火车差标估价金额调整

This commit is contained in:
dengwc 2024-02-28 14:44:37 +08:00
parent 626968a7f0
commit af6feb405a
8 changed files with 108 additions and 11 deletions

View File

@ -92,7 +92,7 @@ public class RankController {
.setPrice(travelStandardsData.getPrice()) .setPrice(travelStandardsData.getPrice())
.setCityTag(travelStandardsData.getCityTag()); .setCityTag(travelStandardsData.getCityTag());
List<TravelStandards> travelStandardsList = travelStandardsRepository.findByTravelStandards(travelStandards); List<TravelStandards> travelStandardsList = travelStandardsRepository.findByTravelStandards(travelStandards);
if (travelStandardsList.isEmpty()) { if (!travelStandardsList.isEmpty()) {
return Result.error("该差标已经存在,不可重复添加!"); return Result.error("该差标已经存在,不可重复添加!");
} }
travelStandards = travelStandardsRepository.save(travelStandards); travelStandards = travelStandardsRepository.save(travelStandards);

View File

@ -1,6 +1,7 @@
package com.chint.application.queryies.estimate; package com.chint.application.queryies.estimate;
import com.chint.domain.aggregates.standards.CityTag; import com.chint.domain.aggregates.standards.CityTag;
import com.chint.domain.aggregates.standards.TrainStandards;
import com.chint.domain.aggregates.standards.TravelStandards; import com.chint.domain.aggregates.standards.TravelStandards;
import com.chint.domain.aggregates.user.User; import com.chint.domain.aggregates.user.User;
import com.chint.domain.repository.CityRepository; import com.chint.domain.repository.CityRepository;
@ -21,13 +22,18 @@ import com.chint.interfaces.rest.ctrip.dto.estimate.response.TrainValuationResul
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.math.BigDecimal;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.time.temporal.ChronoUnit; import java.time.temporal.ChronoUnit;
import java.util.Comparator;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Optional; import java.util.Optional;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import static com.chint.domain.aggregates.standards.TrainStandards.trainStandardsMap;
import static com.chint.infrastructure.constant.LegConstant.LEG_TYPE_HOTEL; import static com.chint.infrastructure.constant.LegConstant.LEG_TYPE_HOTEL;
@Component @Component
@ -69,6 +75,23 @@ public class CTripEstimatePrice implements EstimatePrice {
String.valueOf(seatMaxPriceInfo.getMaxPrice()), String.valueOf(seatMaxPriceInfo.getMaxPrice()),
seatCode); seatCode);
}); });
//根据差标等级获取可报销最大酒店金额
//1.获取该用户的差标等级
User user = BaseContext.getCurrentUser();//用户
String standardLevel = user.getStandardLevel();//差旅等级
String trainStandards = trainStandardsMap.get(standardLevel);//获取可报销座位
Optional<String> optional = trainPriceData.getSeatInfoList().stream()
.filter(seatInfo -> {
Pattern pattern = Pattern.compile("\\b" + seatInfo.getSeatName() + "\\b");
return pattern.matcher(trainStandards).find();//过滤符合对应座位的火车数据
})
.map(TrainPriceData.SeatInfo::getSeatPrice)
.max(Comparator.comparing(BigDecimal::new));//获取最大值
if (optional.isPresent()) {
String maxPrice = optional.get();
trainPriceData.setMaxPrice(maxPrice);
}
return trainPriceData; return trainPriceData;
} }

View File

@ -9,8 +9,8 @@ public class CityTag {
static { static {
cityMap = new HashMap<>(); cityMap = new HashMap<>();
//直辖市 //直辖市
cityMap.put("北京", "1"); cityMap.put("北京", "3");
cityMap.put("上海", "1"); cityMap.put("上海", "3");
cityMap.put("天津", "1"); cityMap.put("天津", "1");
cityMap.put("重庆", "1"); cityMap.put("重庆", "1");
//省会城市 //省会城市
@ -29,7 +29,7 @@ public class CityTag {
cityMap.put("郑州", "1"); cityMap.put("郑州", "1");
cityMap.put("武汉", "1"); cityMap.put("武汉", "1");
cityMap.put("长沙", "1"); cityMap.put("长沙", "1");
cityMap.put("广州", "1"); cityMap.put("广州", "3");
cityMap.put("南宁", "1"); cityMap.put("南宁", "1");
cityMap.put("海口", "1"); cityMap.put("海口", "1");
cityMap.put("成都", "1"); cityMap.put("成都", "1");
@ -40,10 +40,12 @@ public class CityTag {
cityMap.put("兰州", "1"); cityMap.put("兰州", "1");
cityMap.put("西宁", "1"); cityMap.put("西宁", "1");
cityMap.put("银川", "1"); cityMap.put("银川", "1");
cityMap.put("乌鲁木齐", "1"); cityMap.put("乌鲁木齐", "1");
//特别行政区 //特别行政区
cityMap.put("香港", "1"); cityMap.put("香港", "1");
cityMap.put("澳门", "1"); cityMap.put("澳门", "1");
cityMap.put("深圳", "3");
} }
} }

View File

@ -0,0 +1,24 @@
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);
}
}

View File

@ -24,6 +24,6 @@ public class TravelStandards {
//差标等级 //差标等级
private String standardLevel; private String standardLevel;
//城市类别 //城市类别
private String cityTag;//1直辖市省会特别行政区2其它城市 private String cityTag;//1直辖市省会特别行政区2其它城市,3:北上广深
} }

View File

@ -30,11 +30,60 @@ public class LYOrderExtensionFactoryImpl implements OrderExtensionFactory {
public TrainOrderDetail createTrainOrderDetail(Object trainOrderDetailData) { public TrainOrderDetail createTrainOrderDetail(Object trainOrderDetailData) {
TrainDetailResponse trainDetailResponse = (TrainDetailResponse) trainOrderDetailData; TrainDetailResponse trainDetailResponse = (TrainDetailResponse) trainOrderDetailData;
TrainDetailResponse.TrainDetailData data = trainDetailResponse.getData(); TrainDetailResponse.TrainDetailData data = trainDetailResponse.getData();
TrainDetailResponse.TravelData travelData = data.getTravelData();
TrainOrderDetail trainOrderDetail = new TrainOrderDetail(); TrainOrderDetail trainOrderDetail = new TrainOrderDetail();
//映射值 //映射值
trainOrderDetail.setOrderNo(data.getOrderNo()) /*trainOrderDetail.setOrderNo(data.getOrderNo())
.setOverStandard(String.valueOf(data.getRuleViolate())) .setOverStandard(null)
; .setParentOrderNo()
.setOriginalOrderNo(null)
.setOrderStatus(null)
.setAccountCompanyId()
.setAccountCompanyName()
.setReceiptsNum(travelData.getTravelApplyNo())
.setScheduleNum()
.setBookingUserCode(data.getOutEmployeeId())
.setBookingName()
.setBookingUserPhone()
.setCreateTime()
.setStartTime()
.setArriveTime()
.setFromStationName()
.setToStationName()
.setTrainNo()
.setFromCity()
.setToCity()
.setRunTime()
.setOrderAmount()
.setPreServiceFee()
.setPostServiceFee()
.setRefundAmount()
.setChangeDifference()
.setChangeCost()
.setTickets()
.setSeatType()
.setSeatName()
.setTicketPrice()
.setRefundCost()
.setRefundPrice()
.setStandardItems()
.setUserName()
.setUserCode()
.setOverStandard()
.setPhone()
// .setXXX()
// .setXXX()
// .setXXX()
// .setXXX()
// .setXXX()
.setBOOK_ORG_STRUCT_1()
.setBOOK_ORG_STRUCT_2()
.setBOOK_ORG_STRUCT_3()
.setPaymentType()
// .setXXX()
// .setXXX()
// .setXXX()
;*/
return trainOrderDetail; return trainOrderDetail;
} }

View File

@ -23,7 +23,7 @@ public class TrainPriceData {
} }
@Data @Data
private static class SeatInfo { public static class SeatInfo {
private String seatName; private String seatName;
private String seatPrice; private String seatPrice;
private String seatCode; private String seatCode;

View File

@ -53,7 +53,6 @@ public class TrainDetailResponse {
private int bookType; private int bookType;
private int trainIndex; private int trainIndex;
private String relationOrderNo; private String relationOrderNo;
private Boolean ruleViolate;
// Constructors, Getters, and Setters // Constructors, Getters, and Setters
} }
@Data @Data