diff --git a/ruoyi-modules/ruoyi-oa/src/main/java/org/dromara/oa/erp/service/impl/ErpContractInfoServiceImpl.java b/ruoyi-modules/ruoyi-oa/src/main/java/org/dromara/oa/erp/service/impl/ErpContractInfoServiceImpl.java index 28cf855c..e55cefc9 100644 --- a/ruoyi-modules/ruoyi-oa/src/main/java/org/dromara/oa/erp/service/impl/ErpContractInfoServiceImpl.java +++ b/ruoyi-modules/ruoyi-oa/src/main/java/org/dromara/oa/erp/service/impl/ErpContractInfoServiceImpl.java @@ -813,7 +813,7 @@ public class ErpContractInfoServiceImpl implements IErpContractInfoService { } /** - * 审批已通过且合同未激活,删除已结束流程实例,清空状态以便重新发起。 + * 审批已通过(可用/已激活)且流程已结束,删除已结束流程实例,清空状态以便重新发起。 */ private boolean resetFinishedContractFlowForResubmit(ErpContractInfoBo bo) { if (bo == null || bo.getContractId() == null) { @@ -823,15 +823,15 @@ public class ErpContractInfoServiceImpl implements IErpContractInfoService { if (current == null) { return false; } - if (!OAStatusEnum.COMPLETED.getStatus().equals(current.getContractStatus())) { - return false; - } String wfStatus = remoteWorkflowService.getBusinessStatus(String.valueOf(bo.getContractId())); if (!BusinessStatusEnum.FINISH.getStatus().equals(wfStatus)) { return false; } log.info("合同[{}]重新发起审批:删除已结束流程实例后重新发起", bo.getContractId()); - remoteWorkflowService.deleteInstance(Collections.singletonList(bo.getContractId())); + boolean deleted = remoteWorkflowService.deleteInstance(Collections.singletonList(bo.getContractId())); + if (!deleted) { + throw new ServiceException("清理已完成合同审批流程失败,请稍后重试"); + } bo.setContractStatus(null); bo.setFlowStatus(null); return true;