| | |
| | | import cc.mrbird.febs.dapp.mapper.DappStorageMapper; |
| | | import cc.mrbird.febs.dapp.mapper.DataDictionaryCustomMapper; |
| | | import cc.mrbird.febs.dapp.service.DappSystemService; |
| | | import cc.mrbird.febs.rabbit.producer.ChainProducer; |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.hutool.core.date.DateTime; |
| | | import cn.hutool.core.date.DateUtil; |
| | |
| | | private DappStorageMapper dappStorageMapper; |
| | | @Resource |
| | | private DappMemberDao dappMemberDao; |
| | | @Resource |
| | | private ChainProducer chainProducer; |
| | | |
| | | /** |
| | | * 每天释放1%的静态释放 |
| | |
| | | for(DappStorage storage : dappStorages){ |
| | | Long memberId = storage.getMemberId(); |
| | | BigDecimal releaseAmount = storage.getReleaseAmount(); |
| | | |
| | | /** |
| | | * DAO成员动态: |
| | | * * 1.直推1个拿2代,直推10个拿20代,直推15个拿30代,最高30代 |
| | | */ |
| | | chainProducer.sendMemberDynamicPerkMsg(storage.getId()); |
| | | |
| | | dappSystemService.updateBalanceInsertFlow( |
| | | releaseAmount, |
| | | memberId, |
| | |
| | | BigDecimal everyAmount = daDanTotal.divide(new BigDecimal(count)); |
| | | |
| | | if(everyAmount.compareTo(BigDecimal.ZERO) > 0){ |
| | | DappStorage dappStorageOne = dappStorageMapper.selectAmountByDesc(new Date(),0,1); |
| | | if(ObjectUtil.isNotEmpty(dappStorageOne)){ |
| | | List<DappStorage> dappStorageOne = dappStorageMapper.selectSumByAmountDesc(new Date(),0,1); |
| | | if(CollUtil.isNotEmpty(dappStorageOne)){ |
| | | BigDecimal multiply = everyAmount.multiply(new BigDecimal(oneCount)); |
| | | dappSystemService.updateBalanceInsertFlow( |
| | | multiply, |
| | | dappStorageOne.getMemberId(), |
| | | dappStorageOne.get(0).getMemberId(), |
| | | MoneyFlowEnum.DA_DAN_JI_LI_PERK.getValue(), |
| | | StrUtil.format(MoneyFlowEnum.DA_DAN_JI_LI_PERK.getDescrition(),daDanTotal,multiply)); |
| | | |
| | | realAmount = realAmount.add(multiply); |
| | | } |
| | | DappStorage dappStorageTwo = dappStorageMapper.selectAmountByDesc(new Date(),1,1); |
| | | if(ObjectUtil.isNotEmpty(dappStorageTwo)){ |
| | | List<DappStorage> dappStorageTwo = dappStorageMapper.selectSumByAmountDesc(new Date(),1,1); |
| | | if(CollUtil.isNotEmpty(dappStorageTwo)){ |
| | | BigDecimal multiply = everyAmount.multiply(new BigDecimal(twoCount)); |
| | | dappSystemService.updateBalanceInsertFlow( |
| | | multiply, |
| | | dappStorageTwo.getMemberId(), |
| | | dappStorageTwo.get(0).getMemberId(), |
| | | MoneyFlowEnum.DA_DAN_JI_LI_PERK.getValue(), |
| | | StrUtil.format(MoneyFlowEnum.DA_DAN_JI_LI_PERK.getDescrition(),daDanTotal,multiply)); |
| | | |
| | | realAmount = realAmount.add(multiply); |
| | | } |
| | | DappStorage dappStorageThree = dappStorageMapper.selectAmountByDesc(new Date(),2,1); |
| | | if(ObjectUtil.isNotEmpty(dappStorageThree)){ |
| | | List<DappStorage> dappStorageThree = dappStorageMapper.selectSumByAmountDesc(new Date(),2,1); |
| | | if(CollUtil.isNotEmpty(dappStorageThree)){ |
| | | BigDecimal multiply = everyAmount.multiply(new BigDecimal(threeCount)); |
| | | dappSystemService.updateBalanceInsertFlow( |
| | | multiply, |
| | | dappStorageThree.getMemberId(), |
| | | dappStorageThree.get(0).getMemberId(), |
| | | MoneyFlowEnum.DA_DAN_JI_LI_PERK.getValue(), |
| | | StrUtil.format(MoneyFlowEnum.DA_DAN_JI_LI_PERK.getDescrition(),daDanTotal,multiply)); |
| | | |
| | | realAmount = realAmount.add(multiply); |
| | | } |
| | | DappStorage dappStorageFour = dappStorageMapper.selectAmountByDesc(new Date(),3,1); |
| | | if(ObjectUtil.isNotEmpty(dappStorageFour)){ |
| | | List<DappStorage> dappStorageFour = dappStorageMapper.selectSumByAmountDesc(new Date(),3,1); |
| | | if(CollUtil.isNotEmpty(dappStorageFour)){ |
| | | BigDecimal multiply = everyAmount.multiply(new BigDecimal(fourCount)); |
| | | dappSystemService.updateBalanceInsertFlow( |
| | | multiply, |
| | | dappStorageFour.getMemberId(), |
| | | dappStorageFour.get(0).getMemberId(), |
| | | MoneyFlowEnum.DA_DAN_JI_LI_PERK.getValue(), |
| | | StrUtil.format(MoneyFlowEnum.DA_DAN_JI_LI_PERK.getDescrition(),daDanTotal,multiply)); |
| | | |