diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectChangeManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectChangeManage.java index 947e7cf..8d28d06 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectChangeManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectChangeManage.java @@ -89,9 +89,9 @@ public class ProjectChangeManage { throw BizException.wrap("暂无法提交变更申请"); } ProjectDetailVO projDetailOld = projectLibManage.getProjectDetail(project); - List projDiffs = ProjectDetailDiffUtil.diff(projDetailOld, projJsonObj, true, EditProjectDTO.SYSTEM_REPLACE_INFOS, "id", "projectCode"); + int changeFieldsCount = projDiffs.size(); List systemReplaceInfos = reqProj.getSystemReplaceInfos(); List systemReplaceInfosOld = projDetailOld.getSystemReplaceInfos(); if (!CollUtil.isEqualList(systemReplaceInfos, systemReplaceInfosOld)) { @@ -101,6 +101,7 @@ public class ProjectChangeManage { .oldValue(systemReplaceInfosOld) .newValue(systemReplaceInfos) .build()); + changeFieldsCount++; } projectEditDetail.set(EditProjectDetailDTO.FIELD_PROJECT_DIFFS, projDiffs); List purchaseJsonObjs = projectEditDetail.getBeanList(EditProjectDetailDTO.FIELD_PURCHASES, JSONObject.class); @@ -134,13 +135,16 @@ public class ProjectChangeManage { List purchaseDiffs = ProjectDetailDiffUtil.diff(purchase, reqPurchase, true, "id"); List operationDiffs = ProjectDetailDiffUtil.diff(operation, reqOperation, true, "id"); List contractDiffs = ProjectDetailDiffUtil.diff(contract, reqContract, true, "id"); + changeFieldsCount += purchaseDiffs.size() + operationDiffs.size() + contractDiffs.size(); reqPurchaseDetail.set(EditPurchaseDetailDTO.FIELD_PURCHASE_DIFFS, purchaseDiffs); reqPurchaseDetail.set(EditPurchaseDetailDTO.FIELD_CONTRACT_DIFFS, contractDiffs); reqPurchaseDetail.set(EditPurchaseDetailDTO.FIELD_OPERATION_DIFFS, operationDiffs); } } } - + if (changeFieldsCount == 0) { + throw BizException.wrap("项目内容无修改"); + } UserInfoDetails userDetail = LoginUserUtil.loginUserDetail(); WflowModels wflowModels = processModelManage.getWflowModelsNoNull(ProjectProcessType.PROJECT_CHANGE, userDetail.getMhUnitId()); @@ -206,7 +210,7 @@ public class ProjectChangeManage { return result; } - public ProjectChangeDetailVO changeDetail(Long projectId,String instCode) { + public ProjectChangeDetailVO changeDetail(Long projectId, String instCode) { Wrapper query = Wrappers.lambdaQuery(ProjectChangeHistory.class) .eq(ProjectChangeHistory::getProjectId, projectId) .eq(ProjectChangeHistory::getInstCode, instCode);