mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2024-11-26 01:01:52 +08:00
promotion:修复拼团下单时,相关字段记录不正确的情况。
This commit is contained in:
parent
c8f1269d6e
commit
c7b5df930e
@ -77,6 +77,7 @@ public interface CombinationRecordApi {
|
||||
* @param count 数量
|
||||
* @return 拼团信息
|
||||
*/
|
||||
// TODO @puhui:userId 放最前面;然后应该还有个 headId 参数;
|
||||
CombinationValidateJoinRespDTO validateJoinCombination(Long activityId, Long userId, Long skuId, Integer count);
|
||||
|
||||
}
|
||||
|
@ -108,7 +108,7 @@ public interface CombinationActivityConvert {
|
||||
CombinationActivityDO activity, MemberUserRespDTO user,
|
||||
ProductSpuRespDTO spu, ProductSkuRespDTO sku) {
|
||||
return convert(reqDTO)
|
||||
.setCount(reqDTO.getCount())
|
||||
.setCount(reqDTO.getCount()).setUserCount(1)
|
||||
.setVirtualGroup(false)
|
||||
.setExpireTime(activity.getStartTime().plusHours(activity.getLimitDuration()))
|
||||
.setUserSize(activity.getUserSize())
|
||||
|
@ -5,6 +5,7 @@ import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.iocoder.yudao.framework.common.core.KeyValue;
|
||||
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils;
|
||||
import cn.iocoder.yudao.module.member.api.user.MemberUserApi;
|
||||
import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO;
|
||||
import cn.iocoder.yudao.module.product.api.sku.ProductSkuApi;
|
||||
@ -97,9 +98,9 @@ public class CombinationRecordServiceImpl implements CombinationRecordService {
|
||||
item.setStatus(CombinationRecordStatusEnum.SUCCESS.getStatus());
|
||||
}
|
||||
});
|
||||
}
|
||||
recordMapper.updateBatch(records);
|
||||
}
|
||||
}
|
||||
|
||||
private CombinationRecordDO validateCombinationRecord(Long userId, Long orderId) {
|
||||
// 校验拼团是否存在
|
||||
@ -179,7 +180,7 @@ public class CombinationRecordServiceImpl implements CombinationRecordService {
|
||||
throw exception(COMBINATION_RECORD_FAILED_HAVE_JOINED);
|
||||
}
|
||||
// 3、校验活动是否开启
|
||||
if (LocalDateTime.now().isAfter(activity.getStartTime())) {
|
||||
if (!LocalDateTimeUtils.beforeNow(activity.getStartTime())) {
|
||||
throw exception(COMBINATION_RECORD_FAILED_TIME_NOT_START);
|
||||
}
|
||||
// 4、校验当前活动是否过期
|
||||
|
@ -207,12 +207,16 @@ public interface TradeOrderConvert {
|
||||
default TradePriceCalculateReqBO convert(Long userId, AppTradeOrderSettlementReqVO settlementReqVO,
|
||||
List<CartDO> cartList) {
|
||||
TradePriceCalculateReqBO reqBO = new TradePriceCalculateReqBO().setUserId(userId)
|
||||
.setItems(new ArrayList<>(settlementReqVO.getItems().size()))
|
||||
.setCouponId(settlementReqVO.getCouponId()).setPointStatus(settlementReqVO.getPointStatus())
|
||||
// 物流信息
|
||||
.setDeliveryType(settlementReqVO.getDeliveryType()).setAddressId(settlementReqVO.getAddressId())
|
||||
.setPickUpStoreId(settlementReqVO.getPickUpStoreId())
|
||||
.setItems(new ArrayList<>(settlementReqVO.getItems().size()))
|
||||
// 各种活动
|
||||
.setSeckillActivityId(settlementReqVO.getSeckillActivityId())
|
||||
.setBargainRecordId(settlementReqVO.getBargainRecordId());
|
||||
.setBargainRecordId(settlementReqVO.getBargainRecordId())
|
||||
.setCombinationActivityId(settlementReqVO.getCombinationActivityId())
|
||||
.setCombinationHeadId(settlementReqVO.getCombinationHeadId());
|
||||
// 商品项的构建
|
||||
Map<Long, CartDO> cartMap = convertMap(cartList, CartDO::getId);
|
||||
for (AppTradeOrderSettlementReqVO.Item item : settlementReqVO.getItems()) {
|
||||
|
@ -318,10 +318,16 @@ public class TradeOrderDO extends BaseDO {
|
||||
*/
|
||||
private Long combinationActivityId;
|
||||
/**
|
||||
* 团长编号
|
||||
* 拼团团长编号
|
||||
*
|
||||
* 关联 CombinationRecordDO 的 headId 字段
|
||||
*/
|
||||
private Long combinationHeadId;
|
||||
/**
|
||||
* 拼团记录编号
|
||||
*
|
||||
* 关联 CombinationRecordDO 的 id 字段
|
||||
*/
|
||||
private Long combinationHeadId;
|
||||
private Long combinationRecordId;
|
||||
|
||||
}
|
||||
|
@ -47,7 +47,8 @@ public class TradeCombinationHandler implements TradeOrderHandler {
|
||||
|
||||
// 获取商品信息
|
||||
TradeOrderItemDO item = orderItems.get(0);
|
||||
// 创建砍价记录
|
||||
// 创建拼团记录
|
||||
// TODO puhui:这里应该先不创建;等支付好,才去创建;另外,创建好后,需要更新编号到订单;
|
||||
combinationRecordApi.createCombinationRecord(TradeOrderConvert.INSTANCE.convert(order, item));
|
||||
}
|
||||
|
||||
|
@ -31,7 +31,6 @@ public class TradeCombinationActivityPriceCalculator implements TradePriceCalcul
|
||||
if (param.getCombinationActivityId() == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
Assert.isTrue(param.getItems().size() == 1, "拼团时,只允许选择一个商品");
|
||||
// 2. 校验是否可以参与拼团
|
||||
TradePriceCalculateRespBO.OrderItem orderItem = result.getItems().get(0);
|
||||
|
Loading…
Reference in New Issue
Block a user