diff --git a/src/main/java/com/chint/domain/aggregates/order/LegExtensionField.java b/src/main/java/com/chint/domain/aggregates/order/LegExtensionField.java index 6b6d43fa..02165ab6 100644 --- a/src/main/java/com/chint/domain/aggregates/order/LegExtensionField.java +++ b/src/main/java/com/chint/domain/aggregates/order/LegExtensionField.java @@ -32,7 +32,7 @@ public class LegExtensionField implements Serializable { private String originDescription; private String destinationDescription; private String estimatedAmount; - + private String extension; public LegExtensionField addLocationIdsAsString(List locationIds) { this.locationIds = Arrays.toString(locationIds.toArray()); diff --git a/src/main/java/com/chint/domain/value_object/LegData.java b/src/main/java/com/chint/domain/value_object/LegData.java index 9da5c5d7..79b1ab93 100644 --- a/src/main/java/com/chint/domain/value_object/LegData.java +++ b/src/main/java/com/chint/domain/value_object/LegData.java @@ -7,17 +7,12 @@ import lombok.Data; public class LegData { public final String legId; - public final Integer legType; @ApiModelProperty("变更理由") private final String changeReason; - public final String startTime; - - public String endTime; - + public String endTime; public final Long originId; - public final Long destinationId; public String currencyType; diff --git a/src/main/java/com/chint/domain/value_object/LegExtensionFieldData.java b/src/main/java/com/chint/domain/value_object/LegExtensionFieldData.java index c404989d..4cc304cc 100644 --- a/src/main/java/com/chint/domain/value_object/LegExtensionFieldData.java +++ b/src/main/java/com/chint/domain/value_object/LegExtensionFieldData.java @@ -20,4 +20,6 @@ public class LegExtensionFieldData { private String estimatedAmount; @ApiModelProperty("地理位置id列表") private List locationIds; + @ApiModelProperty("扩展字段") + public String extension; } diff --git a/src/main/java/com/chint/infrastructure/cache/RouteCacheService.java b/src/main/java/com/chint/infrastructure/cache/RouteCacheService.java index 3ee51b3a..62d6e370 100644 --- a/src/main/java/com/chint/infrastructure/cache/RouteCacheService.java +++ b/src/main/java/com/chint/infrastructure/cache/RouteCacheService.java @@ -82,7 +82,7 @@ public class RouteCacheService { // return routeListByIds; } else { List routeOrders = jdbcRouteRepository.findByUserIdOrApproveOrderNo_Creator(employeeNo, employeeNo); - CompletableFuture.runAsync(()->{ + CompletableFuture.runAsync(() -> { routeCacheManage.getRouteIdsByEmployeeNo(employeeNo, routeOrders, null); routeOrders.forEach(this::updateRouteCache); }); @@ -202,7 +202,7 @@ public class RouteCacheService { List routeIds = routeCacheManage.getRouteIdsByEmployeeNo(userId, null, null); if (routeIds == null || routeIds.size() <= 2) { List routeOrders = preloadUserRoutes(userId); - routeIds = routeOrders.stream().map(RouteOrder::getRouteId).toList(); + routeIds = routeOrders.stream().filter(Objects::nonNull).map(RouteOrder::getRouteId).toList(); } if (!routeIds.contains(routeId)) { List newRouteIds = new ArrayList<>(routeIds); @@ -233,9 +233,11 @@ public class RouteCacheService { .map(RouteOrder::getRouteId).toList(); List notInCacheRouteIds = routeIds.stream().filter(it -> !inCacheRouteIds.contains(it)) .toList(); - List byRouteIdIn = jdbcRouteRepository.findByRouteIdIn(notInCacheRouteIds); - CompletableFuture.runAsync(() -> byRouteIdIn.forEach(this::updateRouteCache)); - inCacheRouteOrder.addAll(byRouteIdIn); + if(!notInCacheRouteIds.isEmpty()) { + List byRouteIdIn = jdbcRouteRepository.findByRouteIdIn(notInCacheRouteIds); + CompletableFuture.runAsync(() -> byRouteIdIn.forEach(this::updateRouteCache)); + inCacheRouteOrder.addAll(byRouteIdIn); + } return inCacheRouteOrder; } else { return List.of(); @@ -243,6 +245,9 @@ public class RouteCacheService { } private void updateRouteCache(RouteOrder routeOrder) { + if(routeOrder.getOrderStatus() == null){ + routeOrder.reloadStatus(); + } routeCacheManage.invalidateRouteCache(routeOrder.getRouteId()); routeCacheManage.cacheRouteOrder(routeOrder); } diff --git a/src/main/java/com/chint/infrastructure/repository/UserRepositoryImpl.java b/src/main/java/com/chint/infrastructure/repository/UserRepositoryImpl.java index ec799e4c..5f710fd4 100644 --- a/src/main/java/com/chint/infrastructure/repository/UserRepositoryImpl.java +++ b/src/main/java/com/chint/infrastructure/repository/UserRepositoryImpl.java @@ -86,7 +86,7 @@ public class UserRepositoryImpl extends AbstractGenericRepository im public List findByEmployeeNoIn(Set employeeNoSet) { return this.findByFieldsIn("EmployeeNo", employeeNoSet, User::getEmployeeNo, - (set) -> jdbcUserRepository.findByEmployeeNoIn(employeeNoSet)); + (set) -> jdbcUserRepository.findByEmployeeNoIn(set)); } @Override diff --git a/src/test/java/com/chint/RouteApplicationTests.java b/src/test/java/com/chint/RouteApplicationTests.java index 376757b0..aadb3b4d 100644 --- a/src/test/java/com/chint/RouteApplicationTests.java +++ b/src/test/java/com/chint/RouteApplicationTests.java @@ -3,6 +3,7 @@ package com.chint; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; +import com.chint.application.dtos.AddLegData; import com.chint.application.in.RankController; import com.chint.application.out.LoginController; import com.chint.application.services.login.strategy.PailaLoginStrategy; @@ -313,9 +314,9 @@ class RouteApplicationTests { @Test void loginSign() { - String sfno = "211213002"; + String sfno = "220222190"; String syscode = "FSSC"; - String billcode = "CLSQ240225000099"; + String billcode = "CLSQ240225000101"; String companycode = "正泰集团股份有限公司"; String timespan = "1708908662738"; String s = Digest.md5(sfno + syscode + billcode + companycode + LOGIN_SECRET_KEY + timespan); @@ -324,7 +325,7 @@ class RouteApplicationTests { @Test void loginSignProd() { - String sfno = "230615020"; + String sfno = "240522018"; String syscode = "FSSC"; String billcode = "CLSQ240225000099"; String companycode = "正泰集团股份有限公司"; @@ -335,20 +336,26 @@ class RouteApplicationTests { } + @Test + void deleteRouteOrder2() { + routeRepository.deleteById(50519L); + } @Test void testPushBatch() throws UnsupportedEncodingException { - List billcodeList = List.of("CLS24062500065", - "CLS24062400348", - "CLS24062500073", - "CLS24062500207"); + List billcodeList = List.of("CLS24070100346", + "CLS24070100358", + "CLS24070100472", + "CLS24070100474", + "CLS24063000266"); List sfnoList = List.of( - "220915110", - "220719073", - "230627119", - "220802056" + "220524027", + "220506052", + "180605050", + "220621032", + "220630159" ); System.out.println(billcodeList.size()); @@ -376,6 +383,30 @@ class RouteApplicationTests { } } + @Test + void addLegToTempRoute() { + String url = "https://trip.chint.com/api/order/leg/add"; + + List billcodeList = List.of("CLS24070100346", + "CLS24070100358", + "CLS24070100472", + "CLS24070100474", + "CLS24063000266"); + Gson gson = new Gson(); + for (String billcode : billcodeList) { + String postStr = String.format( + """ + {"routeId":null,"sysCode":"ANFSSC","fakeOrderNo":"%s","legData":{"legType":3,"startTime":"2024-07-04 00:00:00","endTime":"2024-07-05 00:00:00","legExtensionFieldData":{"amountType":3,"estimatedAmount":"0.00","locationIds":[321,317]}},"ifApprove":0} + """, billcode); + Result post = postRequest.post("token", + """ + eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJFbXBsb3llZU5vIiwiaWF0IjoxNzIwNTc3MjI5LCJleHAiOjE3MjA1ODgwMjksImVtcGxveWVlTGV2ZWwiOm51bGwsImNvbXBhbnlDb2RlIjoiQTMwMDAwMDAxIiwicmFua0NvZGUiOiJKVF9TVEFOREFSRF9MRVZFTF9GT1VSIiwiZnNzY1N5c3RlbUxpc3QiOiJbe1wic3lzdGVtTmFtZVwiOlwi5rWZ5rGf5q2j5rOw55S15Zmo6IKh5Lu95pyJ6ZmQ5YWs5Y-4XCIsXCJzeXN0ZW1Db2RlXCI6XCJGU1NDXCIsXCJjb21wYW55Q29kZVwiOlwiQTMwMDAwMDAxXCJ9XSIsInBob25lTnVtYmVyIjoiMTU4NTcxOTMzNjUiLCJuYW1lIjoi5Y2i6bqf5ZOyIiwiZW1wbG95ZWVObyI6IjIzMDYxNTAyMCIsInVzZXJJZCI6MSwidXNlckxvZ2luUGFyYW0iOiJ7XCJzZm5vXCI6XCIyMzA2MTUwMjBcIixcInN5c2NvZGVcIjpcIkZTU0NcIixcImJpbGxjb2RlXCI6XCJcIixcImNvbXBhbnlDb2RlXCI6XCJcIixcInRpbWVzcGFuXCI6XCIxNzIwNTc3MjI4NTIyXCJ9IiwiZW1haWwiOm51bGwsInN0YW5kYXJkTGV2ZWwiOiJKVF9TVEFOREFSRF9MRVZFTF9GT1VSIn0.UQMdGCBT8ZUPvbyLiyr_SvLw4x7HmHQ0RvJp8qepemA + """ + , url, gson.fromJson(postStr, AddLegData.class), Result.class); + System.out.println(post); + } + } + // @Test void queryUserInfo() { User user2 = User.withEmployeeNo("180101001");