fix:优化行程节点变更原因的获取逻辑
This commit is contained in:
parent
4a75189756
commit
8f7bc94a22
|
@ -85,11 +85,21 @@ public class OrderApplicationService {
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
public void addLegToOrder(AddLegData addLegData) {
|
public void addLegToOrder(AddLegData addLegData) {
|
||||||
//这里也先去redis查询如果没有的话 ,再查询数据库
|
// First, attempt to retrieve the RouteOrder from the database
|
||||||
RouteOrder routeOrder = Optional.ofNullable(routeRepository
|
RouteOrder routeOrder = Optional.ofNullable(routeRepository
|
||||||
.findTempRouteOrderBySysCodeAndBillCode(addLegData.getSysCode(), addLegData.getFakeOrderNo()))
|
.findByFakeOrderNoAndSysCode(addLegData.getFakeOrderNo(), addLegData.getSysCode()))
|
||||||
.orElseGet(() -> Optional.ofNullable(routeRepository.queryById(addLegData.getRouteId()))
|
.orElseGet(() -> {
|
||||||
.orElseThrow(() -> new NotFoundException(NOT_FOUND))).reloadStatus();
|
// If not found in the database, attempt to retrieve from Redis
|
||||||
|
RouteOrder tempRouteOrder = routeRepository
|
||||||
|
.findTempRouteOrderBySysCodeAndBillCode(addLegData.getSysCode(), addLegData.getFakeOrderNo());
|
||||||
|
// If not found in Redis, retrieve by ID from the database
|
||||||
|
if (tempRouteOrder == null) {
|
||||||
|
return Optional.ofNullable(routeRepository.queryById(addLegData.getRouteId()))
|
||||||
|
.orElseThrow(() -> new NotFoundException(NOT_FOUND));
|
||||||
|
}
|
||||||
|
return tempRouteOrder;
|
||||||
|
});
|
||||||
|
|
||||||
checkLegDataTime(addLegData, routeOrder);
|
checkLegDataTime(addLegData, routeOrder);
|
||||||
LegData legData = addLegData.getLegData();
|
LegData legData = addLegData.getLegData();
|
||||||
List<Leg> legs = processLegData(legData, routeOrder); //创建行程节点
|
List<Leg> legs = processLegData(legData, routeOrder); //创建行程节点
|
||||||
|
@ -101,7 +111,6 @@ public class OrderApplicationService {
|
||||||
routeRepository.save(routeOrder); // 仅在所有操作完成后保存一次
|
routeRepository.save(routeOrder); // 仅在所有操作完成后保存一次
|
||||||
}
|
}
|
||||||
//如果行程变更成功,自动执行同步功能
|
//如果行程变更成功,自动执行同步功能
|
||||||
// Command.of(RouteAutoSyncCommand.class).route(routeOrder).async().sendToQueue();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
|
|
Loading…
Reference in New Issue