package com.yeshi.fanli.controller.admin;
|
|
import java.io.PrintWriter;
|
import java.util.List;
|
|
import javax.annotation.Resource;
|
|
import org.springframework.stereotype.Controller;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMethod;
|
|
import com.yeshi.fanli.entity.admin.OrderAdmin;
|
import com.yeshi.fanli.service.inter.hongbao.HongBaoService;
|
import com.yeshi.fanli.service.inter.order.OrderService;
|
import com.yeshi.fanli.tag.PageEntity;
|
import com.yeshi.fanli.util.Constant;
|
import com.yeshi.fanli.util.GsonUtil;
|
import org.yeshi.utils.JsonUtil;
|
|
import net.sf.json.JSONObject;
|
|
@Controller
|
@RequestMapping("admin/new/api/v1/order")
|
public class OrderAdminController {
|
|
@Resource
|
private OrderService orderService;
|
|
@Resource
|
private HongBaoService hongBaoService;
|
|
@RequestMapping(value ="getOrderList",method=RequestMethod.POST)
|
public void getOrderList(int pageIndex,String key,PrintWriter out){
|
List<OrderAdmin> orderAdminList = hongBaoService.getOrderAdminList(pageIndex,key);
|
int count = orderService.getCount(key);
|
int totalPage = count % Constant.PAGE_SIZE == 0 ? count
|
/ Constant.PAGE_SIZE : count / Constant.PAGE_SIZE + 1;
|
PageEntity pe = new PageEntity(pageIndex, Constant.PAGE_SIZE, count,
|
totalPage);
|
JSONObject data = new JSONObject();
|
data.put("pe", pe);
|
data.put("orderList", JsonUtil.getSimpleGsonWithDateAndSerialization().toJson(orderAdminList));
|
out.print(JsonUtil.loadTrueResult(data));
|
}
|
}
|