From 8f48941ca0f4d64517f14f12fc7a7378fbc89cdc Mon Sep 17 00:00:00 2001 From: WendyYang Date: Mon, 8 Jan 2024 17:54:55 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pm/api/common/model/entity/MenuTreeEntity.java | 2 +- .../action/ProjectDeclareChoiceAction.java | 6 +- .../factory/ProjectDeclareGuardFactory.java | 4 +- .../statemachine/util/MachineBuilderFounder.java | 80 +++++------ .../common/statemachine/util/StateMachineUtil.java | 153 ++++++++++++++++++++ .../statemachine/util/StateMachineUtils.java | 160 --------------------- .../com/hz/pm/api/common/util/JwtTokenUtil.java | 91 ------------ .../java/com/hz/pm/api/common/util/MDCUtil.java | 3 + .../java/com/hz/pm/api/common/util/TreeUtil.java | 6 +- .../dashboard/manage/MeetingStatisticsManage.java | 5 +- .../model/vo/PerformanceStatisticsVO.java | 3 +- .../ExpertAdminExpertManageAssembler.java | 8 +- .../hz/pm/api/expert/assembler/TagAssembler.java | 29 ---- .../pm/api/expert/controller/ExpertController.java | 3 - .../api/expert/manage/ExpertMetaApplyManage.java | 1 - .../service/impl/ExpertAdminManageServiceImpl.java | 8 +- .../api/external/controller/MhSyncController.java | 1 - .../pm/api/external/model/dto/MhTechExpertDTO.java | 4 - .../api/filemanage/manage/ProjectFileManage.java | 3 +- .../model/entity/ProjectApplyBorrow.java | 2 +- .../pm/api/filemanage/model/vo/ProjectFileVO.java | 2 - .../hz/pm/api/gov/utils/ProjectConvertUtil.java | 2 +- .../hz/pm/api/irs/controller/IrsController.java | 5 +- .../api/irs/controller/IrsProjectController.java | 9 +- .../com/hz/pm/api/irs/manage/AppIrsManage.java | 6 +- .../com/hz/pm/api/irs/manage/IrsProjectManage.java | 5 +- .../com/hz/pm/api/leave/manage/LeaveManage.java | 3 - .../api/meeting/builder/YxtSmsContextBuilder.java | 129 ----------------- .../controller/MeetingExpertJudgeController.java | 2 - .../meeting/entity/domain/MeetingExpertJudge.java | 1 - .../api/meeting/entity/dto/ExpertIdFilterDTO.java | 1 - .../api/meeting/entity/vo/MeetingByManagerVO.java | 2 - .../pm/api/meeting/helper/MeetingManageHelper.java | 1 - .../pm/api/meeting/helper/YxtCallOrSmsHelper.java | 8 +- .../hz/pm/api/meta/assembler/MetaTagAssembler.java | 37 +++-- .../api/meta/helper/basic/AbstractTagsCache.java | 4 +- .../java/com/hz/pm/api/meta/manage/MetaManage.java | 16 +-- .../service/impl/MetaDictionaryServiceImpl.java | 7 +- .../api/meta/service/impl/MetaTagServiceImpl.java | 7 +- .../organization/manage/OrganizationManage.java | 4 +- .../model/vo/OrganizationSynthesizeTreeVO.java | 3 - .../organization/model/vo/OrganizationTreeVO.java | 2 +- .../convert/PerformanceAppraisalConveter.java | 7 +- .../performance/manage/OrgSelfAppraisalManage.java | 2 +- .../mapper/PerformanceAppraisalMapper.java | 1 - .../mapper/PerformanceAppraisalProjectMapper.java | 1 - .../model/dto/PerformanceAppraisalEditDTO.java | 3 - .../PerformanceAppraisalProjectGroupSaveDTO.java | 4 - .../dto/PerformanceIndicatorAppIndexSaveDTO.java | 13 +- .../PerformanceIndicatorProjectIndexSaveDTO.java | 8 +- .../model/entity/PerformanceAppraisalProject.java | 1 - .../PerformanceIndicatorProjectTemplate.java | 2 - .../model/vo/ProjectIndexTemplateVO.java | 1 - .../api/performance/model/vo/ProjectIndexVO.java | 11 +- .../pm/api/performance/util/ContentTypeUtils.java | 1 - .../projectdeclared/manage/ConstructionManage.java | 8 +- .../manage/ConstructionPlanManage.java | 12 +- .../projectdeclared/manage/DelayedApplyManage.java | 49 ++++--- .../projectdeclared/manage/OperationManage.java | 6 +- .../PrequalificationDeclaredProjectManage.java | 6 +- .../manage/ProjectAdjustmentManage.java | 63 ++++---- .../api/projectdeclared/manage/PurchaseManage.java | 6 +- .../projectdeclared/model/dto/OperationDTO.java | 3 - .../model/dto/PaymentPlanSupplementDTO.java | 2 - .../model/dto/PreInsAcceptancePersonSaveDTO.java | 3 - .../projectdeclared/model/dto/PreInsSaveDTO.java | 3 - .../model/dto/ProjectDraftSaveDTO.java | 2 +- .../projectdeclared/model/entity/PaymentPlan.java | 5 +- .../model/entity/PreInsAcceptancePerson.java | 1 - .../model/vo/PreInsAcceptancePersonVO.java | 3 - .../pm/api/projectdeclared/model/vo/PreInsVO.java | 5 - .../utils/ReStartProcessMapUtil.java | 58 -------- .../utils/RestartProcessMapUtil.java | 51 +++++++ .../pm/api/projectlib/handle/AnnualPlanHandle.java | 34 +++-- .../handle/ProcessExecuteChainHandle.java | 4 +- .../api/projectlib/manage/AnnualPlanLibManage.java | 4 +- .../pm/api/projectlib/manage/ProjectLibManage.java | 80 +++++------ .../manage/ProjectRenewalFundManage.java | 39 +++-- .../model/po/ProjectRenewalFundDeclarationPO.java | 3 - .../model/req/ProjectRenewalAuditReq.java | 2 - .../service/INdProjectStatusChangeService.java | 4 + .../impl/NdProjectStatusChangeServiceImpl.java | 12 ++ .../hz/pm/api/provincial/model/res/OssApiData.java | 2 - .../api/provincial/model/res/OssApiResponse.java | 2 +- .../api/scheduler/listener/ProcessEndListener.java | 6 +- .../scheduler/listener/ProcessStartListener.java | 6 +- .../task/CheckProvincialReviewResultTask.java | 6 +- .../api/scheduler/task/ProjectStatusFlowTask.java | 50 +++---- .../staging/utils/ProjectStatusFlowMapUtil.java | 29 ++-- .../api/staging/utils/WorkNoticeFlowMapUtil.java | 8 +- .../com/hz/pm/api/sys/mapper/NotifyMapper.java | 1 - .../sys/model/dto/MeetingReviewMsgExtraDTO.java | 5 + .../com/hz/pm/api/sys/model/dto/MenuSaveDTO.java | 1 - .../java/com/hz/pm/api/sys/model/entity/Menu.java | 2 +- .../com/hz/pm/api/sys/model/vo/MenuRoleVO.java | 2 +- .../pm/api/todocenter/enumeration/IsOrNotEnum.java | 13 +- .../hz/pm/api/todocenter/manage/HandlerManage.java | 142 +++++++++--------- .../hz/pm/api/todocenter/service/ITodoService.java | 2 +- .../todocenter/service/impl/TodoServiceImpl.java | 6 +- .../com/hz/pm/api/todocenter/utils/PdfUtils.java | 22 ++- .../java/com/hz/pm/api/user/entity/MhUnit.java | 6 +- .../workbench/converter/WorkbenchConverter.java | 5 - .../hz/pm/api/workbench/model/vo/WorkbenchVO.java | 3 +- .../hz/pm/api/sys/project/ProjectStateTest.java | 6 +- .../main/java/com/hz/pm/sync/SynDataTaskApp.java | 1 - .../pm/sync/open/manage/ProjectReceiveManage.java | 113 ++++++++------- 106 files changed, 700 insertions(+), 1090 deletions(-) create mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/util/StateMachineUtil.java delete mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/util/StateMachineUtils.java delete mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/common/util/JwtTokenUtil.java delete mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/expert/assembler/TagAssembler.java delete mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/meeting/builder/YxtSmsContextBuilder.java delete mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/utils/ReStartProcessMapUtil.java create mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/utils/RestartProcessMapUtil.java diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/model/entity/MenuTreeEntity.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/model/entity/MenuTreeEntity.java index 2209dab..aceb4cd 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/common/model/entity/MenuTreeEntity.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/model/entity/MenuTreeEntity.java @@ -29,7 +29,7 @@ import static com.baomidou.mybatisplus.annotation.SqlCondition.LIKE; @Setter @Accessors(chain = true) @ToString(callSuper = true) -public class MenuTreeEntity { +public class MenuTreeEntity { @TableId(value = "id", type = IdType.AUTO) protected Long id; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareChoiceAction.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareChoiceAction.java index 254a69f..b5eff58 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareChoiceAction.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareChoiceAction.java @@ -4,7 +4,7 @@ import cn.hutool.core.collection.CollUtil; import com.hz.pm.api.common.model.constant.ProjectDeclareConst; import com.hz.pm.api.common.model.constant.StateMachineConst; import com.hz.pm.api.common.enumeration.CommonEnum; -import com.hz.pm.api.common.statemachine.util.StateMachineUtils; +import com.hz.pm.api.common.statemachine.util.StateMachineUtil; 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; @@ -75,7 +75,7 @@ public class ProjectDeclareChoiceAction implements Action stateContext) { Project project = stateContext.getMessage().getHeaders().get(PROJECT_DECLARE, Project.class); log.info("预审申报事件之前,项目的状态为:{}"+project.getStatus()); - if (StateMachineUtils.isCityProject(project) && StateMachineUtils.judgeDeclareAmount(project, + if (StateMachineUtil.isCityProject(project) && StateMachineUtil.judgeDeclareAmount(project, ProjectDeclareConst.Number.DECLARE_AMOUNT_JUDGEMENT)){ project.setStatus(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS.getCode()); }else { @@ -86,7 +86,7 @@ public class ProjectDeclareChoiceAction implements Action stateContext) { Project project = stateContext.getMessage().getHeaders().get(PROJECT_DECLARE, Project.class); log.info("预审中撤回事件之前,项目的状态为:{}"+project.getStatus()); - if (StateMachineUtils.isCityProject(project) && StateMachineUtils.judgeDeclareAmount(project, + if (StateMachineUtil.isCityProject(project) && StateMachineUtil.judgeDeclareAmount(project, ProjectDeclareConst.Number.DECLARE_AMOUNT_JUDGEMENT)){ project.setStatus(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS.getCode()); }else { diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/factory/ProjectDeclareGuardFactory.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/factory/ProjectDeclareGuardFactory.java index 0de73d1..6e879df 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/factory/ProjectDeclareGuardFactory.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/factory/ProjectDeclareGuardFactory.java @@ -4,7 +4,7 @@ import cn.hutool.core.collection.CollUtil; import com.hz.pm.api.common.model.constant.ProjectDeclareConst; import com.hz.pm.api.common.model.constant.StateMachineConst; import com.hz.pm.api.common.enumeration.CommonEnum; -import com.hz.pm.api.common.statemachine.util.StateMachineUtils; +import com.hz.pm.api.common.statemachine.util.StateMachineUtil; 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; @@ -31,7 +31,7 @@ public class ProjectDeclareGuardFactory { public boolean evaluate(StateContext context) { Project project = context.getMessage().getHeaders().get(PROJECT_DECLARE, Project.class); // 判断申报项目是否是市级项目,且申报金额是否大于等于1000万元 - if (StateMachineUtils.isCityProject(project) && StateMachineUtils.judgeDeclareAmount(project, + if (StateMachineUtil.isCityProject(project) && StateMachineUtil.judgeDeclareAmount(project, ProjectDeclareConst.Number.DECLARE_AMOUNT_JUDGEMENT)){ return true; } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/util/MachineBuilderFounder.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/util/MachineBuilderFounder.java index 42aef82..433b0f8 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/util/MachineBuilderFounder.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/util/MachineBuilderFounder.java @@ -1,13 +1,13 @@ package com.hz.pm.api.common.statemachine.util; -import com.google.common.collect.Maps; import com.hz.pm.api.common.statemachine.builder.*; import com.hz.pm.api.common.statemachine.contant.RegionContant; +import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import javax.annotation.PostConstruct; +import java.util.HashMap; import java.util.Map; /** @@ -16,58 +16,42 @@ import java.util.Map; * @author CMM * @since 2023/02/07 15:56 */ -@Component @Slf4j +@Component +@RequiredArgsConstructor public class MachineBuilderFounder { - public final static Map machineBuilderMap = - Maps.newConcurrentMap(); - - @Autowired - private ProjectDeclareStateMachineSBJBuilder projectDeclareStateMachineSBJBuilder; - - @Autowired - private ProjectDeclareStateMachineLDBuilder projectDeclareStateMachineLDBuilder; - - @Autowired - private ProjectDeclareStateMachineQTBuilder projectDeclareStateMachineQTBuilder; - - @Autowired - private ProjectDeclareStateMachineJYBuilder projectDeclareStateMachineJYBuilder; - - @Autowired - private ProjectDeclareStateMachineSCBuilder projectDeclareStateMachineSCBuilder; + private static final Map MACHINE_BUILDER_MAP = new HashMap<>(16); - @Autowired - private ProjectDeclareStateMachineSYBuilder projectDeclareStateMachineSYBuilder; - - @Autowired - private ProjectDeclareStateMachineYHBuilder projectDeclareStateMachineYHBuilder; - - @Autowired - private ProjectDeclareStateMachineQYBuilder projectDeclareStateMachineQYBuilder; - - @Autowired - private ProjectDeclareStateMachineJNBuilder projectDeclareStateMachineJNBuilder; - - @Autowired - private ProjectDeclareStateMachineLQBuilder projectDeclareStateMachineLQBuilder; + public static ProjectDeclareStateMachineBuilder getByRegion(String regionCode) { + return MACHINE_BUILDER_MAP.get(regionCode); + } - @Autowired - private ProjectDeclareStateMachineKFQBuilder projectDeclareStateMachineKFQBuilder; + private final ProjectDeclareStateMachineSBJBuilder projectDeclareStateMachineSBJBuilder; + private final ProjectDeclareStateMachineLDBuilder projectDeclareStateMachineLDBuilder; + private final ProjectDeclareStateMachineQTBuilder projectDeclareStateMachineQTBuilder; + private final ProjectDeclareStateMachineJYBuilder projectDeclareStateMachineJYBuilder; + private final ProjectDeclareStateMachineSCBuilder projectDeclareStateMachineSCBuilder; + private final ProjectDeclareStateMachineSYBuilder projectDeclareStateMachineSYBuilder; + private final ProjectDeclareStateMachineYHBuilder projectDeclareStateMachineYHBuilder; + private final ProjectDeclareStateMachineQYBuilder projectDeclareStateMachineQYBuilder; + private final ProjectDeclareStateMachineJNBuilder projectDeclareStateMachineJNBuilder; + private final ProjectDeclareStateMachineLQBuilder projectDeclareStateMachineLQBuilder; + private final ProjectDeclareStateMachineKFQBuilder projectDeclareStateMachineKFQBuilder; @PostConstruct - public void MachineBuilderFounder(){ - machineBuilderMap.put(RegionContant.LS_SBJ_CODE, projectDeclareStateMachineSBJBuilder); - machineBuilderMap.put(RegionContant.LS_LD_CODE, projectDeclareStateMachineLDBuilder); - machineBuilderMap.put(RegionContant.LS_QT_CODE, projectDeclareStateMachineQTBuilder); - machineBuilderMap.put(RegionContant.LS_JY_CODE, projectDeclareStateMachineJYBuilder); - machineBuilderMap.put(RegionContant.LS_SC_CODE, projectDeclareStateMachineSCBuilder); - machineBuilderMap.put(RegionContant.LS_SY_CODE, projectDeclareStateMachineSYBuilder); - machineBuilderMap.put(RegionContant.LS_YH_CODE, projectDeclareStateMachineYHBuilder); - machineBuilderMap.put(RegionContant.LS_QY_CODE, projectDeclareStateMachineQYBuilder); - machineBuilderMap.put(RegionContant.LS_JN_CODE, projectDeclareStateMachineJNBuilder); - machineBuilderMap.put(RegionContant.LS_LQ_CODE, projectDeclareStateMachineLQBuilder); - machineBuilderMap.put(RegionContant.LS_KFQ_CODE, projectDeclareStateMachineKFQBuilder); + public void machineBuilderFounder(){ + MACHINE_BUILDER_MAP.put(RegionContant.LS_SBJ_CODE, projectDeclareStateMachineSBJBuilder); + MACHINE_BUILDER_MAP.put(RegionContant.LS_LD_CODE, projectDeclareStateMachineLDBuilder); + MACHINE_BUILDER_MAP.put(RegionContant.LS_QT_CODE, projectDeclareStateMachineQTBuilder); + MACHINE_BUILDER_MAP.put(RegionContant.LS_JY_CODE, projectDeclareStateMachineJYBuilder); + MACHINE_BUILDER_MAP.put(RegionContant.LS_SC_CODE, projectDeclareStateMachineSCBuilder); + MACHINE_BUILDER_MAP.put(RegionContant.LS_SY_CODE, projectDeclareStateMachineSYBuilder); + MACHINE_BUILDER_MAP.put(RegionContant.LS_YH_CODE, projectDeclareStateMachineYHBuilder); + MACHINE_BUILDER_MAP.put(RegionContant.LS_QY_CODE, projectDeclareStateMachineQYBuilder); + MACHINE_BUILDER_MAP.put(RegionContant.LS_JN_CODE, projectDeclareStateMachineJNBuilder); + MACHINE_BUILDER_MAP.put(RegionContant.LS_LQ_CODE, projectDeclareStateMachineLQBuilder); + MACHINE_BUILDER_MAP.put(RegionContant.LS_KFQ_CODE, projectDeclareStateMachineKFQBuilder); } + } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/util/StateMachineUtil.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/util/StateMachineUtil.java new file mode 100644 index 0000000..4965c52 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/util/StateMachineUtil.java @@ -0,0 +1,153 @@ +package com.hz.pm.api.common.statemachine.util; + +import com.ningdatech.basic.exception.BizException; +import com.ningdatech.basic.function.VUtils; +import com.hz.pm.api.common.model.constant.RegionConst; +import com.hz.pm.api.common.model.constant.StateMachineConst; +import com.hz.pm.api.common.statemachine.builder.ProjectDeclareStateMachineBuilder; +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.ProjectStatusChange; +import com.hz.pm.api.projectlib.model.entity.Project; +import com.hz.pm.api.projectlib.service.INdProjectStatusChangeService; +import com.hz.pm.api.projectlib.service.IProjectApplicationService; +import com.wflow.exception.BusinessException; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.messaging.Message; +import org.springframework.messaging.support.MessageBuilder; +import org.springframework.statemachine.StateMachine; +import org.springframework.statemachine.persist.StateMachinePersister; +import org.springframework.stereotype.Component; + +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.Objects; + +/** + * 状态机工具类 + * + * @author CMM + * @since 2023/02/07 22:49 + */ +@Slf4j +@Component +@RequiredArgsConstructor +public class StateMachineUtil { + + private static final String PROJECT_DECLARE = StateMachineConst.PROJECT_DECLARE; + + private static final String APPLICATION_DECLARE = StateMachineConst.APPLICATION_DECLARE; + + private final INdProjectStatusChangeService projectStatusChangeService; + + private final IProjectApplicationService projectApplicationService; + + //通过审核 + public void pass(Project project) { + try { + execute(project, getProjectStatusPassEvent(project.getStatus())); + } catch (Exception e) { + log.info("状态机 通过失败 :{}", e.getMessage()); + throw new BusinessException("状态机 通过失败: " + e); + } + } + + //拒绝 + public void reject(Project project) { + try { + execute(project, getProjectStatusRejectEvent(project.getStatus())); + } catch (Exception e) { + log.info("状态机 拒绝失败 :{}", e.getMessage()); + throw new BusinessException("状态机 拒绝失败: " + e); + } + } + + //撤回 + public void withDraw(Project project) { + try { + execute(project, getProjectStatusWithdrawEvent(project.getStatus())); + } catch (Exception e) { + log.info("状态机 撤回失败 :{}", e.getMessage()); + throw new BusinessException("状态机 撤回失败: " + e); + } + } + + public void execute(Project project, ProjectStatusChangeEvent event) throws Exception { + log.info("调用状态机前的项目状态为:{}", project.getStatus()); + // 将状态变更记录保存到项目状态变更表中 + ProjectStatusChange projectStatusChange = new ProjectStatusChange(); + projectStatusChange.setBeforeStatus(project.getStatus()); + + ProjectDeclareStateMachineBuilder builder = MachineBuilderFounder.getByRegion(project.getAreaCode()); + + VUtils.isTrue(Objects.isNull(builder)).throwMessage("状态机初始化失败!"); + //获取TO状态机 + StateMachine stateMachine = builder.build(); + Message message = MessageBuilder.withPayload(event) + .setHeader(PROJECT_DECLARE, project) + .setHeader(APPLICATION_DECLARE, projectApplicationService.getApplicationsByProject(project)) + .build(); + //初始化状态机 + StateMachinePersister projectDeclareStateMachinePersister = builder.getProjectPersister(); + projectDeclareStateMachinePersister.restore(stateMachine, project); + stateMachine.sendEvent(message); + projectStatusChange.setProjectId(project.getId()); + projectStatusChange.setAfterStatus(project.getStatus()); + projectStatusChange.setEvent(event.name()); + projectStatusChange.setCreateOn(LocalDateTime.now()); + projectStatusChange.setProjectCode(project.getProjectCode()); + // 插入项目状态变更表中 + projectStatusChangeService.save(projectStatusChange); + log.info("调用状态机后的项目状态为:{}", project.getStatus()); + } + + /** + * 判断项目申报金额是否大于1000万元 + * + * @param project \ + * @return boolean + * @since 2023/02/07 17:13 + */ + public static boolean judgeDeclareAmount(Project project, BigDecimal targetAmount) { + int flag = project.getDeclareAmount().compareTo(targetAmount); + return flag > 0 || flag == 0; + } + + /** + * 判断申报项目是否为市级项目 + * + * @param project \ + * @return boolean + * @since 2023/02/07 17:05 + */ + public static boolean isCityProject(Project project) { + String areaCode = project.getAreaCode(); + return areaCode.equals(RegionConst.RC_HZ); + } + + public ProjectStatusChangeEvent getProjectStatusPassEvent(Integer status) { + ProjectStatusChangeEvent event = ProjectStatusChangeEvent.getPassValueByCode(status); + if (Objects.isNull(event)) { + throw new BizException("该状态下没有对应的通过操作!"); + } + return event; + } + + public ProjectStatusChangeEvent getProjectStatusRejectEvent(Integer status) { + ProjectStatusChangeEvent event = ProjectStatusChangeEvent.getRejectValueByCode(status); + if (Objects.isNull(event)) { + throw new BizException("该状态下没有对应的驳回操作!"); + } + return event; + } + + public ProjectStatusChangeEvent getProjectStatusWithdrawEvent(Integer status) { + ProjectStatusChangeEvent event = ProjectStatusChangeEvent.getWithdrawValueByCode(status); + if (Objects.isNull(event)) { + throw new BizException("该状态下没有对应的撤回操作!"); + } + return event; + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/util/StateMachineUtils.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/util/StateMachineUtils.java deleted file mode 100644 index 9e3f4b4..0000000 --- a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/util/StateMachineUtils.java +++ /dev/null @@ -1,160 +0,0 @@ -package com.hz.pm.api.common.statemachine.util; - -import com.ningdatech.basic.exception.BizException; -import com.ningdatech.basic.function.VUtils; -import com.hz.pm.api.common.model.constant.RegionConst; -import com.hz.pm.api.common.model.constant.StateMachineConst; -import com.hz.pm.api.common.statemachine.builder.ProjectDeclareStateMachineBuilder; -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.ProjectStatusChange; -import com.hz.pm.api.projectlib.model.entity.Project; -import com.hz.pm.api.projectlib.service.INdProjectStatusChangeService; -import com.hz.pm.api.projectlib.service.IProjectApplicationService; -import com.wflow.exception.BusinessException; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.messaging.Message; -import org.springframework.messaging.support.MessageBuilder; -import org.springframework.statemachine.StateMachine; -import org.springframework.statemachine.persist.StateMachinePersister; -import org.springframework.stereotype.Component; - -import java.math.BigDecimal; -import java.time.LocalDateTime; -import java.util.Objects; - -/** - * 状态机工具类 - * - * @author CMM - * @since 2023/02/07 22:49 - */ -@Slf4j -@Component -@RequiredArgsConstructor -public class StateMachineUtils { - - private static final String PROJECT_DECLARE = StateMachineConst.PROJECT_DECLARE; - - private static final String APPLICATION_DECLARE = StateMachineConst.APPLICATION_DECLARE; - - private final INdProjectStatusChangeService projectStatusChangeService; - - private final IProjectApplicationService projectApplicationService; - - //通过审核 - public void pass(Project project) { - try{ - execute(project,getProjectStatusPassEvent(project.getStatus())); - }catch (Exception e){ - log.info("状态机 通过失败 :{}",e.getMessage()); - throw new BusinessException("状态机 通过失败: " + e); - } - } - - //拒绝 - public void reject(Project project) { - try{ - execute(project,getProjectStatusRejectEvent(project.getStatus())); - }catch (Exception e){ - log.info("状态机 拒绝失败 :{}",e.getMessage()); - throw new BusinessException("状态机 拒绝失败: " + e); - } - } - - //撤回 - public void withDraw(Project project) { - try{ - execute(project,getProjectStatusWithdrawEvent(project.getStatus())); - }catch (Exception e){ - log.info("状态机 撤回失败 :{}",e.getMessage()); - throw new BusinessException("状态机 撤回失败: " + e); - } - } - - public void execute(Project project, ProjectStatusChangeEvent event) throws Exception { - log.info("调用状态机前的项目状态为>>>>>>>>>>{}" + project.getStatus()); - // 将状态变更记录保存到项目状态变更表中 - ProjectStatusChange projectStatusChange = new ProjectStatusChange(); - projectStatusChange.setBeforeStatus(project.getStatus()); - - ProjectDeclareStateMachineBuilder builder = MachineBuilderFounder.machineBuilderMap.get(project.getAreaCode()); - - VUtils.isTrue(Objects.isNull(builder)).throwMessage("状态机初始化失败!"); - //获取TO状态机 - StateMachine stateMachine = builder.build(); - Message message = MessageBuilder.withPayload(event) - .setHeader(PROJECT_DECLARE, project) - .setHeader(APPLICATION_DECLARE,projectApplicationService.getApplicationsByProject(project)) - .build(); - //初始化状态机 - StateMachinePersister projectDeclareStateMachinePersister = builder.getProjectPersister(); - projectDeclareStateMachinePersister.restore(stateMachine, project); - stateMachine.sendEvent(message); - projectStatusChange.setProjectId(project.getId()); - projectStatusChange.setAfterStatus(project.getStatus()); - projectStatusChange.setEvent(event.name()); - projectStatusChange.setCreateOn(LocalDateTime.now()); - projectStatusChange.setProjectCode(project.getProjectCode()); - // 插入项目状态变更表中 - projectStatusChangeService.save(projectStatusChange); - log.info("调用状态机后的项目状态为>>>>>>>>>>{}" + project.getStatus()); - } - - /** - * 判断项目申报金额是否大于1000万元 - * - * @param project - * @return boolean - * @author CMM - * @since 2023/02/07 17:13 - */ - public static boolean judgeDeclareAmount(Project project, BigDecimal targetAmount) { - int flag = project.getDeclareAmount().compareTo(targetAmount); - if (flag > 0 || flag == 0) { - return true; - } - return false; - } - - /** - * 判断申报项目是否为市级项目 - * - * @param project - * @return boolean - * @author CMM - * @since 2023/02/07 17:05 - */ - public static boolean isCityProject(Project project) { - String areaCode = project.getAreaCode(); - if (areaCode.equals(RegionConst.RC_HZ)) { - return true; - } - return false; - } - - public ProjectStatusChangeEvent getProjectStatusPassEvent(Integer status) { - ProjectStatusChangeEvent event = ProjectStatusChangeEvent.getPassValueByCode(status); - if (Objects.isNull(event)) { - throw new BizException("该状态下没有对应的通过操作!"); - } - return event; - } - - public ProjectStatusChangeEvent getProjectStatusRejectEvent(Integer status) { - ProjectStatusChangeEvent event = ProjectStatusChangeEvent.getRejectValueByCode(status); - if (Objects.isNull(event)) { - throw new BizException("该状态下没有对应的驳回操作!"); - } - return event; - } - - public ProjectStatusChangeEvent getProjectStatusWithdrawEvent(Integer status) { - ProjectStatusChangeEvent event = ProjectStatusChangeEvent.getWithdrawValueByCode(status); - if (Objects.isNull(event)) { - throw new BizException("该状态下没有对应的撤回操作!"); - } - return event; - } -} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/util/JwtTokenUtil.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/util/JwtTokenUtil.java deleted file mode 100644 index 8aca60d..0000000 --- a/hz-pm-api/src/main/java/com/hz/pm/api/common/util/JwtTokenUtil.java +++ /dev/null @@ -1,91 +0,0 @@ -package com.hz.pm.api.common.util; - -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONObject; -import com.auth0.jwt.JWT; -import com.auth0.jwt.JWTVerifier; -import com.auth0.jwt.algorithms.Algorithm; -import com.hz.pm.api.common.model.ZwddTokenUser; -import org.apache.commons.lang3.StringUtils; - -import java.util.Date; -import java.util.HashMap; -import java.util.Map; - -/** - * @author liuxinxin - * @date 2023/5/4 下午2:34 - */ - -public class JwtTokenUtil { - - private static final String SECRET_KEY = "dbe1cc89019c4c7abd5085bf47a25fb0"; - - private static final String CLAIM_KEY = "content"; - - private static final Integer DEFAULT_EXPIRE_TIME = Integer.valueOf(86400); - - public static String createToken(ZwddTokenUser dingTokenUser) { - return createToken(dingTokenUser, DEFAULT_EXPIRE_TIME); - } - - public static String createToken(ZwddTokenUser dingTokenUser, Integer expireTime) { - if (dingTokenUser == null) { - throw new IllegalArgumentException(""); - } - if (dingTokenUser.getTenantId() == null) { - throw new IllegalArgumentException(""); - } - if (StringUtils.isEmpty(dingTokenUser.getEmployeeCode())) { - throw new IllegalArgumentException(""); - } - if (dingTokenUser.getTenantId() == null) { - throw new IllegalArgumentException(""); - } - return createToken(JSON.toJSONString(dingTokenUser), expireTime); - } - - private static String createToken(String content, Integer expireTime) { - if (StringUtils.isEmpty(content)) { - throw new IllegalArgumentException(""); - } - Map header = new HashMap<>(4); - header.put("alg", "HS256"); - header.put("typ", "JWT"); - Algorithm algorithm = Algorithm.HMAC256(SECRET_KEY); - return JWT.create() - .withHeader(header) - .withClaim("content", content) - .withIssuedAt(new Date()) - .withExpiresAt(new Date(System.currentTimeMillis() + (expireTime.intValue() * 1000))) - .sign(algorithm); - } - - public static boolean verifyToken(String token) { - if (StringUtils.isEmpty(token)) { - throw new IllegalArgumentException("token"); - } - Algorithm algorithm = Algorithm.HMAC256(SECRET_KEY); - JWTVerifier verifier = JWT.require(algorithm).build(); - verifier.verify(token); - return true; - } - - private static String parseJwtString(String token) { - if (StringUtils.isEmpty(token)) { - throw new IllegalArgumentException("token"); - } - Algorithm algorithm = Algorithm.HMAC256(SECRET_KEY); - JWTVerifier verifier = JWT.require(algorithm).build(); - return verifier.verify(token).getClaim("content").asString(); - } - - public static ZwddTokenUser parseJwt(String token) { - String dingUserJson = parseJwtString(token); - if (StringUtils.isEmpty(dingUserJson)) { - return null; - } - ZwddTokenUser dingTokenUser = (ZwddTokenUser) JSONObject.parseObject(dingUserJson, ZwddTokenUser.class); - return dingTokenUser; - } -} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/util/MDCUtil.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/util/MDCUtil.java index fa5eef7..c9368fe 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/common/util/MDCUtil.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/util/MDCUtil.java @@ -12,6 +12,9 @@ import org.slf4j.MDC; **/ public class MDCUtil { + private MDCUtil() { + } + public static final String TRACE_ID = "traceId"; public static final String TRACE_ID_HEADER = "Trace-Id"; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/util/TreeUtil.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/util/TreeUtil.java index 19b51dd..3fad758 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/common/util/TreeUtil.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/util/TreeUtil.java @@ -46,7 +46,7 @@ public final class TreeUtil { * @param treeList 待转换的集合 * @return 树结构 */ - public static > List buildTree(List treeList) { + public static > List buildTree(List treeList) { if (CollUtil.isEmpty(treeList)) { return treeList; } @@ -71,7 +71,7 @@ public final class TreeUtil { return trees; } - private static > + private static > void foreachNodes(List treeList, List selfIdEqSelfParent) { nodeMap = Maps.newConcurrentMap(); for (E parent : treeList) { @@ -98,7 +98,7 @@ public final class TreeUtil { } } - private static > void foreachNodesWithTopMenu(List treeList) { + private static > void foreachNodesWithTopMenu(List treeList) { for (E parent : treeList) { Serializable id = parent.getId(); for (E children : treeList) { diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/manage/MeetingStatisticsManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/manage/MeetingStatisticsManage.java index 7c2f5a2..17893a6 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/manage/MeetingStatisticsManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/manage/MeetingStatisticsManage.java @@ -136,10 +136,7 @@ public class MeetingStatisticsManage { data.setCode(region.getRegionCode()); data.setName(region.getRegionName()); //先求出 此区域会议 - List regionMeetingIds = meetings.stream().filter(m -> { - - return Boolean.FALSE; - }).map(Meeting::getId).collect(Collectors.toList()); + List regionMeetingIds = meetings.stream().filter(m -> Boolean.FALSE).map(Meeting::getId).collect(Collectors.toList()); List regionReviews = expertReviews.stream().filter(r -> { if (Objects.nonNull(r.getMeetingId()) && diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/model/vo/PerformanceStatisticsVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/model/vo/PerformanceStatisticsVO.java index 20207c3..0c6f0fa 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/model/vo/PerformanceStatisticsVO.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/model/vo/PerformanceStatisticsVO.java @@ -6,11 +6,10 @@ import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.io.Serializable; -import java.math.BigDecimal; import java.util.List; @Data -@ApiModel(value = "绩效统计", description = "") +@ApiModel(value = "绩效统计") public class PerformanceStatisticsVO implements Serializable { private static final long serialVersionUID = 1L; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/assembler/ExpertAdminExpertManageAssembler.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/assembler/ExpertAdminExpertManageAssembler.java index bac253a..2afc411 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/expert/assembler/ExpertAdminExpertManageAssembler.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/assembler/ExpertAdminExpertManageAssembler.java @@ -2,19 +2,17 @@ package com.hz.pm.api.expert.assembler; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollectionUtil; -import com.hz.pm.api.common.helper.RegionCacheHelper; import com.hz.pm.api.expert.model.DictFieldInfoDTO; -import com.hz.pm.api.expert.model.TagFieldInfo; import com.hz.pm.api.expert.model.dto.ExpertAdminExpertListDTO; import com.hz.pm.api.expert.model.vo.ExpertLibraryListItemVO; import com.hz.pm.api.meta.helper.DictionaryCache; -import com.hz.pm.api.meta.helper.impl.TagsCacheImpl; import com.hz.pm.api.meta.model.dto.DictionaryDTO; -import com.hz.pm.api.meta.model.dto.TagDTO; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Component; -import java.util.*; +import java.util.Collections; +import java.util.List; +import java.util.Optional; import java.util.stream.Collectors; /** diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/assembler/TagAssembler.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/assembler/TagAssembler.java deleted file mode 100644 index 590532e..0000000 --- a/hz-pm-api/src/main/java/com/hz/pm/api/expert/assembler/TagAssembler.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.hz.pm.api.expert.assembler; - -import cn.hutool.core.collection.CollectionUtil; -import com.hz.pm.api.expert.model.TagFieldInfo; -import com.hz.pm.api.meta.model.entity.ExpertTag; - -import java.util.ArrayList; -import java.util.List; -import java.util.stream.Collectors; - -/** - * @author liuxinxin - * @date 2022/7/25 下午4:30 - */ - -public class TagAssembler { - - public static List toTagFieldInfoList(List expertTagList) { - if (CollectionUtil.isEmpty(expertTagList)) { - return new ArrayList<>(); - } - return expertTagList.stream().map(r -> { - TagFieldInfo dictionaryFieldInfo = new TagFieldInfo(); - dictionaryFieldInfo.setTagFieldName(r.getExpertInfoField()); - dictionaryFieldInfo.setTagCode(r.getTagCode()); - return dictionaryFieldInfo; - }).collect(Collectors.toList()); - } -} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/controller/ExpertController.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/controller/ExpertController.java index 453f877..7b12ace 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/expert/controller/ExpertController.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/controller/ExpertController.java @@ -16,12 +16,9 @@ import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; import org.springframework.web.bind.annotation.*; -import springfox.documentation.annotations.ApiIgnore; -import javax.servlet.http.HttpServletResponse; import javax.validation.Valid; import javax.validation.constraints.NotNull; -import java.io.IOException; /** *

diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/manage/ExpertMetaApplyManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/manage/ExpertMetaApplyManage.java index 678d0e4..9700554 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/expert/manage/ExpertMetaApplyManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/manage/ExpertMetaApplyManage.java @@ -37,7 +37,6 @@ import com.hz.pm.api.meta.model.bo.RegionContainsBO; import com.hz.pm.api.meta.model.dto.DictionaryDTO; import com.hz.pm.api.meta.model.entity.ExpertDictionary; import com.hz.pm.api.meta.service.IExpertDictionaryService; -import com.hz.pm.api.sys.model.dto.RegionDTO; import com.hz.pm.api.user.util.LoginUserUtil; import com.ningdatech.basic.exception.BizException; import com.ningdatech.basic.model.PageVo; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/service/impl/ExpertAdminManageServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/service/impl/ExpertAdminManageServiceImpl.java index 4b1fe56..1a324f5 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/expert/service/impl/ExpertAdminManageServiceImpl.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/service/impl/ExpertAdminManageServiceImpl.java @@ -1,14 +1,11 @@ package com.hz.pm.api.expert.service.impl; import cn.hutool.core.collection.CollUtil; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.hz.pm.api.expert.entity.ExpertUserFullInfo; -import com.ningdatech.basic.util.CollUtils; import com.hz.pm.api.common.model.CommonPage; import com.hz.pm.api.expert.assembler.ExpertUserInfoAssembler; import com.hz.pm.api.expert.constant.ExpertAccountStatusEnum; +import com.hz.pm.api.expert.entity.ExpertUserFullInfo; import com.hz.pm.api.expert.mapper.ExpertAdminManageMapper; import com.hz.pm.api.expert.model.cmd.ExpertAdminExpertManageQueryCmd; import com.hz.pm.api.expert.model.dto.ExpertAdminExpertListDTO; @@ -18,16 +15,15 @@ import com.hz.pm.api.expert.model.query.ListExpertQuery; import com.hz.pm.api.expert.service.ExpertAdminManageService; import com.hz.pm.api.expert.service.IExpertUserFullInfoService; import com.hz.pm.api.meta.model.entity.ExpertDictionary; -import com.hz.pm.api.meta.model.entity.ExpertTag; import com.hz.pm.api.meta.service.IExpertDictionaryService; import com.hz.pm.api.meta.service.IExpertTagService; +import com.ningdatech.basic.util.CollUtils; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; import java.util.ArrayList; import java.util.List; import java.util.Map; -import java.util.stream.Collectors; /** * @author liuxinxin diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/external/controller/MhSyncController.java b/hz-pm-api/src/main/java/com/hz/pm/api/external/controller/MhSyncController.java index 3a69bcf..d586dec 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/external/controller/MhSyncController.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/external/controller/MhSyncController.java @@ -1,6 +1,5 @@ package com.hz.pm.api.external.controller; -import com.hz.pm.api.external.MhApiClient; import com.hz.pm.api.user.manage.SyncMhUserOrgManage; import io.swagger.annotations.Api; import lombok.RequiredArgsConstructor; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/external/model/dto/MhTechExpertDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/external/model/dto/MhTechExpertDTO.java index 326cd3b..aa55572 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/external/model/dto/MhTechExpertDTO.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/external/model/dto/MhTechExpertDTO.java @@ -1,12 +1,8 @@ package com.hz.pm.api.external.model.dto; -import cn.hutool.core.collection.CollUtil; import lombok.Data; -import java.util.Arrays; import java.util.Date; -import java.util.List; -import java.util.stream.Collectors; /** *

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 3615039..8ee17e6 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 @@ -525,8 +525,7 @@ public class ProjectFileManage { private List getFileIdList(String buildBasis) { List prePlanFileArray = JSON.parseArray(buildBasis, JSONObject.class); - List prePlanFileIdList = CollUtils.fieldList(prePlanFileArray, w -> w.getLong(CommonConst.ID_STR)); - return prePlanFileIdList; + return CollUtils.fieldList(prePlanFileArray, w -> w.getLong(CommonConst.ID_STR)); } /** diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/model/entity/ProjectApplyBorrow.java b/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/model/entity/ProjectApplyBorrow.java index 04b03fe..592112b 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/model/entity/ProjectApplyBorrow.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/model/entity/ProjectApplyBorrow.java @@ -19,7 +19,7 @@ import lombok.Data; */ @Data @TableName("nd_project_apply_borrow") -@ApiModel(value = "NdProjectApplyBorrow对象", description = "") +@ApiModel(value = "NdProjectApplyBorrow对象") public class ProjectApplyBorrow implements Serializable { private static final long serialVersionUID = 1L; 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 f0374cf..d8249eb 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 @@ -1,6 +1,5 @@ package com.hz.pm.api.filemanage.model.vo; -import com.hz.pm.api.expert.model.vo.ExpertReviewDetailVO; import com.hz.pm.api.expert.model.vo.ProjectReviewDetailVO; import com.hz.pm.api.projectdeclared.model.vo.ContractVO; import com.hz.pm.api.projectdeclared.model.vo.FinalAcceptanceVO; @@ -12,7 +11,6 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; -import java.time.LocalDateTime; import java.util.List; /** 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 2cd0ba9..6c058ed 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 @@ -240,7 +240,7 @@ public class ProjectConvertUtil { if(CollUtil.isNotEmpty(purchases)){ purchases.stream().map(PurchaseVO::getTransactionAmount) .filter(Objects::nonNull).reduce(BigDecimal::add) - .ifPresent(j -> approve.setReleaseYearMoney(j)); + .ifPresent(approve::setReleaseYearMoney); } return approve; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/irs/controller/IrsController.java b/hz-pm-api/src/main/java/com/hz/pm/api/irs/controller/IrsController.java index fa0d767..93b55ad 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/irs/controller/IrsController.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/irs/controller/IrsController.java @@ -1,11 +1,10 @@ package com.hz.pm.api.irs.controller; -import com.ningdatech.log.annotation.WebLog; -import com.hz.pm.api.irs.model.dto.ForwardDTO; import com.hz.pm.api.projectdeclared.manage.IrsManage; import com.hz.pm.api.projectdeclared.model.vo.IrsApplicationVO; import com.hz.pm.api.projectdeclared.model.vo.PiotTasksVO; import com.hz.pm.api.scheduler.task.SynProjectCoreBizTask; +import com.ningdatech.log.annotation.WebLog; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; @@ -56,7 +55,7 @@ public class IrsController { @ApiOperation(value = "获取企业社会信用编码", notes = "获取企业社会信用编码") @GetMapping("/get-credit-code") - public String getCreditCode() throws NoSuchAlgorithmException, UnsupportedEncodingException { + public String getCreditCode() throws NoSuchAlgorithmException { return irsManage.getCreditCode(); } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/irs/controller/IrsProjectController.java b/hz-pm-api/src/main/java/com/hz/pm/api/irs/controller/IrsProjectController.java index c6e6939..cab9d72 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/irs/controller/IrsProjectController.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/irs/controller/IrsProjectController.java @@ -1,18 +1,17 @@ package com.hz.pm.api.irs.controller; -import com.ningdatech.basic.model.PageVo; -import com.hz.pm.api.dashboard.model.vo.ProtraitProjectOutputVO; import com.hz.pm.api.irs.manage.IrsProjectManage; import com.hz.pm.api.projectlib.model.req.ProjectListReq; import com.hz.pm.api.projectlib.model.vo.ProjectLibListItemVO; +import com.ningdatech.basic.model.PageVo; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.*; - -import java.util.List; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; /** * @Classname IrsController diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/irs/manage/AppIrsManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/irs/manage/AppIrsManage.java index 5421df8..d37efcd 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/irs/manage/AppIrsManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/irs/manage/AppIrsManage.java @@ -8,7 +8,7 @@ import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.hz.pm.api.common.model.constant.RegionConst; import com.hz.pm.api.common.enumeration.CommonEnum; -import com.hz.pm.api.common.statemachine.util.StateMachineUtils; +import com.hz.pm.api.common.statemachine.util.StateMachineUtil; import com.hz.pm.api.common.util.CryptUtils; import com.hz.pm.api.common.util.HttpUtil; import com.hz.pm.api.irs.model.dto.ApiApplyDTO; @@ -54,7 +54,7 @@ public class AppIrsManage { private final IProjectApplicationService applicationService; - private final StateMachineUtils stateMachineUtils; + private final StateMachineUtil stateMachineUtil; @Value("${irs.push-app.appKey}") private String pushAppKey; @@ -172,7 +172,7 @@ public class AppIrsManage { //如果筛选出来的 为空的话 就调用状态机 if (CollUtil.isEmpty(apps)) { - stateMachineUtils.pass(project); + stateMachineUtil.pass(project); project.setUpdateOn(LocalDateTime.now()); projectService.updateById(project); } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/irs/manage/IrsProjectManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/irs/manage/IrsProjectManage.java index d281229..f2d2f2f 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/irs/manage/IrsProjectManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/irs/manage/IrsProjectManage.java @@ -66,10 +66,7 @@ public class IrsProjectManage { if(CollUtil.isEmpty(page.getRecords())){ return PageVo.empty(); } - List res = page.getRecords().stream().map(p -> { - ProjectLibListItemVO vo = BeanUtil.copyProperties(p,ProjectLibListItemVO.class); - return vo; - }).collect(Collectors.toList()); + List res = page.getRecords().stream().map(p -> BeanUtil.copyProperties(p,ProjectLibListItemVO.class)).collect(Collectors.toList()); return PageVo.of(res,page.getTotal()); } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/leave/manage/LeaveManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/leave/manage/LeaveManage.java index f2ac767..e993f43 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/leave/manage/LeaveManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/leave/manage/LeaveManage.java @@ -15,10 +15,8 @@ import com.hz.pm.api.common.util.StrUtils; import com.hz.pm.api.expert.constant.ExpertApplyStatusEnum; import com.hz.pm.api.expert.constant.ExpertApplyTypeEnum; import com.hz.pm.api.expert.entity.ExpertMetaApply; -import com.hz.pm.api.expert.entity.ExpertUserFullInfo; import com.hz.pm.api.expert.model.dto.ModifyApplyExtraInfoDTO; import com.hz.pm.api.expert.service.IExpertMetaApplyService; -import com.hz.pm.api.expert.service.IExpertUserFullInfoService; import com.hz.pm.api.leave.entity.domain.ExpertLeave; import com.hz.pm.api.leave.entity.domain.ExpertLeaveDetail; import com.hz.pm.api.leave.entity.enumeration.LeaveStatusEnum; @@ -77,7 +75,6 @@ public class LeaveManage { private final IExpertLeaveDetailService leaveDetailService; private final IExpertMetaApplyService metaApplyService; private final FileService fileService; - private final IExpertUserFullInfoService userFullInfoService; private final MeetingCallOrMsgHelper meetingCallOrMsgHelper; private static final int HOURS_BEFORE_MEETING = 2; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/builder/YxtSmsContextBuilder.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/builder/YxtSmsContextBuilder.java deleted file mode 100644 index bf384e8..0000000 --- a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/builder/YxtSmsContextBuilder.java +++ /dev/null @@ -1,129 +0,0 @@ -//package com.hz.pm.api.meeting.builder; -// -// -//import com.hz.pm.api.meeting.entity.domain.Meeting; -//import com.hz.pm.api.meeting.entity.domain.MeetingExpert; -//import com.hz.pm.api.sms.utils.DateUtil; -// -//import java.time.format.DateTimeFormatter; -//import java.util.ArrayList; -//import java.util.List; -// -///** -// *

-// * YxtSmsContextBuilder -// *

-// * -// * @author WendyYang -// * @since 14:19 2022/11/17 -// */ -//public class YxtSmsContextBuilder { -// -// private YxtSmsContextBuilder() { -// } -// -// public static List smsToExpertByCancelMeeting(Meeting meeting, List experts, String meetingType) { -// String holdCompany = meeting.getHoldCompanyBracket(); -// String meetingTime = meeting.getStartTime().format(DateUtil.DTF_YMD_HM); -// List contexts = new ArrayList<>(); -// for (MeetingExpert me : experts) { -// SendSmsContext context = new SendSmsContext(); -// context.setContent(holdCompany + String.format(YxtSmsTemplateConst.MEETING_CANCEL, -// me.getExpertName(), meeting.getCancelRemark(), meetingTime, meetingType, meeting.getContact())); -// context.setReceiveNumber(me.getMobile()); -// contexts.add(context); -// } -// return contexts; -// } -// -// public static List smsToExpertBySendNotice(Meeting meeting, List experts, String meetingType) { -// String holdCompany = meeting.getHoldCompanyBracket(); -// String meetingTime = meeting.getStartTime().format(DateUtil.DTF_YMD_HM); -// List contexts = new ArrayList<>(); -// for (MeetingExpert me : experts) { -// SendSmsContext context = new SendSmsContext(); -// context.setContent(holdCompany + String.format(YxtSmsTemplateConst.SEND_MEETING_NOTICE, -// me.getExpertName(), me.getUpdateOn().format(DateUtil.DTF_YMD_HM), -// meetingType, meetingTime, meeting.getRegionDetail(), meeting.getContact())); -// context.setReceiveNumber(me.getMobile()); -// contexts.add(context); -// } -// return contexts; -// } -// -// public static SendSmsContext smsToExpertByReplace(Meeting meeting, MeetingExpert expert, String meetingType) { -// SendSmsContext context = new SendSmsContext(); -// String holdCompany = meeting.getHoldCompanyBracket(); -// context.setContent(holdCompany + String.format(YxtSmsTemplateConst.EXPERT_REPLACED, -// expert.getExpertName(), -// meeting.getStartTime().format(DateUtil.DTF_YMD_HM), -// meetingType, -// meeting.getContact() -// )); -// context.setReceiveNumber(expert.getMobile()); -// return context; -// } -// -// public static List smsToExpertByMeetingChange(Meeting old, Meeting curr, List experts, String meetingType) { -// List contexts = new ArrayList<>(); -// String holdCompany = curr.getHoldCompanyBracket(); -// String sTimeOld = old.getStartTime().format(DateUtil.DTF_YMD_HM); -// String sTimeNew = curr.getStartTime().format(DateUtil.DTF_YMD_HM); -// for (MeetingExpert me : experts) { -// SendSmsContext context = new SendSmsContext(); -// String content = String.format(YxtSmsTemplateConst.MEETING_INGO_CHANGE, me.getExpertName(), -// sTimeOld, meetingType, sTimeNew, curr.getRegionDetail(), curr.getContact()); -// context.setContent(holdCompany + content); -// context.setReceiveNumber(me.getMobile()); -// contexts.add(context); -// } -// return contexts; -// } -// -// public static SendSmsContext smsToInvitorByExpertLeave(UserBasicInfo invitor, String meetingName, String expertName) { -// SendSmsContext context = new SendSmsContext(); -// context.setReceiveNumber(invitor.getPhoneNo()); -// context.setContent(String.format(YxtSmsTemplateConst.TEMP_LEAVE_APPLY, invitor.getNickName(), -// meetingName, expertName, WebProperties.webUrl)); -// return context; -// } -// -// public static SendSmsContext smsToExpertByLeavePassed(ExpertLeave leave, String leaveUser, String mobile) { -// String smsContent = String.format(YxtSmsTemplateConst.LEAVE_APPLY_PASSED, leaveUser, -// leave.getStartTime().format(DateTimeFormatter.ofPattern(DatePattern.YMD_HMS)), -// leave.getEndTime().format(DateTimeFormatter.ofPattern(DatePattern.YMD_HMS))); -// SendSmsContext context = new SendSmsContext(); -// context.setContent(smsContent); -// context.setReceiveNumber(mobile); -// return context; -// } -// -// public static SendSmsContext smsToExpertBtLeaveReject(String leaveUser, String mobile, String opinion) { -// String smsContent = String.format(YxtSmsTemplateConst.LEAVE_APPLY_REFUSED, leaveUser, opinion); -// SendSmsContext context = new SendSmsContext(); -// context.setContent(smsContent); -// context.setReceiveNumber(mobile); -// return context; -// } -// -// public static SendSmsContext smsByRandomInviteStop(String inviterName, String meetingName, String mobile) { -// String smsContent = String.format(YxtSmsTemplateConst.RANDOM_INVITE_STOP, -// inviterName, meetingName, WebProperties.webUrl -// ); -// SendSmsContext context = new SendSmsContext(); -// context.setContent(smsContent); -// context.setReceiveNumber(mobile); -// return context; -// } -// -// -// public static SendSmsContext meetingInviteCompleteNotice(Meeting meeting) { -// String smsContent = String.format(YxtSmsTemplateConst.RANDOM_EXTRACTION_COMPLETED, -// meeting.getConnecter(), meeting.getName(), WebProperties.webUrl -// ); -// SendSmsContext context = new SendSmsContext(); -// context.setContent(smsContent); -// context.setReceiveNumber(meeting.getContact()); -// return context; -// } -//} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/controller/MeetingExpertJudgeController.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/controller/MeetingExpertJudgeController.java index e5fc724..b6dce22 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/controller/MeetingExpertJudgeController.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/controller/MeetingExpertJudgeController.java @@ -10,8 +10,6 @@ import lombok.AllArgsConstructor; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; -import javax.validation.Valid; - /** *

* 前端控制器 diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/domain/MeetingExpertJudge.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/domain/MeetingExpertJudge.java index 19285c3..9246e81 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/domain/MeetingExpertJudge.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/domain/MeetingExpertJudge.java @@ -1,7 +1,6 @@ package com.hz.pm.api.meeting.entity.domain; import com.baomidou.mybatisplus.annotation.*; -import io.swagger.annotations.Api; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/dto/ExpertIdFilterDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/dto/ExpertIdFilterDTO.java index 9ea369a..1cccbd0 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/dto/ExpertIdFilterDTO.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/dto/ExpertIdFilterDTO.java @@ -2,7 +2,6 @@ package com.hz.pm.api.meeting.entity.dto; import lombok.AllArgsConstructor; import lombok.Data; -import lombok.RequiredArgsConstructor; import java.util.List; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/vo/MeetingByManagerVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/vo/MeetingByManagerVO.java index fda5e0a..5b70ac0 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/vo/MeetingByManagerVO.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/vo/MeetingByManagerVO.java @@ -3,9 +3,7 @@ package com.hz.pm.api.meeting.entity.vo; import com.alibaba.fastjson.annotation.JSONField; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import lombok.Builder; import lombok.Data; -import lombok.experimental.Tolerate; import java.time.LocalDateTime; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/helper/MeetingManageHelper.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/helper/MeetingManageHelper.java index f3d83c1..9e088f8 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/helper/MeetingManageHelper.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/helper/MeetingManageHelper.java @@ -31,7 +31,6 @@ import com.hz.pm.api.meeting.service.IMeetingExpertService; import com.hz.pm.api.meta.constant.ExpertDictTypeEnum; import com.hz.pm.api.meta.helper.DictionaryCache; import com.hz.pm.api.meta.model.dto.DictionaryDTO; -import com.hz.pm.api.sys.model.dto.RegionDTO; import com.ningdatech.basic.exception.BizException; import com.ningdatech.basic.util.CollUtils; import lombok.AllArgsConstructor; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/helper/YxtCallOrSmsHelper.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/helper/YxtCallOrSmsHelper.java index 8d84122..f8df961 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/helper/YxtCallOrSmsHelper.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/helper/YxtCallOrSmsHelper.java @@ -34,10 +34,10 @@ public class YxtCallOrSmsHelper { } public void sendSms(List smsList) { - yxtClient.submitSmsTask(new SendSmsCmd() {{ - setContextList(smsList); - setSmsSignEnum(YxtSmsSignEnum.LS_BIG_DATA_BUREAU); - }}); + SendSmsCmd cmd = new SendSmsCmd(); + cmd.setContextList(smsList); + cmd.setSmsSignEnum(YxtSmsSignEnum.LS_BIG_DATA_BUREAU); + yxtClient.submitSmsTask(cmd); } public void sendSms(SendSmsContext sms) { diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meta/assembler/MetaTagAssembler.java b/hz-pm-api/src/main/java/com/hz/pm/api/meta/assembler/MetaTagAssembler.java index 8bd3b0e..65d2dfe 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/meta/assembler/MetaTagAssembler.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meta/assembler/MetaTagAssembler.java @@ -7,34 +7,41 @@ import com.hz.pm.api.meta.model.vo.ResTagTreeVO; import org.apache.commons.collections4.CollectionUtils; import java.util.ArrayList; +import java.util.Collections; import java.util.List; import java.util.stream.Collectors; /** - * @author liuxinxin - * @date 2022/7/22 上午9:57 + *

+ * MetaTagAssembler + *

+ * + * @author WendyYang + * @since 17:06 2024/1/8 */ - public class MetaTagAssembler { - public static TagDTO toTagDTO(MetaTag metaTagManage) { + private MetaTagAssembler() { + } + + public static TagDTO convert(MetaTag metaTag) { TagDTO tagDTO = new TagDTO(); - tagDTO.setParentCode(metaTagManage.getParentCode()); - tagDTO.setTagCode(metaTagManage.getTagCode()); - tagDTO.setTagLevel(metaTagManage.getTagLevel()); - tagDTO.setTagName(metaTagManage.getTagName()); + tagDTO.setParentCode(metaTag.getParentCode()); + tagDTO.setTagCode(metaTag.getTagCode()); + tagDTO.setTagLevel(metaTag.getTagLevel()); + tagDTO.setTagName(metaTag.getTagName()); return tagDTO; } - public static List toTagTreeDTOList(List tagDTOList) { - if (CollectionUtils.isEmpty(tagDTOList)) { - return new ArrayList<>(); + public static List convert(List tagList) { + if (CollectionUtils.isEmpty(tagList)) { + return Collections.emptyList(); } - return tagDTOList.stream().map(MetaTagAssembler::toTagTreeDTO).collect(Collectors.toList()); + return tagList.stream().map(MetaTagAssembler::convert).collect(Collectors.toList()); } - public static TagTreeDTO toTagTreeDTO(TagDTO tagDTO) { + public static TagTreeDTO convert(TagDTO tagDTO) { TagTreeDTO tagTreeDTO = new TagTreeDTO(); tagTreeDTO.setParentCode(tagDTO.getParentCode()); tagTreeDTO.setTagCode(tagDTO.getTagCode()); @@ -43,7 +50,7 @@ public class MetaTagAssembler { return tagTreeDTO; } - public static List toTagTreeVOList(List tagTreeDTOList) { + public static List to(List tagTreeDTOList) { List resTagTreeVOList = new ArrayList<>(); for (TagTreeDTO tagTreeDTO : tagTreeDTOList) { ResTagTreeVO resTagTreeVO = new ResTagTreeVO(); @@ -53,7 +60,7 @@ public class MetaTagAssembler { resTagTreeVO.setTagCode(tagTreeDTO.getTagCode()); resTagTreeVO.setUnionCode(tagTreeDTO.getTagName() + "##" + tagTreeDTO.getTagCode()); if (CollectionUtils.isNotEmpty(tagTreeDTO.getChildren())) { - resTagTreeVO.setChildren(toTagTreeVOList(tagTreeDTO.getChildren())); + resTagTreeVO.setChildren(to(tagTreeDTO.getChildren())); } resTagTreeVOList.add(resTagTreeVO); } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meta/helper/basic/AbstractTagsCache.java b/hz-pm-api/src/main/java/com/hz/pm/api/meta/helper/basic/AbstractTagsCache.java index a594939..c137d4c 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/meta/helper/basic/AbstractTagsCache.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meta/helper/basic/AbstractTagsCache.java @@ -51,7 +51,7 @@ public abstract class AbstractTagsCache implements InitializingBean, TagCache { // 查询全部 List tags = metaTagService.queryLeLevel(Integer.parseInt(key)); putToTagMap(tags); - return toTree(MetaTagAssembler.toTagTreeDTOList(tags)); + return toTree(MetaTagAssembler.convert(tags)); } @Override @@ -75,7 +75,7 @@ public abstract class AbstractTagsCache implements InitializingBean, TagCache { List tagsByLevel = allTags.stream() .filter(w -> w.getTagLevel() <= currLevel) .collect(Collectors.toList()); - mapByKeys.put(String.valueOf(currLevel), toTree(MetaTagAssembler.toTagTreeDTOList(tagsByLevel))); + mapByKeys.put(String.valueOf(currLevel), toTree(MetaTagAssembler.convert(tagsByLevel))); }); return mapByKeys; } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meta/manage/MetaManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/meta/manage/MetaManage.java index 950e6b6..33bf73c 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/meta/manage/MetaManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meta/manage/MetaManage.java @@ -119,24 +119,24 @@ public class MetaManage { tagTreeDTOList.add(tagTreeDTO); } } - return MetaTagAssembler.toTagTreeVOList(tagTreeDTOList); + return MetaTagAssembler.to(tagTreeDTOList); } /** * 专家管理员才能调用 * - * @param reqAddDictionaryPO + * @param req \ */ @Transactional(rollbackFor = Exception.class) - public void addDictionary(ReqAddDictionaryPO reqAddDictionaryPO) { - String dictionaryType = reqAddDictionaryPO.getDictionaryType(); + public void addDictionary(ReqAddDictionaryPO req) { + String dictionaryType = req.getDictionaryType(); boolean contains = ExpertDictTypeEnum.contains(dictionaryType); if (!contains) { throw BizException.wrap("无效的专家字典类型:%s", dictionaryType); } - String name = reqAddDictionaryPO.getName(); - Integer sortValue = reqAddDictionaryPO.getSortValue(); + String name = req.getName(); + Integer sortValue = req.getSortValue(); LambdaQueryWrapper eq = Wrappers.lambdaQuery(MetaDictionary.class).eq(MetaDictionary::getDictionaryType, dictionaryType); List dictionaryManageList = metaDictionaryManageService.list(eq); @@ -232,8 +232,8 @@ public class MetaManage { }).collect(Collectors.toList()); } - public List tagQuery(ReqTagQueryPO reqTagQueryPO) { - String parentCode = reqTagQueryPO.getParentCode(); + public List tagQuery(ReqTagQueryPO req) { + String parentCode = req.getParentCode(); if (StringUtils.isBlank(parentCode)) { parentCode = TagConst.TAG_ROOT_PARENT_CODE; } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meta/service/impl/MetaDictionaryServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/meta/service/impl/MetaDictionaryServiceImpl.java index 2f2ec85..e35a476 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/meta/service/impl/MetaDictionaryServiceImpl.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meta/service/impl/MetaDictionaryServiceImpl.java @@ -1,17 +1,16 @@ package com.hz.pm.api.meta.service.impl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.hz.pm.api.meta.model.entity.MetaDictionary; -import com.hz.pm.api.meta.mapper.MetaDictionaryMapper; -import com.hz.pm.api.meta.service.IMetaDictionaryService; import com.hz.pm.api.meta.assembler.MetaDictionaryAssembler; +import com.hz.pm.api.meta.mapper.MetaDictionaryMapper; import com.hz.pm.api.meta.model.dto.DictionaryDTO; +import com.hz.pm.api.meta.model.entity.MetaDictionary; +import com.hz.pm.api.meta.service.IMetaDictionaryService; import com.ningdatech.basic.util.CollUtils; import org.springframework.stereotype.Service; import java.util.Collection; import java.util.List; -import java.util.stream.Collectors; /** *

diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meta/service/impl/MetaTagServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/meta/service/impl/MetaTagServiceImpl.java index dfeb6a2..a718b19 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/meta/service/impl/MetaTagServiceImpl.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meta/service/impl/MetaTagServiceImpl.java @@ -2,15 +2,14 @@ package com.hz.pm.api.meta.service.impl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.hz.pm.api.meta.assembler.MetaTagAssembler; -import com.hz.pm.api.meta.model.entity.MetaTag; import com.hz.pm.api.meta.mapper.MetaTagMapper; import com.hz.pm.api.meta.model.dto.TagDTO; +import com.hz.pm.api.meta.model.entity.MetaTag; import com.hz.pm.api.meta.service.IMetaTagService; import com.ningdatech.basic.util.CollUtils; import org.springframework.stereotype.Service; import java.util.List; -import java.util.stream.Collectors; /** *

@@ -27,7 +26,7 @@ public class MetaTagServiceImpl extends ServiceImpl impl @Override public List queryAll() { List allTags = this.lambdaQuery().ne(MetaTag::getId, -1).list(); - return CollUtils.convert(allTags, MetaTagAssembler::toTagDTO); + return CollUtils.convert(allTags, MetaTagAssembler::convert); } @Override @@ -36,7 +35,7 @@ public class MetaTagServiceImpl extends ServiceImpl impl .ne(MetaTag::getId, -1) .le(MetaTag::getTagLevel, level) .list(); - return CollUtils.convert(allTags, MetaTagAssembler::toTagDTO); + return CollUtils.convert(allTags, MetaTagAssembler::convert); } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/organization/manage/OrganizationManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/organization/manage/OrganizationManage.java index 5ce0447..388a7dc 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/organization/manage/OrganizationManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/organization/manage/OrganizationManage.java @@ -95,8 +95,8 @@ public class OrganizationManage { } public List getChildOrganizationList(String parentCode, String orgName, Boolean onlyUnit) { - List parentCodeList = new ArrayList<>(); - List dingOrganizationList = new ArrayList<>(); + List parentCodeList; + List dingOrganizationList; if (StrUtils.isBlank(parentCode)) { parentCodeList = dingOrganizationProperties.getDeptVisibleScopes(); dingOrganizationList = iDingOrganizationService.list(Wrappers.lambdaQuery(DingOrganization.class) diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/organization/model/vo/OrganizationSynthesizeTreeVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/organization/model/vo/OrganizationSynthesizeTreeVO.java index a1d92eb..8b27095 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/organization/model/vo/OrganizationSynthesizeTreeVO.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/organization/model/vo/OrganizationSynthesizeTreeVO.java @@ -24,9 +24,6 @@ public class OrganizationSynthesizeTreeVO { @ApiModelProperty("名称") private String name; -// @ApiModelProperty("自己组织列表") -// private List childOrganizationList; - @ApiModelProperty("组织下成员列表") private List memberList; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/organization/model/vo/OrganizationTreeVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/organization/model/vo/OrganizationTreeVO.java index 43730fc..dc2fe12 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/organization/model/vo/OrganizationTreeVO.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/organization/model/vo/OrganizationTreeVO.java @@ -37,5 +37,5 @@ public class OrganizationTreeVO { // private Boolean isLeaf; // @ApiModelProperty(value = "社会同一信用代码") - private String unifiedSocialCreditCode;; + private String unifiedSocialCreditCode; } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/convert/PerformanceAppraisalConveter.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/convert/PerformanceAppraisalConveter.java index c251be9..00b2255 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/performance/convert/PerformanceAppraisalConveter.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/convert/PerformanceAppraisalConveter.java @@ -86,11 +86,10 @@ public class PerformanceAppraisalConveter { */ public static Boolean checkCanSelfAppraisal(PerformanceAppraisalProject appraisalProject) { if (Objects.nonNull(appraisalProject.getSelfAppraisalStart()) - && Objects.nonNull(appraisalProject.getSelfAppraisalEnd())) { - if (LocalDateTime.now().compareTo(appraisalProject.getSelfAppraisalStart()) > 0 && - LocalDateTime.now().compareTo(appraisalProject.getSelfAppraisalEnd()) < 0) { + && Objects.nonNull(appraisalProject.getSelfAppraisalEnd()) && (LocalDateTime.now().isAfter(appraisalProject.getSelfAppraisalStart()) && + LocalDateTime.now().isBefore(appraisalProject.getSelfAppraisalEnd()))) { return Boolean.TRUE; - } + } return Boolean.FALSE; } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/manage/OrgSelfAppraisalManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/manage/OrgSelfAppraisalManage.java index 512fcd0..173b3ce 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/performance/manage/OrgSelfAppraisalManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/manage/OrgSelfAppraisalManage.java @@ -502,7 +502,7 @@ public class OrgSelfAppraisalManage { .sheet(fileName) .doWrite(exportDataList); } catch (IOException e) { - throw new RuntimeException(e); + throw new BizException(e); } } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/mapper/PerformanceAppraisalMapper.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/mapper/PerformanceAppraisalMapper.java index 9dbdca1..17c46dd 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/performance/mapper/PerformanceAppraisalMapper.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/mapper/PerformanceAppraisalMapper.java @@ -2,7 +2,6 @@ package com.hz.pm.api.performance.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.hz.pm.api.performance.model.entity.PerformanceAppraisal; -import com.hz.pm.api.projectlib.model.entity.Project; /** *

diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/mapper/PerformanceAppraisalProjectMapper.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/mapper/PerformanceAppraisalProjectMapper.java index a4b7690..c71497d 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/performance/mapper/PerformanceAppraisalProjectMapper.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/mapper/PerformanceAppraisalProjectMapper.java @@ -1,7 +1,6 @@ package com.hz.pm.api.performance.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.hz.pm.api.performance.model.entity.PerformanceAppraisal; import com.hz.pm.api.performance.model.entity.PerformanceAppraisalProject; /** diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/dto/PerformanceAppraisalEditDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/dto/PerformanceAppraisalEditDTO.java index 82cdff5..5719de0 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/dto/PerformanceAppraisalEditDTO.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/dto/PerformanceAppraisalEditDTO.java @@ -1,15 +1,12 @@ package com.hz.pm.api.performance.model.dto; -import com.alibaba.fastjson.annotation.JSONField; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import org.hibernate.validator.constraints.Range; -import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotNull; import java.io.Serializable; -import java.time.LocalDateTime; import java.util.List; /** diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/dto/PerformanceAppraisalProjectGroupSaveDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/dto/PerformanceAppraisalProjectGroupSaveDTO.java index 4588aa4..f34b1d4 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/dto/PerformanceAppraisalProjectGroupSaveDTO.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/dto/PerformanceAppraisalProjectGroupSaveDTO.java @@ -1,14 +1,10 @@ package com.hz.pm.api.performance.model.dto; -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.io.Serializable; -import java.time.LocalDateTime; import java.util.List; /** diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/dto/PerformanceIndicatorAppIndexSaveDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/dto/PerformanceIndicatorAppIndexSaveDTO.java index 3d83884..51479ae 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/dto/PerformanceIndicatorAppIndexSaveDTO.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/dto/PerformanceIndicatorAppIndexSaveDTO.java @@ -1,19 +1,12 @@ package com.hz.pm.api.performance.model.dto; -import java.io.Serializable; -import java.math.BigDecimal; -import java.time.LocalDateTime; - -import javax.validation.constraints.Size; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import org.hibernate.validator.constraints.Range; - import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; +import java.io.Serializable; +import java.math.BigDecimal; + /** * 绩效评级-应用指标库 新增指标保存 * @return diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/dto/PerformanceIndicatorProjectIndexSaveDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/dto/PerformanceIndicatorProjectIndexSaveDTO.java index 3771991..3b8c839 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/dto/PerformanceIndicatorProjectIndexSaveDTO.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/dto/PerformanceIndicatorProjectIndexSaveDTO.java @@ -1,17 +1,13 @@ package com.hz.pm.api.performance.model.dto; -import java.io.Serializable; -import java.math.BigDecimal; -import java.util.List; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import org.hibernate.validator.constraints.Range; import javax.validation.constraints.Size; +import java.io.Serializable; +import java.math.BigDecimal; /** * 绩效评级-项目指标库 新增指标保存 diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/entity/PerformanceAppraisalProject.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/entity/PerformanceAppraisalProject.java index 8b69692..c75c383 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/entity/PerformanceAppraisalProject.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/entity/PerformanceAppraisalProject.java @@ -1,6 +1,5 @@ package com.hz.pm.api.performance.model.entity; -import com.alibaba.fastjson.annotation.JSONField; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/entity/PerformanceIndicatorProjectTemplate.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/entity/PerformanceIndicatorProjectTemplate.java index 49daa64..4990417 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/entity/PerformanceIndicatorProjectTemplate.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/entity/PerformanceIndicatorProjectTemplate.java @@ -5,12 +5,10 @@ import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import liquibase.pro.packaged.I; import lombok.Data; import java.io.Serializable; import java.time.LocalDateTime; -import java.util.List; /** * @Classname PerformanceIndicatorTemplate diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/vo/ProjectIndexTemplateVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/vo/ProjectIndexTemplateVO.java index 690a3b4..9efa7bb 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/vo/ProjectIndexTemplateVO.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/vo/ProjectIndexTemplateVO.java @@ -1,6 +1,5 @@ package com.hz.pm.api.performance.model.vo; -import com.hz.pm.api.performance.model.dto.ProjectTemplateDetailDTO; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/vo/ProjectIndexVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/vo/ProjectIndexVO.java index 04d6d11..b3d8215 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/vo/ProjectIndexVO.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/vo/ProjectIndexVO.java @@ -1,16 +1,13 @@ package com.hz.pm.api.performance.model.vo; -import java.io.Serializable; -import java.math.BigDecimal; -import java.time.LocalDateTime; -import java.util.List; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; + /** * 绩效评价-项目指标库 * @return diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/util/ContentTypeUtils.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/util/ContentTypeUtils.java index 5caf5d1..40be9cb 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/performance/util/ContentTypeUtils.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/util/ContentTypeUtils.java @@ -7,7 +7,6 @@ package com.hz.pm.api.performance.util; import cn.hutool.core.util.CharsetUtil; import com.ningdatech.basic.exception.BizException; -import com.wflow.config.ResponseCode; import java.io.UnsupportedEncodingException; import java.net.URLEncoder; 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 89aada9..381ca93 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 @@ -9,7 +9,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.google.common.collect.Lists; import com.hz.pm.api.common.model.constant.BizConst; import com.hz.pm.api.common.helper.UserInfoHelper; -import com.hz.pm.api.common.statemachine.util.StateMachineUtils; +import com.hz.pm.api.common.statemachine.util.StateMachineUtil; 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; @@ -79,7 +79,7 @@ public class ConstructionManage { private final IPreInsAcceptancePersonService acceptancePersonService; - private final StateMachineUtils stateMachineUtils; + private final StateMachineUtil stateMachineUtil; /** * 待采购的-项目列表 @@ -349,7 +349,7 @@ public class ConstructionManage { //判断下 如果和初验都完成了 才进入下一阶段 if (StringUtils.isNotBlank(project.getPreliminaryInspectionMaterials())) { //进入到下一状态 - stateMachineUtils.pass(project); + stateMachineUtil.pass(project); } project.setUpdateOn(LocalDateTime.now()); if (Objects.nonNull(dto.getDeliveryTime())) { @@ -540,7 +540,7 @@ public class ConstructionManage { //判断下 如果和初验都完成了 才进入下一阶段 if (Objects.nonNull(project.getDeliveryTime())) { //进入到下一状态 - stateMachineUtils.pass(project); + stateMachineUtil.pass(project); } project.setUpdateOn(LocalDateTime.now()); project.setPreliminaryInspectionMaterials(dto.getPreliminaryInspectionMaterials()); 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 48d0cc2..501006f 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 @@ -12,7 +12,7 @@ import com.hz.pm.api.common.enumeration.CommonEnum; import com.hz.pm.api.common.enumeration.ProjectProcessStageEnum; import com.hz.pm.api.common.helper.RegionCacheHelper; import com.hz.pm.api.common.helper.UserInfoHelper; -import com.hz.pm.api.common.statemachine.util.StateMachineUtils; +import com.hz.pm.api.common.statemachine.util.StateMachineUtil; import com.hz.pm.api.common.util.ExcelDownUtil; import com.hz.pm.api.common.util.ExcelExportStyle; import com.hz.pm.api.projectdeclared.model.dto.ConstructionPlanExportDTO; @@ -79,7 +79,7 @@ public class ConstructionPlanManage { private final IProjectService projectService; private final ProcessInstanceService processService; private final ProcessModelService processModelService; - private final StateMachineUtils stateMachineUtils; + private final StateMachineUtil stateMachineUtil; private final IProjectInstService projectInstService; private final ProjectLibManage projectLibManage; private final UserInfoHelper userInfoHelper; @@ -159,8 +159,8 @@ public class ConstructionPlanManage { //如果被禁用了的话 直接跳过 进入到下一个状态 if (Boolean.TRUE.equals(model.getIsStop())) { //被禁用了 调2次状态机 - stateMachineUtils.pass(constructProject); - stateMachineUtils.pass(constructProject); + stateMachineUtil.pass(constructProject); + stateMachineUtil.pass(constructProject); constructProject.setUpdateOn(LocalDateTime.now()); projectService.updateById(constructProject); return "因为建设方案流程被禁用了 直接跳过!"; @@ -194,7 +194,7 @@ public class ConstructionPlanManage { } private Project contructionPlanModifyProject(Project project, String instanceId) { - stateMachineUtils.pass(project); + stateMachineUtil.pass(project); project.setUpdateOn(LocalDateTime.now()); project.setInstCode(instanceId); projectService.updateById(project); @@ -249,7 +249,7 @@ public class ConstructionPlanManage { project.setInstCode(instanceId); project.setConstructionPlanFile(constructionPlanFile); //调用状态机 进入下一个通过状态 - stateMachineUtils.pass(project); + stateMachineUtil.pass(project); projectService.updateById(project); //保存项目和实例的关系 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 e11ec92..1a7e573 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 @@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.google.common.collect.Lists; +import com.ningdatech.basic.exception.BizException; import com.ningdatech.basic.function.VUtils; import com.ningdatech.basic.model.PageVo; import com.ningdatech.basic.util.CollUtils; @@ -88,6 +89,7 @@ public class DelayedApplyManage { /** * 延期的-项目列表 + * * @param req * @return */ @@ -97,11 +99,11 @@ public class DelayedApplyManage { LambdaQueryWrapper query = ProjectHelper.projectQuery(req); //待终验 并且已经过期 //只能看自己单位的 - query.eq(Project::getBuildOrgCode,user.getEmpPosUnitCode()); - query.eq(Project::getStatus,ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.getCode()); - query.eq(Project::getStage,ProjectStatusEnum.PROJECT_APPROVED.getCode()); + query.eq(Project::getBuildOrgCode, user.getEmpPosUnitCode()); + query.eq(Project::getStatus, ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.getCode()); + query.eq(Project::getStage, ProjectStatusEnum.PROJECT_APPROVED.getCode()); query.lt(Project::getPlanAcceptanceTime, LocalDateTime.now()); - query.eq(Project::getNewest,Boolean.TRUE); + query.eq(Project::getNewest, Boolean.TRUE); query.isNotNull(Project::getApprovalDate); query.isNotNull(Project::getBuildCycle); query.orderByAsc(Project::getApprovalDate); @@ -167,18 +169,18 @@ public class DelayedApplyManage { LambdaQueryWrapper query = ProjectHelper.projectQuery(param); //待终验 //只能看自己单位的 - query.eq(Project::getBuildOrgCode,user.getEmpPosUnitCode()); - query.eq(Project::getStatus,ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.getCode()); - query.eq(Project::getStage,ProjectStatusEnum.PROJECT_APPROVED.getCode()); - query.eq(Project::getNewest,Boolean.TRUE); + query.eq(Project::getBuildOrgCode, user.getEmpPosUnitCode()); + query.eq(Project::getStatus, ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.getCode()); + query.eq(Project::getStage, ProjectStatusEnum.PROJECT_APPROVED.getCode()); + query.eq(Project::getNewest, Boolean.TRUE); query.isNotNull(Project::getApprovalDate); query.isNotNull(Project::getBuildCycle); query.orderByAsc(Project::getApprovalDate); List records = projectService.list(query); - AtomicInteger serialNumber = new AtomicInteger(0); List collect = Lists.newArrayList(); - if(CollUtil.isNotEmpty(records)){ + if (CollUtil.isNotEmpty(records)) { + AtomicInteger rowNo = new AtomicInteger(0); collect = records.stream().map(r -> { DeclaredProjectExportDTO exportDTO = new DeclaredProjectExportDTO(); BeanUtils.copyProperties(r, exportDTO); @@ -186,7 +188,7 @@ public class DelayedApplyManage { exportDTO.setStatusName(ProjectStatusEnum.getDesc(r.getStatus())); String createOnStr = NdDateUtils.format(r.getCreateOn(), "yyyy-MM-dd HH:mm"); exportDTO.setCreateOn(createOnStr); - exportDTO.setSerialNumber(serialNumber.incrementAndGet()); + exportDTO.setSerialNumber(rowNo.incrementAndGet()); exportDTO.setPlanAcceptanceTime(Objects.nonNull(r.getPlanAcceptanceTime()) ? NdDateUtils.format(r.getPlanAcceptanceTime(), "yyyy-MM-dd") : StringUtils.EMPTY); return exportDTO; @@ -194,7 +196,7 @@ public class DelayedApplyManage { } String fileName = "待终验申请项目列表"; - ExcelDownUtil.setFileName(fileName,response); + ExcelDownUtil.setFileName(fileName, response); //数据导出处理函数 try { EasyExcel.write(response.getOutputStream(), DeclaredProjectExportDTO.class) @@ -203,14 +205,14 @@ public class DelayedApplyManage { .sheet(fileName) .doWrite(collect); } catch (IOException e) { - throw new RuntimeException(e); - } catch (Exception e) { - throw new RuntimeException(e); + log.error("待终验申请项目列表导出失败:{}", e.getMessage(), e); + throw BizException.wrap("导出失败"); } } /** * 延期申请 + * * @param dto * @return */ @@ -229,7 +231,7 @@ public class DelayedApplyManage { .throwMessage("提交失败 该项目不是 已立项|待终验"); VUtils.isTrue(Objects.isNull(project.getPlanAcceptanceTime()) - || project.getPlanAcceptanceTime().compareTo(LocalDateTime.now()) <= 0) + || !project.getPlanAcceptanceTime().isAfter(LocalDateTime.now())) .throwMessage("当前项目还未过期验收"); return "申请发起成功"; @@ -237,6 +239,7 @@ public class DelayedApplyManage { /** * 开启延期申请审批流程 + * * @param dto * @return */ @@ -256,7 +259,7 @@ public class DelayedApplyManage { .throwMessage("提交失败 该项目不是 已立项|待终验"); VUtils.isTrue(Objects.isNull(project.getPlanAcceptanceTime()) - || project.getPlanAcceptanceTime().compareTo(LocalDateTime.now()) > 0) + || project.getPlanAcceptanceTime().isAfter(LocalDateTime.now())) .throwMessage("当前项目还未过期验收"); String regionCode = project.getAreaCode(); @@ -286,7 +289,7 @@ public class DelayedApplyManage { projectLibManage.saveProjectByApplyDelay(dto, project, instanceId); //发送给第一个审批人消息 - noticeManage.sendFirtUser(project,model.getFormName(),instanceId, + noticeManage.sendFirtUser(project, model.getFormName(), instanceId, WorkNoticeConstant.PASS_MSG_TEMPLATE, MsgTypeEnum.PROJECT_REVIEW); return instanceId; @@ -294,6 +297,7 @@ public class DelayedApplyManage { /** * 查询延期 详情 + * * @param projectId * @return */ @@ -302,14 +306,15 @@ public class DelayedApplyManage { .eq(ProjectDelayApply::getProjectId, projectId) .orderByDesc(ProjectDelayApply::getCreateOn) .last(BizConst.LIMIT_1)); - if(Objects.isNull(delayApply)){ + if (Objects.isNull(delayApply)) { return null; } - return BeanUtil.copyProperties(delayApply,DelayedApplyVO.class); + return BeanUtil.copyProperties(delayApply, DelayedApplyVO.class); } /** * 查看某个项目的 延期列表 + * * @param projectId * @return */ @@ -319,11 +324,11 @@ public class DelayedApplyManage { .in(ProjectDelayApply::getProjectId, allVersionProjectId) .eq(ProjectDelayApply::getSuccess, Boolean.TRUE)); - if(CollUtil.isEmpty(delays)){ + if (CollUtil.isEmpty(delays)) { return Collections.emptyList(); } - return delays.stream().map(d -> BeanUtil.copyProperties(d,DelayedApplyVO.class)) + return delays.stream().map(d -> BeanUtil.copyProperties(d, DelayedApplyVO.class)) .collect(Collectors.toList()); } } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/OperationManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/OperationManage.java index 9f4003b..7139d1e 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 @@ -4,7 +4,7 @@ import cn.hutool.core.bean.BeanUtil; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.ningdatech.basic.function.VUtils; import com.hz.pm.api.common.model.constant.BizConst; -import com.hz.pm.api.common.statemachine.util.StateMachineUtils; +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.entity.Operation; import com.hz.pm.api.projectdeclared.model.vo.OperationVO; @@ -36,7 +36,7 @@ public class OperationManage { private final IProjectService projectService; - private final StateMachineUtils stateMachineUtils; + private final StateMachineUtil stateMachineUtil; /** * 获取实施详情 @@ -84,7 +84,7 @@ public class OperationManage { //强制放入 计划终验时间 entity.setFinalInspectionDate(project.getPlanAcceptanceTime()); if(operationService.saveOrUpdate(entity)){ - stateMachineUtils.pass(project); + stateMachineUtil.pass(project); project.setUpdateOn(LocalDateTime.now()); projectService.updateById(project); } 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 f09a221..a3849f6 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 @@ -8,7 +8,7 @@ import com.google.common.collect.Lists; import com.hz.pm.api.common.enumeration.ProjectProcessStageEnum; 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.StateMachineUtils; +import com.hz.pm.api.common.statemachine.util.StateMachineUtil; import com.hz.pm.api.common.util.ExcelDownUtil; import com.hz.pm.api.common.util.ExcelExportStyle; import com.hz.pm.api.projectdeclared.model.dto.DefaultDeclaredDTO; @@ -73,7 +73,7 @@ public class PrequalificationDeclaredProjectManage { private final ProjectLibManage projectLibManage; - private final StateMachineUtils stateMachineUtils; + private final StateMachineUtil stateMachineUtil; private final IProjectStagingService projectStagingService; @@ -122,7 +122,7 @@ public class PrequalificationDeclaredProjectManage { if (StringUtils.isNotBlank(projectDto.getHigherLineSuperOrgReviewComments())) { projectInfo.setHigherLineSuperOrgReviewComments(projectDto.getHigherLineSuperOrgReviewComments()); } - stateMachineUtils.pass(projectInfo); + stateMachineUtil.pass(projectInfo); String instanceId = null; //如果是省级部门 需要联审的(申报金额大于1000万 并且是市级项目) if (ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ProjectAdjustmentManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ProjectAdjustmentManage.java index cc2b10f..2753b95 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ProjectAdjustmentManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ProjectAdjustmentManage.java @@ -10,21 +10,21 @@ import com.hz.pm.api.common.util.ExcelExportStyle; import com.hz.pm.api.projectdeclared.model.dto.DefaultDeclaredDTO; import com.hz.pm.api.projectdeclared.model.dto.ProjectAdjustmentExportDTO; import com.hz.pm.api.projectdeclared.model.req.AdjustmentListReq; -import com.hz.pm.api.projectdeclared.utils.GenerateProjectCodeUtil; -import com.hz.pm.api.projectdeclared.utils.ReStartProcessMapUtil; -import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum; -import com.hz.pm.api.projectlib.model.enumeration.ProjectTypeNewEnum; +import com.hz.pm.api.projectdeclared.utils.RestartProcessMapUtil; import com.hz.pm.api.projectlib.helper.ProjectHelper; import com.hz.pm.api.projectlib.manage.ProjectLibManage; import com.hz.pm.api.projectlib.model.dto.ProjectDTO; import com.hz.pm.api.projectlib.model.entity.Project; import com.hz.pm.api.projectlib.model.entity.ProjectApplication; +import com.hz.pm.api.projectlib.model.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.IProjectApplicationService; import com.hz.pm.api.projectlib.service.IProjectService; import com.hz.pm.api.user.security.model.UserFullInfoDTO; 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.NdDateUtils; @@ -40,6 +40,7 @@ import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.time.LocalDateTime; import java.util.Arrays; +import java.util.Collections; import java.util.List; import java.util.Objects; import java.util.concurrent.atomic.AtomicInteger; @@ -61,17 +62,17 @@ public class ProjectAdjustmentManage { private final IProjectApplicationService projectApplicationService; - private final ReStartProcessMapUtil reStartProcessMapUtil; + private final RestartProcessMapUtil reStartProcessMapUtil; private final DefaultDeclaredProjectManage defaultDeclaredProjectManage; private final ProjectLibManage projectLibManage; private final UserInfoHelper userInfoHelper; - private final GenerateProjectCodeUtil generateProjectCodeUtil; /** * 项目内容调整 + * * @param dto * @return */ @@ -83,25 +84,20 @@ public class ProjectAdjustmentManage { VUtils.isTrue(Objects.isNull(projectInfo)).throwMessage("调整失败 此项目不存在!"); //项目名称去重 - if(StringUtils.isNotBlank(projectDto.getProjectName()) && - !projectDto.getProjectName().equals(projectInfo.getProjectName())){ + if (StringUtils.isNotBlank(projectDto.getProjectName()) && + !projectDto.getProjectName().equals(projectInfo.getProjectName())) { projectDto.setProjectCode(projectInfo.getProjectCode()); defaultDeclaredProjectManage.checkDuplication(projectDto); } //金额check - if(Objects.nonNull(projectDto.getDeclareAmount())){ + if (Objects.nonNull(projectDto.getDeclareAmount())) { defaultDeclaredProjectManage.checkAmount(projectDto); } - //修改项目内容 -// if(!modifyProject(projectDto)){ -// throw new BusinessException("调整项目失败!"); -// } - //最后去重新 提交项目流程 不同的状态 提交到不同的工作流去 Function declaredFunction = - reStartProcessMapUtil.reStartProcessMap.get(projectInfo.getStatus()); + RestartProcessMapUtil.getRestartFunction(projectInfo.getStatus()); VUtils.isTrue(Objects.isNull(declaredFunction)).throwMessage("状态不正常 没有找到对应申报函数!"); return declaredFunction.apply(dto); } @@ -109,16 +105,16 @@ public class ProjectAdjustmentManage { private Boolean modifyProject(ProjectDTO projectDto) { //先修改项目信息 Project project = new Project(); - BeanUtils.copyProperties(projectDto,project); + BeanUtils.copyProperties(projectDto, project); project.setUpdateOn(LocalDateTime.now()); - if(!projectService.updateById(project)){ + if (!projectService.updateById(project)) { throw new BusinessException("项目调整失败"); } //再修改应用信息 - if(CollUtil.isNotEmpty(projectDto.getApplicationList())){ + if (CollUtil.isNotEmpty(projectDto.getApplicationList())) { //采取批量删除 批量添加的方式 projectApplicationService.remove(Wrappers.lambdaQuery(ProjectApplication.class) - .eq(ProjectApplication::getProjectId,project.getId())); + .eq(ProjectApplication::getProjectId, project.getId())); //批量添加 List applications = projectDto.getApplicationList().stream().map(application -> { ProjectApplication projectApplication = new ProjectApplication(); @@ -133,22 +129,26 @@ public class ProjectAdjustmentManage { return Boolean.TRUE; } + private static final List PROJECT_STATUS = Arrays.asList( + ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS.getCode(), + ProjectStatusEnum.PREQUALIFICATION_FAILED.getCode(), + ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED.getCode(), + ProjectStatusEnum.SCHEME_REVIEW_FAILED.getCode()); + /** * 项目库 + * * @param preReq * @return */ public PageVo projectLibList(AdjustmentListReq preReq) { //限定参数 复制bean ProjectListReq req = new ProjectListReq(); - BeanUtils.copyProperties(preReq,req); + BeanUtils.copyProperties(preReq, req); //项目阶段 状态 已定 方案待申报 - req.setStageList(Arrays.asList(ProjectStatusEnum.NOT_APPROVED.getCode())); + req.setStageList(Collections.singletonList(ProjectStatusEnum.NOT_APPROVED.getCode())); //只有 单位内部审核不通过 省级联审不通过 预审不通过 建设方案不通过 4种状态 - req.setStatusList(Arrays.asList(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS.getCode(), - ProjectStatusEnum.PREQUALIFICATION_FAILED.getCode(), - ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED.getCode(), - ProjectStatusEnum.SCHEME_REVIEW_FAILED.getCode())); + req.setStatusList(PROJECT_STATUS); UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); VUtils.isTrue(Objects.isNull(user)).throwMessage("获取登录用户失败!"); //放入用户的单位 @@ -159,14 +159,11 @@ public class ProjectAdjustmentManage { public void exportList(HttpServletResponse response, AdjustmentListReq preReq) { //限定参数 复制bean ProjectListReq req = new ProjectListReq(); - BeanUtils.copyProperties(preReq,req); + BeanUtils.copyProperties(preReq, req); //项目阶段 状态 已定 方案待申报 - req.setStageList(Arrays.asList(ProjectStatusEnum.NOT_APPROVED.getCode())); + req.setStageList(Collections.singletonList(ProjectStatusEnum.NOT_APPROVED.getCode())); //只有 单位内部审核不通过 省级联审不通过 预审不通过 建设方案不通过 4种状态 - req.setStatusList(Arrays.asList(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS.getCode(), - ProjectStatusEnum.PREQUALIFICATION_FAILED.getCode(), - ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED.getCode(), - ProjectStatusEnum.SCHEME_REVIEW_FAILED.getCode())); + req.setStatusList(PROJECT_STATUS); UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); VUtils.isTrue(Objects.isNull(user)).throwMessage("获取登录用户失败!"); //放入用户的单位 @@ -187,7 +184,7 @@ public class ProjectAdjustmentManage { return exportDTO; }).collect(Collectors.toList()); String fileName = "项目内容调整列表"; - ExcelDownUtil.setFileName(fileName,response); + ExcelDownUtil.setFileName(fileName, response); //数据导出处理函数 try { EasyExcel.write(response.getOutputStream(), ProjectAdjustmentExportDTO.class) @@ -196,7 +193,7 @@ public class ProjectAdjustmentManage { .sheet(fileName) .doWrite(collect); } catch (IOException e) { - throw new RuntimeException(e); + throw new BizException(e); } } } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/PurchaseManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/PurchaseManage.java index 4a3435e..26bdf16 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 @@ -12,7 +12,7 @@ import com.ningdatech.basic.model.PageVo; import com.ningdatech.basic.util.CollUtils; import com.ningdatech.basic.util.NdDateUtils; import com.hz.pm.api.common.helper.UserInfoHelper; -import com.hz.pm.api.common.statemachine.util.StateMachineUtils; +import com.hz.pm.api.common.statemachine.util.StateMachineUtil; import com.hz.pm.api.common.util.ExcelDownUtil; import com.hz.pm.api.common.util.ExcelExportStyle; import com.hz.pm.api.projectdeclared.model.dto.DeclaredProjectExportDTO; @@ -61,7 +61,7 @@ public class PurchaseManage { private final IPurchaseService purchaseService; - private final StateMachineUtils stateMachineUtils; + private final StateMachineUtil stateMachineUtil; /** * 待采购的-项目列表 @@ -207,7 +207,7 @@ public class PurchaseManage { // } // } //进入到下一状态 - stateMachineUtils.pass(project); + stateMachineUtil.pass(project); project.setUpdateOn(LocalDateTime.now()); // 获取总的成交时间及金额 diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/dto/OperationDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/dto/OperationDTO.java index a6798f7..3dd4c0c 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/OperationDTO.java @@ -1,8 +1,5 @@ package com.hz.pm.api.projectdeclared.model.dto; -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.AllArgsConstructor; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/dto/PaymentPlanSupplementDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/dto/PaymentPlanSupplementDTO.java index 0f15309..d0158e2 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/dto/PaymentPlanSupplementDTO.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/dto/PaymentPlanSupplementDTO.java @@ -1,13 +1,11 @@ package com.hz.pm.api.projectdeclared.model.dto; -import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import javax.validation.constraints.NotNull; import java.math.BigDecimal; -import java.time.LocalDateTime; /** * @Classname PaymentPlan diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/dto/PreInsAcceptancePersonSaveDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/dto/PreInsAcceptancePersonSaveDTO.java index 0dcab7b..78ff9ae 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/dto/PreInsAcceptancePersonSaveDTO.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/dto/PreInsAcceptancePersonSaveDTO.java @@ -4,9 +4,6 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; -import javax.validation.constraints.NotNull; -import java.time.LocalDateTime; - /** * @Classname PreInsAcceptancePerson * @Description 初验人员 diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/dto/PreInsSaveDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/dto/PreInsSaveDTO.java index 6edacbc..0e0dd37 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/dto/PreInsSaveDTO.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/dto/PreInsSaveDTO.java @@ -1,14 +1,11 @@ package com.hz.pm.api.projectdeclared.model.dto; -import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotNull; -import java.math.BigDecimal; -import java.time.LocalDateTime; import java.util.List; /** 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 d9217ec..38c93be 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 @@ -1,10 +1,10 @@ package com.hz.pm.api.projectdeclared.model.dto; import com.hz.pm.api.projectlib.model.dto.ProjectDTO; -import com.wflow.workflow.bean.dto.ProcessInstanceUserDto; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.*; + import javax.validation.constraints.NotNull; import java.io.Serializable; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/entity/PaymentPlan.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/entity/PaymentPlan.java index bfc2243..6d69a00 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/entity/PaymentPlan.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/entity/PaymentPlan.java @@ -1,12 +1,13 @@ package com.hz.pm.api.projectdeclared.model.entity; -import com.baomidou.mybatisplus.annotation.*; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.math.BigDecimal; -import java.time.LocalDate; import java.time.LocalDateTime; /** diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/entity/PreInsAcceptancePerson.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/entity/PreInsAcceptancePerson.java index c541ace..68394a9 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/entity/PreInsAcceptancePerson.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/entity/PreInsAcceptancePerson.java @@ -7,7 +7,6 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; -import java.math.BigDecimal; import java.time.LocalDateTime; /** diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/vo/PreInsAcceptancePersonVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/vo/PreInsAcceptancePersonVO.java index a487285..6b98428 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/vo/PreInsAcceptancePersonVO.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/vo/PreInsAcceptancePersonVO.java @@ -1,8 +1,5 @@ package com.hz.pm.api.projectdeclared.model.vo; -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/vo/PreInsVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/vo/PreInsVO.java index 7c4e602..316dd59 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/vo/PreInsVO.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/vo/PreInsVO.java @@ -1,14 +1,9 @@ package com.hz.pm.api.projectdeclared.model.vo; -import com.baomidou.mybatisplus.annotation.FieldFill; -import com.baomidou.mybatisplus.annotation.TableField; -import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; -import java.math.BigDecimal; -import java.time.LocalDateTime; import java.util.List; /** 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 deleted file mode 100644 index 7b4dd7c..0000000 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/utils/ReStartProcessMapUtil.java +++ /dev/null @@ -1,58 +0,0 @@ -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.model.enumeration.ProjectStatusEnum; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; -import java.util.Map; -import java.util.function.Function; - -/** - * @Classname ReSubmitProcessMap - * @Description 项目调整 重新提交时的 事件函数MAP - * @Date 2023/2/15 11:19 - * @Author PoffyZhang - */ -@Component -public class ReStartProcessMapUtil { - @Autowired - private DeclaredProjectManage declaredProjectManage; - - @Autowired - private ConstructionPlanManage constructionPlanManage; - - @Autowired - private PrequalificationDeclaredProjectManage prequalificationDeclaredProjectManage; - - @Autowired - private ReviewByProvincialDeptManage provincialDeptManage; - - @Autowired - private FinalAcceptanceManage finalAcceptanceManage; - - public Map> reStartProcessMap = Maps.newHashMap(); - /** - * 初始化业务分派逻辑,代替了if-else部分 - * key: 枚举 状态值 - * value: lambda表达式,最终会获取发起实例的函数 - */ - public ReStartProcessMapUtil(){ - //重新项目申报 - reStartProcessMap.put(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS.getCode(), - dto->declaredProjectManage.reStartTheProcess(dto)); - //建设方案 - reStartProcessMap.put(ProjectStatusEnum.SCHEME_REVIEW_FAILED.getCode(), - dto->constructionPlanManage.restartTheProcess(dto)); - //预审方案 - reStartProcessMap.put(ProjectStatusEnum.PREQUALIFICATION_FAILED.getCode(), - dto->prequalificationDeclaredProjectManage.restartTheProcess(dto)); - //省级联审 - reStartProcessMap.put(ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED.getCode(), - dto->provincialDeptManage.restartTheProcess(dto)); - //终审 - reStartProcessMap.put(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED.getCode(), - dto->finalAcceptanceManage.restartProcess(dto)); - } -} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/utils/RestartProcessMapUtil.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/utils/RestartProcessMapUtil.java new file mode 100644 index 0000000..aa05673 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/utils/RestartProcessMapUtil.java @@ -0,0 +1,51 @@ +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.model.enumeration.ProjectStatusEnum; +import org.springframework.stereotype.Component; + +import java.util.Map; +import java.util.function.Function; + +/** + *

+ * RestartProcessMapUtil - 项目调整 重新提交时的 事件函数MAP + *

+ * + * @author PoffyZhang + * @since 2023/2/15 11:19 + */ +@Component +public class RestartProcessMapUtil { + + private static final Map> RESTART_PROCESS_MAP = Maps.newHashMap(); + + public RestartProcessMapUtil(DeclaredProjectManage declaredProjectManage, + ConstructionPlanManage constructionPlanManage, + PrequalificationDeclaredProjectManage prequalificationDeclaredProjectManage, + ReviewByProvincialDeptManage provincialDeptManage, + FinalAcceptanceManage finalAcceptanceManage) { + //重新项目申报 + RESTART_PROCESS_MAP.put(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS.getCode(), + declaredProjectManage::reStartTheProcess); + //建设方案 + RESTART_PROCESS_MAP.put(ProjectStatusEnum.SCHEME_REVIEW_FAILED.getCode(), + constructionPlanManage::restartTheProcess); + //预审方案 + RESTART_PROCESS_MAP.put(ProjectStatusEnum.PREQUALIFICATION_FAILED.getCode(), + prequalificationDeclaredProjectManage::restartTheProcess); + //省级联审 + RESTART_PROCESS_MAP.put(ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED.getCode(), + provincialDeptManage::restartTheProcess); + //终审 + RESTART_PROCESS_MAP.put(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED.getCode(), + finalAcceptanceManage::restartProcess); + } + + public static Function getRestartFunction(Integer status) { + return RESTART_PROCESS_MAP.get(status); + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/AnnualPlanHandle.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/AnnualPlanHandle.java index 50dd02a..6282d8a 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/AnnualPlanHandle.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/AnnualPlanHandle.java @@ -1,5 +1,6 @@ package com.hz.pm.api.projectlib.handle; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.hz.pm.api.common.model.constant.BizConst; import com.hz.pm.api.common.model.constant.CommonConst; @@ -52,7 +53,7 @@ public class AnnualPlanHandle extends AbstractProcessBusinessHandle { DEPARTMENT_JOINT_REVIEW_FAILED ); - public AnnualPlanHandle(INdProjectStatusChangeService projectStatusChangeService, IProjectService projectService){ + public AnnualPlanHandle(INdProjectStatusChangeService projectStatusChangeService, IProjectService projectService) { this.projectStatusChangeService = projectStatusChangeService; this.projectService = projectService; } @@ -69,7 +70,7 @@ public class AnnualPlanHandle extends AbstractProcessBusinessHandle { List allVersionProjectIds = projectService.getAllVersionProjectId(project); // 项目状态为年度计划中之前的状态 - if (fieldList.contains(status)){ + if (fieldList.contains(status)) { processDetailVO.setStepStatus(StepStatusEnum.NOT_START); processDetailVO.setProcessName(CommonConst.ANNUAL_PLAN); processSchedule.add(processDetailVO); @@ -77,33 +78,30 @@ public class AnnualPlanHandle extends AbstractProcessBusinessHandle { } // 项目状态为年度计划中 - if (ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode().equals(status)){ + LambdaQueryWrapper pscQuery = Wrappers.lambdaQuery(ProjectStatusChange.class) + .in(ProjectStatusChange::getProjectId, allVersionProjectIds) + .last(BizConst.LIMIT_1); + if (ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode().equals(status)) { // 根据部门联审通过的时间获取 - ProjectStatusChange projectStatusChange = projectStatusChangeService.getOne(Wrappers.lambdaQuery(ProjectStatusChange.class) - .in(ProjectStatusChange::getProjectId, allVersionProjectIds) - .eq(ProjectStatusChange::getEvent, ProjectStatusChangeEvent.DEPARTMENT_UNITED_REVIEW_PASS.name()) - .last(BizConst.LIMIT_1)); - if(Objects.nonNull(projectStatusChange)){ + pscQuery.eq(ProjectStatusChange::getEvent, ProjectStatusChangeEvent.DEPARTMENT_UNITED_REVIEW_PASS); + ProjectStatusChange projectStatusChange = projectStatusChangeService.getOne(pscQuery); + if (Objects.nonNull(projectStatusChange)) { processDetailVO.setFinishTime(projectStatusChange.getCreateOn()); processDetailVO.setStepStatus(StepStatusEnum.ON_GOING); } } else if (ProjectStatusEnum.BE_SUSPENDED.getCode().equals(status)) { // 根据年度计划暂缓的时间获取 - ProjectStatusChange projectStatusChange = projectStatusChangeService.getOne(Wrappers.lambdaQuery(ProjectStatusChange.class) - .in(ProjectStatusChange::getProjectId, allVersionProjectIds) - .eq(ProjectStatusChange::getEvent, ProjectStatusChangeEvent.ANNUAL_PLAN_SUSPEND.name()) - .last(BizConst.LIMIT_1)); - if(Objects.nonNull(projectStatusChange)){ + pscQuery.eq(ProjectStatusChange::getEvent, ProjectStatusChangeEvent.ANNUAL_PLAN_SUSPEND); + ProjectStatusChange projectStatusChange = projectStatusChangeService.getOne(pscQuery); + if (Objects.nonNull(projectStatusChange)) { processDetailVO.setFinishTime(projectStatusChange.getCreateOn()); processDetailVO.setStepStatus(StepStatusEnum.REJECTED); } } else { // 根据开启方案申报的时间获取 - ProjectStatusChange projectStatusChange = projectStatusChangeService.getOne(Wrappers.lambdaQuery(ProjectStatusChange.class) - .in(ProjectStatusChange::getProjectId, allVersionProjectIds) - .eq(ProjectStatusChange::getEvent, ProjectStatusChangeEvent.ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE.name()) - .last(BizConst.LIMIT_1)); - if(Objects.nonNull(projectStatusChange)){ + pscQuery.eq(ProjectStatusChange::getEvent, ProjectStatusChangeEvent.ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE); + ProjectStatusChange projectStatusChange = projectStatusChangeService.getOne(pscQuery); + if (Objects.nonNull(projectStatusChange)) { processDetailVO.setFinishTime(projectStatusChange.getCreateOn()); processDetailVO.setStepStatus(StepStatusEnum.COMPLETED); } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/ProcessExecuteChainHandle.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/ProcessExecuteChainHandle.java index bb9ee78..c9ef5a1 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/ProcessExecuteChainHandle.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/ProcessExecuteChainHandle.java @@ -6,7 +6,7 @@ import com.hz.pm.api.common.model.constant.BizConst; import com.hz.pm.api.common.model.constant.ProjectDeclareConst; import com.hz.pm.api.common.enumeration.ProjectProcessStageEnum; import com.hz.pm.api.common.statemachine.contant.RegionContant; -import com.hz.pm.api.common.statemachine.util.StateMachineUtils; +import com.hz.pm.api.common.statemachine.util.StateMachineUtil; import com.hz.pm.api.projectlib.model.entity.Project; import com.hz.pm.api.projectlib.service.IProjectService; import com.wflow.bean.entity.WflowModels; @@ -84,7 +84,7 @@ public class ProcessExecuteChainHandle { } } else if (processBusinessHandle instanceof ProvinceUnitedReviewHandle) { //省级联审 - if (StateMachineUtils.isCityProject(project) && StateMachineUtils.judgeDeclareAmount(project, + if (StateMachineUtil.isCityProject(project) && StateMachineUtil.judgeDeclareAmount(project, ProjectDeclareConst.Number.DECLARE_AMOUNT_JUDGEMENT)) { handles.add(processBusinessHandle); } 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 fc13877..1dbba65 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 @@ -16,7 +16,7 @@ import com.hz.pm.api.common.model.constant.CommonConst; import com.hz.pm.api.common.enumeration.CommonEnum; import com.hz.pm.api.common.helper.UserInfoHelper; import com.hz.pm.api.common.model.entity.ExcelExportWriter; -import com.hz.pm.api.common.statemachine.util.StateMachineUtils; +import com.hz.pm.api.common.statemachine.util.StateMachineUtil; import com.hz.pm.api.common.util.BizUtils; import com.hz.pm.api.common.util.ExcelDownUtil; import com.hz.pm.api.datascope.model.DataScopeDTO; @@ -80,7 +80,7 @@ public class AnnualPlanLibManage { private final IProjectService projectService; private final IProjectApplicationService applicationService; - private final StateMachineUtils stateMachine; + private final StateMachineUtil stateMachine; private final UserInfoHelper userInfoHelper; private final IProjectRenewalFundDeclarationService projectRenewalFundDeclarationService; 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 b4e3548..a0a1be6 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 @@ -25,7 +25,7 @@ import com.hz.pm.api.common.enumeration.ProjectProcessStageEnum; import com.hz.pm.api.common.helper.RegionCacheHelper; import com.hz.pm.api.common.helper.UserInfoHelper; import com.hz.pm.api.common.model.entity.ExcelExportWriter; -import com.hz.pm.api.common.statemachine.util.StateMachineUtils; +import com.hz.pm.api.common.statemachine.util.StateMachineUtil; import com.hz.pm.api.common.util.BizUtils; import com.hz.pm.api.common.util.ExcelDownUtil; import com.hz.pm.api.dashboard.handle.ApplicationHandler; @@ -93,6 +93,7 @@ import org.springframework.stereotype.Component; import javax.servlet.http.HttpServletResponse; import java.math.BigDecimal; +import java.math.RoundingMode; import java.time.LocalDateTime; import java.util.*; import java.util.stream.Collectors; @@ -119,7 +120,7 @@ public class ProjectLibManage { private final IProjectApplicationService projectApplicationService; private final GenerateProjectCodeUtil generateProjectCodeUtil; private final IProjectInstService projectInstService; - private final StateMachineUtils stateMachineUtils; + private final StateMachineUtil stateMachineUtil; private final INdProjectDelayApplyService projectDelayApplyService; private final INdProjectApplyBorrowService projectApplyBorrowService; private final IDingOrganizationService dingOrganizationService; @@ -151,12 +152,11 @@ public class ProjectLibManage { LambdaQueryWrapper query = ProjectHelper.projectQuery(req); query.eq(Project::getNewest, Boolean.TRUE); Page page = projectService.page(req.page(), query); - long total; + if (CollUtil.isEmpty(page.getRecords())) { return PageVo.empty(); } - // List projectCodes = page.getRecords().stream() .map(Project::getProjectCode).collect(Collectors.toList()); @@ -208,7 +208,7 @@ public class ProjectLibManage { //项目查最新 query.eq(Project::getNewest, Boolean.TRUE); Page page = projectService.page(req.page(), query); - long total; + if (CollUtil.isEmpty(page.getRecords())) { return PageVo.empty(); } @@ -387,11 +387,10 @@ public class ProjectLibManage { public PageVo projectAllListWithPermission(ProjectListReq req, UserFullInfoDTO user) { req = buildProjectLibPermission(req, user); Page page = projectService.pageAllWithPermission(req.page(), req); - long total; + if (CollUtil.isEmpty(page.getRecords())) { return PageVo.empty(); } - UserFullInfoDTO finalUser = user; Set projectCodes = page.getRecords().stream() .map(ProjectPO::getProjectCode).collect(Collectors.toSet()); @@ -443,10 +442,10 @@ public class ProjectLibManage { item.setProcessStatus(w.getProcessStatus()); item.setInstCode(w.getInstCode()); item.setIsHigherSuperOrg(w.getIsHigherSuperOrg()); - if (finalUser.getIsOrgAdmin() && + if (user.getIsOrgAdmin() && ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode().equals(item.getStatus()) - && StringUtils.isNotBlank(w.getSuperOrgCode()) && StringUtils.isNotBlank(finalUser.getEmpPosUnitCode()) - && w.getSuperOrgCode().equals(finalUser.getEmpPosUnitCode())) { + && StringUtils.isNotBlank(w.getSuperOrgCode()) && StringUtils.isNotBlank(user.getEmpPosUnitCode()) + && w.getSuperOrgCode().equals(user.getEmpPosUnitCode())) { item.setCanPreDeclared(Boolean.TRUE); } item.setApprovedAmount(w.getApprovalAmount()); @@ -469,11 +468,10 @@ public class ProjectLibManage { public PageVo libListWithPermission(ProjectListReq req, UserFullInfoDTO user) { req = buildProjectLibPermission(req, user); Page page = projectService.pagelibWithPermission(req.page(), req); - long total; + if (CollUtil.isEmpty(page.getRecords())) { return PageVo.empty(); } - UserFullInfoDTO finalUser = user; Set projectCodes = page.getRecords().stream() .map(ProjectPO::getProjectCode).collect(Collectors.toSet()); @@ -525,10 +523,10 @@ public class ProjectLibManage { item.setProcessStatus(w.getProcessStatus()); item.setInstCode(w.getInstCode()); item.setIsHigherSuperOrg(w.getIsHigherSuperOrg()); - if (finalUser.getIsOrgAdmin() && + if (user.getIsOrgAdmin() && ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode().equals(item.getStatus()) - && StringUtils.isNotBlank(w.getSuperOrgCode()) && StringUtils.isNotBlank(finalUser.getEmpPosUnitCode()) - && w.getSuperOrgCode().equals(finalUser.getEmpPosUnitCode())) { + && StringUtils.isNotBlank(w.getSuperOrgCode()) && StringUtils.isNotBlank(user.getEmpPosUnitCode()) + && w.getSuperOrgCode().equals(user.getEmpPosUnitCode())) { item.setCanPreDeclared(Boolean.TRUE); } item.setApprovedAmount(w.getApprovalAmount()); @@ -552,15 +550,14 @@ public class ProjectLibManage { UserFullInfoDTO user) { req = buildProjectLibPermission(req, user); Page page = projectService.pagelibWithPermission(req.page(), req); - long total; + if (CollUtil.isEmpty(page.getRecords())) { return PageVo.empty(); } - UserFullInfoDTO finalUser = user; Set instCodes = page.getRecords().stream() - .filter(p -> StringUtils.isNotBlank(p.getInstCode())) - .map(ProjectPO::getInstCode).collect(Collectors.toSet()); + .map(ProjectPO::getInstCode) + .filter(StringUtils::isNotBlank).collect(Collectors.toSet()); List tasks = taskService.createTaskQuery() .processInstanceIdIn(instCodes) .orderByTaskCreateTime() @@ -594,10 +591,10 @@ public class ProjectLibManage { item.setInstCode(w.getInstCode()); item.setIsHigherSuperOrg(w.getIsHigherSuperOrg()); item.setApproveUsers(buildApproveUsers(w.getInstCode(), map, userMap)); - if (finalUser.getIsOrgAdmin() && + if (user.getIsOrgAdmin() && ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode().equals(item.getStatus()) - && StringUtils.isNotBlank(w.getSuperOrgCode()) && StringUtils.isNotBlank(finalUser.getEmpPosUnitCode()) - && w.getSuperOrgCode().equals(finalUser.getEmpPosUnitCode())) { + && StringUtils.isNotBlank(w.getSuperOrgCode()) && StringUtils.isNotBlank(user.getEmpPosUnitCode()) + && w.getSuperOrgCode().equals(user.getEmpPosUnitCode())) { item.setCanPreDeclared(Boolean.TRUE); } item.setApprovedAmount(w.getApprovalAmount()); @@ -809,13 +806,11 @@ public class ProjectLibManage { .eq(ProjectRenewalFundDeclaration::getDeleted, Boolean.FALSE) .orderByAsc(ProjectRenewalFundDeclaration::getProjectYear)); Optional.ofNullable(renewalDeclarations).ifPresent(declarations -> - declarations.forEach(declaration -> { - annualAmounts.add(AnnualAmountVO.builder() - .projectId(projectInfo.getId()) - .projectYear(declaration.getProjectYear()) - .annualAmount(declaration.getAnnualPaymentAmount()) - .build()); - }) + declarations.forEach(declaration -> annualAmounts.add(AnnualAmountVO.builder() + .projectId(projectInfo.getId()) + .projectYear(declaration.getProjectYear()) + .annualAmount(declaration.getAnnualPaymentAmount()) + .build())) ); vo.setAnnualAccumulateAmountList(annualAmounts); } @@ -1032,7 +1027,7 @@ public class ProjectLibManage { project.setCreateOn(LocalDateTime.now()); project.setUpdateOn(LocalDateTime.now()); project.setIsBackReject(Boolean.FALSE); - stateMachineUtils.pass(project); + stateMachineUtil.pass(project); projectService.save(project); oldProject.setIsBackReject(Boolean.TRUE); @@ -1156,7 +1151,7 @@ public class ProjectLibManage { project.setIsBackReject(isBackReject); //终验材料 project.setFinalAcceptanceMaterials(dto.getFinalAcceptanceMaterials()); - stateMachineUtils.pass(project); + stateMachineUtil.pass(project); oldProject.setIsBackReject(isBackReject); projectService.updateById(oldProject); @@ -1193,7 +1188,7 @@ public class ProjectLibManage { project.setUpdateOn(LocalDateTime.now()); // 标识保存的项目信息是否为建设方案申报项目 project.setIsConstruct(Boolean.FALSE); - stateMachineUtils.pass(project); + stateMachineUtil.pass(project); oldProject.setIsBackReject(Boolean.TRUE); projectService.updateById(oldProject); @@ -1218,7 +1213,7 @@ public class ProjectLibManage { /** * 获取项目初步方案详情 * - * @param projectId + * @param projectId \ * @return com.hz.pm.api.projectlib.model.vo.ProjectDetailVO * @author CMM * @since 2023/07/12 11:43 @@ -1253,17 +1248,16 @@ public class ProjectLibManage { private boolean checkCanRead(Set subOrgSet, Project project) { // 从申请借阅信息表中查出本单位及下属单位审批通过的项目 - HashSet borrowProjectIdSet = new HashSet<>(); - List applyBorrowProjectIdList = projectApplyBorrowService - .list(Wrappers.lambdaQuery(ProjectApplyBorrow.class) - .in(ProjectApplyBorrow::getApplyBorrowEmpPosUnitCode, subOrgSet) - .eq(ProjectApplyBorrow::getIsSuccess, Boolean.TRUE)) - .stream().map(ProjectApplyBorrow::getProjectId).filter(borrowProjectIdSet::add).collect(Collectors.toList()); + LambdaQueryWrapper query = Wrappers.lambdaQuery(ProjectApplyBorrow.class) + .select(ProjectApplyBorrow::getProjectId) + .in(ProjectApplyBorrow::getApplyBorrowEmpPosUnitCode, subOrgSet) + .eq(ProjectApplyBorrow::getIsSuccess, Boolean.TRUE); + List applyBorrowProjectIdList = CollUtils.fieldList(projectApplyBorrowService.list(query), ProjectApplyBorrow::getProjectId); return applyBorrowProjectIdList.contains(project.getId()); } private Set getSubOrgList(String empPosUnitCode) { - HashSet orgSet = new HashSet<>(); + Set orgSet = new HashSet<>(); // 先将自己加入子集 orgSet.add(empPosUnitCode); Set subOrgList = dingOrganizationService @@ -1505,7 +1499,7 @@ public class ProjectLibManage { PaymentPlanVO vo = BeanUtil.copyProperties(p, PaymentPlanVO.class); vo.setRatio((Objects.isNull(totalAmount) || totalAmount.compareTo(BigDecimal.ZERO) == 0) ? "0%" : p.getPaymentAmount().multiply(BigDecimal.valueOf(100)) - .divide(totalAmount, BigDecimal.ROUND_CEILING, BigDecimal.ROUND_CEILING) + "%"); + .divide(totalAmount, BigDecimal.ROUND_CEILING, RoundingMode.CEILING) + "%"); return vo; }) .collect(Collectors.toList()); @@ -1565,7 +1559,7 @@ public class ProjectLibManage { //2.要判断 项目在当前状态 有没有被驳回和退回过 //当前项目状态流程的 实例 看看是不是有2个以上 有2个说明 有退回 驳回 - Boolean isChangeRecord = todoService.isChangeRecord(projectId); + boolean isChangeRecord = todoService.isChangeRecord(projectId); if (!isChangeRecord) { return res; } @@ -1623,7 +1617,7 @@ public class ProjectLibManage { private void saveApplication(ProjectDTO projectDto, Project project, Boolean isConstruct) { UserInfoDetails user = LoginUserUtil.loginUserDetail(); //保存项目应用 - Boolean isApp = Objects.nonNull(projectDto.getIncludeApplication()) && CommonEnum.YES.getCode().equals(projectDto.getIncludeApplication()) + boolean isApp = Objects.nonNull(projectDto.getIncludeApplication()) && CommonEnum.YES.getCode().equals(projectDto.getIncludeApplication()) ? Boolean.TRUE : Boolean.FALSE; //采取批量删除 批量添加的方式 Integer version = Objects.nonNull(project.getVersion()) ? project.getVersion() : 1; 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 47b1c04..2ac2ae1 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 @@ -289,7 +289,6 @@ public class ProjectRenewalFundManage { } vo.setProjectName(operationBaseinfo.getBaseProjName()); vo.setProjectType(operationBaseinfo.getBaseProjType()); -// vo.setStage(project.getStage()); vo.setStatus(StringUtils.isNotBlank(operationBaseinfo.getBaseProjSetProg()) ? Integer.parseInt(operationBaseinfo.getBaseProjSetProg()) : null); vo.setBuildOrgName(operationBaseinfo.getBaseBuildDeprt()); @@ -307,19 +306,17 @@ public class ProjectRenewalFundManage { .eq(ProjectRenewalFundDeclaration::getDeleted,Boolean.FALSE) .orderByAsc(ProjectRenewalFundDeclaration::getProjectYear)); Optional.ofNullable(renewalDeclarations).ifPresent(declarations -> - declarations.forEach(declaration -> { - annualAmounts.add(AnnualAmountVO.builder() - .projectId(operationBaseinfo.getId()) - .projectCode(operationBaseinfo.getBaseProjId()) - .projectYear(declaration.getProjectYear()) - .annualAmount(declaration.getAnnualPaymentAmount()) - .haveAmount(declaration.getHaveAmount()) - .govOwnFinanceAmount(declaration.getGovOwnFinanceAmount()) - .bankLendingAmount(declaration.getBankLendingAmount()) - .govSuperiorFinanceAmount(declaration.getGovSuperiorFinanceAmount()) - .otherAmount(declaration.getOtherAmount()) - .build()); - }) + declarations.forEach(declaration -> annualAmounts.add(AnnualAmountVO.builder() + .projectId(operationBaseinfo.getId()) + .projectCode(operationBaseinfo.getBaseProjId()) + .projectYear(declaration.getProjectYear()) + .annualAmount(declaration.getAnnualPaymentAmount()) + .haveAmount(declaration.getHaveAmount()) + .govOwnFinanceAmount(declaration.getGovOwnFinanceAmount()) + .bankLendingAmount(declaration.getBankLendingAmount()) + .govSuperiorFinanceAmount(declaration.getGovSuperiorFinanceAmount()) + .otherAmount(declaration.getOtherAmount()) + .build())) ); vo.setAnnualAccumulateAmountList(annualAmounts); } @@ -332,7 +329,6 @@ public class ProjectRenewalFundManage { * @return */ public Long declared(ProjectRenewalFundDeclarationDTO dto) { - Integer projectYear = dto.getProjectYear(); //要判断 项目id 是否 以及状态是 已验收 String projectCode = dto.getProjectCode(); Project project = projectService.getProjectByCode(projectCode); @@ -388,9 +384,6 @@ public class ProjectRenewalFundManage { .throwMessage("续建资金年度错误!"); } - //判断金额 -// checkPaymentAmount(projectCode,projectYear,dto.getAnnualPaymentAmount()); - declaration.setApprovalStatus(ProjectRenewalApprovalStatusEnum.PENDING.name()); if(Objects.nonNull(project)){ declaration.setRegionCode(project.getAreaCode()); @@ -417,16 +410,16 @@ public class ProjectRenewalFundManage { .eq(PaymentPlan::getProjectCode, projectCode) .orderByAsc(PaymentPlan::getPaymentTime)); VUtils.isTrue(CollUtil.isEmpty(paymentPlans)).throwMessage("未有所选年度的支付计划,无法提交"); - Boolean hasYearPlan = Boolean.FALSE; + boolean hasYearPlan = Boolean.FALSE; for(PaymentPlan plan : paymentPlans){ if(Objects.isNull(plan.getPaymentTime())){ continue; } int year = plan.getPaymentTime().getYear(); - if(Objects.nonNull(year) && projectYear.equals(year)){ + if(projectYear.equals(year)){ hasYearPlan = Boolean.TRUE; - }else if(Objects.nonNull(year) && projectYear.compareTo(year) > 0){ + }else if(projectYear.compareTo(year) > 0){ //2 如果有 这一年前的实际支付金额有没有填 VUtils.isTrue(Objects.isNull(plan.getActualPaymentAmount())) .throwMessage("有漏填写此年度之前年度的实际支付金额,请去合同备案补充"); @@ -552,7 +545,7 @@ public class ProjectRenewalFundManage { .sheet(fileName) .doWrite(collect); } catch (IOException e) { - throw new RuntimeException(e); + throw new BizException(e); } } @@ -593,7 +586,7 @@ public class ProjectRenewalFundManage { .sheet(fileName) .doWrite(collect); } catch (IOException e) { - throw new RuntimeException(e); + throw new BizException(e); } } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/po/ProjectRenewalFundDeclarationPO.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/po/ProjectRenewalFundDeclarationPO.java index 383dcc6..8bdc79a 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/po/ProjectRenewalFundDeclarationPO.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/po/ProjectRenewalFundDeclarationPO.java @@ -1,8 +1,5 @@ package com.hz.pm.api.projectlib.model.po; -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/req/ProjectRenewalAuditReq.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/req/ProjectRenewalAuditReq.java index 55f6e17..dad252a 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/req/ProjectRenewalAuditReq.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/req/ProjectRenewalAuditReq.java @@ -5,9 +5,7 @@ import io.swagger.annotations.ApiModelProperty; import lombok.Data; import org.hibernate.validator.constraints.Length; -import javax.validation.constraints.Max; import javax.validation.constraints.NotNull; -import javax.validation.constraints.Size; /** * 续建项目审核请求实体 diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/INdProjectStatusChangeService.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/INdProjectStatusChangeService.java index 420f094..02eb411 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/INdProjectStatusChangeService.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/INdProjectStatusChangeService.java @@ -4,6 +4,8 @@ import com.hz.pm.api.common.statemachine.event.ProjectStatusChangeEvent; import com.hz.pm.api.projectlib.model.entity.ProjectStatusChange; import com.baomidou.mybatisplus.extension.service.IService; +import java.util.Collection; + /** *

* 服务类 @@ -16,4 +18,6 @@ public interface INdProjectStatusChangeService extends IService projectIds); + } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/impl/NdProjectStatusChangeServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/impl/NdProjectStatusChangeServiceImpl.java index 75ae37f..94a7b20 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/impl/NdProjectStatusChangeServiceImpl.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/impl/NdProjectStatusChangeServiceImpl.java @@ -10,6 +10,10 @@ import com.hz.pm.api.projectlib.service.INdProjectStatusChangeService; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.springframework.stereotype.Service; +import java.util.Collection; + +import static com.hz.pm.api.common.statemachine.event.ProjectStatusChangeEvent.DEPARTMENT_UNITED_REVIEW_PASS; + /** *

* 服务实现类 @@ -31,4 +35,12 @@ public class NdProjectStatusChangeServiceImpl extends ServiceImpl projectIds) { + LambdaQueryWrapper query = Wrappers.lambdaQuery(ProjectStatusChange.class) + .in(ProjectStatusChange::getProjectId, projectIds) + .eq(ProjectStatusChange::getEvent, DEPARTMENT_UNITED_REVIEW_PASS) + .last(BizConst.LIMIT_1); + return getOne(query); + } } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/provincial/model/res/OssApiData.java b/hz-pm-api/src/main/java/com/hz/pm/api/provincial/model/res/OssApiData.java index 383e5b7..dd94e92 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/provincial/model/res/OssApiData.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/provincial/model/res/OssApiData.java @@ -1,7 +1,5 @@ package com.hz.pm.api.provincial.model.res; -import com.ningdatech.basic.enumeration.Status; -import com.ningdatech.basic.model.ApiStatus; import lombok.Data; import lombok.NoArgsConstructor; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/provincial/model/res/OssApiResponse.java b/hz-pm-api/src/main/java/com/hz/pm/api/provincial/model/res/OssApiResponse.java index c1fde78..33f9ca9 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/provincial/model/res/OssApiResponse.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/provincial/model/res/OssApiResponse.java @@ -65,7 +65,7 @@ public class OssApiResponse implements Serializable { * @return ApiResponse */ public static OssApiResponse of(Integer respCode, String respMsg, T data) { - return new OssApiResponse(respCode, respMsg, data); + return new OssApiResponse<>(respCode, respMsg, data); } /** 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 44cf746..757b9a2 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 @@ -7,7 +7,7 @@ import com.ningdatech.basic.exception.BizException; import com.ningdatech.file.service.FileService; import com.hz.pm.api.common.model.constant.BizConst; import com.hz.pm.api.common.model.constant.ProjectDeclareConst; -import com.hz.pm.api.common.statemachine.util.StateMachineUtils; +import com.hz.pm.api.common.statemachine.util.StateMachineUtil; import com.hz.pm.api.projectdeclared.converter.ApplicationConverter; import com.hz.pm.api.projectlib.model.enumeration.InstTypeEnum; import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum; @@ -211,8 +211,8 @@ public class ProcessEndListener { // 当前项目状态是部门联审中 case DEPARTMENT_JOINT_REVIEW: //如果是 区县 并且 500万及以上要推送省局重大项目 - if (!StateMachineUtils.isCityProject(declaredProject) && - StateMachineUtils.judgeDeclareAmount(declaredProject, + if (!StateMachineUtil.isCityProject(declaredProject) && + StateMachineUtil.judgeDeclareAmount(declaredProject, ProjectDeclareConst.Number.DECLARE_COUNTY_AMOUNT_JUDGEMENT)) { try { List applications = projectApplicationService diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/listener/ProcessStartListener.java b/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/listener/ProcessStartListener.java index f68964f..e146618 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/listener/ProcessStartListener.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/listener/ProcessStartListener.java @@ -3,7 +3,7 @@ package com.hz.pm.api.scheduler.listener; import cn.hutool.core.collection.CollUtil; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.hz.pm.api.common.model.constant.BizConst; -import com.hz.pm.api.common.statemachine.util.StateMachineUtils; +import com.hz.pm.api.common.statemachine.util.StateMachineUtil; import com.hz.pm.api.projectlib.model.entity.Project; import com.hz.pm.api.projectlib.model.entity.ProjectInst; import com.hz.pm.api.projectlib.service.IProjectInstService; @@ -40,7 +40,7 @@ public class ProcessStartListener { private final IProjectService projectService; - private final StateMachineUtils stateMachineUtils; + private final StateMachineUtil stateMachineUtil; @Async @EventListener @@ -82,7 +82,7 @@ public class ProcessStartListener { //如果真的没有实时任务和历史任务 那么说明 该项目没有人审批 需要去调用状态机 Long projectId = projectInst.getProjectId(); Project project = projectService.getNewProject(projectId); - stateMachineUtils.pass(project); + stateMachineUtil.pass(project); project.setUpdateOn(LocalDateTime.now()); projectService.updateById(project); } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/CheckProvincialReviewResultTask.java b/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/CheckProvincialReviewResultTask.java index a4dba53..516616b 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/CheckProvincialReviewResultTask.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/CheckProvincialReviewResultTask.java @@ -7,7 +7,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.hz.pm.api.common.model.constant.BizConst; import com.hz.pm.api.common.model.constant.ProjectDeclareConst; import com.hz.pm.api.common.model.constant.RegionConst; -import com.hz.pm.api.common.statemachine.util.StateMachineUtils; +import com.hz.pm.api.common.statemachine.util.StateMachineUtil; import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum; import com.hz.pm.api.projectlib.model.entity.Project; import com.hz.pm.api.projectlib.service.IProjectService; @@ -42,7 +42,7 @@ public class CheckProvincialReviewResultTask { private final IJoinReviewProvincialBureauService reviewProvincialBureauService; private final IProjectService projectService; - private final StateMachineUtils stateMachineUtils; + private final StateMachineUtil stateMachineUtil; @Value("${hostname}") private String HOST_NAME; @@ -96,7 +96,7 @@ public class CheckProvincialReviewResultTask { //在省级联审 才调状态机 否则 只改变 联审结果 if(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS.getCode().equals( project.getStatus())){ - stateMachineUtils.pass(project); + stateMachineUtil.pass(project); } log.info("已经审批完成 进入下一状态"); } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/ProjectStatusFlowTask.java b/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/ProjectStatusFlowTask.java index a61a406..89f9d44 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/ProjectStatusFlowTask.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/ProjectStatusFlowTask.java @@ -5,7 +5,6 @@ import com.alibaba.fastjson.JSON; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.hz.pm.api.projectlib.model.entity.Project; import com.hz.pm.api.projectlib.service.IProjectService; -import com.hz.pm.api.scheduler.contants.TaskContant; import com.hz.pm.api.staging.contants.StagingContant; import com.hz.pm.api.staging.model.entity.ProjectStaging; import com.hz.pm.api.staging.service.IProjectStagingService; @@ -20,7 +19,6 @@ import java.net.InetAddress; import java.net.UnknownHostException; import java.time.LocalDateTime; import java.util.List; -import java.util.Map; import java.util.Objects; import java.util.function.Function; @@ -38,9 +36,7 @@ public class ProjectStatusFlowTask { private final IProjectStagingService projectStagingService; private final IProjectService projectService; - - private final ProjectStatusFlowMapUtil projectStatusFlowMapUtil; - + @Value("${hostname}") private String HOST_NAME; @@ -49,44 +45,39 @@ public class ProjectStatusFlowTask { if (HOST_NAME.equals(InetAddress.getLocalHost().getHostName())) { //1. 定时取 项目暂存表的数据 去进行状态继续流转 List stagingList = projectStagingService.list(Wrappers.lambdaQuery(ProjectStaging.class) - .eq(ProjectStaging::getDead,Boolean.FALSE) - .le(ProjectStaging::getNextTime, LocalDateTime.now()) - .le(ProjectStaging::getRetryTimes, StagingContant.Retry.MAX_RETRY_TIMES) - .orderByAsc(ProjectStaging::getProjectId)); + .eq(ProjectStaging::getDead, Boolean.FALSE) + .le(ProjectStaging::getNextTime, LocalDateTime.now()) + .le(ProjectStaging::getRetryTimes, StagingContant.Retry.MAX_RETRY_TIMES) + .orderByAsc(ProjectStaging::getProjectId)); - log.info("需要状态流转的项目 size:{} :{}",stagingList.size(), JSON.toJSONString(stagingList)); - if(CollUtil.isEmpty(stagingList)){ + log.info("需要状态流转的项目 size:{} :{}", stagingList.size(), JSON.toJSONString(stagingList)); + if (CollUtil.isEmpty(stagingList)) { log.info("没有需要状态流转的项目!"); return; } //遍历 - for(ProjectStaging projectStaging : stagingList){ - try{ + for (ProjectStaging projectStaging : stagingList) { + try { Project project = projectService.getById(projectStaging.getProjectId()); - if(Objects.isNull(project)){ - log.info("此项目 【{}】 不存在",projectStaging.getProjectId()); + if (Objects.isNull(project)) { + log.info("此项目 【{}】 不存在", projectStaging.getProjectId()); continue; } - //2. 用函数map 定位到 状态流转的函数 - Map> reStartProcessMap = - projectStatusFlowMapUtil.statusFlowFunctionMap; - - if(!reStartProcessMap.containsKey(project.getStatus())){ - log.info("此项目 【{}】 当前状态 【{}】,没有对应流转函数",projectStaging.getProjectId(),project.getStatus()); + Function flowFunction = ProjectStatusFlowMapUtil.getFlowFunction(project.getStatus()); + if (flowFunction == null) { + log.info("此项目 【{}】 当前状态 【{}】,没有对应流转函数", projectStaging.getProjectId(), project.getStatus()); continue; } - - Function functionMap = reStartProcessMap.get(project.getStatus()); //执行对应的函数 - if(functionMap.apply(project)){ + if (flowFunction.apply(project)) { //执行成功了 删除暂存的数据 projectStagingService.removeById(projectStaging); } - }catch (Exception e){ + } catch (Exception e) { log.error("项目流转 异常 projectId:【" + projectStaging.getProjectId() + "】 异常内容:" + e.getMessage()); - }finally { + } finally { //增加重试的次数 和下次扫描时间 projectStagingService.addRetryTimes(projectStaging); } @@ -94,11 +85,4 @@ public class ProjectStatusFlowTask { } } -// @Scheduled(cron = "0 */1 * * * ?") - public void nonUserFinishFlowToNext() throws UnknownHostException { - //测试暂时用自己HOST - if (TaskContant.Host.HOST_ZPF.equals(InetAddress.getLocalHost().getHostName())) { - - } - } } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/staging/utils/ProjectStatusFlowMapUtil.java b/hz-pm-api/src/main/java/com/hz/pm/api/staging/utils/ProjectStatusFlowMapUtil.java index 284eec5..fe811b3 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/staging/utils/ProjectStatusFlowMapUtil.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/staging/utils/ProjectStatusFlowMapUtil.java @@ -1,5 +1,6 @@ package com.hz.pm.api.staging.utils; +import cn.hutool.core.lang.func.Func; import com.google.common.collect.Maps; import com.hz.pm.api.projectdeclared.manage.ReviewByDeptJointManage; import com.hz.pm.api.projectdeclared.manage.ReviewByProvincialDeptManage; @@ -19,25 +20,27 @@ import java.util.function.Function; */ @Component public class ProjectStatusFlowMapUtil { - @Autowired - private ReviewByProvincialDeptManage provincialDeptManage; - @Autowired - private ReviewByDeptJointManage reviewByDeptJointManage; + private static final Map> STATUS_FLOW_FUNCTION_MAP = Maps.newHashMap(); - public Map> statusFlowFunctionMap = Maps.newHashMap(); + + public static Function getFlowFunction(Integer status){ + return STATUS_FLOW_FUNCTION_MAP.get(status); + } /** - * 初始化业务分派逻辑,代替了if-else部分 - * key: 枚举 状态值 - * value: lambda表达式,最终会获取发起实例的函数 + * 初始化业务分派逻辑,代替了if-else部分 + * key: 枚举 状态值 + * value: lambda表达式,最终会获取发起实例的函数 */ - public ProjectStatusFlowMapUtil(){ + public ProjectStatusFlowMapUtil(ReviewByProvincialDeptManage provincialDeptManage, + ReviewByDeptJointManage reviewByDeptJointManage) { //省级部门联审 - statusFlowFunctionMap.put(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS.getCode(), - project->provincialDeptManage.startTheProcess(project)); + STATUS_FLOW_FUNCTION_MAP.put(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS.getCode(), + provincialDeptManage::startTheProcess); //部门联审 - statusFlowFunctionMap.put(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW.getCode(), - project->reviewByDeptJointManage.startTheProcess(project)); + STATUS_FLOW_FUNCTION_MAP.put(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW.getCode(), + reviewByDeptJointManage::startTheProcess); } + } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/staging/utils/WorkNoticeFlowMapUtil.java b/hz-pm-api/src/main/java/com/hz/pm/api/staging/utils/WorkNoticeFlowMapUtil.java index e26cec3..2ff90b9 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/staging/utils/WorkNoticeFlowMapUtil.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/staging/utils/WorkNoticeFlowMapUtil.java @@ -1,12 +1,10 @@ package com.hz.pm.api.staging.utils; -import java.util.Map; -import javax.annotation.PostConstruct; - +import com.google.common.collect.Maps; import lombok.AllArgsConstructor; import org.springframework.stereotype.Component; -import com.google.common.collect.Maps; -import lombok.RequiredArgsConstructor; + +import java.util.Map; /** * 工作通知流转 事件函数MAP diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/mapper/NotifyMapper.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/mapper/NotifyMapper.java index 96baca1..d52b503 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/sys/mapper/NotifyMapper.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/mapper/NotifyMapper.java @@ -1,7 +1,6 @@ package com.hz.pm.api.sys.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.hz.pm.api.sys.model.entity.Notice; import com.hz.pm.api.sys.model.entity.Notify; /** diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/dto/MeetingReviewMsgExtraDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/dto/MeetingReviewMsgExtraDTO.java index 84b5bdc..2520e5a 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/dto/MeetingReviewMsgExtraDTO.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/dto/MeetingReviewMsgExtraDTO.java @@ -1,5 +1,8 @@ package com.hz.pm.api.sys.model.dto; +import lombok.Data; +import lombok.EqualsAndHashCode; + /** *

* MeetingReviewMsgExtraDTO @@ -8,6 +11,8 @@ package com.hz.pm.api.sys.model.dto; * @author WendyYang * @since 2023/4/12 **/ +@Data +@EqualsAndHashCode(callSuper = true) public class MeetingReviewMsgExtraDTO extends AbstractMsgExtraDTO { private Long meetingId; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/dto/MenuSaveDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/dto/MenuSaveDTO.java index 008e59e..4fa853e 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/dto/MenuSaveDTO.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/dto/MenuSaveDTO.java @@ -6,7 +6,6 @@ import io.swagger.annotations.ApiModelProperty; import lombok.*; import lombok.experimental.Accessors; -import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotEmpty; import javax.validation.constraints.NotNull; import java.io.Serializable; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/entity/Menu.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/entity/Menu.java index a9b55b8..50e15e9 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/entity/Menu.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/entity/Menu.java @@ -33,7 +33,7 @@ import static com.baomidou.mybatisplus.annotation.SqlCondition.LIKE; @TableName("nd_menu") @ApiModel(value = "Menu", description = "菜单") @AllArgsConstructor -public class Menu extends MenuTreeEntity { +public class Menu extends MenuTreeEntity

{ private static final long serialVersionUID = 1L; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/vo/MenuRoleVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/vo/MenuRoleVO.java index c1c6014..604528e 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/vo/MenuRoleVO.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/vo/MenuRoleVO.java @@ -24,7 +24,7 @@ import lombok.experimental.Accessors; @Accessors(chain = true) @ApiModel(value = "RoleMenuVO", description = "菜单") @AllArgsConstructor -public class MenuRoleVO extends MenuTreeEntity { +public class MenuRoleVO extends MenuTreeEntity { private static final long serialVersionUID = 1L; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/enumeration/IsOrNotEnum.java b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/enumeration/IsOrNotEnum.java index 7e605b7..2f147e6 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/enumeration/IsOrNotEnum.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/enumeration/IsOrNotEnum.java @@ -16,7 +16,6 @@ import lombok.NoArgsConstructor; */ @Getter @AllArgsConstructor -@NoArgsConstructor @ApiModel(value = "IsOrNotEnum", description = "是否-枚举") public enum IsOrNotEnum { /** @@ -30,16 +29,8 @@ public enum IsOrNotEnum { IS(1, "是"); - private Integer code; - private String desc; - - public String getDesc() { - return desc; - } - - public void setDesc(String desc) { - this.desc = desc; - } + private final Integer code; + private final String desc; public static String getDescByCode(Integer code) { if (Objects.isNull(code)) { 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 6bfe1fd..2eadbac 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 @@ -38,7 +38,7 @@ import org.springframework.transaction.annotation.Transactional; import com.alibaba.fastjson.JSON; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.ningdatech.basic.exception.BizException; -import com.hz.pm.api.common.statemachine.util.StateMachineUtils; +import com.hz.pm.api.common.statemachine.util.StateMachineUtil; import com.hz.pm.api.projectdeclared.manage.DeclaredProjectManage; import com.hz.pm.api.projectdeclared.model.dto.ProjectDraftSaveDTO; import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum; @@ -82,7 +82,7 @@ public class HandlerManage { private final TaskService taskService; private final HistoryService historyService; private final IProjectService projectService; - private final StateMachineUtils stateMachineUtils; + private final StateMachineUtil stateMachineUtil; private final ProcessInstanceService processInstanceService; private final IProjectApplicationService projectApplicationService; private final IProjectStagingService projectStagingService; @@ -102,10 +102,11 @@ public class HandlerManage { /** * 审核通过后 所处理的逻辑 + * * @param declaredProject * @param instance */ - public void afterPassTodo(Project declaredProject, HistoricProcessInstance instance){ + public void afterPassTodo(Project declaredProject, HistoricProcessInstance instance) { Long userId = LoginUserUtil.getUserId(); // 获取流程通过后的流程实例 HistoricProcessInstance newInstance = historyService.createHistoricProcessInstanceQuery() @@ -118,7 +119,7 @@ public class HandlerManage { .last(BizConst.LIMIT_1)); Integer instType = projectInst.getInstType(); InstTypeEnum instTypeEnum = InstTypeEnum.getByCode(instType); - if (Objects.isNull(instTypeEnum)){ + if (Objects.isNull(instTypeEnum)) { throw new BizException("当前审批流类型不存在,流程类型code:" + instType); } @@ -154,20 +155,20 @@ public class HandlerManage { // 并向流程发起人发送浙政钉工作通知:【项目名称】已通过【流程名称】,请及时开始下一步操作。 if (HisProInsEndActId.END.equals(newInstance.getEndActivityId())) { // 如果是申请延期和申请借阅审批流程,不走状态机 - if (InstTypeEnum.APPLY_DELAY.getCode().equals(instType) || InstTypeEnum.APPLY_BORROW.getCode().equals(instType)){ + if (InstTypeEnum.APPLY_DELAY.getCode().equals(instType) || InstTypeEnum.APPLY_BORROW.getCode().equals(instType)) { switch (instTypeEnum) { case APPLY_DELAY: // 保存延期申请记录,更新项目建设周期和计划验收时间 - updateProjectDelayApplyInfo(declaredProject,instanceId); + updateProjectDelayApplyInfo(declaredProject, instanceId); break; case APPLY_BORROW: // 更新申请借阅状态为成功 - updateProjectApplyBorrowInfo(declaredProject,instanceId); + updateProjectApplyBorrowInfo(declaredProject, instanceId); break; default: throw new BizException("传入实例类型错误: " + instTypeEnum); } - }else { + } else { switch (Objects.requireNonNull(ProjectStatusEnum.match(declaredProject.getStatus()))) { // 当前项目状态是预审中 case PRE_APPLYING: @@ -180,10 +181,10 @@ public class HandlerManage { case DEPARTMENT_JOINT_REVIEW: log.info("部门联审成功后 要判断是否是 区县重大项目"); - Boolean isImport = !StateMachineUtils.isCityProject(declaredProject) && - StateMachineUtils.judgeDeclareAmount(declaredProject, + Boolean isImport = !StateMachineUtil.isCityProject(declaredProject) && + StateMachineUtil.judgeDeclareAmount(declaredProject, ProjectDeclareConst.Number.DECLARE_COUNTY_AMOUNT_JUDGEMENT); - log.info("isImport :{}",isImport); + log.info("isImport :{}", isImport); //如果是 区县 并且 500万及以上要推送省局重大项目 if (isImport) { try { @@ -191,7 +192,7 @@ public class HandlerManage { .list(Wrappers.lambdaQuery(ProjectApplication.class) .eq(ProjectApplication::getProjectCode, declaredProject.getProjectCode())); joinReviewProvincialBureauService.pushImportProject( - ApplicationConverter.convertProject(declaredProject, applications, fileService,active)); + ApplicationConverter.convertProject(declaredProject, applications, fileService, active)); updatePassProjectStatus(userId, declaredProject); break; } catch (Exception e) { @@ -210,15 +211,15 @@ public class HandlerManage { // 当前项目状态是终验审核中 updatePassProjectStatus(userId, declaredProject); // 判断是否 保存建设建议信息 - saveContructionSuggestionInfo(instance.getId(),declaredProject); + saveContructionSuggestionInfo(instance.getId(), declaredProject); break; default: throw new BizException("传入项目状态错误: " + declaredProject.getStatus()); } } //发送消息 - noticeManage.sendNotice(instance.getStartUserId(),userId,declaredProject,instance.getProcessDefinitionName(), - PASS_MSG_TEMPLATE2,MsgTypeEnum.PROJECT_REVIEW_PASS); + noticeManage.sendNotice(instance.getStartUserId(), userId, declaredProject, instance.getProcessDefinitionName(), + PASS_MSG_TEMPLATE2, MsgTypeEnum.PROJECT_REVIEW_PASS); } else { // 若有下一个审核人(当前节点的用户),会签/或签会有多个 // 向其发送浙政钉工作通知:标题:审核任务 内容:【单位名称】的【项目名称】需要您审核。 @@ -228,14 +229,15 @@ public class HandlerManage { throw new BizException("审核人信息不存在!"); } //发送消息 - noticeManage.sendNotice(currentEmployeeCode,userId,declaredProject,instance.getProcessDefinitionName(), - PASS_MSG_TEMPLATE,MsgTypeEnum.PROJECT_REVIEW); + noticeManage.sendNotice(currentEmployeeCode, userId, declaredProject, instance.getProcessDefinitionName(), + PASS_MSG_TEMPLATE, MsgTypeEnum.PROJECT_REVIEW); } } } /** * 去保存 建设建议信息 + * * @param instanceId * @param project */ @@ -244,7 +246,7 @@ public class HandlerManage { .eq(ProjectConstructionSuggestions::getProjectCode, project.getProjectCode()) .eq(ProjectConstructionSuggestions::getInstanceId, instanceId) .last(BizConst.LIMIT_1)); - if(Objects.isNull(pcs)){ + if (Objects.isNull(pcs)) { log.info("没有该流程的 建设 建议信息"); return; } @@ -257,7 +259,7 @@ public class HandlerManage { public void updateProjectApplyBorrowInfo(Project declaredProject, String instanceId) { // 获取申请借阅信息 - ProjectApplyBorrow projectApplyBorrow = projectApplyBorrowService.getOne(Wrappers.lambdaQuery(ProjectApplyBorrow.class) + ProjectApplyBorrow projectApplyBorrow = projectApplyBorrowService.getOne(Wrappers.lambdaQuery(ProjectApplyBorrow.class) .eq(ProjectApplyBorrow::getProjectId, declaredProject.getId()) .eq(ProjectApplyBorrow::getInstanceId, instanceId)); // 更新项目借阅信息为成功 @@ -297,6 +299,7 @@ public class HandlerManage { /** * 驳回后 所处理的逻辑 + * * @param declaredProject * @param instance */ @@ -313,8 +316,8 @@ public class HandlerManage { updateRejectProjectStatus(userId, declaredProject, instType); } //发送消息 - noticeManage.sendNotice(instance.getStartUserId(),userId,declaredProject,instance.getProcessDefinitionName(), - REJECT_MSG_TEMPLATE,MsgTypeEnum.PROJECT_REVIEW_REJECT); + noticeManage.sendNotice(instance.getStartUserId(), userId, declaredProject, instance.getProcessDefinitionName(), + REJECT_MSG_TEMPLATE, MsgTypeEnum.PROJECT_REVIEW_REJECT); } /** @@ -352,7 +355,7 @@ public class HandlerManage { private void saveToDraft(Project declaredProject) { ProjectDraftSaveDTO draftSaveDto = new ProjectDraftSaveDTO(); ProjectDTO projectInfo = new ProjectDTO(); - BeanUtils.copyProperties(declaredProject,projectInfo); + BeanUtils.copyProperties(declaredProject, projectInfo); // 查询出项目关联的应用信息 List applicationList = projectApplicationService.list(Wrappers.lambdaQuery(ProjectApplication.class) .eq(ProjectApplication::getProjectId, declaredProject.getId())); @@ -362,7 +365,7 @@ public class HandlerManage { return applicationDTO; }).collect(Collectors.toList()); projectInfo.setApplicationList(applicationDTOList); - HashMap dynamicMap = JSON.parseObject(declaredProject.getDynamicForm(), HashMap.class); + HashMap dynamicMap = JSON.parseObject(declaredProject.getDynamicForm(), HashMap.class); projectInfo.setDynamicForm(dynamicMap); draftSaveDto.setProjectInfo(projectInfo); declaredProjectManage.saveToDraft(draftSaveDto); @@ -370,6 +373,7 @@ public class HandlerManage { /** * 删除项目的所有信息 + * * @param declaredProject */ public void deleteProjectRelated(Project declaredProject) { @@ -377,11 +381,12 @@ public class HandlerManage { projectService.removeById(declaredProject); //删除app信息 projectApplicationService.remove(Wrappers.lambdaQuery(ProjectApplication.class) - .eq(ProjectApplication::getProjectId,declaredProject.getId())); + .eq(ProjectApplication::getProjectId, declaredProject.getId())); } /** * 退回审核后 所处理的逻辑 + * * @param declaredProject * @param instance */ @@ -394,21 +399,21 @@ public class HandlerManage { Integer instType = projectInst.getInstType(); LambdaUpdateWrapper updateWrapper = Wrappers.lambdaUpdate(); // 如果是预审审批或建设方案退回,需要重新盖章,原来盖过章的文件要清空 - if (InstTypeEnum.PRELIMINARY_PREVIEW.getCode().equals(instType)){ - updateWrapper.set(Project::getPretrialFileId,null) - .set(Project::getPretrialFileName,null) - .eq(Project::getId,declaredProject.getId()); + if (InstTypeEnum.PRELIMINARY_PREVIEW.getCode().equals(instType)) { + updateWrapper.set(Project::getPretrialFileId, null) + .set(Project::getPretrialFileName, null) + .eq(Project::getId, declaredProject.getId()); projectService.update(updateWrapper); } else if (InstTypeEnum.CONSTRUCTION_PLAN_REVIEW.getCode().equals(instType)) { - updateWrapper.set(Project::getConstructFileId,null) - .set(Project::getConstructFileName,null) - .eq(Project::getId,declaredProject.getId()); + updateWrapper.set(Project::getConstructFileId, null) + .set(Project::getConstructFileName, null) + .eq(Project::getId, declaredProject.getId()); projectService.update(updateWrapper); } // 给项目创建人、流程发起人发送浙政钉工作通知:【项目名称】的【流程名称】被退回,请及时处理。 //发送消息 - noticeManage.sendNotice(instance.getStartUserId(),userId,declaredProject,instance.getProcessDefinitionName(), - BACK_MSG_TEMPLATE,MsgTypeEnum.PROJECT_REVIEW_BACK); + noticeManage.sendNotice(instance.getStartUserId(), userId, declaredProject, instance.getProcessDefinitionName(), + BACK_MSG_TEMPLATE, MsgTypeEnum.PROJECT_REVIEW_BACK); } @@ -423,12 +428,12 @@ public class HandlerManage { */ public void updatePassProjectStatus(Long userId, Project declaredProject) { try { - stateMachineUtils.pass(declaredProject); + stateMachineUtil.pass(declaredProject); declaredProject.setUpdateOn(LocalDateTime.now()); declaredProject.setUpdateBy(userId); projectService.updateById(declaredProject); } catch (Exception e) { - log.error("状态机执行失败",e); + log.error("状态机执行失败", e); throw new BizException("状态机执行失败!"); } } @@ -444,21 +449,21 @@ public class HandlerManage { * @since 2023/02/08 */ private void updateRejectProjectStatus(Long userId, Project declaredProject, Integer instType) { - stateMachineUtils.reject(declaredProject); + stateMachineUtil.reject(declaredProject); LambdaUpdateWrapper updateWrapper = Wrappers.lambdaUpdate(); declaredProject.setUpdateOn(LocalDateTime.now()); declaredProject.setUpdateBy(userId); projectService.updateById(declaredProject); // 如果是预审审批驳回,需要重新盖章,原来盖过章的文件要清空 - if (InstTypeEnum.PRELIMINARY_PREVIEW.getCode().equals(instType)){ - updateWrapper.set(Project::getPretrialFileId,null) - .set(Project::getPretrialFileName,null) - .eq(Project::getId,declaredProject.getId()); + if (InstTypeEnum.PRELIMINARY_PREVIEW.getCode().equals(instType)) { + updateWrapper.set(Project::getPretrialFileId, null) + .set(Project::getPretrialFileName, null) + .eq(Project::getId, declaredProject.getId()); projectService.update(updateWrapper); - }else if (InstTypeEnum.CONSTRUCTION_PLAN_REVIEW.getCode().equals(instType)) { - updateWrapper.set(Project::getConstructFileId,null) - .set(Project::getConstructFileName,null) - .eq(Project::getId,declaredProject.getId()); + } else if (InstTypeEnum.CONSTRUCTION_PLAN_REVIEW.getCode().equals(instType)) { + updateWrapper.set(Project::getConstructFileId, null) + .set(Project::getConstructFileName, null) + .eq(Project::getId, declaredProject.getId()); projectService.update(updateWrapper); } } @@ -476,12 +481,12 @@ public class HandlerManage { public void updateWithdrawProjectStatus(Long userId, Project declaredProject) { // 删除关联表信息 projectInstService.remove(Wrappers.lambdaQuery(ProjectInst.class) - .eq(ProjectInst::getProjectId,declaredProject.getId()) - .eq(ProjectInst::getInstCode,declaredProject.getInstCode())); + .eq(ProjectInst::getProjectId, declaredProject.getId()) + .eq(ProjectInst::getInstCode, declaredProject.getInstCode())); //删除项目的实例信息 historyService.deleteHistoricProcessInstance(declaredProject.getInstCode()); - stateMachineUtils.withDraw(declaredProject); + stateMachineUtil.withDraw(declaredProject); declaredProject.setUpdateOn(LocalDateTime.now()); declaredProject.setUpdateBy(userId); declaredProject.setInstCode(TodoCenterConstant.Declared.NULL_INST_CODE); @@ -489,22 +494,21 @@ public class HandlerManage { } public void deleteBackComments(List approves) { - if(CollUtil.isNotEmpty(approves)){ - for(HistoricVariableInstance approve : approves){ - if(approve.getValue() instanceof ProcessHandlerEnum){ - if(ProcessHandlerEnum.BACK.equals(ProcessHandlerEnum.getEnumByName(String.valueOf(approve.getValue())))){ - runtimeService.removeVariable(approve.getProcessInstanceId(),approve.getVariableName()); + if (CollUtil.isNotEmpty(approves)) { + for (HistoricVariableInstance approve : approves) { + if (approve.getValue() instanceof ProcessHandlerEnum) { + if (ProcessHandlerEnum.BACK.equals(ProcessHandlerEnum.getEnumByName(String.valueOf(approve.getValue())))) { + runtimeService.removeVariable(approve.getProcessInstanceId(), approve.getVariableName()); Comment comment; Optional first = taskService.getProcessInstanceComments(approve.getProcessInstanceId()) .stream() .filter(c -> c.getTaskId().equals(approve.getVariableName().replace("approve_", StringUtils.EMPTY))) .findFirst(); - if (first.isPresent()){ + if (first.isPresent()) { comment = first.get(); taskService.deleteComment(comment.getId()); } - break; } } @@ -514,27 +518,25 @@ public class HandlerManage { /** * 判断是否包含 此任务 - * @param progressNodes - * @param taskId - * @return + * + * @param progressNodes \ + * @param taskId \ + * @return \ */ - public static Boolean checkIsContainsTask(List progressNodes, String taskId) { - if(CollUtil.isEmpty(progressNodes)){ + public static boolean checkIsContainsTask(List progressNodes, String taskId) { + if (CollUtil.isEmpty(progressNodes)) { return Boolean.FALSE; } - final Boolean[] res = {Boolean.FALSE}; - progressNodes.forEach(p -> { - if(p.getTaskId().equals(taskId)){ - res[0] = Boolean.TRUE; - return; + for (ProgressNode node : progressNodes) { + if (node.getTaskId().equals(taskId)) { + return Boolean.TRUE; } - if(CollUtil.isNotEmpty(p.getChildren()) && - (checkIsContainsTask(p.getChildren(),taskId))){ - res[0] = Boolean.TRUE; - return; + if (CollUtil.isNotEmpty(node.getChildren()) && + (checkIsContainsTask(node.getChildren(), taskId))) { + return Boolean.TRUE; } - }); - return res[0]; + } + return Boolean.FALSE; } } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/service/ITodoService.java b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/service/ITodoService.java index 1acd79b..62b0eaa 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/service/ITodoService.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/service/ITodoService.java @@ -17,5 +17,5 @@ public interface ITodoService { */ ProcessProgressDetailVO getProcessDetail(ProcessDetailReq request) ; - Boolean isChangeRecord(Long projectId) ; + boolean isChangeRecord(Long projectId) ; } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/service/impl/TodoServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/service/impl/TodoServiceImpl.java index 3c80d14..768111f 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/service/impl/TodoServiceImpl.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/service/impl/TodoServiceImpl.java @@ -98,7 +98,7 @@ public class TodoServiceImpl implements ITodoService { * @param user * @return */ - private Boolean checkHighLine(List progressInfo, String taskId, UserInfoDetails user) { + private boolean checkHighLine(List progressInfo, String taskId, UserInfoDetails user) { if(CollUtil.isEmpty(progressInfo)){ return Boolean.FALSE; } @@ -122,7 +122,7 @@ public class TodoServiceImpl implements ITodoService { .equals(userFullInfoDTO.getEmpPosUnitCode())){ //说明是此单位的人 //那么要去看 taskId 是不是 在这个单位内的任务 - Boolean isContainsTask = HandlerManage.checkIsContainsTask(children,taskId); + boolean isContainsTask = HandlerManage.checkIsContainsTask(children,taskId); if(isContainsTask){ res[0] = Boolean.TRUE; return; @@ -139,7 +139,7 @@ public class TodoServiceImpl implements ITodoService { * @return */ @Override - public Boolean isChangeRecord(Long projectId) { + public boolean isChangeRecord(Long projectId) { //1.先判断下 项目存不存在 Project project = projectService.getById(projectId); if(Objects.isNull(project)){ diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/utils/PdfUtils.java b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/utils/PdfUtils.java index bedfc17..2b31778 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/utils/PdfUtils.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/utils/PdfUtils.java @@ -1,25 +1,22 @@ package com.hz.pm.api.todocenter.utils; +import cn.hutool.core.io.IoUtil; +import com.itextpdf.text.DocumentException; +import com.itextpdf.text.pdf.BaseFont; +import com.ningdatech.basic.exception.BizException; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; +import org.xhtmlrenderer.pdf.ITextFontResolver; +import org.xhtmlrenderer.pdf.ITextRenderer; + import java.io.*; import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Paths; -import java.util.Iterator; import java.util.Map; import java.util.UUID; -import cn.hutool.core.io.IoUtil; -import org.springframework.stereotype.Component; -import org.xhtmlrenderer.pdf.ITextFontResolver; -import org.xhtmlrenderer.pdf.ITextRenderer; - -import com.itextpdf.text.DocumentException; -import com.itextpdf.text.pdf.BaseFont; -import com.ningdatech.basic.exception.BizException; - -import lombok.extern.slf4j.Slf4j; - /** * pdf生成工具类 * @@ -50,7 +47,6 @@ public class PdfUtils { new File(filePath).mkdir(); } StringBuilder stringBuilder = new StringBuilder(); - ; String line; while ((line = bufferedReader.readLine()) != null) { stringBuilder.append(line); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/entity/MhUnit.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/entity/MhUnit.java index 6314e92..ef09dad 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/user/entity/MhUnit.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/entity/MhUnit.java @@ -3,14 +3,12 @@ package com.hz.pm.api.user.entity; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import lombok.Data; import java.io.Serializable; import java.time.LocalDateTime; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - /** *

* 组织表 diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/workbench/converter/WorkbenchConverter.java b/hz-pm-api/src/main/java/com/hz/pm/api/workbench/converter/WorkbenchConverter.java index 0f01312..cdc76db 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/workbench/converter/WorkbenchConverter.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/workbench/converter/WorkbenchConverter.java @@ -1,16 +1,11 @@ package com.hz.pm.api.workbench.converter; import cn.hutool.core.bean.BeanUtil; -import cn.hutool.core.collection.CollUtil; -import com.ningdatech.basic.model.PageVo; import com.hz.pm.api.projectdeclared.model.po.DeclaredProjectStatisticsPO; -import com.hz.pm.api.sys.model.vo.NoticeListItemVO; import com.hz.pm.api.todocenter.model.vo.ResToBeProcessedVO; import com.hz.pm.api.todocenter.model.vo.TodoVO; import com.hz.pm.api.workbench.model.vo.WorkbenchVO; -import java.util.Collections; -import java.util.List; import java.util.Objects; /** diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/workbench/model/vo/WorkbenchVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/workbench/model/vo/WorkbenchVO.java index 6572068..03d069d 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/workbench/model/vo/WorkbenchVO.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/workbench/model/vo/WorkbenchVO.java @@ -1,12 +1,11 @@ package com.hz.pm.api.workbench.model.vo; -import com.ningdatech.basic.model.PageVo; import com.hz.pm.api.projectlib.model.vo.ProjectLibListItemVO; -import com.hz.pm.api.sys.model.entity.ProjectEarlyWarning; import com.hz.pm.api.sys.model.vo.NoticeListItemVO; import com.hz.pm.api.sys.model.vo.ProjectEarlyWarningVO; import com.hz.pm.api.sys.model.vo.WflowEarlyWarningRecordsVO; import com.hz.pm.api.todocenter.model.vo.TodoCenterStatisticsVO; +import com.ningdatech.basic.model.PageVo; import io.swagger.annotations.ApiModelProperty; import lombok.Data; diff --git a/hz-pm-api/src/test/java/com/hz/pm/api/sys/project/ProjectStateTest.java b/hz-pm-api/src/test/java/com/hz/pm/api/sys/project/ProjectStateTest.java index 628b1db..f3605fc 100644 --- a/hz-pm-api/src/test/java/com/hz/pm/api/sys/project/ProjectStateTest.java +++ b/hz-pm-api/src/test/java/com/hz/pm/api/sys/project/ProjectStateTest.java @@ -3,7 +3,7 @@ package com.hz.pm.api.sys.project; import cn.hutool.core.date.StopWatch; import com.alibaba.fastjson.JSON; import com.hz.pm.api.AppTests; -import com.hz.pm.api.common.statemachine.util.StateMachineUtils; +import com.hz.pm.api.common.statemachine.util.StateMachineUtil; import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum; import com.hz.pm.api.projectlib.model.entity.Project; import com.hz.pm.api.projectlib.service.IProjectService; @@ -20,7 +20,7 @@ import javax.annotation.Resource; public class ProjectStateTest extends AppTests { @Resource - private StateMachineUtils stateMachineUtils; + private StateMachineUtil stateMachineUtil; @Resource private IProjectService projectService; @@ -37,7 +37,7 @@ public class ProjectStateTest extends AppTests { project.setStage(ProjectStatusEnum.NOT_APPROVED.getCode()); project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()); //调用状态机 进入下一个通过状态 - stateMachineUtils.pass(project); + stateMachineUtil.pass(project); stopWatch.stop(); System.out.println("调用状态机结束 :" + stopWatch.getTotalTimeSeconds()); diff --git a/hz-pm-sync/src/main/java/com/hz/pm/sync/SynDataTaskApp.java b/hz-pm-sync/src/main/java/com/hz/pm/sync/SynDataTaskApp.java index 65344c7..b8ca6f0 100644 --- a/hz-pm-sync/src/main/java/com/hz/pm/sync/SynDataTaskApp.java +++ b/hz-pm-sync/src/main/java/com/hz/pm/sync/SynDataTaskApp.java @@ -4,7 +4,6 @@ package com.hz.pm.sync; import org.mybatis.spring.annotation.MapperScan; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.EnableAspectJAutoProxy; import org.springframework.scheduling.annotation.EnableAsync; import org.springframework.scheduling.annotation.EnableScheduling; diff --git a/hz-pm-sync/src/main/java/com/hz/pm/sync/open/manage/ProjectReceiveManage.java b/hz-pm-sync/src/main/java/com/hz/pm/sync/open/manage/ProjectReceiveManage.java index 37e85be..ee9f70e 100644 --- a/hz-pm-sync/src/main/java/com/hz/pm/sync/open/manage/ProjectReceiveManage.java +++ b/hz-pm-sync/src/main/java/com/hz/pm/sync/open/manage/ProjectReceiveManage.java @@ -44,6 +44,7 @@ public class ProjectReceiveManage { /** * 接收保存 项目 + * * @param dto * @return */ @@ -58,34 +59,34 @@ public class ProjectReceiveManage { ProjectBaseInfo oldBaseInfo = baseInfoService.getOne(Wrappers.lambdaQuery(ProjectBaseInfo.class) .eq(ProjectBaseInfo::getBaseProjId, baseProjId) .last(BizConst.LIMIT_1)); - ProjectBaseInfo saveBase = BeanUtil.copyProperties(baseInfo,ProjectBaseInfo.class); + ProjectBaseInfo saveBase = BeanUtil.copyProperties(baseInfo, ProjectBaseInfo.class); //项目状态 String baseProjSetProg = saveBase.getBaseProjSetProg(); - if(StringUtils.isBlank(baseProjSetProg)){ + if (StringUtils.isBlank(baseProjSetProg)) { return "无状态不保存"; } //评审中 基本信息和申报信息 GovProjectStatusEnum match = GovProjectStatusEnum.match(baseProjSetProg); - if(Objects.isNull(match)){ + if (Objects.isNull(match)) { return "状态不对 不保存"; } - switch (match){ + switch (match) { case APPROVAL: - log.info("评审中状态 保存基本信息和申报信息 :{}",baseProjId); - saveBase(oldBaseInfo,saveBase,baseInfo); + log.info("评审中状态 保存基本信息和申报信息 :{}", baseProjId); + saveBase(oldBaseInfo, saveBase, baseInfo); saveApply(dto, baseProjId); break; case PENDING: case APPROVED: - log.info("待立项和已立项状态 保存基本信息,申报信息,评审信息 :{}",baseProjId); - saveBase(oldBaseInfo,saveBase,baseInfo); + log.info("待立项和已立项状态 保存基本信息,申报信息,评审信息 :{}", baseProjId); + saveBase(oldBaseInfo, saveBase, baseInfo); saveApply(dto, baseProjId); saveApprove(dto, baseProjId); break; case PURCHASED: - log.info("已采购状态 保存基本信息,申报信息,评审信息,采购信息 :{}",baseProjId); - saveBase(oldBaseInfo,saveBase,baseInfo); + log.info("已采购状态 保存基本信息,申报信息,评审信息,采购信息 :{}", baseProjId); + saveBase(oldBaseInfo, saveBase, baseInfo); saveApply(dto, baseProjId); saveApprove(dto, baseProjId); saveProcure(dto, baseProjId); @@ -93,18 +94,18 @@ public class ProjectReceiveManage { case HAS_PRE_INS: case HAS_FINAL_INS: case TERMINATED: - log.info("初验 终验状态 终止 保存所有信息 :{}",baseProjId); - saveBase(oldBaseInfo,saveBase,baseInfo); + log.info("初验 终验状态 终止 保存所有信息 :{}", baseProjId); + saveBase(oldBaseInfo, saveBase, baseInfo); saveApply(dto, baseProjId); saveApprove(dto, baseProjId); saveProcure(dto, baseProjId); saveCimplementOrMimplement(dto, baseProjId); break; case REJECTED: - log.info("驳回终止状态 啥都不保存 :{}",baseProjId); + log.info("驳回终止状态 啥都不保存 :{}", baseProjId); break; default: - log.info("没有匹配任何状态 保存失败 :{}",baseProjId); + log.info("没有匹配任何状态 保存失败 :{}", baseProjId); } return BizConst.SAVE_SUCCESS; @@ -113,22 +114,22 @@ public class ProjectReceiveManage { private void saveCimplementOrMimplement(ProjectSaveDTO dto, String baseProjId) { // 4.保存 建设项目 实施信息 ProjectCimplement cimplement = dto.getCimplement(); - if(Objects.nonNull(cimplement)){ + if (Objects.nonNull(cimplement)) { ProjectCimplement oldCimplement = cimplementService.getOne(Wrappers.lambdaQuery(ProjectCimplement.class) .eq(ProjectCimplement::getBaseProjId, baseProjId) .last(BizConst.LIMIT_1)); - ProjectCimplement saveCimplement = BeanUtil.copyProperties(cimplement,ProjectCimplement.class); + ProjectCimplement saveCimplement = BeanUtil.copyProperties(cimplement, ProjectCimplement.class); saveCimplement.setBaseProjId(baseProjId); - if(Objects.isNull(oldCimplement)){ + if (Objects.isNull(oldCimplement)) { //如果当前 数据不存在 但是我们平台操作是修改 说明之前数据被推送过了那么 可以置为修改update - if(StringUtils.isNotBlank(cimplement.getOp()) && BizConst.OP_UPDATE.equals(cimplement.getOp())){ + if (StringUtils.isNotBlank(cimplement.getOp()) && BizConst.OP_UPDATE.equals(cimplement.getOp())) { saveCimplement.setOp(BizConst.OP_UPDATE); - }else{ + } else { saveCimplement.setOp(BizConst.OP_INSERT); } saveCimplement.setTongTime(LocalDateTime.now()); - }else{ + } else { saveCimplement.setOp(BizConst.OP_INSERT); saveCimplement.setTongID(oldCimplement.getTongID()); saveCimplement.setTongTime(LocalDateTime.now()); @@ -139,22 +140,22 @@ public class ProjectReceiveManage { // 5.保存 运维项目 实施信息 ProjectMimplement mimplement = dto.getMimplement(); - if(Objects.nonNull(mimplement)){ + if (Objects.nonNull(mimplement)) { ProjectMimplement oldMimplement = mimplementService.getOne(Wrappers.lambdaQuery(ProjectMimplement.class) .eq(ProjectMimplement::getBaseProjId, baseProjId) .last(BizConst.LIMIT_1)); - ProjectMimplement saveMimplement = BeanUtil.copyProperties(mimplement,ProjectMimplement.class); + ProjectMimplement saveMimplement = BeanUtil.copyProperties(mimplement, ProjectMimplement.class); saveMimplement.setBaseProjId(baseProjId); - if(Objects.isNull(oldMimplement)){ + if (Objects.isNull(oldMimplement)) { //如果当前 数据不存在 但是我们平台操作是修改 说明之前数据被推送过了那么 可以置为修改update - if(StringUtils.isNotBlank(mimplement.getOp()) && BizConst.OP_UPDATE.equals(mimplement.getOp())){ + if (StringUtils.isNotBlank(mimplement.getOp()) && BizConst.OP_UPDATE.equals(mimplement.getOp())) { saveMimplement.setOp(BizConst.OP_UPDATE); - }else{ + } else { saveMimplement.setOp(BizConst.OP_INSERT); } saveMimplement.setTongTime(LocalDateTime.now()); - }else{ + } else { saveMimplement.setOp(BizConst.OP_INSERT); saveMimplement.setTongID(oldMimplement.getTongID()); saveMimplement.setTongTime(LocalDateTime.now()); @@ -167,34 +168,36 @@ public class ProjectReceiveManage { private void saveProcure(ProjectSaveDTO dto, String baseProjId) { // 6.保存 采购信息 List procures = dto.getProcures(); - if(Objects.nonNull(procures)){ + if (Objects.nonNull(procures)) { List olds = procureService.list(Wrappers.lambdaQuery(ProjectProcure.class) .eq(ProjectProcure::getBaseProjId, baseProjId) .orderByAsc(ProjectProcure::getBaseBidCode)); - Integer index = 0; - for(ProjectProcure old : olds){ - if(StringUtils.isNotBlank(old.getBaseBidCode())){ - try{ + int index = 0; + for (ProjectProcure old : olds) { + if (StringUtils.isNotBlank(old.getBaseBidCode())) { + try { String bidCode = old.getBaseBidCode().split(StrPool.DASH)[1]; index = Integer.parseInt(bidCode); - }catch (Exception e){} + } catch (Exception e) { + log.error(e.getMessage(),e); + } } //删除标记 old.setOp(BizConst.OP_DELETE); procureService.updateById(old); } - index ++; - for(ProjectProcure procure : procures){ + index++; + for (ProjectProcure procure : procures) { //添加标记 - ProjectProcure saveProcure = BeanUtil.copyProperties(procure,ProjectProcure.class); + ProjectProcure saveProcure = BeanUtil.copyProperties(procure, ProjectProcure.class); saveProcure.setBaseProjId(baseProjId); - saveProcure.setBaseBidCode(baseProjId + StrPool.DASH + String.format(StrPool.FORMAT_DATE_SINGLE_DIGITS,index)); + saveProcure.setBaseBidCode(baseProjId + StrPool.DASH + String.format(StrPool.FORMAT_DATE_SINGLE_DIGITS, index)); saveProcure.setTongID(null); saveProcure.setTongTime(LocalDateTime.now()); saveProcure.setBizTime(LocalDateTime.now()); saveProcure.setOp(BizConst.OP_INSERT); procureService.save(saveProcure); - index ++; + index++; } } } @@ -207,17 +210,17 @@ public class ProjectReceiveManage { .eq(ProjectApprove::getBaseProjId, baseProjId) .last(BizConst.LIMIT_1)); - ProjectApprove saveApprove = BeanUtil.copyProperties(approve,ProjectApprove.class); + ProjectApprove saveApprove = BeanUtil.copyProperties(approve, ProjectApprove.class); saveApprove.setBaseProjId(baseProjId); - if(Objects.isNull(oldApprove)){ + if (Objects.isNull(oldApprove)) { //如果当前 数据不存在 但是我们平台操作是修改 说明之前数据被推送过了那么 可以置为修改update - if(StringUtils.isNotBlank(approve.getOp()) && BizConst.OP_UPDATE.equals(approve.getOp())){ + if (StringUtils.isNotBlank(approve.getOp()) && BizConst.OP_UPDATE.equals(approve.getOp())) { saveApprove.setOp(BizConst.OP_UPDATE); - }else{ + } else { saveApprove.setOp(BizConst.OP_INSERT); } saveApprove.setTongTime(LocalDateTime.now()); - }else{ + } else { saveApprove.setOp(BizConst.OP_INSERT); saveApprove.setTongID(oldApprove.getTongID()); saveApprove.setTongTime(LocalDateTime.now()); @@ -234,17 +237,17 @@ public class ProjectReceiveManage { .eq(ProjectApply::getBaseProjId, baseProjId) .last(BizConst.LIMIT_1)); - ProjectApply saveApply = BeanUtil.copyProperties(apply,ProjectApply.class); + ProjectApply saveApply = BeanUtil.copyProperties(apply, ProjectApply.class); saveApply.setBaseProjId(baseProjId); - if(Objects.isNull(oldApply)){ + if (Objects.isNull(oldApply)) { //如果当前 数据不存在 但是我们平台操作是修改 说明之前数据被推送过了那么 可以置为修改update - if(StringUtils.isNotBlank(apply.getOp()) && BizConst.OP_UPDATE.equals(apply.getOp())){ + if (StringUtils.isNotBlank(apply.getOp()) && BizConst.OP_UPDATE.equals(apply.getOp())) { saveApply.setOp(BizConst.OP_UPDATE); - }else{ + } else { saveApply.setOp(BizConst.OP_INSERT); } saveApply.setTongTime(LocalDateTime.now()); - }else{ + } else { saveApply.setOp(BizConst.OP_INSERT); saveApply.setTongID(oldApply.getTongID()); saveApply.setTongTime(LocalDateTime.now()); @@ -255,16 +258,16 @@ public class ProjectReceiveManage { } //保存基本信息 - private void saveBase(ProjectBaseInfo oldBaseInfo, ProjectBaseInfo saveBase,ProjectBaseInfo baseInfo) { - if(Objects.isNull(oldBaseInfo)){ + private void saveBase(ProjectBaseInfo oldBaseInfo, ProjectBaseInfo saveBase, ProjectBaseInfo baseInfo) { + if (Objects.isNull(oldBaseInfo)) { //如果当前 数据不存在 但是我们平台操作是修改 说明之前数据被推送过了那么 可以置为修改update - if(StringUtils.isNotBlank(baseInfo.getOp()) && BizConst.OP_UPDATE.equals(baseInfo.getOp())){ + if (StringUtils.isNotBlank(baseInfo.getOp()) && BizConst.OP_UPDATE.equals(baseInfo.getOp())) { saveBase.setOp(BizConst.OP_UPDATE); - }else{ + } else { saveBase.setOp(BizConst.OP_INSERT); } saveBase.setTongTime(LocalDateTime.now()); - }else { + } else { saveBase.setOp(BizConst.OP_INSERT); saveBase.setTongID(oldBaseInfo.getTongID()); saveBase.setTongTime(LocalDateTime.now()); @@ -275,6 +278,7 @@ public class ProjectReceiveManage { /** * 置为无效 + * * @param dto * @return */ @@ -283,9 +287,9 @@ public class ProjectReceiveManage { .eq(ProjectBaseInfo::getBaseProjId, dto.getBaseProjId()) .last(BizConst.LIMIT_1)); - ProjectBaseInfo saveBaseinfo = BeanUtil.copyProperties(dto,ProjectBaseInfo.class); + ProjectBaseInfo saveBaseinfo = BeanUtil.copyProperties(dto, ProjectBaseInfo.class); saveBaseinfo.setIsEffective(BizConst.NOT_EFFECTIVE); - if(Objects.isNull(oldBaseInfo)){ + if (Objects.isNull(oldBaseInfo)) { saveBaseinfo.setTongTime(LocalDateTime.now()); } saveBaseinfo.setBizTime(LocalDateTime.now()); @@ -297,6 +301,7 @@ public class ProjectReceiveManage { /** * 删除表里的所有数据 + * * @return */ public String deleteAll() {