新增租电逻辑
This commit is contained in:
@ -1155,6 +1155,23 @@ public class OrderServiceImpl implements OrderService {
|
||||
throw new BizException("订单状态异常,非待取车状态");
|
||||
}
|
||||
|
||||
//同步租电订单
|
||||
LambdaQueryWrapper<OrderSubPO> querySubBatteryWrapper = new LambdaQueryWrapper<>();
|
||||
querySubBatteryWrapper.eq(OrderSubPO::getOrderId, orderMainPO.getOrderId())
|
||||
.eq(OrderSubPO::getSuborderType, SubOrderTypeEnum.RENTBATTEY.getCode())
|
||||
.orderByDesc(OrderSubPO::getCreatedAt)
|
||||
.last(" limit 1");
|
||||
OrderSubPO renBatteryOrderSubPO = orderSubRepo.getOne(querySubBatteryWrapper);
|
||||
if(renBatteryOrderSubPO!=null){
|
||||
Map<String, String> result = syncInteg.sendSubOrderId(renBatteryOrderSubPO.getSuborderId());
|
||||
String status = result.get("code");
|
||||
if (status.equals("40001") || status.equals("40002") || status.equals("40003") || status.equals("40005") || status.equals("40006")){
|
||||
throw new BizException("此用户在租电APP还有未完成的订单,请联系用户完成租电订单或是驳回此租车订单");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
LambdaQueryWrapper<OrderSubPO> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(OrderSubPO::getOrderId, orderMainPO.getOrderId())
|
||||
.eq(OrderSubPO::getSuborderType, SubOrderTypeEnum.RENTCAR.getCode())
|
||||
@ -1205,19 +1222,7 @@ public class OrderServiceImpl implements OrderService {
|
||||
.set(CarPO::getBrsStatus, CarStatusEnum.RENT_ING.getCode());
|
||||
carRepo.update(carPOLambdaUpdateWrapper);
|
||||
|
||||
//同步租电订单
|
||||
LambdaQueryWrapper<OrderSubPO> querySubBatteryWrapper = new LambdaQueryWrapper<>();
|
||||
querySubBatteryWrapper.eq(OrderSubPO::getOrderId, orderMainPO.getOrderId())
|
||||
.eq(OrderSubPO::getSuborderType, SubOrderTypeEnum.RENTBATTEY.getCode())
|
||||
.orderByDesc(OrderSubPO::getCreatedAt)
|
||||
.last(" limit 1");
|
||||
OrderSubPO renBatteryOrderSubPO = orderSubRepo.getOne(querySubBatteryWrapper);
|
||||
if(renBatteryOrderSubPO!=null){
|
||||
//异步同步租电订单
|
||||
ThreadPoolUtils.getThreadPool().execute(() -> {
|
||||
syncInteg.sendSubOrderId(renBatteryOrderSubPO.getSuborderId());
|
||||
});
|
||||
}
|
||||
|
||||
return getOrderInfoByOrderNo(bindCarToOrderReq.getOrderNo());
|
||||
} catch (Exception e){
|
||||
log.warn("绑定车辆失败",e);
|
||||
|
||||
@ -20,6 +20,8 @@ public class SyncInteg {
|
||||
Map<String, String> result = syncFacade.sendSubOrderId(subOrderId);
|
||||
if( "200".equals(result.get("code"))){
|
||||
return result;
|
||||
}else{
|
||||
return result;
|
||||
}
|
||||
} catch (Exception e){
|
||||
log.error("发送租电订单同步失败",e);
|
||||
|
||||
Reference in New Issue
Block a user