| | |
| | | import cc.mrbird.febs.dapp.entity.DataDictionaryCustom; |
| | | import cc.mrbird.febs.dapp.enumerate.DataDictionaryEnum; |
| | | import cc.mrbird.febs.dapp.enumerate.MoneyFlowEnum; |
| | | import cc.mrbird.febs.dapp.mapper.DappFundFlowDao; |
| | | import cc.mrbird.febs.dapp.mapper.DappMemberDao; |
| | | 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.dapp.vo.ApidirectNumVo; |
| | | import cc.mrbird.febs.rabbit.producer.ChainProducer; |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.hutool.core.date.DateTime; |
| | |
| | | private DappMemberDao dappMemberDao; |
| | | @Resource |
| | | private ChainProducer chainProducer; |
| | | @Resource |
| | | private DappFundFlowDao dappFundFlowDao; |
| | | |
| | | /** |
| | | * 每天释放1%的静态释放 |
| | |
| | | * (其中50%给予当天大单排名激励前4名,40%、30%、20、10%; |
| | | * 另外50% 给予当天直推总业绩排名激励前10名,第1名40%,2-4名30%,5-10名30%) |
| | | */ |
| | | @Scheduled(cron = "0 0 0 * * ?") |
| | | @Scheduled(cron = "0 0/1 0 * * ?") |
| | | public void profitDailyJobOne() { |
| | | |
| | | Date date = new Date(); |
| | | DappStorage dappStorageLast = dappStorageMapper.selectOneByCreateTimeDesc(0, 1); |
| | | DateTime dateTime1 = DateUtil.offsetHour(dappStorageLast.getCreateTime(), 24); |
| | | int compare = DateUtil.compare(dateTime1, date); |
| | | if(compare > 0){ |
| | | return; |
| | | } |
| | | |
| | | DataDictionaryCustom symbolDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode( |
| | | DataDictionaryEnum.BUCHANG_SYMBOL.getType(), |
| | | DataDictionaryEnum.BUCHANG_SYMBOL.getCode() |
| | | ); |
| | | if(2 == Integer.parseInt(symbolDic.getValue())){ |
| | | return; |
| | | } |
| | | symbolDic.setValue("2"); |
| | | dataDictionaryCustomMapper.updateById(symbolDic); |
| | | |
| | | DataDictionaryCustom buChangChiDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode( |
| | | DataDictionaryEnum.BUCAHNG_CHI.getType(), |
| | | DataDictionaryEnum.BUCAHNG_CHI.getCode() |
| | |
| | | HashMap<Long, BigDecimal> map = new HashMap<>(); |
| | | |
| | | DateTime startTime = DateUtil.offsetHour(new Date(), -24); |
| | | List<DappMemberEntity> dappMemberEntityList = dappMemberDao.selectListByDateFiveToFiver(startTime); |
| | | // DateTime startTime = DateUtil.parseDateTime(startTimeStr); |
| | | // List<DappMemberEntity> dappMemberEntityList = dappMemberDao.selectListByDateFiveToFiver(startTime); |
| | | |
| | | if(CollUtil.isNotEmpty(dappMemberEntityList)){ |
| | | for(DappMemberEntity member : dappMemberEntityList){ |
| | | List<DappStorage> dappStorages = dappStorageMapper.selectListByDateFiveToFiver(startTime); |
| | | Set<Long> collect = dappStorages.stream().map(DappStorage::getMemberId).collect(Collectors.toSet()); |
| | | |
| | | // List<DappMemberEntity> dappMemberEntityList = dappMemberDao.selectListByDate(new Date()); |
| | | if(CollUtil.isNotEmpty(collect)){ |
| | | for(Long memberId : collect){ |
| | | DappMemberEntity member = dappMemberDao.selectById(memberId); |
| | | if(StrUtil.isEmpty(member.getRefererId())){ |
| | | continue; |
| | | } |
| | |
| | | .limit(10) |
| | | .collect(Collectors.toList()); |
| | | |
| | | int startNum = 1; |
| | | List<ApidirectNumVo> apiDirectInfoVos = new ArrayList<>(); |
| | | for (Map.Entry<Long, BigDecimal> entry : topTenEntries) { |
| | | |
| | | Long memberId = entry.getKey(); |
| | | BigDecimal directAchieve = entry.getValue(); |
| | | BigDecimal directCnt = entry.getValue(); |
| | | ApidirectNumVo apiDirectInfoVo = new ApidirectNumVo(); |
| | | apiDirectInfoVo.setMemberId(memberId); |
| | | apiDirectInfoVo.setDirectCnt(directCnt); |
| | | DappStorage dappStorage = dappStorageMapper.selectNewRecordByRefMemberId(memberId); |
| | | apiDirectInfoVo.setCreateTime(dappStorage.getCreateTime()); |
| | | apiDirectInfoVos.add(apiDirectInfoVo); |
| | | } |
| | | |
| | | if(CollUtil.isNotEmpty(apiDirectInfoVos)){ |
| | | apiDirectInfoVos = apiDirectInfoVos.stream() |
| | | .sorted((a, b) -> { |
| | | // 先按照amount从大到小排序 |
| | | int compare = b.getDirectCnt().compareTo(a.getDirectCnt()); |
| | | if (compare != 0) { |
| | | return compare; |
| | | } |
| | | // 如果amount相同,则按照createTime从小到大排序 |
| | | return a.getCreateTime().compareTo(b.getCreateTime()); |
| | | }) |
| | | .collect(Collectors.toList()); |
| | | } |
| | | |
| | | int startNum = 1; |
| | | for (ApidirectNumVo numVo : apiDirectInfoVos) { |
| | | Long memberId = numVo.getMemberId(); |
| | | BigDecimal directAchieve = numVo.getDirectCnt(); |
| | | //第一名 |
| | | if(startNum == 1){ |
| | | BigDecimal bigDecimal = directTotal.multiply(new BigDecimal("0.4")).setScale(2, BigDecimal.ROUND_DOWN); |
| | |
| | | |
| | | public static void main(String[] args) { |
| | | |
| | | Date date = new Date(); |
| | | System.out.println(date); |
| | | DateTime dateTime1 = DateUtil.offsetHour(date, 24); |
| | | System.out.println(dateTime1); |
| | | |
| | | int compare = DateUtil.compare(date, dateTime1); |
| | | System.out.println(compare); |
| | | |
| | | |
| | | |
| | | DateTime dateTime = DateUtil.offsetHour(new Date(), -24); |
| | | System.out.println(dateTime); |
| | | DateTime nowTime = DateUtil.parseTime(DateUtil.formatTime(new Date())); |