xiaoyong931011
2020-05-27 cf21e298163c8ac112eec85998c6f55285247ae2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
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.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
 
import com.xcong.excoin.common.response.Result;
import com.xcong.excoin.modules.coin.parameter.dto.CancelEntrustWalletCoinOrderDto;
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.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.TransactionPageOfWalletCoinVo;
import com.xcong.excoin.modules.coin.service.OrderCoinService;
 
import io.swagger.annotations.Api;
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;
 
@Slf4j
@Api(value = "币币交易接口", tags = "币币交易接口")
@RestController
@RequestMapping(value = "/api/orderCoin")
public class OrderCoinController {
    
    @Resource
    OrderCoinService orderCoinService;
    
    /**
     * 进入交易页面
     * @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")
    })
    @GetMapping(value = "/enterTransactionPageOfWalletCoin")
    public Result enterTransactionPageOfWalletCoin(String symbol,String type) {
        return orderCoinService.enterTransactionPageOfWalletCoin(symbol,type);
    }
    
    /**
     *    提交买卖订单
     * @return
     */
    @ApiOperation(value = "提交买卖订单", notes = "提交买卖订单")
    @PostMapping(value="/submitSalesWalletCoinOrder")
    public Result submitSalesWalletCoinOrder(@RequestBody @Valid SubmitSalesWalletCoinOrderDto submitSalesWalletCoinOrderDto) {
        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);
    }
    
    /**
     * 获取委托单数据
     * @return
     */
    @ApiOperation(value = "获取委托单数据", notes = "获取委托单数据")
    @ApiResponses({@ApiResponse( code = 200, message = "success", response = OrderWalletCoinVo.class)})
    @ApiImplicitParams({
        @ApiImplicitParam(name = "symbol", value = "币种", required = true, dataType = "String", 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) {
        return orderCoinService.getEntrustWalletCoinOrder(symbol,status);
    }
    
    /**
     * 撤销委托订单
     * @return
     */
    @ApiOperation(value = "撤销委托订单", notes = "撤销委托订单")
    @PostMapping(value="/cancelEntrustWalletCoinOrder")
    public Result cancelEntrustWalletCoinOrder(@RequestBody @Valid CancelEntrustWalletCoinOrderDto cancelEntrustWalletCoinOrderDto) {
        String orderNo = cancelEntrustWalletCoinOrderDto.getOrderNo();
        return orderCoinService.cancelEntrustWalletCoinOrder(orderNo);
    }
    
    /**
     * 获取币币交易历史订单信息
     * @return
     */
    @ApiOperation(value = "获取币币交易历史订单信息", notes = "获取币币交易历史订单信息")
    @ApiResponses({@ApiResponse( code = 200, message = "success", response = OrderWalletCoinDealListVo.class)})
    @GetMapping(value = "/findAllWalletCoinOrder")
    public Result  findAllWalletCoinOrder() {
        return orderCoinService.findAllWalletCoinOrder();
    }
    
    /**
     * 获取一条币币交易历史订单信息
     * @return
     */
    @ApiOperation(value = "获取一条币币交易历史订单信息", notes = "获取一条币币交易历史订单信息")
    @ApiResponses({@ApiResponse( code = 200, message = "success", response = OrderWalletCoinDealVo.class)})
    @ApiImplicitParams({
        @ApiImplicitParam(name = "orderId", value = "订单ID", required = true, dataType = "Long", paramType="query")
    })
    @GetMapping(value = "/findWalletCoinOrder")
    public Result  findWalletCoinOrder(Long orderId) {
        return orderCoinService.findWalletCoinOrder(orderId);
    }
    
    /**
     * 币币自选|取消自选
     * @return
     */
    @ApiOperation(value = "币币自选|取消自选", notes = "币币自选|取消自选")
    @PostMapping(value="/findCollect")
    public Result  findCollect(@RequestBody @Valid FindCollectDto findCollectDto) {
        String symbol = findCollectDto.getSymbol();
        Integer type = findCollectDto.getType();
        return orderCoinService.findCollect(symbol,type);
    }
    
    /**
     * 币币是否自选
     * @return
     */
    @ApiOperation(value = "币币是否自选", notes = "币币是否自选")
    @ApiResponses({@ApiResponse( code = 200, message = "success", response = MemberSelectSymbolsVo.class)})
    @ApiImplicitParams({
        @ApiImplicitParam(name = "symbol", value = "币种", required = true, dataType = "String", paramType="query")
    })
    @GetMapping(value = "/checkIsCollect")
    public Result  checkIsCollect(String symbol) {
        return orderCoinService.checkIsCollect(symbol);
    }
    
}