提交携程结算数据保存代码

This commit is contained in:
lulz1 2024-03-28 17:02:37 +08:00
parent 6e46dd20fd
commit 8eb0c2dfc2
27 changed files with 215 additions and 63 deletions

View File

@ -41,7 +41,7 @@ public class AutoWorkController {
public Result<String> autoSaveCTripRecord() {
cTripOrderRecordAutoSave.saveAll();
//将昨天的结算数据生成为财务共享需要的数据
Command.of(OrderRecordGenerateCommand.class).sendToQueue();
// Command.of(OrderRecordGenerateCommand.class).sendToQueue();
return Result.Success(SUCCESS);
}

View File

@ -1,5 +1,6 @@
package com.chint.domain.aggregates.order.order_record.ctrip_order_record;
import com.chint.infrastructure.util.DateTimeUtil;
import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.relational.core.mapping.MappedCollection;
@ -7,6 +8,7 @@ import org.springframework.data.relational.core.mapping.Table;
import java.io.Serial;
import java.io.Serializable;
import java.time.LocalDateTime;
@Data
@Table("c_trip_car_record")
@ -16,6 +18,8 @@ public class CTripCarRecord implements Serializable {
@Id
private Long id;
private String recordId;
private LocalDateTime createTime;
private String routeOrderNo;
@MappedCollection(idColumn = "c_trip_car_record_id")
private CTripCarRecordBase cTripCarRecordBase;
@MappedCollection(idColumn = "c_trip_car_record_id")
@ -26,6 +30,7 @@ public class CTripCarRecord implements Serializable {
cTripCarRecord.setCTripCarQuickInfo(cTripCarQuickInfo);
cTripCarRecord.setCTripCarRecordBase(cTripCarRecordBase);
cTripCarRecord.setRecordId(String.valueOf(cTripCarRecordBase.getRecordId()));
cTripCarRecord.setCreateTime(DateTimeUtil.strToTime(cTripCarRecordBase.getCreateTime()));
return cTripCarRecord;
}
}

View File

@ -43,7 +43,7 @@ public class CTripCarRecordBase implements Serializable {
private Double expressFee;
private Integer orderType;
private String subAccCheckBatchNo;
private Long tripId;
private String tripId;
private String settlementCurrency;
private Double postServiceFee;
private Double realAmountHasPost;
@ -94,7 +94,7 @@ public class CTripCarRecordBase implements Serializable {
ctripCarOrderDetail.setExpressFee(carOrderSettlementBaseInfo.getExpressFee());
ctripCarOrderDetail.setOrderType(carOrderSettlementBaseInfo.getOrderType());
ctripCarOrderDetail.setSubAccCheckBatchNo(carOrderSettlementBaseInfo.getSubAccCheckBatchNo());
ctripCarOrderDetail.setTripId(carOrderSettlementBaseInfo.getTripID());
ctripCarOrderDetail.setTripId( carOrderSettlementBaseInfo.getTripID());
ctripCarOrderDetail.setSettlementCurrency(carOrderSettlementBaseInfo.getSettlementCurrency());
ctripCarOrderDetail.setPostServiceFee(carOrderSettlementBaseInfo.getPostServiceFee());
ctripCarOrderDetail.setRealAmountHasPost(carOrderSettlementBaseInfo.getRealAmountHasPost());

View File

@ -1,16 +1,21 @@
package com.chint.domain.aggregates.order.order_record.ctrip_order_record;
import com.chint.infrastructure.util.DateTimeUtil;
import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.relational.core.mapping.MappedCollection;
import org.springframework.data.relational.core.mapping.Table;
import java.time.LocalDateTime;
@Data
@Table("c_trip_flight_record")
public class CTripFlightRecord {
@Id
private Long id;
private String recordId;
public LocalDateTime createTime;
private String routeOrderNo;
@MappedCollection(idColumn = "c_trip_flight_record_id")
private CTripFlightRecordBase cTripFlightRecordBase;
@MappedCollection(idColumn = "c_trip_flight_record_id")
@ -21,6 +26,7 @@ public class CTripFlightRecord {
cTripFlightRecord.setCTripFlightRecordBase(cTripFlightRecordBase);
cTripFlightRecord.setCTripFlightInfo(cTripFlightInfo);
cTripFlightRecord.setRecordId(String.valueOf(cTripFlightRecordBase.getRecordId()));
cTripFlightRecord.setCreateTime(DateTimeUtil.strToTimeMM(cTripFlightRecordBase.getCreateTime()));
return cTripFlightRecord;
}
}

View File

@ -1,7 +1,6 @@
package com.chint.domain.aggregates.order.order_record.ctrip_order_record;
import cn.hutool.core.bean.BeanUtil;
import com.chint.interfaces.rest.ctrip.dto.order.OrderCarResponse;
import com.chint.interfaces.rest.ctrip.dto.order.OrderHotelResponse;
import lombok.Data;
import org.springframework.data.annotation.Id;
@ -23,7 +22,7 @@ public class CTripHotelInfo implements Serializable {
private String CityName;
private String CityNameEN;
private Integer Star;
private boolean IsDomestic;
private Integer IsDomestic;
private String ISCU;
private Integer CityID;
private String DistrictCode;
@ -37,6 +36,8 @@ public class CTripHotelInfo implements Serializable {
private String HotelGroupName;
public static CTripHotelInfo of(OrderHotelResponse.SettlementHotelDetail data) {
return BeanUtil.copyProperties(data, CTripHotelInfo.class);
CTripHotelInfo cTripHotelInfo = BeanUtil.copyProperties(data, CTripHotelInfo.class);
cTripHotelInfo.setIsDomestic(data.isIsDomestic() ? 1 : 0);
return cTripHotelInfo;
}
}

View File

@ -1,16 +1,21 @@
package com.chint.domain.aggregates.order.order_record.ctrip_order_record;
import com.chint.infrastructure.util.DateTimeUtil;
import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.relational.core.mapping.MappedCollection;
import org.springframework.data.relational.core.mapping.Table;
import java.time.LocalDateTime;
@Data
@Table("c_trip_flight_record")
@Table("c_trip_hotel_record")
public class CTripHotelRecord {
@Id
private Long id;
private String recordId;
private LocalDateTime createTime;
private String routeOrderNo;
@MappedCollection(idColumn = "c_trip_hotel_record_id")
private CTripHotelRecordBase cTripHotelRecordBase;
@MappedCollection(idColumn = "c_trip_hotel_record_id")
@ -21,6 +26,7 @@ public class CTripHotelRecord {
cTripHotelRecord.setRecordId(String.valueOf(cTripHotelRecordBase.getRecordId()));
cTripHotelRecord.setCTripHotelRecordBase(cTripHotelRecordBase);
cTripHotelRecord.setCTripHotelInfo(cTripHotelInfo);
cTripHotelRecord.setCreateTime(DateTimeUtil.strToTimeMM(cTripHotelRecordBase.getCreateTime()));
return cTripHotelRecord;
}
}

View File

@ -7,7 +7,6 @@ import org.springframework.data.relational.core.mapping.Table;
import java.io.Serial;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* @author wanglf3
@ -41,7 +40,7 @@ public class CTripHotelRecordBase implements Serializable {
private String subAccCheckBatchNo;
private Long tripId;
private String settlementCurrency;
private Boolean isChecked;
private Integer isChecked;
private String dailyAvgPriceInfo;
private String invoiceIds;
private String batchStartDate;
@ -58,16 +57,16 @@ public class CTripHotelRecordBase implements Serializable {
private String employeeId;
private Double insuranceAmount;
private Double personAmount;
private BigDecimal channelFee;
private BigDecimal personalChannelFee;
private BigDecimal paidAmount;
private BigDecimal personalTotalAmount;
private BigDecimal personalRemittedTax;
private BigDecimal bookServiceFee;
private BigDecimal modifyServiceFee;
private BigDecimal cancelServiceFee;
private BigDecimal payDiscountAmount;
private BigDecimal averageRoomPrice;
private String channelFee;
private String personalChannelFee;
private String paidAmount;
private String personalTotalAmount;
private String personalRemittedTax;
private String bookServiceFee;
private String modifyServiceFee;
private String cancelServiceFee;
private String payDiscountAmount;
private String averageRoomPrice;
public static CTripHotelRecordBase changeInfo(OrderHotelResponse.SettlementDetail SettlementDetail) {
@ -91,7 +90,7 @@ public class CTripHotelRecordBase implements Serializable {
ctripHotelOrderDetail.setSubAccCheckBatchNo(SettlementDetail.getSubAccCheckBatchNo());
ctripHotelOrderDetail.setTripId(SettlementDetail.getTripID());
ctripHotelOrderDetail.setSettlementCurrency(SettlementDetail.getSettlementCurrency());
ctripHotelOrderDetail.setIsChecked(SettlementDetail.isIsChecked());
ctripHotelOrderDetail.setIsChecked(SettlementDetail.isIsChecked() ? 1 : 0);
// ctripHotelOrderDetailis.setDailyAvgPriceInfo(SettlementDetail.getDailyAvgPriceInfo());
// ctripHotelOrderDetailis.setInvoiceIds(SettlementDetail.getInvoiceIds());
ctripHotelOrderDetail.setBatchStartDate(SettlementDetail.getBatchStartDate());
@ -108,16 +107,16 @@ public class CTripHotelRecordBase implements Serializable {
ctripHotelOrderDetail.setEmployeeId(SettlementDetail.getEmployeeID());
ctripHotelOrderDetail.setInsuranceAmount(SettlementDetail.getInsuranceAmount());
ctripHotelOrderDetail.setPersonAmount(SettlementDetail.getPersonAmount());
ctripHotelOrderDetail.setChannelFee(SettlementDetail.getChannelFee());
ctripHotelOrderDetail.setPersonalChannelFee(SettlementDetail.getPersonalChannelFee());
ctripHotelOrderDetail.setPaidAmount(SettlementDetail.getPaidAmount());
ctripHotelOrderDetail.setPersonalTotalAmount(SettlementDetail.getPersonalTotalAmount());
ctripHotelOrderDetail.setPersonalRemittedTax(SettlementDetail.getPersonalRemittedTax());
ctripHotelOrderDetail.setBookServiceFee(SettlementDetail.getBookServiceFee());
ctripHotelOrderDetail.setModifyServiceFee(SettlementDetail.getModifyServiceFee());
ctripHotelOrderDetail.setCancelServiceFee(SettlementDetail.getCancelServiceFee());
ctripHotelOrderDetail.setPayDiscountAmount(SettlementDetail.getPayDiscountAmount());
ctripHotelOrderDetail.setAverageRoomPrice(SettlementDetail.getAverageRoomPrice());
ctripHotelOrderDetail.setChannelFee(String.valueOf(SettlementDetail.getChannelFee()));
ctripHotelOrderDetail.setPersonalChannelFee(String.valueOf(SettlementDetail.getPersonalChannelFee()));
ctripHotelOrderDetail.setPaidAmount(String.valueOf(SettlementDetail.getPaidAmount()));
ctripHotelOrderDetail.setPersonalTotalAmount(String.valueOf(SettlementDetail.getPersonalTotalAmount()));
ctripHotelOrderDetail.setPersonalRemittedTax(String.valueOf(SettlementDetail.getPersonalRemittedTax()));
ctripHotelOrderDetail.setBookServiceFee(String.valueOf(SettlementDetail.getBookServiceFee()));
ctripHotelOrderDetail.setModifyServiceFee(String.valueOf(SettlementDetail.getModifyServiceFee()));
ctripHotelOrderDetail.setCancelServiceFee(String.valueOf(SettlementDetail.getCancelServiceFee()));
ctripHotelOrderDetail.setPayDiscountAmount(String.valueOf(SettlementDetail.getPayDiscountAmount()));
ctripHotelOrderDetail.setAverageRoomPrice(String.valueOf(SettlementDetail.getAverageRoomPrice()));
return ctripHotelOrderDetail;
}
}

View File

@ -1,5 +1,6 @@
package com.chint.domain.aggregates.order.order_record.ctrip_order_record;
import com.chint.infrastructure.util.DateTimeUtil;
import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.relational.core.mapping.MappedCollection;
@ -7,6 +8,7 @@ import org.springframework.data.relational.core.mapping.Table;
import java.io.Serial;
import java.io.Serializable;
import java.time.LocalDateTime;
@Data
@Table("c_trip_train_record")
@ -16,6 +18,8 @@ public class CTripTrainRecord implements Serializable {
@Id
private Long id;
private String recordId;
private LocalDateTime createTime;
private String routeOrderNo;
@MappedCollection(idColumn = "c_trip_train_record_id")
private CTripTrainRecordBase cTripTrainRecordBase;
@MappedCollection(idColumn = "c_trip_train_record_id")
@ -26,6 +30,7 @@ public class CTripTrainRecord implements Serializable {
cTripTrainRecord.setRecordId(String.valueOf(cTripTrainRecordBase.getRecordId()));
cTripTrainRecord.setCTripTrainRecordBase(cTripTrainRecordBase);
cTripTrainRecord.setCTripTrainInfo(cTripTrainInfo);
cTripTrainRecord.setCreateTime(DateTimeUtil.strToTimeMM(cTripTrainRecordBase.getCreateTime()));
return cTripTrainRecord;
}
}

View File

@ -8,6 +8,7 @@ import com.chint.domain.aggregates.order.order_record.OrderCarRecord;
import com.chint.domain.aggregates.order.order_record.OrderFlightRecord;
import com.chint.domain.aggregates.order.order_record.OrderHotelRecord;
import com.chint.domain.aggregates.order.order_record.OrderTrainRecord;
import com.chint.domain.aggregates.order.order_record.ctrip_order_record.CTripCarRecord;
import com.chint.domain.service.OrderDetailDomainService;
import com.chint.infrastructure.repository.jdbc.JdbcCtripHotelOrderDetailRepository;
import org.springframework.beans.factory.annotation.Autowired;
@ -23,7 +24,7 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFa
@Override
public OrderCarRecord createCarOrderRecord(Object orderCarRecordData) {
CTripCarRecord orderCarRecord = (CTripCarRecord) orderCarRecordData;
return null;
}

View File

@ -35,10 +35,10 @@ public class RanksFactoryImpl implements RanksFactory {
Integer level = ranksData.getLevel();
ranks.setStandardLevel(
switch (level) {
case 1 -> prefix + RankConstant.STANDARD_LEVEL_ONE;
case 2 -> prefix + RankConstant.STANDARD_LEVEL_TWO;
case 3 -> prefix + RankConstant.STANDARD_LEVEL_THREE;
case 4 -> prefix + RankConstant.STANDARD_LEVEL_FOUR;
case 1 -> prefix + STANDARD_LEVEL_ONE_COMMON;
case 2 -> prefix + STANDARD_LEVEL_TWO_COMMON;
case 3 -> prefix + STANDARD_LEVEL_THREE_COMMON;
case 4 -> prefix + STANDARD_LEVEL_FOUR_COMMON;
default -> throw new NotFoundException(CommonMessageConstant.NOT_FOUND);
}
);

View File

@ -38,7 +38,13 @@ public interface CTripOrderDetailRepository {
CTripCarRecordBase findCarByRecordId(Long id);
void saveAllCTripFlightRecord(List<CTripFlightRecord> cTripFlightRecordList);
CTripFlightRecord findFlightRecordById(Long id);
CTripFlightRecord findFlightRecordByRecordId(String recordId);
void saveAllCTripHotelRecord(List<CTripHotelRecord> cTripHotelRecordList);
CTripHotelRecord findHotelRecordById(Long id);
CTripHotelRecord findHotelRecordByRecordId(String recordId);
void saveAllCTripTrainRecord(List<CTripTrainRecord> cTripTrainRecordList);
CTripTrainRecord findTrainRecordByRecordId(String recordId);
void saveAllCTripCarRecord(List<CTripCarRecord> cTripCarRecordList);
CTripCarRecord findCarRecordByRecordId(String recordId);
}

View File

@ -9,4 +9,6 @@ public interface CompanyBlackListRepository {
CompanyBlackList findByCompanyName(String companyName);
List<CompanyBlackList> findAll();
Boolean ifInCompanyList(String companyName);
}

View File

@ -6,4 +6,6 @@ import java.util.List;
public interface OrderFlightRecordRepository {
List<OrderFlightRecord> saveAll(List<OrderFlightRecord> orderFlightRecordList);
}

View File

@ -113,7 +113,6 @@ public class OrderDomainService {
@Autowired
private JdbcLegRepository jdbcLegRepository;
private Set<String> companyBlackList = new HashSet<>();
public RouteOrder saveOrder(RouteOrder routeOrder) {
@ -130,7 +129,7 @@ public class OrderDomainService {
}
public boolean checkCompanyNameIfBlack(String companyName) {
if (companyBlackList.contains(companyName)) {
if (companyBlackListRepository.ifInCompanyList(companyName)) {
throw new OrderException(COMPANY_NAME_IN_BLACK_LIST);
} else {
return true;
@ -197,6 +196,16 @@ public class OrderDomainService {
ApprovalSimpleData data = command.getData();
Optional.ofNullable(routeRepository.findByActualOrderNoAndSysCode(data.getActualOrderNo(), data.getSysCode()))
.ifPresentOrElse(route -> {
//保存提交审批所提供的资料
ApproveOrderNo approveOrderNo = route.getApproveOrderNo();
approveOrderNo.setActualOrderNo(data.getActualOrderNo());
approveOrderNo.setInstructions(data.getInstructions());
approveOrderNo.setCreator(data.getCreator());
approveOrderNo.setAccountCompanyName(data.getAccountCompany());
approveOrderNo.setAccountCompanyCode(data.getAccountCompanyCode());
approveOrderNo.setProjectName(data.getProjectName());
approveOrderNo.setCostCenter(data.getCostCenter());
LegEvent legEvent = legEventFactory.creatLegEvent(command.getLegEventType());
route.getLegItems().forEach(leg -> leg.addEvent(legEvent));
ApprovalEvent approvalEvent = routeOrderFactory.createApprovalEvent(APPROVAL_EVENT_ING);

View File

@ -114,6 +114,7 @@ public class LegEventHandler implements LegEventService {
approveOrderNo.setActualOrderNo(data.getActualOrderNo());
approveOrderNo.setInstructions(data.getInstructions());
approveOrderNo.setCreator(data.getCreator());
approveOrderNo.setAccountCompanyName(data.getAccountCompany());
approveOrderNo.setAccountCompanyCode(data.getAccountCompanyCode());
approveOrderNo.setProjectName(data.getProjectName());
approveOrderNo.setCostCenter(data.getCostCenter());

View File

@ -28,6 +28,7 @@ import java.util.stream.Collectors;
import static com.chint.infrastructure.constant.LegConstant.*;
import static com.chint.infrastructure.constant.LocationConstant.LOCATION_LEVEL_COUNTY;
import static com.chint.infrastructure.constant.LocationConstant.LOCATION_TYPE_DISTRICT;
@Slf4j
@Component
@ -198,7 +199,13 @@ public class CTripOrderSyncAdapter implements SupplierOrderSync {
}
locationRepository.saveAll(List.of(location));
}
//这里的逻辑需要修改
// 如果是县级市的话 取CItyId
// 如果是区的话 要查找地级市 取地级市的Id
// 如果是地级市的话 直接取地级市的ID
if (location.getLocationType().equals(LOCATION_TYPE_DISTRICT)) {
return locationRepository.findById(location.getParentLocationId());
}
return location;
}
}

View File

@ -29,6 +29,12 @@ public class RankConstant {
public static final String ALTER_APPLY = "3";//变更
//集团差标等级
public static final String STANDARD_LEVEL_ONE_COMMON = "STANDARD_LEVEL_ONE";//差标1
public static final String STANDARD_LEVEL_TWO_COMMON = "STANDARD_LEVEL_TWO";//差标2
public static final String STANDARD_LEVEL_THREE_COMMON = "STANDARD_LEVEL_THREE";//差标3
public static final String STANDARD_LEVEL_FOUR_COMMON = "STANDARD_LEVEL_FOUR";//差标4
//集团差标等级
public static final String STANDARD_LEVEL_ONE = "JT_STANDARD_LEVEL_ONE";//差标1
public static final String STANDARD_LEVEL_TWO = "JT_STANDARD_LEVEL_TWO";//差标2

View File

@ -119,20 +119,50 @@ public class CTripOrderDetailImpl implements CTripOrderDetailRepository {
jdbcCTripFlightRecordRepository.saveAll(cTripFlightRecordList);
}
@Override
public CTripFlightRecord findFlightRecordById(Long id) {
return jdbcCTripFlightRecordRepository.findById(id).get();
}
@Override
public CTripFlightRecord findFlightRecordByRecordId(String recordId) {
return jdbcCTripFlightRecordRepository.findByRecordId(recordId);
}
@Override
public void saveAllCTripHotelRecord(List<CTripHotelRecord> cTripHotelRecordList) {
jdbcCTripHotelRecordRepository.saveAll(cTripHotelRecordList);
}
@Override
public CTripHotelRecord findHotelRecordById(Long id) {
return jdbcCTripHotelRecordRepository.findById(id).get();
}
@Override
public CTripHotelRecord findHotelRecordByRecordId(String recordId) {
return jdbcCTripHotelRecordRepository.findByRecordId(recordId);
}
@Override
public void saveAllCTripTrainRecord(List<CTripTrainRecord> cTripTrainRecordList) {
jdbcCTripTrainRecordRepository.saveAll(cTripTrainRecordList);
}
@Override
public CTripTrainRecord findTrainRecordByRecordId(String recordId) {
return jdbcCTripTrainRecordRepository.findByRecordId(recordId);
}
@Override
public void saveAllCTripCarRecord(List<CTripCarRecord> cTripCarRecordList) {
jdbcCTripCarRecordRepository.saveAll(cTripCarRecordList);
}
@Override
public CTripCarRecord findCarRecordByRecordId(String recordId) {
return jdbcCTripCarRecordRepository.findByRecordId(recordId);
}
//
// @Override
// public Client findByClientId(String clientId){

View File

@ -4,6 +4,7 @@ import com.chint.domain.aggregates.system.CompanyBlackList;
import com.chint.domain.repository.CompanyBlackListRepository;
import com.chint.infrastructure.repository.jdbc.JdbcCompanyBlackListRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Repository;
import java.util.ArrayList;
@ -20,6 +21,7 @@ public class CompanyBlackListRepositoryImpl implements CompanyBlackListRepositor
return jdbcCompanyBlackListRepository.findByCompanyName(companyName);
}
@Cacheable(value = "CompanyBlack")
@Override
public List<CompanyBlackList> findAll() {
List<CompanyBlackList> all = new ArrayList<>();
@ -28,4 +30,11 @@ public class CompanyBlackListRepositoryImpl implements CompanyBlackListRepositor
);
return all;
}
@Cacheable(value = "CompanyBlack", key = "#companyName")
@Override
public Boolean ifInCompanyList(String companyName) {
CompanyBlackList byCompanyName = jdbcCompanyBlackListRepository.findByCompanyName(companyName);
return byCompanyName != null;
}
}

View File

@ -21,4 +21,6 @@ public class OrderFlightRecordRepositoryImpl implements OrderFlightRecordReposit
jdbcOrderFlightRecordRepository.saveAll(orderFlightRecordList).forEach(res::add);
return res;
}
}

View File

@ -8,4 +8,5 @@ import org.springframework.stereotype.Repository;
@Repository
public interface JdbcCTripCarRecordRepository extends CrudRepository<CTripCarRecord,Long> {
CTripCarRecord findByRecordId(String recordId);
}

View File

@ -6,4 +6,6 @@ import org.springframework.stereotype.Repository;
@Repository
public interface JdbcCTripFlightRecordRepository extends CrudRepository<CTripFlightRecord,Long> {
CTripFlightRecord findByRecordId(String recordId);
}

View File

@ -7,4 +7,5 @@ import org.springframework.stereotype.Repository;
@Repository
public interface JdbcCTripHotelRecordRepository extends CrudRepository<CTripHotelRecord,Long> {
CTripHotelRecord findByRecordId(String recordId);
}

View File

@ -7,4 +7,5 @@ import org.springframework.stereotype.Repository;
@Repository
public interface JdbcCTripTrainRecordRepository extends CrudRepository<CTripTrainRecord,Long> {
CTripTrainRecord findByRecordId(String recordId);
}

View File

@ -5,8 +5,21 @@ import java.time.format.DateTimeFormatter;
public class DateTimeUtil {
private final static DateTimeFormatter formatterMM = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSS");
private final static DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
private final static DateTimeFormatter formatterDate = DateTimeFormatter.ofPattern("yyyy-MM-dd");
public static String timeToStr(LocalDateTime input) {
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
return input.format(formatter);
return input.format(formatterDate);
}
public static LocalDateTime strToTime(String input) {
return LocalDateTime.parse(input.substring(0, 19), formatter);
}
public static LocalDateTime strToTimeMM(String input) {
return LocalDateTime.parse(input.substring(0, 23), formatterMM);
}
}

View File

@ -30,6 +30,7 @@ public class OrderCarResponse {
public static class ResponseStatus {
private String Message;
private Boolean Success;
private Integer ErrorCode;
}
@ -57,7 +58,7 @@ public class OrderCarResponse {
private double ExpressFee;
private int OrderType;
private String SubAccCheckBatchNo;
private long TripID;
private String TripID;
private String SettlementCurrency;
private double PostServiceFee;
private double RealAmountHasPost;
@ -122,7 +123,7 @@ public class OrderCarResponse {
private String ReachTravel;
private String ServerFrom;
private double ServiceFee;
private long TripID;
private String TripID;
private String Uid;
private String UserName;
private String PreEmployeeID;
@ -142,7 +143,7 @@ public class OrderCarResponse {
}
@Data
public static class CarOrderCorpInfo {
private long CorpId;
private String CorpId;
private String CorpName;
private int AccountId;
private int SubAccountId;

View File

@ -38,12 +38,23 @@ public class CTripOrderRecordAutoSave {
List<CTripFlightRecord> cTripFlightRecords = flightOrderAccountSettlementList
.stream()
.flatMap(it -> it.getOrderSettlementList().stream())
.map(it -> CTripFlightRecord.of(
.map(it -> {
//对数据库进行查找 如果发现已经存在 就使用查找出来的
OrderFlightResponse.FlightOrderSettlementBaseInfo orderSettlementBaseInfo = it.getOrderSettlementBaseInfo();
CTripFlightRecord record = cTripOrderDetailRepository.findFlightRecordByRecordId(
String.valueOf(orderSettlementBaseInfo.getRecordID()));
if (record == null) {
record = CTripFlightRecord.of(
CTripFlightRecordBase.changeInfo(
it.getOrderSettlementBaseInfo()
orderSettlementBaseInfo
), CTripFlightInfo.of(it.getOrderFlightInfo())
))
.toList();
);
}
//补充额外的字段
OrderFlightResponse.FlightOrderBaseInfo orderBaseInfo = it.getOrderBaseInfo();
record.setRouteOrderNo(orderBaseInfo.getJourneyID());
return record;
}).toList();
cTripOrderDetailRepository.saveAllCTripFlightRecord(cTripFlightRecords);
}
}
@ -55,11 +66,19 @@ public class CTripOrderRecordAutoSave {
if (lstHtlSettlement != null && !lstHtlSettlement.isEmpty()) {
List<CTripHotelRecord> list = lstHtlSettlement.stream()
.flatMap(it -> it.getLstHotelSettlementDetail().stream())
.map(it ->
CTripHotelRecord.of(CTripHotelRecordBase.changeInfo(it.getSettlementDetail()),
CTripHotelInfo.of(it.getHotelDetail()))
)
.toList();
.map(it -> {
OrderHotelResponse.SettlementDetail settlementDetail = it.getSettlementDetail();
CTripHotelRecord record = cTripOrderDetailRepository.findHotelRecordByRecordId(
String.valueOf(settlementDetail.getRecordId()));
if (record == null) {
record = CTripHotelRecord.of(CTripHotelRecordBase.changeInfo(settlementDetail),
CTripHotelInfo.of(it.getHotelDetail()));
}
//补充额外的字段
OrderHotelResponse.SettlementOrderDetail orderDetail = it.getOrderDetail();
record.setRecordId(orderDetail.getHotelRelatedJourneyNo());
return record;
}).toList();
cTripOrderDetailRepository.saveAllCTripHotelRecord(list);
}
}
@ -71,11 +90,18 @@ public class CTripOrderRecordAutoSave {
if (lstTrainSettlement != null && !lstTrainSettlement.isEmpty()) {
List<CTripTrainRecord> list = lstTrainSettlement.stream()
.flatMap(it -> it.getLstTrainSettlementDetail().stream())
.map(it ->
CTripTrainRecord.of(CTripTrainRecordBase.changeInfo(it.getTrainSettlementDetail()),
CTripTrainInfo.of(it.getTrainSettlementTicket()))
)
.toList();
.map(it -> {
OrderTrainResponse.CorpTrainSettlementDetail trainSettlementDetail = it.getTrainSettlementDetail();
CTripTrainRecord record = cTripOrderDetailRepository.findTrainRecordByRecordId(
String.valueOf(trainSettlementDetail.getRecordID()));
if (record == null) {
record = CTripTrainRecord.of(CTripTrainRecordBase.changeInfo(trainSettlementDetail),
CTripTrainInfo.of(it.getTrainSettlementTicket()));
}
//补充额外的字段
record.setRouteOrderNo(it.getTrainSettlementOrder().getJouneryID());
return record;
}).toList();
cTripOrderDetailRepository.saveAllCTripTrainRecord(list);
}
}
@ -86,10 +112,20 @@ public class CTripOrderRecordAutoSave {
if (settlementList != null && !settlementList.isEmpty()) {
List<CTripCarRecord> list = settlementList.stream()
.flatMap(it -> it.getCarSettlementDetailList().stream())
.map(it -> CTripCarRecord.of(
CTripCarRecordBase.changeInfo(it.getSettlementBaseInfo()),
CTripCarQuickInfo.of(it.getOrderDetail().getQuickProductInfo())))
.toList();
.map(it -> {
OrderCarResponse.CarOrderSettlementBaseInfo settlementBaseInfo = it.getSettlementBaseInfo();
CTripCarRecord record = cTripOrderDetailRepository.findCarRecordByRecordId(
String.valueOf(settlementBaseInfo.getRecordId()));
if (record == null) {
record = CTripCarRecord.of(
CTripCarRecordBase.changeInfo(settlementBaseInfo),
CTripCarQuickInfo.of(it.getOrderDetail().getQuickProductInfo()));
}
//补充额外的字段
OrderCarResponse.CarOrderCorpInfo corpInfo = it.getOrderDetail().getCorpInfo();
record.setRouteOrderNo(corpInfo.getJouneryId());
return record;
}).toList();
cTripOrderDetailRepository.saveAllCTripCarRecord(list);
}
}