结算明细字段映射调整
This commit is contained in:
parent
1c235c3f3d
commit
415a0f182c
|
@ -69,7 +69,7 @@ public class AutoWorkController {
|
|||
public Result<String> autoSaveLYRecord() {
|
||||
//同步拉取上月数据
|
||||
lyStatementOrder.saveAll();
|
||||
//将上月的结算数据生成为财务共享需要的数据
|
||||
//将未转换的结算数据生成为财务共享需要的数据
|
||||
Command.of(LYOrderRecordGenerateCommand.class).sendToQueue();
|
||||
return Result.Success(SUCCESS);
|
||||
}
|
||||
|
|
|
@ -14,6 +14,8 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
|
@ -94,12 +96,12 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor
|
|||
flightFieldCheck(orderFlightRecord, lyOrderFlightRecord);
|
||||
orderFlightRecord.setDetailId(lyOrderFlightRecord.getBillOrderNo())//防重标识
|
||||
.setTicketClerk(lyOrderFlightRecord.getReserveManName())//票务员
|
||||
.setAccountPeriod(lyOrderFlightRecord.getStatementCode())//账期号
|
||||
.setAccountPeriod(getAccountPeriod(lyOrderFlightRecord.getStatementCode()))//账期号
|
||||
.setBillNo(lyOrderFlightRecord.getBillOrderNo())//账单号
|
||||
.setOrderNo(lyOrderFlightRecord.getOrderSerialNo())//订单号
|
||||
.setParentOrderNo(flightOrderDetail.getParentOrderNo())//父级订单号
|
||||
.setOriginalOrderNo(lyOrderFlightRecord.getOriginOrderSerialNo())//原始订单号
|
||||
.setTicketNo(lyOrderFlightRecord.getTicketNo());//票号
|
||||
.setTicketNo(StringUtils.isBlank(lyOrderFlightRecord.getTicketNo()) ? null : lyOrderFlightRecord.getTicketNo().replace("-", ""));//票号
|
||||
//行程单号
|
||||
List<OrderTravel> byOrderNo = orderTravelRepository.findByOrderNo(orderSerialNo);
|
||||
String travelNo = byOrderNo.isEmpty() ? "" : byOrderNo.get(0).getTravelNo();
|
||||
|
@ -170,7 +172,7 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor
|
|||
hotelFieldCheck(orderHotelRecord, lyOrderHotelRecord);
|
||||
orderHotelRecord.setDetailId(lyOrderHotelRecord.getBillOrderNo())//防重标识
|
||||
.setTicketClerk(lyOrderHotelRecord.getReserveManName()) //票务员
|
||||
.setAccountPeriod(lyOrderHotelRecord.getStatementCode()) //账期号
|
||||
.setAccountPeriod(getAccountPeriod(lyOrderHotelRecord.getStatementCode())) //账期号
|
||||
.setBillNo(lyOrderHotelRecord.getBillOrderNo()) //账单号(结算单号)
|
||||
.setOrderNo(lyOrderHotelRecord.getOrderSerialNo()) //订单号
|
||||
.setParentOrderNo("") //父级订单号
|
||||
|
@ -240,7 +242,7 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor
|
|||
trainFieldCheck(orderTrainRecord, lyOrderTrainRecord);
|
||||
orderTrainRecord.setDetailId(lyOrderTrainRecord.getBillOrderNo())//防重标识
|
||||
.setTicketClerk(lyOrderTrainRecord.getReserveManName()) //票务员
|
||||
.setAccountPeriod(lyOrderTrainRecord.getStatementCode()) //账期号
|
||||
.setAccountPeriod(getAccountPeriod(lyOrderTrainRecord.getStatementCode())) //账期号
|
||||
.setBillNo(lyOrderTrainRecord.getBillOrderNo()) //账单号
|
||||
.setOrderNo(lyOrderTrainRecord.getOrderSerialNo()) //订单号
|
||||
.setParentOrderNo(trainOrderDetail.getParentOrderNo()) //父级订单号
|
||||
|
@ -310,7 +312,7 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor
|
|||
carFieldCheck(orderCarRecord, lyOrderCarRecord);
|
||||
orderCarRecord.setDetailId(lyOrderCarRecord.getBillOrderNo())//防重标识
|
||||
.setTicketClerk(lyOrderCarRecord.getReserveManName()) //票务员
|
||||
.setAccountPeriod(lyOrderCarRecord.getStatementCode()) //账期号
|
||||
.setAccountPeriod(getAccountPeriod(lyOrderCarRecord.getStatementCode())) //账期号
|
||||
.setBillNo(lyOrderCarRecord.getBillOrderNo()); //账单号
|
||||
orderCarRecord.setReceiptsNum(getReceiptsNum(lyOrderCarRecord.getOutApplayOrderNo(), routeOrder))//关联申请单号
|
||||
.setReceiptsNumOrigin(lyOrderCarRecord.getOutApplayOrderNo()) //原关联申请单号
|
||||
|
@ -372,6 +374,23 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor
|
|||
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) {
|
||||
orderFlightRecord.setTrvaleSysType(TRAVAL_SYS_TYPE_LY)//数据来源商旅平台 XC:携程 TC:同程
|
||||
.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()
|
||||
.filter(item -> LY_CUSTOM1.equals(item.getCode()))
|
||||
.findFirst()
|
||||
|
@ -476,7 +495,7 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor
|
|||
}
|
||||
|
||||
//核算企业code
|
||||
private static Optional<String> findAccountCompanyId(List<TripSubmitItemList> tripSubmitItemList) {
|
||||
public Optional<String> findAccountCompanyId(List<TripSubmitItemList> tripSubmitItemList) {
|
||||
return tripSubmitItemList.stream()
|
||||
.filter(item -> LY_CUSTOM2.equals(item.getCode()))
|
||||
.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()
|
||||
.filter(item -> LY_CUSTOM3.equals(item.getCode()))
|
||||
.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()
|
||||
.filter(item -> LY_CUSTOM4.equals(item.getCode()))
|
||||
.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) {
|
||||
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.JdbcLyOrderTrainRecord;
|
||||
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.DetailResponse.CarStatement;
|
||||
import com.chint.interfaces.rest.ly.reconciliation.dto.DetailResponse.FlightStatement;
|
||||
|
@ -47,6 +48,8 @@ public class LyStatementOrder {
|
|||
@Autowired
|
||||
private JdbcLyOrderCarRecord jdbcLyOrderCarRecord;
|
||||
|
||||
@Autowired
|
||||
private LYSearchRequest lySearchRequest;
|
||||
|
||||
/**
|
||||
* 拉取保存数据
|
||||
|
@ -117,6 +120,7 @@ public class LyStatementOrder {
|
|||
!orderSerialNoList.contains(o.getBillOrderNo())
|
||||
).toList();
|
||||
List<LyOrderFlightRecord> lyOrderFlightRecords = BeanCopyUtils.copyBeanList(statementOrderListNew, LyOrderFlightRecord.class);
|
||||
//保存结算明细数据
|
||||
jdbcLyOrderFlightRecord.saveAll(lyOrderFlightRecords);
|
||||
flightCount++;
|
||||
} while (flightCount < flightPageCount);
|
||||
|
@ -141,11 +145,13 @@ public class LyStatementOrder {
|
|||
!orderSerialNoList.contains(o.getBillOrderNo())
|
||||
).toList();
|
||||
List<LyOrderHotelRecord> lyOrderHotelRecords = BeanCopyUtils.copyBeanList(statementOrderListNew, LyOrderHotelRecord.class);
|
||||
//保存结算明细数据
|
||||
jdbcLyOrderHotelRecord.saveAll(lyOrderHotelRecords);
|
||||
hotelCount++;
|
||||
} while (hotelCount < hotelPageCount);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 火车账单同步
|
||||
*/
|
||||
|
@ -165,6 +171,7 @@ public class LyStatementOrder {
|
|||
!orderSerialNoList.contains(o.getBillOrderNo())
|
||||
).toList();
|
||||
List<LyOrderTrainRecord> lyOrderTrainRecords = BeanCopyUtils.copyBeanList(statementOrderListNew, LyOrderTrainRecord.class);
|
||||
//保存结算明细数据
|
||||
jdbcLyOrderTrainRecord.saveAll(lyOrderTrainRecords);
|
||||
trainCount++;
|
||||
} while (trainCount < trainPageCount);
|
||||
|
@ -190,10 +197,44 @@ public class LyStatementOrder {
|
|||
!orderSerialNoList.contains(o.getBillOrderNo())
|
||||
).toList();
|
||||
List<LyOrderCarRecord> lyOrderCarRecords = BeanCopyUtils.copyBeanList(statementOrderListNew, LyOrderCarRecord.class);
|
||||
//保存结算明细数据
|
||||
jdbcLyOrderCarRecord.saveAll(lyOrderCarRecords);
|
||||
|
||||
carCount++;
|
||||
} 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