Browse Source

modify:

1. 增加申报暂存接口;
tags/24102401
WendyYang 1 month ago
parent
commit
3140900b60
5 changed files with 94 additions and 1 deletions
  1. +7
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/controller/DeclaredProjectController.java
  2. +34
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/DeclaredProjectManage.java
  3. +48
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectLibManage.java
  4. +1
    -1
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/dto/ProjectDTO.java
  5. +4
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/vo/ProjectDetailVO.java

+ 7
- 0
hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/controller/DeclaredProjectController.java View File

@@ -91,6 +91,13 @@ public class DeclaredProjectController {
return "启动流程实例 【" + instanceId + "】 成功";
}

@ApiOperation("申报项目暂存")
@WebLog("申报项目暂存")
@PostMapping("/store")
public void store(@Validated @RequestBody DefaultDeclaredDTO dto) {
declaredProjectManage.store(dto);
}

@ApiOperation(value = "重新申报项目", notes = "重新申报项目")
@WebLog("重新申报项目")
@PostMapping("/restart")


+ 34
- 0
hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/DeclaredProjectManage.java View File

@@ -111,6 +111,40 @@ public class DeclaredProjectManage {
* @return \
*/
@Transactional(rollbackFor = Exception.class)
public synchronized void store(DefaultDeclaredDTO req) {
UserInfoDetails user = LoginUserUtil.loginUserDetail();
ProjectDTO reqProj = req.getProjectInfo();
reqProj.setBuildOrgCode(user.getMhUnitIdStr());
reqProj.setBuildOrgName(user.getMhUnitName());
//项目名称去重
declaredProjectHelper.projectNameDuplicateCheck(reqProj);
//判断申报金额 是否等于总的 判断年度支付金额 是否等于总金额
declaredProjectHelper.checkAmount(reqProj);
//写死 是否有主管单位
reqProj.setIsHigherSuperOrg(CommonEnum.YES.getCode());
reqProj.setIsSuperOrg(CommonEnum.YES.getCode());

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

//如果是重新提交的话 判断下 项目是否存在
if (Objects.nonNull(reqProj.getId())) {
//新申报的项目不允许带项目id
reqProj.setId(null);
}
projectLibManage.saveProjectNewVersion(reqProj, user.getUserId(), ProjectStatus.TO_BE_DECLARED);
}

/**
* 新项目 启动实例
*
* @param req \
* @return \
*/
@Transactional(rollbackFor = Exception.class)
public synchronized String startTheProcess(DefaultDeclaredDTO req) {
UserInfoDetails user = LoginUserUtil.loginUserDetail();



+ 48
- 0
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectLibManage.java View File

@@ -16,6 +16,7 @@ import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.hz.pm.api.common.compare.CompareUtils;
import com.hz.pm.api.common.enumeration.ProjectProcessType;
import com.hz.pm.api.common.exception.ReturnException;
import com.hz.pm.api.common.helper.UserInfoHelper;
import com.hz.pm.api.common.model.constant.BizConst;
import com.hz.pm.api.common.model.constant.CommonConst;
@@ -712,6 +713,16 @@ public class ProjectLibManage {
BeanUtils.copyProperties(project, retProjectDetail);
retProjectDetail.buildDynamicForm(project.getDynamicForm());
String projectCode = project.getProjectCode();
if (ProjectStatus.CHANGE_APPLY_PASSED.eq(project.getStatus())) {
Wrapper<Project> newProjectQuery = Wrappers.lambdaQuery(Project.class)
.select(Project::getId, Project::getProjectCode)
.eq(Project::getHisProjectCode, project.getHisProjectCode())
.eq(Project::getNewest, Boolean.TRUE)
.last(BizConst.LIMIT_1);
Project newProject = projectService.getOne(newProjectQuery);
retProjectDetail.setNewProjectId(newProject.getId());
retProjectDetail.setNewProjectCode(newProject.getProjectCode());
}
if (StrUtil.isNotBlank(project.getHisProjectCode())) {
retProjectDetail.setHisProjectId(ProjectIdCodeCacheUtil.newest(project.getHisProjectCode()));
}
@@ -913,6 +924,43 @@ public class ProjectLibManage {
}
}

public Project saveProjectNewVersion(ProjectDTO reqProj,
Long userId,
ProjectStatus status) {
try {
Project newProj = new Project();
BeanUtils.copyProperties(reqProj, newProj);
newProj.setCreateOn(LocalDateTime.now());
newProj.setUpdateOn(LocalDateTime.now());
newProj.setIsBackReject(Boolean.FALSE);
newProj.setStage(status.getStage());
newProj.setStatus(status.getCode());
newProj.setSponsor(String.valueOf(userId));
if (Objects.isNull(reqProj.getId())) {
newProj.setProjectCode(projectCodeGenUtil.generateProjectCode(reqProj));
} else {
Project oldProj = projectService.getById(reqProj.getId());
if (ProjectStatus.TO_BE_DECLARED.eq(status)
&& !ProjectStatus.TO_BE_DECLARED.eq(oldProj.getStatus())) {
throw ReturnException.wrap("项目状态异常,保存失败");
}
newProj.setVersion(oldProj.getVersion() + 1);
projectService.reverseNewest(newProj.getProjectCode(), newProj.getId());
}
newProj.setId(null);
newProj.setNewest(Boolean.TRUE);
if (projectService.save(newProj)) {
projectSaveHelper.saveApplication(reqProj, newProj, null);
projectSaveHelper.savePaymentPlans(newProj, reqProj.getPaymentPlanList());
projectSaveHelper.saveGovSystemReplaceInfos(newProj.getId(), newProj.getProjectCode(), reqProj.getSystemReplaceInfos());
}
return newProj;
} catch (Exception e) {
log.error("项目信息入库错误", e);
throw BizException.wrap("项目信息入库错误");
}
}


/**
* 在其它项目阶段 保存项目信息和其它相关联的信息


+ 1
- 1
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/dto/ProjectDTO.java View File

@@ -54,7 +54,7 @@ public class ProjectDTO implements Serializable {
private String baseBasisAmountOri;

@ApiModelProperty("是否临时增补 0:否 1:是")
private Integer isTemporaryAugment;
private Integer isTemporaryAugment = 0;

@ApiModelProperty("项目负责人")
private String responsibleMan;


+ 4
- 0
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/vo/ProjectDetailVO.java View File

@@ -604,4 +604,8 @@ public class ProjectDetailVO {
@ApiModelProperty("历史项目id")
private Long hisProjectId;

private String newProjectCode;

private Long newProjectId;

}

Loading…
Cancel
Save