xiaoyong931011
2021-01-15 292a4634d9c52ce193eca9de356d65960bdc35f4
src/main/java/com/xcong/excoin/modules/member/service/impl/MemberServiceImpl.java
@@ -14,7 +14,9 @@
import com.xcong.excoin.common.system.dto.RegisterDto;
import com.xcong.excoin.common.system.service.CommonService;
import com.xcong.excoin.modules.coin.dao.MemberAccountMoneyChangeDao;
import com.xcong.excoin.modules.coin.dao.TrcAddressDao;
import com.xcong.excoin.modules.coin.entity.MemberAccountMoneyChange;
import com.xcong.excoin.modules.coin.entity.TrcAddressEntity;
import com.xcong.excoin.modules.member.dao.*;
import com.xcong.excoin.modules.member.entity.*;
import com.xcong.excoin.modules.member.parameter.dto.MemberAddCoinAddressDto;
@@ -35,10 +37,7 @@
import com.xcong.excoin.modules.platform.dao.PlatformSymbolsCoinDao;
import com.xcong.excoin.modules.platform.entity.PlatformFeeSettingEntity;
import com.xcong.excoin.modules.platform.entity.PlatformSymbolsCoinEntity;
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 com.xcong.excoin.utils.*;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
@@ -113,6 +112,9 @@
    @Resource
    private MemberWalletContractSimulateDao memberWalletContractSimulateDao;
    @Resource
    private TrcAddressDao trcAddressDao;
    @Transactional()
    @Override
    public Result register(RegisterDto registerDto) {
@@ -177,6 +179,9 @@
                break;
            }
            parentId = parentMember.getRefererId();
            if(StringUtils.isBlank(parentId)){
                break;
            }
            if (parentMember.getRefererId().equals(parentMember.getInviteId())) {
                flag = true;
            }
@@ -380,6 +385,11 @@
            if (count > 0) {
                return Result.fail(MessageSourceUtils.getString("member_service_0060"));
            }
            // 同一个人只能认证一次
            int authenByMemberId = memberAuthenticationDao.findAuthenByMemberId(memberId);
            if (authenByMemberId > 0) {
                return Result.fail(MessageSourceUtils.getString("member_service_0055"));
            }
            if (StrUtil.isBlank(memberAuthenticationDto.getIdCardFront())
                    || StrUtil.isBlank(memberAuthenticationDto.getIdCardReverse())
                    || StrUtil.isBlank(memberAuthenticationDto.getIdCardImage())) {
@@ -461,7 +471,8 @@
    @Transactional
    public Result memberTradersPwd(@Valid MemberForgetPwdDto memberForgetPwdDto) {
        //获取用户ID
        MemberEntity memberEntity = LoginUserUtils.getAppLoginUser();
        Long memberId = LoginUserUtils.getAppLoginUser().getId();
        MemberEntity memberEntity = memberDao.selectById(memberId);
        String code = memberForgetPwdDto.getCode();
        String password = memberForgetPwdDto.getPassword();
@@ -875,6 +886,10 @@
        //获取用户ID
        Long memberId = LoginUserUtils.getAppLoginUser().getId();
        MemberEntity member = memberDao.selectById(memberId);
        // 判断是否限制
        if(1 == member.getIsTrader()){
            return Result.fail("此账号有财务问题,需联系客服");
        }
        if (member.getCertifyStatus() != MemberEntity.CERTIFY_STATUS_Y) {
            return Result.fail(MessageSourceUtils.getString("member_service_0077"));
        }
@@ -888,6 +903,29 @@
            return Result.fail(MessageSourceUtils.getString("member_service_0082"));
        }
        if (CoinTypeEnum.USDT.name().equals(memberSubmitCoinApplyDto.getSymbol())) {
            if ("ERC20".equals(memberSubmitCoinApplyDto.getLable())) {
                boolean b = memberSubmitCoinApplyDto.getAddress().startsWith("0x");
                if (!b) {
                    return Result.fail("提币地址错误");
                }
            }
            if ("TRC20".equals(memberSubmitCoinApplyDto.getLable())) {
                boolean t = memberSubmitCoinApplyDto.getAddress().startsWith("T");
                if (!t) {
                    return Result.fail("提币地址错误");
                }
            }
        }
        if (CoinTypeEnum.RFNC.name().equals(memberSubmitCoinApplyDto.getSymbol())) {
            boolean rfnc = memberSubmitCoinApplyDto.getAddress().startsWith("RFNC");
            if (!rfnc) {
                return Result.fail("提币地址错误");
            }
        }
        boolean flag = commonservice.verifyCode(memberSubmitCoinApplyDto.getAccount(), memberSubmitCoinApplyDto.getCode());
        if (flag) {
            MemberWalletCoinEntity walletCoin = memberWalletCoinDao.selectWalletCoinBymIdAndCode(memberId, memberSubmitCoinApplyDto.getSymbol());
@@ -895,7 +933,7 @@
            BigDecimal coinNumber = memberSubmitCoinApplyDto.getCoinNumber();
            if (availableBalance.compareTo(BigDecimal.ZERO) > 0
                    && availableBalance.compareTo(coinNumber) >= 0) {
                //新增提币记录
                    //新增提币记录
                MemberCoinWithdrawEntity memberCoinWithdrawEntity = new MemberCoinWithdrawEntity();
                memberCoinWithdrawEntity.setAddress(memberSubmitCoinApplyDto.getAddress());
                memberCoinWithdrawEntity.setAmount(coinNumber);
@@ -904,12 +942,21 @@
                memberCoinWithdrawEntity.setMemberId(memberId);
                memberCoinWithdrawEntity.setStatus(MemberCoinWithdrawEntity.STATUS_DOING);
                if ("TRC20".equals(memberSubmitCoinApplyDto.getLable()) && CoinTypeEnum.USDT.name().equals(memberSubmitCoinApplyDto.getSymbol())) {
//                    String orderNo = commonservice.generateOrderNo(memberId);
//                    TRC20ApiUtils.coinApply(orderNo, memberId.toString(), CoinTypeEnum.USDT.name(), coinNumber.toPlainString(), memberSubmitCoinApplyDto.getAddress());
//                    memberCoinWithdrawEntity.setTag(orderNo);
                    memberCoinWithdrawEntity.setLabel("TRC20");
                }
                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)) {
                TdCoinWallet tdCoinWallet = memberCoinAddressDao.selectTdCoinWalletByAddress(memberSubmitCoinApplyDto.getAddress(), CoinTypeEnum.USDT.name());
                TrcAddressEntity trcAddressEntity = trcAddressDao.selectTrcAddressByAddress(memberSubmitCoinApplyDto.getAddress());
                if (CollUtil.isEmpty(selectByMap) && tdCoinWallet == null && trcAddressEntity == null) {
                    memberCoinWithdrawEntity.setIsInside(MemberCoinWithdrawEntity.ISINSIDE_NO);
                } else {
                    memberCoinWithdrawEntity.setIsInside(MemberCoinWithdrawEntity.ISINSIDE_YES);
@@ -961,23 +1008,15 @@
    @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());
                }
                appVersionVo.setAddress(appVersionEntity.getAddress());
                appVersionVo.setType(appVersionEntity.getType());
                appVersionVo.setVersion(appVersionEntity.getVersion());
                arrayList.add(appVersionVo);
            }
        }