fix:修复提交审批的时候出现事件id重复的问题
This commit is contained in:
parent
c62a6f661a
commit
bdbff65d70
|
@ -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.ApprovalMethod.APPROVE;
|
||||||
import static com.chint.domain.aggregates.approval.ApprovalType.LEG_ADD_CHANGE_BATCH;
|
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.*;
|
||||||
import static com.chint.infrastructure.constant.LegConstant.LEG_APPROVAL_STATUS_SUBMIT;
|
|
||||||
|
|
||||||
public class ApprovalLegAddAndChangeBatch extends ApprovalProcess {
|
public class ApprovalLegAddAndChangeBatch extends ApprovalProcess {
|
||||||
|
|
||||||
|
@ -113,26 +112,36 @@ public class ApprovalLegAddAndChangeBatch extends ApprovalProcess {
|
||||||
if (this.getApprovalMethod() == null || this.getApprovalMethod().equals(APPROVE)) {
|
if (this.getApprovalMethod() == null || this.getApprovalMethod().equals(APPROVE)) {
|
||||||
//所有被提交审批的被加入审批事件
|
//所有被提交审批的被加入审批事件
|
||||||
String approvalRecordNo = approvalData.getApprovalRecordNo();
|
String approvalRecordNo = approvalData.getApprovalRecordNo();
|
||||||
addApprovalEventAndRecord(LegApprovalEvent.submit(approvalRecordNo));
|
addApprovalEventAndRecord(LEG_APPROVAL_STATUS_SUBMIT, approvalRecordNo);
|
||||||
} else {
|
} else {
|
||||||
//所有被提交审批的被加入知会事件
|
//所有被提交审批的被加入知会事件
|
||||||
String approvalRecordNo = approvalData.getApprovalRecordNo();
|
String approvalRecordNo = approvalData.getApprovalRecordNo();
|
||||||
addApprovalEventAndRecord(LegApprovalEvent.notifyEvent(approvalRecordNo));
|
addApprovalEventAndRecord(LEG_APPROVAL_STATUS_NOTIFY, approvalRecordNo);
|
||||||
}
|
}
|
||||||
bpmPlatform.submitLegAddOrChangeApproval(approvalData);
|
bpmPlatform.submitLegAddOrChangeApproval(approvalData);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addApprovalEventAndRecord(LegApprovalEvent event) {
|
private void addApprovalEventAndRecord(Integer legApprovalEventType, String approvalRecordNo) {
|
||||||
ApprovalRecord approvalRecord = this.getApprovalRecord();
|
ApprovalRecord approvalRecord = this.getApprovalRecord();
|
||||||
approvalData.getAddLegList().forEach(leg -> {
|
approvalData.getAddLegList().forEach(leg -> {
|
||||||
leg.addEvent(event);
|
if (legApprovalEventType == LEG_APPROVAL_STATUS_SUBMIT) {
|
||||||
|
leg.addEvent(LegApprovalEvent.submit(approvalRecordNo));
|
||||||
approvalRecord.addLeg(leg);
|
approvalRecord.addLeg(leg);
|
||||||
|
} else {
|
||||||
|
leg.addEvent(LegApprovalEvent.notifyEvent(approvalRecordNo));
|
||||||
|
approvalRecord.addLeg(leg);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
approvalData.getChangeLegList().forEach(it -> {
|
approvalData.getChangeLegList().forEach(it -> {
|
||||||
Leg newLeg = it.getFirst();
|
Leg newLeg = it.getFirst();
|
||||||
newLeg.addEvent(event);
|
if (legApprovalEventType == LEG_APPROVAL_STATUS_SUBMIT) {
|
||||||
|
newLeg.addEvent(LegApprovalEvent.submit(approvalRecordNo));
|
||||||
approvalRecord.addLeg(newLeg);
|
approvalRecord.addLeg(newLeg);
|
||||||
|
} else {
|
||||||
|
newLeg.addEvent(LegApprovalEvent.notifyEvent(approvalRecordNo));
|
||||||
|
approvalRecord.addLeg(newLeg);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
bpmPlatform.submitLegAddOrChangeApproval(approvalData);
|
bpmPlatform.submitLegAddOrChangeApproval(approvalData);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue