|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | @Transactional(rollbackFor = Exception.class) | 
|---|
|  |  |  | public void staticProfit() { | 
|---|
|  |  |  | public void staticProfit(Date profitDate) { | 
|---|
|  |  |  | log.info("#####静态分红开始运行:{}#####", new Date()); | 
|---|
|  |  |  | List<MallMember> members = mallMemberMapper.selectList(null); | 
|---|
|  |  |  | if (CollUtil.isEmpty(members)) { | 
|---|
|  |  |  | return; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Date profitDate = DateUtil.offset(new Date(), DateField.DAY_OF_YEAR, -1); | 
|---|
|  |  |  | if (profitDate == null) { | 
|---|
|  |  |  | profitDate = DateUtil.offset(new Date(), DateField.DAY_OF_YEAR, -1); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | // 套餐业绩 | 
|---|
|  |  |  | //        BigDecimal tcIncome = mallOrderInfoMapper.selectTotalAmountUnCostForDate(profitDate, null, "D", 2); | 
|---|
|  |  |  | // 普通商品业绩 | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | BigDecimal income = profit.multiply(profitProp).divide(BigDecimal.valueOf(agentMemberList.size()), 2, RoundingMode.HALF_UP); | 
|---|
|  |  |  | if (income.compareTo(BigDecimal.ZERO) < 1) { | 
|---|
|  |  |  | continue; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | for (MallMember agentMember : agentMemberList) { | 
|---|
|  |  |  | //                int reduce = walletService.reduce(income, agentMember.getId(), "score"); | 
|---|
|  |  |  | 
|---|
|  |  |  | Page<MallMember> page = new Page<>(1, 5); | 
|---|
|  |  |  | MallMember query = new MallMember(); | 
|---|
|  |  |  | query.setQuery("2"); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Date profitDate = DateUtil.offset(new Date(), DateField.DAY_OF_YEAR, -1); | 
|---|
|  |  |  | query.setCreatedTime(profitDate); | 
|---|
|  |  |  | IPage<MallMember> rankListInPage = mallMemberMapper.selectRankListInPage(page, query); | 
|---|
|  |  |  | 
|---|
|  |  |  | //        BigDecimal tcIncome = mallOrderInfoMapper.selectTotalAmountUnCostForDate(profitDate, null, "M", 2); | 
|---|
|  |  |  | // 普通商品业绩 | 
|---|
|  |  |  | //        BigDecimal normalIncome = mallOrderInfoMapper.selectTotalAmountUnCostForDate(profitDate, null, "M", 1); | 
|---|
|  |  |  | BigDecimal totalIncome = mallAchieveRecordMapper.selectAchieveTotal("D", profitDate); | 
|---|
|  |  |  | BigDecimal totalIncome = mallAchieveRecordMapper.selectAchieveTotal("M", profitDate); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | List<DataDictionaryCustom> rankAward = dataDictionaryCustomMapper.selectDicByType("RANK_AWARD"); | 
|---|
|  |  |  | DataDictionaryCustom dic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(DataDictionaryEnum.RANK_BONUS.getType(), DataDictionaryEnum.RANK_BONUS.getCode()); | 
|---|
|  |  |  | 
|---|
|  |  |  | * 拿推荐人的收益(代理,直推,排名)的10%加权平分给下面直推 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public void thankfulProfit() { | 
|---|
|  |  |  | public void thankfulProfit(Date date) { | 
|---|
|  |  |  | log.info("######==感恩奖==start==####"); | 
|---|
|  |  |  | List<MallMember> mallMembers = mallMemberMapper.selectMemberListHasChild(); | 
|---|
|  |  |  | if (CollUtil.isEmpty(mallMembers)) { | 
|---|
|  |  |  | return; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (date == null) { | 
|---|
|  |  |  | date = DateUtil.offset(new Date(), DateField.DAY_OF_YEAR, -1); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | DataDictionaryCustom dic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(DataDictionaryEnum.THANKFUL_BONUS.getType(), DataDictionaryEnum.THANKFUL_BONUS.getCode()); | 
|---|
|  |  |  | // 感恩奖比例 | 
|---|
|  |  |  | BigDecimal prop = new BigDecimal(dic.getValue()).divide(BigDecimal.valueOf(100), 2, RoundingMode.HALF_UP); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Date date = DateUtil.offset(new Date(), DateField.DAY_OF_YEAR, -1); | 
|---|
|  |  |  | for (MallMember mallMember : mallMembers) { | 
|---|
|  |  |  | BigDecimal income = mallMoneyFlowMapper.selectThankfulCommission(date, mallMember.getId()); | 
|---|
|  |  |  | List<MallMember> children = mallMemberMapper.selectMemberDirectForHasLevel(mallMember.getInviteId()); | 
|---|