From edb19b1fec14d667363b38b90dbb4585a0cc37ef Mon Sep 17 00:00:00 2001 From: xiaoyong931011 <15274802129@163.com> Date: Thu, 04 Mar 2021 11:32:42 +0800 Subject: [PATCH] 20210304 消息提醒日志 --- src/main/java/com/xcong/excoin/modules/member/service/impl/MemberServiceImpl.java | 434 ++++++++++++++++++++++++++++++++++++++++------------- 1 files changed, 327 insertions(+), 107 deletions(-) diff --git a/src/main/java/com/xcong/excoin/modules/member/service/impl/MemberServiceImpl.java b/src/main/java/com/xcong/excoin/modules/member/service/impl/MemberServiceImpl.java index 56ace36..19fdafd 100644 --- a/src/main/java/com/xcong/excoin/modules/member/service/impl/MemberServiceImpl.java +++ b/src/main/java/com/xcong/excoin/modules/member/service/impl/MemberServiceImpl.java @@ -15,20 +15,10 @@ import com.xcong.excoin.common.system.service.CommonService; import com.xcong.excoin.modules.coin.dao.MemberAccountMoneyChangeDao; import com.xcong.excoin.modules.coin.entity.MemberAccountMoneyChange; +import com.xcong.excoin.modules.contract.entity.ContractEntrustOrderEntity; import com.xcong.excoin.modules.member.dao.*; import com.xcong.excoin.modules.member.entity.*; -import com.xcong.excoin.modules.member.parameter.dto.MemberAddCoinAddressDto; -import com.xcong.excoin.modules.member.parameter.dto.MemberAuthenticationDto; -import com.xcong.excoin.modules.member.parameter.dto.MemberBindEmailDto; -import com.xcong.excoin.modules.member.parameter.dto.MemberBindPhoneDto; -import com.xcong.excoin.modules.member.parameter.dto.MemberDelCoinAddressDto; -import com.xcong.excoin.modules.member.parameter.dto.MemberDelPaymethodDto; -import com.xcong.excoin.modules.member.parameter.dto.MemberForgetPwdDto; -import com.xcong.excoin.modules.member.parameter.dto.MemberPaymethodDto; -import com.xcong.excoin.modules.member.parameter.dto.MemberSubmitCoinApplyDto; -import com.xcong.excoin.modules.member.parameter.dto.MemberUpdatePwdDto; -import com.xcong.excoin.modules.member.parameter.dto.MemberUpdateTradePwdDto; -import com.xcong.excoin.modules.member.parameter.dto.MemberUpdateTradersPwdTimeDto; +import com.xcong.excoin.modules.member.parameter.dto.*; import com.xcong.excoin.modules.member.parameter.vo.*; import com.xcong.excoin.modules.member.service.MemberService; import com.xcong.excoin.modules.platform.dao.PlatformFeeSettingDao; @@ -38,6 +28,7 @@ import com.xcong.excoin.utils.MessageSourceUtils; import com.xcong.excoin.utils.RedisUtils; import com.xcong.excoin.utils.ShareCodeUtil; +import com.xcong.excoin.utils.ThreadPoolUtils; import lombok.extern.slf4j.Slf4j; import org.springframework.security.core.context.SecurityContextHolder; @@ -96,15 +87,20 @@ @Resource MemberCoinAddressDao memberCoinAddressDao; + + @Resource + MemberCoinAddressInDao memberCoinAddressInDao; @Resource private CommonService commonservice; @Resource MemberCoinWithdrawDao memberCoinWithdrawDao; - + @Resource AppVersionDao appVersionDao; + @Resource + private MemberSettingDao memberSettingDao; @Resource private MemberWalletContractSimulateDao memberWalletContractSimulateDao; @@ -117,6 +113,11 @@ if (member != null) { return Result.fail("账号已存在"); } + +// boolean isTrue = commonservice.verifyCode(registerDto.getAccount(), registerDto.getCode()); +// if (!isTrue) { +// return Result.fail(MessageSourceUtils.getString("common_verify_code")); +// } member = new MemberEntity(); member.setPassword(SecureUtil.md5(registerDto.getPassword())); @@ -134,19 +135,29 @@ // if (StrUtil.isBlank(registerDto.getRefererId())) { // registerDto.setRefererId(AppContants.SYSTEM_REFERER); // } - MemberEntity isExist = memberDao.selectMemberInfoByInviteId(registerDto.getRefererId()); - if (isExist == null) { - return Result.fail("推荐人不存在"); + if (!AppContants.SYSTEM_REFERER.equals(registerDto.getRefererId())) { + MemberEntity isExist = memberDao.selectMemberInfoByInviteId(registerDto.getRefererId()); + if (isExist == null) { + return Result.fail("推荐人不存在"); + } } member.setRefererId(registerDto.getRefererId()); member.setAccountStatus(MemberEntity.ACCOUNT_STATUS_ENABLE); - member.setAccountType(registerDto.getType()); + member.setAccountType(MemberEntity.ACCOUNT_TYPE_NORMAL); member.setAgentLevel(MemberEntity.ACCOUNT_AGENT_LEVEL); member.setCertifyStatus(MemberEntity.CERTIFY_STATUS_UN_SUBMIT); - member.setIsForce(0); + member.setIsForce(1); member.setIsProfit(0); + member.setContractPositionType(ContractEntrustOrderEntity.POSITION_TYPE_ALL); memberDao.insert(member); + + MemberSettingEntity memberSettingEntity = new MemberSettingEntity(); + memberSettingEntity.setSpread(BigDecimal.ONE); + memberSettingEntity.setClosingSpread(BigDecimal.valueOf(5)); + memberSettingEntity.setForceParam(BigDecimal.valueOf(0.0055)); + memberSettingEntity.setMemberId(member.getId()); + memberSettingDao.insert(memberSettingEntity); String inviteId = ShareCodeUtil.toSerialCode(member.getId()); member.setInviteId(inviteId); @@ -168,6 +179,15 @@ member.setRefererIds(ids); memberDao.updateById(member); + MemberWalletContractSimulateEntity walletContractSimulate = new MemberWalletContractSimulateEntity(); + walletContractSimulate.setMemberId(member.getId()); + walletContractSimulate.setAvailableBalance(new BigDecimal(AppContants.INIT_SIMULATE_MONEY)); + walletContractSimulate.setTotalBalance(new BigDecimal(AppContants.INIT_SIMULATE_MONEY)); + walletContractSimulate.setFrozenBalance(AppContants.INIT_MONEY); + walletContractSimulate.setBorrowedFund(AppContants.INIT_MONEY); + walletContractSimulate.setWalletCode(CoinTypeEnum.USDT.name()); + memberWalletContractSimulateDao.insert(walletContractSimulate); + //初始化合约钱包 MemberWalletContractEntity walletContract = new MemberWalletContractEntity(); walletContract.setMemberId(member.getId()); @@ -178,18 +198,8 @@ walletContract.setWalletCode(CoinTypeEnum.USDT.name()); memberWalletContractDao.insert(walletContract); - MemberWalletContractSimulateEntity walletContractSimulate = new MemberWalletContractSimulateEntity(); - walletContractSimulate.setMemberId(member.getId()); - walletContractSimulate.setAvailableBalance(new BigDecimal(AppContants.INIT_SIMULATE_MONEY)); - walletContractSimulate.setTotalBalance(new BigDecimal(AppContants.INIT_SIMULATE_MONEY)); - walletContractSimulate.setFrozenBalance(AppContants.INIT_MONEY); - walletContractSimulate.setBorrowedFund(AppContants.INIT_MONEY); - walletContractSimulate.setWalletCode(CoinTypeEnum.USDT.name()); - memberWalletContractSimulateDao.insert(walletContractSimulate); - - - // 初始化币币钱包 for (CoinTypeEnum coinTypeEnum : CoinTypeEnum.values()) { + // 初始化币币钱包 MemberWalletCoinEntity walletCoin = new MemberWalletCoinEntity(); walletCoin.setWalletCode(coinTypeEnum.name()); walletCoin.setMemberId(member.getId()); @@ -213,7 +223,8 @@ levelRate.setSymbol(symbolEnum.getValue()); memberLevelRateDao.insert(levelRate); } - return Result.ok("success"); + + return Result.ok(MessageSourceUtils.getString("home_service_0009")); } @Override @@ -320,8 +331,13 @@ //获取用户ID Long memberId = LoginUserUtils.getAppLoginUser().getId(); MemberEntity member = memberDao.selectById(memberId); + if (MemberEntity.CERTIFY_STATUS_ING.equals(member.getCertifyStatus())) { + return Result.fail(MessageSourceUtils.getString("member_service_4000")); + } if (ObjectUtil.isNotEmpty(member)) { + MemberAuthenticationEntity memberAuthenticationEntity = new MemberAuthenticationEntity(); + if (MemberEntity.CERTIFY_STATUS_Y == member.getCertifyStatus()) { return Result.fail(MessageSourceUtils.getString("member_service_0055")); } @@ -344,19 +360,19 @@ return Result.fail(MessageSourceUtils.getString("member_service_0059")); } memberAuthenticationEntity.setSecondName(memberAuthenticationDto.getSecondName()); - + String type = memberAuthenticationDto.getType(); memberAuthenticationEntity.setType(type); - + String idCardNo = memberAuthenticationDto.getIdCardNo(); if (StrUtil.isBlank(idCardNo)) { - return Result.fail(MessageSourceUtils.getString("member_service_0060")); + return Result.fail(MessageSourceUtils.getString("member_service_0060")); } memberAuthenticationEntity.setIdcardNo(idCardNo); //同一个身份证号码不能重复实名认证 int count = memberAuthenticationDao.findMemberbyIdCardNoCount(idCardNo); if (count > 0) { - return Result.fail(MessageSourceUtils.getString("member_service_0060")); + return Result.fail(MessageSourceUtils.getString("member_service_0060")); } if (StrUtil.isBlank(memberAuthenticationDto.getIdCardFront()) || StrUtil.isBlank(memberAuthenticationDto.getIdCardReverse()) @@ -366,19 +382,22 @@ memberAuthenticationEntity.setIdcardImageFront(memberAuthenticationDto.getIdCardFront()); memberAuthenticationEntity.setIdcardImageBack(memberAuthenticationDto.getIdCardReverse()); memberAuthenticationEntity.setIdcardImageInHand(memberAuthenticationDto.getIdCardImage()); - memberAuthenticationDao.insert(memberAuthenticationEntity); + + Map<String, Object> columnMap = new HashMap<>(); + columnMap.put("member_id", memberId); + List<MemberAuthenticationEntity> selectByMap = memberAuthenticationDao.selectByMap(columnMap); + if (CollUtil.isEmpty(selectByMap)) { + memberAuthenticationDao.insert(memberAuthenticationEntity); + } else { + memberAuthenticationEntity.setId(selectByMap.get(0).getId()); + memberAuthenticationDao.updateById(memberAuthenticationEntity); + } member.setCertifyStatus(MemberEntity.CERTIFY_STATUS_ING); member.setIdcardNo(idCardNo); memberDao.updateById(member); - /** - * TODO dingtalk - Constant.excutor.execute(new Runnable() { - @Override public void run() { - DingTalkUtils.sendActionCard(4); - } - });*/ + ThreadPoolUtils.sendDingTalk(4); return Result.ok(MessageSourceUtils.getString("member_service_0024")); } return Result.fail(MessageSourceUtils.getString("member_service_0063")); @@ -466,17 +485,17 @@ if (!MemberEntity.CERTIFY_STATUS_Y.equals(member.getCertifyStatus())) { return Result.fail(MessageSourceUtils.getString("member_service_0077")); } - + Map<String, Object> columnMap = new HashMap<>(); columnMap.put("member_id", memberId); - List<MemberPaymentMethodEntity> selectByMap = memberPaymentMethodDao.selectByMap(columnMap); - if(CollUtil.isNotEmpty(selectByMap)) { - for(MemberPaymentMethodEntity memberPaymentMethodEntity : selectByMap) { - if(memberPaymethodDto.getAccount().equals(memberPaymentMethodEntity.getAccount())) { - return Result.fail(MessageSourceUtils.getString("member_service_0097")); - } - } - } + List<MemberPaymentMethodEntity> selectByMap = memberPaymentMethodDao.selectByMap(columnMap); + if (CollUtil.isNotEmpty(selectByMap)) { + for (MemberPaymentMethodEntity memberPaymentMethodEntity : selectByMap) { + if (memberPaymethodDto.getAccount().equals(memberPaymentMethodEntity.getAccount())) { + return Result.fail(MessageSourceUtils.getString("member_service_0097")); + } + } + } String account = memberPaymethodDto.getAccount(); String bank = memberPaymethodDto.getBank(); String name = memberPaymethodDto.getName(); @@ -557,7 +576,7 @@ @Override @Transactional public Result memberBindPhone(@Valid MemberBindPhoneDto memberBindPhoneDto) { - //获取用户ID + //获取用户ID Long memberId = LoginUserUtils.getAppLoginUser().getId(); String phone = memberBindPhoneDto.getPhone(); String code = memberBindPhoneDto.getCode(); @@ -570,13 +589,13 @@ } Map<String, Object> columnMap = new HashMap<>(); columnMap.put("phone", phone); - List<MemberEntity> selectByMap = memberDao.selectByMap(columnMap ); - if(CollUtil.isEmpty(selectByMap)) { - member.setPhone(phone); - memberDao.updateById(member); - return Result.ok(MessageSourceUtils.getString("member_service_0014")); - }else { - return Result.fail(MessageSourceUtils.getString("member_service_1400")); + List<MemberEntity> selectByMap = memberDao.selectByMap(columnMap); + if (CollUtil.isEmpty(selectByMap)) { + member.setPhone(phone); + memberDao.updateById(member); + return Result.ok(MessageSourceUtils.getString("member_service_0014")); + } else { + return Result.fail(MessageSourceUtils.getString("member_service_1400")); } } @@ -587,7 +606,7 @@ @Transactional public Result memberBindEmail(@Valid MemberBindEmailDto memberBindEmailDto) { - //获取用户ID + //获取用户ID Long memberId = LoginUserUtils.getAppLoginUser().getId(); String email = memberBindEmailDto.getEmail(); String code = memberBindEmailDto.getCode(); @@ -596,15 +615,15 @@ boolean flag = commonservice.verifyCode(email, code); if (ObjectUtil.isNotEmpty(member)) { if (flag) { - Map<String, Object> columnMap = new HashMap<>(); + Map<String, Object> columnMap = new HashMap<>(); columnMap.put("email", email); - List<MemberEntity> selectByMap = memberDao.selectByMap(columnMap ); - if(CollUtil.isEmpty(selectByMap)) { - member.setEmail(email); + List<MemberEntity> selectByMap = memberDao.selectByMap(columnMap); + if (CollUtil.isEmpty(selectByMap)) { + member.setEmail(email); memberDao.updateById(member); return Result.ok(MessageSourceUtils.getString("member_service_0018")); - }else { - return Result.fail(MessageSourceUtils.getString("member_service_1400")); + } else { + return Result.fail(MessageSourceUtils.getString("member_service_1400")); } } } @@ -658,15 +677,15 @@ Long memberId = LoginUserUtils.getAppLoginUser().getId(); String address = memberAddCoinAddressDto.getAddress(); String isBiyict = memberAddCoinAddressDto.getIsBiyict(); - Long symbolscoinId = memberAddCoinAddressDto.getSymbolscoinId(); + String symbol = memberAddCoinAddressDto.getSymbol(); String remark = memberAddCoinAddressDto.getRemark(); - - PlatformSymbolsCoinEntity platformSymbolsCoinEntity = platformSymbolsCoinDao.selectById(symbolscoinId); + PlatformSymbolsCoinEntity platformSymbolsCoinEntity = platformSymbolsCoinDao.selectOneBySymbol(symbol); + Long symbolscoinId = platformSymbolsCoinEntity.getId(); MemberCoinAddressEntity memberCoinAddressEntity = new MemberCoinAddressEntity(); memberCoinAddressEntity.setAddress(address); memberCoinAddressEntity.setMemberId(memberId); - memberCoinAddressEntity.setIsBiyict(isBiyict); + memberCoinAddressEntity.setIsBiyict(MemberCoinAddressEntity.IS_BIYICT_NO); memberCoinAddressEntity.setSymbolscoinId(symbolscoinId); memberCoinAddressEntity.setLabel(remark); memberCoinAddressEntity.setSymbol(platformSymbolsCoinEntity.getName()); @@ -733,16 +752,19 @@ MemberEntity member = memberDao.selectById(memberId); MemberPersonCenterInfoVo memberPersonCenterInfoVo = new MemberPersonCenterInfoVo(); - + + Integer certifyStatus = member.getCertifyStatus(); + memberPersonCenterInfoVo.setCertifyStatus(certifyStatus); + Map<String, Object> columnMap = new HashMap<>(); columnMap.put("member_id", memberId); List<MemberPaymentMethodEntity> selectByMap = memberPaymentMethodDao.selectByMap(columnMap); - if(CollUtil.isEmpty(selectByMap)) { - memberPersonCenterInfoVo.setMemberPaymentMethod(0); - }else { - memberPersonCenterInfoVo.setMemberPaymentMethod(1); + if (CollUtil.isEmpty(selectByMap)) { + memberPersonCenterInfoVo.setMemberPaymentMethod(0); + } else { + memberPersonCenterInfoVo.setMemberPaymentMethod(1); } - + if (StrUtil.isNotEmpty(member.getPhone())) { memberPersonCenterInfoVo.setPhone(1); } else { @@ -767,6 +789,9 @@ } else { memberPersonCenterInfoVo.setTradeAgingSetting(MemberPersonCenterInfoVo.PWD_NEED_NO); } + + Integer fingerprintState = member.getFingerprintState(); + memberPersonCenterInfoVo.setFingerprintState(fingerprintState); return Result.ok(memberPersonCenterInfoVo); } @@ -798,15 +823,22 @@ return Result.fail(MessageSourceUtils.getString("member_service_0087")); } - MemberAvivableCoinInfoVo memberAvivableCoinInfoVo = new MemberAvivableCoinInfoVo(); - memberAvivableCoinInfoVo.setAvailableBalance(walletCoin.getAvailableBalance()); + List<MemberAvivableCoinInfoVo> arrayList = new ArrayList<>(); - PlatformFeeSettingEntity feeSetting = platformFeeSettingDao.getFeeSettingByTypeAndSymbol(2, symbol); - if (ObjectUtil.isEmpty(feeSetting)) { + + List<PlatformFeeSettingEntity> feeSettingByTypeAndSymbolLable = platformFeeSettingDao.getFeeSettingsByTypeAndSymbol(2, symbol); + if (CollUtil.isEmpty(feeSettingByTypeAndSymbolLable)) { return Result.fail(MessageSourceUtils.getString("member_service_0087")); } - memberAvivableCoinInfoVo.setFee(feeSetting.getFeePrice()); - return Result.ok(memberAvivableCoinInfoVo); + for (PlatformFeeSettingEntity platformFeeSettingEntity : feeSettingByTypeAndSymbolLable) { + MemberAvivableCoinInfoVo memberAvivableCoinInfoVo = new MemberAvivableCoinInfoVo(); + memberAvivableCoinInfoVo.setAvailableBalance(walletCoin.getAvailableBalance()); + memberAvivableCoinInfoVo.setFee(platformFeeSettingEntity.getFeePrice()); + memberAvivableCoinInfoVo.setLable(platformFeeSettingEntity.getLable()); + arrayList.add(memberAvivableCoinInfoVo); + } + + return Result.ok(arrayList); } @Override @@ -857,9 +889,9 @@ if (flag) { MemberWalletCoinEntity walletCoin = memberWalletCoinDao.selectWalletCoinBymIdAndCode(memberId, memberSubmitCoinApplyDto.getSymbol()); BigDecimal availableBalance = walletCoin.getAvailableBalance(); - BigDecimal coinNumber = memberSubmitCoinApplyDto.getCoinNumber().add(memberSubmitCoinApplyDto.getFeeAmount()); + BigDecimal coinNumber = memberSubmitCoinApplyDto.getCoinNumber(); if (availableBalance.compareTo(BigDecimal.ZERO) > 0 - && availableBalance.compareTo(coinNumber) > 0) { + && availableBalance.compareTo(coinNumber) >= 0) { //新增提币记录 MemberCoinWithdrawEntity memberCoinWithdrawEntity = new MemberCoinWithdrawEntity(); memberCoinWithdrawEntity.setAddress(memberSubmitCoinApplyDto.getAddress()); @@ -867,11 +899,13 @@ memberCoinWithdrawEntity.setFeeAmount(memberSubmitCoinApplyDto.getFeeAmount()); memberCoinWithdrawEntity.setSymbol(memberSubmitCoinApplyDto.getSymbol()); memberCoinWithdrawEntity.setMemberId(memberId); + memberCoinWithdrawEntity.setLabel(memberSubmitCoinApplyDto.getLable()); memberCoinWithdrawEntity.setStatus(MemberCoinWithdrawEntity.STATUS_DOING); Map<String, Object> columnMap = new HashMap<>(); columnMap.put("symbol", memberSubmitCoinApplyDto.getSymbol()); columnMap.put("address", memberSubmitCoinApplyDto.getAddress()); + columnMap.put("is_biyict", MemberCoinAddressEntity.IS_BIYICT_YES); List<MemberCoinAddressEntity> selectByMap = memberCoinAddressDao.selectByMap(columnMap); if (CollUtil.isEmpty(selectByMap)) { memberCoinWithdrawEntity.setIsInside(MemberCoinWithdrawEntity.ISINSIDE_NO); @@ -888,19 +922,14 @@ MemberAccountMoneyChange accountRecord = new MemberAccountMoneyChange(); accountRecord.setContent("提币"); accountRecord.setMemberId(memberId); - accountRecord.setAmount(memberSubmitCoinApplyDto.getCoinNumber()); + accountRecord.setAmount(coinNumber); + accountRecord.setWithdrawId(memberCoinWithdrawEntity.getId()); accountRecord.setStatus(MemberAccountMoneyChange.STATUS_WAIT_INTEGER); accountRecord.setSymbol(memberSubmitCoinApplyDto.getSymbol()); accountRecord.setType(MemberAccountMoneyChange.TYPE_WALLET_COIN); memberAccountMoneyChangeDao.insert(accountRecord); - /** - * TODO dingtalk - Constant.excutor.execute(new Runnable() { - @Override public void run() { - DingTalkUtils.sendActionCard(3); - } - }); - */ + + ThreadPoolUtils.sendDingTalk(3); return Result.ok(MessageSourceUtils.getString("member_service_0086")); } else { return Result.fail(MessageSourceUtils.getString("member_service_0005")); @@ -928,22 +957,213 @@ return Result.ok(""); } + @Override + public Result getAppVersionInfo() { + MemberEntity memberEntity = LoginUserUtils.getAppLoginUser(); + + Map<String, Object> columnMap = new HashMap<>(); + List<AppVersionEntity> selectByMap = appVersionDao.selectByMap(columnMap); + List<Object> arrayList = new ArrayList<>(); + if (CollUtil.isNotEmpty(selectByMap)) { + for (AppVersionEntity appVersionEntity : selectByMap) { + AppVersionVo appVersionVo = new AppVersionVo(); + if ("37059551".equals(memberEntity.getInviteId())) { + appVersionVo.setAddress("www.baidu.com"); + appVersionVo.setType(appVersionEntity.getType()); + appVersionVo.setVersion(appVersionEntity.getVersion()); + } else { + appVersionVo.setAddress(appVersionEntity.getAddress()); + appVersionVo.setType(appVersionEntity.getType()); + appVersionVo.setVersion(appVersionEntity.getVersion()); + } + arrayList.add(appVersionVo); + } + } + return Result.ok(arrayList); + } + + @Override + public Result getPcVersionInfo() { + Map<String, Object> columnMap = new HashMap<>(); + List<AppVersionEntity> selectByMap = appVersionDao.selectByMap(columnMap); + List<Object> arrayList = new ArrayList<>(); + if (CollUtil.isNotEmpty(selectByMap)) { + for (AppVersionEntity appVersionEntity : selectByMap) { + AppVersionVo appVersionVo = new AppVersionVo(); + appVersionVo.setAddress(appVersionEntity.getAddress()); + appVersionVo.setType(appVersionEntity.getType()); + appVersionVo.setVersion(appVersionEntity.getVersion()); + arrayList.add(appVersionVo); + } + } + return Result.ok(arrayList); + } + @Override - public Result getAppVersionInfo() { - Map<String, Object> columnMap = new HashMap<>(); - List<AppVersionEntity> selectByMap = appVersionDao.selectByMap(columnMap); - List<Object> arrayList = new ArrayList<>(); - if(CollUtil.isNotEmpty(selectByMap)) { - for(AppVersionEntity appVersionEntity : selectByMap) { - AppVersionVo appVersionVo = new AppVersionVo(); - appVersionVo.setAddress(appVersionEntity.getAddress()); - appVersionVo.setType(appVersionEntity.getType()); - appVersionVo.setVersion(appVersionEntity.getVersion()); - arrayList.add(appVersionVo); - } + public Result memberSubmitCoinApplyIn(@Valid MemberSubmitCoinApplyInDto memberSubmitCoinApplyInDto) { + //获取用户ID + Long memberId = LoginUserUtils.getAppLoginUser().getId(); + MemberEntity member = memberDao.selectById(memberId); + if (member.getCertifyStatus() != MemberEntity.CERTIFY_STATUS_Y) { + return Result.fail(MessageSourceUtils.getString("member_service_0077")); + } + if (StrUtil.isEmpty(member.getTradePassword())) { + return Result.fail(MessageSourceUtils.getString("member_service_0081")); + } + if (member.getTradePassword() == null) { + return Result.fail(MessageSourceUtils.getString("member_service_0082")); + } + if (!member.getTradePassword().equals(SecureUtil.md5(memberSubmitCoinApplyInDto.getTradePassword()))) { + return Result.fail(MessageSourceUtils.getString("member_service_0082")); + } + + boolean flag = commonservice.verifyCode(memberSubmitCoinApplyInDto.getAccount(), memberSubmitCoinApplyInDto.getCode()); + if (flag) { + //获取到账地址 + String address = memberSubmitCoinApplyInDto.getAddress(); + //根据账号获取会员信息 + MemberEntity selectMemberInfoByAccount = memberDao.selectMemberInfoByAccount(address); + if(ObjectUtil.isEmpty(selectMemberInfoByAccount)) { + return Result.fail(MessageSourceUtils.getString("member_service_0087")); + } + Long memberInfoId = selectMemberInfoByAccount.getId(); + String symbol = memberSubmitCoinApplyInDto.getSymbol(); + + Map<String, Object> columnMapAddress = new HashMap<>(); + columnMapAddress.put("member_id", memberInfoId); + columnMapAddress.put("symbol", symbol); + List<MemberCoinAddressEntity> selectByMap2 = memberCoinAddressDao.selectByMap(columnMapAddress ); + if(CollUtil.isEmpty(selectByMap2)) { + return Result.fail(MessageSourceUtils.getString("member_service_0087")); } - return Result.ok(arrayList); - } + MemberCoinAddressEntity memberCoinAddressEntity = selectByMap2.get(0); + String addressIn = memberCoinAddressEntity.getAddress(); + + MemberWalletCoinEntity walletCoin = memberWalletCoinDao.selectWalletCoinBymIdAndCode(memberId, memberSubmitCoinApplyInDto.getSymbol()); + BigDecimal availableBalance = walletCoin.getAvailableBalance(); + BigDecimal coinNumber = memberSubmitCoinApplyInDto.getCoinNumber(); + if (availableBalance.compareTo(BigDecimal.ZERO) > 0 + && availableBalance.compareTo(coinNumber) >= 0) { + //新增提币记录 + MemberCoinWithdrawEntity memberCoinWithdrawEntity = new MemberCoinWithdrawEntity(); + memberCoinWithdrawEntity.setAddress(addressIn); + memberCoinWithdrawEntity.setAmount(coinNumber); + memberCoinWithdrawEntity.setFeeAmount(BigDecimal.ZERO); + memberCoinWithdrawEntity.setSymbol(memberSubmitCoinApplyInDto.getSymbol()); + memberCoinWithdrawEntity.setMemberId(memberId); + memberCoinWithdrawEntity.setStatus(MemberCoinWithdrawEntity.STATUS_DOING); + memberCoinWithdrawEntity.setIsInside(MemberCoinWithdrawEntity.ISINSIDE_YES); + memberCoinWithdrawEntity.setLabel(memberSubmitCoinApplyInDto.getLable()); + memberCoinWithdrawDao.insert(memberCoinWithdrawEntity); + BigDecimal subtract = walletCoin.getAvailableBalance().subtract(coinNumber); + walletCoin.setAvailableBalance(subtract); + BigDecimal add = walletCoin.getFrozenBalance().add(coinNumber); + walletCoin.setFrozenBalance(add); + memberWalletCoinDao.updateById(walletCoin); + + MemberAccountMoneyChange accountRecord = new MemberAccountMoneyChange(); + accountRecord.setContent("提币"); + accountRecord.setMemberId(memberId); + accountRecord.setAmount(coinNumber); + accountRecord.setWithdrawId(memberCoinWithdrawEntity.getId()); + accountRecord.setStatus(MemberAccountMoneyChange.STATUS_WAIT_INTEGER); + accountRecord.setSymbol(memberSubmitCoinApplyInDto.getSymbol()); + accountRecord.setType(MemberAccountMoneyChange.TYPE_WALLET_COIN); + memberAccountMoneyChangeDao.insert(accountRecord); + + ThreadPoolUtils.sendDingTalk(3); + return Result.ok(MessageSourceUtils.getString("member_service_0086")); + } else { + return Result.fail(MessageSourceUtils.getString("member_service_0005")); + } + + } else { + return Result.fail(MessageSourceUtils.getString("member_service_0039")); + } + } + + @Override + public Result memberAddCoinAddressIn(@Valid MemberAddCoinAddressInDto memberAddCoinAddressDto) { + + //获取用户ID + Long memberId = LoginUserUtils.getAppLoginUser().getId(); + String address = memberAddCoinAddressDto.getAddress(); + String remark = memberAddCoinAddressDto.getRemark(); + + MemberCoinAddressInEntity memberCoinAddressInEntity = new MemberCoinAddressInEntity(); + memberCoinAddressInEntity.setAccount(address); + memberCoinAddressInEntity.setMemberId(memberId); + memberCoinAddressInEntity.setContent(remark); + memberCoinAddressInDao.insert(memberCoinAddressInEntity); + return Result.ok(MessageSourceUtils.getString("member_service_0024")); + } + + @Override + public Result memberDelCoinAddressIn(@Valid MemberDelCoinAddressDto memberDelCoinAddressDto) { + //获取用户ID + Long memberId = LoginUserUtils.getAppLoginUser().getId(); + MemberEntity member = memberDao.selectById(memberId); + if (ObjectUtil.isNotEmpty(member)) { + Long id = memberDelCoinAddressDto.getId(); + memberCoinAddressInDao.deleteById(id); + } + return Result.ok("success"); + } + + @Override + public Result memberCoinAddressInList() { + //获取用户ID + Long memberId = LoginUserUtils.getAppLoginUser().getId(); + + Map<String, Object> columnMap = new HashMap<>(); + columnMap.put("member_id", memberId); + List<MemberCoinAddressInEntity> selectByMap = memberCoinAddressInDao.selectByMap(columnMap ); + List<MemberCoinAddressInListVo> arrayList = new ArrayList<>(); + if (CollUtil.isNotEmpty(selectByMap)) { + for (MemberCoinAddressInEntity memberCoinAddressInEntity : selectByMap) { + MemberCoinAddressInListVo memberCoinAddressInListVo = new MemberCoinAddressInListVo(); + memberCoinAddressInListVo.setId(memberCoinAddressInEntity.getId()); + memberCoinAddressInListVo.setAccount(memberCoinAddressInEntity.getAccount()); + memberCoinAddressInListVo.setContent(memberCoinAddressInEntity.getContent()); + arrayList.add(memberCoinAddressInListVo); + } + } + return Result.ok(arrayList); + } + + @Override + public Result memberFingerprintState(@Valid MemberFingerprintStateDto memberFingerprintStateDto) { + //获取用户ID + Long memberId = LoginUserUtils.getAppLoginUser().getId(); + + String password = SecureUtil.md5(memberFingerprintStateDto.getPassword()); + MemberEntity member = memberDao.selectById(memberId); + + if(password.equals(member.getPassword())){ + Integer fingerprintState = memberFingerprintStateDto.getFingerprintState(); + MemberEntity memberEntity = memberDao.selectById(memberId); + memberEntity.setFingerprintState(fingerprintState); + memberDao.updateById(memberEntity); + return Result.ok(MessageSourceUtils.getString("member_service_0024")); + }else{ + return Result.fail(MessageSourceUtils.getString("home_service_0005")); + } + } + + @Override + @Transactional + public Result memberMessageReminder() { + //获取用户ID + Long memberId = LoginUserUtils.getAppLoginUser().getId(); + MemberMessageReminderVo memberMessageReminderVo = new MemberMessageReminderVo(); + MemberSettingEntity selectById = memberSettingDao.selectMemberSettingByMemberId(memberId); + if(ObjectUtil.isNotEmpty(selectById)) { + memberMessageReminderVo.setMessageReminder(selectById.getMessageReminder()); + } + return Result.ok(memberMessageReminderVo); + } + + } -- Gitblit v1.9.1