| | |
| | | PRIZE(17), |
| | | |
| | | /** |
| | | * 抽奖 |
| | | * 积分池收益 |
| | | */ |
| | | SCORE_POOL(18); |
| | | |
| | |
| | | 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()); |
| | |
| | | private final DataDictionaryCustomMapper dataDictionaryCustomMapper; |
| | | private final MallMoneyFlowMapper mallMoneyFlowMapper; |
| | | private final MallAchieveRecordMapper mallAchieveRecordMapper; |
| | | private final RedisUtils redisUtils; |
| | | private final MallMemberWalletMapper mallMemberWalletMapper; |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | |
| | | log.info("#####==店补/董事==end==######"); |
| | | } |
| | | |
| | | private final RedisUtils redisUtils; |
| | | |
| | | @Override |
| | | public void scorePool() { |
| | | log.info("#####==积分池==start==######"); |
| | |
| | | return; |
| | | } |
| | | for(MallMember mallMember : mallMembers){ |
| | | walletService.add(income, mallMember.getId(), "score"); |
| | | moneyFlowService.addMoneyFlow(mallMember.getId(), income, MoneyFlowTypeEnum.SCORE_POOL.getValue(), null, FlowTypeEnum.SCORE.getValue()); |
| | | /* |
| | | 平分成佣金,一比一减少赠送积分 |
| | | 如果没有赠送积分,则平分0 |
| | | */ |
| | | BigDecimal outCome = BigDecimal.ZERO; |
| | | MallMemberWallet mallMemberWallet = mallMemberWalletMapper.selectWalletByMemberId(mallMember.getId()); |
| | | if(mallMemberWallet.getScore().compareTo(income) < 0){ |
| | | outCome = new BigDecimal(mallMemberWallet.getScore().intValue()); |
| | | }else{ |
| | | outCome = income; |
| | | } |
| | | walletService.add(outCome, mallMember.getId(), "commission"); |
| | | walletService.reduce(outCome, mallMember.getId(), "score"); |
| | | moneyFlowService.addMoneyFlow(mallMember.getId(), outCome, MoneyFlowTypeEnum.SCORE_POOL.getValue(), null, FlowTypeEnum.COMMISSION.getValue()); |
| | | moneyFlowService.addMoneyFlow(mallMember.getId(), outCome.negate(), MoneyFlowTypeEnum.SCORE_POOL.getValue(), null, FlowTypeEnum.SCORE.getValue()); |
| | | } |
| | | } |
| | | log.info("#####==积分池==end==######"); |
| | |
| | | import cc.mrbird.febs.common.exception.FebsException; |
| | | import cc.mrbird.febs.common.service.ValidateCodeService; |
| | | import cc.mrbird.febs.common.utils.Md5Util; |
| | | import cc.mrbird.febs.common.utils.RedisUtils; |
| | | import cc.mrbird.febs.mall.entity.MallMember; |
| | | import cc.mrbird.febs.mall.mapper.MallAchieveRecordMapper; |
| | | import cc.mrbird.febs.mall.mapper.MallMemberMapper; |
| | |
| | | private final MallMemberMapper mallMemberMapper; |
| | | private final MallOrderInfoMapper mallOrderInfoMapper; |
| | | private final MallAchieveRecordMapper mallAchieveRecordMapper; |
| | | private final RedisUtils redisUtils; |
| | | |
| | | @PostMapping("login") |
| | | @Limit(key = "login", period = 60, count = 10, name = "登录接口", prefix = "limit") |
| | |
| | | // Long todayIp = this.loginLogService.findTodayIp(); |
| | | // data.put("todayIp", todayIp); |
| | | |
| | | //积分池数据 |
| | | data.put("scorePool",redisUtils.get("scorePool")); |
| | | //支付统计 |
| | | data.put("wechatPay",mallOrderInfoMapper.selectSumAmountByPayMethodAndStatue(OrderPayMethodEnum.WECHAT.getName(), OrderStatusEnum.FINISH.getValue())); |
| | | data.put("alipayPay",mallOrderInfoMapper.selectSumAmountByPayMethodAndStatue(OrderPayMethodEnum.ALIPAY.getName(), OrderStatusEnum.FINISH.getValue())); |
| | |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="layui-card-body layui-anim layui-anim-fadein"> |
| | | <div class="layui-row"> |
| | | <div class="m-title">积分池</div> |
| | | <div class="layui-row layui-col-space15"> |
| | | <div class="layui-col-md3"> |
| | | <div class="layui-panel"> |
| | | <div class="box"> |
| | | <p class="name">剩余积分</p> |
| | | <p class="num"><span id="scorePool"></span></p> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | </div> |
| | | </div> |
| | | </div> |