结算明细字段映射调整
This commit is contained in:
parent
616ac89182
commit
8895835e4a
|
@ -69,7 +69,7 @@ public class AutoWorkController {
|
||||||
public Result<String> autoSaveLYRecord() {
|
public Result<String> autoSaveLYRecord() {
|
||||||
//同步拉取上月数据
|
//同步拉取上月数据
|
||||||
lyStatementOrder.saveAll();
|
lyStatementOrder.saveAll();
|
||||||
//将上月的结算数据生成为财务共享需要的数据
|
//将未转换的结算数据生成为财务共享需要的数据
|
||||||
Command.of(LYOrderRecordGenerateCommand.class).sendToQueue();
|
Command.of(LYOrderRecordGenerateCommand.class).sendToQueue();
|
||||||
return Result.Success(SUCCESS);
|
return Result.Success(SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,8 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
@ -94,12 +96,12 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor
|
||||||
flightFieldCheck(orderFlightRecord, lyOrderFlightRecord);
|
flightFieldCheck(orderFlightRecord, lyOrderFlightRecord);
|
||||||
orderFlightRecord.setDetailId(lyOrderFlightRecord.getBillOrderNo())//防重标识
|
orderFlightRecord.setDetailId(lyOrderFlightRecord.getBillOrderNo())//防重标识
|
||||||
.setTicketClerk(lyOrderFlightRecord.getReserveManName())//票务员
|
.setTicketClerk(lyOrderFlightRecord.getReserveManName())//票务员
|
||||||
.setAccountPeriod(lyOrderFlightRecord.getStatementCode())//账期号
|
.setAccountPeriod(getAccountPeriod(lyOrderFlightRecord.getStatementCode()))//账期号
|
||||||
.setBillNo(lyOrderFlightRecord.getBillOrderNo())//账单号
|
.setBillNo(lyOrderFlightRecord.getBillOrderNo())//账单号
|
||||||
.setOrderNo(lyOrderFlightRecord.getOrderSerialNo())//订单号
|
.setOrderNo(lyOrderFlightRecord.getOrderSerialNo())//订单号
|
||||||
.setParentOrderNo(flightOrderDetail.getParentOrderNo())//父级订单号
|
.setParentOrderNo(flightOrderDetail.getParentOrderNo())//父级订单号
|
||||||
.setOriginalOrderNo(lyOrderFlightRecord.getOriginOrderSerialNo())//原始订单号
|
.setOriginalOrderNo(lyOrderFlightRecord.getOriginOrderSerialNo())//原始订单号
|
||||||
.setTicketNo(lyOrderFlightRecord.getTicketNo());//票号
|
.setTicketNo(StringUtils.isBlank(lyOrderFlightRecord.getTicketNo()) ? null : lyOrderFlightRecord.getTicketNo().replace("-", ""));//票号
|
||||||
//行程单号
|
//行程单号
|
||||||
List<OrderTravel> byOrderNo = orderTravelRepository.findByOrderNo(orderSerialNo);
|
List<OrderTravel> byOrderNo = orderTravelRepository.findByOrderNo(orderSerialNo);
|
||||||
String travelNo = byOrderNo.isEmpty() ? "" : byOrderNo.get(0).getTravelNo();
|
String travelNo = byOrderNo.isEmpty() ? "" : byOrderNo.get(0).getTravelNo();
|
||||||
|
@ -170,7 +172,7 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor
|
||||||
hotelFieldCheck(orderHotelRecord, lyOrderHotelRecord);
|
hotelFieldCheck(orderHotelRecord, lyOrderHotelRecord);
|
||||||
orderHotelRecord.setDetailId(lyOrderHotelRecord.getBillOrderNo())//防重标识
|
orderHotelRecord.setDetailId(lyOrderHotelRecord.getBillOrderNo())//防重标识
|
||||||
.setTicketClerk(lyOrderHotelRecord.getReserveManName()) //票务员
|
.setTicketClerk(lyOrderHotelRecord.getReserveManName()) //票务员
|
||||||
.setAccountPeriod(lyOrderHotelRecord.getStatementCode()) //账期号
|
.setAccountPeriod(getAccountPeriod(lyOrderHotelRecord.getStatementCode())) //账期号
|
||||||
.setBillNo(lyOrderHotelRecord.getBillOrderNo()) //账单号(结算单号)
|
.setBillNo(lyOrderHotelRecord.getBillOrderNo()) //账单号(结算单号)
|
||||||
.setOrderNo(lyOrderHotelRecord.getOrderSerialNo()) //订单号
|
.setOrderNo(lyOrderHotelRecord.getOrderSerialNo()) //订单号
|
||||||
.setParentOrderNo("") //父级订单号
|
.setParentOrderNo("") //父级订单号
|
||||||
|
@ -240,7 +242,7 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor
|
||||||
trainFieldCheck(orderTrainRecord, lyOrderTrainRecord);
|
trainFieldCheck(orderTrainRecord, lyOrderTrainRecord);
|
||||||
orderTrainRecord.setDetailId(lyOrderTrainRecord.getBillOrderNo())//防重标识
|
orderTrainRecord.setDetailId(lyOrderTrainRecord.getBillOrderNo())//防重标识
|
||||||
.setTicketClerk(lyOrderTrainRecord.getReserveManName()) //票务员
|
.setTicketClerk(lyOrderTrainRecord.getReserveManName()) //票务员
|
||||||
.setAccountPeriod(lyOrderTrainRecord.getStatementCode()) //账期号
|
.setAccountPeriod(getAccountPeriod(lyOrderTrainRecord.getStatementCode())) //账期号
|
||||||
.setBillNo(lyOrderTrainRecord.getBillOrderNo()) //账单号
|
.setBillNo(lyOrderTrainRecord.getBillOrderNo()) //账单号
|
||||||
.setOrderNo(lyOrderTrainRecord.getOrderSerialNo()) //订单号
|
.setOrderNo(lyOrderTrainRecord.getOrderSerialNo()) //订单号
|
||||||
.setParentOrderNo(trainOrderDetail.getParentOrderNo()) //父级订单号
|
.setParentOrderNo(trainOrderDetail.getParentOrderNo()) //父级订单号
|
||||||
|
@ -310,7 +312,7 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor
|
||||||
carFieldCheck(orderCarRecord, lyOrderCarRecord);
|
carFieldCheck(orderCarRecord, lyOrderCarRecord);
|
||||||
orderCarRecord.setDetailId(lyOrderCarRecord.getBillOrderNo())//防重标识
|
orderCarRecord.setDetailId(lyOrderCarRecord.getBillOrderNo())//防重标识
|
||||||
.setTicketClerk(lyOrderCarRecord.getReserveManName()) //票务员
|
.setTicketClerk(lyOrderCarRecord.getReserveManName()) //票务员
|
||||||
.setAccountPeriod(lyOrderCarRecord.getStatementCode()) //账期号
|
.setAccountPeriod(getAccountPeriod(lyOrderCarRecord.getStatementCode())) //账期号
|
||||||
.setBillNo(lyOrderCarRecord.getBillOrderNo()); //账单号
|
.setBillNo(lyOrderCarRecord.getBillOrderNo()); //账单号
|
||||||
orderCarRecord.setReceiptsNum(getReceiptsNum(lyOrderCarRecord.getOutApplayOrderNo(), routeOrder))//关联申请单号
|
orderCarRecord.setReceiptsNum(getReceiptsNum(lyOrderCarRecord.getOutApplayOrderNo(), routeOrder))//关联申请单号
|
||||||
.setReceiptsNumOrigin(lyOrderCarRecord.getOutApplayOrderNo()) //原关联申请单号
|
.setReceiptsNumOrigin(lyOrderCarRecord.getOutApplayOrderNo()) //原关联申请单号
|
||||||
|
@ -372,6 +374,23 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor
|
||||||
return orderRecordFactory.buildWithRouteOrder(routeOrder);
|
return orderRecordFactory.buildWithRouteOrder(routeOrder);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//获取账期号 202403
|
||||||
|
public String getAccountPeriod(String statementCode) {
|
||||||
|
LocalDate currentDate = LocalDate.now();
|
||||||
|
String nowDate = currentDate.format(DateTimeFormatter.ofPattern("yyyyMMdd"));
|
||||||
|
if (StringUtils.isBlank(statementCode)) {
|
||||||
|
//如果为空,获取上月赋值
|
||||||
|
LocalDate lastMonthDate = currentDate.minusMonths(1);
|
||||||
|
return lastMonthDate.format(DateTimeFormatter.ofPattern("yyyyMM"));
|
||||||
|
}
|
||||||
|
String dateSuffix = statementCode.substring(2, 6);
|
||||||
|
|
||||||
|
String datePrefix = nowDate.substring(0, 2);
|
||||||
|
System.out.println(datePrefix + dateSuffix);
|
||||||
|
return datePrefix + dateSuffix;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public void flightFieldCheck(OrderFlightRecord orderFlightRecord, LyOrderFlightRecord lyOrderFlightRecord) {
|
public void flightFieldCheck(OrderFlightRecord orderFlightRecord, LyOrderFlightRecord lyOrderFlightRecord) {
|
||||||
orderFlightRecord.setTrvaleSysType(TRAVAL_SYS_TYPE_LY)//数据来源商旅平台 XC:携程 TC:同程
|
orderFlightRecord.setTrvaleSysType(TRAVAL_SYS_TYPE_LY)//数据来源商旅平台 XC:携程 TC:同程
|
||||||
.setBookingName(lyOrderFlightRecord.getReserveManName()) //预订人姓名
|
.setBookingName(lyOrderFlightRecord.getReserveManName()) //预订人姓名
|
||||||
|
@ -465,7 +484,7 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor
|
||||||
}
|
}
|
||||||
|
|
||||||
//对应所属系统
|
//对应所属系统
|
||||||
private static String findBelongSysType(List<TripSubmitItemList> itemList, String outApplayOrderNo) {
|
public String findBelongSysType(List<TripSubmitItemList> itemList, String outApplayOrderNo) {
|
||||||
return itemList.stream()
|
return itemList.stream()
|
||||||
.filter(item -> LY_CUSTOM1.equals(item.getCode()))
|
.filter(item -> LY_CUSTOM1.equals(item.getCode()))
|
||||||
.findFirst()
|
.findFirst()
|
||||||
|
@ -476,7 +495,7 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor
|
||||||
}
|
}
|
||||||
|
|
||||||
//核算企业code
|
//核算企业code
|
||||||
private static Optional<String> findAccountCompanyId(List<TripSubmitItemList> tripSubmitItemList) {
|
public Optional<String> findAccountCompanyId(List<TripSubmitItemList> tripSubmitItemList) {
|
||||||
return tripSubmitItemList.stream()
|
return tripSubmitItemList.stream()
|
||||||
.filter(item -> LY_CUSTOM2.equals(item.getCode()))
|
.filter(item -> LY_CUSTOM2.equals(item.getCode()))
|
||||||
.findFirst()
|
.findFirst()
|
||||||
|
@ -484,7 +503,7 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor
|
||||||
}
|
}
|
||||||
|
|
||||||
////核算企业名称
|
////核算企业名称
|
||||||
private static Optional<String> findAccountCompanyName(List<TripSubmitItemList> tripSubmitItemList) {
|
public Optional<String> findAccountCompanyName(List<TripSubmitItemList> tripSubmitItemList) {
|
||||||
return tripSubmitItemList.stream()
|
return tripSubmitItemList.stream()
|
||||||
.filter(item -> LY_CUSTOM3.equals(item.getCode()))
|
.filter(item -> LY_CUSTOM3.equals(item.getCode()))
|
||||||
.findFirst()
|
.findFirst()
|
||||||
|
@ -492,7 +511,7 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor
|
||||||
}
|
}
|
||||||
|
|
||||||
//项目订单号
|
//项目订单号
|
||||||
private static Optional<String> findProjectOrderNo(List<TripSubmitItemList> tripSubmitItemList) {
|
public Optional<String> findProjectOrderNo(List<TripSubmitItemList> tripSubmitItemList) {
|
||||||
return tripSubmitItemList.stream()
|
return tripSubmitItemList.stream()
|
||||||
.filter(item -> LY_CUSTOM4.equals(item.getCode()))
|
.filter(item -> LY_CUSTOM4.equals(item.getCode()))
|
||||||
.findFirst()
|
.findFirst()
|
||||||
|
@ -500,21 +519,6 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void flightReceiptsNum(OrderFlightRecord orderFlightRecord, LyOrderFlightRecord lyOrderFlightRecord, RouteOrder routeOrder) {
|
|
||||||
ApproveOrderNo approveOrderNo = routeOrder.getApproveOrderNo();
|
|
||||||
String outApplayOrderNo = lyOrderFlightRecord.getOutApplayOrderNo();
|
|
||||||
String receiptsNum = "";
|
|
||||||
if (Objects.isNull(approveOrderNo) && StringUtils.isNotBlank(outApplayOrderNo)) {
|
|
||||||
String[] receiptsNums = outApplayOrderNo.split("-");
|
|
||||||
if (receiptsNums.length > 1) {
|
|
||||||
receiptsNum = receiptsNums[1];
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
receiptsNum = approveOrderNo.getActualOrderNo();
|
|
||||||
}
|
|
||||||
orderFlightRecord.setReceiptsNum(receiptsNum);
|
|
||||||
}
|
|
||||||
|
|
||||||
//获取财务共享单号
|
//获取财务共享单号
|
||||||
private String getReceiptsNum(String outApplayOrderNo, RouteOrder routeOrder) {
|
private String getReceiptsNum(String outApplayOrderNo, RouteOrder routeOrder) {
|
||||||
ApproveOrderNo approveOrderNo = routeOrder.getApproveOrderNo();
|
ApproveOrderNo approveOrderNo = routeOrder.getApproveOrderNo();
|
||||||
|
|
|
@ -9,6 +9,7 @@ import com.chint.infrastructure.repository.jdbc.JdbcLyOrderFlightRecord;
|
||||||
import com.chint.infrastructure.repository.jdbc.JdbcLyOrderHotelRecord;
|
import com.chint.infrastructure.repository.jdbc.JdbcLyOrderHotelRecord;
|
||||||
import com.chint.infrastructure.repository.jdbc.JdbcLyOrderTrainRecord;
|
import com.chint.infrastructure.repository.jdbc.JdbcLyOrderTrainRecord;
|
||||||
import com.chint.infrastructure.util.BeanCopyUtils;
|
import com.chint.infrastructure.util.BeanCopyUtils;
|
||||||
|
import com.chint.interfaces.rest.ly.LYSearchRequest;
|
||||||
import com.chint.interfaces.rest.ly.reconciliation.dto.BaseDetailParam;
|
import com.chint.interfaces.rest.ly.reconciliation.dto.BaseDetailParam;
|
||||||
import com.chint.interfaces.rest.ly.reconciliation.dto.DetailResponse.CarStatement;
|
import com.chint.interfaces.rest.ly.reconciliation.dto.DetailResponse.CarStatement;
|
||||||
import com.chint.interfaces.rest.ly.reconciliation.dto.DetailResponse.FlightStatement;
|
import com.chint.interfaces.rest.ly.reconciliation.dto.DetailResponse.FlightStatement;
|
||||||
|
@ -47,6 +48,8 @@ public class LyStatementOrder {
|
||||||
@Autowired
|
@Autowired
|
||||||
private JdbcLyOrderCarRecord jdbcLyOrderCarRecord;
|
private JdbcLyOrderCarRecord jdbcLyOrderCarRecord;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private LYSearchRequest lySearchRequest;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 拉取保存数据
|
* 拉取保存数据
|
||||||
|
@ -117,6 +120,7 @@ public class LyStatementOrder {
|
||||||
!orderSerialNoList.contains(o.getBillOrderNo())
|
!orderSerialNoList.contains(o.getBillOrderNo())
|
||||||
).toList();
|
).toList();
|
||||||
List<LyOrderFlightRecord> lyOrderFlightRecords = BeanCopyUtils.copyBeanList(statementOrderListNew, LyOrderFlightRecord.class);
|
List<LyOrderFlightRecord> lyOrderFlightRecords = BeanCopyUtils.copyBeanList(statementOrderListNew, LyOrderFlightRecord.class);
|
||||||
|
//保存结算明细数据
|
||||||
jdbcLyOrderFlightRecord.saveAll(lyOrderFlightRecords);
|
jdbcLyOrderFlightRecord.saveAll(lyOrderFlightRecords);
|
||||||
flightCount++;
|
flightCount++;
|
||||||
} while (flightCount < flightPageCount);
|
} while (flightCount < flightPageCount);
|
||||||
|
@ -141,11 +145,13 @@ public class LyStatementOrder {
|
||||||
!orderSerialNoList.contains(o.getBillOrderNo())
|
!orderSerialNoList.contains(o.getBillOrderNo())
|
||||||
).toList();
|
).toList();
|
||||||
List<LyOrderHotelRecord> lyOrderHotelRecords = BeanCopyUtils.copyBeanList(statementOrderListNew, LyOrderHotelRecord.class);
|
List<LyOrderHotelRecord> lyOrderHotelRecords = BeanCopyUtils.copyBeanList(statementOrderListNew, LyOrderHotelRecord.class);
|
||||||
|
//保存结算明细数据
|
||||||
jdbcLyOrderHotelRecord.saveAll(lyOrderHotelRecords);
|
jdbcLyOrderHotelRecord.saveAll(lyOrderHotelRecords);
|
||||||
hotelCount++;
|
hotelCount++;
|
||||||
} while (hotelCount < hotelPageCount);
|
} while (hotelCount < hotelPageCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 火车账单同步
|
* 火车账单同步
|
||||||
*/
|
*/
|
||||||
|
@ -165,6 +171,7 @@ public class LyStatementOrder {
|
||||||
!orderSerialNoList.contains(o.getBillOrderNo())
|
!orderSerialNoList.contains(o.getBillOrderNo())
|
||||||
).toList();
|
).toList();
|
||||||
List<LyOrderTrainRecord> lyOrderTrainRecords = BeanCopyUtils.copyBeanList(statementOrderListNew, LyOrderTrainRecord.class);
|
List<LyOrderTrainRecord> lyOrderTrainRecords = BeanCopyUtils.copyBeanList(statementOrderListNew, LyOrderTrainRecord.class);
|
||||||
|
//保存结算明细数据
|
||||||
jdbcLyOrderTrainRecord.saveAll(lyOrderTrainRecords);
|
jdbcLyOrderTrainRecord.saveAll(lyOrderTrainRecords);
|
||||||
trainCount++;
|
trainCount++;
|
||||||
} while (trainCount < trainPageCount);
|
} while (trainCount < trainPageCount);
|
||||||
|
@ -190,10 +197,44 @@ public class LyStatementOrder {
|
||||||
!orderSerialNoList.contains(o.getBillOrderNo())
|
!orderSerialNoList.contains(o.getBillOrderNo())
|
||||||
).toList();
|
).toList();
|
||||||
List<LyOrderCarRecord> lyOrderCarRecords = BeanCopyUtils.copyBeanList(statementOrderListNew, LyOrderCarRecord.class);
|
List<LyOrderCarRecord> lyOrderCarRecords = BeanCopyUtils.copyBeanList(statementOrderListNew, LyOrderCarRecord.class);
|
||||||
|
//保存结算明细数据
|
||||||
jdbcLyOrderCarRecord.saveAll(lyOrderCarRecords);
|
jdbcLyOrderCarRecord.saveAll(lyOrderCarRecords);
|
||||||
|
|
||||||
carCount++;
|
carCount++;
|
||||||
} while (carCount < carPageCount);
|
} while (carCount < carPageCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* //保存需要的机票订单明细字段
|
||||||
|
private void saveLyOrderFlightDetail(List<LyOrderFlightRecord> lyOrderFlightRecords) {
|
||||||
|
lyOrderFlightRecords.forEach(lyOrderFlightRecord -> {
|
||||||
|
lySearchRequest.getFlightOrderDetail(lyOrderFlightRecord.getOrderSerialNo());
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//保存需要的酒店订单明细字段
|
||||||
|
private void saveLyOrderHotelDetail(List<LyOrderHotelRecord> lyOrderHotelRecords) {
|
||||||
|
lyOrderHotelRecords.forEach(lyOrderHotelRecord -> {
|
||||||
|
lySearchRequest.getHotelOrderDetail(lyOrderHotelRecord.getOrderSerialNo());
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//保存需要的火车订单明细字段
|
||||||
|
private void saveLyOrderTrainDetail(List<LyOrderTrainRecord> lyOrderTrainRecords) {
|
||||||
|
lyOrderTrainRecords.forEach(lyOrderTrainRecord -> {
|
||||||
|
lySearchRequest.getTrainOrderDetail(lyOrderTrainRecord.getOrderSerialNo());
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//保存需要的用车订单明细字段
|
||||||
|
private void saveLyOrderCarDetail(List<LyOrderCarRecord> lyOrderCarRecords) {
|
||||||
|
lyOrderCarRecords.forEach(lyOrderCarRecord -> {
|
||||||
|
lySearchRequest.getCarDetailResponse(lyOrderCarRecord.getOrderSerialNo());
|
||||||
|
});
|
||||||
|
|
||||||
|
}*/
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue