| | |
| | | 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.member.vo.DefaultWayVo; |
| | | import com.xcong.excoin.modules.platform.dao.PlatformFeeSettingDao; |
| | | import com.xcong.excoin.modules.platform.dao.PlatformSymbolsCoinDao; |
| | | import com.xcong.excoin.modules.platform.entity.PlatformFeeSettingEntity; |
| | |
| | | } |
| | | |
| | | @Override |
| | | public Result setDefaultPaymethod(Long id) { |
| | | MemberEntity member = LoginUserUtils.getAppLoginUser(); |
| | | MemberPaymentMethodEntity defualtMethod = this.memberPaymentMethodDao.selectDefualtMethod(member.getId(), null, "1"); |
| | | |
| | | if (defualtMethod != null) { |
| | | if (id.equals(defualtMethod.getId())) { |
| | | return Result.fail("不能关闭默认收款方式"); |
| | | } |
| | | } |
| | | |
| | | MemberPaymentMethodEntity paymentMethodEntity = new MemberPaymentMethodEntity(); |
| | | paymentMethodEntity.setId(id); |
| | | paymentMethodEntity.setIsDefualt("1"); |
| | | this.memberPaymentMethodDao.updateById(paymentMethodEntity); |
| | | |
| | | if (defualtMethod != null) { |
| | | defualtMethod.setIsDefualt("2"); |
| | | this.memberPaymentMethodDao.updateById(defualtMethod); |
| | | } |
| | | return Result.ok("操作成功"); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public Result memberBindPhone(@Valid MemberBindPhoneDto memberBindPhoneDto) { |
| | | //获取用户ID |
| | |
| | | memberPersonCenterInfoVo.setTradeAgingSetting(MemberPersonCenterInfoVo.PWD_NEED_NO); |
| | | } |
| | | |
| | | if (StrUtil.isEmpty(member.getName())) { |
| | | memberPersonCenterInfoVo.setNickName(2); |
| | | } else { |
| | | memberPersonCenterInfoVo.setNickName(1); |
| | | } |
| | | |
| | | memberPersonCenterInfoVo.setIsMb(member.getIsTrader()); |
| | | return Result.ok(memberPersonCenterInfoVo); |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | @Override |
| | | public Result findDefaultWay() { |
| | | //获取用户ID |
| | | Long memberId = LoginUserUtils.getAppLoginUser().getId(); |
| | | |
| | | DefaultWayVo defaultWayVo = new DefaultWayVo(); |
| | | MemberPaymentMethodEntity defualtMethod = this.memberPaymentMethodDao.selectDefualtMethod(memberId, null, "1"); |
| | | if (ObjectUtil.isNotEmpty(defualtMethod)) { |
| | | String paymentType = defualtMethod.getPaymentType(); |
| | | defaultWayVo.setPaymentType(paymentType); |
| | | } |
| | | return Result.ok(defaultWayVo); |
| | | } |
| | | |
| | | public Result memberCoinAddressInList() { |
| | | //获取用户ID |
| | | Long memberId = LoginUserUtils.getAppLoginUser().getId(); |
| | |
| | | memberCoinAddressInDao.insert(memberCoinAddressInEntity); |
| | | return Result.ok(MessageSourceUtils.getString("member_service_0024")); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | 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(); |
| | | |
| | | String addressIn = ""; |
| | | 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")); |
| | | addressIn = address; |
| | | } else { |
| | | MemberCoinAddressEntity memberCoinAddressEntity = selectByMap2.get(0); |
| | | if(StrUtil.isEmpty(memberCoinAddressEntity.getAddress())){ |
| | | addressIn = selectMemberInfoByAccount.getInviteId(); |
| | | }else{ |
| | | 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 memberDelCoinAddressIn(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"); |
| | | } |
| | | } |
| | | |
| | | |