Merge branch 'master-jdk17' of https://gitee.com/zhijiantianya/ruoyi-vue-pro
# Conflicts: # yudao-dependencies/pom.xml
This commit is contained in:
@@ -63,11 +63,11 @@ public class DiscountActivityBaseVO {
|
||||
@Min(value = 0, message = "优惠金额需要大于等于 0")
|
||||
private Integer discountPrice;
|
||||
|
||||
@AssertTrue(message = "折扣百分比需要大于等于 1,小于等于 99")
|
||||
@AssertTrue(message = "折扣百分比需要大于等于 0.01%,小于等于 99.99%")
|
||||
@JsonIgnore
|
||||
public boolean isDiscountPercentValid() {
|
||||
return ObjectUtil.notEqual(discountType, PromotionDiscountTypeEnum.PERCENT.getType())
|
||||
|| (discountPercent != null && discountPercent >= 1 && discountPercent<= 99);
|
||||
|| (discountPercent != null && discountPercent >= 1 && discountPercent <= 9999);
|
||||
}
|
||||
|
||||
@AssertTrue(message = "优惠金额不能为空")
|
||||
|
@@ -30,6 +30,11 @@ import java.util.List;
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class CouponTemplateDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* 不限制领取数量
|
||||
*/
|
||||
public static final Integer TIME_LIMIT_COUNT_MAX = -1;
|
||||
|
||||
// ========== 基本信息 BEGIN ==========
|
||||
/**
|
||||
* 模板编号,自增唯一
|
||||
|
@@ -131,7 +131,7 @@ public class CombinationRecordServiceImpl implements CombinationRecordService {
|
||||
throw exception(COMBINATION_JOIN_ACTIVITY_PRODUCT_NOT_EXISTS);
|
||||
}
|
||||
// 4.3 校验库存是否充足
|
||||
if (count > sku.getStock()) {
|
||||
if (count >= sku.getStock()) {
|
||||
throw exception(COMBINATION_ACTIVITY_UPDATE_STOCK_FAIL);
|
||||
}
|
||||
|
||||
|
@@ -269,7 +269,8 @@ public class CouponServiceImpl implements CouponService {
|
||||
throw exception(COUPON_TEMPLATE_NOT_EXISTS);
|
||||
}
|
||||
// 校验剩余数量
|
||||
if (couponTemplate.getTakeCount() + userIds.size() > couponTemplate.getTotalCount()) {
|
||||
if (ObjUtil.notEqual(couponTemplate.getTakeLimitCount(), CouponTemplateDO.TIME_LIMIT_COUNT_MAX) // 非不限制
|
||||
&& couponTemplate.getTakeCount() + userIds.size() > couponTemplate.getTotalCount()) {
|
||||
throw exception(COUPON_TEMPLATE_NOT_ENOUGH);
|
||||
}
|
||||
// 校验"固定日期"的有效期类型是否过期
|
||||
|
@@ -1,5 +1,6 @@
|
||||
package cn.iocoder.yudao.module.promotion.service.coupon;
|
||||
|
||||
import cn.hutool.core.util.ObjUtil;
|
||||
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.product.api.category.ProductCategoryApi;
|
||||
@@ -59,7 +60,7 @@ public class CouponTemplateServiceImpl implements CouponTemplateService {
|
||||
CouponTemplateDO couponTemplate = validateCouponTemplateExists(updateReqVO.getId());
|
||||
// 校验发放数量不能过小(仅在 CouponTakeTypeEnum.USER 用户领取时)
|
||||
if (CouponTakeTypeEnum.isUser(couponTemplate.getTakeType())
|
||||
&& updateReqVO.getTotalCount() > 0 // 大于 0 的原因,是因为 -1 不限制
|
||||
&& ObjUtil.notEqual(couponTemplate.getTakeLimitCount(), CouponTemplateDO.TIME_LIMIT_COUNT_MAX) // 非不限制
|
||||
&& updateReqVO.getTotalCount() < couponTemplate.getTakeCount()) {
|
||||
throw exception(COUPON_TEMPLATE_TOTAL_COUNT_TOO_SMALL, couponTemplate.getTakeCount());
|
||||
}
|
||||
|
@@ -300,7 +300,7 @@ public class PointActivityServiceImpl implements PointActivityService {
|
||||
throw exception(POINT_ACTIVITY_JOIN_ACTIVITY_SINGLE_LIMIT_COUNT_EXCEED);
|
||||
}
|
||||
// 2.2 校验库存是否充足
|
||||
if (count > product.getStock()) {
|
||||
if (count >= product.getStock()) {
|
||||
throw exception(POINT_ACTIVITY_UPDATE_STOCK_FAIL);
|
||||
}
|
||||
return BeanUtils.toBean(product, PointValidateJoinRespDTO.class);
|
||||
|
@@ -317,7 +317,7 @@ public class SeckillActivityServiceImpl implements SeckillActivityService {
|
||||
throw exception(SECKILL_JOIN_ACTIVITY_PRODUCT_NOT_EXISTS);
|
||||
}
|
||||
// 2.2 校验库存是否充足
|
||||
if (count > product.getStock()) {
|
||||
if (count >= product.getStock()) {
|
||||
throw exception(SECKILL_ACTIVITY_UPDATE_STOCK_FAIL);
|
||||
}
|
||||
return SeckillActivityConvert.INSTANCE.convert02(activity, product);
|
||||
|
@@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import cn.hutool.core.net.NetUtil;
|
||||
import cn.hutool.core.util.ObjUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.RandomUtil;
|
||||
@@ -888,8 +889,8 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService {
|
||||
if (!order.getPayStatus()) {
|
||||
throw exception(ORDER_CANCEL_PAID_FAIL, "已支付");
|
||||
}
|
||||
// 1.3 校验订单是否已退款
|
||||
if (ObjUtil.equal(TradeOrderRefundStatusEnum.NONE.getStatus(), order.getRefundStatus())) {
|
||||
// 1.3 校验订单是否未退款
|
||||
if (ObjUtil.notEqual(TradeOrderRefundStatusEnum.NONE.getStatus(), order.getRefundStatus())) {
|
||||
throw exception(ORDER_CANCEL_PAID_FAIL, "未退款");
|
||||
}
|
||||
|
||||
@@ -897,7 +898,8 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService {
|
||||
cancelOrder0(order, TradeOrderCancelTypeEnum.COMBINATION_CLOSE);
|
||||
// 2.2 创建退款单
|
||||
payRefundApi.createRefund(new PayRefundCreateReqDTO()
|
||||
.setAppKey(tradeOrderProperties.getPayAppKey()).setUserIp(getClientIP()) // 支付应用
|
||||
.setAppKey(tradeOrderProperties.getPayAppKey()) // 支付应用
|
||||
.setUserIp(NetUtil.getLocalhostStr()) // 使用本机 IP,因为是服务器发起退款的
|
||||
.setMerchantOrderId(String.valueOf(order.getId())) // 支付单号
|
||||
.setMerchantRefundId(String.valueOf(order.getId()))
|
||||
.setReason(TradeOrderCancelTypeEnum.COMBINATION_CLOSE.getName()).setPrice(order.getPayPrice())); // 价格信息
|
||||
|
Reference in New Issue
Block a user