|
|
@@ -310,35 +310,37 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
|
|
|
if (sku.getPrice() == null || sku.getPrice().compareTo(BigDecimal.ZERO) <= 0) {
|
|
|
throw BusinessRuntimeException.getInstance("下单商品价格异常");
|
|
|
}
|
|
|
- //是否是特定价格 且是否满足
|
|
|
- Boolean isSpecificPrice = Optional.ofNullable(payRequest.getIsSpecificPrice()).orElse(false);
|
|
|
+ }
|
|
|
+
|
|
|
+ //是否是特定价格 且是否满足
|
|
|
+ Boolean isSpecificPrice = Optional.ofNullable(payRequest.getIsSpecificPrice()).orElse(false);
|
|
|
+ BigDecimal specificPrice = null;
|
|
|
+ if (isSpecificPrice) {
|
|
|
String specificGoodsIds = sku.getSpecificGoodsIds();
|
|
|
- BigDecimal specificPrice = BigDecimal.ZERO;
|
|
|
- if (isSpecificPrice) {
|
|
|
- if (StrUtil.isEmpty(specificGoodsIds)) {
|
|
|
- throw BusinessRuntimeException.getInstance("系统异常,请刷新页面重试");
|
|
|
- }
|
|
|
- if (payRequest.getDonMoney().compareTo(sku.getSpecificPrice()) <= 0) {
|
|
|
- payRequest.setDonMoney(sku.getSpecificPrice());
|
|
|
- }
|
|
|
- List<Long> specificGoodsList = Jsons.parseList(specificGoodsIds, Long.class);
|
|
|
- if (CollUtil.isEmpty(specificGoodsList)) {
|
|
|
- throw BusinessRuntimeException.getInstance("系统异常,请刷新页面重试");
|
|
|
- }
|
|
|
- if (user.getId() == 0) throw BusinessRuntimeException.getGatewayApiCode(GatewayApiCode.CMS_TOKEN_VALID);
|
|
|
- Number count = beanSearcher.searchCount(OrderDon.class, MapUtils.builder().field(OrderDon::getGoodsId, specificGoodsList).op(Operator.InList)
|
|
|
- .field(OrderDon::getUserId, user.getId())
|
|
|
- .field(OrderDon::getStatus, Constant.noOrderAllStatus).op(Operator.NotIn)
|
|
|
- .build());
|
|
|
- if (count.intValue() <= 0) {
|
|
|
- throw BusinessRuntimeException.getInstance("你不满足该商品特定价格条件");
|
|
|
- }
|
|
|
- specificPrice = sku.getSpecificPrice();
|
|
|
+ if (StrUtil.isEmpty(specificGoodsIds)) {
|
|
|
+ throw BusinessRuntimeException.getInstance("系统异常,请刷新页面重试");
|
|
|
}
|
|
|
- if (payRequest.getDonMoney().compareTo(sku.getPrice()) < 0) {
|
|
|
- log.info("规格:{}支付金额:{}异常,调整用户userId:{}支付金额为:{}", sku.getSpecVal(), payRequest.getDonMoney(), user.getId(), sku.getPrice());
|
|
|
- payRequest.setDonMoney(sku.getPrice());
|
|
|
+ if (payRequest.getDonMoney().compareTo(sku.getSpecificPrice()) <= 0) {
|
|
|
+ payRequest.setDonMoney(sku.getSpecificPrice());
|
|
|
}
|
|
|
+ List<Long> specificGoodsList = Jsons.parseList(specificGoodsIds, Long.class);
|
|
|
+ if (CollUtil.isEmpty(specificGoodsList)) {
|
|
|
+ throw BusinessRuntimeException.getInstance("系统异常,请刷新页面重试");
|
|
|
+ }
|
|
|
+ if (user.getId() == 0) throw BusinessRuntimeException.getGatewayApiCode(GatewayApiCode.CMS_TOKEN_VALID);
|
|
|
+ Number count = beanSearcher.searchCount(OrderDon.class, MapUtils.builder().field(OrderDon::getGoodsId, specificGoodsList).op(Operator.InList)
|
|
|
+ .field(OrderDon::getUserId, user.getId())
|
|
|
+ .field(OrderDon::getStatus, Constant.noOrderAllStatus).op(Operator.NotIn)
|
|
|
+ .build());
|
|
|
+ if (count.intValue() <= 0) {
|
|
|
+ throw BusinessRuntimeException.getInstance("你不满足该商品特定价格条件");
|
|
|
+ }
|
|
|
+ specificPrice = sku.getSpecificPrice();
|
|
|
+ }
|
|
|
+
|
|
|
+ if (sku != null && !isSpecificPrice && payRequest.getDonMoney().compareTo(sku.getPrice()) < 0) {
|
|
|
+ log.info("规格:{}支付金额:{}异常,调整用户userId:{}支付金额为:{}", sku.getSpecVal(), payRequest.getDonMoney(), user.getId(), sku.getPrice());
|
|
|
+ payRequest.setDonMoney(sku.getPrice());
|
|
|
}
|
|
|
|
|
|
orderDon.setMoney(payRequest.getDonMoney());
|
|
|
@@ -346,9 +348,6 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
|
|
|
|
|
|
List<Long> dpSkuIds = payRequest.getDpSkuIds();
|
|
|
if (CollUtil.isNotEmpty(dpSkuIds)) {
|
|
|
- if (dpSkuIds.size() > 1) {
|
|
|
- throw BusinessRuntimeException.getInstance("暂只支持优惠加购一件商品");
|
|
|
- }
|
|
|
//是否满足关联
|
|
|
List<GoodsDiscountPlusPurchaseRelation> ds_relations = discountPlusPurchaseRelationMapper.selectList(Wrappers.lambdaQuery(GoodsDiscountPlusPurchaseRelation.class)
|
|
|
.eq(GoodsDiscountPlusPurchaseRelation::getSkuId, sku.getId())
|