|
|
@@ -260,6 +260,29 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
|
|
|
if (sku.getPrice() == null || sku.getPrice().compareTo(BigDecimal.ZERO) <= 0) {
|
|
|
throw BusinessRuntimeException.getInstance("下单商品价格异常");
|
|
|
}
|
|
|
+ //是否是特定价格 且是否满足
|
|
|
+ Boolean isSpecificPrice = false;
|
|
|
+ String specificGoodsIds = sku.getSpecificGoodsIds();
|
|
|
+ BigDecimal specificPrice = BigDecimal.ZERO;
|
|
|
+ if (StrUtil.isNotEmpty(specificGoodsIds)) {
|
|
|
+ if (payRequest.getDonMoney().compareTo(sku.getSpecificPrice()) <= 0) {
|
|
|
+ payRequest.setDonMoney(sku.getSpecificPrice());
|
|
|
+ }
|
|
|
+ List<Long> specificGoodsList = Jsons.parseList(specificGoodsIds, Long.class);
|
|
|
+ if (CollUtil.isNotEmpty(specificGoodsList)) {
|
|
|
+ if (user.getId() == 0) throw BusinessRuntimeException.getGatewayApiCode(GatewayApiCode.CMS_TOKEN_VALID);
|
|
|
+ Number count = beanSearcher.searchCount(OrderDon.class, MapUtils.builder().field(OrderDon::getGoodsId, specificGoodsIds).op(Operator.InList)
|
|
|
+ .field(OrderDon::getUserId, user.getId())
|
|
|
+ .field(OrderDon::getStatus, Constant.noOrderAllStatus).op(Operator.NotIn)
|
|
|
+ .build());
|
|
|
+ if (count.intValue() <= 0) {
|
|
|
+ throw BusinessRuntimeException.getInstance("你不满足该商品特定价格条件");
|
|
|
+ }
|
|
|
+ isSpecificPrice = true;
|
|
|
+ specificPrice = sku.getPrice();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
if (payRequest.getDonMoney().compareTo(sku.getPrice()) < 0) {
|
|
|
log.info("规格:{}支付金额:{}异常,调整用户userId:{}支付金额为:{}", sku.getSpecVal(), payRequest.getDonMoney(), user.getId(), sku.getPrice());
|
|
|
payRequest.setDonMoney(sku.getPrice());
|