|
|
@ -26,6 +26,7 @@ |
|
|
|
package com.yxt.anrui.buscenter.biz.bussalesorder; |
|
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil; |
|
|
|
import cn.hutool.core.convert.Convert; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
import com.yxt.anrui.buscenter.api.busdepositfictitious.BusDepositFictitiousDto; |
|
|
@ -48,7 +49,15 @@ import com.yxt.anrui.buscenter.biz.bussalesorderprice.BusSalesOrderPriceService; |
|
|
|
import com.yxt.anrui.buscenter.biz.bussalesordervehicle.BusSalesOrderVehicleService; |
|
|
|
import com.yxt.anrui.buscenter.biz.bussalesvehicleorder.BusSalesVehicleOrderService; |
|
|
|
import com.yxt.anrui.flowable.api.flow.FlowableFeign; |
|
|
|
import com.yxt.anrui.flowable.api.flowtask.FlowTask; |
|
|
|
import com.yxt.anrui.flowable.api.flowtask.FlowTaskFeign; |
|
|
|
import com.yxt.anrui.flowable.api.flowtask.FlowTaskVo; |
|
|
|
import com.yxt.anrui.flowable.api.flowtask.LatestTaskVo; |
|
|
|
import com.yxt.anrui.flowable.api.sysformlink.SysFormLinkFeign; |
|
|
|
import com.yxt.anrui.flowable.api.sysformlink.SysFormLinkFlowStateEnum; |
|
|
|
import com.yxt.anrui.flowable.api.utils.ProcDefEnum; |
|
|
|
import com.yxt.anrui.flowable.api.utils.ProcessStateEnum; |
|
|
|
import com.yxt.anrui.flowable.sqloperationsymbol.BusinessVariables; |
|
|
|
import com.yxt.anrui.portal.api.sysstafforg.SysStaffOrgFeign; |
|
|
|
import com.yxt.common.base.service.MybatisBaseService; |
|
|
|
import com.yxt.common.base.utils.PagerUtil; |
|
|
@ -100,6 +109,8 @@ public class BusSalesOrderService extends MybatisBaseService<BusSalesOrderMapper |
|
|
|
@Autowired |
|
|
|
private SysStaffOrgFeign sysStaffOrgFeign; |
|
|
|
private FlowableFeign flowableFeign; |
|
|
|
private FlowTaskFeign flowTaskFeign; |
|
|
|
private SysFormLinkFeign sysFormLinkFeign; |
|
|
|
|
|
|
|
/** |
|
|
|
* 构造查询条件 |
|
|
@ -362,4 +373,96 @@ public class BusSalesOrderService extends MybatisBaseService<BusSalesOrderMapper |
|
|
|
procInsId, |
|
|
|
taskDefKey); |
|
|
|
} |
|
|
|
|
|
|
|
public ResultBean complete(BusSalesOrderFlowQuery busSalesOrderFlowQuery) { |
|
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
|
//查询对象转换为map集合
|
|
|
|
Map<String, Object> variables = Convert.toMap(String.class, Object.class, busSalesOrderFlowQuery); |
|
|
|
BusinessVariables bv = BusinessVariables.builder().build(); |
|
|
|
bv.setFormVariables(variables); |
|
|
|
ResultBean<FlowTask> resultBean = flowTaskFeign.businessComplete(bv); |
|
|
|
if (!resultBean.getSuccess()) { |
|
|
|
return resultBean; |
|
|
|
} |
|
|
|
String nodeState = ""; |
|
|
|
String taskDefKey = ""; |
|
|
|
Map<String, Object> map = new HashMap<>(); |
|
|
|
map.put("businessSid", variables.get("businessSid").toString()); |
|
|
|
if (resultBean.getData() != null) { |
|
|
|
ResultBean<List<LatestTaskVo>> listResultBean = flowTaskFeign.getLatestTasks(resultBean.getData().getProcInsId()); |
|
|
|
if (listResultBean.getSuccess() && listResultBean.getData().size() != 0) { |
|
|
|
nodeState = listResultBean.getData().get(0).getName_(); |
|
|
|
taskDefKey = listResultBean.getData().get(0).getTask_def_key_(); |
|
|
|
} else { |
|
|
|
nodeState = ProcessStateEnum.FINISHED.getStateName(); |
|
|
|
taskDefKey = "Event_end"; |
|
|
|
map.put("flowState", SysFormLinkFlowStateEnum.FINISH.getCode()); |
|
|
|
} |
|
|
|
} |
|
|
|
map.put("nodeState", nodeState); |
|
|
|
map.put("taskDefKey", taskDefKey); |
|
|
|
sysFormLinkFeign.updateFiled(map); |
|
|
|
return rb.success(); |
|
|
|
} |
|
|
|
|
|
|
|
public ResultBean reject(BusSalesOrderFlowDto dto) { |
|
|
|
FlowTaskVo flowTaskVo = new FlowTaskVo(); |
|
|
|
BeanUtil.copyProperties(dto, flowTaskVo); |
|
|
|
ResultBean<List<LatestTaskVo>> resultBean = flowTaskFeign.taskReject(flowTaskVo); |
|
|
|
if (!resultBean.getSuccess()) { |
|
|
|
return resultBean; |
|
|
|
} |
|
|
|
String nodeState = resultBean.getData().get(0).getName_(); |
|
|
|
String taskDefKey = resultBean.getData().get(0).getTask_def_key_(); |
|
|
|
String incomingSourceRef = resultBean.getData().get(0).getIncomingSourceRef(); |
|
|
|
Map<String, Object> map = new HashMap<>(); |
|
|
|
map.put("businessSid", dto.getBusinessSid()); |
|
|
|
map.put("nodeState", nodeState); |
|
|
|
map.put("taskDefKey", taskDefKey); |
|
|
|
if (incomingSourceRef.contains("start")) { |
|
|
|
map.put("flowState", SysFormLinkFlowStateEnum.REJECT.getCode()); |
|
|
|
} |
|
|
|
sysFormLinkFeign.updateFiled(map); |
|
|
|
return new ResultBean().success(); |
|
|
|
} |
|
|
|
|
|
|
|
public ResultBean breakProcess(BusSalesOrderFlowDto dto) { |
|
|
|
FlowTaskVo flowTaskVo = new FlowTaskVo(); |
|
|
|
BeanUtil.copyProperties(dto, flowTaskVo); |
|
|
|
ResultBean resultBean = flowTaskFeign.breakProcess(flowTaskVo); |
|
|
|
if (!resultBean.getSuccess()) { |
|
|
|
return resultBean; |
|
|
|
} |
|
|
|
Map<String, Object> map = new HashMap<>(); |
|
|
|
map.put("businessSid", dto.getBusinessSid()); |
|
|
|
map.put("nodeState", String.valueOf(resultBean.getData())); |
|
|
|
map.put("taskDefKey", "Event_end"); |
|
|
|
map.put("flowState", SysFormLinkFlowStateEnum.BREAK.getCode()); |
|
|
|
sysFormLinkFeign.updateFiled(map); |
|
|
|
return resultBean.success(); |
|
|
|
} |
|
|
|
|
|
|
|
public ResultBean revokeProcess(BusSalesOrderFlowDto dto) { |
|
|
|
FlowTaskVo flowTaskVo = new FlowTaskVo(); |
|
|
|
BeanUtil.copyProperties(dto, flowTaskVo); |
|
|
|
ResultBean<List<LatestTaskVo>> resultBean = flowTaskFeign.revokeProcess(flowTaskVo); |
|
|
|
if (!resultBean.getSuccess()) { |
|
|
|
return resultBean; |
|
|
|
} |
|
|
|
String nodeState = resultBean.getData().get(0).getName_(); |
|
|
|
String taskDefKey = resultBean.getData().get(0).getTask_def_key_(); |
|
|
|
String inComingSourceRef = resultBean.getData().get(0).getIncomingSourceRef(); |
|
|
|
Map<String, Object> map = new HashMap<>(); |
|
|
|
map.put("businessSid", dto.getBusinessSid()); |
|
|
|
if (inComingSourceRef.contains("start")) { |
|
|
|
map.put("nodeState", SysFormLinkFlowStateEnum.UNCOMMITTED.getState()); |
|
|
|
map.put("taskDefKey", taskDefKey); |
|
|
|
map.put("flowState", SysFormLinkFlowStateEnum.UNCOMMITTED.getCode()); |
|
|
|
} else { |
|
|
|
map.put("nodeState", nodeState); |
|
|
|
map.put("taskDefKey", taskDefKey); |
|
|
|
} |
|
|
|
sysFormLinkFeign.updateFiled(map); |
|
|
|
return new ResultBean().success(); |
|
|
|
} |
|
|
|
} |