Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
dengwc 2024-03-22 17:27:38 +08:00
commit d82f5bf9d1
10 changed files with 94 additions and 41 deletions

View File

@ -5,6 +5,7 @@ import com.chint.domain.aggregates.location.basedata.PrefectureLevelCityInfoEnti
import com.chint.domain.aggregates.order.Location; import com.chint.domain.aggregates.order.Location;
import com.chint.domain.aggregates.order.RouteOrder; import com.chint.domain.aggregates.order.RouteOrder;
import com.chint.domain.aggregates.standards.CityTag; import com.chint.domain.aggregates.standards.CityTag;
import com.chint.domain.aggregates.standards.TrainStandardsService;
import com.chint.domain.aggregates.user.User; import com.chint.domain.aggregates.user.User;
import com.chint.domain.exceptions.LocationException; import com.chint.domain.exceptions.LocationException;
import com.chint.domain.repository.*; import com.chint.domain.repository.*;
@ -34,7 +35,6 @@ import java.util.List;
import java.util.Optional; import java.util.Optional;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import static com.chint.domain.aggregates.standards.TrainStandards.trainStandardsMap;
import static com.chint.infrastructure.constant.CommonMessageConstant.LEG_LOCATION_SAME_ERROR; import static com.chint.infrastructure.constant.CommonMessageConstant.LEG_LOCATION_SAME_ERROR;
import static com.chint.infrastructure.constant.CommonMessageConstant.NO_PRICE_ERROR; import static com.chint.infrastructure.constant.CommonMessageConstant.NO_PRICE_ERROR;
import static com.chint.infrastructure.constant.LocationConstant.LOCATION_TYPE_COUNTY; import static com.chint.infrastructure.constant.LocationConstant.LOCATION_TYPE_COUNTY;
@ -65,6 +65,9 @@ public class CTripEstimatePrice implements EstimatePrice {
@Autowired @Autowired
private RouteRepository routeRepository; private RouteRepository routeRepository;
@Autowired
private TrainStandardsService trainStandardsService;
@Override @Override
public TrainPriceData queryTrainPrice(PriceQueryData priceQueryData) { public TrainPriceData queryTrainPrice(PriceQueryData priceQueryData) {
checkPriceQueryData(priceQueryData); checkPriceQueryData(priceQueryData);
@ -122,7 +125,7 @@ public class CTripEstimatePrice implements EstimatePrice {
}); });
//根据差标等级获取可报销最大火车金额 //根据差标等级获取可报销最大火车金额
String trainStandards = trainStandardsMap.get(standardLevel);//获取可报销座位 String trainStandards = trainStandardsService.priceTrainStandards(standardLevel);//获取可报销座位
Optional<String> optional = trainPriceData.getSeatInfoList().stream() Optional<String> optional = trainPriceData.getSeatInfoList().stream()
.filter(seatInfo -> { .filter(seatInfo -> {
Pattern pattern = Pattern.compile("\\b" + seatInfo.getSeatName() + "\\b"); Pattern pattern = Pattern.compile("\\b" + seatInfo.getSeatName() + "\\b");
@ -254,7 +257,7 @@ public class CTripEstimatePrice implements EstimatePrice {
HotelValuationResult hotelValuationResult = estimate.getData().getHotelValuationResult(); HotelValuationResult hotelValuationResult = estimate.getData().getHotelValuationResult();
String price = hotelValuationResult.getMaxPrice().toString(); String price = hotelValuationResult.getMaxPrice().toString();
if(Double.parseDouble(price) == 0){ if (Double.parseDouble(price) == 0) {
hotelPriceData.setSuccess(false); hotelPriceData.setSuccess(false);
return hotelPriceData; return hotelPriceData;
} }

View File

@ -1,34 +0,0 @@
package com.chint.domain.aggregates.standards;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import static com.chint.infrastructure.constant.RankConstant.*;
public class TrainStandards {
public static final HashMap<String, String> trainStandardsMap;
static {
trainStandardsMap = new HashMap<>();
//集团
String oneStandards = "商务座,一等双软,一等座,二等座,高级软卧,一等双软";
String twoStandards = "一等座,高级软卧,一等双软,动卧,软卧,硬卧,硬座";
String threeStandards = "一等座,一等双软,二等座,软卧,硬卧,硬座";
String fourStandards = "二等座,二等双软,软卧,无座,硬卧,硬座";
trainStandardsMap.put(STANDARD_LEVEL_ONE, oneStandards);
trainStandardsMap.put(STANDARD_LEVEL_TWO, twoStandards);
trainStandardsMap.put(STANDARD_LEVEL_THREE, threeStandards);
trainStandardsMap.put(STANDARD_LEVEL_FOUR, fourStandards);
//仪表
String oneStandardsYB = "一等座,高级软卧,一等双软,动卧,软卧,硬卧,硬座";
String twoStandardsYB = "一等座,高级软卧,一等双软,动卧,软卧,硬卧,硬座";
String threeStandardsYB = "一等座,一等双软,二等座,软卧,硬卧,硬座";
String fourStandardsYB = "二等座,二等双软,软卧,无座,硬卧,硬座";
trainStandardsMap.put(STANDARD_LEVEL_ONE_YB, oneStandardsYB);
trainStandardsMap.put(STANDARD_LEVEL_TWO_YB, twoStandardsYB);
trainStandardsMap.put(STANDARD_LEVEL_THREE_YB, threeStandardsYB);
trainStandardsMap.put(STANDARD_LEVEL_FOUR_YB, fourStandardsYB);
}
}

View File

@ -0,0 +1,54 @@
package com.chint.domain.aggregates.standards;
import com.chint.domain.exceptions.NotFoundException;
import com.chint.domain.repository.TravelStandardsRepository;
import jakarta.annotation.PostConstruct;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Component;
import java.util.HashMap;
import java.util.List;
import static com.chint.infrastructure.constant.LegConstant.LEG_TYPE_TRAIN;
import static com.chint.infrastructure.constant.RankConstant.*;
@Component
public class TrainStandardsService {
@Autowired
private TravelStandardsRepository travelStandardsRepository;
// @PostConstruct
// private void init() {
// List<TravelStandards> allTrain = travelStandardsRepository.findAllTrain();
// allTrain.forEach(it -> trainStandardsMap.put(it.getStandardLevel(), it.getPrice()));
// }
@Cacheable(value = "TrainStandards" , key = "#standardLevel")
public String priceTrainStandards(String standardLevel) {
List<TravelStandards> byStandardLevelAndProductType = travelStandardsRepository.
findByStandardLevelAndProductType(standardLevel, String.valueOf(LEG_TYPE_TRAIN));
if (byStandardLevelAndProductType.isEmpty()) {
throw new NotFoundException("火车相关差标未配置,请联系管理员");
}
TravelStandards travelStandards = byStandardLevelAndProductType.get(0);
return travelStandards.getPrice();
// if (trainStandardsMap.containsKey(standardLevel)) {
// return trainStandardsMap.get(standardLevel);
// } else {
// List<TravelStandards> byStandardLevelAndProductType = travelStandardsRepository.
// findByStandardLevelAndProductType(standardLevel, String.valueOf(LEG_TYPE_TRAIN));
// if (byStandardLevelAndProductType.isEmpty()) {
// throw new NotFoundException("火车相关差标未配置,请联系管理员");
// }
// TravelStandards travelStandards = byStandardLevelAndProductType.get(0);
// trainStandardsMap.put(travelStandards.getStandardLevel(), travelStandards.getPrice());
// return travelStandards.getPrice();
// }
}
}

View File

@ -25,6 +25,7 @@ public class RanksFactoryImpl implements RanksFactory {
String prefix = switch (ranksData.getCompanyCode()) { String prefix = switch (ranksData.getCompanyCode()) {
case JT_COMPANY_CODE -> STANDARD_LEVEL_JT; case JT_COMPANY_CODE -> STANDARD_LEVEL_JT;
case STANDARD_LEVEL_YB_CODE -> STANDARD_LEVEL_YB; case STANDARD_LEVEL_YB_CODE -> STANDARD_LEVEL_YB;
case STANDARD_LEVEL_WL_CODE -> STANDARD_LEVEL_WL;
// case STANDARD_LEVEL_SZKJ_CODE -> STANDARD_LEVEL_SZKJ; // case STANDARD_LEVEL_SZKJ_CODE -> STANDARD_LEVEL_SZKJ;
case STANDARD_LEVEL_SDZN_CODE -> STANDARD_LEVEL_SDZN; case STANDARD_LEVEL_SDZN_CODE -> STANDARD_LEVEL_SDZN;
// case STANDARD_LEVEL_DQXS_CODE -> STANDARD_LEVEL_DQXS; // case STANDARD_LEVEL_DQXS_CODE -> STANDARD_LEVEL_DQXS;

View File

@ -10,7 +10,10 @@ import java.util.List;
public interface TravelStandardsRepository { public interface TravelStandardsRepository {
TravelStandards save(TravelStandards travelStandards); TravelStandards save(TravelStandards travelStandards);
void saveAll(List<TravelStandards> travelStandardsList); void saveAll(List<TravelStandards> travelStandardsList);
List<TravelStandards> findAllTrain();
List<TravelStandards> findByStandardLevel(String standardLevel); List<TravelStandards> findByStandardLevel(String standardLevel);
List<TravelStandards> findByStandardLevelAndProductType(String standardLevel, String productType);
List<TravelStandards> findByTravelStandards(TravelStandards travelStandards); List<TravelStandards> findByTravelStandards(TravelStandards travelStandards);

View File

@ -46,6 +46,11 @@ public class LYConstant {
public static final int L_Y_PRODUCT_TYPE_CAR = 6; //用车 public static final int L_Y_PRODUCT_TYPE_CAR = 6; //用车
public static final int L_Y_PRODUCT_TYPE_HOTEL = 3; //酒店 public static final int L_Y_PRODUCT_TYPE_HOTEL = 3; //酒店
public static final int L_Y_CAR_FEE_TYPE_START = 1; //起步费
public static final int L_Y_CAR_FEE_TYPE_MILE = 2; //里程费
public static final int L_Y_CAR_FEE_TYPE_TIME= 3; //时长费
public static final int L_Y_CAR_FEE_TYPE_CANCEL = 4; //取消费
//同程订单推送类型 //同程订单推送类型
// public static final int L_Y_NOTIFY_COMMON = 1; //酒店 // public static final int L_Y_NOTIFY_COMMON = 1; //酒店
// public static final int L_Y_PRODUCT_TYPE_HOTEL = 3; //酒店 // public static final int L_Y_PRODUCT_TYPE_HOTEL = 3; //酒店

View File

@ -7,7 +7,9 @@ public class RankConstant {
public static final String XN_COMPANY_CODE = "A70000056";//新能编号 public static final String XN_COMPANY_CODE = "A70000056";//新能编号
public static final String STANDARD_LEVEL_JT = "JT_";//正泰集团股份有限公司 public static final String STANDARD_LEVEL_JT = "JT_";//正泰集团股份有限公司
public static final String STANDARD_LEVEL_YB_CODE = "A10160001";//仪表编号 public static final String STANDARD_LEVEL_YB_CODE = "A10160001";//仪表编号
public static final String STANDARD_LEVEL_WL_CODE = "A70000059";//仪表编号
public static final String STANDARD_LEVEL_YB = "YB_";//浙江正泰仪器仪表有限责任公司 public static final String STANDARD_LEVEL_YB = "YB_";//浙江正泰仪器仪表有限责任公司
public static final String STANDARD_LEVEL_WL = "WL_";//浙江正泰仪器仪表有限责任公司
public static final String STANDARD_LEVEL_SZKJ_CODE = "";//数智科技编号 public static final String STANDARD_LEVEL_SZKJ_CODE = "";//数智科技编号
public static final String STANDARD_LEVEL_SZKJ = "SZKJ_";//数智科技 public static final String STANDARD_LEVEL_SZKJ = "SZKJ_";//数智科技
public static final String STANDARD_LEVEL_SDZN_CODE = "A70000067";//山东智能编号 public static final String STANDARD_LEVEL_SDZN_CODE = "A70000067";//山东智能编号
@ -39,4 +41,11 @@ public class RankConstant {
public static final String STANDARD_LEVEL_TWO_YB = "YB_STANDARD_LEVEL_TWO";//差标2 public static final String STANDARD_LEVEL_TWO_YB = "YB_STANDARD_LEVEL_TWO";//差标2
public static final String STANDARD_LEVEL_THREE_YB = "YB_STANDARD_LEVEL_THREE";//差标3 public static final String STANDARD_LEVEL_THREE_YB = "YB_STANDARD_LEVEL_THREE";//差标3
public static final String STANDARD_LEVEL_FOUR_YB = "YB_STANDARD_LEVEL_FOUR";//差标4 public static final String STANDARD_LEVEL_FOUR_YB = "YB_STANDARD_LEVEL_FOUR";//差标4
//物联
public static final String STANDARD_LEVEL_ONE_WL = "WL_STANDARD_LEVEL_ONE";//差标1
public static final String STANDARD_LEVEL_TWO_WL = "WL_STANDARD_LEVEL_TWO";//差标2
public static final String STANDARD_LEVEL_THREE_WL = "WL_STANDARD_LEVEL_THREE";//差标3
public static final String STANDARD_LEVEL_FOUR_WL = "WL_STANDARD_LEVEL_FOUR";//差标4
} }

View File

@ -1,15 +1,15 @@
package com.chint.infrastructure.repository; package com.chint.infrastructure.repository;
import com.chint.domain.aggregates.standards.Ranks;
import com.chint.domain.aggregates.standards.TravelStandards; import com.chint.domain.aggregates.standards.TravelStandards;
import com.chint.domain.repository.TravelStandardsRepository; import com.chint.domain.repository.TravelStandardsRepository;
import com.chint.infrastructure.repository.jdbc.JdbcRanksRepository;
import com.chint.infrastructure.repository.jdbc.JdbcTravelStandardsRepository; import com.chint.infrastructure.repository.jdbc.JdbcTravelStandardsRepository;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import java.util.List; import java.util.List;
import static com.chint.infrastructure.constant.LegConstant.LEG_TYPE_TRAIN;
@Repository @Repository
public class TravelStandardsRepositoryImpl implements TravelStandardsRepository { public class TravelStandardsRepositoryImpl implements TravelStandardsRepository {
@ -26,11 +26,21 @@ public class TravelStandardsRepositoryImpl implements TravelStandardsRepository
jdbcTravelStandardsRepository.saveAll(travelStandardsList); jdbcTravelStandardsRepository.saveAll(travelStandardsList);
} }
@Override
public List<TravelStandards> findAllTrain() {
return jdbcTravelStandardsRepository.findByProductType(String.valueOf(LEG_TYPE_TRAIN));
}
@Override @Override
public List<TravelStandards> findByStandardLevel(String standardLevel) { public List<TravelStandards> findByStandardLevel(String standardLevel) {
return jdbcTravelStandardsRepository.findByStandardLevel(standardLevel); return jdbcTravelStandardsRepository.findByStandardLevel(standardLevel);
} }
@Override
public List<TravelStandards> findByStandardLevelAndProductType(String standardLevel, String productType) {
return jdbcTravelStandardsRepository.findByStandardLevelAndProductType(standardLevel, productType);
}
@Override @Override
public List<TravelStandards> findByTravelStandards(TravelStandards travelStandards) { public List<TravelStandards> findByTravelStandards(TravelStandards travelStandards) {
return jdbcTravelStandardsRepository.findByProductTypeAndStandardLevelAndCityTag( return jdbcTravelStandardsRepository.findByProductTypeAndStandardLevelAndCityTag(

View File

@ -9,7 +9,8 @@ import java.util.List;
@Repository @Repository
public interface JdbcTravelStandardsRepository extends CrudRepository<TravelStandards, Integer> { public interface JdbcTravelStandardsRepository extends CrudRepository<TravelStandards, Integer> {
List<TravelStandards> findByProductType(String productType);
List<TravelStandards> findByStandardLevel(String standardLevel); List<TravelStandards> findByStandardLevel(String standardLevel);
List<TravelStandards> findByProductTypeAndStandardLevelAndCityTag(String productType,String standardLevel,String cityTag); List<TravelStandards> findByProductTypeAndStandardLevelAndCityTag(String productType,String standardLevel,String cityTag);
List<TravelStandards> findByStandardLevelAndProductType(String standardLevel, String productType);
} }

View File

@ -1,6 +1,7 @@
package com.chint.interfaces.rest.ly.dto.search.response.car; package com.chint.interfaces.rest.ly.dto.search.response.car;
import com.chint.interfaces.rest.ly.dto.LYBaseResponse; import com.chint.interfaces.rest.ly.dto.LYBaseResponse;
import com.chint.interfaces.rest.ly.dto.carorderdatapushback.PriceDetail;
import lombok.Data; import lombok.Data;
import java.util.List; import java.util.List;
@ -13,7 +14,7 @@ public class CarDetailResponse extends LYBaseResponse {
@Data @Data
public static class DataWrapper { public static class DataWrapper {
private CarOrderDetailInfo carOrderDetailInfo; private CarOrderDetailInfo carOrderDetailInfo;
private List<Object> priceDetailList; private List<PriceDetail> priceDetailList;
private OrderExtendInfo orderExtendInfo; private OrderExtendInfo orderExtendInfo;
private OrderDriverInfo orderDriverInfo; private OrderDriverInfo orderDriverInfo;
private TravelDataInfo travelDataInfo; private TravelDataInfo travelDataInfo;