| | |
| | | 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); |
| | |
| | | @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 团长特征码 |
| | | * , IFNULL(sum(a.amount),0) amount 每日提成总金额 |
| | | */ |
| | | //获取每日提成总数 |
| | | /** |
| | | * a.unique_code uniqueCode 团长特征码 |
| | | * , IFNULL(sum(a.amount),0) amount 每日提成总金额 |
| | | */ |
| | | // DateTime dateTime = DateUtil.offsetDay(new Date(), -1); |
| | | DateTime dateTime = DateUtil.offsetDay(new Date(), 0); |
| | | List<Map<String, String>> allLeaderAchieve = mallLeaderAchieveMapper.selectListByStateAndCreateTimeAndUniqueCode(MallLeaderAchieve.STATE_ONE,dateTime); |
| | | if (CollUtil.isNotEmpty(allLeaderAchieve)) { |
| | | for (Map<String, String> map : allLeaderAchieve) { |
| | | String uniqueCode = map.get("uniqueCode"); |
| | | Object profitAmount = map.get("profitAmount"); |
| | | DateTime dateTime = DateUtil.offsetDay(new Date(), 0); |
| | | List<Map<String, String>> allLeaderAchieve = mallLeaderAchieveMapper.selectListByStateAndCreateTimeAndUniqueCode(MallLeaderAchieve.STATE_ONE,dateTime); |
| | | if (CollUtil.isNotEmpty(allLeaderAchieve)) { |
| | | 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); |