gao
2020-05-22 4c0935d38fc3b8a04cbee29072ce28b8301f73f4
src/main/java/com/xcong/excoin/modules/coin/controller/CoinController.java
New file
@@ -0,0 +1,163 @@
package com.xcong.excoin.modules.coin.controller;
import java.math.BigDecimal;
import javax.annotation.Resource;
import javax.validation.Valid;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.xcong.excoin.common.response.Result;
import com.xcong.excoin.modules.coin.parameter.dto.TransferOfBalanceDto;
import com.xcong.excoin.modules.coin.service.CoinService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
@Slf4j
@Api(value = "会员资产接口", tags = "会员资产接口")
@RestController
@RequestMapping(value = "/api/coin")
public class CoinController {
   @Resource
   private CoinService coinService;
   /**
    *  获取我的币币资产信息
    * @return
    */
   @ApiOperation(value = "获取我的币币账户信息", notes = "获取我的币币账户信息")
    @GetMapping(value = "/getWalletCoin")
   public Result getWalletCoin() {
      return coinService.getWalletCoin();
   }
   /**
    *  获取币币账户某个币种信息
    * @return
    */
   @ApiOperation(value="获取币币账户某个币种信息", notes="获取币币账户某个币种信息")
   @GetMapping(value = "/getWalletCoinById")
   public Result getWalletCoinById(@RequestParam("id") Long id) {
      return coinService.getWalletCoinById(id);
   }
   /**
    * --todo
    *  获取我的合约资产信息
    * @return
    */
   @ApiOperation(value="获取我的合约账户信息", notes="获取我的合约账户信息")
   @GetMapping(value="/getWalletContractById")
   public Result getWalletContractById() {
      return coinService.getWalletContractById();
   }
   /**
    * 查询合约账户里面的资产余额
    * @return
    */
   @ApiOperation(value="查询合约账户里面的资产余额", notes="查询合约账户里面的资产余额")
   @GetMapping(value="/findWalletContractBySymbol")
   public Result findWalletContractBySymbol(String symbol) {
      return coinService.findWalletContractBySymbol(symbol);
   }
   /**
    * 查询币币账户里面的可用资产余额
    * @return
    */
   @ApiOperation(value="查询币币账户里面的可用资产余额", notes="查询币币账户里面的可用资产余额")
   @GetMapping(value="/findWalletCoinBySymbol")
   public Result findWalletCoinBysymbol(String symbol) {
      return coinService.findWalletCoinBySymbol(symbol);
   }
   /**
    * 查询代理账户里面的资产余额
    * @return
    */
   @ApiOperation(value="查询代理账户里面的资产余额", notes="查询代理账户里面的资产余额")
   @GetMapping(value="/findWalletAgentBySymbol")
   public Result findWalletAgentBySymbol() {
      return coinService.findWalletAgentBySymbol();
   }
   /**
    *  获取币币资产交易记录
    * @return
    */
   @ApiOperation(value="获取币币资产交易记录", notes="获取币币资产交易记录")
   @GetMapping(value="/getWalletCoinRecords")
   public Result  getWalletCoinRecords() {
      return coinService.getWalletCoinRecords();
   }
   /**
    *  获取合约资产交易记录
    * @return
    */
   @ApiOperation(value="获取合约资产交易记录", notes="获取合约资产交易记录")
   @GetMapping(value="/getWalletContractRecords")
   public Result getWalletContractRecords(String symbol) {
      return coinService.getWalletContractRecords(symbol);
   }
   /**
    *  获取代理资产交易记录
    * @return
    */
   @ApiOperation(value="获取代理资产交易记录", notes="获取代理资产交易记录")
   @GetMapping(value="/getWalletAgentRecords")
   public Result  getWalletAgentRecords() {
      return coinService.getWalletAgentRecords();
   }
   /**
    * 币币账户USDT划转到合约账户
    * @return
    */
   @ApiOperation(value="币币账户USDT划转到合约账户", notes="币币账户USDT划转到合约账户")
   @PostMapping(value="/coinWalletTransferToContract")
   public Result coinWalletTransferToContract(@RequestBody @Valid TransferOfBalanceDto transferOfBalanceDto) {
      BigDecimal balance = transferOfBalanceDto.getBalance();
      String symbol = transferOfBalanceDto.getSymbol();
      return coinService.coinWalletTransferToContract(balance,symbol);
   }
   /**
    * 合约账户划转到币币USDT账户
    * @return
    */
   @ApiOperation(value="合约账户划转到币币USDT账户", notes="合约账户划转到币币USDT账户")
   @PostMapping(value="/contractTransferToWalletCoin")
   public Result contractTransferToWalletCoin(@RequestBody @Valid TransferOfBalanceDto transferOfBalanceDto) {
      BigDecimal balance = transferOfBalanceDto.getBalance();
      String symbol = transferOfBalanceDto.getSymbol();
      return coinService.contractTransferToWalletCoin(balance,symbol);
   }
   /**
    * 代理账户划转到USDT账户
    * @return
    */
   @ApiOperation(value="代理账户划转到USDT账户", notes="代理账户划转到USDT账户")
   @PostMapping(value="/agentTransferToWalletCoin")
   public Result  agentTransferToWalletCoin(@RequestBody @Valid TransferOfBalanceDto transferOfBalanceDto) {
      BigDecimal balance = transferOfBalanceDto.getBalance();
      Integer transfertype = transferOfBalanceDto.getTransfertype();
      return coinService.agentTransferToWalletCoin(balance,transfertype);
   }
}