备份差旅申请单代码
This commit is contained in:
commit
e903a95b35
|
@ -0,0 +1,29 @@
|
|||
package com.chint.domain.aggregates.base;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.springframework.data.annotation.CreatedDate;
|
||||
import org.springframework.data.annotation.LastModifiedBy;
|
||||
import org.springframework.data.annotation.LastModifiedDate;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
public class BaseTimeEntity implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 112312511366658864L;
|
||||
|
||||
@CreatedDate
|
||||
@ApiModelProperty("创建时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
public LocalDateTime createTime;
|
||||
|
||||
@LastModifiedDate
|
||||
@ApiModelProperty("最后更新时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
public LocalDateTime updateTime;
|
||||
}
|
|
@ -90,6 +90,9 @@ public class RouteOrder implements Serializable {
|
|||
@MappedCollection(idColumn = "route_id", keyColumn = "route_order_key")
|
||||
private List<ApprovalEvent> approveEvents;
|
||||
|
||||
@MappedCollection(idColumn = "route_id", keyColumn = "route_order_key")
|
||||
private List<RouteRequest> routeRequestList;
|
||||
|
||||
@ApiModelProperty("启用状态,1启动,0禁用")
|
||||
public Integer status = 1;
|
||||
|
||||
|
|
|
@ -1,4 +1,57 @@
|
|||
package com.chint.domain.aggregates.order;
|
||||
|
||||
public class RouteRequest {
|
||||
import com.chint.domain.aggregates.base.BaseEntity;
|
||||
import com.chint.domain.aggregates.base.BaseTimeEntity;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.springframework.data.annotation.CreatedDate;
|
||||
import org.springframework.data.annotation.Id;
|
||||
import org.springframework.data.annotation.LastModifiedDate;
|
||||
import org.springframework.data.annotation.Transient;
|
||||
import org.springframework.data.relational.core.mapping.MappedCollection;
|
||||
import org.springframework.data.relational.core.mapping.Table;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@Table("route_request")
|
||||
public class RouteRequest implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 7125989663091861990L;
|
||||
@Id
|
||||
private Long id;
|
||||
|
||||
private Long routeId;
|
||||
|
||||
private Long routeOrderKey;
|
||||
|
||||
private String RouteRequestNo;
|
||||
|
||||
private String supplier;
|
||||
|
||||
@MappedCollection(idColumn = "route_request_id", keyColumn = "route_request_key")
|
||||
private List<RouteRequestLeg> routeRequestLegList;
|
||||
|
||||
@MappedCollection(idColumn = "route_request_id", keyColumn = "route_request_key")
|
||||
private List<RouteRequestEvent> eventList;
|
||||
|
||||
@Transient
|
||||
private Integer status;
|
||||
@Transient
|
||||
private String statusName;
|
||||
|
||||
@CreatedDate
|
||||
@ApiModelProperty("创建时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
public LocalDateTime createTime;
|
||||
|
||||
@LastModifiedDate
|
||||
@ApiModelProperty("最后更新时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
public LocalDateTime updateTime;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
package com.chint.domain.aggregates.order;
|
||||
|
||||
import lombok.Data;
|
||||
import org.springframework.data.annotation.Id;
|
||||
import org.springframework.data.relational.core.mapping.Table;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
@Table("route_request_event")
|
||||
public class RouteRequestEvent implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 5421219887361331990L;
|
||||
@Id
|
||||
private Long id;
|
||||
|
||||
private Long routeRequestId;
|
||||
|
||||
private Long routeRequestKey;
|
||||
|
||||
private Integer eventType;
|
||||
|
||||
private String extension;
|
||||
|
||||
private LocalDateTime happenTime;
|
||||
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
package com.chint.domain.aggregates.order;
|
||||
|
||||
|
||||
import lombok.Data;
|
||||
import org.springframework.data.annotation.Id;
|
||||
import org.springframework.data.annotation.Transient;
|
||||
import org.springframework.data.relational.core.mapping.Table;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@Table("route_request_leg")
|
||||
public class RouteRequestLeg implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 4421908127368912654L;
|
||||
@Id
|
||||
private Long id;
|
||||
private Long routeRequestId;
|
||||
private Long routeRequestKey;
|
||||
private Long legId;
|
||||
@Transient
|
||||
private Leg leg;
|
||||
|
||||
public static RouteRequestLeg ofLeg(Leg leg) {
|
||||
RouteRequestLeg routeRequestLeg = new RouteRequestLeg();
|
||||
routeRequestLeg.setLegId(leg.getLegId());
|
||||
routeRequestLeg.setLeg(leg);
|
||||
return routeRequestLeg;
|
||||
}
|
||||
}
|
|
@ -3,11 +3,14 @@ package com.chint.domain.factoriy.order;
|
|||
import com.chint.application.commands.OrderCreateCommand;
|
||||
import com.chint.domain.aggregates.order.ApprovalEvent;
|
||||
import com.chint.domain.aggregates.order.RouteOrder;
|
||||
import com.chint.domain.aggregates.order.RouteRequest;
|
||||
import com.chint.domain.value_object.OrderSaveData;
|
||||
|
||||
public interface OrderFactory {
|
||||
RouteOrder createRoute(OrderSaveData orderData);
|
||||
RouteOrder createRoute(OrderCreateCommand command);
|
||||
ApprovalEvent createApprovalEvent(Integer eventType);
|
||||
|
||||
RouteRequest createRequestByRoute(RouteOrder routeOrder);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,10 +1,7 @@
|
|||
package com.chint.domain.factoriy.order;
|
||||
|
||||
import com.chint.application.commands.OrderCreateCommand;
|
||||
import com.chint.domain.aggregates.order.ApprovalEvent;
|
||||
import com.chint.domain.aggregates.order.ApproveOrderNo;
|
||||
import com.chint.domain.aggregates.order.Leg;
|
||||
import com.chint.domain.aggregates.order.RouteOrder;
|
||||
import com.chint.domain.aggregates.order.*;
|
||||
import com.chint.domain.aggregates.user.User;
|
||||
import com.chint.domain.factoriy.leg.RouteLegFactory;
|
||||
import com.chint.domain.value_object.LegData;
|
||||
|
@ -83,4 +80,10 @@ public class RouteOrderFactory implements OrderFactory {
|
|||
approvalEvent.setHappenTime(LocalDateTime.now());
|
||||
return approvalEvent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RouteRequest createRequestByRoute(RouteOrder routeOrder) {
|
||||
RouteRequest routeRequest = new RouteRequest();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,10 +6,10 @@ 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.infrastructure.repository.jdbc.JdbcOrderDetailRepository;
|
||||
import com.chint.infrastructure.repository.jdbc.JdbcOrderTravelRepository;
|
||||
import com.chint.infrastructure.repository.jdbc.JdbcRouteRepository;
|
||||
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;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@ -26,6 +26,7 @@ import java.util.function.Consumer;
|
|||
|
||||
import static com.chint.infrastructure.constant.BelongSystemConstant.*;
|
||||
import static com.chint.infrastructure.constant.OrderRecordConstant.*;
|
||||
import static com.chint.infrastructure.constant.RankConstant.OUT_OF_STANDARD;
|
||||
|
||||
/**
|
||||
* 同程数据转换
|
||||
|
@ -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;
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
package com.chint.infrastructure.repository.config;
|
||||
|
||||
import com.chint.domain.aggregates.order.RouteOrder;
|
||||
import com.chint.domain.aggregates.order.RouteRequest;
|
||||
import org.springframework.data.relational.core.conversion.MutableAggregateChange;
|
||||
import org.springframework.data.relational.core.mapping.event.BeforeSaveCallback;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Component
|
||||
public class RouteRequestCallBackImpl implements BeforeSaveCallback<RouteRequest> {
|
||||
@Override
|
||||
public RouteRequest onBeforeSave(RouteRequest entity, MutableAggregateChange<RouteRequest> aggregateChange) {
|
||||
if (entity.getCreateTime() == null) {
|
||||
entity.setCreateTime(LocalDateTime.now());
|
||||
}
|
||||
entity.setUpdateTime(LocalDateTime.now());
|
||||
return entity;
|
||||
}
|
||||
}
|
|
@ -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;//初始化变量
|
||||
|
@ -779,6 +780,7 @@ public class ExcelTest {
|
|||
log.info(JSON.toJSONString(records));
|
||||
repository.saveAll(pageResult.getRecords());
|
||||
|
||||
|
||||
count++;
|
||||
} while (count < LoopNum);
|
||||
log.info("成功");
|
||||
|
|
|
@ -15,8 +15,10 @@ import com.chint.domain.repository.RouteRepository;
|
|||
import com.chint.domain.service.order_sync.LYOrderSyncAdapter;
|
||||
import com.chint.infrastructure.constant.LYConstant;
|
||||
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;
|
||||
|
@ -826,7 +828,7 @@ public class LYTest {
|
|||
System.out.println(json);
|
||||
}
|
||||
|
||||
// @Test
|
||||
// @Test
|
||||
void searchCar() {
|
||||
CarDetailResponse carDetailResponse = lySearchRequest.getCarDetailResponse("DC24031566878059751");
|
||||
Gson gson = new Gson();
|
||||
|
@ -862,6 +864,7 @@ public class LYTest {
|
|||
// System.out.println(json);
|
||||
|
||||
|
||||
|
||||
// CarDetailResponse carDetailResponse = lySearchRequest.getCarDetailResponse("30352884087");
|
||||
// Gson gson = new Gson();
|
||||
// String json = gson.toJson(carDetailResponse);
|
||||
|
|
Loading…
Reference in New Issue