已合并 PR 10187: 添加国内机场数据,添加姓名映射,订单明细细节调整

This commit is contained in:
卢麟哲 2024-03-24 21:45:08 +08:00
commit c6d7c52534
60 changed files with 1470 additions and 476 deletions

View File

@ -7,6 +7,8 @@ import org.springframework.data.annotation.Id;
import java.io.Serializable;
import static com.chint.infrastructure.constant.LocationConstant.LOCATION_TYPE_AIRPORT;
@Data
public class LocationRes implements Serializable {
@Id
@ -16,6 +18,9 @@ public class LocationRes implements Serializable {
private String country;
private String province;
private String city;
private String county;
private String district;
private String airport;
private Integer isInternal;
public static LocationRes copyFrom(Location location) {
@ -36,6 +41,13 @@ public class LocationRes implements Serializable {
locationRes.setProvince(parts[2]);
locationRes.setCity(parts[3]);
}
if (parts.length == 6) {
locationRes.setProvince(parts[2]);
locationRes.setCity(parts[3]);
}
if (location.getLocationType() == LOCATION_TYPE_AIRPORT) {
locationRes.setAirport(location.getLocationName());
}
return locationRes;
}

View File

@ -21,6 +21,8 @@ import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import static com.chint.infrastructure.constant.CommonMessageConstant.SUCCESS;
import static com.chint.infrastructure.constant.LegConstant.LEG_TYPE_AIRPLANE;
import static com.chint.infrastructure.constant.LocationConstant.LOCATION_TYPE_AIRPORT;
@RestController
@RequestMapping("/location")
@ -51,6 +53,14 @@ public class LocationController {
locations = locationDomainService.queryByFirstLetter(locationParam);
}
if (locationParam.getProductType() != LEG_TYPE_AIRPLANE) {
//过滤机场数据
locations = locations
.stream()
.filter(it -> !it.getLocationType().equals(LOCATION_TYPE_AIRPORT))
.toList();
}
if (locations != null && !locations.isEmpty()) {
locationRes = locations
.stream()

View File

@ -161,9 +161,6 @@ public class OrderDetailQuery {
return null;
}
HotelOrderDetailDto orderDetailDto = HotelOrderDetailDto.copyFrom(hotelOrderDetail);
RouteOrder routeOrder = routeRepository.queryById(orderDetail.getRouteId());
orderDetailDto.setApplicantId(routeOrder.getUserId());
@ -272,10 +269,6 @@ public class OrderDetailQuery {
details = details.filter(it -> it.getStartTime() != null).filter(it -> it.getStartTime().isAfter(LocalDateTime.now()));
}
// if(ifStart != null && ifStart.equals(1)){
// details = details.filter(it->it.getStartTime().isBefore(LocalDateTime.now()));
// }
List<OrderDetail> res = details.toList();
Integer total = res.size();
List<OrderDetailRes> OrderDetailResList = res.stream().sorted(Comparator.comparing(OrderDetail::getUpdateTime).reversed()).skip((long) (pageNum - 1) * pageSize).limit(pageSize).map(OrderDetailMapper::copyFromExtension).toList();

View File

@ -37,8 +37,8 @@ import java.util.stream.Stream;
import static com.chint.infrastructure.constant.FSSCConstant.*;
import static com.chint.infrastructure.constant.LegConstant.LEG_TYPE_HOTEL;
import static com.chint.infrastructure.constant.LegConstant.LEG_TYPE_OTHER;
import static com.chint.infrastructure.constant.LocationConstant.LOCATION_TYPE_CITY;
import static com.chint.infrastructure.constant.LocationConstant.LOCATION_TYPE_COUNTY;
import static com.chint.infrastructure.constant.LocationConstant.LOCATION_LEVEL_CITY;
import static com.chint.infrastructure.constant.LocationConstant.LOCATION_LEVEL_COUNTY;
import static com.chint.infrastructure.constant.OrderConstant.ORDER_EVENT_CANCEL_NAME;
import static com.chint.infrastructure.constant.OrderConstant.ORDER_EVENT_PREPARE_NAME;
import static com.chint.infrastructure.constant.RouteConstant.*;
@ -378,13 +378,13 @@ public class OrderQuery {
if (location.getLocationEnName() == null) {
//这里的代码来补充地理位置的英文名
Integer level = location.getLevel();
if (level.equals(LOCATION_TYPE_CITY)) {
if (level.equals(LOCATION_LEVEL_CITY)) {
PrefectureLevelCityInfoEntity cityInfo = prefectureLevelRepository.findByCityId(location.getCityId());
location.setLocationEnName(cityInfo.getCityEnName());
} else if (level.equals(LOCATION_TYPE_COUNTY) && location.getLocationShortName().contains("D")) {
} else if (level.equals(LOCATION_LEVEL_COUNTY) && location.getLocationShortName().contains("D")) {
DistrictPOIInfoEntity byCityId = districtInfoRepository.findByCityId(location.getCityId());
location.setLocationEnName(byCityId.getDistrictEnName());
} else if (level.equals(LOCATION_TYPE_COUNTY)) {
} else if (level.equals(LOCATION_LEVEL_COUNTY)) {
CountryLevelInfoEntity byCityId = countryLevelInfoRepository.findByCityId(location.getCityId());
location.setLocationEnName(byCityId.getCountyEnName());
} else {

View File

@ -5,7 +5,7 @@ import com.chint.domain.aggregates.location.basedata.PrefectureLevelCityInfoEnti
import com.chint.domain.aggregates.order.Location;
import com.chint.domain.aggregates.order.RouteOrder;
import com.chint.domain.aggregates.standards.CityTag;
import com.chint.domain.aggregates.standards.TrainStandardsService;
import com.chint.domain.service.TrainStandardsService;
import com.chint.domain.aggregates.user.User;
import com.chint.domain.exceptions.LocationException;
import com.chint.domain.repository.*;
@ -37,7 +37,7 @@ import java.util.regex.Pattern;
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.LocationConstant.LOCATION_TYPE_COUNTY;
import static com.chint.infrastructure.constant.LocationConstant.LOCATION_LEVEL_COUNTY;
import static com.chint.infrastructure.constant.RankConstant.STANDARD_LEVEL_ONE;
@Component
@ -235,7 +235,7 @@ public class CTripEstimatePrice implements EstimatePrice {
Long departCity = priceQueryData.getDepartCity();
Location location = locationRepository.findById(departCity);
if (location.getLevel().equals(LOCATION_TYPE_COUNTY)) {
if (location.getLevel().equals(LOCATION_LEVEL_COUNTY)) {
location = locationRepository.findByLocationId(location.getParentLocationId());
hotelPriceData.setSuccess(false);
hotelPriceData.setMaxPrice(NO_PRICE_ERROR);
@ -333,7 +333,7 @@ public class CTripEstimatePrice implements EstimatePrice {
private Location getCityId(Location location) {
if (location.getCityId() == null) {
if (location.getLevel().equals(LOCATION_TYPE_COUNTY)) {
if (location.getLevel().equals(LOCATION_LEVEL_COUNTY)) {
CountryLevelInfoEntity byCityName = countryLevelInfoRepository
.findByCityName(location.getLocationName())
.get(0);

View File

@ -40,8 +40,6 @@ public class ANFeiShuLoginStrategy implements LoginStrategy {
log.info("开始执行飞书登录");
String appAccessTokenPath = "/open-apis/auth/v3/app_access_token/internal";
String userAccessTokenPath = "/open-apis/authen/v1/access_token";
// 获取 appAccessToken
String appAccessTokenUrl = null;
try {

View File

@ -35,12 +35,6 @@ public class FeishuLoginStrategy implements LoginStrategy {
@Value("${feishu.appSecret}")
private String appSecret;
@Value("${feishu.ANAppId}")
private String ANAppId;
@Value("${feishu.ANAppSecret}")
private String ANAppSecret;
@Override
public Optional<String> getAccessToken(String code) {

View File

@ -5,7 +5,6 @@ import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.Id;
import org.springframework.data.annotation.Transient;
import org.springframework.data.relational.core.mapping.Column;
import org.springframework.data.relational.core.mapping.Table;
@ -15,7 +14,7 @@ import java.io.Serializable;
@Data
@AllArgsConstructor
@NoArgsConstructor
@Table("location_2")
@Table("location")
public class Location implements Serializable {
@Serial
private static final long serialVersionUID = -4974427694646166097L;
@ -33,4 +32,5 @@ public class Location implements Serializable {
private Integer level;
private Long cityId;
private Integer isHaveAirport;
private Integer locationType;
}

View File

@ -84,10 +84,10 @@ public class OrderEvent implements Serializable {
return switch (eventType) {
case ORDER_EVENT_PREPARE -> FSSC_FLIGHT_STATUS_SUCCESS;
case ORDER_EVENT_PAYED -> FSSC_FLIGHT_STATUS_SUCCESS;
case ORDER_EVENT_CHANGE -> FSSC_FLIGHT_STATUS_CHANGE;
case ORDER_EVENT_CHANGE -> FSSC_FLIGHT_STATUS_SUCCESS;
case ORDER_EVENT_CANCEL -> FSSC_ORDER_STATUS_CANCEL;
case ORDER_EVENT_ORDERED -> FSSC_FLIGHT_STATUS_SUCCESS;
case ORDER_EVENT_REFUND -> FSSC_FLIGHT_STATUS_REFUND;
case ORDER_EVENT_REFUND -> FSSC_FLIGHT_STATUS_SUCCESS;
case ORDER_EVENT_UNKNOWN -> FSSC_FLIGHT_STATUS_SUCCESS;
case ORDER_EVENT_FINISH -> FSSC_FLIGHT_STATUS_SUCCESS;
case ORDER_EVENT_ETA -> FSSC_FLIGHT_STATUS_SUCCESS;
@ -162,7 +162,7 @@ public class OrderEvent implements Serializable {
case ORDER_EVENT_PREPARE -> FSSC_CAR_STATUS_SUCCESS;
case ORDER_EVENT_PAYED -> FSSC_CAR_STATUS_SUCCESS;
case ORDER_EVENT_CHANGE -> FSSC_CAR_STATUS_SUCCESS;
case ORDER_EVENT_CANCEL -> FSSC_CAR_STATUS_SUCCESS;
case ORDER_EVENT_CANCEL -> FSSC_ORDER_STATUS_CANCEL;
case ORDER_EVENT_ORDERED -> FSSC_CAR_STATUS_SUCCESS;
case ORDER_EVENT_REFUND -> FSSC_CAR_STATUS_SUCCESS;
case ORDER_EVENT_UNKNOWN -> FSSC_ORDER_STATUS_CANCEL;

View File

@ -413,7 +413,7 @@ public class RouteOrder implements Serializable {
}
}
if(leg.getLegType().equals(LEG_TYPE_TAXI)){
if (leg.getLegType().equals(LEG_TYPE_TAXI)) {
return false;
}
@ -421,11 +421,14 @@ public class RouteOrder implements Serializable {
Location destinationLocation = leg.getDestinationLocation();
Long orderDetailOriginId = orderDetail.getOriginId();
Long orderDetailDestinationId = orderDetail.getDestinationId();
return leg.getLegType().equals(orderDetail.getProductType())
&& (originLocation.getLocationId().equals(orderDetailOriginId) ||
originLocation.getParentLocationId().equals(orderDetailOriginId))
&& (destinationLocation.getLocationId().equals(orderDetailDestinationId) ||
destinationLocation.getParentLocationId().equals(orderDetailDestinationId));
return leg.getLegType().equals(orderDetail.getProductType()) &&
(originLocation.getLocationId().equals(orderDetailOriginId) ||
originLocation.getParentLocationId().equals(orderDetailOriginId) ||
originLocation.getLocationPath().contains(String.valueOf(orderDetailOriginId)))
&&
(destinationLocation.getLocationId().equals(orderDetailDestinationId) ||
destinationLocation.getParentLocationId().equals(orderDetailDestinationId) ||
destinationLocation.getLocationPath().contains(String.valueOf(orderDetailDestinationId)));
})
.toList();

View File

@ -20,6 +20,7 @@ public class SystemCode implements Serializable {
private String systemCode;
private String bpmCode;
private String redirectPath;
private Integer ifImmediateResponse; //是否立马回复审批结果0不是1是
@MappedCollection(idColumn = "system_id", keyColumn = "system_key")
private List<CompanyInfo> companyInfos;
}

View File

@ -0,0 +1,22 @@
package com.chint.domain.aggregates.user;
import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.relational.core.mapping.Table;
import java.io.Serial;
import java.io.Serializable;
@Data
@Table("user_name")
public class UserName implements Serializable {
@Serial
private static final long serialVersionUID = 5602115854141241146L;
@Id
private Long id;
private String employeeNo;
private String sfName;
private String enName;
private String idName;
private String extension;
}

View File

@ -13,8 +13,6 @@ import com.chint.interfaces.rest.ctrip.dto.search.flight.*;
import com.chint.interfaces.rest.ctrip.dto.search.hotel.ClientInfo;
import com.chint.interfaces.rest.ctrip.dto.search.hotel.HotelOrderInfoEntity;
import com.chint.interfaces.rest.ctrip.dto.search.hotel.PaymentReceived;
import com.chint.interfaces.rest.ctrip.tools.CTripUtils;
import com.chint.interfaces.rest.ly.tools.LYOrderUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@ -50,66 +48,45 @@ public class CTripOrderExtensionFactoryImpl implements OrderExtensionFactory {
@Override
public CarOrderDetail createCarOrderDetail(Object carOrderDetailData) {
//获取基础信息数据
CarQuickOrderInfoEntity carQuickOrderInfoEntity = (CarQuickOrderInfoEntity) carOrderDetailData;
CarBasicInfo carBasicInfo = carQuickOrderInfoEntity.getBasicInfo();
String orderNo = carBasicInfo.getOrderId();
String journeyNo = carBasicInfo.getJourneyID();
RouteOrder routeOrder = routeRepository.findByOrderNo(journeyNo);
String sysCode = routeOrder.getApproveOrderNo().getSysCode();
Optional<OrderDetail> first = routeOrder.getOrderDetails()
OrderDetail orderDetail = routeOrder.getOrderDetails()
.stream()
.filter(orderDetail -> orderDetail.getOrderNo().equals(orderNo))
.findFirst();
.filter(it -> it.getOrderNo().equals(orderNo))
.findFirst()
.orElseThrow(() -> new NotFoundException(NOT_FOUND));
CarOrderDetail carOrderDetail;
if (first.isPresent()) {
if (first.get().getCarOrderDetail() == null) {
carOrderDetail = new CarOrderDetail();
} else {
carOrderDetail = first.get().getCarOrderDetail();
}
CarOrderDetail carOrderDetail = orderDetailFactory.buildCarWithRouteOrderAndOrderDetail(routeOrder, orderDetail);
//这里要更新用车的状态
OrderEvent lastEvent = orderDetail.getLastEvent();
if (lastEvent != null) {
carOrderDetail.setOrderStatus(lastEvent.mapToCarOrderDetailStatus());
} else {
carOrderDetail = new CarOrderDetail();
carOrderDetail.setOrderStatus(FSSC_CAR_STATUS_SUCCESS);
}
carOrderDetail.setTrvaleSysType(TRAVAL_SYS_TYPE_CTRIP);
if (sysCode != null) {
if (sysCode.equals(BELONG_SYS_CODE_FSSC)) {
carOrderDetail.setBelongSysType(BELONG_SYS_TYPE_FSSC);
}
if (sysCode.equals(BELONG_SYS_CODE_H3BPM)) {
carOrderDetail.setBelongSysType(BELONG_SYS_TYPE_H3BPM);
}
if (sysCode.equals(BELONG_SYS_CODE_XNFSSC)) {
carOrderDetail.setBelongSysType(BELONG_SYS_TYPE_XNFSSC);
}
if (sysCode.equals(BELONG_SYS_CODE_ANFSSC)) {
carOrderDetail.setBelongSysType(BELONG_SYS_TYPE_ANFSSC);
}
//这里根据用车费用是否有无的情况进行判断 如果有取消费 那么就为部分退订
List<OrderFee> orderFeeList = carQuickOrderInfoEntity.getOrderFeeList();
if (orderFeeList != null && !orderFeeList.isEmpty()) {
orderFeeList.forEach(it -> {
if (it.getFeeName().equals("取消费")) {
carOrderDetail.setOrderStatus(FSSC_CAR_STATUS_REFUND);
carOrderDetail.setCancellationFee(it.getAmount().toString());
}
});
}
carOrderDetail.setOrderNo(orderNo);
carOrderDetail.setDetailId(orderNo);
first.ifPresent(orderDetail -> {
OrderEvent lastEvent = orderDetail.getLastEvent();
if (lastEvent != null) {
carOrderDetail.setOrderStatus(lastEvent.mapToCarOrderDetailStatus());
} else {
carOrderDetail.setOrderStatus(FSSC_CAR_STATUS_SUCCESS);
}
});
String employeeNo = routeOrder.getUserId();
User user = userRepository.findByUserEmployeeNo(employeeNo);
if (user != null) {
carOrderDetail.setBookingUserCode(user.getEmployeeNo());
carOrderDetail.setBookingName(user.getName());
carOrderDetail.setBookingUserPhone(user.getPhoneNumber());
}
return updateCarOrderDetailData(carOrderDetail, carOrderDetailData);
}
@Override
public CarOrderDetail updateCarOrderDetailData(CarOrderDetail carOrderDetail, Object carOrderDetailData) {
CarQuickOrderInfoEntity carQuickOrderInfoEntity = (CarQuickOrderInfoEntity) carOrderDetailData;
CarPassengerInfo passengerInfo = carQuickOrderInfoEntity.getPassengerInfo();
if (passengerInfo != null) {
@ -120,7 +97,8 @@ public class CTripOrderExtensionFactoryImpl implements OrderExtensionFactory {
carOrderDetail.setBOOK_ORG_STRUCT_2(passengerInfo.getDept2());
carOrderDetail.setBOOK_ORG_STRUCT_3(passengerInfo.getDept3());
}
carOrderDetail.setReceiptsNum(routeOrder.getRouteOrderNo());
CarBasicInfo carBasicInfo = carQuickOrderInfoEntity.getBasicInfo();
carOrderDetail.setCreateTime(carBasicInfo.getCreateTime());
carOrderDetail.setOrderAmount(String.valueOf(carBasicInfo.getOrderAmount()));
carOrderDetail.setCompanyPaymentAmount(String.valueOf(carBasicInfo.getAccntAmount()));
@ -131,18 +109,17 @@ public class CTripOrderExtensionFactoryImpl implements OrderExtensionFactory {
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();
if (orderProduct != null) {
carOrderDetail.setStartTime(orderProduct.getServiceBeginTime());
carOrderDetail.setArriveTime(orderProduct.getServiceEndTime());
//这里判断用车成功的加入服务开始时间和结束时间失败的话使用订单的创建时间
if (carOrderDetail.getOrderStatus().equals(FSSC_CAR_STATUS_SUCCESS)) {
carOrderDetail.setStartTime(orderProduct.getServiceBeginTime());
carOrderDetail.setArriveTime(orderProduct.getServiceEndTime());
} else {
carOrderDetail.setStartTime(carOrderDetail.getCreateTime());
carOrderDetail.setArriveTime(carOrderDetail.getCreateTime());
}
carOrderDetail.setMileage(orderProduct.getNormalDistance());
carOrderDetail.setRunTime(orderProduct.getNormalTime());
Address depAddress = orderProduct.getDepartAddress();
@ -154,34 +131,6 @@ public class CTripOrderExtensionFactoryImpl implements OrderExtensionFactory {
Vehicle vehicle = orderProduct.getVehicle();
carOrderDetail.setCarModel(vehicle.getVehicleName());
}
ApproveOrderNo approveOrderNo = routeOrder.getApproveOrderNo();
if (approveOrderNo != null) {
carOrderDetail.setAccountCompanyId(approveOrderNo.getAccountCompanyCode());
carOrderDetail.setAccountCompanyName(approveOrderNo.getAccountCompanyName());
carOrderDetail.setReceiptsNum(routeOrder.getRouteOrderNo());
carOrderDetail.setCostCenter(approveOrderNo.getCostCenter());
carOrderDetail.setProjectOrderNo(approveOrderNo.getProjectName());
}
OrderDetail orderDetail = orderDetailRepository.findByOrderNo(carBasicInfo.getOrderId())
.orElseThrow(() -> new NotFoundException(NOT_FOUND));
Optional<Integer> firstOrderEvent = orderDetail.getOrderEventList()
.stream()
.map(OrderEvent::getEventType)
.filter(it -> it.equals(ORDER_EVENT_ETA))
.findFirst();
if (firstOrderEvent.isEmpty()) {
carOrderDetail.setOverStandard(""); //
} else {
carOrderDetail.setOverStandard(""); //
}
Optional<OrderEvent> first1 = orderDetail.getOrderEventList()
.stream()
.findFirst();
first1.ifPresent(orderEvent -> carOrderDetail.setOverStandardReason(orderEvent.getExtension()));
// derDetail.setTollFee(tollFee);//
return carOrderDetail;
}
@ -222,7 +171,7 @@ public class CTripOrderExtensionFactoryImpl implements OrderExtensionFactory {
flightOrderDetail.setOrderStatus(FSSC_FLIGHT_STATUS_SUCCESS);
}
//携程创建的飞机订单只有
if(!flightOrderDetail.getOrderStatus().equals(FSSC_ORDER_STATUS_CANCEL)){
if (!flightOrderDetail.getOrderStatus().equals(FSSC_ORDER_STATUS_CANCEL)) {
flightOrderDetail.setOrderStatus(FSSC_FLIGHT_STATUS_SUCCESS);
}
});
@ -268,6 +217,7 @@ public class CTripOrderExtensionFactoryImpl implements OrderExtensionFactory {
flightOrderDetail.setUpFee(KEEP_TWO_DECIMAL_ZERO);
//对飞机明细的航班明细进行录入
List<FlightInfo> flightInfoList = flightOrderInfoEntity.getFlightInfo();
if (flightInfoList != null && !flightInfoList.isEmpty()) {
FlightInfo flightInfo = flightInfoList.get(0);
flightOrderDetail.setStartTime(flightInfo.getTakeoffTime());
@ -298,7 +248,6 @@ public class CTripOrderExtensionFactoryImpl implements OrderExtensionFactory {
List<TripRecordInfo> tripRecordInfoList = flightOrderInfoEntity.getTripRecordInfoList();
if (tripRecordInfoList != null && !tripRecordInfoList.isEmpty()) {
TripRecordInfo tripRecordInfo = tripRecordInfoList.get(0);
flightOrderDetail.setUserName(tripRecordInfo.getPassengerName());
flightOrderDetail.setStartTerminal(tripRecordInfo.getDPortBuilding());
flightOrderDetail.setEndTerminal(tripRecordInfo.getAPortBuilding());
flightOrderDetail.setTicketNo(tripRecordInfo.getTicketNo());
@ -312,10 +261,18 @@ public class CTripOrderExtensionFactoryImpl implements OrderExtensionFactory {
List<SequenceInfo> sequenceInfoList = passengerInfo.getSequenceInfo();
if (sequenceInfoList != null && !sequenceInfoList.isEmpty()) {
SequenceInfo sequenceInfo = sequenceInfoList.get(0);
List<TicketInfo> ticketInfoList = sequenceInfo.getTicketInfo();
//获取票号信息
if (ticketInfoList != null && !ticketInfoList.isEmpty() &&
flightOrderDetail.getOrderStatus().equals(FSSC_FLIGHT_STATUS_SUCCESS)) {
TicketInfo ticketInfo = ticketInfoList.get(0);
flightOrderDetail.setTicketNo(ticketInfo.getTicketNo());
}
if (sequenceInfo.getChangeInfo() != null && !sequenceInfo.getChangeInfo().isEmpty() &&
flightOrderDetail.getOrderStatus().equals(FSSC_FLIGHT_STATUS_CHANGE)) {
String[] split = flightOrderDetail.getDetailId().split("-");
//要找出对应退票信息
//要找出对应改签信息
if (split.length > 1) {
ChangeInfo changeInfo = sequenceInfo
.getChangeInfo()
@ -330,6 +287,28 @@ public class CTripOrderExtensionFactoryImpl implements OrderExtensionFactory {
flightOrderDetail.setFuelTax(String.valueOf(changeInfo.getOilFee()));
flightOrderDetail.setAirportTax(String.valueOf(changeInfo.getTax()));
flightOrderDetail.setFacePrice(String.valueOf(changeInfo.getCPrintPrice()));
//这里对改签的航班信息进行重新录入
flightOrderDetail.setStartTime(changeInfo.getCTakeOffTime());
flightOrderDetail.setArriveTime(changeInfo.getCArrivalTime());
flightOrderDetail.setStartCityName(changeInfo.getCDCityName());
flightOrderDetail.setStartCityCode(changeInfo.getCDCityCode());
flightOrderDetail.setStartAirportName(changeInfo.getCAPortName());
flightOrderDetail.setStartAirportCode(changeInfo.getCAPortCode());
flightOrderDetail.setEndCityName(changeInfo.getCACityName());
flightOrderDetail.setEndCityCode(changeInfo.getCACityCode());
flightOrderDetail.setEndAirportName(changeInfo.getCAPortName());
flightOrderDetail.setEndAirportCode(changeInfo.getCAPortCode());
// flightOrderDetail.setDistance(String.valueOf(changeInfo.getCTpm()));
flightOrderDetail.setFlightCompName(changeInfo.getCAirlineName());
flightOrderDetail.setFlightNum(changeInfo.getCFlight());
// flightOrderDetail.setSeatPoint(changeInfo.getCFlightClass());
flightOrderDetail.setSeatPointName(changeInfo.getCClassName());
flightOrderDetail.setFlightModel(changeInfo.getCFlight());
//前后收服务费,燃油费机建费
// flightOrderDetail.setPreServiceFee(String.valueOf(changeInfo.getItineraryFee()));
flightOrderDetail.setStandard(changeInfo.getCClassName() + changeInfo.getPriceRate());
flightOrderDetail.setNotBookedLowestPriceReason(changeInfo.getRebookReasonDesc());
} else {
flightOrderDetail.setOrderStatus(FSSC_FLIGHT_STATUS_SUCCESS);
}

View File

@ -7,6 +7,7 @@ import com.chint.domain.exceptions.NotFoundException;
import com.chint.domain.repository.OrderDetailRepository;
import com.chint.domain.repository.RouteRepository;
import com.chint.domain.repository.UserRepository;
import com.chint.interfaces.rest.ly.dto.carorderdatapushback.PriceDetail;
import com.chint.interfaces.rest.ly.dto.hotelorderdatapushbach.Resident;
import com.chint.interfaces.rest.ly.dto.search.response.car.CarDetailResponse;
import com.chint.interfaces.rest.ly.dto.search.response.filght.FlightOrderResponse;
@ -27,6 +28,7 @@ import java.util.stream.Collectors;
import static com.chint.infrastructure.constant.BelongSystemConstant.*;
import static com.chint.infrastructure.constant.CommonMessageConstant.NOT_FOUND;
import static com.chint.infrastructure.constant.FSSCConstant.*;
import static com.chint.infrastructure.constant.LYConstant.L_Y_CAR_FEE_TYPE_CANCEL;
import static com.chint.infrastructure.constant.OrderConstant.ORDER_EVENT_CANCEL;
import static com.chint.infrastructure.constant.OrderConstant.ORDER_EVENT_ETA;
import static com.chint.infrastructure.constant.SupplierNameConstant.SUPPLIER_L_Y_CN_NAME;
@ -59,7 +61,200 @@ public class LYOrderExtensionFactoryImpl implements OrderExtensionFactory {
@Override
public CarOrderDetail createCarOrderDetail(Object carOrderDetailData) {
CarDetailResponse.DataWrapper data = (CarDetailResponse.DataWrapper) carOrderDetailData;
CarOrderDetail carOrderDetail = convertCarOrderDetail(data);
CarDetailResponse.CarOrderDetailInfo carOrderDetailInfo = data.getCarOrderDetailInfo();
String orderSerialNo = carOrderDetailInfo.getOrderSerialNo();
OrderDetail orderDetail = orderDetailRepository.findByOrderNo(orderSerialNo)
.orElseThrow(() -> new NotFoundException(NOT_FOUND));
RouteOrder routeOrder = routeRepository.queryById(orderDetail.getRouteId());
CarOrderDetail carOrderDetail = orderDetailFactory.buildCarWithRouteOrderAndOrderDetail(routeOrder, orderDetail);
//这里要更新用车的状态
OrderEvent lastEvent = orderDetail.getLastEvent();
if (lastEvent != null) {
carOrderDetail.setOrderStatus(lastEvent.mapToCarOrderDetailStatus());
} else {
carOrderDetail.setOrderStatus(FSSC_CAR_STATUS_SUCCESS);
}
List<PriceDetail> priceDetailList = data.getPriceDetailList();
if (priceDetailList != null && !priceDetailList.isEmpty()) {
priceDetailList.forEach(it -> {
if (it.getType().equals(L_Y_CAR_FEE_TYPE_CANCEL)) {
carOrderDetail.setOrderStatus(FSSC_CAR_STATUS_REFUND);
carOrderDetail.setCancellationFee(it.getDisplayValue());
}
});
}
return updateCarOrderDetailData(carOrderDetail,data);
}
@Override
public CarOrderDetail updateCarOrderDetailData(CarOrderDetail carOrderDetail, Object carOrderDetailData) {
CarDetailResponse.DataWrapper data = (CarDetailResponse.DataWrapper) carOrderDetailData;
CarDetailResponse.CarOrderDetailInfo carOrderDetailInfo = data.getCarOrderDetailInfo();
CarDetailResponse.OrderExtendInfo orderExtendInfo = data.getOrderExtendInfo();
carOrderDetail.setCreateTime(carOrderDetailInfo.getCreateTime());
carOrderDetail.setOrderAmount(String.valueOf(carOrderDetailInfo.getTotalPrice()));
carOrderDetail.setUserName(carOrderDetailInfo.getContactName());
carOrderDetail.setUserCode(carOrderDetailInfo.getOutEmployeeId());
carOrderDetail.setPhone(carOrderDetailInfo.getContactPhone());
carOrderDetail.setPersonalPaymentAmount(String.valueOf(carOrderDetailInfo.getPersonalPrice()));
carOrderDetail.setCompanyPaymentAmount(String.valueOf(carOrderDetailInfo.getCompanyPrice()));
if (carOrderDetailInfo.getPayType() == 1) {
carOrderDetail.setPaymentType("0"); //
} else {
carOrderDetail.setPaymentType("1"); //
}
if (orderExtendInfo != null) {
carOrderDetail.setStartTime(orderExtendInfo.getChargeTime());
carOrderDetail.setArriveTime(orderExtendInfo.getFinishTime());
carOrderDetail.setFromStationName(orderExtendInfo.getStartAddress());
carOrderDetail.setToStationName(orderExtendInfo.getEndAddress());
carOrderDetail.setFromCity(orderExtendInfo.getStartCityName());
carOrderDetail.setToCity(orderExtendInfo.getEndCityName());
String duration = orderExtendInfo.getDuration();
String durationNumbers = duration.replaceAll("[^\\u0000-\\u007F\\p{P}]", "");
carOrderDetail.setRunTime(durationNumbers);
String mileage = orderExtendInfo.getMileage();
String mileageNumbers = mileage.replaceAll("[^\\u0000-\\u007F\\p{P}]", "");
carOrderDetail.setMileage(mileageNumbers);
carOrderDetail.setCarModel(String.valueOf(orderExtendInfo.getCarTypeName()));
}
return carOrderDetail;
}
private CarOrderDetail convertCarOrderDetail(CarDetailResponse.DataWrapper data) {
CarDetailResponse.CarOrderDetailInfo carOrderDetailInfo = data.getCarOrderDetailInfo();
CarDetailResponse.OrderExtendInfo orderExtendInfo = data.getOrderExtendInfo();
CarDetailResponse.OrderDriverInfo orderDriverInfo = data.getOrderDriverInfo();
CarOrderDetail carOrderDetail = new CarOrderDetail();
RouteOrder routeOrder = null;
if (carOrderDetailInfo != null) {
OrderDetail orderDetail = orderDetailRepository.findByOrderNo(carOrderDetailInfo.getOrderSerialNo())
.orElseThrow(() -> new NotFoundException(NOT_FOUND));
routeOrder = routeRepository.queryById(orderDetail.getRouteId());
String sysCode = routeOrder.getApproveOrderNo().getSysCode();
carOrderDetail.setTrvaleSysType(TRAVAL_SYS_TYPE_LY);
if (sysCode != null) {
if (sysCode.equals(BELONG_SYS_CODE_FSSC)) {
carOrderDetail.setBelongSysType(BELONG_SYS_TYPE_FSSC);
}
if (sysCode.equals(BELONG_SYS_CODE_H3BPM)) {
carOrderDetail.setBelongSysType(BELONG_SYS_TYPE_H3BPM);
}
if (sysCode.equals(BELONG_SYS_CODE_XNFSSC)) {
carOrderDetail.setBelongSysType(BELONG_SYS_TYPE_XNFSSC);
}
if (sysCode.equals(BELONG_SYS_CODE_ANFSSC)) {
carOrderDetail.setBelongSysType(BELONG_SYS_TYPE_ANFSSC);
}
}
carOrderDetail.setOrderNo(carOrderDetailInfo.getOrderSerialNo());
carOrderDetail.setDetailId(carOrderDetailInfo.getOrderSerialNo());
Optional<OrderDetail> firstOrderDetail = routeOrder
.getOrderDetails()
.stream()
.filter(it -> it.getOrderNo().equals(carOrderDetail.getOrderNo()))
.findFirst();
firstOrderDetail.ifPresent(it -> {
OrderEvent lastEvent = it.getLastEvent();
if (lastEvent != null) {
carOrderDetail.setOrderStatus(lastEvent.mapToCarOrderDetailStatus());
} else {
//如果订单事件为空那么就需要重新根据查询到的订单信息重新进行映射
Integer orderStatus = carOrderDetailInfo.getOrderStatus();
carOrderDetail.setOrderStatus(
OrderEvent.mapToCarOrderDetailStatus(
LYOrderUtil.mapCarStatus(orderStatus)
)
);
}
}
);
String EmployeeNo = routeOrder.getUserId();
User user = userRepository.findByUserEmployeeNo(EmployeeNo);
if (user != null) {
carOrderDetail.setBookingUserCode(user.getEmployeeNo());
carOrderDetail.setBookingName(user.getName());
carOrderDetail.setBookingUserPhone(user.getPhoneNumber());
}
carOrderDetail.setCreateTime(carOrderDetailInfo.getCreateTime());
carOrderDetail.setOrderAmount(String.valueOf(carOrderDetailInfo.getTotalPrice()));
carOrderDetail.setUserName(carOrderDetailInfo.getContactName());
carOrderDetail.setUserCode(carOrderDetailInfo.getOutEmployeeId());
carOrderDetail.setPhone(carOrderDetailInfo.getContactPhone());
carOrderDetail.setPersonalPaymentAmount(String.valueOf(carOrderDetailInfo.getPersonalPrice()));
carOrderDetail.setCompanyPaymentAmount(String.valueOf(carOrderDetailInfo.getCompanyPrice()));
if (Double.valueOf(carOrderDetail.getCompanyPaymentAmount()) > 0) {
carOrderDetail.setPaymentType("0"); //
} else {
carOrderDetail.setPaymentType("1"); //
}
}
carOrderDetail.setReceiptsNum(routeOrder.getRouteOrderNo());
if (orderExtendInfo != null) {
carOrderDetail.setStartTime(orderExtendInfo.getChargeTime());
carOrderDetail.setArriveTime(orderExtendInfo.getFinishTime());
carOrderDetail.setFromStationName(orderExtendInfo.getStartAddress());
carOrderDetail.setToStationName(orderExtendInfo.getEndAddress());
carOrderDetail.setFromCity(orderExtendInfo.getStartCityName());
carOrderDetail.setToCity(orderExtendInfo.getEndCityName());
String duration = orderExtendInfo.getDuration();
String durationNumbers = duration.replaceAll("[^\\u0000-\\u007F\\p{P}]", "");
carOrderDetail.setRunTime(durationNumbers);
String mileage = orderExtendInfo.getMileage();
String mileageNumbers = mileage.replaceAll("[^\\u0000-\\u007F\\p{P}]", "");
carOrderDetail.setMileage(mileageNumbers);
carOrderDetail.setCarModel(String.valueOf(orderExtendInfo.getCarTypeName()));
}
List<CarDetailResponse.SubmitItem> submitItemList =
data.getTravelDataInfo().getSubmitItemList();
ApproveOrderNo approveOrderNo = routeOrder.getApproveOrderNo();
if (approveOrderNo != null) {
carOrderDetail.setAccountCompanyId(approveOrderNo.getAccountCompanyCode());
carOrderDetail.setAccountCompanyName(approveOrderNo.getAccountCompanyName());
carOrderDetail.setCostCenter(approveOrderNo.getCostCenter());
carOrderDetail.setProjectOrderNo(approveOrderNo.getProjectName());
}
OrderDetail orderDetail = orderDetailRepository.findByOrderNo(carOrderDetailInfo.getOrderSerialNo())
.orElseThrow(() -> new NotFoundException(NOT_FOUND));
Optional<Integer> firstOrderEvent = orderDetail.getOrderEventList()
.stream()
.map(OrderEvent::getEventType)
.filter(it -> it.equals(ORDER_EVENT_ETA))
.findFirst();
if (firstOrderEvent.isEmpty()) {
carOrderDetail.setOverStandard(""); //
} else {
carOrderDetail.setOverStandard(""); //
}
Optional<OrderEvent> first2 = orderDetail.getOrderEventList()
.stream()
.findFirst();
first2.ifPresent(orderEvent -> carOrderDetail.setOverStandardReason(orderEvent.getExtension()));
return carOrderDetail;
}
@ -487,9 +682,10 @@ public class LYOrderExtensionFactoryImpl implements OrderExtensionFactory {
TrainDetailResponse.TravelData travelData = trainDetailData.getTravelData();
String travelApplyNo = travelData.getTravelApplyNo();
//这里对火车的进行信息进行录入
trainOrderDetail.setReceiptsNum(travelApplyNo);
//这里对改签状态得订单明细进行特殊处理
trainOrderDetail.setCreateTime(formatter.format(LocalDateTime.now()));
trainOrderDetail.setStartTime(trainDetailData.getPlanBeginDate());
trainOrderDetail.setArriveTime(trainDetailData.getPlanEndDate());
@ -753,161 +949,17 @@ public class LYOrderExtensionFactoryImpl implements OrderExtensionFactory {
case "secondseat" -> "二等座";
case "businessseat" -> "商务座";
case "hardseat" -> "二等座";
case "softsleeperup" -> "软卧";
case "hardsleeperup" -> "硬卧";
case "softsleeperup" -> "软卧上铺";
case "hardsleeperup" -> "硬卧上铺";
case "firstseat" -> "一等座";
case "softsleeperdown" -> "软卧下铺";
case "hardsleeperdown" -> "硬卧下铺";
case "softsleepermid" -> "软卧中铺";
case "hardsleepermid" -> "硬卧中铺";
default -> "未知类型座位";
};
}
private CarOrderDetail convertCarOrderDetail(CarDetailResponse.DataWrapper data) {
CarDetailResponse.CarOrderDetailInfo carOrderDetailInfo = data.getCarOrderDetailInfo();
CarDetailResponse.OrderExtendInfo orderExtendInfo = data.getOrderExtendInfo();
CarDetailResponse.OrderDriverInfo orderDriverInfo = data.getOrderDriverInfo();
CarOrderDetail carOrderDetail = new CarOrderDetail();
RouteOrder routeOrder = null;
if (carOrderDetailInfo != null) {
OrderDetail orderDetail = orderDetailRepository.findByOrderNo(carOrderDetailInfo.getOrderSerialNo())
.orElseThrow(() -> new NotFoundException(NOT_FOUND));
routeOrder = routeRepository.queryById(orderDetail.getRouteId());
String sysCode = routeOrder.getApproveOrderNo().getSysCode();
carOrderDetail.setTrvaleSysType(TRAVAL_SYS_TYPE_LY);
if (sysCode != null) {
if (sysCode.equals(BELONG_SYS_CODE_FSSC)) {
carOrderDetail.setBelongSysType(BELONG_SYS_TYPE_FSSC);
}
if (sysCode.equals(BELONG_SYS_CODE_H3BPM)) {
carOrderDetail.setBelongSysType(BELONG_SYS_TYPE_H3BPM);
}
if (sysCode.equals(BELONG_SYS_CODE_XNFSSC)) {
carOrderDetail.setBelongSysType(BELONG_SYS_TYPE_XNFSSC);
}
if (sysCode.equals(BELONG_SYS_CODE_ANFSSC)) {
carOrderDetail.setBelongSysType(BELONG_SYS_TYPE_ANFSSC);
}
}
carOrderDetail.setOrderNo(carOrderDetailInfo.getOrderSerialNo());
carOrderDetail.setDetailId(carOrderDetailInfo.getOrderSerialNo());
Optional<OrderDetail> firstOrderDetail = routeOrder
.getOrderDetails()
.stream()
.filter(it -> it.getOrderNo().equals(carOrderDetail.getOrderNo()))
.findFirst();
firstOrderDetail.ifPresent(it -> {
OrderEvent lastEvent = it.getLastEvent();
if (lastEvent != null) {
carOrderDetail.setOrderStatus(lastEvent.mapToCarOrderDetailStatus());
} else {
//如果订单事件为空那么就需要重新根据查询到的订单信息重新进行映射
Integer orderStatus = carOrderDetailInfo.getOrderStatus();
carOrderDetail.setOrderStatus(
OrderEvent.mapToCarOrderDetailStatus(
LYOrderUtil.mapCarStatus(orderStatus)
)
);
}
}
);
String EmployeeNo = routeOrder.getUserId();
User user = userRepository.findByUserEmployeeNo(EmployeeNo);
if (user != null) {
carOrderDetail.setBookingUserCode(user.getEmployeeNo());
carOrderDetail.setBookingName(user.getName());
carOrderDetail.setBookingUserPhone(user.getPhoneNumber());
}
carOrderDetail.setCreateTime(carOrderDetailInfo.getCreateTime());
carOrderDetail.setOrderAmount(String.valueOf(carOrderDetailInfo.getTotalPrice()));
carOrderDetail.setUserName(carOrderDetailInfo.getContactName());
carOrderDetail.setUserCode(carOrderDetailInfo.getOutEmployeeId());
carOrderDetail.setPhone(carOrderDetailInfo.getContactPhone());
carOrderDetail.setPersonalPaymentAmount(String.valueOf(carOrderDetailInfo.getPersonalPrice()));
carOrderDetail.setCompanyPaymentAmount(String.valueOf(carOrderDetailInfo.getCompanyPrice()));
if (Double.valueOf(carOrderDetail.getCompanyPaymentAmount()) > 0) {
carOrderDetail.setPaymentType("0"); //
} else {
carOrderDetail.setPaymentType("1"); //
}
}
carOrderDetail.setReceiptsNum(routeOrder.getRouteOrderNo());
if (orderExtendInfo != null) {
carOrderDetail.setStartTime(orderExtendInfo.getChargeTime());
carOrderDetail.setArriveTime(orderExtendInfo.getFinishTime());
carOrderDetail.setFromStationName(orderExtendInfo.getStartAddress());
carOrderDetail.setToStationName(orderExtendInfo.getEndAddress());
carOrderDetail.setFromCity(orderExtendInfo.getStartCityName());
carOrderDetail.setToCity(orderExtendInfo.getEndCityName());
String duration = orderExtendInfo.getDuration();
String durationNumbers = duration.replaceAll("[^\\u0000-\\u007F\\p{P}]", "");
carOrderDetail.setRunTime(durationNumbers);
String mileage = orderExtendInfo.getMileage();
String mileageNumbers = mileage.replaceAll("[^\\u0000-\\u007F\\p{P}]", "");
carOrderDetail.setMileage(mileageNumbers);
carOrderDetail.setCarModel(String.valueOf(orderExtendInfo.getCarTypeName()));
}
List<CarDetailResponse.SubmitItem> submitItemList =
data.getTravelDataInfo().getSubmitItemList();
ApproveOrderNo approveOrderNo = routeOrder.getApproveOrderNo();
if (approveOrderNo != null) {
carOrderDetail.setAccountCompanyId(approveOrderNo.getAccountCompanyCode());
carOrderDetail.setAccountCompanyName(approveOrderNo.getAccountCompanyName());
carOrderDetail.setCostCenter(approveOrderNo.getCostCenter());
carOrderDetail.setProjectOrderNo(approveOrderNo.getProjectName());
}
OrderDetail orderDetail = orderDetailRepository.findByOrderNo(carOrderDetailInfo.getOrderSerialNo())
.orElseThrow(() -> new NotFoundException(NOT_FOUND));
Optional<Integer> firstOrderEvent = orderDetail.getOrderEventList()
.stream()
.map(OrderEvent::getEventType)
.filter(it -> it.equals(ORDER_EVENT_ETA))
.findFirst();
if (firstOrderEvent.isEmpty()) {
carOrderDetail.setOverStandard(""); //
} else {
carOrderDetail.setOverStandard(""); //
}
Optional<OrderEvent> first2 = orderDetail.getOrderEventList()
.stream()
.findFirst();
first2.ifPresent(orderEvent -> carOrderDetail.setOverStandardReason(orderEvent.getExtension()));
// carOrderDetail.setParentOrderNo(parentOrderNo); //
// carOrderDetail.setOriginalOrderNo(originalOrderNo); //
// carOrderDetail.setScheduleNum(scheduleNum); //
// carOrderDetail.setCancellationFee(cancellationFee); //
// carOrderDetail.setStandardItems(standardItems); //
// carOrderDetail.setBOOK_ORG_STRUCT_1(BOOK_ORG_STRUCT_1); //
// carOrderDetail.setBOOK_ORG_STRUCT_2(BOOK_ORG_STRUCT_2); //
// carOrderDetail.setBOOK_ORG_STRUCT_3(BOOK_ORG_STRUCT_3); //
// carOrderDetail.setTollFee(tollFee); //
return carOrderDetail;
}
private List<HotelOrderDetailCustomer> getCustomers(List<Resident> residentList) {

View File

@ -17,4 +17,5 @@ public interface OrderDetailFactory {
TrainOrderDetail buildTrainWithRouteOrderAndOrderDetail(RouteOrder routeOrder, Optional<OrderDetail> orderDetail);
HotelOrderDetail buildHotelWithRouteOrderAndOrderDetail(RouteOrder routeOrder, OrderDetail orderDetail);
CarOrderDetail buildCarWithRouteOrderAndOrderDetail(RouteOrder routeOrder, OrderDetail orderDetail);
}

View File

@ -198,4 +198,36 @@ public class OrderDetailFactoryImpl implements OrderDetailFactory {
return hotelOrderDetail;
}
@Override
public CarOrderDetail buildCarWithRouteOrderAndOrderDetail(RouteOrder routeOrder, OrderDetail orderDetail) {
//获取飞机订单明细
CarOrderDetail carOrderDetail;
if (orderDetail.getCarOrderDetail() == null) {
carOrderDetail = BeanUtil.copyProperties(buildWithRouteOrder(routeOrder), CarOrderDetail.class);
} else {
//如果已经存在的话 那么这些基础字段就不用重新构建了
return orderDetail.getCarOrderDetail();
}
//如果订单存在直接配置该订单的超标信息和原因
if(orderDetail.getOrderEventList() != null){
orderDetail.getOrderEventList()
.stream()
.filter(it -> it.getEventType().equals(ORDER_EVENT_ETA))
.findFirst()
.ifPresentOrElse(it -> {
carOrderDetail.setOverStandard("");
carOrderDetail.setOverStandardReason(it.getExtension());
}, () -> carOrderDetail.setOverStandard(""));
carOrderDetail.setOrderNo(orderDetail.getOrderNo());
carOrderDetail.setDetailId(orderDetail.getOrderNo());
User user = userRepository.findByUserEmployeeNo(routeOrder.getUserId());
carOrderDetail.setBookingUserCode(user.getEmployeeNo());
carOrderDetail.setBookingName(user.getName());
carOrderDetail.setBookingUserPhone(user.getPhoneNumber());
}
return carOrderDetail;
}
}

View File

@ -5,6 +5,7 @@ import com.chint.domain.aggregates.order.*;
public interface OrderExtensionFactory {
CarOrderDetail createCarOrderDetail(Object carOrderDetailData);
CarOrderDetail updateCarOrderDetailData(CarOrderDetail carOrderDetail ,Object carOrderDetailData);
TrainOrderDetail createTrainOrderDetail(Object trainOrderDetailData);

View File

@ -20,6 +20,8 @@ public interface LocationRepository {
Location findByCityIdAndLevelFour(Long cityId);
List<Location> findByCityIdAndLocationType(Long cityId , Integer LocationType);
List<Location> findByLocationType(Integer LocationType);
List<Location> findAllLevelThreeAndFour();

View File

@ -14,7 +14,6 @@ public interface TravelStandardsRepository {
List<TravelStandards> findAllTrain();
List<TravelStandards> findByStandardLevel(String standardLevel);
List<TravelStandards> findByStandardLevelAndProductType(String standardLevel, String productType);
List<TravelStandards> findByTravelStandards(TravelStandards travelStandards);
}

View File

@ -0,0 +1,9 @@
package com.chint.domain.repository;
import com.chint.domain.aggregates.user.UserName;
import java.util.Optional;
public interface UserNameRepository {
Optional<UserName> findByEmployeeNo(String employeeNo);
}

View File

@ -31,7 +31,7 @@ public class LocationDomainService {
}
public Location queryCityLocation(Location location) {
if (location.getLevel().equals(LOCATION_TYPE_CITY)) {
if (location.getLevel().equals(LOCATION_LEVEL_CITY)) {
return location;
} else {
return locationRepository.findById(location.getParentLocationId());
@ -44,15 +44,13 @@ public class LocationDomainService {
case LocationConstant.CITY_TYPE_DOMESTIC -> queryByCityName
.stream()
.filter(location -> location.getIsInternal().equals(LOCATION_IS_INTERNAL)
&& (location.getLevel().equals(3) || location.getLevel().equals(4))).toList();
&& (location.getLevel().equals(3) || location.getLevel().equals(4) || location.getLevel().equals(5))).toList();
case LocationConstant.CITY_TYPE_FOREIGN -> queryByCityName
.stream()
.filter(location -> location.getIsInternal().equals(LOCATION_IS_NOT_INTERNAL)
&& (location.getLevel().equals(3) || location.getLevel().equals(4))).toList();
&& (location.getLevel().equals(3) || location.getLevel().equals(4) || location.getLevel().equals(5))).toList();
default -> throw new NotFoundException(CommonMessageConstant.NOT_FOUND);
};
}
}

View File

@ -1,5 +1,6 @@
package com.chint.domain.service;
import com.chint.domain.aggregates.system.SystemCode;
import com.chint.domain.exceptions.NotFoundException;
import com.chint.domain.repository.SystemCodeRepository;
import org.springframework.beans.factory.annotation.Autowired;
@ -15,9 +16,18 @@ public class SystemDomainService {
public boolean checkSystemCode(String sysCode) {
boolean b = systemCodeRepository.findBySysCode(sysCode) != null;
if(!b){
if (!b) {
throw new NotFoundException(SYS_CODE_ERROR);
}
return b;
}
//是否返回结果
public boolean ifImmediateResponse(String sysCode) {
SystemCode bySysCode = systemCodeRepository.findBySysCode(sysCode);
if (bySysCode == null) {
throw new NotFoundException(SYS_CODE_ERROR);
}
return bySysCode.getIfImmediateResponse() == 1;
}
}

View File

@ -1,6 +1,7 @@
package com.chint.domain.aggregates.standards;
package com.chint.domain.service;
import com.chint.domain.aggregates.standards.TravelStandards;
import com.chint.domain.exceptions.NotFoundException;
import com.chint.domain.repository.TravelStandardsRepository;
import jakarta.annotation.PostConstruct;
@ -21,15 +22,8 @@ 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()) {
@ -37,18 +31,5 @@ public class TrainStandardsService {
}
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

@ -41,9 +41,11 @@ import static com.chint.infrastructure.constant.BPMConstant.XNYS_BPM;
import static com.chint.infrastructure.constant.CommonMessageConstant.LEG_CHANGE_MAX_ERROR;
import static com.chint.infrastructure.constant.DataMessageConstant.DATA_NOT_FOUND;
import static com.chint.infrastructure.constant.LegConstant.*;
import static com.chint.infrastructure.constant.OrderConstant.*;
import static com.chint.infrastructure.constant.OrderConstant.ORDER_EVENT_FINISH_NAME;
import static com.chint.infrastructure.constant.RankConstant.ZTZW_COMPANY_CODE;
import static com.chint.infrastructure.constant.RankConstant.ZTZW_COMPANY_NAME;
import static com.chint.infrastructure.constant.RouteConstant.ORDER_STATUS_PREPARE;
import static com.chint.infrastructure.constant.RouteConstant.*;
import static com.chint.infrastructure.constant.UtilConstant.RESULT_ORDER_DETAIL;
@Service
@ -232,10 +234,25 @@ public class LegEventHandler implements LegEventService {
//如果筛选事件可能会是错误需要用户手动添加并修改事件 因此会进行额外出发修改下单事件
Leg leg = legRepository.findByLegId(command.getLegId());
//因为orderDetail已经进行持久化保存 只需要从数据库进行查询
OrderDetail orderDetail = orderDetailRepository.findById(command.getOrderDetailId());
LegEvent legEvent = legEventFactory
.creatLegEvent(command.getLegEventType());
leg.addEvent(legEvent);
OrderDetail orderDetail = orderDetailRepository.findById(command.getOrderDetailId()).reloadStatus();
String orderStatus = orderDetail.getOrderStatus();
//只有在以下状态 才是下单状态
if (orderStatus.equals(ORDER_EVENT_ORDERED_NAME) ||
orderStatus.equals(ORDER_EVENT_PAYED_NAME) ||
orderStatus.equals(ORDER_EVENT_CHANGE_NAME) ||
orderStatus.equals(ORDER_EVENT_FINISH_NAME)) {
LegEvent legEvent = legEventFactory
.creatLegEvent(command.getLegEventType());
leg.addEvent(legEvent);
} else if(orderStatus.equals(ORDER_EVENT_REFUND_NAME) ||
orderStatus.equals(ORDER_EVENT_CANCEL_NAME)){
//如果是退款状态那么就创建加入未下单事件
LegEvent legEvent = legEventFactory
.creatLegEvent(LEG_EVENT_NOT_ORDERED);
leg.addEvent(legEvent);
}
orderDetail.setLegId(leg.getLegId());
legRepository.save(leg);
orderDetailRepository.save(orderDetail);

View File

@ -27,7 +27,7 @@ import java.util.Map;
import java.util.stream.Collectors;
import static com.chint.infrastructure.constant.LegConstant.*;
import static com.chint.infrastructure.constant.LocationConstant.LOCATION_TYPE_COUNTY;
import static com.chint.infrastructure.constant.LocationConstant.LOCATION_LEVEL_COUNTY;
@Slf4j
@Component
@ -182,10 +182,10 @@ public class CTripOrderSyncAdapter implements SupplierOrderSync {
private Location getCityId(Location location) {
if (location.getCityId() == null) {
if (location.getLevel().equals(LOCATION_TYPE_COUNTY) && location.getLocationShortName().endsWith("D")) {
if (location.getLevel().equals(LOCATION_LEVEL_COUNTY) && location.getLocationShortName().endsWith("D")) {
List<DistrictPOIInfoEntity> byLocationName = districtInfoRepository.findByLocationName(location.getLocationName());
location.setCityId(byLocationName.get(0).getDistrictId());
} else if (location.getLevel().equals(LOCATION_TYPE_COUNTY)) {
} else if (location.getLevel().equals(LOCATION_LEVEL_COUNTY)) {
CountryLevelInfoEntity byCityName = countryLevelInfoRepository
.findByCityName(location.getLocationName())
.get(0);

View File

@ -6,7 +6,6 @@ import com.chint.domain.exceptions.NotFoundException;
import com.chint.domain.repository.LocationRepository;
import com.chint.domain.repository.UserRepository;
import com.chint.domain.service.OrderDomainService;
import com.chint.infrastructure.util.BaseContext;
import com.chint.interfaces.rest.ly.LYPostRequest;
import com.chint.interfaces.rest.ly.dto.applyordersync.*;
import com.chint.interfaces.rest.ly.dto.commonresult.Result;
@ -23,8 +22,7 @@ import java.util.stream.Collectors;
import static com.chint.infrastructure.constant.CommonMessageConstant.NOT_FOUND;
import static com.chint.infrastructure.constant.LYConstant.L_Y_ORDER_PATH;
import static com.chint.infrastructure.constant.LegConstant.*;
import static com.chint.infrastructure.constant.LocationConstant.LOCATION_TYPE_CITY;
import static com.chint.infrastructure.constant.LocationConstant.LOCATION_TYPE_COUNTY;
import static com.chint.infrastructure.constant.LocationConstant.*;
@Slf4j
@Component
@ -219,10 +217,19 @@ public class LYOrderSyncAdapter implements SupplierOrderSync {
private Location getCityLocation(Location location) {
if (location.getLevel().equals(LOCATION_TYPE_CITY)) {
if (location.getLocationType().equals(LOCATION_TYPE_CITY)) {
return location;
} else if (location.getLevel().equals(LOCATION_TYPE_COUNTY)) {
} else if (location.getLocationType().equals(LOCATION_LEVEL_COUNTY) || location.getLocationType().equals(LOCATION_TYPE_DISTRICT)) {
return locationRepository.findById(location.getParentLocationId());
} else if (location.getLocationType().equals(LOCATION_TYPE_AIRPORT)) {
//如果是机场的话要查询出对应的地级市
Location parentLocation = locationRepository.findById(location.getParentLocationId());
if (parentLocation.getLocationType().equals(LOCATION_TYPE_COUNTY)) {
//查询出县级市对应的地级市
return locationRepository.findById(parentLocation.getParentLocationId());
} else {
return parentLocation;
}
} else {
throw new NotFoundException(NOT_FOUND);
}

View File

@ -10,6 +10,7 @@ public class SupplierCallbackData {
private Integer selfOrderStatus;
private String outOrderStatus;
private Object data;
private String extension; //扩展字段用于处理其他信息
public static SupplierCallbackData of(String supplierName, String employeeNo) {
SupplierCallbackData supplierCallbackData = new SupplierCallbackData();
@ -33,4 +34,9 @@ public class SupplierCallbackData {
this.data = data;
return this;
}
public SupplierCallbackData extension(String daextensionta) {
this.extension = extension;
return this;
}
}

View File

@ -46,12 +46,12 @@ public class LogService {
public void batchSaveLog() {
while (processedLogCount < 5000) {
//获取日志数量数量
long logNums = redisCache.getHashSize("SystemLog");
if (logNums < 100L) {
int logNums = redisCache.getKeyCountWithPrefix("SystemLog:");
if (logNums < 100) {
break;//少于100条结束循环
}
// 获取100条日志数据
Map<String, Object> systemLogMap = redisCache.getCacheHashValues("SystemLog", 100);
Map<String, Object> systemLogMap = redisCache.getDataWithPrefix("SystemLog:", 100);
Gson gson = new Gson();
// 转换日志数据并保存到数据库
List<SystemLog> systemLogs = systemLogMap.values().stream()
@ -59,7 +59,7 @@ public class LogService {
.toList();
jdbcSystemLogRepository.saveAll(systemLogs);
// 删除已处理的日志数据
redisCache.delCacheMapValue("SystemLog", systemLogMap.keySet());
long l = redisCache.deleteObject(systemLogMap.keySet());
// 更新已处理日志数量
processedLogCount += systemLogs.size();
}
@ -103,18 +103,18 @@ public class LogService {
}
/**
* 保存redis可能剩余的日志信息
* 保存redis的日志信息
*/
@Transactional
public void saveLogs() {
int count = 0; // 初始化计数器
while (count <= 10000) { //当计数器小于10000时执行循环
long logNums = redisCache.getHashSize("SystemLog");
if (logNums <= 0L) {
int logNums = redisCache.getKeyCountWithPrefix("SystemLog:");
if (logNums <= 0) {
break;//没有数据结束循环
}
//获取日志信息
Map<String, Object> systemLogMap = redisCache.getCacheHashValues("SystemLog", 100);
Map<String, Object> systemLogMap = redisCache.getDataWithPrefix("SystemLog:", 100);
if (systemLogMap.isEmpty()) {
break; // 如果没有数据可取跳出循环
}
@ -125,7 +125,7 @@ public class LogService {
).toList();
jdbcSystemLogRepository.saveAll(systemLogs);
// 删除已处理的日志数据
redisCache.delCacheMapValue("SystemLog", systemLogMap.keySet());
long l = redisCache.deleteObject(systemLogMap.keySet());
count++;
}
}

View File

@ -1,10 +1,12 @@
package com.chint.infrastructure.config.LogConfig;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.connection.DataType;
import org.springframework.data.redis.core.*;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;
import java.nio.charset.StandardCharsets;
import java.util.*;
import java.util.concurrent.TimeUnit;
@ -268,4 +270,58 @@ public class RedisCache {
public Collection<String> keys(final String pattern) {
return redisTemplate.keys(pattern);
}
/**
* 获取指定数量key前缀相同的数据
* @param prefix key前缀
* @param count 个数
* @return key 和value
*/
public Map<String, Object> getDataWithPrefix(String prefix, int count) {
ScanOptions options = ScanOptions.scanOptions().match(prefix + "*").count(count).build();
Cursor<byte[]> cursor = (Cursor<byte[]>) redisTemplate.execute((RedisCallback<Cursor<byte[]>>) connection -> connection.scan(options));
Map<String, Object> result = new HashMap<>();
try {
if (cursor != null) {
int limit = 0;
while (cursor.hasNext() && limit < count) {
byte[] keyBytes = cursor.next();
String key = new String(keyBytes, StandardCharsets.UTF_8);
// 判断键的类型是否为 String,防止是其它类型是报错
DataType dataType = redisTemplate.type(key);
if (dataType == DataType.STRING) {
Object value = redisTemplate.opsForValue().get(key);
result.put(key, value);
limit++;
}
}
}
} finally {
if (cursor != null) {
cursor.close();
}
}
return result;
}
/**
* 获取指定数量key前缀相同的数量
* @param prefix key前缀
* @return 数量
*/
public Integer getKeyCountWithPrefix(String prefix) {
ScanOptions options = ScanOptions.scanOptions().match(prefix + "*").build();
Integer count = 0;
try (Cursor<byte[]> cursor = (Cursor<byte[]>) redisTemplate.execute((RedisCallback<Cursor<byte[]>>) connection -> connection.scan(options))) {
if (cursor != null) {
while (cursor.hasNext()) {
cursor.next();
count++;
}
}
}
return count;
}
}

View File

@ -85,15 +85,11 @@ public class RequestLoggingInterceptor implements HandlerInterceptor {
.name(name)
.accessTime(accessTime).build();
//获得时间戳
DateTimeFormatter formatTimestamp = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss SSSSSS");
DateTimeFormatter formatTimestamp = DateTimeFormatter.ofPattern("yyyy-MM-dd:HH-mm-ss SSSSSS");
String timestamp = now.format(formatTimestamp);
String data = new Gson().toJson(systemLog);
//存入redis
redisCache.setCacheMapValue("SystemLog", timestamp, data);
// 设置单独的过期时间
String hashFieldKey = "SystemLog" + ":" + timestamp;
redisCache.expire(hashFieldKey, 1, TimeUnit.DAYS);
//存入redis,过期时间设置为1天,hash不能给字段单独设置过期时间
redisCache.setCacheObject("SystemLog:" + timestamp, data,1,TimeUnit.DAYS);
}
}

View File

@ -7,6 +7,7 @@ public class CTripConstant {
public static final String C_TRIP_COUNTRY_PATH = "/switchAPI/basedata/v2/getcountry";
public static final String C_TRIP_AllPOIInfo_PATH = "/switchapi/basedata/v2/queryAllPOIInfo";
public static final String C_TRIP_AIRPORT_PATH = "/switchAPI/basedata/v2/getairport";
public static final String C_TRIP_LOGIN_PATH = "/singlesignon/openapi/saml/login";
public static final String C_TRIP_ENTITY_ID = "/zhengtai";

View File

@ -29,6 +29,8 @@ public class FSSCConstant {
public static final String FSSC_TRAIN_STATUS_REFUND = "3";//申请单类型
public static final String FSSC_CAR_STATUS_SUCCESS = "1";//申请单类型
public static final String FSSC_CAR_STATUS_REFUND = "3";//申请单类型
public static final String FSSC_CAR_STATUS_HALF_REFUND = "4";//申请单类型

View File

@ -3,6 +3,7 @@ package com.chint.infrastructure.constant;
public class LYConstant {
//同程
public static final String L_Y_STROKE_PUSH = "/api/TravelBizOrder/ExternalApproval";//行程推送外部审批
public static final String L_Y_STROKE_PUSH_NEW = "/api/TravelBizOrder/ExternalApprovalNew";//行程推送外部审批 -
public static final String L_Y_TOKEN_PATH = "/api/OAuth/v2/GetAccessToken";
public static final String L_Y_ORDER_PATH = "/api/TravelApplyOrder/ApplyOrderSync";
public static final String L_Y_USER_PATH = "/api/Employee/SyncEmployeeInfo";

View File

@ -9,6 +9,21 @@ public class LocationConstant {
public static final int LOCATION_IS_INTERNAL = 1;//是国内
public static final int LOCATION_IS_NOT_INTERNAL = 0;//是国外
public static final int LOCATION_TYPE_CITY = 3;//是地级市
public static final int LOCATION_TYPE_COUNTY = 4;//是县级市
//等级
public static final int LOCATION_LEVEL_CITY = 3;//是地级市
public static final int LOCATION_LEVEL_COUNTY = 4;//是县级市
//类型
public static final int LOCATION_TYPE_CONTINENT = 1;//大洲
public static final int LOCATION_TYPE_COUNTRY = 2;//国家
public static final int LOCATION_TYPE_PROVINCE = 3;//
public static final int LOCATION_TYPE_CITY = 4;//是地级市
public static final int LOCATION_TYPE_COUNTY = 5;//县级市
public static final int LOCATION_TYPE_DISTRICT = 6;//
public static final int LOCATION_TYPE_AIRPORT = 7;//机场
}

View File

@ -17,8 +17,8 @@ import java.util.List;
import static com.chint.infrastructure.constant.CommonMessageConstant.NOT_FOUND;
import static com.chint.infrastructure.constant.LegConstant.LEG_TYPE_AIRPLANE;
import static com.chint.infrastructure.constant.LocationConstant.LOCATION_TYPE_CITY;
import static com.chint.infrastructure.constant.LocationConstant.LOCATION_TYPE_COUNTY;
import static com.chint.infrastructure.constant.LocationConstant.LOCATION_LEVEL_CITY;
import static com.chint.infrastructure.constant.LocationConstant.LOCATION_LEVEL_COUNTY;
@Repository
public class LocationRepositoryImpl implements LocationRepository {
@ -67,12 +67,22 @@ public class LocationRepositoryImpl implements LocationRepository {
@Override
public Location findByCityIdAndLevelThree(Long cityId) {
return jdbcLocationRepository.findByCityIdAndLevel(cityId, LOCATION_TYPE_CITY);
return jdbcLocationRepository.findByCityIdAndLevel(cityId, LOCATION_LEVEL_CITY);
}
@Override
public Location findByCityIdAndLevelFour(Long cityId) {
return jdbcLocationRepository.findByCityIdAndLevel(cityId, LOCATION_TYPE_COUNTY);
return jdbcLocationRepository.findByCityIdAndLevel(cityId, LOCATION_LEVEL_COUNTY);
}
@Override
public List<Location> findByCityIdAndLocationType(Long cityId, Integer LocationType) {
return jdbcLocationRepository.findByCityIdAndLocationType(cityId, LocationType);
}
@Override
public List<Location> findByLocationType(Integer LocationType) {
return jdbcLocationRepository.findByLocationType(LocationType);
}
@Override
@ -103,8 +113,8 @@ public class LocationRepositoryImpl implements LocationRepository {
Integer cityType = locationParam.getCityType();
String queryWord = locationParam.getQueryWord();
if (productType.equals(LEG_TYPE_AIRPLANE)) {
return jdbcLocationRepository.findByFirstPinYinAndIsInternalAndIsHaveAirportAndLevelOrFirstPinYinAndIsInternalAndIsHaveAirportAndLevel(
queryWord, cityType, 1, 3, queryWord, cityType, 1, 4);
return jdbcLocationRepository.findByFirstPinYinAndIsInternalAndIsHaveAirportAndLevelOrFirstPinYinAndIsInternalAndIsHaveAirportAndLevelOrFirstPinYinAndIsInternalAndIsHaveAirportAndLevel(
queryWord, cityType, 1, 3, queryWord, cityType, 1, 4, queryWord, cityType, 1, 5);
} else {
return jdbcLocationRepository.findByFirstPinYinAndIsInternalAndLevelOrFirstPinYinAndIsInternalAndLevel(
queryWord, cityType, 3, queryWord, cityType, 4);
@ -118,8 +128,8 @@ public class LocationRepositoryImpl implements LocationRepository {
Integer cityType = locationParam.getCityType();
String queryWord = locationParam.getQueryWord();
if (productType.equals(LEG_TYPE_AIRPLANE)) {
return jdbcLocationRepository.findByLocationPathNameContainingAndIsInternalAndIsHaveAirportAndLevelOrLocationPathNameContainingAndIsInternalAndIsHaveAirportAndLevel(
queryWord, cityType, 1, 3, queryWord, cityType, 1, 4);
return jdbcLocationRepository.findByLocationPathNameContainingAndIsInternalAndIsHaveAirportAndLevelOrLocationPathNameContainingAndIsInternalAndIsHaveAirportAndLevelOrLocationPathNameContainingAndIsInternalAndIsHaveAirportAndLevel(
queryWord, cityType, 1, 3, queryWord, cityType, 1, 4, queryWord, cityType, 1, 5);
} else {
return jdbcLocationRepository.findByLocationPathNameContainingAndIsInternalAndLevelOrLocationPathNameContainingAndIsInternalAndLevel(
queryWord, cityType, 3, queryWord, cityType, 4);

View File

@ -5,8 +5,11 @@ import com.chint.domain.exceptions.NotFoundException;
import com.chint.domain.repository.SystemCodeRepository;
import com.chint.infrastructure.repository.jdbc.JdbcSystemCodeRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Repository;
import static com.chint.infrastructure.constant.CommonMessageConstant.NOT_FOUND;
@Repository
@ -20,6 +23,7 @@ public class SystemCodeRepositoryImpl implements SystemCodeRepository {
return jdbcSystemCodeRepository.save(systemCode);
}
@Cacheable(value = "SystemCode", key = "#sysCode")
@Override
public SystemCode findBySysCode(String sysCode) {
return jdbcSystemCodeRepository.findBySystemCode(sysCode);

View File

@ -0,0 +1,20 @@
package com.chint.infrastructure.repository;
import com.chint.domain.aggregates.user.UserName;
import com.chint.domain.repository.UserNameRepository;
import com.chint.infrastructure.repository.jdbc.JdbcUserNameRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import java.util.Optional;
@Repository
public class UserNameRepositoryImpl implements UserNameRepository {
@Autowired
private JdbcUserNameRepository jdbcUserNameRepository;
@Override
public Optional<UserName> findByEmployeeNo(String employeeNo) {
return jdbcUserNameRepository.findByEmployeeNo(employeeNo);
}
}

View File

@ -13,6 +13,9 @@ import java.util.List;
public interface JdbcLocationRepository extends CrudRepository<Location, Long> {
Location findByCityIdAndLocationShortName(Long cityId, String locationShortName);
List<Location> findByLocationType(Integer locationType);
List<Location> findByCityIdAndLocationType(Long cityId, Integer locationType);
Location findByLocationId(Long locationId);
@ -30,14 +33,12 @@ public interface JdbcLocationRepository extends CrudRepository<Location, Long> {
List<Location> findByLocationPathNameContaining(String localName);
List<Location> findByFirstPinYinAndIsInternalAndIsHaveAirportAndLevelOrFirstPinYinAndIsInternalAndIsHaveAirportAndLevel(String firstPinYin, Integer isInternal, Integer isHaveAirport, Integer level,
String firstPinYin2, Integer isInternal2, Integer isHaveAirport2, Integer level2);
List<Location> findByFirstPinYinAndIsInternalAndIsHaveAirportAndLevelOrFirstPinYinAndIsInternalAndIsHaveAirportAndLevelOrFirstPinYinAndIsInternalAndIsHaveAirportAndLevel(String firstPinYin, Integer isInternal, Integer isHaveAirport, Integer level, String firstPinYin2, Integer isInternal2, Integer isHaveAirport2, Integer level2, String firstPinYin3, Integer isInternal3, Integer isHaveAirport3, Integer level3);
List<Location> findByFirstPinYinAndIsInternalAndLevelOrFirstPinYinAndIsInternalAndLevel(String firstPinYin, Integer isInternal, Integer level,
String firstPinYin2, Integer isInternal2, Integer level2);
List<Location> findByLocationPathNameContainingAndIsInternalAndIsHaveAirportAndLevelOrLocationPathNameContainingAndIsInternalAndIsHaveAirportAndLevel(String locationPathName, Integer isInternal, Integer isHaveAirport, Integer level,
String locationPathName2, Integer isInternal2, Integer isHaveAirport2, Integer level2);
List<Location> findByLocationPathNameContainingAndIsInternalAndIsHaveAirportAndLevelOrLocationPathNameContainingAndIsInternalAndIsHaveAirportAndLevelOrLocationPathNameContainingAndIsInternalAndIsHaveAirportAndLevel(String locationPathName, Integer isInternal, Integer isHaveAirport, Integer level, String locationPathName2, Integer isInternal2, Integer isHaveAirport2, Integer level2, String locationPathName3, Integer isInternal3, Integer isHaveAirport3, Integer level3);
List<Location> findByLocationPathNameContainingAndIsInternalAndLevelOrLocationPathNameContainingAndIsInternalAndLevel(String locationPathName, Integer isInternal, Integer level,
String locationPathName2, Integer isInternal2, Integer level2);

View File

@ -0,0 +1,12 @@
package com.chint.infrastructure.repository.jdbc;
import com.chint.domain.aggregates.user.UserName;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;
import java.util.Optional;
@Repository
public interface JdbcUserNameRepository extends CrudRepository<UserName, Long> {
Optional<UserName> findByEmployeeNo(String employeeNo);
}

View File

@ -96,6 +96,8 @@ public class CarOrderDetailDto implements Serializable {
// 取消费
private String cancellationFee;
// 取消费
private String cancelFee;
// 差标
private String standardItems;
@ -153,6 +155,10 @@ public class CarOrderDetailDto implements Serializable {
}
CarOrderDetailDto carOrderDetailDto = BeanUtil.copyProperties(carOrderDetail, CarOrderDetailDto.class);
carOrderDetailDto.setCarType(carOrderDetail.getCarModel());
String cancellationFee = carOrderDetailDto.getCancellationFee();
if(cancellationFee != null){
carOrderDetailDto.setCancelFee(cancellationFee);
}
return carOrderDetailDto;
}
}

View File

@ -0,0 +1,42 @@
package com.chint.interfaces.rest.ctrip;
import com.chint.interfaces.rest.base.PostRequest;
import com.chint.interfaces.rest.ctrip.dto.Authentification;
import com.chint.interfaces.rest.ctrip.dto.airport.AirportSearchRequest;
import com.chint.interfaces.rest.ctrip.dto.airport.AirportSearchResponse;
import com.google.gson.Gson;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import static com.chint.infrastructure.constant.CTripConstant.C_TRIP_AIRPORT_PATH;
@Slf4j
@Component
public class CTripAirportRequest {
@Value("${cTrip.baseUrl}")
public String C_TRIP_BASE_URL;
@Value("${cTrip.appKey}")
private String C_TRIP_APP_KEY;
@Autowired
private PostRequest postRequest;
@Autowired
private CTripTicketRequest ticketRequest;
public AirportSearchResponse getAirport() {
Gson gson = new Gson();
Authentification auth = new Authentification(C_TRIP_APP_KEY, ticketRequest.loadTicket());
AirportSearchRequest airportSearchRequest = AirportSearchRequest.of(auth);
AirportSearchResponse response = postRequest.post(C_TRIP_BASE_URL + C_TRIP_AIRPORT_PATH,
airportSearchRequest, AirportSearchResponse.class);
log.info(gson.toJson(response));
return response;
}
}

View File

@ -42,9 +42,7 @@ public class CTripAllPOIInfoRequest {
public QueryAllPOIInfoResponseType getAllPOIInfoQuery(Long countryId) {
Authentification authentification = new Authentification(C_TRIP_APP_KEY, ticketRequest.loadTicket());
QueryAllPOIInfoRequestType request = QueryAllPOIInfoRequestType.builder()
.setAuth(authentification)
.setCountryId(countryId)
@ -64,12 +62,35 @@ public class CTripAllPOIInfoRequest {
.setReturnBusStation(false)
.done() // returns to QueryAllPOIInfoRequestType.Builder
.build();
QueryAllPOIInfoResponseType allPOIInfoResponseType = postRequest.post(allPOIInfoUrl, request,
QueryAllPOIInfoResponseType.class);
return allPOIInfoResponseType;
}
public QueryAllPOIInfoResponseType getAirPortInfoByCityInfo(){
Authentification authentification = new Authentification(C_TRIP_APP_KEY, ticketRequest.loadTicket());
QueryAllPOIInfoRequestType request = QueryAllPOIInfoRequestType.builder()
.setAuth(authentification)
.setCountryId(336L)
.provinceConditions()
.setProvinceIds("16")
.setProvinceNames("")
.prefectureLevelCityConditions()
.setPrefectureLevelCityIds("")
.setPrefectureLevelCityNames("")
.setReturnDistrict(true)
.setReturnCounty(true)
.done() // returns to ProvinceCondition.Builder
.done() // returns to QueryAllPOIInfoRequestType.Builder
.poiConditions()
.setReturnAirport(true)
.setReturnTrainStation(true)
.setReturnBusStation(true)
.done() // returns to QueryAllPOIInfoRequestType.Builder
.build();
QueryAllPOIInfoResponseType allPOIInfoResponseType = postRequest.post(allPOIInfoUrl, request,
QueryAllPOIInfoResponseType.class);
return allPOIInfoResponseType;
}
}

View File

@ -1,6 +1,7 @@
package com.chint.interfaces.rest.ctrip;
import com.chint.domain.aggregates.user.User;
import com.chint.domain.repository.UserNameRepository;
import com.chint.infrastructure.constant.CTripConstant;
import com.chint.infrastructure.util.BaseContext;
import com.chint.interfaces.rest.base.PostRequest;
@ -27,6 +28,9 @@ public class CTripUserSaveRequest {
@Autowired
private CTripTicketRequest ticketRequest;
@Autowired
private UserNameRepository userNameRepository;
@Value("${cTrip.baseUrl}")
public String C_TRIP_BASE_URL;
@ -37,7 +41,8 @@ public class CTripUserSaveRequest {
@Value("${cTrip.subAccountName}")
private String subAccountName;
private String userUrl;
private String userUrl;
@Autowired
public CTripUserSaveRequest(PostRequest postRequest,
UserHttpRequest userHttpRequest,
@ -91,9 +96,9 @@ public class CTripUserSaveRequest {
public AuthenticationEntity buildAuthenticationEntityWithUser(User user) {
AuthenticationEntity authenticationEntity = new AuthenticationEntity();
authenticationEntity.setName(user.getName());
authenticationEntity.setEmployeeID(user.getEmployeeNo().toString());
// authenticationEntity.setRankName(user.getStandardLevel());
userNameRepository.findByEmployeeNo(user.getEmployeeNo()).ifPresentOrElse(it -> authenticationEntity.setName(it.getIdName()),
() -> authenticationEntity.setName(user.getName()));
authenticationEntity.setEmployeeID(user.getEmployeeNo());
authenticationEntity.setValid(user.getWorkStatus());
authenticationEntity.setSubAccountName(subAccountName);
return authenticationEntity;

View File

@ -0,0 +1,19 @@
package com.chint.interfaces.rest.ctrip.dto.airport;
import cn.hutool.core.lang.UUID;
import com.chint.interfaces.rest.ctrip.dto.Authentification;
import lombok.Data;
@Data
public class AirportSearchRequest {
private String requestId;
private String locale;
private Authentification auth;
public static AirportSearchRequest of(Authentification auth){
AirportSearchRequest airportSearchRequest = new AirportSearchRequest();
airportSearchRequest.setRequestId(UUID.fastUUID().toString());
airportSearchRequest.setAuth(auth);
return airportSearchRequest;
}
}

View File

@ -0,0 +1,24 @@
package com.chint.interfaces.rest.ctrip.dto.airport;
import lombok.Data;
import java.util.List;
@Data
public class AirportSearchResponse {
private int responseCode;
private String responseDesc;
private List<AirportBaseInfo> airportList;
@Data
public static class AirportBaseInfo{
private String code;
private String name;
private String enName;
private String shortName;
private String shortEnName;
private String superShortName;
private Long cityId;
private String cityCode;
}
}

View File

@ -34,12 +34,12 @@ public class ChangeInfo {
private String CClassName;
private String CTakeOffTime;
private String CArrivalTime;
private String CdCityName;
private String CdPortName;
private String CdTerminal;
private String CaCityName;
private String CaPortName;
private String CaTerminal;
private String CDCityName;
private String CDPortName;
private String CDTerminal;
private String CACityName;
private String CAPortName;
private String CATerminal;
private String RebookStatus;
private double PriceDifferential;
private double DateChangeFee;
@ -54,12 +54,12 @@ public class ChangeInfo {
private String SpecialClassDesc;
private String JounaryNo;
private String AuthorizeStatus;
private String CdPortCode;
private String CaPortCode;
private String CDPortCode;
private String CAPortCode;
private String RebookReasonDesc;
private String RebookType;
private String CaCityCode;
private String CdCityCode;
private String CACityCode;
private String CDCityCode;
private int TaxDifferential;
private String TakeOffTimeUTC;
private String ArrivalTimeUTC;

View File

@ -10,7 +10,5 @@ public class SequenceInfo {
private int Sequence;
private List<TicketInfo> TicketInfo;
// Getters and setters
private List<ChangeInfo> ChangeInfo;
}

View File

@ -4,7 +4,7 @@ package com.chint.interfaces.rest.ctrip.dto.search.flight;
import lombok.Data;
@Data
class TicketInfo {
public class TicketInfo {
private String AirLineCode;
private String TicketNo;
private String TicketNoSignCode;

View File

@ -2,6 +2,9 @@ package com.chint.interfaces.rest.ctrip.tools;
import com.chint.infrastructure.constant.OrderConstant;
import static com.chint.infrastructure.constant.OrderConstant.ORDER_EVENT_ETA;
import static com.chint.infrastructure.constant.OrderConstant.ORDER_EVENT_UNKNOWN;
public class CTripUtils {
public static Integer mapFlightStatus(String status) {
return switch (status) {
@ -35,13 +38,13 @@ public class CTripUtils {
// "改签取消"可能需要新的状态常量因为它没有直接映射
OrderConstant.ORDER_EVENT_PAYED;
case "Paid" -> OrderConstant.ORDER_EVENT_PAYED; // "已支付"映射到已预定
case "Approve_G" -> OrderConstant.ORDER_EVENT_UNKNOWN; // 未知状态
case "Approving" -> OrderConstant.ORDER_EVENT_UNKNOWN; // 未知状态
case "Approving2" -> OrderConstant.ORDER_EVENT_ETA; // 未知状态
case "Approve_T" -> OrderConstant.ORDER_EVENT_UNKNOWN; // 未知状态
case "Approve_F" -> OrderConstant.ORDER_EVENT_UNKNOWN; // 未知状态
case "Approve_A" -> OrderConstant.ORDER_EVENT_UNKNOWN; // 未知状态
case "Approve_C" -> OrderConstant.ORDER_EVENT_UNKNOWN; // 未知状态
case "Approve_G" -> ORDER_EVENT_UNKNOWN; // 未知状态
case "Approving" -> ORDER_EVENT_UNKNOWN; // 未知状态
case "Approving2" -> ORDER_EVENT_ETA; // 未知状态
case "Approve_T" -> ORDER_EVENT_UNKNOWN; // 未知状态
case "Approve_F" -> ORDER_EVENT_UNKNOWN; // 未知状态
case "Approve_A" -> ORDER_EVENT_UNKNOWN; // 未知状态
case "Approve_C" -> ORDER_EVENT_UNKNOWN; // 未知状态
default ->
// 处理未知或未映射的状态
-99;
@ -73,13 +76,13 @@ public class CTripUtils {
case "submitFailed" ->
// "提交失败"可能需要新的状态常量因为它没有直接映射
OrderConstant.ORDER_EVENT_PREPARE;
case "Approve_G" -> OrderConstant.ORDER_EVENT_UNKNOWN; // 未知状态
case "Approving" -> OrderConstant.ORDER_EVENT_UNKNOWN; // 未知状态
case "Approving2" -> OrderConstant.ORDER_EVENT_ETA; // 未知状态
case "Approve_T" -> OrderConstant.ORDER_EVENT_UNKNOWN; // 未知状态
case "Approve_F" -> OrderConstant.ORDER_EVENT_UNKNOWN; // 未知状态
case "Approve_A" -> OrderConstant.ORDER_EVENT_UNKNOWN; // 未知状态
case "Approve_C" -> OrderConstant.ORDER_EVENT_UNKNOWN; // 未知状态
case "Approve_G" -> ORDER_EVENT_UNKNOWN; // 未知状态
case "Approving" -> ORDER_EVENT_UNKNOWN; // 未知状态
case "Approving2" -> ORDER_EVENT_ETA; // 未知状态
case "Approve_T" -> ORDER_EVENT_UNKNOWN; // 未知状态
case "Approve_F" -> ORDER_EVENT_UNKNOWN; // 未知状态
case "Approve_A" -> ORDER_EVENT_UNKNOWN; // 未知状态
case "Approve_C" -> ORDER_EVENT_UNKNOWN; // 未知状态
default ->
// 处理未知或未映射的状态
-99;
@ -105,13 +108,13 @@ public class CTripUtils {
// "退票成功"可能最接近"已经退票"但具体映射取决于业务逻辑
OrderConstant.ORDER_EVENT_REFUND; // 使用退票状态作为近似映射
case "Paid" -> OrderConstant.ORDER_EVENT_PAYED; // "已支付"映射到已预定状态
case "Approve_G" -> OrderConstant.ORDER_EVENT_UNKNOWN; // 未知状态
case "Approving" -> OrderConstant.ORDER_EVENT_UNKNOWN; // 未知状态
case "Approving2" -> OrderConstant.ORDER_EVENT_UNKNOWN; // 未知状态
case "Approve_T" -> OrderConstant.ORDER_EVENT_UNKNOWN; // 未知状态
case "Approve_F" -> OrderConstant.ORDER_EVENT_UNKNOWN; // 未知状态
case "Approve_A" -> OrderConstant.ORDER_EVENT_UNKNOWN; // 未知状态
case "Approve_C" -> OrderConstant.ORDER_EVENT_UNKNOWN; // 未知状态
case "Approve_G" -> ORDER_EVENT_UNKNOWN; // 未知状态
case "Approving" -> ORDER_EVENT_UNKNOWN; // 未知状态
case "Approving2" -> ORDER_EVENT_ETA; // 未知状态
case "Approve_T" -> ORDER_EVENT_UNKNOWN; // 未知状态
case "Approve_F" -> ORDER_EVENT_UNKNOWN; // 未知状态
case "Approve_A" -> ORDER_EVENT_UNKNOWN; // 未知状态
case "Approve_C" -> ORDER_EVENT_UNKNOWN; // 未知状态
default ->
// 处理未知或未映射的状态
-99;
@ -148,13 +151,13 @@ public class CTripUtils {
case "Canceling" ->
// "取消中"可能表示订单正在取消过程中但没有直接映射可能需要新的状态常量
OrderConstant.ORDER_EVENT_REFUND;
case "Approve_G" -> OrderConstant.ORDER_EVENT_UNKNOWN; // 未知状态
case "Approving" -> OrderConstant.ORDER_EVENT_UNKNOWN; // 未知状态
case "Approving2" -> OrderConstant.ORDER_EVENT_UNKNOWN; // 未知状态
case "Approve_T" -> OrderConstant.ORDER_EVENT_UNKNOWN; // 未知状态
case "Approve_F" -> OrderConstant.ORDER_EVENT_UNKNOWN; // 未知状态
case "Approve_A" -> OrderConstant.ORDER_EVENT_UNKNOWN; // 未知状态
case "Approve_C" -> OrderConstant.ORDER_EVENT_UNKNOWN; // 未知状态
case "Approve_G" -> ORDER_EVENT_UNKNOWN; // 未知状态
case "Approving" -> ORDER_EVENT_UNKNOWN; // 未知状态
case "Approving2" -> ORDER_EVENT_UNKNOWN; // 未知状态
case "Approve_T" -> ORDER_EVENT_UNKNOWN; // 未知状态
case "Approve_F" -> ORDER_EVENT_UNKNOWN; // 未知状态
case "Approve_A" -> ORDER_EVENT_UNKNOWN; // 未知状态
case "Approve_C" -> ORDER_EVENT_UNKNOWN; // 未知状态
default ->
// 处理未知或未映射的状态
-99;

View File

@ -14,4 +14,8 @@ public class LYNoteResponse {
public static LYNoteResponse success() {
return new LYNoteResponse("100", "OK");
}
public static LYNoteResponse error(String resMsg) {
return new LYNoteResponse("100", resMsg);
}
}

View File

@ -1,6 +1,7 @@
package com.chint.interfaces.rest.ly;
import com.chint.domain.aggregates.user.User;
import com.chint.domain.repository.UserNameRepository;
import com.chint.infrastructure.util.BaseContext;
import com.chint.interfaces.rest.ly.dto.user.EmployeeEntity;
import com.chint.interfaces.rest.ly.dto.user.EmployeeRequest;
@ -31,6 +32,9 @@ public class LYUserRequest {
@Autowired
private UserHttpRequest userHttpRequest;
@Autowired
private UserNameRepository userNameRepository;
private String userUrl;
@PostConstruct
@ -82,21 +86,13 @@ public class LYUserRequest {
private EmployeeEntity user2LYEmployee(User user) {
EmployeeEntity employeeEntity = new EmployeeEntity();
employeeEntity.setOutEmployeeId(String.valueOf(user.getEmployeeNo()));
employeeEntity.setSurName(user.getName());
userNameRepository.findByEmployeeNo(user.getEmployeeNo()).ifPresentOrElse(it->employeeEntity.setSurName(it.getIdName()),
()-> employeeEntity.setSurName(user.getName()));
employeeEntity.setGender(translateGender(user.getGender()));
employeeEntity.setWorkingState(translateWorkStatus(user.getWorkStatus()));
employeeEntity.setReservationType(0);
String standardLevel = user.getStandardLevel();
employeeEntity.setPositionLevelName(standardLevel);
// List<PreTravelPolicy> preTravelPolicyList = List.of(
// new PreTravelPolicy(standardLevel, 1),
// new PreTravelPolicy(standardLevel, 2),
// new PreTravelPolicy(standardLevel, 3),
// new PreTravelPolicy(standardLevel, 4),
// new PreTravelPolicy(standardLevel, 5),
// new PreTravelPolicy(standardLevel, 6)
// );
// employeeEntity.setPreTravelPolicyList(preTravelPolicyList);
return employeeEntity;
}
}

View File

@ -0,0 +1,34 @@
package com.chint.interfaces.rest.ly;
import com.chint.interfaces.rest.ly.dto.approval.ApprovalRequest;
import com.chint.interfaces.rest.ly.dto.approval.ApprovalResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import static com.chint.infrastructure.constant.LYConstant.L_Y_STROKE_PUSH_NEW;
@Component
public class LyApprovalRequest {
@Value("${ly.baseUrl}")
private String baseUrl;
@Autowired
private LYPostRequest lyPostRequest;
public ApprovalResponse pushApprovalSuccess(String approvalId) {
return pushApprovalRes(approvalId, 2);
}
public ApprovalResponse pushApprovalError(String approvalId) {
return pushApprovalRes(approvalId, 1);
}
private ApprovalResponse pushApprovalRes(String approvalId, Integer approvalStatus) {
ApprovalRequest approvalRequest = ApprovalRequest.approvalOrder(approvalId, approvalStatus);
return lyPostRequest.post(baseUrl + L_Y_STROKE_PUSH_NEW,
approvalRequest,
ApprovalResponse.class);
}
}

View File

@ -0,0 +1,26 @@
package com.chint.interfaces.rest.ly.dto.approval;
import com.chint.interfaces.rest.ly.dto.LYBaseRequest;
import lombok.Data;
@Data
public class ApprovalRequest extends LYBaseRequest {
private ApprovalParam param;
public static ApprovalRequest approvalOrder(String approvalId, Integer approvalStatus) {
ApprovalRequest approvalRequest = new ApprovalRequest();
ApprovalParam param = new ApprovalParam();
param.setApprovalId(approvalId);
param.setApprovalStatus(approvalStatus);
approvalRequest.setParam(param);
return approvalRequest;
}
@Data
public static class ApprovalParam {
private String approvalId;
private Integer remarks;
private Integer approvalStatus;
private Integer outApprovalId;
}
}

View File

@ -0,0 +1,10 @@
package com.chint.interfaces.rest.ly.dto.approval;
import com.chint.interfaces.rest.ly.dto.LYBaseResponse;
import lombok.Data;
@Data
public class ApprovalResponse extends LYBaseResponse {
private String data;
private Integer errorType;
}

View File

@ -0,0 +1,158 @@
package com.chint.interfaces.rest.ly.dto.eta;
import com.chint.interfaces.rest.ctrip.dto.search.flight.FlightInfo;
import lombok.Data;
import java.util.List;
@Data
public class LyETAPush {
private NotifyData notifyData;
private int notifyType;
private int subNotifyType;
private long notifyTime;
private String sign;
private String soleKey;
private boolean isEncrypt;
@Data
public static class NotifyData {
private String ApprovalOrderId;
private String TravelApplyNo;
private String TravelOrderNo;
private List<Employee> Employees;
private String BookEmpId;
private String BookEmpEmail;
private String CompanyCode;
private List<String> OrderNos;
private OrderInfo OrderInfos;
}
@Data
public static class Employee {
private String empId;
private String empEmail;
private String empName;
}
@Data
public static class OrderInfo {
private List<FlightOrderInfo> flightOrderInfos;
private List<HotelOrderInfo> hotelOrderInfos;
private List<TrainOrderInfo> trainOrderInfos;
}
@Data
public static class BaseOrderInfo {
private List<BusinessTravelPolicy> businessTravelPolicies;
}
@Data
public static class FlightOrderInfo extends BaseOrderInfo{
private String orderNo;
private double totalAmount;
private double originalAmount;
private double refundAmount;
private double changeAmount;
private List<FlightInfo> flightInfo;
}
@Data
public static class BusinessTravelPolicy {
private int isViolation;
private String passengerEmpId;
private String violationReasonCode;
private String violationReasonChinese;
private String violationReasonRemark;
private List<PolicyDetail> policyDetails;
}
@Data
public static class PolicyDetail {
private String violationContent;
private String violationContentCode;
}
@Data
public static class FlightInfo {
private String arrivalAirport;
private String arrivalCity;
private String arrivalDate;
private String cabin;
private String departureAirport;
private String departureCity;
private String departureDate;
private String flightCompany;
private String flight;
private String meal;
private String planeModel;
private double price;
private double tax;
private double oil;
private double amount;
private int flightNo;
}
//酒店订单信息
@Data
public static class HotelOrderInfo extends BaseOrderInfo{
private String orderNo;
private AmountInfo amountInfo;
private List<HotelInfo> hotelInfos;
// Getters and Setters
}
@Data
public static class AmountInfo {
private double totalAmount;
private String currency;
private String payType;
private double companyAmt;
private double personAmt;
// Getters and Setters
}
@Data
public static class HotelInfo {
private String clientName;
private String city;
private String startTime;
private String endTime;
private String quantity;
private String roomDays;
private String roomName;
private String roomNo;
private String meal;
private String stars;
private String hotelType;
}
//火车订单信息
@Data
public static class TrainOrderInfo extends BaseOrderInfo {
private String orderNo;
private double totalAmount;
private double originalAmount;
private double changeAmount;
private double refundAmount;
private List<TrainInfo> trainInfos;
}
@Data
class TrainInfo {
private String passengerName;
private String trainNum;
private String seatType;
private String departureTime;
private String arriveTime;
private String dCityName;
private String aCityName;
private String dStationName;
private String aStationName;
private double price;
}
}

View File

@ -196,7 +196,6 @@ public class CommonController {
orderTravel.setOrderNo(dataObject.getOrderDetails().getOrderSerialNo());
orderTravel.setTravelNo(dataObject.getOrderDetails().getTravelOrderNo());
saveOrderTravel(orderTravel);
int ruleViolate = dataObject.getOrderDetails().getRuleViolate() ? 1 : 0;
String orderSerialNo = dataObject.getOrderDetails().getOrderSerialNo();
@ -212,7 +211,6 @@ public class CommonController {
}
}
return new LYNoteResponse("100", "OK");
}
/**

View File

@ -0,0 +1,192 @@
package com.chint.interfaces.rest.ly.in;
import com.chint.application.commands.OrderStatusChangeCommand;
import com.chint.domain.aggregates.order.OrderDetail;
import com.chint.domain.exceptions.NotFoundException;
import com.chint.domain.service.SystemDomainService;
import com.chint.domain.service.supplier.SupplierService;
import com.chint.domain.value_object.SupplierCallbackData;
import com.chint.infrastructure.echo_framework.command.Command;
import com.chint.infrastructure.util.DelayDispatch;
import com.chint.interfaces.rest.ly.LYNoteResponse;
import com.chint.interfaces.rest.ly.LYSearchRequest;
import com.chint.interfaces.rest.ly.LyApprovalRequest;
import com.chint.interfaces.rest.ly.dto.eta.LyETAPush;
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 lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import java.util.concurrent.CompletableFuture;
import static com.chint.infrastructure.constant.CommonMessageConstant.NOT_FOUND;
import static com.chint.infrastructure.constant.LegConstant.*;
import static com.chint.infrastructure.constant.OrderConstant.ORDER_EVENT_CHANGE;
import static com.chint.infrastructure.constant.OrderConstant.ORDER_EVENT_ETA;
import static com.chint.infrastructure.constant.SupplierNameConstant.SUPPLIER_L_Y;
@Slf4j
@RestController
@RequestMapping("/public/common")
public class LYETAController {
@Autowired
private SystemDomainService systemDomainService;
@Autowired
private LyApprovalRequest lyApprovalRequest;
@Autowired
private LYSearchRequest lySearchRequest;
@Autowired
private SupplierService supplierService;
@PostMapping("/eta")
public LYNoteResponse noteByETA(@RequestBody LyETAPush lyETAPush) {
if (lyETAPush.getNotifyType() != 51) {
return LYNoteResponse.error("推送类型错误");
}
LyETAPush.NotifyData notifyData = lyETAPush.getNotifyData();
String travelApplyNo = notifyData.getTravelApplyNo();
String[] split = travelApplyNo.split("-");
if (split.length == 0) {
return LYNoteResponse.error("外部申请单格式错误");
}
//获取系统标识
String sysCode = split[0];
if (systemDomainService.ifImmediateResponse(sysCode)) {
//如果是可以立刻返回结果的直接返回审批通过信息
CompletableFuture.runAsync(() -> DelayDispatch.attemptToSend(
() -> lyApprovalRequest.pushApprovalSuccess(notifyData.getApprovalOrderId()).isSuccess(), 0
));
}
SupplierCallbackData supplierCallbackData = handlerETACallBackData(lyETAPush);
OrderDetail orderDetail = supplierService.handleSupplierCallback(supplierCallbackData);
//发送超标事件
Command.of(OrderStatusChangeCommand.class)
.orderDetail(orderDetail)
.outStatus("超标")
.extension(supplierCallbackData.getExtension())
.eventType(ORDER_EVENT_ETA)
.orderNo(orderDetail.getOrderNo())
.sendToQueue();
int subNotifyType = lyETAPush.getSubNotifyType();
if(subNotifyType == 2 || subNotifyType == 4 || subNotifyType == 6 ){
//如果推送类是2,4,6还要触发改签事件
Command.of(OrderStatusChangeCommand.class)
.orderDetail(orderDetail)
.outStatus("改签")
.extension(supplierCallbackData.getExtension())
.eventType(ORDER_EVENT_CHANGE)
.orderNo(orderDetail.getOrderNo())
.sendToQueue();
}
return LYNoteResponse.success();
}
private SupplierCallbackData handlerETACallBackData(LyETAPush lyETAPush) {
LyETAPush.NotifyData notifyData = lyETAPush.getNotifyData();
String bookEmpId = notifyData.getBookEmpId();
SupplierCallbackData supplierCallbackData =
SupplierCallbackData.of(SUPPLIER_L_Y, bookEmpId);
LyETAPush.OrderInfo orderInfos = notifyData.getOrderInfos();
//如果子类型是1 那么就要自己去找出是那种类型的
if (lyETAPush.getSubNotifyType() == 1) {
handleCommonETA(orderInfos, supplierCallbackData);
} else if (lyETAPush.getSubNotifyType() == 2) {
//子类型为2代表机票改签超标
searchOrderDetailByProductType(orderInfos, supplierCallbackData, LEG_TYPE_AIRPLANE);
} else if (lyETAPush.getSubNotifyType() == 4) {
//子类型为4代表火车改签超标
searchOrderDetailByProductType(orderInfos, supplierCallbackData, LEG_TYPE_TRAIN);
} else if (lyETAPush.getSubNotifyType() == 6) {
//子类型为6代表酒店变更超标
searchOrderDetailByProductType(orderInfos, supplierCallbackData, LEG_TYPE_HOTEL);
}
return supplierCallbackData;
}
private SupplierCallbackData handleCommonETA(LyETAPush.OrderInfo orderInfos, SupplierCallbackData supplierCallbackData) {
Integer productType = findProductType(orderInfos);
if (productType == null) {
throw new NotFoundException(NOT_FOUND);
}
return searchOrderDetailByProductType(orderInfos, supplierCallbackData, productType);
}
private SupplierCallbackData searchOrderDetailByProductType(LyETAPush.OrderInfo orderInfos, SupplierCallbackData supplierCallbackData, Integer productType) {
switch (productType) {
case LEG_TYPE_AIRPLANE -> {
List<LyETAPush.FlightOrderInfo> flightOrderInfos = orderInfos.getFlightOrderInfos();
if (flightOrderInfos != null && !flightOrderInfos.isEmpty()) {
LyETAPush.FlightOrderInfo flightOrderInfo = flightOrderInfos.get(0);
FlightOrderResponse.Data data = lySearchRequest
.getFlightOrderDetail(flightOrderInfo.getOrderNo()).getData();
supplierCallbackData.data(data).extension(getETAReason(flightOrderInfo));
}
}
case LEG_TYPE_TRAIN -> {
List<LyETAPush.TrainOrderInfo> trainOrderInfos = orderInfos.getTrainOrderInfos();
if (trainOrderInfos != null && !trainOrderInfos.isEmpty()) {
LyETAPush.TrainOrderInfo trainOrderInfo = trainOrderInfos.get(0);
TrainDetailResponse.TrainDetailData data = lySearchRequest
.getTrainOrderDetail(trainOrderInfo.getOrderNo()).getData();
supplierCallbackData.data(data).extension(getETAReason(trainOrderInfo));
}
}
case LEG_TYPE_HOTEL -> {
List<LyETAPush.HotelOrderInfo> hotelOrderInfos = orderInfos.getHotelOrderInfos();
if (hotelOrderInfos != null && !hotelOrderInfos.isEmpty()) {
LyETAPush.HotelOrderInfo hotelOrderInfo = hotelOrderInfos.get(0);
HotelDetailResponse.Data data = lySearchRequest
.getHotelOrderDetail(hotelOrderInfo.getOrderNo()).getData();
supplierCallbackData.data(data).extension(getETAReason(hotelOrderInfo));
}
}
default -> throw new NotFoundException(NOT_FOUND);
}
return supplierCallbackData;
}
private Integer findProductType(LyETAPush.OrderInfo orderInfos) {
List<LyETAPush.FlightOrderInfo> flightOrderInfos = orderInfos.getFlightOrderInfos();
if (flightOrderInfos != null && !flightOrderInfos.isEmpty()) {
return LEG_TYPE_AIRPLANE;
}
List<LyETAPush.TrainOrderInfo> trainOrderInfos = orderInfos.getTrainOrderInfos();
if (trainOrderInfos != null && !trainOrderInfos.isEmpty()) {
return LEG_TYPE_TRAIN;
}
List<LyETAPush.HotelOrderInfo> hotelOrderInfos = orderInfos.getHotelOrderInfos();
if (hotelOrderInfos != null && !hotelOrderInfos.isEmpty()) {
return LEG_TYPE_HOTEL;
}
return null;
}
private String getETAReason(LyETAPush.BaseOrderInfo baseOrderInfo) {
List<LyETAPush.BusinessTravelPolicy> businessTravelPolicies = baseOrderInfo.getBusinessTravelPolicies();
if (businessTravelPolicies != null && !businessTravelPolicies.isEmpty()) {
LyETAPush.BusinessTravelPolicy businessTravelPolicy = businessTravelPolicies.get(0);
return businessTravelPolicy.getViolationReasonChinese();
}
return null;
}
}

View File

@ -4,16 +4,20 @@ import com.chint.domain.aggregates.location.basedata.CountryInfoEntity;
import com.chint.domain.aggregates.location.basedata.DistrictPOIInfoEntity;
import com.chint.domain.aggregates.location.basedata.PrefectureLevelCityInfoEntity;
import com.chint.domain.aggregates.order.Location;
import com.chint.domain.aggregates.order.RouteOrder;
import com.chint.domain.aggregates.order.ctrip.CtripCarOrderDetail;
import com.chint.domain.aggregates.order.ctrip.CtripFlightOrderDetail;
import com.chint.domain.aggregates.order.ctrip.CtripHotelOrderDetail;
import com.chint.domain.aggregates.order.ctrip.CtripTrainOrderDetail;
import com.chint.domain.aggregates.user.User;
import com.chint.domain.repository.*;
import com.chint.domain.service.order_sync.CTripOrderSyncAdapter;
import com.chint.domain.service.supplier.SupplierService;
import com.chint.domain.value_object.SupplierCallbackData;
import com.chint.infrastructure.util.BaseContext;
import com.chint.infrastructure.util.Digest;
import com.chint.infrastructure.util.PinyinUtil;
import com.chint.interfaces.rest.base.PostRequest;
import com.chint.interfaces.rest.ctrip.*;
import com.chint.interfaces.rest.ctrip.dto.city.FlightCitySearchResponse;
import com.chint.interfaces.rest.ctrip.dto.country.CountryResponse;
@ -31,12 +35,15 @@ import com.chint.interfaces.rest.ctrip.dto.order.OrderCarResponse;
import com.chint.interfaces.rest.ctrip.dto.order.OrderFlightResponse;
import com.chint.interfaces.rest.ctrip.dto.order.OrderHotelResponse;
import com.chint.interfaces.rest.ctrip.dto.order.OrderTrainResponse;
import com.chint.interfaces.rest.ctrip.dto.put.CTripNoteResponse;
import com.chint.interfaces.rest.ctrip.dto.put.CTripStatusNotification;
import com.chint.interfaces.rest.ctrip.dto.search.SearchOrderResponse;
import com.chint.interfaces.rest.ctrip.in.CTripNoteController;
import com.chint.interfaces.rest.ctrip.order.CTripOrderDetailRequest;
import com.google.gson.Gson;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.test.context.SpringBootTest;
import java.util.*;
@ -104,8 +111,27 @@ public class CTripTest {
@Autowired
private DistrictInfoRepository districtInfoRepository;
@Autowired
private CTripOrderSyncAdapter cTripOrderSyncAdapter;
@Autowired
private RouteRepository routeRepository;
@Autowired
private PostRequest postRequest;
@Value("${cTrip.requestSecret}")
private String C_TRIP_REQUEST_SECRET;
private User user = new User(1L, "230615020", 1, "卢麟哲", "1033719135@qq.com", "15857193365", "A30000001");
@Test
void syncOrder(){
RouteOrder routeOrder = routeRepository.queryById(3892L);
cTripOrderSyncAdapter.syncSupplierOrder(routeOrder);
}
//@Test
void locationCountry() {
@ -210,10 +236,10 @@ public class CTripTest {
System.out.println(gson.toJson(estimate));
}
// @Test
@Test
void search() {
BaseContext.setCurrentUser(user);
SearchOrderResponse response = orderSearchRequest.searchOrderResponseByOrderId("30410372171");
SearchOrderResponse response = orderSearchRequest.searchOrderResponseByOrderId("31108053999");
System.out.println(response);
}
@ -535,4 +561,29 @@ public class CTripTest {
}
}
// @Test
void batchPush(){
List<String> strings = List.of(
"31060889641");
for (String string : strings) {
CTripStatusNotification item = new CTripStatusNotification();
item.setApproveScenario("");
item.setCorpId("zhengtai2024");
item.setOrderId(string);
item.setOrderStatus("Dealt");
item.setProductType("HotelContract");
item.setRefundType(null);
item.setStatusIDs(null);
String putCTripSign = Digest.getPutCTripStatusSign(item.getCorpId(), item.getProductType(), item.getOrderStatus(), item.getOrderId(), C_TRIP_REQUEST_SECRET);
item.setSign(putCTripSign);
CTripNoteResponse post = postRequest.post("https://trip.chint.com/api/public/CTrip/status", item, CTripNoteResponse.class);
System.out.println(post.getErrorCode());
System.out.println(post.getErrorMessage());
}
}
}

View File

@ -8,9 +8,11 @@ import com.authine.cloudpivot.opensdk.model.response.workflow.StartWorkflowRespo
import com.chint.application.commands.RefundOrderGenerateCommand;
import com.chint.domain.aggregates.order.OrderDetail;
import com.chint.domain.aggregates.order.OrderTravel;
import com.chint.domain.aggregates.order.RouteOrder;
import com.chint.domain.aggregates.user.User;
import com.chint.domain.repository.OrderDetailRepository;
import com.chint.domain.repository.RouteRepository;
import com.chint.domain.service.order_sync.LYOrderSyncAdapter;
import com.chint.infrastructure.constant.LYConstant;
import com.chint.infrastructure.echo_framework.command.Command;
import com.chint.infrastructure.repository.jdbc.JdbcOrderDetailRepository;
@ -22,6 +24,7 @@ import com.chint.interfaces.rest.bpm.XNBPM.ClientFactory;
import com.chint.interfaces.rest.bpm.XNBPM.YSTokenDto;
import com.chint.interfaces.rest.bpm.dot.BPMBaseResponse;
import com.chint.interfaces.rest.bpm.dto.*;
import com.chint.interfaces.rest.bpm.dto.orderdetail.HotelOrderDetailDto;
import com.chint.interfaces.rest.ly.*;
import com.chint.interfaces.rest.ly.dto.applyordersync.*;
import com.chint.interfaces.rest.ly.dto.commonresult.Result;
@ -30,12 +33,7 @@ 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.dto.strokepush.Param;
import com.chint.interfaces.rest.ly.dto.strokepush.StrokeController;
import com.chint.interfaces.rest.ly.dto.strokepush.StrokePushDTO;
import com.chint.interfaces.rest.ly.in.CommonController;
import com.chint.interfaces.rest.ly.vo.estimateprice.TrainPriceVo;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
@ -52,7 +50,6 @@ import java.util.*;
import static com.chint.infrastructure.constant.BPMConstant.H3BPM_EXCEED_STANDARD_URL;
import static com.chint.infrastructure.constant.BPMConstant.YSBPM_TOKEN_URL;
import static com.chint.infrastructure.constant.SupplierNameConstant.SUPPLIER_L_Y_BPM_NAME;
@SpringBootTest
public class LYTest {
@ -89,6 +86,10 @@ public class LYTest {
@Value("${ly.baseUrl}")
private String lyBaseUrl;
@Autowired
private LYOrderSyncAdapter lyOrderSyncAdapter;
@Autowired
private BPMRequest bpmRequest;
@ -801,41 +802,44 @@ public class LYTest {
String join = String.join(",", set);
System.out.println("join = " + join);
}
// @Test
@Test
void searchFlight() {
FlightOrderResponse flightOrderDetail = lySearchRequest.getFlightOrderDetail("DF24031967216947447");
FlightOrderResponse flightOrderDetail = lySearchRequest.getFlightOrderDetail("DF24032167509129714");
Gson gson = new Gson();
String json = gson.toJson(flightOrderDetail);
System.out.println(json);
}
// @Test
@Test
void searchTrain() {
TrainDetailResponse trainOrderDetail = lySearchRequest.getTrainOrderDetail("DTC24031767013846252");
TrainDetailResponse trainOrderDetail = lySearchRequest.getTrainOrderDetail("DT24032167537614664");
Gson gson = new Gson();
String json = gson.toJson(trainOrderDetail);
System.out.println(json);
}
// @Test
@Test
void searchHotel() {
HotelDetailResponse hotelOrderDetail = lySearchRequest.getHotelOrderDetail("HO20240317101300570508");
HotelDetailResponse hotelOrderDetail = lySearchRequest.getHotelOrderDetail("HO20240320223900768299");
Gson gson = new Gson();
String json = gson.toJson(hotelOrderDetail);
System.out.println(json);
}
// @Test
@Test
void searchCar() {
CarDetailResponse carDetailResponse = lySearchRequest.getCarDetailResponse("DC24031466726324898");
CarDetailResponse carDetailResponse = lySearchRequest.getCarDetailResponse("DC24031566878059751");
Gson gson = new Gson();
String json = gson.toJson(carDetailResponse);
System.out.println(json);
}
// @Test
@Test
void deleteOrderDetailById(){
orderDetailRepository.deleteById(1433L);
orderDetailRepository.deleteById(2617L);
orderDetailRepository.deleteById(2618L);
}
// @Test
@ -847,7 +851,7 @@ public class LYTest {
// System.out.println(json);
TrainDetailResponse trainDetailResponse = lySearchRequest.getTrainOrderDetail("DTC24031767013846252");
TrainDetailResponse trainDetailResponse = lySearchRequest.getTrainOrderDetail(" DTC24031767013846252");
Gson gson = new Gson();
String json = gson.toJson(trainDetailResponse);
System.out.println(json);
@ -865,21 +869,30 @@ public class LYTest {
// System.out.println(json);
}
// @Test
@Test
void testRoomStandard(){
String dayStandardPrice = "300.00";
String[] split = dayStandardPrice.split(",");
List<String> list = Arrays.asList(split);
if (!list.isEmpty()) {
System.out.println(list.get(0));
}
}
@Test
void conform() {
commonController.changeFlight(1, 9, "DFC24031767042246246");
}
// @Test
@Test
void sendMsg() {
commonController.sendMsg("T24031867123861097");
commonController.sendMsg("T24032167509127504");
}
// DTC24031466757493927
// DTC24031466757493927
// @Test
@Test
void generateLyTrain() {
TrainDetailResponse trainOrderDetail = lySearchRequest.getTrainOrderDetail("DTC24031466757493927");
TrainDetailResponse trainOrderDetail = lySearchRequest.getTrainOrderDetail("DTC24031767004591541");
TrainDetailResponse.TrainDetailData data = trainOrderDetail.getData();
if (data != null && data.getOrderStatus().equals("T") && data.getItems() != null && !data.getItems().isEmpty()) {
TrainDetailResponse.Item item = data.getItems().get(0);
@ -894,17 +907,30 @@ public class LYTest {
}
System.out.println(trainOrderDetail);
}
@Autowired
private StrokeController strokeController;
// @Test
public void aaaa() {
StrokePushDTO strokePushDTO = new StrokePushDTO();
Param param = new Param();
param.setTravelBizOrderNo("T24031967219916513")//同程行程单号
.setApprovalStatus(2);//1驳回 2通过
strokePushDTO.setParam(param);
strokeController.strokePush(strokePushDTO);
// @Test
void syncToSupplierLy(){
List<Integer> integers = List.of(3, 5, 19, 20, 31, 34, 36, 63, 73, 76, 86, 102, 104, 109, 110, 143, 147, 150, 155, 172, 182, 196, 200, 204, 212, 214, 230, 301, 314, 343, 365, 379, 382, 399, 402, 438, 446, 448, 487, 551, 563, 580, 588, 595, 599, 607, 612, 613, 622, 664, 665, 669, 672, 673, 674, 676, 680, 700, 702, 703, 755, 759, 764, 790, 801, 808, 855, 876, 925, 941, 963, 990, 1012, 1028, 1038, 1044, 1125, 1131, 1173, 1194, 1198, 1217, 1238, 1240, 1241, 1242, 1248, 1250, 1275, 1280, 1284, 1308, 1313, 1317, 1324, 1354, 1363, 1368, 1375, 1383, 1405, 1414, 1418, 1441, 1444, 1452, 1461, 1463, 1464, 1467, 1469, 1470, 1472, 1478, 1481, 1487, 1509, 1515, 1526, 1536, 1541, 1547, 1558, 1576, 1584, 1587, 1594, 1596, 1601, 1603, 1626, 1627, 1630, 1631, 1633, 1641, 1646, 1651, 1656, 1658, 1666, 1675, 1683, 1689, 1691, 1705, 1725, 1735, 1755, 1759, 1771, 1775, 1780, 1781, 1797, 1814, 1837, 1841, 1859, 1860, 1876, 1895, 1896, 1917, 1918, 1922, 1940, 1953, 1958, 1959, 1963, 1991, 1999, 2012, 2023, 2040, 2050, 2055, 2075, 2078, 2082, 2089, 2097, 2105, 2108, 2121, 2122, 2125, 2131, 2146, 2147, 2153, 2154, 2156, 2161, 2174, 2177, 2178, 2184, 2194, 2201, 2222, 2226, 2231, 2237, 2238, 2239, 2241, 2256, 2268, 2275, 2280, 2292, 2293, 2298, 2299, 2301, 2306, 2311, 2313, 2316, 2333, 2342, 2355, 2381, 2399, 2405, 2408, 2416, 2424, 2434, 2435, 2437, 2441, 2450, 2470, 2505, 2555, 2561, 2566, 2567, 2571, 2586, 2591, 2612, 2613, 2615, 2623, 2624, 2626, 2632, 2642, 2646, 2680, 2687, 2703, 2735, 2791, 2793, 2797, 2802, 2812, 2819, 2827, 2838, 2847, 2849, 2856, 2868, 2872, 2882, 2892, 2895, 2900, 2912, 2915, 2921, 2924, 2927, 2928, 2929, 2932, 2935, 2937, 2943, 2947, 2959, 2962, 2984, 2985, 3017, 3022, 3029, 3044, 3049, 3052, 3053, 3055, 3056, 3068, 3077, 3080, 3083, 3088, 3106, 3108, 3113, 3114, 3124, 3125, 3159, 3168, 3174, 3178, 3179, 3190, 3204, 3209, 3213, 3220, 3225, 3229, 3234, 3290, 3297, 3312, 3327, 3329, 3408, 3417, 3419, 3456, 3462, 3467, 3468, 3470, 3474, 3477, 3479, 3481, 3484, 3490, 3495, 3498, 3504, 3522, 3532, 3537, 3539, 3540, 3542, 3555, 3561, 3563, 3566, 3570, 3571, 3576, 3590, 3601, 3607, 3613, 3627, 3709, 3710, 3714, 3719, 3723, 3728, 3731, 3733, 3743, 3753, 3794, 3804, 3805, 3807, 3842, 3843, 3851, 3854, 3858, 3865, 3875, 3893, 3896, 3901, 3902, 3908, 3926
);
for (Integer integer : integers) {
RouteOrder routeOrder = routeRepository.queryById(Long.valueOf(integer));
lyOrderSyncAdapter.syncSupplierOrder(routeOrder);
}
}
@Test
void syncToSupplierOne(){
RouteOrder routeOrder = routeRepository.queryById(665L);
lyOrderSyncAdapter.syncSupplierOrder(routeOrder);
}
@Test
void queryHotelCustom(){
OrderDetail byId = orderDetailRepository.findById(2569L);
HotelOrderDetailDto hotelOrderDetailDto = HotelOrderDetailDto.copyFrom(byId.getHotelOrderDetail());
System.out.println(hotelOrderDetailDto);
}
}

View File

@ -1,8 +1,9 @@
package com.chint;
import cn.hutool.extra.pinyin.PinyinUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.chint.application.in.RankController;
import com.chint.application.out.LoginController;
import com.chint.application.services.login.strategy.PailaLoginStrategy;
import com.chint.domain.aggregates.location.basedata.CountryLevelInfoEntity;
@ -13,9 +14,13 @@ import com.chint.domain.aggregates.order.RouteOrder;
import com.chint.domain.aggregates.user.User;
import com.chint.domain.repository.*;
import com.chint.domain.service.JTCompanyDomainService;
import com.chint.domain.value_object.RanksData;
import com.chint.infrastructure.util.Digest;
import com.chint.infrastructure.util.PinyinUtil;
import com.chint.interfaces.rest.base.PostRequest;
import com.chint.interfaces.rest.ctrip.CTripAirportRequest;
import com.chint.interfaces.rest.ctrip.CTripUserSaveRequest;
import com.chint.interfaces.rest.ctrip.dto.airport.AirportSearchResponse;
import com.chint.interfaces.rest.ctrip.dto.put.CTripStatusNotification;
import com.chint.interfaces.rest.ly.LYPostRequest;
import com.chint.interfaces.rest.ly.LYSearchRequest;
@ -44,9 +49,7 @@ import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.stream.Collectors;
import static com.chint.infrastructure.constant.BPMConstant.FSSC;
import static com.chint.infrastructure.constant.LocationConstant.LOCATION_TYPE_CITY;
import static com.chint.infrastructure.constant.LocationConstant.LOCATION_TYPE_COUNTY;
import static com.chint.infrastructure.constant.LocationConstant.*;
@Slf4j
@SpringBootTest
@ -84,6 +87,10 @@ class RouteApplicationTests {
@Autowired
private JTCompanyDomainService jtCompanyDomainService;
@Autowired
private CTripAirportRequest cTripAirportRequest;
@Value("${FSSC.jt-baseUrl}")
private String jtFSSCUrl;
@ -125,6 +132,9 @@ class RouteApplicationTests {
@Autowired
private DistrictInfoRepository districtInfoRepository;
@Autowired
private RankController rankController;
void test3() {
FlyOkDTO freightDTO = new FlyOkDTO();
ParamFly param = new ParamFly();
@ -152,7 +162,6 @@ class RouteApplicationTests {
user.setName("陈光金");
user.setCompanyName("正泰集团股份有限公司");
user.setEmployeeNo("605403");
lyUserRequest.saveCurrentUser(user);
cTripUserSaveRequest.saveUserToCTrip(user);
}
@ -240,7 +249,7 @@ class RouteApplicationTests {
System.out.println(orderInfo.getOrderSerialNo());
}
// @Test
// @Test
void loginSign() {
String sfno = "081001001";
String syscode = "FSSC";
@ -255,7 +264,7 @@ class RouteApplicationTests {
// log.trace("trace");
}
// @Test
// @Test
void loginSignProd() {
String sfno = "081001001";
String syscode = "FSSC";
@ -283,14 +292,14 @@ class RouteApplicationTests {
void handleLocation() {
List<Location> all = locationRepository.findAll();
all.forEach(
location -> {
char c = location.getLocationName().charAt(0);
char firstLetter = PinyinUtil.getFirstLetter(c);
String h3 = String.valueOf(firstLetter).toUpperCase();
location.setFirstPinYin(h3);
}
);
// all.forEach(
// location -> {
// char c = location.getLocationName().charAt(0);
// char firstLetter = PinyinUtil.getFirstLetter(c);
// String h3 = String.valueOf(firstLetter).toUpperCase();
// location.setFirstPinYin(h3);
// }
// );
locationRepository.saveAll(all);
}
@ -300,9 +309,9 @@ class RouteApplicationTests {
routeRepository.deleteById(875L);
}
// @Test
@Test
void deleteOrderDetail() {
orderDetailRepository.deleteById(1497L);
orderDetailRepository.deleteById(2609L);
}
// @Test
@ -973,7 +982,7 @@ class RouteApplicationTests {
System.out.println(saveLocations);
}
// @Test
// @Test
void timeTest() {
DateTimeFormatter formatterWithT = DateTimeFormatter.ofPattern("yyyy-MM-dd");
//根据项目需求当传入的时间 使用该时间保存到订单当中
@ -983,18 +992,19 @@ class RouteApplicationTests {
}
// @Test
// @Test
void pushUserInfo() {
pushUser.getUserSFDataFromOpenApiBatch();
}
// @Test
@Test
void deleteByOrderId() {
orderDetailRepository.deleteById(1488L);
orderDetailRepository.deleteById(1489L);
orderDetailRepository.deleteById(1647L);
orderDetailRepository.deleteById(1648L);
}
// @Test
// @Test
void generateLocationEnName() {
List<Location> allLevelThreeAndFour = locationRepository.findAllLevelThreeAndFour();
List<String> unknownCityId = new ArrayList<>();
@ -1002,21 +1012,21 @@ class RouteApplicationTests {
if (location.getLocationEnName() == null) {
//这里的代码来补充地理位置的英文名
Integer level = location.getLevel();
if (level.equals(LOCATION_TYPE_CITY)) {
if (level.equals(LOCATION_LEVEL_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")) {
} else if (level.equals(LOCATION_LEVEL_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)) {
} else if (level.equals(LOCATION_LEVEL_COUNTY)) {
Optional.ofNullable(countryLevelInfoRepository.findByCityId(location.getCityId()))
.ifPresentOrElse(cityInfo -> location.setLocationEnName(cityInfo.getCountyEnName()),
() -> {
@ -1033,8 +1043,108 @@ class RouteApplicationTests {
locationRepository.saveAll(allLevelThreeAndFour);
}
@Test
void generateIfAirport() {
List<Location> airportLocation = new ArrayList<>();
AirportSearchResponse response = cTripAirportRequest.getAirport();
List<AirportSearchResponse.AirportBaseInfo> airportList = response.getAirportList();
for (AirportSearchResponse.AirportBaseInfo airport : airportList) {
Location location = new Location();
location.setLocationType(LOCATION_TYPE_AIRPORT);
location.setLocationName(airport.getName());
location.setLocationShortName(airport.getShortName());
location.setLocationEnName(airport.getCode());
location.setCityId(airport.getCityId());
location.setIsHaveAirport(1);
location.setFirstPinYin(PinyinUtil.getFirstLetter(airport.getName()));
//先去查找父类的城市信息 先找地级市
List<Location> cityList = locationRepository
.findByCityIdAndLocationType(airport.getCityId(), LOCATION_TYPE_CITY);
if (cityList != null && !cityList.isEmpty()) {
Location city = cityList.get(0);
//作为父类信息
location.setLocationPath(city.getLocationPath());
location.setLocationPathName(city.getLocationPathName() + location.getLocationName() + "_");
location.setIsInternal(city.getIsInternal());
location.setParentLocationId(city.getLocationId());
location.setLevel(city.getLevel() + 1);
} else {
//没有再找县级市
List<Location> countyList = locationRepository
.findByCityIdAndLocationType(airport.getCityId(), LOCATION_TYPE_COUNTY);
if (countyList != null && !countyList.isEmpty()) {
Location county = countyList.get(0);
//作为父类信息
location.setLocationPath(county.getLocationPath());
location.setLocationPathName(county.getLocationPathName() + location.getLocationName() + "_");
location.setIsInternal(county.getIsInternal());
location.setParentLocationId(county.getLocationId());
location.setLevel(county.getLevel() + 1);
}
}
if (location.getLocationPath() != null) {
airportLocation.add(location);
}
}
locationRepository.saveAll(airportLocation);
}
// @Test
@Test
void updateCounty() {
List<Location> byLocationType = locationRepository.findByLocationType(5);
for (Location location : byLocationType) {
String locationPath = location.getLocationPath();
String[] split = locationPath.split("_");
location.setLocationPath(split[0] + "_" + split[1] + "_" + split[2] + "_" + split[3] + "_" + location.getLocationId() + "_");
}
locationRepository.saveAll(byLocationType);
}
@Test
void updateAirportPath() {
List<Location> byLocationType = locationRepository.findByLocationType(7);
for (Location location : byLocationType) {
Location location1 = locationRepository.findById(location.getParentLocationId());
location.setLocationPath(location1.getLocationPath() + location.getLocationId() + "_");
}
locationRepository.saveAll(byLocationType);
}
@Test
void generateLocationType() {
List<Location> all = locationRepository.findAll();
all.forEach(it -> {
Integer level = it.getLevel();
if (level == null) {
String locationPathName = it.getLocationPathName();
String[] split = locationPathName.split("_");
int i = split.length - 1;
it.setLevel(i);
level = i;
}
if (level == 1) {
it.setLocationType(LOCATION_TYPE_COUNTRY);
} else if (level == 2) {
it.setLocationType(LOCATION_TYPE_PROVINCE);
} else if (level == 0) {
it.setLocationType(LOCATION_TYPE_CONTINENT);
} else if (level == 3) {
it.setLocationType(LOCATION_TYPE_CITY);
} else if (level == 4) {
if (it.getIsInternal() == 1 && it.getLocationShortName().contains("D")) {
it.setLocationType(LOCATION_TYPE_DISTRICT);
} else {
it.setLocationType(LOCATION_TYPE_COUNTY);
}
}
});
locationRepository.saveAll(all);
}
// @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}
@ -1057,10 +1167,10 @@ class RouteApplicationTests {
}
}
// @Test
void batchPushCTripCar(){
List<String> carOrderNo = List.of("30397695527","30398096043","30398133695","30398135929","30398172920",
"30398235616","30398255836","30398307458","30398307872","30398370192","30398383725","30398385376");
// @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");
@ -1070,4 +1180,30 @@ class RouteApplicationTests {
cTripStatusNotification.setStatusIDs(null);
}
@Test
void addRanks() {
RanksData ranksData = new RanksData();
ranksData.setIndustry("浙江正泰物联技术有限公司");
ranksData.setCompanyCode("A70000059");
for (int i = 1; i < 13; i++) {
if (i <= 2) {
ranksData.setLevel(4);
} else if (i <= 4) {
ranksData.setLevel(3);
} else if (i <= 7) {
ranksData.setLevel(2);
} else {
ranksData.setLevel(1);
}
ranksData.setRankName("P" + i);
rankController.saveRanks(ranksData);
ranksData.setRankName("M" + i);
rankController.saveRanks(ranksData);
ranksData.setRankName("L" + i);
rankController.saveRanks(ranksData);
}
}
}