| | |
| | | import cc.mrbird.febs.dapp.enumerate.DataDictionaryEnum; |
| | | import cc.mrbird.febs.dapp.mapper.*; |
| | | import cc.mrbird.febs.dapp.service.DappMemberService; |
| | | import cc.mrbird.febs.dapp.service.DappWalletService; |
| | | import cc.mrbird.febs.dapp.utils.CaptchaUtil; |
| | | import cc.mrbird.febs.dapp.utils.UUIDUtil; |
| | | import cc.mrbird.febs.dapp.vo.*; |
| | |
| | | import cn.hutool.crypto.asymmetric.RSA; |
| | | import cn.hutool.json.JSONUtil; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | |
| | | private final DappMemberAddressDao dappMemberAddressDao; |
| | | private final IgtOnHookPlanOrderDao igtOnHookPlanOrderDao; |
| | | private final AppVersionMapper appVersionMapper; |
| | | private final DappMessageDao dappMessageDao; |
| | | private final MemberCoinChargeDao memberCoinChargeDao; |
| | | private final MemberCoinWithdrawDao memberCoinWithdrawDao; |
| | | |
| | | private final RedisTemplate<String, Object> redisTemplate; |
| | | |
| | |
| | | } |
| | | member = new DappMemberEntity(); |
| | | member.setUsername(registerDto.getAccount()); |
| | | member.setPassword(SecureUtil.md5(registerDto.getPassword())); |
| | | |
| | | //RSA解密 |
| | | String password = registerDto.getPassword(); |
| | | RSA rsa = new RSA(AppContants.PRIVATE_KEY, null); |
| | | password = rsa.decryptStr(password, KeyType.PrivateKey); |
| | | member.setPassword(SecureUtil.md5(password)); |
| | | member.setIdentity(DataDictionaryEnum.LEVEL_MB.getCode()); |
| | | member.setRefererId(registerDto.getRefererId()); |
| | | member.setIsOnHook(2); |
| | |
| | | } else { |
| | | return new FebsResponse().fail().message(MessageSourceUtils.getString("verification_code_err_003")); |
| | | } |
| | | |
| | | String md5Pwd = SecureUtil.md5(loginDto.getPassword()); |
| | | //RSA解密 |
| | | String password = loginDto.getPassword(); |
| | | RSA rsa = new RSA(AppContants.PRIVATE_KEY, null); |
| | | password = rsa.decryptStr(password, KeyType.PrivateKey); |
| | | String md5Pwd = SecureUtil.md5(password); |
| | | DappMemberEntity dappMemberEntity = dappMemberDao.selectMemberInfoByUsernameAndPassword(loginDto.getAccount(), md5Pwd); |
| | | if (ObjectUtil.isEmpty(dappMemberEntity)) { |
| | | return new FebsResponse().fail().message(MessageSourceUtils.getString("login_err_001")); |
| | |
| | | } |
| | | |
| | | String token = IdUtil.simpleUUID(); |
| | | redisUtils.set(token, JSONObject.toJSONString(dappMemberEntity), 3600); |
| | | redisUtils.set(redisKey, token, 3600); |
| | | redisUtils.set(token, JSONObject.toJSONString(dappMemberEntity)); |
| | | redisUtils.set(redisKey, token); |
| | | Map<String, Object> authInfo = new HashMap<>(); |
| | | authInfo.put("token", token); |
| | | authInfo.put("rasToken", generateAsaToken(token)); |
| | |
| | | dappWalletCoinEntity.setAvailableAmount(AppContants.TOURIST_INIT_MONEY); |
| | | dappWalletCoinEntity.setFrozenAmount(AppContants.INIT_MONEY); |
| | | dappWalletCoinEntity.setTotalAmount(AppContants.TOURIST_INIT_MONEY); |
| | | dappWalletCoinEntity.setWalletCode("USDT"); |
| | | dappWalletCoinDao.insert(dappWalletCoinEntity); |
| | | } |
| | | |
| | |
| | | } |
| | | DappMemberEntity memberadd = new DappMemberEntity(); |
| | | memberadd.setUsername(apiAddTeammateDto.getAccount()); |
| | | memberadd.setPassword(SecureUtil.md5(apiAddTeammateDto.getPassword())); |
| | | |
| | | //RSA解密 |
| | | String password = apiAddTeammateDto.getPassword(); |
| | | RSA rsa = new RSA(AppContants.PRIVATE_KEY, null); |
| | | password = rsa.decryptStr(password, KeyType.PrivateKey); |
| | | memberadd.setPassword(SecureUtil.md5(password)); |
| | | memberadd.setIdentity(DataDictionaryEnum.LEVEL_MB.getCode()); |
| | | memberadd.setRefererId(member.getInviteId()); |
| | | dappMemberDao.insert(memberadd); |
| | |
| | | dappWalletCoinEntity.setAvailableAmount(AppContants.INIT_MONEY); |
| | | dappWalletCoinEntity.setFrozenAmount(AppContants.INIT_MONEY); |
| | | dappWalletCoinEntity.setTotalAmount(AppContants.INIT_MONEY); |
| | | dappWalletCoinEntity.setWalletCode("USDT"); |
| | | dappWalletCoinDao.insert(dappWalletCoinEntity); |
| | | |
| | | return new FebsResponse().success().message(MessageSourceUtils.getString("register_err_006")); |
| | |
| | | if(DataDictionaryEnum.LEVEL_TM.getCode().equals(identity)){ |
| | | apiMyTeammateInfoListVo.setLevelName("游客"); |
| | | }else{ |
| | | apiMyTeammateInfoListVo.setLevelName("会员"); |
| | | apiMyTeammateInfoListVo.setLevelName("Member"); |
| | | } |
| | | } |
| | | } |
| | |
| | | return new FebsResponse().fail().message(MessageSourceUtils.getString("member_err_006")); |
| | | } |
| | | //验证资金密码 |
| | | Boolean aBoolean = validateTransferCodeInside(addBankDto.getTransferCode(), member.getId()); |
| | | //RSA解密 |
| | | RSA rsa = new RSA(AppContants.PRIVATE_KEY, null); |
| | | String transferCode = addBankDto.getTransferCode(); |
| | | transferCode = rsa.decryptStr(transferCode, KeyType.PrivateKey); |
| | | Boolean aBoolean = validateTransferCodeInside(transferCode, member.getId()); |
| | | if(!aBoolean){ |
| | | return new FebsResponse().fail().message(MessageSourceUtils.getString("member_err_006")); |
| | | } |
| | |
| | | return new FebsResponse().fail().message(MessageSourceUtils.getString("member_err_006")); |
| | | } |
| | | //验证资金密码 |
| | | Boolean aBoolean = validateTransferCodeInside(apiAddAddressDto.getTransferCode(), member.getId()); |
| | | //RSA解密 |
| | | RSA rsa = new RSA(AppContants.PRIVATE_KEY, null); |
| | | String transferCode = apiAddAddressDto.getTransferCode(); |
| | | transferCode = rsa.decryptStr(transferCode, KeyType.PrivateKey); |
| | | Boolean aBoolean = validateTransferCodeInside(transferCode, member.getId()); |
| | | if(!aBoolean){ |
| | | return new FebsResponse().fail().message(MessageSourceUtils.getString("member_err_006")); |
| | | } |
| | |
| | | if(ObjectUtil.isEmpty(dappWalletCoinEntity)){ |
| | | return new FebsResponse().fail().message("会员账户不存在"); |
| | | } |
| | | BigDecimal availableAmount = dappWalletCoinEntity.getAvailableAmount(); |
| | | dappWalletCoinDao.addTotalAndaddAvailableById(dappWalletCoinEntity.getId(),coinNumber); |
| | | |
| | | DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity(memberEntity.getId(), coinNumber, "系统拨付", 9); |
| | | DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity(memberEntity.getId(), |
| | | availableAmount,coinNumber,availableAmount.add(coinNumber) ,"充值(手动)", 10); |
| | | dappAccountMoneyChangeDao.insert(dappAccountMoneyChangeEntity); |
| | | return new FebsResponse().success().message("操作成功"); |
| | | } |
| | | |
| | | @Override |
| | | public List<AdminMemberIdentityVo> identitySetList() { |
| | | ArrayList<AdminMemberIdentityVo> objects = new ArrayList<>(); |
| | | List<DataDictionaryCustom> dataDictionaryCustoms = dataDictionaryCustomMapper.selectDicByType(DataDictionaryEnum.LEVEL_AIB.getType()); |
| | | if(CollUtil.isNotEmpty(dataDictionaryCustoms)){ |
| | | for(DataDictionaryCustom dic :dataDictionaryCustoms){ |
| | | if(!DataDictionaryEnum.LEVEL_TM.getCode().equals(dic.getCode())){ |
| | | AdminMemberIdentityVo adminMemberIdentityVo = new AdminMemberIdentityVo(); |
| | | adminMemberIdentityVo.setIdentityCode(dic.getCode()); |
| | | adminMemberIdentityVo.setIdentityValue(dic.getDescription()); |
| | | objects.add(adminMemberIdentityVo); |
| | | } |
| | | } |
| | | } |
| | | return objects; |
| | | } |
| | | |
| | | @Override |
| | | public FebsResponse identitySet(DappMemberEntity memberEntity) { |
| | | DappMemberEntity dappMemberEntity = dappMemberDao.selectById(memberEntity.getId()); |
| | | if(ObjectUtil.isEmpty(dappMemberEntity)){ |
| | | return new FebsResponse().fail().message("会员信息不存在"); |
| | | } |
| | | dappMemberEntity.setIdentity(memberEntity.getIdentity()); |
| | | dappMemberDao.updateById(dappMemberEntity); |
| | | return new FebsResponse().success(); |
| | | } |
| | | |
| | | @Override |
| | | public FebsResponse amountFlowBack(Long id) { |
| | | DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = dappAccountMoneyChangeDao.selectById(id); |
| | | if(7 == dappAccountMoneyChangeEntity.getType() || 8 == dappAccountMoneyChangeEntity.getType() ){ |
| | | Long memberId = dappAccountMoneyChangeEntity.getMemberId(); |
| | | DappWalletCoinEntity dappWalletCoinEntity = dappWalletCoinDao.selectByMemberId(memberId); |
| | | dappWalletCoinDao.delAvailableDelTotalById(dappWalletCoinEntity.getId(),dappAccountMoneyChangeEntity.getAmount()); |
| | | |
| | | DappAccountMoneyChangeEntity addFlow = new DappAccountMoneyChangeEntity(65L, |
| | | dappAccountMoneyChangeEntity.getAmount(), "系统", 9,dappAccountMoneyChangeEntity.getOrderId()); |
| | | dappAccountMoneyChangeDao.insert(addFlow); |
| | | |
| | | dappAccountMoneyChangeDao.deleteById(dappAccountMoneyChangeEntity.getId()); |
| | | return new FebsResponse().success().message("操作成功"); |
| | | }else{ |
| | | return new FebsResponse().fail().message("只允许回退【盈利分成】和【流水佣金】"); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public FebsResponse addMessage(AddMessageDto addMessageDto) { |
| | | DappMemberEntity member = LoginUserUtil.getAppUser(); |
| | | if(ObjectUtil.isEmpty(member)){ |
| | | return new FebsResponse().success(); |
| | | } |
| | | DappMessageEntity dappMessageEntity = new DappMessageEntity(); |
| | | dappMessageEntity.setMemberId(member.getId()); |
| | | dappMessageEntity.setMessage(addMessageDto.getMessage()); |
| | | dappMessageDao.insert(dappMessageEntity); |
| | | return new FebsResponse().success(); |
| | | } |
| | | |
| | | @Override |
| | | public IPage<DappMessageEntity> getMessageListInPage(DappMessageEntity dappMessageEntity, QueryRequest request) { |
| | | Page<DappMemberEntity> page = new Page<>(request.getPageNum(), request.getPageSize()); |
| | | User currentUser = FebsUtil.getCurrentUser(); |
| | | if(StrUtil.isNotEmpty(currentUser.getDescription())){ |
| | | dappMessageEntity.setDescription(currentUser.getDescription()); |
| | | } |
| | | return dappMemberDao.selectMessageListInPage(dappMessageEntity, page); |
| | | } |
| | | |
| | | @Override |
| | | public IPage<MemberCoinChargeEntity> getFlowListByDay(MemberCoinChargeEntity memberCoinChargeEntity, QueryRequest request) { |
| | | Page<MemberCoinChargeEntity> page = new Page<>(request.getPageNum(), request.getPageSize()); |
| | | IPage<MemberCoinChargeEntity> memberCoinChargeEntityIPage = this.baseMapper.getChargeListByDayInPage(page, memberCoinChargeEntity); |
| | | return memberCoinChargeEntityIPage; |
| | | } |
| | | |
| | | @Override |
| | | public IPage<AdminMemberCoinWithdrawVo> getOutFlowListByDay(MemberCoinWithdrawEntity memberCoinWithdrawEntity, QueryRequest request) { |
| | | Page<AdminMemberCoinWithdrawVo> page = new Page<>(request.getPageNum(), request.getPageSize()); |
| | | IPage<AdminMemberCoinWithdrawVo> adminMemberCoinWithdrawVos = this.baseMapper.getWithDrawListByDayInPage(page, memberCoinWithdrawEntity); |
| | | return adminMemberCoinWithdrawVos; |
| | | } |
| | | |
| | | @Override |
| | | public IPage<AdminTeamInfoVo> getTeamInfo(DappMemberEntity dappMemberEntity, QueryRequest request) { |
| | | Page<AdminTeamInfoVo> page = new Page<>(request.getPageNum(), request.getPageSize()); |
| | | dappMemberEntity = this.baseMapper.selectById(dappMemberEntity.getId()); |
| | | IPage<AdminTeamInfoVo> adminTeamInfoVoIPage = this.baseMapper.findTeamInfoListInPage(page, dappMemberEntity); |
| | | List<AdminTeamInfoVo> records = adminTeamInfoVoIPage.getRecords(); |
| | | if(CollUtil.isNotEmpty(records)){ |
| | | for(AdminTeamInfoVo adminTeamInfoVo : records){ |
| | | Long memberId = adminTeamInfoVo.getId(); |
| | | //获取团队成员的主要信息 |
| | | DappWalletCoinEntity dappWalletCoinEntity = dappWalletCoinDao.selectByMemberId(memberId); |
| | | adminTeamInfoVo.setTotalAmount(dappWalletCoinEntity.getTotalAmount()); |
| | | adminTeamInfoVo.setAvaAmount(dappWalletCoinEntity.getAvailableAmount()); |
| | | adminTeamInfoVo.setFrozenAmount(dappWalletCoinEntity.getFrozenAmount()); |
| | | |
| | | BigDecimal chargeAmount = memberCoinChargeDao.selectTotalAmountByMemberId(memberId); |
| | | adminTeamInfoVo.setChargeAmount(chargeAmount); |
| | | |
| | | BigDecimal withDrawAmount = memberCoinWithdrawDao.selectTotalAmountByMemberIdAndType(memberId,"N"); |
| | | adminTeamInfoVo.setWithDrawAmount(withDrawAmount); |
| | | BigDecimal insideAmount = memberCoinWithdrawDao.selectTotalAmountByMemberIdAndType(memberId,"Y"); |
| | | adminTeamInfoVo.setInsideAmount(insideAmount); |
| | | |
| | | QueryWrapper<IgtOnHookPlanOrder> objectQueryWrapper = new QueryWrapper<>(); |
| | | objectQueryWrapper.eq("member_id",memberId); |
| | | Integer onHookTimes = igtOnHookPlanOrderDao.selectCount(objectQueryWrapper); |
| | | adminTeamInfoVo.setOnHookTimes(onHookTimes); |
| | | BigDecimal totalProfit = igtOnHookPlanOrderDao.selectSumProfitByMemberId(memberId); |
| | | adminTeamInfoVo.setTotalProfit(totalProfit); |
| | | } |
| | | } |
| | | return adminTeamInfoVoIPage; |
| | | } |
| | | |
| | | @Override |
| | | public FebsResponse sendBackMessage(DappMessageEntity dappMessageEntity) { |
| | | if(ObjectUtil.isEmpty(dappMessageEntity.getBackMessage())){ |
| | | return new FebsResponse().fail().message("回复不能为空。"); |
| | | } |
| | | Long id = dappMessageEntity.getId(); |
| | | DappMessageEntity dappMessage = dappMessageDao.selectById(id); |
| | | DappMessageEntity dappMessageEntityBack = new DappMessageEntity(); |
| | | dappMessageEntityBack.setMemberId(dappMessage.getMemberId()); |
| | | StringBuffer stringBuffer = new StringBuffer(); |
| | | stringBuffer.append("客服回复:"); |
| | | stringBuffer.append(dappMessageEntity.getBackMessage()); |
| | | dappMessageEntityBack.setBackMessage(stringBuffer.toString()); |
| | | dappMessageDao.insert(dappMessageEntityBack); |
| | | return new FebsResponse().success().message("操作成功"); |
| | | } |
| | | |
| | | @Override |
| | | public IPage<DappMessageEntity> showMessageList(DappMessageEntity dappMessageEntity, QueryRequest request) { |
| | | dappMessageEntity = dappMessageDao.selectById(dappMessageEntity.getId()); |
| | | Page<DappMessageEntity> page = new Page<>(request.getPageNum(), request.getPageSize()); |
| | | IPage<DappMessageEntity> dappMessageEntitys = dappMemberDao.showMessageListInPage(page, dappMessageEntity); |
| | | return dappMessageEntitys; |
| | | } |
| | | |
| | | @Override |
| | | public IPage<ApiMessageListVo> getMessageListInPage(ApiMessageListDto apiMessageListDto) { |
| | | Page<ApiMessageListVo> page = new Page<>(apiMessageListDto.getPageNum(), apiMessageListDto.getPageSize()); |
| | | |
| | | DappMemberEntity member = LoginUserUtil.getAppUser(); |
| | | DappMessageEntity dappMessageEntity = new DappMessageEntity(); |
| | | dappMessageEntity.setMemberId(member.getId()); |
| | | IPage<ApiMessageListVo> records = dappMemberDao.getMessageListInPage(page, dappMessageEntity); |
| | | return records; |
| | | } |
| | | |
| | | public String generateAsaToken(String token) { |
| | | RSA rsa = new RSA(null, AppContants.PUBLIC_KEY); |
| | | return rsa.encryptBase64(token + "_" + System.currentTimeMillis(), KeyType.PublicKey); |