@@ -1,9 +1,11 @@ | |||||
package com.ningdatech.pmapi.projectdeclared.controller; | package com.ningdatech.pmapi.projectdeclared.controller; | ||||
import com.alibaba.fastjson.JSONArray; | |||||
import com.alibaba.fastjson.JSONObject; | import com.alibaba.fastjson.JSONObject; | ||||
import com.ningdatech.basic.model.PageVo; | import com.ningdatech.basic.model.PageVo; | ||||
import com.ningdatech.pmapi.common.util.ExcelDownUtil; | import com.ningdatech.pmapi.common.util.ExcelDownUtil; | ||||
import com.ningdatech.pmapi.projectdeclared.contants.DeclaredProjectContant; | 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.DeclaredProjectListParamDTO; | ||||
import com.ningdatech.pmapi.projectdeclared.model.dto.DefaultDeclaredDTO; | import com.ningdatech.pmapi.projectdeclared.model.dto.DefaultDeclaredDTO; | ||||
import com.ningdatech.pmapi.projectdeclared.model.dto.ProjectDraftSaveDTO; | import com.ningdatech.pmapi.projectdeclared.model.dto.ProjectDraftSaveDTO; | ||||
@@ -16,10 +18,14 @@ import io.swagger.annotations.Api; | |||||
import io.swagger.annotations.ApiOperation; | import io.swagger.annotations.ApiOperation; | ||||
import lombok.RequiredArgsConstructor; | import lombok.RequiredArgsConstructor; | ||||
import lombok.extern.slf4j.Slf4j; | import lombok.extern.slf4j.Slf4j; | ||||
import org.apache.commons.lang3.StringUtils; | |||||
import org.springframework.validation.annotation.Validated; | import org.springframework.validation.annotation.Validated; | ||||
import org.springframework.web.bind.annotation.*; | import org.springframework.web.bind.annotation.*; | ||||
import javax.servlet.http.HttpServletResponse; | import javax.servlet.http.HttpServletResponse; | ||||
import java.util.Collection; | |||||
import java.util.Iterator; | |||||
import java.util.Map; | |||||
/** | /** | ||||
* @Classname DeclaredProjectController | * @Classname DeclaredProjectController | ||||
@@ -36,6 +42,8 @@ import javax.servlet.http.HttpServletResponse; | |||||
public class DeclaredProjectController { | public class DeclaredProjectController { | ||||
private final DeclaredProjectManage declaredProjectManage; | private final DeclaredProjectManage declaredProjectManage; | ||||
private final ProjectAdjustmentManage projectAdjustmentManage; | |||||
@ApiOperation(value = "申报项目已申报列表", notes = "申报项目已申报列表") | @ApiOperation(value = "申报项目已申报列表", notes = "申报项目已申报列表") | ||||
@GetMapping("/list") | @GetMapping("/list") | ||||
public PageVo<ProjectLibListItemVO> list(@ModelAttribute ProjectListReq req) { | public PageVo<ProjectLibListItemVO> list(@ModelAttribute ProjectListReq req) { | ||||
@@ -44,8 +52,22 @@ public class DeclaredProjectController { | |||||
@ApiOperation(value = "核心业务列表", notes = "核心业务列表") | @ApiOperation(value = "核心业务列表", notes = "核心业务列表") | ||||
@GetMapping("/core-biz") | @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 = "申报项目草稿箱列表") | @ApiOperation(value = "申报项目草稿箱列表", notes = "申报项目草稿箱列表") | ||||
@@ -73,6 +95,12 @@ public class DeclaredProjectController { | |||||
return "启动流程实例 【" + instanceId + "】 成功"; | return "启动流程实例 【" + instanceId + "】 成功"; | ||||
} | } | ||||
@ApiOperation(value = "重新申报项目", notes = "重新申报项目") | |||||
@PostMapping("/restart") | |||||
public String reStartTheProcess(@Validated @RequestBody DefaultDeclaredDTO dto) { | |||||
return projectAdjustmentManage.adjustment(dto); | |||||
} | |||||
@GetMapping("/export") | @GetMapping("/export") | ||||
@ApiOperation("申报项目列表导出") | @ApiOperation("申报项目列表导出") | ||||
public void exportList(ProjectListReq req, HttpServletResponse response){ | public void exportList(ProjectListReq req, HttpServletResponse response){ | ||||
@@ -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 | * @param project | ||||
@@ -131,15 +131,8 @@ public class DeclaredProjectManage { | |||||
//如果是重新提交的话 判断下 项目是否存在 | //如果是重新提交的话 判断下 项目是否存在 | ||||
if(Objects.nonNull(projectInfo.getId())){ | 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(); | String regionCode = userInfoDetails.getRegionCode(); | ||||
@@ -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 | * @param preReq | ||||
* @return | * @return | ||||
@@ -33,6 +33,7 @@ import com.ningdatech.pmapi.user.util.LoginUserUtil; | |||||
import com.wflow.exception.BusinessException; | import com.wflow.exception.BusinessException; | ||||
import lombok.RequiredArgsConstructor; | import lombok.RequiredArgsConstructor; | ||||
import lombok.extern.slf4j.Slf4j; | import lombok.extern.slf4j.Slf4j; | ||||
import org.apache.commons.lang3.StringUtils; | |||||
import org.springframework.beans.BeanUtils; | import org.springframework.beans.BeanUtils; | ||||
import org.springframework.stereotype.Component; | import org.springframework.stereotype.Component; | ||||
import org.springframework.transaction.annotation.Transactional; | import org.springframework.transaction.annotation.Transactional; | ||||
@@ -83,7 +84,14 @@ public class ProjectAdjustmentManage { | |||||
VUtils.isTrue(Objects.isNull(projectInfo)).throwMessage("调整失败 此项目不存在!"); | 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)){ | if(!modifyProject(projectDto)){ | ||||
@@ -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.ProvincialApplicationDTO; | ||||
import com.ningdatech.pmapi.provincial.model.dto.ProvincialProjectDTO; | import com.ningdatech.pmapi.provincial.model.dto.ProvincialProjectDTO; | ||||
import com.ningdatech.pmapi.provincial.service.IJoinReviewProvincialBureauService; | import com.ningdatech.pmapi.provincial.service.IJoinReviewProvincialBureauService; | ||||
import com.wflow.exception.BusinessException; | |||||
import lombok.RequiredArgsConstructor; | import lombok.RequiredArgsConstructor; | ||||
import lombok.extern.slf4j.Slf4j; | import lombok.extern.slf4j.Slf4j; | ||||
import org.apache.commons.lang3.StringUtils; | import org.apache.commons.lang3.StringUtils; | ||||
@@ -70,16 +71,38 @@ public class ReviewByProvincialDeptManage { | |||||
if(joinReviewProvincialBureauService.pushImportProject( | if(joinReviewProvincialBureauService.pushImportProject( | ||||
ApplicationConverter.convertProject(projectInfo,applications))){ | ApplicationConverter.convertProject(projectInfo,applications))){ | ||||
return Boolean.TRUE; | return Boolean.TRUE; | ||||
// //测试先成功 | |||||
// stateMachineUtils.pass(project); | |||||
// projectService.updateById(project); | |||||
// //直接去预审 | |||||
// if(StringUtils.isNotBlank(defaultProjectManage | |||||
// .directStartProcess(project,project.getPreStartUserId()))){ | |||||
// return Boolean.TRUE; | |||||
// } | |||||
} | } | ||||
return Boolean.FALSE; | 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()); | |||||
} | |||||
} | } |
@@ -4,6 +4,7 @@ import com.google.common.collect.Maps; | |||||
import com.ningdatech.pmapi.projectdeclared.manage.ConstructionPlanManage; | import com.ningdatech.pmapi.projectdeclared.manage.ConstructionPlanManage; | ||||
import com.ningdatech.pmapi.projectdeclared.manage.DeclaredProjectManage; | import com.ningdatech.pmapi.projectdeclared.manage.DeclaredProjectManage; | ||||
import com.ningdatech.pmapi.projectdeclared.manage.PrequalificationDeclaredProjectManage; | 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.projectdeclared.model.dto.DefaultDeclaredDTO; | ||||
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; | import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; | ||||
import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
@@ -27,6 +28,9 @@ public class ReStartProcessMapUtil { | |||||
@Autowired | @Autowired | ||||
private PrequalificationDeclaredProjectManage prequalificationDeclaredProjectManage; | private PrequalificationDeclaredProjectManage prequalificationDeclaredProjectManage; | ||||
@Autowired | |||||
private ReviewByProvincialDeptManage provincialDeptManage; | |||||
public Map<Integer, Function<DefaultDeclaredDTO,String>> reStartProcessMap = Maps.newHashMap(); | public Map<Integer, Function<DefaultDeclaredDTO,String>> reStartProcessMap = Maps.newHashMap(); | ||||
/** | /** | ||||
* 初始化业务分派逻辑,代替了if-else部分 | * 初始化业务分派逻辑,代替了if-else部分 | ||||
@@ -37,14 +41,14 @@ public class ReStartProcessMapUtil { | |||||
//重新项目申报 | //重新项目申报 | ||||
reStartProcessMap.put(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS.getCode(), | reStartProcessMap.put(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS.getCode(), | ||||
dto->declaredProjectManage.reStartTheProcess(dto)); | dto->declaredProjectManage.reStartTheProcess(dto)); | ||||
//预审方案 | |||||
//建设方案 | |||||
reStartProcessMap.put(ProjectStatusEnum.SCHEME_REVIEW_FAILED.getCode(), | reStartProcessMap.put(ProjectStatusEnum.SCHEME_REVIEW_FAILED.getCode(), | ||||
dto->constructionPlanManage.startTheProcess(dto)); | |||||
dto->constructionPlanManage.restartTheProcess(dto)); | |||||
//预审方案 | //预审方案 | ||||
reStartProcessMap.put(ProjectStatusEnum.PREQUALIFICATION_FAILED.getCode(), | 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(), | reStartProcessMap.put(ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED.getCode(), | ||||
dto->null); | |||||
dto->provincialDeptManage.restartTheProcess(dto)); | |||||
} | } | ||||
} | } |
@@ -39,10 +39,10 @@ public class CheckProvincialReviewResultTask { | |||||
private final IProjectService projectService; | private final IProjectService projectService; | ||||
private final StateMachineUtils stateMachineUtils; | private final StateMachineUtils stateMachineUtils; | ||||
@Scheduled(cron = "0 */1 * * * ?") | |||||
@Scheduled(cron = "0 */5 * * * ?") | |||||
public void statusFlow() throws UnknownHostException { | public void statusFlow() throws UnknownHostException { | ||||
//测试暂时用自己电脑HOST | //测试暂时用自己电脑HOST | ||||
if (TaskContant.Host.HOST_ZPF.equals(InetAddress.getLocalHost().getHostName())) { | |||||
if (TaskContant.Host.HOST_207.equals(InetAddress.getLocalHost().getHostName())) { | |||||
//1. 定时取 省级部门联审中的项目 去取项目 | //1. 定时取 省级部门联审中的项目 去取项目 | ||||
List<Project> projectList = projectService.list(Wrappers.lambdaQuery(Project.class) | List<Project> projectList = projectService.list(Wrappers.lambdaQuery(Project.class) | ||||
.eq(Project::getStage, ProjectStatusEnum.NOT_APPROVED.getCode()) | .eq(Project::getStage, ProjectStatusEnum.NOT_APPROVED.getCode()) | ||||
@@ -74,7 +74,7 @@ public class CheckProvincialReviewResultTask { | |||||
stateMachineUtils.pass(project); | stateMachineUtils.pass(project); | ||||
project.setUpdateOn(LocalDateTime.now()); | project.setUpdateOn(LocalDateTime.now()); | ||||
projectService.updateById(project); | projectService.updateById(project); | ||||
}else if(ProjectProvincialAuditStatusEnum.SUCCESS.getCode().equals(projectRes.getProjectStatus())){ | |||||
}else if(ProjectProvincialAuditStatusEnum.FAIL.getCode().equals(projectRes.getProjectStatus())){ | |||||
log.info("此项目 【{}】 审核不通过",projectRes.getProjectId()); | log.info("此项目 【{}】 审核不通过",projectRes.getProjectId()); | ||||
stateMachineUtils.reject(project); | stateMachineUtils.reject(project); | ||||
project.setUpdateOn(LocalDateTime.now()); | project.setUpdateOn(LocalDateTime.now()); | ||||