refactor(mall): 优化积分和余额支付流程
- 修改积分支付和余额支付的积分流水描述,使其更加准确
- 更新 ScoreFlowTypeEnum 枚举,增加 PAY_BALANCE 类型用于余额支付
- 在 ScoreServiceImpl 和 VipCommonServiceImpl 中使用新的支付描述格式
| | |
| | | /** |
| | | * |
| | | */ |
| | | SIGN_EXPERIENCE(7, "签到获得会员经验"), |
| | | SIGN_SCORE(7, "签到获得积分"), |
| | | SALE_RECOMMEND(6, "好友下单获得佣金"), |
| | | OTHER_RECOMMEND(5, "推荐下单获得积分"), |
| | | MINE_RECOMMEND(4, "下单获得积分"), |
| | | PAY_BALANCE(9, "余额支付{}"), |
| | | |
| | | PAY(1, "积分支付"), |
| | | SIGN_EXPERIENCE(8, "签到获得{}会员经验"), |
| | | SIGN_SCORE(7, "签到获得{}积分"), |
| | | SALE_RECOMMEND(6, "好友下单获得{}佣金"), |
| | | OTHER_RECOMMEND(5, "推荐下单获得{}积分"), |
| | | MINE_RECOMMEND(4, "下单获得{}积分"), |
| | | |
| | | BUY(2, "购买商品,获得等级经验"), |
| | | PAY(1, "支付{}积分"), |
| | | |
| | | BUY(2, "购买商品,获得{}会员经验"), |
| | | |
| | | RECOMMEND(3, "推荐下单获得积分"); |
| | | |
| | |
| | | //先支付积分部分 |
| | | if(orderInfo.getScoreAmount().compareTo(BigDecimal.ZERO) > 0){ |
| | | balanceScorePay(orderInfo, payOrderDto.getTradePwd(), "prizeScore"); |
| | | mallMoneyFlowService.addMoneyFlow(member.getId(), orderInfo.getAmount().negate(), ScoreFlowTypeEnum.PAY.getValue(), orderInfo.getOrderNo(), FlowTypeEnum.PRIZE_SCORE.getValue(), null, 2); |
| | | mallMoneyFlowService.addMoneyFlow( |
| | | member.getId(), |
| | | orderInfo.getAmount().negate(), |
| | | ScoreFlowTypeEnum.PAY.getValue(), |
| | | orderInfo.getOrderNo(), |
| | | FlowTypeEnum.PRIZE_SCORE.getValue(), |
| | | StrUtil.format(ScoreFlowTypeEnum.PAY.getDesc(),orderInfo.getScoreAmount()), |
| | | 2 |
| | | ); |
| | | } |
| | | |
| | | String payResultStr = ""; |
| | |
| | | orderInfo.setPayResult("1"); |
| | | orderInfo.setDeliveryState(OrderDeliveryStateEnum.DELIVERY_WAIT.getValue()); |
| | | |
| | | mallMoneyFlowService.addMoneyFlow(member.getId(), orderInfo.getAmount().negate(), MoneyFlowTypeEnum.PAY.getValue(), orderInfo.getOrderNo(), FlowTypeEnum.BALANCE.getValue(),"余额支付",2); |
| | | |
| | | mallMoneyFlowService.addMoneyFlow( |
| | | member.getId(), |
| | | orderInfo.getAmount().negate(), |
| | | ScoreFlowTypeEnum.PAY_BALANCE.getValue(), |
| | | orderInfo.getOrderNo(), |
| | | FlowTypeEnum.BALANCE.getValue(), |
| | | StrUtil.format(ScoreFlowTypeEnum.PAY_BALANCE.getDesc(),orderInfo.getScoreAmount()), |
| | | 2 |
| | | ); |
| | | agentProducer.sendOrderCoupon(orderInfo.getId()); |
| | | break; |
| | | case "4": |
| | |
| | | import cn.hutool.core.date.DateTime; |
| | | import cn.hutool.core.date.DateUnit; |
| | | import cn.hutool.core.date.DateUtil; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | |
| | | ScoreFlowTypeEnum.SIGN_EXPERIENCE.getValue(), |
| | | mallScoreSignRecord.getId().toString(), |
| | | FlowTypeEnum.SCORE.getValue(), |
| | | ScoreFlowTypeEnum.SIGN_EXPERIENCE.getDesc(), |
| | | StrUtil.format(ScoreFlowTypeEnum.SIGN_EXPERIENCE.getDesc(),amount), |
| | | 2); |
| | | } |
| | | if(mostSignIn == 2){ |
| | |
| | | ScoreFlowTypeEnum.SIGN_SCORE.getValue(), |
| | | mallScoreSignRecord.getId().toString(), |
| | | FlowTypeEnum.PRIZE_SCORE.getValue(), |
| | | ScoreFlowTypeEnum.SIGN_SCORE.getDesc(), |
| | | StrUtil.format(ScoreFlowTypeEnum.SIGN_SCORE.getDesc(),amount), |
| | | 2); |
| | | } |
| | | |
| | |
| | | ScoreFlowTypeEnum.BUY.getValue(), |
| | | mallOrderInfo.getOrderNo(), |
| | | FlowTypeEnum.SCORE.getValue(), |
| | | ScoreFlowTypeEnum.BUY.getDesc(), |
| | | StrUtil.format(ScoreFlowTypeEnum.BUY.getDesc(),amount), |
| | | 2 |
| | | ); |
| | | // 更新会员钱包中的分数 |
| | |
| | | recommendTypeScoreMap.get(key), |
| | | mallOrderInfo.getOrderNo(), |
| | | FlowTypeEnum.PRIZE_SCORE.getValue(), |
| | | ScoreFlowTypeEnum.getDescByValue(recommendTypeScoreMap.get(key)), |
| | | StrUtil.format(ScoreFlowTypeEnum.getDescByValue(recommendTypeScoreMap.get(key)),value), |
| | | 2); |
| | | mallMemberWalletService.add(value, key, "prizeScore"); |
| | | } |
| | |
| | | ScoreFlowTypeEnum.SALE_RECOMMEND.getValue(), |
| | | mallOrderInfo.getOrderNo(), |
| | | FlowTypeEnum.BALANCE.getValue(), |
| | | ScoreFlowTypeEnum.SALE_RECOMMEND.getDesc(), |
| | | StrUtil.format(ScoreFlowTypeEnum.SALE_RECOMMEND.getDesc(),multiply), |
| | | 2 |
| | | ); |
| | | // 更新会员钱包中的余额 |