Ejemplo n.º 1
0
 public void ProcessTableTList(List<TableT> list) {
   rows.clear();
   for (Iterator it = list.iterator(); it.hasNext(); ) {
     TableT tt = (TableT) it.next();
     // if("0".equals(tt.get))
     if ("0".equals(tt.getTablestate())) {
       tt.setTablestate("<div style='background:green;height:10px'>空</div>");
     } else {
       tt.setTablestate("<div style='background:red;height:10px'>使用中</div>");
     }
     Map<String, Object> cellMap = new HashMap<String, Object>();
     cellMap.put("id", tt.getTableid());
     cellMap.put(
         "cell",
         new Object[] {
           tt.getTableNumber(),
           tt.getRoomName(),
           tt.getFloor(),
           tt.getTablestate(),
           BaseTools.formateDbDate(tt.getCreatetime()),
           tt.getCreatorid(),
           tt.getNop(),
           tt.getRnop(),
           tt.getNote(),
           tt.getAndroidDevicesCount()
         });
     rows.add(cellMap);
   }
 }
 /**
  * 查询餐桌信息反馈给手机端
  *
  * @throws IOException
  */
 @Action(value = "findAllTableTforAndroid")
 public void findAllTableTforAndroid() throws IOException {
   int currentPage = page;
   int lineSize = 20;
   List<TableT> list = this.getTableTService().findAllTableT(currentPage, lineSize);
   StringBuilder json = new StringBuilder();
   for (Iterator it = list.iterator(); it.hasNext(); ) {
     TableT t = (TableT) it.next();
     json.append("{");
     json.append("\"tableid\":\"").append(t.getTableid()).append("\",");
     json.append("\"tableNumber\":\"").append(t.getTableNumber()).append("\",");
     json.append("\"roomName\":\"").append(t.getRoomName()).append("\",");
     json.append("\"androidDevicesCount\":\"").append(t.getAndroidDevicesCount()).append("\",");
     json.append("\"note\":\"").append(t.getNote()).append("\",");
     json.append("\"createtime\":\"")
         .append(BaseTools.formateDbDate(t.getCreatetime()))
         .append("\",");
     json.append("\"nop\":\"").append(t.getNop()).append("\",");
     json.append("\"tablestate\":\"").append(t.getTablestate()).append("\",");
     json.append("\"floor\":\"").append(t.getFloor()).append("\",");
     json.append("\"rnop\":\"").append(t.getRnop()).append("\"");
     json.append("}").append("--");
   }
   json.deleteCharAt(json.length() - 1);
   this.setResponsejsonstr(json.toString());
   response.setContentType("text/html");
   response.setCharacterEncoding("utf-8");
   PrintWriter out = response.getWriter();
   out.write(this.getResponsejsonstr());
   out.flush();
   out.close();
 }