diff --git a/src/main/java/com/chint/domain/aggregates/approval/ApprovalLegAddAndChangeBatch.java b/src/main/java/com/chint/domain/aggregates/approval/ApprovalLegAddAndChangeBatch.java index e93a6a8b..02e1baa0 100644 --- a/src/main/java/com/chint/domain/aggregates/approval/ApprovalLegAddAndChangeBatch.java +++ b/src/main/java/com/chint/domain/aggregates/approval/ApprovalLegAddAndChangeBatch.java @@ -15,8 +15,7 @@ import java.util.stream.Collectors; import static com.chint.domain.aggregates.approval.ApprovalMethod.APPROVE; import static com.chint.domain.aggregates.approval.ApprovalType.LEG_ADD_CHANGE_BATCH; -import static com.chint.infrastructure.constant.LegConstant.LEG_APPROVAL_STATUS_PREPARE; -import static com.chint.infrastructure.constant.LegConstant.LEG_APPROVAL_STATUS_SUBMIT; +import static com.chint.infrastructure.constant.LegConstant.*; public class ApprovalLegAddAndChangeBatch extends ApprovalProcess { @@ -113,26 +112,36 @@ public class ApprovalLegAddAndChangeBatch extends ApprovalProcess { if (this.getApprovalMethod() == null || this.getApprovalMethod().equals(APPROVE)) { //所有被提交审批的被加入审批事件 String approvalRecordNo = approvalData.getApprovalRecordNo(); - addApprovalEventAndRecord(LegApprovalEvent.submit(approvalRecordNo)); + addApprovalEventAndRecord(LEG_APPROVAL_STATUS_SUBMIT, approvalRecordNo); } else { //所有被提交审批的被加入知会事件 String approvalRecordNo = approvalData.getApprovalRecordNo(); - addApprovalEventAndRecord(LegApprovalEvent.notifyEvent(approvalRecordNo)); + addApprovalEventAndRecord(LEG_APPROVAL_STATUS_NOTIFY, approvalRecordNo); } bpmPlatform.submitLegAddOrChangeApproval(approvalData); return this; } - private void addApprovalEventAndRecord(LegApprovalEvent event) { + private void addApprovalEventAndRecord(Integer legApprovalEventType, String approvalRecordNo) { ApprovalRecord approvalRecord = this.getApprovalRecord(); approvalData.getAddLegList().forEach(leg -> { - leg.addEvent(event); - approvalRecord.addLeg(leg); + if (legApprovalEventType == LEG_APPROVAL_STATUS_SUBMIT) { + leg.addEvent(LegApprovalEvent.submit(approvalRecordNo)); + approvalRecord.addLeg(leg); + } else { + leg.addEvent(LegApprovalEvent.notifyEvent(approvalRecordNo)); + approvalRecord.addLeg(leg); + } }); approvalData.getChangeLegList().forEach(it -> { Leg newLeg = it.getFirst(); - newLeg.addEvent(event); - approvalRecord.addLeg(newLeg); + if (legApprovalEventType == LEG_APPROVAL_STATUS_SUBMIT) { + newLeg.addEvent(LegApprovalEvent.submit(approvalRecordNo)); + approvalRecord.addLeg(newLeg); + } else { + newLeg.addEvent(LegApprovalEvent.notifyEvent(approvalRecordNo)); + approvalRecord.addLeg(newLeg); + } }); bpmPlatform.submitLegAddOrChangeApproval(approvalData); }