| | |
| | | import cc.mrbird.febs.common.entity.QueryRequest; |
| | | import cc.mrbird.febs.common.exception.FebsException; |
| | | import cc.mrbird.febs.common.utils.*; |
| | | import cc.mrbird.febs.dapp.chain.ChainEnum; |
| | | import cc.mrbird.febs.dapp.chain.ChainService; |
| | | import cc.mrbird.febs.dapp.chain.ContractChainService; |
| | | import cc.mrbird.febs.dapp.contract.andao.AndaoContractMain; |
| | | import cc.mrbird.febs.dapp.dto.*; |
| | | import cc.mrbird.febs.dapp.entity.*; |
| | | import cc.mrbird.febs.dapp.enumerate.*; |
| | | import cc.mrbird.febs.dapp.enumerate.AccountFlowEnum; |
| | | import cc.mrbird.febs.dapp.enumerate.DataDictionaryEnum; |
| | | import cc.mrbird.febs.dapp.enumerate.FundFlowEnum; |
| | | import cc.mrbird.febs.dapp.enumerate.MemberLevelEnum; |
| | | import cc.mrbird.febs.dapp.mapper.*; |
| | | import cc.mrbird.febs.dapp.service.DappMemberService; |
| | | import cc.mrbird.febs.dapp.soccer.entity.SoccerLeagues; |
| | | import cc.mrbird.febs.dapp.vo.*; |
| | | import cc.mrbird.febs.rabbit.producer.ChainProducer; |
| | | import cc.mrbird.febs.system.entity.User; |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.hutool.core.date.DateTime; |
| | | import cn.hutool.core.date.DateUtil; |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import cn.hutool.core.util.StrUtil; |
| | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.jsoup.helper.DataUtil; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.web3j.utils.Strings; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.math.BigInteger; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | |
| | | private final MallGoodsCategoryMapper mallGoodsCategoryMapper; |
| | | private final PlatformBannerMapper platformBannerMapper; |
| | | private final MallGoodsImagesMapper goodsImagesMapper; |
| | | private final MemberCoinWithdrawDao memberCoinWithdrawDao; |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | |
| | | member = insertMember(connectDto.getAddress(), referenceID,nodeType); |
| | | } |
| | | |
| | | DappMemberEntity dappMemberEntity = dappMemberDao.selectById(member.getId()); |
| | | if(2 == dappMemberEntity.getChangeAble()){ |
| | | throw new FebsException("账号已冻结"); |
| | | } |
| | | |
| | | String key = LoginUserUtil.getLoginKey(connectDto.getAddress(), connectDto.getNonce(), connectDto.getSign()); |
| | | redisUtils.hset(AppContants.REDIS_KEY_MEMBER_INFO, connectDto.getAddress(), member); |
| | | |
| | |
| | | for(DappMemberEntity memberEntity : records){ |
| | | Long memberId = memberEntity.getId(); |
| | | |
| | | List<MallAchieveRecord> mallAchieveRecords = mallAchieveRecordMapper.selectListByMemberId(memberId); |
| | | // List<MallAchieveRecord> mallAchieveRecords = mallAchieveRecordMapper.selectListByMemberId(memberId); |
| | | List<MallAchieveRecord> mallAchieveRecords = mallAchieveRecordMapper.selectListByMemberIdAndScore(memberId); |
| | | BigDecimal myShareAchieve = BigDecimal.ZERO; |
| | | if(CollUtil.isNotEmpty(mallAchieveRecords)){ |
| | | Date payTime = mallAchieveRecords.get(0).getPayTime(); |
| | |
| | | memberEntity.setMyShareAchieve(myShareAchieve); |
| | | |
| | | |
| | | BigDecimal totalIncomeMember = dappMemberDao.selectAllAchieveByInviteId(memberEntity.getInviteId()); |
| | | BigDecimal totalIncomeMember = dappMemberDao.selectAllAchieveByRefId(memberEntity.getInviteId()); |
| | | memberEntity.setMyTeamAchieve(totalIncomeMember); |
| | | |
| | | BigDecimal withdrawAmount = memberCoinWithdrawDao.selectByMemberIdAndStatus(memberId, MemberCoinWithdrawEntity.STATUS_YES); |
| | | memberEntity.setWithdrawAmount(withdrawAmount); |
| | | } |
| | | } |
| | | return dappMemberEntityIPage; |
| | |
| | | dappMemberInfoVo.setPayCnt(payCnt); |
| | | dappMemberInfoVo.setCancelCnt(cancelCnt); |
| | | |
| | | List<MallAchieveRecord> mallAchieveRecords = mallAchieveRecordMapper.selectListByMemberId(member.getId()); |
| | | // List<MallAchieveRecord> mallAchieveRecords = mallAchieveRecordMapper.selectListByMemberId(member.getId()); |
| | | List<MallAchieveRecord> mallAchieveRecords = mallAchieveRecordMapper.selectListByMemberIdAndScore(member.getId()); |
| | | BigDecimal myShareAchieve = BigDecimal.ZERO; |
| | | if(CollUtil.isNotEmpty(mallAchieveRecords)){ |
| | | Date payTime = mallAchieveRecords.get(0).getPayTime(); |
| | |
| | | |
| | | @Override |
| | | public List<AdminAgentLevelOptionTreeVo> getAgentLevelOption() { |
| | | return dataDictionaryCustomMapper.getAgentLevelOption(); |
| | | List<AdminAgentLevelOptionTreeVo> agentLevelOption = dataDictionaryCustomMapper.getAgentLevelOption(); |
| | | AdminAgentLevelOptionTreeVo adminAgentLevelOptionTreeVo = new AdminAgentLevelOptionTreeVo(); |
| | | adminAgentLevelOptionTreeVo.setId("MEMBER"); |
| | | adminAgentLevelOptionTreeVo.setName("MEMBER"); |
| | | agentLevelOption.add(adminAgentLevelOptionTreeVo); |
| | | return agentLevelOption; |
| | | } |
| | | |
| | | @Override |
| | |
| | | @Transactional |
| | | public Long createOrder(AddOrderDto addOrderDto) { |
| | | DappMemberEntity member = LoginUserUtil.getAppUser(); |
| | | |
| | | DappMemberEntity dappMemberEntity = dappMemberDao.selectById(member.getId()); |
| | | if(2 == dappMemberEntity.getChangeAble()){ |
| | | throw new FebsException("账号已冻结"); |
| | | } |
| | | // DappMemberEntity member = dappMemberDao.selectById(1L); |
| | | /** |
| | | * 1、商品是否上架 |
| | | * 2、用户余额是否足够 |
| | | */ |
| | | |
| | | MallGoods mallGoods = mallGoodsMapper.selectById(addOrderDto.getGoodsId()); |
| | | if(ObjectUtil.isEmpty(mallGoods)){ |
| | | throw new FebsException("商品不存在"); |
| | |
| | | /** |
| | | * todo 发送一条订单出的消息 |
| | | */ |
| | | chainProducer.sendSpeedPayOrderMsg(id); |
| | | chainProducer.sendAutoLevelUpTeamMsg(member.getId()); |
| | | // chainProducer.sendSpeedPayOrderMsg(id); |
| | | // chainProducer.sendAutoLevelUpTeamMsg(member.getId()); |
| | | } |
| | | |
| | | @Override |
| | |
| | | public FebsResponse salePackage(SalePackageDto salePackageDto) { |
| | | Long memberId = LoginUserUtil.getAppUser().getId(); |
| | | BigDecimal cnt = salePackageDto.getCnt(); |
| | | |
| | | if(ObjectUtil.isEmpty(salePackageDto.getCnt())){ |
| | | throw new FebsException("请输入正确的数量"); |
| | | } |
| | | DappMemberEntity dappMemberEntity = dappMemberDao.selectById(memberId); |
| | | |
| | | if(2 == dappMemberEntity.getChangeAble()){ |
| | | throw new FebsException("账号已冻结"); |
| | | } |
| | | BigDecimal saleDoing = dappFundFlowDao.selectSumAmountByMemberIdAndTypeAndStatus(memberId, FundFlowEnum.SALE_PACKAGE.getCode(), DappFundFlowEntity.WITHDRAW_STATUS_ING); |
| | | if(BigDecimal.ZERO.compareTo(saleDoing) < 0){ |
| | | throw new FebsException("正在进行中,请稍后再试"); |
| | |
| | | dappMemberEntity.setBalance(subtract); |
| | | dappMemberDao.updateById(dappMemberEntity); |
| | | |
| | | chainProducer.sendSalePackageMsg(scoreFlow.getId()); |
| | | // chainProducer.sendSalePackageMsg(scoreFlow.getId()); |
| | | return new FebsResponse().success(); |
| | | } |
| | | |
| | |
| | | |
| | | @Override |
| | | public List<AKLineLimitVo> packageKline() { |
| | | return dappAKlineMapper.selectListByTypeAndLimit(2, 30); |
| | | // return dappAKlineMapper.selectListByTypeAndLimit(2, 30); |
| | | List<AKLineLimitVo> akLineLimitVos = dappAKlineMapper.selectListByTypeAndLimitDesc(1, 60); |
| | | List<AKLineLimitVo> sortedList = akLineLimitVos.stream() |
| | | .sorted((k1, k2) -> k1.getCreateTime().compareTo(k2.getCreateTime())) |
| | | .collect(Collectors.toList()); |
| | | return sortedList; |
| | | } |
| | | |
| | | @Override |
| | | public FebsResponse changeAbleYes(Long id) { |
| | | DappMemberEntity dappMemberEntity = dappMemberDao.selectById(id); |
| | | if(ObjectUtil.isEmpty(dappMemberEntity)) { |
| | | return new FebsResponse().fail().message("会员信息不存在"); |
| | | } |
| | | dappMemberEntity.setChangeAble(2); |
| | | dappMemberDao.updateById(dappMemberEntity); |
| | | return new FebsResponse().success(); |
| | | } |
| | | @Override |
| | | public FebsResponse changeAbleNo(Long id) { |
| | | DappMemberEntity dappMemberEntity = dappMemberDao.selectById(id); |
| | | if(ObjectUtil.isEmpty(dappMemberEntity)) { |
| | | return new FebsResponse().fail().message("会员信息不存在"); |
| | | } |
| | | dappMemberEntity.setChangeAble(1); |
| | | dappMemberDao.updateById(dappMemberEntity); |
| | | |
| | | redisUtils.hdel(AppContants.REDIS_KEY_SIGN, dappMemberEntity.getAddress()); |
| | | redisUtils.hdel(AppContants.REDIS_KEY_MEMBER_INFO, dappMemberEntity.getAddress()); |
| | | return new FebsResponse().success(); |
| | | } |
| | | |
| | | @Override |
| | | public IPage<SoccerLeagues> selectSoccerLeaguesInPage(SoccerLeagues soccerLeagues, QueryRequest request) { |
| | | Page<SoccerLeagues> page = new Page<>(request.getPageNum(), request.getPageSize()); |
| | | IPage<SoccerLeagues> soccerLeaguesIPage = dappMemberDao.selectSoccerLeaguesInPage(soccerLeagues, page); |
| | | return soccerLeaguesIPage; |
| | | } |
| | | |
| | | public static List<List<String>> partitionList(List<String> originalList, int partitionSize) { |