瀏覽代碼

modify:

1. 项目终止修改;
tags/24080901
WendyYang 5 月之前
父節點
當前提交
117ddf279e
共有 11 個檔案被更改,包括 117 行新增10 行删除
  1. +8
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/controller/ProjectStoppedChangeController.java
  2. +5
    -2
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/helper/ProjectChangeStopHelper.java
  3. +1
    -1
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectChangeManage.java
  4. +31
    -2
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectStoppedManage.java
  5. +3
    -3
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/entity/ProjectStatusChange.java
  6. +11
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/enumeration/status/ProjectStatus.java
  7. +2
    -1
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/enumeration/status/ProjectStoppedStatus.java
  8. +13
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/req/SubmitProjectStoppedApplyReq.java
  9. +40
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/vo/ProjectStoppedDetailVO.java
  10. +2
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/sys/controller/SysProcDefController.java
  11. +1
    -1
      hz-pm-api/src/main/java/com/hz/pm/api/sys/manage/InitProcessManage.java

+ 8
- 0
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/controller/ProjectStoppedChangeController.java 查看文件

@@ -8,6 +8,7 @@ import com.hz.pm.api.projectlib.model.req.SubmitProjectStoppedApplyReq;
import com.hz.pm.api.projectlib.model.vo.ProjectChangeDetailVO;
import com.hz.pm.api.projectlib.model.vo.ProjectChangeListVO;
import com.hz.pm.api.projectlib.model.vo.ProjectLibListItemVO;
import com.hz.pm.api.projectlib.model.vo.ProjectStoppedDetailVO;
import com.ningdatech.basic.model.PageVo;
import com.ningdatech.log.annotation.WebLog;
import io.swagger.annotations.Api;
@@ -35,6 +36,13 @@ public class ProjectStoppedChangeController {
private final ProjectStoppedManage projectStoppedManage;
private final ProjectChangeManage projectChangeManage;

@GetMapping("/stopped/detail/{projectId}")
@ApiOperation("项目终止详情")
@WebLog("项目终止详情")
public ProjectStoppedDetailVO stoppedDetail(@PathVariable("projectId") Long projectId) {
return projectStoppedManage.detail(projectId);
}

@PostMapping("/stopped/submitApply")
@ApiOperation("提交项目终止申请")
@WebLog("提交项目终止申请")


+ 5
- 2
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/helper/ProjectChangeStopHelper.java 查看文件

@@ -107,7 +107,8 @@ public class ProjectChangeStopHelper {
.afterStatus(status.getCode())
.build();
projectStatusChangeService.save(projectStatusChange);
project.setStage(project.getStatus() - project.getStatus() % 10000);
project.setStatus(status.getCode());
project.setStage(status.getStage().getCode());
projectService.updateById(project);
List<Purchase> purchases = purchaseService.listByProjectId(project.getId());
List<PurchaseStatusChange> purchaseStatusChanges = CollUtils.convert(purchases,
@@ -189,9 +190,11 @@ public class ProjectChangeStopHelper {
IStatus<Integer, String> bizStatus;
switch (event) {
case STOPPED_APPLY_PASS:
case STOPPED_APPLY_AUTO_PASS:
bizStatus = ProjectStoppedStatus.STOPPED_PASSED;
break;
case STOPPED_APPLY_AUTO_PASS:
bizStatus = ProjectStoppedStatus.STOPPED_AUTO_PASSED;
break;
case STOPPED_APPLY_SUBMIT:
bizStatus = ProjectStoppedStatus.ON_STOPPED_APPLY;
break;


+ 1
- 1
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectChangeManage.java 查看文件

@@ -133,7 +133,7 @@ public class ProjectChangeManage {
ProcessStartParamsVo params = new ProcessStartParamsVo();
params.setUser(declaredProjectHelper.buildUser(userDetail));
params.setProcessUsers(Collections.emptyMap());
params.setFormData(BeanUtil.beanToMap(req));
params.setFormData(BeanUtil.beanToMap(req, false, true));

// 获取发起单位、发起单位主管单位、发起单位上级主管条线单位信息
Map<String, OrgInfoDTO> orgModelMap = declaredProjectHelper.buildOrgModelMap(userDetail, project);


+ 31
- 2
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectStoppedManage.java 查看文件

@@ -1,11 +1,13 @@
package com.hz.pm.api.projectlib.manage;

import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hz.pm.api.common.enumeration.ProjectProcessType;
import com.hz.pm.api.common.statemachine.event.ProjectStateChangeEvent;
import com.hz.pm.api.common.util.BizUtils;
import com.hz.pm.api.external.model.enumeration.MhUnitStripEnum;
import com.hz.pm.api.projectdeclared.manage.DeclaredProjectHelper;
import com.hz.pm.api.projectlib.helper.ProjectChangeStopHelper;
@@ -17,6 +19,7 @@ import com.hz.pm.api.projectlib.model.enumeration.status.ProjectStatus;
import com.hz.pm.api.projectlib.model.req.ProjectListReq;
import com.hz.pm.api.projectlib.model.req.SubmitProjectStoppedApplyReq;
import com.hz.pm.api.projectlib.model.vo.ProjectLibListItemVO;
import com.hz.pm.api.projectlib.model.vo.ProjectStoppedDetailVO;
import com.hz.pm.api.projectlib.service.IProjectInstService;
import com.hz.pm.api.projectlib.service.IProjectService;
import com.hz.pm.api.projectlib.service.IProjectStatusChangeService;
@@ -36,6 +39,7 @@ import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@@ -72,7 +76,7 @@ public class ProjectStoppedManage {
throw BizException.wrap("暂无法提交终止申请");
}
long hasDeclared = projectStatusChangeService.count(Wrappers.lambdaQuery(ProjectStatusChange.class)
.eq(ProjectStatusChange::getProjectId, project.getProjectCode())
.eq(ProjectStatusChange::getProjectCode, project.getProjectCode())
.eq(ProjectStatusChange::getEvent, ProjectStateChangeEvent.DECLARED_RECORD_PASS));

project.setStoppedFiles(req.getStoppedFiles());
@@ -89,7 +93,7 @@ public class ProjectStoppedManage {
ProcessStartParamsVo params = new ProcessStartParamsVo();
params.setUser(declaredProjectHelper.buildUser(userDetail));
params.setProcessUsers(Collections.emptyMap());
params.setFormData(BeanUtil.beanToMap(req));
params.setFormData(BeanUtil.beanToMap(req, false, true));

// 获取发起单位、发起单位主管单位、发起单位上级主管条线单位信息
Map<String, OrgInfoDTO> orgModelMap = declaredProjectHelper.buildOrgModelMap(userDetail, project);
@@ -114,12 +118,23 @@ public class ProjectStoppedManage {
return PageVo.empty();
}
List<Project> records = page.getRecords();
Wrapper<ProjectInst> projectInstQuery = Wrappers.lambdaQuery(ProjectInst.class)
.eq(ProjectInst::getInstType, ProjectProcessType.PROJECT_STOPPED.getCode())
.in(ProjectInst::getProjectId, CollUtils.fieldList(records, Project::getId));
List<ProjectInst> projectInstList = projectInstService.list(projectInstQuery);
Map<Long, ProjectInst> projectInstMap = BizUtils.groupFirstMap(projectInstList,
ProjectInst::getProjectId,
Comparator.comparing(ProjectInst::getCreateOn).reversed());
List<ProjectLibListItemVO> data = records.stream().map(w -> {
ProjectLibListItemVO project = new ProjectLibListItemVO();
project.setProjectName(w.getProjectName());
project.setProjectCode(w.getProjectCode());
project.setStoppedStatus(w.getStoppedStatus());
project.setId(w.getId());
ProjectInst projectInst = projectInstMap.get(w.getId());
if (projectInst != null) {
project.setInstCode(projectInst.getInstCode());
}
project.setStage(w.getStage());
project.setStatus(w.getStatus());
project.setCreateOn(w.getCreateOn());
@@ -151,4 +166,18 @@ public class ProjectStoppedManage {
});
}

public ProjectStoppedDetailVO detail(Long projectId) {
Project project = projectService.getById(projectId);
if (project == null) {
throw BizException.wrap("项目不存在");
}
return ProjectStoppedDetailVO.builder()
.projectId(project.getId())
.projectName(project.getProjectName())
.stoppedStatus(project.getStoppedStatus())
.stoppedReason(project.getStoppedReason())
.stoppedFiles(project.getStoppedFiles())
.build();
}

}

+ 3
- 3
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/entity/ProjectStatusChange.java 查看文件

@@ -1,8 +1,7 @@
package com.hz.pm.api.projectlib.model.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.*;

import java.io.Serializable;
import java.time.LocalDateTime;
import io.swagger.annotations.ApiModel;
@@ -47,6 +46,7 @@ public class ProjectStatusChange implements Serializable {
private String event;

@ApiModelProperty("状态变更发生的时间")
@TableField(fill = FieldFill.INSERT)
private LocalDateTime createOn;

@ApiModelProperty("项目code")


+ 11
- 0
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/enumeration/status/ProjectStatus.java 查看文件

@@ -83,6 +83,17 @@ public enum ProjectStatus implements IStatus<Integer, String> {
private final Integer code;
private final String desc;

/**
* 项目阶段增量
*/
private static final Integer STAGE_INCR = 10000;


public ProjectStatus getStage() {
int stageCode = this.getCode() - this.getCode() % STAGE_INCR;
return getNoNull(stageCode);
}

public static String getDesc(Integer code) {
return get(code).flatMap(w -> Optional.of(w.getDesc())).orElse(StrUtil.EMPTY);
}


+ 2
- 1
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/enumeration/status/ProjectStoppedStatus.java 查看文件

@@ -19,7 +19,8 @@ public enum ProjectStoppedStatus implements IStatus<Integer, String> {
* 项目终止
*/
ON_STOPPED_APPLY(40001, "项目终止审核中"),
STOPPED_PASSED(40002, "项目终止"),
STOPPED_PASSED(40002, "项目终止审核通过"),
STOPPED_AUTO_PASSED(40004, "项目终止审核通过"),
STOPPED_FAILED(40003, "项目终止审核不通过");

private final Integer code;


+ 13
- 0
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/req/SubmitProjectStoppedApplyReq.java 查看文件

@@ -1,7 +1,12 @@
package com.hz.pm.api.projectlib.model.req;

import io.swagger.annotations.ApiModelProperty;
import lombok.Builder;
import lombok.Data;
import lombok.experimental.Tolerate;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;

/**
* <p>
@@ -12,12 +17,20 @@ import lombok.Data;
* @since 11:07 2024/8/5
*/
@Data
@Builder
public class SubmitProjectStoppedApplyReq {

@Tolerate
public SubmitProjectStoppedApplyReq() {
// 默认构造方法
}

@ApiModelProperty(value = "项目id")
@NotNull(message = "项目id不能为空")
private Long projectId;

@ApiModelProperty(value = "项目终止原因")
@NotBlank(message = "项目终止原因不能为空")
private String stoppedReason;

@ApiModelProperty(value = "项目终止附件")


+ 40
- 0
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/vo/ProjectStoppedDetailVO.java 查看文件

@@ -0,0 +1,40 @@
package com.hz.pm.api.projectlib.model.vo;

import io.swagger.annotations.ApiModelProperty;
import lombok.Builder;
import lombok.Data;
import lombok.experimental.Tolerate;

/**
* <p>
* SubmitProjectStoppedApplyReq
* </p>
*
* @author WendyYang
* @since 11:07 2024/8/5
*/
@Data
@Builder
public class ProjectStoppedDetailVO {

@Tolerate
public ProjectStoppedDetailVO() {
// 默认构造方法
}

@ApiModelProperty(value = "项目id")
private Long projectId;

@ApiModelProperty(value = "项目终止状态")
private Integer stoppedStatus;

@ApiModelProperty(value = "项目名称")
private String projectName;

@ApiModelProperty(value = "项目终止原因")
private String stoppedReason;

@ApiModelProperty(value = "项目终止附件")
private String stoppedFiles;

}

+ 2
- 0
hz-pm-api/src/main/java/com/hz/pm/api/sys/controller/SysProcDefController.java 查看文件

@@ -13,6 +13,7 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

@@ -74,6 +75,7 @@ public class SysProcDefController {
}

@GetMapping("/initProcessForUnits")
@PreAuthorize("hasAuthority('SUPER_ADMIN')")
public void initProcessForUnits(@RequestParam Set<Long> unitIds) {
initProcessManage.initProcessForUnits(unitIds);
}


+ 1
- 1
hz-pm-api/src/main/java/com/hz/pm/api/sys/manage/InitProcessManage.java 查看文件

@@ -36,7 +36,7 @@ public class InitProcessManage {
private final ProcessModelService processModelService;

@Transactional(rollbackFor = Exception.class)
public void initProcessForUnits(Set<Long> unitIds) {
public synchronized void initProcessForUnits(Set<Long> unitIds) {
if (CollUtil.isEmpty(unitIds)) {
return;
}


Loading…
取消
儲存