Helius
2020-08-13 1356cf874d0fac038269d4277afea86d285dd623
src/main/java/com/xcong/excoin/modules/member/service/impl/MemberServiceImpl.java
@@ -106,6 +106,8 @@
    @Resource
    AppVersionDao appVersionDao;
    @Resource
    private MemberSettingDao memberSettingDao;
    @Resource
    private MemberWalletContractSimulateDao memberWalletContractSimulateDao;
@@ -152,11 +154,16 @@
        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.setSpread(BigDecimal.ONE);
        member.setSpread(BigDecimal.ONE);
        memberDao.insert(member);
        MemberSettingEntity memberSettingEntity = new MemberSettingEntity();
        memberSettingEntity.setSpread(BigDecimal.ONE);
        memberSettingEntity.setClosingSpread(BigDecimal.ONE);
        memberSettingEntity.setForceParam(BigDecimal.valueOf(0.0015));
        memberSettingEntity.setMemberId(member.getId());
        memberSettingDao.insert(memberSettingEntity);
        String inviteId = ShareCodeUtil.toSerialCode(member.getId());
        member.setInviteId(inviteId);
@@ -331,12 +338,12 @@
        //获取用户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 (MemberEntity.CERTIFY_STATUS_ING.equals(member.getCertifyStatus())) {
            return Result.fail(MessageSourceUtils.getString("member_service_4000"));
        }
        if (ObjectUtil.isNotEmpty(member)) {
           MemberAuthenticationEntity memberAuthenticationEntity = new MemberAuthenticationEntity();
            MemberAuthenticationEntity memberAuthenticationEntity = new MemberAuthenticationEntity();
            if (MemberEntity.CERTIFY_STATUS_Y == member.getCertifyStatus()) {
                return Result.fail(MessageSourceUtils.getString("member_service_0055"));
@@ -366,13 +373,13 @@
            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())
@@ -384,14 +391,14 @@
            memberAuthenticationEntity.setIdcardImageInHand(memberAuthenticationDto.getIdCardImage());
            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);
           }
            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);
@@ -488,14 +495,14 @@
        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();
@@ -576,7 +583,7 @@
    @Override
    @Transactional
    public Result memberBindPhone(@Valid MemberBindPhoneDto memberBindPhoneDto) {
       //获取用户ID
        //获取用户ID
        Long memberId = LoginUserUtils.getAppLoginUser().getId();
        String phone = memberBindPhoneDto.getPhone();
        String code = memberBindPhoneDto.getCode();
@@ -589,13 +596,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"));
            }
        }
@@ -606,7 +613,7 @@
    @Transactional
    public Result memberBindEmail(@Valid MemberBindEmailDto memberBindEmailDto) {
       //获取用户ID
        //获取用户ID
        Long memberId = LoginUserUtils.getAppLoginUser().getId();
        String email = memberBindEmailDto.getEmail();
        String code = memberBindEmailDto.getCode();
@@ -615,15 +622,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"));
                }
            }
        }
@@ -759,10 +766,10 @@
        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())) {
@@ -823,16 +830,16 @@
        List<MemberAvivableCoinInfoVo> arrayList = new ArrayList<>();
      List<PlatformFeeSettingEntity> feeSettingByTypeAndSymbolLable = platformFeeSettingDao.getFeeSettingsByTypeAndSymbol(2, symbol);
        List<PlatformFeeSettingEntity> feeSettingByTypeAndSymbolLable = platformFeeSettingDao.getFeeSettingsByTypeAndSymbol(2, symbol);
        if (CollUtil.isEmpty(feeSettingByTypeAndSymbolLable)) {
            return Result.fail(MessageSourceUtils.getString("member_service_0087"));
        }
        for(PlatformFeeSettingEntity platformFeeSettingEntity : feeSettingByTypeAndSymbolLable) {
           MemberAvivableCoinInfoVo memberAvivableCoinInfoVo = new MemberAvivableCoinInfoVo();
           memberAvivableCoinInfoVo.setAvailableBalance(walletCoin.getAvailableBalance());
           memberAvivableCoinInfoVo.setFee(platformFeeSettingEntity.getFeePrice());
           memberAvivableCoinInfoVo.setLable(platformFeeSettingEntity.getLable());
           arrayList.add(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);
@@ -953,22 +960,47 @@
        return Result.ok("");
    }
   @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);
            }
         }
   return Result.ok(arrayList);
   }
    @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);
    }
}