Browse Source

modify:

1. 项目ID缓存映射修改;
tags/24080901
WendyYang 3 months ago
parent
commit
19de17f055
3 changed files with 41 additions and 29 deletions
  1. +0
    -1
      hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/utils/ProjectIdCodeCacheUtil.java
  2. +40
    -28
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/helper/ProjectChangeStopHelper.java
  3. +1
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectLibManage.java

+ 0
- 1
hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/utils/ProjectIdCodeCacheUtil.java View File

@@ -1,6 +1,5 @@
package com.hz.pm.api.projectdeclared.utils;

import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;


+ 40
- 28
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/helper/ProjectChangeStopHelper.java View File

@@ -224,7 +224,7 @@ public class ProjectChangeStopHelper {

private void projectEditRewrite(ProjectEditDTO projectEdit) {
List<FieldDiff> projectDiffs = projectEdit.getProjectDiffs();
if (projectDiffs != null && !projectDiffs.isEmpty()) {
if (CollUtil.isNotEmpty(projectDiffs)) {
ProjectDTO projectDetail = projectEdit.getProject();
FieldDiff systemReplaceInfos = CollUtil.findOne(projectDiffs,
w -> w.getFieldName().equals(ProjectDTO.SYSTEM_REPLACE_INFOS));
@@ -241,33 +241,45 @@ public class ProjectChangeStopHelper {
List<PurchaseEditDTO> purchases = projectEdit.getPurchases();
if (CollUtil.isNotEmpty(purchases)) {
for (PurchaseEditDTO purchaseEdit : purchases) {
List<FieldDiff> purchaseDiffs = purchaseEdit.getPurchaseDiffs();
if (CollUtil.isNotEmpty(purchaseDiffs)) {
PurchaseDTO purchaseDetail = purchaseEdit.getPurchase();
UpdateWrapper<Purchase> wrapper = buildWrapper(purchaseDiffs, Purchase.class);
if (wrapper != null) {
wrapper.eq("id", purchaseDetail.getId());
purchaseService.update(wrapper);
}
}
List<FieldDiff> contractDiffs = purchaseEdit.getContractDiffs();
if (CollUtil.isNotEmpty(contractDiffs)) {
ContractDTO contractDetail = purchaseEdit.getContract();
UpdateWrapper<Contract> wrapper = buildWrapper(contractDiffs, Contract.class);
if (wrapper != null) {
wrapper.eq("id", contractDetail.getId());
contractService.update(wrapper);
}
}
List<FieldDiff> operationDiffs = purchaseEdit.getOperationDiffs();
if (CollUtil.isNotEmpty(operationDiffs)) {
OperationDTO operationDetail = purchaseEdit.getOperation();
UpdateWrapper<Operation> wrapper = buildWrapper(operationDiffs, Operation.class);
if (wrapper != null) {
wrapper.eq("id", operationDetail.getId());
operationService.update(wrapper);
}
}
modifyPurchase(purchaseEdit);
modifyContract(purchaseEdit);
modifyOperation(purchaseEdit);
}
}
}

private void modifyPurchase(PurchaseEditDTO purchaseEdit) {
List<FieldDiff> purchaseDiffs = purchaseEdit.getPurchaseDiffs();
if (CollUtil.isNotEmpty(purchaseDiffs)) {
PurchaseDTO purchaseDetail = purchaseEdit.getPurchase();
UpdateWrapper<Purchase> wrapper = buildWrapper(purchaseDiffs, Purchase.class);
if (wrapper != null) {
wrapper.eq("id", purchaseDetail.getId());
purchaseService.update(wrapper);
}
}
}

private void modifyContract(PurchaseEditDTO purchaseEdit) {
List<FieldDiff> contractDiffs = purchaseEdit.getContractDiffs();
if (CollUtil.isNotEmpty(contractDiffs)) {
ContractDTO contractDetail = purchaseEdit.getContract();
UpdateWrapper<Contract> wrapper = buildWrapper(contractDiffs, Contract.class);
if (wrapper != null) {
wrapper.eq("id", contractDetail.getId());
contractService.update(wrapper);
}
}
}

private void modifyOperation(PurchaseEditDTO purchaseEdit) {
List<FieldDiff> operationDiffs = purchaseEdit.getOperationDiffs();
if (CollUtil.isNotEmpty(operationDiffs)) {
OperationDTO operationDetail = purchaseEdit.getOperation();
UpdateWrapper<Operation> wrapper = buildWrapper(operationDiffs, Operation.class);
if (wrapper != null) {
wrapper.eq("id", operationDetail.getId());
operationService.update(wrapper);
}
}
}


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

@@ -862,6 +862,7 @@ public class ProjectLibManage {
project.setSponsor(String.valueOf(userId));
String projectCode = projectCodeGenUtil.generateProjectCode(projectDto);
project.setProjectCode(projectCode);
project.setNewest(Boolean.TRUE);
projectStateMachineUtil.pass(project);
if (projectService.save(project)) {
saveApplication(projectDto, project, null);


Loading…
Cancel
Save