1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- package com.iamberry.rst.controllers.pts;
- import com.iamberry.rst.core.order.Order;
- import com.iamberry.rst.core.order.RentType;
- import com.iamberry.rst.core.page.PagedResult;
- import com.iamberry.rst.core.pts.PtsMachine;
- import com.iamberry.rst.faces.pts.*;
- import org.apache.commons.lang.StringUtils;
- import org.apache.shiro.authz.annotation.RequiresPermissions;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.stereotype.Controller;
- import org.springframework.web.bind.annotation.RequestMapping;
- import org.springframework.web.bind.annotation.RequestParam;
- import org.springframework.web.servlet.ModelAndView;
- import java.util.List;
- @Controller
- @RequestMapping("/admin/mcahine")
- public class AdminMachineController {
- @Autowired
- private MachineService machineService;
-
- @RequiresPermissions("machine:select_all:machine")
- @RequestMapping("/_machine_list")
- public ModelAndView listOrder(
- @RequestParam(value= "pageSize",defaultValue= "10" ,required=false) Integer pageSize,
- @RequestParam(value = "pageNO", defaultValue = "1",required=false) Integer pageNO,
- @RequestParam(value = "totalNum", defaultValue = "0",required=false) Integer totalNum,
- PtsMachine ptsMachine){
- ModelAndView mv = new ModelAndView("machine/machine_list");
- PagedResult<PtsMachine> pagedResult = machineService.listMachine(pageNO, pageSize, ptsMachine, totalNum == 0);
- if(totalNum != 0) {
- pagedResult.setTotal(totalNum);
- pagedResult.setPages((int) Math.ceil((double)totalNum/pageSize));
- }
- StringBuilder sb = new StringBuilder("/admin/mcahine/_machine_list?pageSize=" + pageSize);
- if (StringUtils.isNotEmpty(ptsMachine.getMachineBarcode())) {
- sb.append("&machineBarcode=");
- sb.append(ptsMachine.getMachineBarcode());
- mv.addObject("machineBarcode",ptsMachine.getMachineBarcode());
- }
- if (ptsMachine.getMachineIsPrint() != null && ptsMachine.getMachineIsPrint() != -1) {
- sb.append("&machineIsPrint=" );
- sb.append(ptsMachine.getMachineIsPrint());
- mv.addObject("machineIsPrint",ptsMachine.getMachineIsPrint());
- }
- if (ptsMachine.getMachineProcessState() != null && ptsMachine.getMachineProcessState() != -1) {
- sb.append("&machineProcessState=" );
- sb.append(ptsMachine.getMachineProcessState());
- mv.addObject("machineProcessState",ptsMachine.getMachineProcessState());
- }
- sb.append("&totalNum=");
- sb.append(totalNum == 0 ? pagedResult.getTotal() : totalNum);
- sb.append("&pageNO=");
- mv.addObject("page", pagedResult);
- mv.addObject("url", sb.toString());
- return mv;
- }
- }
|