fix(aftersales,timesheet,businesstrip): 修复业务流程中业务编码缺失问题

dev
Yangk 4 weeks ago
parent 09b39feca3
commit 85be59a474

@ -29,6 +29,7 @@ import org.dromara.common.core.exception.ServiceException;
import org.dromara.system.api.RemoteCodeRuleService; import org.dromara.system.api.RemoteCodeRuleService;
import org.dromara.workflow.api.RemoteWorkflowService; import org.dromara.workflow.api.RemoteWorkflowService;
import org.dromara.workflow.api.domain.RemoteStartProcess; import org.dromara.workflow.api.domain.RemoteStartProcess;
import org.dromara.workflow.api.domain.RemoteFlowInstanceBizExt;
import org.dromara.workflow.api.event.ProcessEvent; import org.dromara.workflow.api.event.ProcessEvent;
import org.springframework.context.event.EventListener; import org.springframework.context.event.EventListener;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -156,6 +157,7 @@ public class CrmBusinessTripApplyServiceImpl implements ICrmBusinessTripApplySer
boolean flag = baseMapper.insert(add) > 0; boolean flag = baseMapper.insert(add) > 0;
if (flag) { if (flag) {
bo.setTripId(add.getTripId()); bo.setTripId(add.getTripId());
bo.setApplyCode(add.getApplyCode());
} }
return flag; return flag;
} }
@ -228,6 +230,10 @@ public class CrmBusinessTripApplyServiceImpl implements ICrmBusinessTripApplySer
bo.getBizExt().setBusinessId(startProcess.getBusinessId()); bo.getBizExt().setBusinessId(startProcess.getBusinessId());
} }
// 确保 BizExt 里有 BusinessId 和 BusinessCode
startProcess.getBizExt().setBusinessId(startProcess.getBusinessId());
startProcess.getBizExt().setBusinessCode(bo.getApplyCode());
boolean flag = remoteWorkflowService.startCompleteTask(startProcess); boolean flag = remoteWorkflowService.startCompleteTask(startProcess);
if (!flag) { if (!flag) {
throw new ServiceException("流程发起异常"); throw new ServiceException("流程发起异常");

@ -28,6 +28,7 @@ import org.dromara.oa.erp.service.IErpAfterSalesMaterialCostsService;
import org.dromara.system.api.RemoteCodeRuleService; import org.dromara.system.api.RemoteCodeRuleService;
import org.dromara.workflow.api.RemoteWorkflowService; import org.dromara.workflow.api.RemoteWorkflowService;
import org.dromara.workflow.api.domain.RemoteStartProcess; import org.dromara.workflow.api.domain.RemoteStartProcess;
import org.dromara.workflow.api.domain.RemoteFlowInstanceBizExt;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.dromara.oa.erp.domain.bo.ErpAfterSalesBo; import org.dromara.oa.erp.domain.bo.ErpAfterSalesBo;
import org.dromara.oa.erp.domain.vo.ErpAfterSalesVo; import org.dromara.oa.erp.domain.vo.ErpAfterSalesVo;
@ -184,6 +185,7 @@ public class ErpAfterSalesServiceImpl implements IErpAfterSalesService {
boolean flag = baseMapper.insert(add) > 0; boolean flag = baseMapper.insert(add) > 0;
bo.setAfterSalesId(add.getAfterSalesId()); // 将生成的 ID 回填给 BO bo.setAfterSalesId(add.getAfterSalesId()); // 将生成的 ID 回填给 BO
bo.setAfterSalesCode(add.getAfterSalesCode()); // 将生成的 Code 回填给 BO
if (flag) { if (flag) {
Long afterSalesId = add.getAfterSalesId(); Long afterSalesId = add.getAfterSalesId();
@ -317,10 +319,9 @@ public class ErpAfterSalesServiceImpl implements IErpAfterSalesService {
startProcess.setVariables(bo.getVariables()); startProcess.setVariables(bo.getVariables());
startProcess.setBizExt(bo.getBizExt()); startProcess.setBizExt(bo.getBizExt());
// 确保 BizExt 里也有 BusinessId // 确保 BizExt 里有 BusinessId 和 BusinessCode
if (bo.getBizExt() != null) { startProcess.getBizExt().setBusinessId(startProcess.getBusinessId());
bo.getBizExt().setBusinessId(startProcess.getBusinessId()); startProcess.getBizExt().setBusinessCode(bo.getAfterSalesCode());
}
// 调用远程服务启动流程 // 调用远程服务启动流程
// startCompleteTask 表示“启动并自动完成第一个发起节点”,直接流转到下一个审批人 // startCompleteTask 表示“启动并自动完成第一个发起节点”,直接流转到下一个审批人

@ -163,6 +163,7 @@ public class ErpTimesheetInfoServiceImpl implements IErpTimesheetInfoService {
if (flag) { if (flag) {
// 回填 ID 给 BO // 回填 ID 给 BO
bo.setTimesheetId(add.getTimesheetId()); bo.setTimesheetId(add.getTimesheetId());
bo.setTimesheetCode(add.getTimesheetCode());
Long timesheetId = add.getTimesheetId(); Long timesheetId = add.getTimesheetId();
// 保存部门工时子表 // 保存部门工时子表
@ -328,6 +329,10 @@ public class ErpTimesheetInfoServiceImpl implements IErpTimesheetInfoService {
bo.getBizExt().setBusinessId(startProcess.getBusinessId()); bo.getBizExt().setBusinessId(startProcess.getBusinessId());
} }
// 确保 BizExt 里有 BusinessId 和 BusinessCode
startProcess.getBizExt().setBusinessId(startProcess.getBusinessId());
startProcess.getBizExt().setBusinessCode(bo.getTimesheetCode());
RemoteStartProcessReturn result = remoteWorkflowService.startWorkFlow(startProcess); RemoteStartProcessReturn result = remoteWorkflowService.startWorkFlow(startProcess);
if (result == null) { if (result == null) {
throw new ServiceException("流程发起失败"); throw new ServiceException("流程发起失败");
@ -347,7 +352,6 @@ public class ErpTimesheetInfoServiceImpl implements IErpTimesheetInfoService {
} }
} else { } else {
// taskId 为空,说明流程启动后直接跳过/已结束/进入下一个节点(可能因为自动完成) // taskId 为空,说明流程启动后直接跳过/已结束/进入下一个节点(可能因为自动完成)
// 这种情况下,我们不需要做任何事,直接视为成功
log.info("流程启动成功,首节点已自动完成或跳过: instanceId={}", result.getProcessInstanceId()); log.info("流程启动成功,首节点已自动完成或跳过: instanceId={}", result.getProcessInstanceId());
} }

Loading…
Cancel
Save