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

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

View File

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

View File

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

View File

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

View File

@ -1,7 +1,6 @@
package com.chint.domain.aggregates.order.order_record.ctrip_order_record; package com.chint.domain.aggregates.order.order_record.ctrip_order_record;
import cn.hutool.core.bean.BeanUtil; 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 com.chint.interfaces.rest.ctrip.dto.order.OrderHotelResponse;
import lombok.Data; import lombok.Data;
import org.springframework.data.annotation.Id; import org.springframework.data.annotation.Id;
@ -23,7 +22,7 @@ public class CTripHotelInfo implements Serializable {
private String CityName; private String CityName;
private String CityNameEN; private String CityNameEN;
private Integer Star; private Integer Star;
private boolean IsDomestic; private Integer IsDomestic;
private String ISCU; private String ISCU;
private Integer CityID; private Integer CityID;
private String DistrictCode; private String DistrictCode;
@ -37,6 +36,8 @@ public class CTripHotelInfo implements Serializable {
private String HotelGroupName; private String HotelGroupName;
public static CTripHotelInfo of(OrderHotelResponse.SettlementHotelDetail data) { 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; package com.chint.domain.aggregates.order.order_record.ctrip_order_record;
import com.chint.infrastructure.util.DateTimeUtil;
import lombok.Data; import lombok.Data;
import org.springframework.data.annotation.Id; import org.springframework.data.annotation.Id;
import org.springframework.data.relational.core.mapping.MappedCollection; import org.springframework.data.relational.core.mapping.MappedCollection;
import org.springframework.data.relational.core.mapping.Table; import org.springframework.data.relational.core.mapping.Table;
import java.time.LocalDateTime;
@Data @Data
@Table("c_trip_flight_record") @Table("c_trip_hotel_record")
public class CTripHotelRecord { public class CTripHotelRecord {
@Id @Id
private Long id; private Long id;
private String recordId; private String recordId;
private LocalDateTime createTime;
private String routeOrderNo;
@MappedCollection(idColumn = "c_trip_hotel_record_id") @MappedCollection(idColumn = "c_trip_hotel_record_id")
private CTripHotelRecordBase cTripHotelRecordBase; private CTripHotelRecordBase cTripHotelRecordBase;
@MappedCollection(idColumn = "c_trip_hotel_record_id") @MappedCollection(idColumn = "c_trip_hotel_record_id")
@ -21,6 +26,7 @@ public class CTripHotelRecord {
cTripHotelRecord.setRecordId(String.valueOf(cTripHotelRecordBase.getRecordId())); cTripHotelRecord.setRecordId(String.valueOf(cTripHotelRecordBase.getRecordId()));
cTripHotelRecord.setCTripHotelRecordBase(cTripHotelRecordBase); cTripHotelRecord.setCTripHotelRecordBase(cTripHotelRecordBase);
cTripHotelRecord.setCTripHotelInfo(cTripHotelInfo); cTripHotelRecord.setCTripHotelInfo(cTripHotelInfo);
cTripHotelRecord.setCreateTime(DateTimeUtil.strToTimeMM(cTripHotelRecordBase.getCreateTime()));
return cTripHotelRecord; return cTripHotelRecord;
} }
} }

View File

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

View File

@ -1,5 +1,6 @@
package com.chint.domain.aggregates.order.order_record.ctrip_order_record; package com.chint.domain.aggregates.order.order_record.ctrip_order_record;
import com.chint.infrastructure.util.DateTimeUtil;
import lombok.Data; import lombok.Data;
import org.springframework.data.annotation.Id; import org.springframework.data.annotation.Id;
import org.springframework.data.relational.core.mapping.MappedCollection; 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.Serial;
import java.io.Serializable; import java.io.Serializable;
import java.time.LocalDateTime;
@Data @Data
@Table("c_trip_train_record") @Table("c_trip_train_record")
@ -16,6 +18,8 @@ public class CTripTrainRecord implements Serializable {
@Id @Id
private Long id; private Long id;
private String recordId; private String recordId;
private LocalDateTime createTime;
private String routeOrderNo;
@MappedCollection(idColumn = "c_trip_train_record_id") @MappedCollection(idColumn = "c_trip_train_record_id")
private CTripTrainRecordBase cTripTrainRecordBase; private CTripTrainRecordBase cTripTrainRecordBase;
@MappedCollection(idColumn = "c_trip_train_record_id") @MappedCollection(idColumn = "c_trip_train_record_id")
@ -26,6 +30,7 @@ public class CTripTrainRecord implements Serializable {
cTripTrainRecord.setRecordId(String.valueOf(cTripTrainRecordBase.getRecordId())); cTripTrainRecord.setRecordId(String.valueOf(cTripTrainRecordBase.getRecordId()));
cTripTrainRecord.setCTripTrainRecordBase(cTripTrainRecordBase); cTripTrainRecord.setCTripTrainRecordBase(cTripTrainRecordBase);
cTripTrainRecord.setCTripTrainInfo(cTripTrainInfo); cTripTrainRecord.setCTripTrainInfo(cTripTrainInfo);
cTripTrainRecord.setCreateTime(DateTimeUtil.strToTimeMM(cTripTrainRecordBase.getCreateTime()));
return cTripTrainRecord; 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.OrderFlightRecord;
import com.chint.domain.aggregates.order.order_record.OrderHotelRecord; 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.OrderTrainRecord;
import com.chint.domain.aggregates.order.order_record.ctrip_order_record.CTripCarRecord;
import com.chint.domain.service.OrderDetailDomainService; import com.chint.domain.service.OrderDetailDomainService;
import com.chint.infrastructure.repository.jdbc.JdbcCtripHotelOrderDetailRepository; import com.chint.infrastructure.repository.jdbc.JdbcCtripHotelOrderDetailRepository;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -23,7 +24,7 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFa
@Override @Override
public OrderCarRecord createCarOrderRecord(Object orderCarRecordData) { public OrderCarRecord createCarOrderRecord(Object orderCarRecordData) {
CTripCarRecord orderCarRecord = (CTripCarRecord) orderCarRecordData;
return null; return null;
} }

View File

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

View File

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

View File

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

View File

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

View File

@ -113,7 +113,6 @@ public class OrderDomainService {
@Autowired @Autowired
private JdbcLegRepository jdbcLegRepository; private JdbcLegRepository jdbcLegRepository;
private Set<String> companyBlackList = new HashSet<>(); private Set<String> companyBlackList = new HashSet<>();
public RouteOrder saveOrder(RouteOrder routeOrder) { public RouteOrder saveOrder(RouteOrder routeOrder) {
@ -130,7 +129,7 @@ public class OrderDomainService {
} }
public boolean checkCompanyNameIfBlack(String companyName) { public boolean checkCompanyNameIfBlack(String companyName) {
if (companyBlackList.contains(companyName)) { if (companyBlackListRepository.ifInCompanyList(companyName)) {
throw new OrderException(COMPANY_NAME_IN_BLACK_LIST); throw new OrderException(COMPANY_NAME_IN_BLACK_LIST);
} else { } else {
return true; return true;
@ -197,6 +196,16 @@ public class OrderDomainService {
ApprovalSimpleData data = command.getData(); ApprovalSimpleData data = command.getData();
Optional.ofNullable(routeRepository.findByActualOrderNoAndSysCode(data.getActualOrderNo(), data.getSysCode())) Optional.ofNullable(routeRepository.findByActualOrderNoAndSysCode(data.getActualOrderNo(), data.getSysCode()))
.ifPresentOrElse(route -> { .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()); LegEvent legEvent = legEventFactory.creatLegEvent(command.getLegEventType());
route.getLegItems().forEach(leg -> leg.addEvent(legEvent)); route.getLegItems().forEach(leg -> leg.addEvent(legEvent));
ApprovalEvent approvalEvent = routeOrderFactory.createApprovalEvent(APPROVAL_EVENT_ING); ApprovalEvent approvalEvent = routeOrderFactory.createApprovalEvent(APPROVAL_EVENT_ING);

View File

@ -114,6 +114,7 @@ public class LegEventHandler implements LegEventService {
approveOrderNo.setActualOrderNo(data.getActualOrderNo()); approveOrderNo.setActualOrderNo(data.getActualOrderNo());
approveOrderNo.setInstructions(data.getInstructions()); approveOrderNo.setInstructions(data.getInstructions());
approveOrderNo.setCreator(data.getCreator()); approveOrderNo.setCreator(data.getCreator());
approveOrderNo.setAccountCompanyName(data.getAccountCompany());
approveOrderNo.setAccountCompanyCode(data.getAccountCompanyCode()); approveOrderNo.setAccountCompanyCode(data.getAccountCompanyCode());
approveOrderNo.setProjectName(data.getProjectName()); approveOrderNo.setProjectName(data.getProjectName());
approveOrderNo.setCostCenter(data.getCostCenter()); 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.LegConstant.*;
import static com.chint.infrastructure.constant.LocationConstant.LOCATION_LEVEL_COUNTY; import static com.chint.infrastructure.constant.LocationConstant.LOCATION_LEVEL_COUNTY;
import static com.chint.infrastructure.constant.LocationConstant.LOCATION_TYPE_DISTRICT;
@Slf4j @Slf4j
@Component @Component
@ -198,7 +199,13 @@ public class CTripOrderSyncAdapter implements SupplierOrderSync {
} }
locationRepository.saveAll(List.of(location)); locationRepository.saveAll(List.of(location));
} }
//这里的逻辑需要修改
// 如果是县级市的话 取CItyId
// 如果是区的话 要查找地级市 取地级市的Id
// 如果是地级市的话 直接取地级市的ID
if (location.getLocationType().equals(LOCATION_TYPE_DISTRICT)) {
return locationRepository.findById(location.getParentLocationId());
}
return location; return location;
} }
} }

View File

@ -29,6 +29,12 @@ public class RankConstant {
public static final String ALTER_APPLY = "3";//变更 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_ONE = "JT_STANDARD_LEVEL_ONE";//差标1
public static final String STANDARD_LEVEL_TWO = "JT_STANDARD_LEVEL_TWO";//差标2 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); 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 @Override
public void saveAllCTripHotelRecord(List<CTripHotelRecord> cTripHotelRecordList) { public void saveAllCTripHotelRecord(List<CTripHotelRecord> cTripHotelRecordList) {
jdbcCTripHotelRecordRepository.saveAll(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 @Override
public void saveAllCTripTrainRecord(List<CTripTrainRecord> cTripTrainRecordList) { public void saveAllCTripTrainRecord(List<CTripTrainRecord> cTripTrainRecordList) {
jdbcCTripTrainRecordRepository.saveAll(cTripTrainRecordList); jdbcCTripTrainRecordRepository.saveAll(cTripTrainRecordList);
} }
@Override
public CTripTrainRecord findTrainRecordByRecordId(String recordId) {
return jdbcCTripTrainRecordRepository.findByRecordId(recordId);
}
@Override @Override
public void saveAllCTripCarRecord(List<CTripCarRecord> cTripCarRecordList) { public void saveAllCTripCarRecord(List<CTripCarRecord> cTripCarRecordList) {
jdbcCTripCarRecordRepository.saveAll(cTripCarRecordList); jdbcCTripCarRecordRepository.saveAll(cTripCarRecordList);
} }
@Override
public CTripCarRecord findCarRecordByRecordId(String recordId) {
return jdbcCTripCarRecordRepository.findByRecordId(recordId);
}
// //
// @Override // @Override
// public Client findByClientId(String clientId){ // 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.domain.repository.CompanyBlackListRepository;
import com.chint.infrastructure.repository.jdbc.JdbcCompanyBlackListRepository; import com.chint.infrastructure.repository.jdbc.JdbcCompanyBlackListRepository;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import java.util.ArrayList; import java.util.ArrayList;
@ -20,6 +21,7 @@ public class CompanyBlackListRepositoryImpl implements CompanyBlackListRepositor
return jdbcCompanyBlackListRepository.findByCompanyName(companyName); return jdbcCompanyBlackListRepository.findByCompanyName(companyName);
} }
@Cacheable(value = "CompanyBlack")
@Override @Override
public List<CompanyBlackList> findAll() { public List<CompanyBlackList> findAll() {
List<CompanyBlackList> all = new ArrayList<>(); List<CompanyBlackList> all = new ArrayList<>();
@ -28,4 +30,11 @@ public class CompanyBlackListRepositoryImpl implements CompanyBlackListRepositor
); );
return all; 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); jdbcOrderFlightRecordRepository.saveAll(orderFlightRecordList).forEach(res::add);
return res; return res;
} }
} }

View File

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

View File

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

View File

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

View File

@ -7,4 +7,5 @@ import org.springframework.stereotype.Repository;
@Repository @Repository
public interface JdbcCTripTrainRecordRepository extends CrudRepository<CTripTrainRecord,Long> { 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 { 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) { public static String timeToStr(LocalDateTime input) {
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); return input.format(formatterDate);
return input.format(formatter); }
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 { public static class ResponseStatus {
private String Message; private String Message;
private Boolean Success; private Boolean Success;
private Integer ErrorCode;
} }
@ -57,7 +58,7 @@ public class OrderCarResponse {
private double ExpressFee; private double ExpressFee;
private int OrderType; private int OrderType;
private String SubAccCheckBatchNo; private String SubAccCheckBatchNo;
private long TripID; private String TripID;
private String SettlementCurrency; private String SettlementCurrency;
private double PostServiceFee; private double PostServiceFee;
private double RealAmountHasPost; private double RealAmountHasPost;
@ -122,7 +123,7 @@ public class OrderCarResponse {
private String ReachTravel; private String ReachTravel;
private String ServerFrom; private String ServerFrom;
private double ServiceFee; private double ServiceFee;
private long TripID; private String TripID;
private String Uid; private String Uid;
private String UserName; private String UserName;
private String PreEmployeeID; private String PreEmployeeID;
@ -142,7 +143,7 @@ public class OrderCarResponse {
} }
@Data @Data
public static class CarOrderCorpInfo { public static class CarOrderCorpInfo {
private long CorpId; private String CorpId;
private String CorpName; private String CorpName;
private int AccountId; private int AccountId;
private int SubAccountId; private int SubAccountId;

View File

@ -38,12 +38,23 @@ public class CTripOrderRecordAutoSave {
List<CTripFlightRecord> cTripFlightRecords = flightOrderAccountSettlementList List<CTripFlightRecord> cTripFlightRecords = flightOrderAccountSettlementList
.stream() .stream()
.flatMap(it -> it.getOrderSettlementList().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( CTripFlightRecordBase.changeInfo(
it.getOrderSettlementBaseInfo() orderSettlementBaseInfo
), CTripFlightInfo.of(it.getOrderFlightInfo()) ), CTripFlightInfo.of(it.getOrderFlightInfo())
)) );
.toList(); }
//补充额外的字段
OrderFlightResponse.FlightOrderBaseInfo orderBaseInfo = it.getOrderBaseInfo();
record.setRouteOrderNo(orderBaseInfo.getJourneyID());
return record;
}).toList();
cTripOrderDetailRepository.saveAllCTripFlightRecord(cTripFlightRecords); cTripOrderDetailRepository.saveAllCTripFlightRecord(cTripFlightRecords);
} }
} }
@ -55,11 +66,19 @@ public class CTripOrderRecordAutoSave {
if (lstHtlSettlement != null && !lstHtlSettlement.isEmpty()) { if (lstHtlSettlement != null && !lstHtlSettlement.isEmpty()) {
List<CTripHotelRecord> list = lstHtlSettlement.stream() List<CTripHotelRecord> list = lstHtlSettlement.stream()
.flatMap(it -> it.getLstHotelSettlementDetail().stream()) .flatMap(it -> it.getLstHotelSettlementDetail().stream())
.map(it -> .map(it -> {
CTripHotelRecord.of(CTripHotelRecordBase.changeInfo(it.getSettlementDetail()), OrderHotelResponse.SettlementDetail settlementDetail = it.getSettlementDetail();
CTripHotelInfo.of(it.getHotelDetail())) CTripHotelRecord record = cTripOrderDetailRepository.findHotelRecordByRecordId(
) String.valueOf(settlementDetail.getRecordId()));
.toList(); 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); cTripOrderDetailRepository.saveAllCTripHotelRecord(list);
} }
} }
@ -71,11 +90,18 @@ public class CTripOrderRecordAutoSave {
if (lstTrainSettlement != null && !lstTrainSettlement.isEmpty()) { if (lstTrainSettlement != null && !lstTrainSettlement.isEmpty()) {
List<CTripTrainRecord> list = lstTrainSettlement.stream() List<CTripTrainRecord> list = lstTrainSettlement.stream()
.flatMap(it -> it.getLstTrainSettlementDetail().stream()) .flatMap(it -> it.getLstTrainSettlementDetail().stream())
.map(it -> .map(it -> {
CTripTrainRecord.of(CTripTrainRecordBase.changeInfo(it.getTrainSettlementDetail()), OrderTrainResponse.CorpTrainSettlementDetail trainSettlementDetail = it.getTrainSettlementDetail();
CTripTrainInfo.of(it.getTrainSettlementTicket())) CTripTrainRecord record = cTripOrderDetailRepository.findTrainRecordByRecordId(
) String.valueOf(trainSettlementDetail.getRecordID()));
.toList(); if (record == null) {
record = CTripTrainRecord.of(CTripTrainRecordBase.changeInfo(trainSettlementDetail),
CTripTrainInfo.of(it.getTrainSettlementTicket()));
}
//补充额外的字段
record.setRouteOrderNo(it.getTrainSettlementOrder().getJouneryID());
return record;
}).toList();
cTripOrderDetailRepository.saveAllCTripTrainRecord(list); cTripOrderDetailRepository.saveAllCTripTrainRecord(list);
} }
} }
@ -86,10 +112,20 @@ public class CTripOrderRecordAutoSave {
if (settlementList != null && !settlementList.isEmpty()) { if (settlementList != null && !settlementList.isEmpty()) {
List<CTripCarRecord> list = settlementList.stream() List<CTripCarRecord> list = settlementList.stream()
.flatMap(it -> it.getCarSettlementDetailList().stream()) .flatMap(it -> it.getCarSettlementDetailList().stream())
.map(it -> CTripCarRecord.of( .map(it -> {
CTripCarRecordBase.changeInfo(it.getSettlementBaseInfo()), OrderCarResponse.CarOrderSettlementBaseInfo settlementBaseInfo = it.getSettlementBaseInfo();
CTripCarQuickInfo.of(it.getOrderDetail().getQuickProductInfo()))) CTripCarRecord record = cTripOrderDetailRepository.findCarRecordByRecordId(
.toList(); 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); cTripOrderDetailRepository.saveAllCTripCarRecord(list);
} }
} }