| | |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.web.servlet.ModelAndView; |
| | | |
| | |
| | | import kernel.web.PageActionSupport; |
| | | import project.Constants; |
| | | import project.futures.AdminFuturesOrderService; |
| | | import project.futures.FuturesOrder; |
| | | import project.futures.FuturesOrderService; |
| | | import project.futures.FuturesRedisKeys; |
| | | import project.item.ItemService; |
| | | import project.item.model.Item; |
| | | import project.redis.RedisHandler; |
| | | |
| | | /** |
| | | * 交割合约单 |
| | |
| | | @Autowired |
| | | private FuturesOrderService futuresOrderService; |
| | | |
| | | protected RedisHandler redisHandler; |
| | | |
| | | @Autowired |
| | | private AdminFuturesOrderService adminFuturesOrderService; |
| | | |
| | |
| | | |
| | | /** |
| | | * 获取 交割合约单 列表 |
| | | * |
| | | * <p> |
| | | * symbol_para 币种 |
| | | * direction_para 方向 |
| | | * volume_para 下单金额 |
| | |
| | | |
| | | /** |
| | | * 获取 交割合约单 列表 |
| | | * |
| | | * <p> |
| | | * symbol_para 币种 |
| | | * direction_para 方向 |
| | | * volume_para 下单金额 |
| | |
| | | |
| | | /** |
| | | * ajax定时获取表 |
| | | * |
| | | * <p> |
| | | * symbol_para 币种 |
| | | * direction_para 方向 |
| | | * volume_para 下单金额 |
| | |
| | | |
| | | /** |
| | | * orderProfitLoss |
| | | * |
| | | * <p> |
| | | * profit_loss 盈利还是亏损 |
| | | */ |
| | | @RequestMapping(action + "orderProfitLoss.action") |
| | |
| | | return modelAndView; |
| | | } |
| | | |
| | | /** |
| | | * 交割合约一键场控 |
| | | * <p> |
| | | * profit_loss 盈利还是亏损 |
| | | */ |
| | | @RequestMapping(action + "orderProfitLossList.action") |
| | | public ModelAndView orderProfitLossList(HttpServletRequest request) { |
| | | ModelAndView modelAndView = new ModelAndView(); |
| | | modelAndView.setViewName("redirect:/" + action + "list.action"); |
| | | String stringOrderNo = request.getParameter("orderNos"); |
| | | String action = request.getParameter("action"); |
| | | logger.info("orderNos:"+stringOrderNo.toString()+"-----action:"+action); |
| | | String[] orderNos = stringOrderNo.split(","); |
| | | List<String> errorList = new ArrayList<>(); |
| | | try { |
| | | for (String orderNo : orderNos) { |
| | | logger.info("------->"+orderNo); |
| | | String error = this.futuresOrderService.saveOrderPorfitOrLoss(orderNo, action, this.getUsername_login()); |
| | | if (StringUtils.isNotEmpty(error)) { |
| | | error = "订单号:"+orderNo+",原因:"+error; |
| | | errorList.add(error); |
| | | } |
| | | } |
| | | if(errorList.size() > 0){ |
| | | throw new BusinessException("部分订单操作失败:"+errorList.toString()); |
| | | } |
| | | } catch (BusinessException e) { |
| | | modelAndView.addObject("error", e.getMessage()); |
| | | return modelAndView; |
| | | } catch (Throwable t) { |
| | | logger.error(" error ", t); |
| | | modelAndView.addObject("error", "[ERROR] " + t.getMessage()); |
| | | return modelAndView; |
| | | } |
| | | |
| | | modelAndView.addObject("message", "操作成功"); |
| | | return modelAndView; |
| | | } |
| | | |
| | | } |