diff --git a/pmapi/pom.xml b/pmapi/pom.xml
index b370bd1..3cdc006 100644
--- a/pmapi/pom.xml
+++ b/pmapi/pom.xml
@@ -264,10 +264,6 @@
${basedir}/src/lib/zwdd-sdk-java-1.2.0.jar
- com.ningdatech
- nd-rabbitmq-starter
-
-
org.apache.httpcomponents
httpclient
diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/controller/PrequalificationDeclaredController.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/controller/PrequalificationDeclaredController.java
index bdb2f49..b6ecd2b 100644
--- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/controller/PrequalificationDeclaredController.java
+++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/controller/PrequalificationDeclaredController.java
@@ -49,7 +49,6 @@ public class PrequalificationDeclaredController {
@ApiOperation(value = "申报预审", notes = "申报预审")
@PostMapping("/start")
public String startTheProcess(@Validated @RequestBody DefaultDeclaredDTO dto) {
- String instanceId = prequalificationDeclaredProjectManage.startTheProcess(dto);
- return "提交预审 【" + instanceId + "】 成功";
+ return prequalificationDeclaredProjectManage.startTheProcess(dto);
}
}
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 2d7b786..10426ce 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
@@ -82,7 +82,6 @@ public class ConstructionPlanManage {
VUtils.isTrue(!ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode().equals(projectInfo.getStatus()) ||
!ProjectStatusEnum.NOT_APPROVED.getCode().equals(projectInfo.getStage()))
.throwMessage("提交失败 该项目不是 方案待申报状态或者未立项阶段");
- // TODO 再判断 该项目是否 真实走完 预审审批
ProcessStartParamsVo params = new ProcessStartParamsVo();
params.setUser(dto.getUser());
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 ab6f90a..9770d1b 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
@@ -114,6 +114,14 @@ public class DeclaredProjectManage {
@Transactional(rollbackFor = Exception.class)
public String startTheProcess(DefaultDeclaredDTO dto) {
ProjectDTO projectInfo = dto.getProjectInfo();
+
+ //如果是重新提交的话 判断下 项目是否存在
+ if(Objects.nonNull(projectInfo.getId())){
+ Project oldProject = projectService.getById(projectInfo.getId());
+ VUtils.isTrue(Objects.isNull(oldProject))
+ .throwMessage(String.format("重新提交失败 该项目【%s】不存在",projectInfo.getId()));
+ }
+
String regionCode = projectInfo.getAreaCode();
WflowModels model = processModelService.getOne(Wrappers.lambdaQuery(WflowModels.class)
@@ -144,8 +152,8 @@ public class DeclaredProjectManage {
String instanceId = processService.startProcess(model.getProcessDefId(), params);
log.info("申报项目成功 【{}】", instanceId);
- //保存项目
- saveProject(dto.getProjectInfo(), instanceId, regionCode);
+ //如果是重新提交的话 判断下 项目是否存在
+ saveOrUpdateProject(dto.getProjectInfo(), instanceId, regionCode);
return instanceId;
}
@@ -174,6 +182,11 @@ public class DeclaredProjectManage {
throw new BusinessException(String.format("此 【%s】区域找不到单位流程配置", regionCode));
}
+ //首先要判断 项目当前状态 是不是 单位内部拒绝
+ VUtils.isTrue(!ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS.getCode().equals(projectInfo.getStatus()) ||
+ !ProjectStatusEnum.NOT_APPROVED.getCode().equals(projectInfo.getStage()))
+ .throwMessage("提交失败 该项目不是 单位内部拒绝审核状态或者未立项阶段");
+
ProcessStartParamsVo params = new ProcessStartParamsVo();
params.setUser(dto.getUser());
params.setProcessUsers(Collections.emptyMap());
@@ -221,7 +234,7 @@ public class DeclaredProjectManage {
* @param projectDto
* @param instanceId
*/
- private void saveProject(ProjectDTO projectDto, String instanceId, String regionCode) {
+ private void saveOrUpdateProject(ProjectDTO projectDto, String instanceId, String regionCode) {
//流程启动之后 入库项目 重要业务信息 用于列表查询 展示
try {
//保存项目表信息
@@ -233,7 +246,7 @@ public class DeclaredProjectManage {
project.setStage(ProjectStatusEnum.NOT_APPROVED.getCode());
project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode());
project.setInstCode(instanceId);
- projectService.save(project);
+ projectService.saveOrUpdate(project);
//保存项目应用
if (CollUtil.isNotEmpty(projectDto.getApplicationList())) {
List applications = projectDto.getApplicationList().stream().map(application -> {
@@ -250,6 +263,7 @@ public class DeclaredProjectManage {
projectInst.setInstCode(instanceId);
projectInst.setCreatOn(LocalDateTime.now());
projectInst.setUpdateOn(LocalDateTime.now());
+ projectInst.setInstType(ProjectProcessStageEnum.ORG_INTERNAL_APPROVAL_PROCESS.getCode());
projectInstService.save(projectInst);
} catch (Exception e) {
log.error("项目信息入库错误 ", e);
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 9819482..ba26fff 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
@@ -15,6 +15,7 @@ import com.ningdatech.pmapi.projectlib.model.entity.Project;
import com.ningdatech.pmapi.projectlib.model.entity.ProjectInst;
import com.ningdatech.pmapi.projectlib.service.IProjectInstService;
import com.ningdatech.pmapi.projectlib.service.IProjectService;
+import com.ningdatech.pmapi.staging.serivice.IProjectStagingService;
import com.wflow.bean.entity.WflowModels;
import com.wflow.exception.BusinessException;
import com.wflow.workflow.bean.vo.ProcessStartParamsVo;
@@ -52,6 +53,8 @@ public class PrequalificationDeclaredProjectManage {
private final IProjectInstService projectInstService;
+ private final IProjectStagingService projectStagingService;
+
/**
* 提交预审
*
@@ -95,8 +98,13 @@ public class PrequalificationDeclaredProjectManage {
//如果是省级部门 需要联审的(申报金额大于1000万 并且是市级项目)
if(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS
.getCode().equals(projectInfo.getStatus())){
- //TODO 对接外部 省级
- instanceId = DeclaredProjectContant.Instance.PROVINCE_INSTANCE_ID;
+ //入库暂存表 后续处理 对接外部接口
+ projectInfo.setUpdateOn(LocalDateTime.now());
+ if(projectStagingService.addByProject(projectInfo,"省级部门联审")
+ && projectService.updateById(projectInfo)){
+ return "提交省级部门联审成功";
+ }
+ return "提交省级部门联审失败";
}else if(ProjectStatusEnum.PRE_APPLYING
.getCode().equals(projectInfo.getStatus())){
//如果是非省级联审的项目 直接提交 预审
@@ -115,14 +123,13 @@ public class PrequalificationDeclaredProjectManage {
log.info("提交预审项目成功 【{}】", instanceId);
//保存预审项目
- if(Objects.nonNull(instanceId)){
- modifyProject(projectInfo, instanceId);
- }
+ modifyProject(projectInfo, instanceId);
+
}else{
throw new BusinessException("项目状态 错误 project :" + JSON.toJSONString(projectInfo));
}
- return instanceId;
+ return "提交预审成功【" + instanceId + "】";
}
/**
@@ -146,6 +153,7 @@ public class PrequalificationDeclaredProjectManage {
projectInst.setInstCode(instanceId);
projectInst.setCreatOn(LocalDateTime.now());
projectInst.setUpdateOn(LocalDateTime.now());
+ projectInst.setInstType(ProjectProcessStageEnum.PROJECT_PREQUALIFICATION_APPROVAL_PROCESS.getCode());
projectInstService.save(projectInst);
} catch (Exception e) {
log.error("提交预审 项目信息修改 错误 ", e);
diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ReviewByDeptJointManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ReviewByDeptJointManage.java
new file mode 100644
index 0000000..a20f562
--- /dev/null
+++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ReviewByDeptJointManage.java
@@ -0,0 +1,87 @@
+package com.ningdatech.pmapi.projectdeclared.manage;
+
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.ningdatech.basic.function.VUtils;
+import com.ningdatech.pmapi.common.enumeration.ProjectProcessStageEnum;
+import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum;
+import com.ningdatech.pmapi.projectlib.model.entity.Project;
+import com.ningdatech.pmapi.projectlib.service.IProjectInstService;
+import com.ningdatech.pmapi.projectlib.service.IProjectService;
+import com.wflow.bean.entity.WflowModels;
+import com.wflow.exception.BusinessException;
+import com.wflow.workflow.service.ProcessInstanceService;
+import com.wflow.workflow.service.ProcessModelService;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Component;
+import org.springframework.transaction.annotation.Transactional;
+import java.util.Objects;
+
+/**
+ * @Classname ReviewByDeptJointManage
+ * @Description 部门联审
+ * @Date 2023/2/17 14:48
+ * @Author PoffyZhang
+ */
+@Component
+@Slf4j
+@RequiredArgsConstructor
+public class ReviewByDeptJointManage {
+
+ private final IProjectService projectService;
+
+ private final ProcessModelService processModelService;
+
+ private final ProcessInstanceService processService;
+
+ private final IProjectInstService projectInstService;
+
+ /**
+ * 省级部门联审
+ * @param project
+ * @return
+ */
+ @Transactional(rollbackFor = Exception.class)
+ public Boolean startTheProcess(Project project) {
+ VUtils.isTrue(Objects.isNull(project.getId())).throwMessage("提交失败 缺少项目ID!");
+ Project projectInfo = projectService.getById(project.getId());
+ VUtils.isTrue(Objects.isNull(projectInfo)).throwMessage("提交失败 此项目不存在!");
+ String regionCode = projectInfo.getAreaCode();
+
+ WflowModels model = processModelService.getOne(Wrappers.lambdaQuery(WflowModels.class)
+ .eq(WflowModels::getRegionCode, regionCode)
+ .eq(WflowModels::getProcessType, ProjectProcessStageEnum.DEPARTMENT_JOINT_APPROVAL_PROCESS.getCode())
+ .last("limit 1"));
+
+ if (Objects.isNull(model)) {
+ log.error("此 【{}】区域找不到 部门联审申报流程配置", regionCode);
+ throw new BusinessException(String.format("此 【%s】区域找不到 部门联审申报流程配置", regionCode));
+ }
+ //要判断 项目当前状态 是不是 部门联审
+ VUtils.isTrue(!ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW.getCode().equals(projectInfo.getStatus()) ||
+ !ProjectStatusEnum.NOT_APPROVED.getCode().equals(projectInfo.getStage()))
+ .throwMessage("提交失败 该项目不是 省级部门联审状态状态或者未立项阶段");
+
+ // 再判断 该项目是否 真实走完 预审审批 并且提取出 提交人
+// projectInstService.
+//
+// ProcessStartParamsVo params = new ProcessStartParamsVo();
+// params.setUser(dto.getUser());
+// params.setProcessUsers(Collections.emptyMap());
+// //放入条件判断的项目字段
+// ProjectConditionDTO conditionDto = new ProjectConditionDTO();
+// BeanUtils.copyProperties(projectInfo, conditionDto);
+// dto.getFormData().putAll(
+// JSON.parseObject(JSON.toJSONString(conditionDto), new TypeReference