xiaoyong931011
2023-03-30 836e019db92b9871cba9d440c8159b35f79e1726
src/main/java/cc/mrbird/febs/mall/service/impl/ApiMallOrderInfoServiceImpl.java
@@ -461,9 +461,14 @@
                    BigDecimal star = (mallGoods.getStar()==null ? BigDecimal.ZERO : mallGoods.getStar())
                            .multiply(new BigDecimal(orderItem.getCnt()));
                    starSum = starSum.add(star);
//                    scoreSum = scoreSum.add(
//                            new BigDecimal(mallGoods.getPresentPrice())
//                                    .multiply(new BigDecimal(3))
//                                    .multiply(new BigDecimal(orderItem.getCnt()))
//                                    .abs()
//                                    .setScale(2,BigDecimal.ROUND_DOWN));
                    scoreSum = scoreSum.add(
                            new BigDecimal(mallGoods.getPresentPrice())
                                    .multiply(new BigDecimal(3))
                                    .multiply(new BigDecimal(orderItem.getCnt()))
                                    .abs()
                                    .setScale(2,BigDecimal.ROUND_DOWN));
@@ -491,7 +496,8 @@
                                    starSum,
                                    MoneyFlowTypeEnum.STAR.getValue(),
                                    orderInfo.getOrderNo(),
                                    FlowTypeEnum.STAR.getValue());
                                    FlowTypeEnum.STAR.getValue(),
                                    2);
                        }
                        if(starGet.compareTo(star) > 0){
                            BigDecimal subtract = starGet.subtract(star);
@@ -504,7 +510,8 @@
                                    starSum,
                                    MoneyFlowTypeEnum.STAR.getValue(),
                                    orderInfo.getOrderNo(),
                                    FlowTypeEnum.STAR.getValue());
                                    FlowTypeEnum.STAR.getValue(),
                                    2);
                        }
                    }else{
                        mallMemberWalletMapper.addStarByMemberId(starSum.intValue(), memberId);
@@ -513,7 +520,8 @@
                                starSum,
                                MoneyFlowTypeEnum.STAR.getValue(),
                                orderInfo.getOrderNo(),
                                FlowTypeEnum.STAR.getValue());
                                FlowTypeEnum.STAR.getValue(),
                                2);
                    }
                }
            }
@@ -521,13 +529,29 @@
             * 增加补贴额度
             */
            if (scoreSum.compareTo(BigDecimal.ZERO) > 0) {
                MallMember mallMember = memberMapper.selectById(memberId);
                if(MemberLevelEnum.SECOND_LEVEL.getLevelCode(mallMember.getLevel()) >= 5){
                    scoreSum = scoreSum.multiply(new BigDecimal(3));
                }
                if(MemberLevelEnum.SECOND_LEVEL.getLevelCode(mallMember.getLevel()) >= 3
                &&MemberLevelEnum.SECOND_LEVEL.getLevelCode(mallMember.getLevel()) < 5){
                    scoreSum = scoreSum.multiply(new BigDecimal(2.8));
                }
                if(MemberLevelEnum.SECOND_LEVEL.getLevelCode(mallMember.getLevel()) < 3){
                    scoreSum = scoreSum.multiply(new BigDecimal(2.5));
                }
                memberWalletService.add(scoreSum, memberId, "totalScore");
                mallMoneyFlowService.addMoneyFlow(
                        memberId,
                        scoreSum,
                        MoneyFlowTypeEnum.TOTAL_SCORE.getValue(),
                        orderInfo.getOrderNo(),
                        FlowTypeEnum.TOTAL_SCORE.getValue());
                        "",
                        scoreSum.toString(),
                        memberId,
                        1,
                        FlowTypeEnum.TOTAL_SCORE.getValue(),
                        2);
            }
        }