Explorar el Código

立项备案增加状态校验

tags/24080901
WendyYang hace 5 meses
padre
commit
919e091f0c
Se han modificado 2 ficheros con 23 adiciones y 20 borrados
  1. +23
    -19
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/DeclaredRecordManage.java
  2. +0
    -1
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectLibManage.java

+ 23
- 19
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/DeclaredRecordManage.java Ver fichero

@@ -232,23 +232,28 @@ public class DeclaredRecordManage {

@Transactional(rollbackFor = Exception.class)
public synchronized void startDeclaredRecord(DefaultDeclaredDTO req) {
ProjectDTO projectInfo = req.getProjectInfo();
ProjectDTO reqProj = req.getProjectInfo();
UserInfoDetails user = LoginUserUtil.loginUserDetail();

projectInfo.setBuildOrgCode(user.getMhUnitIdStr());
projectInfo.setBuildOrgName(user.getMhUnitName());
reqProj.setBuildOrgCode(user.getMhUnitIdStr());
reqProj.setBuildOrgName(user.getMhUnitName());

Project oldProj = projectService.getNoNull(reqProj.getId());

VUtils.isTrue(!ProjectStatus.DECLARED_APPROVED_TO_BE_RECORD.eq(oldProj.getStatus()))
.throwMessage("提交失败,该项目不是立项备案审核不通过状态或者未立项阶段");

// 项目名称去重
declaredProjectHelper.projectNameDuplicateCheck(projectInfo);
declaredProjectHelper.projectNameDuplicateCheck(reqProj);

// 写死 是否有主管单位
projectInfo.setIsHigherSuperOrg(CommonEnum.YES.getCode());
projectInfo.setIsSuperOrg(CommonEnum.YES.getCode());
reqProj.setIsHigherSuperOrg(CommonEnum.YES.getCode());
reqProj.setIsSuperOrg(CommonEnum.YES.getCode());

//如果主管单位没有 那么主管单位就是自己
if (CommonEnum.NO.getCode().equals(projectInfo.getIsSuperOrg())) {
projectInfo.setSuperOrgCode(user.getMhUnitIdStr());
projectInfo.setSuperOrg(user.getMhUnitName());
if (CommonEnum.NO.getCode().equals(reqProj.getIsSuperOrg())) {
reqProj.setSuperOrgCode(user.getMhUnitIdStr());
reqProj.setSuperOrg(user.getMhUnitName());
}

ProjectProcessType instType = ProjectProcessType.PROJECT_RECORD_APPROVAL_PROCESS;
@@ -265,25 +270,25 @@ public class DeclaredRecordManage {
//开始申报
// 获取发起单位、发起单位主管单位、发起单位上级主管条线单位信息
Project project = new Project();
BeanUtils.copyProperties(projectInfo, project);
BeanUtils.copyProperties(reqProj, project);
Map<String, OrgInfoDTO> orgModelMap = declaredProjectHelper.buildOrgModelMap(user, project);
String instanceId = processInstanceService.startProcessLs(model, params, orgModelMap);
log.info("立项备案成功 【{}】", instanceId);

// 如果是重新提交的话 判断下 项目是否存在
// 保存项目相关
Project newProj = projectLibManage.saveProjectInDeclared(projectInfo, instanceId, user.getUserId(),
Project newProj = projectLibManage.saveProjectInDeclared(reqProj, instanceId, user.getUserId(),
ProjectStatus.NOT_APPROVED, ProjectStatus.DECLARED_APPROVED_TO_BE_RECORD,
ProjectProcessType.PROJECT_RECORD_APPROVAL_PROCESS);
if (Objects.nonNull(projectInfo.getDraftId())) {
if (Objects.nonNull(reqProj.getDraftId())) {
//如果是草稿箱提交 删除对应的草稿箱
projectDraftService.removeById(projectInfo.getDraftId());
projectDraftService.removeById(reqProj.getDraftId());
}
if (projectInfo.getMhProjectId() != null) {
if (reqProj.getMhProjectId() != null) {
// 申报项目完成后 保存项目编码
Wrapper<MhProject> update = Wrappers.lambdaUpdate(MhProject.class)
.set(MhProject::getProjectCode, newProj.getProjectCode())
.eq(MhProject::getId, projectInfo.getMhProjectId());
.eq(MhProject::getId, reqProj.getMhProjectId());
mhProjectService.update(update);
}
//发送给第一个审批人消息
@@ -303,6 +308,9 @@ public class DeclaredRecordManage {

Project oldProj = projectService.getNoNull(reqProj.getId());

VUtils.isTrue(!ProjectStatus.DECLARED_APPROVED_RECORD_FAILED.eq(oldProj.getStatus()))
.throwMessage("提交失败,该项目不是立项备案审核不通过状态或者未立项阶段");

//项目名称去重
if (StrUtil.isNotBlank(reqProj.getProjectName()) &&
!reqProj.getProjectName().equals(oldProj.getProjectName())) {
@@ -328,10 +336,6 @@ public class DeclaredRecordManage {
ProjectProcessType instType = ProjectProcessType.PROJECT_RECORD_APPROVAL_PROCESS;
WflowModels model = processModelManage.getWflowModelsNoNull(instType, user.getMhUnitId());

VUtils.isTrue(!ProjectStatus.DECLARED_APPROVED_RECORD_FAILED.eq(oldProj.getStatus()) ||
!ProjectStatus.NOT_APPROVED.eq(oldProj.getStage()))
.throwMessage("提交失败,该项目不是立项备案审核不通过状态或者未立项阶段");

ProcessStartParamsVo params = new ProcessStartParamsVo();
params.setUser(declaredProjectHelper.buildUser(user));
params.setProcessUsers(Collections.emptyMap());


+ 0
- 1
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectLibManage.java Ver fichero

@@ -924,7 +924,6 @@ public class ProjectLibManage {
.setIgnoreError(Boolean.TRUE).setIgnoreNullValue(Boolean.TRUE));
newProj.setVersion(oldProj.getVersion() + 1);
newProj.setId(null);
newProj.setNewest(Boolean.TRUE);
newProj.setCreateOn(LocalDateTime.now());
newProj.setUpdateOn(LocalDateTime.now());
newProj.setIsBackReject(Boolean.FALSE);


Cargando…
Cancelar
Guardar