结算明细字段映射调整,添加归属部门
This commit is contained in:
parent
b3a071d13c
commit
edb6072433
|
@ -588,7 +588,7 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac
|
|||
return orderHotelRecord;
|
||||
}
|
||||
|
||||
private String belongDeport(String employeeNo, String accountCompanyName) {
|
||||
public String belongDeport(String employeeNo, String accountCompanyName) {
|
||||
User user = userRepository.findByUserEmployeeNo(employeeNo);
|
||||
if (user == null) {
|
||||
user = userHttpRequest.loadUserBaseInfo(User.withEmployeeNo(employeeNo));
|
||||
|
|
|
@ -6,6 +6,7 @@ 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.*;
|
||||
import com.chint.domain.aggregates.user.User;
|
||||
import com.chint.infrastructure.repository.jdbc.*;
|
||||
import com.chint.infrastructure.util.BeanCopyUtils;
|
||||
import com.chint.interfaces.rest.bpm.dto.BPMResponse;
|
||||
|
@ -40,12 +41,13 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor
|
|||
@Autowired
|
||||
private JdbcRouteRepository jdbcRouteRepository;
|
||||
|
||||
@Autowired
|
||||
private OrderRecordFactory orderRecordFactory;
|
||||
|
||||
@Autowired
|
||||
private JdbcOrderTravelRepository orderTravelRepository;
|
||||
|
||||
@Autowired
|
||||
private CTripOrderRecordExtensionFactory cTripOrderRecordExtensionFactory;
|
||||
|
||||
@Override
|
||||
public OrderFlightRecord createFlightOrderRecord(Object orderFlightRecordData) {
|
||||
OrderFlightRecord orderFlightRecord = new OrderFlightRecord();
|
||||
|
@ -101,7 +103,6 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor
|
|||
.setAccountPeriod(getAccountPeriod(lyOrderFlightRecord.getStatementCode()))//账期号
|
||||
.setBillNo(lyOrderFlightRecord.getBillOrderNo())//账单号
|
||||
.setOrderNo(lyOrderFlightRecord.getOrderSerialNo())//订单号
|
||||
.setParentOrderNo(flightOrderDetail.getParentOrderNo())//父级订单号
|
||||
.setOriginalOrderNo(lyOrderFlightRecord.getOriginOrderSerialNo())//原始订单号
|
||||
.setTicketNo(StringUtils.isBlank(lyOrderFlightRecord.getTicketNo()) ? null : lyOrderFlightRecord.getTicketNo().replace("-", ""));//票号
|
||||
//行程单号
|
||||
|
@ -114,15 +115,7 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor
|
|||
.setUserCode(lyOrderFlightRecord.getPassengerExternalId())//出行人编码
|
||||
.setOverStandard(lyOrderFlightRecord.getOverStandardStatus())//"是否违规(超标):0否 ,1是"
|
||||
.setOverStandardReason(lyOrderFlightRecord.getViolationReason())//违规原因(超标原因)
|
||||
.setStartAirportName(flightOrderDetail.getStartAirportName())//起飞机场名称
|
||||
.setStartCityCode(flightOrderDetail.getStartCityCode())//起飞城市编码
|
||||
.setStartCityName(flightOrderDetail.getStartCityName())//起飞城市名称
|
||||
.setStartTime(lyOrderFlightRecord.getPlanBeginDate())//起飞时间 yyyy-MM-dd HH:mm:ss
|
||||
.setEndAirportCode(flightOrderDetail.getEndAirportCode())//到达机场三字码
|
||||
.setEndAirportName(flightOrderDetail.getEndAirportName())//到达机场名称
|
||||
.setEndCityCode(flightOrderDetail.getEndCityCode())//到达城市编码
|
||||
.setEndCityName(flightOrderDetail.getEndCityName())//到达城市名称
|
||||
.setEndTerminal(flightOrderDetail.getEndTerminal())//到达航站楼
|
||||
.setEndTime(lyOrderFlightRecord.getPlanEndDate())//到达时间 yyyy-MM-dd HH:mm:ss
|
||||
.setFlightCompName(lyOrderFlightRecord.getAirlineCompanyName())//航空公司名称
|
||||
.setFlightLowestPrice(String.valueOf(lyOrderFlightRecord.getFligthMinPrice()))//航班最低价
|
||||
|
@ -157,6 +150,29 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor
|
|||
// .setSettleOrderFlag() //订单对账状态
|
||||
.setPayAmount(String.valueOf(lyOrderFlightRecord.getToBePayAmount() + lyOrderFlightRecord.getServiceAmount()))//支付金额
|
||||
;
|
||||
//订单明细字段赋值
|
||||
setFlightRecordDetail(orderFlightRecord, flightOrderDetail);
|
||||
|
||||
//这里添加归属部门编号 , 这里兼容测试环境 , 如果行程规划单已经有这个值 , 那么直接取, 没有的话,查找用户的部门获取
|
||||
Optional<RouterOrderExtensionField> routerOrderExtensionField = Optional.of(routeOrder)
|
||||
.flatMap(it -> Optional.ofNullable(it.getRouterOrderExtensionField()));
|
||||
routerOrderExtensionField.ifPresentOrElse(it -> orderFlightRecord.loadBelongDeport(it.getBelongDeptCode()),
|
||||
() -> orderFlightRecord.loadBelongDeport(
|
||||
cTripOrderRecordExtensionFactory.belongDeport(orderFlightRecord.getBookingUserCode(), orderFlightRecord.getAccountCompanyName())
|
||||
));
|
||||
}
|
||||
|
||||
//订单明细字段赋值
|
||||
private void setFlightRecordDetail(OrderFlightRecord orderFlightRecord, FlightOrderDetail flightOrderDetail) {
|
||||
orderFlightRecord.setParentOrderNo(flightOrderDetail.getParentOrderNo())//父级订单号
|
||||
.setStartAirportName(flightOrderDetail.getStartAirportName())//起飞机场名称
|
||||
.setStartCityCode(flightOrderDetail.getStartCityCode())//起飞城市编码
|
||||
.setStartCityName(flightOrderDetail.getStartCityName())//起飞城市名称
|
||||
.setEndAirportCode(flightOrderDetail.getEndAirportCode())//到达机场三字码
|
||||
.setEndAirportName(flightOrderDetail.getEndAirportName())//到达机场名称
|
||||
.setEndCityCode(flightOrderDetail.getEndCityCode())//到达城市编码
|
||||
.setEndCityName(flightOrderDetail.getEndCityName())//到达城市名称
|
||||
.setEndTerminal(flightOrderDetail.getEndTerminal());//到达航站楼
|
||||
}
|
||||
|
||||
|
||||
|
@ -193,10 +209,8 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor
|
|||
.setCountry(lyOrderHotelRecord.getCountryName()) //国家
|
||||
.setCustomerServiceName("") //客服处理人
|
||||
.setDepartureDate(lyOrderHotelRecord.getLeaveTime()) //离店日期yyyy - MM - dd
|
||||
.setHotelAddress(hotelOrderDetail.getHotelAddress()) //酒店地址
|
||||
.setHotelName(lyOrderHotelRecord.getHotelName()) //酒店名称
|
||||
.setIncludeAmount("") //含早情况:XX份
|
||||
.setIsAgreement("是".equals(hotelOrderDetail.getAgreementHotel()) ? "1" : "0") //是否协议酒店:0否1是
|
||||
.setPaymentType(getPaymentType(lyOrderHotelRecord.getPayType()))//"付款方式:0-公司统付 1-个人付 2-混付"
|
||||
.setOrderAmount(String.valueOf(lyOrderHotelRecord.getToBePayAmount())) //结算总额
|
||||
.setCompanyAmount(String.valueOf(lyOrderHotelRecord.getToBePayAmount())) //企业统付总额
|
||||
|
@ -204,7 +218,6 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor
|
|||
.setUnifiedPayAmt(String.valueOf(lyOrderHotelRecord.getServiceAmount())) //统付服务费
|
||||
.setPersonalPayAmt("") //个人服务费
|
||||
.setProvince("") //省份
|
||||
.setRoomCount(Integer.parseInt(StringUtils.isBlank(hotelOrderDetail.getRoomCount()) ? "1" : hotelOrderDetail.getRoomCount())) //房间数
|
||||
.setRoomNightCount(lyOrderHotelRecord.getHotelNights()) //夜间数
|
||||
.setNightCount(lyOrderHotelRecord.getHotelNights()) //间夜数
|
||||
.setRoomPrice("") //房价(房间单价不包含服务费)
|
||||
|
@ -217,19 +230,37 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor
|
|||
.setNoTaxCusFee("") //托管费不含税
|
||||
.setTaxCusFee("") //托管费税费
|
||||
.setRoomTypeName(lyOrderHotelRecord.getBedType()) //房型
|
||||
.setStarRate(hotelOrderDetail.getStarRate()) //星级
|
||||
.setOrderSource(StringUtils.isNotBlank(lyOrderHotelRecord.getOutApplayOrderNo()) ? "Y" : "N") //预订来源:线上/线下
|
||||
.setBookOrgCode1(lyOrderHotelRecord.getPassengerDepartment()) //入住人组织架构信息1
|
||||
.setBookOrgCode2(hotelOrderDetail.getBOOK_ORG_STRUCT_2()) //入住人组织架构信息2
|
||||
.setBookOrgCode3(hotelOrderDetail.getBOOK_ORG_STRUCT_3()) //入住人组织架构信息3
|
||||
.setOfflineCcomyCode(lyOrderHotelRecord.getPassengerCostCenter()) //成本中心
|
||||
.setOrderStatus("") //结算状态
|
||||
// .setExpenseOrderAmount("") //订单金额
|
||||
// .setSettleOrderFlag() //订单对账状态
|
||||
.setPayAmount(String.valueOf(lyOrderHotelRecord.getToBePayAmount() + lyOrderHotelRecord.getServiceAmount())) //支付金额
|
||||
;
|
||||
//订单明细字段赋值
|
||||
setHotelRecordDetail(orderHotelRecord, hotelOrderDetail);
|
||||
|
||||
//这里添加归属部门编号 , 这里兼容测试环境 , 如果行程规划单已经有这个值 , 那么直接取, 没有的话,查找用户的部门获取
|
||||
Optional<RouterOrderExtensionField> routerOrderExtensionField = Optional.of(routeOrder)
|
||||
.flatMap(it -> Optional.ofNullable(it.getRouterOrderExtensionField()));
|
||||
routerOrderExtensionField.ifPresentOrElse(it -> orderHotelRecord.loadBelongDeport(it.getBelongDeptCode()),
|
||||
() -> orderHotelRecord.loadBelongDeport(
|
||||
cTripOrderRecordExtensionFactory.belongDeport(orderHotelRecord.getBookingUserCode(), orderHotelRecord.getAccountCompanyName())
|
||||
));
|
||||
}
|
||||
|
||||
//酒店订单明细字段赋值
|
||||
private void setHotelRecordDetail(OrderHotelRecord orderHotelRecord, HotelOrderDetail hotelOrderDetail) {
|
||||
orderHotelRecord.setHotelAddress(hotelOrderDetail.getHotelAddress()) //酒店地址
|
||||
.setIsAgreement("是".equals(hotelOrderDetail.getAgreementHotel()) ? "1" : "0") //是否协议酒店:0否1是
|
||||
.setRoomCount(Integer.parseInt(StringUtils.isBlank(hotelOrderDetail.getRoomCount()) ? "1" : hotelOrderDetail.getRoomCount())) //房间数
|
||||
.setStarRate(hotelOrderDetail.getStarRate()) //星级
|
||||
.setBookOrgCode2(hotelOrderDetail.getBOOK_ORG_STRUCT_2()) //入住人组织架构信息2
|
||||
.setBookOrgCode3(hotelOrderDetail.getBOOK_ORG_STRUCT_3()); //入住人组织架构信息3
|
||||
}
|
||||
|
||||
|
||||
private void createTrainOrder(OrderTrainRecord orderTrainRecord, LyOrderTrainRecord lyOrderTrainRecord) {
|
||||
String orderSerialNo = lyOrderTrainRecord.getOrderSerialNo();//订单号
|
||||
AtomicReference<OrderDetail> orderDetailRef = new AtomicReference<>();
|
||||
|
@ -247,7 +278,6 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor
|
|||
.setAccountPeriod(getAccountPeriod(lyOrderTrainRecord.getStatementCode())) //账期号
|
||||
.setBillNo(lyOrderTrainRecord.getBillOrderNo()) //账单号
|
||||
.setOrderNo(lyOrderTrainRecord.getOrderSerialNo()) //订单号
|
||||
.setParentOrderNo(trainOrderDetail.getParentOrderNo()) //父级订单号
|
||||
.setOriginalOrderNo(lyOrderTrainRecord.getOriginOrderSerialNo());//原始订单号
|
||||
orderTrainRecord.setReceiptsNum(getReceiptsNum(lyOrderTrainRecord.getOutApplayOrderNo(), routeOrder))//关联申请单号
|
||||
.setReceiptsNumOrigin(lyOrderTrainRecord.getOutApplayOrderNo()) //原关联申请单号
|
||||
|
@ -273,16 +303,11 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor
|
|||
.setToCity(lyOrderTrainRecord.getTripName()) //到达城市
|
||||
.setToStationName(lyOrderTrainRecord.getTripName()) //到达站
|
||||
.setIssueTicketTime(lyOrderTrainRecord.getEnterAccount()) //出票时间 yyyy-MM-dd HH:mm:ss
|
||||
.setRunTime(trainOrderDetail.getRunTime()) //时长
|
||||
.setSeatType(trainOrderDetail.getSeatType())// 座位等级
|
||||
.setTrainNo(lyOrderTrainRecord.getTrainNo()) //车次
|
||||
.setUserCode(lyOrderTrainRecord.getPassengerNo())//出行人编码
|
||||
.setUserName(lyOrderTrainRecord.getPassengerName())//出行人姓名
|
||||
.setOrderSource(StringUtils.isNotBlank(lyOrderTrainRecord.getOutApplayOrderNo()) ? "Y" : "N")//预订来源:线上 / 线下
|
||||
// .setOrderSource(lyOrderTrainRecord.getBookingPlat())//预订来源:线上 / 线下
|
||||
.setBookOrgCode1(lyOrderTrainRecord.getPassengerDepartment())//出行人组织架构信息1
|
||||
.setBookOrgCode2(trainOrderDetail.getBOOK_ORG_STRUCT_2())//出行人组织架构信息2
|
||||
.setBookOrgCode3(trainOrderDetail.getBOOK_ORG_STRUCT_3())//出行人组织架构信息3
|
||||
.setOfflineCcomyCode(lyOrderTrainRecord.getPassengerCostCenter())//成本中心
|
||||
// .setOrderStatus() //结算状态
|
||||
// .setExpenseOrderAmount() //订单金额
|
||||
|
@ -298,6 +323,25 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor
|
|||
.setTrainTime("")//发车时间 yyyy - MM - dd HH:mm:ss
|
||||
.setYxId("")//影像比对ID*/
|
||||
;
|
||||
//订单明细字段赋值
|
||||
setTrainRecordDetail(orderTrainRecord, trainOrderDetail);
|
||||
|
||||
//这里添加归属部门编号 , 这里兼容测试环境 , 如果行程规划单已经有这个值 , 那么直接取, 没有的话,查找用户的部门获取
|
||||
Optional<RouterOrderExtensionField> routerOrderExtensionField = Optional.of(routeOrder)
|
||||
.flatMap(it -> Optional.ofNullable(it.getRouterOrderExtensionField()));
|
||||
routerOrderExtensionField.ifPresentOrElse(it -> orderTrainRecord.loadBelongDeport(it.getBelongDeptCode()),
|
||||
() -> orderTrainRecord.loadBelongDeport(
|
||||
cTripOrderRecordExtensionFactory.belongDeport(orderTrainRecord.getBookingUserCode(), orderTrainRecord.getAccountCompanyName())
|
||||
));
|
||||
}
|
||||
|
||||
//火车订单明细字段赋值
|
||||
private void setTrainRecordDetail(OrderTrainRecord orderTrainRecord, TrainOrderDetail trainOrderDetail) {
|
||||
orderTrainRecord.setParentOrderNo(trainOrderDetail.getParentOrderNo())//父级订单号
|
||||
.setRunTime(trainOrderDetail.getRunTime()) //时长
|
||||
.setSeatType(trainOrderDetail.getSeatType())// 座位等级
|
||||
.setBookOrgCode2(trainOrderDetail.getBOOK_ORG_STRUCT_2())//出行人组织架构信息2
|
||||
.setBookOrgCode3(trainOrderDetail.getBOOK_ORG_STRUCT_3());//出行人组织架构信息3
|
||||
}
|
||||
|
||||
private void createCarOrder(OrderCarRecord orderCarRecord, LyOrderCarRecord lyOrderCarRecord) {
|
||||
|
@ -321,19 +365,13 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor
|
|||
.setOverStandard("否") //"是否违规(超标):0否 1是"
|
||||
.setOverStandardReason("无")//违规原因(超标原因)
|
||||
.setOrderNo(lyOrderCarRecord.getOrderSerialNo()) //订单号
|
||||
.setParentOrderNo(carOrderDetail.getParentOrderNo())//父级订单号
|
||||
.setOriginalOrderNo(lyOrderCarRecord.getOriginOrderSerialNo())//原始订单号
|
||||
.setOrderStatus("") //"结算状态"
|
||||
.setCreateTime(lyOrderCarRecord.getBookingDate()) //"订单创建时间格式:2023-04-26 13:15:17"
|
||||
.setStartTime(lyOrderCarRecord.getPlanBeginDate()) //"出发时间格式:2023-04-26 13:15:17"
|
||||
.setArriveTime(carOrderDetail.getArriveTime()) //"到达时间格式:2023-04-26 13:15:17"
|
||||
.setFromStationName(lyOrderCarRecord.getCarStartPlaceActual()) //出发地
|
||||
.setToStationName(lyOrderCarRecord.getCarEndPlaceActual()) //到达地
|
||||
.setCarType(carOrderDetail.getCarModel()) //车型
|
||||
.setFromCity(lyOrderCarRecord.getStartCityName()) //出发城市
|
||||
.setToCity(carOrderDetail.getToCity()) //到达城市
|
||||
.setRunTime(carOrderDetail.getRunTime()) //运行时长
|
||||
.setMiles(carOrderDetail.getMileage()) //里程数
|
||||
.setNoTaxAmt("") //未税金额
|
||||
.setTaxAmt("") //税费
|
||||
.setOrderAmount(String.valueOf(lyOrderCarRecord.getToBePayAmount())) //结算总额(含前收服务费)
|
||||
|
@ -344,21 +382,41 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor
|
|||
.setCancelCost(String.valueOf(lyOrderCarRecord.getToBePayAmount())) //取消费
|
||||
.setUserName(String.valueOf(lyOrderCarRecord.getPassengerName())) //用车人姓名
|
||||
.setUserCode(lyOrderCarRecord.getPassengerNo()) //用车人code
|
||||
.setOwnPayAmt(carOrderDetail.getPersonalPaymentAmount()) //个人支付金额
|
||||
.setComyPayAmt(String.valueOf(lyOrderCarRecord.getToBePayAmount())) //公司统付金额
|
||||
.setBookOrgCode1(lyOrderCarRecord.getPassengerDepartment()) //用车人组织架构信息1
|
||||
.setBookOrgCode2(carOrderDetail.getBOOK_ORG_STRUCT_2()) //用车人组织架构信息2
|
||||
.setBookOrgCode3(carOrderDetail.getBOOK_ORG_STRUCT_3()) //用车人组织架构信息3
|
||||
.setPaymentType(String.valueOf(getPaymentType(lyOrderCarRecord.getPayType()))) //"付款方式0:公司统付 1:个人付 2:混付"
|
||||
.setOfflineCcomyCode(lyOrderCarRecord.getPassengerDepartment()) //成本中心
|
||||
.setOrderSource(StringUtils.isNotBlank(lyOrderCarRecord.getOutApplayOrderNo()) ? "Y" : "N") //预订来源:线上/线下
|
||||
// .setExpenseOrderAmount() //订单金额
|
||||
// .setSettleOrderFlag() //订单对账状态
|
||||
.setPayAmount(String.valueOf(lyOrderCarRecord.getToBePayAmount() + lyOrderCarRecord.getServiceAmount()))// 支付金额
|
||||
|
||||
;
|
||||
//订单明细字段赋值
|
||||
setCarRecordDetail(orderCarRecord, carOrderDetail);
|
||||
|
||||
//这里添加归属部门编号 , 这里兼容测试环境 , 如果行程规划单已经有这个值 , 那么直接取, 没有的话,查找用户的部门获取
|
||||
Optional<RouterOrderExtensionField> routerOrderExtensionField = Optional.of(routeOrder)
|
||||
.flatMap(it -> Optional.ofNullable(it.getRouterOrderExtensionField()));
|
||||
routerOrderExtensionField.ifPresentOrElse(it -> orderCarRecord.loadBelongDeport(it.getBelongDeptCode()),
|
||||
() -> orderCarRecord.loadBelongDeport(
|
||||
cTripOrderRecordExtensionFactory.belongDeport(orderCarRecord.getBookingUserCode(), orderCarRecord.getAccountCompanyName())
|
||||
));
|
||||
}
|
||||
|
||||
//用车订单明细字段赋值
|
||||
private void setCarRecordDetail(OrderCarRecord orderCarRecord, CarOrderDetail carOrderDetail) {
|
||||
orderCarRecord.setParentOrderNo(carOrderDetail.getParentOrderNo())//父级订单号
|
||||
.setArriveTime(carOrderDetail.getArriveTime()) //"到达时间格式:2023-04-26 13:15:17"
|
||||
.setCarType(carOrderDetail.getCarModel()) //车型
|
||||
.setToCity(carOrderDetail.getToCity()) //到达城市
|
||||
.setRunTime(carOrderDetail.getRunTime()) //运行时长
|
||||
.setMiles(carOrderDetail.getMileage()) //里程数
|
||||
.setOwnPayAmt(carOrderDetail.getPersonalPaymentAmount()) //个人支付金额
|
||||
.setBookOrgCode2(carOrderDetail.getBOOK_ORG_STRUCT_2()) //用车人组织架构信息2
|
||||
.setBookOrgCode3(carOrderDetail.getBOOK_ORG_STRUCT_3()); //用车人组织架构信息3
|
||||
}
|
||||
|
||||
|
||||
//获取公共对象
|
||||
public OrderRecordBasic getOrderRecordBasic(String orderSerialNo, Consumer<OrderDetail> consumerOrderDetail, Consumer<RouteOrder> consumerRouteOrder) {
|
||||
OrderDetail orderDetail = jdbcOrderDetailRepository.findByOrderNo(orderSerialNo);
|
||||
|
@ -380,17 +438,24 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor
|
|||
//获取账期号 202403
|
||||
public String getAccountPeriod(String statementCode) {
|
||||
LocalDate currentDate = LocalDate.now();
|
||||
String nowDate = currentDate.format(DateTimeFormatter.ofPattern("yyyyMMdd"));
|
||||
DateTimeFormatter format = DateTimeFormatter.ofPattern("yyyyMM");
|
||||
DateTimeFormatter formatDay = DateTimeFormatter.ofPattern("yyyyMMdd");
|
||||
String nowDate = currentDate.format(formatDay);
|
||||
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;
|
||||
String dateString = datePrefix + dateSuffix;
|
||||
// 补全日期信息,假设为每月的第一天
|
||||
String completeDateString = dateString + "01";
|
||||
// 解析为 LocalDate 对象
|
||||
LocalDate localDate = LocalDate.parse(completeDateString, formatDay);
|
||||
// 减去一个月的时间间隔
|
||||
LocalDate lastMonthDate = localDate.minusMonths(1);
|
||||
return lastMonthDate.format(format);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -86,13 +86,13 @@ public class LogService {
|
|||
@Async
|
||||
@Scheduled(cron = "0 0 4 * * 1") // 每周一凌晨4点执行一次
|
||||
public void timedClearLog() {
|
||||
//清空日志前一周的数据
|
||||
Integer count = jdbcSystemLogRepository.deleteLogsOlderThanOneMonth(7);
|
||||
//清空日志前30天的数据
|
||||
Integer count = jdbcSystemLogRepository.deleteLogsOlderThanOneMonth(30);
|
||||
log.info("日志删除成功:{}条", count);
|
||||
//获取目前的日志总数量
|
||||
long nums = jdbcSystemLogRepository.count();
|
||||
long maxLogCount = 1000000L;
|
||||
//如果删除一个月前的日志数量后,表中数量还是大于100万条
|
||||
long maxLogCount = 3000000L;
|
||||
//如果删除一个月前的日志数量后,表中数量还是大于300万条
|
||||
if (nums > maxLogCount) {
|
||||
// 计算需要删除的记录数
|
||||
long deleteCount = nums - maxLogCount;
|
||||
|
|
|
@ -60,6 +60,7 @@ import com.fasterxml.jackson.core.JsonProcessingException;
|
|||
import com.google.gson.Gson;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
|
@ -638,7 +639,7 @@ public class ExcelTest {
|
|||
System.out.println("bean = " + bean);
|
||||
}
|
||||
|
||||
@Test
|
||||
// @Test
|
||||
public void testDto() {
|
||||
AtomicReference<OrderDetail> orderDetailRef = new AtomicReference<>();
|
||||
OrderRecordBasic orderRecordBasic = getOrderRecordBasic("123", orderDetailRef::set);
|
||||
|
@ -671,7 +672,7 @@ public class ExcelTest {
|
|||
return null;
|
||||
}
|
||||
|
||||
@Test
|
||||
// @Test
|
||||
public void testStrDto() {
|
||||
String ab = "dadasd";
|
||||
String[] split = ab.split("-");
|
||||
|
@ -679,7 +680,7 @@ public class ExcelTest {
|
|||
}
|
||||
|
||||
//获取账期号
|
||||
@Test
|
||||
// @Test
|
||||
public void getAccountPeriod() {
|
||||
// 获取当前时间
|
||||
LocalDate now = LocalDate.now();
|
||||
|
@ -696,7 +697,7 @@ public class ExcelTest {
|
|||
@Autowired
|
||||
private JdbcRouteRepository repository;
|
||||
|
||||
// @Test
|
||||
// @Test
|
||||
@Transactional
|
||||
public void getRouteOrder() throws Exception {
|
||||
int count = 0;//初始化变量
|
||||
|
|
Loading…
Reference in New Issue