xiaoyong931011
2022-09-09 e1e7d29ea23fcee395e3f13dc2763162c588b6d0
src/main/java/cc/mrbird/febs/mall/quartz/OrderSettlementJob.java
@@ -110,8 +110,10 @@
        List<MallOrderInfo> orderInfos = mallOrderInfoMapper.selectOrderByStatusAndPayTime(3,DateUtil.offsetDay(new Date(), -value));
        if(CollUtil.isNotEmpty(orderInfos)){
            for(MallOrderInfo orderInfo : orderInfos){
                DataDictionaryCustom dicBonusPercent = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(DataDictionaryEnum.BONUS_PERCENT.getType(), DataDictionaryEnum.BONUS_PERCENT.getCode());
                BigDecimal bonusPercent = new BigDecimal(dicBonusPercent.getValue()).setScale(2,BigDecimal.ROUND_DOWN);
                MallTeamLeader mallTeamLeader = mallTeamLeaderMapper.selectLeaderByUniqueCode(orderInfo.getTakeUniqueCode());
                BigDecimal bonusPercent =new BigDecimal(mallTeamLeader.getBonusPercent()==null?"0":mallTeamLeader.getBonusPercent());
//                DataDictionaryCustom dicBonusPercent = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(DataDictionaryEnum.BONUS_PERCENT.getType(), DataDictionaryEnum.BONUS_PERCENT.getCode());
//                BigDecimal bonusPercent = new BigDecimal(dicBonusPercent.getValue()).setScale(2,BigDecimal.ROUND_DOWN);
                //生成一条团长提成记录
                Long id = orderInfo.getId();
                List<MallOrderItem> mallOrderItemList = mallOrderItemMapper.selectListByOrderId(id);
@@ -147,11 +149,6 @@
    @Scheduled(cron = "1 * * * * ?")
    public void leaderAchieveAuto() {
        log.info("团长每日提成");
        DataDictionaryCustom dicBonusSwitch = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(DataDictionaryEnum.BONUS_SWITCH.getType(), DataDictionaryEnum.BONUS_SWITCH.getCode());
        String bonusSwitch = dicBonusSwitch.getValue();
        if("1".equals(bonusSwitch)){
//            DataDictionaryCustom dicBonusPercent = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(DataDictionaryEnum.BONUS_PERCENT.getType(), DataDictionaryEnum.BONUS_PERCENT.getCode());
//            BigDecimal bonusPercent = new BigDecimal(dicBonusPercent.getValue()).setScale(2,BigDecimal.ROUND_DOWN);
            //获取每日提成总数
            /**
             * a.unique_code uniqueCode 团长特征码
@@ -164,6 +161,10 @@
                for (Map<String, String> map : allLeaderAchieve) {
                    String uniqueCode = map.get("uniqueCode");
                    Object profitAmount = map.get("profitAmount");
                MallTeamLeader mallTeamLeader = mallTeamLeaderMapper.selectLeaderByUniqueCode(uniqueCode);
                Integer profitSwitch = mallTeamLeader.getProfitSwitch();
                if(1 == profitSwitch){
                    //直接舍弃小数点的第三位
                    BigDecimal achieveMoney = new BigDecimal(String.valueOf(profitAmount)).setScale(2,BigDecimal.ROUND_DOWN);
                    MallMember mallMember = mallMemberMapper.selectInfoByInviteId(uniqueCode);