修复数据回推时 ,出现可能找不到城市的异常
This commit is contained in:
parent
9b89282394
commit
4bfabf6fd3
|
@ -210,10 +210,10 @@ public class CTripTest {
|
|||
System.out.println(gson.toJson(estimate));
|
||||
}
|
||||
|
||||
@Test
|
||||
// @Test
|
||||
void search() {
|
||||
BaseContext.setCurrentUser(user);
|
||||
SearchOrderResponse response = orderSearchRequest.searchOrderResponseByOrderId("31105372581");
|
||||
SearchOrderResponse response = orderSearchRequest.searchOrderResponseByOrderId("30410372171");
|
||||
System.out.println(response);
|
||||
}
|
||||
|
||||
|
@ -336,7 +336,7 @@ public class CTripTest {
|
|||
System.out.println(allPOIInfoQuery);
|
||||
}
|
||||
|
||||
@Test
|
||||
// @Test
|
||||
void queryDistrictByCountryId() {
|
||||
// CountryInfoEntity countryInfoEntity = countryInfoEntityRepository.findById(336L);
|
||||
QueryAllPOIInfoResponseType allPOIInfoQuery = cTripAllPOIInfoRequest.getAllPOIInfoQuery(1L);
|
||||
|
@ -362,7 +362,7 @@ public class CTripTest {
|
|||
|
||||
}
|
||||
|
||||
@Test
|
||||
// @Test
|
||||
void generateDistrictInLocation() {
|
||||
|
||||
List<Location> allLeverThree = locationRepository.findAllLeverThreeAndIsInternal();
|
||||
|
@ -389,23 +389,23 @@ public class CTripTest {
|
|||
}
|
||||
|
||||
|
||||
@Test
|
||||
// @Test
|
||||
void updateDistrictInLocation() {
|
||||
List<DistrictPOIInfoEntity> all = districtInfoRepository.findAll();
|
||||
List<Location> districtCities = new ArrayList<>();
|
||||
for (DistrictPOIInfoEntity districtPOIInfoEntity : all) {
|
||||
Location byDistrictShotName = locationRepository
|
||||
.findByCityId(districtPOIInfoEntity.getDistrictId(),districtPOIInfoEntity.getDistrictName()+"D");
|
||||
if(byDistrictShotName == null) {
|
||||
System.out.println(districtPOIInfoEntity.getDistrictId()+ districtPOIInfoEntity.getDistrictName()+"D");
|
||||
continue;
|
||||
}
|
||||
Location location = locationRepository.findById(byDistrictShotName.getParentLocationId());
|
||||
byDistrictShotName.setLocationPathName(location.getLocationPathName() + districtPOIInfoEntity.getDistrictName() + '_' );
|
||||
byDistrictShotName.setLocationPath(location.getLocationPath() + byDistrictShotName.getLocationId() + '_');
|
||||
districtCities.add(byDistrictShotName);
|
||||
}
|
||||
locationRepository.saveAll(districtCities);
|
||||
// List<DistrictPOIInfoEntity> all = districtInfoRepository.findAll();
|
||||
// List<Location> districtCities = new ArrayList<>();
|
||||
// for (DistrictPOIInfoEntity districtPOIInfoEntity : all) {
|
||||
// Location byDistrictShotName = locationRepository
|
||||
// .findByCityId(districtPOIInfoEntity.getDistrictId(),districtPOIInfoEntity.getDistrictName()+"D");
|
||||
// if(byDistrictShotName == null) {
|
||||
// System.out.println(districtPOIInfoEntity.getDistrictId()+ districtPOIInfoEntity.getDistrictName()+"D");
|
||||
// continue;
|
||||
// }
|
||||
// Location location = locationRepository.findById(byDistrictShotName.getParentLocationId());
|
||||
// byDistrictShotName.setLocationPathName(location.getLocationPathName() + districtPOIInfoEntity.getDistrictName() + '_' );
|
||||
// byDistrictShotName.setLocationPath(location.getLocationPath() + byDistrictShotName.getLocationId() + '_');
|
||||
// districtCities.add(byDistrictShotName);
|
||||
// }
|
||||
// locationRepository.saveAll(districtCities);
|
||||
}
|
||||
|
||||
|
||||
|
@ -424,7 +424,7 @@ public class CTripTest {
|
|||
}
|
||||
|
||||
|
||||
@Test
|
||||
// @Test
|
||||
void deleteByCountryId() {
|
||||
}
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ public class CacheTest {
|
|||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
// @Test
|
||||
public void getUserRouteIds(){
|
||||
List<Long> ids = routeCacheManage.getRouteIdsByEmployeeNo("181026006" , null, null);
|
||||
for (Long id : ids) {
|
||||
|
@ -42,12 +42,12 @@ public class CacheTest {
|
|||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
// @Test
|
||||
public void getRouteIdFromCache(){
|
||||
RouteOrder routeById = routeCacheManage.getRouteById(1046L);
|
||||
}
|
||||
|
||||
@Test
|
||||
// @Test
|
||||
public void cancelCache(){
|
||||
routeCacheService.invalidateRouteCache(null);
|
||||
}
|
||||
|
|
|
@ -27,6 +27,8 @@ import com.chint.interfaces.rest.ly.dto.applyordersync.*;
|
|||
import com.chint.interfaces.rest.ly.dto.commonresult.Result;
|
||||
import com.chint.interfaces.rest.ly.dto.estimateprice.*;
|
||||
import com.chint.interfaces.rest.ly.dto.search.response.car.CarDetailResponse;
|
||||
import com.chint.interfaces.rest.ly.dto.search.response.filght.FlightOrderResponse;
|
||||
import com.chint.interfaces.rest.ly.dto.search.response.hotel.HotelDetailResponse;
|
||||
import com.chint.interfaces.rest.ly.dto.search.response.train.TrainDetailResponse;
|
||||
import com.chint.interfaces.rest.ly.in.CommonController;
|
||||
import com.chint.interfaces.rest.ly.vo.estimateprice.TrainPriceVo;
|
||||
|
@ -793,7 +795,42 @@ public class LYTest {
|
|||
String join = String.join(",", set);
|
||||
System.out.println("join = " + join);
|
||||
}
|
||||
// @Test
|
||||
void searchFlight() {
|
||||
FlightOrderResponse flightOrderDetail = lySearchRequest.getFlightOrderDetail("DFR24031366602488575");
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(flightOrderDetail);
|
||||
System.out.println(json);
|
||||
}
|
||||
|
||||
// @Test
|
||||
void searchTrain() {
|
||||
TrainDetailResponse trainOrderDetail = lySearchRequest.getTrainOrderDetail("DTC24031767013846252");
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(trainOrderDetail);
|
||||
System.out.println(json);
|
||||
}
|
||||
|
||||
// @Test
|
||||
void searchHotel() {
|
||||
HotelDetailResponse hotelOrderDetail = lySearchRequest.getHotelOrderDetail("HO20240317101300570508");
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(hotelOrderDetail);
|
||||
System.out.println(json);
|
||||
}
|
||||
|
||||
// @Test
|
||||
void searchCar() {
|
||||
CarDetailResponse carDetailResponse = lySearchRequest.getCarDetailResponse("DC24031466726324898");
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(carDetailResponse);
|
||||
System.out.println(json);
|
||||
}
|
||||
|
||||
// @Test
|
||||
void deleteOrderDetailById(){
|
||||
orderDetailRepository.deleteById(1433L);
|
||||
}
|
||||
|
||||
// @Test
|
||||
void search() {
|
||||
|
@ -824,12 +861,12 @@ public class LYTest {
|
|||
|
||||
// @Test
|
||||
void conform() {
|
||||
commonController.changeFlight(0, 9, "T24031566810476306");
|
||||
commonController.changeFlight(1, 9, "DFC24031767042246246");
|
||||
}
|
||||
|
||||
// @Test
|
||||
void sendMsg() {
|
||||
commonController.sendMsg("T24031566811702174");
|
||||
commonController.sendMsg("T24031867123861097");
|
||||
}
|
||||
|
||||
// DTC24031466757493927
|
||||
|
|
|
@ -16,9 +16,11 @@ import com.chint.domain.service.JTCompanyDomainService;
|
|||
import com.chint.infrastructure.util.Digest;
|
||||
import com.chint.interfaces.rest.base.PostRequest;
|
||||
import com.chint.interfaces.rest.ctrip.CTripUserSaveRequest;
|
||||
import com.chint.interfaces.rest.ctrip.dto.put.CTripStatusNotification;
|
||||
import com.chint.interfaces.rest.ly.LYPostRequest;
|
||||
import com.chint.interfaces.rest.ly.LYSearchRequest;
|
||||
import com.chint.interfaces.rest.ly.LYUserRequest;
|
||||
import com.chint.interfaces.rest.ly.dto.Notification;
|
||||
import com.chint.interfaces.rest.ly.dto.flydatapushback.FlyOkDTO;
|
||||
import com.chint.interfaces.rest.ly.dto.flydatapushback.ParamFly;
|
||||
import com.chint.interfaces.rest.ly.dto.hotelorderdatapushbach.OrderInfo;
|
||||
|
@ -29,6 +31,7 @@ import com.chint.interfaces.rest.user.PushUser;
|
|||
import com.chint.interfaces.rest.user.UserHttpRequest;
|
||||
import com.chint.interfaces.rest.user.UserHttpRequestImpl;
|
||||
import com.chint.interfaces.rest.user.UserSFRequest;
|
||||
import com.google.gson.Gson;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@ -38,12 +41,12 @@ import org.springframework.boot.test.context.SpringBootTest;
|
|||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.chint.infrastructure.constant.LocationConstant.LOCATION_TYPE_CITY;
|
||||
import static com.chint.infrastructure.constant.LocationConstant.LOCATION_TYPE_COUNTY;
|
||||
|
||||
@Slf4j
|
||||
@SpringBootTest
|
||||
class RouteApplicationTests {
|
||||
|
@ -118,6 +121,9 @@ class RouteApplicationTests {
|
|||
@Autowired
|
||||
private CTripUserSaveRequest cTripUserSaveRequest;
|
||||
|
||||
@Autowired
|
||||
private DistrictInfoRepository districtInfoRepository;
|
||||
|
||||
void test3() {
|
||||
FlyOkDTO freightDTO = new FlyOkDTO();
|
||||
ParamFly param = new ParamFly();
|
||||
|
@ -137,7 +143,7 @@ class RouteApplicationTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
void syncUserTo(){
|
||||
void syncUserTo() {
|
||||
User user = new User();
|
||||
user.setCompanyCode("A10000001");
|
||||
user.setWorkStatus("A");
|
||||
|
@ -233,9 +239,9 @@ class RouteApplicationTests {
|
|||
System.out.println(orderInfo.getOrderSerialNo());
|
||||
}
|
||||
|
||||
@Test
|
||||
// @Test
|
||||
void loginSign() {
|
||||
String sfno = "160601023";
|
||||
String sfno = "081001001";
|
||||
String syscode = "FSSC";
|
||||
String billcode = "CLSQ240225000099";
|
||||
String companycode = "正泰集团股份有限公司";
|
||||
|
@ -248,12 +254,12 @@ class RouteApplicationTests {
|
|||
// log.trace("trace");
|
||||
}
|
||||
|
||||
@Test
|
||||
// @Test
|
||||
void loginSignProd() {
|
||||
String sfno = "81001001";
|
||||
String sfno = "081001001";
|
||||
String syscode = "FSSC";
|
||||
String billcode = "CLSQ240225000099";
|
||||
String companycode = "正泰集团股份有限公司";
|
||||
String billcode = "CLSQ240315000308";
|
||||
String companycode = "浙江正泰电器股份有限公司";
|
||||
String timespan = "1708908662738";
|
||||
String key = "ZhengTaiRoute";
|
||||
String s = Digest.md5(sfno + syscode + billcode + companycode + key + timespan);
|
||||
|
@ -293,9 +299,9 @@ class RouteApplicationTests {
|
|||
routeRepository.deleteById(875L);
|
||||
}
|
||||
|
||||
@Test
|
||||
// @Test
|
||||
void deleteOrderDetail() {
|
||||
orderDetailRepository.deleteById(1457L);
|
||||
orderDetailRepository.deleteById(1497L);
|
||||
}
|
||||
|
||||
// @Test
|
||||
|
@ -966,7 +972,7 @@ class RouteApplicationTests {
|
|||
System.out.println(saveLocations);
|
||||
}
|
||||
|
||||
@Test
|
||||
// @Test
|
||||
void timeTest() {
|
||||
DateTimeFormatter formatterWithT = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
||||
//根据项目需求,当传入的时间 , 使用该时间保存到订单当中
|
||||
|
@ -976,8 +982,91 @@ class RouteApplicationTests {
|
|||
}
|
||||
|
||||
|
||||
@Test
|
||||
// @Test
|
||||
void pushUserInfo() {
|
||||
pushUser.getUserSFDataFromOpenApiBatch();
|
||||
}
|
||||
|
||||
// @Test
|
||||
void deleteByOrderId() {
|
||||
orderDetailRepository.deleteById(1488L);
|
||||
orderDetailRepository.deleteById(1489L);
|
||||
}
|
||||
|
||||
// @Test
|
||||
void generateLocationEnName() {
|
||||
List<Location> allLevelThreeAndFour = locationRepository.findAllLevelThreeAndFour();
|
||||
List<String> unknownCityId = new ArrayList<>();
|
||||
for (Location location : allLevelThreeAndFour) {
|
||||
if (location.getLocationEnName() == null) {
|
||||
//这里的代码来补充地理位置的英文名
|
||||
Integer level = location.getLevel();
|
||||
if (level.equals(LOCATION_TYPE_CITY)) {
|
||||
Optional.ofNullable(prefectureLevelRepository.findByCityId(location.getCityId()))
|
||||
.ifPresentOrElse(cityInfo -> location.setLocationEnName(cityInfo.getCityEnName()),
|
||||
() -> {
|
||||
location.setLocationEnName("unknown");
|
||||
unknownCityId.add(location.getLocationId().toString());
|
||||
});
|
||||
} else if (level.equals(LOCATION_TYPE_COUNTY) && location.getLocationShortName().contains("D")) {
|
||||
Optional.ofNullable(districtInfoRepository.findByCityId(location.getCityId()))
|
||||
.ifPresentOrElse(cityInfo -> location.setLocationEnName(cityInfo.getDistrictEnName()),
|
||||
() -> {
|
||||
location.setLocationEnName("unknown");
|
||||
unknownCityId.add(location.getLocationId().toString());
|
||||
});
|
||||
} else if (level.equals(LOCATION_TYPE_COUNTY)) {
|
||||
Optional.ofNullable(countryLevelInfoRepository.findByCityId(location.getCityId()))
|
||||
.ifPresentOrElse(cityInfo -> location.setLocationEnName(cityInfo.getCountyEnName()),
|
||||
() -> {
|
||||
location.setLocationEnName("unknown");
|
||||
unknownCityId.add(location.getLocationId().toString());
|
||||
});
|
||||
CountryLevelInfoEntity byCityId = countryLevelInfoRepository.findByCityId(location.getCityId());
|
||||
location.setLocationEnName(byCityId.getCountyEnName());
|
||||
} else {
|
||||
location.setLocationEnName("unknown");
|
||||
}
|
||||
}
|
||||
}
|
||||
locationRepository.saveAll(allLevelThreeAndFour);
|
||||
}
|
||||
|
||||
|
||||
// @Test
|
||||
void batchPushCarData() {
|
||||
String requestBody1 = """
|
||||
{"notifyData":"{\\"order\\":{\\"orderSerialNo\\":\\"%s\\",\\"productName\\":\\"无锡-用车\\",\\"policyRuleName\\":\\"JT_STANDARD_LEVEL_TWO\\",\\"orderStatus\\":31,\\"orderStatusDesc\\":\\"行程结束\\",\\"totalPrice\\":82.60,\\"createTime\\":\\"2024-03-17T19:02:39\\",\\"servicePrice\\":0.00,\\"contactName\\":\\"高广全\\",\\"contactPhone\\":\\"18020504070\\",\\"isEstimate\\":false,\\"priceDetailList\\":[{\\"title\\":\\"起步费\\",\\"displayValue\\":\\"10.68\\",\\"type\\":1},{\\"title\\":\\"里程费(29.4公里)\\",\\"displayValue\\":\\"45.33\\",\\"type\\":2},{\\"title\\":\\"长途费\\",\\"displayValue\\":\\"16.85\\",\\"type\\":0},{\\"title\\":\\"时长费(30分钟)\\",\\"displayValue\\":\\"8.72\\",\\"type\\":3},{\\"title\\":\\"其他费用\\",\\"displayValue\\":\\"0.52\\",\\"type\\":0},{\\"title\\":\\"企业服务费\\",\\"displayValue\\":\\"0.50\\",\\"type\\":0}],\\"outEmployeeId\\":\\"210511055\\",\\"outEnterpriseId\\":\\"\\",\\"diffPrice\\":0.0,\\"carPurposeId\\":0,\\"subjectMatter\\":\\"\\",\\"subjectRemark\\":\\"\\",\\"personalPrice\\":0.00,\\"companyPrice\\":82.60,\\"payType\\":1,\\"passagerOutEmployeeId\\":\\"210511055\\",\\"employeeCode\\":\\"\\"},\\"orderDriver\\":{\\"driverName\\":\\"夏师傅\\",\\"driverPhone\\":\\"13182885247\\",\\"carColor\\":\\"白色\\",\\"carType\\":\\"东风风行风行S50EV\\",\\"carCard\\":\\"苏BDL5653\\"},\\"orderExtend\\":{\\"serviceType\\":19,\\"serviceTypeDesc\\":\\"即时用车\\",\\"departureTime\\":\\"2024-03-17T19:02:56\\",\\"startCityName\\":\\"无锡\\",\\"endCityName\\":\\"无锡\\",\\"startCityId\\":\\"229\\",\\"endCityId\\":\\"229\\",\\"carType\\":\\"1\\",\\"carTypeName\\":\\"经济型\\",\\"startAddress\\":\\"T2-国内停车场-H区\\",\\"startLatitude\\":31.50589,\\"startLongitude\\":120.43319,\\"endAddress\\":\\"嘉盛维纳阳光16号\\",\\"endLatitude\\":31.671008,\\"endLongitude\\":120.297028,\\"passengerCount\\":1,\\"chargeTime\\":\\"2024-03-17T19:07:38\\",\\"finishTime\\":\\"2024-03-17T19:37:37\\",\\"duration\\":\\"30分钟\\",\\"mileage\\":\\"29.4公里\\",\\"flightNo\\":\\"\\",\\"departAirportCode\\":\\"\\",\\"arriveAirportCode\\":\\"\\",\\"departAirportName\\":\\"\\",\\"arriveAirportName\\":\\"\\",\\"flightDate\\":\\"1900-01-01T00:00:00\\",\\"flightArriveTime\\":\\"1900-01-01T00:00:00\\",\\"departTerminal\\":\\"\\",\\"arriveTerminal\\":\\"\\",\\"serviceName\\":\\"T3\\"},\\"travelData\\":{\\"oaNo\\":\\"\\",\\"travelApplyNo\\":\\"XNFSSC-XNCLSQ240315000090\\",\\"travelRemark\\":\\"\\",\\"submitItemList\\":[{\\"itemCode\\":\\"Custom1\\",\\"itemTitle\\":\\"对应所属系统\\",\\"itemTitleEn\\":\\"\\",\\"itemContent\\":\\"XNFSSC\\",\\"attachmentList\\":null},{\\"itemCode\\":\\"Custom2\\",\\"itemTitle\\":\\"核算企业code\\",\\"itemTitleEn\\":\\"\\",\\"itemContent\\":\\"35ebf5eafa3c11eb87f255e414e4799e\\",\\"attachmentList\\":null},{\\"itemCode\\":\\"Custom3\\",\\"itemTitle\\":\\"核算企业名称\\",\\"itemTitleEn\\":\\"\\",\\"itemContent\\":\\"正泰新能科技股份有限公司\\",\\"attachmentList\\":null},{\\"itemCode\\":\\"Custom4\\",\\"itemTitle\\":\\"项目订单号\\",\\"itemTitleEn\\":\\"\\",\\"itemContent\\":\\"HZNqt01\\",\\"attachmentList\\":null}]},\\"priceVarList\\":[]}","notifyType":6,"subNotifyType":1,"notifyTime":1710675471847,"sign":"0b4a5b5311847f7d36502f4af6092007","soleKey":"b7d150b06684bf85ed4720ca96becdbb","isEncrypt":false}
|
||||
""";
|
||||
List<String> carNo = List.of("DC24031767027658390", "DC24031767023808945", "DC24031767021079236", "DC24031767019641697",
|
||||
"DC24031767017225857", "DC24031767016162128", "DC24031767010404956", "DC24031767008941070", "DC24031767006323992",
|
||||
"DC24031767001629859", "DC24031766988159362", "DC24031766983878276", "DC24031767037498389", "DC24031767042030765",
|
||||
"DC24031767043065233", "DC24031767042058095", "DC24031767042030765", "DC24031767037498389", "DC24031767028490005"
|
||||
, "DC24031867055153288", "DC24031867059573209", "DC24031867064445617", "DC24031867067886419", "DC24031867071326517",
|
||||
"DC24031867076083515", "DC24031867077390535", "DC24031867080618898", "DC24031867081971394", "DC24031867084946553",
|
||||
"DC24031867085670005", "DC24031867087888141", "DC24031867088414549", "DC24031867091347149", "DC24031867099981677",
|
||||
"DC24031867100722462");
|
||||
Gson gson = new Gson();
|
||||
for (String s : carNo) {
|
||||
String requestJson = String.format(requestBody1, s);
|
||||
Notification notification = gson.fromJson(requestJson, Notification.class);
|
||||
System.out.println(requestJson);
|
||||
Object post = postRequest.post("https://trip.chint.com/api/public/common/back", notification, Object.class);
|
||||
System.out.println(gson.toJson(post));
|
||||
}
|
||||
}
|
||||
|
||||
// @Test
|
||||
void batchPushCTripCar(){
|
||||
List<String> carOrderNo = List.of("30397695527","30398096043","30398133695","30398135929","30398172920",
|
||||
"30398235616","30398255836","30398307458","30398307872","30398370192","30398383725","30398385376");
|
||||
CTripStatusNotification cTripStatusNotification = new CTripStatusNotification();
|
||||
cTripStatusNotification.setApproveScenario("");
|
||||
cTripStatusNotification.setCorpId("zhengtai2024");
|
||||
cTripStatusNotification.setOrderStatus("EndService");
|
||||
cTripStatusNotification.setProductType("CarImmediately");
|
||||
cTripStatusNotification.setRefundType(null);
|
||||
cTripStatusNotification.setStatusIDs(null);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue