fix:兼容新能和安能消费明细签名加密方式

This commit is contained in:
lulz1 2024-05-20 08:55:14 +08:00
parent 6eefc3a9f7
commit 2185a22d62
2 changed files with 95 additions and 42 deletions

View File

@ -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);

View File

@ -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<RouteOrder> 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");
@ -324,7 +328,7 @@ class RouteApplicationTests {
}
@Test
void getFSSCRedirectUrl(){
void getFSSCRedirectUrl() {
}
@ -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<CTripStatusNotification> cTripStatusNotifications = new ArrayList<>();
for (String string : split) {
CTripStatusNotification cTripStatusNotification = gson.fromJson(string, CTripStatusNotification.class);
cTripStatusNotifications.add(cTripStatusNotification);
}
System.out.println(cTripStatusNotifications);
List<Integer> success = new ArrayList<>();
List<Integer> 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<Location> locationList = locationRepository.findChinaCityByLevel("3106_1_",3);
@ -1074,7 +1127,7 @@ class RouteApplicationTests {
locationRepository.saveAll(allLevelThreeAndFour);
}
// @Test
// @Test
void generateIfAirport() {
List<Location> airportLocation = new ArrayList<>();
AirportSearchResponse response = cTripAirportRequest.getAirport();
@ -1120,7 +1173,7 @@ class RouteApplicationTests {
locationRepository.saveAll(airportLocation);
}
// @Test
// @Test
void updateCounty() {
List<Location> byLocationType = locationRepository.findByLocationType(5);
for (Location location : byLocationType) {
@ -1131,7 +1184,7 @@ class RouteApplicationTests {
locationRepository.saveAll(byLocationType);
}
// @Test
// @Test
void updateAirportPath() {
List<Location> byLocationType = locationRepository.findByLocationType(7);
for (Location location : byLocationType) {
@ -1141,7 +1194,7 @@ class RouteApplicationTests {
locationRepository.saveAll(byLocationType);
}
// @Test
// @Test
void generateLocationType() {
List<Location> 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<String> s = systemDomainService.companyNameByAccountId(null);
s.ifPresent(System.out::println);
}
// @Test
void testRankSearch(){
// @Test
void testRankSearch() {
// user.setManaLevel("M5");
user.setProfLevel("P5");
String rankName;
@ -1312,7 +1365,7 @@ class RouteApplicationTests {
}
@Test
void roleTest(){
void roleTest() {
System.out.println(System.currentTimeMillis());
User byId = userRepository.findByUserEmployeeNo("230615020").loadRoleOrg();
System.out.println(System.currentTimeMillis());