| | |
| | | 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.RequestMapping;
|
| | | import org.springframework.web.bind.annotation.RestController;
|
| | | import com.alibaba.fastjson.JSONObject;
|
| | | import com.xcong.excoin.common.annotations.SubmitRepeat;
|
| | | import com.xcong.excoin.modules.coin.entity.OrderCoinsEntity;
|
| | | import com.xcong.excoin.modules.symbols.constants.SymbolsConstats;
|
| | | import com.xcong.excoin.utils.RedisUtils;
|
| | | import org.springframework.beans.factory.annotation.Autowired;
|
| | | import org.springframework.validation.annotation.Validated;
|
| | | import org.springframework.web.bind.annotation.*;
|
| | |
|
| | | import com.xcong.excoin.common.response.Result;
|
| | | import com.xcong.excoin.modules.coin.parameter.dto.CancelEntrustWalletCoinOrderDto;
|
| | | import com.xcong.excoin.modules.coin.parameter.dto.FindAllWalletCoinOrderDto;
|
| | | import com.xcong.excoin.modules.coin.parameter.dto.FindCollectDto;
|
| | | import com.xcong.excoin.modules.coin.parameter.dto.SubmitSalesWalletCoinOrderDto;
|
| | | import com.xcong.excoin.modules.coin.parameter.vo.FindCollectListVo;
|
| | | import com.xcong.excoin.modules.coin.parameter.vo.MemberSelectSymbolsVo;
|
| | | import com.xcong.excoin.modules.coin.parameter.vo.OrderWalletCoinDealListVo;
|
| | | import com.xcong.excoin.modules.coin.parameter.vo.OrderWalletCoinDealVo;
|
| | | import com.xcong.excoin.modules.coin.parameter.vo.OrderWalletCoinVo;
|
| | | import com.xcong.excoin.modules.coin.parameter.vo.OrderWalletCoinListVo;
|
| | | import com.xcong.excoin.modules.coin.parameter.vo.TransactionPageOfWalletCoinVo;
|
| | | import com.xcong.excoin.modules.coin.service.OrderCoinService;
|
| | |
|
| | |
| | | import io.swagger.annotations.ApiImplicitParam;
|
| | | import io.swagger.annotations.ApiImplicitParams;
|
| | | import io.swagger.annotations.ApiOperation;
|
| | | import io.swagger.annotations.ApiParam;
|
| | | import io.swagger.annotations.ApiResponse;
|
| | | import io.swagger.annotations.ApiResponses;
|
| | | import lombok.extern.slf4j.Slf4j;
|
| | |
| | | @Api(value = "币币交易接口", tags = "币币交易接口")
|
| | | @RestController
|
| | | @RequestMapping(value = "/api/orderCoin")
|
| | | @CrossOrigin("*")
|
| | | public class OrderCoinController {
|
| | |
|
| | | @Resource
|
| | | OrderCoinService orderCoinService;
|
| | | |
| | |
|
| | | @Autowired
|
| | | private RedisUtils redisUtils;
|
| | | /**
|
| | | * 进入交易页面
|
| | | * @return
|
| | |
| | | @ApiOperation(value = "进入交易页面", notes = "进入交易页面")
|
| | | @ApiResponses({@ApiResponse( code = 200, message = "success", response = TransactionPageOfWalletCoinVo.class)})
|
| | | @ApiImplicitParams({
|
| | | @ApiImplicitParam(name = "symbol", value = "币种", required = true, dataType = "String", paramType="query"),
|
| | | @ApiImplicitParam(name = "type", value = "买入卖出类型1:买入,2:卖出", required = true, dataType = "String", paramType="query")
|
| | | @ApiImplicitParam(name = "symbol", value = "币种", required = true, dataType = "String", paramType="query")
|
| | | })
|
| | | @GetMapping(value = "/enterTransactionPageOfWalletCoin")
|
| | | public Result enterTransactionPageOfWalletCoin(String symbol,String type) {
|
| | | return orderCoinService.enterTransactionPageOfWalletCoin(symbol,type);
|
| | | public Result enterTransactionPageOfWalletCoin(String symbol) {
|
| | | return orderCoinService.enterTransactionPageOfWalletCoin(symbol);
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | */
|
| | | @ApiOperation(value = "提交买卖订单", notes = "提交买卖订单")
|
| | | @PostMapping(value="/submitSalesWalletCoinOrder")
|
| | | @SubmitRepeat
|
| | | public Result submitSalesWalletCoinOrder(@RequestBody @Valid SubmitSalesWalletCoinOrderDto submitSalesWalletCoinOrderDto) {
|
| | | log.debug("买卖单参数[{}]", JSONObject.toJSONString(submitSalesWalletCoinOrderDto));
|
| | | String status = redisUtils.getString("bea_order_status");
|
| | | if (!"1".equals(status)) {
|
| | | return Result.fail("暂未开放");
|
| | | }
|
| | | String symbol = submitSalesWalletCoinOrderDto.getSymbol();
|
| | | Integer type = submitSalesWalletCoinOrderDto.getType();
|
| | | Integer tradeType = submitSalesWalletCoinOrderDto.getTradeType();
|
| | | BigDecimal price = submitSalesWalletCoinOrderDto.getPrice();
|
| | | BigDecimal amount = submitSalesWalletCoinOrderDto.getAmount();
|
| | | return orderCoinService.submitSalesWalletCoinOrder(symbol,type,tradeType,price,amount);
|
| | | if(SymbolsConstats.EXCHANGE_SYMBOLS.contains(symbol)){
|
| | | return orderCoinService.submitSalesWalletCoinOrderWithMatch(symbol,type,tradeType,price,amount,submitSalesWalletCoinOrderDto.getEntrustAmount());
|
| | |
|
| | | }else{
|
| | | return orderCoinService.submitSalesWalletCoinOrder(symbol,type,tradeType,price,amount,submitSalesWalletCoinOrderDto.getEntrustAmount());
|
| | | }
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | * @return
|
| | | */
|
| | | @ApiOperation(value = "获取委托单数据", notes = "获取委托单数据")
|
| | | @ApiResponses({@ApiResponse( code = 200, message = "success", response = OrderWalletCoinVo.class)})
|
| | | @ApiResponses({@ApiResponse( code = 200, message = "success", response = OrderWalletCoinListVo.class)})
|
| | | @ApiImplicitParams({
|
| | | @ApiImplicitParam(name = "symbol", value = "币种", required = true, dataType = "String", paramType="query"),
|
| | | @ApiImplicitParam(name = "status", value = "状态 1:委托中2:撤单3:已成交", required = true, dataType = "Integer", paramType="query")
|
| | | @ApiImplicitParam(name = "status", value = "状态 1:委托中2:撤单3:已成交", required = true, dataType = "int", paramType="query")
|
| | | })
|
| | | @GetMapping(value = "/getEntrustWalletCoinOrder")
|
| | | public Result getEntrustWalletCoinOrder(String symbol,Integer status) {
|
| | |
| | | */
|
| | | @ApiOperation(value = "撤销委托订单", notes = "撤销委托订单")
|
| | | @PostMapping(value="/cancelEntrustWalletCoinOrder")
|
| | | @SubmitRepeat
|
| | | public Result cancelEntrustWalletCoinOrder(@RequestBody @Valid CancelEntrustWalletCoinOrderDto cancelEntrustWalletCoinOrderDto) {
|
| | | String orderNo = cancelEntrustWalletCoinOrderDto.getOrderNo();
|
| | | return orderCoinService.cancelEntrustWalletCoinOrder(orderNo);
|
| | | String orderId = cancelEntrustWalletCoinOrderDto.getOrderId();
|
| | | // 根据不同币种
|
| | | return orderCoinService.cancelEntrustWalletCoinOrder(orderId);
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | * @return
|
| | | */
|
| | | @ApiOperation(value = "获取币币交易历史订单信息", notes = "获取币币交易历史订单信息")
|
| | | @ApiResponses({@ApiResponse( code = 200, message = "success", response = OrderWalletCoinDealListVo.class)})
|
| | | @GetMapping(value = "/findAllWalletCoinOrder")
|
| | | public Result findAllWalletCoinOrder() {
|
| | | return orderCoinService.findAllWalletCoinOrder();
|
| | | @ApiResponses({@ApiResponse( code = 200, message = "success", response = OrderWalletCoinDealVo.class)})
|
| | | @PostMapping(value="/findAllWalletCoinOrder")
|
| | | public Result findAllWalletCoinOrder(@RequestBody @Validated FindAllWalletCoinOrderDto findAllWalletCoinOrderDto) {
|
| | | return orderCoinService.findAllWalletCoinOrder(findAllWalletCoinOrderDto);
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | */
|
| | | @ApiOperation(value = "币币是否自选", notes = "币币是否自选")
|
| | | @ApiResponses({@ApiResponse( code = 200, message = "success", response = MemberSelectSymbolsVo.class)})
|
| | | @PostMapping(value="/checkIsCollect")
|
| | | public Result checkIsCollect(@ApiParam(name="symbol",value="币种",required=true)String symbol) {
|
| | | @ApiImplicitParams({
|
| | | @ApiImplicitParam(name = "symbol", value = "币种", required = true, dataType = "String", paramType="query")
|
| | | })
|
| | | @GetMapping(value = "/checkIsCollect")
|
| | | public Result checkIsCollect(String symbol) {
|
| | | return orderCoinService.checkIsCollect(symbol);
|
| | | }
|
| | |
|
| | | /**
|
| | | * 已自选的币种
|
| | | * @return
|
| | | */
|
| | | @ApiOperation(value = "已自选的币种", notes = "已自选的币种")
|
| | | @ApiResponses({@ApiResponse( code = 200, message = "success", response = FindCollectListVo.class)})
|
| | | @GetMapping(value = "/findCollectList")
|
| | | public Result findCollectList() {
|
| | | return orderCoinService.findCollectList();
|
| | | }
|
| | | |
| | | /**
|
| | | * 币种搜索
|
| | | * @return
|
| | | */
|
| | | @ApiOperation(value = "币种搜索", notes = "币种搜索")
|
| | | @GetMapping(value = "/searchSymbolResultList")
|
| | | public Result searchSymbolResultList() {
|
| | | return orderCoinService.searchSymbolResultList();
|
| | | }
|
| | |
|
| | | /**
|
| | | * 获取币币交易历史订单信息
|
| | | * @return
|
| | | */
|
| | | @ApiOperation(value = "获取币币交易历史订单信息", notes = "获取币币交易历史订单信息")
|
| | | @ApiResponses({@ApiResponse( code = 200, message = "success", response = OrderWalletCoinDealVo.class)})
|
| | | @GetMapping(value="/deal/list")
|
| | | public Result findAllWalletCoinOrder() {
|
| | | return orderCoinService.findAllWalletCoinOrder();
|
| | | }
|
| | | }
|