| | |
| | | private final IApiMallMemberService memberService; |
| | | private final IMallMoneyFlowService mallMoneyFlowService; |
| | | private final RedisUtils redisUtils; |
| | | private final MallCountryDeliveryMapper mallCountryDeliveryMapper; |
| | | |
| | | private final AgentProducer agentProducer; |
| | | private final ApiChatPayService apiChatPayService; |
| | |
| | | this.baseMapper.insert(orderInfo); |
| | | |
| | | BigDecimal total = BigDecimal.ZERO; |
| | | //运费 |
| | | BigDecimal delivaryAmount = addOrderDto.getDeliveryAmount() == null ? BigDecimal.ZERO : addOrderDto.getDeliveryAmount(); |
| | | for (AddOrderItemDto item : addOrderDto.getItems()) { |
| | | MallOrderItem orderItem = new MallOrderItem(); |
| | | |
| | |
| | | if(1 != goodsResult){ |
| | | throw new FebsException("Discontinued"); |
| | | } |
| | | |
| | | delivaryAmount = delivaryAmount.add(mallGoods.getCarriageAmount()); |
| | | |
| | | BigDecimal amount = sku.getPresentPrice().multiply(BigDecimal.valueOf(item.getCnt())); |
| | | orderItem.setAmount(amount); |
| | |
| | | } |
| | | mallOrderItemMapper.insert(orderItem); |
| | | } |
| | | |
| | | |
| | | |
| | | //运费 |
| | | MallCountryDelivery delivery = mallCountryDeliveryMapper.selectOne( |
| | | Wrappers.lambdaQuery(MallCountryDelivery.class) |
| | | .eq(MallCountryDelivery::getCountryCode, addOrderDto.getCountryCode().toUpperCase()) |
| | | .eq(MallCountryDelivery::getStatus, 1) |
| | | ); |
| | | MallCountryDelivery defaultDelivery = mallCountryDeliveryMapper.selectOne( |
| | | Wrappers.lambdaQuery(MallCountryDelivery.class) |
| | | .eq(MallCountryDelivery::getCountryCode, "DEFAULT") |
| | | .eq(MallCountryDelivery::getStatus, 1) |
| | | ); |
| | | BigDecimal delivaryAmount = defaultDelivery.getShippingFee(); |
| | | if (delivery != null) { |
| | | delivaryAmount = delivery.getShippingFee(); |
| | | } |
| | | orderInfo.setCarriage(delivaryAmount); |
| | | |
| | | total = total.add(delivaryAmount); |