xiaoyong931011
2021-01-29 c8becdd9554e47ab975cebee20439082b9c34df1
src/main/java/com/xcong/excoin/modules/coin/service/impl/CoinServiceImpl.java
@@ -7,6 +7,7 @@
import java.util.Map;
import javax.annotation.Resource;
import javax.validation.Valid;
import com.xcong.excoin.modules.platform.entity.PlatformCnyUsdtExchangeEntity;
import org.springframework.stereotype.Service;
@@ -23,8 +24,10 @@
import com.xcong.excoin.modules.coin.entity.MemberAccountMoneyChange;
import com.xcong.excoin.modules.coin.entity.OrderCoinsDealEntity;
import com.xcong.excoin.modules.coin.mapper.MemberAccountMoneyChangeMapper;
import com.xcong.excoin.modules.coin.parameter.dto.CoinInListDto;
import com.xcong.excoin.modules.coin.parameter.dto.RecordsPageDto;
import com.xcong.excoin.modules.coin.parameter.vo.AllWalletCoinVo;
import com.xcong.excoin.modules.coin.parameter.vo.CoinInListVo;
import com.xcong.excoin.modules.coin.parameter.vo.ContractSymbolListVo;
import com.xcong.excoin.modules.coin.parameter.vo.MemberAccountMoneyChangeInfoVo;
import com.xcong.excoin.modules.coin.parameter.vo.MemberWalletAgentInfoVo;
@@ -32,10 +35,14 @@
import com.xcong.excoin.modules.coin.parameter.vo.MemberWalletCoinVo;
import com.xcong.excoin.modules.coin.parameter.vo.MemberWalletContractInfoVo;
import com.xcong.excoin.modules.coin.service.CoinService;
import com.xcong.excoin.modules.member.dao.MemberCoinChargeDao;
import com.xcong.excoin.modules.member.dao.MemberCoinWithdrawDao;
import com.xcong.excoin.modules.member.dao.MemberDao;
import com.xcong.excoin.modules.member.dao.MemberWalletAgentDao;
import com.xcong.excoin.modules.member.dao.MemberWalletCoinDao;
import com.xcong.excoin.modules.member.dao.MemberWalletContractDao;
import com.xcong.excoin.modules.member.entity.MemberCoinChargeEntity;
import com.xcong.excoin.modules.member.entity.MemberCoinWithdrawEntity;
import com.xcong.excoin.modules.member.entity.MemberEntity;
import com.xcong.excoin.modules.member.entity.MemberWalletAgentEntity;
import com.xcong.excoin.modules.member.entity.MemberWalletCoinEntity;
@@ -49,6 +56,7 @@
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import jnr.ffi.Struct.int16_t;
@Service
public class CoinServiceImpl extends ServiceImpl<MemberWalletCoinDao, MemberWalletCoinEntity> implements CoinService {
@@ -67,6 +75,10 @@
    MemberWalletAgentDao memberWalletAgentDao;
    @Resource
    MemberDao memberDao;
    @Resource
    MemberCoinChargeDao memberCoinChargeDao;
    @Resource
    MemberCoinWithdrawDao memberCoinWithdrawDao;
    @Resource
    RedisUtils redisUtils;
@@ -870,6 +882,8 @@
        String symbolIns = symbolIn+"/USDT";
        ThreadPoolUtils.sendWholeForceClosingPrice(symbolIns, memberEntity);
        
        ThreadPoolUtils.sendWholePrice(memberId);
        //添加币币资金划转历史记录
        MemberAccountMoneyChange memberAccountRecord = new MemberAccountMoneyChange();
        memberAccountRecord.setContent("转出至合约"+symbolIn+"账户");
@@ -886,6 +900,124 @@
        
        return Result.ok(MessageSourceUtils.getString("member_service_0006"));
   }
   @Override
   public Result coinInList(@Valid CoinInListDto coinInListDto) {
      //获取用户ID
        Long memberId = LoginUserUtils.getAppLoginUser().getId();
        int type = coinInListDto.getType();
        //充币记录
        if(type == 1) {
           Page<MemberCoinChargeEntity> page = new Page<>(coinInListDto.getPageNum(), coinInListDto.getPageSize());
           MemberCoinChargeEntity memberCoinChargeEntity = new MemberCoinChargeEntity();
           memberCoinChargeEntity.setMemberId(memberId);
          IPage<MemberCoinChargeEntity> memberCoinCharge = memberCoinChargeDao.findMemberCoinChargeInPage(page, memberCoinChargeEntity);
          List<MemberCoinChargeEntity> records = memberCoinCharge.getRecords();
          Page<CoinInListVo> responsePage = new Page<>(coinInListDto.getPageNum(), coinInListDto.getPageSize());
          if(CollUtil.isNotEmpty(records)) {
             ArrayList<CoinInListVo> arrayList = new ArrayList<>();
             for(MemberCoinChargeEntity memberCoinChargeEntitys : records) {
                CoinInListVo coinInListVo = new CoinInListVo();
                coinInListVo.setSymbol(memberCoinChargeEntitys.getSymbol());
                coinInListVo.setAmount(memberCoinChargeEntitys.getAmount());
                coinInListVo.setContent("充币");
                coinInListVo.setStatus(memberCoinChargeEntitys.getStatus());
                coinInListVo.setUpdateTime(memberCoinChargeEntitys.getUpdateTime());
                arrayList.add(coinInListVo);
             }
             responsePage.setRecords(arrayList);
          }
          return Result.ok(responsePage);
        }
        //提币记录
        if(type == 2) {
           Page<MemberCoinWithdrawEntity> page = new Page<>(coinInListDto.getPageNum(), coinInListDto.getPageSize());
           MemberCoinWithdrawEntity memberCoinWithdrawEntity = new MemberCoinWithdrawEntity();
           memberCoinWithdrawEntity.setMemberId(memberId);
          IPage<MemberCoinWithdrawEntity> memberCoinWithdraw = memberCoinWithdrawDao.findMemberCoinWithdrawInPage(page, memberCoinWithdrawEntity);
          List<MemberCoinWithdrawEntity> records = memberCoinWithdraw.getRecords();
          Page<CoinInListVo> responsePage = new Page<>(coinInListDto.getPageNum(), coinInListDto.getPageSize());
          if(CollUtil.isNotEmpty(records)) {
             ArrayList<CoinInListVo> arrayList = new ArrayList<>();
             for(MemberCoinWithdrawEntity memberCoinWithdrawEntitys : records) {
                CoinInListVo coinInListVo = new CoinInListVo();
                coinInListVo.setSymbol(memberCoinWithdrawEntitys.getSymbol());
                coinInListVo.setAmount(memberCoinWithdrawEntitys.getAmount());
                coinInListVo.setContent("提币");
                int status = memberCoinWithdrawEntitys.getStatus();
                int statusOut = 0;
                if(status == 1) {
                   statusOut = 0;
                }
                if(status == 2) {
                   statusOut = 1;
                }
                if(status == 3) {
                   statusOut = 2;
                }
                coinInListVo.setStatus(statusOut);
                coinInListVo.setUpdateTime(memberCoinWithdrawEntitys.getUpdateTime());
                coinInListVo.setIsInside(memberCoinWithdrawEntitys.getIsInside());
                arrayList.add(coinInListVo);
             }
             responsePage.setRecords(arrayList);
          }
          return Result.ok(responsePage);
        }
        //划转记录
        if(type == 3) {
           Page<MemberAccountMoneyChange> page = new Page<>(coinInListDto.getPageNum(), coinInListDto.getPageSize());
           MemberAccountMoneyChange memberAccountMoneyChange = new MemberAccountMoneyChange();
           memberAccountMoneyChange.setMemberId(memberId);
           IPage<MemberAccountMoneyChange> list = memberAccountMoneyChangeDao.coinInList(page, memberAccountMoneyChange);
           List<MemberAccountMoneyChange> records = list.getRecords();
           Page<CoinInListVo> responsePage = new Page<>(coinInListDto.getPageNum(), coinInListDto.getPageSize());
          if(CollUtil.isNotEmpty(records)) {
             ArrayList<CoinInListVo> arrayList = new ArrayList<>();
             for(MemberAccountMoneyChange memberAccountMoneyChanges : records) {
                CoinInListVo coinInListVo = new CoinInListVo();
                coinInListVo.setSymbol(memberAccountMoneyChanges.getSymbol());
                coinInListVo.setAmount(memberAccountMoneyChanges.getAmount());
                coinInListVo.setContent(memberAccountMoneyChanges.getContent());
                coinInListVo.setStatus(memberAccountMoneyChanges.getStatus());
                coinInListVo.setUpdateTime(memberAccountMoneyChanges.getUpdateTime());
                arrayList.add(coinInListVo);
             }
             responsePage.setRecords(arrayList);
          }
          return Result.ok(responsePage);
        }
        //其他记录
        if(type == 4) {
           Page<OrderCoinsDealEntity> page = new Page<>(coinInListDto.getPageNum(), coinInListDto.getPageSize());
           MemberAccountMoneyChange memberAccountMoneyChange = new MemberAccountMoneyChange();
           memberAccountMoneyChange.setMemberId(memberId);
           IPage<MemberAccountMoneyChange> list = memberAccountMoneyChangeDao.selectWalletAgentIntoRecordsByMemIdTypeSymbol(page, memberAccountMoneyChange);
           List<MemberAccountMoneyChange> records = list.getRecords();
           Page<CoinInListVo> responsePage = new Page<>(coinInListDto.getPageNum(), coinInListDto.getPageSize());
          if(CollUtil.isNotEmpty(records)) {
             ArrayList<CoinInListVo> arrayList = new ArrayList<>();
             for(MemberAccountMoneyChange memberAccountMoneyChanges : records) {
                CoinInListVo coinInListVo = new CoinInListVo();
                coinInListVo.setSymbol(memberAccountMoneyChanges.getSymbol());
                coinInListVo.setAmount(memberAccountMoneyChanges.getAmount());
                coinInListVo.setContent(memberAccountMoneyChanges.getContent());
                coinInListVo.setStatus(memberAccountMoneyChanges.getStatus());
                coinInListVo.setUpdateTime(memberAccountMoneyChanges.getUpdateTime());
                arrayList.add(coinInListVo);
             }
             responsePage.setRecords(arrayList);
          }
          return Result.ok(responsePage);
        }
        return Result.fail(MessageSourceUtils.getString("member_controller_0005"));
    }