From df85cf5ab5d73361420a9303cd19b2127a8329e7 Mon Sep 17 00:00:00 2001 From: PoffyZhang <99775271@qq.com> Date: Tue, 21 Mar 2023 15:10:15 +0800 Subject: [PATCH] =?UTF-8?q?=E9=87=8D=E6=96=B0=E7=94=B3=E6=8A=A5=E9=A1=B9?= =?UTF-8?q?=E7=9B=AE=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/DeclaredProjectController.java | 32 ++++++++++++++++-- .../manage/ConstructionPlanManage.java | 23 +++++++++++++ .../manage/DeclaredProjectManage.java | 11 ++---- .../PrequalificationDeclaredProjectManage.java | 22 ++++++++++++ .../manage/ProjectAdjustmentManage.java | 10 +++++- .../manage/ReviewByProvincialDeptManage.java | 39 +++++++++++++++++----- .../utils/ReStartProcessMapUtil.java | 12 ++++--- 7 files changed, 125 insertions(+), 24 deletions(-) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/controller/DeclaredProjectController.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/controller/DeclaredProjectController.java index ad28692..53e6da6 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/controller/DeclaredProjectController.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/controller/DeclaredProjectController.java @@ -1,9 +1,11 @@ package com.ningdatech.pmapi.projectdeclared.controller; +import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.ningdatech.basic.model.PageVo; import com.ningdatech.pmapi.common.util.ExcelDownUtil; import com.ningdatech.pmapi.projectdeclared.contants.DeclaredProjectContant; +import com.ningdatech.pmapi.projectdeclared.manage.ProjectAdjustmentManage; import com.ningdatech.pmapi.projectdeclared.model.dto.DeclaredProjectListParamDTO; import com.ningdatech.pmapi.projectdeclared.model.dto.DefaultDeclaredDTO; import com.ningdatech.pmapi.projectdeclared.model.dto.ProjectDraftSaveDTO; @@ -16,10 +18,14 @@ import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletResponse; +import java.util.Collection; +import java.util.Iterator; +import java.util.Map; /** * @Classname DeclaredProjectController @@ -36,6 +42,8 @@ import javax.servlet.http.HttpServletResponse; public class DeclaredProjectController { private final DeclaredProjectManage declaredProjectManage; + private final ProjectAdjustmentManage projectAdjustmentManage; + @ApiOperation(value = "申报项目已申报列表", notes = "申报项目已申报列表") @GetMapping("/list") public PageVo list(@ModelAttribute ProjectListReq req) { @@ -44,8 +52,22 @@ public class DeclaredProjectController { @ApiOperation(value = "核心业务列表", notes = "核心业务列表") @GetMapping("/core-biz") - public JSONObject bizList() { - return JSONObject.parseObject(DeclaredProjectContant.Biz.CORE_BIZ); + public JSONObject bizList(@RequestParam(required = false) String businessName) { + JSONObject jsonObject = JSONObject.parseObject(DeclaredProjectContant.Biz.CORE_BIZ); + if(StringUtils.isNotBlank(businessName)){ + JSONArray dataArray = JSONArray.parseArray(jsonObject.getString("data")); + Iterator iter = dataArray.stream().iterator(); + JSONArray dataArrayRes = new JSONArray(); + while (iter.hasNext()) { + JSONObject value = (JSONObject) iter.next(); + String businessValue = value.getString("matterName"); + if(StringUtils.isNotBlank(businessValue) && businessValue.contains(businessName)){ + dataArrayRes.add(value); + } + } + jsonObject.put("data",dataArrayRes); + } + return jsonObject; } @ApiOperation(value = "申报项目草稿箱列表", notes = "申报项目草稿箱列表") @@ -73,6 +95,12 @@ public class DeclaredProjectController { return "启动流程实例 【" + instanceId + "】 成功"; } + @ApiOperation(value = "重新申报项目", notes = "重新申报项目") + @PostMapping("/restart") + public String reStartTheProcess(@Validated @RequestBody DefaultDeclaredDTO dto) { + return projectAdjustmentManage.adjustment(dto); + } + @GetMapping("/export") @ApiOperation("申报项目列表导出") public void exportList(ProjectListReq req, HttpServletResponse response){ diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ConstructionPlanManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ConstructionPlanManage.java index 384e942..337d13b 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ConstructionPlanManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ConstructionPlanManage.java @@ -144,6 +144,29 @@ public class ConstructionPlanManage { } /** + * 重新建设方案 + * + * @param dto + * @return + */ + @Transactional(rollbackFor = Exception.class) + public String restartTheProcess(DefaultDeclaredDTO dto) { + UserInfoDetails userInfoDetails = LoginUserUtil.loginUserDetail(); + VUtils.isTrue(Objects.isNull(userInfoDetails) ||Objects.isNull(userInfoDetails.getUserId())) + .throwMessage("获取登录用户失败!"); + + ProjectDTO projectDto = dto.getProjectInfo(); + VUtils.isTrue(Objects.isNull(projectDto.getId())).throwMessage("提交失败 缺少项目ID!"); + Project projectInfo = projectService.getById(projectDto.getId()); + VUtils.isTrue(Objects.isNull(projectInfo)).throwMessage("提交失败 此项目不存在!"); + VUtils.isTrue(StringUtils.isBlank(projectDto.getConstructionPlanFile())).throwMessage("提交失败 请提交建设方案!"); + //直接先到待方案审批 + projectInfo.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode()); + projectService.updateById(projectInfo); + return startTheProcess(dto); + } + + /** * 提交预审项目 时 更新信息 * * @param project diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DeclaredProjectManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DeclaredProjectManage.java index 2ae6b51..f141baa 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DeclaredProjectManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DeclaredProjectManage.java @@ -131,15 +131,8 @@ public class DeclaredProjectManage { //如果是重新提交的话 判断下 项目是否存在 if(Objects.nonNull(projectInfo.getId())){ - Project oldProject = projectService.getById(projectInfo.getId()); - VUtils.isTrue(Objects.isNull(oldProject)) - .throwMessage(String.format("重新提交失败 该项目【%s】不存在",projectInfo.getId())); - - //重新要判断 项目当前状态 是不是 单位内部审核失败 - VUtils.isTrue(!ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS.getCode().equals(oldProject.getStatus()) || - !ProjectStatusEnum.NOT_APPROVED.getCode().equals(oldProject.getStage())) - .throwMessage("重新提交失败 该项目不是 单位内部拒绝或者未立项阶段"); - + //不允许带项目id + projectInfo.setId(null); } String regionCode = userInfoDetails.getRegionCode(); diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/PrequalificationDeclaredProjectManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/PrequalificationDeclaredProjectManage.java index 44351fc..4a7876e 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/PrequalificationDeclaredProjectManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/PrequalificationDeclaredProjectManage.java @@ -135,6 +135,28 @@ public class PrequalificationDeclaredProjectManage { } /** + * 重新提交预审 + * + * @param dto + * @return + */ + @Transactional(rollbackFor = Exception.class) + public String restartTheProcess(DefaultDeclaredDTO dto) { + UserInfoDetails userInfoDetails = LoginUserUtil.loginUserDetail(); + Long userId = userInfoDetails.getUserId(); + VUtils.isTrue(Objects.isNull(userId)).throwMessage("获取登录用户失败!"); + + ProjectDTO projectDto = dto.getProjectInfo(); + VUtils.isTrue(Objects.isNull(projectDto.getId())).throwMessage("提交失败 缺少项目ID!"); + Project projectInfo = projectService.getById(projectDto.getId()); + VUtils.isTrue(Objects.isNull(projectInfo)).throwMessage("提交失败 此项目不存在!"); + //先回到 待预审状态 + projectInfo.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()); + projectService.updateById(projectInfo); + return startTheProcess(dto); + } + + /** * 查询项目库 * @param preReq * @return diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ProjectAdjustmentManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ProjectAdjustmentManage.java index 1dd6877..7cc4018 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ProjectAdjustmentManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ProjectAdjustmentManage.java @@ -33,6 +33,7 @@ import com.ningdatech.pmapi.user.util.LoginUserUtil; import com.wflow.exception.BusinessException; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; @@ -83,7 +84,14 @@ public class ProjectAdjustmentManage { VUtils.isTrue(Objects.isNull(projectInfo)).throwMessage("调整失败 此项目不存在!"); //项目名称去重 - defaultDeclaredProjectManage.checkDuplication(projectDto); + if(StringUtils.isNotBlank(projectDto.getProjectName())){ + defaultDeclaredProjectManage.checkDuplication(projectDto); + } + + //金额check + if(Objects.nonNull(projectDto.getDeclareAmount())){ + defaultDeclaredProjectManage.checkAmount(projectDto); + } //修改项目内容 if(!modifyProject(projectDto)){ diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ReviewByProvincialDeptManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ReviewByProvincialDeptManage.java index 3f182cf..ad73360 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ReviewByProvincialDeptManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ReviewByProvincialDeptManage.java @@ -15,6 +15,7 @@ import com.ningdatech.pmapi.projectlib.service.IProjectService; import com.ningdatech.pmapi.provincial.model.dto.ProvincialApplicationDTO; import com.ningdatech.pmapi.provincial.model.dto.ProvincialProjectDTO; import com.ningdatech.pmapi.provincial.service.IJoinReviewProvincialBureauService; +import com.wflow.exception.BusinessException; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; @@ -70,16 +71,38 @@ public class ReviewByProvincialDeptManage { if(joinReviewProvincialBureauService.pushImportProject( ApplicationConverter.convertProject(projectInfo,applications))){ return Boolean.TRUE; -// //测试先成功 -// stateMachineUtils.pass(project); -// projectService.updateById(project); -// //直接去预审 -// if(StringUtils.isNotBlank(defaultProjectManage -// .directStartProcess(project,project.getPreStartUserId()))){ -// return Boolean.TRUE; -// } } return Boolean.FALSE; } + + /** + * 省级部门联审 重新提交 + * @param declaringDTO + * @return + */ + @Transactional(rollbackFor = Exception.class) + public String restartTheProcess(DefaultDeclaredDTO declaringDTO) { + ProjectDTO project = declaringDTO.getProjectInfo(); + VUtils.isTrue(Objects.isNull(project.getId())).throwMessage("提交失败 缺少项目ID!"); + Project projectInfo = projectService.getById(project.getId()); + VUtils.isTrue(Objects.isNull(projectInfo)).throwMessage("提交失败 此项目不存在!"); + String regionCode = projectInfo.getAreaCode(); + + //首先要判断 项目当前状态 是不是 省级部门联审不通过 + VUtils.isTrue(!ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED.getCode().equals(projectInfo.getStatus()) || + !ProjectStatusEnum.NOT_APPROVED.getCode().equals(projectInfo.getStage())) + .throwMessage("提交失败 该项目不是 省级部门联审不通过状态或者未立项阶段"); + + // 对接省级联审的接口 + List applications = applicationService.list(Wrappers.lambdaQuery(ProjectApplication.class) + .eq(ProjectApplication::getProjectId, projectInfo.getId())); + if(joinReviewProvincialBureauService.pushImportProject( + ApplicationConverter.convertProject(projectInfo,applications))){ + throw new BusinessException("提交省级部门联审失败"); + } + projectInfo.setStatus(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS.getCode()); + projectService.updateById(projectInfo); + return String.valueOf(projectInfo.getId()); + } } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/utils/ReStartProcessMapUtil.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/utils/ReStartProcessMapUtil.java index 052bd76..e06bd57 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/utils/ReStartProcessMapUtil.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/utils/ReStartProcessMapUtil.java @@ -4,6 +4,7 @@ import com.google.common.collect.Maps; import com.ningdatech.pmapi.projectdeclared.manage.ConstructionPlanManage; import com.ningdatech.pmapi.projectdeclared.manage.DeclaredProjectManage; import com.ningdatech.pmapi.projectdeclared.manage.PrequalificationDeclaredProjectManage; +import com.ningdatech.pmapi.projectdeclared.manage.ReviewByProvincialDeptManage; import com.ningdatech.pmapi.projectdeclared.model.dto.DefaultDeclaredDTO; import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; import org.springframework.beans.factory.annotation.Autowired; @@ -27,6 +28,9 @@ public class ReStartProcessMapUtil { @Autowired private PrequalificationDeclaredProjectManage prequalificationDeclaredProjectManage; + + @Autowired + private ReviewByProvincialDeptManage provincialDeptManage; public Map> reStartProcessMap = Maps.newHashMap(); /** * 初始化业务分派逻辑,代替了if-else部分 @@ -37,14 +41,14 @@ public class ReStartProcessMapUtil { //重新项目申报 reStartProcessMap.put(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS.getCode(), dto->declaredProjectManage.reStartTheProcess(dto)); - //预审方案 + //建设方案 reStartProcessMap.put(ProjectStatusEnum.SCHEME_REVIEW_FAILED.getCode(), - dto->constructionPlanManage.startTheProcess(dto)); + dto->constructionPlanManage.restartTheProcess(dto)); //预审方案 reStartProcessMap.put(ProjectStatusEnum.PREQUALIFICATION_FAILED.getCode(), - dto->prequalificationDeclaredProjectManage.startTheProcess(dto)); + dto->prequalificationDeclaredProjectManage.restartTheProcess(dto)); //省级联审 reStartProcessMap.put(ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED.getCode(), - dto->null); + dto->provincialDeptManage.restartTheProcess(dto)); } }