Commit 7957cfa50d3eeb4aca22acb6dd4d5fd4bb1ba235
1 parent
8d13ecc9
fix:优化拼团与订单集成逻辑
Showing
7 changed files
with
70 additions
and
19 deletions
yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/api/combination/CombinationApi.java
| @@ -24,7 +24,8 @@ public interface CombinationApi { | @@ -24,7 +24,8 @@ public interface CombinationApi { | ||
| 24 | * @param userId 用户编号 | 24 | * @param userId 用户编号 |
| 25 | * @param orderId 订单编号 | 25 | * @param orderId 订单编号 |
| 26 | */ | 26 | */ |
| 27 | - Integer getRecordStatus(Long userId, Long orderId); | 27 | + boolean validateRecordStatusIsSuccess(Long userId, Long orderId); |
| 28 | + | ||
| 28 | 29 | ||
| 29 | /** | 30 | /** |
| 30 | * 更新开团记录状态 | 31 | * 更新开团记录状态 |
| @@ -41,6 +42,7 @@ public interface CombinationApi { | @@ -41,6 +42,7 @@ public interface CombinationApi { | ||
| 41 | * @param userId 用户编号 | 42 | * @param userId 用户编号 |
| 42 | * @param orderId 订单编号 | 43 | * @param orderId 订单编号 |
| 43 | * @param status 状态值 | 44 | * @param status 状态值 |
| 45 | + * @return | ||
| 44 | */ | 46 | */ |
| 45 | void updateRecordStatusAndStartTime(Long userId, Long orderId, Integer status); | 47 | void updateRecordStatusAndStartTime(Long userId, Long orderId, Integer status); |
| 46 | 48 |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/api/combination/CombinationApiImpl.java
| @@ -23,8 +23,8 @@ public class CombinationApiImpl implements CombinationApi { | @@ -23,8 +23,8 @@ public class CombinationApiImpl implements CombinationApi { | ||
| 23 | } | 23 | } |
| 24 | 24 | ||
| 25 | @Override | 25 | @Override |
| 26 | - public Integer getRecordStatus(Long userId, Long orderId) { | ||
| 27 | - return activityService.getRecordStatus(userId, orderId); | 26 | + public boolean validateRecordStatusIsSuccess(Long userId, Long orderId) { |
| 27 | + return activityService.validateRecordStatusIsSuccess(userId, orderId); | ||
| 28 | } | 28 | } |
| 29 | 29 | ||
| 30 | @Override | 30 | @Override |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/combination/combinationactivity/CombinationRecordDO.java
| 1 | package cn.iocoder.yudao.module.promotion.dal.dataobject.combination.combinationactivity; | 1 | package cn.iocoder.yudao.module.promotion.dal.dataobject.combination.combinationactivity; |
| 2 | 2 | ||
| 3 | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; | 3 | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; |
| 4 | +import cn.iocoder.yudao.module.promotion.enums.combination.CombinationRecordStatusEnum; | ||
| 4 | import com.baomidou.mybatisplus.annotation.KeySequence; | 5 | import com.baomidou.mybatisplus.annotation.KeySequence; |
| 5 | import com.baomidou.mybatisplus.annotation.TableId; | 6 | import com.baomidou.mybatisplus.annotation.TableId; |
| 6 | import com.baomidou.mybatisplus.annotation.TableName; | 7 | import com.baomidou.mybatisplus.annotation.TableName; |
| @@ -72,7 +73,9 @@ public class CombinationRecordDO extends BaseDO { | @@ -72,7 +73,9 @@ public class CombinationRecordDO extends BaseDO { | ||
| 72 | */ | 73 | */ |
| 73 | private String avatar; | 74 | private String avatar; |
| 74 | /** | 75 | /** |
| 75 | - * 开团状态: 正在开团 拼团成功 拼团失败 | 76 | + * 开团状态 |
| 77 | + * | ||
| 78 | + * 关联 {@link CombinationRecordStatusEnum} | ||
| 76 | */ | 79 | */ |
| 77 | private Integer status; | 80 | private Integer status; |
| 78 | /** | 81 | /** |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/combination/combinationactivity/CombinationRecordMapper.java
| 1 | package cn.iocoder.yudao.module.promotion.dal.mysql.combination.combinationactivity; | 1 | package cn.iocoder.yudao.module.promotion.dal.mysql.combination.combinationactivity; |
| 2 | 2 | ||
| 3 | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | 3 | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; |
| 4 | +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; | ||
| 4 | import cn.iocoder.yudao.module.promotion.dal.dataobject.combination.combinationactivity.CombinationRecordDO; | 5 | import cn.iocoder.yudao.module.promotion.dal.dataobject.combination.combinationactivity.CombinationRecordDO; |
| 5 | import org.apache.ibatis.annotations.Mapper; | 6 | import org.apache.ibatis.annotations.Mapper; |
| 6 | 7 | ||
| 8 | +import java.util.List; | ||
| 9 | + | ||
| 7 | /** | 10 | /** |
| 8 | * 拼团记录 Mapper | 11 | * 拼团记录 Mapper |
| 9 | * | 12 | * |
| @@ -16,4 +19,13 @@ public interface CombinationRecordMapper extends BaseMapperX<CombinationRecordDO | @@ -16,4 +19,13 @@ public interface CombinationRecordMapper extends BaseMapperX<CombinationRecordDO | ||
| 16 | return selectOne(CombinationRecordDO::getUserId, userId, CombinationRecordDO::getOrderId, orderId); | 19 | return selectOne(CombinationRecordDO::getUserId, userId, CombinationRecordDO::getOrderId, orderId); |
| 17 | } | 20 | } |
| 18 | 21 | ||
| 22 | + default List<CombinationRecordDO> selectListByHeadIdAndStatus(Long headId, Integer status) { | ||
| 23 | + return selectList(new LambdaQueryWrapperX<CombinationRecordDO>().eq(CombinationRecordDO::getHeadId, headId) | ||
| 24 | + .eq(CombinationRecordDO::getStatus, status)); | ||
| 25 | + } | ||
| 26 | + | ||
| 27 | + default List<CombinationRecordDO> selectListByStatus(Integer status) { | ||
| 28 | + return selectList(new LambdaQueryWrapperX<CombinationRecordDO>().eq(CombinationRecordDO::getStatus, status)); | ||
| 29 | + } | ||
| 30 | + | ||
| 19 | } | 31 | } |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/combination/CombinationActivityService.java
| @@ -99,6 +99,7 @@ public interface CombinationActivityService { | @@ -99,6 +99,7 @@ public interface CombinationActivityService { | ||
| 99 | * @param orderId 订单编号 | 99 | * @param orderId 订单编号 |
| 100 | * @param status 状态 | 100 | * @param status 状态 |
| 101 | * @param startTime 开始时间 | 101 | * @param startTime 开始时间 |
| 102 | + * @return | ||
| 102 | */ | 103 | */ |
| 103 | void updateRecordStatusAndStartTimeByUserIdAndOrderId(Long userId, Long orderId, Integer status, LocalDateTime startTime); | 104 | void updateRecordStatusAndStartTimeByUserIdAndOrderId(Long userId, Long orderId, Integer status, LocalDateTime startTime); |
| 104 | 105 | ||
| @@ -116,5 +117,5 @@ public interface CombinationActivityService { | @@ -116,5 +117,5 @@ public interface CombinationActivityService { | ||
| 116 | * @param orderId 订单编号 | 117 | * @param orderId 订单编号 |
| 117 | * @return 拼团状态 | 118 | * @return 拼团状态 |
| 118 | */ | 119 | */ |
| 119 | - Integer getRecordStatus(Long userId, Long orderId); | 120 | + boolean validateRecordStatusIsSuccess(Long userId, Long orderId); |
| 120 | } | 121 | } |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/combination/CombinationActivityServiceImpl.java
| @@ -24,7 +24,9 @@ import cn.iocoder.yudao.module.promotion.dal.dataobject.combination.combinationa | @@ -24,7 +24,9 @@ import cn.iocoder.yudao.module.promotion.dal.dataobject.combination.combinationa | ||
| 24 | import cn.iocoder.yudao.module.promotion.dal.mysql.combination.combinationactivity.CombinationActivityMapper; | 24 | import cn.iocoder.yudao.module.promotion.dal.mysql.combination.combinationactivity.CombinationActivityMapper; |
| 25 | import cn.iocoder.yudao.module.promotion.dal.mysql.combination.combinationactivity.CombinationProductMapper; | 25 | import cn.iocoder.yudao.module.promotion.dal.mysql.combination.combinationactivity.CombinationProductMapper; |
| 26 | import cn.iocoder.yudao.module.promotion.dal.mysql.combination.combinationactivity.CombinationRecordMapper; | 26 | import cn.iocoder.yudao.module.promotion.dal.mysql.combination.combinationactivity.CombinationRecordMapper; |
| 27 | +import cn.iocoder.yudao.module.promotion.enums.combination.CombinationRecordStatusEnum; | ||
| 27 | import org.springframework.stereotype.Service; | 28 | import org.springframework.stereotype.Service; |
| 29 | +import org.springframework.transaction.annotation.Transactional; | ||
| 28 | import org.springframework.validation.annotation.Validated; | 30 | import org.springframework.validation.annotation.Validated; |
| 29 | 31 | ||
| 30 | import javax.annotation.Resource; | 32 | import javax.annotation.Resource; |
| @@ -217,14 +219,27 @@ public class CombinationActivityServiceImpl implements CombinationActivityServic | @@ -217,14 +219,27 @@ public class CombinationActivityServiceImpl implements CombinationActivityServic | ||
| 217 | } | 219 | } |
| 218 | 220 | ||
| 219 | @Override | 221 | @Override |
| 222 | + @Transactional(rollbackFor = Exception.class) | ||
| 220 | public void updateRecordStatusAndStartTimeByUserIdAndOrderId(Long userId, Long orderId, Integer status, LocalDateTime startTime) { | 223 | public void updateRecordStatusAndStartTimeByUserIdAndOrderId(Long userId, Long orderId, Integer status, LocalDateTime startTime) { |
| 221 | CombinationRecordDO recordDO = validateCombinationRecord(userId, orderId); | 224 | CombinationRecordDO recordDO = validateCombinationRecord(userId, orderId); |
| 222 | - | ||
| 223 | // 更新状态 | 225 | // 更新状态 |
| 224 | recordDO.setStatus(status); | 226 | recordDO.setStatus(status); |
| 225 | // 更新开始时间 | 227 | // 更新开始时间 |
| 226 | recordDO.setStartTime(startTime); | 228 | recordDO.setStartTime(startTime); |
| 227 | recordMapper.updateById(recordDO); | 229 | recordMapper.updateById(recordDO); |
| 230 | + | ||
| 231 | + // 更新拼团参入人数 | ||
| 232 | + List<CombinationRecordDO> recordDOs = recordMapper.selectListByHeadIdAndStatus(recordDO.getHeadId(), status); | ||
| 233 | + if (CollUtil.isNotEmpty(recordDOs)) { | ||
| 234 | + recordDOs.forEach(item -> { | ||
| 235 | + item.setUserCount(recordDOs.size()); | ||
| 236 | + // 校验拼团是否满足要求 | ||
| 237 | + if (recordDOs.size() >= recordDO.getUserSize()) { | ||
| 238 | + item.setStatus(CombinationRecordStatusEnum.SUCCESS.getStatus()); | ||
| 239 | + } | ||
| 240 | + }); | ||
| 241 | + } | ||
| 242 | + recordMapper.updateBatch(recordDOs); | ||
| 228 | } | 243 | } |
| 229 | 244 | ||
| 230 | private CombinationRecordDO validateCombinationRecord(Long userId, Long orderId) { | 245 | private CombinationRecordDO validateCombinationRecord(Long userId, Long orderId) { |
| @@ -249,9 +264,18 @@ public class CombinationActivityServiceImpl implements CombinationActivityServic | @@ -249,9 +264,18 @@ public class CombinationActivityServiceImpl implements CombinationActivityServic | ||
| 249 | } | 264 | } |
| 250 | 265 | ||
| 251 | @Override | 266 | @Override |
| 252 | - public Integer getRecordStatus(Long userId, Long orderId) { | 267 | + public boolean validateRecordStatusIsSuccess(Long userId, Long orderId) { |
| 253 | CombinationRecordDO recordDO = validateCombinationRecord(userId, orderId); | 268 | CombinationRecordDO recordDO = validateCombinationRecord(userId, orderId); |
| 254 | - return recordDO.getStatus(); | 269 | + return ObjectUtil.equal(recordDO.getStatus(), CombinationRecordStatusEnum.SUCCESS.getStatus()); |
| 270 | + } | ||
| 271 | + | ||
| 272 | + /** | ||
| 273 | + * APP 端获取开团记录 | ||
| 274 | + * | ||
| 275 | + * @return 开团记录 | ||
| 276 | + */ | ||
| 277 | + public List<CombinationRecordDO> getRecordList() { | ||
| 278 | + return recordMapper.selectListByStatus(CombinationRecordStatusEnum.ONGOING.getStatus()); | ||
| 255 | } | 279 | } |
| 256 | 280 | ||
| 257 | } | 281 | } |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/order/TradeOrderServiceImpl.java
| @@ -164,13 +164,10 @@ public class TradeOrderServiceImpl implements TradeOrderService { | @@ -164,13 +164,10 @@ public class TradeOrderServiceImpl implements TradeOrderService { | ||
| 164 | @Override | 164 | @Override |
| 165 | @Transactional(rollbackFor = Exception.class) | 165 | @Transactional(rollbackFor = Exception.class) |
| 166 | public TradeOrderDO createOrder(Long userId, String userIp, AppTradeOrderCreateReqVO createReqVO) { | 166 | public TradeOrderDO createOrder(Long userId, String userIp, AppTradeOrderCreateReqVO createReqVO) { |
| 167 | - // 1. 用户收件地址的校验 | ||
| 168 | - AddressRespDTO address = validateAddress(userId, createReqVO.getAddressId()); | ||
| 169 | // 2. 价格计算 | 167 | // 2. 价格计算 |
| 170 | TradePriceCalculateRespBO calculateRespBO = calculatePrice(userId, createReqVO); | 168 | TradePriceCalculateRespBO calculateRespBO = calculatePrice(userId, createReqVO); |
| 171 | - | ||
| 172 | // 3.1 插入 TradeOrderDO 订单 | 169 | // 3.1 插入 TradeOrderDO 订单 |
| 173 | - TradeOrderDO order = createTradeOrder(userId, userIp, createReqVO, calculateRespBO, address); | 170 | + TradeOrderDO order = createTradeOrder(userId, userIp, createReqVO, calculateRespBO); |
| 174 | // 3.2 插入 TradeOrderItemDO 订单项 | 171 | // 3.2 插入 TradeOrderItemDO 订单项 |
| 175 | List<TradeOrderItemDO> orderItems = createTradeOrderItems(order, calculateRespBO); | 172 | List<TradeOrderItemDO> orderItems = createTradeOrderItems(order, calculateRespBO); |
| 176 | // 订单创建完后的逻辑 | 173 | // 订单创建完后的逻辑 |
| @@ -183,6 +180,10 @@ public class TradeOrderServiceImpl implements TradeOrderService { | @@ -183,6 +180,10 @@ public class TradeOrderServiceImpl implements TradeOrderService { | ||
| 183 | combinationApi.createRecord(TradeOrderConvert.INSTANCE.convert(order, orderItems.get(0), createReqVO, user) | 180 | combinationApi.createRecord(TradeOrderConvert.INSTANCE.convert(order, orderItems.get(0), createReqVO, user) |
| 184 | .setStatus(CombinationRecordStatusEnum.NOT_PAY.getStatus())); | 181 | .setStatus(CombinationRecordStatusEnum.NOT_PAY.getStatus())); |
| 185 | } | 182 | } |
| 183 | + // TODO 秒杀扣减库存是下单就扣除还是等待订单支付成功再扣除 | ||
| 184 | + if (ObjectUtil.equal(TradeOrderTypeEnum.SECKILL.getType(), order.getType())) { | ||
| 185 | + | ||
| 186 | + } | ||
| 186 | 187 | ||
| 187 | // TODO @LeeYan9: 是可以思考下, 订单的营销优惠记录, 应该记录在哪里, 微信讨论起来! | 188 | // TODO @LeeYan9: 是可以思考下, 订单的营销优惠记录, 应该记录在哪里, 微信讨论起来! |
| 188 | return order; | 189 | return order; |
| @@ -221,7 +222,13 @@ public class TradeOrderServiceImpl implements TradeOrderService { | @@ -221,7 +222,13 @@ public class TradeOrderServiceImpl implements TradeOrderService { | ||
| 221 | } | 222 | } |
| 222 | 223 | ||
| 223 | private TradeOrderDO createTradeOrder(Long userId, String clientIp, AppTradeOrderCreateReqVO createReqVO, | 224 | private TradeOrderDO createTradeOrder(Long userId, String clientIp, AppTradeOrderCreateReqVO createReqVO, |
| 224 | - TradePriceCalculateRespBO calculateRespBO, AddressRespDTO address) { | 225 | + TradePriceCalculateRespBO calculateRespBO) { |
| 226 | + // 用户选择物流配送的时候才需要填写收货地址 | ||
| 227 | + AddressRespDTO address = new AddressRespDTO(); | ||
| 228 | + if (ObjectUtil.equal(createReqVO.getDeliveryType(), DeliveryTypeEnum.EXPRESS.getMode())) { | ||
| 229 | + // 用户收件地址的校验 | ||
| 230 | + address = validateAddress(userId, createReqVO.getAddressId()); | ||
| 231 | + } | ||
| 225 | TradeOrderDO order = TradeOrderConvert.INSTANCE.convert(userId, clientIp, createReqVO, calculateRespBO, address); | 232 | TradeOrderDO order = TradeOrderConvert.INSTANCE.convert(userId, clientIp, createReqVO, calculateRespBO, address); |
| 226 | order.setType(validateActivity(createReqVO)); | 233 | order.setType(validateActivity(createReqVO)); |
| 227 | order.setNo(IdUtil.getSnowflakeNextId() + ""); // TODO @LeeYan9: 思考下, 怎么生成好点哈; 这个是会展示给用户的; | 234 | order.setNo(IdUtil.getSnowflakeNextId() + ""); // TODO @LeeYan9: 思考下, 怎么生成好点哈; 这个是会展示给用户的; |
| @@ -232,7 +239,7 @@ public class TradeOrderServiceImpl implements TradeOrderService { | @@ -232,7 +239,7 @@ public class TradeOrderServiceImpl implements TradeOrderService { | ||
| 232 | // 支付信息 | 239 | // 支付信息 |
| 233 | order.setAdjustPrice(0).setPayStatus(false); | 240 | order.setAdjustPrice(0).setPayStatus(false); |
| 234 | // 物流信息 TODO 芋艿:暂时写死物流方式;应该是前端选择的 | 241 | // 物流信息 TODO 芋艿:暂时写死物流方式;应该是前端选择的 |
| 235 | - order.setDeliveryType(DeliveryTypeEnum.EXPRESS.getMode()).setDeliveryStatus(TradeOrderDeliveryStatusEnum.UNDELIVERED.getStatus()); | 242 | + order.setDeliveryType(createReqVO.getDeliveryType()).setDeliveryStatus(TradeOrderDeliveryStatusEnum.UNDELIVERED.getStatus()); |
| 236 | // 退款信息 | 243 | // 退款信息 |
| 237 | order.setRefundStatus(TradeOrderRefundStatusEnum.NONE.getStatus()).setRefundPrice(0); | 244 | order.setRefundStatus(TradeOrderRefundStatusEnum.NONE.getStatus()).setRefundPrice(0); |
| 238 | tradeOrderMapper.insert(order); | 245 | tradeOrderMapper.insert(order); |
| @@ -260,7 +267,7 @@ public class TradeOrderServiceImpl implements TradeOrderService { | @@ -260,7 +267,7 @@ public class TradeOrderServiceImpl implements TradeOrderService { | ||
| 260 | TradePriceCalculateRespBO calculateRespBO) { | 267 | TradePriceCalculateRespBO calculateRespBO) { |
| 261 | // 下单时扣减商品库存 | 268 | // 下单时扣减商品库存 |
| 262 | productSkuApi.updateSkuStock(new ProductSkuUpdateStockReqDTO(TradeOrderConvert.INSTANCE.convertList(orderItems))); | 269 | productSkuApi.updateSkuStock(new ProductSkuUpdateStockReqDTO(TradeOrderConvert.INSTANCE.convertList(orderItems))); |
| 263 | - // TODO puhui:扣减活动库存 | 270 | + |
| 264 | // 删除购物车商品 TODO 芋艿:待实现 | 271 | // 删除购物车商品 TODO 芋艿:待实现 |
| 265 | 272 | ||
| 266 | // 扣减积分,抵扣金额 TODO 芋艿:待实现 | 273 | // 扣减积分,抵扣金额 TODO 芋艿:待实现 |
| @@ -271,7 +278,7 @@ public class TradeOrderServiceImpl implements TradeOrderService { | @@ -271,7 +278,7 @@ public class TradeOrderServiceImpl implements TradeOrderService { | ||
| 271 | .setOrderId(tradeOrderDO.getId())); | 278 | .setOrderId(tradeOrderDO.getId())); |
| 272 | } | 279 | } |
| 273 | 280 | ||
| 274 | - // 生成预支付 TODO puhui: 活动支付金额怎么算? | 281 | + // 生成预支付 |
| 275 | createPayOrder(tradeOrderDO, orderItems, calculateRespBO); | 282 | createPayOrder(tradeOrderDO, orderItems, calculateRespBO); |
| 276 | 283 | ||
| 277 | // 增加订单日志 TODO 芋艿:待实现 | 284 | // 增加订单日志 TODO 芋艿:待实现 |
| @@ -289,6 +296,7 @@ public class TradeOrderServiceImpl implements TradeOrderService { | @@ -289,6 +296,7 @@ public class TradeOrderServiceImpl implements TradeOrderService { | ||
| 289 | } | 296 | } |
| 290 | 297 | ||
| 291 | @Override | 298 | @Override |
| 299 | + @Transactional(rollbackFor = Exception.class) | ||
| 292 | public void updateOrderPaid(Long id, Long payOrderId) { | 300 | public void updateOrderPaid(Long id, Long payOrderId) { |
| 293 | // 校验并获得交易订单(可支付) | 301 | // 校验并获得交易订单(可支付) |
| 294 | KeyValue<TradeOrderDO, PayOrderRespDTO> orderResult = validateOrderPayable(id, payOrderId); | 302 | KeyValue<TradeOrderDO, PayOrderRespDTO> orderResult = validateOrderPayable(id, payOrderId); |
| @@ -305,7 +313,7 @@ public class TradeOrderServiceImpl implements TradeOrderService { | @@ -305,7 +313,7 @@ public class TradeOrderServiceImpl implements TradeOrderService { | ||
| 305 | // 校验活动 | 313 | // 校验活动 |
| 306 | // 1、拼团活动 | 314 | // 1、拼团活动 |
| 307 | if (ObjectUtil.equal(TradeOrderTypeEnum.COMBINATION.getType(), order.getType())) { | 315 | if (ObjectUtil.equal(TradeOrderTypeEnum.COMBINATION.getType(), order.getType())) { |
| 308 | - // 更新拼团状态 TODO puhui999:订单支付失败或订单过期删除这条拼团记录 | 316 | + // 更新拼团状态 TODO puhui999:订单支付失败或订单支付过期删除这条拼团记录 |
| 309 | combinationApi.updateRecordStatusAndStartTime(order.getUserId(), order.getId(), CombinationRecordStatusEnum.ONGOING.getStatus()); | 317 | combinationApi.updateRecordStatusAndStartTime(order.getUserId(), order.getId(), CombinationRecordStatusEnum.ONGOING.getStatus()); |
| 310 | } | 318 | } |
| 311 | // TODO 芋艿:发送订单变化的消息 | 319 | // TODO 芋艿:发送订单变化的消息 |
| @@ -498,10 +506,11 @@ public class TradeOrderServiceImpl implements TradeOrderService { | @@ -498,10 +506,11 @@ public class TradeOrderServiceImpl implements TradeOrderService { | ||
| 498 | if (ObjectUtil.notEqual(TradeOrderRefundStatusEnum.NONE.getStatus(), order.getRefundStatus())) { | 506 | if (ObjectUtil.notEqual(TradeOrderRefundStatusEnum.NONE.getStatus(), order.getRefundStatus())) { |
| 499 | throw exception(ORDER_DELIVERY_FAIL_REFUND_STATUS_NOT_NONE); | 507 | throw exception(ORDER_DELIVERY_FAIL_REFUND_STATUS_NOT_NONE); |
| 500 | } | 508 | } |
| 501 | - // 校验订单拼团是否成功 | 509 | + // 订单类型:拼团 |
| 502 | if (ObjectUtil.equal(TradeOrderTypeEnum.COMBINATION.getType(), order.getType())) { | 510 | if (ObjectUtil.equal(TradeOrderTypeEnum.COMBINATION.getType(), order.getType())) { |
| 511 | + // 校验订单拼团是否成功 | ||
| 503 | // TODO 用户 ID 使用当前登录用户的还是订单保存的? | 512 | // TODO 用户 ID 使用当前登录用户的还是订单保存的? |
| 504 | - if (ObjectUtil.notEqual(combinationApi.getRecordStatus(order.getUserId(), order.getId()), CombinationRecordStatusEnum.SUCCESS.getStatus())) { | 513 | + if (combinationApi.validateRecordStatusIsSuccess(order.getUserId(), order.getId())) { |
| 505 | throw exception(ORDER_DELIVERY_FAIL_COMBINATION_RECORD_STATUS_NOT_SUCCESS); | 514 | throw exception(ORDER_DELIVERY_FAIL_COMBINATION_RECORD_STATUS_NOT_SUCCESS); |
| 506 | } | 515 | } |
| 507 | } | 516 | } |