Merge branch 'main' into zhangli-test
This commit is contained in:
@ -22,6 +22,7 @@ import com.sczx.order.thirdpart.dto.req.CarQueryConditionReq;
|
|||||||
import com.sczx.order.thirdpart.integration.CarInteg;
|
import com.sczx.order.thirdpart.integration.CarInteg;
|
||||||
import com.sczx.order.thirdpart.integration.PayInteg;
|
import com.sczx.order.thirdpart.integration.PayInteg;
|
||||||
import com.sczx.order.thirdpart.integration.StoreInteg;
|
import com.sczx.order.thirdpart.integration.StoreInteg;
|
||||||
|
import com.sczx.order.thirdpart.integration.SyncInteg;
|
||||||
import com.sczx.order.utils.JwtUtil;
|
import com.sczx.order.utils.JwtUtil;
|
||||||
import com.sczx.order.utils.OrderUtil;
|
import com.sczx.order.utils.OrderUtil;
|
||||||
import com.sczx.order.utils.RedisUtil;
|
import com.sczx.order.utils.RedisUtil;
|
||||||
@ -78,6 +79,9 @@ public class OrderServiceImpl implements OrderService {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private PayService payService;
|
private PayService payService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SyncInteg syncInteg;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public OrderMainPO queryOrderMainPoByOrderNo(String orderNo, String delFlag) {
|
public OrderMainPO queryOrderMainPoByOrderNo(String orderNo, String delFlag) {
|
||||||
LambdaQueryWrapper<OrderMainPO> currentOrderWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<OrderMainPO> currentOrderWrapper = new LambdaQueryWrapper<>();
|
||||||
@ -823,6 +827,16 @@ public class OrderServiceImpl implements OrderService {
|
|||||||
.set(CarPO::getBrsStatus, CarStatusEnum.RENT_ING.getCode());
|
.set(CarPO::getBrsStatus, CarStatusEnum.RENT_ING.getCode());
|
||||||
carRepo.update(carPOLambdaUpdateWrapper);
|
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);
|
||||||
|
Long batterySubOrderId = renBatteryOrderSubPO.getSuborderId();
|
||||||
|
syncInteg.sendSubOrderId(batterySubOrderId);
|
||||||
|
|
||||||
return getOrderInfoByOrderNo(bindCarToOrderReq.getOrderNo());
|
return getOrderInfoByOrderNo(bindCarToOrderReq.getOrderNo());
|
||||||
} catch (Exception e){
|
} catch (Exception e){
|
||||||
log.warn("绑定车辆失败",e);
|
log.warn("绑定车辆失败",e);
|
||||||
|
|||||||
@ -0,0 +1,15 @@
|
|||||||
|
package com.sczx.order.thirdpart.facade;
|
||||||
|
|
||||||
|
|
||||||
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@FeignClient(name = "sczx-sync", url = "${sczx-sync.ribbon.listOfServers:}")
|
||||||
|
public interface SyncFacade {
|
||||||
|
|
||||||
|
@GetMapping("/send/subOrder/{subOrderId}")
|
||||||
|
Map<String, String> sendSubOrderId(@PathVariable Long subOrderId);
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,33 @@
|
|||||||
|
package com.sczx.order.thirdpart.integration;
|
||||||
|
|
||||||
|
import com.sczx.order.exception.InnerException;
|
||||||
|
import com.sczx.order.thirdpart.facade.SyncFacade;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Component
|
||||||
|
public class SyncInteg {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SyncFacade syncFacade;
|
||||||
|
|
||||||
|
public Map<String, String> sendSubOrderId(Long subOrderId){
|
||||||
|
try{
|
||||||
|
Map<String, String> result = syncFacade.sendSubOrderId(subOrderId);
|
||||||
|
if(result.get("code") == "200"){
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
} catch (Exception e){
|
||||||
|
log.error("发送租电订单同步失败",e);
|
||||||
|
throw new InnerException("发送租电订单同步失败");
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user