订单 优惠券部分 重写
This commit is contained in:
@@ -98,6 +98,11 @@ public class OrderDetailDTO implements Serializable {
|
||||
*/
|
||||
private BigDecimal couponNum;
|
||||
|
||||
/**
|
||||
* 半价券抵扣数量
|
||||
*/
|
||||
private BigDecimal halfPriceCouponNum;
|
||||
|
||||
/**
|
||||
* 退菜数量(不管价格)
|
||||
*/
|
||||
|
||||
@@ -97,6 +97,10 @@ admin-app APP管理端 APP+雪花ID
|
||||
* 满减优惠券抵扣金额
|
||||
*/
|
||||
private BigDecimal fullCouponDiscountAmount;
|
||||
/**
|
||||
* 其它优惠券抵扣金额
|
||||
*/
|
||||
private BigDecimal otherCouponDiscountAmount;
|
||||
|
||||
/**
|
||||
* 手动优惠金额
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
package com.czg.market.service;
|
||||
|
||||
import com.czg.account.vo.UserCouponVo;
|
||||
import com.czg.market.dto.ShopCouponDTO;
|
||||
import com.czg.market.entity.MkShopCouponRecord;
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
import com.mybatisflex.core.service.IService;
|
||||
import com.czg.market.entity.ShopCoupon;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 优惠券信息表 服务层。
|
||||
*
|
||||
@@ -13,10 +17,20 @@ import com.czg.market.entity.ShopCoupon;
|
||||
*/
|
||||
public interface ShopCouponService extends IService<ShopCoupon> {
|
||||
Page<ShopCouponDTO> getCouponPage(ShopCouponDTO param);
|
||||
|
||||
ShopCouponDTO getCouponById(Long id);
|
||||
|
||||
void addCoupon(ShopCouponDTO param);
|
||||
|
||||
void updateCouponById(ShopCouponDTO param);
|
||||
|
||||
void deleteCoupon(Long id);
|
||||
|
||||
Page<MkShopCouponRecord> find(Long userId, Long shopId, Integer status);
|
||||
|
||||
List<UserCouponVo> findCoupon(Long shopId, Long shopUserId, Integer type);
|
||||
|
||||
Boolean use(List<Long> ids, Long shopUserId, Long orderId);
|
||||
|
||||
Boolean refund(Long orderId, Long shopUserId);
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ public class CheckOrderPay implements Serializable {
|
||||
/**
|
||||
* 折扣比例(计算时 向上取整保留 两位小数)
|
||||
*/
|
||||
private BigDecimal discountRatio;
|
||||
// private BigDecimal discountRatio;
|
||||
/**
|
||||
* 手动优惠金额
|
||||
*/
|
||||
@@ -62,9 +62,9 @@ public class CheckOrderPay implements Serializable {
|
||||
*/
|
||||
private BigDecimal productCouponDiscountAmount;
|
||||
/**
|
||||
* 满减优惠券抵扣金额
|
||||
* 其它优惠券抵扣金额
|
||||
*/
|
||||
private BigDecimal fullCouponDiscountAmount;
|
||||
private BigDecimal otherCouponDiscountAmount;
|
||||
/**
|
||||
* 用户使用的卡券
|
||||
*/
|
||||
@@ -108,15 +108,15 @@ public class CheckOrderPay implements Serializable {
|
||||
return pointsNum == null ? 0 : pointsNum;
|
||||
}
|
||||
|
||||
public BigDecimal getDiscountRatio() {
|
||||
if (discountRatio == null) {
|
||||
return BigDecimal.ZERO;
|
||||
}
|
||||
return discountRatio.setScale(2, RoundingMode.UP);
|
||||
}
|
||||
// public BigDecimal getDiscountRatio() {
|
||||
// if (discountRatio == null) {
|
||||
// return BigDecimal.ZERO;
|
||||
// }
|
||||
// return discountRatio.setScale(2, RoundingMode.UP);
|
||||
// }
|
||||
|
||||
public BigDecimal getFullCouponDiscountAmount() {
|
||||
return fullCouponDiscountAmount == null ? BigDecimal.ZERO : fullCouponDiscountAmount;
|
||||
public BigDecimal getOtherCouponDiscountAmount() {
|
||||
return otherCouponDiscountAmount == null ? BigDecimal.ZERO : otherCouponDiscountAmount;
|
||||
}
|
||||
|
||||
public BigDecimal getProductCouponDiscountAmount() {
|
||||
|
||||
@@ -102,6 +102,10 @@ public class OrderDetail implements Serializable {
|
||||
* 优惠券抵扣数量
|
||||
*/
|
||||
private BigDecimal couponNum;
|
||||
/**
|
||||
* 半价券抵扣数量
|
||||
*/
|
||||
private BigDecimal halfPriceCouponNum;
|
||||
|
||||
/**
|
||||
* 退菜数量(不管价格)
|
||||
|
||||
@@ -102,6 +102,10 @@ public class OrderInfo implements Serializable {
|
||||
* 满减优惠券抵扣金额
|
||||
*/
|
||||
private BigDecimal fullCouponDiscountAmount;
|
||||
/**
|
||||
* 其它优惠券抵扣金额
|
||||
*/
|
||||
private BigDecimal otherCouponDiscountAmount;
|
||||
|
||||
/**
|
||||
* 折扣金额
|
||||
|
||||
@@ -17,7 +17,6 @@ import org.jetbrains.annotations.NotNull;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 订单表 服务层。
|
||||
@@ -50,12 +49,8 @@ public interface OrderInfoService extends IService<OrderInfo> {
|
||||
void expired(Long orderId);
|
||||
|
||||
OrderInfo createPayOrder(Long shopId, BigDecimal amount, String remark);
|
||||
|
||||
void processOrderDetails2(List<OrderDetail> orderDetails, Map<Long, Integer> prodCouponMap,
|
||||
BigDecimalDTO prodCouponAmount, BigDecimalDTO totalAmount, BigDecimalDTO packAmount,
|
||||
boolean isAllPack, Integer userAllPack, boolean isVipPrice);
|
||||
|
||||
|
||||
void getOrderAmount(List<OrderDetail> orderDetails, BigDecimalDTO totalAmount, BigDecimalDTO packAmount,
|
||||
BigDecimalDTO tempAmount, boolean isAllPack, Integer userAllPack, boolean isVipPrice);
|
||||
Boolean printOrder(Long shopId, OrderInfoPrintDTO orderInfoPrintDTO);
|
||||
|
||||
|
||||
|
||||
@@ -2,6 +2,8 @@ package com.czg.utils;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
/**
|
||||
* @author ww
|
||||
* @description
|
||||
@@ -15,4 +17,18 @@ public class CzgStrUtils {
|
||||
public static String getStrOrNull(String str) {
|
||||
return StrUtil.isNotBlank(str) ? str : null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取当天是周几
|
||||
* @return 周几
|
||||
*/
|
||||
public static String getStrWeek() {
|
||||
int dayOfWeek = LocalDate.now().getDayOfWeek().getValue();
|
||||
|
||||
// 定义汉字星期数组(索引0不用,从1开始对应周一到周日)
|
||||
String[] chineseWeeks = {"无", "一", "二", "三", "四", "五", "六", "日"};
|
||||
|
||||
return "周" + chineseWeeks[dayOfWeek];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user