Quellcode durchsuchen

modify:

1. 项目变更修改;
tags/24080901
WendyYang vor 5 Monaten
Ursprung
Commit
cf1554cdab
6 geänderte Dateien mit 50 neuen und 21 gelöschten Zeilen
  1. +6
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/dto/ProjectEditDTO.java
  2. +2
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/dto/PurchaseDTO.java
  3. +12
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/dto/PurchaseEditDTO.java
  4. +1
    -1
      hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/utils/ProjectIdCodeCacheUtil.java
  5. +22
    -19
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectChangeManage.java
  6. +7
    -1
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/req/SubmitProjectChangeApplyReq.java

+ 6
- 0
hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/dto/ProjectEditDTO.java Datei anzeigen

@@ -21,6 +21,12 @@ public class ProjectEditDTO implements Serializable {

private static final long serialVersionUID = 7066112975653039072L;

public static final String FIELD_PROJECT = "project";

public static final String FIELD_PURCHASES = "purchases";

public static final String FIELD_PROJECT_DIFFS = "projectDiffs";

@ApiModelProperty("项目信息")
private ProjectDTO project;



+ 2
- 0
hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/dto/PurchaseDTO.java Datei anzeigen

@@ -22,6 +22,8 @@ import java.time.LocalDateTime;
@AllArgsConstructor
public class PurchaseDTO {

public static final String FIELD_ID = "id";

@ApiModelProperty("id")
private Long id;



+ 12
- 0
hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/dto/PurchaseEditDTO.java Datei anzeigen

@@ -17,6 +17,18 @@ import java.util.List;
@Data
public class PurchaseEditDTO {

public static final String FIELD_PURCHASE = "purchase";

public static final String FIELD_CONTRACT = "contract";

public static final String FIELD_OPERATION = "operation";

public static final String FIELD_PURCHASE_DIFFS = "purchaseDiffs";

public static final String FIELD_CONTRACT_DIFFS = "contractDiffs";

public static final String FIELD_OPERATION_DIFFS = "operationDiffs";

@ApiModelProperty("采购信息")
private PurchaseDTO purchase;



+ 1
- 1
hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/utils/ProjectIdCodeCacheUtil.java Datei anzeigen

@@ -69,7 +69,7 @@ public class ProjectIdCodeCacheUtil {
public static List<Long> get(String projectCode) {
return CACHE.entrySet()
.stream()
.filter(w -> w.getValue().getProjectCode().equals(projectCode))
.filter(w -> StrUtil.equals(w.getValue().getProjectCode(), projectCode))
.map(Map.Entry::getKey)
.collect(Collectors.toList());
}


+ 22
- 19
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectChangeManage.java Datei anzeigen

@@ -2,7 +2,7 @@ package com.hz.pm.api.projectlib.manage;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.json.JSONConfig;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
@@ -83,18 +83,18 @@ public class ProjectChangeManage {

@Transactional(rollbackFor = Exception.class)
public synchronized void submitProjectChangeApply(SubmitProjectChangeApplyReq req) {
ProjectEditDTO projectEdit = req.getProjectEditDetail();
ProjectDTO reqProject = projectEdit.getProject();
Project project = projectService.getNewProject(reqProject.getId());
JSONObject projectEditDetail = req.getProjectEditDetail();
JSONObject projJsonObj = projectEditDetail.getJSONObject(ProjectEditDTO.FIELD_PROJECT);
ProjectDTO reqProj = projJsonObj.toBean(ProjectDTO.class);
Project project = projectService.getNewProject(reqProj.getId());
if (ProjectStatus.ON_CHANGE_APPLY.eq(project.getStatus()) ||
ProjectStatus.STOPPED_PASSED.eq(project.getStatus())) {
throw BizException.wrap("暂无法提交变更申请");
}
ProjectDetailVO projDetailOld = projectLibManage.getProjectDetail(project);

List<FieldDiff> projDiffs = BeanDiffUtil.diffSameField(projDetailOld, reqProject,
ProjectDTO.SYSTEM_REPLACE_INFOS);
List<GovSystemReplaceInfoDTO> systemReplaceInfos = reqProject.getSystemReplaceInfos();
List<FieldDiff> projDiffs = BeanDiffUtil.diffSameField(projDetailOld, projJsonObj, ProjectDTO.SYSTEM_REPLACE_INFOS);
List<GovSystemReplaceInfoDTO> systemReplaceInfos = reqProj.getSystemReplaceInfos();
List<GovSystemReplaceInfoDTO> systemReplaceInfosOld = projDetailOld.getSystemReplaceInfos();
if (!CollUtil.isEqualList(systemReplaceInfos, systemReplaceInfosOld)) {
projDiffs.add(FieldDiff.builder()
@@ -104,28 +104,29 @@ public class ProjectChangeManage {
.newValue(systemReplaceInfos)
.build());
}
projectEdit.setProjectDiffs(projDiffs);
if (CollUtil.isNotEmpty(projectEdit.getPurchases())) {
projJsonObj.set(ProjectEditDTO.FIELD_PROJECT_DIFFS, projDiffs);
List<JSONObject> purchaseJsonObjs = projectEditDetail.getBeanList(ProjectEditDTO.FIELD_PURCHASES, JSONObject.class);
if (CollUtil.isNotEmpty(purchaseJsonObjs)) {
List<PurchaseFullInfoVO> purchaseDetails = projDetailOld.getPurchaseDetails();
if (purchaseDetails != null && !purchaseDetails.isEmpty()) {
Map<Long, PurchaseEditDTO> reqPurchaseMap = CollUtils.listToMap(projectEdit.getPurchases(),
w -> w.getPurchase().getId());
Map<Long, JSONObject> reqPurchaseMap = CollUtils.listToMap(purchaseJsonObjs,
w -> w.getJSONObject(PurchaseEditDTO.FIELD_PURCHASE).getLong(PurchaseDTO.FIELD_ID));
for (PurchaseFullInfoVO purchaseDetail : purchaseDetails) {
PurchaseVO purchase = purchaseDetail.getPurchase();
ContractVO contract = purchaseDetail.getConstruction();
OperationVO operation = purchaseDetail.getOperation();

PurchaseEditDTO reqPurchaseDetail = reqPurchaseMap.get(purchase.getId());
PurchaseDTO reqPurchase = reqPurchaseDetail.getPurchase();
OperationDTO reqOperation = reqPurchaseDetail.getOperation();
ContractDTO reqContract = reqPurchaseDetail.getContract();
JSONObject reqPurchaseDetail = reqPurchaseMap.get(purchase.getId());
JSONObject reqPurchase = reqPurchaseDetail.getJSONObject(PurchaseEditDTO.FIELD_PURCHASE);
JSONObject reqOperation = reqPurchaseDetail.getJSONObject(PurchaseEditDTO.FIELD_OPERATION);
JSONObject reqContract = reqPurchaseDetail.getJSONObject(PurchaseEditDTO.FIELD_CONTRACT);

List<FieldDiff> purchaseDiffs = BeanDiffUtil.diffSameField(purchase, reqPurchase);
List<FieldDiff> operationDiffs = BeanDiffUtil.diffSameField(operation, reqOperation);
List<FieldDiff> contractDiffs = BeanDiffUtil.diffSameField(contract, reqContract);
reqPurchaseDetail.setPurchaseDiffs(purchaseDiffs);
reqPurchaseDetail.setContractDiffs(contractDiffs);
reqPurchaseDetail.setOperationDiffs(operationDiffs);
reqPurchaseDetail.set(PurchaseEditDTO.FIELD_PURCHASE_DIFFS, purchaseDiffs);
reqPurchaseDetail.set(PurchaseEditDTO.FIELD_CONTRACT_DIFFS, contractDiffs);
reqPurchaseDetail.set(PurchaseEditDTO.FIELD_OPERATION_DIFFS, operationDiffs);
}
}
}
@@ -149,9 +150,11 @@ public class ProjectChangeManage {
projectInstService.save(projectInst);
projectChangeStopHelper.changeProjectPurchaseStatus(project, CHANGE_APPLY_SUBMIT);

projectEditDetail.getConfig().setIgnoreNullValue(false);

// 保存变更历史
ProjectChangeHistory projectChangeHistory = new ProjectChangeHistory();
projectChangeHistory.setChangeContent(JSONUtil.toJsonStr(projectEdit, BizConst.JSON_NOT_IGNORE_NULL_VALUE));
projectChangeHistory.setChangeContent(projectEditDetail.toString());
projectChangeHistory.setChangeReason(req.getChangeReason());
projectChangeHistory.setProjectId(project.getId());
projectChangeHistory.setProjectCode(project.getProjectCode());


+ 7
- 1
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/req/SubmitProjectChangeApplyReq.java Datei anzeigen

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

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.json.JSONObject;
import com.hz.pm.api.projectdeclared.model.dto.ProjectEditDTO;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@@ -22,6 +24,10 @@ public class SubmitProjectChangeApplyReq {
private String changeReason;

@ApiModelProperty("项目信息")
private ProjectEditDTO projectEditDetail;
private JSONObject projectEditDetail;

public ProjectEditDTO getProjectDetail() {
return BeanUtil.toBean(projectEditDetail, ProjectEditDTO.class);
}

}

Laden…
Abbrechen
Speichern