| | |
| | | import cc.mrbird.febs.common.entity.QueryRequest; |
| | | import cc.mrbird.febs.common.enumerates.FlowTypeEnum; |
| | | import cc.mrbird.febs.common.enumerates.MoneyFlowTypeEnum; |
| | | import cc.mrbird.febs.common.utils.RedisUtils; |
| | | import cc.mrbird.febs.mall.dto.*; |
| | | import cc.mrbird.febs.mall.entity.*; |
| | | import cc.mrbird.febs.mall.mapper.*; |
| | |
| | | iApiMallMemberWalletService.addBalance(amount, mallOrderInfo.getMemberId()); |
| | | |
| | | mallMoneyFlowService.addMoneyFlow(mallOrderRefund.getMemberId(), amount, MoneyFlowTypeEnum.REFUND.getValue(), mallOrderInfo.getOrderNo(), FlowTypeEnum.BALANCE.getValue()); |
| | | |
| | | //积分池减少对应的数值 |
| | | String redisKey = "scorePool"; |
| | | String scorePoolRedis = redisUtils.getString(redisKey); |
| | | if(StrUtil.isBlank(scorePoolRedis)){ |
| | | redisUtils.set(redisKey,0,0L); |
| | | } |
| | | BigDecimal scorePoolOld = new BigDecimal(redisUtils.getString(redisKey)); |
| | | if(scorePoolOld.compareTo(amount) < 0){ |
| | | redisUtils.set(redisKey,0,0L); |
| | | }else{ |
| | | redisUtils.set(redisKey,scorePoolOld.subtract(amount).intValue(),0L); |
| | | } |
| | | } |
| | | |
| | | MallOrderRefundOperation mallOrderRefundOperation = new MallOrderRefundOperation(); |
| | |
| | | return new FebsResponse().success(); |
| | | } |
| | | |
| | | private final RedisUtils redisUtils; |
| | | @Override |
| | | public FebsResponse refundConfirm(Long id) { |
| | | MallOrderRefund mallOrderRefund = mallOrderRefundMapper.selectById(id); |
| | |
| | | BigDecimal refundAmount = mallOrderRefund.getAmount(); |
| | | //用户钱包增加对应的余额 |
| | | iApiMallMemberWalletService.addBalance(refundAmount, mallOrderInfo.getMemberId()); |
| | | //积分池减少对应的数值 |
| | | String redisKey = "scorePool"; |
| | | String scorePoolRedis = redisUtils.getString(redisKey); |
| | | if(StrUtil.isBlank(scorePoolRedis)){ |
| | | redisUtils.set(redisKey,0,0L); |
| | | } |
| | | BigDecimal scorePoolOld = new BigDecimal(redisUtils.getString(redisKey)); |
| | | if(scorePoolOld.compareTo(refundAmount) < 0){ |
| | | redisUtils.set(redisKey,0,0L); |
| | | }else{ |
| | | redisUtils.set(redisKey,scorePoolOld.subtract(refundAmount).intValue(),0L); |
| | | } |
| | | |
| | | //新增一条资金流水 |
| | | mallMoneyFlowService.addMoneyFlow(mallOrderRefund.getMemberId(), refundAmount, MoneyFlowTypeEnum.REFUND.getValue(), mallOrderInfo.getOrderNo(), FlowTypeEnum.BALANCE.getValue()); |