@@ -56,6 +56,6 @@ public class ProjectAdjustmentController { | |||
@PostMapping | |||
public String startTheProcess(@Validated @RequestBody DefaultDeclaredDTO dto) { | |||
String instanceId = projectAdjustmentManage.adjustment(dto); | |||
return "建设方案申报 【" + instanceId + "】 成功"; | |||
return "项目内容调整并且重新申报 【" + instanceId + "】 成功"; | |||
} | |||
} |
@@ -24,6 +24,7 @@ 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; | |||
import java.time.LocalDateTime; | |||
import java.util.Collections; | |||
@@ -57,6 +58,7 @@ public class ConstructionPlanManage { | |||
* @param dto | |||
* @return | |||
*/ | |||
@Transactional(rollbackFor = Exception.class) | |||
public String startTheProcess(DefaultDeclaredDTO dto) { | |||
ProjectDTO projectDto = dto.getProjectInfo(); | |||
VUtils.isTrue(Objects.isNull(projectDto.getId())).throwMessage("提交失败 缺少项目ID!"); | |||
@@ -34,6 +34,7 @@ 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; | |||
import java.time.LocalDateTime; | |||
import java.util.Collections; | |||
@@ -65,6 +66,8 @@ public class DeclaredProjectManage { | |||
private final IProjectInstService projectInstService; | |||
private final DefaultDeclaredProjectManage defaultDeclaredProjectManage; | |||
public PageVo<ProjectDraftVO> pageDraft(DeclaredProjectListParamDTO params) { | |||
Page<ProjectDraft> page = params.page(); | |||
LambdaQueryWrapper<ProjectDraft> wrapper = Wrappers.lambdaQuery(ProjectDraft.class) | |||
@@ -108,6 +111,7 @@ public class DeclaredProjectManage { | |||
* @param dto | |||
* @return | |||
*/ | |||
@Transactional(rollbackFor = Exception.class) | |||
public String startTheProcess(DefaultDeclaredDTO dto) { | |||
ProjectDTO projectInfo = dto.getProjectInfo(); | |||
String regionCode = projectInfo.getAreaCode(); | |||
@@ -122,6 +126,9 @@ public class DeclaredProjectManage { | |||
throw new BusinessException(String.format("此 【%s】区域找不到单位流程配置", regionCode)); | |||
} | |||
//项目名称去重 | |||
defaultDeclaredProjectManage.checkDuplication(projectInfo); | |||
ProcessStartParamsVo params = new ProcessStartParamsVo(); | |||
params.setUser(dto.getUser()); | |||
params.setProcessUsers(Collections.emptyMap()); | |||
@@ -133,6 +140,7 @@ public class DeclaredProjectManage { | |||
}) | |||
); | |||
params.setFormData(dto.getFormData()); | |||
//开始申报 | |||
String instanceId = processService.startProcess(model.getProcessDefId(), params); | |||
log.info("申报项目成功 【{}】", instanceId); | |||
@@ -148,6 +156,7 @@ public class DeclaredProjectManage { | |||
* @param dto | |||
* @return | |||
*/ | |||
@Transactional(rollbackFor = Exception.class) | |||
public String reStartTheProcess(DefaultDeclaredDTO dto) { | |||
ProjectDTO projectDto = dto.getProjectInfo(); | |||
VUtils.isTrue(Objects.isNull(projectDto.getId())).throwMessage("提交失败 缺少项目ID!"); | |||
@@ -1,14 +1,14 @@ | |||
package com.ningdatech.pmapi.projectdeclared.manage; | |||
import com.google.common.collect.Maps; | |||
import com.ningdatech.pmapi.projectdeclared.model.dto.DefaultDeclaredDTO; | |||
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; | |||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||
import com.ningdatech.basic.function.VUtils; | |||
import com.ningdatech.pmapi.projectlib.model.dto.ProjectDTO; | |||
import com.ningdatech.pmapi.projectlib.model.entity.Project; | |||
import com.ningdatech.pmapi.projectlib.service.IProjectService; | |||
import lombok.RequiredArgsConstructor; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.stereotype.Component; | |||
import javax.annotation.PostConstruct; | |||
import java.util.Map; | |||
import java.util.function.Function; | |||
import java.util.Objects; | |||
/** | |||
* @Classname DefaultDeclaredProjectManage | |||
@@ -22,28 +22,14 @@ import java.util.function.Function; | |||
@RequiredArgsConstructor | |||
public class DefaultDeclaredProjectManage { | |||
private final DeclaredProjectManage declaredProjectManage; | |||
private final IProjectService projectService; | |||
private final ConstructionPlanManage constructionPlanManage; | |||
private final PrequalificationDeclaredProjectManage prequalificationDeclaredProjectManage; | |||
public Map<Integer, Function<DefaultDeclaredDTO,String>> startProcessMap = Maps.newHashMap(); | |||
/** | |||
* 初始化业务分派逻辑,代替了if-else部分 | |||
* key: 枚举 状态值 | |||
* value: lambda表达式,最终会获取发起实例的函数 | |||
*/ | |||
@PostConstruct | |||
public void startProcessInit(){ | |||
startProcessMap.put(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS.getCode(), | |||
dto->declaredProjectManage.reStartTheProcess(dto)); | |||
startProcessMap.put(ProjectStatusEnum.SCHEME_REVIEW_FAILED.getCode(), | |||
dto->constructionPlanManage.startTheProcess(dto)); | |||
startProcessMap.put(ProjectStatusEnum.PREQUALIFICATION_FAILED.getCode(), | |||
dto->prequalificationDeclaredProjectManage.startTheProcess(dto)); | |||
startProcessMap.put(ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED.getCode(), | |||
dto->null); | |||
//项目名称去重 | |||
public void checkDuplication(ProjectDTO project){ | |||
VUtils.isTrue(projectService.count(Wrappers.lambdaQuery(Project.class) | |||
.eq(Project::getProjectName,project.getProjectName()) | |||
.ne(Objects.nonNull(project.getId()),Project::getId,project.getId())) > 0) | |||
.throwMessage(String.format("修改失败 此项目名 【%s】 已存在!",project.getProjectName())); | |||
} | |||
} |
@@ -24,6 +24,7 @@ import lombok.RequiredArgsConstructor; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.beans.BeanUtils; | |||
import org.springframework.stereotype.Component; | |||
import org.springframework.transaction.annotation.Transactional; | |||
import java.time.LocalDateTime; | |||
import java.util.Collections; | |||
@@ -57,6 +58,7 @@ public class PrequalificationDeclaredProjectManage { | |||
* @param dto | |||
* @return | |||
*/ | |||
@Transactional(rollbackFor = Exception.class) | |||
public String startTheProcess(DefaultDeclaredDTO dto) { | |||
ProjectDTO projectDto = dto.getProjectInfo(); | |||
VUtils.isTrue(Objects.isNull(projectDto.getId())).throwMessage("提交失败 缺少项目ID!"); | |||
@@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollUtil; | |||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||
import com.ningdatech.basic.function.VUtils; | |||
import com.ningdatech.pmapi.projectdeclared.model.dto.DefaultDeclaredDTO; | |||
import com.ningdatech.pmapi.projectdeclared.utils.ReStartProcessMapUtil; | |||
import com.ningdatech.pmapi.projectlib.model.dto.ProjectDTO; | |||
import com.ningdatech.pmapi.projectlib.model.entity.Project; | |||
import com.ningdatech.pmapi.projectlib.model.entity.ProjectApplication; | |||
@@ -14,6 +15,8 @@ import lombok.RequiredArgsConstructor; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.beans.BeanUtils; | |||
import org.springframework.stereotype.Component; | |||
import org.springframework.transaction.annotation.Transactional; | |||
import java.time.LocalDateTime; | |||
import java.util.List; | |||
import java.util.Objects; | |||
@@ -35,6 +38,8 @@ public class ProjectAdjustmentManage { | |||
private final IProjectApplicationService projectApplicationService; | |||
private final ReStartProcessMapUtil reStartProcessMapUtil; | |||
private final DefaultDeclaredProjectManage defaultDeclaredProjectManage; | |||
/** | |||
@@ -42,12 +47,16 @@ public class ProjectAdjustmentManage { | |||
* @param dto | |||
* @return | |||
*/ | |||
@Transactional(rollbackFor = Exception.class) | |||
public String adjustment(DefaultDeclaredDTO dto) { | |||
ProjectDTO projectDto = dto.getProjectInfo(); | |||
Project projectInfo = projectService.getById(projectDto.getId()); | |||
VUtils.isTrue(Objects.isNull(projectInfo)).throwMessage("调整失败 此项目不存在!"); | |||
//项目名称去重 | |||
defaultDeclaredProjectManage.checkDuplication(projectDto); | |||
//先修改项目信息 | |||
Project project = new Project(); | |||
BeanUtils.copyProperties(projectDto,project); | |||
@@ -72,7 +81,7 @@ public class ProjectAdjustmentManage { | |||
//最后去重新 提交项目流程 不同的状态 提交到不同的工作流去 | |||
Function<DefaultDeclaredDTO, String> declaredFunction = | |||
defaultDeclaredProjectManage.startProcessMap.get(project.getStatus()); | |||
reStartProcessMapUtil.reStartProcessMap.get(projectInfo.getStatus()); | |||
VUtils.isTrue(Objects.isNull(declaredFunction)).throwMessage("状态不正常 没有找到对应申报函数!"); | |||
return declaredFunction.apply(dto); | |||
} | |||
@@ -1,6 +1,7 @@ | |||
package com.ningdatech.pmapi.projectdeclared.model.dto; | |||
import com.ningdatech.basic.model.PagePo; | |||
import io.swagger.annotations.ApiModelProperty; | |||
import lombok.AllArgsConstructor; | |||
import lombok.Builder; | |||
import lombok.Data; | |||
@@ -19,21 +20,29 @@ import org.springframework.format.annotation.DateTimeFormat; | |||
@AllArgsConstructor | |||
public class DeclaredProjectListParamDTO extends PagePo { | |||
@ApiModelProperty("用户ID") | |||
private String userId; | |||
@ApiModelProperty("项目名称") | |||
private String projectName; | |||
@ApiModelProperty("项目类型 1建设 2运维") | |||
private Integer projectType; | |||
@ApiModelProperty("项目阶段") | |||
private Integer projectStage; | |||
@ApiModelProperty("项目状态") | |||
private Integer projectStatus; | |||
@ApiModelProperty("项目年份") | |||
private Integer projectYear; | |||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") | |||
@ApiModelProperty("开始时间") | |||
private String startTime; | |||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") | |||
@ApiModelProperty("结束时间") | |||
private String endTime; | |||
} |
@@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollUtil; | |||
import com.google.common.collect.Maps; | |||
import com.ningdatech.pmapi.projectlib.model.dto.ProjectDTO; | |||
import com.wflow.workflow.bean.dto.ProcessInstanceUserDto; | |||
import io.swagger.annotations.ApiModelProperty; | |||
import lombok.AllArgsConstructor; | |||
import lombok.Data; | |||
import lombok.NoArgsConstructor; | |||
@@ -24,11 +25,14 @@ import java.util.Map; | |||
public class DefaultDeclaredDTO implements Serializable { | |||
@NotNull | |||
@ApiModelProperty("项目信息") | |||
private ProjectDTO projectInfo; | |||
@ApiModelProperty("表单信息 保留") | |||
private Map<String,Object> formData; | |||
@NotNull | |||
@ApiModelProperty("用户信息 暂时填一下") | |||
private ProcessInstanceUserDto user; | |||
public Map<String,Object> getFormData(){ | |||
@@ -3,6 +3,7 @@ package com.ningdatech.pmapi.projectdeclared.model.dto; | |||
import com.ningdatech.pmapi.projectlib.model.dto.ProjectDTO; | |||
import com.wflow.workflow.bean.dto.ProcessInstanceUserDto; | |||
import io.swagger.annotations.ApiModel; | |||
import io.swagger.annotations.ApiModelProperty; | |||
import lombok.*; | |||
import javax.validation.constraints.NotNull; | |||
import java.io.Serializable; | |||
@@ -26,9 +27,11 @@ public class ProjectDraftSaveDTO implements Serializable { | |||
private static final long serialVersionUID = 1L; | |||
@NotNull | |||
@ApiModelProperty("项目信息") | |||
private ProjectDTO projectInfo; | |||
@NotNull | |||
@ApiModelProperty("用户信息") | |||
private ProcessInstanceUserDto user; | |||
} |
@@ -0,0 +1,47 @@ | |||
package com.ningdatech.pmapi.projectdeclared.utils; | |||
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.model.dto.DefaultDeclaredDTO; | |||
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; | |||
import lombok.RequiredArgsConstructor; | |||
import org.springframework.stereotype.Component; | |||
import javax.annotation.PostConstruct; | |||
import java.util.Map; | |||
import java.util.function.Function; | |||
/** | |||
* @Classname ReSubmitProcessMap | |||
* @Description 项目调整 重新提交时的 事件函数MAP | |||
* @Date 2023/2/15 11:19 | |||
* @Author PoffyZhang | |||
*/ | |||
@Component | |||
@RequiredArgsConstructor | |||
public class ReStartProcessMapUtil { | |||
private final DeclaredProjectManage declaredProjectManage; | |||
private final ConstructionPlanManage constructionPlanManage; | |||
private final PrequalificationDeclaredProjectManage prequalificationDeclaredProjectManage; | |||
public Map<Integer, Function<DefaultDeclaredDTO,String>> reStartProcessMap = Maps.newHashMap(); | |||
/** | |||
* 初始化业务分派逻辑,代替了if-else部分 | |||
* key: 枚举 状态值 | |||
* value: lambda表达式,最终会获取发起实例的函数 | |||
*/ | |||
@PostConstruct | |||
public void reStartProcessInit(){ | |||
reStartProcessMap.put(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS.getCode(), | |||
dto->declaredProjectManage.reStartTheProcess(dto)); | |||
reStartProcessMap.put(ProjectStatusEnum.SCHEME_REVIEW_FAILED.getCode(), | |||
dto->constructionPlanManage.startTheProcess(dto)); | |||
reStartProcessMap.put(ProjectStatusEnum.PREQUALIFICATION_FAILED.getCode(), | |||
dto->prequalificationDeclaredProjectManage.startTheProcess(dto)); | |||
reStartProcessMap.put(ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED.getCode(), | |||
dto->null); | |||
} | |||
} |
@@ -36,12 +36,6 @@ public class ProjectApplicationDTO implements Serializable { | |||
@ApiModelProperty("创建时间") | |||
private LocalDateTime createOn; | |||
@ApiModelProperty("更新时间") | |||
private LocalDateTime updateOn; | |||
@ApiModelProperty("删除时间") | |||
private LocalDateTime deleteOn; | |||
@ApiModelProperty("关联IRS现有应用") | |||
private String relatedExistsApplication; | |||
@@ -162,8 +156,4 @@ public class ProjectApplicationDTO implements Serializable { | |||
@ApiModelProperty("试点文件") | |||
private String experimentsFile; | |||
private Long createBy; | |||
private Long updateBy; | |||
} |
@@ -34,12 +34,6 @@ public class ProjectDTO implements Serializable { | |||
@ApiModelProperty("所属地区名称") | |||
private String area; | |||
@ApiModelProperty("项目阶段") | |||
private Integer stage; | |||
@ApiModelProperty("项目状态") | |||
private Integer status; | |||
@ApiModelProperty("项目名称") | |||
private String projectName; | |||
@@ -231,13 +225,6 @@ public class ProjectDTO implements Serializable { | |||
@ApiModelProperty("一地创新全省共享项目-是否开启 false:关闭 true:开启") | |||
private Boolean isInnovateWholeProvinceShare; | |||
private LocalDateTime createOn; | |||
private LocalDateTime updateOn; | |||
@ApiModelProperty("流程实例编号") | |||
private String instCode; | |||
@ApiModelProperty("安全投入-模块信息") | |||
private String safetyInputModular; | |||
@@ -274,12 +261,6 @@ public class ProjectDTO implements Serializable { | |||
@ApiModelProperty("前端所需验证字段") | |||
private Integer allApplicationsDone; | |||
@ApiModelProperty("流程实例id") | |||
private String processInsId; | |||
@ApiModelProperty("流程实例 formId") | |||
private String formId; | |||
@ApiModelProperty("项目应用实例") | |||
private List<ProjectApplicationDTO> applicationList; | |||
@@ -289,8 +270,4 @@ public class ProjectDTO implements Serializable { | |||
@ApiModelProperty("动态表单 json") | |||
private Map<String,Object> dynamicForm; | |||
private Long createBy; | |||
private Long updateBy; | |||
} |