mirror of
https://gitee.com/hhyykk/ipms-sjy.git
synced 2025-07-24 16:05:08 +08:00
Merge branch 'develop' of https://gitee.com/zhijiantianya/ruoyi-vue-pro into master-jdk21
This commit is contained in:
@ -101,7 +101,7 @@ public class AppProductSpuController {
|
||||
throw exception(SPU_NOT_EXISTS);
|
||||
}
|
||||
if (!ProductSpuStatusEnum.isEnable(spu.getStatus())) {
|
||||
throw exception(SPU_NOT_ENABLE);
|
||||
throw exception(SPU_NOT_ENABLE, spu.getName());
|
||||
}
|
||||
// 获得商品 SKU
|
||||
List<ProductSkuDO> skus = productSkuService.getSkuListBySpuId(spu.getId());
|
||||
|
@ -4,14 +4,11 @@ import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
||||
import cn.iocoder.yudao.framework.common.validation.InEnum;
|
||||
import lombok.*;
|
||||
|
||||
import java.time.LocalTime;
|
||||
import java.util.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_HOUR_MINUTE_SECOND;
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - 自提门店分页 Request VO")
|
||||
|
@ -1,9 +1,9 @@
|
||||
package cn.iocoder.yudao.module.trade.controller.app.cart.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import jakarta.validation.constraints.Min;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
@Schema(description = "用户 App - 购物车添加购物项 Request VO")
|
||||
@Data
|
||||
@ -15,6 +15,7 @@ public class AppCartAddReqVO {
|
||||
|
||||
@Schema(description = "新增商品数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
@NotNull(message = "数量不能为空")
|
||||
@Min(value = 1, message = "商品数量必须大于等于 1")
|
||||
private Integer count;
|
||||
|
||||
}
|
||||
|
@ -140,6 +140,9 @@ public class AppTradeOrderDetailRespVO {
|
||||
@Schema(description = "VIP 减免金额", requiredMode = Schema.RequiredMode.REQUIRED, example = "888")
|
||||
private Integer vipPrice;
|
||||
|
||||
@Schema(description = "拼团记录编号", example = "100")
|
||||
private Long combinationRecordId;
|
||||
|
||||
/**
|
||||
* 订单项数组
|
||||
*/
|
||||
|
@ -50,4 +50,9 @@ public class AppTradeOrderPageItemRespVO {
|
||||
*/
|
||||
private List<AppTradeOrderItemRespVO> items;
|
||||
|
||||
// ========== 营销基本信息 ==========
|
||||
|
||||
@Schema(description = "拼团记录编号", example = "100")
|
||||
private Long combinationRecordId;
|
||||
|
||||
}
|
||||
|
@ -88,6 +88,7 @@ public interface BrokerageRecordMapper extends BaseMapperX<BrokerageRecordDO> {
|
||||
@Param("beginTime") LocalDateTime beginTime,
|
||||
@Param("endTime") LocalDateTime endTime);
|
||||
|
||||
// TODO @芋艿:收敛掉 @Select 注解操作,统一成 MyBatis-Plus 的方式,或者 xml
|
||||
@Select("SELECT user_id AS id, SUM(price) AS brokeragePrice FROM trade_brokerage_record " +
|
||||
"WHERE biz_type = #{bizType} AND status = #{status} AND deleted = FALSE " +
|
||||
"AND unfreeze_time BETWEEN #{beginTime} AND #{endTime} " +
|
||||
|
@ -624,7 +624,7 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService {
|
||||
throw exception(ORDER_UPDATE_PRICE_FAIL_ALREADY);
|
||||
}
|
||||
// 1.3 支付价格不能为 0
|
||||
int newPayPrice = order.getPayPrice() + order.getAdjustPrice();
|
||||
int newPayPrice = order.getPayPrice() + reqVO.getAdjustPrice();
|
||||
if (newPayPrice <= 0) {
|
||||
throw exception(ORDER_UPDATE_PRICE_FAIL_PRICE_ERROR);
|
||||
}
|
||||
@ -635,12 +635,14 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService {
|
||||
|
||||
// 3. 更新 TradeOrderItem,需要做 adjustPrice 的分摊
|
||||
List<TradeOrderItemDO> orderOrderItems = tradeOrderItemMapper.selectListByOrderId(order.getId());
|
||||
List<Integer> dividePrices = TradePriceCalculatorHelper.dividePrice2(orderOrderItems, newPayPrice);
|
||||
List<Integer> dividePrices = TradePriceCalculatorHelper.dividePrice2(orderOrderItems, reqVO.getAdjustPrice());
|
||||
List<TradeOrderItemDO> updateItems = new ArrayList<>();
|
||||
for (int i = 0; i < orderOrderItems.size(); i++) {
|
||||
TradeOrderItemDO item = orderOrderItems.get(i);
|
||||
// TODO puhui999: 已有分摊记录的情况下价格是否会不对,也就是说之前订单项 1 分摊了 10 块这次是 -100
|
||||
// 那么 setPayPrice 是否改为 (item.getPayPrice()-item.getAdjustPrice()) + dividePrices.get(i) 先减掉原来的价格再加上调价。经过验证可行,修改后订单价格增减都能正确分摊
|
||||
updateItems.add(new TradeOrderItemDO().setId(item.getId()).setAdjustPrice(dividePrices.get(i))
|
||||
.setPayPrice(item.getPayPrice() + dividePrices.get(i)));
|
||||
.setPayPrice((item.getPayPrice() - item.getAdjustPrice()) + dividePrices.get(i)));
|
||||
}
|
||||
tradeOrderItemMapper.updateBatch(updateItems);
|
||||
|
||||
|
@ -83,7 +83,7 @@ public class TradeBrokerageOrderHandler implements TradeOrderHandler {
|
||||
if (order.getBrokerageUserId() == null) {
|
||||
return;
|
||||
}
|
||||
cancelBrokerage(order.getBrokerageUserId(), orderItem.getOrderId());
|
||||
cancelBrokerage(order.getBrokerageUserId(), orderItem.getId());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -254,12 +254,15 @@ public class TradePriceCalculatorHelper {
|
||||
TradeOrderItemDO orderItem = items.get(i);
|
||||
int partPrice;
|
||||
if (i < items.size() - 1) { // 减一的原因,是因为拆分时,如果按照比例,可能会出现.所以最后一个,使用反减
|
||||
partPrice = (int) (price * (1.0D * orderItem.getPayPrice() / total));
|
||||
// partPrice = (int) (price * (1.0D * orderItem.getPayPrice() / total));
|
||||
// pr fix: 改为了使用订单原价来计算比例
|
||||
partPrice = (int) (price * (1.0D * orderItem.getPrice() / total));
|
||||
remainPrice -= partPrice;
|
||||
} else {
|
||||
partPrice = remainPrice;
|
||||
}
|
||||
Assert.isTrue(partPrice >= 0, "分摊金额必须大于等于 0");
|
||||
// TODO puhui999: 如果是减价的情况这里过不了
|
||||
// Assert.isTrue(partPrice >= 0, "分摊金额必须大于等于 0");
|
||||
prices.add(partPrice);
|
||||
}
|
||||
return prices;
|
||||
|
Reference in New Issue
Block a user