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 index 2512b83..ee1657e 100644 --- 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 @@ -2,28 +2,36 @@ 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; +/** + *

+ * ProjectProcessStageEnum + *

+ * + * @author WendyYang + * @since 14:25 2024/2/2 + */ @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,"申请借阅审批流程"); + ORG_INTERNAL_APPROVAL_PROCESS(1, "单位内部审批流程"), + PROJECT_PREQUALIFICATION_APPROVAL_PROCESS(2, "项目预审审批流程"), + DEPARTMENT_JOINT_APPROVAL_PROCESS(3, "部门联合审批流程"), + CONSTRUCTION_PROJECT_APPROVAL_PROCESS(4, "建设方案审批流程"), + PROJECT_RECORD_APPROVAL_PROCESS(8, "立项备案审批流程"), + ACCEPTANCE_DECLARATION_APPROVAL_PROCESS(5, "验收申报审批流程"), + APPLY_DELAY(6, "申请延期审批流程"), + APPLY_BORROW(7, "申请借阅审批流程"); - private Integer code; - private String desc; + private final Integer code; + private final String desc; public static String getDesc(Integer code) { if (Objects.isNull(code)) { @@ -36,4 +44,5 @@ public enum ProjectProcessStageEnum { } return StringUtils.EMPTY; } + } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/HzProjectDeclareAction.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/HzProjectDeclareAction.java index 0b252ac..c54db61 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/HzProjectDeclareAction.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/HzProjectDeclareAction.java @@ -1,10 +1,11 @@ package com.hz.pm.api.common.statemachine.action; +import cn.hutool.core.lang.Assert; import com.hz.pm.api.common.model.constant.StateMachineConst; -import com.hz.pm.api.common.statemachine.builder.ProjectDeclareStateMachineBuilderImpl; +import com.hz.pm.api.common.statemachine.builder.impl.ProjectDeclareStateMachineBuilderImpl; import com.hz.pm.api.common.statemachine.event.ProjectStatusChangeEvent; -import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum; import com.hz.pm.api.projectlib.model.entity.Project; +import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum; import lombok.extern.slf4j.Slf4j; import org.springframework.messaging.Message; import org.springframework.statemachine.annotation.OnTransition; @@ -12,7 +13,7 @@ import org.springframework.statemachine.annotation.WithStateMachine; /** * 项目申报状态机action集合类 - * 市本级 + * * @author CMM * @since 2023/02/08 13:48 */ @@ -22,177 +23,213 @@ public class HzProjectDeclareAction { private static final String PROJECT_DECLARE = StateMachineConst.PROJECT_DECLARE; + private Project getProject(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + Assert.notNull(project, "未获取到需要状态变更的项目信息"); + return project; + } + @OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "PENDING_PREQUALIFICATION") public void UNDER_INTERNAL_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + Project project = getProject(message); 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 project = getProject(message); 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 project = getProject(message); 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 project = getProject(message); 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 project = getProject(message); 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 project = getProject(message); 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 project = getProject(message); 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 project = getProject(message); 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 project = getProject(message); 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 project = getProject(message); 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 project = getProject(message); 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 project = getProject(message); 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 project = getProject(message); 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 project = getProject(message); 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 project = getProject(message); 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 project = getProject(message); 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 project = getProject(message); 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 project = getProject(message); 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 project = getProject(message); 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 project = getProject(message); 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 project = getProject(message); 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 project = getProject(message); 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 project = getProject(message); 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 project = getProject(message); 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 project = getProject(message); 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 project = getProject(message); 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 project = getProject(message); project.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode()); } + //================================================================================================================== + + @OnTransition(source = "DECLARED_APPROVED_TO_BE_RECORD", target = "DECLARED_APPROVED_RECORD_AUDITING") + public void DECLARED_RECORD_SUBMIT(Message message) { + Project project = getProject(message); + // 待立项批复批复后,项目一级状态变更为已立项 + project.setStatus(ProjectStatusEnum.DECLARED_APPROVED_RECORD_AUDITING.getCode()); + } + + @OnTransition(source = "DECLARED_APPROVED_RECORD_FAILED", target = "DECLARED_APPROVED_RECORD_AUDITING") + public void DECLARED_RECORD_RESUBMIT(Message message) { + Project project = getProject(message); + project.setStatus(ProjectStatusEnum.DECLARED_APPROVED_RECORD_AUDITING.getCode()); + } + + @OnTransition(source = "DECLARED_APPROVED_RECORD_AUDITING", target = "TO_BE_PURCHASED") + public void DECLARED_RECORD_PASS(Message message) { + Project project = getProject(message); + // 待立项批复批复后,项目一级状态变更为已立项 + project.setStage(ProjectStatusEnum.PROJECT_APPROVED.getCode()); + project.setStatus(ProjectStatusEnum.TO_BE_PURCHASED.getCode()); + } + + @OnTransition(source = "DECLARED_APPROVED_RECORD_AUDITING", target = "DECLARED_APPROVED_RECORD_FAILED") + public void DECLARED_RECORD_FAILED(Message message) { + Project project = getProject(message); + project.setStatus(ProjectStatusEnum.DECLARED_APPROVED_RECORD_FAILED.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 project = getProject(message); // 待立项批复批复后,项目一级状态变更为已立项 project.setStage(ProjectStatusEnum.PROJECT_APPROVED.getCode()); project.setStatus(ProjectStatusEnum.TO_BE_PURCHASED.getCode()); @@ -200,25 +237,25 @@ public class HzProjectDeclareAction { @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 project = getProject(message); 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 project = getProject(message); 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 project = getProject(message); 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 project = getProject(message); // 待采购状态撤回后,项目一级状态回退到未立项 project.setStage(ProjectStatusEnum.NOT_APPROVED.getCode()); project.setStatus(ProjectStatusEnum.TO_BE_APPROVED.getCode()); @@ -227,33 +264,33 @@ public class HzProjectDeclareAction { @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 project = getProject(message); 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 project = getProject(message); 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 project = getProject(message); 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 project = getProject(message); 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 project = getProject(message); // 终验审核通过后,项目一级状态变更为已归档 project.setStage(ProjectStatusEnum.ARCHIVED.getCode()); project.setStatus(ProjectStatusEnum.ACCEPTED.getCode()); @@ -261,19 +298,20 @@ public class HzProjectDeclareAction { @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 project = getProject(message); 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 project = getProject(message); 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 project = getProject(message); 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/ProjectDeclareStateMachineBuilderImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/impl/ProjectDeclareStateMachineBuilderImpl.java similarity index 92% rename from hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/ProjectDeclareStateMachineBuilderImpl.java rename to hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/impl/ProjectDeclareStateMachineBuilderImpl.java index 0bda86b..edade1e 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/ProjectDeclareStateMachineBuilderImpl.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/impl/ProjectDeclareStateMachineBuilderImpl.java @@ -1,6 +1,7 @@ -package com.hz.pm.api.common.statemachine.builder; +package com.hz.pm.api.common.statemachine.builder.impl; import com.hz.pm.api.common.statemachine.action.ProjectDeclareChoiceAction; +import com.hz.pm.api.common.statemachine.builder.ProjectDeclareStateMachineBuilder; import com.hz.pm.api.common.statemachine.event.ProjectStatusChangeEvent; import com.hz.pm.api.common.statemachine.factory.ProjectDeclareGuardFactory.PendingPreQualificationChoiceGuard; import com.hz.pm.api.projectlib.model.entity.Project; @@ -89,7 +90,6 @@ public class ProjectDeclareStateMachineBuilderImpl implements ProjectDeclareStat .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS) .target(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) .event(ProjectStatusChangeEvent.UNDER_INTERNAL_REJECT_RESUBMIT).and() - // 待预审预审申报,从待预审到待预审选择 .withExternal() .source(ProjectStatusEnum.PENDING_PREQUALIFICATION) @@ -203,6 +203,23 @@ public class ProjectDeclareStateMachineBuilderImpl implements ProjectDeclareStat .source(ProjectStatusEnum.SCHEME_REVIEW_FAILED) .target(ProjectStatusEnum.SCHEME_UNDER_REVIEW) .event(ProjectStatusChangeEvent.PLAN_REVIEW_REJECT_RESUBMIT).and() + // 立项备案 + .withExternal() + .source(ProjectStatusEnum.DECLARED_APPROVED_TO_BE_RECORD) + .target(ProjectStatusEnum.DECLARED_APPROVED_RECORD_AUDITING) + .event(ProjectStatusChangeEvent.DECLARED_RECORD_SUBMIT).and() + .withExternal() + .source(ProjectStatusEnum.DECLARED_APPROVED_RECORD_FAILED) + .target(ProjectStatusEnum.DECLARED_APPROVED_RECORD_AUDITING) + .event(ProjectStatusChangeEvent.DECLARED_RECORD_RESUBMIT).and() + .withExternal() + .source(ProjectStatusEnum.DECLARED_APPROVED_RECORD_AUDITING) + .target(ProjectStatusEnum.TO_BE_PURCHASED) + .event(ProjectStatusChangeEvent.DECLARED_RECORD_PASS).and() + .withExternal() + .source(ProjectStatusEnum.DECLARED_APPROVED_RECORD_AUDITING) + .source(ProjectStatusEnum.DECLARED_APPROVED_RECORD_FAILED) + .event(ProjectStatusChangeEvent.DECLARED_RECORD_FAILED).and() // 待立项批复批复,从待立项批复到待采购 .withExternal() .source(ProjectStatusEnum.TO_BE_APPROVED) 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 index 6a9499c..72d23ce 100644 --- 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 @@ -26,7 +26,7 @@ public enum ProjectStatusChangeEvent { /** * 项目申报提交(项目状态进入:单位内部审核中) */ - PROJECT_APPLICATION_SUBMIT( ProjectStatusEnum.TO_BE_DECLARED.getCode(), null, null), + PROJECT_APPLICATION_SUBMIT(ProjectStatusEnum.TO_BE_DECLARED.getCode(), null, null), /** * 单位内部审核驳回(项目状态进入:单位内部审核不通过) */ @@ -38,7 +38,7 @@ public enum ProjectStatusChangeEvent { /** * 单位内部审核不通过重新提交(项目状态进入:单位内部审核中) */ - UNDER_INTERNAL_REJECT_RESUBMIT(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS.getCode(),null,null), + UNDER_INTERNAL_REJECT_RESUBMIT(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS.getCode(), null, null), /** * 预审申报(项目状态进入:待预审选择,有判断条件:市级项目且申报金额大于1000万项目状态变为:省级部门联审中;否则项目状态变为:预审中) @@ -64,7 +64,7 @@ public enum ProjectStatusChangeEvent { /** * 预审不通过重新提交(项目状态变为:待预审选择) */ - PRELIMINARY_REVIEW_REJECT_RESUBMIT(ProjectStatusEnum.PREQUALIFICATION_FAILED.getCode(),null,null), + PRELIMINARY_REVIEW_REJECT_RESUBMIT(ProjectStatusEnum.PREQUALIFICATION_FAILED.getCode(), null, null), /** * 预审通过(项目状态变为:部门联审中) */ @@ -88,7 +88,7 @@ public enum ProjectStatusChangeEvent { /** * 申报方案(项目状态变为:方案评审中) */ - DECLARE_PLAN( ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode(), null, null), + DECLARE_PLAN(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode(), null, null), /** * 方案评审驳回(项目状态变为:方案评审不通过) */ @@ -96,11 +96,36 @@ public enum ProjectStatusChangeEvent { /** * 方案评审不通过重新提交(项目状态变为:方案评审中) */ - PLAN_REVIEW_REJECT_RESUBMIT(ProjectStatusEnum.SCHEME_REVIEW_FAILED.getCode(),null,null), + PLAN_REVIEW_REJECT_RESUBMIT(ProjectStatusEnum.SCHEME_REVIEW_FAILED.getCode(), null, null), /** * 方案评审通过(项目状态变为:待立项批复) */ PLAN_REVIEW_PASS(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode(), null, null), + + //立项备案=========================================================================================================== + + /** + * 立项备案提交 + */ + DECLARED_RECORD_SUBMIT(ProjectStatusEnum.DECLARED_APPROVED_TO_BE_RECORD.getCode(), null, null), + + /** + * 立项备案重新提交 + */ + DECLARED_RECORD_RESUBMIT(ProjectStatusEnum.DECLARED_APPROVED_RECORD_FAILED.getCode(), null, null), + + /** + * 立项备案通过 + */ + DECLARED_RECORD_PASS(ProjectStatusEnum.DECLARED_APPROVED_RECORD_AUDITING.getCode(), null, null), + + /** + * 立项备案不通过 + */ + DECLARED_RECORD_FAILED(null, ProjectStatusEnum.DECLARED_APPROVED_RECORD_FAILED.getCode(), null), + + //================================================================================================================== + /** * 立项批复(项目状态变为:已立项-待采购) */ @@ -118,7 +143,7 @@ public enum ProjectStatusChangeEvent { /** * 开工 到建设中 */ - START_TO_WORK(ProjectStatusEnum.OPERATION.getCode(), null,null), + START_TO_WORK(ProjectStatusEnum.OPERATION.getCode(), null, null), /** * 初验备案(项目状态变为:待终验) */ 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 index 0e0686a..20a6a21 100644 --- 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 @@ -6,6 +6,7 @@ import com.alibaba.fastjson.JSONArray; import com.hz.pm.api.projectlib.model.enumeration.ProjectTypeNewEnum; import com.ningdatech.basic.util.StrPool; import com.ningdatech.file.entity.vo.result.FileResultVO; +import liquibase.pro.packaged.O; import org.apache.commons.lang3.StringUtils; import org.springframework.util.NumberUtils; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/util/DecimalUtil.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/util/DecimalUtil.java new file mode 100644 index 0000000..de08485 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/util/DecimalUtil.java @@ -0,0 +1,81 @@ +package com.hz.pm.api.common.util; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.util.ArrayUtil; + +import java.math.BigDecimal; +import java.math.RoundingMode; +import java.util.Arrays; +import java.util.Collection; +import java.util.Comparator; +import java.util.function.Function; + +/** + *

+ * DecimalUtil + *

+ * + * @author WendyYang + * @since 18:53 2024/2/21 + */ +public class DecimalUtil { + + private DecimalUtil() { + } + + @SafeVarargs + public static BigDecimal sum(Collection objs, Function... functions) { + if (CollUtil.isEmpty(objs) || ArrayUtil.isEmpty(functions)) { + return BigDecimal.ZERO; + } + return objs.stream() + .map(w -> Arrays.stream(functions) + .map(f -> f.apply(w)) + .reduce(BigDecimal::add) + .orElse(BigDecimal.ZERO)) + .reduce(BigDecimal::add) + .orElse(BigDecimal.ZERO); + + } + + public static BigDecimal avg(Collection objs, Function function) { + if (CollUtil.isEmpty(objs)) { + return BigDecimal.ZERO; + } + BigDecimal size = BigDecimal.valueOf(objs.size()); + return objs.stream() + .map(function) + .reduce(BigDecimal::add) + .orElse(BigDecimal.ZERO) + .divide(size, RoundingMode.HALF_UP); + } + + public static BigDecimal max(Collection objs, Function function) { + if (CollUtil.isEmpty(objs)) { + return BigDecimal.ZERO; + } + return objs.stream().map(function).max(BigDecimal::compareTo).orElse(BigDecimal.ZERO); + } + + public static BigDecimal min(Collection objs, Function function) { + if (CollUtil.isEmpty(objs)) { + return BigDecimal.ZERO; + } + return objs.stream().map(function).min(BigDecimal::compareTo).orElse(BigDecimal.ZERO); + } + + public static T objByMax(Collection objs, Function function) { + if (CollUtil.isEmpty(objs)) { + return null; + } + return objs.stream().max(Comparator.comparing(function)).orElse(null); + } + + public static T objByMin(Collection objs, Function function) { + if (CollUtil.isEmpty(objs)) { + return null; + } + return objs.stream().min(Comparator.comparing(function)).orElse(null); + } + +} 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/DictUtil.java similarity index 96% rename from hz-pm-api/src/main/java/com/hz/pm/api/common/util/DictUtils.java rename to hz-pm-api/src/main/java/com/hz/pm/api/common/util/DictUtil.java index 41c5262..7c96d42 100644 --- 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/DictUtil.java @@ -10,9 +10,9 @@ import java.util.List; * @author liuxinxin * @date 2022/7/28 下午2:14 */ -public class DictUtils { +public class DictUtil { - private DictUtils() { + private DictUtil() { } public static Boolean isValueEquals(List list1, List list2) { diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/util/ExpertRegionInfoUtil.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/util/ExpertRegionInfoUtil.java new file mode 100644 index 0000000..8046ada --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/util/ExpertRegionInfoUtil.java @@ -0,0 +1,65 @@ +package com.hz.pm.api.common.util; + +import cn.hutool.core.collection.CollUtil; +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 java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; + +/** + * @author liuxinxin + * @since 2022/7/28 下午4:33 + */ + +public class ExpertRegionInfoUtil { + + private ExpertRegionInfoUtil() { + } + + public static ExpertRegionModifyDiffBO diff(List preRegions, List currRegions) { + ExpertRegionModifyDiffBO diff = new ExpertRegionModifyDiffBO(); + List addList = new ArrayList<>(); + List removeList = new ArrayList<>(); + if (CollUtil.isEmpty(preRegions) && CollUtil.isEmpty(currRegions)) { + diff.setAddList(addList); + diff.setRemoveList(removeList); + } else if (CollUtil.isEmpty(preRegions)) { + diff.setAddList(currRegions); + diff.setRemoveList(removeList); + } else if (CollUtil.isEmpty(currRegions)) { + diff.setAddList(addList); + diff.setRemoveList(preRegions); + } else { + List preRegionMapKey = convert(preRegions); + List currRegionMapKey = convert(currRegions); + removeList.addAll(notContains(currRegionMapKey, preRegionMapKey)); + addList.addAll(notContains(preRegionMapKey, currRegionMapKey)); + diff.setAddList(addList); + diff.setRemoveList(removeList); + } + return diff; + + } + + private static List notContains(List source, List target) { + return target.stream().filter(w -> !source.contains(w)).map(key -> { + ExpertRegionInfo expertRegionInfo = new ExpertRegionInfo(); + expertRegionInfo.setRegionCode(key.getRegionCode()); + expertRegionInfo.setRegionLevel(key.getRegionLevel()); + return expertRegionInfo; + }).collect(Collectors.toList()); + } + + private static List convert(List regionInfos) { + return regionInfos.stream().map(r -> { + RegionDtoMapKey regionDtoMapKey = new RegionDtoMapKey(); + regionDtoMapKey.setRegionLevel(r.getRegionLevel()); + regionDtoMapKey.setRegionCode(r.getRegionCode()); + return regionDtoMapKey; + }).collect(Collectors.toList()); + } + +} 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 deleted file mode 100644 index 97923ec..0000000 --- a/hz-pm-api/src/main/java/com/hz/pm/api/common/util/ExpertRegionInfoUtils.java +++ /dev/null @@ -1,73 +0,0 @@ -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 deleted file mode 100644 index 124150f..0000000 --- a/hz-pm-api/src/main/java/com/hz/pm/api/common/util/ExpertRegisterUtil.java +++ /dev/null @@ -1,268 +0,0 @@ -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.DictTypeEnum; -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.LocalDate; -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.listDictByDictType(DictTypeEnum.POLITICAL.getKey()); - if (!politicalDicts.isEmpty()) { - politicalDicts.stream() - .filter(dict -> dict.getName().equals(political)) - .findFirst().ifPresent(dictionary -> { - DictFieldInfoDTO dict = new DictFieldInfoDTO(); - 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(LocalDate.now()); - eduInfo.setEdu(new ArrayList<>()); - eduInfo.setDegree(new ArrayList<>()); - // 学历 - String eduStr = MapUtil.getStr(w, "学历"); - List eduDicts = dictionaryCache.listDictByDictType(DictTypeEnum.EDU.getKey()); - if (!eduDicts.isEmpty()) { - eduDicts.stream() - .filter(dict -> dict.getName().equals(eduStr)) - .findFirst().ifPresent(dictionary -> { - DictFieldInfoDTO dict = new DictFieldInfoDTO(); - dict.setDictionaryName(dictionary.getName()); - dict.setDictionaryCode(dictionary.getDictionaryCode()); - dict.setDictionaryFieldName(dictionary.getDictionaryType()); - eduInfo.getEdu().add(dict); - }); - } - // 学位 - String degreeStr = MapUtil.getStr(w, "学位"); - List degreeDicts = dictionaryCache.listDictByDictType(DictTypeEnum.DEGREE.getKey()); - if (!degreeDicts.isEmpty()) { - degreeDicts.stream() - .filter(dict -> dict.getName().equals(degreeStr)) - .findFirst().ifPresent(dictionary -> { - DictFieldInfoDTO dict = new DictFieldInfoDTO(); - 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.listDictByDictType(DictTypeEnum.ADMINISTRATIVE_RANK.getKey()); - if (!administrativeRankDicts.isEmpty()) { - administrativeRankDicts.stream() - .filter(dict -> dict.getName().equals(administrativeRankStr)) - .findFirst().ifPresent(dictionary -> { - DictFieldInfoDTO dict = new DictFieldInfoDTO(); - 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.listDictByDictType(DictTypeEnum.COMPANY_ATTRIBUTE.getKey()); - if (!companyTypeDicts.isEmpty()) { - companyTypeDicts.stream() - .filter(dict -> dict.getName().equals(companyTypeStr)) - .findFirst().ifPresent(dictionary -> { - DictFieldInfoDTO dict = new DictFieldInfoDTO(); - 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.getNameTagMap(); - 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.listDictByDictType(DictTypeEnum.TITLE_LEVEL.getKey()); - if (!titleLevelDicts.isEmpty()) { - titleLevelDicts.stream() - .filter(dict -> dict.getName().equals(titleLevel)) - .findFirst().ifPresent(dictionary -> { - DictFieldInfoDTO dict = new DictFieldInfoDTO(); - 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<>()); - 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/Md5Utils.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/util/Md5Util.java similarity index 90% rename from hz-pm-api/src/main/java/com/hz/pm/api/common/util/Md5Utils.java rename to hz-pm-api/src/main/java/com/hz/pm/api/common/util/Md5Util.java index ebb2039..209c821 100644 --- 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/Md5Util.java @@ -6,12 +6,20 @@ import org.slf4j.LoggerFactory; import java.nio.charset.StandardCharsets; import java.security.MessageDigest; -public class Md5Utils { +/** + *

+ * Md5Utils + *

+ * + * @author WendyYang + * @since 19:21 2024/2/21 + */ +public class Md5Util { - private Md5Utils() { + private Md5Util() { } - private static final Logger LOGGER = LoggerFactory.getLogger(Md5Utils.class); + private static final Logger LOGGER = LoggerFactory.getLogger(Md5Util.class); public static byte[] md5(String s) { MessageDigest algorithm; 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 index 8d8a4fd..01ce8df 100644 --- 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 @@ -24,7 +24,7 @@ public class RefreshKeyUtil { // 刷新秘钥 HttpUtil httpUtil = HttpUtil.getInstance(); log.info("请求密钥" + appSecret); - String sign = Md5Utils.hash (appKey + appSecret + requestTime); + String sign = Md5Util.hash (appKey + appSecret + requestTime); String refreshUrl = "http://interface.zjzwfw.gov.cn/gateway/app/refreshTokenByKey.htm"; log.info(refreshUrl); Map map = new HashMap<>(); @@ -44,7 +44,7 @@ public class RefreshKeyUtil { // 刷新秘钥 HttpUtil httpUtil = HttpUtil.getInstance(); log.info("刷新密钥" + refreshSecret); - String refreshSign = Md5Utils.hash (appKey + refreshSecret + requestTime); + String refreshSign = Md5Util.hash (appKey + refreshSecret + requestTime); String refreshUrl = "http://interface.zjzwfw.gov.cn/gateway/app/refreshTokenBySec.htm"; log.info(refreshUrl); Map map = new HashMap<>(); 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/RegionUtil.java similarity index 95% rename from hz-pm-api/src/main/java/com/hz/pm/api/common/util/RegionUtils.java rename to hz-pm-api/src/main/java/com/hz/pm/api/common/util/RegionUtil.java index 29f67a0..88bab3e 100644 --- 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/RegionUtil.java @@ -8,11 +8,11 @@ import java.util.List; /** * @author liuxinxin - * @date 2022/7/28 下午2:27 + * @since 2022/7/28 下午2:27 */ -public class RegionUtils { +public class RegionUtil { - private RegionUtils() { + private RegionUtil() { } public static Boolean isValueEquals(ExpertRegionInfo regionInfo1, ExpertRegionInfo regionInfo2) { 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 deleted file mode 100644 index 6d6e2ef..0000000 --- a/hz-pm-api/src/main/java/com/hz/pm/api/common/util/SendWorkNoticeUtil.java +++ /dev/null @@ -1,73 +0,0 @@ -package com.hz.pm.api.common.util; - -import com.hz.pm.api.todocenter.bean.entity.WorkNoticeInfo; -import com.ningdatech.basic.model.GenericResult; -import com.ningdatech.zwdd.client.ZwddClient; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; -import org.springframework.stereotype.Component; - -import java.util.concurrent.CompletableFuture; -import java.util.concurrent.ExecutionException; -import java.util.concurrent.ThreadPoolExecutor; - -/** - * 异步发送工作通知工具类 - * - * @author CMM - * @since 2023/02/23 13:50 - */ -@Slf4j -@Component -@RequiredArgsConstructor -public class SendWorkNoticeUtil { - - private final ZwddClient zwddClient; - - /** - * 初始化线程池 - */ - public static final ThreadPoolTaskExecutor EXECUTOR; - - static { - EXECUTOR = new ThreadPoolTaskExecutor(); - EXECUTOR.setCorePoolSize(2); - EXECUTOR.setMaxPoolSize(4); - EXECUTOR.setQueueCapacity(200); - EXECUTOR.setKeepAliveSeconds(120); - EXECUTOR.setThreadNamePrefix("sendWorkNotice-"); - EXECUTOR.setWaitForTasksToCompleteOnShutdown(true); - EXECUTOR.setRejectedExecutionHandler(new ThreadPoolExecutor.AbortPolicy()); - EXECUTOR.initialize(); - } - - 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 "发送工作通知成功!"; - }, EXECUTOR); - try { - future.get(); - } catch (InterruptedException | ExecutionException e) { - log.error("获取异步线程处理结果失败!", e); - Thread.currentThread().interrupt(); - } - return Boolean.TRUE; - } - -} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/util/TagUtil.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/util/TagUtil.java new file mode 100644 index 0000000..ea012f3 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/util/TagUtil.java @@ -0,0 +1,46 @@ +package com.hz.pm.api.common.util; + +import cn.hutool.core.collection.CollUtil; +import com.hz.pm.api.expert.model.TagFieldInfo; +import org.apache.commons.collections4.CollectionUtils; + +import java.util.Comparator; +import java.util.List; + +/** + * @author liuxinxin + * @since 2022/7/28 下午2:14 + */ +public class TagUtil { + + private TagUtil() { + } + + private static final Comparator COMPARATOR = Comparator.comparing(TagFieldInfo::getTagFieldName) + .thenComparing(TagFieldInfo::getTagCode); + + public static Boolean isValEq(List list1, List list2) { + if (CollUtil.isEmpty(list1) && CollUtil.isEmpty(list2)) { + return true; + } + + boolean collStatusNotEq = (CollUtil.isEmpty(list1) && CollUtil.isNotEmpty(list2)) + || (CollUtil.isEmpty(list2) && CollUtil.isNotEmpty(list1)); + if (collStatusNotEq) { + return false; + } + if (list1.size() != list2.size()) { + return false; + } + list1.sort(COMPARATOR); + list2.sort(COMPARATOR); + + 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/TagUtils.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/util/TagUtils.java deleted file mode 100644 index f64aa72..0000000 --- a/hz-pm-api/src/main/java/com/hz/pm/api/common/util/TagUtils.java +++ /dev/null @@ -1,42 +0,0 @@ -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/expert/model/SensitiveModifySegment.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/SensitiveModifySegment.java index 6727739..a0e2227 100644 --- 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 @@ -1,10 +1,10 @@ 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.DictUtil; +import com.hz.pm.api.common.util.RegionUtil; import com.hz.pm.api.common.util.StrUtils; -import com.hz.pm.api.common.util.TagUtils; +import com.hz.pm.api.common.util.TagUtil; import com.hz.pm.api.expert.constant.ExpertSensitiveFieldTypeEnum; import com.hz.pm.api.expert.constant.ExpertUserInfoSensitiveFieldEnum; import com.hz.pm.api.meta.model.ExpertRegionInfo; @@ -55,19 +55,19 @@ public class SensitiveModifySegment { } case administrative_rank: case title_level: { - return DictUtils.isValueEquals((List) this.original + return DictUtil.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); + return TagUtil.isValEq((List) this.original, (List) this.apply); } case expert_region: - return RegionUtils.isValueEquals((ExpertRegionInfo) this.original, (ExpertRegionInfo) this.apply); + return RegionUtil.isValueEquals((ExpertRegionInfo) this.original, (ExpertRegionInfo) this.apply); case expert_intention_work_region: - return RegionUtils.isValueEquals((List) this.original, (List) this.apply); + return RegionUtil.isValueEquals((List) this.original, (List) this.apply); default: return Objects.equals(this.original, this.apply); } 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 index daa8693..2b2e961 100644 --- 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 @@ -2,6 +2,7 @@ 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.ObjectUtil; import cn.hutool.core.util.PhoneUtil; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; @@ -9,7 +10,7 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; 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.ExpertRegionInfoUtil; import com.hz.pm.api.common.util.GzipUtil; import com.hz.pm.api.expert.assembler.ExpertUserInfoAssembler; import com.hz.pm.api.expert.constant.ExpertApplyStatusEnum; @@ -543,7 +544,7 @@ public class ExpertInfoServiceImpl implements ExpertInfoService { SensitiveModifySegment segment = expertIntentionFieldSegmentList.get(0); List apply = (List) segment.getApply(); List original = (List) segment.getOriginal(); - ExpertRegionModifyDiffBO expertRegionModifyDiffBO = ExpertRegionInfoUtils.modifyDiff(original, apply); + ExpertRegionModifyDiffBO expertRegionModifyDiffBO = ExpertRegionInfoUtil.diff(original, apply); List addList = expertRegionModifyDiffBO.getAddList(); List removeList = expertRegionModifyDiffBO.getRemoveList(); @@ -571,7 +572,7 @@ public class ExpertInfoServiceImpl implements ExpertInfoService { @Transactional(rollbackFor = Exception.class) public Long createExpertInfoModifyApply(List expertSensitiveInfoFieldSegmentList , ExpertUserFullInfo originalExpertUserFullInfo, ModifyApplyExtraInfoDTO modifyApplyExtraInfo) { - expertSensitiveInfoFieldSegmentList = expertSensitiveInfoFieldSegmentList.stream().filter(r -> !r.isValueEquals()).collect(Collectors.toList()); + expertSensitiveInfoFieldSegmentList.removeIf(SensitiveModifySegment::isValueEquals); String compressedModifyJsonStr = GzipUtil.zip(JSONObject.toJSONString(expertSensitiveInfoFieldSegmentList)); ExpertMetaApply expertMetaApply = new ExpertMetaApply(); @@ -629,9 +630,9 @@ public class ExpertInfoServiceImpl implements ExpertInfoService { /** * 创建层级变更审核 * - * @param expertRegionFieldSegmentList - * @param originalExpertUserFullInfo - * @param modifyApplyExtraInfo + * @param expertRegionFieldSegmentList \ + * @param originalExpertUserFullInfo \ + * @param modifyApplyExtraInfo \ */ private Long createExpertRegionModifyApply(List expertRegionFieldSegmentList , ExpertUserFullInfo originalExpertUserFullInfo, ModifyApplyExtraInfoDTO modifyApplyExtraInfo) { diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/external/MhFileClient.java b/hz-pm-api/src/main/java/com/hz/pm/api/external/MhFileClient.java index b94d852..b145f2c 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/external/MhFileClient.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/external/MhFileClient.java @@ -30,7 +30,7 @@ import java.util.List; @RequiredArgsConstructor public class MhFileClient { - private static final int TIMEOUT_MILLS = 5000; + private static final int TIMEOUT_MILLS = 10000; @Value("${mh.file.down-url:}") private String fileDownUrl; @@ -43,7 +43,7 @@ public class MhFileClient { try (ServletOutputStream stream = response.getOutputStream()) { long size = HttpUtil.download(fileUrl, stream, true); log.info("下载文件:{},大小为:{}", fileId, size); - } catch (IOException e) { + } catch (Exception e) { log.error("信创平台文件下载异常:{}", fileId, e); throw BizException.wrap("下载文件失败"); } @@ -51,14 +51,18 @@ public class MhFileClient { public List listFileInfo(String fileIds) { String url = fileDetailUrl + "?ids=" + fileIds; - String body = HttpUtil.get(url, TIMEOUT_MILLS); - MhRetDTO> ret = JSONUtil.toBean(body, - new TypeReference>>() { - }, false); - if (ret.isOk()) { - return ret.getData(); + try { + String body = HttpUtil.get(url, TIMEOUT_MILLS); + MhRetDTO> ret = JSONUtil.toBean(body, + new TypeReference>>() { + }, false); + if (ret.isOk()) { + return ret.getData(); + } + throw BizException.wrap("获取文件详情失败"); + } catch (Exception e) { + throw BizException.wrap("获取文件详情失败"); } - throw BizException.wrap("获取文件详情"); } } 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 index ce5ce57..4b150a5 100644 --- 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 @@ -50,7 +50,7 @@ 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.todocenter.constant.WorkNoticeConst; import com.hz.pm.api.user.helper.MhUnitCache; import com.hz.pm.api.user.model.dto.UnitDTO; import com.hz.pm.api.user.security.model.UserFullInfoDTO; @@ -230,7 +230,7 @@ public class ProjectFileManage { List processDetailVos = projectLibManage.processScheduleDetail(projectId); ProjectReviewDetailVO projectReviewDetailVo = expertReviewManage.projectExpertReviewDetail(projectCode); List purchaseVos = purchaseManage.detailByProjectId(projectId); - ContractVO contractVo = constructionManage.detailContractByProjectId(projectId); + List contractVos = constructionManage.detailContractByProjectId(projectId); PreInsVO preInsVo = constructionManage.detailPreInsByProjectId(projectId); FinalAcceptanceVO finalAcceptanceVo = finalAcceptanceManage.detailByProjectId(projectId); @@ -238,7 +238,7 @@ public class ProjectFileManage { projectFileVo.setProcessDetailVos(processDetailVos); projectFileVo.setProjectReviewDetailVo(projectReviewDetailVo); projectFileVo.setPurchaseVos(purchaseVos); - projectFileVo.setContractVo(contractVo); + projectFileVo.setContractVos(contractVos); projectFileVo.setPreInsVo(preInsVo); projectFileVo.setFinalAcceptanceVo(finalAcceptanceVo); @@ -277,7 +277,7 @@ public class ProjectFileManage { projectLibManage.saveProjectByApplyBorrow(project, user, instanceId); // 发送给第一个审批人消息 - noticeManage.sendFirstUser(project, model.getFormName(), instanceId, WorkNoticeConstant.PASS_MSG_TEMPLATE, + noticeManage.sendFirstUser(project, model.getFormName(), instanceId, WorkNoticeConst.PASS_MSG_TEMPLATE, MsgTypeEnum.PROJECT_REVIEW); return instanceId; 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 index d8249eb..77b1c5a 100644 --- 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 @@ -36,7 +36,7 @@ public class ProjectFileVO { private List purchaseVos; @ApiModelProperty("合同登记详情") - private ContractVO contractVo; + private List contractVos; @ApiModelProperty("初验登记详情") private PreInsVO preInsVo; 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 index bfcba48..02e85e5 100644 --- 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 @@ -307,14 +307,6 @@ public class ProjectConvertUtil { //转化采购信息 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(); @@ -332,10 +324,6 @@ public class ProjectConvertUtil { 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; 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 index 4c68509..9a2fa6c 100644 --- 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 @@ -2,9 +2,9 @@ package com.hz.pm.api.projectdeclared.controller; 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.PaymentPlanSupplementDTO; import com.hz.pm.api.projectdeclared.model.dto.PreInsSaveDTO; +import com.hz.pm.api.projectdeclared.model.req.SubmitConstructionReq; 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; @@ -56,17 +56,17 @@ public class ConstructionController { ExcelDownUtil.downXls(response, req, constructionManage::exportList); } - @ApiOperation(value = "合同备案的详情-通过项目ID", notes = "合同备案的详情-通过项目ID") + @ApiOperation(value = "合同备案的详情") @GetMapping("/contract/detail/{projectId}") - public ContractVO detailContractByProjectId(@PathVariable Long projectId) { + public List detailContractByProjectId(@PathVariable Long projectId) { return constructionManage.detailContractByProjectId(projectId); } - @ApiOperation(value = "填写合同信息", notes = "填写合同信息") + @ApiOperation(value = "填写合同信息") @WebLog("填写合同信息") @PostMapping("/submit-contract") - public String submitContract(@Validated @RequestBody ContractSaveDTO dto) { - return constructionManage.submitContract(dto); + public String submitContract(@Validated @RequestBody SubmitConstructionReq req) { + return constructionManage.submitPurchaseContract(req); } @ApiOperation(value = "补充实际支付金额", notes = "补充实际支付金额") 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 index d2c4527..91cc12f 100644 --- 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 @@ -2,6 +2,7 @@ package com.hz.pm.api.projectdeclared.controller; import javax.servlet.http.HttpServletResponse; +import com.hz.pm.api.projectdeclared.model.enumerization.ProjectDraftTypeEnum; import com.ningdatech.log.annotation.WebLog; import com.hz.pm.api.gov.manage.GovProjectCollectionManage; import org.springframework.validation.annotation.Validated; @@ -52,13 +53,19 @@ public class DeclaredProjectController { @RequestParam(required = false) Integer pageSize, @RequestParam(required = false) Integer pageNumber, @RequestParam(required = false) String orgCode) { - return declaredProjectManage.bizList(businessName,pageSize,pageNumber,orgCode); + return declaredProjectManage.bizList(businessName, pageSize, pageNumber, orgCode); } @ApiOperation(value = "申报项目草稿箱列表", notes = "申报项目草稿箱列表") @GetMapping("/draft") public PageVo draft(@ModelAttribute DeclaredProjectListParamDTO params) { - return declaredProjectManage.pageDraft(params); + return declaredProjectManage.pageDraft(params, ProjectDraftTypeEnum.PROJECT_DECLARED.getCode()); + } + + @ApiOperation(value = "立项备案草稿箱列表", notes = "立项备案草稿箱列表") + @GetMapping("/declaredRecord/draft") + public PageVo declaredRecordDraft(@ModelAttribute DeclaredProjectListParamDTO params) { + return declaredProjectManage.pageDraft(params, ProjectDraftTypeEnum.DECLARED_RECORD.getCode()); } @ApiOperation(value = "申报项目草稿箱详情", notes = "申报项目草稿箱详情") @@ -71,7 +78,14 @@ public class DeclaredProjectController { @WebLog("申报项目保存至草稿箱") @PostMapping("/save-to-draft") public Object saveToDraft(@Validated @RequestBody ProjectDraftSaveDTO dto) { - return declaredProjectManage.saveToDraft(dto); + return declaredProjectManage.saveToDraft(dto, ProjectDraftTypeEnum.PROJECT_DECLARED.getCode()); + } + + @ApiOperation(value = "立项备案保存至草稿箱", notes = "立项备案保存至草稿箱") + @WebLog("立项备案保存至草稿箱") + @PostMapping("/declaredRecord/save-to-draft") + public Object declaredRecordSaveToDraft(@Validated @RequestBody ProjectDraftSaveDTO dto) { + return declaredProjectManage.saveToDraft(dto, ProjectDraftTypeEnum.DECLARED_RECORD.getCode()); } @ApiOperation(value = "申报项目", notes = "申报项目") @@ -92,14 +106,14 @@ public class DeclaredProjectController { @GetMapping("/export") @ApiOperation("申报项目列表导出") @WebLog("申报项目列表导出") - public void exportList(ProjectListReq req, HttpServletResponse response){ - ExcelDownUtil.downXls(response,req,declaredProjectManage::exportList); + public void exportList(ProjectListReq req, HttpServletResponse response) { + ExcelDownUtil.downXls(response, req, declaredProjectManage::exportList); } @PostMapping("/remove/{projectCode}") @ApiOperation("申报项目删除-预审失败") @WebLog("申报项目删除-预审失败") - public String remove(@PathVariable String projectCode){ + 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/OperationController.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/controller/OperationController.java index 41d3300..fc620d0 100644 --- 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 @@ -1,8 +1,8 @@ package com.hz.pm.api.projectdeclared.controller; +import com.hz.pm.api.projectdeclared.model.dto.OperationReq; 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; @@ -11,6 +11,8 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; +import java.util.List; + /** * @Classname OperationController * @Description 申报项目-实施 @@ -28,14 +30,14 @@ public class OperationController { @ApiOperation(value = "实施详情", notes = "实施详情") @GetMapping("/detail/{projectId}") - public OperationVO detail(@PathVariable Long projectId) { + public List detail(@PathVariable Long projectId) { return operationManage.detail(projectId); } @PostMapping("/push-operation") @ApiOperation("填写实施计划") @WebLog("填写实施计划") - public String pushOperation(@RequestBody OperationDTO operation) { + public String pushOperation(@RequestBody OperationReq operation) { return operationManage.pushOperation(operation); } 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 index e6ebb49..0c99307 100644 --- 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 @@ -1,5 +1,6 @@ package com.hz.pm.api.projectdeclared.controller; +import cn.hutool.core.io.FileUtil; import com.hz.pm.api.common.util.ExcelDownUtil; import com.hz.pm.api.projectdeclared.manage.ProjectAdjustmentManage; import com.hz.pm.api.projectdeclared.model.dto.DefaultDeclaredDTO; @@ -15,6 +16,9 @@ import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletResponse; +import java.io.File; +import java.util.Comparator; +import java.util.List; /** * @Classname ConstructionPlanController @@ -52,4 +56,5 @@ public class ProjectAdjustmentController { 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 index 1a0f07e..0387251 100644 --- 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 @@ -1,14 +1,15 @@ 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.req.SubmitPurchaseRecordReq; +import com.hz.pm.api.projectdeclared.model.req.SubmitPurchaseNoticeReq; 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 com.ningdatech.basic.model.PageVo; +import com.ningdatech.log.annotation.WebLog; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; @@ -34,8 +35,6 @@ import java.util.List; public class PurchaseController { private final PurchaseManage purchaseManage; - private final ProjectAdjustmentManage projectAdjustmentManage; - @ApiOperation(value = "待采购结果备案列表", notes = "待采购结果备案列表") @GetMapping("/project-list") public PageVo projectlist(@ModelAttribute ProjectListReq req) { @@ -62,4 +61,18 @@ public class PurchaseController { return purchaseManage.submitResult(dto); } + @ApiOperation("发布采购公告") + @WebLog("发布采购公告") + @PostMapping("/notice/submit") + public void submitPurchaseNotice(@RequestBody SubmitPurchaseNoticeReq req) { + purchaseManage.submitPurchaseNotice(req); + } + + @ApiOperation("采购信息备案") + @WebLog("采购信息备案") + @PostMapping("/record/submit") + public void submitPurchaseRecord(@RequestBody SubmitPurchaseRecordReq req) { + purchaseManage.submitPurchaseRecord(req); + } + } 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 index 33a095e..1067da5 100644 --- 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 @@ -43,7 +43,8 @@ public class ApplicationConverter { .projectId(projectInfo.getProjectCode()) .projectType(convertProjectType(projectInfo.getProjectType())) .totalMoney(projectInfo.getDeclareAmount()) - .yearBudget(projectInfo.getAnnualPlanAmount()) + // TODO + .yearBudget(BigDecimal.ZERO) .budgetFrom(checkAddBudget(projectInfo.getDeclareHaveAmount() , projectInfo.getDeclareGovOwnFinanceAmount(), projectInfo.getDeclareGovSuperiorFinanceAmount(), 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 index f2caf79..ddfd563 100644 --- 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 @@ -10,6 +10,7 @@ import com.google.common.collect.Lists; import com.hz.pm.api.common.helper.UserInfoHelper; import com.hz.pm.api.common.model.constant.BizConst; import com.hz.pm.api.common.statemachine.util.StateMachineUtil; +import com.hz.pm.api.common.util.DecimalUtil; import com.hz.pm.api.common.util.ExcelDownUtil; import com.hz.pm.api.common.util.ExcelExportStyle; import com.hz.pm.api.projectdeclared.model.dto.ContractSaveDTO; @@ -20,6 +21,7 @@ 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.req.SubmitConstructionReq; import com.hz.pm.api.projectdeclared.model.vo.*; import com.hz.pm.api.projectdeclared.service.IContractService; import com.hz.pm.api.projectdeclared.service.IPaymentPlanService; @@ -27,10 +29,12 @@ import com.hz.pm.api.projectdeclared.service.IPreInsAcceptancePersonService; import com.hz.pm.api.projectdeclared.service.IPurchaseService; import com.hz.pm.api.projectlib.helper.ProjectHelper; import com.hz.pm.api.projectlib.model.entity.Project; +import com.hz.pm.api.projectlib.model.entity.ProjectPaymentPlan; import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum; import com.hz.pm.api.projectlib.model.enumeration.ProjectTypeNewEnum; 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.IProjectPaymentPlanService; import com.hz.pm.api.projectlib.service.IProjectService; import com.hz.pm.api.user.security.model.UserFullInfoDTO; import com.hz.pm.api.user.security.model.UserInfoDetails; @@ -45,16 +49,14 @@ 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.math.BigDecimal; import java.math.RoundingMode; 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.*; import java.util.concurrent.atomic.AtomicInteger; import java.util.stream.Collectors; @@ -81,6 +83,7 @@ public class ConstructionManage { private final IPreInsAcceptancePersonService acceptancePersonService; private final StateMachineUtil stateMachineUtil; + private final IProjectPaymentPlanService projectPaymentPlanService; /** * 待采购的-项目列表 @@ -246,51 +249,29 @@ public class ConstructionManage { /** * 获取合同备案详情 * - * @param projectId - * @return + * @param projectId \ + * @return \ */ - public ContractVO detailContractByProjectId(Long projectId) { + public List 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, RoundingMode.CEILING) + "%"); - return vo; - }) - .collect(Collectors.toList()); + List contracts = contractService.list(Wrappers.lambdaQuery(Contract.class) + .eq(Contract::getProjectCode, project.getProjectCode())); + + return BeanUtil.copyToList(contracts, ContractVO.class); } /** * 填写合同信息 * - * @param dto - * @return + * @param dto \ + * @return \ + * @deprecated 弃用 */ + @Deprecated + @Transactional(rollbackFor = Exception.class) public String submitContract(ContractSaveDTO dto) { UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); Long projectId = dto.getProjectId(); @@ -317,27 +298,25 @@ public class ConstructionManage { } 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(user.getUserIdStr()); - plan.setUpdateBy(user.getUserIdStr()); - return plan; - }).collect(Collectors.toList()); - - paymentPlanService.saveBatch(payments); - } + if (contractService.saveOrUpdate(contractEntity) && (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(user.getUserIdStr()); + plan.setUpdateBy(user.getUserIdStr()); + return plan; + }).collect(Collectors.toList()); + + paymentPlanService.saveBatch(payments); } + } //判断下 如果和初验都完成了 才进入下一阶段 @@ -357,6 +336,47 @@ public class ConstructionManage { return "填写成功"; } + @Transactional(rollbackFor = Exception.class) + public String submitPurchaseContract(SubmitConstructionReq req) { + UserInfoDetails user = LoginUserUtil.loginUserDetail(); + Long projectId = req.getProjectId(); + Project project = projectService.getNewProject(req.getProjectId()); + VUtils.isTrue(Objects.isNull(project)).throwMessage("提交失败 此项目不存在!"); + + //首先要判断 项目当前状态 是不是 采购结果备案 + VUtils.isTrue(!ProjectStatusEnum.UNDER_CONSTRUCTION.getCode().equals(project.getStatus()) || + !ProjectStatusEnum.PROJECT_APPROVED.getCode().equals(project.getStage())) + .throwMessage("提交失败 该项目不是 建设中或者已立项阶段"); + + LocalDateTime now = LocalDateTime.now(); + Contract contract = new Contract(); + contract.setContractTime(req.getContractTime()); + contract.setAttachment(req.getAttachment()); + contract.setName(req.getName()); + contract.setProjectId(projectId); + contract.setProjectCode(project.getProjectCode()); + contract.setBidId(req.getBidId()); + contract.setId(req.getConstructionId()); + contract.setCreateBy(user.getUserIdStr()); + contract.setUpdateBy(user.getUserIdStr()); + contract.setCreateOn(now); + contract.setUpdateOn(now); + contract.setTotalAmount(req.getTotalAmount()); + contract.setConstructionNo(req.getConstructionNo()); + contract.setSupplierContact(req.getSupplierContact()); + contract.setSupplierContactInfo(req.getSupplierContactInfo()); + contractService.saveOrUpdate(contract); + + LambdaQueryWrapper query = Wrappers.lambdaQuery(Contract.class) + .eq(Contract::getProjectId, projectId); + List allContracts = contractService.list(query); + BigDecimal totalAmount = DecimalUtil.sum(allContracts, Contract::getTotalAmount); + project.setUpdateOn(now); + project.setContractAmount(totalAmount); + projectService.updateById(project); + return "填写成功"; + } + /** * 待初验项目列表 * @@ -381,6 +401,16 @@ public class ConstructionManage { if ((total = page.getTotal()) == 0) { return PageVo.empty(); } + + Set projectCodes = new HashSet<>(); + List projectIds = new ArrayList<>(); + for (Project project : page.getRecords()) { + projectIds.add(project.getId()); + projectCodes.add(project.getProjectCode()); + } + + Map> paymentPlansMap = projectPaymentPlanService.listByProjectIds(projectIds); + List records = CollUtils.convert(page.getRecords(), w -> { ProjectLibListItemVO item = new ProjectLibListItemVO(); item.setId(w.getId()); @@ -400,7 +430,11 @@ public class ConstructionManage { item.setApprovalDate(w.getApprovalDate()); item.setDeliveryTime(w.getDeliveryTime()); item.setContractAmount(w.getContractAmount()); - item.setAnnualPlanAmount(w.getAnnualPlanAmount()); + List paymentPlans = paymentPlansMap.getOrDefault(w.getId(), Collections.emptyList()); + BigDecimal totalAnnualAmount = paymentPlans.stream() + .map(ProjectPaymentPlan::getAnnualPlanAmount) + .reduce(BigDecimal::add).orElse(BigDecimal.ZERO); + item.setAnnualPlanAmount(totalAnnualAmount); item.setTransactionTime(w.getTransactionTime()); item.setTransactionAmount(w.getTransactionAmount()); return item; @@ -425,6 +459,13 @@ public class ConstructionManage { List collect = Lists.newArrayList(); if (CollUtil.isNotEmpty(records)) { + List projectIds = new ArrayList<>(); + for (Project project : records) { + projectIds.add(project.getId()); + } + + Map> paymentPlansMap = projectPaymentPlanService.listByProjectIds(projectIds); + AtomicInteger serialNumber = new AtomicInteger(0); collect = records.stream().map(r -> { DeclaredProjectExportDTO exportDTO = new DeclaredProjectExportDTO(); @@ -436,7 +477,13 @@ public class ConstructionManage { exportDTO.setSerialNumber(serialNumber.incrementAndGet()); exportDTO.setDeliveryTime(r.getDeliveryTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))); exportDTO.setContractAmount(r.getContractAmount()); - exportDTO.setAnnualPlanAmount(r.getAnnualPlanAmount()); + + List paymentPlans = paymentPlansMap.getOrDefault(r.getId(), Collections.emptyList()); + BigDecimal totalAnnualAmount = paymentPlans.stream() + .map(ProjectPaymentPlan::getAnnualPlanAmount) + .reduce(BigDecimal::add).orElse(BigDecimal.ZERO); + + exportDTO.setAnnualPlanAmount(totalAnnualAmount); if (Objects.nonNull(r.getTransactionTime())) { exportDTO.setTransactionTime(r.getTransactionTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))); } @@ -445,7 +492,7 @@ public class ConstructionManage { }).collect(Collectors.toList()); } - String fileName = "合同备案项目列表"; + final String fileName = "合同备案项目列表"; ExcelDownUtil.setFileName(fileName, response); //数据导出处理函数 try { @@ -538,15 +585,14 @@ public class ConstructionManage { project.setIsCompletedLogCollection(dto.getIsCompletedLogCollection()); project.setActualPerformanceIndicators(dto.getActualPerformanceIndicators()); projectService.updateById(project); - return "填写成功"; } /** * 补充项目 合同 实际支付信息 * - * @param plans - * @return + * @param plans \ + * @return \ */ public String supplement(List plans) { if (CollUtil.isEmpty(plans)) { 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 index 4532afa..881351c 100644 --- 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 @@ -33,7 +33,7 @@ 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.todocenter.constant.WorkNoticeConst; import com.hz.pm.api.user.security.model.UserInfoDetails; import com.hz.pm.api.user.util.LoginUserUtil; import com.ningdatech.basic.exception.BizException; @@ -169,7 +169,7 @@ public class ConstructionPlanManage { //发送给第一个审批人消息 noticeManage.sendFirstUser(buildProject, model.getFormName(), instanceId, - WorkNoticeConstant.PASS_MSG_TEMPLATE, MsgTypeEnum.PROJECT_REVIEW); + WorkNoticeConst.PASS_MSG_TEMPLATE, MsgTypeEnum.PROJECT_REVIEW); return instanceId; } 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 index 641f27b..96cf9ef 100644 --- 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 @@ -2,6 +2,8 @@ package com.hz.pm.api.projectdeclared.manage; import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.util.StrUtil; +import cn.hutool.json.JSONUtil; import com.alibaba.excel.EasyExcel; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; @@ -12,6 +14,7 @@ import com.baomidou.mybatisplus.core.toolkit.Assert; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.google.common.collect.Lists; +import com.hz.pm.api.projectlib.model.dto.ProjectPaymentPlanDTO; import com.ningdatech.basic.exception.BizException; import com.ningdatech.basic.function.VUtils; import com.ningdatech.basic.model.PageVo; @@ -44,7 +47,7 @@ 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.todocenter.constant.WorkNoticeConst; import com.hz.pm.api.user.security.model.UserFullInfoDTO; import com.hz.pm.api.user.security.model.UserInfoDetails; import com.hz.pm.api.user.util.LoginUserUtil; @@ -177,7 +180,7 @@ public class DeclaredProjectManage { //发送给第一个审批人消息 noticeManage.sendFirstUser(buildProject, model.getFormName(), instanceId, - WorkNoticeConstant.PASS_MSG_TEMPLATE, MsgTypeEnum.PROJECT_REVIEW); + WorkNoticeConst.PASS_MSG_TEMPLATE, MsgTypeEnum.PROJECT_REVIEW); return instanceId; } @@ -191,7 +194,7 @@ public class DeclaredProjectManage { */ @Transactional(rollbackFor = Exception.class) public String reStartTheProcess(DefaultDeclaredDTO dto) { - UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); + UserInfoDetails user = LoginUserUtil.loginUserDetail(); ProjectDTO projectDto = dto.getProjectInfo(); projectDto.setBuildOrgCode(user.getMhUnitIdStr()); projectDto.setBuildOrgName(user.getMhUnitName()); @@ -254,16 +257,17 @@ public class DeclaredProjectManage { //发送给第一个审批人消息 noticeManage.sendFirstUser(buildProject, model.getFormName(), instanceId, - WorkNoticeConstant.PASS_MSG_TEMPLATE, MsgTypeEnum.PROJECT_REVIEW); + WorkNoticeConst.PASS_MSG_TEMPLATE, MsgTypeEnum.PROJECT_REVIEW); return instanceId; } - public PageVo pageDraft(DeclaredProjectListParamDTO params) { + public PageVo pageDraft(DeclaredProjectListParamDTO params, Integer draftType) { Long userId = LoginUserUtil.getUserId(); Page page = params.page(); LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(ProjectDraft.class) .eq(ProjectDraft::getUserId, userId) + .eq(ProjectDraft::getDraftType, draftType) .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()) @@ -290,10 +294,13 @@ public class DeclaredProjectManage { 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())) { + if (StrUtil.isNotBlank(draft.getProjectApplicationList())) { vo.setApplicationList(JSON.parseArray(draft.getProjectApplicationList(), ProjectApplication.class)); } - if (StringUtils.isNotBlank(draft.getDynamicForm())) { + if (StrUtil.isNotBlank(draft.getPaymentPlans())) { + vo.setPaymentPlanList(JSONUtil.toList(draft.getPaymentPlans(), ProjectPaymentPlanDTO.class)); + } + if (StrUtil.isNotBlank(draft.getDynamicForm())) { vo.setDynamicForm(JSON.parseObject(draft.getDynamicForm(), Map.class)); } return vo; @@ -302,10 +309,10 @@ public class DeclaredProjectManage { /** * 保存至草稿箱 * - * @param dto - * @return + * @param dto \ + * @return \ */ - public Long saveToDraft(ProjectDraftSaveDTO dto) { + public Long saveToDraft(ProjectDraftSaveDTO dto, Integer draftType) { Long userId = LoginUserUtil.getUserId(); UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); @@ -322,6 +329,9 @@ public class DeclaredProjectManage { if (CollUtil.isNotEmpty(projectInfo.getDynamicForm())) { draft.setDynamicForm(JSON.toJSONString(projectInfo.getDynamicForm())); } + if (CollUtil.isNotEmpty(projectInfo.getPaymentPlanList())) { + draft.setPaymentPlans(JSON.toJSONString(projectInfo.getPaymentPlanList())); + } if (CollUtil.isNotEmpty(projectInfo.getApplicationList())) { draft.setProjectApplicationList(JSON.toJSONString(projectInfo.getApplicationList())); } @@ -333,6 +343,7 @@ public class DeclaredProjectManage { draft.setCreateOn(LocalDateTime.now()); } } + draft.setDraftType(draftType); draft.setUpdateOn(LocalDateTime.now()); draft.setUserId(String.valueOf(userId)); projectDraftService.saveOrUpdate(draft); 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 index a18cd53..7b86b3a 100644 --- 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 @@ -1,5 +1,6 @@ package com.hz.pm.api.projectdeclared.manage; +import cn.hutool.core.collection.CollUtil; import cn.hutool.core.lang.Assert; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.TypeReference; @@ -14,6 +15,7 @@ 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.dto.ProjectPaymentPlanDTO; import com.hz.pm.api.projectlib.model.entity.Project; import com.hz.pm.api.projectlib.service.IProjectService; import com.hz.pm.api.user.security.model.UserFullInfoDTO; @@ -107,23 +109,23 @@ public class DefaultDeclaredProjectManage { .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)); + if (CollUtil.isNotEmpty(projectInfo.getPaymentPlanList())) { + for (ProjectPaymentPlanDTO paymentPlan : projectInfo.getPaymentPlanList()) { + BigDecimal annualPlanAmount = paymentPlan.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 = paymentPlan.getAnnualPlanGovSuperiorFinanceAmount(); + BigDecimal annualOwnSuperAmount = paymentPlan.getAnnualPlanGovOwnFinanceAmount(); + BigDecimal annualHaveAmount = paymentPlan.getAnnualPlanHaveAmount(); + BigDecimal totalAnnual = annualGovSuperAmount.add(annualOwnSuperAmount).add(annualHaveAmount); + VUtils.isTrue(annualPlanAmount.compareTo(totalAnnual) != 0) + .throwMessage(String.format("申报失败! 年度支付总金额【%s】 不等于其它年度支付金额 【%s】", annualPlanAmount, totalAnnual)); + + } } } } 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 index 08d945f..d6ba1c3 100644 --- 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 @@ -31,7 +31,7 @@ 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.todocenter.constant.WorkNoticeConst; import com.hz.pm.api.user.security.model.UserFullInfoDTO; import com.hz.pm.api.user.security.model.UserInfoDetails; import com.hz.pm.api.user.util.LoginUserUtil; @@ -280,7 +280,7 @@ public class DelayedApplyManage { //发送给第一个审批人消息 noticeManage.sendFirstUser(project, model.getFormName(), instanceId, - WorkNoticeConstant.PASS_MSG_TEMPLATE, MsgTypeEnum.PROJECT_REVIEW); + WorkNoticeConst.PASS_MSG_TEMPLATE, MsgTypeEnum.PROJECT_REVIEW); return instanceId; } 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 index 5918874..25ddd12 100644 --- 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 @@ -54,7 +54,7 @@ import java.util.concurrent.atomic.AtomicInteger; import java.util.stream.Collectors; import static com.hz.pm.api.staging.enums.MsgTypeEnum.PROJECT_REVIEW; -import static com.hz.pm.api.todocenter.constant.WorkNoticeConstant.PASS_MSG_TEMPLATE; +import static com.hz.pm.api.todocenter.constant.WorkNoticeConst.PASS_MSG_TEMPLATE; /** * @Classname FinalAcceptanceManage 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 index ee1084f..e82cb92 100644 --- 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 @@ -5,7 +5,7 @@ import com.baomidou.mybatisplus.core.toolkit.Assert; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.hz.pm.api.common.model.constant.BizConst; import com.hz.pm.api.common.statemachine.util.StateMachineUtil; -import com.hz.pm.api.projectdeclared.model.dto.OperationDTO; +import com.hz.pm.api.projectdeclared.model.dto.OperationReq; 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; @@ -15,11 +15,14 @@ import com.hz.pm.api.projectlib.service.IProjectService; import com.hz.pm.api.user.security.model.UserInfoDetails; import com.hz.pm.api.user.util.LoginUserUtil; import com.ningdatech.basic.function.VUtils; +import com.ningdatech.basic.util.CollUtils; 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.List; import java.util.Objects; /** @@ -42,24 +45,24 @@ public class OperationManage { /** * 获取实施详情 * - * @param projectId - * @return + * @param projectId \ + * @return \ */ - public OperationVO detail(Long projectId) { + public List detail(Long projectId) { Project project = projectService.getNewProject(projectId); Assert.notNull(project, "项目不存在!"); - Operation operation = operationService.getOne(Wrappers.lambdaQuery(Operation.class) - .eq(Operation::getProjectCode, project.getProjectCode()) - .last(BizConst.LIMIT_1)); + List operations = operationService.list(Wrappers.lambdaQuery(Operation.class) + .eq(Operation::getProjectCode, project.getProjectCode())); - return BeanUtil.copyProperties(operation, OperationVO.class); + return CollUtils.convert(operations, w -> BeanUtil.copyProperties(w, OperationVO.class)); } - public String pushOperation(OperationDTO operation) { + @Transactional(rollbackFor = Exception.class) + public String pushOperation(OperationReq req) { UserInfoDetails user = LoginUserUtil.loginUserDetail(); - Project project = projectService.getNewProject(operation.getProjectId()); + Project project = projectService.getNewProject(req.getProjectId()); Assert.notNull(project, "项目不存在!"); //首先要判断 项目当前状态 是不是 待开工状态 @@ -67,28 +70,23 @@ public class OperationManage { !ProjectStatusEnum.PROJECT_APPROVED.eq(project.getStage())) .throwMessage("提交失败 该项目不是 待开工或者已立项阶段"); - Operation old = operationService.getOne(Wrappers.lambdaQuery(Operation.class) + Operation pre = operationService.getOne(Wrappers.lambdaQuery(Operation.class) .eq(Operation::getProjectCode, project.getProjectCode()) + .eq(Operation::getBidId, req.getBidId()) .last(BizConst.LIMIT_1)); - Operation entity = BeanUtil.copyProperties(operation, Operation.class); - if (Objects.nonNull(old)) { - entity.setId(old.getId()); + LocalDateTime now = LocalDateTime.now(); + Operation curr = BeanUtil.copyProperties(req, Operation.class); + if (Objects.nonNull(pre)) { + curr.setId(pre.getId()); } else { - entity.setCreateOn(LocalDateTime.now()); - entity.setCreateBy(user.getUsername()); + curr.setCreateOn(now); + curr.setCreateBy(user.getUsername()); } - entity.setProjectCode(project.getProjectCode()); - entity.setUpdateOn(LocalDateTime.now()); - entity.setUpdateBy(user.getUsername()); - //强制放入 计划终验时间 - entity.setFinalInspectionDate(project.getPlanAcceptanceTime()); - if (operationService.saveOrUpdate(entity)) { - stateMachineUtil.pass(project); - project.setUpdateOn(LocalDateTime.now()); - projectService.updateById(project); - } - - return entity.getProjectCode(); + curr.setProjectCode(project.getProjectCode()); + curr.setUpdateOn(now); + curr.setUpdateBy(user.getUsername()); + operationService.saveOrUpdate(curr); + return curr.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 index 3abf0c4..7bf94e3 100644 --- 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 @@ -29,7 +29,7 @@ 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.TodoCenterConst; -import com.hz.pm.api.todocenter.constant.WorkNoticeConstant; +import com.hz.pm.api.todocenter.constant.WorkNoticeConst; import com.hz.pm.api.user.security.model.UserFullInfoDTO; import com.hz.pm.api.user.security.model.UserInfoDetails; import com.hz.pm.api.user.util.LoginUserUtil; @@ -204,7 +204,7 @@ public class PrequalificationDeclaredProjectManage { //发送给第一个审批人消息 noticeManage.sendFirstUser(projectInfo, model.getFormName(), instanceId, - WorkNoticeConstant.PASS_MSG_TEMPLATE, MsgTypeEnum.PROJECT_REVIEW); + WorkNoticeConst.PASS_MSG_TEMPLATE, MsgTypeEnum.PROJECT_REVIEW); return instanceId; } 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 index d0a6b4c..1f36315 100644 --- 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 @@ -13,6 +13,8 @@ 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.req.SubmitPurchaseNoticeReq; +import com.hz.pm.api.projectdeclared.model.req.SubmitPurchaseRecordReq; import com.hz.pm.api.projectdeclared.model.vo.PurchaseVO; import com.hz.pm.api.projectdeclared.service.IPurchaseService; import com.hz.pm.api.projectlib.helper.ProjectHelper; @@ -23,6 +25,7 @@ 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.model.UserFullInfoDTO; +import com.hz.pm.api.user.security.model.UserInfoDetails; import com.hz.pm.api.user.util.LoginUserUtil; import com.ningdatech.basic.exception.BizException; import com.ningdatech.basic.function.VUtils; @@ -215,4 +218,51 @@ public class PurchaseManage { return "保存失败"; } + public void submitPurchaseNotice(SubmitPurchaseNoticeReq req) { + UserInfoDetails user = LoginUserUtil.loginUserDetail(); + Long projectId = req.getProjectId(); + Project project = projectService.getNewProject(projectId); + Assert.notNull(project, "提交失败 此项目不存在!"); + + //首先要判断 项目当前状态 是不是 采购结果备案 + VUtils.isTrue(!ProjectStatusEnum.TO_BE_PURCHASED.eq(project.getStatus()) + || !ProjectStatusEnum.PROJECT_APPROVED.eq(project.getStage())) + .throwMessage("提交失败,该项目不是待采购备案状态或者已立项阶段"); + Purchase purchase = new Purchase(); + purchase.setPurchaseMethod(req.getPurchaseMethod()); + purchase.setBizAddress(req.getBidAddress()); + purchase.setBidName(req.getBidName()); + purchase.setBizBudget(req.getBidBudget()); + purchase.setBidDoc(req.getBidDoc()); + purchase.setBidStartTime(req.getBidStartTime()); + purchase.setBidEndTime(req.getBidEndTime()); + purchase.setId(req.getBidId()); + purchase.setProjectId(projectId); + if (purchase.getId() == null) { + purchase.setCreateBy(user.getUserIdStr()); + } + purchaseService.saveOrUpdate(purchase); + } + + public void submitPurchaseRecord(SubmitPurchaseRecordReq req) { + Long projectId = req.getProjectId(); + Project project = projectService.getNewProject(projectId); + Assert.notNull(project, "提交失败 此项目不存在!"); + + //首先要判断 项目当前状态 是不是 采购结果备案 + VUtils.isTrue(!ProjectStatusEnum.TO_BE_PURCHASED.eq(project.getStatus()) + || !ProjectStatusEnum.PROJECT_APPROVED.eq(project.getStage())) + .throwMessage("提交失败,该项目不是待采购备案状态或者已立项阶段"); + + Purchase purchase = new Purchase(); + purchase.setId(req.getBidId()); + purchase.setAcceptanceLetter(req.getAcceptanceLetter()); + purchase.setBidBuildContent(req.getBidBuildContent()); + purchase.setBiddingDoc(req.getBiddingDoc()); + purchase.setSupplier(req.getSupplier()); + purchase.setSupplierSocialCreditCode(req.getSupplierSocialCreditCode()); + purchase.setBidType(req.getBidType()); + purchaseService.saveOrUpdate(purchase); + } + } 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 index 90af76e..f5ef841 100644 --- 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 @@ -9,7 +9,7 @@ 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.todocenter.constant.WorkNoticeConst; import com.ningdatech.basic.function.VUtils; import com.wflow.bean.entity.WflowModels; import com.wflow.exception.BusinessException; @@ -97,7 +97,7 @@ public class ReviewByDeptJointManage { projectInfo = projectLibManage.saveProjectWithVersion(projectInfo, instanceId, ProjectProcessStageEnum.DEPARTMENT_JOINT_APPROVAL_PROCESS.getCode()); //发送给第一个审批人消息 - noticeManage.sendFirstUser(projectInfo, model.getFormName(), instanceId, WorkNoticeConstant.PASS_MSG_TEMPLATE, MsgTypeEnum.PROJECT_REVIEW); + noticeManage.sendFirstUser(projectInfo, model.getFormName(), instanceId, WorkNoticeConst.PASS_MSG_TEMPLATE, MsgTypeEnum.PROJECT_REVIEW); return Boolean.TRUE; } 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 index ed3e245..b3ea67d 100644 --- 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 @@ -121,7 +121,7 @@ public class ReviewChecklistManage { item.setProcessStatus(w.getProcessStatus()); item.setInstCode(w.getInstCode()); item.setApprovedAmount(w.getApprovalAmount()); - item.setAnnualPlanAmount(w.getAnnualPlanAmount()); + // item.setAnnualPlanAmount(w.getAnnualPlanAmount()); // 审查人员情况 item.setVerifiedHumans(computeVerify(item, approveMap.get(w.getProjectCode()), userMap, user)); item.setReviewCheckFinish(w.getReviewCheckFinish()); 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/OperationReq.java similarity index 71% rename from hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/dto/OperationDTO.java rename to hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/dto/OperationReq.java index 3dd4c0c..b9a833d 100644 --- 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/OperationReq.java @@ -2,24 +2,28 @@ package com.hz.pm.api.projectdeclared.model.dto; 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 + *

+ * 实施计划参数类 + *

+ * + * @author WendyYang + * @since 09:25 2024/2/23 */ -@ApiModel(value = "实施对象DTO", description = "实施对象DTO") @Data -@AllArgsConstructor -@NoArgsConstructor -public class OperationDTO { +@ApiModel(value = "实施对象DTO") +public class OperationReq { + + @ApiModelProperty("实施计划ID") + private Long operationId; + + @ApiModelProperty("标段ID") + private Long bidId; @ApiModelProperty("项目ID") @NotNull(message = "项目ID不能为空") @@ -41,6 +45,9 @@ public class OperationDTO { private LocalDateTime finalInspectionDate; @ApiModelProperty("开始实施时间") - @NotNull(message = "开始实施时间不能为空") private LocalDateTime startTrialOperationDate; + + @ApiModelProperty("试运行开始时间") + private LocalDateTime pilotRunStartDate; + } 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 index 38c93be..4a192ac 100644 --- 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 @@ -16,7 +16,7 @@ import java.io.Serializable; * @author zpf * @since 2023-02-06 */ -@ApiModel(value = "NdProjectDraftDto", description = "") +@ApiModel(value = "NdProjectDraftDto") @Data @Builder @NoArgsConstructor 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 index c4ceb1d..dad24f2 100644 --- 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 @@ -70,4 +70,16 @@ public class Contract { @ApiModelProperty("项目编号") private String projectCode; + @ApiModelProperty("标段ID") + private Long bidId; + + @ApiModelProperty("合同编号") + private String constructionNo; + + @ApiModelProperty("供应商联系人") + private String supplierContact; + + @ApiModelProperty("供应商联系方式") + private String supplierContactInfo; + } 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 index 6be2c42..944fedf 100644 --- 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 @@ -5,28 +5,33 @@ import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import io.swagger.annotations.ApiOperation; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; + import java.time.LocalDateTime; /** - * @Classname Operation - * @Description - * @Date 2023/5/29 10:00 - * @Author PoffyZhang + *

+ * Operation + *

+ * + * @author WendyYang + * @since 09:36 2024/2/23 */ -@TableName("nd_project_operation") -@ApiModel(value = "实施对象", description = "实施对象") @Data -@AllArgsConstructor -@NoArgsConstructor +@TableName("nd_project_operation") +@ApiModel(value = "实施对象") public class Operation { @TableId(type = IdType.AUTO) @ApiModelProperty("id") private Long id; + @ApiModelProperty("标段ID") + private Long bidId; + @ApiModelProperty("项目ID") private Long projectId; @@ -39,10 +44,10 @@ public class Operation { @ApiModelProperty("修改时间") private LocalDateTime updateOn; - @ApiModelProperty("创建人 工号") + @ApiModelProperty("创建人ID") private String createBy; - @ApiModelProperty("修改人 工号") + @ApiModelProperty("修改人ID") private String updateBy; @ApiModelProperty("项目开工时间") @@ -56,4 +61,8 @@ public class Operation { @ApiModelProperty("开始实施时间") private LocalDateTime startTrialOperationDate; + + @ApiModelProperty("试运行开始时间") + private LocalDateTime pilotRunStartDate; + } 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 index 20b6ccb..b93acc9 100644 --- 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 @@ -4,6 +4,7 @@ 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 com.hz.pm.api.projectlib.model.dto.ProjectPaymentPlanDTO; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.AllArgsConstructor; @@ -14,6 +15,7 @@ import lombok.NoArgsConstructor; import java.io.Serializable; import java.math.BigDecimal; import java.time.LocalDateTime; +import java.util.List; /** *

@@ -181,23 +183,8 @@ public class ProjectDraft implements Serializable { @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 paymentPlans; @ApiModelProperty("立项批复资金(万元)") private BigDecimal approvalAmount; @@ -367,4 +354,8 @@ public class ProjectDraft implements Serializable { @ApiModelProperty("立项依据证明材料") private String baseProjBasisFile; + + @ApiModelProperty("暂存类型:1 项目申报、2 立项备案") + private Integer draftType; + } 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 index 8a0e1ac..0787466 100644 --- 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 @@ -50,12 +50,6 @@ public class Purchase { @ApiModelProperty("供应商") private String supplier; - @ApiModelProperty("供应商联系人") - private String supplierContact; - - @ApiModelProperty("供应商联系方式") - private String supplierContactInfo; - @ApiModelProperty("供应商社会信用代码") private String supplierSocialCreditCode; @@ -71,18 +65,37 @@ public class Purchase { @ApiModelProperty("代理机构") private String agency; - @ApiModelProperty("代理机构社会统一信用代码") - private String purchaseSocialCreditCode; + @ApiModelProperty("标段类型") + private Integer bidType; @ApiModelProperty("投标文件") private String biddingDoc; - @ApiModelProperty("招标文件") - private String bidDoc; - @ApiModelProperty("中标通知书") private String acceptanceLetter; + @ApiModelProperty("标段建设内容") + private String bidBuildContent; + + @ApiModelProperty("代理机构社会统一信用代码") + private String purchaseSocialCreditCode; + + @ApiModelProperty("招标文件") + private String bidDoc; + @ApiModelProperty("预算执行确认书编号") private String budgetExecConfirmNo; + + @ApiModelProperty("投标地址") + private String bizAddress; + + @ApiModelProperty("标项预算") + private BigDecimal bizBudget; + + @ApiModelProperty("开标时间") + private LocalDateTime bidStartTime; + + @ApiModelProperty("投标截止时间") + private LocalDateTime bidEndTime; + } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/enumerization/ProjectDraftTypeEnum.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/enumerization/ProjectDraftTypeEnum.java new file mode 100644 index 0000000..cbc3236 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/enumerization/ProjectDraftTypeEnum.java @@ -0,0 +1,24 @@ +package com.hz.pm.api.projectdeclared.model.enumerization; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + *

+ * ProjectDraftTypeEnum + *

+ * + * @author WendyYang + * @since 09:57 2024/2/20 + */ +@Getter +@AllArgsConstructor +public enum ProjectDraftTypeEnum { + + PROJECT_DECLARED(1, "项目申报"), + DECLARED_RECORD(2, "立项备案"); + + private final Integer code; + private final String val; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/req/SubmitConstructionReq.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/req/SubmitConstructionReq.java new file mode 100644 index 0000000..05f86fd --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/req/SubmitConstructionReq.java @@ -0,0 +1,56 @@ +package com.hz.pm.api.projectdeclared.model.req; + +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; + +/** + *

+ * SubmitConstructionReq + *

+ * + * @author WendyYang + * @since 00:14 2024/2/23 + */ +@Data +@ApiModel(value = "合同对象") +public class SubmitConstructionReq { + + @ApiModelProperty("项目ID") + @NotNull(message = "项目ID不能为空") + private Long projectId; + + @ApiModelProperty("合同ID") + private Long constructionId; + + @ApiModelProperty("标段ID") + private Long bidId; + + @ApiModelProperty("合同名称") + private String name; + + @ApiModelProperty("合同总金额") + private BigDecimal totalAmount; + + @ApiModelProperty("合同编号") + private String constructionNo; + + @ApiModelProperty("合同完成时间") + @JsonFormat(pattern = "yyyy-MM-dd") + private LocalDateTime contractTime; + + @ApiModelProperty("附件") + private String attachment; + + @ApiModelProperty("供应商联系人") + private String supplierContact; + + @ApiModelProperty("供应商联系方式") + private String supplierContactInfo; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/req/SubmitPurchaseNoticeReq.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/req/SubmitPurchaseNoticeReq.java new file mode 100644 index 0000000..1f48388 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/req/SubmitPurchaseNoticeReq.java @@ -0,0 +1,57 @@ +package com.hz.pm.api.projectdeclared.model.req; + +import com.fasterxml.jackson.annotation.JsonFormat; +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; + +/** + *

+ * SubmitPurchaseNoticeReq + *

+ * + * @author WendyYang + * @since 11:34 2024/2/22 + */ +@Data +@AllArgsConstructor +public class SubmitPurchaseNoticeReq { + + @ApiModelProperty("项目ID") + @NotNull(message = "请传项目ID") + private Long projectId; + + + @ApiModelProperty("标段ID") + private Long bidId; + + @ApiModelProperty("标段名称") + private String bidName; + + @ApiModelProperty("标段预算") + private BigDecimal bidBudget; + + @ApiModelProperty("开标时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm") + private LocalDateTime bidStartTime; + + @ApiModelProperty("投标截止时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm") + private LocalDateTime bidEndTime; + + @ApiModelProperty("投标地址") + private String bidAddress; + + @ApiModelProperty("采购方式") + private String purchaseMethod; + + @ApiModelProperty("招标文件") + private String bidDoc; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/req/SubmitPurchaseRecordReq.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/req/SubmitPurchaseRecordReq.java new file mode 100644 index 0000000..aa1aed9 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/req/SubmitPurchaseRecordReq.java @@ -0,0 +1,48 @@ +package com.hz.pm.api.projectdeclared.model.req; + +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; + +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; +import java.util.List; + +/** + *

+ * 采购信息备案提交参数类 + *

+ * + * @author WendyYang + * @since 11:34 2024/2/22 + */ +@Data +@AllArgsConstructor +public class SubmitPurchaseRecordReq { + + @ApiModelProperty("项目ID") + @NotNull(message = "请传项目ID") + private Long projectId; + + @ApiModelProperty("标段ID") + private Long bidId; + + @ApiModelProperty("标段类型") + private Integer bidType; + + @ApiModelProperty("供应商") + private String supplier; + + @ApiModelProperty("供应商社会信用代码") + private String supplierSocialCreditCode; + + @ApiModelProperty("投标文件") + private String biddingDoc; + + @ApiModelProperty("中标通知书") + private String acceptanceLetter; + + @ApiModelProperty("标段建设内容") + private String bidBuildContent; + +} 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 index 9753cf9..5078e91 100644 --- 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 @@ -9,7 +9,6 @@ import lombok.Data; import java.math.BigDecimal; import java.time.LocalDateTime; -import java.util.List; /** * @Classname Contract @@ -18,11 +17,9 @@ import java.util.List; * @Author PoffyZhang */ @Data -@ApiModel(value = "ContractVO", description = "") +@ApiModel(value = "ContractVO") public class ContractVO { - private static final long serialVersionUID = 1L; - @ApiModelProperty("主键") private Long id; @@ -75,6 +72,16 @@ public class ContractVO { @ApiModelProperty("项目编号") private String projectCode; - @ApiModelProperty("支付计划") - private List payments; + @ApiModelProperty("供应商联系人") + private String supplierContact; + + @ApiModelProperty("供应商联系方式") + private String supplierContactInfo; + + @ApiModelProperty("标段ID") + private Long bidId; + + @ApiModelProperty("合同编号") + private String constructionNo; + } 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 index 2e521d3..e732de8 100644 --- 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 @@ -9,15 +9,15 @@ import lombok.NoArgsConstructor; import java.time.LocalDateTime; /** - * @Classname Operation - * @Description - * @Date 2023/5/29 10:00 - * @Author PoffyZhang + *

+ * OperationVO + *

+ * + * @author WendyYang + * @since 09:28 2024/2/23 */ -@ApiModel(value = "实施对象", description = "实施对象") @Data -@AllArgsConstructor -@NoArgsConstructor +@ApiModel(value = "实施对象") public class OperationVO { @ApiModelProperty("id") @@ -50,6 +50,13 @@ public class OperationVO { @ApiModelProperty("终验时间") private LocalDateTime finalInspectionDate; + @ApiModelProperty("标段ID") + private Long bidId; + + @ApiModelProperty("试运行开始时间") + private LocalDateTime pilotRunStartDate; + @ApiModelProperty("开始实施时间") private LocalDateTime startTrialOperationDate; + } 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 index c7d5a34..b2d80ed 100644 --- 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 @@ -3,6 +3,7 @@ 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.dto.ProjectPaymentPlanDTO; import com.hz.pm.api.projectlib.model.entity.ProjectApplication; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; @@ -356,7 +357,11 @@ public class ProjectDraftVO implements Serializable { @ApiModelProperty("评审清单") private String reviewChecklist; + @ApiModelProperty("支付计划") + private List paymentPlanList; + private Long createBy; + private Long updateBy; @ApiModelProperty("是否推送省里") @@ -370,4 +375,7 @@ public class ProjectDraftVO implements Serializable { @ApiModelProperty("立项依据证明材料") private String baseProjBasisFile; + + @ApiModelProperty("草稿箱类型:1 项目申报、2 立项备案") + private Integer draftType; } 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 index aa05673..a57cf72 100644 --- 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 @@ -3,6 +3,7 @@ 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.manage.DeclaredRecordManage; import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum; import org.springframework.stereotype.Component; @@ -26,7 +27,8 @@ public class RestartProcessMapUtil { ConstructionPlanManage constructionPlanManage, PrequalificationDeclaredProjectManage prequalificationDeclaredProjectManage, ReviewByProvincialDeptManage provincialDeptManage, - FinalAcceptanceManage finalAcceptanceManage) { + FinalAcceptanceManage finalAcceptanceManage, + DeclaredRecordManage declaredRecordManage) { //重新项目申报 RESTART_PROCESS_MAP.put(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS.getCode(), declaredProjectManage::reStartTheProcess); @@ -42,6 +44,9 @@ public class RestartProcessMapUtil { //终审 RESTART_PROCESS_MAP.put(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED.getCode(), finalAcceptanceManage::restartProcess); + // 立项备案重新提交 + RESTART_PROCESS_MAP.put(ProjectStatusEnum.DECLARED_APPROVED_RECORD_FAILED.getCode(), + declaredRecordManage::restartDeclaredRecord); } public static Function getRestartFunction(Integer status) { diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/controller/MhProjectController.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/controller/MhProjectController.java index ce4aa67..d860237 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/controller/MhProjectController.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/controller/MhProjectController.java @@ -1,6 +1,7 @@ package com.hz.pm.api.projectlib.controller; -import com.hz.pm.api.projectlib.manage.MhProjectManage; +import com.hz.pm.api.projectdeclared.model.dto.DefaultDeclaredDTO; +import com.hz.pm.api.projectlib.manage.DeclaredRecordManage; import com.hz.pm.api.projectlib.model.req.DeclaredProjectListReq; import com.hz.pm.api.projectlib.model.vo.DeclaredProjectListVO; import com.hz.pm.api.projectlib.model.vo.MhProjectBaseInfoVO; @@ -8,10 +9,9 @@ import com.ningdatech.basic.model.PageVo; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; -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 org.springframework.web.bind.annotation.*; + +import javax.validation.Valid; /** *

@@ -21,24 +21,36 @@ import org.springframework.web.bind.annotation.RestController; * @author WendyYang * @since 2024-01-30 */ -@Api(tags = "信产项目(立项备案)列表") +@Api(tags = "信产项目(立项备案)相关接口") @RestController @RequiredArgsConstructor -@RequestMapping("/api/v1/mh/project") +@RequestMapping("/api/v1/declared/record") public class MhProjectController { - private final MhProjectManage mhProjectManage; + private final DeclaredRecordManage declaredRecordManage; @ApiOperation("立项备案列表") @GetMapping("/pageDeclaredProject") public PageVo pageDeclaredProject(DeclaredProjectListReq req) { - return mhProjectManage.pageDeclaredProject(req); + return declaredRecordManage.pageDeclaredProject(req); } @ApiOperation("信产项目基本信息") @GetMapping("/baseInfo/{mhProjectId}") public MhProjectBaseInfoVO projectBaseInfo(@PathVariable Long mhProjectId) { - return mhProjectManage.getProjectBaseInfo(mhProjectId); + return declaredRecordManage.getProjectBaseInfo(mhProjectId); + } + + @ApiOperation("立项备案提交") + @PostMapping("/submit") + public void submit(@Valid @RequestBody DefaultDeclaredDTO req) { + declaredRecordManage.startDeclaredRecord(req); + } + + @ApiOperation("立项备案重新提交") + @PostMapping("/resubmit") + public void resubmit(@Valid @RequestBody DefaultDeclaredDTO req) { + declaredRecordManage.restartDeclaredRecord(req); } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/controller/NdProjectPaymentPlanController.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/controller/NdProjectPaymentPlanController.java new file mode 100644 index 0000000..9baaacd --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/controller/NdProjectPaymentPlanController.java @@ -0,0 +1,18 @@ +package com.hz.pm.api.projectlib.controller; + +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.stereotype.Controller; + +/** + *

+ * 前端控制器 + *

+ * + * @author WendyYang + * @since 2024-02-21 + */ +@Controller +@RequestMapping("/api.projectlib/ndProjectPaymentPlan") +public class NdProjectPaymentPlanController { + +} 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 index 23a51af..31f6c8d 100644 --- 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 @@ -344,7 +344,8 @@ public class AnnualPlanLibManage { project.setBeginTime(dataArr[0].trim()); project.setEndTime(dataArr[1].trim()); project.setDeclareAmount(data.getDeclaredAmount()); - project.setAnnualPlanAmount(data.getAnnualPlanAmount()); + // TODO 年度计划 + // project.setAnnualPlanAmount(data.getAnnualPlanAmount()); project.setDeclareHaveAmount(data.getDeclareHaveAmount()); project.setDeclareGovOwnFinanceAmount(data.getDeclareGovOwnFinanceAmount()); project.setDeclareGovSuperiorFinanceAmount(data.getDeclareGovSuperiorFinanceAmount()); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/DeclaredRecordManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/DeclaredRecordManage.java new file mode 100644 index 0000000..e15037d --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/DeclaredRecordManage.java @@ -0,0 +1,301 @@ +package com.hz.pm.api.projectlib.manage; + +import cn.hutool.core.lang.Assert; +import cn.hutool.core.util.StrUtil; +import com.alibaba.fastjson.JSON; +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.hz.pm.api.common.enumeration.CommonEnum; +import com.hz.pm.api.common.enumeration.ProjectProcessStageEnum; +import com.hz.pm.api.common.model.constant.BizConst; +import com.hz.pm.api.projectdeclared.manage.DefaultDeclaredProjectManage; +import com.hz.pm.api.projectdeclared.model.dto.DefaultDeclaredDTO; +import com.hz.pm.api.projectdeclared.model.dto.ProjectConditionDTO; +import com.hz.pm.api.projectdeclared.service.IProjectDraftService; +import com.hz.pm.api.projectlib.model.dto.ProjectDTO; +import com.hz.pm.api.projectlib.model.entity.MhProject; +import com.hz.pm.api.projectlib.model.entity.MhProjectSchemaTargetData; +import com.hz.pm.api.projectlib.model.entity.Project; +import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum; +import com.hz.pm.api.projectlib.model.req.DeclaredProjectListReq; +import com.hz.pm.api.projectlib.model.vo.DeclaredProjectListVO; +import com.hz.pm.api.projectlib.model.vo.MhProjectBaseInfoVO; +import com.hz.pm.api.projectlib.service.IMhProjectSchemaTargetDataService; +import com.hz.pm.api.projectlib.service.IMhProjectService; +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.WorkNoticeConst; +import com.hz.pm.api.user.helper.MhUnitCache; +import com.hz.pm.api.user.model.dto.UnitDTO; +import com.hz.pm.api.user.security.model.UserInfoDetails; +import com.hz.pm.api.user.util.LoginUserUtil; +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.wflow.bean.entity.WflowModels; +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.beans.BeanUtils; +import org.springframework.stereotype.Component; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.stream.Collectors; + +/** + *

+ * MhProjectManage + *

+ * + * @author WendyYang + * @since 19:06 2024/1/30 + */ +@Slf4j +@Component +@RequiredArgsConstructor +public class DeclaredRecordManage { + + private final IMhProjectService mhProjectService; + private final IMhProjectSchemaTargetDataService mhProjectSchemaTargetDataService; + private final IProjectService projectService; + private final MhUnitCache mhUnitCache; + private final NoticeManage noticeManage; + private final IProjectDraftService projectDraftService; + private final ProcessModelService processModelService; + private final DefaultDeclaredProjectManage defaultDeclaredProjectManage; + private final ProcessInstanceService processInstanceService; + private final ProjectLibManage projectLibManage; + + private LambdaQueryWrapper buildQuery(DeclaredProjectListReq req) { + LambdaQueryWrapper query = Wrappers.lambdaQuery(MhProject.class) + .like(StrUtil.isNotBlank(req.getProjectName()), MhProject::getProjectName, req.getProjectName()) + .like(StrUtil.isNotBlank(req.getDeclaredUnit()), MhProject::getUnitName, req.getDeclaredUnit()); + if (req.getCreateDateMin() != null) { + query.ge(MhProject::getCreateTime, req.getCreateDateMin()); + } + if (req.getCreateDateMax() != null) { + query.lt(MhProject::getCreateTime, req.getCreateDateMax().minusDays(1)); + } + UserInfoDetails user = LoginUserUtil.loginUserDetail(); + if (!user.getSuperAdmin() && !user.getRegionAdmin()) { + query.eq(MhProject::getUnitId, user.getMhUnitId()); + } + return query; + } + + public PageVo pageDeclaredProject(DeclaredProjectListReq req) { + LambdaQueryWrapper query = buildQuery(req); + Page page = mhProjectService.page(req.page(), query); + if (page.getTotal() == 0) { + return PageVo.empty(); + } + List records = page.getRecords(); + List projectCodes = CollUtils.fieldList(records, MhProject::getProjectCode); + Map projectMap; + if (!projectCodes.isEmpty()) { + List projects = projectService.listNewestByProjectCodes(projectCodes); + projectMap = CollUtils.listToMap(projects, Project::getProjectCode); + } else { + projectMap = Collections.emptyMap(); + } + List data = records.stream().map(w -> { + DeclaredProjectListVO item = new DeclaredProjectListVO(); + item.setMhProjectId(w.getId()); + Project project = projectMap.get(w.getProjectCode()); + if (project == null) { + item.setStatus(null); + item.setStage(null); + } else { + item.setStatus(project.getStatus()); + item.setStage(project.getStage()); + } + item.setProjectCode(w.getProjectCode()); + item.setProjectName(w.getProjectName()); + item.setDeclaredAmount(w.getTotalMoney()); + item.setCreateTime(w.getCreateTime()); + return item; + }).collect(Collectors.toList()); + return PageVo.of(data, page.getTotal()); + } + + public MhProjectBaseInfoVO getProjectBaseInfo(Long mhProjectId) { + MhProject mhProject = mhProjectService.getById(mhProjectId); + if (mhProject == null) { + throw BizException.wrap("项目不存在"); + } + MhProjectBaseInfoVO detail = new MhProjectBaseInfoVO(); + detail.setMhProjectId(mhProject.getId()); + detail.setProjectName(mhProject.getProjectName()); + detail.setDeclaredUnit(mhProject.getUnitName()); + detail.setDeclaredUnitId(mhProject.getUnitId()); + detail.setTotalInvestAmount(mhProject.getTotalMoney()); + detail.setReviewInvestAmount(mhProject.getMoney()); + MhProjectSchemaTargetData schemaTargetData = mhProjectSchemaTargetDataService.getByMhProjectId(mhProjectId); + if (schemaTargetData != null) { + detail.setTotalInvestBudgetAmount(schemaTargetData.getMoney()); + } + UnitDTO unit = mhUnitCache.getById(mhProject.getId()); + if (unit != null) { + detail.setDeclaredUnitUnifiedSocialCreditCode(unit.getUnifiedSocialCreditCode()); + } + return detail; + } + + public String startDeclaredRecord(DefaultDeclaredDTO req) { + UserInfoDetails user = LoginUserUtil.loginUserDetail(); + ProjectDTO projectInfo = req.getProjectInfo(); + + projectInfo.setBuildOrgCode(user.getMhUnitIdStr()); + projectInfo.setBuildOrgName(user.getMhUnitName()); + + // 项目名称去重 + 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.getMhUnitIdStr()); + projectInfo.setSuperOrg(user.getMhUnitName()); + } + + //如果是重新提交的话 判断下 项目是否存在 + if (Objects.nonNull(projectInfo.getId())) { + //新申报的项目不允许带项目id + projectInfo.setId(null); + } + + WflowModels model = processModelService.getOne(Wrappers.lambdaQuery(WflowModels.class) + .eq(WflowModels::getProcessType, ProjectProcessStageEnum.PROJECT_RECORD_APPROVAL_PROCESS.getCode()) + .last(BizConst.LIMIT_1)); + + if (Objects.isNull(model)) { + throw BizException.wrap("找不到立项备案审批流程配置"); + } + + ProcessStartParamsVo params = new ProcessStartParamsVo(); + params.setUser(defaultDeclaredProjectManage.buildUser(user.getUserId())); + params.setProcessUsers(Collections.emptyMap()); + //放入条件判断的项目字段 + ProjectConditionDTO conditionDto = new ProjectConditionDTO(); + BeanUtils.copyProperties(req.getProjectInfo(), conditionDto); + req.getFormData().putAll( + JSON.parseObject(JSON.toJSONString(conditionDto), new TypeReference>() { + }) + ); + params.setFormData(req.getFormData()); + //开始申报 + // 获取发起单位、发起单位主管单位、发起单位上级主管条线单位信息 + Project project = new Project(); + BeanUtils.copyProperties(projectInfo, project); + Map orgModelMap = defaultDeclaredProjectManage.buildOrgModelMap(user.getUserId(), project); + String instanceId = processInstanceService.startProcessLs(model, params, orgModelMap); + log.info("申报项目成功 【{}】", instanceId); + + //如果是重新提交的话 判断下 项目是否存在 + //保存项目相关 + Project buildProject = projectLibManage.saveProjectInDeclared(projectInfo, instanceId, user.getUserId(), + ProjectStatusEnum.NOT_APPROVED, ProjectStatusEnum.DECLARED_APPROVED_RECORD_AUDITING, + ProjectProcessStageEnum.PROJECT_RECORD_APPROVAL_PROCESS); + if (Objects.nonNull(projectInfo.getDraftId())) { + //如果是草稿箱提交 删除对应的草稿箱 + projectDraftService.removeById(projectInfo.getDraftId()); + } + + //发送给第一个审批人消息 + noticeManage.sendFirstUser(buildProject, model.getFormName(), instanceId, + WorkNoticeConst.PASS_MSG_TEMPLATE, MsgTypeEnum.PROJECT_REVIEW); + + return instanceId; + } + + @Transactional(rollbackFor = Exception.class) + public String restartDeclaredRecord(DefaultDeclaredDTO req) { + UserInfoDetails user = LoginUserUtil.loginUserDetail(); + ProjectDTO reqProj = req.getProjectInfo(); + Assert.notNull(reqProj.getId(), "提交失败,缺少项目ID!"); + reqProj.setBuildOrgCode(user.getMhUnitIdStr()); + reqProj.setBuildOrgName(user.getMhUnitName()); + + Project oldProj = projectService.getById(reqProj.getId()); + Assert.notNull(oldProj, "提交失败,此项目不存在!"); + + //项目名称去重 + if (StrUtil.isNotBlank(reqProj.getProjectName()) && + !reqProj.getProjectName().equals(oldProj.getProjectName())) { + reqProj.setProjectCode(oldProj.getProjectCode()); + defaultDeclaredProjectManage.checkDuplication(reqProj); + } + + // 写死 是否有主管单位 + oldProj.setIsHigherSuperOrg(CommonEnum.YES.getCode()); + oldProj.setIsSuperOrg(CommonEnum.YES.getCode()); + + //如果主管单位没有 那么主管单位就是自己 + if (CommonEnum.NO.getCode().equals(reqProj.getIsSuperOrg())) { + oldProj.setSuperOrgCode(user.getMhUnitIdStr()); + oldProj.setSuperOrg(user.getMhUnitName()); + reqProj.setSuperOrgCode(user.getMhUnitIdStr()); + reqProj.setSuperOrg(user.getMhUnitName()); + } + + //判断申报金额 是否等于总的 判断年度支付金额 是否等于总金额 + defaultDeclaredProjectManage.checkAmount(reqProj); + ProjectProcessStageEnum processStageEnum = ProjectProcessStageEnum.PROJECT_RECORD_APPROVAL_PROCESS; + WflowModels model = processModelService.getOne(Wrappers.lambdaQuery(WflowModels.class) + .eq(WflowModels::getProcessType, processStageEnum.getCode()) + .last(BizConst.LIMIT_1)); + + if (Objects.isNull(model)) { + throw BizException.wrap("%s不存在", processStageEnum.getDesc()); + } + + //首先要判断 项目当前状态 是不是 单位内部拒绝 + VUtils.isTrue(!ProjectStatusEnum.DECLARED_APPROVED_RECORD_FAILED.eq(oldProj.getStatus()) || + !ProjectStatusEnum.NOT_APPROVED.eq(oldProj.getStage())) + .throwMessage("提交失败,该项目不是立项备案审核不通过状态或者未立项阶段"); + + ProcessStartParamsVo params = new ProcessStartParamsVo(); + params.setUser(defaultDeclaredProjectManage.buildUser(user.getUserId())); + params.setProcessUsers(Collections.emptyMap()); + + //把条件值给放入工作流 + defaultDeclaredProjectManage.buildCondition(params, req); + + // 获取发起单位、发起单位主管单位、发起单位上级主管条线单位信息 + Project project = new Project(); + BeanUtils.copyProperties(reqProj, project); + Map orgModelMap = defaultDeclaredProjectManage.buildOrgModelMap(user.getUserId(), project); + String instId = processInstanceService.startProcessLs(model, params, orgModelMap); + log.info("立项备案重新提交 【{}】", instId); + + //保存项目相关 + Project newProj = projectLibManage.saveProjectInDeclared(reqProj, instId, user.getUserId(), + ProjectStatusEnum.NOT_APPROVED, + ProjectStatusEnum.DECLARED_APPROVED_RECORD_AUDITING, + processStageEnum); + + //发送给第一个审批人消息 + noticeManage.sendFirstUser(newProj, model.getFormName(), instId, + WorkNoticeConst.PASS_MSG_TEMPLATE, MsgTypeEnum.PROJECT_REVIEW); + + return instId; + } + + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/MhProjectManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/MhProjectManage.java deleted file mode 100644 index 5f93fed..0000000 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/MhProjectManage.java +++ /dev/null @@ -1,124 +0,0 @@ -package com.hz.pm.api.projectlib.manage; - -import cn.hutool.core.util.StrUtil; -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.projectlib.model.entity.MhProject; -import com.hz.pm.api.projectlib.model.entity.MhProjectSchemaTargetData; -import com.hz.pm.api.projectlib.model.entity.Project; -import com.hz.pm.api.projectlib.model.req.DeclaredProjectListReq; -import com.hz.pm.api.projectlib.model.vo.DeclaredProjectListVO; -import com.hz.pm.api.projectlib.model.vo.MhProjectBaseInfoVO; -import com.hz.pm.api.projectlib.service.IMhProjectSchemaTargetDataService; -import com.hz.pm.api.projectlib.service.IMhProjectService; -import com.hz.pm.api.projectlib.service.IProjectService; -import com.hz.pm.api.user.helper.MhUnitCache; -import com.hz.pm.api.user.model.dto.UnitDTO; -import com.hz.pm.api.user.security.model.UserInfoDetails; -import com.hz.pm.api.user.util.LoginUserUtil; -import com.ningdatech.basic.exception.BizException; -import com.ningdatech.basic.model.PageVo; -import com.ningdatech.basic.util.CollUtils; -import lombok.RequiredArgsConstructor; -import org.springframework.stereotype.Component; - -import java.util.Collections; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; - -/** - *

- * MhProjectManage - *

- * - * @author WendyYang - * @since 19:06 2024/1/30 - */ -@Component -@RequiredArgsConstructor -public class MhProjectManage { - - private final IMhProjectService mhProjectService; - private final IMhProjectSchemaTargetDataService mhProjectSchemaTargetDataService; - private final IProjectService projectService; - private final MhUnitCache mhUnitCache; - - private LambdaQueryWrapper buildQuery(DeclaredProjectListReq req) { - LambdaQueryWrapper query = Wrappers.lambdaQuery(MhProject.class) - .like(StrUtil.isNotBlank(req.getProjectName()), MhProject::getProjectName, req.getProjectName()) - .like(StrUtil.isNotBlank(req.getDeclaredUnit()), MhProject::getUnitName, req.getDeclaredUnit()); - if (req.getCreateDateMin() != null) { - query.ge(MhProject::getCreateTime, req.getCreateDateMin()); - } - if (req.getCreateDateMax() != null) { - query.lt(MhProject::getCreateTime, req.getCreateDateMax().minusDays(1)); - } - UserInfoDetails user = LoginUserUtil.loginUserDetail(); - if (!user.getSuperAdmin() && !user.getRegionAdmin()) { - query.eq(MhProject::getUnitId, user.getMhUnitId()); - } - return query; - } - - public PageVo pageDeclaredProject(DeclaredProjectListReq req) { - LambdaQueryWrapper query = buildQuery(req); - Page page = mhProjectService.page(req.page(), query); - if (page.getTotal() == 0) { - return PageVo.empty(); - } - List records = page.getRecords(); - List projectCodes = CollUtils.fieldList(records, MhProject::getProjectCode); - Map projectMap; - if (!projectCodes.isEmpty()) { - List projects = projectService.listNewestByProjectCodes(projectCodes); - projectMap = CollUtils.listToMap(projects, Project::getProjectCode); - } else { - projectMap = Collections.emptyMap(); - } - List data = records.stream().map(w -> { - DeclaredProjectListVO item = new DeclaredProjectListVO(); - item.setMhProjectId(w.getId()); - Project project = projectMap.get(w.getProjectCode()); - if (project == null) { - item.setStatus(null); - item.setStage(null); - } else { - item.setStatus(project.getStatus()); - item.setStage(project.getStage()); - } - item.setProjectCode(w.getProjectCode()); - item.setProjectName(w.getProjectName()); - item.setDeclaredAmount(w.getTotalMoney()); - item.setCreateTime(w.getCreateTime()); - return item; - }).collect(Collectors.toList()); - return PageVo.of(data, page.getTotal()); - } - - public MhProjectBaseInfoVO getProjectBaseInfo(Long mhProjectId) { - MhProject mhProject = mhProjectService.getById(mhProjectId); - if (mhProject == null) { - throw BizException.wrap("项目不存在"); - } - MhProjectBaseInfoVO detail = new MhProjectBaseInfoVO(); - detail.setMhProjectId(mhProject.getId()); - detail.setProjectName(mhProject.getProjectName()); - detail.setDeclaredUnit(mhProject.getUnitName()); - detail.setDeclaredUnitId(mhProject.getUnitId()); - detail.setTotalInvestAmount(mhProject.getTotalMoney()); - detail.setReviewInvestAmount(mhProject.getMoney()); - MhProjectSchemaTargetData schemaTargetData = mhProjectSchemaTargetDataService.getByMhProjectId(mhProjectId); - if (schemaTargetData != null) { - detail.setTotalInvestBudgetAmount(schemaTargetData.getMoney()); - } - UnitDTO unit = mhUnitCache.getById(mhProject.getId()); - if (unit != null) { - detail.setDeclaredUnitUnifiedSocialCreditCode(unit.getUnifiedSocialCreditCode()); - } - return detail; - } - - -} 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 index 55c70ae..31871be 100644 --- 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 @@ -40,8 +40,12 @@ 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.manage.ConstructionManage; import com.hz.pm.api.projectdeclared.model.dto.DelayedApplyDTO; -import com.hz.pm.api.projectdeclared.model.entity.*; +import com.hz.pm.api.projectdeclared.model.entity.Operation; +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.*; import com.hz.pm.api.projectdeclared.utils.GenerateProjectCodeUtil; @@ -49,6 +53,7 @@ import com.hz.pm.api.projectlib.handle.ProcessExecuteChainHandle; import com.hz.pm.api.projectlib.helper.ProjectHelper; import com.hz.pm.api.projectlib.model.constant.ProjectConstant; import com.hz.pm.api.projectlib.model.dto.ProjectDTO; +import com.hz.pm.api.projectlib.model.dto.ProjectPaymentPlanDTO; import com.hz.pm.api.projectlib.model.entity.*; import com.hz.pm.api.projectlib.model.enumeration.InstTypeEnum; import com.hz.pm.api.projectlib.model.enumeration.ProjectRenewalApprovalStatusEnum; @@ -126,23 +131,17 @@ public class ProjectLibManage { private final IPaymentPlanService paymentPlanService; private final ITodoService todoService; private final IProjectCoreBusinessIndicatorsService projectCoreBusinessIndicatorsService; - + private final IProjectPaymentPlanService projectPaymentPlanService; 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; + private final ConstructionManage constructionManage; public PageVo projectLibList(ProjectListReq req) { LambdaQueryWrapper query = ProjectHelper.projectQuery(req); @@ -152,10 +151,14 @@ public class ProjectLibManage { if (CollUtil.isEmpty(page.getRecords())) { return PageVo.empty(); } - - List projectCodes = page.getRecords().stream() - .map(Project::getProjectCode).collect(Collectors.toList()); + Set projectCodes = new HashSet<>(); + List projectIds = new ArrayList<>(); + for (Project project : page.getRecords()) { + projectIds.add(project.getId()); + projectCodes.add(project.getProjectCode()); + } Map> renewalMap = listRenewDeclarations(projectCodes); + Map> paymentPlansMap = projectPaymentPlanService.listByProjectIds(projectIds); List records = CollUtils.convert(page.getRecords(), w -> { ProjectLibListItemVO item = new ProjectLibListItemVO(); @@ -175,13 +178,18 @@ public class ProjectLibManage { item.setProcessStatus(w.getProcessStatus()); item.setInstCode(w.getInstCode()); item.setIsHigherSuperOrg(w.getIsHigherSuperOrg()); + List paymentPlans = paymentPlansMap.getOrDefault(w.getId(), Collections.emptyList()); + BigDecimal totalAnnualPaymentAmount = paymentPlans.stream() + .map(ProjectPaymentPlan::getAnnualPlanAmount) + .reduce(BigDecimal::add).orElse(BigDecimal.ZERO); + List fundDeclarations = renewalMap.get(w.getId()); if (fundDeclarations != null) { - item.setAnnualAccumulateAmount(computeAmount(w.getAnnualPlanAmount(), fundDeclarations)); - item.setAnnualAccumulateAmountList(convertAccmulate(w, fundDeclarations)); + item.setAnnualAccumulateAmount(computeAmount(totalAnnualPaymentAmount, fundDeclarations)); + item.setAnnualAccumulateAmountList(convertAccmulate(w, totalAnnualPaymentAmount, fundDeclarations)); } else { - item.setAnnualAccumulateAmount(w.getAnnualPlanAmount()); - item.setAnnualAccumulateAmountList(convertAccmulate(w, Collections.emptyList())); + item.setAnnualAccumulateAmount(totalAnnualPaymentAmount); + item.setAnnualAccumulateAmountList(convertAccmulate(w, totalAnnualPaymentAmount, Collections.emptyList())); } return item; }); @@ -199,10 +207,14 @@ public class ProjectLibManage { return PageVo.empty(); } UserFullInfoDTO finalUser = user; - - Set projectCodes = page.getRecords().stream() - .map(Project::getProjectCode).collect(Collectors.toSet()); + Set projectCodes = new HashSet<>(); + List projectIds = new ArrayList<>(); + for (Project project : page.getRecords()) { + projectIds.add(project.getId()); + projectCodes.add(project.getProjectCode()); + } Map> projectTagMap = getProjectTags(projectCodes); + Map> paymentPlansMap = projectPaymentPlanService.listByProjectIds(projectIds); Map> renewalMap = listRenewDeclarations(projectCodes); List records = CollUtils.convert(page.getRecords(), w -> { @@ -229,16 +241,20 @@ public class ProjectLibManage { item.setCanPreDeclared(Boolean.TRUE); } item.setApprovedAmount(w.getApprovalAmount()); - item.setAnnualPlanAmount(w.getAnnualPlanAmount()); + List paymentPlans = paymentPlansMap.getOrDefault(w.getId(), Collections.emptyList()); + BigDecimal totalAnnualPaymentAmount = paymentPlans.stream() + .map(ProjectPaymentPlan::getAnnualPlanAmount) + .reduce(BigDecimal::add).orElse(BigDecimal.ZERO); + item.setAnnualPlanAmount(totalAnnualPaymentAmount); item.setPrePlanProjectId(w.getPrePlanProjectId()); item.setTags(projectTagMap.get(w.getProjectCode())); List fundDeclarations = renewalMap.get(w.getId()); if (fundDeclarations != null) { - item.setAnnualAccumulateAmount(computeAmount(w.getAnnualPlanAmount(), fundDeclarations)); - item.setAnnualAccumulateAmountList(convertAccmulate(w, fundDeclarations)); + item.setAnnualAccumulateAmount(computeAmount(totalAnnualPaymentAmount, fundDeclarations)); + item.setAnnualAccumulateAmountList(convertAccmulate(w, totalAnnualPaymentAmount, fundDeclarations)); } else { - item.setAnnualAccumulateAmount(w.getAnnualPlanAmount()); - item.setAnnualAccumulateAmountList(convertAccmulate(w, Collections.emptyList())); + item.setAnnualAccumulateAmount(totalAnnualPaymentAmount); + item.setAnnualAccumulateAmountList(convertAccmulate(w, totalAnnualPaymentAmount, Collections.emptyList())); } return item; }); @@ -304,7 +320,7 @@ public class ProjectLibManage { item.setCanPreDeclared(Boolean.TRUE); } item.setApprovedAmount(w.getApprovalAmount()); - item.setAnnualPlanAmount(w.getAnnualPlanAmount()); + // item.setAnnualPlanAmount(w.getAnnualPlanAmount()); item.setPrePlanProjectId(w.getPrePlanProjectId()); records.add(item); } @@ -578,12 +594,12 @@ public class ProjectLibManage { return annualAmounts; } - public static List convertAccmulate(Project project, List prfs) { + public static List convertAccmulate(Project project, BigDecimal totalAnnualPlanAmount, List prfs) { List annualAmounts = Lists.newArrayList(); annualAmounts.add(AnnualAmountVO.builder() .projectId(project.getId()) .projectYear(project.getProjectYear()) - .annualAmount(project.getAnnualPlanAmount()) + .annualAmount(totalAnnualPlanAmount) .build()); for (ProjectRenewalFundDeclaration prf : prfs) { annualAmounts.add(AnnualAmountVO.builder() @@ -676,17 +692,8 @@ public class ProjectLibManage { 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())); - } + List contracts = constructionManage.detailContractByProjectId(projectInfo.getId()); + vo.setContract(contracts); //查询实施信息 Operation operation = operationService.getOne(Wrappers.lambdaQuery(Operation.class) @@ -725,11 +732,15 @@ public class ProjectLibManage { //查询年度投资金额 要是已验收的项目 if (ProjectStatusEnum.ACCEPTED.getCode().equals(projectInfo.getStatus())) { + List paymentPlans = projectPaymentPlanService.listByProjectId(projectInfo.getId()); + BigDecimal totalAnnualAmount = paymentPlans.stream() + .map(ProjectPaymentPlan::getAnnualPlanAmount) + .reduce(BigDecimal::add).orElse(BigDecimal.ZERO); List annualAmounts = Lists.newArrayList(); annualAmounts.add(AnnualAmountVO.builder() .projectId(projectInfo.getId()) .projectYear(projectInfo.getProjectYear()) - .annualAmount(projectInfo.getAnnualPlanAmount()) + .annualAmount(totalAnnualAmount) .build()); List renewalDeclarations = renewalFundDeclarationService.list(Wrappers.lambdaQuery(ProjectRenewalFundDeclaration.class) .eq(ProjectRenewalFundDeclaration::getProjectId, vo.getId()) @@ -787,6 +798,28 @@ public class ProjectLibManage { return project; } + /** + * 申报新项目时 保存项目信息和其它相关联的信息 + * + * @param projectDto \ + * @param instanceId \ + * @return \ + */ + public Project saveProjectInDeclared(ProjectDTO projectDto, String instanceId, Long userId, + ProjectStatusEnum stage, ProjectStatusEnum status, + ProjectProcessStageEnum processStage) { + Project project = saveProjectNewVersion(projectDto, instanceId, userId, Boolean.FALSE, stage, status); + //保存项目和实例的关系 + ProjectInst projectInst = new ProjectInst(); + projectInst.setProjectId(project.getId()); + projectInst.setInstCode(instanceId); + projectInst.setCreatOn(LocalDateTime.now()); + projectInst.setUpdateOn(LocalDateTime.now()); + projectInst.setInstType(processStage.getCode()); + projectInstService.save(projectInst); + return project; + } + /** * 建设方案申报项目时 保存项目信息和其它相关联的信息 @@ -828,6 +861,14 @@ public class ProjectLibManage { public Project saveProjectNewVersion(ProjectDTO projectDto, String instanceId, Long userId, Boolean isContruct) { //流程启动之后 入库项目 重要业务信息 用于列表查询 展示 + return saveProjectNewVersion(projectDto, instanceId, userId, isContruct, ProjectStatusEnum.NOT_APPROVED, ProjectStatusEnum.UNDER_INTERNAL_AUDIT); + } + + public Project saveProjectNewVersion(ProjectDTO projectDto, String instanceId, + Long userId, Boolean isContruct, + ProjectStatusEnum stage, + ProjectStatusEnum status) { + //流程启动之后 入库项目 重要业务信息 用于列表查询 展示 try { Project project = new Project(); //为空 代表是新申报的 @@ -835,14 +876,15 @@ public class ProjectLibManage { 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.setStage(stage.getCode()); + project.setStatus(status.getCode()); project.setInstCode(instanceId); project.setSponsor(String.valueOf(userId)); String projectCode = generateProjectCodeUtil.generateProjectCode(projectDto); project.setProjectCode(projectCode); if (projectService.save(project)) { saveApplication(projectDto, project, null); + savePaymentPlans(project, projectDto.getPaymentPlanList()); } } else { //否则是重新提交的 新生成一个新版本的项目 @@ -860,6 +902,18 @@ public class ProjectLibManage { } } + private void savePaymentPlans(Project project, List paymentPlans) { + Integer version = Objects.nonNull(project.getVersion()) ? project.getVersion() : 1; + projectPaymentPlanService.remove(project.getProjectCode(), version); + List plans = paymentPlans.stream().map(w -> { + ProjectPaymentPlan plan = BeanUtil.copyProperties(w, ProjectPaymentPlan.class); + plan.setProjectCode(project.getProjectCode()); + plan.setProjectVersion(version); + return plan; + }).collect(Collectors.toList()); + projectPaymentPlanService.saveBatch(plans); + } + /** * 建设方案申报项目时 保存项目信息和其它相关联的信息 * @@ -962,7 +1016,7 @@ public class ProjectLibManage { projectService.updateById(oldProject); projectService.reverseNewest(project.getProjectCode(), project.getId()); saveApplication(projecDto, project, isContruct); - + savePaymentPlans(project, projecDto.getPaymentPlanList()); return project; } @@ -1513,29 +1567,21 @@ public class ProjectLibManage { //采取批量删除 批量添加的方式 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); - } - + projectApplicationService.remove(project.getProjectCode(), version); 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.setProjectId(project.getId()); + projectApplication.setProjectCode(project.getProjectCode()); + projectApplication.setBuildOrgCode(project.getBuildOrgCode()); + projectApplication.setBuildOrgName(project.getBuildOrgName()); projectApplication.setProjectVersion(version); projectApplication.setIsConstruct(isConstruct); if (StringUtils.isNotBlank(application.getRelatedExistsApplication())) { projectApplication.setApplicationName(null); } - boolean result = projectApplicationService.save(projectApplication); // 保存应用关联的核心业务 List coreBusinessList = application.getCoreBusinessList(); @@ -1558,8 +1604,8 @@ public class ProjectLibManage { /** * 申报项目转化为 项目归集 * - * @param projectCode - * @return + * @param projectCode \ + * @return \ */ public GovBizProjectDetailVO convertToCollection(String projectCode) { ProjectDetailVO projectDetailVO = this.detailProjectCode(projectCode); 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 index 3e033cf..6e61030 100644 --- 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 @@ -9,6 +9,8 @@ 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.hz.pm.api.projectlib.model.entity.ProjectPaymentPlan; +import com.hz.pm.api.projectlib.service.IProjectPaymentPlanService; import com.hz.pm.api.user.security.model.UserInfoDetails; import com.hz.pm.api.user.util.LoginUserUtil; import com.ningdatech.basic.exception.BizException; @@ -91,9 +93,8 @@ public class ProjectRenewalFundManage { private final IGovBizProjectApproveService approveService; - private final RegionCacheHelper regionCacheHelper; - private final IPaymentPlanService paymentPlanService; + private final IProjectPaymentPlanService projectPaymentPlanService; /** * 项目续建资金库列表 分页 @@ -131,7 +132,14 @@ public class ProjectRenewalFundManage { return PageVo.empty(); } - List projectCodes = CollUtils.fieldList(page.getRecords(), Project::getProjectCode); + Set projectCodes = new HashSet<>(); + List projectIds = new ArrayList<>(); + for (Project project : page.getRecords()) { + projectIds.add(project.getId()); + projectCodes.add(project.getProjectCode()); + } + + Map> paymentPlansMap = projectPaymentPlanService.listByProjectIds(projectIds); Map> renewalMap; if (CollUtil.isNotEmpty(projectCodes)) { @@ -172,15 +180,20 @@ public class ProjectRenewalFundManage { item.setCanPreDeclared(Boolean.TRUE); } item.setApprovedAmount(w.getApprovalAmount()); - item.setAnnualPlanAmount(w.getAnnualPlanAmount()); + List paymentPlans = paymentPlansMap.getOrDefault(w.getId(), Collections.emptyList()); + BigDecimal totalAnnualPaymentAmount = paymentPlans.stream() + .map(ProjectPaymentPlan::getAnnualPlanAmount) + .reduce(BigDecimal::add).orElse(BigDecimal.ZERO); + + item.setAnnualPlanAmount(totalAnnualPaymentAmount); 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)); + item.setAnnualAccumulateAmount(ProjectLibManage.computeAmount(totalAnnualPaymentAmount, prfs)); + item.setAnnualAccumulateAmountList(ProjectLibManage.convertAccmulate(w, totalAnnualPaymentAmount, prfs)); } else { - item.setAnnualAccumulateAmount(w.getAnnualPlanAmount()); - item.setAnnualAccumulateAmountList(ProjectLibManage.convertAccmulate(w, Collections.emptyList())); + item.setAnnualAccumulateAmount(totalAnnualPaymentAmount); + item.setAnnualAccumulateAmountList(ProjectLibManage.convertAccmulate(w, totalAnnualPaymentAmount, Collections.emptyList())); } return item; }); @@ -223,11 +236,18 @@ public class ProjectRenewalFundManage { vo.setBuildOrgName(project.getBuildOrgName()); vo.setAnnualPaymentAmount(renewal.getAnnualPaymentAmount()); List annualAmounts = Lists.newArrayList(); + + List paymentPlans = projectPaymentPlanService.listByProjectId(project.getId()); + + BigDecimal totalAnnualPaymentAmount = paymentPlans.stream() + .map(ProjectPaymentPlan::getAnnualPlanAmount) + .reduce(BigDecimal::add).orElse(BigDecimal.ZERO); + annualAmounts.add(AnnualAmountVO.builder() .projectId(project.getId()) .projectCode(project.getProjectCode()) .projectYear(project.getProjectYear()) - .annualAmount(project.getAnnualPlanAmount()) + .annualAmount(totalAnnualPaymentAmount) .build()); List renewalDeclarations = projectRenewalFundDeclarationService.list(Wrappers.lambdaQuery(ProjectRenewalFundDeclaration.class) .eq(ProjectRenewalFundDeclaration::getProjectId, vo.getProjectId()) 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 index b26ca24..c60155c 100644 --- 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 @@ -18,7 +18,6 @@ approval_amount, stage, status, - annual_plan_amount, biz_domain, inst_code, is_higher_super_org, @@ -41,7 +40,6 @@ approval_amount, stage, status, - annual_plan_amount, biz_domain, inst_code, is_higher_super_org, @@ -297,7 +295,6 @@ approval_amount, stage, status, - annual_plan_amount, biz_domain, inst_code, is_higher_super_org, @@ -320,7 +317,6 @@ approval_amount, stage, status, - annual_plan_amount, biz_domain, inst_code, is_higher_super_org, diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/mapper/ProjectPaymentPlanMapper.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/mapper/ProjectPaymentPlanMapper.java new file mode 100644 index 0000000..c592f7c --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/mapper/ProjectPaymentPlanMapper.java @@ -0,0 +1,16 @@ +package com.hz.pm.api.projectlib.mapper; + +import com.hz.pm.api.projectlib.model.entity.ProjectPaymentPlan; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * Mapper 接口 + *

+ * + * @author WendyYang + * @since 2024-02-21 + */ +public interface ProjectPaymentPlanMapper extends BaseMapper { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/mapper/ProjectPaymentPlanMapper.xml b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/mapper/ProjectPaymentPlanMapper.xml new file mode 100644 index 0000000..6346f93 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/mapper/ProjectPaymentPlanMapper.xml @@ -0,0 +1,5 @@ + + + + + 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 index cfcbf65..deadb2e 100644 --- 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 @@ -21,7 +21,7 @@ import java.util.Map; * @since 2023-02-03 */ @Data -@ApiModel(value = "NdProjectDto", description = "") +@ApiModel(value = "NdProjectDto") public class ProjectDTO implements Serializable { private static final long serialVersionUID = 1L; @@ -176,28 +176,13 @@ public class ProjectDTO implements Serializable { @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 List paymentPlanList; @ApiModelProperty("立项批复资金(万元)") private BigDecimal approvalAmount; - @JsonFormat(shape = JsonFormat.Shape.STRING, pattern="yyyy-MM-dd HH:mm:ss") + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss") private LocalDateTime annualPlanAddTime; @ApiModelProperty("核心业务-核心业务模块") @@ -326,7 +311,7 @@ public class ProjectDTO implements Serializable { @ApiModelProperty("终验材料") private String finalAcceptanceMaterials; - private Map dynamicForm; + private Map dynamicForm; //P省级,M市级,C县(市、区)级,T乡镇(街道、办事处)级,V村(社区)级 private String baseLowestLevel; @@ -349,6 +334,9 @@ public class ProjectDTO implements Serializable { @ApiModelProperty("可研报告") private String baseResearchReportFile; + @ApiModelProperty("可研批复文件") + private String baseResearchReportApprovalFile; + @ApiModelProperty("其他附件") private String baseProjOtherFile; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/dto/ProjectPaymentPlanDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/dto/ProjectPaymentPlanDTO.java new file mode 100644 index 0000000..c2699c3 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/dto/ProjectPaymentPlanDTO.java @@ -0,0 +1,37 @@ +package com.hz.pm.api.projectlib.model.dto; + +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.math.BigDecimal; + +/** + *

+ * ProjectPaymentPlanDTO + *

+ * + * @author WendyYang + * @since 11:36 2024/2/21 + */ +@Data +@ApiModel("年度支付计划") +public class ProjectPaymentPlanDTO { + + @ApiModelProperty("支付年度") + private Integer paymentYear; + + @ApiModelProperty("年度支付计划-年度支付计划(万元)") + private BigDecimal annualPlanAmount; + + @ApiModelProperty("年度支付计划-自有金额(万元)") + private BigDecimal annualPlanHaveAmount; + + @ApiModelProperty("年度支付计划-政府投资-本级财政资金(万元)") + private BigDecimal annualPlanGovOwnFinanceAmount; + + @ApiModelProperty("年度支付计划-政府投资-上级补助资金(万元)") + private BigDecimal annualPlanGovSuperiorFinanceAmount; + +} 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 index 59d6e5f..fa7949b 100644 --- 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 @@ -209,30 +209,6 @@ public class Project implements Serializable { @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; @@ -535,6 +511,9 @@ public class Project implements Serializable { @ApiModelProperty("可研报告") private String baseResearchReportFile; + @ApiModelProperty("可研批复文件") + private String baseResearchReportApprovalFile; + @ApiModelProperty("其他附件") private String baseProjOtherFile; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/entity/ProjectPaymentPlan.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/entity/ProjectPaymentPlan.java new file mode 100644 index 0000000..cbeba84 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/entity/ProjectPaymentPlan.java @@ -0,0 +1,50 @@ +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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; + +/** + *

+ * 项目年度支付计划 + *

+ * + * @author WendyYang + * @since 2024-02-21 + */ +@Data +@TableName("ND_PROJECT_PAYMENT_PLAN") +@ApiModel(value = "NdProjectPaymentPlan对象") +public class ProjectPaymentPlan implements Serializable { + + private static final long serialVersionUID = 1L; + + @TableId(value = "ID", type = IdType.AUTO) + private Long id; + + @ApiModelProperty("支付年度") + private Integer paymentYear; + + private BigDecimal annualPlanAmount; + + private BigDecimal annualPlanHaveAmount; + + private BigDecimal annualPlanGovOwnFinanceAmount; + + private BigDecimal annualPlanGovSuperiorFinanceAmount; + + private Long projectId; + + @ApiModelProperty("项目编码") + private String projectCode; + + @ApiModelProperty("项目版本") + private Integer projectVersion; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/enumeration/ProjectStatusEnum.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/enumeration/ProjectStatusEnum.java index f6007ea..597236b 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/enumeration/ProjectStatusEnum.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/enumeration/ProjectStatusEnum.java @@ -5,6 +5,7 @@ import lombok.AllArgsConstructor; import lombok.Getter; import lombok.NoArgsConstructor; import org.apache.commons.lang3.StringUtils; + import java.util.Objects; /** @@ -22,44 +23,50 @@ 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), + 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), + 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), + /** + * 信产项目备案 + */ + DECLARED_APPROVED_TO_BE_RECORD(10022, "待立项备案", null), + DECLARED_APPROVED_RECORD_AUDITING(10022, "立项备案审核中", null), + DECLARED_APPROVED_RECORD_FAILED(10023, "立项备案审核不通过", 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), + 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); + ARCHIVED(30000, "已归档", null), + ACCEPTED(30001, "已验收", GovProjectStatusEnum.HAS_FINAL_INS); private Integer code; private String desc; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/vo/DeclaredProjectListVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/vo/DeclaredProjectListVO.java index a35368f..6ab19a8 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/vo/DeclaredProjectListVO.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/vo/DeclaredProjectListVO.java @@ -35,7 +35,7 @@ public class DeclaredProjectListVO { @ApiModelProperty("创建时间") private LocalDateTime createTime; - @ApiModelProperty("项目名称") + @ApiModelProperty("项目编码") private String projectCode; @ApiModelProperty("ID") 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 index 09b244e..a5349aa 100644 --- 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 @@ -402,7 +402,7 @@ public class ProjectDetailVO { private BigDecimal contractAmount; @ApiModelProperty("合同信息") - private ContractVO contract; + private List contract; @ApiModelProperty("采购信息") private List purchases; 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 index c154028..d9cc391 100644 --- 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 @@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers; 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 com.hz.pm.api.projectlib.model.entity.ProjectPaymentPlan; import java.util.List; @@ -26,4 +27,10 @@ public interface IProjectApplicationService extends IService .eq(ProjectApplication::getProjectId, projectId)); } + default void remove(String projectCode, Integer projectVersion) { + remove(Wrappers.lambdaQuery(ProjectApplication.class) + .eq(ProjectApplication::getProjectCode, projectCode) + .eq(ProjectApplication::getProjectVersion, projectVersion)); + } + } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/IProjectPaymentPlanService.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/IProjectPaymentPlanService.java new file mode 100644 index 0000000..2e83374 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/IProjectPaymentPlanService.java @@ -0,0 +1,44 @@ +package com.hz.pm.api.projectlib.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.hz.pm.api.projectlib.model.entity.ProjectPaymentPlan; +import com.ningdatech.basic.util.CollUtils; + +import java.util.Collection; +import java.util.List; +import java.util.Map; + +/** + *

+ * 服务类 + *

+ * + * @author WendyYang + * @since 2024-02-21 + */ +public interface IProjectPaymentPlanService extends IService { + + default void remove(String projectCode, Integer projectVersion) { + remove(Wrappers.lambdaQuery(ProjectPaymentPlan.class) + .eq(ProjectPaymentPlan::getProjectCode, projectCode) + .eq(ProjectPaymentPlan::getProjectVersion, projectVersion)); + } + + default Map> listByProjectIds(Collection projectIds) { + LambdaQueryWrapper query = Wrappers.lambdaQuery(ProjectPaymentPlan.class) + .in(ProjectPaymentPlan::getProjectId, projectIds) + .orderByAsc(ProjectPaymentPlan::getPaymentYear); + return CollUtils.group(list(query), ProjectPaymentPlan::getProjectId); + } + + default List listByProjectId(Long projectId) { + LambdaQueryWrapper query = Wrappers.lambdaQuery(ProjectPaymentPlan.class) + .eq(ProjectPaymentPlan::getProjectId, projectId) + .orderByAsc(ProjectPaymentPlan::getPaymentYear); + return list(query); + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/impl/ProjectPaymentPlanServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/impl/ProjectPaymentPlanServiceImpl.java new file mode 100644 index 0000000..8fdeacf --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/impl/ProjectPaymentPlanServiceImpl.java @@ -0,0 +1,20 @@ +package com.hz.pm.api.projectlib.service.impl; + +import com.hz.pm.api.projectlib.model.entity.ProjectPaymentPlan; +import com.hz.pm.api.projectlib.mapper.ProjectPaymentPlanMapper; +import com.hz.pm.api.projectlib.service.IProjectPaymentPlanService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author WendyYang + * @since 2024-02-21 + */ +@Service +public class ProjectPaymentPlanServiceImpl extends ServiceImpl implements IProjectPaymentPlanService { + +} 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 index ad98880..e3c8f3c 100644 --- 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 @@ -28,7 +28,7 @@ import java.time.Duration; import java.util.List; import java.util.Objects; -import static com.hz.pm.api.todocenter.constant.WorkNoticeConstant.CC_MSG_TEMPLATE; +import static com.hz.pm.api.todocenter.constant.WorkNoticeConst.CC_MSG_TEMPLATE; /** * 抄送事件 事件监听 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 index b3a59ab..8b1fc8b 100644 --- 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 @@ -40,8 +40,8 @@ import java.util.List; import java.util.Objects; import java.util.Set; -import static com.hz.pm.api.todocenter.constant.WorkNoticeConstant.PASS_MSG_TEMPLATE; -import static com.hz.pm.api.todocenter.constant.WorkNoticeConstant.PASS_MSG_TEMPLATE2; +import static com.hz.pm.api.todocenter.constant.WorkNoticeConst.PASS_MSG_TEMPLATE; +import static com.hz.pm.api.todocenter.constant.WorkNoticeConst.PASS_MSG_TEMPLATE2; /** * 工作流开始 结束监听 自动审批的话 会漏掉 调用状态机 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 index b35b385..37e7524 100644 --- 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 @@ -55,7 +55,7 @@ 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; +import static com.hz.pm.api.todocenter.constant.WorkNoticeConst.AUDIT_WORK_TITLE; /** *

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 index 1b2dbb7..b9dc6d1 100644 --- 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 @@ -7,13 +7,12 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Assert; 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.todocenter.constant.WorkNoticeConst; import com.hz.pm.api.user.util.LoginUserUtil; import lombok.RequiredArgsConstructor; import org.apache.commons.lang3.StringUtils; @@ -57,9 +56,9 @@ public class NotifyManage { 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); + Long projectId = jsonObject.getLong(WorkNoticeConst.PROJECT_ID); + String instanceId = jsonObject.getString(WorkNoticeConst.INSTANCE_ID); + Long meetingId = jsonObject.getLong(WorkNoticeConst.MEETING_ID); notifyVo.setProjectId(projectId); notifyVo.setInstanceId(instanceId); notifyVo.setMeetingId(meetingId); 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/WorkNoticeConst.java similarity index 94% rename from hz-pm-api/src/main/java/com/hz/pm/api/todocenter/constant/WorkNoticeConstant.java rename to hz-pm-api/src/main/java/com/hz/pm/api/todocenter/constant/WorkNoticeConst.java index 8b07769..1add096 100644 --- 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/WorkNoticeConst.java @@ -4,9 +4,9 @@ package com.hz.pm.api.todocenter.constant; * @author CMM * @since 2023/02/01 14:56 */ -public class WorkNoticeConstant { +public class WorkNoticeConst { - private WorkNoticeConstant() { + private WorkNoticeConst() { } public static final String PASS_MSG_TEMPLATE = "【%s】的【%s】需要您审核。"; 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 index fb6c9c5..06ca656 100644 --- 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 @@ -16,6 +16,7 @@ import com.hz.pm.api.filemanage.service.INdProjectApplyBorrowService; import com.hz.pm.api.projectdeclared.manage.DeclaredProjectManage; import com.hz.pm.api.projectdeclared.model.dto.ProjectDraftSaveDTO; import com.hz.pm.api.projectdeclared.model.entity.ProjectConstructionSuggestions; +import com.hz.pm.api.projectdeclared.model.enumerization.ProjectDraftTypeEnum; import com.hz.pm.api.projectdeclared.service.IConstructionSuggestionsService; import com.hz.pm.api.projectlib.model.dto.ProjectApplicationDTO; import com.hz.pm.api.projectlib.model.dto.ProjectDTO; @@ -25,10 +26,7 @@ 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.enumeration.InstTypeEnum; import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum; -import com.hz.pm.api.projectlib.service.INdProjectDelayApplyService; -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.projectlib.service.*; import com.hz.pm.api.staging.enums.MsgTypeEnum; import com.hz.pm.api.staging.service.IProjectStagingService; import com.hz.pm.api.sys.manage.NoticeManage; @@ -60,7 +58,7 @@ import java.time.format.DateTimeFormatter; import java.util.*; import java.util.stream.Collectors; -import static com.hz.pm.api.todocenter.constant.WorkNoticeConstant.*; +import static com.hz.pm.api.todocenter.constant.WorkNoticeConst.*; /** * @Classname HandlerManage @@ -329,7 +327,7 @@ public class HandlerManage { }); projectInfo.setDynamicForm(dynamicMap); draftSaveDto.setProjectInfo(projectInfo); - declaredProjectManage.saveToDraft(draftSaveDto); + declaredProjectManage.saveToDraft(draftSaveDto, ProjectDraftTypeEnum.PROJECT_DECLARED.getCode()); } /** 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 index 563f9cc..9423264 100644 --- 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 @@ -1414,8 +1414,8 @@ public class TodoCenterManage { paramsMap.put("cloudType", cloudTypeName); } // 获取本年计划投资金额 - BigDecimal yearPlanInvest = project.getAnnualPlanAmount(); - paramsMap.put("yearPlanInvest", yearPlanInvest); + // BigDecimal yearPlanInvest = project.getAnnualPlanAmount(); + paramsMap.put("yearPlanInvest", BigDecimal.ZERO); // 根据地区编码获取当地大数据局(中心)的名称 paramsMap.put("bigDataBureauName", null); // 备注模块如果为空 diff --git a/hz-pm-api/src/main/resources/application-dev.yml b/hz-pm-api/src/main/resources/application-dev.yml index b44e72e..f3f384b 100644 --- a/hz-pm-api/src/main/resources/application-dev.yml +++ b/hz-pm-api/src/main/resources/application-dev.yml @@ -51,9 +51,9 @@ spring: # 是客户端等待连接池连接的最大毫秒数 connection-timeout: 30000 # 是允许连接在连接池中空闲的最长时间 - minimum-idle: 5 + minimum-idle: 10 # 配置最大池大小 - maximum-pool-size: 300 + maximum-pool-size: 20 # 是允许连接在连接池中空闲的最长时间(以毫秒为单位) idle-timeout: 60000 # 池中连接关闭后的最长生命周期(以毫秒为单位) @@ -61,7 +61,7 @@ spring: # 配置从池返回的连接的默认自动提交行为。默认值为true。 auto-commit: true # 开启连接监测泄露 - leak-detection-threshold: 5000 + leak-detection-threshold: 6000 # 测试连接数据库 connection-test-query: SELECT 1 #设置上传 单个文件的大小 @@ -253,8 +253,8 @@ mh: api-host: https://hzszxc.hzswb.cn:8443/test/mh-gateway/auth-single expert-qr-code-url: https://jiema.wwei.cn/uploads/2023/12/28/658d7a3f15f06.jpg file: - down-url: https://weixin.hzszxc.hzswb.cn:8443/mh-gateway/oss/oss/previewFileLogin - detail-url: https://weixin.hzszxc.hzswb.cn:8443/mh-gateway/oss/ossfile/getFileInfoList + down-url: https://weixin.hzszxc.hzswb.cn:8443/test/mh-gateway/oss/oss/previewFileLogin + detail-url: https://weixin.hzszxc.hzswb.cn:8443/test/mh-gateway/oss/ossfile/getFileInfoList auth-code: secret-key: nqkmzqojg5j4eiypr3rb8s7nb4noa8b2 agent-login: 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 index 2aca077..f090a43 100644 --- 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 @@ -1,19 +1,13 @@ 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.common.util.Md5Util; 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; @@ -87,7 +81,7 @@ public class CoreTest {//extends AppTests dto.setAppKey(appKey); dto.setSecret(secret); dto.setRequestTime(requestTime); - String sign = Md5Utils.hash(appKey + secret + requestTime); + String sign = Md5Util.hash(appKey + secret + requestTime); dto.setSign(sign); HttpHeaders headers = new HttpHeaders(); MediaType type = MediaType.parseMediaType("application/json; charset=UTF-8"); 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 index 4d3569e..6bfbc58 100644 --- 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 @@ -38,7 +38,7 @@ 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; +import static com.hz.pm.api.todocenter.constant.WorkNoticeConst.PASS_MSG_TEMPLATE; /** * 待办中心测试 diff --git a/hz-pm-gen/src/main/java/com/hz/pm/gen/config/CodeGen.java b/hz-pm-gen/src/main/java/com/hz/pm/gen/config/CodeGen.java index 272bc4a..dded921 100644 --- a/hz-pm-gen/src/main/java/com/hz/pm/gen/config/CodeGen.java +++ b/hz-pm-gen/src/main/java/com/hz/pm/gen/config/CodeGen.java @@ -55,7 +55,7 @@ public class CodeGen { } public static void main(String[] args) { - generate("WendyYang", "projectlib", PATH_YYD, "mh_project_schema_target_data"); + generate("WendyYang", "projectlib", PATH_YYD, "nd_project_payment_plan"); } }