/** * 后台订单的筛选地址 * * @param orderQuery * @param response * @throws IOException */ @RequestMapping(value = "/order/search") public void searchOrder(OrderQuery orderQuery, HttpServletResponse response) throws IOException { List<OrderDetail> list = new ArrayList<OrderDetail>(); Page<Order> orderPage = tradeCenterBossClient.searchOrderByQuery(orderQuery); for (Order order : orderPage.getResult()) { OrderDetail orderDetail = new OrderDetail(); orderDetail.setUserId(order.getUserId()); orderDetail.setUserName(order.getUserName()); orderDetail.setOrderId(order.getId()); orderDetail.setOrderNo(order.getOrderNo()); orderDetail.setAccountType(order.getAccountType()); if (order.getOrderState() == OrderState.Success) { orderDetail.setEndDate( DateUtils.formatDate(order.getEndDate(), DateUtils.DateFormatType.DATE_FORMAT_STR)); } orderDetail.setStartDate( DateUtils.formatDate(order.getCreateDate(), DateUtils.DateFormatType.DATE_FORMAT_STR)); orderDetail.setInvoice(order.getInvoiceInfo().isInvoice()); orderDetail.setOrderState(order.getOrderState().toString()); orderDetail.setOrderStateDesc(order.getOrderState().serviceDesc()); Logistics logistics = tradeCenterBossClient.queryLogisticsByOrderId(order.getId()); orderDetail.setGoodToUserName(logistics.getName()); list.add(orderDetail); } new JsonResult(true) .addData("totalCount", orderPage.getTotalCount()) .addData("result", list) .toJson(response); }
@Override public Page<ProductStorage> queryProductStorageByPage(int customerId, Page<ProductStorage> page) { Map param = new HashMap(); param.put("customerId", customerId); param.put("start", page.getPageFirst()); param.put("limit", page.getPageSize()); List<ProductStorage> queryProductStorageByPage = getSqlMapClientTemplate().queryForList("queryProductStorageByPage", param); page.setResult(queryProductStorageByPage); page.setTotalCount( (Integer) getSqlMapClientTemplate().queryForObject("selectCountForProductStorage", customerId)); return page; }
/** * 带状态的商品列表 * * @param start * @param limit * @param online * @param response * @throws IOException */ @RequestMapping(value = "/product/list/status") public void productOnlineStatusList( @RequestParam int start, @RequestParam int limit, boolean online, HttpServletResponse response) throws IOException { Page<Product> productPage = productService.queryProductsByOnlineStatus( online, new Page<Product>(start / limit + 1, limit)); List<ProductModel> productGrid = createProductGrid(productPage.getResult()); new JsonResult(true) .addData("totalCount", productPage.getTotalCount()) .addData("result", productGrid) .toJson(response); }
/** * 读取产品列表 * * @param productQuery * @return */ @RequestMapping(value = "/product/list") public void productList(ProductQuery productQuery, HttpServletResponse response) throws IOException { List<Product> productList = new ArrayList<Product>(); int total = 0; if (productQuery.isProductId()) { // 如果有ID筛选 Product product = productService.getProductById(NumberUtils.toInt(productQuery.getSearch())); if (product != null) { productList.add(product); total = 1; } } else if (productQuery.getSearch().length() > 0) { // 模糊查询 Page<Product> page; page = productService.queryProductByFuzzyPage( productQuery.getSearch(), productQuery.getPageNo(), productQuery.getLimit()); productList = page.getResult(); total = page.getTotalCount(); } else { Page<Product> page; if (productQuery.getCategoryId() > 0) { page = productService.queryProductsByCategoryIdByPage( productQuery.getCategoryId(), productQuery.getPageNo(), productQuery.getLimit()); } else if (productQuery.getCustomerId() > 0) { page = productService.queryProductsByCustomerIdByPage( productQuery.getCustomerId(), productQuery.getPageNo(), productQuery.getLimit()); } else if (productQuery.getBrandId() > 0) { page = productService.queryProductsByBrandIdByPage( productQuery.getBrandId(), productQuery.getPageNo(), productQuery.getLimit()); } else if (productQuery.getStoreId() > 0) { page = productService.queryProductsByStoreIdByPage( productQuery.getStoreId(), productQuery.getPageNo(), productQuery.getLimit()); } else { page = productService.queryAllProductsByPage( productQuery.getPageNo(), productQuery.getLimit()); } productList = page.getResult(); total = page.getTotalCount(); } List<ProductModel> productGrid = createProductGrid(productList); new JsonResult(true) .addData("totalCount", total) .addData("result", productGrid) .toJson(response); }