|
|
@ -85,6 +85,7 @@ import com.yxt.anrui.flowable.api.flow.FlowableFeign; |
|
|
|
import com.yxt.anrui.flowable.api.flow.UpdateFlowFieldVo; |
|
|
|
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.utils.ProcDefEnum; |
|
|
|
import com.yxt.anrui.flowable.sqloperationsymbol.BusinessVariables; |
|
|
|
import com.yxt.anrui.portal.api.dictcommon.DictCommonFeign; |
|
|
@ -531,14 +532,6 @@ 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); |
|
|
|
} |
|
|
|
//更改申请的状态为待审核2
|
|
|
|
baseMapper.updateStateBySid(2, sid);*/ |
|
|
|
String businessSid = resultBean.getData(); |
|
|
|
//创建BusinessVariables实体对象
|
|
|
|
BusinessVariables bv = new BusinessVariables(); |
|
|
@ -581,14 +574,7 @@ public class BusDeliveredApplyService extends MybatisBaseService<BusDeliveredApp |
|
|
|
bv.setTaskDefKey(busDeliveredApply.getTaskDefKey()); |
|
|
|
bv.setComment("重新提交"); |
|
|
|
bv.setInstanceId(dto.getInstanceId()); |
|
|
|
//将待出库中的车辆更改状态为出库申请0
|
|
|
|
List<String> stringList = busDeliveredApplyDetailsService.selectVinByApplySid(sid); |
|
|
|
for (int i = 0; i < stringList.size(); i++) { |
|
|
|
String vinNo = stringList.get(i); |
|
|
|
busDeliveredService.updateState(vinNo, 0); |
|
|
|
} |
|
|
|
//更改申请的状态为待审核2
|
|
|
|
baseMapper.updateStateBySid(2, sid); |
|
|
|
|
|
|
|
return complete(bv); |
|
|
|
} |
|
|
|
return rb; |
|
|
@ -677,8 +663,17 @@ public class BusDeliveredApplyService extends MybatisBaseService<BusDeliveredApp |
|
|
|
log.error("推送数据失败=========================" + e.getMessage()); |
|
|
|
return rb.setMsg("推送数据失败"); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
if ("重新提交".equals(bv.getComment())) { |
|
|
|
//将待出库中的车辆更改状态为出库申请0
|
|
|
|
List<String> stringList = busDeliveredApplyDetailsService.selectVinByApplySid(bv.getBusinessSid()); |
|
|
|
for (int i = 0; i < stringList.size(); i++) { |
|
|
|
String vinNo = stringList.get(i); |
|
|
|
busDeliveredService.updateState(vinNo, 0); |
|
|
|
} |
|
|
|
//更改申请的状态为待审核2
|
|
|
|
baseMapper.updateStateBySid(2, bv.getBusinessSid()); |
|
|
|
} |
|
|
|
} |
|
|
|
return rb.success().setData(resultBean.getData()); |
|
|
|
} else { |
|
|
@ -822,9 +817,23 @@ public class BusDeliveredApplyService extends MybatisBaseService<BusDeliveredApp |
|
|
|
if ("1".equals(busDeliveredApply.getPaymentMethodKey())) { |
|
|
|
baseVehicleZSOutApplyDto.setSaleTypeKey("001"); |
|
|
|
baseVehicleZSOutApplyDto.setSaleTypeValue("全款车"); |
|
|
|
baseVehicleZSOutApplyDto.setCustomerName(busDeliveredApply.getName()); |
|
|
|
baseVehicleZSOutApplyDto.setCustomerSid(busDeliveredApply.getCustomerSid()); |
|
|
|
//客户编码
|
|
|
|
ResultBean<CrmCustomerTempVo> crmCustomerTempVoResultBean = crmCustomerTempFeign.fetchSid(busDeliveredApply.getCustomerSid()); |
|
|
|
if (crmCustomerTempVoResultBean.getData() != null) { |
|
|
|
baseVehicleZSOutApplyDto.setCustomerNo(crmCustomerTempVoResultBean.getData().getCustomerNo()); |
|
|
|
} |
|
|
|
} else { |
|
|
|
baseVehicleZSOutApplyDto.setSaleTypeKey("002"); |
|
|
|
baseVehicleZSOutApplyDto.setSaleTypeValue("贷款车"); |
|
|
|
baseVehicleZSOutApplyDto.setCustomerName(busDeliveredApply.getLoanName()); |
|
|
|
baseVehicleZSOutApplyDto.setCustomerSid(busDeliveredApply.getLoanSid()); |
|
|
|
//客户编码
|
|
|
|
ResultBean<CrmCustomerTempVo> crmCustomerTempVoResultBean = crmCustomerTempFeign.fetchSid(busDeliveredApply.getLoanSid()); |
|
|
|
if (crmCustomerTempVoResultBean.getData() != null) { |
|
|
|
baseVehicleZSOutApplyDto.setCustomerNo(crmCustomerTempVoResultBean.getData().getCustomerNo()); |
|
|
|
} |
|
|
|
} |
|
|
|
baseVehicleZSOutApplyDto.setSaleDate(DateUtil.today()); |
|
|
|
baseVehicleZSOutApplyDto.setOrgSid(busDeliveredApply.getStaffDeptSid()); |
|
|
@ -834,9 +843,9 @@ public class BusDeliveredApplyService extends MybatisBaseService<BusDeliveredApp |
|
|
|
} |
|
|
|
|
|
|
|
baseVehicleZSOutApplyDto.setStaffName(busDeliveredApply.getStaffName()); |
|
|
|
baseVehicleZSOutApplyDto.setCustomerName(busDeliveredApply.getName()); |
|
|
|
|
|
|
|
baseVehicleZSOutApplyDto.setMobile(busDeliveredApply.getMobile()); |
|
|
|
baseVehicleZSOutApplyDto.setCustomerSid(busDeliveredApply.getCustomerSid()); |
|
|
|
|
|
|
|
//总成交价
|
|
|
|
baseVehicleZSOutApplyDto.setTotalDealPrice(new BigDecimal(busDeliveredApply.getPrice()).multiply(new BigDecimal(detailsList.size())).toString()); |
|
|
|
baseVehicleZSOutApplyDto.setCreateOrgSid(busDeliveredApply.getUseOrgSid()); |
|
|
@ -851,11 +860,7 @@ public class BusDeliveredApplyService extends MybatisBaseService<BusDeliveredApp |
|
|
|
} |
|
|
|
//合同编号
|
|
|
|
baseVehicleZSOutApplyDto.setContractNo(busDeliveredApply.getContractNo()); |
|
|
|
//客户编码
|
|
|
|
ResultBean<CrmCustomerTempVo> crmCustomerTempVoResultBean = crmCustomerTempFeign.fetchSid(busDeliveredApply.getCustomerSid()); |
|
|
|
if (crmCustomerTempVoResultBean.getData() != null) { |
|
|
|
baseVehicleZSOutApplyDto.setCustomerNo(crmCustomerTempVoResultBean.getData().getCustomerNo()); |
|
|
|
} |
|
|
|
|
|
|
|
//实际购车人key
|
|
|
|
baseVehicleZSOutApplyDto.setBuyerTypeKey(busDeliveredApply.getTypeKey()); |
|
|
|
baseVehicleZSOutApplyDto.setBuyerTypeValue(busDeliveredApply.getType()); |
|
|
@ -964,6 +969,15 @@ public class BusDeliveredApplyService extends MybatisBaseService<BusDeliveredApp |
|
|
|
if (businessTaskId.equals(query.getTaskId())) { |
|
|
|
FlowTaskVo flowTaskVo = new FlowTaskVo(); |
|
|
|
BeanUtil.copyProperties(query, flowTaskVo); |
|
|
|
Map<String,Object> variables = new HashMap<>(); |
|
|
|
//若app移动端有此功能,则传递appMap参数
|
|
|
|
Map<String, Object> appMap = new HashMap<>(); |
|
|
|
//需和移动端沟通业务sid保存的属性具体值:appMap中sid不是固定的。移动端提供具体字段。
|
|
|
|
appMap.put("outboundSid", query.getBusinessSid()); |
|
|
|
appMap.put("contractId", busDeliveredApply.getContractNo()); |
|
|
|
appMap.put("contract_id", busDeliveredApply.getContractNo()); |
|
|
|
variables.put("app", appMap); |
|
|
|
flowTaskVo.setValues(variables); |
|
|
|
ResultBean<UpdateFlowFieldVo> resultBean = flowableFeign.taskReject(flowTaskVo); |
|
|
|
if (!resultBean.getSuccess()) { |
|
|
|
return rb.setMsg(resultBean.getMsg()); |
|
|
@ -971,11 +985,41 @@ public class BusDeliveredApplyService extends MybatisBaseService<BusDeliveredApp |
|
|
|
baseMapper.updateStateBySid(1, query.getBusinessSid()); |
|
|
|
Map<String, Object> map = BeanUtil.beanToMap(resultBean.getData()); |
|
|
|
//更新业务中的流程相关的参数
|
|
|
|
|
|
|
|
updateFlowFiled(map); |
|
|
|
//将该申请的车架号的待出库中的状态修改为出库中
|
|
|
|
List<String> vinSidList = busDeliveredApplyDetailsService.selectVinSidByApplySid(query.getBusinessSid()); |
|
|
|
//更新该合同的该车架号的状态为1
|
|
|
|
busDeliveredService.updateStateByContractNo(busDeliveredApply.getContractNo(), vinSidList, 1); |
|
|
|
busDeliveredApply = fetchBySid(query.getBusinessSid()); |
|
|
|
ResultBean<List<LatestTaskVo>> listResultBean = flowTaskFeign.getLatestTasks(busDeliveredApply.getProcInstId()); |
|
|
|
String nextNodeUserSids = listResultBean.getData().get(0).getASSIGNEE_(); |
|
|
|
String nextName = listResultBean.getData().get(0).getName_(); |
|
|
|
List<String> receiveSidList = Arrays.asList(nextNodeUserSids.split(",")); |
|
|
|
if ("发起申请".equals(nextName)) { |
|
|
|
List<String> vinSidList = busDeliveredApplyDetailsService.selectVinSidByApplySid(query.getBusinessSid()); |
|
|
|
//更新该合同的该车架号的状态为1
|
|
|
|
busDeliveredService.updateStateByContractNo(busDeliveredApply.getContractNo(), vinSidList, 1); |
|
|
|
} |
|
|
|
//极光推送
|
|
|
|
UpdateFlowFieldVo ufVo = resultBean.getData(); |
|
|
|
busDeliveredApply = fetchBySid(query.getBusinessSid()); |
|
|
|
MessageFlowableQuery messageFlowableQuery = new MessageFlowableQuery(); |
|
|
|
MessageFlowVo messageFlowVo = new MessageFlowVo(); |
|
|
|
BeanUtil.copyProperties(ufVo, messageFlowVo); |
|
|
|
messageFlowVo.setProcInsId(busDeliveredApply.getProcInstId()); |
|
|
|
messageFlowVo.setProcDefId(busDeliveredApply.getProcDefId()); |
|
|
|
messageFlowableQuery.setUfVo(messageFlowVo); |
|
|
|
messageFlowableQuery.setAppMap((Map<String, Object>) variables.get("app")); |
|
|
|
messageFlowableQuery.setBusinessSid(query.getBusinessSid()); |
|
|
|
messageFlowableQuery.setModuleName("出库申请"); |
|
|
|
ResultBean<List<LatestTaskVo>> listResultBean2 = flowTaskFeign.getLatestTasks(busDeliveredApply.getProcInstId()); |
|
|
|
String nextNodeUserSids2 = listResultBean2.getData().get(0).getASSIGNEE_(); |
|
|
|
String nextName2 = listResultBean2.getData().get(0).getName_(); |
|
|
|
if ("发起申请".equals(nextName2)) { |
|
|
|
messageFlowableQuery.setMsgContent("您提交的" + messageFlowableQuery.getModuleName() + "已被驳回,请重新提交"); |
|
|
|
} else { |
|
|
|
messageFlowableQuery.setMsgContent(busDeliveredApply.getStaffName() + "提交的" + messageFlowableQuery.getModuleName() + ",请审批"); |
|
|
|
} |
|
|
|
messageFlowableQuery.setMsgTitle("出库申请"); |
|
|
|
ResultBean<String> stringResultBean = messageFeign.pushMessage(messageFlowableQuery); |
|
|
|
|
|
|
|
return rb.success(); |
|
|
|
} |
|
|
|
} |
|
|
@ -990,7 +1034,6 @@ public class BusDeliveredApplyService extends MybatisBaseService<BusDeliveredApp |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
public ResultBean revokeProcess(BusDeliveredApplyTaskQuery query) { |
|
|
|
|
|
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
|
if (StringUtils.isBlank(query.getUserSid())) { |
|
|
|
return rb.setMsg("参数错误:userSid"); |
|
|
@ -1008,10 +1051,17 @@ public class BusDeliveredApplyService extends MybatisBaseService<BusDeliveredApp |
|
|
|
} |
|
|
|
baseMapper.updateStateBySid(1, query.getBusinessSid()); |
|
|
|
updateFlowFiled(BeanUtil.beanToMap(resultBean.getData())); |
|
|
|
//将该申请的车架号的待出库中的状态修改为出库中
|
|
|
|
List<String> vinSidList = busDeliveredApplyDetailsService.selectVinSidByApplySid(query.getBusinessSid()); |
|
|
|
//更新该合同的该车架号的状态为0
|
|
|
|
busDeliveredService.updateStateByContractNo(busDeliveredApply.getContractNo(), vinSidList, 1); |
|
|
|
busDeliveredApply = fetchBySid(query.getBusinessSid()); |
|
|
|
ResultBean<List<LatestTaskVo>> listResultBean = flowTaskFeign.getLatestTasks(busDeliveredApply.getProcInstId()); |
|
|
|
String nextNodeUserSids = listResultBean.getData().get(0).getASSIGNEE_(); |
|
|
|
String nextName = listResultBean.getData().get(0).getName_(); |
|
|
|
List<String> receiveSidList = Arrays.asList(nextNodeUserSids.split(",")); |
|
|
|
if ("发起申请".equals(nextName)) { |
|
|
|
List<String> vinSidList = busDeliveredApplyDetailsService.selectVinSidByApplySid(query.getBusinessSid()); |
|
|
|
//更新该合同的该车架号的状态为1
|
|
|
|
busDeliveredService.updateStateByContractNo(busDeliveredApply.getContractNo(), vinSidList, 1); |
|
|
|
} |
|
|
|
|
|
|
|
return rb.success().setData(resultBean.getData()); |
|
|
|
} |
|
|
|
} |
|
|
@ -1045,9 +1095,8 @@ public class BusDeliveredApplyService extends MybatisBaseService<BusDeliveredApp |
|
|
|
} |
|
|
|
baseMapper.updateStateBySid(4, query.getBusinessSid()); |
|
|
|
updateFlowFiled(BeanUtil.beanToMap(resultBean.getData())); |
|
|
|
//将该申请的车架号的待出库中的状态修改为出库中
|
|
|
|
List<String> vinSidList = busDeliveredApplyDetailsService.selectVinSidByApplySid(query.getBusinessSid()); |
|
|
|
//更新该合同的该车架号的状态为0
|
|
|
|
//更新该合同的该车架号的状态为1
|
|
|
|
busDeliveredService.updateStateByContractNo(busDeliveredApply.getContractNo(), vinSidList, 1); |
|
|
|
return rb.success().setData(resultBean.getData()); |
|
|
|
} |
|
|
@ -1262,15 +1311,11 @@ public class BusDeliveredApplyService extends MybatisBaseService<BusDeliveredApp |
|
|
|
busDeliveredUseMessageService.insert(busDeliveredUseMessage); |
|
|
|
busDeliveredApplyDetails.setUseMessageSid(busDeliveredUseMessage.getSid()); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
busDeliveredApplyDetailsService.insert(busDeliveredApplyDetails); |
|
|
|
} |
|
|
|
baseMapper.insert(busDeliveredApply); |
|
|
|
sid = busDeliveredApply.getSid(); |
|
|
|
|
|
|
|
} else { |
|
|
|
//根据出库申请sid查询出库申请是否存在
|
|
|
|
BusDeliveredApply busDeliveredApply = fetchBySid(sid); |
|
|
@ -1348,7 +1393,6 @@ public class BusDeliveredApplyService extends MybatisBaseService<BusDeliveredApp |
|
|
|
busDeliveredDetailsDiscount.setDiscountExplain(busDeliveredDetailsDiscountsVo.getDiscountInfo()); |
|
|
|
//数量
|
|
|
|
BusSalesOrderDiscount busSalesOrderDiscount = busSalesOrderDiscountService.fetchBySid(busDeliveredDetailsDiscountsVo.getDiscountSid()); |
|
|
|
// busDeliveredDetailsDiscount.setNum(busDeliveredDetailsDiscountsVo.getTotalNum());
|
|
|
|
busDeliveredDetailsDiscount.setNum(busSalesOrderDiscount.getNum()); |
|
|
|
//本次赠送数量
|
|
|
|
busDeliveredDetailsDiscount.setGiveNum(busDeliveredDetailsDiscountsVo.getDiscountNum()); |
|
|
@ -1570,6 +1614,7 @@ public class BusDeliveredApplyService extends MybatisBaseService<BusDeliveredApp |
|
|
|
//需和移动端沟通业务sid保存的属性具体值:appMap中sid不是固定的。移动端提供具体字段。
|
|
|
|
appMap.put("outboundSid", businessSid); |
|
|
|
appMap.put("contractId", busDeliveredApply.getContractNo()); |
|
|
|
appMap.put("contract_id", busDeliveredApply.getContractNo()); |
|
|
|
variables.put("app", appMap); |
|
|
|
//流程定义id
|
|
|
|
bv.setModelId(ProcDefEnum.BUSDELIVEREDAPPLY.getProDefId()); |
|
|
|