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) { } }