Helius
2020-11-13 9935010f3b4ec131c660d7816f39ddb611a48314
src/main/java/com/xcong/excoin/modules/member/service/impl/MemberServiceImpl.java
@@ -1,7 +1,9 @@
package com.xcong.excoin.modules.member.service.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.RandomUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
@@ -9,6 +11,8 @@
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xcong.excoin.common.entity.FebsResponse;
import com.xcong.excoin.common.entity.QueryRequest;
import com.xcong.excoin.common.utils.RedisUtils;
import com.xcong.excoin.common.utils.TRC20ApiUtils;
import com.xcong.excoin.modules.Sms106Send;
import com.xcong.excoin.modules.member.dto.MemberDetailConfirmDto;
import com.xcong.excoin.modules.member.entity.*;
@@ -71,6 +75,8 @@
   private final AgentFriendRelationMapper agentFriendRelationMapper;
   private final TdFinancialReordDao tdFinancialReordDao;
   private final RedisUtils redisUtils;
   
   @Override
   public IPage<AgentFriendRelationEntity> findAgentInfoListInPage(AgentFriendRelationEntity agentFriendRelationEntity,
@@ -540,6 +546,21 @@
      
      selectById.setStatus(MemberCoinWithdrawEntity.IS_STATUS_Y);
      memberCoinWithdrawMapper.updateById(selectById);
      if ("TRC20".equals(selectById.getLabel())) {
         Thread thread = new Thread(new Runnable() {
            @Override
            public void run() {
               log.info("远程调用TRC执行:{}", selectById.getId());
               String orderNo = generateOrderNo(memberId);
               TRC20ApiUtils.coinApply(orderNo, memberId.toString(), selectById.getSymbol(), selectById.getAmount().toPlainString(), selectById.getAddress());
               selectById.setTag(orderNo);
               memberCoinWithdrawMapper.updateById(selectById);
            }
         });
         thread.start();
      }
      MemberEntity memberEntity = memberMapper.selectById(memberId);
      String phone = memberEntity.getPhone();
      //String email = memberEntity.getEmail();
@@ -579,6 +600,29 @@
         return new FebsResponse().success();
   }
   public String generateOrderNo(Long mid) {
      StringBuilder orderNo = new StringBuilder();
      String date = DateUtil.format(new Date(), "yyyyMMdd");
      orderNo.append(date);
      orderNo.append(mid);
      orderNo.append(RandomUtil.randomNumbers(2));
      Object countObj = redisUtils.get(date);
      if (countObj == null) {
         countObj = 0;
      }
      int count = (int) countObj;
      count++;
      redisUtils.set(date, count, 24 * 60 * 60);
      int size = 4;
      for (int i = 0; i < size - String.valueOf(count).length(); i++) {
         orderNo.append("0");
      }
      orderNo.append(count);
      return orderNo.toString();
   }
   @Override
   @Transactional(rollbackFor = Exception.class)
   public FebsResponse memberWithdrawCoinCancel(@NotNull(message = "{required}") Long id) {