|
@ -30,6 +30,10 @@ import cn.hutool.core.date.DateUtil; |
|
|
import com.alibaba.fastjson.JSON; |
|
|
import com.alibaba.fastjson.JSON; |
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
|
|
import com.yxt.anrui.base.api.basevehicle.BaseVehicle; |
|
|
|
|
|
import com.yxt.anrui.base.api.basevehicle.BaseVehicleFeign; |
|
|
|
|
|
import com.yxt.anrui.base.api.commoncontract.CommonContract; |
|
|
|
|
|
import com.yxt.anrui.base.api.commoncontract.CommonContractFeign; |
|
|
import com.yxt.anrui.buscenter.api.busdeliveredapply.*; |
|
|
import com.yxt.anrui.buscenter.api.busdeliveredapply.*; |
|
|
import com.yxt.anrui.buscenter.api.busdeliveredapplydetails.AppCarListDto; |
|
|
import com.yxt.anrui.buscenter.api.busdeliveredapplydetails.AppCarListDto; |
|
|
import com.yxt.anrui.buscenter.api.busdeliveredapplydetails.AppCarListVo; |
|
|
import com.yxt.anrui.buscenter.api.busdeliveredapplydetails.AppCarListVo; |
|
@ -106,6 +110,10 @@ public class BusDeliveredApplyService extends MybatisBaseService<BusDeliveredApp |
|
|
private FlowTaskFeign flowTaskFeign; |
|
|
private FlowTaskFeign flowTaskFeign; |
|
|
@Autowired |
|
|
@Autowired |
|
|
SysUserFeign sysUserFeign; |
|
|
SysUserFeign sysUserFeign; |
|
|
|
|
|
@Autowired |
|
|
|
|
|
CommonContractFeign commonContractFeign; |
|
|
|
|
|
@Autowired |
|
|
|
|
|
BaseVehicleFeign baseVehicleFeign; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 构造出库申请的查询条件 |
|
|
* 构造出库申请的查询条件 |
|
@ -710,11 +718,16 @@ public class BusDeliveredApplyService extends MybatisBaseService<BusDeliveredApp |
|
|
*/ |
|
|
*/ |
|
|
public IPage<AppDeliveredApplyPageVo> getRetrievalApplyList(PagerQuery<AppDeliveredApplyPageQuery> pagerQuery) { |
|
|
public IPage<AppDeliveredApplyPageVo> getRetrievalApplyList(PagerQuery<AppDeliveredApplyPageQuery> pagerQuery) { |
|
|
QueryWrapper<AppDeliveredApplyPageQuery> qw = new QueryWrapper<>(); |
|
|
QueryWrapper<AppDeliveredApplyPageQuery> qw = new QueryWrapper<>(); |
|
|
if (StringUtils.isNotBlank(pagerQuery.getParams().getName())) { |
|
|
String orgPath = pagerQuery.getParams().getOrgPath(); |
|
|
qw.eq("name", pagerQuery.getParams().getName()); |
|
|
String orgSid = ""; |
|
|
|
|
|
if (StringUtils.isNotBlank(orgPath)) { |
|
|
|
|
|
orgSid = sysStaffOrgFeign.getOrgSidByPath(orgPath).getData(); |
|
|
|
|
|
} else { |
|
|
|
|
|
orgSid = sysStaffOrgFeign.getPathSidByUserSid(pagerQuery.getParams().getUserSid()).getData(); |
|
|
} |
|
|
} |
|
|
|
|
|
qw.eq("orgSid", orgSid); |
|
|
IPage<AppDeliveredApplyPageQuery> page = PagerUtil.queryToPage(pagerQuery); |
|
|
IPage<AppDeliveredApplyPageQuery> page = PagerUtil.queryToPage(pagerQuery); |
|
|
IPage<AppDeliveredApplyPageVo> iPage = baseMapper.getRetrievalApplyList(page, qw); |
|
|
IPage<AppDeliveredApplyPageVo> iPage = baseMapper.getRetrievalApplyList(page, qw, pagerQuery.getParams().getName()); |
|
|
return iPage; |
|
|
return iPage; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -723,33 +736,46 @@ public class BusDeliveredApplyService extends MybatisBaseService<BusDeliveredApp |
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
String dtoSid = appDeliveredApplyDto.getSid(); |
|
|
String dtoSid = appDeliveredApplyDto.getSid(); |
|
|
SysUserVo sysUserVo = sysUserFeign.fetchBySid(appDeliveredApplyDto.getUserSid()).getData(); |
|
|
SysUserVo sysUserVo = sysUserFeign.fetchBySid(appDeliveredApplyDto.getUserSid()).getData(); |
|
|
|
|
|
BaseVehicle baseVehicle = null; |
|
|
if (StringUtils.isBlank(dtoSid)) { |
|
|
if (StringUtils.isBlank(dtoSid)) { |
|
|
BusDeliveredApply busDeliveredApply = new BusDeliveredApply(); |
|
|
BusDeliveredApply busDeliveredApply = new BusDeliveredApply(); |
|
|
BeanUtil.copyProperties(appDeliveredApplyDto, busDeliveredApply, "sid"); |
|
|
BeanUtil.copyProperties(appDeliveredApplyDto, busDeliveredApply, "sid"); |
|
|
List<AppCarListDto> carList = appDeliveredApplyDto.getCarList(); |
|
|
List<AppCarListDto> carList = appDeliveredApplyDto.getCarList(); |
|
|
if (carList.size() > 0) { |
|
|
|
|
|
busDeliveredApplyDetailsService.appSaveList(carList, busDeliveredApply.getSid()); |
|
|
|
|
|
} |
|
|
|
|
|
//根据申请人sid查询分公司sid
|
|
|
//根据申请人sid查询分公司sid
|
|
|
ResultBean<String> stringResultBean = sysStaffOrgFeign.getPathSidByUserSid(appDeliveredApplyDto.getUserSid()); |
|
|
ResultBean<String> stringResultBean = sysStaffOrgFeign.getPathSidByUserSid(appDeliveredApplyDto.getUserSid()); |
|
|
if (stringResultBean.getSuccess()) { |
|
|
if (stringResultBean.getSuccess()) { |
|
|
busDeliveredApply.setOrgSid(stringResultBean.getData()); |
|
|
busDeliveredApply.setOrgSid(stringResultBean.getData()); |
|
|
} |
|
|
} |
|
|
|
|
|
if (carList.size() > 0) { |
|
|
|
|
|
String vin = carList.get(0).getVin(); |
|
|
|
|
|
baseVehicle = baseVehicleFeign.selectByVinNoAndOrgSid(vin, stringResultBean.getData()).getData(); |
|
|
|
|
|
busDeliveredApplyDetailsService.appSaveList(carList, busDeliveredApply.getSid()); |
|
|
|
|
|
} |
|
|
busDeliveredApply.setApplySid(sysUserVo.getSid()); |
|
|
busDeliveredApply.setApplySid(sysUserVo.getSid()); |
|
|
busDeliveredApply.setApplyName(sysUserVo.getName()); |
|
|
busDeliveredApply.setApplyName(sysUserVo.getName()); |
|
|
|
|
|
busDeliveredApply.setModelSid(baseVehicle.getModelSid()); |
|
|
|
|
|
busDeliveredApply.setConfigSid(baseVehicle.getModelConfigSid()); |
|
|
save(busDeliveredApply); |
|
|
save(busDeliveredApply); |
|
|
} else { |
|
|
} else { |
|
|
BusDeliveredApply busDeliveredApply = fetchBySid(dtoSid); |
|
|
BusDeliveredApply busDeliveredApply = fetchBySid(dtoSid); |
|
|
if (busDeliveredApply == null) { |
|
|
if (busDeliveredApply == null) { |
|
|
return rb.setMsg("该申请不存在"); |
|
|
return rb.setMsg("该申请不存在"); |
|
|
} |
|
|
} |
|
|
|
|
|
BeanUtil.copyProperties(appDeliveredApplyDto, busDeliveredApply, "sid"); |
|
|
//删除
|
|
|
//删除
|
|
|
busDeliveredApplyDetailsService.deleteByApplySid(dtoSid); |
|
|
busDeliveredApplyDetailsService.deleteByApplySid(dtoSid); |
|
|
busDeliveredUseMessageService.deleteByApplySid(dtoSid); |
|
|
busDeliveredUseMessageService.deleteByApplySid(dtoSid); |
|
|
List<AppCarListDto> carList = appDeliveredApplyDto.getCarList(); |
|
|
List<AppCarListDto> carList = appDeliveredApplyDto.getCarList(); |
|
|
|
|
|
//根据申请人sid查询分公司sid
|
|
|
|
|
|
ResultBean<String> stringResultBean = sysStaffOrgFeign.getPathSidByUserSid(appDeliveredApplyDto.getUserSid()); |
|
|
if (carList.size() > 0) { |
|
|
if (carList.size() > 0) { |
|
|
|
|
|
String vin = carList.get(0).getVin(); |
|
|
|
|
|
baseVehicle = baseVehicleFeign.selectByVinNoAndOrgSid(vin, stringResultBean.getData()).getData(); |
|
|
|
|
|
busDeliveredApply.setModelSid(baseVehicle.getModelSid()); |
|
|
|
|
|
busDeliveredApply.setConfigSid(baseVehicle.getModelConfigSid()); |
|
|
busDeliveredApplyDetailsService.appSaveList(carList, busDeliveredApply.getSid()); |
|
|
busDeliveredApplyDetailsService.appSaveList(carList, busDeliveredApply.getSid()); |
|
|
} |
|
|
} |
|
|
|
|
|
updateById(busDeliveredApply); |
|
|
} |
|
|
} |
|
|
return rb.success().setData(dtoSid); |
|
|
return rb.success().setData(dtoSid); |
|
|
} |
|
|
} |
|
@ -760,24 +786,30 @@ public class BusDeliveredApplyService extends MybatisBaseService<BusDeliveredApp |
|
|
BusDeliveredApply busDeliveredApply = fetchBySid(sid); |
|
|
BusDeliveredApply busDeliveredApply = fetchBySid(sid); |
|
|
BeanUtil.copyProperties(busDeliveredApply, vo); |
|
|
BeanUtil.copyProperties(busDeliveredApply, vo); |
|
|
|
|
|
|
|
|
if (vo.getIsTerminal().equals("1")) { |
|
|
if (vo.getIsTerminal() == 1) { |
|
|
//根据出库申请单的sid查询需要出库的车辆信息
|
|
|
//根据出库申请单的sid查询需要出库的车辆信息
|
|
|
List<AppCarListVo> voList = busDeliveredApplyDetailsService.appDetailsList(sid); |
|
|
List<AppCarListVo> voList = busDeliveredApplyDetailsService.appDetailsList(sid); |
|
|
voList.removeAll(Collections.singleton(null)); |
|
|
voList.removeAll(Collections.singleton(null)); |
|
|
if (!voList.isEmpty()) { |
|
|
if (!voList.isEmpty()) { |
|
|
for (AppCarListVo v : voList) { |
|
|
for (AppCarListVo v : voList) { |
|
|
CrmCustomerTempVo data = crmCustomerTempFeign.selByMobile(vo.getMobile()).getData(); |
|
|
String contractNo = vo.getContractNo(); |
|
|
AppUseInfoVo appUseInfoVo = new AppUseInfoVo(); |
|
|
CommonContract commonContract = commonContractFeign.selectByNo(contractNo).getData(); |
|
|
appUseInfoVo.setMobile(data.getMobile()); |
|
|
// String customerSid = commonContract.getCustomerSid();
|
|
|
appUseInfoVo.setCustomer(data.getName()); |
|
|
// CrmCustomerTempVo data = crmCustomerTempFeign.fetchSid(customerSid).getData();
|
|
|
appUseInfoVo.setAddress(data.getAddress()); |
|
|
AppUseInfoVo appUseInfoVo = null; |
|
|
appUseInfoVo.setIdNumber(data.getIDNumber()); |
|
|
// 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); |
|
|
v.setUseInfo(appUseInfoVo); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
vo.setCarList(voList); |
|
|
vo.setCarList(voList); |
|
|
|
|
|
|
|
|
} else if (vo.getIsTerminal().equals("0")) { |
|
|
} else if (vo.getIsTerminal() == 0) { |
|
|
//根据出库申请单的sid查询需要出库的车辆信息
|
|
|
//根据出库申请单的sid查询需要出库的车辆信息
|
|
|
List<AppCarListVo> voList = busDeliveredApplyDetailsService.appDetailsList(sid); |
|
|
List<AppCarListVo> voList = busDeliveredApplyDetailsService.appDetailsList(sid); |
|
|
for (int i = 0; i < voList.size(); i++) { |
|
|
for (int i = 0; i < voList.size(); i++) { |
|
@ -787,13 +819,116 @@ public class BusDeliveredApplyService extends MybatisBaseService<BusDeliveredApp |
|
|
appUseInfoVo.setCustomer(busDeliveredUseMessage.getName()); |
|
|
appUseInfoVo.setCustomer(busDeliveredUseMessage.getName()); |
|
|
appUseInfoVo.setAddress(busDeliveredUseMessage.getAddress()); |
|
|
appUseInfoVo.setAddress(busDeliveredUseMessage.getAddress()); |
|
|
appUseInfoVo.setIdNumber(busDeliveredUseMessage.getIdNo()); |
|
|
appUseInfoVo.setIdNumber(busDeliveredUseMessage.getIdNo()); |
|
|
|
|
|
appUseInfoVo.setProvince(busDeliveredUseMessage.getProvince()); |
|
|
|
|
|
appUseInfoVo.setCity(busDeliveredUseMessage.getCity()); |
|
|
|
|
|
appUseInfoVo.setCounty(busDeliveredUseMessage.getCounty()); |
|
|
voList.get(i).setUseInfo(appUseInfoVo); |
|
|
voList.get(i).setUseInfo(appUseInfoVo); |
|
|
} |
|
|
} |
|
|
vo.setCarList(voList); |
|
|
vo.setCarList(voList); |
|
|
} |
|
|
} |
|
|
|
|
|
vo.setSid(sid); |
|
|
return rb.success().setData(vo); |
|
|
return rb.success().setData(vo); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public ResultBean submitAppDeliveredApply(AppSubmitDeliveredApplyDto dto) { |
|
|
|
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
|
|
|
//根据用户sid获取staffSid
|
|
|
|
|
|
ResultBean<SysUserVo> userVoResultBean = sysUserFeign.fetchBySid(dto.getUserSid()); |
|
|
|
|
|
if (!userVoResultBean.getSuccess()) { |
|
|
|
|
|
return rb.setMsg(userVoResultBean.getMsg()); |
|
|
|
|
|
} |
|
|
|
|
|
//根据staffSid获取用户的组织全路径
|
|
|
|
|
|
ResultBean<SysStaffOrg> staffOrgResultBean = sysStaffOrgFeign.getOrgByStaffSid(userVoResultBean.getData().getStaffSid()); |
|
|
|
|
|
if (!staffOrgResultBean.getSuccess()) { |
|
|
|
|
|
return rb.setMsg(staffOrgResultBean.getMsg()); |
|
|
|
|
|
} |
|
|
|
|
|
//用户的组织全路径
|
|
|
|
|
|
String orgSidPath = staffOrgResultBean.getData().getOrgSidPath(); |
|
|
|
|
|
BusDeliveredApply busDeliveredApply = fetchBySid(dto.getSid()); |
|
|
|
|
|
int r = submitAppBusinessData(dto, busDeliveredApply); |
|
|
|
|
|
if (r == 3) { |
|
|
|
|
|
return rb.setMsg("该申请不存在"); |
|
|
|
|
|
} |
|
|
|
|
|
if (r == 0) { |
|
|
|
|
|
return rb.setMsg("操作失败!提交的数据不一致"); |
|
|
|
|
|
} |
|
|
|
|
|
//新增修改保存
|
|
|
|
|
|
ResultBean<String> resultBean = saveRetrievalApplyInfo(dto); |
|
|
|
|
|
if (!resultBean.getSuccess()) { |
|
|
|
|
|
return rb.setMsg(resultBean.getMsg()); |
|
|
|
|
|
} |
|
|
|
|
|
String sid = resultBean.getData(); |
|
|
|
|
|
//更改状态
|
|
|
|
|
|
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()); |
|
|
|
|
|
String businessSid = resultBean.getData(); |
|
|
|
|
|
//创建BusinessVariables实体对象
|
|
|
|
|
|
BusinessVariables bv = new BusinessVariables(); |
|
|
|
|
|
//流程中的参数赋值
|
|
|
|
|
|
Map<String, Object> variables = BeanUtil.beanToMap(dto); |
|
|
|
|
|
//若有网关,则赋值网关中判断的字段。
|
|
|
|
|
|
variables.put("businessSid", businessSid); |
|
|
|
|
|
//用户的部门全路径sid
|
|
|
|
|
|
bv.setOrgSidPath(orgSidPath); |
|
|
|
|
|
//业务sid
|
|
|
|
|
|
bv.setBusinessSid(businessSid); |
|
|
|
|
|
//用户sid
|
|
|
|
|
|
bv.setUserSid(dto.getUserSid()); |
|
|
|
|
|
bv.setFormVariables(variables); |
|
|
|
|
|
//流程定义id
|
|
|
|
|
|
bv.setModelId(ProcDefEnum.BUSDELIVEREDAPPLY.getProDefId()); |
|
|
|
|
|
if (r == 1) { |
|
|
|
|
|
ResultBean<UpdateFlowFieldVo> voResultBean = flowableFeign.startProcess(bv); |
|
|
|
|
|
UpdateFlowFieldVo ufVo = voResultBean.getData(); |
|
|
|
|
|
updateFlowFiled(BeanUtil.beanToMap(ufVo)); |
|
|
|
|
|
return voResultBean; |
|
|
|
|
|
} |
|
|
|
|
|
if (r == 2) { |
|
|
|
|
|
// ToDo:驳回到发起人后再次提交
|
|
|
|
|
|
if (StringUtils.isBlank(dto.getInstanceId())) { |
|
|
|
|
|
return rb.setMsg("参数错误:instanceId"); |
|
|
|
|
|
} |
|
|
|
|
|
bv.setTaskId(busDeliveredApply.getTaskId()); |
|
|
|
|
|
bv.setTaskDefKey(busDeliveredApply.getNodeId()); |
|
|
|
|
|
bv.setComment(StringUtils.isNotBlank(dto.getComment()) ? dto.getComment() : "重新提交"); |
|
|
|
|
|
bv.setInstanceId(dto.getInstanceId()); |
|
|
|
|
|
return complete(bv); |
|
|
|
|
|
} |
|
|
|
|
|
return rb; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 判断提交的流程是否被允许 |
|
|
|
|
|
* |
|
|
|
|
|
* @param dto |
|
|
|
|
|
* @return |
|
|
|
|
|
*/ |
|
|
|
|
|
private synchronized int submitAppBusinessData(AppSubmitDeliveredApplyDto dto, BusDeliveredApply busDeliveredApply) { |
|
|
|
|
|
int r = 0; |
|
|
|
|
|
if (StringUtils.isBlank(dto.getSid())) { |
|
|
|
|
|
r = 1; |
|
|
|
|
|
} else { |
|
|
|
|
|
if (busDeliveredApply != null) { |
|
|
|
|
|
String businessTaskId = busDeliveredApply.getTaskId(); |
|
|
|
|
|
if (StringUtils.isBlank(businessTaskId) && StringUtils.isBlank(dto.getTaskId())) { |
|
|
|
|
|
//新提交
|
|
|
|
|
|
r = 1; |
|
|
|
|
|
} else if (StringUtils.isNotBlank(businessTaskId) && businessTaskId.equals(dto.getTaskId())) { |
|
|
|
|
|
//二次提交//只有数据一致的时候才能进行下一步
|
|
|
|
|
|
r = 2; |
|
|
|
|
|
} |
|
|
|
|
|
} else { |
|
|
|
|
|
r = 3; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
return r; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
// public ResultBean<AppDeliveredApplyInfoVo> getRetrievalDetail(String contractSid) {
|
|
|
// public ResultBean<AppDeliveredApplyInfoVo> getRetrievalDetail(String contractSid) {
|
|
|
// ResultBean<AppDeliveredApplyInfoVo> rb = ResultBean.fireFail();
|
|
|
// ResultBean<AppDeliveredApplyInfoVo> rb = ResultBean.fireFail();
|
|
|
// AppDeliveredApplyInfoVo vo = new AppDeliveredApplyInfoVo();
|
|
|
// AppDeliveredApplyInfoVo vo = new AppDeliveredApplyInfoVo();
|
|
|