| | |
| | | @RequestMapping(action + "close.action") |
| | | public Result<String> close(@RequestParam String order_no) { |
| | | try { |
| | | ContractOrder order = contractOrderService.findByOrderNo(order_no); |
| | | if (order != null && ContractOrder.ORDER_FOLLOW == order.getFollow()) { |
| | | return Result.failed("跟单订单不支持手动平仓,请先停止跟单"); |
| | | } |
| | | // 建议使用线程池 TODO |
| | | CloseDelayThread lockDelayThread = new CloseDelayThread(SecurityUtils.getCurrentUserId(), order_no, this.contractOrderService, false); |
| | | Thread t = new Thread(lockDelayThread); |
| | |
| | | @RequestMapping(action + "closeAll.action") |
| | | public Result<String> closeAll() { |
| | | try { |
| | | String partyId = SecurityUtils.getCurrentUserId(); |
| | | List<ContractOrder> submittedOrders = contractOrderService.findSubmitted(partyId); |
| | | if (submittedOrders != null) { |
| | | for (ContractOrder one : submittedOrders) { |
| | | if (ContractOrder.ORDER_FOLLOW == one.getFollow()) { |
| | | return Result.failed("包含跟单订单,不能手动一键平仓,请先停止跟单"); |
| | | } |
| | | } |
| | | } |
| | | CloseDelayThread lockDelayThread = new CloseDelayThread(SecurityUtils.getCurrentUserId(), "", this.contractOrderService, true); |
| | | Thread t = new Thread(lockDelayThread); |
| | | t.start(); |