Compare commits

...

9 Commits

Author SHA1 Message Date
lulz1 404847cb07 修改测试文件 2024-03-28 20:30:19 +08:00
lulz1 3098af9a24 Merge remote-tracking branch 'origin/dev' into dev 2024-03-28 20:22:52 +08:00
lulz1 2adcf92af0 行程规划同步添加提示 2024-03-28 20:19:58 +08:00
dengwc c8101a9d50 Merge remote-tracking branch 'origin/dev' into dev 2024-03-28 17:36:23 +08:00
dengwc df15005b16 同程结算明细接口编写 2024-03-28 17:36:04 +08:00
lulz1 8eb0c2dfc2 提交携程结算数据保存代码 2024-03-28 17:02:37 +08:00
lulz1 6e46dd20fd Merge remote-tracking branch 'origin/dev' into dev
# Conflicts:
#	src/main/java/com/chint/application/in/AutoWorkController.java
2024-03-28 17:02:06 +08:00
dengwc 10a25f25c5 同程结算明细接口编写 2024-03-28 16:36:08 +08:00
dengwc 7d042f808e 同程结算接口编写 2024-03-28 09:49:54 +08:00
47 changed files with 875 additions and 115 deletions

View File

@ -1,7 +1,10 @@
package com.chint.application.commands;
import com.chint.infrastructure.echo_framework.command.Command;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import java.time.LocalDate;
import java.time.LocalDateTime;

View File

@ -1,6 +1,9 @@
package com.chint.application.in;
import com.chint.domain.factoriy.order_record.LyStatementOrder;
import com.chint.infrastructure.echo_framework.command.Command;
import com.chint.application.commands.OrderRecordGenerateCommand;
import com.chint.domain.factoriy.order_record.LyStatementOrder;
import com.chint.infrastructure.echo_framework.command.Command;
import com.chint.infrastructure.util.Result;
@ -12,6 +15,12 @@ import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.chint.application.commands.OrderRecordGenerateCommand;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.List;
import static com.chint.infrastructure.constant.CommonMessageConstant.SUCCESS;
@RestController
@ -29,19 +38,21 @@ public class AutoWorkController {
@Transactional
@ApiOperation("自动拉取昨天的流水号每天晚上8点执行")
@PostMapping("/cTrip/record/save")
public Result<String> autoSaveCTripRecord(){
public Result<String> autoSaveCTripRecord() {
cTripOrderRecordAutoSave.saveAll();
//将昨天的结算数据生成为财务共享需要的数据
Command.of(OrderRecordGenerateCommand.class).sendToQueue();
// Command.of(OrderRecordGenerateCommand.class).sendToQueue();
return Result.Success(SUCCESS);
}
@Transactional
@ApiOperation("自动拉取同程上个月的流水号")
@PostMapping("/ly/record/save")
public Result<String> autoSaveLYRecord() {
//同步拉取上月数据
lyStatementOrder.saveAll();
//将上月的结算数据生成为财务共享需要的数据
Command.of(OrderRecordGenerateCommand.class).sendToQueue();
return Result.Success(SUCCESS);
}

View File

@ -1,11 +1,17 @@
package com.chint.domain.aggregates.order.order_record;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import org.springframework.data.annotation.Id;
import org.springframework.data.relational.core.mapping.Table;
@Data
@Table("order_car_record")
@NoArgsConstructor
@AllArgsConstructor
@Accessors(chain = true)
public class OrderCarRecord extends OrderBaseRecord {
@Id
private Long id;

View File

@ -1,11 +1,17 @@
package com.chint.domain.aggregates.order.order_record;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import org.springframework.data.annotation.Id;
import org.springframework.data.relational.core.mapping.Table;
@Data
@Table("order_flight_record")
@NoArgsConstructor
@AllArgsConstructor
@Accessors(chain = true)
public class OrderFlightRecord extends OrderBaseRecord{
@Id
private Long id;

View File

@ -1,11 +1,17 @@
package com.chint.domain.aggregates.order.order_record;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import org.springframework.data.annotation.Id;
import org.springframework.data.relational.core.mapping.Table;
@Data
@Table("order_hotel_record")
@NoArgsConstructor
@AllArgsConstructor
@Accessors(chain = true)
public class OrderHotelRecord extends OrderBaseRecord{
@Id
private Long id;

View File

@ -1,11 +1,17 @@
package com.chint.domain.aggregates.order.order_record;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import org.springframework.data.annotation.Id;
import org.springframework.data.relational.core.mapping.Table;
@Data
@Table("order_train_record")
@NoArgsConstructor
@AllArgsConstructor
@Accessors(chain = true)
public class OrderTrainRecord extends OrderBaseRecord{
@Id
private Long id;

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

@ -9,6 +9,7 @@ import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import com.fasterxml.jackson.annotation.JsonInclude;
import org.springframework.data.annotation.Id;
import org.springframework.data.relational.core.mapping.MappedCollection;
import org.springframework.data.relational.core.mapping.Table;
@ -137,4 +138,7 @@ public class LyOrderCarRecord implements Serializable {
private String reserveManExpand4;
//差旅备注
private String travelRemark;
//状态 默认为null, 1已经转为财务共享数据
private Integer status;
}

View File

@ -179,4 +179,6 @@ public class LyOrderFlightRecord implements Serializable {
//差旅备注
private String travelRemark;
//状态 默认为null, 1已经转为财务共享数据
private Integer status;
}

View File

@ -151,4 +151,6 @@ public class LyOrderHotelRecord implements Serializable {
//差旅备注
private String travelRemark;
//状态 默认为null, 1已经转为财务共享数据
private Integer status;
}

View File

@ -144,5 +144,7 @@ public class LyOrderTrainRecord implements Serializable {
private String reserveManExpand4;
//差旅备注
private String travelRemark;
//状态 默认为null, 1已经转为财务共享数据
private Integer status;
}

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

@ -0,0 +1,319 @@
package com.chint.domain.factoriy.order_record;
import com.chint.domain.aggregates.order.OrderDetail;
import com.chint.domain.aggregates.order.RouteOrder;
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.ly_order_record.LyOrderCarRecord;
import com.chint.domain.aggregates.order.order_record.ly_order_record.LyOrderFlightRecord;
import com.chint.domain.aggregates.order.order_record.ly_order_record.LyOrderHotelRecord;
import com.chint.domain.aggregates.order.order_record.ly_order_record.LyOrderTrainRecord;
import com.chint.domain.repository.UserRepository;
import com.chint.domain.service.OrderDetailDomainService;
import com.chint.infrastructure.repository.jdbc.*;
import com.chint.infrastructure.util.BeanCopyUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.math.BigDecimal;
import java.util.Objects;
/**
* 同程数据转换
*/
@Component
public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactory {
@Autowired
private JdbcOrderDetailRepository jdbcOrderDetailRepository;
@Autowired
private JdbcRouteRepository jdbcRouteRepository;
@Autowired
private OrderRecordFactory orderRecordFactory;
@Override
public OrderFlightRecord createFlightOrderRecord(Object orderFlightRecordData) {
OrderFlightRecord orderFlightRecord = new OrderFlightRecord();
if (orderFlightRecordData instanceof LyOrderFlightRecord lyOrderFlightRecord) {
createFlightOrder(orderFlightRecord, lyOrderFlightRecord);
}
return orderFlightRecord;
}
@Override
public OrderHotelRecord createHotelOrderRecord(Object orderHotelRecordData) {
OrderHotelRecord orderHotelRecord = new OrderHotelRecord();
if (orderHotelRecordData instanceof LyOrderHotelRecord lyOrderHotelRecord) {
createHotelOrder(orderHotelRecord, lyOrderHotelRecord);
}
return orderHotelRecord;
}
@Override
public OrderTrainRecord createTrainOrderRecord(Object orderTrainRecordData) {
OrderTrainRecord orderTrainRecord = new OrderTrainRecord();
if (orderTrainRecordData instanceof LyOrderTrainRecord lyOrderTrainRecord) {
createTrainOrder(orderTrainRecord, lyOrderTrainRecord);
}
return orderTrainRecord;
}
@Override
public OrderCarRecord createCarOrderRecord(Object orderCarRecordData) {
OrderCarRecord orderCarRecord = new OrderCarRecord();
if (orderCarRecordData instanceof LyOrderCarRecord lyOrderCarRecord) {
createCarOrder(orderCarRecord, lyOrderCarRecord);
}
return orderCarRecord;
}
private void createFlightOrder(OrderFlightRecord orderFlightRecord, LyOrderFlightRecord lyOrderFlightRecord) {
String orderSerialNo = lyOrderFlightRecord.getOrderSerialNo();//订单号
OrderRecordBasic orderRecordBasic = getOrderRecordBasic(orderSerialNo);
BeanUtils.copyProperties(orderRecordBasic, orderFlightRecord);
orderFlightRecord.setDetailId(lyOrderFlightRecord.getBillOrderNo())//防重标识
.setTicketClerk(lyOrderFlightRecord.getReserveManName())//票务员
.setAccountPeriod(lyOrderFlightRecord.getStatementCode())//账期号
.setBillNo(lyOrderFlightRecord.getBillOrderNo())//账单号
.setOrderNo(lyOrderFlightRecord.getOrderSerialNo())//订单号
.setParentOrderNo("")//父级订单号
.setOriginalOrderNo(lyOrderFlightRecord.getOriginOrderSerialNo())//原始订单号
.setTicketNo(lyOrderFlightRecord.getTicketNo())//票号
.setScheduleNum("")//行程单号
.setReceiptsNum(lyOrderFlightRecord.getOutApplayOrderNo())//关联申请单号
.setUserName(lyOrderFlightRecord.getPassengerName())//出行人姓名
.setUserCode(lyOrderFlightRecord.getPassengerExternalId())//出行人编码
.setOverStandard("".equals(lyOrderFlightRecord.getOverStandardStatus()) ? "1" : "0")//"是否违规超标0否 ,1是"
.setOverStandardReason(lyOrderFlightRecord.getViolationReason())//违规原因超标原因
.setStartAirportName("")//起飞机场名称
.setStartCityCode("")//起飞城市编码
.setStartCityName("")//起飞城市名称
.setStartTime(lyOrderFlightRecord.getPlanBeginDate())//起飞时间 yyyy-MM-dd HH:mm:ss
.setEndAirportCode("")//到达机场三字码
.setEndAirportName("")//到达机场名称
.setEndCityCode("")//到达城市编码
.setEndCityName("")//到达城市名称
.setEndTerminal("")//到达航站楼
.setEndTime(lyOrderFlightRecord.getPlanEndDate())//到达时间 yyyy-MM-dd HH:mm:ss
.setFlightCompName(lyOrderFlightRecord.getAirlineCompanyName())//航空公司名称
.setFlightLowestPrice(String.valueOf(lyOrderFlightRecord.getFligthMinPrice()))//航班最低价
.setFlightNum(lyOrderFlightRecord.getFligthNo())//
.setOrderAmount(String.valueOf(lyOrderFlightRecord.getToBePayAmount())) //结算总额
.setFacePrice(String.valueOf(lyOrderFlightRecord.getTicketOutAmount())) //票面价
.setNoTaxAmt(String.valueOf(BigDecimal.valueOf(lyOrderFlightRecord.getTicketTotalAmount() == null ? 0 : lyOrderFlightRecord.getTicketTotalAmount())
.subtract(BigDecimal.valueOf(lyOrderFlightRecord.getTicketDeductibleTax() == null ? 0 : lyOrderFlightRecord.getTicketDeductibleTax())))) //未税金额
.setTaxAmt(String.valueOf(lyOrderFlightRecord.getTicketDeductibleTax())) //税额
.setPreServiceFee(String.valueOf(lyOrderFlightRecord.getServiceAmount())) //服务费
.setPostServiceFee("") //配送服务费
.setAirportTax(String.valueOf(lyOrderFlightRecord.getCapitalCost())) //机建费
.setChangeFee(String.valueOf(lyOrderFlightRecord.getChangeFee())) //改签手续费
.setFuelTax(String.valueOf(lyOrderFlightRecord.getFuelCost())) //燃油费
.setRefundFee(String.valueOf(lyOrderFlightRecord.getRefundFee())) //退票手续费
.setUpFee(String.valueOf(lyOrderFlightRecord.getUpgradeFee())) //改签差价
.setYcabinFullPrice("") //经济舱全价
.setIssueTicketTime(lyOrderFlightRecord.getEnterAccount())//出票时间 yyyy-MM-dd HH:mm:ss
.setPolicyLowestPrice(String.valueOf(lyOrderFlightRecord.getNHoursMinPrice())) //比价范围最低价
.setSeatDiscount(lyOrderFlightRecord.getDiscount())//折扣率
.setSeatPoint(lyOrderFlightRecord.getSeatClass())//舱位
.setSeatPointName(lyOrderFlightRecord.getSeatClass())//舱位名称
.setUseStatus(lyOrderFlightRecord.getTicketStatus()) //机票使用情况
.setOrderSource("") //预订来源线上/线下
.setNotLowReason("正泰机票无超标") //未预订最低价原因
.setBookOrgCode1(lyOrderFlightRecord.getPassengerDepartment()) //出行人组织架构信息1
.setBookOrgCode2(lyOrderFlightRecord.getPassengerDepartment()) //出行人组织架构信息2
.setBookOrgCode3(lyOrderFlightRecord.getPassengerDepartment()) //出行人组织架构信息3
.setOfflineCcomyCode(lyOrderFlightRecord.getPassengerCostCenter()) //成本中心
;
}
private void createHotelOrder(OrderHotelRecord orderHotelRecord, LyOrderHotelRecord lyOrderHotelRecord) {
String orderSerialNo = lyOrderHotelRecord.getOrderSerialNo();//订单号
OrderRecordBasic orderRecordBasic = getOrderRecordBasic(orderSerialNo);
BeanUtils.copyProperties(orderRecordBasic, orderHotelRecord);
orderHotelRecord.setDetailId(lyOrderHotelRecord.getBillOrderNo())//防重标识
.setTicketClerk(lyOrderHotelRecord.getReserveManName()) //票务员
.setAccountPeriod(lyOrderHotelRecord.getStatementCode()) //账期号
.setBillNo(lyOrderHotelRecord.getBillOrderNo()) //账单号结算单号
.setOrderNo(lyOrderHotelRecord.getOrderSerialNo()) //订单号
.setParentOrderNo("") //父级订单号
.setOriginalOrderNo(lyOrderHotelRecord.getOriginOrderSerialNo())//原始订单号
.setBrandGroup("") //酒店品牌集团
.setBrandName("") //酒店品牌
.setOverStandard("".equals(lyOrderHotelRecord.getOverStandardStatus()) ? 1 : 0) //"是否违规(超标) 0否,1是"
.setOverStandardReason(lyOrderHotelRecord.getViolationReason()) //违规原因超标原因
.setReceiptsNum(lyOrderHotelRecord.getOutApplayOrderNo()) //关联申请单号
.setUserName(lyOrderHotelRecord.getPassengerName()) //入住人姓名
.setUserCode(lyOrderHotelRecord.getPassengerNo()) //入住人编码
.setCheckInCity(lyOrderHotelRecord.getCityName()) //入住城市
.setCheckInDate(lyOrderHotelRecord.getCheckInTime()) //入住日期yyyy-MM-dd
.setCountry(lyOrderHotelRecord.getCountryName()) //国家
.setCustomerServiceName("") //客服处理人
.setDepartureDate(lyOrderHotelRecord.getLeaveTime()) //离店日期yyyy - MM - dd
.setHotelAddress("") //酒店地址
.setHotelName(lyOrderHotelRecord.getHotelName()) //酒店名称
.setIncludeAmount("") //含早情况XX份
.setIsAgreement(0) //是否协议酒店0否1是
.setPaymentType(getPaymentType(lyOrderHotelRecord.getPayType()))//"付款方式0-公司统付 1-个人付 2-混付"
.setOrderAmount(String.valueOf(lyOrderHotelRecord.getToBePayAmount())) //结算总额
.setCompanyAmount(String.valueOf(lyOrderHotelRecord.getToBePayAmount())) //企业统付总额
.setPersonalAmount("") //个人支付金额
.setUnifiedPayAmt(String.valueOf(lyOrderHotelRecord.getServiceAmount())) //统付服务费
.setPersonalPayAmt("") //个人服务费
.setProvince("") //省份
.setRoomCount(1) //房间数
.setRoomNightCount(lyOrderHotelRecord.getHotelNights()) //夜间数
.setNightCount(1) //间夜数
.setRoomPrice("") //房价房间单价不包含服务费
.setRoomRate(String.valueOf(lyOrderHotelRecord.getTotalRoomPrice())) //房费订单总额减总服务费
.setNoTaxAmt("") //不含税价
.setTaxAmt("") //税费
.setInvoiceType("") //供应商发票类型
.setInvoiceFee("") //开票手续费
.setCustodayFee("") //托管费
.setNoTaxCusFee("") //托管费不含税
.setTaxCusFee("") //托管费税费
.setRoomTypeName(lyOrderHotelRecord.getBedType()) //房型
.setStarRate("") //星级
.setOrderSource(lyOrderHotelRecord.getBookingPlat()) //预订来源线上/线下
.setBookOrgCode1(lyOrderHotelRecord.getPassengerDepartment()) //入住人组织架构信息1
.setBookOrgCode2("") //入住人组织架构信息2
.setBookOrgCode3("") //入住人组织架构信息3
.setOfflineCcomyCode(lyOrderHotelRecord.getPassengerCostCenter()) //成本中心
;
}
private void createTrainOrder(OrderTrainRecord orderTrainRecord, LyOrderTrainRecord lyOrderTrainRecord) {
String orderSerialNo = lyOrderTrainRecord.getOrderSerialNo();//订单号
OrderRecordBasic orderRecordBasic = getOrderRecordBasic(orderSerialNo);
BeanUtils.copyProperties(orderRecordBasic, orderTrainRecord);
orderTrainRecord.setDetailId(lyOrderTrainRecord.getBillOrderNo())//防重标识
.setTicketClerk(lyOrderTrainRecord.getReserveManName()) //票务员
.setAccountPeriod(lyOrderTrainRecord.getStatementCode()) //账期号
.setBillNo(lyOrderTrainRecord.getBillOrderNo()) //账单号
.setOrderNo(lyOrderTrainRecord.getOrderSerialNo()) //订单号
.setParentOrderNo("") //父级订单号
.setOriginalOrderNo(lyOrderTrainRecord.getOriginOrderSerialNo()) //原始订单号
.setReceiptsNum(lyOrderTrainRecord.getOutApplayOrderNo()) //关联申请单号
.setStartDate(lyOrderTrainRecord.getPlanBeginDate()) //出发日期
.setArriveDate(lyOrderTrainRecord.getPlanEndDate()) //到达日期
.setOverStandard("".equals(lyOrderTrainRecord.getOverStandardStatus()) ? "1" : "0") //"是否违规超标0否 1是"
.setOverStandardReason(lyOrderTrainRecord.getViolationReason()) //违规原因超标原因
.setChangeAddAmount(String.valueOf(lyOrderTrainRecord.getToBePayAmount())) //改签收款
.setChangeCost(String.valueOf(lyOrderTrainRecord.getChangeFee())) //改签手续费
.setChangeReturnAmount(String.valueOf(lyOrderTrainRecord.getToBePayAmount())) //改签退款
.setReturnCost(String.valueOf(lyOrderTrainRecord.getRefundFee())) //退款手续费
.setBookFee(String.valueOf(lyOrderTrainRecord.getServiceAmount())) //订票手续费
.setCollFee("") //取票手续费
.setNoTaxFeeAmt("") //手续费未税金额
.setTaxFeeAmt("") //手续费税费
.setReturnRes(lyOrderTrainRecord.getRefundChangeReason()) //退票原因
.setReturnFee(String.valueOf(lyOrderTrainRecord.getRefundFee())) //退票手续费
.setNoTaxAmt("") //未税金额
.setTaxAmt("") //税额
.setOrderAmount(String.valueOf(lyOrderTrainRecord.getToBePayAmount())) //结算总额
.setFromCity(lyOrderTrainRecord.getTripName()) //出发城市
.setFromStationName(lyOrderTrainRecord.getTripName()) //出发站
.setToCity(lyOrderTrainRecord.getTripName()) //到达城市
.setToStationName(lyOrderTrainRecord.getTripName()) //到达站
.setIssueTicketTime(lyOrderTrainRecord.getEnterAccount()) //出票时间 yyyy-MM-dd HH:mm:ss
.setRunTime("") //时长
.setSeatType("")// 座位等级
.setTrainNo(lyOrderTrainRecord.getTrainNo()) //车次
.setUserCode(lyOrderTrainRecord.getPassengerNo())//出行人编码
.setUserName(lyOrderTrainRecord.getPassengerName())//出行人姓名
.setOrderSource(lyOrderTrainRecord.getBookingPlat())//预订来源线上 / 线下
.setBookOrgCode1(lyOrderTrainRecord.getPassengerDepartment())//出行人组织架构信息1
.setBookOrgCode2("")//出行人组织架构信息2
.setBookOrgCode3("")//出行人组织架构信息3
.setOfflineCcomyCode(lyOrderTrainRecord.getPassengerCostCenter())//成本中心
.setTravelUserBirthday("")//生日
.setTravelUserPhone("") //出行人手机号
.setTravelUserSex("")//"性别0保密不展示 1男 2女"
.setTravelUserType("") //"乘客类型:成人(ADULT) 儿童(CHILDREN) 婴儿(BABY)"
.setPassportNo("")//乘客证件号
.setPassportType("")//乘客证件类型
.setTrainTime("")//发车时间 yyyy - MM - dd HH:mm:ss
.setYxId("")//影像比对ID
;
}
private void createCarOrder(OrderCarRecord orderCarRecord, LyOrderCarRecord lyOrderCarRecord) {
String orderSerialNo = lyOrderCarRecord.getOrderSerialNo();//订单号
OrderRecordBasic orderRecordBasic = getOrderRecordBasic(orderSerialNo);
BeanUtils.copyProperties(orderRecordBasic, orderCarRecord);
orderCarRecord.setDetailId(lyOrderCarRecord.getBillOrderNo())//防重标识
.setTicketClerk(lyOrderCarRecord.getReserveManName()) //票务员
.setAccountPeriod(lyOrderCarRecord.getStatementCode()) //账期号
.setBillNo(lyOrderCarRecord.getBillOrderNo()) //账单号
.setReceiptsNum(lyOrderCarRecord.getOrderSerialNo()) //关联申请单号
.setOverStandard("0") //"是否违规超标0否 1是"
.setOverStandardReason("")//违规原因超标原因
.setOrderNo(lyOrderCarRecord.getOrderSerialNo()) //订单号
.setParentOrderNo("")//父级订单号
.setOriginalOrderNo(lyOrderCarRecord.getOriginOrderSerialNo())//原始订单号
.setOrderStatus("") //"结算状态"
.setCreateTime(lyOrderCarRecord.getBookingDate()) //"订单创建时间格式2023-04-26 13:15:17"
.setStartTime(lyOrderCarRecord.getPlanBeginDate()) //"出发时间格式2023-04-26 13:15:17"
.setArriveTime("") //"到达时间格式2023-04-26 13:15:17"
.setFromStationName(lyOrderCarRecord.getCarStartPlaceActual()) //出发地
.setToStationName(lyOrderCarRecord.getCarEndPlaceActual()) //到达地
.setCarType("") //车型
.setFromCity(lyOrderCarRecord.getStartCityName()) //出发城市
.setToCity("") //到达城市
.setRunTime("") //运行时长
.setMiles("") //里程数
.setNoTaxAmt("") //未税金额
.setTaxAmt("") //税费
.setOrderAmount(String.valueOf(lyOrderCarRecord.getToBePayAmount())) //结算总额(含前收服务费)
.setOpenCharge("") //开票手续费
.setHighSpeedAmt("") //额外费用
.setHighSpeedName("") //额外费用名称
.setServiceCost(String.valueOf(lyOrderCarRecord.getServiceAmount())) //服务费
.setCancelCost(String.valueOf(lyOrderCarRecord.getToBePayAmount())) //取消费
.setUserName(String.valueOf(lyOrderCarRecord.getPassengerName())) //用车人姓名
.setUserCode(lyOrderCarRecord.getPassengerNo()) //用车人code
// .setOwnPayAmt() //个人支付金额
.setComyPayAmt(String.valueOf(lyOrderCarRecord.getToBePayAmount())) //公司统付金额
.setBookOrgCode1(lyOrderCarRecord.getPassengerDepartment()) //用车人组织架构信息1
.setBookOrgCode2("") //用车人组织架构信息2
.setBookOrgCode3("") //用车人组织架构信息3
.setPaymentType(String.valueOf(getPaymentType(lyOrderCarRecord.getPayType()))) //"付款方式0公司统付 1个人付 2混付"
.setOfflineCcomyCode(lyOrderCarRecord.getPassengerDepartment()) //成本中心
.setOrderSource(lyOrderCarRecord.getBookingPlat()) //预订来源线上/线下
// .setORDER_AMOUNT() //订单金额
// .setSETTLE_ORDER_FLAG() //订单对账状态
// .setpayAmount()// 支付金额
;
}
//获取公共对象
public OrderRecordBasic getOrderRecordBasic(String orderSerialNo) {
OrderDetail orderDetail = jdbcOrderDetailRepository.findByOrderNo(orderSerialNo);
Long routeId = orderDetail == null ? 0L : orderDetail.getRouteId();
RouteOrder routeOrder = jdbcRouteRepository.findByRouteId(routeId);
if (Objects.isNull(routeOrder)) {
return new OrderRecordBasic();
}
return orderRecordFactory.buildWithRouteOrder(routeOrder);
}
//映射付款方式
//支付类型(1:企业授信 / 2:个人支付 / 3组合支付)
public int getPaymentType(String payType) {
return switch (payType) {
case "企业授信" -> 0;
case "个人支付" -> 1;
case "组合支付" -> 2;
default -> -1;
};
}
}

View File

@ -54,6 +54,8 @@ public class OrderRecordFactory {
if (sysCode.equals(BELONG_SYS_CODE_ANFSSC)) {
orderRecordBasic.setBelongSysType(BELONG_SYS_TYPE_ANFSSC);
}
} else {
orderRecordBasic.setBelongSysType(BELONG_SYS_TYPE_NOT);
}
}
return orderRecordBasic;

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

@ -42,10 +42,9 @@ import static com.chint.infrastructure.constant.CommonMessageConstant.LEG_CHANGE
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.*;
import static com.chint.infrastructure.constant.RouteConstant.ORDER_STATUS_PREPARE;
import static com.chint.infrastructure.constant.UtilConstant.RESULT_ORDER_DETAIL;
@Service
@ -114,6 +113,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());
@ -160,15 +160,26 @@ public class LegEventHandler implements LegEventService {
if (routeOrder.getOrderStatus() >= RouteConstant.ORDER_STATUS_APPROVAL) {
String supplierName = data.getSupplierName();
routeOrder.setSupplierName(supplierName);
List<Leg> legItems = routeOrder.getLegItems();
//这里增加一个判断 如果这个订单的行程为空那么就返回给用户提示
if (legItems == null || legItems.isEmpty()) {
throw new CommandException("订单的行程不能为空");
}
List<Leg> needSyncLegs = legItems.stream().filter(it -> !it.getLegType().equals(LEG_TYPE_OTHER)).toList();
if (needSyncLegs.isEmpty()) {
throw new CommandException("有所选的行程规划单不存在需要同步的行程");
}
//这里order所有的leg触发sync事件
routeOrder.getLegItems().forEach(leg -> leg.getEventList().add(
legItems.forEach(leg -> leg.getEventList().add(
legEventFactory.creatLegEvent(command.getLegEventType())
));
//保存routeOrder的状态
routeRepository.save(routeOrder).reloadStatus();
routeOrder.setLegItems(
routeOrder
.getLegItems()
legItems
.stream()
.filter(leg -> !leg.getLegType().equals(LegConstant.LEG_TYPE_OTHER))
.toList()
@ -244,8 +255,8 @@ public class LegEventHandler implements LegEventService {
LegEvent legEvent = legEventFactory
.creatLegEvent(command.getLegEventType());
leg.addEvent(legEvent);
} else if(orderStatus.equals(ORDER_EVENT_REFUND_NAME) ||
orderStatus.equals(ORDER_EVENT_CANCEL_NAME)){
} else if (orderStatus.equals(ORDER_EVENT_REFUND_NAME) ||
orderStatus.equals(ORDER_EVENT_CANCEL_NAME)) {
//如果是退款状态那么就创建加入未下单事件
LegEvent legEvent = legEventFactory
.creatLegEvent(LEG_EVENT_NOT_ORDERED);

View File

@ -5,32 +5,161 @@ 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.ly_order_record.LyOrderCarRecord;
import com.chint.domain.aggregates.order.order_record.ly_order_record.LyOrderFlightRecord;
import com.chint.domain.aggregates.order.order_record.ly_order_record.LyOrderHotelRecord;
import com.chint.domain.aggregates.order.order_record.ly_order_record.LyOrderTrainRecord;
import com.chint.domain.factoriy.order_record.CTripOrderRecordExtensionFactory;
import com.chint.domain.factoriy.order_record.LyOrderRecordExtensionFactory;
import com.chint.domain.service.OrderDetailDomainService;
import com.chint.infrastructure.repository.jdbc.*;
import com.chint.infrastructure.util.PageResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
public class LYOrderRecordDomainService implements OrderRecordDomainService{
@Component
public class LYOrderRecordDomainService implements OrderRecordDomainService {
@Autowired
private JdbcLyOrderFlightRecord jdbcLyOrderFlightRecord;
@Autowired
private JdbcLyOrderHotelRecord jdbcLyOrderHotelRecord;
@Autowired
private JdbcLyOrderTrainRecord jdbcLyOrderTrainRecord;
@Autowired
private JdbcLyOrderCarRecord jdbcLyOrderCarRecord;
@Autowired
private LyOrderRecordExtensionFactory lyOrderRecordExtensionFactory;
@Autowired
private OrderDetailDomainService orderDetailDomainService;
@Override
public List<OrderHotelRecord> generateHotelRecord(OrderRecordGenerateCommand command) {
LocalDateTime startTime = command.getStartTime();
return null;
}
@Override
public List<OrderTrainRecord> generateTrainRecord(OrderRecordGenerateCommand command) {
return null;
}
@Override
@Transactional
public List<OrderFlightRecord> generateFlightRecord(OrderRecordGenerateCommand command) {
return null;
ArrayList<OrderFlightRecord> orderFlightRecordList = new ArrayList<>();
int count = 0;//初始化变量
int pageSize = 100; // 假设每页大小为10
int LoopNum;//需要的循环数
do {
PageRequest pageResult = PageRequest.of(count, pageSize);
Page<LyOrderFlightRecord> lyOrderFlightRecordPage = jdbcLyOrderFlightRecord.findAllByStatusIsNull(pageResult);
long totalElements = lyOrderFlightRecordPage.getTotalElements();//总数
LoopNum = (int) Math.ceil((double) totalElements / pageSize); // 计算总页数并向上取整
//数据
List<LyOrderFlightRecord> lyOrderFlightRecordPageList = lyOrderFlightRecordPage.toList();
ArrayList<OrderFlightRecord> orderFlightRecords = new ArrayList<>(100);
for (LyOrderFlightRecord lyOrderFlightRecord : lyOrderFlightRecordPageList) {
OrderFlightRecord orderFlightRecord = lyOrderRecordExtensionFactory.createFlightOrderRecord(lyOrderFlightRecord);//转换
orderFlightRecords.add(orderFlightRecord);
}
//保存数据
orderDetailDomainService.saveFlightOrderRecordBatch(orderFlightRecords);
orderFlightRecordList.addAll(orderFlightRecords);
count++;
} while (count < LoopNum);
//修改数据将状态为null的设置为1
jdbcLyOrderFlightRecord.updateStatusByNullStatus();
return orderFlightRecordList;
}
@Override
@Transactional
public List<OrderHotelRecord> generateHotelRecord(OrderRecordGenerateCommand command) {
ArrayList<OrderHotelRecord> orderHotelRecordList = new ArrayList<>();
int count = 0;//初始化变量
int pageSize = 100; // 假设每页大小为10
int LoopNum;//需要的循环数
do {
PageRequest pageResult = PageRequest.of(count, pageSize);
Page<LyOrderHotelRecord> lyOrderHotelRecordPage = jdbcLyOrderHotelRecord.findAllByStatusIsNull(pageResult);
long totalElements = lyOrderHotelRecordPage.getTotalElements();//总数
LoopNum = (int) Math.ceil((double) totalElements / pageSize); // 计算总页数并向上取整
//数据
List<LyOrderHotelRecord> lyOrderHotelRecordPageList = lyOrderHotelRecordPage.toList();
ArrayList<OrderHotelRecord> orderHotelRecords = new ArrayList<>(100);
for (LyOrderHotelRecord lyOrderHotelRecord : lyOrderHotelRecordPageList) {
OrderHotelRecord orderHotelRecord = lyOrderRecordExtensionFactory.createHotelOrderRecord(lyOrderHotelRecord);//转换
orderHotelRecords.add(orderHotelRecord);
}
//保存数据
orderDetailDomainService.saveHotelOrderRecordBatch(orderHotelRecords);
orderHotelRecordList.addAll(orderHotelRecords);
count++;
} while (count < LoopNum);
//修改数据将状态为null的设置为1
jdbcLyOrderHotelRecord.updateStatusByNullStatus();
return orderHotelRecordList;
}
@Override
@Transactional
public List<OrderTrainRecord> generateTrainRecord(OrderRecordGenerateCommand command) {
ArrayList<OrderTrainRecord> orderTrainRecordsList = new ArrayList<>();
int count = 0;//初始化变量
int pageSize = 100; // 假设每页大小为10
int LoopNum;//需要的循环数
do {
PageRequest pageResult = PageRequest.of(count, pageSize);
Page<LyOrderTrainRecord> lyOrderTrainRecordPage = jdbcLyOrderTrainRecord.findAllByStatusIsNull(pageResult);
long totalElements = lyOrderTrainRecordPage.getTotalElements();//总数
LoopNum = (int) Math.ceil((double) totalElements / pageSize); // 计算总页数并向上取整
//数据
List<LyOrderTrainRecord> lyOrderTrainRecordPageList = lyOrderTrainRecordPage.toList();
ArrayList<OrderTrainRecord> orderTrainRecords = new ArrayList<>(100);
for (LyOrderTrainRecord lyOrderTrainRecord : lyOrderTrainRecordPageList) {
OrderTrainRecord orderTrainRecord = lyOrderRecordExtensionFactory.createTrainOrderRecord(lyOrderTrainRecord);//转换
orderTrainRecords.add(orderTrainRecord);
}
//保存数据
orderDetailDomainService.saveTrainOrderRecordBatch(orderTrainRecords);
orderTrainRecordsList.addAll(orderTrainRecords);
count++;
} while (count < LoopNum);
//修改数据将状态为null的设置为1
jdbcLyOrderTrainRecord.updateStatusByNullStatus();
return orderTrainRecordsList;
}
@Override
@Transactional
public List<OrderCarRecord> generateCarRecord(OrderRecordGenerateCommand command) {
return null;
ArrayList<OrderCarRecord> orderCarRecordsList = new ArrayList<>();
int count = 0;//初始化变量
int pageSize = 100; // 假设每页大小为10
int LoopNum;//需要的循环数
do {
PageRequest pageResult = PageRequest.of(count, pageSize);
Page<LyOrderCarRecord> lyOrderCarRecordPage = jdbcLyOrderCarRecord.findAllByStatusIsNull(pageResult);
long totalElements = lyOrderCarRecordPage.getTotalElements();//总数
LoopNum = (int) Math.ceil((double) totalElements / pageSize); // 计算总页数并向上取整
//数据
List<LyOrderCarRecord> lyOrderCarRecordPageList = lyOrderCarRecordPage.toList();
ArrayList<OrderCarRecord> orderCarRecords = new ArrayList<>(100);
for (LyOrderCarRecord lyOrderCarRecord : lyOrderCarRecordPageList) {
OrderCarRecord orderCarRecord = lyOrderRecordExtensionFactory.createCarOrderRecord(lyOrderCarRecord);//转换
orderCarRecords.add(orderCarRecord);
}
//保存数据
orderDetailDomainService.saveCarOrderRecordBatch(orderCarRecords);
orderCarRecordsList.addAll(orderCarRecords);
count++;
} while (count < LoopNum);
//修改数据将状态为null的设置为1
jdbcLyOrderCarRecord.updateStatusByNullStatus();
return orderCarRecordsList;
}
}

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

@ -12,4 +12,6 @@ public class BelongSystemConstant {
public static final String BELONG_SYS_TYPE_XNFSSC = "XN_FK";
public static final String BELONG_SYS_TYPE_ANFSSC = "AN_FK";
public static final String BELONG_SYS_TYPE_NOT = "NOT";
}

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

@ -2,6 +2,10 @@ package com.chint.infrastructure.repository.jdbc;
import com.chint.domain.aggregates.order.order_record.ly_order_record.LyOrderCarRecord;
import com.chint.domain.aggregates.order.order_record.ly_order_record.LyOrderFlightRecord;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.jdbc.repository.query.Modifying;
import org.springframework.data.jdbc.repository.query.Query;
import org.springframework.data.repository.CrudRepository;
import org.springframework.data.repository.query.Param;
@ -13,4 +17,10 @@ import java.util.List;
public interface JdbcLyOrderCarRecord extends CrudRepository<LyOrderCarRecord, Long> {
@Query(value = "SELECT bill_order_no FROM ly_order_car_record WHERE enter_account BETWEEN :beginDate AND :endDate")
List<String> queryBillOrderNo(@Param("beginDate") String beginDate, @Param("endDate") String endDate);
Page<LyOrderCarRecord> findAllByStatusIsNull(PageRequest pageResult);
@Modifying
@Query("UPDATE ly_order_car_record l SET l.status = 1 WHERE l.status IS NULL")
void updateStatusByNullStatus();
}

View File

@ -1,9 +1,11 @@
package com.chint.infrastructure.repository.jdbc;
import com.chint.domain.aggregates.order.order_record.ly_order_record.LyOrderFlightRecord;
import com.chint.infrastructure.config.LogConfig.SystemLog;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.jdbc.repository.query.Modifying;
import org.springframework.data.jdbc.repository.query.Query;
import org.springframework.data.repository.CrudRepository;
import org.springframework.data.repository.query.Param;
@ -15,4 +17,10 @@ import java.util.List;
public interface JdbcLyOrderFlightRecord extends CrudRepository<LyOrderFlightRecord, Long> {
@Query(value = "SELECT bill_order_no FROM ly_order_flight_record WHERE enter_account BETWEEN :beginDate AND :endDate")
List<String> queryBillOrderNo(@Param("beginDate") String beginDate, @Param("endDate") String endDate);
Page<LyOrderFlightRecord> findAllByStatusIsNull(PageRequest pageResult);
@Modifying
@Query("UPDATE ly_order_flight_record l SET l.status = 1 WHERE l.status IS NULL")
void updateStatusByNullStatus();
}

View File

@ -2,7 +2,11 @@ package com.chint.infrastructure.repository.jdbc;
import com.chint.domain.aggregates.order.order_record.ly_order_record.LyOrderCarRecord;
import com.chint.domain.aggregates.order.order_record.ly_order_record.LyOrderHotelRecord;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.jdbc.repository.query.Modifying;
import org.springframework.data.jdbc.repository.query.Query;
import org.springframework.data.repository.CrudRepository;
import org.springframework.data.repository.query.Param;
@ -14,4 +18,10 @@ import java.util.List;
public interface JdbcLyOrderHotelRecord extends CrudRepository<LyOrderHotelRecord, Long> {
@Query(value = "SELECT bill_order_no FROM ly_order_hotel_record WHERE enter_account BETWEEN :beginDate AND :endDate")
List<String> queryBillOrderNo(@Param("beginDate") String beginDate, @Param("endDate") String endDate);
Page<LyOrderHotelRecord> findAllByStatusIsNull(PageRequest pageResult);
@Modifying
@Query("UPDATE ly_order_hotel_record l SET l.status = 1 WHERE l.status IS NULL")
void updateStatusByNullStatus();
}

View File

@ -1,8 +1,11 @@
package com.chint.infrastructure.repository.jdbc;
import com.chint.domain.aggregates.order.order_record.ly_order_record.LyOrderCarRecord;
import com.chint.domain.aggregates.order.order_record.ly_order_record.LyOrderTrainRecord;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.jdbc.repository.query.Modifying;
import org.springframework.data.jdbc.repository.query.Query;
import org.springframework.data.repository.CrudRepository;
import org.springframework.data.repository.query.Param;
@ -14,4 +17,10 @@ import java.util.List;
public interface JdbcLyOrderTrainRecord extends CrudRepository<LyOrderTrainRecord, Long> {
@Query(value = "SELECT bill_order_no FROM ly_order_train_record WHERE enter_account BETWEEN :beginDate AND :endDate")
List<String> queryBillOrderNo(@Param("beginDate") String beginDate, @Param("endDate") String endDate);
Page<LyOrderTrainRecord> findAllByStatusIsNull(PageRequest pageResult);
@Modifying
@Query("UPDATE ly_order_train_record l SET l.status = 1 WHERE l.status IS NULL")
void updateStatusByNullStatus();
}

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(
CTripFlightRecordBase.changeInfo(
it.getOrderSettlementBaseInfo()
), CTripFlightInfo.of(it.getOrderFlightInfo())
))
.toList();
.map(it -> {
//对数据库进行查找 如果发现已经存在 就使用查找出来的
OrderFlightResponse.FlightOrderSettlementBaseInfo orderSettlementBaseInfo = it.getOrderSettlementBaseInfo();
CTripFlightRecord record = cTripOrderDetailRepository.findFlightRecordByRecordId(
String.valueOf(orderSettlementBaseInfo.getRecordID()));
if (record == null) {
record = CTripFlightRecord.of(
CTripFlightRecordBase.changeInfo(
orderSettlementBaseInfo
), CTripFlightInfo.of(it.getOrderFlightInfo())
);
}
//补充额外的字段
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);
}
}

View File

@ -5,15 +5,15 @@ 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.order.order_record.OrderFlightRecord;
import com.chint.domain.aggregates.order.order_record.ctrip_order_record.*;
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.repository.CTripOrderDetailImpl;
import com.chint.infrastructure.repository.OrderFlightRecordRepositoryImpl;
import com.chint.infrastructure.util.BaseContext;
import com.chint.infrastructure.util.Digest;
import com.chint.infrastructure.util.PinyinUtil;
@ -124,6 +124,12 @@ public class CTripTest {
@Value("${cTrip.requestSecret}")
private String C_TRIP_REQUEST_SECRET;
@Autowired
private OrderFlightRecordRepository orderFlightRecordRepository;
@Autowired
private CTripOrderDetailImpl cTripOrderDetail;
private User user = new User(1L, "230615020", 1, "卢麟哲", "1033719135@qq.com", "15857193365", "A30000001");
@ -236,10 +242,10 @@ public class CTripTest {
System.out.println(gson.toJson(estimate));
}
@Test
// @Test
void search() {
BaseContext.setCurrentUser(user);
SearchOrderResponse response = orderSearchRequest.searchOrderResponseByOrderId("31108053999");
SearchOrderResponse response = orderSearchRequest.searchOrderResponseByOrderId("31288249965");
System.out.println(response);
}
@ -488,7 +494,7 @@ public class CTripTest {
OrderFlightResponse.FlightOrderSettlementBaseInfo orderSettlementBaseInfo =
flightOrderSettlementInfo.getOrderSettlementBaseInfo();
if (orderSettlementBaseInfo != null) {
CtripFlightOrderDetail ctripFlightOrderDetail = new CtripFlightOrderDetail();
CTripFlightRecordBase ctripFlightOrderDetail = new CTripFlightRecordBase();
ctripFlightOrderDetail = ctripFlightOrderDetail.changeInfo(orderSettlementBaseInfo);
ctripOrderDetailRepository.save(ctripFlightOrderDetail);
}
@ -510,7 +516,7 @@ public class CTripTest {
OrderTrainResponse.CorpTrainSettlementDetail trainSettlementDetail =
corpTrainSettlementInfo.getTrainSettlementDetail();
if (trainSettlementDetail != null) {
CtripTrainOrderDetail ctripTrainOrderDetail = new CtripTrainOrderDetail();
CTripTrainRecordBase ctripTrainOrderDetail = new CTripTrainRecordBase();
ctripTrainOrderDetail = ctripTrainOrderDetail.changeInfo(trainSettlementDetail);
ctripOrderDetailRepository.save(ctripTrainOrderDetail);
}
@ -531,7 +537,7 @@ public class CTripTest {
OrderHotelResponse.LstHotelSettlementDetail hotelSettlementDetail = LstHotelSettlementDetail.get(0);
OrderHotelResponse.SettlementDetail settlementDetail = hotelSettlementDetail.getSettlementDetail();
if (settlementDetail != null) {
CtripHotelOrderDetail ctripFlightOrderDetail = new CtripHotelOrderDetail();
CTripHotelRecordBase ctripFlightOrderDetail = new CTripHotelRecordBase();
ctripFlightOrderDetail = ctripFlightOrderDetail.changeInfo(settlementDetail);
ctripOrderDetailRepository.save(ctripFlightOrderDetail);
}
@ -553,7 +559,7 @@ public class CTripTest {
OrderCarResponse.CarOrderSettlementDetail carOrderSettlementDetail = carSettlementDetailList.get(0);
OrderCarResponse.CarOrderSettlementBaseInfo settlementBaseInfo = carOrderSettlementDetail.getSettlementBaseInfo();
if (settlementBaseInfo != null) {
CtripCarOrderDetail ctripCarOrderDetail = new CtripCarOrderDetail();
CTripCarRecordBase ctripCarOrderDetail = new CTripCarRecordBase();
ctripCarOrderDetail = ctripCarOrderDetail.changeInfo(settlementBaseInfo);
ctripOrderDetailRepository.save(ctripCarOrderDetail);
}
@ -586,4 +592,25 @@ public class CTripTest {
}
// @Test
void findRecord(){
CTripFlightRecord byId = cTripOrderDetail.findFlightRecordById(14513L);
Gson gson = new Gson();
System.out.println(gson.toJson(byId));
}
// @Test
void findHotelRecord(){
CTripHotelRecord byId = cTripOrderDetail.findHotelRecordByRecordId("97211839");
Gson gson = new Gson();
System.out.println(gson.toJson(byId));
}
// @Test
void findCarRecord(){
CTripCarRecord byId = cTripOrderDetail.findCarRecordByRecordId("50597248");
Gson gson = new Gson();
System.out.println(gson.toJson(byId));
}
}

View File

@ -18,6 +18,7 @@ import com.chint.infrastructure.echo_framework.command.Command;
import com.chint.infrastructure.repository.jdbc.JdbcOrderDetailRepository;
import com.chint.infrastructure.repository.jdbc.JdbcOrderTravelRepository;
import com.chint.infrastructure.util.BaseContext;
import com.chint.infrastructure.util.Digest;
import com.chint.interfaces.rest.base.PostRequest;
import com.chint.interfaces.rest.bpm.BPMRequest;
import com.chint.interfaces.rest.bpm.XNBPM.ClientFactory;
@ -886,7 +887,7 @@ public class LYTest {
// @Test
void sendMsg() {
commonController.sendMsg("T24032167509127504");
commonController.sendMsg("T24032868351668790");
}
@ -920,14 +921,14 @@ public class LYTest {
}
// @Test
@Test
void syncToSupplierOne(){
RouteOrder routeOrder = routeRepository.queryById(665L);
lyOrderSyncAdapter.syncSupplierOrder(routeOrder);
}
// @Test
@Test
void queryHotelCustom(){
OrderDetail byId = orderDetailRepository.findById(2569L);
HotelOrderDetailDto hotelOrderDetailDto = HotelOrderDetailDto.copyFrom(byId.getHotelOrderDetail());

View File

@ -11,11 +11,15 @@ import com.chint.domain.aggregates.location.basedata.PrefectureLevelCityInfoEnti
import com.chint.domain.aggregates.order.Leg;
import com.chint.domain.aggregates.order.Location;
import com.chint.domain.aggregates.order.RouteOrder;
import com.chint.domain.aggregates.order.order_record.ctrip_order_record.CTripHotelRecord;
import com.chint.domain.aggregates.user.User;
import com.chint.domain.repository.*;
import com.chint.domain.service.JTCompanyDomainService;
import com.chint.domain.service.OrderDomainService;
import com.chint.domain.service.order_sync.LYOrderSyncAdapter;
import com.chint.domain.value_object.RanksData;
import com.chint.infrastructure.repository.CTripOrderDetailImpl;
import com.chint.infrastructure.util.DateTimeUtil;
import com.chint.infrastructure.util.Digest;
import com.chint.infrastructure.util.PinyinUtil;
import com.chint.interfaces.rest.base.PostRequest;
@ -138,6 +142,12 @@ class RouteApplicationTests {
@Autowired
private RankController rankController;
@Autowired
private CTripOrderDetailImpl cTripOrderDetail;
@Autowired
private OrderDomainService orderDomainService;
void test3() {
FlyOkDTO freightDTO = new FlyOkDTO();
ParamFly param = new ParamFly();
@ -156,7 +166,7 @@ class RouteApplicationTests {
System.out.println(postRequest.getReDirectUrl("http://10.10.100.129:8089" + "/MobileOA/api/FsscSSO?loginUser=230615020&data=%2F%23%2Fexpenseclaim%3FbillDefineId%3Dfcc76666fb1211e98e2019f4db5548fd%26scene%3DWRITE%26isNew%3Dtrue%26goback%3Dfalse"));
}
@Test
// @Test
void syncUserTo() {
User user = new User();
user.setCompanyCode("A10000001");
@ -267,7 +277,7 @@ class RouteApplicationTests {
// log.trace("trace");
}
@Test
// @Test
void loginSignProd() {
String sfno = "231201060";
String syscode = "FSSC";
@ -312,7 +322,7 @@ class RouteApplicationTests {
routeRepository.deleteById(875L);
}
@Test
// @Test
void deleteOrderDetail() {
orderDetailRepository.deleteById(2609L);
}
@ -1000,7 +1010,7 @@ class RouteApplicationTests {
pushUser.getUserSFDataFromOpenApiBatch();
}
@Test
// @Test
void deleteByOrderId() {
orderDetailRepository.deleteById(1647L);
orderDetailRepository.deleteById(1648L);
@ -1046,7 +1056,7 @@ class RouteApplicationTests {
locationRepository.saveAll(allLevelThreeAndFour);
}
@Test
// @Test
void generateIfAirport() {
List<Location> airportLocation = new ArrayList<>();
AirportSearchResponse response = cTripAirportRequest.getAirport();
@ -1092,7 +1102,7 @@ class RouteApplicationTests {
locationRepository.saveAll(airportLocation);
}
@Test
// @Test
void updateCounty() {
List<Location> byLocationType = locationRepository.findByLocationType(5);
for (Location location : byLocationType) {
@ -1103,7 +1113,7 @@ class RouteApplicationTests {
locationRepository.saveAll(byLocationType);
}
@Test
// @Test
void updateAirportPath() {
List<Location> byLocationType = locationRepository.findByLocationType(7);
for (Location location : byLocationType) {
@ -1113,7 +1123,7 @@ class RouteApplicationTests {
locationRepository.saveAll(byLocationType);
}
@Test
// @Test
void generateLocationType() {
List<Location> all = locationRepository.findAll();
all.forEach(it -> {
@ -1183,12 +1193,18 @@ class RouteApplicationTests {
cTripStatusNotification.setStatusIDs(null);
}
@Test
// YB_STANDARD_LEVEL_ONE m2.p2及以下
// YB_STANDARD_LEVEL_TWO m3-m4 p3-p4
// YB_STANDARD_LEVEL_THREE m5-m7 p5-p7
// YB_STANDARD_LEVEL_FOUR m8.p8及以上
//浙江正泰仪器仪表有限责任公司 A10160001
// @Test
void addRanks() {
RanksData ranksData = new RanksData();
ranksData.setIndustry("浙江正泰物联技术有限公司");
ranksData.setCompanyCode("A70000059");
ranksData.setIndustry("浙江正泰仪器仪表有限责任公司");
ranksData.setCompanyCode("A10160001");
for (int i = 1; i < 13; i++) {
if (i <= 2) {
ranksData.setLevel(4);
@ -1209,10 +1225,27 @@ class RouteApplicationTests {
}
@Test
// @Test
void testQueryCity() {
Location location = locationRepository.findById(373L);
Location cityLocation = lyOrderSyncAdapter.getCityLocation(location);
System.out.println(cityLocation);
}
// @Test
void testTimeFor(){
LocalDateTime localDateTime = DateTimeUtil.strToTimeMM("2024-03-04 00:23:26.727");
System.out.println(localDateTime);
}
// @Test
void testFindOrderRecord(){
CTripHotelRecord hotelRecordByRecordId = cTripOrderDetail.findHotelRecordByRecordId("98494942");
System.out.println(hotelRecordByRecordId);
}
// @Test
void testInBlackList(){
orderDomainService.checkCompanyNameIfBlack("乐清正泰电器销售有限公司");
}
}