|  |  |  | 
|---|
|  |  |  | package com.xcong.excoin.modules.contract.controller; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.xcong.excoin.common.response.Result; | 
|---|
|  |  |  | import io.swagger.annotations.Api; | 
|---|
|  |  |  | import io.swagger.annotations.ApiOperation; | 
|---|
|  |  |  | import com.xcong.excoin.modules.contract.parameter.dto.*; | 
|---|
|  |  |  | import com.xcong.excoin.modules.contract.parameter.vo.ContractMoneyInfoVo; | 
|---|
|  |  |  | import com.xcong.excoin.modules.contract.parameter.vo.HoldOrderListVo; | 
|---|
|  |  |  | import com.xcong.excoin.modules.contract.parameter.vo.OrderListVo; | 
|---|
|  |  |  | import com.xcong.excoin.modules.contract.service.ContractHoldOrderService; | 
|---|
|  |  |  | import com.xcong.excoin.modules.contract.service.ContractOrderService; | 
|---|
|  |  |  | import com.xcong.excoin.rabbit.producer.OrderProducer; | 
|---|
|  |  |  | import io.swagger.annotations.*; | 
|---|
|  |  |  | import lombok.extern.slf4j.Slf4j; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.GetMapping; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.PostMapping; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.RequestMapping; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.RestController; | 
|---|
|  |  |  | import org.springframework.validation.annotation.Validated; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.*; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import javax.annotation.Resource; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * @author wzy | 
|---|
|  |  |  | 
|---|
|  |  |  | @RequestMapping(value = "/api/contractOrder") | 
|---|
|  |  |  | public class ContractOrderController { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Resource | 
|---|
|  |  |  | private ContractHoldOrderService contractHoldOrderService; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Resource | 
|---|
|  |  |  | private ContractOrderService contractOrderService; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ApiOperation(value = "市价提交合约订单") | 
|---|
|  |  |  | @PostMapping(value = "/submitOrder") | 
|---|
|  |  |  | public Result submitOrder() { | 
|---|
|  |  |  | return null; | 
|---|
|  |  |  | public Result submitOrder(@RequestBody SubmitOrderDto submitOrderDto) { | 
|---|
|  |  |  | return contractHoldOrderService.submitOrder(submitOrderDto); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ApiOperation(value = "查询当前持仓订单列表") | 
|---|
|  |  |  | @ApiOperation(value = "查询当前持仓订单列表 -- 轮询") | 
|---|
|  |  |  | @ApiResponses({ | 
|---|
|  |  |  | @ApiResponse(code = 0, message = "success", response = HoldOrderListVo.class) | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | @GetMapping(value = "/findHoldOrderList") | 
|---|
|  |  |  | public Result findHoldOrderList() { | 
|---|
|  |  |  | return null; | 
|---|
|  |  |  | public Result findHoldOrderList(@ApiParam(name = "symbol", value = "币种", example = "BTC/USDT") @RequestParam(value = "symbol", required = false) String symbol) { | 
|---|
|  |  |  | return contractHoldOrderService.findHoldOrderList(symbol); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ApiOperation(value = "根据Id查询订单详情") | 
|---|
|  |  |  | @GetMapping(value = "/findOrderDetail") | 
|---|
|  |  |  | public Result findOrderDetail() { | 
|---|
|  |  |  | return null; | 
|---|
|  |  |  | @ApiOperation(value = "根据Id查询持仓订单详情") | 
|---|
|  |  |  | @GetMapping(value = "/findHoldOrderDetail") | 
|---|
|  |  |  | public Result findHoldOrderDetail(@ApiParam(name = "id", value = "持仓ID", required = true, example = "1") @RequestParam(value = "id") Long id) { | 
|---|
|  |  |  | return contractHoldOrderService.findHoldOrderDetailById(id); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ApiOperation(value = "根据Id平仓") | 
|---|
|  |  |  | @GetMapping(value = "/closingOrder") | 
|---|
|  |  |  | public Result closingOrder() { | 
|---|
|  |  |  | return null; | 
|---|
|  |  |  | public Result closingOrder(@ApiParam(name = "id", value = "持仓ID", required = true, example = "1") @RequestParam(value = "id") Long id) { | 
|---|
|  |  |  | return contractHoldOrderService.cancelHoldOrder(id); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ApiOperation(value = "一键平仓") | 
|---|
|  |  |  | @GetMapping(value = "/oneKeyClosing") | 
|---|
|  |  |  | public Result oneKeyClosing() { | 
|---|
|  |  |  | return null; | 
|---|
|  |  |  | @PostMapping(value = "/oneKeyClosing") | 
|---|
|  |  |  | public Result oneKeyClosing(@RequestBody SymbolDto symbolDto) { | 
|---|
|  |  |  | return contractHoldOrderService.cancelHoldOrderBatch(symbolDto); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ApiOperation(value = "设置止盈止损") | 
|---|
|  |  |  | @PostMapping(value = "/setTargetProfitOrLoss") | 
|---|
|  |  |  | public Result setTargetProfitOrLoss() { | 
|---|
|  |  |  | return null; | 
|---|
|  |  |  | public Result setTargetProfitOrLoss(@RequestBody @Validated ProfitOrLessDto profitOrLessDto) { | 
|---|
|  |  |  | return contractHoldOrderService.setTargetProfitOrLess(profitOrLessDto); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ApiOperation(value = "调整保证金") | 
|---|
|  |  |  | @PostMapping(value = "/tuneUpBond") | 
|---|
|  |  |  | public Result tuneUpBond() { | 
|---|
|  |  |  | return null; | 
|---|
|  |  |  | @PostMapping(value = "/changeBond") | 
|---|
|  |  |  | public Result changeBond(@RequestBody @Validated ChangeBondDto changeBondDto) { | 
|---|
|  |  |  | return contractHoldOrderService.changeBond(changeBondDto); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ApiOperation(value = "分页查询历史订单列表") | 
|---|
|  |  |  | @GetMapping(value = "/findHistoryOrderList") | 
|---|
|  |  |  | public Result findHistoryOrderList() { | 
|---|
|  |  |  | return null; | 
|---|
|  |  |  | @ApiResponses({ | 
|---|
|  |  |  | @ApiResponse(code = 0, message = "success", response = OrderListVo.class) | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | @PostMapping(value = "/findHistoryOrderList") | 
|---|
|  |  |  | public Result findHistoryOrderList(@RequestBody @Validated OrderListDto orderListDto) { | 
|---|
|  |  |  | return contractHoldOrderService.findOrderList(orderListDto); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ApiOperation(value = "获取合约页面资产信息") | 
|---|
|  |  |  | @ApiResponses({ | 
|---|
|  |  |  | @ApiResponse(code = 0, message = "success", response = ContractMoneyInfoVo.class) | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | @GetMapping(value = "/findContractMoneyInfo") | 
|---|
|  |  |  | public Result findContractMoneyInfo(@ApiParam(name = "symbol", value = "币种", required = true, example = "BTC/USDT") @RequestParam(value = "symbol") String symbol) { | 
|---|
|  |  |  | return contractHoldOrderService.findContractMoneyInfo(symbol); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ApiOperation(value = "调整杠杆") | 
|---|
|  |  |  | @PostMapping(value = "/changeLeverRate") | 
|---|
|  |  |  | public Result changeLeverRate(@RequestBody @Validated ChangeLeverRateDto changeLeverRateDto) { | 
|---|
|  |  |  | return contractHoldOrderService.changeLeverRate(changeLeverRateDto); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ApiOperation(value = "查询历史委托订单详情") | 
|---|
|  |  |  | @GetMapping(value = "/findOrderDetailById") | 
|---|
|  |  |  | public Result findOrderDetailById(@ApiParam(name = "id", value = "订单id", required = true, example = "1") @RequestParam(value = "id") Long id) { | 
|---|
|  |  |  | return contractHoldOrderService.findOrderDetailById(id); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|