|
|
@@ -54,6 +54,7 @@ import com.cyksj.model.dto.*;
|
|
|
import com.cyksj.model.entity.*;
|
|
|
import com.cyksj.model.manage.dto.ChannelBaiDuDiscountDto;
|
|
|
import com.cyksj.model.manage.dto.GiftCardDto;
|
|
|
+import com.cyksj.model.manage.request.ReqGoodsSkuSpec;
|
|
|
import com.cyksj.model.manage.views.GroupsRelationView;
|
|
|
import com.cyksj.model.manage.views.OrderDonView;
|
|
|
import com.cyksj.model.request.*;
|
|
|
@@ -131,6 +132,8 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
|
|
|
|
|
|
private final GoodsDonMapper goodsDonMapper;
|
|
|
|
|
|
+ private final GoodsDonSpecMapper goodsDonSpecMapper;
|
|
|
+
|
|
|
private final GroupsRelationMapper groupsRelationMapper;
|
|
|
|
|
|
private final BeanSearcher beanSearcher;
|
|
|
@@ -399,6 +402,18 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
|
|
|
payRequest.setDonMoney(sku.getPrice());
|
|
|
}
|
|
|
|
|
|
+ //租赁商品
|
|
|
+ if (goodsDon.getType() == 4) {
|
|
|
+ //租赁商品押金
|
|
|
+ BigDecimal rentGoodsDonDeposit = getRentGoodsDonDeposit(goodsId, sku.getSpecIds());
|
|
|
+ if (rentGoodsDonDeposit == null) throw BusinessRuntimeException.getInstance("应付押金异常..");
|
|
|
+ BigDecimal sPay = rentGoodsDonDeposit.add(sku.getPrice());
|
|
|
+ if (payRequest.getDonMoney().compareTo(sPay) < 0) {
|
|
|
+ payRequest.setDonMoney(sPay);
|
|
|
+ }
|
|
|
+ orderDon.setDeposit(rentGoodsDonDeposit);
|
|
|
+ }
|
|
|
+
|
|
|
orderDon.setMoney(payRequest.getDonMoney());
|
|
|
orderDon.setRealMoney(payRequest.getDonMoney());
|
|
|
orderDon.setOriMoney(sku.getPrice());
|
|
|
@@ -457,7 +472,8 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
|
|
|
throw BusinessRuntimeException.getInstance("车位与车队规格不一致");
|
|
|
}
|
|
|
}
|
|
|
- if (sku != null) {
|
|
|
+ //租赁商品不参与优惠
|
|
|
+ if (sku != null && goodsDon.getType() != 4) {
|
|
|
//扣除使用优惠券、余额的订单金额
|
|
|
deductOrderMoney(orderDon, couponUser, payRequest.getBalance(), user, sku.getPrice(), goodsDon.getType(), payRequest.getGcCash(), payRequest.getGcpIds(), payRequest.getIsAcReduce());
|
|
|
}
|
|
|
@@ -2780,4 +2796,26 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
|
|
|
userBenefitsService.recordBalanceBySource(user.getId(), BigDecimal.valueOf(-subBalance.longValue()), UserBalanceSourceRecord.Source.payment);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取租赁商品的应付押金
|
|
|
+ */
|
|
|
+ private BigDecimal getRentGoodsDonDeposit(Long goodsId, String specIdsStr) throws Exception {
|
|
|
+ GoodsDonSpec rentGoodsDonSpec = goodsDonSpecMapper.selectOne(Wrappers.lambdaQuery(GoodsDonSpec.class)
|
|
|
+ .eq(GoodsDonSpec::getGoodsId, goodsId)
|
|
|
+ .last("limit 1"));
|
|
|
+ List<Long> specIds = Jsons.parseList(specIdsStr, Long.class);
|
|
|
+ String specsJson = rentGoodsDonSpec.getSpecsJson();
|
|
|
+ List<ReqGoodsSkuSpec> reqGoodsSkuSpec = Jsons.parseList(specsJson, ReqGoodsSkuSpec.class);
|
|
|
+ for (ReqGoodsSkuSpec spec : reqGoodsSkuSpec) {
|
|
|
+ if (spec.getKey().contains("版本")) {
|
|
|
+ for (ReqGoodsSkuSpec.Node value : spec.getValues()) {
|
|
|
+ if (specIds.contains(value.getId())) {
|
|
|
+ return value.getDeposit();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
}
|