You've already forked FrameTour-BE
价格查询,待处理订单内容
This commit is contained in:
38
src/main/java/com/ycwl/basic/pricing/dto/CouponInfo.java
Normal file
38
src/main/java/com/ycwl/basic/pricing/dto/CouponInfo.java
Normal file
@@ -0,0 +1,38 @@
|
||||
package com.ycwl.basic.pricing.dto;
|
||||
|
||||
import com.ycwl.basic.pricing.enums.CouponType;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 优惠券信息DTO
|
||||
*/
|
||||
@Data
|
||||
public class CouponInfo {
|
||||
|
||||
/**
|
||||
* 优惠券ID
|
||||
*/
|
||||
private Long couponId;
|
||||
|
||||
/**
|
||||
* 优惠券名称
|
||||
*/
|
||||
private String couponName;
|
||||
|
||||
/**
|
||||
* 优惠类型
|
||||
*/
|
||||
private CouponType discountType;
|
||||
|
||||
/**
|
||||
* 优惠值
|
||||
*/
|
||||
private BigDecimal discountValue;
|
||||
|
||||
/**
|
||||
* 实际优惠金额
|
||||
*/
|
||||
private BigDecimal actualDiscountAmount;
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.ycwl.basic.pricing.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 优惠券使用请求DTO
|
||||
*/
|
||||
@Data
|
||||
public class CouponUseRequest {
|
||||
|
||||
/**
|
||||
* 优惠券ID
|
||||
*/
|
||||
private Long couponId;
|
||||
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 订单ID
|
||||
*/
|
||||
private String orderId;
|
||||
|
||||
/**
|
||||
* 原始金额
|
||||
*/
|
||||
private BigDecimal originalAmount;
|
||||
|
||||
/**
|
||||
* 优惠金额
|
||||
*/
|
||||
private BigDecimal discountAmount;
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.ycwl.basic.pricing.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 优惠券使用结果DTO
|
||||
*/
|
||||
@Data
|
||||
public class CouponUseResult {
|
||||
|
||||
/**
|
||||
* 优惠券ID
|
||||
*/
|
||||
private Long couponId;
|
||||
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 订单ID
|
||||
*/
|
||||
private String orderId;
|
||||
|
||||
/**
|
||||
* 使用时间
|
||||
*/
|
||||
private LocalDateTime useTime;
|
||||
|
||||
/**
|
||||
* 优惠金额
|
||||
*/
|
||||
private BigDecimal discountAmount;
|
||||
}
|
||||
76
src/main/java/com/ycwl/basic/pricing/dto/DiscountDetail.java
Normal file
76
src/main/java/com/ycwl/basic/pricing/dto/DiscountDetail.java
Normal file
@@ -0,0 +1,76 @@
|
||||
package com.ycwl.basic.pricing.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 折扣明细DTO
|
||||
*/
|
||||
@Data
|
||||
public class DiscountDetail {
|
||||
|
||||
/**
|
||||
* 折扣类型
|
||||
*/
|
||||
private String discountType;
|
||||
|
||||
/**
|
||||
* 折扣名称
|
||||
*/
|
||||
private String discountName;
|
||||
|
||||
/**
|
||||
* 折扣金额
|
||||
*/
|
||||
private BigDecimal discountAmount;
|
||||
|
||||
/**
|
||||
* 折扣描述
|
||||
*/
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 排序(数值越小越靠前)
|
||||
*/
|
||||
private Integer sortOrder;
|
||||
|
||||
/**
|
||||
* 创建限时立减折扣明细
|
||||
*/
|
||||
public static DiscountDetail createLimitedTimeDiscount(BigDecimal discountAmount) {
|
||||
DiscountDetail detail = new DiscountDetail();
|
||||
detail.setDiscountType("LIMITED_TIME");
|
||||
detail.setDiscountName("限时立减");
|
||||
detail.setDiscountAmount(discountAmount);
|
||||
detail.setDescription("限时优惠,立即享受");
|
||||
detail.setSortOrder(1); // 限时立减排在最前面
|
||||
return detail;
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建优惠券折扣明细
|
||||
*/
|
||||
public static DiscountDetail createCouponDiscount(String couponName, BigDecimal discountAmount) {
|
||||
DiscountDetail detail = new DiscountDetail();
|
||||
detail.setDiscountType("COUPON");
|
||||
detail.setDiscountName(couponName);
|
||||
detail.setDiscountAmount(discountAmount);
|
||||
detail.setDescription("优惠券减免");
|
||||
detail.setSortOrder(2); // 优惠券排在限时立减后面
|
||||
return detail;
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建一口价折扣明细
|
||||
*/
|
||||
public static DiscountDetail createBundleDiscount(BigDecimal discountAmount) {
|
||||
DiscountDetail detail = new DiscountDetail();
|
||||
detail.setDiscountType("BUNDLE");
|
||||
detail.setDiscountName("一口价优惠");
|
||||
detail.setDiscountAmount(discountAmount);
|
||||
detail.setDescription("一口价购买更优惠");
|
||||
detail.setSortOrder(3); // 一口价排在最后
|
||||
return detail;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.ycwl.basic.pricing.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 价格计算请求DTO
|
||||
*/
|
||||
@Data
|
||||
public class PriceCalculationRequest {
|
||||
|
||||
/**
|
||||
* 商品列表
|
||||
*/
|
||||
private List<ProductItem> products;
|
||||
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 是否自动使用优惠券
|
||||
*/
|
||||
private Boolean autoUseCoupon = true;
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package com.ycwl.basic.pricing.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 价格计算结果DTO
|
||||
*/
|
||||
@Data
|
||||
public class PriceCalculationResult {
|
||||
|
||||
/**
|
||||
* 原始金额(用于前端展示的总原价)
|
||||
*/
|
||||
private BigDecimal originalAmount;
|
||||
|
||||
/**
|
||||
* 商品小计金额(按实际计算价格)
|
||||
*/
|
||||
private BigDecimal subtotalAmount;
|
||||
|
||||
/**
|
||||
* 优惠金额
|
||||
*/
|
||||
private BigDecimal discountAmount;
|
||||
|
||||
/**
|
||||
* 最终金额
|
||||
*/
|
||||
private BigDecimal finalAmount;
|
||||
|
||||
/**
|
||||
* 使用的优惠券信息
|
||||
*/
|
||||
private CouponInfo usedCoupon;
|
||||
|
||||
/**
|
||||
* 折扣明细列表(包含限时立减、优惠券、一口价等)
|
||||
*/
|
||||
private List<DiscountDetail> discountDetails;
|
||||
|
||||
/**
|
||||
* 商品明细列表
|
||||
*/
|
||||
private List<ProductItem> productDetails;
|
||||
}
|
||||
32
src/main/java/com/ycwl/basic/pricing/dto/PriceDetails.java
Normal file
32
src/main/java/com/ycwl/basic/pricing/dto/PriceDetails.java
Normal file
@@ -0,0 +1,32 @@
|
||||
package com.ycwl.basic.pricing.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 价格详情(内部计算用)
|
||||
*/
|
||||
@Data
|
||||
public class PriceDetails {
|
||||
|
||||
/**
|
||||
* 实际计算总金额
|
||||
*/
|
||||
private BigDecimal totalAmount;
|
||||
|
||||
/**
|
||||
* 原价总金额
|
||||
*/
|
||||
private BigDecimal originalTotalAmount;
|
||||
|
||||
public PriceDetails() {
|
||||
this.totalAmount = BigDecimal.ZERO;
|
||||
this.originalTotalAmount = BigDecimal.ZERO;
|
||||
}
|
||||
|
||||
public PriceDetails(BigDecimal totalAmount, BigDecimal originalTotalAmount) {
|
||||
this.totalAmount = totalAmount;
|
||||
this.originalTotalAmount = originalTotalAmount;
|
||||
}
|
||||
}
|
||||
53
src/main/java/com/ycwl/basic/pricing/dto/ProductItem.java
Normal file
53
src/main/java/com/ycwl/basic/pricing/dto/ProductItem.java
Normal file
@@ -0,0 +1,53 @@
|
||||
package com.ycwl.basic.pricing.dto;
|
||||
|
||||
import com.ycwl.basic.pricing.enums.ProductType;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 商品项DTO
|
||||
*/
|
||||
@Data
|
||||
public class ProductItem {
|
||||
|
||||
/**
|
||||
* 商品类型
|
||||
*/
|
||||
private ProductType productType;
|
||||
|
||||
/**
|
||||
* 具体商品ID:vlog视频为具体视频ID,录像集/照相集为景区ID,打印为景区ID
|
||||
*/
|
||||
private String productId;
|
||||
|
||||
/**
|
||||
* 商品子类型
|
||||
*/
|
||||
private String productSubType;
|
||||
|
||||
/**
|
||||
* 数量(如原片数量、照片数量等)
|
||||
*/
|
||||
private Integer quantity;
|
||||
|
||||
/**
|
||||
* 购买数量(购买几个该商品)
|
||||
*/
|
||||
private Integer purchaseCount;
|
||||
|
||||
/**
|
||||
* 原价(用于前端展示)
|
||||
*/
|
||||
private BigDecimal originalPrice;
|
||||
|
||||
/**
|
||||
* 单价(实际计算用的价格)
|
||||
*/
|
||||
private BigDecimal unitPrice;
|
||||
|
||||
/**
|
||||
* 小计(计算后填入)
|
||||
*/
|
||||
private BigDecimal subtotal;
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.ycwl.basic.pricing.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 商品价格信息(内部计算用)
|
||||
*/
|
||||
@Data
|
||||
public class ProductPriceInfo {
|
||||
|
||||
/**
|
||||
* 实际计算价格
|
||||
*/
|
||||
private BigDecimal actualPrice;
|
||||
|
||||
/**
|
||||
* 原价(用于前端展示)
|
||||
*/
|
||||
private BigDecimal originalPrice;
|
||||
|
||||
public ProductPriceInfo(BigDecimal actualPrice, BigDecimal originalPrice) {
|
||||
this.actualPrice = actualPrice;
|
||||
this.originalPrice = originalPrice != null ? originalPrice : actualPrice;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user