| | |
| | | |
| | | private final AgentProducer agentProducer; |
| | | private final IPayService payService; |
| | | private final IMallAchieveService mallAchieveService; |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | |
| | | |
| | | // 零撸专区购买 |
| | | if (new BigDecimal(mallGoods.getPresentPrice()).compareTo(BigDecimal.ZERO) == 0) { |
| | | List<MallOrderItem> items = mallOrderItemMapper.selectItemByGoodsIdUnCancel(mallGoods.getId()); |
| | | List<MallOrderItem> items = mallOrderItemMapper.selectItemByGoodsIdUnCancel(mallGoods.getId(), member.getId()); |
| | | if (CollUtil.isNotEmpty(items)) { |
| | | throw new FebsException("无法重复领取同一个商品"); |
| | | } |
| | |
| | | if (CollUtil.isNotEmpty(orderItems)) { |
| | | for (MallOrderItem orderItem : orderItems) { |
| | | MallGoods mallGoods = mallGoodsMapper.selectById(orderItem.getGoodsId()); |
| | | |
| | | BigDecimal score = BigDecimal.ZERO; |
| | | MallGoodsSku sku = mallGoodsSkuMapper.selectById(orderItem.getSkuId()); |
| | | if (mallGoods.getIsNormal() == 2) { |
| | | hasTc = true; |
| | | MallGoodsSku sku = mallGoodsSkuMapper.selectById(orderItem.getSkuId()); |
| | | BigDecimal score = sku.getOriginalPrice().multiply(mallGoods.getStaticMulti()); |
| | | score = sku.getPresentPrice().multiply(mallGoods.getStaticMulti()); |
| | | } |
| | | |
| | | if (score.compareTo(BigDecimal.ZERO) > 0) { |
| | | memberWalletService.add(score, member.getId(), "score"); |
| | | mallMoneyFlowService.addMoneyFlow(member.getId(), score, MoneyFlowTypeEnum.STATIC_BONUS.getValue(), orderInfo.getOrderNo(), FlowTypeEnum.SCORE.getValue()); |
| | | |
| | | // 添加业绩 |
| | | mallAchieveService.add(orderItem.getId()); |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | mallMoneyFlowService.addMoneyFlow(member.getId(), orderInfo.getAmount().negate(), MoneyFlowTypeEnum.PAY.getValue(), orderInfo.getOrderNo(), FlowTypeEnum.BALANCE.getValue()); |
| | | // agentProducer.sendAutoLevelUpMsg(member.getId()); |
| | | agentProducer.sendAutoLevelUpMsg(member.getId()); |
| | | agentProducer.sendOrderReturn(orderInfo.getId()); |
| | | break; |
| | | case "4": |
| | |
| | | orderRefund.setRefundTime(new Date()); |
| | | orderRefund.setBeforeStatus(beforeStatus); |
| | | orderRefund.setStatus(OrderRefundStatusEnum.REFUND_APPLY.getValue()); |
| | | |
| | | // 未发货则退运费,发货了则不退 |
| | | if (beforeStatus == 2) { |
| | | orderRefund.setAmount(orderInfo.getAmount().add(orderInfo.getCarriage())); |
| | | } else { |
| | | orderRefund.setAmount(orderInfo.getAmount()); |
| | | } |
| | | mallOrderRefundMapper.insert(orderRefund); |
| | | } else { |
| | | orderRefund.setDesp(addRefundDto.getDesp()); |
| | |
| | | orderRefund.setRefundTime(new Date()); |
| | | orderRefund.setBeforeStatus(beforeStatus); |
| | | orderRefund.setStatus(OrderRefundStatusEnum.REFUND_APPLY.getValue()); |
| | | // 未发货则退运费,发货了则不退 |
| | | if (beforeStatus == 2) { |
| | | orderRefund.setAmount(orderInfo.getAmount().add(orderInfo.getCarriage())); |
| | | } else { |
| | | orderRefund.setAmount(orderInfo.getAmount()); |
| | | } |
| | | mallOrderRefundMapper.updateById(orderRefund); |
| | | } |
| | | |