From d97da29c2fe2418da01e16f98814f43897ecdcd1 Mon Sep 17 00:00:00 2001 From: lulz1 Date: Thu, 4 Jul 2024 18:49:35 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E4=BF=AE=E5=A4=8D=E5=9B=A0=E5=9C=B0?= =?UTF-8?q?=E7=90=86=E4=BF=A1=E6=81=AF=E7=A1=AE=E5=AE=9E=E5=AF=BC=E8=87=B4?= =?UTF-8?q?=E6=97=A0=E6=B3=95=E5=AE=A1=E6=89=B9=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/chint/application/queryies/OrderQuery.java | 9 ++++++--- .../java/com/chint/domain/service/LegDomainService.java | 1 + .../com/chint/domain/service/OrderDomainService.java | 9 +++++++++ .../domain/service/order_sync/SupplierOrderSync.java | 1 + .../cache/CachePermissionConfigRepository.java | 3 ++- 5 files changed, 19 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/chint/application/queryies/OrderQuery.java b/src/main/java/com/chint/application/queryies/OrderQuery.java index 5e9dc419..c35e2736 100644 --- a/src/main/java/com/chint/application/queryies/OrderQuery.java +++ b/src/main/java/com/chint/application/queryies/OrderQuery.java @@ -150,15 +150,18 @@ public class OrderQuery { //根据系统标识进行筛选 routeOrders = sysCodeFilter(routeOrders, queryData.getSysCode()); - //将已结束的行程放到最后 Comparator statusComparator = Comparator.comparing( (RouteOrder order) -> order.getOrderStatus().equals(ORDER_STATUS_FINISH), Comparator.reverseOrder() ); + int total = routeOrders.size(); routeApprovalDomainService.checkApprovalPermissions(routeOrders); +// Set employeeNoSet = routeOrders.stream().filter(it -> it.getApproveOrderNo() != null) +// .flatMap(it -> Stream.of(it.getUserId(), it.getApproveOrderNo().getCreator())) +// .collect(Collectors.toSet()); List orders = routeOrders .stream() .sorted(statusComparator.thenComparing(RouteOrder::getUpdateTime).reversed()) @@ -170,13 +173,13 @@ public class OrderQuery { return getRouteOrderPageRes(routeOrder, user); }) .toList(); - //这里按照业务要求,尝试进行自动确认结束行程 orders.forEach(it -> { if (it.getIfCanBeFinished().equals("1") && !it.getOrderStatus().equals(ORDER_STATUS_FINISH)) { - orderDomainService.finishOrder(it.getRouteId()); + orderDomainService.finishOrder(it); } }); + return new PageResult<>(total, orders); } diff --git a/src/main/java/com/chint/domain/service/LegDomainService.java b/src/main/java/com/chint/domain/service/LegDomainService.java index 8ceaf0f0..7b09c4b2 100644 --- a/src/main/java/com/chint/domain/service/LegDomainService.java +++ b/src/main/java/com/chint/domain/service/LegDomainService.java @@ -244,6 +244,7 @@ public class LegDomainService { !it.getLegApprovalStatus().equals(LEG_APPROVAL_STATUS_PREPARE)) .toList(); + // 根据供应商名称查找供应商并进行处理 return supplierRepository.findBySupplierName(supplierName) .map(supplier -> { diff --git a/src/main/java/com/chint/domain/service/OrderDomainService.java b/src/main/java/com/chint/domain/service/OrderDomainService.java index 9c981c1b..c2976d6e 100644 --- a/src/main/java/com/chint/domain/service/OrderDomainService.java +++ b/src/main/java/com/chint/domain/service/OrderDomainService.java @@ -2,6 +2,7 @@ package com.chint.domain.service; import cn.hutool.core.bean.BeanUtil; import com.chint.application.commands.*; +import com.chint.application.dtos.response.RouteOrderPageRes; import com.chint.domain.aggregates.order.*; import com.chint.domain.aggregates.user.User; import com.chint.domain.exceptions.OrderException; @@ -279,6 +280,14 @@ public class OrderDomainService { return false; } + public boolean finishOrder(RouteOrderPageRes routeOrderPageRes) { + if (DateTimeUtil.endOfDay(routeOrderPageRes.getEndTime()).isAfter(LocalDateTime.now())) { + return finishOrder(routeOrderPageRes.getRouteId()); + } + return false; + } + + private void cTripFlightRefundAndChangeOrder(String orderNo) { SearchOrderResponse response = cTripOrderSearchRequest.searchOrderResponseByOrderId(orderNo); FlightOrderInfoEntity flightOrderInfoEntity = response.getItineraryList().get(0).getFlightOrderInfoList().get(0); diff --git a/src/main/java/com/chint/domain/service/order_sync/SupplierOrderSync.java b/src/main/java/com/chint/domain/service/order_sync/SupplierOrderSync.java index 60260152..98680b1f 100644 --- a/src/main/java/com/chint/domain/service/order_sync/SupplierOrderSync.java +++ b/src/main/java/com/chint/domain/service/order_sync/SupplierOrderSync.java @@ -8,6 +8,7 @@ import com.chint.domain.exceptions.AuthException; import com.chint.domain.exceptions.CommandException; import com.chint.domain.service.supplier.SupplierAdapter; +import java.util.ArrayList; import java.util.List; import java.util.Optional; diff --git a/src/main/java/com/chint/infrastructure/repository/cache/CachePermissionConfigRepository.java b/src/main/java/com/chint/infrastructure/repository/cache/CachePermissionConfigRepository.java index 5f78c12c..b73968c5 100644 --- a/src/main/java/com/chint/infrastructure/repository/cache/CachePermissionConfigRepository.java +++ b/src/main/java/com/chint/infrastructure/repository/cache/CachePermissionConfigRepository.java @@ -2,6 +2,7 @@ package com.chint.infrastructure.repository.cache; import com.chint.domain.aggregates.base.PermissionConfig; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.cache.annotation.CacheEvict; import org.springframework.cache.annotation.Cacheable; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.stereotype.Repository; @@ -45,7 +46,7 @@ public class CachePermissionConfigRepository { return permissionConfig; } - @Cacheable(value = "PermissionConfig", key = "#permissionName") + @CacheEvict(value = "PermissionConfig", key = "#permissionName") public void cacheEvictByName(String permissionName) { } }