已合并 PR 10076: 修复县级市行政区英文问题

This commit is contained in:
卢麟哲 2024-03-19 09:22:08 +08:00
commit c6b82eee11
11 changed files with 202 additions and 57 deletions

View File

@ -16,6 +16,13 @@ import com.chint.infrastructure.echo_framework.annotation.TransitionTo;
import com.chint.infrastructure.util.Digest;
import com.chint.infrastructure.util.PageResult;
import com.chint.infrastructure.util.Result;
import com.chint.interfaces.rest.ctrip.CTripOrderSearchRequest;
import com.chint.interfaces.rest.ctrip.dto.search.SearchOrderResponse;
import com.chint.interfaces.rest.ly.LYSearchRequest;
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 io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
@ -30,7 +37,6 @@ import java.util.List;
import java.util.Optional;
import static com.chint.infrastructure.constant.CommonMessageConstant.SUCCESS;
import static com.chint.infrastructure.constant.OrderConstant.ORDER_EVENT_CHANGE;
@RestController
@RequestMapping("/OrderDetail")
@ -51,6 +57,12 @@ public class OrderDetailController {
@Autowired
private OrderDetailQuery orderDetailPageQuery;
@Autowired
private CTripOrderSearchRequest cTripOrderSearchRequest;
@Autowired
private LYSearchRequest lySearchRequest;
@ApiOperation("订单明细认证接口")
@PostMapping("/public/authentication")
@ -95,6 +107,41 @@ public class OrderDetailController {
return Result.Success(SUCCESS, orderDetailResPageResult);
}
@ApiOperation("查询携程订单")
@PostMapping("/public/query/cTrip")
public Result<Object> queryOrderDetail(@RequestBody String orderNo) {
SearchOrderResponse response = cTripOrderSearchRequest.searchOrderResponseByOrderId(orderNo);
return Result.Success(SUCCESS, response);
}
@ApiOperation("查询同程订单火车")
@PostMapping("/public/query/ly/train")
public Result<Object> queryOrderDetailTrain(@RequestBody String orderNo) {
TrainDetailResponse trainOrderDetail = lySearchRequest.getTrainOrderDetail(orderNo);
return Result.Success(SUCCESS, trainOrderDetail);
}
@ApiOperation("查询同程订单酒店")
@PostMapping("/public/query/ly/hotel")
public Result<Object> queryOrderDetailHotel(@RequestBody String orderNo) {
HotelDetailResponse response = lySearchRequest.getHotelOrderDetail(orderNo);
return Result.Success(SUCCESS, response);
}
@ApiOperation("查询同程订单用车")
@PostMapping("/public/query/ly/car")
public Result<Object> queryOrderDetailCar(@RequestBody String orderNo) {
CarDetailResponse carDetailResponse = lySearchRequest.getCarDetailResponse(orderNo);
return Result.Success(SUCCESS, carDetailResponse);
}
@ApiOperation("查询同程订单飞机")
@PostMapping("/public/query/ly/flight")
public Result<Object> queryOrderDetailFlight(@RequestBody String orderNo) {
FlightOrderResponse flightOrderDetail = lySearchRequest.getFlightOrderDetail(orderNo);
return Result.Success(SUCCESS, flightOrderDetail);
}
@TransitionTo(command = "RefundOrderGenerateCommand", order = 0)
public void generateCTripRefund(RefundOrderGenerateCommand command) {
@ -108,7 +155,7 @@ public class OrderDetailController {
}
RouteOrder routeOrder = routeRepository.queryById(orderDetail.getRouteId());
if(routeOrder.getOrderDetails().stream().map(OrderDetail::getOrderNo).toList().contains(newOrderNo)){
if (routeOrder.getOrderDetails().stream().map(OrderDetail::getOrderNo).toList().contains(newOrderNo)) {
return;
}
Integer productType = orderDetail.getProductType();

View File

@ -375,27 +375,30 @@ public class OrderQuery {
List<Location> locationListAfterNotNull = locationList.stream().filter(Objects::nonNull).toList();
List<CityEntity> cityEntities = new ArrayList<>();
// List<CityEntity> cityEntities = new ArrayList<>();
for (Location location : locationListAfterNotNull) {
// if (location.getLocationEnName() == null) {
// //这里的代码来补充地理位置的英文名
// Integer level = location.getLevel();
// if (level.equals(LOCATION_TYPE_CITY)) {
// PrefectureLevelCityInfoEntity cityInfo = prefectureLevelRepository.findByCityId(location.getCityId());
// location.setLocationEnName(cityInfo.getCityEnName());
// } else if (level.equals(LOCATION_TYPE_COUNTY) && location.getLocationShortName().contains("D")) {
// DistrictPOIInfoEntity byCityId = districtInfoRepository.findByCityId(location.getCityId());
// location.setLocationEnName(byCityId.getDistrictEnName());
// } else if (level.equals(LOCATION_TYPE_COUNTY)) {
// CountryLevelInfoEntity byCityId = countryLevelInfoRepository.findByCityId(location.getCityId());
// location.setLocationEnName(byCityId.getCountyEnName());
// } else {
// location.setLocationEnName("unknown");
// }
// }
CityEntity city = cityRepository.findByCityName(location.getLocationName());
cityEntities.add(city);
if (location.getLocationEnName() == null) {
//这里的代码来补充地理位置的英文名
Integer level = location.getLevel();
if (level.equals(LOCATION_TYPE_CITY)) {
PrefectureLevelCityInfoEntity cityInfo = prefectureLevelRepository.findByCityId(location.getCityId());
location.setLocationEnName(cityInfo.getCityEnName());
} else if (level.equals(LOCATION_TYPE_COUNTY) && location.getLocationShortName().contains("D")) {
DistrictPOIInfoEntity byCityId = districtInfoRepository.findByCityId(location.getCityId());
location.setLocationEnName(byCityId.getDistrictEnName());
} else if (level.equals(LOCATION_TYPE_COUNTY)) {
CountryLevelInfoEntity byCityId = countryLevelInfoRepository.findByCityId(location.getCityId());
location.setLocationEnName(byCityId.getCountyEnName());
} else {
location.setLocationEnName("unknown");
}
locationRepository.saveAll(List.of(location));
}
// CityEntity city = cityRepository.findByCityName(location.getLocationName());
// cityEntities.add(city);
callbackDataBuilder.cityList()
.cityName(location.getLocationName())
.cityEnName(location.getLocationEnName())
@ -405,32 +408,30 @@ public class OrderQuery {
List<ScheduleDetail> scheduleDetails = legItems.stream()
.map(leg -> {
leg.reloadStatus();
CityEntity originCity;
CityEntity destinationCity;
// CityEntity originCity;
// CityEntity destinationCity;
ScheduleDetail.ScheduleDetailBuilder scheduleDetailBuilder = ScheduleDetail
.builder()
.legId(leg.getLegId());
if (!leg.getLegType().equals(LEG_TYPE_OTHER)) {
if (leg.getOriginLocation() != null) {
originCity = cityEntities.stream().filter(cityEntity -> cityEntity
.getCityName()
.equals(leg.getOriginLocation().getLocationName()))
.findFirst().orElseThrow(() -> new NotFoundException(NOT_FOUND));
Location originLocation = leg.getOriginLocation();
if (originLocation != null) {
// originCity = cityEntities.stream().filter(cityEntity -> cityEntity
// .getCityName()
// .equals(leg.getOriginLocation().getLocationName()))
// .findFirst().orElseThrow(() -> new NotFoundException(NOT_FOUND));
scheduleDetailBuilder
.startCity(originCity.getCityName())
.startCityName(originCity.getCityName())
.startCityEnName(originCity.getCityename());
.startCity(originLocation.getLocationName())
.startCityName(originLocation.getLocationName())
.startCityEnName(originLocation.getLocationEnName());
}
if (leg.getDestinationLocation() != null) {
destinationCity = cityEntities.stream().filter(cityEntity -> cityEntity
.getCityName()
.equals(leg.getDestinationLocation().getLocationName()))
.findFirst().orElseThrow(() -> new NotFoundException(NOT_FOUND));
Location destinationLocation = leg.getDestinationLocation();
if (destinationLocation != null) {
scheduleDetailBuilder
.endCityName(destinationCity.getCityName())
.endCity(destinationCity.getCityName())
.endCityEnName(destinationCity.getCityename());
.endCityName(destinationLocation.getLocationName())
.endCity(destinationLocation.getLocationName())
.endCityEnName(destinationLocation.getLocationEnName());
}
}
@ -447,7 +448,6 @@ public class OrderQuery {
.currencyNameUS(leg.getCurrencyType().getAbbreviation());
}
LegExtensionField legExtensionField = leg.getLegExtensionField();
if (legExtensionField != null) {
List<Location> locationList1 = legExtensionField.getLocationList();

View File

@ -13,11 +13,10 @@ import com.chint.domain.value_object.UserLoginParam;
import com.chint.infrastructure.util.BaseContext;
import com.chint.infrastructure.util.OrderNo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.List;
@Component
@ -26,6 +25,8 @@ public class RouteOrderFactory implements OrderFactory {
@Autowired
private RouteLegFactory routeLegFactory;
@Value("${chint.envMark}")
private String envMark;
@Override
@ -54,8 +55,13 @@ public class RouteOrderFactory implements OrderFactory {
String syscode = loginParam.getSyscode();
String billcode = loginParam.getBillcode();
RouteOrder routeOrder = new RouteOrder();
routeOrder.setRouteOrderNo(OrderNo.generate(syscode, billcode));
//用于区分测试环境和正式环境的出差申请单
String generate = OrderNo.generate(syscode, billcode);
if (envMark.equals("prod")) {
generate = generate + envMark;
}
routeOrder.setRouteOrderNo(generate);
//根据项目需求需要保存假审批订单号真审批订单号 创建的时候保存假审批订单号

View File

@ -0,0 +1,36 @@
package com.chint.domain.factoriy.order_detail;
import lombok.Data;
@Data
public class BaseOrderExtension {
// 数据来源商旅平台
private String trvaleSysType;
// 对应所属系统
private String belongSysType;
// 订单号
private String orderNo;
// 消费明细唯一标识
private String detailId;
// 核算企业id
private String accountCompanyId;
// 核算企业名称
private String accountCompanyName;
// 申请单号
private String receiptsNum;
// 行程编号
private String scheduleNum;
// 预订人Code
private String bookingUserCode;
// 预订人姓名
private String bookingName;
// 预订人电话
private String bookingUserPhone;
// 资源供应商
private String supplier;
// 差标
private String standardItems;
// 超标原因
private String overStandardReason;
}

View File

@ -123,11 +123,14 @@ public class CTripOrderExtensionFactoryImpl implements OrderExtensionFactory {
carOrderDetail.setPaymentType("0");
} else {
carOrderDetail.setPaymentType("1");
}
if (!carQuickOrderInfoEntity.getOrderFeeList().isEmpty()) {
OrderFee orderFee = carQuickOrderInfoEntity.getOrderFeeList().get(0);
if (orderFee.getFeeName().equals("取消费")) {
carOrderDetail.setCancellationFee(orderFee.getAmount().toString());
} else {
}
}
OrderProduct orderProduct = carQuickOrderInfoEntity.getOrderProduct();
@ -142,7 +145,6 @@ public class CTripOrderExtensionFactoryImpl implements OrderExtensionFactory {
carOrderDetail.setToStationName(arrAddress.getAddressDetail());
carOrderDetail.setFromCity(depAddress.getCityName());
carOrderDetail.setToCity(arrAddress.getCityName());
// Driver driver = orderProduct.getDriver();
Vehicle vehicle = orderProduct.getVehicle();
carOrderDetail.setCarModel(vehicle.getVehicleName());
}
@ -301,6 +303,8 @@ public class CTripOrderExtensionFactoryImpl implements OrderExtensionFactory {
}
if (flightInfo != null) {
flightOrderDetail.setStartTime(flightInfo.getTakeoffTime());
flightOrderDetail.setArriveTime(flightInfo.getArrivalTime());
flightOrderDetail.setStartCityName(flightInfo.getDCityName());
@ -337,6 +341,7 @@ public class CTripOrderExtensionFactoryImpl implements OrderExtensionFactory {
}
if (tripRecordInfo != null) {
flightOrderDetail.setUserName(tripRecordInfo.getPassengerName());
flightOrderDetail.setStartTerminal(tripRecordInfo.getDPortBuilding());
flightOrderDetail.setEndTerminal(tripRecordInfo.getAPortBuilding());
flightOrderDetail.setTicketNo(tripRecordInfo.getTicketNo());
@ -345,7 +350,7 @@ public class CTripOrderExtensionFactoryImpl implements OrderExtensionFactory {
if (changeInfo != null) {
flightOrderDetail.setChangeFee(String.valueOf(changeInfo.getDateChangeFee()));
// flightOrderDetail.setChangeFee(String.valueOf(changeInfo.getDateChangeFee()));
flightOrderDetail.setUpFee(String.valueOf(changeInfo.getPriceDifferential()));
}
ApproveOrderNo approveOrderNo = routeOrder.getApproveOrderNo();
@ -371,7 +376,6 @@ public class CTripOrderExtensionFactoryImpl implements OrderExtensionFactory {
if (flightRefundInfo.getRefundDetail() != null && !flightRefundInfo.getRefundDetail().isEmpty()) {
FlightRefundDetail refundDetail = flightRefundInfo.getRefundDetail().get(0);
flightOrderDetail.setRefundFee(String.valueOf(refundDetail.getRefundFee()));
flightOrderDetail.setRefundAmount(String.valueOf(flightRefundInfo.getPayCustomerAmount()));
}
}

View File

@ -99,7 +99,7 @@ public class LYOrderExtensionFactoryImpl implements OrderExtensionFactory {
if (!data.getFlightSegmentList().isEmpty()) {
flightSegment = data.getFlightSegmentList().get(0);
}
FlightOrderResponse.TravelData travelData = data.getTravelData();
FlightOrderResponse.Passenger passenger = null;
if (!data.getPassengerList().isEmpty()) {
passenger = data.getPassengerList().get(0);
@ -412,7 +412,7 @@ public class LYOrderExtensionFactoryImpl implements OrderExtensionFactory {
TrainOrderDetail trainOrderDetail;
if (byOrderNo.isPresent()) {
if (byOrderNo.get().getHotelOrderDetail() == null) {
if (byOrderNo.get().getTrainOrderDetail() == null) {
trainOrderDetail = new TrainOrderDetail();
} else {
return byOrderNo.get().getTrainOrderDetail();
@ -508,7 +508,6 @@ public class LYOrderExtensionFactoryImpl implements OrderExtensionFactory {
trainOrderDetail.setCostCenter(approveOrderNo.getCostCenter());
trainOrderDetail.setProjectOrderNo(approveOrderNo.getProjectName());
}
}
if (item != null) {
@ -516,7 +515,6 @@ public class LYOrderExtensionFactoryImpl implements OrderExtensionFactory {
trainOrderDetail.setPostServiceFee(String.valueOf(item.getAfterServiceCharge()));
trainOrderDetail.setRefundAmount(String.valueOf(item.getRefundAmountCor()));
if (item.getSeatClass().equals("secondseat")) {
trainOrderDetail.setSeatType("二等座");
}
@ -549,7 +547,6 @@ public class LYOrderExtensionFactoryImpl implements OrderExtensionFactory {
if (changeItem != null) {
trainOrderDetail.setChangeDifference(String.valueOf(changeItem.getChangePrice()));
trainOrderDetail.setChangeDifference(String.valueOf(changeItem.getChangePrice()));
}
// trainOrderDetail.setSupplier(SUPPLIER_L_Y_EXTENSION_NAME);
@ -684,13 +681,11 @@ public class LYOrderExtensionFactoryImpl implements OrderExtensionFactory {
String mileage = orderExtendInfo.getMileage();
String mileageNumbers = mileage.replaceAll("\\D+", "");
carOrderDetail.setMileage(mileageNumbers);
carOrderDetail.setCarModel(orderExtendInfo.getCarTypeName());
carOrderDetail.setCarModel(String.valueOf(orderExtendInfo.getCarTypeName()));
}
// if (orderDriverInfo != null) {
// carOrderDetail.setCarModel(String.valueOf(orderDriverInfo.getCarType()));
// }
List<CarDetailResponse.SubmitItem> submitItemList =
data.getTravelDataInfo().getSubmitItemList();
@ -754,4 +749,7 @@ public class LYOrderExtensionFactoryImpl implements OrderExtensionFactory {
return list;
}
}

View File

@ -8,4 +8,5 @@ public interface OrderDetailFactory {
OrderEvent createEvent(Integer eventType, String outStatus);
BaseOrderExtension buildWithRouteOrder(RouteOrder routeOrder);
}

View File

@ -1,15 +1,24 @@
package com.chint.domain.factoriy.order_detail;
import com.chint.domain.aggregates.order.*;
import com.chint.domain.aggregates.user.User;
import com.chint.domain.repository.UserRepository;
import com.chint.domain.value_object.*;
import com.chint.domain.value_object.enums.CurrencyType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import static com.chint.infrastructure.constant.BelongSystemConstant.*;
import static com.chint.infrastructure.constant.SupplierNameConstant.SUPPLIER_C_TRIP;
@Component
public class OrderDetailFactoryImpl implements OrderDetailFactory {
@Autowired
private UserRepository userRepository;
@Override
public OrderDetail create(OrderLegData orderLegData) {
OrderDetail orderDetail = OrderDetail.of(orderLegData.getOutOrderNo(), orderLegData.getSupplierName());
@ -36,4 +45,47 @@ public class OrderDetailFactoryImpl implements OrderDetailFactory {
orderEvent.setHappenTime(LocalDateTime.now());
return orderEvent;
}
@Override
public BaseOrderExtension buildWithRouteOrder(RouteOrder routeOrder) {
BaseOrderExtension baseOrderExtension = new BaseOrderExtension();
//完成身份信息
String userId = routeOrder.getUserId();
User user = userRepository.findByUserEmployeeNo(userId);
baseOrderExtension.setBookingUserCode(user.getEmployeeNo());
baseOrderExtension.setBookingName(user.getName());
baseOrderExtension.setBookingUserPhone(user.getPhoneNumber());
//配置供应商信息
String supplierName = routeOrder.getSupplierName();
if(supplierName.equals(SUPPLIER_C_TRIP)){
baseOrderExtension.setTrvaleSysType(TRAVAL_SYS_TYPE_CTRIP);
} else {
baseOrderExtension.setTrvaleSysType(TRAVAL_SYS_TYPE_LY);
}
ApproveOrderNo approveOrderNo = routeOrder.getApproveOrderNo();
if(approveOrderNo != null){
}
// if (sysCode != null) {
// if (sysCode.equals(BELONG_SYS_CODE_FSSC)) {
// trainOrderDetail.setBelongSysType(BELONG_SYS_TYPE_FSSC);
// }
// if (sysCode.equals(BELONG_SYS_CODE_H3BPM)) {
// trainOrderDetail.setBelongSysType(BELONG_SYS_TYPE_H3BPM);
//
// }
// if (sysCode.equals(BELONG_SYS_CODE_XNFSSC)) {
// trainOrderDetail.setBelongSysType(BELONG_SYS_TYPE_XNFSSC);
// }
// if (sysCode.equals(BELONG_SYS_CODE_ANFSSC)) {
// trainOrderDetail.setBelongSysType(BELONG_SYS_TYPE_ANFSSC);
// }
// }
return baseOrderExtension;
}
}

View File

@ -17,7 +17,7 @@ chint:
port: 6379
password: Worktask@Redis2023
database: 5
envMark: dev
logging:

View File

@ -23,6 +23,7 @@ chint:
port: 6889
password: 33WJTKrlJ(5lf#x%Vg
database: 5
envMark: prod
logging:
level:

View File

@ -28,7 +28,7 @@ chint:
port: 6379
password: Worktask@Redis2023
database: 5
envMark: test
logging:
level: