|
|
@@ -141,107 +141,4 @@ public class ReturnGoodsManager extends AbstractOrderManager<ReturnGoodsRequest> |
|
|
|
return res; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void doTransaction(IssueOrderinfo order) throws ManagerException { |
|
|
|
List<TransactionStatus> transList = transactionManager.listByBizId(order.getOrderNo()); |
|
|
|
logger.info("开始执行跨库事务id:{},bizTypeList:{}", order.getId(), |
|
|
|
LambdaTools.doMap(transList, TransactionStatus::getBusinessType)); |
|
|
|
// 更新老库 |
|
|
|
OisBasicDataUpdateRequest req = new OisBasicDataUpdateRequest(); |
|
|
|
TransactionStatus syncCardTrans = |
|
|
|
transList.stream().filter(t -> t.getBusinessType() == ISSUE_CARD_SYNC).findFirst().orElse(null); |
|
|
|
TransactionStatus syncObuTrans = |
|
|
|
transList.stream().filter(t -> t.getBusinessType() == ISSUE_OBU_SYNC).findFirst().orElse(null); |
|
|
|
if (syncCardTrans != null) { |
|
|
|
req.setCardInfo(cardInfoRepo.findByCardId(order.getCardId())); |
|
|
|
} |
|
|
|
if (syncObuTrans != null) { |
|
|
|
req.setObuInfo(obuInfoRepo.findByObuId(order.getObuId())); |
|
|
|
} |
|
|
|
if (req.getCardInfo() != null || req.getObuInfo() != null) { |
|
|
|
try { |
|
|
|
logger.info("开始向老库同步卡签数据,{}", order.getOrderNo()); |
|
|
|
jsonPostRepeat(req); |
|
|
|
logger.info("向老库同步卡签数据成功"); |
|
|
|
if (syncCardTrans != null) { |
|
|
|
transactionManager.deleteById(syncCardTrans.getId()); |
|
|
|
} |
|
|
|
if (syncObuTrans != null) { |
|
|
|
transactionManager.deleteById(syncObuTrans.getId()); |
|
|
|
} |
|
|
|
} catch (ManagerException e) { |
|
|
|
logger.error("向老库同步卡签数据失败", e); |
|
|
|
} |
|
|
|
} |
|
|
|
// 上传订单 |
|
|
|
List<TransactionStatus> uploadOrderList = |
|
|
|
LambdaTools.doFilter(transList, t -> t.getBusinessType() == ISSUE_ORDER_SYNC); |
|
|
|
uploadOrderList.forEach(trans -> { |
|
|
|
try { |
|
|
|
IssueOrderinfoExt ext = orderInfoExtRepo.findByOrderNo(order.getOrderNo()); |
|
|
|
logger.info("开始上传订单数据,{}", order.getOrderNo()); |
|
|
|
saveOldOrder(order, ext); |
|
|
|
logger.info("上传订单数据成功"); |
|
|
|
transactionManager.deleteById(trans.getId()); |
|
|
|
} catch (ManagerException e) { |
|
|
|
logger.error("上传订单数据失败", e); |
|
|
|
} |
|
|
|
}); |
|
|
|
// 上传卡 |
|
|
|
List<TransactionStatus> uploadList = |
|
|
|
LambdaTools.doFilter(transList, t -> t.getBusinessType() == ISSUE_CARD_UPLOAD); |
|
|
|
uploadList.forEach(trans -> { |
|
|
|
try { |
|
|
|
QtkCardInfo cardInfo = cardInfoRepo.findByCardId(order.getCardId()); |
|
|
|
logger.info("开始上传卡数据,{}", cardInfo.getCardId()); |
|
|
|
YgzCardUploadRequest request = new YgzCardUploadRequest(); |
|
|
|
request.setCard(cardInfo); |
|
|
|
request.setOperation(Operation.ADD); |
|
|
|
request.setDataSource(DataSourceEnum.DSI_INTERFACE); |
|
|
|
cardUploadManager.serviceHandle(request); |
|
|
|
logger.info("上传卡数据成功"); |
|
|
|
transactionManager.deleteById(trans.getId()); |
|
|
|
} catch (ManagerException e) { |
|
|
|
logger.error("上传卡数据失败", e); |
|
|
|
} |
|
|
|
}); |
|
|
|
// 上传OBU |
|
|
|
List<TransactionStatus> obuUploadList = |
|
|
|
LambdaTools.doFilter(transList, t -> t.getBusinessType() == ISSUE_OBU_UPLOAD); |
|
|
|
obuUploadList.forEach(trans -> { |
|
|
|
try { |
|
|
|
QtkObuInfo obuInfo = obuInfoRepo.findByObuId(order.getObuId()); |
|
|
|
logger.info("开始上传签数据,{}", obuInfo.getObuId()); |
|
|
|
YgzObuUploadRequest request = new YgzObuUploadRequest(); |
|
|
|
request.setObu(obuInfo); |
|
|
|
request.setOperation(Operation.ADD); |
|
|
|
request.setDataSource(DataSourceEnum.DSI_INTERFACE); |
|
|
|
obuUploadManager.serviceHandle(request); |
|
|
|
logger.info("上传签数据成功"); |
|
|
|
transactionManager.deleteById(trans.getId()); |
|
|
|
} catch (ManagerException e) { |
|
|
|
logger.error("上传签数据失败", e); |
|
|
|
|
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void saveOldOrder(IssueOrderinfo order, IssueOrderinfoExt ext) throws ManagerException { |
|
|
|
// logger.info("保存历史订单开始+++++++++++++"); |
|
|
|
OisOrderSaveRequest req = new OisOrderSaveRequest(); |
|
|
|
req.setOrderId(order.getOrderNo()); |
|
|
|
req.setOrder(order); |
|
|
|
req.setExt(ext); |
|
|
|
if (StringTools.hasText(order.getCustomerId())) { |
|
|
|
QtkCustomerInfo customerInfo = customerInfoRepo.findByCustomerId(order.getCustomerId()); |
|
|
|
req.setQtkCustomerInfo(customerInfo); |
|
|
|
} |
|
|
|
QtkVehicleInfo vehicleInfo = vehicleInfoRepo.findByVehicleId(order.getVehicleId()); |
|
|
|
if (vehicleInfo != null) { |
|
|
|
req.setQtkVehicleInfo(vehicleInfo); |
|
|
|
} |
|
|
|
jsonPostRepeat(req); |
|
|
|
} |
|
|
|
} |