diff --git a/src/main/java/com/chint/application/out/OrderDetailController.java b/src/main/java/com/chint/application/out/OrderDetailController.java index 9e7de692..fff3fc1a 100644 --- a/src/main/java/com/chint/application/out/OrderDetailController.java +++ b/src/main/java/com/chint/application/out/OrderDetailController.java @@ -151,10 +151,10 @@ public class OrderDetailController { Integer pageNum = authenticationDto.getPageNum(); String orgsign = authenticationDto.getSign(); String input; - if (orderNo != null) { - input = orderNo + productType + systemType + startTime + endTime + pageSize + pageNum; - } else { + if (systemType.equals("XN_FK") || systemType.equals("AN_FK")) { input = productType + systemType + startTime + endTime + pageSize + pageNum; + } else { + input = orderNo + productType + systemType + startTime + endTime + pageSize + pageNum; } String sign = Digest.md5(input); return orgsign.equals(sign); diff --git a/src/test/java/com/chint/RouteApplicationTests.java b/src/test/java/com/chint/RouteApplicationTests.java index 7969d7e4..56c47cc3 100644 --- a/src/test/java/com/chint/RouteApplicationTests.java +++ b/src/test/java/com/chint/RouteApplicationTests.java @@ -27,8 +27,13 @@ import com.chint.interfaces.rest.base.PostRequest; import com.chint.interfaces.rest.ctrip.CTripAirportRequest; import com.chint.interfaces.rest.ctrip.CTripUserSaveRequest; import com.chint.interfaces.rest.ctrip.dto.airport.AirportSearchResponse; +import com.chint.interfaces.rest.ctrip.dto.put.CTripNoteResponse; import com.chint.interfaces.rest.ctrip.dto.put.CTripStatusNotification; import com.chint.interfaces.rest.data_center.org.OrgRequest; +import com.chint.interfaces.rest.data_center.user.BatchUserWorker; +import com.chint.interfaces.rest.data_center.user.UserHttpRequest; +import com.chint.interfaces.rest.data_center.user.UserHttpRequestImpl; +import com.chint.interfaces.rest.data_center.user.UserSFRequest; import com.chint.interfaces.rest.ly.LYPostRequest; import com.chint.interfaces.rest.ly.LYSearchRequest; import com.chint.interfaces.rest.ly.LYUserRequest; @@ -39,10 +44,6 @@ import com.chint.interfaces.rest.ly.dto.hotelorderdatapushbach.OrderInfo; import com.chint.interfaces.rest.ly.dto.search.response.hotel.HotelDetailResponse; import com.chint.interfaces.rest.ly.dto.strokepush.StrokePushResult; import com.chint.interfaces.rest.ly.dto.strokepush.TrainChange.TrainChangeRequest; -import com.chint.interfaces.rest.data_center.user.BatchUserWorker; -import com.chint.interfaces.rest.data_center.user.UserHttpRequest; -import com.chint.interfaces.rest.data_center.user.UserHttpRequestImpl; -import com.chint.interfaces.rest.data_center.user.UserSFRequest; import com.google.gson.Gson; import lombok.extern.slf4j.Slf4j; import org.junit.jupiter.api.Test; @@ -50,6 +51,9 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.test.context.SpringBootTest; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Paths; import java.time.LocalDate; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; @@ -163,18 +167,18 @@ class RouteApplicationTests { @Test - void testQueryIdsFromCache(){ + void testQueryIdsFromCache() { List routeOrders = routeRepository.queryByIdIn(List.of(11822L, 11823L, 11824L, 11825L, 11826L)); System.out.println(routeOrders); } @Test - void testSyncOrg(){ + void testSyncOrg() { orgRequest.syncAllOrg(); } @Test - void testUpdateOrg(){ + void testUpdateOrg() { orgRequest.generateParentId(); } @@ -196,7 +200,7 @@ class RouteApplicationTests { System.out.println(postRequest.getReDirectUrl("http://10.10.100.129:8089" + "/MobileOA/api/FsscSSO?loginUser=230615020&data=%2F%23%2Fexpenseclaim%3FbillDefineId%3Dfcc76666fb1211e98e2019f4db5548fd%26scene%3DWRITE%26isNew%3Dtrue%26goback%3Dfalse")); } -// @Test + // @Test void syncUserTo() { User user = new User(); user.setCompanyCode("A10000001"); @@ -292,7 +296,7 @@ class RouteApplicationTests { System.out.println(orderInfo.getOrderSerialNo()); } - @Test + @Test void loginSign() { String sfno = "060726001"; String syscode = "FSSC"; @@ -303,7 +307,7 @@ class RouteApplicationTests { System.out.println(s); } - @Test + @Test void loginSignProd() { String sfno = "001019002"; String syscode = "FSSC"; @@ -324,8 +328,8 @@ class RouteApplicationTests { } @Test - void getFSSCRedirectUrl(){ - + void getFSSCRedirectUrl() { + } // @Test @@ -374,6 +378,55 @@ class RouteApplicationTests { } + @Test + void post() { + + // 读取文件内容 + String filePath = "D:\\data\\routeData\\itinerary_booking_system_log.sql"; // 修改为实际文件路径 + String s = readFileAsString(filePath); + + String[] split = s.replace("'", "").split(", "); + Gson gson = new Gson(); + List cTripStatusNotifications = new ArrayList<>(); + for (String string : split) { + CTripStatusNotification cTripStatusNotification = gson.fromJson(string, CTripStatusNotification.class); + cTripStatusNotifications.add(cTripStatusNotification); + } + System.out.println(cTripStatusNotifications); + List success = new ArrayList<>(); + List failure = new ArrayList<>(); + int requestCount = 0; + for (CTripStatusNotification cTripStatusNotification : cTripStatusNotifications) { + CTripNoteResponse post = postRequest.post("https://trip.chint.com/api/public/CTrip/status", cTripStatusNotification, CTripNoteResponse.class); + if (post.getErrorMessage() != null || !Objects.equals(post.getErrorCode(), "0")) { + failure.add(0); + } else { + success.add(0); + } + requestCount++; + System.out.println("这是第" + requestCount + "次请求"); + // 每发起10次请求后休息1秒 + if (requestCount % 10 == 0) { + try { + Thread.sleep(10000); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + } + System.out.println(success); + System.out.println(failure); + } + + private String readFileAsString(String filePath) { + try { + return new String(Files.readAllBytes(Paths.get(filePath))); + } catch (IOException e) { + e.printStackTrace(); + return null; + } + } + // @Test // void findAndInsetLeve4Info() { // List locationList = locationRepository.findChinaCityByLevel("3106_1_",3); @@ -1074,7 +1127,7 @@ class RouteApplicationTests { locationRepository.saveAll(allLevelThreeAndFour); } -// @Test + // @Test void generateIfAirport() { List airportLocation = new ArrayList<>(); AirportSearchResponse response = cTripAirportRequest.getAirport(); @@ -1120,7 +1173,7 @@ class RouteApplicationTests { locationRepository.saveAll(airportLocation); } -// @Test + // @Test void updateCounty() { List byLocationType = locationRepository.findByLocationType(5); for (Location location : byLocationType) { @@ -1131,7 +1184,7 @@ class RouteApplicationTests { locationRepository.saveAll(byLocationType); } -// @Test + // @Test void updateAirportPath() { List byLocationType = locationRepository.findByLocationType(7); for (Location location : byLocationType) { @@ -1141,7 +1194,7 @@ class RouteApplicationTests { locationRepository.saveAll(byLocationType); } -// @Test + // @Test void generateLocationType() { List all = locationRepository.findAll(); all.forEach(it -> { @@ -1212,8 +1265,7 @@ class RouteApplicationTests { } - -// @Test + // @Test void addRanks() { RanksData ranksData = new RanksData(); ranksData.setIndustry("正泰电气股份有限公司"); @@ -1243,58 +1295,59 @@ class RouteApplicationTests { } } -// @Test + // @Test void testQueryCity() { Location location = locationRepository.findById(373L); Location cityLocation = lyOrderSyncAdapter.getCityLocation(location); System.out.println(cityLocation); } -// @Test - void testTimeFor(){ + // @Test + void testTimeFor() { LocalDateTime localDateTime = DateTimeUtil.strToTimeMM("2024-03-04 00:23:26.727"); System.out.println(localDateTime); } -// @Test - void testFindOrderRecord(){ + // @Test + void testFindOrderRecord() { CTripHotelRecord hotelRecordByRecordId = cTripOrderDetail.findHotelRecordByRecordId("98494942"); System.out.println(hotelRecordByRecordId); } -// @Test - void testInBlackList(){ + // @Test + void testInBlackList() { orderDomainService.checkCompanyNameIfBlack("乐清正泰电器销售有限公司"); } -// @Test - void testSplit(){ + // @Test + void testSplit() { String str = "20240301"; System.out.println(str.substring(0, 5)); System.out.println(lastMonthStr()); } -// @Test - void testsplit2(){ + // @Test + void testsplit2() { String receiptsNum = "FSSC-CLSQ240409000001dev#NBWSAW"; if (receiptsNum.contains("-")) { String[] split = receiptsNum.split("-"); receiptsNum = split[1]; } - if(receiptsNum.contains("#")){ + if (receiptsNum.contains("#")) { String[] split1 = receiptsNum.split("#"); receiptsNum = split1[0]; } System.out.println(receiptsNum); } -// @Test - void testS(){ + + // @Test + void testS() { Optional s = systemDomainService.companyNameByAccountId(null); s.ifPresent(System.out::println); } -// @Test - void testRankSearch(){ + // @Test + void testRankSearch() { // user.setManaLevel("M5"); user.setProfLevel("P5"); String rankName; @@ -1312,17 +1365,17 @@ class RouteApplicationTests { } @Test - void roleTest(){ + void roleTest() { System.out.println(System.currentTimeMillis()); User byId = userRepository.findByUserEmployeeNo("230615020").loadRoleOrg(); System.out.println(System.currentTimeMillis()); - byId.loadRoleOrg(); + byId.loadRoleOrg(); System.out.println(System.currentTimeMillis()); - byId.loadRoleOrg(); + byId.loadRoleOrg(); System.out.println(System.currentTimeMillis()); - byId.loadRoleOrg(); + byId.loadRoleOrg(); System.out.println(System.currentTimeMillis()); - byId.loadRoleOrg(); + byId.loadRoleOrg(); System.out.println(System.currentTimeMillis()); } }