@@ -56,7 +56,8 @@ public class GeneratorCodeKingbaseConfig { | |||
} | |||
public static void main(String[] args) { | |||
generate("Liuxinxin", "expert", PATH_LXX, "expert_gov_business_strip"); | |||
//generate("Liuxinxin", "expert", PATH_LXX, "expert_gov_business_strip"); | |||
generate("CMM", "test", PATH_CMM, "nd_project_delay_apply"); | |||
} | |||
} |
@@ -49,7 +49,6 @@ public class DelayedApplyController { | |||
@PostMapping("/apply") | |||
public String delayedApply(@Validated @RequestBody DelayedApplyDTO dto) { | |||
String instanceId = delayedApplyManage.startDelayedApplyProcess(dto); | |||
return "启动流程实例 【" + instanceId + "】 成功"; | |||
//return delayedApplyManage.delayedApply(dto); | |||
return "启动延期申请流程实例 【" + instanceId + "】 成功"; | |||
} | |||
} |
@@ -36,6 +36,7 @@ import com.ningdatech.pmapi.projectlib.model.entity.Project; | |||
import com.ningdatech.pmapi.projectlib.model.entity.ProjectInst; | |||
import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq; | |||
import com.ningdatech.pmapi.projectlib.model.vo.ProjectLibListItemVO; | |||
import com.ningdatech.pmapi.projectlib.service.INdProjectDelayApplyService; | |||
import com.ningdatech.pmapi.projectlib.service.IProjectInstService; | |||
import com.ningdatech.pmapi.projectlib.service.IProjectService; | |||
import com.ningdatech.pmapi.staging.enums.MsgTypeEnum; | |||
@@ -253,12 +254,11 @@ public class DelayedApplyManage { | |||
// 获取发起单位、发起单位主管单位、发起单位上级条线主管单位信息 | |||
Map<String, OrgInfoDTO> orgModelMap = defaultDeclaredProjectManage.buildOrgModelMap(employeeCode, project); | |||
String instanceId = processInstanceService.newStartProcess(model.getProcessDefId(), model.getFormId(), params, orgModelMap); | |||
log.info("终验方案项目申报成功 【{}】", instanceId); | |||
log.info("延期申请申报成功 【{}】", instanceId); | |||
// 保存项目相关 | |||
// 保存项目延期实例相关 | |||
projectLibManage.saveProjectByApplyDelay(dto, project, instanceId); | |||
//发送给第一个审批人消息 | |||
noticeManage.sendFirtUser(project,model.getFormName(),instanceId, | |||
WorkNoticeContant.PASS_MSG_TEMPLATE, MsgTypeEnum.PROJECT_REVIEW); | |||
@@ -44,4 +44,16 @@ public enum InstTypeEnum { | |||
} | |||
return StringUtils.EMPTY; | |||
} | |||
public static InstTypeEnum getByCode(Integer code) { | |||
if (Objects.isNull(code)) { | |||
return null; | |||
} | |||
for (InstTypeEnum t : InstTypeEnum.values()) { | |||
if (code.equals(t.getCode())) { | |||
return t; | |||
} | |||
} | |||
return null; | |||
} | |||
} |
@@ -34,16 +34,14 @@ import com.ningdatech.pmapi.projectlib.handle.ProcessExecuteChainHandle; | |||
import com.ningdatech.pmapi.projectlib.helper.ProjectHelper; | |||
import com.ningdatech.pmapi.projectlib.model.dto.ProjectApplicationDTO; | |||
import com.ningdatech.pmapi.projectlib.model.dto.ProjectDTO; | |||
import com.ningdatech.pmapi.projectlib.model.entity.Project; | |||
import com.ningdatech.pmapi.projectlib.model.entity.ProjectApplication; | |||
import com.ningdatech.pmapi.projectlib.model.entity.ProjectInst; | |||
import com.ningdatech.pmapi.projectlib.model.entity.ProjectRenewalFundDeclaration; | |||
import com.ningdatech.pmapi.projectlib.model.entity.*; | |||
import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq; | |||
import com.ningdatech.pmapi.projectlib.model.vo.AnnualAmountVO; | |||
import com.ningdatech.pmapi.projectlib.model.vo.ProjectDetailVO; | |||
import com.ningdatech.pmapi.projectlib.model.vo.ProjectLibListItemVO; | |||
import com.ningdatech.pmapi.projectlib.service.*; | |||
import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO; | |||
import com.ningdatech.pmapi.user.util.LoginUserUtil; | |||
import com.wflow.exception.BusinessException; | |||
import com.wflow.workflow.bean.vo.ProcessDetailVO; | |||
import lombok.RequiredArgsConstructor; | |||
@@ -79,8 +77,8 @@ public class ProjectLibManage { | |||
private final IProjectApplicationService projectApplicationService; | |||
private final GenerateProjectCodeUtil generateProjectCodeUtil; | |||
private final IProjectInstService projectInstService; | |||
private final StateMachineUtils stateMachineUtils; | |||
private final INdProjectDelayApplyService projectDelayApplyService; | |||
public PageVo<ProjectLibListItemVO> projectLibList(ProjectListReq req) { | |||
LambdaQueryWrapper<Project> query = ProjectHelper.projectQuery(req); | |||
@@ -617,19 +615,18 @@ public class ProjectLibManage { | |||
} | |||
public void saveProjectByApplyDelay(DelayedApplyDTO dto, Project project, String instanceId) { | |||
// 获取项目的立项批复时间和建设周期 | |||
LocalDateTime approvalDate = project.getApprovalDate(); | |||
String buildCycle = project.getBuildCycle(); | |||
// 重新计算建设周期、验收时间 | |||
String constructCycle = buildCycle + dto.getDelayedMonth(); | |||
project.setBuildCycle(constructCycle); | |||
Long delayedMonth = Long.valueOf(dto.getDelayedMonth()); | |||
String acceptTime = NdDateUtils.format(approvalDate.plusMonths(delayedMonth), DatePattern.NORM_DATETIME_MINUTE_PATTERN); | |||
project.setBuildCycle(acceptTime); | |||
project.setInstCode(instanceId); | |||
project.setApplyDelayFile(dto.getSupportingMaterials()); | |||
project.setApplyDelayReason(dto.getDelayedReason()); | |||
projectService.updateById(project); | |||
ProjectDelayApply projectDelayApply = new ProjectDelayApply(); | |||
projectDelayApply.setDelayTime(dto.getDelayedMonth()); | |||
projectDelayApply.setDelayApplyFile(dto.getSupportingMaterials()); | |||
projectDelayApply.setDelayApplyReason(dto.getDelayedReason()); | |||
projectDelayApply.setProjectId(project.getId()); | |||
projectDelayApply.setInstanceId(instanceId); | |||
projectDelayApply.setCreateBy(LoginUserUtil.getUserId()); | |||
projectDelayApply.setCreateOn(LocalDateTime.now()); | |||
projectDelayApply.setUpdateBy(LoginUserUtil.getUserId()); | |||
projectDelayApply.setUpdateOn(LocalDateTime.now()); | |||
projectDelayApplyService.save(projectDelayApply); | |||
//保存项目和实例的关系 | |||
ProjectInst projectInst = new ProjectInst(); | |||
@@ -0,0 +1,16 @@ | |||
package com.ningdatech.pmapi.projectlib.mapper; | |||
import com.ningdatech.pmapi.projectlib.model.entity.ProjectDelayApply; | |||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||
/** | |||
* <p> | |||
* 项目延期申请记录表 Mapper 接口 | |||
* </p> | |||
* | |||
* @author CMM | |||
* @since 2023-06-15 | |||
*/ | |||
public interface NdProjectDelayApplyMapper extends BaseMapper<ProjectDelayApply> { | |||
} |
@@ -0,0 +1,5 @@ | |||
<?xml version="1.0" encoding="UTF-8"?> | |||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||
<mapper namespace="com.ningdatech.pmapi.projectlib.mapper.NdProjectDelayApplyMapper"> | |||
</mapper> |
@@ -0,0 +1,57 @@ | |||
package com.ningdatech.pmapi.projectlib.model.entity; | |||
import com.baomidou.mybatisplus.annotation.IdType; | |||
import com.baomidou.mybatisplus.annotation.TableId; | |||
import com.baomidou.mybatisplus.annotation.TableName; | |||
import java.io.Serializable; | |||
import java.time.LocalDateTime; | |||
import io.swagger.annotations.ApiModel; | |||
import io.swagger.annotations.ApiModelProperty; | |||
import lombok.Data; | |||
/** | |||
* <p> | |||
* 项目延期申请记录表 | |||
* </p> | |||
* | |||
* @author CMM | |||
* @since 2023-06-15 | |||
*/ | |||
@Data | |||
@TableName("nd_project_delay_apply") | |||
@ApiModel(value = "NdProjectDelayApply对象", description = "项目延期申请记录表") | |||
public class ProjectDelayApply implements Serializable { | |||
private static final long serialVersionUID = 1L; | |||
@ApiModelProperty("主键") | |||
@TableId(type = IdType.AUTO) | |||
private Long id; | |||
@ApiModelProperty("项目ID") | |||
private Long projectId; | |||
@ApiModelProperty("延期时间(几个月)") | |||
private Integer delayTime; | |||
@ApiModelProperty("延期申请佐证材料") | |||
private String delayApplyFile; | |||
@ApiModelProperty("延期申请理由") | |||
private String delayApplyReason; | |||
@ApiModelProperty("创建人") | |||
private Long createBy; | |||
@ApiModelProperty("创建时间") | |||
private LocalDateTime createOn; | |||
@ApiModelProperty("更新人") | |||
private Long updateBy; | |||
@ApiModelProperty("更新时间") | |||
private LocalDateTime updateOn; | |||
@ApiModelProperty("延期申请实例ID") | |||
private String instanceId; | |||
} |
@@ -0,0 +1,16 @@ | |||
package com.ningdatech.pmapi.projectlib.service; | |||
import com.ningdatech.pmapi.projectlib.model.entity.ProjectDelayApply; | |||
import com.baomidou.mybatisplus.extension.service.IService; | |||
/** | |||
* <p> | |||
* 项目延期申请记录表 服务类 | |||
* </p> | |||
* | |||
* @author CMM | |||
* @since 2023-06-15 | |||
*/ | |||
public interface INdProjectDelayApplyService extends IService<ProjectDelayApply> { | |||
} |
@@ -0,0 +1,20 @@ | |||
package com.ningdatech.pmapi.projectlib.service.impl; | |||
import com.ningdatech.pmapi.projectlib.model.entity.ProjectDelayApply; | |||
import com.ningdatech.pmapi.projectlib.mapper.NdProjectDelayApplyMapper; | |||
import com.ningdatech.pmapi.projectlib.service.INdProjectDelayApplyService; | |||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |||
import org.springframework.stereotype.Service; | |||
/** | |||
* <p> | |||
* 项目延期申请记录表 服务实现类 | |||
* </p> | |||
* | |||
* @author CMM | |||
* @since 2023-06-15 | |||
*/ | |||
@Service | |||
public class NdProjectDelayApplyServiceImpl extends ServiceImpl<NdProjectDelayApplyMapper, ProjectDelayApply> implements INdProjectDelayApplyService { | |||
} |
@@ -6,13 +6,17 @@ import java.time.LocalDateTime; | |||
import java.util.*; | |||
import java.util.stream.Collectors; | |||
import cn.hutool.core.date.DatePattern; | |||
import com.google.common.collect.Lists; | |||
import com.ningdatech.basic.util.NdDateUtils; | |||
import com.ningdatech.file.service.FileService; | |||
import com.ningdatech.pmapi.common.constant.ProjectDeclareConst; | |||
import com.ningdatech.pmapi.projectdeclared.converter.ApplicationConverter; | |||
import com.ningdatech.pmapi.projectlib.enumeration.InstTypeEnum; | |||
import com.ningdatech.pmapi.projectlib.model.entity.ProjectDelayApply; | |||
import com.ningdatech.pmapi.projectlib.service.INdProjectDelayApplyService; | |||
import com.ningdatech.pmapi.provincial.service.IJoinReviewProvincialBureauService; | |||
import org.apache.commons.lang3.StringUtils; | |||
import org.checkerframework.checker.nullness.qual.Nullable; | |||
import org.flowable.engine.HistoryService; | |||
import org.flowable.engine.RuntimeService; | |||
import org.flowable.engine.TaskService; | |||
@@ -77,10 +81,9 @@ public class HandlerManage { | |||
private final IProjectInstService projectInstService; | |||
private final NoticeManage noticeManage; | |||
private final DeclaredProjectManage declaredProjectManage; | |||
private final FileService fileService; | |||
private final IJoinReviewProvincialBureauService joinReviewProvincialBureauService; | |||
private final INdProjectDelayApplyService projectDelayApplyService; | |||
/** | |||
* 审核通过后 所处理的逻辑 | |||
@@ -93,6 +96,16 @@ public class HandlerManage { | |||
HistoricProcessInstance newInstance = historyService.createHistoricProcessInstanceQuery() | |||
.processInstanceId(instance.getId()) | |||
.singleResult(); | |||
// 获取当前流程实例类型 | |||
String instanceId = newInstance.getId(); | |||
ProjectInst projectInst = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class) | |||
.eq(ProjectInst::getInstCode, instanceId)); | |||
Integer instType = projectInst.getInstType(); | |||
InstTypeEnum instTypeEnum = InstTypeEnum.getByCode(instType); | |||
if (Objects.isNull(instTypeEnum)){ | |||
throw new BizException("当前审批流类型不存在,流程类型code:" + instType); | |||
} | |||
// 获取流程通过后当前流程详情 | |||
ProcessProgressVo newInstanceDetail = processInstanceService.getProgressInstanceDetail(null, instance.getId()); | |||
// 获取流程通过后当前审核人信息,向其发送工作通知 | |||
@@ -124,41 +137,58 @@ public class HandlerManage { | |||
// 若当前登录用户是最后一个审批人,需更新流程状态为审核完成,项目状态到下个状态 | |||
// 并向流程发起人发送浙政钉工作通知:【项目名称】已通过【流程名称】,请及时开始下一步操作。 | |||
if (HisProInsEndActId.END.equals(newInstance.getEndActivityId())) { | |||
switch (Objects.requireNonNull(ProjectStatusEnum.getValue(declaredProject.getStatus()))) { | |||
// 当前项目状态是预审中 | |||
case PRE_APPLYING: | |||
//先修改项目状态 | |||
updatePassProjectStatus(userId, declaredProject); | |||
//然后入库暂存库 | |||
projectStagingService.addByProject(declaredProject,"暂存入库 待提交部门联审"); | |||
break; | |||
// 当前项目状态是单位内部审核中 | |||
case UNDER_INTERNAL_AUDIT: | |||
// 如果是申请延期和申请借阅审批流程,不走状态机 | |||
if (InstTypeEnum.APPLY_DELAY.getCode().equals(instType) || InstTypeEnum.APPLY_BORROW.getCode().equals(instType)){ | |||
switch (instTypeEnum) { | |||
case APPLY_DELAY: | |||
// 保存延期申请记录,更新项目建设周期和计划验收时间 | |||
updateProjectDelayApplyInfo(declaredProject,instanceId); | |||
break; | |||
case APPLY_BORROW: | |||
// 申请借阅审批逻辑 | |||
break; | |||
default: | |||
throw new BizException("传入实例类型错误: " + instTypeEnum); | |||
} | |||
}else { | |||
switch (Objects.requireNonNull(ProjectStatusEnum.getValue(declaredProject.getStatus()))) { | |||
// 当前项目状态是预审中 | |||
case PRE_APPLYING: | |||
//先修改项目状态 | |||
updatePassProjectStatus(userId, declaredProject); | |||
//然后入库暂存库 | |||
projectStagingService.addByProject(declaredProject, "暂存入库 待提交部门联审"); | |||
break; | |||
// 当前项目状态是单位内部审核中 | |||
case UNDER_INTERNAL_AUDIT: | |||
// 当前项目状态是部门联审中 | |||
case DEPARTMENT_JOINT_REVIEW: | |||
//如果是 区县 并且 500万及以上要推送省局重大项目 | |||
if(!StateMachineUtils.isCityProject(declaredProject) && | |||
StateMachineUtils.judgeDeclareAmount(declaredProject, | |||
ProjectDeclareConst.Number.DECLARE_COUNTY_AMOUNT_JUDGEMENT) ){ | |||
try{ | |||
List<ProjectApplication> applications = projectApplicationService | |||
.list(Wrappers.lambdaQuery(ProjectApplication.class) | |||
.eq(ProjectApplication::getProjectId,declaredProject.getId())); | |||
joinReviewProvincialBureauService.pushImportProject( | |||
ApplicationConverter.convertProject(declaredProject,applications,fileService)); | |||
}catch (Exception e){ | |||
log.info("区县推送省级联审失败[{}],{}", declaredProject.getProjectName() ,e.getMessage()); | |||
log.error("区县推送省级联审失败:" + e); | |||
case DEPARTMENT_JOINT_REVIEW: | |||
//如果是 区县 并且 500万及以上要推送省局重大项目 | |||
if (!StateMachineUtils.isCityProject(declaredProject) && | |||
StateMachineUtils.judgeDeclareAmount(declaredProject, | |||
ProjectDeclareConst.Number.DECLARE_COUNTY_AMOUNT_JUDGEMENT)) { | |||
try { | |||
List<ProjectApplication> applications = projectApplicationService | |||
.list(Wrappers.lambdaQuery(ProjectApplication.class) | |||
.eq(ProjectApplication::getProjectId, declaredProject.getId())); | |||
joinReviewProvincialBureauService.pushImportProject( | |||
ApplicationConverter.convertProject(declaredProject, applications, fileService)); | |||
updatePassProjectStatus(userId, declaredProject); | |||
break; | |||
} catch (Exception e) { | |||
log.info("区县推送省级联审失败[{}],{}", declaredProject.getProjectName(), e.getMessage()); | |||
log.error("区县推送省级联审失败:" + e); | |||
} | |||
} | |||
} | |||
// 当前项目状态是方案评审中 | |||
case SCHEME_UNDER_REVIEW: | |||
// 当前项目状态是终验审核中 | |||
case FINAL_ACCEPTANCE_IS_UNDER_REVIEW: | |||
updatePassProjectStatus(userId, declaredProject); | |||
break; | |||
default: | |||
throw new IllegalStateException("Unexpected value: " + declaredProject.getStatus()); | |||
// 当前项目状态是方案评审中 | |||
case SCHEME_UNDER_REVIEW: | |||
// 当前项目状态是终验审核中 | |||
case FINAL_ACCEPTANCE_IS_UNDER_REVIEW: | |||
updatePassProjectStatus(userId, declaredProject); | |||
break; | |||
default: | |||
throw new BizException("传入项目状态错误: " + declaredProject.getStatus()); | |||
} | |||
} | |||
//发送消息 | |||
noticeManage.sendNotice(instance.getStartUserId(),userId,declaredProject,instance.getProcessDefinitionName(), | |||
@@ -178,6 +208,26 @@ public class HandlerManage { | |||
} | |||
} | |||
private void updateProjectDelayApplyInfo(Project declaredProject, String instanceId) { | |||
// 获取延期申请填写的相关信息 | |||
ProjectDelayApply delayApply = projectDelayApplyService.getOne(Wrappers.lambdaQuery(ProjectDelayApply.class) | |||
.eq(ProjectDelayApply::getProjectId, declaredProject.getId()) | |||
.eq(ProjectDelayApply::getInstanceId, instanceId)); | |||
// 获取项目的立项批复时间和建设周期 | |||
LocalDateTime approvalDate = declaredProject.getApprovalDate(); | |||
String buildCycle = declaredProject.getBuildCycle(); | |||
// 重新计算建设周期、验收时间 | |||
String constructCycle = buildCycle + delayApply.getDelayTime(); | |||
declaredProject.setBuildCycle(constructCycle); | |||
Long delayedMonth = Long.valueOf(delayApply.getDelayTime()); | |||
String acceptTime = NdDateUtils.format(approvalDate.plusMonths(delayedMonth), DatePattern.NORM_DATETIME_MINUTE_PATTERN); | |||
declaredProject.setBuildCycle(acceptTime); | |||
declaredProject.setInstCode(instanceId); | |||
declaredProject.setApplyDelayFile(delayApply.getDelayApplyFile()); | |||
declaredProject.setApplyDelayReason(delayApply.getDelayApplyReason()); | |||
projectService.updateById(declaredProject); | |||
} | |||
/** | |||
* 驳回后 所处理的逻辑 | |||