修复财务共享时间传参问题

This commit is contained in:
lulz1 2024-03-12 16:32:03 +08:00
parent fd6783b1f4
commit 6cb39172e7
8 changed files with 119 additions and 14 deletions

View File

@ -0,0 +1,28 @@
package com.chint.application.dtos.mapper;
import cn.hutool.core.bean.BeanUtil;
import com.chint.application.dtos.response.OrderDetailRes;
import com.chint.domain.aggregates.order.OrderDetail;
import com.chint.domain.aggregates.order.TrainOrderDetail;
import static com.chint.infrastructure.constant.LegConstant.*;
public class OrderDetailMapper {
public static OrderDetailRes copyFromExtension(OrderDetail orderDetail) {
OrderDetailRes orderDetailRes = BeanUtil.copyProperties(orderDetail.reloadStatus(), OrderDetailRes.class);
orderDetailRes.setOutOrderStatus(orderDetail.getOutOrderStatus());
Integer productType = orderDetail.getProductType();
// switch (productType){
// case LEG_TYPE_TRAIN -> {
// TrainOrderDetail trainOrderDetail = orderDetail.getTrainOrderDetail();
// };
// case LEG_TYPE_AIRPLANE -> ;
// case LEG_TYPE_HOTEL -> ;
// case LEG_TYPE_TAXI -> ;
// }
return orderDetailRes;
}
}

View File

@ -0,0 +1,7 @@
package com.chint.application.dtos.response;
import lombok.Data;
@Data
public class CarExtensionField {
}

View File

@ -0,0 +1,12 @@
package com.chint.application.dtos.response;
import lombok.Data;
@Data
public class FLightExtensionField {
private String flightInfo;
private String departCity;
private String departStation;
private String arriveCity;
private String arriveStation;
}

View File

@ -0,0 +1,10 @@
package com.chint.application.dtos.response;
import lombok.Data;
@Data
public class HotelExtensionField {
private String hotelName;
private String roomCount;
private String nightCount;
}

View File

@ -3,36 +3,68 @@ package com.chint.application.dtos.response;
import cn.hutool.core.bean.BeanUtil;
import com.chint.domain.aggregates.order.OrderDetail;
import com.chint.domain.value_object.enums.CurrencyType;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.time.LocalDateTime;
@Data
public class OrderDetailRes {
@ApiModelProperty("主键")
private Long orderId; // 使用 order_id 作为主键
// 对应所属系统
@ApiModelProperty("所属系统")
private String belongSysType;
@ApiModelProperty("订单号")
private String orderNo;
@ApiModelProperty("供应商名称")
private String supplierName;
@ApiModelProperty("产品名称")
private String productName; // 产品名称
@ApiModelProperty("商品类型")
private Integer productType; // 商品类型
@ApiModelProperty("数量")
private Integer quantity; // 数量
@ApiModelProperty("价格")
private String price; // 价格
@ApiModelProperty("货币类型")
private CurrencyType currencyType; //货币类型
@ApiModelProperty("货币类型编码")
private String currencyCode; //货币类型
@ApiModelProperty("目的地Id")
private Long destinationId;
@ApiModelProperty("出发地Id")
private Long originId;
@ApiModelProperty("出发时间")
private LocalDateTime startTime;
@ApiModelProperty("结束时间")
private LocalDateTime endTime;
@ApiModelProperty("创建时间")
private LocalDateTime createTime;
@ApiModelProperty("更新时间")
private LocalDateTime updateTime;
@ApiModelProperty("订单状态")
private String orderStatus;
//
// private FLightExtensionField fLightExtensionField;
// private CarExtensionField carExtensionField;
// private TrainExtensionField trainExtensionField;
// private HotelExtensionField hotelExtensionField;
@ApiModelProperty("供应商订单状态")
private String outOrderStatus;
//
@ApiModelProperty("机票扩展字段")
private FLightExtensionField fLightExtensionField;
@ApiModelProperty("用车扩展字段")
private CarExtensionField carExtensionField;
@ApiModelProperty("火车扩展字段")
private TrainExtensionField trainExtensionField;
@ApiModelProperty("酒店扩展字段")
private HotelExtensionField hotelExtensionField;
public static OrderDetailRes copyFrom(OrderDetail orderDetail) {
return BeanUtil.copyProperties(orderDetail.reloadStatus(), OrderDetailRes.class);
}
public static OrderDetailRes copyFromExtension(OrderDetail orderDetail) {
OrderDetailRes orderDetailRes = copyFrom(orderDetail);
orderDetailRes.setOutOrderStatus(orderDetail.getOutOrderStatus());
return orderDetailRes;
}
}

View File

@ -0,0 +1,14 @@
package com.chint.application.dtos.response;
import lombok.Data;
@Data
public class TrainExtensionField {
private String departCity;
private String departStation;
private String arriveCity;
private String arriveStation;
private String trainNo;
private String seatName;
}

View File

@ -3,7 +3,6 @@ package com.chint.domain.aggregates.order;
import com.chint.domain.exceptions.NotFoundException;
import com.chint.domain.value_object.enums.CurrencyType;
import com.chint.infrastructure.constant.LegConstant;
import com.chint.infrastructure.constant.OrderConstant;
import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.annotation.Transient;
@ -13,8 +12,8 @@ import org.springframework.data.relational.core.mapping.Table;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.Optional;
import static com.chint.infrastructure.constant.CommonMessageConstant.NOT_FOUND;
import static com.chint.infrastructure.constant.LegConstant.*;
@ -68,6 +67,8 @@ public class OrderDetail implements Serializable {
@Transient
private String orderStatus;
@Transient
private String outOrderStatus;
@Transient
private String productName; // 产品名称
public static OrderDetail of(String orderNo, String supplierName) {
@ -91,11 +92,11 @@ public class OrderDetail implements Serializable {
public OrderDetail reloadStatus() {
if (this.getOrderEventList() != null && !this.orderEventList.isEmpty()) {
this.orderEventList.stream()
.filter(orderEvent -> !orderEvent.getEventType().equals(OrderConstant.ORDER_EVENT_UNKNOWN))
.max(Comparator.comparingLong(OrderEvent::getOrderEventId))
.ifPresentOrElse(event -> this.setOrderStatus(event.reloadStatus().getEventName()),
() -> this.setOrderStatus(ORDER_EVENT_PREPARE_NAME));
Optional.ofNullable(getLastEvent()).ifPresentOrElse(event -> {
this.setOrderStatus(event.reloadStatus().getEventName());
this.setOutOrderStatus(event.getOutStatus());
},
() -> this.setOrderStatus(ORDER_EVENT_PREPARE_NAME));
} else {
this.setOrderStatus(ORDER_EVENT_PREPARE_NAME);
}

View File

@ -130,8 +130,9 @@ public class LegEventHandler implements LegEventService {
if (startTime != null && endTime != null) {
if (startTime.contains("T") && endTime.contains("T")) {
routeOrder.setStartTime(LocalDate.parse(startTime, formatterWithT).atStartOfDay());
routeOrder.setEndTime(LocalDate.parse(endTime, formatterWithT).atStartOfDay().plusHours(23).plusMinutes(59).plusSeconds(59));
//如果包含T就截取时间信息前10位
routeOrder.setStartTime(LocalDate.parse(startTime.substring(0, 10), formatterWithT).atStartOfDay());
routeOrder.setEndTime(LocalDate.parse(endTime.substring(0, 10), formatterWithT).atStartOfDay().plusHours(23).plusMinutes(59).plusSeconds(59));
} else {
routeOrder.setStartTime(LocalDate.parse(startTime, formatter).atStartOfDay());
routeOrder.setEndTime(LocalDate.parse(endTime, formatter).atStartOfDay().plusHours(23).plusMinutes(59).plusSeconds(59));