xiaoyong931011
2020-05-31 9c8711046b00898717aa7a3b9f6dfee974d3f427
src/main/java/com/xcong/excoin/modules/member/service/impl/MemberServiceImpl.java
@@ -25,16 +25,23 @@
import com.xcong.excoin.modules.member.parameter.dto.MemberPaymethodDto;
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.vo.MemberAuthenticationInfoVo;
import com.xcong.excoin.modules.member.parameter.vo.MemberAvivableCoinInfoVo;
import com.xcong.excoin.modules.member.parameter.vo.MemberCoinAddressCountListVo;
import com.xcong.excoin.modules.member.parameter.vo.MemberCoinAddressCountVo;
import com.xcong.excoin.modules.member.parameter.vo.MemberCoinAddressListVo;
import com.xcong.excoin.modules.member.parameter.vo.MemberCoinAddressVo;
import com.xcong.excoin.modules.member.parameter.vo.MemberCoinInfoListVo;
import com.xcong.excoin.modules.member.parameter.vo.MemberCoinInfoVo;
import com.xcong.excoin.modules.member.parameter.vo.MemberInfoVo;
import com.xcong.excoin.modules.member.parameter.vo.MemberPaymethodDetailListVo;
import com.xcong.excoin.modules.member.parameter.vo.MemberPaymethodDetailVo;
import com.xcong.excoin.modules.member.parameter.vo.MemberPersonCenterInfoVo;
import com.xcong.excoin.modules.member.parameter.vo.MemberSendCodeWayVo;
import com.xcong.excoin.modules.member.service.MemberService;
import com.xcong.excoin.modules.platform.dao.PlatformFeeSettingDao;
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;
@@ -89,14 +96,17 @@
    PlatformSymbolsCoinDao platformSymbolsCoinDao;
    
    @Resource
    PlatformFeeSettingDao platformFeeSettingDao;
    @Resource
    MemberCoinAddressDao memberCoinAddressDao;
    
    @Resource
    private CommonService commonservice;
    @Resource
    private MemberWalletContractSimulateDao memberWalletContractSimulateDao;
    @Transactional()
    @Override
    public Result register(RegisterDto registerDto) {
@@ -442,7 +452,6 @@
      String paymentQrcode = memberPaymethodDto.getPaymentQrcode();
      String paymentType = memberPaymethodDto.getPaymentType();
      String subBank = memberPaymethodDto.getSubBank();
      String isDefualt = memberPaymethodDto.getIsDefualt();
      MemberPaymentMethodEntity memberPaymentMethodEntity = new MemberPaymentMethodEntity();
      memberPaymentMethodEntity.setMemberId(memberId);
      memberPaymentMethodEntity.setAccount(account);
@@ -451,7 +460,6 @@
      memberPaymentMethodEntity.setPaymentQrcode(paymentQrcode);
      memberPaymentMethodEntity.setPaymentType(paymentType);
      memberPaymentMethodEntity.setSubBank(subBank);
      memberPaymentMethodEntity.setIsDefualt(isDefualt);
      memberPaymentMethodDao.insert(memberPaymentMethodEntity);
      return Result.ok(MessageSourceUtils.getString("member_service_0024"));
    }
@@ -656,4 +664,94 @@
      return Result.ok("success");
   }
   @Override
   public Result memberAuthenticationInfo() {
      //获取用户ID
      Long memberId = LoginUserUtils.getAppLoginUser().getId();
      MemberEntity member = memberDao.selectById(memberId);
      Map<String, Object> columnMap = new HashMap<>();
      columnMap.put("member_id", memberId);
      List<MemberAuthenticationEntity> selectByMap = memberAuthenticationDao.selectByMap(columnMap);
      MemberAuthenticationInfoVo memberAuthnticationInfoVo = new MemberAuthenticationInfoVo();
      memberAuthnticationInfoVo.setCertifyStatus(member.getCertifyStatus());
      if(CollUtil.isNotEmpty(selectByMap)) {
         for(MemberAuthenticationEntity memberAuthenticationEntity : selectByMap) {
            memberAuthnticationInfoVo.setFirstName(memberAuthenticationEntity.getFirstName());
            memberAuthnticationInfoVo.setSecondName(memberAuthenticationEntity.getSecondName());
            memberAuthnticationInfoVo.setNation(memberAuthenticationEntity.getNation());
            memberAuthnticationInfoVo.setIdCardNo(memberAuthenticationEntity.getIdcardNo());
         }
      }
      return Result.ok(memberAuthnticationInfoVo);
   }
   @Override
   public Result memberPersonCenterInfo() {
      //获取用户ID
      Long memberId = LoginUserUtils.getAppLoginUser().getId();
      MemberEntity member = memberDao.selectById(memberId);
      MemberPersonCenterInfoVo memberPersonCenterInfoVo = new MemberPersonCenterInfoVo();
      if(StrUtil.isNotEmpty(member.getPhone())) {
         memberPersonCenterInfoVo.setPhone(1);
      }
      memberPersonCenterInfoVo.setPhone(0);
      if(StrUtil.isNotEmpty(member.getEmail())) {
         memberPersonCenterInfoVo.setEmail(1);
      }
      memberPersonCenterInfoVo.setEmail(0);
      if(StrUtil.isNotEmpty(member.getTradePassword())) {
         memberPersonCenterInfoVo.setTradePassword(1);
      }
      memberPersonCenterInfoVo.setTradePassword(0);
      if(StrUtil.isNotEmpty(member.getTradeAgingSetting().toString())) {
         memberPersonCenterInfoVo.setTradeAgingSetting(MemberPersonCenterInfoVo.PWD_NEED_FORVER);
      }
      memberPersonCenterInfoVo.setTradeAgingSetting(MemberPersonCenterInfoVo.PWD_NEED_FORVER);
      return Result.ok(memberPersonCenterInfoVo);
   }
   @Override
   public Result memberCoinInfoList() {
      //获取用户ID
      Long memberId = LoginUserUtils.getAppLoginUser().getId();
      MemberCoinInfoListVo memberCoinInfoListVo = new MemberCoinInfoListVo();
      List<PlatformSymbolsCoinEntity> selectByMap = platformSymbolsCoinDao.selectByMap(new HashMap<>());
      List<MemberCoinInfoVo> arrayList = new ArrayList<>();
      if(CollUtil.isNotEmpty(selectByMap)) {
         for(PlatformSymbolsCoinEntity platformSymbolsCoinEntity : selectByMap) {
            MemberCoinInfoVo memberCoinInfoVo = new MemberCoinInfoVo();
            memberCoinInfoVo.setName(platformSymbolsCoinEntity.getName());
            arrayList.add(memberCoinInfoVo);
         }
      }
      memberCoinInfoListVo.setMemberCoinInfoVo(arrayList);
      return Result.ok(memberCoinInfoListVo);
   }
   @Override
   public Result memberAvivableCoinInfo(String symbol) {
      //获取用户ID
      Long memberId = LoginUserUtils.getAppLoginUser().getId();
        MemberWalletCoinEntity walletCoin = memberWalletCoinDao.selectWalletCoinBymIdAndCode(memberId, symbol);
        if (ObjectUtil.isEmpty(walletCoin)) {
             return Result.fail(MessageSourceUtils.getString("member_service_0087"));
        }
        MemberAvivableCoinInfoVo memberAvivableCoinInfoVo = new MemberAvivableCoinInfoVo();
        memberAvivableCoinInfoVo.setAvailableBalance(walletCoin.getAvailableBalance());
        PlatformFeeSettingEntity feeSetting = platformFeeSettingDao.getFeeSettingByTypeAndSymbol(2,symbol);
        memberAvivableCoinInfoVo.setFee(feeSetting.getFeePrice());
        return Result.ok(memberAvivableCoinInfoVo);
    }
}