|
|
@ -23,6 +23,7 @@ import com.yxt.anrui.scm.api.scmapplyinboundvehicle.ScmApplyInboundVehicleDto; |
|
|
|
import com.yxt.anrui.scm.api.scmapplyinboundvehicle.ScmApplyInboundVehicleVo; |
|
|
|
import com.yxt.anrui.scm.api.scmvehicleexamine.AppScmVehicleExamineDto; |
|
|
|
import com.yxt.anrui.scm.api.scmvehicleexamine.ScmEntryVehicleExamineDto; |
|
|
|
import com.yxt.anrui.scm.api.scmvehiclereturn.ScmVehicleReturnDto; |
|
|
|
import com.yxt.anrui.scm.biz.flow.FlowableService; |
|
|
|
import com.yxt.anrui.scm.biz.scmapplyinboundvehicle.ScmApplyInboundVehicleService; |
|
|
|
import com.yxt.anrui.scm.biz.scmvehicleexamine.ScmVehicleExamineService; |
|
|
@ -241,7 +242,6 @@ public class ScmApplyInboundService extends MybatisBaseService<ScmApplyInboundMa |
|
|
|
// }
|
|
|
|
return baseMapper.update(null, uw); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 提交入账申请 |
|
|
|
* |
|
|
@ -249,54 +249,58 @@ public class ScmApplyInboundService extends MybatisBaseService<ScmApplyInboundMa |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
public ResultBean submitRecordApplication(SubmitScmApplyInboundDto dto) { |
|
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
|
//取组织架构的全路径sid
|
|
|
|
// SysStaffOrg sysStaffOrg = sysStaffOrgFeign.getOrgByStaffSid(dto.getUserSid()).getData();
|
|
|
|
String orgSidPath = dto.getOrgSidPath(); //sysStaffOrg.getOrgSidPath();
|
|
|
|
String orgSidPath = dto.getOrgSidPath(); |
|
|
|
String busSid = dto.getBusinessSid(); |
|
|
|
if (StringUtils.isBlank(busSid)) { |
|
|
|
Map<String, Object> variables = BeanUtil.beanToMap(dto); |
|
|
|
|
|
|
|
ScmApplyInbound booad = new ScmApplyInbound(); |
|
|
|
int r = submitBusinessData(dto, booad); |
|
|
|
if (r == 0) { |
|
|
|
return rb.setMsg("操作失败,提交的数据不一致!"); |
|
|
|
ResultBean resultBean = saveOrUpdateApplyInBound(dto);//insert
|
|
|
|
String businessSid = resultBean.getData().toString(); |
|
|
|
BusinessVariables bv = new BusinessVariables(); |
|
|
|
BeanUtil.copyProperties(dto, bv); |
|
|
|
bv.setOrgSidPath(orgSidPath); |
|
|
|
bv.setBusinessSid(businessSid); |
|
|
|
bv.setUserSid(dto.getUserSid()); |
|
|
|
variables.put("businessSid", businessSid); |
|
|
|
bv.setFormVariables(variables); |
|
|
|
bv.setModelId(ProcDefEnum.RECORDAPPLICATION.getProDefId()); |
|
|
|
ResultBean<UpdateFlowFieldVo> resultBean1 = flowableFeign.startProcess(bv); |
|
|
|
UpdateFlowFieldVo uff = resultBean1.getData(); |
|
|
|
updateFlowFiled(BeanUtil.beanToMap(uff)); |
|
|
|
return resultBean1; |
|
|
|
} |
|
|
|
return submitBusinessData(dto, busSid,orgSidPath); |
|
|
|
} |
|
|
|
|
|
|
|
ResultBean<String> resultBean = saveOrUpdateApplyInBound(dto); |
|
|
|
String businessSid = resultBean.getData(); |
|
|
|
private synchronized ResultBean submitBusinessData(SubmitScmApplyInboundDto dto,String businessSid,String orgSidPath) { |
|
|
|
Map<String, Object> variables = BeanUtil.beanToMap(dto); |
|
|
|
ScmApplyInbound entity = this.fetchBySid(dto.getSid()); |
|
|
|
String businessTaskid = entity.getTaskId(); |
|
|
|
BusinessVariables bv = new BusinessVariables(); |
|
|
|
BeanUtil.copyProperties(dto, bv); |
|
|
|
bv.setOrgSidPath(orgSidPath); |
|
|
|
bv.setBusinessSid(businessSid); |
|
|
|
bv.setUserSid(dto.getUserSid()); |
|
|
|
variables.put("businessSid", businessSid); |
|
|
|
bv.setFormVariables(variables); |
|
|
|
bv.setModelId(ProcDefEnum.RECORDAPPLICATION.getProDefId()); |
|
|
|
if (r == 1) { |
|
|
|
if (StringUtils.isBlank(businessTaskid) && StringUtils.isBlank(dto.getTaskId())) { |
|
|
|
saveOrUpdateApplyInBound(dto); |
|
|
|
ResultBean<UpdateFlowFieldVo> resultBean1 = flowableFeign.startProcess(bv); |
|
|
|
UpdateFlowFieldVo uff = resultBean1.getData(); |
|
|
|
updateFlowFiled(uff); |
|
|
|
updateFlowFiled(BeanUtil.beanToMap(uff)); |
|
|
|
return resultBean1; |
|
|
|
} else if (r == 2) { |
|
|
|
bv.setTaskDefKey(booad.getTaskDefKey()); |
|
|
|
} else if (StringUtils.isNotBlank(businessTaskid) && businessTaskid.equals(dto.getTaskId())) {//只有数据一致的时候才能进行下一步
|
|
|
|
saveOrUpdateApplyInBound(dto); |
|
|
|
bv.setTaskDefKey(entity.getTaskDefKey()); |
|
|
|
bv.setComment(StringUtils.isNotBlank(dto.getComment()) ? dto.getComment() : "重新提交"); |
|
|
|
bv.setInstanceId(booad.getProcInsId()); |
|
|
|
bv.setInstanceId(dto.getProcInsId()); |
|
|
|
bv.setTaskId(dto.getTaskId()); |
|
|
|
ResultBean<UpdateFlowFieldVo> rrb = flowableFeign.handleProsess(bv); |
|
|
|
updateFlowFiled(rrb.getData()); |
|
|
|
return rrb; |
|
|
|
}else{ |
|
|
|
return ResultBean.fireFail().setMsg("操作失败,提交的数据不一致!"); |
|
|
|
} |
|
|
|
return rb; |
|
|
|
} |
|
|
|
|
|
|
|
private synchronized int submitBusinessData(SubmitScmApplyInboundDto dto, ScmApplyInbound booad) { |
|
|
|
int r = 0; |
|
|
|
booad = this.fetchBySid(dto.getSid()); |
|
|
|
String businessTaskid = booad.getTaskId(); |
|
|
|
if (StringUtils.isBlank(businessTaskid) && StringUtils.isBlank(dto.getTaskId())) { |
|
|
|
// 新提交 taskid都是空的
|
|
|
|
r = 1; |
|
|
|
} else if (StringUtils.isNotBlank(businessTaskid) && businessTaskid.equals(dto.getTaskId())) {//只有数据一致的时候才能进行下一步
|
|
|
|
r = 2; |
|
|
|
} |
|
|
|
return r; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
@ -312,7 +316,6 @@ public class ScmApplyInboundService extends MybatisBaseService<ScmApplyInboundMa |
|
|
|
if (StringUtils.isBlank(booad.getTaskId()) || !booad.getTaskId().equals(dto.getTaskId())) { |
|
|
|
return rb.setMsg("操作失败,提交的数据不一致!"); |
|
|
|
} |
|
|
|
|
|
|
|
//取组织架构的全路径sid
|
|
|
|
// SysStaffOrg sysStaffOrg = sysStaffOrgFeign.getOrgByStaffSid(dto.getApplicationSid()).getData();
|
|
|
|
String orgSidPath = dto.getOrgSidPath(); |
|
|
@ -331,8 +334,8 @@ public class ScmApplyInboundService extends MybatisBaseService<ScmApplyInboundMa |
|
|
|
ResultBean<UpdateFlowFieldVo> rrb = flowableFeign.handleProsess(bv); |
|
|
|
String taskDefKey = rrb.getData().getTaskDefKey(); |
|
|
|
updateFlowFiled(rrb.getData()); |
|
|
|
if("Event_end".equals(taskDefKey)){ |
|
|
|
|
|
|
|
if("Event_end".equals(taskDefKey)){ |
|
|
|
List<ScmApplyInboundVehicleDto> vehicleList = dto.getVehicleList(); |
|
|
|
for(ScmApplyInboundVehicleDto scmApplyInboundVehicleDto:vehicleList){ |
|
|
|
ScmEntryVehicleExamineDto scmEntryVehicleExamineDto=new ScmEntryVehicleExamineDto(); |
|
|
@ -377,6 +380,7 @@ public class ScmApplyInboundService extends MybatisBaseService<ScmApplyInboundMa |
|
|
|
String incomingSourceRef = resultBean.getData().get(0).getIncomingSourceRef(); |
|
|
|
Map<String, Object> paramMap = new HashMap<>(); |
|
|
|
paramMap.put("sid", businessSid); |
|
|
|
paramMap.put("taskId", resultBean.getData().get(0).getId_()); |
|
|
|
if (incomingSourceRef.contains("start")) { |
|
|
|
paramMap.put("nodeState", SysFormLinkFlowStateEnum.UNCOMMITTED.getState()); |
|
|
|
paramMap.put("taskDefKey", taskDefKey); |
|
|
@ -408,6 +412,7 @@ public class ScmApplyInboundService extends MybatisBaseService<ScmApplyInboundMa |
|
|
|
String incomingSourceRef = resultBean.getData().get(0).getIncomingSourceRef(); |
|
|
|
Map<String, Object> paramMap = new HashMap<>(); |
|
|
|
paramMap.put("sid", businessSid); |
|
|
|
paramMap.put("taskId", resultBean.getData().get(0).getId_()); |
|
|
|
paramMap.put("nodeState", nodeState); |
|
|
|
paramMap.put("taskDefKey", taskDefKey); |
|
|
|
if (incomingSourceRef.contains("start")) { |
|
|
@ -433,7 +438,7 @@ public class ScmApplyInboundService extends MybatisBaseService<ScmApplyInboundMa |
|
|
|
} |
|
|
|
Map<String, Object> paramMap = new HashMap<>(); |
|
|
|
paramMap.put("sid", businessSid); |
|
|
|
paramMap.put("nodeState", String.valueOf(resultBean.getData())); |
|
|
|
paramMap.put("nodeState", "已终止"); |
|
|
|
paramMap.put("taskDefKey", "Event_end"); |
|
|
|
paramMap.put("flowState", SysFormLinkFlowStateEnum.BREAK.getCode()); |
|
|
|
updateFlowFiled(paramMap); |
|
|
|