package project.web.admin;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import kernel.bo.RecordObjectMapper;
import kernel.web.ApplicationUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
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.exception.BusinessException;
import kernel.util.JsonUtils;
import kernel.util.StringUtils;
import kernel.web.Page;
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;
import project.wallet.Wallet;
/**
* 交割合约单
*/
@RestController
public class AdminFuturesOrderController extends PageActionSupport {
@Autowired
private ItemService itemService;
@Autowired
private FuturesOrderService futuresOrderService;
protected RedisHandler redisHandler;
@Autowired
private AdminFuturesOrderService adminFuturesOrderService;
private final String action = "normal/adminFuturesOrderAction!";
private Logger logger = LoggerFactory.getLogger(AdminFuturesOrderController.class);
/**
* 获取 交割合约单 列表
*
* symbol_para 币种
* direction_para 方向
* volume_para 下单金额
* symbol_map 上线币种
*/
@RequestMapping(action + "list.action")
public ModelAndView list(HttpServletRequest request) {
String pageNoStr = request.getParameter("pageNo");
String message = request.getParameter("message");
String error = request.getParameter("error");
String status_para = request.getParameter("status_para");
String rolename_para = request.getParameter("rolename_para");
String name_para = request.getParameter("name_para");
String order_no_para = request.getParameter("order_no_para");
String symbol_para = request.getParameter("symbol_para");
String direction_para = request.getParameter("direction_para");
String volume_para = request.getParameter("volume_para");
ModelAndView modelAndView = new ModelAndView();
modelAndView.setViewName("futures_order_list");
Map symbol_map = new HashMap();
int pageNo = 1;
Page page = null;
int pageSize = 30;
try {
List- items = this.itemService.cacheGetAll();
for (Item item : items) {
symbol_map.put(item.getSymbol(), item.getSymbol());
}
pageNo = checkAndSetPageNo(pageNoStr);
Double volume_para_double = null;
if (StringUtils.isNullOrEmpty(volume_para)) {
volume_para_double = null;
} else {
if (!StringUtils.isDouble(volume_para)) {
throw new BusinessException("下单金额不是浮点数");
}
if (Double.valueOf(volume_para).doubleValue() < 0) {
throw new BusinessException("下单金额不能小于0");
}
volume_para_double = Double.valueOf(volume_para).doubleValue();
}
String loginPartyId = this.getLoginPartyId();
page = this.adminFuturesOrderService.pagedQuery(pageNo, pageSize, status_para,
rolename_para, loginPartyId, name_para, order_no_para, symbol_para, direction_para, volume_para_double);
List