浏览代码

重新申报项目接口

master
PoffyZhang 1年前
父节点
当前提交
df85cf5ab5
共有 7 个文件被更改,包括 125 次插入24 次删除
  1. +30
    -2
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/controller/DeclaredProjectController.java
  2. +23
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ConstructionPlanManage.java
  3. +2
    -9
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DeclaredProjectManage.java
  4. +22
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/PrequalificationDeclaredProjectManage.java
  5. +9
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ProjectAdjustmentManage.java
  6. +31
    -8
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ReviewByProvincialDeptManage.java
  7. +8
    -4
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/utils/ReStartProcessMapUtil.java

+ 30
- 2
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<ProjectLibListItemVO> 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){


+ 23
- 0
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


+ 2
- 9
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();


+ 22
- 0
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


+ 9
- 1
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)){


+ 31
- 8
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<ProjectApplication> 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());
}
}

+ 8
- 4
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<Integer, Function<DefaultDeclaredDTO,String>> 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));
}
}

正在加载...
取消
保存