Browse Source

modify:

1. 项目变更列表权限修改;
tags/24102401
WendyYang 1 month ago
parent
commit
6387e155a2
3 changed files with 37 additions and 23 deletions
  1. +31
    -23
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectChangeManage.java
  2. +3
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectLibManage.java
  3. +3
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/vo/ProjectDetailVO.java

+ 31
- 23
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectChangeManage.java View File

@@ -11,11 +11,13 @@ 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.exception.ReturnException;
import com.hz.pm.api.common.util.BizUtils;
import com.hz.pm.api.external.model.enumeration.MhUnitStripEnum;
import com.hz.pm.api.projectdeclared.model.entity.ProjectChangeHistory;
import com.hz.pm.api.projectdeclared.manage.DeclaredProjectHelper;
import com.hz.pm.api.projectdeclared.model.dto.*;
import com.hz.pm.api.projectdeclared.model.dto.EditProjectDTO;
import com.hz.pm.api.projectdeclared.model.dto.EditProjectDetailDTO;
import com.hz.pm.api.projectdeclared.model.dto.EditPurchaseDTO;
import com.hz.pm.api.projectdeclared.model.dto.EditPurchaseDetailDTO;
import com.hz.pm.api.projectdeclared.model.entity.ProjectChangeHistory;
import com.hz.pm.api.projectdeclared.model.vo.*;
import com.hz.pm.api.projectdeclared.service.IProjectChangeHistoryService;
import com.hz.pm.api.projectdeclared.utils.ProjectDetailDiffUtil;
@@ -38,6 +40,8 @@ import com.hz.pm.api.projectlib.model.vo.ProjectLibListItemVO;
import com.hz.pm.api.projectlib.service.IProjectInstService;
import com.hz.pm.api.projectlib.service.IProjectService;
import com.hz.pm.api.sys.manage.ProcessModelManage;
import com.hz.pm.api.user.helper.MhUnitQueryAuthHelper;
import com.hz.pm.api.user.helper.MhUnitQueryAuthHelper.UnitQueryState;
import com.hz.pm.api.user.security.model.UserInfoDetails;
import com.hz.pm.api.user.util.LoginUserUtil;
import com.ningdatech.basic.exception.BizException;
@@ -80,6 +84,7 @@ public class ProjectChangeManage {
private final ProjectChangeStopHelper projectChangeStopHelper;
private final ProjectLibManage projectLibManage;
private final IProjectChangeHistoryService projectChangeHistoryService;
private final MhUnitQueryAuthHelper mhUnitQueryAuthHelper;

@Transactional(rollbackFor = Exception.class)
public synchronized void submitProjectChangeApplyNew(SubmitProjectChangeApplyReq req) {
@@ -226,9 +231,13 @@ public class ProjectChangeManage {
public PageVo<ProjectChangeListVO> page(ProjectListReq req) {
LambdaQueryWrapper<Project> wrapper = ProjectManageUtil.projectQuery(req)
.eq(Project::getNewest, Boolean.TRUE);
UserInfoDetails userDetail = LoginUserUtil.loginUserDetail();
if (!userDetail.hasSuperAdmin()) {
wrapper.eq(Project::getBuildOrgCode, userDetail.getMhUnitIdStr());
Long buildOrgCode = req.clearBuildOrgCode();
UnitQueryState unitQueryState = mhUnitQueryAuthHelper.listCanViewUnitIds(buildOrgCode);
if (!unitQueryState.isState()) {
return PageVo.empty();
}
if (CollUtil.isNotEmpty(unitQueryState.getUnitIds())) {
wrapper.in(Project::getBuildOrgCode, CollUtils.convert(unitQueryState.getUnitIds(), String::valueOf));
}
Page<ProjectChangeListDTO> page = projectService.pageChangeList(wrapper, req.page());
if (page.getTotal() == 0) {
@@ -246,11 +255,17 @@ public class ProjectChangeManage {

public ProjectChangeDetailVO changeDetail(Long id) {
ProjectChangeHistory changeHistory = projectChangeHistoryService.getById(id);
return buildProjectChangeDetail(changeHistory);
}

private static ProjectChangeDetailVO buildProjectChangeDetail(ProjectChangeHistory changeHistory) {
if (changeHistory == null) {
return null;
}
ProjectChangeDetailVO result = new ProjectChangeDetailVO();
result.setProjectEditDetail(JSONUtil.toBean(changeHistory.getChangeContent(), EditProjectDetailDTO.class));
if (StrUtil.isNotBlank(changeHistory.getChangeContent())) {
result.setProjectEditDetail(JSONUtil.toBean(changeHistory.getChangeContent(), EditProjectDetailDTO.class));
}
result.setChangeReason(changeHistory.getChangeReason());
result.setCreateOn(changeHistory.getCreateOn());
return result;
@@ -261,16 +276,7 @@ public class ProjectChangeManage {
.eq(ProjectChangeHistory::getProjectId, projectId)
.eq(ProjectChangeHistory::getInstCode, instCode);
ProjectChangeHistory changeHistory = projectChangeHistoryService.getOne(query);
if (changeHistory == null) {
return null;
}
ProjectChangeDetailVO result = new ProjectChangeDetailVO();
if (StrUtil.isNotBlank(changeHistory.getChangeContent())) {
result.setProjectEditDetail(JSONUtil.toBean(changeHistory.getChangeContent(), EditProjectDetailDTO.class));
}
result.setChangeReason(changeHistory.getChangeReason());
result.setCreateOn(changeHistory.getCreateOn());
return result;
return buildProjectChangeDetail(changeHistory);
}

public List<ProjectLibListItemVO> options() {
@@ -281,12 +287,14 @@ public class ProjectChangeManage {
.notExists("select 1 from nd_project_change_history npch where " +
"npch.project_code = nd_project.project_code and npch.status = {0}",
ProjectChangeStatus.CHANGE_FAILED.getCode())
.notIn(Project::getStatus, ProjectStatus.STOPPED_PASSED.getCode(),
ProjectStatus.ON_STOPPED_APPLY.getCode(),
ProjectStatus.ON_CHANGE_APPLY.getCode());
UserInfoDetails userDetail = LoginUserUtil.loginUserDetail();
if (!userDetail.hasSuperAdmin()) {
query.eq(Project::getBuildOrgCode, userDetail.getMhUnitIdStr());
.notIn(Project::getStage, ProjectStatus.STOPPED.getCode(),
ProjectStatus.CHANGE.getCode());
UnitQueryState unitQueryState = mhUnitQueryAuthHelper.listCanViewUnitIds(null);
if (!unitQueryState.isState()) {
return Collections.emptyList();
}
if (CollUtil.isNotEmpty(unitQueryState.getUnitIds())) {
query.in(Project::getBuildOrgCode, CollUtils.convert(unitQueryState.getUnitIds(), String::valueOf));
}
List<Project> projects = projectService.list(query);
return CollUtils.convert(projects, w -> {


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

@@ -712,6 +712,9 @@ public class ProjectLibManage {
BeanUtils.copyProperties(project, retProjectDetail);
retProjectDetail.buildDynamicForm(project.getDynamicForm());
String projectCode = project.getProjectCode();
if (StrUtil.isNotBlank(project.getHisProjectCode())) {
retProjectDetail.setHisProjectId(ProjectIdCodeCacheUtil.newest(project.getHisProjectCode()));
}
if (DecimalUtil.noNullAndGtZero(project.getApprovalAmount())) {
retProjectDetail.setApprovalAmounts(amountApprovalManage.listApprovalAmounts(projectCode));
}


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

@@ -601,4 +601,7 @@ public class ProjectDetailVO {
@ApiModelProperty("历史项目编码")
private String hisProjectCode;

@ApiModelProperty("历史项目id")
private Long hisProjectId;

}

Loading…
Cancel
Save