|
|
@ -44,6 +44,7 @@ import com.yxt.anrui.buscenter.api.busdeliveredusemessage.BusDeliveredUseMessage |
|
|
|
import com.yxt.anrui.buscenter.api.busdeliveredusemessage.BusDeliveredUseMessageVo; |
|
|
|
import com.yxt.anrui.buscenter.biz.busdelivered.BusDeliveredService; |
|
|
|
import com.yxt.anrui.buscenter.biz.busdeliveredapplydetails.BusDeliveredApplyDetailsService; |
|
|
|
import com.yxt.anrui.buscenter.biz.busdelivereddetailsdiscount.BusDeliveredDetailsDiscountService; |
|
|
|
import com.yxt.anrui.buscenter.biz.busdeliveredusemessage.BusDeliveredUseMessageService; |
|
|
|
import com.yxt.anrui.crm.api.crmcustomertemp.CrmCustomerTempFeign; |
|
|
|
import com.yxt.anrui.crm.api.crmcustomertemp.CrmCustomerTempVo; |
|
|
@ -114,6 +115,8 @@ public class BusDeliveredApplyService extends MybatisBaseService<BusDeliveredApp |
|
|
|
BaseVehicleFeign baseVehicleFeign; |
|
|
|
@Autowired |
|
|
|
private MessageFeign messageFeign; |
|
|
|
@Autowired |
|
|
|
private BusDeliveredDetailsDiscountService busDeliveredDetailsDiscountService; |
|
|
|
|
|
|
|
/** |
|
|
|
* 构造出库申请的查询条件 |
|
|
@ -160,30 +163,29 @@ public class BusDeliveredApplyService extends MybatisBaseService<BusDeliveredApp |
|
|
|
*/ |
|
|
|
public ResultBean saveOrUpdateDto(BusDeliveredApplyDto dto) { |
|
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
|
if (dto.getDetailsList().size() <= 0) { |
|
|
|
return rb.setMsg("请选择车辆信息!!!"); |
|
|
|
if (dto.getDetailsList().size() == 0) { |
|
|
|
return rb.setMsg("请选择车辆信息!"); |
|
|
|
} |
|
|
|
if (dto.getIsTerminal() == 3) { |
|
|
|
return rb.setMsg("请选择是否为终端客户!!!"); |
|
|
|
if (StringUtils.isBlank(dto.getType())) { |
|
|
|
return rb.setMsg("请选择实际购车人!"); |
|
|
|
} |
|
|
|
String dtoSid = dto.getSid(); |
|
|
|
if (StringUtils.isBlank(dtoSid)) { |
|
|
|
//新增
|
|
|
|
BusDeliveredApply busDeliveredApply = new BusDeliveredApply(); |
|
|
|
String mobile = dto.getDetailsList().get(0).getUseMessage().getMobile(); |
|
|
|
busDeliveredApply.setMobile(mobile); |
|
|
|
busDeliveredApply.setCreateBySid(dto.getUserSid()); |
|
|
|
BeanUtil.copyProperties(dto, busDeliveredApply, "sid"); |
|
|
|
busDeliveredApply.setCreateBySid(dto.getUserSid()); |
|
|
|
String useOrgSid = ""; |
|
|
|
if (StringUtils.isNotBlank(dto.getOrgPath())) { |
|
|
|
useOrgSid = sysStaffOrgFeign.getOrgSidByPath(dto.getOrgPath()).getData(); |
|
|
|
} else { |
|
|
|
useOrgSid = sysStaffOrgFeign.getPathSidByUserSid(dto.getUserSid()).getData(); |
|
|
|
} |
|
|
|
busDeliveredApply.setUseOrgSid(useOrgSid); |
|
|
|
List<BusDeliveredApplyDetailsDto> dtoList = dto.getDetailsList(); |
|
|
|
if (dtoList.size() > 0) { |
|
|
|
busDeliveredApplyDetailsService.saveList(dtoList, busDeliveredApply.getSid()); |
|
|
|
} |
|
|
|
|
|
|
|
//根据申请人sid查询分公司sid
|
|
|
|
ResultBean<String> stringResultBean = sysStaffOrgFeign.selectSidPathByStaffSid(dto.getApplySid()); |
|
|
|
if (stringResultBean.getSuccess()) { |
|
|
|
busDeliveredApply.setOrgSid(stringResultBean.getData()); |
|
|
|
} |
|
|
|
save(busDeliveredApply); |
|
|
|
dtoSid = busDeliveredApply.getSid(); |
|
|
|
} else { |
|
|
@ -191,9 +193,6 @@ public class BusDeliveredApplyService extends MybatisBaseService<BusDeliveredApp |
|
|
|
if (busDeliveredApply == null) { |
|
|
|
return rb.setMsg("该申请不存在"); |
|
|
|
} |
|
|
|
//删除
|
|
|
|
busDeliveredApplyDetailsService.deleteByApplySid(dtoSid); |
|
|
|
busDeliveredUseMessageService.deleteByApplySid(dtoSid); |
|
|
|
List<BusDeliveredApplyDetailsDto> dtoList = dto.getDetailsList(); |
|
|
|
if (dtoList.size() > 0) { |
|
|
|
busDeliveredApplyDetailsService.saveList(dtoList, busDeliveredApply.getSid()); |
|
|
@ -219,10 +218,10 @@ public class BusDeliveredApplyService extends MybatisBaseService<BusDeliveredApp |
|
|
|
} |
|
|
|
BeanUtil.copyProperties(entity, vo); |
|
|
|
vo.setUserSid(entity.getCreateBySid()); |
|
|
|
vo.setTaskDefKey(entity.getNodeId()); |
|
|
|
String format = DateUtil.format(entity.getApplyDate(), "yyyy-MM-dd"); |
|
|
|
vo.setApplyDate(format); |
|
|
|
if (vo.getIsTerminal().equals(1)) { |
|
|
|
// vo.setTaskDefKey(entity.getTaskDefKey());
|
|
|
|
String format = DateUtil.format(entity.getCreateTime(), "yyyy-MM-dd"); |
|
|
|
vo.setCreateTime(format); |
|
|
|
if ("0".equals(vo.getType())) { |
|
|
|
List<BusDeliveredApplyDetailsVo> voList = busDeliveredApplyDetailsService.detailsList(sid); |
|
|
|
voList.removeAll(Collections.singleton(null)); |
|
|
|
if (!voList.isEmpty()) { |
|
|
@ -239,8 +238,7 @@ public class BusDeliveredApplyService extends MybatisBaseService<BusDeliveredApp |
|
|
|
} |
|
|
|
} |
|
|
|
vo.setListVo(voList); |
|
|
|
|
|
|
|
} else if (vo.getIsTerminal().equals(0)) { |
|
|
|
} else { |
|
|
|
//根据出库申请单的sid查询需要出库的车辆信息
|
|
|
|
List<BusDeliveredApplyDetailsVo> voList = busDeliveredApplyDetailsService.detailsList(sid); |
|
|
|
for (int i = 0; i < voList.size(); i++) { |
|
|
@ -251,7 +249,6 @@ public class BusDeliveredApplyService extends MybatisBaseService<BusDeliveredApp |
|
|
|
} |
|
|
|
vo.setListVo(voList); |
|
|
|
} |
|
|
|
|
|
|
|
return rb.success().setData(vo); |
|
|
|
} |
|
|
|
|
|
|
@ -268,7 +265,7 @@ public class BusDeliveredApplyService extends MybatisBaseService<BusDeliveredApp |
|
|
|
String sid = resultBean.getData().toString(); |
|
|
|
//更新出库申请的状态为待审核。
|
|
|
|
//状态:1待提交,2待审核,3已通过,4未通过
|
|
|
|
baseMapper.updateStateBySid(2, sid, DateUtil.date()); |
|
|
|
baseMapper.updateStateBySid(2, sid); |
|
|
|
return rb.success().setMsg("提交成功"); |
|
|
|
} |
|
|
|
return rb.setMsg(resultBean.getMsg()); |
|
|
@ -287,7 +284,7 @@ public class BusDeliveredApplyService extends MybatisBaseService<BusDeliveredApp |
|
|
|
return rb.setMsg("该出库申请不存在"); |
|
|
|
} |
|
|
|
//状态:1待提交,2待审核,3已通过,4未通过
|
|
|
|
baseMapper.updateStateBySid(2, sid, DateUtil.date()); |
|
|
|
baseMapper.updateStateBySid(2, sid); |
|
|
|
return rb.success().setMsg("提交成功"); |
|
|
|
} |
|
|
|
|
|
|
@ -307,7 +304,7 @@ public class BusDeliveredApplyService extends MybatisBaseService<BusDeliveredApp |
|
|
|
if (!busDeliveredApply.getState().equals(2)) { |
|
|
|
return rb.setMsg("撤回失败,该申请已在审核中"); |
|
|
|
} |
|
|
|
baseMapper.updateStateBySid(1, sid, DateUtil.date()); |
|
|
|
baseMapper.updateStateBySid(1, sid); |
|
|
|
return rb.success().setMsg("撤回成功"); |
|
|
|
} |
|
|
|
|
|
|
@ -336,6 +333,7 @@ public class BusDeliveredApplyService extends MybatisBaseService<BusDeliveredApp |
|
|
|
for (int i = 0; i < sidsList.size(); i++) { |
|
|
|
busDeliveredApplyDetailsService.deleteByApplySid(sidsList.get(i)); |
|
|
|
busDeliveredUseMessageService.deleteByApplySid(sidsList.get(i)); |
|
|
|
busDeliveredDetailsDiscountService.deleteByApplySid(sidsList.get(i)); |
|
|
|
deleteBySid(sidsList.get(i)); |
|
|
|
} |
|
|
|
} |
|
|
@ -447,7 +445,8 @@ public class BusDeliveredApplyService extends MybatisBaseService<BusDeliveredApp |
|
|
|
*/ |
|
|
|
public ResultBean submitDeliveredApply(SubmitDeliveredApplyDto dto) { |
|
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
|
//根据用户sid获取staffSid
|
|
|
|
String orgSidPath = dto.getOrgPath(); |
|
|
|
/*//根据用户sid获取staffSid
|
|
|
|
ResultBean<SysUserVo> userVoResultBean = sysUserFeign.fetchBySid(dto.getUserSid()); |
|
|
|
if (!userVoResultBean.getSuccess()) { |
|
|
|
return rb.setMsg(userVoResultBean.getMsg()); |
|
|
@ -456,9 +455,9 @@ public class BusDeliveredApplyService extends MybatisBaseService<BusDeliveredApp |
|
|
|
ResultBean<SysStaffOrg> staffOrgResultBean = sysStaffOrgFeign.getOrgByStaffSid(userVoResultBean.getData().getStaffSid()); |
|
|
|
if (!staffOrgResultBean.getSuccess()) { |
|
|
|
return rb.setMsg(staffOrgResultBean.getMsg()); |
|
|
|
} |
|
|
|
}*/ |
|
|
|
//用户的组织全路径
|
|
|
|
String orgSidPath = staffOrgResultBean.getData().getOrgSidPath(); |
|
|
|
// String orgSidPath = staffOrgResultBean.getData().getOrgSidPath();
|
|
|
|
BusDeliveredApply busDeliveredApply = fetchBySid(dto.getSid()); |
|
|
|
int r = submitBusinessData(dto, busDeliveredApply); |
|
|
|
if (r == 3) { |
|
|
@ -473,13 +472,14 @@ public class BusDeliveredApplyService extends MybatisBaseService<BusDeliveredApp |
|
|
|
return rb.setMsg(resultBean.getMsg()); |
|
|
|
} |
|
|
|
String sid = resultBean.getData(); |
|
|
|
//更改状态
|
|
|
|
//将待出库中的车辆更改状态为出库申请0
|
|
|
|
List<String> stringList = busDeliveredApplyDetailsService.selectVinByApplySid(sid); |
|
|
|
for (int i = 0; i < stringList.size(); i++) { |
|
|
|
String vinNo = stringList.get(i); |
|
|
|
busDeliveredService.updateState(vinNo, 0); |
|
|
|
} |
|
|
|
baseMapper.updateStateBySid(2, sid, DateUtil.date()); |
|
|
|
//更改申请的状态为待审核2
|
|
|
|
baseMapper.updateStateBySid(2, sid); |
|
|
|
String businessSid = resultBean.getData(); |
|
|
|
//创建BusinessVariables实体对象
|
|
|
|
BusinessVariables bv = new BusinessVariables(); |
|
|
@ -498,6 +498,9 @@ public class BusDeliveredApplyService extends MybatisBaseService<BusDeliveredApp |
|
|
|
bv.setModelId(ProcDefEnum.BUSDELIVEREDAPPLY.getProDefId()); |
|
|
|
if (r == 1) { |
|
|
|
ResultBean<UpdateFlowFieldVo> voResultBean = flowableFeign.startProcess(bv); |
|
|
|
if (!voResultBean.getSuccess()) { |
|
|
|
return rb.setMsg(voResultBean.getMsg()); |
|
|
|
} |
|
|
|
UpdateFlowFieldVo ufVo = voResultBean.getData(); |
|
|
|
updateFlowFiled(BeanUtil.beanToMap(ufVo)); |
|
|
|
return voResultBean; |
|
|
@ -508,8 +511,8 @@ public class BusDeliveredApplyService extends MybatisBaseService<BusDeliveredApp |
|
|
|
return rb.setMsg("参数错误:instanceId"); |
|
|
|
} |
|
|
|
bv.setTaskId(busDeliveredApply.getTaskId()); |
|
|
|
bv.setTaskDefKey(busDeliveredApply.getNodeId()); |
|
|
|
bv.setComment(StringUtils.isNotBlank(dto.getComment()) ? dto.getComment() : "重新提交"); |
|
|
|
bv.setTaskDefKey(busDeliveredApply.getTaskDefKey()); |
|
|
|
bv.setComment("重新提交"); |
|
|
|
bv.setInstanceId(dto.getInstanceId()); |
|
|
|
return complete(bv); |
|
|
|
} |
|
|
@ -569,7 +572,7 @@ public class BusDeliveredApplyService extends MybatisBaseService<BusDeliveredApp |
|
|
|
return rb.setMsg(resultBean.getMsg()); |
|
|
|
} |
|
|
|
if ("Event_end".equals(resultBean.getData().getTaskDefKey())) { |
|
|
|
baseMapper.updateStateBySid(3, bv.getBusinessSid(), DateUtil.date()); |
|
|
|
baseMapper.updateStateBySid(3, bv.getBusinessSid()); |
|
|
|
} |
|
|
|
updateFlowFiled(BeanUtil.beanToMap(resultBean.getData())); |
|
|
|
return rb.success().setData(resultBean.getData()); |
|
|
@ -635,7 +638,7 @@ public class BusDeliveredApplyService extends MybatisBaseService<BusDeliveredApp |
|
|
|
if (!resultBean.getSuccess()) { |
|
|
|
return rb.setMsg(resultBean.getMsg()); |
|
|
|
} |
|
|
|
baseMapper.updateStateBySid(1, query.getBusinessSid(), DateUtil.date()); |
|
|
|
baseMapper.updateStateBySid(1, query.getBusinessSid()); |
|
|
|
Map<String, Object> map = BeanUtil.beanToMap(resultBean.getData()); |
|
|
|
//更新业务中的流程相关的参数
|
|
|
|
updateFlowFiled(map); |
|
|
@ -669,7 +672,7 @@ public class BusDeliveredApplyService extends MybatisBaseService<BusDeliveredApp |
|
|
|
if (!resultBean.getSuccess()) { |
|
|
|
return rb.setMsg("操作失败!"); |
|
|
|
} |
|
|
|
baseMapper.updateStateBySid(1, query.getBusinessSid(), DateUtil.date()); |
|
|
|
baseMapper.updateStateBySid(1, query.getBusinessSid()); |
|
|
|
updateFlowFiled(BeanUtil.beanToMap(resultBean.getData())); |
|
|
|
return rb.success().setData(resultBean.getData()); |
|
|
|
} |
|
|
@ -702,7 +705,7 @@ public class BusDeliveredApplyService extends MybatisBaseService<BusDeliveredApp |
|
|
|
if (!resultBean.getSuccess()) { |
|
|
|
return rb.setMsg(resultBean.getMsg()); |
|
|
|
} |
|
|
|
baseMapper.updateStateBySid(4, query.getBusinessSid(), DateUtil.date()); |
|
|
|
baseMapper.updateStateBySid(4, query.getBusinessSid()); |
|
|
|
updateFlowFiled(BeanUtil.beanToMap(resultBean.getData())); |
|
|
|
return rb.success().setData(resultBean.getData()); |
|
|
|
} |
|
|
@ -744,7 +747,7 @@ public class BusDeliveredApplyService extends MybatisBaseService<BusDeliveredApp |
|
|
|
//根据申请人sid查询分公司sid
|
|
|
|
ResultBean<String> stringResultBean = sysStaffOrgFeign.getPathSidByUserSid(appDeliveredApplyDto.getUserSid()); |
|
|
|
if (stringResultBean.getSuccess()) { |
|
|
|
busDeliveredApply.setOrgSid(stringResultBean.getData()); |
|
|
|
busDeliveredApply.setUseOrgSid(stringResultBean.getData()); |
|
|
|
} |
|
|
|
if (carList.size() > 0) { |
|
|
|
String vin = carList.get(0).getVin(); |
|
|
@ -756,7 +759,7 @@ public class BusDeliveredApplyService extends MybatisBaseService<BusDeliveredApp |
|
|
|
busDeliveredService.updateState(vinNo, 0); |
|
|
|
} |
|
|
|
} |
|
|
|
baseMapper.updateStateBySid(2, dtoSid, DateUtil.date()); |
|
|
|
baseMapper.updateStateBySid(2, dtoSid); |
|
|
|
busDeliveredApply.setApplySid(sysUserVo.getSid()); |
|
|
|
busDeliveredApply.setApplyName(sysUserVo.getName()); |
|
|
|
busDeliveredApply.setModelSid(baseVehicle.getModelSid()); |
|
|
@ -801,16 +804,7 @@ public class BusDeliveredApplyService extends MybatisBaseService<BusDeliveredApp |
|
|
|
for (AppCarListVo v : voList) { |
|
|
|
String contractNo = vo.getContractNo(); |
|
|
|
CommonContract commonContract = commonContractFeign.selectByNo(contractNo).getData(); |
|
|
|
// String customerSid = commonContract.getCustomerSid();
|
|
|
|
// CrmCustomerTempVo data = crmCustomerTempFeign.fetchSid(customerSid).getData();
|
|
|
|
AppUseInfoVo appUseInfoVo = null; |
|
|
|
// if (data != null) {
|
|
|
|
// appUseInfoVo = new AppUseInfoVo();
|
|
|
|
// appUseInfoVo.setMobile(data.getMobile());
|
|
|
|
// appUseInfoVo.setCustomer(data.getName());
|
|
|
|
// appUseInfoVo.setAddress(data.getAddress());
|
|
|
|
// appUseInfoVo.setIdNumber(data.getIDNumber());
|
|
|
|
// }
|
|
|
|
v.setUseInfo(appUseInfoVo); |
|
|
|
} |
|
|
|
} |
|
|
@ -871,7 +865,7 @@ public class BusDeliveredApplyService extends MybatisBaseService<BusDeliveredApp |
|
|
|
String vinNo = stringList.get(i); |
|
|
|
busDeliveredService.updateState(vinNo, 0); |
|
|
|
} |
|
|
|
baseMapper.updateStateBySid(2, sid, DateUtil.date()); |
|
|
|
baseMapper.updateStateBySid(2, sid); |
|
|
|
String businessSid = resultBean.getData(); |
|
|
|
//创建BusinessVariables实体对象
|
|
|
|
BusinessVariables bv = new BusinessVariables(); |
|
|
@ -915,7 +909,7 @@ public class BusDeliveredApplyService extends MybatisBaseService<BusDeliveredApp |
|
|
|
return rb.setMsg("参数错误:instanceId"); |
|
|
|
} |
|
|
|
bv.setTaskId(busDeliveredApply.getTaskId()); |
|
|
|
bv.setTaskDefKey(busDeliveredApply.getNodeId()); |
|
|
|
bv.setTaskDefKey(busDeliveredApply.getTaskDefKey()); |
|
|
|
bv.setComment(StringUtils.isNotBlank(dto.getComment()) ? dto.getComment() : "重新提交"); |
|
|
|
bv.setInstanceId(dto.getInstanceId()); |
|
|
|
return complete(bv); |
|
|
|