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