package com.boco.nbd.wios.flow.process; import cn.hutool.core.util.StrUtil; import com.boco.nbd.cams.core.util.LambdaUtils; import com.boco.nbd.framework.workflow.entity.SubmitFlowRequest; import com.boco.nbd.framework.workflow.entity.SubmitTypeEnum; import com.boco.nbd.framework.workflow.entity.exception.FlowException; import com.boco.nbd.framework.workflow.flow.AbstractFlow; import com.boco.nbd.wios.flow.entity.FlowConstant; import com.boco.nbd.wios.flow.entity.bo.LocalSubmitFlowBO; import com.boco.nbd.wios.flow.entity.po.OrderPO; import com.boco.nbd.wios.flow.enums.FlowNodeEnum; import com.boco.nbd.wios.flow.service.IOrderService; import com.boco.nbd.wios.manage.entity.bo.SupplierContractVo; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.Date; /** * @author:cao hai * @date:2022/6/30 17:04 * @version:V1.0 * @description:Process102 * @modify: */ @Service("Process102") public class Process102 extends AbstractFlow { @Autowired protected IOrderService orderService; /** * 预处理(业务数据调整) * * @param request */ @Override protected void preProcess(SubmitFlowRequest request) { LocalSubmitFlowBO bo = (LocalSubmitFlowBO) request; if (SubmitTypeEnum.TaskFlow.equals(bo.getSubmitType())) { bo.setNextNodeEnum(FlowNodeEnum.NODE_103); bo.getBusiness().setDispatchTime(new Date()); //验证 if (bo.getBusiness().getInstallSupplierId() == null || StrUtil.isEmpty(bo.getBusiness().getInstallSupplierName())) { throw new FlowException("工单:" + bo.getBusiness().getId() + "安装服务商信息缺失"); } SupplierContractVo supplierContract = orderService.getSupplierContract(bo.getBusiness().getInstallSupplierId()); bo.getBusiness().setSupplierContractId(supplierContract.getId()); //modify 2022-10-18赋值信息勘测安装服务商字段 bo.getBusiness().setSurveySupplierId(bo.getBusiness().getInstallSupplierId()); bo.getBusiness().setSurveySupplierName(bo.getBusiness().getInstallSupplierName()); bo.getTaskParam().put(FlowConstant.SUPPLIER_ID, bo.getBusiness().getInstallSupplierId()); bo.getTaskParam().put(FlowConstant.SUPPLIER_NAME, bo.getBusiness().getInstallSupplierName()); StringBuffer builder = new StringBuffer(); builder.append(LambdaUtils.getFieldApiModelProperty(OrderPO::getInstallSupplierName)); builder.append(":" + bo.getBusiness().getInstallSupplierName()); bo.setCommentMsg(builder.toString()); if (StrUtil.isNotEmpty(bo.getBusiness().getMessage())) { bo.setCommentMsg(bo.getCommentMsg() + ";" + bo.getBusiness().getMessage()); } } } /** * 验证参数 * * @param request */ @Override protected void verifyParam(SubmitFlowRequest request) { } /** * 后续处理 * * @param request */ @Override protected void postProcess(SubmitFlowRequest request) { } }