修复变更行程bug

This commit is contained in:
lulz1 2024-03-09 12:57:23 +08:00
parent 49478aa83b
commit 5f96250f53
4 changed files with 10 additions and 26 deletions

View File

@ -88,6 +88,11 @@
<version>1.0</version> <version>1.0</version>
</dependency> </dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-cache</artifactId>
</dependency>
</dependencies> </dependencies>
<build> <build>

View File

@ -89,6 +89,5 @@ public class LocationController {
dto.setInternationalCitys(internationalLocationRes); dto.setInternationalCitys(internationalLocationRes);
return Result.Success(SUCCESS, dto); return Result.Success(SUCCESS, dto);
} }
} }

View File

@ -90,7 +90,7 @@ public class OrderApplicationService {
LegData legData = addLegData.getLegData(); LegData legData = addLegData.getLegData();
List<Leg> legs = processLegData(legData, order); List<Leg> legs = processLegData(legData, order);
orderDomainService.queryLocation(legs); orderDomainService.queryLocation(legs);
RouteOrder routeOrder = orderDomainService.saveOrder(order);
legs.forEach(leg -> { legs.forEach(leg -> {
leg.reloadStatus(); leg.reloadStatus();
legDomainService.addPreEvent(leg); legDomainService.addPreEvent(leg);
@ -106,24 +106,13 @@ public class OrderApplicationService {
leg = legDomainService.addApproveEvent(leg); leg = legDomainService.addApproveEvent(leg);
} }
order.addLeg(leg); legRepository.save(leg);
if (!order.getOrderStatus().equals(ORDER_STATUS_PREPARE)) { if (!order.getOrderStatus().equals(ORDER_STATUS_PREPARE)) {
Command.of(BPMLegChangeCommand.class).routeOrder(order).newleg(leg.reloadStatus()).routeId(order.getRouteId()).changeType(0).sendToQueue(); Command.of(BPMLegChangeCommand.class).routeOrder(order).newleg(leg.reloadStatus()).routeId(order.getRouteId()).changeType(0).sendToQueue();
} }
}); });
//异步操作-如果是当前的状态已经进行过匹配那么就要订单同步到供应商一次 return routeOrder; // 仅在所有操作完成后保存一次
// if (order.getOrderStatus() >= ORDER_STATUS_NOT_ORDERED) {
// CompletableFuture.runAsync(() -> {
// Command
// .of(LegSyncCommand.class)
// .data(SyncLegData.of(routeOrder.getRouteId(), routeOrder.getSupplierName()))
// .sendToQueue();
// });
// }
return orderDomainService.saveOrder(order); // 仅在所有操作完成后保存一次
} }
@Transactional @Transactional

View File

@ -234,18 +234,9 @@ class RouteApplicationTests {
locationRepository.saveAll(all); locationRepository.saveAll(all);
} }
// @Test // @Test
void deleteRouteOrder() { void deleteRouteOrder() {
routeRepository.deleteById(15L); routeRepository.deleteById(785L);
routeRepository.deleteById(17L);
routeRepository.deleteById(18L);
routeRepository.deleteById(19L);
routeRepository.deleteById(19L);
routeRepository.deleteById(19L);
routeRepository.deleteById(19L);
routeRepository.deleteById(19L);
routeRepository.deleteById(19L);
routeRepository.deleteById(19L);
} }
// @Test // @Test