已合并 PR 10073: 修复可能出现找不到城市的bug
This commit is contained in:
commit
f8490a5f9d
|
@ -124,19 +124,12 @@ public class OrderDetailQuery {
|
|||
|
||||
List<OrderDetail> orderDetailList = orderDetailRepository.findByUpdateTimeBetween(targetTimeBegin, targetTimeEnd);
|
||||
|
||||
Stream<Object> orderDetailStream = orderDetailList.stream().map(orderDetail -> {
|
||||
switch (productType) {
|
||||
case 1:
|
||||
return processFlightOrderDetail(orderDetail, systemType);
|
||||
case 2:
|
||||
return processHotelOrderDetail(orderDetail, systemType);
|
||||
case 3:
|
||||
return processTrainOrderDetail(orderDetail, systemType);
|
||||
case 4:
|
||||
return processCarOrderDetail(orderDetail, systemType);
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
Stream<Object> orderDetailStream = orderDetailList.stream().map(orderDetail -> switch (productType) {
|
||||
case 1 -> processFlightOrderDetail(orderDetail, systemType);
|
||||
case 2 -> processHotelOrderDetail(orderDetail, systemType);
|
||||
case 3 -> processTrainOrderDetail(orderDetail, systemType);
|
||||
case 4 -> processCarOrderDetail(orderDetail, systemType);
|
||||
default -> null;
|
||||
}).filter(Objects::nonNull);
|
||||
|
||||
List<Object> res = orderDetailStream.toList();
|
||||
|
@ -146,7 +139,7 @@ public class OrderDetailQuery {
|
|||
.limit(pageSize)
|
||||
.toList();
|
||||
|
||||
return Result.Success(SUCCESS, PageResult.totalPageNum((long) res.size(), paginatedResults));
|
||||
return Result.Success(SUCCESS, PageResult.totalPageNum(res.size(), paginatedResults));
|
||||
}
|
||||
|
||||
private Object processHotelOrderDetail(OrderDetail orderDetail, String systemType) {
|
||||
|
|
|
@ -3,22 +3,23 @@ package com.chint.domain.repository;
|
|||
import com.chint.application.dtos.LocationParam;
|
||||
import com.chint.domain.aggregates.order.Location;
|
||||
import com.chint.infrastructure.util.PageResult;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface LocationRepository {
|
||||
// List<Location> findByHot(List<LocationHot> locationHots);
|
||||
Location findByLocationId(Long locationId);
|
||||
|
||||
Location save(Location location);
|
||||
|
||||
PageResult<Location> pageQuery(LocationParam locationParam);
|
||||
|
||||
List<Location> findAll();
|
||||
|
||||
Location findByCityId(Long cityId,String shortName);
|
||||
Location findByCityId(Long cityId);
|
||||
|
||||
List<Location> findAllLevelThreeAndFour();
|
||||
|
||||
List<Location> findAllLeverThreeAndIsInternal();
|
||||
|
||||
Location findById(Long id);
|
||||
|
@ -31,6 +32,7 @@ public interface LocationRepository {
|
|||
|
||||
//这个方法需要实现根据城市类型,商品级别的筛选
|
||||
List<Location> findByName(LocationParam locationParam);
|
||||
|
||||
List<Location> findByName(String localName);
|
||||
|
||||
String locationPathByName(String localName);
|
||||
|
@ -41,14 +43,15 @@ public interface LocationRepository {
|
|||
|
||||
List<Location> findByNameList(List<Long> locationIds);
|
||||
|
||||
List<Location> findByCityNameAndLevelThree(String localName);
|
||||
List<Location> findListByCityName(String localName);
|
||||
|
||||
Location findByCityName(String localName);
|
||||
|
||||
Location findByDistrictShotName(String name);
|
||||
|
||||
List<Location> findChinaCityByLevel(String locationNames,Integer level);
|
||||
List<Location> findChinaCityByLevel(String locationNames, Integer level);
|
||||
|
||||
|
||||
List<Location> findNotChintCityByLevel(String locationNames,Integer level);
|
||||
List<Location> findNotChintCityByLevel(String locationNames, Integer level);
|
||||
|
||||
}
|
|
@ -56,10 +56,10 @@ public class CTripOrderDataAdapter implements OrderDataAdapter {
|
|||
if (hotelOrderInfoList != null && hotelOrderInfoList.size() == 1) {
|
||||
HotelOrderInfoEntity hotelOrderInfoEntity = hotelOrderInfoList.get(0);
|
||||
|
||||
Location byName = locationRepository.findByCityNameAndLevelThree(hotelOrderInfoEntity.getCityName()).get(0);
|
||||
Location byName = locationRepository.findByCityId(Long.valueOf(hotelOrderInfoEntity.getCityID()));
|
||||
|
||||
String currency = hotelOrderInfoEntity.getCurrency();
|
||||
if(currency == null){
|
||||
if (currency == null) {
|
||||
currency = CurrencyType.RENMINBI.getCode();
|
||||
}
|
||||
return builder.productType(LegConstant.LEG_TYPE_HOTEL)
|
||||
|
@ -83,11 +83,27 @@ public class CTripOrderDataAdapter implements OrderDataAdapter {
|
|||
if (flightOrderInfoList != null && flightOrderInfoList.size() == 1) {
|
||||
FlightOrderInfoEntity flightOrderInfo = flightOrderInfoList.get(0);
|
||||
FlightInfo flightInfo = flightOrderInfo.getFlightInfo().get(0);
|
||||
Location departCityName = locationRepository.findByCityNameAndLevelThree(flightInfo.getDCityName()).get(0);
|
||||
Location arriveCityName = locationRepository.findByCityNameAndLevelThree(flightInfo.getACityName()).get(0);
|
||||
|
||||
|
||||
Long originId;
|
||||
List<Location> listByCityName = locationRepository.findListByCityName(flightInfo.getDCityName());
|
||||
if (listByCityName == null || listByCityName.isEmpty()) {
|
||||
originId = null;
|
||||
} else {
|
||||
originId = listByCityName.get(0).getLocationId();
|
||||
}
|
||||
|
||||
|
||||
Long destinationId;
|
||||
List<Location> arriveLocation = locationRepository.findListByCityName(flightInfo.getACityName());
|
||||
if (arriveLocation == null || arriveLocation.isEmpty()) {
|
||||
destinationId = null;
|
||||
} else {
|
||||
destinationId = arriveLocation.get(0).getLocationId();
|
||||
}
|
||||
|
||||
String currency = flightOrderInfo.getBasicInfo().getCurrency();
|
||||
if(currency == null){
|
||||
if (currency == null) {
|
||||
currency = CurrencyType.RENMINBI.getCode();
|
||||
}
|
||||
return builder.productType(LegConstant.LEG_TYPE_AIRPLANE)
|
||||
|
@ -96,8 +112,8 @@ public class CTripOrderDataAdapter implements OrderDataAdapter {
|
|||
.orderTime(flightOrderInfo.getBasicInfo().getCreateTime())
|
||||
.startTime(flightInfo.getTakeoffTime())
|
||||
.endTime(flightInfo.getArrivalTime())
|
||||
.originId(departCityName.getLocationId())
|
||||
.destinationId(arriveCityName.getLocationId())
|
||||
.originId(originId)
|
||||
.destinationId(destinationId)
|
||||
.price(String.valueOf(flightInfo.getAmount()))
|
||||
.selfOrderNo(flightOrderInfo.getBasicInfo().getJourneyID())
|
||||
.outOrderNo(flightOrderInfo.getBasicInfo().getOrderID())
|
||||
|
@ -122,8 +138,8 @@ public class CTripOrderDataAdapter implements OrderDataAdapter {
|
|||
CarQuickOrderInfoEntity carOrderInfo = carOrderInfoList.get(0);
|
||||
OrderProduct orderProduct = carOrderInfo.getOrderProduct();
|
||||
CarBasicInfo carBasicInfo = carOrderInfo.getBasicInfo();
|
||||
Location departCityName = locationRepository.findByCityNameAndLevelThree(orderProduct.getDepartAddress().getCityName()).get(0);
|
||||
Location arriveCityName = locationRepository.findByCityNameAndLevelThree(orderProduct.getArriveAddress().getCityName()).get(0);
|
||||
Location departCityName = locationRepository.findByCityId(Long.valueOf(orderProduct.getDepartAddress().getCityId()));
|
||||
Location arriveCityName = locationRepository.findByCityId(Long.valueOf(orderProduct.getArriveAddress().getCityId()));
|
||||
return builder.productType(LegConstant.LEG_TYPE_TAXI)
|
||||
.carOrderDetailData(carOrderInfo)
|
||||
.currencyCode(CurrencyType.RENMINBI.getCode())
|
||||
|
|
|
@ -4,7 +4,6 @@ import com.chint.domain.aggregates.order.Location;
|
|||
import com.chint.domain.repository.LocationRepository;
|
||||
import com.chint.domain.value_object.OrderLegData;
|
||||
import com.chint.domain.value_object.SupplierCallbackData;
|
||||
import com.chint.interfaces.rest.ly.dto.carorderdatapushback.CarDetailResult;
|
||||
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;
|
||||
|
@ -13,6 +12,7 @@ import com.chint.interfaces.rest.ly.tools.LYOrderUtil;
|
|||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
import static com.chint.infrastructure.constant.LYConstant.*;
|
||||
|
@ -45,9 +45,21 @@ public class LYOrderDataAdapter implements OrderDataAdapter {
|
|||
TrainDetailResponse.TrainDetailData trainDetailData = (TrainDetailResponse.TrainDetailData) data;
|
||||
TrainDetailResponse.TravelData travelData = trainDetailData.getTravelData();
|
||||
String departCity = trainDetailData.getDepartCity();
|
||||
Location originLocation = locationRepository.findByCityNameAndLevelThree(departCity).get(0);
|
||||
String arriveCity = trainDetailData.getArriveCity();
|
||||
Location arriveLocation = locationRepository.findByCityNameAndLevelThree(arriveCity).get(0);
|
||||
Long originId;
|
||||
List<Location> listByCityName = locationRepository.findListByCityName(departCity);
|
||||
if (listByCityName == null || listByCityName.isEmpty()) {
|
||||
originId = null;
|
||||
} else {
|
||||
originId = listByCityName.get(0).getLocationId();
|
||||
}
|
||||
Long destinationId;
|
||||
List<Location> arriveCities = locationRepository.findListByCityName(arriveCity);
|
||||
if (arriveCities == null || arriveCities.isEmpty()) {
|
||||
destinationId = null;
|
||||
} else {
|
||||
destinationId = arriveCities.get(0).getLocationId();
|
||||
}
|
||||
return Optional.of(
|
||||
OrderLegData.builder()
|
||||
.productType(LEG_TYPE_TRAIN)
|
||||
|
@ -55,8 +67,8 @@ public class LYOrderDataAdapter implements OrderDataAdapter {
|
|||
.price(String.valueOf(trainDetailData.getTotalAmount()))
|
||||
.outOrderNo(trainDetailData.getOrderNo())
|
||||
.trainOrderDetailData(trainDetailData)
|
||||
.originId(originLocation.getLocationId())
|
||||
.destinationId(arriveLocation.getLocationId())
|
||||
.originId(originId)
|
||||
.destinationId(destinationId)
|
||||
.originName(departCity)
|
||||
.destinationName(arriveCity)
|
||||
.orderStatus(LYOrderUtil.mapTrainStatus(trainDetailData.getOrderStatus()))
|
||||
|
@ -73,7 +85,13 @@ public class LYOrderDataAdapter implements OrderDataAdapter {
|
|||
HotelDetailResponse.OrderInfo orderInfo = hotelDetailData.getOrderInfo();
|
||||
String travelApplyNo = hotelDetailData.getTravelData().getTravelApplyNo();
|
||||
String cityName = hotelDetailData.getHotelInfo().getCityName();
|
||||
Location originLocation = locationRepository.findByCityNameAndLevelThree(cityName).get(0);
|
||||
List<Location> listByCityName = locationRepository.findListByCityName(cityName);
|
||||
Long locationId;
|
||||
if (listByCityName == null || listByCityName.isEmpty()) {
|
||||
locationId = null;
|
||||
} else {
|
||||
locationId = listByCityName.get(0).getLocationId();
|
||||
}
|
||||
return Optional.of(
|
||||
OrderLegData.builder()
|
||||
.productType(LEG_TYPE_HOTEL)
|
||||
|
@ -86,9 +104,9 @@ public class LYOrderDataAdapter implements OrderDataAdapter {
|
|||
.endTime(orderInfo.getOriginalCheckOutDate())
|
||||
.orderStatus(supplierData.getSelfOrderStatus())
|
||||
.originOrderStatus(supplierData.getOutOrderStatus())
|
||||
.originId(originLocation.getLocationId())
|
||||
.originId(locationId)
|
||||
.originName(cityName)
|
||||
.destinationId(originLocation.getLocationId())
|
||||
.destinationId(locationId)
|
||||
.destinationName(cityName)
|
||||
.supplierName(SUPPLIER_L_Y)
|
||||
.build()
|
||||
|
@ -102,9 +120,23 @@ public class LYOrderDataAdapter implements OrderDataAdapter {
|
|||
CarDetailResponse.TravelDataInfo travelDataInfo = data.getTravelDataInfo();
|
||||
CarDetailResponse.OrderExtendInfo orderExtendInfo = data.getOrderExtendInfo();
|
||||
String startCityName = orderExtendInfo.getStartCityName();
|
||||
Location startLocation = locationRepository.findByCityNameAndLevelThree(startCityName).get(0);
|
||||
List<Location> listByCityName = locationRepository.findListByCityName(startCityName);
|
||||
Long originId;
|
||||
if (listByCityName == null || listByCityName.isEmpty()) {
|
||||
originId = null;
|
||||
} else {
|
||||
originId = listByCityName.get(0).getLocationId();
|
||||
}
|
||||
|
||||
Long destinationId;
|
||||
String endCityName = orderExtendInfo.getEndCityName();
|
||||
Location endLocation = locationRepository.findByCityNameAndLevelThree(endCityName).get(0);
|
||||
List<Location> arriveCities = locationRepository.findListByCityName(endCityName);
|
||||
if (arriveCities == null || arriveCities.isEmpty()) {
|
||||
destinationId = null;
|
||||
} else {
|
||||
destinationId = arriveCities.get(0).getLocationId();
|
||||
}
|
||||
|
||||
return Optional.of(
|
||||
OrderLegData.builder()
|
||||
.productType(LEG_TYPE_TAXI)
|
||||
|
@ -117,10 +149,10 @@ public class LYOrderDataAdapter implements OrderDataAdapter {
|
|||
.endTime(orderExtendInfo.getFinishTime())
|
||||
.orderStatus(supplierData.getSelfOrderStatus())
|
||||
.originOrderStatus(supplierData.getOutOrderStatus())
|
||||
.originId(startLocation.getLocationId())
|
||||
.originName(startLocation.getLocationName())
|
||||
.destinationId(endLocation.getLocationId())
|
||||
.destinationName(endLocation.getLocationName())
|
||||
.originId(originId)
|
||||
.originName(startCityName)
|
||||
.destinationId(destinationId)
|
||||
.destinationName(endCityName)
|
||||
.supplierName(SUPPLIER_L_Y)
|
||||
.build()
|
||||
);
|
||||
|
@ -132,13 +164,27 @@ public class LYOrderDataAdapter implements OrderDataAdapter {
|
|||
FlightOrderResponse.OrderDetails orderDetails = flightDetail.getOrderDetails();
|
||||
String travelApplyNo = flightDetail.getTravelData().getTravelApplyNo();
|
||||
|
||||
|
||||
// 检查 flightSegmentList 是否为空或者长度为 0
|
||||
if (flightDetail.getFlightSegmentList() == null || flightDetail.getFlightSegmentList().isEmpty()) {
|
||||
return Optional.empty(); // 或者你可以选择抛出一个异常
|
||||
}
|
||||
FlightOrderResponse.FlightSegment flightSegment = flightDetail.getFlightSegmentList().get(0);
|
||||
|
||||
String departCity = flightSegment.getDepartCity();
|
||||
Location originLocation = locationRepository.findByCityNameAndLevelThree(departCity).get(0);
|
||||
// 检查由 departCity 找到的位置列表是否为空或者长度为 0
|
||||
List<Location> originLocations = locationRepository.findListByCityName(departCity);
|
||||
if (originLocations == null || originLocations.isEmpty()) {
|
||||
return Optional.empty(); // 或者你可以选择抛出一个异常
|
||||
}
|
||||
Location originLocation = originLocations.get(0);
|
||||
|
||||
String arriveCity = flightSegment.getArriveCity();
|
||||
Location arriveLocation = locationRepository.findByCityNameAndLevelThree(arriveCity).get(0);
|
||||
// 检查由 arriveCity 找到的位置列表是否为空或者长度为 0
|
||||
List<Location> arriveLocations = locationRepository.findListByCityName(arriveCity);
|
||||
if (arriveLocations == null || arriveLocations.isEmpty()) {
|
||||
return Optional.empty(); // 或者你可以选择抛出一个异常
|
||||
}
|
||||
Location arriveLocation = arriveLocations.get(0);
|
||||
|
||||
return Optional.of(
|
||||
OrderLegData.builder()
|
||||
|
|
|
@ -64,8 +64,8 @@ public class LocationRepositoryImpl implements LocationRepository {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Location findByCityId(Long cityId, String shortName) {
|
||||
return jdbcLocationRepository.findByCityIdAndLocationShortName(cityId, shortName);
|
||||
public Location findByCityId(Long cityId) {
|
||||
return jdbcLocationRepository.findByCityId(cityId);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -141,8 +141,12 @@ public class LocationRepositoryImpl implements LocationRepository {
|
|||
|
||||
@Cacheable(value = "Location-findByCityNameAndLevelThree-localName", key = "#localName")
|
||||
@Override
|
||||
public List<Location> findByCityNameAndLevelThree(String localName) {
|
||||
return jdbcLocationRepository.findByLocationNameAndLevel(localName, 3);
|
||||
public List<Location> findListByCityName(String localName) {
|
||||
List<Location> byLocationNameAndLevel = jdbcLocationRepository.findByLocationNameContainingAndLevel(localName, 3);
|
||||
if (byLocationNameAndLevel == null || byLocationNameAndLevel.isEmpty()) {
|
||||
return jdbcLocationRepository.findByLocationNameContainingAndLevel(localName, 4);
|
||||
}
|
||||
return byLocationNameAndLevel;
|
||||
}
|
||||
|
||||
@Cacheable(value = "Location-findByCityName-localName", key = "#localName")
|
||||
|
@ -151,6 +155,7 @@ public class LocationRepositoryImpl implements LocationRepository {
|
|||
return jdbcLocationRepository.findByLocationNameAndLevelOrLocationNameAndLevel(localName, 3, localName, 4);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Location findByDistrictShotName(String name) {
|
||||
return jdbcLocationRepository.findByLocationShortName(name);
|
||||
|
|
|
@ -13,8 +13,11 @@ import java.util.List;
|
|||
public interface JdbcLocationRepository extends CrudRepository<Location, Long> {
|
||||
|
||||
Location findByCityIdAndLocationShortName(Long cityId, String locationShortName);
|
||||
|
||||
Location findByLocationId(Long locationId);
|
||||
|
||||
Location findByCityId(Long cityId);
|
||||
|
||||
Location findByLocationShortName(String locationShortName);
|
||||
|
||||
List<Location> findByLevelOrLevel(Integer level, Integer level2);
|
||||
|
@ -57,7 +60,7 @@ public interface JdbcLocationRepository extends CrudRepository<Location, Long> {
|
|||
|
||||
List<Location> findByLocationPathNameInAndLevel(Collection<String> locationPathName, Integer level);
|
||||
|
||||
List<Location> findByLocationNameAndLevel(String locationName, Integer level);
|
||||
List<Location> findByLocationNameContainingAndLevel(String locationName, Integer level);
|
||||
|
||||
List<Location> findAllByLocationPathNotContainingAndLevel(String locationPath, Integer level);
|
||||
|
||||
|
|
|
@ -165,7 +165,6 @@ public class HotelOrderDetailDto implements Serializable {
|
|||
return null;
|
||||
}
|
||||
HotelOrderDetailDto hotelOrderDetailDto = BeanUtil.copyProperties(hotelOrderDetail, HotelOrderDetailDto.class);
|
||||
|
||||
return hotelOrderDetailDto;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -307,8 +307,8 @@ public class CommonController {
|
|||
FlyOkDTO freightDTO = new FlyOkDTO();
|
||||
ParamFly param = new ParamFly();
|
||||
param.setOrderSerialNo(orderSerialNo);
|
||||
changeFlightPush(freightDTO);
|
||||
freightDTO.setParam(param);
|
||||
changeFlightPush(freightDTO);
|
||||
//ruleViolate
|
||||
if (ruleViolate == 1 && subNotifyType == 9) {
|
||||
sendMsg(orderSerialNo);
|
||||
|
|
|
@ -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