yzt
2023-05-08 24e1c6a1c3d5331b5a4f1111dcbae3ef148eda1a
src/main/java/com/hxzkoa/services/ZhwService.java
@@ -1,168 +1,131 @@
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//
package com.hxzkoa.services;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;
import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import com.hxzkoa.json.tb_collector;
import java.sql.Time;
import com.hxzkoa.json.*;
import com.hxzkoa.util.Config;
import com.hxzkoa.util.ModifyConfig;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.hxzkoa.json.User;
import com.hxzkoa.json.tb_achor;
import com.hxzkoa.json.tb_anchor_nearby;
import com.hxzkoa.json.tb_collector;
import com.hxzkoa.json.tb_department;
import com.hxzkoa.json.tb_fence;
import com.hxzkoa.json.tb_gas;
import com.hxzkoa.json.tb_gas_history;
import com.hxzkoa.json.tb_gps;
import com.hxzkoa.json.tb_history_power;
import com.hxzkoa.json.tb_historyinwarning;
import com.hxzkoa.json.tb_icon;
import com.hxzkoa.json.tb_jingwei;
import com.hxzkoa.json.tb_map;
import com.hxzkoa.json.tb_message;
import com.hxzkoa.json.tb_nav;
import com.hxzkoa.json.tb_person;
import com.hxzkoa.json.tb_qihou;
import com.hxzkoa.json.tb_realinwarning;
import com.hxzkoa.json.tb_realkaoqing;
import com.hxzkoa.json.tb_realocation;
import com.hxzkoa.json.tb_realpositoin;
import com.hxzkoa.json.tb_shipin;
import com.hxzkoa.json.tb_system;
import com.hxzkoa.json.tb_tag;
import com.hxzkoa.json.tb_tagpower;
import com.hxzkoa.json.tb_tongbuanchor;
import com.hxzkoa.json.tb_track;
import com.hxzkoa.json.tb_warning;
import com.hxzkoa.json.tb_xunjianbaobiao;
import com.hxzkoa.json.tb_xunjianset;
import com.hxzkoa.util.Config;
import com.hxzkoa.util.ModifyConfig;
import org.springframework.transaction.annotation.Transactional;
@Service
public class ZhwService {
   @PersistenceContext
   private EntityManager em;
   @Autowired
   private CaozuoService cs;
   public ZhwService() {
   }
   public List<tb_map> getMap(String floor_number) {
      String sql = null;
      Query query = null;
      sql = "SELECT floor,mapname,x_Truelength,y_Truewidth,x0_length,y0_width,x_Pixel,y_Pixel FROM tb_map WHERE floor="+floor_number;
      sql = "SELECT floor,mapname,x_Truelength,y_Truewidth,x0_length,y0_width,x_Pixel,y_Pixel FROM tb_map WHERE id=" + floor_number;
      query = this.em.createNativeQuery(sql);
      List resultList = query.getResultList();
      List<tb_map> tb_mapList = new ArrayList<tb_map>();
      List<tb_map> tb_mapList = new ArrayList();
      if (resultList.size() > 0) {
         for (int i = 0; i < resultList.size(); i++) {
         for(int i = 0; i < resultList.size(); ++i) {
            tb_map map = new tb_map();
            Object[] obj = (Object[]) resultList.get(i);
            map.setFloor((String) obj[0]);
            map.setMapname((String) obj[1]);
            map.setX_Truelength((String) obj[2]);
            map.setY_Truewidth((String) obj[3]);
            map.setX0_length((String) obj[4]);
            map.setY0_width((String) obj[5]);
            map.setX_Pixel((String) obj[6]);
            map.setY_Pixel((String) obj[7]);
            Object[] obj = (Object[])((Object[])resultList.get(i));
            map.setFloor((String)obj[0]);
            map.setMapname((String)obj[1]);
            map.setX_Truelength((String)obj[2]);
            map.setY_Truewidth((String)obj[3]);
            map.setX0_length((String)obj[4]);
            map.setY0_width((String)obj[5]);
            map.setX_Pixel((String)obj[6]);
            map.setY_Pixel((String)obj[7]);
            tb_mapList.add(map);
         }
      }
      return tb_mapList;
   }
   public List<tb_person> getpersonid(String tagid) {
      String sql = null;
      Query query = null;
      sql = "SELECT p_x,p_y,p_tagid,p_addtiem FROM tb_person WHERE p_tagid="+tagid;
      sql = "SELECT p_x,p_y,p_tagid,p_addtiem FROM tb_person WHERE p_tagid=" + tagid;
      query = this.em.createNativeQuery(sql);
      List resultList = query.getResultList();
      List<tb_person> tb_mapList = new ArrayList<tb_person>();
      List<tb_person> tb_mapList = new ArrayList();
      if (resultList.size() > 0) {
         for (int i = 0; i < resultList.size(); i++) {
         for(int i = 0; i < resultList.size(); ++i) {
            tb_person map = new tb_person();
            Object[] obj = (Object[]) resultList.get(i);
            map.setP_x((String) obj[0]);
            map.setP_y((String) obj[1]);
            map.setP_tagid((String) obj[2]);
            map.setP_addtiem((String) obj[3]);
            Object[] obj = (Object[])((Object[])resultList.get(i));
            map.setP_x((String)obj[0]);
            map.setP_y((String)obj[1]);
            map.setP_tagid((String)obj[2]);
            map.setP_addtiem((String)obj[3]);
            tb_mapList.add(map);
         }
      }
      return tb_mapList;
   }
   public List<tb_gps> getgpsid(String tagid) {
      String sql = null;
      Query query = null;
      sql = "SELECT gps_weidu,gsp_jingdu,tagid,gps_haiba_gao FROM tb_gps WHERE tagid="+tagid;
      sql = "SELECT gps_weidu,gsp_jingdu,tagid,gps_haiba_gao FROM tb_gps WHERE tagid=" + tagid;
      query = this.em.createNativeQuery(sql);
      List resultList = query.getResultList();
      List<tb_gps> tb_mapList = new ArrayList<tb_gps>();
      List<tb_gps> tb_mapList = new ArrayList();
      if (resultList.size() > 0) {
         for (int i = 0; i < resultList.size(); i++) {
         for(int i = 0; i < resultList.size(); ++i) {
            tb_gps map = new tb_gps();
            Object[] obj = (Object[]) resultList.get(i);
            map.setGps_weidu((String) obj[0]);
            map.setGsp_jingdu((String) obj[1]);
            map.setTagid((String) obj[2]);
            map.setGps_haiba_gao((String) obj[3]);
            Object[] obj = (Object[])((Object[])resultList.get(i));
            map.setGps_weidu((String)obj[0]);
            map.setGsp_jingdu((String)obj[1]);
            map.setTagid((String)obj[2]);
            map.setGps_haiba_gao((String)obj[3]);
            tb_mapList.add(map);
         }
      }
      return tb_mapList;
   }
   public List<tb_map> getMap_all() {
      String sql = null;
      Query query = null;
      sql = "SELECT floor,mapname,x_Truelength,y_Truewidth,x0_length,y0_width,x_Pixel,y_Pixel FROM tb_map";
      query = this.em.createNativeQuery(sql);
      List resultList = query.getResultList();
      List<tb_map> tb_mapList = new ArrayList<tb_map>();
      List<tb_map> tb_mapList = new ArrayList();
      if (resultList.size() > 0) {
         for (int i = 0; i < resultList.size(); i++) {
         for(int i = 0; i < resultList.size(); ++i) {
            tb_map map = new tb_map();
            Object[] obj = (Object[]) resultList.get(i);
            map.setFloor((String) obj[0]);
            map.setMapname((String) obj[1]);
            map.setX_Truelength((String) obj[2]);
            map.setY_Truewidth((String) obj[3]);
            map.setX0_length((String) obj[4]);
            map.setY0_width((String) obj[5]);
            map.setX_Pixel((String) obj[6]);
            map.setY_Pixel((String) obj[7]);
            Object[] obj = (Object[])((Object[])resultList.get(i));
            map.setFloor((String)obj[0]);
            map.setMapname((String)obj[1]);
            map.setX_Truelength((String)obj[2]);
            map.setY_Truewidth((String)obj[3]);
            map.setX0_length((String)obj[4]);
            map.setY0_width((String)obj[5]);
            map.setX_Pixel((String)obj[6]);
            map.setY_Pixel((String)obj[7]);
            tb_mapList.add(map);
         }
      }
      return tb_mapList;
   }
   public List<tb_map> getMap_all2(String floor) {
      String sql = null;
      Query query = null;
@@ -170,44 +133,47 @@
      query = this.em.createNativeQuery(sql);
      query.setParameter("floor", floor);
      List resultList = query.getResultList();
      List<tb_map> tb_mapList = new ArrayList<tb_map>();
      List<tb_map> tb_mapList = new ArrayList();
      if (resultList.size() > 0) {
         for (int i = 0; i < resultList.size(); i++) {
         for(int i = 0; i < resultList.size(); ++i) {
            tb_map map = new tb_map();
            Object[] obj = (Object[]) resultList.get(i);
            map.setFloor((String) obj[0]);
            map.setMapname((String) obj[1]);
            map.setX_Truelength((String) obj[2]);
            map.setY_Truewidth((String) obj[3]);
            map.setX0_length((String) obj[4]);
            map.setY0_width((String) obj[5]);
            map.setX_Pixel((String) obj[6]);
            map.setY_Pixel((String) obj[7]);
            Object[] obj = (Object[])((Object[])resultList.get(i));
            map.setFloor((String)obj[0]);
            map.setMapname((String)obj[1]);
            map.setX_Truelength((String)obj[2]);
            map.setY_Truewidth((String)obj[3]);
            map.setX0_length((String)obj[4]);
            map.setY0_width((String)obj[5]);
            map.setX_Pixel((String)obj[6]);
            map.setY_Pixel((String)obj[7]);
            tb_mapList.add(map);
         }
      }
      return tb_mapList;
   }
   public List<tb_map> getFloor() {
      String sql = null;
      Query query = null;
      sql = "SELECT floor,mapname FROM tb_map";
      sql = "SELECT id,floor,mapname FROM tb_map";
      query = this.em.createNativeQuery(sql);
      List resultList = query.getResultList();
      List<tb_map> tb_mapList = new ArrayList<tb_map>();
      List<tb_map> tb_mapList = new ArrayList();
      if (resultList.size() > 0) {
         for (int i = 0; i < resultList.size(); i++) {
         for(int i = 0; i < resultList.size(); ++i) {
            tb_map map = new tb_map();
            Object[] obj = (Object[]) resultList.get(i);
            map.setFloor((String) obj[0]);
            map.setMapname((String) obj[1]);
            Object[] obj = (Object[])((Object[])resultList.get(i));
            map.setId((Integer)obj[0]);
            map.setFloor((String)obj[1]);
            map.setMapname((String)obj[2]);
            tb_mapList.add(map);
         }
      }
      return tb_mapList;
   }
   public List<tb_map> getFloor2(String floor) {
      String sql = null;
      Query query = null;
@@ -215,111 +181,116 @@
      query = this.em.createNativeQuery(sql);
      query.setParameter("floor", floor);
      List resultList = query.getResultList();
      List<tb_map> tb_mapList = new ArrayList<tb_map>();
      List<tb_map> tb_mapList = new ArrayList();
      if (resultList.size() > 0) {
         for (int i = 0; i < resultList.size(); i++) {
         for(int i = 0; i < resultList.size(); ++i) {
            tb_map map = new tb_map();
            Object[] obj = (Object[]) resultList.get(i);
            map.setFloor((String) obj[0]);
            map.setMapname((String) obj[1]);
            Object[] obj = (Object[])((Object[])resultList.get(i));
            map.setFloor((String)obj[0]);
            map.setMapname((String)obj[1]);
            tb_mapList.add(map);
         }
      }
      return tb_mapList;
   }
   public List<tb_map> getFloorByMapname(String mapname) {
      String sql = null;
      Query query = null;
      sql = "SELECT floor,mapname FROM tb_map WHERE mapname='"+mapname+"'";
      sql = "SELECT floor,mapname FROM tb_map WHERE mapname='" + mapname + "'";
      query = this.em.createNativeQuery(sql);
      List resultList = query.getResultList();
      List<tb_map> tb_mapList = new ArrayList<tb_map>();
      List<tb_map> tb_mapList = new ArrayList();
      if (resultList.size() > 0) {
         for (int i = 0; i < resultList.size(); i++) {
         for(int i = 0; i < resultList.size(); ++i) {
            tb_map map = new tb_map();
            Object[] obj = (Object[]) resultList.get(i);
            map.setFloor((String) obj[0]);
            map.setMapname((String) obj[1]);
            Object[] obj = (Object[])((Object[])resultList.get(i));
            map.setFloor((String)obj[0]);
            map.setMapname((String)obj[1]);
            tb_mapList.add(map);
         }
      }
      return tb_mapList;
   }
   public List<tb_achor> getAnchor() {
      String sql = null;
      Query query = null;
      sql = "SELECT anchorid,anchorip FROM tb_achor";
      query = this.em.createNativeQuery(sql);
      List resultList = query.getResultList();
      List<tb_achor> tb_anchorList = new ArrayList<tb_achor>();
      List<tb_achor> tb_anchorList = new ArrayList();
      if (resultList.size() > 0) {
         for (int i = 0; i < resultList.size(); i++) {
         for(int i = 0; i < resultList.size(); ++i) {
            tb_achor anchor = new tb_achor();
            Object[] obj = (Object[]) resultList.get(i);
            anchor.setAnchorid((String) obj[0]);
            anchor.setAnchorip((String) obj[1]);
            Object[] obj = (Object[])((Object[])resultList.get(i));
            anchor.setAnchorid((String)obj[0]);
            anchor.setAnchorip((String)obj[1]);
            tb_anchorList.add(anchor);
         }
      }
      return tb_anchorList;
   }
   public List<tb_fence> getFence(String floor_number) {
      String sql = null;
      Query query = null;
      sql = "SELECT floor,type,bumen,name,zuobiao,shape,start,stop,addtime,color FROM tb_fence WHERE floor="+floor_number;
      sql = "SELECT floor,type,bumen,name,zuobiao,shape,start,stop,addtime,color FROM tb_fence WHERE floor=" + floor_number;
      query = this.em.createNativeQuery(sql);
      List resultList = query.getResultList();
      List<tb_fence> tb_fenceList = new ArrayList<tb_fence>();
      List<tb_fence> tb_fenceList = new ArrayList();
      if (resultList.size() > 0) {
         for (int i = 0; i < resultList.size(); i++) {
         for(int i = 0; i < resultList.size(); ++i) {
            tb_fence fence = new tb_fence();
            Object[] obj = (Object[]) resultList.get(i);
            fence.setFloor((String) obj[0]);
            fence.setType((String) obj[1]);
            fence.setBumen((String) obj[2]);
            fence.setName((String) obj[3]);
            Object[] obj = (Object[])((Object[])resultList.get(i));
            fence.setFloor((String)obj[0]);
            fence.setType((String)obj[1]);
            fence.setBumen((String)obj[2]);
            fence.setName((String)obj[3]);
            fence.setZuobiao(obj[4].toString().replaceAll(";", ","));
            fence.setShape((String) obj[5]);
            fence.setShape((String)obj[5]);
            fence.setStart(obj[6] == null ? "" : obj[6].toString());
            fence.setStop(obj[7] == null ? "" : obj[7].toString());
            fence.setAddtime((String) obj[8]);
            fence.setColor((String) obj[9]);
            fence.setAddtime((String)obj[8]);
            fence.setColor((String)obj[9]);
            tb_fenceList.add(fence);
         }
      }
      return tb_fenceList;
   }
   public List<tb_fence> getFence_all() {
      String sql = null;
      Query query = null;
      sql = "SELECT floor,type,bumen,name,zuobiao,shape,start,stop,addtime,color FROM tb_fence where type != '变电站'";
      query = this.em.createNativeQuery(sql);
      List resultList = query.getResultList();
      List<tb_fence> tb_fenceList = new ArrayList<tb_fence>();
      List<tb_fence> tb_fenceList = new ArrayList();
      if (resultList.size() > 0) {
         for (int i = 0; i < resultList.size(); i++) {
         for(int i = 0; i < resultList.size(); ++i) {
            tb_fence fence = new tb_fence();
            Object[] obj = (Object[]) resultList.get(i);
            fence.setFloor((String) obj[0]);
            fence.setType((String) obj[1]);
            fence.setBumen((String) obj[2]);
            fence.setName((String) obj[3]);
            Object[] obj = (Object[])((Object[])resultList.get(i));
            fence.setFloor((String)obj[0]);
            fence.setType((String)obj[1]);
            fence.setBumen((String)obj[2]);
            fence.setName((String)obj[3]);
            fence.setZuobiao(obj[4].toString().replaceAll(";", ","));
            fence.setShape((String) obj[5]);
            fence.setShape((String)obj[5]);
            fence.setStart(obj[6] == null ? "" : obj[6].toString());
            fence.setStop(obj[7] == null ? "" : obj[7].toString());
            fence.setAddtime((String) obj[8]);
            fence.setColor((String) obj[9]);
            fence.setAddtime((String)obj[8]);
            fence.setColor((String)obj[9]);
            tb_fenceList.add(fence);
         }
      }
      return tb_fenceList;
   }
   public List<tb_fence> getFenceaaa(String name) {
      String sql = null;
      Query query = null;
@@ -327,33 +298,34 @@
      query = this.em.createNativeQuery(sql);
      query.setParameter("name", name);
      List resultList = query.getResultList();
      List<tb_fence> tb_fenceList = new ArrayList<tb_fence>();
      List<tb_fence> tb_fenceList = new ArrayList();
      if (resultList.size() > 0) {
         for (int i = 0; i < resultList.size(); i++) {
         for(int i = 0; i < resultList.size(); ++i) {
            tb_fence fence = new tb_fence();
            Object[] obj = (Object[]) resultList.get(i);
            fence.setFloor((String) obj[0]);
            fence.setType((String) obj[1]);
            fence.setBumen((String) obj[2]);
            fence.setName((String) obj[3]);
            Object[] obj = (Object[])((Object[])resultList.get(i));
            fence.setFloor((String)obj[0]);
            fence.setType((String)obj[1]);
            fence.setBumen((String)obj[2]);
            fence.setName((String)obj[3]);
            fence.setZuobiao(obj[4].toString().replaceAll(";", ","));
            fence.setShape((String) obj[5]);
            fence.setShape((String)obj[5]);
            fence.setStart(obj[6] == null ? "" : obj[6].toString());
            fence.setStop(obj[7] == null ? "" : obj[7].toString());
            fence.setAddtime((String) obj[8]);
            fence.setColor((String) obj[9]);
            fence.setAddtime((String)obj[8]);
            fence.setColor((String)obj[9]);
            tb_fenceList.add(fence);
         }
      }
      return tb_fenceList;
   }
   @Transactional
   public int drawFence_add(tb_fence fence) {
      String sql = null;
      Query query = null;
      sql = "INSERT INTO tb_fence(id,floor,type,bumen,name,zuobiao,shape,start,stop,addtime,color) VALUES(:id,:floor,:type,:bumen,:name,:zuobiao,:shape,:start,:stop,now(),:color)";
      cs.tb_caozuo("tb_fence", 1);
      this.cs.tb_caozuo("tb_fence", 1);
      query = this.em.createNativeQuery(sql);
      query.setParameter("id", fence.getId());
      query.setParameter("floor", fence.getFloor());
@@ -368,16 +340,17 @@
      int executeUpdate = query.executeUpdate();
      return executeUpdate;
   }
   @Transactional
   public int drawFence_add2(tb_fence fence) {
      if (fence.getBaoliu7() == "") {
         fence.setBaoliu7("0");
      }
      String sql = null;
      Query query = null;
      sql = "INSERT INTO tb_fence(floor,type,name,zuobiao,shape,start,stop,addtime,color,baoliu1,baoliu3,baoliu4,bumen,baoliu6,baoliu7) VALUES(:floor,:type,:name,:zuobiao,:shape,:start,:stop,now(),:color,:baoliu1,:baoliu3,:baoliu4,:bumen,:baoliu6,:baoliu7)";
      cs.tb_caozuo("tb_fence", 1);
      this.cs.tb_caozuo("tb_fence", 1);
      query = this.em.createNativeQuery(sql);
      query.setParameter("floor", fence.getFloor());
      query.setParameter("type", fence.getType());
@@ -388,7 +361,6 @@
      query.setParameter("stop", fence.getStop());
      query.setParameter("color", fence.getColor());
      query.setParameter("baoliu1", fence.getBaoliu1());
//    query.setParameter("baoliu2", fence.getBaoliu2());
      query.setParameter("baoliu3", fence.getBaoliu3());
      query.setParameter("baoliu4", fence.getBaoliu4());
      query.setParameter("bumen", fence.getBumen());
@@ -397,13 +369,13 @@
      int executeUpdate = query.executeUpdate();
      return executeUpdate;
   }
   @Transactional
   public int sanweiFence_add(tb_fence fence) {
      String sql = null;
      Query query = null;
      sql = "INSERT INTO tb_fence(id,floor,type,bumen,name,zuobiao,shape,start,stop,addtime,color,baoliu1) VALUES(:id,:floor,:type,:bumen,:name,:zuobiao,:shape,:start,:stop,now(),:color,:baoliu1)";
      cs.tb_caozuo("tb_fence", 1);
      this.cs.tb_caozuo("tb_fence", 1);
      query = this.em.createNativeQuery(sql);
      query.setParameter("id", fence.getId());
      query.setParameter("floor", fence.getFloor());
@@ -419,45 +391,46 @@
      int executeUpdate = query.executeUpdate();
      return executeUpdate;
   }
   @Transactional
   public int xunjianSet_add(String name) {
      String sql = null;
      Query query = null;
      sql = "INSERT INTO tb_xunjianset(quyu,startime,stoptime,xunshu,tagid,needstoptime,cishu,addtime) VALUES(:name,'23:59:00','无','无','所有标签','1','1',now())";
      cs.tb_caozuo("tb_xunjianset", 1);
      this.cs.tb_caozuo("tb_xunjianset", 1);
      query = this.em.createNativeQuery(sql);
      query.setParameter("name", name);
      int executeUpdate = query.executeUpdate();
      return executeUpdate;
   }
   @Transactional
   public int fenceInout_add(String name,String zuobiaos,String shape,String floor) {
   public int fenceInout_add(String name, String zuobiaos, String shape, String floor) {
      String sql = null;
      Query query = null;
      String bianshu = "";
      StringBuffer canin=new StringBuffer();
      StringBuffer canout=new StringBuffer();
      StringBuffer canin = new StringBuffer();
      StringBuffer canout = new StringBuffer();
      if (shape == "矩形") {
         bianshu = "4";
         canin=new StringBuffer("1,1,1,1");
         canout=new StringBuffer("1,1,1,1");
         canin = new StringBuffer("1,1,1,1");
         canout = new StringBuffer("1,1,1,1");
      } else {
         String[] zb=zuobiaos.split("\\;");
         bianshu=String.valueOf(zb.length);
         for(int i=0;i<zb.length-1;i++) {
         String[] zb = zuobiaos.split("\\;");
         bianshu = String.valueOf(zb.length);
         for(int i = 0; i < zb.length - 1; ++i) {
            canin.append("1,");
            canout.append("1,");
            if(i==(zb.length-2)) {
            if (i == zb.length - 2) {
               canin.append("1");
               canout.append("1");
            }
         }
      }
      sql = "INSERT INTO tb_fence_inout(name, zuobiao, bianshu, canin, canout, floor, addtime) VALUES(:name,:zuobiao,:bianshu,:canin,:canout,:floor,now())";
      cs.tb_caozuo("tb_fence_inout", 1);
      this.cs.tb_caozuo("tb_fence_inout", 1);
      query = this.em.createNativeQuery(sql);
      query.setParameter("name", name);
      query.setParameter("zuobiao", zuobiaos);
@@ -468,228 +441,235 @@
      int executeUpdate = query.executeUpdate();
      return executeUpdate;
   }
   public List<tb_track> getTagtrack(String tag_id,String begin_time,String end_time,String floor) throws ParseException {
      String sql = null;
      Query query = null;
      SimpleDateFormat dateFormat=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
      Date now=dateFormat.parse(begin_time);
      //System.out.print(now);
      SimpleDateFormat dateFormat2=new SimpleDateFormat("yyyyMMdd");
      String now2 = dateFormat2.format(now);
      //System.out.print(now2);
//    //System.out.print(begin_time);
//    //System.out.print(end_time);
//    //System.out.print(tag_id);
//    //System.out.print(floor);
      sql = "SELECT tagid,x,y,z,layer,time,baoliu1,baoliu2,baoliu3,baoliu4 FROM tb_track_"+now2+" WHERE layer= '"+floor+"' AND tagid= '"+tag_id+"' AND time>= '"+begin_time+"' AND time<= '"+end_time+"' ORDER BY time";
//    sql = "SELECT tagid,x,y,z,layer,time FROM tb_track WHERE layer= '"+floor+"' AND tagid= '"+tag_id+"' AND time>= '"+begin_time+"' AND time<= '"+end_time+"'";
      //System.out.print(sql);
      query = this.em.createNativeQuery(sql);
      List resultList = query.getResultList();
      List<tb_track> tb_trackList = new ArrayList<tb_track>();
      if (resultList.size() > 0) {
         for (int i = 0; i < resultList.size(); i++) {
            tb_track map = new tb_track();
            Object[] obj = (Object[]) resultList.get(i);
            map.setTagid((String) obj[0]);
            map.setX((String) obj[1]);
            map.setY((String) obj[2]);
            map.setZ((String) obj[3]);
            map.setLayer((String) obj[4]);
            map.setTime((String) obj[5]);
            map.setFangkeid((String) obj[6]);
            map.setJingdu((String) obj[7]);
            map.setWeidu((String) obj[8]);
            map.setGaocheng((String) obj[9]);
            tb_trackList.add(map);
         }
      }
      return tb_trackList;
   }
   public List<tb_track> getTagtrack2(String name,String begin_time,String end_time,String floor) throws ParseException {
      String sql = null;
      Query query = null;
      SimpleDateFormat dateFormat=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
      Date now=dateFormat.parse(begin_time);
      //System.out.print(now);
      SimpleDateFormat dateFormat2=new SimpleDateFormat("yyyyMMdd");
      String now2 = dateFormat2.format(now);
      //System.out.print(now2);
//    //System.out.print(begin_time);
//    //System.out.print(end_time);
//    //System.out.print(tag_id);
//    //System.out.print(floor);
      sql = "SELECT tagid,x,y,z,layer,time,baoliu1,baoliu2,baoliu3,baoliu4 FROM tb_track_"+now2+" WHERE layer= '"+floor+"' AND baoliu8= '"+name+"' AND time>= '"+begin_time+"' AND time<= '"+end_time+"' ORDER BY time";
//    sql = "SELECT tagid,x,y,z,layer,time FROM tb_track WHERE layer= '"+floor+"' AND tagid= '"+tag_id+"' AND time>= '"+begin_time+"' AND time<= '"+end_time+"'";
      //System.out.print(sql);
      query = this.em.createNativeQuery(sql);
      List resultList = query.getResultList();
      List<tb_track> tb_trackList = new ArrayList<tb_track>();
      if (resultList.size() > 0) {
         for (int i = 0; i < resultList.size(); i++) {
            tb_track map = new tb_track();
            Object[] obj = (Object[]) resultList.get(i);
            map.setTagid((String) obj[0]);
            map.setX((String) obj[1]);
            map.setY((String) obj[2]);
            map.setZ((String) obj[3]);
            map.setLayer((String) obj[4]);
            map.setTime((String) obj[5]);
            map.setFangkeid((String) obj[6]);
            map.setJingdu((String) obj[7]);
            map.setWeidu((String) obj[8]);
            map.setGaocheng((String) obj[9]);
            tb_trackList.add(map);
         }
      }
      return tb_trackList;
   }
   public List<tb_track> getTagtrack3(String tag_id,String begin_time,String end_time) throws ParseException {
      String sql = null;
      Query query = null;
      SimpleDateFormat dateFormat=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
      Date now=dateFormat.parse(begin_time);
      SimpleDateFormat dateFormat2=new SimpleDateFormat("yyyyMMdd");
      String now2 = dateFormat2.format(now);
      sql = "SELECT tagid,x,y,z,layer,time,baoliu1,baoliu2,baoliu3,baoliu4 FROM tb_track_"+now2+" WHERE tagid= '"+tag_id+"' AND time>= '"+begin_time+"' AND time<= '"+end_time+"' ORDER BY time";
   public List<tb_track> getTagtrack(String tag_id, String begin_time, String end_time, String floor) throws ParseException {
      String sql = null;
      Query query = null;
      SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
      Date now = dateFormat.parse(begin_time);
      SimpleDateFormat dateFormat2 = new SimpleDateFormat("yyyyMMdd");
      String now2 = dateFormat2.format(now);
      sql = "SELECT tagid,x,y,z,layer,time,baoliu1,baoliu2,baoliu3,baoliu4 FROM tb_track_" + now2 + " WHERE layer= '" + floor + "' AND tagid= '" + tag_id + "' AND time>= '" + begin_time + "' AND time<= '" + end_time + "' ORDER BY time";
      query = this.em.createNativeQuery(sql);
      List resultList = query.getResultList();
      List<tb_track> tb_trackList = new ArrayList<tb_track>();
      List<tb_track> tb_trackList = new ArrayList();
      if (resultList.size() > 0) {
         for (int i = 0; i < resultList.size(); i++) {
         for(int i = 0; i < resultList.size(); ++i) {
            tb_track map = new tb_track();
            Object[] obj = (Object[]) resultList.get(i);
            map.setTagid((String) obj[0]);
            map.setX((String) obj[1]);
            map.setY((String) obj[2]);
            map.setZ((String) obj[3]);
            map.setLayer((String) obj[4]);
            map.setTime((String) obj[5]);
            map.setFangkeid((String) obj[6]);
            map.setJingdu((String) obj[7]);
            map.setWeidu((String) obj[8]);
            map.setGaocheng((String) obj[9]);
            Object[] obj = (Object[])((Object[])resultList.get(i));
            map.setTagid((String)obj[0]);
            map.setX((String)obj[1]);
            map.setY((String)obj[2]);
            map.setZ((String)obj[3]);
            map.setLayer((String)obj[4]);
            map.setTime((String)obj[5]);
            map.setFangkeid((String)obj[6]);
            map.setJingdu((String)obj[7]);
            map.setWeidu((String)obj[8]);
            map.setGaocheng((String)obj[9]);
            tb_trackList.add(map);
         }
      }
      return tb_trackList;
   }
   public List<tb_track> getTagtrack2(String name, String begin_time, String end_time, String floor) throws ParseException {
      String sql = null;
      Query query = null;
      SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
      Date now = dateFormat.parse(begin_time);
      SimpleDateFormat dateFormat2 = new SimpleDateFormat("yyyyMMdd");
      String now2 = dateFormat2.format(now);
      sql = "SELECT tagid,x,y,z,layer,time,baoliu1,baoliu2,baoliu3,baoliu4 FROM tb_track_" + now2 + " WHERE layer= '" + floor + "' AND baoliu8= '" + name + "' AND time>= '" + begin_time + "' AND time<= '" + end_time + "' ORDER BY time";
      query = this.em.createNativeQuery(sql);
      List resultList = query.getResultList();
      List<tb_track> tb_trackList = new ArrayList();
      if (resultList.size() > 0) {
         for(int i = 0; i < resultList.size(); ++i) {
            tb_track map = new tb_track();
            Object[] obj = (Object[])((Object[])resultList.get(i));
            map.setTagid((String)obj[0]);
            map.setX((String)obj[1]);
            map.setY((String)obj[2]);
            map.setZ((String)obj[3]);
            map.setLayer((String)obj[4]);
            map.setTime((String)obj[5]);
            map.setFangkeid((String)obj[6]);
            map.setJingdu((String)obj[7]);
            map.setWeidu((String)obj[8]);
            map.setGaocheng((String)obj[9]);
            tb_trackList.add(map);
         }
      }
      return tb_trackList;
   }
   public List<tb_track> getTagtrack3(String tag_id, String begin_time, String end_time) throws ParseException {
      String sql = null;
      Query query = null;
      SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
      Date now = dateFormat.parse(begin_time);
      SimpleDateFormat dateFormat2 = new SimpleDateFormat("yyyyMMdd");
      String now2 = dateFormat2.format(now);
      sql = "SELECT tagid,x,y,z,layer,time,baoliu1,baoliu2,baoliu3,baoliu4 FROM tb_track_" + now2 + " WHERE tagid= '" + tag_id + "' AND time>= '" + begin_time + "' AND time<= '" + end_time + "' ORDER BY time";
      query = this.em.createNativeQuery(sql);
      List resultList = query.getResultList();
      List<tb_track> tb_trackList = new ArrayList();
      if (resultList.size() > 0) {
         for(int i = 0; i < resultList.size(); ++i) {
            tb_track map = new tb_track();
            Object[] obj = (Object[])((Object[])resultList.get(i));
            map.setTagid((String)obj[0]);
            map.setX((String)obj[1]);
            map.setY((String)obj[2]);
            map.setZ((String)obj[3]);
            map.setLayer((String)obj[4]);
            map.setTime((String)obj[5]);
            map.setFangkeid((String)obj[6]);
            map.setJingdu((String)obj[7]);
            map.setWeidu((String)obj[8]);
            map.setGaocheng((String)obj[9]);
            tb_trackList.add(map);
         }
      }
      return tb_trackList;
   }
   public String trackFindId(String tagid){
      String sql = null;
      Query query = null;
      return null;
   }
   public List<tb_version> findversion(){
      String sql = null;
      Query query = null;
      sql = "SELECT id,BsVersion,BsTime FROM tb_version  ORDER BY  BsTime DESC limit 0,1";
      query = this.em.createNativeQuery(sql);
      List resultList = query.getResultList();
      List<tb_version> tb_versionList = new ArrayList();
      if (resultList.size() > 0) {
         for(int i = 0; i < resultList.size(); ++i) {
            tb_version version = new tb_version();
            Object[] obj = (Object[])((Object[])resultList.get(i));
            version.setId((Integer) obj[0]);
            version.setBsVersion(obj[1].toString());
            version.setTime(obj[2].toString());
            tb_versionList.add(version);
         }
      }
      return tb_versionList;
   }
   public List<tb_achor> getAnchorip(String anchorid) {
      String sql = null;
      Query query = null;
      sql = "SELECT anchorid,anchorip FROM tb_achor WHERE anchorid="+anchorid;
      sql = "SELECT anchorid,anchorip FROM tb_achor WHERE anchorid=" + anchorid;
      query = this.em.createNativeQuery(sql);
      List resultList = query.getResultList();
      List<tb_achor> tb_anchorList = new ArrayList<tb_achor>();
      List<tb_achor> tb_anchorList = new ArrayList();
      if (resultList.size() > 0) {
         for (int i = 0; i < resultList.size(); i++) {
         for(int i = 0; i < resultList.size(); ++i) {
            tb_achor anchor = new tb_achor();
            Object[] obj = (Object[]) resultList.get(i);
            anchor.setAnchorid((String) obj[0]);
            anchor.setAnchorip((String) obj[1]);
            Object[] obj = (Object[])((Object[])resultList.get(i));
            anchor.setAnchorid((String)obj[0]);
            anchor.setAnchorip((String)obj[1]);
            tb_anchorList.add(anchor);
         }
      }
      return tb_anchorList;
   }
   public List<tb_achor> getAnchorInfo(String floor) {
      String sql = null;
      Query query = null;
      sql = "SELECT a.* FROM tb_achor AS a,( SELECT anchorid, max( GreateTime ) time FROM tb_achor GROUP BY anchorid ) AS b WHERE a.GreateTime = b.time AND a.anchorid = b.anchorid AND a.layer='"+floor+"'";
      sql = "SELECT a.* FROM tb_achor AS a,( SELECT anchorid, max( GreateTime ) time FROM tb_achor GROUP BY anchorid ) AS b WHERE a.GreateTime = b.time AND a.anchorid = b.anchorid AND a.layer='" + floor + "'";
      query = this.em.createNativeQuery(sql);
      List resultList = query.getResultList();
      List<tb_achor> tb_anchorList = new ArrayList<tb_achor>();
      List<tb_achor> tb_anchorList = new ArrayList();
      if (resultList.size() > 0) {
         for (int i = 0; i < resultList.size(); i++) {
         for(int i = 0; i < resultList.size(); ++i) {
            tb_achor anchor = new tb_achor();
            Object[] obj = (Object[]) resultList.get(i);
            anchor.setAnchorid((String) obj[1]);
            anchor.setPOSX((String) obj[2]);
            anchor.setPOSY((String) obj[3]);
            anchor.setPOSZ((String) obj[4]);
            anchor.setLayer((String) obj[5]);
            anchor.setAnchormode((String) obj[8]);
            anchor.setAnchorip((String) obj[9]);
            anchor.setGreateTime((String) obj[13]);
            Object[] obj = (Object[])((Object[])resultList.get(i));
            anchor.setAnchorid((String)obj[1]);
            anchor.setPOSX((String)obj[2]);
            anchor.setPOSY((String)obj[3]);
            anchor.setPOSZ((String)obj[4]);
            anchor.setLayer((String)obj[5]);
            anchor.setAnchormode((String)obj[8]);
            anchor.setAnchorip((String)obj[9]);
            anchor.setGreateTime((String)obj[13]);
            tb_anchorList.add(anchor);
         }
      }
      return tb_anchorList;
   }
   public List<tb_achor> getAnchorInfo_all() {
      String sql = null;
      Query query = null;
      sql = "SELECT a.* FROM tb_achor AS a,( SELECT anchorid, max( GreateTime ) time FROM tb_achor GROUP BY anchorid ) AS b WHERE a.GreateTime = b.time AND a.anchorid = b.anchorid";
      query = this.em.createNativeQuery(sql);
      List resultList = query.getResultList();
      List<tb_achor> tb_anchorList = new ArrayList<tb_achor>();
      List<tb_achor> tb_anchorList = new ArrayList();
      if (resultList.size() > 0) {
         for (int i = 0; i < resultList.size(); i++) {
         for(int i = 0; i < resultList.size(); ++i) {
            tb_achor anchor = new tb_achor();
            Object[] obj = (Object[]) resultList.get(i);
            anchor.setAnchorid((String) obj[1]);
            anchor.setPOSX((String) obj[2]);
            anchor.setPOSY((String) obj[3]);
            anchor.setPOSZ((String) obj[4]);
            anchor.setLayer((String) obj[5]);
            anchor.setAnchormode((String) obj[8]);
            anchor.setAnchorip((String) obj[9]);
            anchor.setGreateTime((String) obj[13]);
            Object[] obj = (Object[])((Object[])resultList.get(i));
            anchor.setAnchorid((String)obj[1]);
            anchor.setPOSX((String)obj[2]);
            anchor.setPOSY((String)obj[3]);
            anchor.setPOSZ((String)obj[4]);
            anchor.setLayer((String)obj[5]);
            anchor.setAnchormode((String)obj[8]);
            anchor.setAnchorip((String)obj[9]);
            anchor.setGreateTime((String)obj[13]);
            tb_anchorList.add(anchor);
         }
      }
      return tb_anchorList;
   }
   public List<tb_achor> getALlAnchor() {
      String sql = null;
      Query query = null;
      sql = "SELECT a.* FROM tb_achor AS a,( SELECT anchorid, max( GreateTime ) time FROM tb_achor GROUP BY anchorid ) AS b WHERE a.GreateTime = b.time AND a.anchorid = b.anchorid";
      query = this.em.createNativeQuery(sql);
      List resultList = query.getResultList();
      List<tb_achor> tb_anchorList = new ArrayList<tb_achor>();
      List<tb_achor> tb_anchorList = new ArrayList();
      if (resultList.size() > 0) {
         for (int i = 0; i < resultList.size(); i++) {
         for(int i = 0; i < resultList.size(); ++i) {
            tb_achor anchor = new tb_achor();
            Object[] obj = (Object[]) resultList.get(i);
            anchor.setAnchorid((String) obj[1]);
            anchor.setPOSX((String) obj[2]);
            anchor.setPOSY((String) obj[3]);
            anchor.setPOSZ((String) obj[4]);
            anchor.setLayer((String) obj[5]);
            anchor.setAnchorip((String) obj[9]);
            anchor.setGreateTime((String) obj[13]);
            Object[] obj = (Object[])((Object[])resultList.get(i));
            anchor.setAnchorid((String)obj[1]);
            anchor.setPOSX((String)obj[2]);
            anchor.setPOSY((String)obj[3]);
            anchor.setPOSZ((String)obj[4]);
            anchor.setLayer((String)obj[5]);
            anchor.setAnchorip((String)obj[9]);
            anchor.setGreateTime((String)obj[13]);
            tb_anchorList.add(anchor);
         }
      }
      return tb_anchorList;
   }
   public List<tb_tag> getRealTagState(String tagid) {
      String sql = null;
      Query query = null;
      sql = "SELECT * FROM tb_tag WHERE tag_id='"+tagid+"' ORDER BY addtime DESC LIMIT 1";
      sql = "SELECT * FROM tb_tag WHERE tag_id='" + tagid + "' ORDER BY addtime DESC LIMIT 1";
      query = this.em.createNativeQuery(sql);
      List resultList = query.getResultList();
      List<tb_tag> tb_realtagList = new ArrayList<tb_tag>();
      List<tb_tag> tb_realtagList = new ArrayList();
      if (resultList.size() > 0) {
         for (int i = 0; i < resultList.size(); i++) {
         for(int i = 0; i < resultList.size(); ++i) {
            tb_tag tag = new tb_tag();
            Object[] obj = (Object[]) resultList.get(i);
            Object[] obj = (Object[])((Object[])resultList.get(i));
            tag.setTag_id(obj[1] == null ? "" : obj[1].toString());
            tag.setState(obj[2] == null ? "" : obj[2].toString());
            tag.setPower(obj[3] == null ? "" : obj[3].toString());
@@ -698,429 +678,475 @@
            tb_realtagList.add(tag);
         }
      }
      return tb_realtagList;
   }
   public List<tb_person> getRealpersonState(String tagid) {
      String sql = null;
      Query query = null;
      sql = "SELECT * FROM tb_person WHERE p_tagid='"+tagid+"' ORDER BY p_addtiem DESC LIMIT 1";
      sql = "SELECT * FROM tb_person WHERE p_tagid='" + tagid + "' ORDER BY p_addtiem DESC LIMIT 1";
      query = this.em.createNativeQuery(sql);
      List resultList = query.getResultList();
      List<tb_person> tb_realpersonList = new ArrayList<tb_person>();
      List<tb_person> tb_realpersonList = new ArrayList();
      if (resultList.size() > 0) {
         for (int i = 0; i < resultList.size(); i++) {
         for(int i = 0; i < resultList.size(); ++i) {
            tb_person person = new tb_person();
            Object[] obj = (Object[]) resultList.get(i);
            Object[] obj = (Object[])((Object[])resultList.get(i));
            person.setP_online(obj[16] == null ? "" : obj[16].toString());
            person.setP_power(obj[17] == null ? "" : obj[17].toString());
            tb_realpersonList.add(person);
         }
      }
      return tb_realpersonList;
   }
   public List<tb_person> getpersonLocation(String floor) {
      String sql = null;
      Query query = null;
      sql = "SELECT * FROM tb_person WHERE p_floor='"+floor+"'";
      sql = "SELECT * FROM tb_person WHERE p_floor='" + floor + "'";
      query = this.em.createNativeQuery(sql);
      List resultList = query.getResultList();
      List<tb_person> tb_realocationList = new ArrayList<tb_person>();
      List<tb_person> tb_realocationList = new ArrayList();
      if (resultList.size() > 0) {
         for (int i = 0; i < resultList.size(); i++) {
         for(int i = 0; i < resultList.size(); ++i) {
            tb_person realocation = new tb_person();
            Object[] obj = (Object[]) resultList.get(i);
            realocation.setP_name((String) obj[1]);
            realocation.setP_tagid((String) obj[2]);
            realocation.setP_phone((String) obj[5]);
            realocation.setP_department((String) obj[6]);
            realocation.setP_idcardnum((String) obj[9]);
            realocation.setP_x((String) obj[12]);
            realocation.setP_y((String) obj[13]);
            realocation.setP_floor((String) obj[14]);
            realocation.setP_sos((String) obj[15]);
            realocation.setP_online((String) obj[16]);
            realocation.setP_power((String) obj[17]);
            realocation.setP_kaoqing((String) obj[18]);
            realocation.setP_fence((String) obj[19]);
            realocation.setP_fencename((String) obj[20]);
            realocation.setP_kaoqqingname((String) obj[21]);
            realocation.setP_image((String) obj[22]);
            realocation.setP_addtiem((String) obj[23]);
            realocation.setP_sousuo((String) obj[25]);
            realocation.setP_shipin((String) obj[26]);
            realocation.setP_jingdu((String) obj[29]);
            realocation.setP_weidu((String) obj[30]);
            realocation.setP_gaocheng((String) obj[31]);
            realocation.setBaoliu10((String) obj[37]);
            realocation.setBaoliu22((String) obj[49]);
            Object[] obj = (Object[])((Object[])resultList.get(i));
            realocation.setP_name((String)obj[1]);
            realocation.setP_tagid((String)obj[2]);
            realocation.setP_phone((String)obj[5]);
            realocation.setP_department((String)obj[6]);
            realocation.setP_idcardnum((String)obj[9]);
            realocation.setP_x((String)obj[12]);
            realocation.setP_y((String)obj[13]);
            realocation.setP_floor((String)obj[14]);
            realocation.setP_sos((String)obj[15]);
            realocation.setP_online((String)obj[16]);
            realocation.setP_power((String)obj[17]);
            realocation.setP_kaoqing((String)obj[18]);
            realocation.setP_fence((String)obj[19]);
            realocation.setP_fencename((String)obj[20]);
            realocation.setP_kaoqqingname((String)obj[21]);
            realocation.setP_image((String)obj[22]);
            realocation.setP_addtiem((String)obj[23]);
            realocation.setP_sousuo((String)obj[25]);
            realocation.setP_shipin((String)obj[26]);
            realocation.setP_jingdu((String)obj[29]);
            realocation.setP_weidu((String)obj[30]);
            realocation.setP_gaocheng((String)obj[31]);
            realocation.setBaoliu10((String)obj[37]);
            realocation.setBaoliu22((String)obj[49]);
            tb_realocationList.add(realocation);
         }
      }
      return tb_realocationList;
   }
   public List<tb_person> getpersonLocationsan() {
      String sql = null;
      Query query = null;
      sql = "SELECT * FROM tb_person";
      query = this.em.createNativeQuery(sql);
      List resultList = query.getResultList();
      List<tb_person> tb_realocationList = new ArrayList<tb_person>();
      List<tb_person> tb_realocationList = new ArrayList();
      if (resultList.size() > 0) {
         for (int i = 0; i < resultList.size(); i++) {
         for(int i = 0; i < resultList.size(); ++i) {
            tb_person realocation = new tb_person();
            Object[] obj = (Object[]) resultList.get(i);
            realocation.setP_name((String) obj[1]);
            realocation.setP_tagid((String) obj[2]);
            realocation.setP_sex((String) obj[3]);
            realocation.setP_minzu((String) obj[4]);
            realocation.setP_phone((String) obj[5]);
            realocation.setP_department((String) obj[6]);
            realocation.setP_x((String) obj[12]);
            realocation.setP_y((String) obj[13]);
            realocation.setP_floor((String) obj[14]);
            realocation.setP_sos((String) obj[15]);
            realocation.setP_online((String) obj[16]);
            realocation.setP_power((String) obj[17]);
            realocation.setP_kaoqing((String) obj[18]);
            realocation.setP_fence((String) obj[19]);
            realocation.setP_fencename((String) obj[20]);
            realocation.setP_kaoqqingname((String) obj[21]);
            realocation.setP_image((String) obj[22]);
            realocation.setP_addtiem((String) obj[23]);
            realocation.setP_sousuo((String) obj[25]);
            realocation.setP_shipin((String) obj[26]);
            realocation.setP_fangkeid((String) obj[28]);
            realocation.setP_jingdu((String) obj[29]);
            realocation.setP_weidu((String) obj[30]);
            realocation.setP_gaocheng((String) obj[31]);
            realocation.setBaoliu22((String) obj[49]);
            realocation.setBaoliu23((String) obj[50]);
            realocation.setBaoliu24((String) obj[51]);
            Object[] obj = (Object[])((Object[])resultList.get(i));
            realocation.setP_name((String)obj[1]);
            realocation.setP_tagid((String)obj[2]);
            realocation.setP_sex((String)obj[3]);
            realocation.setP_minzu((String)obj[4]);
            realocation.setP_phone((String)obj[5]);
            realocation.setP_department((String)obj[6]);
            realocation.setP_x((String)obj[12]);
            realocation.setP_y((String)obj[13]);
            realocation.setP_floor((String)obj[14]);
            realocation.setP_sos((String)obj[15]);
            realocation.setP_online((String)obj[16]);
            realocation.setP_power((String)obj[17]);
            realocation.setP_kaoqing((String)obj[18]);
            realocation.setP_fence((String)obj[19]);
            realocation.setP_fencename((String)obj[20]);
            realocation.setP_kaoqqingname((String)obj[21]);
            realocation.setP_image((String)obj[22]);
            realocation.setP_addtiem((String)obj[23]);
            realocation.setP_sousuo((String)obj[25]);
            realocation.setP_shipin((String)obj[26]);
            realocation.setP_fangkeid((String)obj[28]);
            realocation.setP_jingdu((String)obj[29]);
            realocation.setP_weidu((String)obj[30]);
            realocation.setP_gaocheng((String)obj[31]);
            realocation.setBaoliu19((String)obj[46]);
            realocation.setBaoliu22((String)obj[49]);
            realocation.setBaoliu23((String)obj[50]);
            realocation.setBaoliu24((String)obj[51]);
            tb_realocationList.add(realocation);
         }
      }
      return tb_realocationList;
   }
   public List<tb_person> getpersonLocationsan3(String floor) {
      String sql = null;
      Query query = null;
      sql = "SELECT * FROM tb_person where p_floor="+floor;
      sql = "SELECT * FROM tb_person where p_floor=" + floor;
      query = this.em.createNativeQuery(sql);
      List resultList = query.getResultList();
      List<tb_person> tb_realocationList = new ArrayList<tb_person>();
      List<tb_person> tb_realocationList = new ArrayList();
      if (resultList.size() > 0) {
         for (int i = 0; i < resultList.size(); i++) {
         for(int i = 0; i < resultList.size(); ++i) {
            tb_person realocation = new tb_person();
            Object[] obj = (Object[]) resultList.get(i);
            realocation.setP_name((String) obj[1]);
            realocation.setP_tagid((String) obj[2]);
            realocation.setP_sex((String) obj[3]);
            realocation.setP_minzu((String) obj[4]);
            realocation.setP_phone((String) obj[5]);
            realocation.setP_department((String) obj[6]);
            realocation.setP_x((String) obj[12]);
            realocation.setP_y((String) obj[13]);
            realocation.setP_floor((String) obj[14]);
            realocation.setP_sos((String) obj[15]);
            realocation.setP_online((String) obj[16]);
            realocation.setP_power((String) obj[17]);
            realocation.setP_kaoqing((String) obj[18]);
            realocation.setP_fence((String) obj[19]);
            realocation.setP_fencename((String) obj[20]);
            realocation.setP_kaoqqingname((String) obj[21]);
            realocation.setP_image((String) obj[22]);
            realocation.setP_addtiem((String) obj[23]);
            realocation.setP_sousuo((String) obj[25]);
            realocation.setP_shipin((String) obj[26]);
            realocation.setP_fangkeid((String) obj[28]);
            realocation.setP_jingdu((String) obj[29]);
            realocation.setP_weidu((String) obj[30]);
            realocation.setP_gaocheng((String) obj[31]);
            realocation.setBaoliu22((String) obj[49]);
            realocation.setBaoliu23((String) obj[50]);
            realocation.setBaoliu24((String) obj[51]);
            Object[] obj = (Object[])((Object[])resultList.get(i));
            realocation.setP_name((String)obj[1]);
            realocation.setP_tagid((String)obj[2]);
            realocation.setP_sex((String)obj[3]);
            realocation.setP_minzu((String)obj[4]);
            realocation.setP_phone((String)obj[5]);
            realocation.setP_department((String)obj[6]);
            realocation.setP_x((String)obj[12]);
            realocation.setP_y((String)obj[13]);
            realocation.setP_floor((String)obj[14]);
            realocation.setP_sos((String)obj[15]);
            realocation.setP_online((String)obj[16]);
            realocation.setP_power((String)obj[17]);
            realocation.setP_kaoqing((String)obj[18]);
            realocation.setP_fence((String)obj[19]);
            realocation.setP_fencename((String)obj[20]);
            realocation.setP_kaoqqingname((String)obj[21]);
            realocation.setP_image((String)obj[22]);
            realocation.setP_addtiem((String)obj[23]);
            realocation.setP_sousuo((String)obj[25]);
            realocation.setP_shipin((String)obj[26]);
            realocation.setP_fangkeid((String)obj[28]);
            realocation.setP_jingdu((String)obj[29]);
            realocation.setP_weidu((String)obj[30]);
            realocation.setP_gaocheng((String)obj[31]);
            realocation.setBaoliu22((String)obj[49]);
            realocation.setBaoliu23((String)obj[50]);
            realocation.setBaoliu24((String)obj[51]);
            tb_realocationList.add(realocation);
         }
      }
      return tb_realocationList;
   }
   public List<tb_person> getpersonLocationsan2() {
      String sql = null;
      Query query = null;
      sql = "SELECT a.p_name,a.p_tagid,a.p_idcardnum,a.p_x,a.p_y,a.p_floor,a.p_sos,a.p_online,a.p_power,a.p_kaoqing,a.p_fence,a.p_fencename,a.p_kaoqqingname,a.p_image,a.p_addtiem,a.p_sousuo,a.p_shipin,a.baoliu1,a.baoliu2,a.baoliu3,a.baoliu4,a.p_phone,b.type FROM tb_person AS a,tb_tag AS b WHERE a.p_tagid=b.tag_id";
      query = this.em.createNativeQuery(sql);
      List resultList = query.getResultList();
      List<tb_person> tb_realocationList = new ArrayList<tb_person>();
      List<tb_person> tb_realocationList = new ArrayList();
      if (resultList.size() > 0) {
         for (int i = 0; i < resultList.size(); i++) {
         for(int i = 0; i < resultList.size(); ++i) {
            tb_person realocation = new tb_person();
            Object[] obj = (Object[]) resultList.get(i);
            realocation.setP_name((String) obj[0]);
            realocation.setP_tagid((String) obj[1]);
            realocation.setP_idcardnum((String) obj[2]);
            realocation.setP_x((String) obj[3]);
            realocation.setP_y((String) obj[4]);
            realocation.setP_floor((String) obj[5]);
            realocation.setP_sos((String) obj[6]);
            realocation.setP_online((String) obj[7]);
            realocation.setP_power((String) obj[8]);
            realocation.setP_kaoqing((String) obj[9]);
            realocation.setP_fence((String) obj[10]);
            realocation.setP_fencename((String) obj[11]);
            realocation.setP_kaoqqingname((String) obj[12]);
            realocation.setP_image((String) obj[13]);
            realocation.setP_addtiem((String) obj[14]);
            realocation.setP_sousuo((String) obj[15]);
            realocation.setP_shipin((String) obj[16]);
            realocation.setP_fangkeid((String) obj[17]);
            realocation.setP_jingdu((String) obj[18]);
            realocation.setP_weidu((String) obj[19]);
            realocation.setP_gaocheng((String) obj[20]);
            Object[] obj = (Object[])((Object[])resultList.get(i));
            realocation.setP_name((String)obj[0]);
            realocation.setP_tagid((String)obj[1]);
            realocation.setP_idcardnum((String)obj[2]);
            realocation.setP_x((String)obj[3]);
            realocation.setP_y((String)obj[4]);
            realocation.setP_floor((String)obj[5]);
            realocation.setP_sos((String)obj[6]);
            realocation.setP_online((String)obj[7]);
            realocation.setP_power((String)obj[8]);
            realocation.setP_kaoqing((String)obj[9]);
            realocation.setP_fence((String)obj[10]);
            realocation.setP_fencename((String)obj[11]);
            realocation.setP_kaoqqingname((String)obj[12]);
            realocation.setP_image((String)obj[13]);
            realocation.setP_addtiem((String)obj[14]);
            realocation.setP_sousuo((String)obj[15]);
            realocation.setP_shipin((String)obj[16]);
            realocation.setP_fangkeid((String)obj[17]);
            realocation.setP_jingdu((String)obj[18]);
            realocation.setP_weidu((String)obj[19]);
            realocation.setP_gaocheng((String)obj[20]);
            realocation.setP_phone((String)obj[21]);
            realocation.setP_type((String) obj[22]);
            realocation.setP_type((String)obj[22]);
            tb_realocationList.add(realocation);
         }
      }
      return tb_realocationList;
   }
   public List<tb_person> getpersonLocation_all() {
      String sql = null;
      Query query = null;
      sql = "SELECT * FROM tb_person";
      query = this.em.createNativeQuery(sql);
      List resultList = query.getResultList();
      List<tb_person> tb_realocationList = new ArrayList<tb_person>();
      List<tb_person> tb_realocationList = new ArrayList();
      if (resultList.size() > 0) {
         for (int i = 0; i < resultList.size(); i++) {
         for(int i = 0; i < resultList.size(); ++i) {
            tb_person realocation = new tb_person();
            Object[] obj = (Object[]) resultList.get(i);
            realocation.setP_name((String) obj[1]);
            realocation.setP_tagid((String) obj[2]);
            realocation.setP_x((String) obj[12]);
            realocation.setP_y((String) obj[13]);
            realocation.setP_floor((String) obj[14]);
            realocation.setP_sos((String) obj[15]);
            realocation.setP_online((String) obj[16]);
            realocation.setP_power((String) obj[17]);
            realocation.setP_kaoqing((String) obj[18]);
            realocation.setP_fence((String) obj[19]);
            realocation.setP_fencename((String) obj[20]);
            realocation.setP_kaoqqingname((String) obj[21]);
            realocation.setP_image((String) obj[22]);
            realocation.setP_addtiem((String) obj[23]);
            realocation.setP_shipin((String) obj[26]);
            realocation.setP_shipingname((String) obj[27]);
            realocation.setBaoliu6((String) obj[33]);
            realocation.setBaoliu20((String) obj[47]);
            realocation.setBaoliu21((String) obj[48]);
            Object[] obj = (Object[])((Object[])resultList.get(i));
            realocation.setP_name((String)obj[1]);
            realocation.setP_tagid((String)obj[2]);
            realocation.setP_x((String)obj[12]);
            realocation.setP_y((String)obj[13]);
            realocation.setP_floor((String)obj[14]);
            realocation.setP_sos((String)obj[15]);
            realocation.setP_online((String)obj[16]);
            realocation.setP_power((String)obj[17]);
            realocation.setP_kaoqing((String)obj[18]);
            realocation.setP_fence((String)obj[19]);
            realocation.setP_fencename((String)obj[20]);
            realocation.setP_kaoqqingname((String)obj[21]);
            realocation.setP_image((String)obj[22]);
            realocation.setP_addtiem((String)obj[23]);
            realocation.setP_shipin((String)obj[26]);
            realocation.setP_shipingname((String)obj[27]);
            realocation.setBaoliu6((String)obj[33]);
            realocation.setBaoliu20((String)obj[47]);
            realocation.setBaoliu21((String)obj[48]);
            tb_realocationList.add(realocation);
         }
      }
      return tb_realocationList;
   }
   public List<tb_track> getRealPosTrack(String[] taglist,String start_time, String floor) {
   public List<tb_person> getpersonLocation_all2() {
      String sql = null;
      Query query = null;
      Date date=new Date();
      SimpleDateFormat dateFormat=new SimpleDateFormat("YYYYMMdd");
      String now=dateFormat.format(date);
      sql = "SELECT * FROM tb_track_"+now+" WHERE time >='" +start_time+"' AND layer='"+floor+ " ' AND ( ";
//    sql = "SELECT * FROM tb_track WHERE time >='" +start_time+"' AND layer='"+floor+ "' AND (";
      for (int i=0;i<taglist.length;i++) {
         sql += "tagid='"+taglist[i]+"'";
         if (i!=taglist.length-1) {
            sql += " OR ";
         } else {
            sql += " ) ";
         }
      };
      sql += " ORDER BY time";
      sql = "SELECT * FROM tb_person";
      query = this.em.createNativeQuery(sql);
      List resultList = query.getResultList();
      List<tb_track> tb_realTrackList = new ArrayList<tb_track>();
      List<tb_person> tb_realocationList = new ArrayList();
      if (resultList.size() > 0) {
         for (int i = 0; i < resultList.size(); i++) {
         for(int i = 0; i < resultList.size(); ++i) {
            tb_person realocation = new tb_person();
            Object[] obj = (Object[])((Object[])resultList.get(i));
            realocation.setP_name((String)obj[1]);
            realocation.setP_tagid((String)obj[2]);
            realocation.setP_x((String)obj[12]);
            realocation.setP_y((String)obj[13]);
            realocation.setP_floor((String)obj[14]);
            realocation.setP_sos((String)obj[15]);
            realocation.setP_online((String)obj[16]);
            realocation.setP_power((String)obj[17]);
            realocation.setP_kaoqing((String)obj[18]);
            realocation.setP_fence((String)obj[19]);
            realocation.setP_fencename((String)obj[20]);
            realocation.setP_kaoqqingname((String)obj[21]);
            realocation.setP_image((String)obj[22]);
            realocation.setP_addtiem((String)obj[23]);
            realocation.setP_shipin((String)obj[26]);
            realocation.setP_shipingname((String)obj[27]);
            realocation.setBaoliu6((String)obj[33]);
            realocation.setBaoliu20((String)obj[47]);
            realocation.setBaoliu21((String)obj[48]);
            realocation.setBaoliu25((String)obj[52]);
            realocation.setBaoliu26((String)obj[53]);
            realocation.setBaoliu27((String)obj[54]);
            realocation.setBaoliu28((String)obj[55]);
            realocation.setBaoliu29((String)obj[56]);
            realocation.setBaoliu30((String)obj[57]);
            realocation.setBaoliu31((String)obj[58]);
            realocation.setBaoliu32((String)obj[59]);
            tb_realocationList.add(realocation);
         }
      }
      return tb_realocationList;
   }
   public List<tb_track> getRealPosTrack(String[] taglist, String start_time, String floor) {
      String sql = null;
      Query query = null;
      Date date = new Date();
      SimpleDateFormat dateFormat = new SimpleDateFormat("YYYYMMdd");
      String now = dateFormat.format(date);
      sql = "SELECT * FROM tb_track_" + now + " WHERE time >='" + start_time + "' AND layer='" + floor + " ' AND ( ";
      for(int i = 0; i < taglist.length; ++i) {
         sql = sql + "tagid='" + taglist[i] + "'";
         if (i != taglist.length - 1) {
            sql = sql + " OR ";
         } else {
            sql = sql + " ) ";
         }
      }
      sql = sql + " ORDER BY time";
      query = this.em.createNativeQuery(sql);
      List resultList = query.getResultList();
      List<tb_track> tb_realTrackList = new ArrayList();
      if (resultList.size() > 0) {
         for(int i = 0; i < resultList.size(); ++i) {
            tb_track realtrack = new tb_track();
            Object[] obj = (Object[]) resultList.get(i);
            realtrack.setTagid((String) obj[1]);
            realtrack.setX((String) obj[2]);
            realtrack.setY((String) obj[3]);
            realtrack.setZ((String) obj[4]);
            realtrack.setLayer((String) obj[5]);
            realtrack.setTime((String) obj[6]);
            Object[] obj = (Object[])((Object[])resultList.get(i));
            realtrack.setTagid((String)obj[1]);
            realtrack.setX((String)obj[2]);
            realtrack.setY((String)obj[3]);
            realtrack.setZ((String)obj[4]);
            realtrack.setLayer((String)obj[5]);
            realtrack.setTime((String)obj[6]);
            tb_realTrackList.add(realtrack);
         }
      }
      return tb_realTrackList;
   }
   public List<tb_track> getRealPosTrack_all(String[] taglist, String start_time) {
      String sql = null;
      Query query = null;
      Date date=new Date();
      SimpleDateFormat dateFormat=new SimpleDateFormat("YYYYMMdd");
      String now=dateFormat.format(date);
//    sql = "SELECT * FROM tb_track_"+now+" WHERE tagid='"+tagid+"' AND time >='" +start_time+"' ORDER BY time";
//    sql = "SELECT * FROM tb_track WHERE tagid='"+tagid+"' AND time >='" +start_time+"' ORDER BY time";
      sql = "SELECT * FROM tb_track_"+now+" WHERE time >='" +start_time+"' AND ( ";
      for (int i=0;i<taglist.length;i++) {
         sql += "tagid='"+taglist[i]+"'";
         if (i!=taglist.length-1) {
            sql += " OR ";
      Date date = new Date();
      SimpleDateFormat dateFormat = new SimpleDateFormat("YYYYMMdd");
      String now = dateFormat.format(date);
      sql = "SELECT * FROM tb_track_" + now + " WHERE time >='" + start_time + "' AND ( ";
      for(int i = 0; i < taglist.length; ++i) {
         sql = sql + "tagid='" + taglist[i] + "'";
         if (i != taglist.length - 1) {
            sql = sql + " OR ";
         } else {
            sql += " ) ";
            sql = sql + " ) ";
         }
      };
      sql += " ORDER BY time";
      }
      sql = sql + " ORDER BY time";
      query = this.em.createNativeQuery(sql);
      List resultList = query.getResultList();
      List<tb_track> tb_realTrackList = new ArrayList<tb_track>();
      List<tb_track> tb_realTrackList = new ArrayList();
      if (resultList.size() > 0) {
         for (int i = 0; i < resultList.size(); i++) {
         for(int i = 0; i < resultList.size(); ++i) {
            tb_track realtrack = new tb_track();
            Object[] obj = (Object[]) resultList.get(i);
            realtrack.setTagid((String) obj[1]);
            realtrack.setX((String) obj[2]);
            realtrack.setY((String) obj[3]);
            realtrack.setZ((String) obj[4]);
            realtrack.setLayer((String) obj[5]);
            realtrack.setTime((String) obj[6]);
            Object[] obj = (Object[])((Object[])resultList.get(i));
            realtrack.setTagid((String)obj[1]);
            realtrack.setX((String)obj[2]);
            realtrack.setY((String)obj[3]);
            realtrack.setZ((String)obj[4]);
            realtrack.setLayer((String)obj[5]);
            realtrack.setTime((String)obj[6]);
            tb_realTrackList.add(realtrack);
         }
      }
      return tb_realTrackList;
   }
   public List<tb_gas> getGas() {
      String sql = null;
      Query query = null;
      sql = "SELECT gas_type, nong_du, x,y FROM tb_gas";
      query = this.em.createNativeQuery(sql);
      List resultList = query.getResultList();
      List<tb_gas> tb_gasList = new ArrayList<tb_gas>();
      List<tb_gas> tb_gasList = new ArrayList();
      if (resultList.size() > 0) {
         for (int i = 0; i < resultList.size(); i++) {
         for(int i = 0; i < resultList.size(); ++i) {
            tb_gas gas = new tb_gas();
            Object[] obj = (Object[]) resultList.get(i);
            gas.setGas_type((String) obj[0]);
            gas.setNong_du((String) obj[1]);
            gas.setX((String) obj[2]);
            gas.setY((String) obj[3]);
            Object[] obj = (Object[])((Object[])resultList.get(i));
            gas.setGas_type((String)obj[0]);
            gas.setNong_du((String)obj[1]);
            gas.setX((String)obj[2]);
            gas.setY((String)obj[3]);
            tb_gasList.add(gas);
         }
      }
      return tb_gasList;
   }
   public List<tb_gps> getGPS() {
      String sql = null;
      Query query = null;
      sql = "SELECT a.id,a.gps_utc_time,a.gps_weidu,a.gps_NS,a.gsp_jingdu,a.gps_EW,a.gps_state,a.gps_num,a.gps_hdop,a.gps_haiba_gao,a.gps_tuoqiu,a.gps_chafen_time,a.gps_chafen_id,a.gps_jiaoyan,a.tagid,a.gps_kahao,a.gps_power,a.gps_sos,a.addtime,c.p_name,c.p_online,c.p_sex,c.p_minzu,c.p_phone,c.p_department,c.baoliu13,c.baoliu14,c.baoliu15,c.p_addtiem FROM tb_gps AS a,( SELECT tagid, max(addtime) time FROM tb_gps GROUP BY tagid ) AS b, tb_person as c WHERE a.addtime = b.time AND a.tagid = b.tagid AND c.p_tagid=a.tagid";
      query = this.em.createNativeQuery(sql);
      List resultList = query.getResultList();
      List<tb_gps> tb_gpsList = new ArrayList<tb_gps>();
      List<tb_gps> tb_gpsList = new ArrayList();
      if (resultList.size() > 0) {
         for (int i = 0; i < resultList.size(); i++) {
         for(int i = 0; i < resultList.size(); ++i) {
            tb_gps gps = new tb_gps();
            Object[] obj = (Object[]) resultList.get(i);
            gps.setGps_utc_time((String) obj[1]);
            gps.setGps_weidu((String) obj[2]);
            gps.setGps_NS((String) obj[3]);
            gps.setGsp_jingdu((String) obj[4]);
            gps.setGps_EW((String) obj[5]);
            gps.setGps_state((String) obj[20]);
            gps.setGps_num((String) obj[7]);
            gps.setGps_hdop((String) obj[8]);
            gps.setGps_haiba_gao((String) obj[9]);
            gps.setGps_tuoqiu((String) obj[10]);
            gps.setGps_chafen_time((String) obj[11]);
            gps.setGps_chafen_id((String) obj[12]);
            gps.setGps_jiaoyan((String) obj[13]);
            gps.setTagid((String) obj[14]);
            gps.setGps_kahao((String) obj[15]);
            gps.setGps_power((String) obj[16]);
            gps.setGps_sos((String) obj[17]);
            gps.setAddtime((String) obj[18]);
            gps.setName((String) obj[19]);
            gps.setSex((String) obj[21]);
            gps.setMinzu((String) obj[22]);
            gps.setDianhua((String) obj[23]);
            gps.setBumen((String) obj[24]);
            gps.setBaoliu13((String) obj[25]);
            gps.setBaoliu14((String) obj[26]);
            gps.setBaoliu15((String) obj[27]);
            gps.setP_addtiem((String) obj[28]);
            Object[] obj = (Object[])((Object[])resultList.get(i));
            gps.setGps_utc_time((String)obj[1]);
            gps.setGps_weidu((String)obj[2]);
            gps.setGps_NS((String)obj[3]);
            gps.setGsp_jingdu((String)obj[4]);
            gps.setGps_state((String)obj[20]);
            gps.setGps_num((String)obj[7]);
            gps.setGps_hdop((String)obj[8]);
            gps.setGps_haiba_gao((String)obj[9]);
            gps.setGps_tuoqiu((String)obj[10]);
            gps.setGps_chafen_time((String)obj[11]);
            gps.setGps_chafen_id((String)obj[12]);
            gps.setGps_jiaoyan((String)obj[13]);
            gps.setTagid((String)obj[14]);
            gps.setGps_kahao((String)obj[15]);
            gps.setGps_power((String)obj[16]);
            gps.setGps_sos((String)obj[17]);
            gps.setAddtime((String)obj[18]);
            gps.setName((String)obj[19]);
            gps.setSex((String)obj[21]);
            gps.setMinzu((String)obj[22]);
            gps.setDianhua((String)obj[23]);
            gps.setBumen((String)obj[24]);
            gps.setBaoliu13((String)obj[25]);
            gps.setBaoliu14((String)obj[26]);
            gps.setBaoliu15((String)obj[27]);
            gps.setP_addtiem((String)obj[28]);
            tb_gpsList.add(gps);
         }
      }
      return tb_gpsList;
   }
   public List<tb_gps> getGPStrack(String tag_id,String begin_time,String end_time) throws ParseException {
   public List<tb_gps> getGPStrack(String tag_id, String begin_time, String end_time) throws ParseException {
      String sql = null;
      Query query = null;
      SimpleDateFormat dateFormat=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
      Date now=dateFormat.parse(begin_time);
      SimpleDateFormat dateFormat2=new SimpleDateFormat("yyyyMMdd");
      SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
      Date now = dateFormat.parse(begin_time);
      SimpleDateFormat dateFormat2 = new SimpleDateFormat("yyyyMMdd");
      String now2 = dateFormat2.format(now);
      sql = "SELECT a.*,b.p_name FROM tb_gps_track_"+now2+" AS a, tb_person AS b WHERE a.tagid= '"+tag_id+"' AND a.addtime>= '"+begin_time+"' AND a.addtime<= '"+end_time+"' AND a.tagid=b.p_tagid ORDER BY addtime";
      //System.out.print(sql);
      sql = "SELECT a.*,b.p_name FROM tb_gps_track_" + now2 + " AS a, tb_person AS b WHERE a.tagid= '" + tag_id + "' AND a.addtime>= '" + begin_time + "' AND a.addtime<= '" + end_time + "' AND a.tagid=b.p_tagid ORDER BY addtime";
      query = this.em.createNativeQuery(sql);
      List resultList = query.getResultList();
      List<tb_gps> tb_trackList = new ArrayList<tb_gps>();
      List<tb_gps> tb_trackList = new ArrayList();
      if (resultList.size() > 0) {
         for (int i = 0; i < resultList.size(); i++) {
         for(int i = 0; i < resultList.size(); ++i) {
            tb_gps gps = new tb_gps();
            Object[] obj = (Object[]) resultList.get(i);
            gps.setGps_utc_time((String) obj[1]);
            gps.setGps_weidu((String) obj[2]);
            gps.setGps_NS((String) obj[3]);
            gps.setGsp_jingdu((String) obj[4]);
            gps.setGps_EW((String) obj[5]);
            gps.setGps_state((String) obj[6]);
            gps.setGps_num((String) obj[7]);
            gps.setGps_hdop((String) obj[8]);
            gps.setGps_haiba_gao((String) obj[9]);
            gps.setGps_tuoqiu((String) obj[10]);
            gps.setGps_chafen_time((String) obj[11]);
            gps.setGps_chafen_id((String) obj[12]);
            gps.setGps_jiaoyan((String) obj[13]);
            gps.setTagid((String) obj[14]);
            gps.setGps_kahao((String) obj[15]);
            gps.setGps_power((String) obj[16]);
            gps.setGps_sos((String) obj[17]);
            gps.setAddtime((String) obj[18]);
            gps.setName((String) obj[19]);
            Object[] obj = (Object[])((Object[])resultList.get(i));
            gps.setGps_utc_time((String)obj[1]);
            gps.setGps_weidu((String)obj[2]);
            gps.setGps_NS((String)obj[3]);
            gps.setGsp_jingdu((String)obj[4]);
            gps.setGps_EW((String)obj[5]);
            gps.setGps_state((String)obj[6]);
            gps.setGps_num((String)obj[7]);
            gps.setGps_hdop((String)obj[8]);
            gps.setGps_haiba_gao((String)obj[9]);
            gps.setGps_tuoqiu((String)obj[10]);
            gps.setGps_chafen_time((String)obj[11]);
            gps.setGps_chafen_id((String)obj[12]);
            gps.setGps_jiaoyan((String)obj[13]);
            gps.setTagid((String)obj[14]);
            gps.setGps_kahao((String)obj[15]);
            gps.setGps_power((String)obj[16]);
            gps.setGps_sos((String)obj[17]);
            gps.setAddtime((String)obj[18]);
            gps.setName((String)obj[19]);
            tb_trackList.add(gps);
         }
      }
      return tb_trackList;
   }
   @Transactional
   public int gpsRecord_add(tb_gps gps) {
      String sql = null;
      Query query = null;
      sql = "INSERT INTO tb_gps(`gps_utc_time`, `gps_weidu`, `gps_NS`, `gsp_jingdu`, `gps_EW`, "
            + "`gps_state`, `gps_num`, `gps_hdop`, `gps_haiba_gao`, `gps_tuoqiu`, `gps_chafen_time`, `gps_chafen_id`, "
            + "`gps_jiaoyan`, `tagid`, `gps_power`, `addtime`) VALUES(:gps_utc_time, :gps_weidu, :gps_NS,:gsp_jingdu, :gps_EW, "
            + ":gps_state, :gps_num, :gps_hdop, :gps_haiba_gao, :gps_tuoqiu, :gps_chafen_time, "
            + ":gps_chafen_id, :gps_jiaoyan, :tagid, :power, now(3))";
      cs.tb_caozuo("tb_gps", 1);
      sql = "INSERT INTO tb_gps(`gps_utc_time`, `gps_weidu`, `gps_NS`, `gsp_jingdu`, `gps_EW`, `gps_state`, `gps_num`, `gps_hdop`, `gps_haiba_gao`, `gps_tuoqiu`, `gps_chafen_time`, `gps_chafen_id`, `gps_jiaoyan`, `tagid`, `gps_power`, `addtime`) VALUES(:gps_utc_time, :gps_weidu, :gps_NS,:gsp_jingdu, :gps_EW, :gps_state, :gps_num, :gps_hdop, :gps_haiba_gao, :gps_tuoqiu, :gps_chafen_time, :gps_chafen_id, :gps_jiaoyan, :tagid, :power, now(3))";
      this.cs.tb_caozuo("tb_gps", 1);
      query = this.em.createNativeQuery(sql);
      query.setParameter("gps_utc_time", gps.getGps_utc_time());
      query.setParameter("gps_weidu", gps.getGps_weidu());
@@ -1140,7 +1166,7 @@
      int executeUpdate = query.executeUpdate();
      return executeUpdate;
   }
   public List<tb_gps> searchGps(String input) {
      String sql = null;
      Query query = null;
@@ -1148,44 +1174,42 @@
      query = this.em.createNativeQuery(sql);
      query.setParameter("tagid", input);
      List resultList = query.getResultList();
      List<tb_gps> tb_gpsList = new ArrayList<tb_gps>();
      List<tb_gps> tb_gpsList = new ArrayList();
      if (resultList.size() > 0) {
         for (int i = 0; i < resultList.size(); i++) {
         for(int i = 0; i < resultList.size(); ++i) {
            tb_gps gps = new tb_gps();
            Object[] obj = (Object[]) resultList.get(i);
            gps.setGps_utc_time((String) obj[1]);
            gps.setGps_weidu((String) obj[2]);
            gps.setGps_NS((String) obj[3]);
            gps.setGsp_jingdu((String) obj[4]);
            gps.setGps_EW((String) obj[5]);
            gps.setGps_state((String) obj[6]);
            gps.setGps_num((String) obj[7]);
            gps.setGps_hdop((String) obj[8]);
            gps.setGps_haiba_gao((String) obj[9]);
            gps.setGps_tuoqiu((String) obj[10]);
            gps.setGps_chafen_time((String) obj[11]);
            gps.setGps_chafen_id((String) obj[12]);
            gps.setGps_jiaoyan((String) obj[13]);
            gps.setTagid((String) obj[14]);
            gps.setGps_kahao((String) obj[15]);
            gps.setGps_power((String) obj[16]);
            gps.setGps_sos((String) obj[17]);
            gps.setAddtime((String) obj[18]);
            Object[] obj = (Object[])((Object[])resultList.get(i));
            gps.setGps_utc_time((String)obj[1]);
            gps.setGps_weidu((String)obj[2]);
            gps.setGps_NS((String)obj[3]);
            gps.setGsp_jingdu((String)obj[4]);
            gps.setGps_EW((String)obj[5]);
            gps.setGps_state((String)obj[6]);
            gps.setGps_num((String)obj[7]);
            gps.setGps_hdop((String)obj[8]);
            gps.setGps_haiba_gao((String)obj[9]);
            gps.setGps_tuoqiu((String)obj[10]);
            gps.setGps_chafen_time((String)obj[11]);
            gps.setGps_chafen_id((String)obj[12]);
            gps.setGps_jiaoyan((String)obj[13]);
            gps.setTagid((String)obj[14]);
            gps.setGps_kahao((String)obj[15]);
            gps.setGps_power((String)obj[16]);
            gps.setGps_sos((String)obj[17]);
            gps.setAddtime((String)obj[18]);
            tb_gpsList.add(gps);
         }
      }
      return tb_gpsList;
   }
   @Transactional
   public int gpsRecord_modify(tb_gps gps) {
      String sql = null;
      Query query = null;
      sql = "UPDATE tb_gps SET gps_utc_time=:gps_utc_time,gps_weidu=:gps_weidu,gps_NS=:gps_NS,gsp_jingdu=:gsp_jingdu"
            + ",gps_EW=:gps_EW,gps_state=:gps_state,gps_num=:gps_num,gps_hdop=:gps_hdop,gps_haiba_gao=:gps_haiba_gao,"
            + "gps_tuoqiu=:gps_tuoqiu,gps_chafen_time=:gps_chafen_time ,gps_chafen_id=:gps_chafen_id,gps_jiaoyan=:gps_jiaoyan,gps_power=:power, addtime=now(3) "
            + "WHERE tagid=:tagid";
      cs.tb_caozuo("tb_gps", 3);
      sql = "UPDATE tb_gps SET gps_utc_time=:gps_utc_time,gps_weidu=:gps_weidu,gps_NS=:gps_NS,gsp_jingdu=:gsp_jingdu,gps_EW=:gps_EW,gps_state=:gps_state,gps_num=:gps_num,gps_hdop=:gps_hdop,gps_haiba_gao=:gps_haiba_gao,gps_tuoqiu=:gps_tuoqiu,gps_chafen_time=:gps_chafen_time ,gps_chafen_id=:gps_chafen_id,gps_jiaoyan=:gps_jiaoyan,gps_power=:power, addtime=now(3) WHERE tagid=:tagid";
      this.cs.tb_caozuo("tb_gps", 3);
      query = this.em.createNativeQuery(sql);
      query.setParameter("gps_utc_time", gps.getGps_utc_time());
      query.setParameter("gps_weidu", gps.getGps_weidu());
@@ -1205,16 +1229,12 @@
      int executeUpdate = query.executeUpdate();
      return executeUpdate;
   }
   @Transactional
   public int gpsTrack_add(tb_gps gps) {
      String sql = null;
      Query query = null;
      sql = "INSERT INTO tb_gps_track(`gps_utc_time`, `gps_weidu`, `gps_NS`, `gsp_jingdu`, `gps_EW`, "
            + "`gps_state`, `gps_num`, `gps_hdop`, `gps_haiba_gao`, `gps_tuoqiu`, `gps_chafen_time`, `gps_chafen_id`, "
            + "`gps_jiaoyan`, `tagid`, `gps_power`, `addtime`) VALUES(:gps_utc_time, :gps_weidu, :gps_NS,:gsp_jingdu, :gps_EW, "
            + ":gps_state, :gps_num, :gps_hdop, :gps_haiba_gao, :gps_tuoqiu, :gps_chafen_time, "
            + ":gps_chafen_id, :gps_jiaoyan, :tagid, :power, now())";
      sql = "INSERT INTO tb_gps_track(`gps_utc_time`, `gps_weidu`, `gps_NS`, `gsp_jingdu`, `gps_EW`, `gps_state`, `gps_num`, `gps_hdop`, `gps_haiba_gao`, `gps_tuoqiu`, `gps_chafen_time`, `gps_chafen_id`, `gps_jiaoyan`, `tagid`, `gps_power`, `addtime`) VALUES(:gps_utc_time, :gps_weidu, :gps_NS,:gsp_jingdu, :gps_EW, :gps_state, :gps_num, :gps_hdop, :gps_haiba_gao, :gps_tuoqiu, :gps_chafen_time, :gps_chafen_id, :gps_jiaoyan, :tagid, :power, now())";
      query = this.em.createNativeQuery(sql);
      query.setParameter("gps_utc_time", gps.getGps_utc_time());
      query.setParameter("gps_weidu", gps.getGps_weidu());
@@ -1234,91 +1254,103 @@
      int executeUpdate = query.executeUpdate();
      return executeUpdate;
   }
   @Transactional
   public int fencegao(String tagid) {
      String sql = null;
      Query query = null;
      sql = "UPDATE tb_person SET p_fence=0 WHERE p_tagid=:tagid";
      cs.tb_caozuo("tb_person", 3);
      this.cs.tb_caozuo("tb_person", 3);
      query = this.em.createNativeQuery(sql);
      query.setParameter("tagid", tagid);
      int executeUpdate = query.executeUpdate();
      return executeUpdate;
   }
   @Transactional
   public int sosgao(String tagid) {
      String sql = null;
      Query query = null;
      sql = "UPDATE tb_person SET p_sos=0 WHERE p_tagid=:tagid";
      cs.tb_caozuo("tb_person", 3);
      this.cs.tb_caozuo("tb_person", 3);
      query = this.em.createNativeQuery(sql);
      query.setParameter("tagid", tagid);
      int executeUpdate = query.executeUpdate();
      return executeUpdate;
   }
   @Transactional
   public int sosgao2(String tagid, String type) {
      String sql = null;
      Query query = null;
      sql = "UPDATE tb_person SET " + type + "=0 WHERE p_tagid=:tagid";
      this.cs.tb_caozuo("tb_person", 3);
      query = this.em.createNativeQuery(sql);
      query.setParameter("tagid", tagid);
      int executeUpdate = query.executeUpdate();
      return executeUpdate;
   }
   @Transactional
   public int chaichugao(String tagid) {
      String sql = null;
      Query query = null;
      sql = "UPDATE tb_person SET baoliu6=0 WHERE p_tagid=:tagid";
      cs.tb_caozuo("tb_person", 3);
      this.cs.tb_caozuo("tb_person", 3);
      query = this.em.createNativeQuery(sql);
      query.setParameter("tagid", tagid);
      int executeUpdate = query.executeUpdate();
      return executeUpdate;
   }
   @Transactional
   public int jinmengao(String tagid) {
      String sql = null;
      Query query = null;
      sql = "UPDATE tb_person SET baoliu20=0 WHERE p_tagid=:tagid";
      cs.tb_caozuo("tb_person", 3);
      this.cs.tb_caozuo("tb_person", 3);
      query = this.em.createNativeQuery(sql);
      query.setParameter("tagid", tagid);
      int executeUpdate = query.executeUpdate();
      return executeUpdate;
   }
   @Transactional
   public int chumengao(String tagid) {
      String sql = null;
      Query query = null;
      sql = "UPDATE tb_person SET baoliu21=0 WHERE p_tagid=:tagid";
      cs.tb_caozuo("tb_person", 3);
      this.cs.tb_caozuo("tb_person", 3);
      query = this.em.createNativeQuery(sql);
      query.setParameter("tagid", tagid);
      int executeUpdate = query.executeUpdate();
      return executeUpdate;
   }
   @Transactional
   public int shipin(String tagid) {
      String sql = null;
      Query query = null;
      sql = "UPDATE tb_person SET p_shipin=0 WHERE p_tagid=:tagid";
      cs.tb_caozuo("tb_person", 3);
      this.cs.tb_caozuo("tb_person", 3);
      query = this.em.createNativeQuery(sql);
      query.setParameter("tagid", tagid);
      int executeUpdate = query.executeUpdate();
      return executeUpdate;
   }
   public String getstatus(String tagid) {
      String sql = null;
      Query query = null;
      sql = "SELECT status from tb_tag WHERE tag_id=:tagid";
      cs.tb_caozuo("tb_gps", 3);
      this.cs.tb_caozuo("tb_gps", 3);
      query = this.em.createNativeQuery(sql);
      query.setParameter("tagid", tagid);
      List resultList = query.getResultList();
      String status = resultList.get(0).toString();
      return status;
   }
   public String getfencezuobiao() {
      String sql = null;
      Query query = null;
@@ -1328,7 +1360,7 @@
      String status = resultList.get(0).toString();
      return status;
   }
   public String getfencehaibagao() {
      String sql = null;
      Query query = null;
@@ -1338,28 +1370,25 @@
      String status = resultList.get(0).toString();
      return status;
   }
   public List<tb_person> getfencename(String tagid) {
      String sql = null;
      Query query = null;
      sql = "SELECT p_fencename from tb_person WHERE p_tagid="+tagid;
      sql = "SELECT p_fencename from tb_person WHERE p_tagid=" + tagid;
      query = this.em.createNativeQuery(sql);
//    //System.out.print(sql);
      List resultList = query.getResultList();
//    //System.out.print(resultList.size());
      List<tb_person> tb_person = new ArrayList<tb_person>();
      List<tb_person> tb_person = new ArrayList();
      if (resultList.size() > 0) {
         for (int i = 0; i < resultList.size(); i++) {
         for(int i = 0; i < resultList.size(); ++i) {
            tb_person person = new tb_person();
//          Object[] obj = (Object[]) resultList.get(i);
            person.setP_fencename(resultList.get(i) == null ? "" : resultList.get(i).toString());
//          //System.out.print(person.getP_fencename());
            tb_person.add(person);
         }
      }
      return tb_person;
   }
   public List<tb_shipin> getshebeiid(String fencename) {
      String sql = null;
      Query query = null;
@@ -1367,31 +1396,32 @@
      query = this.em.createNativeQuery(sql);
      query.setParameter("fencename", fencename);
      List resultList = query.getResultList();
      List<tb_shipin> tb_shipinList = new ArrayList<tb_shipin>();
      List<tb_shipin> tb_shipinList = new ArrayList();
      if (resultList.size() > 0) {
         for (int i = 0; i < resultList.size(); i++) {
         for(int i = 0; i < resultList.size(); ++i) {
            tb_shipin shipin = new tb_shipin();
            Object[] obj = (Object[]) resultList.get(i);
            shipin.setYonghuming((String) obj[0]);
            shipin.setMima((String) obj[1]);
            Object[] obj = (Object[])((Object[])resultList.get(i));
            shipin.setYonghuming((String)obj[0]);
            shipin.setMima((String)obj[1]);
            tb_shipinList.add(shipin);
         }
      }
      return tb_shipinList;
   }
   public List<tb_qihou> qihoucha() {
      String sql = null;
      Query query = null;
      sql = "SELECT id,time,place,weather,wd,sd FROM tb_qihou";
      query = this.em.createNativeQuery(sql);
      List resultList = query.getResultList();
      List<tb_qihou> tb_qihouList = new ArrayList<tb_qihou>();
      List<tb_qihou> tb_qihouList = new ArrayList();
      if (resultList.size() > 0) {
         for (int i = 0; i < resultList.size(); i++) {
         for(int i = 0; i < resultList.size(); ++i) {
            tb_qihou qihou = new tb_qihou();
            Object[] obj = (Object[]) resultList.get(i);
            qihou.setId((int) obj[0]);
            Object[] obj = (Object[])((Object[])resultList.get(i));
            qihou.setId((Integer)obj[0]);
            qihou.setTime(obj[1] == null ? "" : obj[1].toString());
            qihou.setPlace(obj[2] == null ? "" : obj[2].toString());
            qihou.setWeather(obj[3] == null ? "" : obj[3].toString());
@@ -1400,9 +1430,10 @@
            tb_qihouList.add(qihou);
         }
      }
      return tb_qihouList;
   }
   public List<tb_qihou> qihoucha(int page) {
      String sql = null;
      Query query = null;
@@ -1411,12 +1442,12 @@
      query.setParameter("start", (page - 1) * Integer.parseInt(ModifyConfig.readData(Config.getPageConfig(), "perPage")));
      query.setParameter("end", Integer.parseInt(ModifyConfig.readData(Config.getPageConfig(), "perPage")));
      List resultList = query.getResultList();
      List<tb_qihou> tb_qihouList = new ArrayList<tb_qihou>();
      List<tb_qihou> tb_qihouList = new ArrayList();
      if (resultList.size() > 0) {
         for (int i = 0; i < resultList.size(); i++) {
         for(int i = 0; i < resultList.size(); ++i) {
            tb_qihou qihou = new tb_qihou();
            Object[] obj = (Object[]) resultList.get(i);
            qihou.setId((int) obj[0]);
            Object[] obj = (Object[])((Object[])resultList.get(i));
            qihou.setId((Integer)obj[0]);
            qihou.setTime(obj[1] == null ? "" : obj[1].toString());
            qihou.setPlace(obj[2] == null ? "" : obj[2].toString());
            qihou.setWeather(obj[3] == null ? "" : obj[3].toString());
@@ -1425,9 +1456,10 @@
            tb_qihouList.add(qihou);
         }
      }
      return tb_qihouList;
   }
   @Transactional
   public int qihouzeng(tb_qihou qihou) {
      String sql = null;
@@ -1441,17 +1473,19 @@
      int executeUpdate = query.executeUpdate();
      return executeUpdate;
   }
   @Transactional
   public void qihoudelete(String[] checkVal) {
      String sql = null;
      Query query = null;
      for (int i = 0; i < checkVal.length; i++) {
      for(int i = 0; i < checkVal.length; ++i) {
         sql = "DELETE FROM tb_qihou WHERE id = :id";
         query = this.em.createNativeQuery(sql);
         query.setParameter("id", checkVal[i]);
         query.executeUpdate();
      }
   }
   @Transactional
@@ -1476,7 +1510,7 @@
      query.setParameter("sd", qihou.getSd());
      query.executeUpdate();
   }
   public int getqihouManagementCount() {
      String sql = null;
      Query query = null;
@@ -1484,120 +1518,126 @@
      query = this.em.createNativeQuery(sql);
      return Integer.parseInt(query.getSingleResult().toString());
   }
   public List<tb_realkaoqing> getkaoqinsan() {
      String sql = null;
      Query query = null;
      sql = "SELECT * FROM tb_realkaoqing";
      query = this.em.createNativeQuery(sql);
      List resultList = query.getResultList();
      List<tb_realkaoqing> tb_realkaoqinList = new ArrayList<tb_realkaoqing>();
      List<tb_realkaoqing> tb_realkaoqinList = new ArrayList();
      if (resultList.size() > 0) {
         for (int i = 0; i < resultList.size(); i++) {
         for(int i = 0; i < resultList.size(); ++i) {
            tb_realkaoqing realocation = new tb_realkaoqing();
            Object[] obj = (Object[]) resultList.get(i);
            realocation.setArea((String) obj[1]);
            realocation.setName((String) obj[2]);
            realocation.setBumen((String) obj[3]);
            realocation.setTagid((String) obj[4]);
            realocation.setIntime((String) obj[5]);
            realocation.setJuli((String) obj[7]);
            Object[] obj = (Object[])((Object[])resultList.get(i));
            realocation.setArea((String)obj[1]);
            realocation.setName((String)obj[2]);
            realocation.setBumen((String)obj[3]);
            realocation.setTagid((String)obj[4]);
            realocation.setIntime((String)obj[5]);
            realocation.setJuli((String)obj[7]);
            tb_realkaoqinList.add(realocation);
         }
      }
      return tb_realkaoqinList;
   }
   public List<tb_person> getsosgaojing() {
      String sql = null;
      Query query = null;
      sql = "select p_tagid from tb_person where p_sos = '1'";
      query = this.em.createNativeQuery(sql);
      List resultList = query.getResultList();
      List<tb_person> soslist = new ArrayList<tb_person>();
      List<tb_person> soslist = new ArrayList();
      if (resultList.size() > 0) {
         for (int i = 0; i < resultList.size(); i++) {
         for(int i = 0; i < resultList.size(); ++i) {
            tb_person person = new tb_person();
            person.setP_tagid(resultList.get(i) == null ? "" : resultList.get(i).toString());
            soslist.add(person);
         }
      }
      return soslist;
   }
   public List<tb_person> getfencegaojing() {
      String sql = null;
      Query query = null;
      sql = "select p_tagid from tb_person where p_fence = '1'";
      query = this.em.createNativeQuery(sql);
      List resultList = query.getResultList();
      List<tb_person> soslist = new ArrayList<tb_person>();
      List<tb_person> soslist = new ArrayList();
      if (resultList.size() > 0) {
         for (int i = 0; i < resultList.size(); i++) {
         for(int i = 0; i < resultList.size(); ++i) {
            tb_person person = new tb_person();
            person.setP_tagid(resultList.get(i) == null ? "" : resultList.get(i).toString());
            soslist.add(person);
         }
      }
      return soslist;
   }
   public List<tb_person> getchufencegaojing() {
      String sql = null;
      Query query = null;
      sql = "select p_tagid from tb_person where p_fence = '2'";
      query = this.em.createNativeQuery(sql);
      List resultList = query.getResultList();
      List<tb_person> soslist = new ArrayList<tb_person>();
      List<tb_person> soslist = new ArrayList();
      if (resultList.size() > 0) {
         for (int i = 0; i < resultList.size(); i++) {
         for(int i = 0; i < resultList.size(); ++i) {
            tb_person person = new tb_person();
            person.setP_tagid(resultList.get(i) == null ? "" : resultList.get(i).toString());
            soslist.add(person);
         }
      }
      return soslist;
   }
   public List<tb_person> getjinchumengaojing() {
      String sql = null;
      Query query = null;
      sql = "select p_tagid from tb_person where baoliu20 = '1' and baoliu21 = '1'";
      query = this.em.createNativeQuery(sql);
      List resultList = query.getResultList();
      List<tb_person> soslist = new ArrayList<tb_person>();
      List<tb_person> soslist = new ArrayList();
      if (resultList.size() > 0) {
         for (int i = 0; i < resultList.size(); i++) {
         for(int i = 0; i < resultList.size(); ++i) {
            tb_person person = new tb_person();
            person.setP_tagid(resultList.get(i) == null ? "" : resultList.get(i).toString());
            soslist.add(person);
         }
      }
      return soslist;
   }
   public List<tb_jingwei> getjingwei() {
      String sql = null;
      Query query = null;
      sql = "SELECT id,qishi,zhongzhi,jieguo,addtime FROM tb_jingwei ORDER BY addtime DESC";
      query = this.em.createNativeQuery(sql);
      List resultList = query.getResultList();
      List<tb_jingwei> tb_jingweiList = new ArrayList<tb_jingwei>();
      List<tb_jingwei> tb_jingweiList = new ArrayList();
      if (resultList.size() > 0) {
         for (int i = 0; i < resultList.size(); i++) {
         for(int i = 0; i < resultList.size(); ++i) {
            tb_jingwei jingwei = new tb_jingwei();
            Object[] obj = (Object[]) resultList.get(i);
            jingwei.setId((int) obj[0]);
            jingwei.setQishi((String) obj[1]);
            jingwei.setZhongzhi((String) obj[2]);
            jingwei.setJieguo((String) obj[3]);
            jingwei.setAddtime((String) obj[4]);
            Object[] obj = (Object[])((Object[])resultList.get(i));
            jingwei.setId((Integer)obj[0]);
            jingwei.setQishi((String)obj[1]);
            jingwei.setZhongzhi((String)obj[2]);
            jingwei.setJieguo((String)obj[3]);
            jingwei.setAddtime((String)obj[4]);
            tb_jingweiList.add(jingwei);
         }
      }
      return tb_jingweiList;
   }
   @Transactional
   public int addjingwei(tb_jingwei jingwei) {
      String sql = null;
@@ -1611,35 +1651,36 @@
      int executeUpdate = query.executeUpdate();
      return executeUpdate;
   }
   public List<tb_nav> getnav() {
      String sql = null;
      Query query = null;
      sql = "SELECT id,label,achor,gps,fence,warning,history,attendance,basiclnfo,video,gas FROM tb_nav";
      query = this.em.createNativeQuery(sql);
      List resultList = query.getResultList();
      List<tb_nav> navlist = new ArrayList<tb_nav>();
      List<tb_nav> navlist = new ArrayList();
      if (resultList.size() > 0) {
         for (int i = 0; i < resultList.size(); i++) {
         for(int i = 0; i < resultList.size(); ++i) {
            tb_nav nav = new tb_nav();
            Object[] obj = (Object[]) resultList.get(i);
            nav.setId((int) obj[0]);
            nav.setLabel((String) obj[1]);
            nav.setAchor((String) obj[2]);
            nav.setGps((String) obj[3]);
            nav.setFence((String) obj[4]);
            nav.setWarning((String) obj[5]);
            nav.setHistory((String) obj[6]);
            nav.setAttendance((String) obj[7]);
            nav.setBasiclnfo((String) obj[8]);
            nav.setVideo((String) obj[9]);
            nav.setGas((String) obj[10]);
            Object[] obj = (Object[])((Object[])resultList.get(i));
            nav.setId((Integer)obj[0]);
            nav.setLabel((String)obj[1]);
            nav.setAchor((String)obj[2]);
            nav.setGps((String)obj[3]);
            nav.setFence((String)obj[4]);
            nav.setWarning((String)obj[5]);
            nav.setHistory((String)obj[6]);
            nav.setAttendance((String)obj[7]);
            nav.setBasiclnfo((String)obj[8]);
            nav.setVideo((String)obj[9]);
            nav.setGas((String)obj[10]);
            navlist.add(nav);
         }
      }
      return navlist;
   }
   @Transactional
   public int updatenav(tb_nav nav) {
      String sql = null;
@@ -1659,48 +1700,50 @@
      int executeUpdate = query.executeUpdate();
      return executeUpdate;
   }
   public List<tb_person> getbumen(){
   public List<tb_person> getbumen() {
      String sql = null;
      Query query = null;
      sql = "select p_name,p_department,p_tagid from tb_person";
      query = this.em.createNativeQuery(sql);
      List resultlist = query.getResultList();
      List<tb_person> persons = new ArrayList<>();
      if(resultlist.size() > 0) {
         for(int i=0; i<resultlist.size(); i++) {
            Object[] obj = (Object[]) resultlist.get(i);
      List<tb_person> persons = new ArrayList();
      if (resultlist.size() > 0) {
         for(int i = 0; i < resultlist.size(); ++i) {
            Object[] obj = (Object[])((Object[])resultlist.get(i));
            tb_person person = new tb_person();
            person.setP_name(obj[0] == null?null:obj[0].toString());
            person.setP_department(obj[1] == null?null:obj[1].toString());
            person.setP_tagid(obj[2] == null?null:obj[2].toString());
            person.setP_name(obj[0] == null ? null : obj[0].toString());
            person.setP_department(obj[1] == null ? null : obj[1].toString());
            person.setP_tagid(obj[2] == null ? null : obj[2].toString());
            persons.add(person);
         }
      }
      return persons;
   }
   public List<tb_message> getmessage(){
   public List<tb_message> getmessage() {
      String sql = null;
      Query query = null;
      sql = "SELECT * FROM tb_message_history WHERE Replytime IS NOT NULL order by Replytime desc";
      query = this.em.createNativeQuery(sql);
      List resultlist = query.getResultList();
      List<tb_message> messages = new ArrayList<>();
      List<tb_message> messages = new ArrayList();
      if (resultlist.size() > 0) {
         for (int i=0; i<resultlist.size(); i++) {
            Object[] obj = (Object[]) resultlist.get(i);
         for(int i = 0; i < resultlist.size(); ++i) {
            Object[] obj = (Object[])((Object[])resultlist.get(i));
            tb_message mess = new tb_message();
            mess.setId((int)obj[0]);
            mess.setMessage(obj[7]==null?null:obj[7].toString());
            mess.setAddtime(obj[6]==null?null:obj[6].toString());
            mess.setBaoliu2(obj[8]==null?null:obj[8].toString());
            mess.setId((Integer)obj[0]);
            mess.setMessage(obj[7] == null ? null : obj[7].toString());
            mess.setAddtime(obj[6] == null ? null : obj[6].toString());
            mess.setBaoliu2(obj[8] == null ? null : obj[8].toString());
            messages.add(mess);
         }
      }
      return messages;
   }
   @Transactional
   public void deletemessage(String date) {
      String sql = null;
@@ -1710,8 +1753,8 @@
      query.setParameter("date", date);
      query.executeUpdate();
   }
   public String getlixian(){
   public String getlixian() {
      String sql = null;
      Query query = null;
      sql = "SELECT baoliu5 FROM tb_linshi_fence_22414 WHERE id = 1";
@@ -1719,4 +1762,84 @@
      List resultlist = query.getResultList();
      return resultlist.get(0).toString();
   }
   public List<tb_person> getRight(int page) {
      String sql = null;
      Query query = null;
      sql = "SELECT p_name,p_department,p_tagid,p_power,p_online,p_sex FROM tb_person ORDER BY p_online DESC, p_tagid ASC ";
      query = this.em.createNativeQuery(sql);
      List resultlist = query.getResultList();
      List<tb_person> tb_personList = new ArrayList();
      for(int i = 0; i < resultlist.size(); ++i) {
         Object[] obj = (Object[])((Object[])resultlist.get(i));
         tb_person person = new tb_person();
         person.setP_name(obj[0].toString());
         person.setP_department(obj[1].toString());
         person.setP_tagid(obj[2].toString());
         person.setP_power(obj[3].toString());
         person.setP_online(obj[4].toString());
         person.setP_sex(obj[5].toString());
         tb_personList.add(person);
      }
      return tb_personList;
   }
   @Transactional
   public int XiuGaiBiaoTi() {
      String sql = null;
      Query query = null;
      sql = "UPDATE tb_system SET title = '' WHERE ID = 1";
      query = this.em.createNativeQuery(sql);
      int up = query.executeUpdate();
      return up;
   }
   @Transactional
   public int XiuGaiBiaoTi1() {
      String sql = null;
      Query query = null;
      sql = "UPDATE tb_system SET title = '定位管理系统' WHERE ID = 1";
      query = this.em.createNativeQuery(sql);
      int up = query.executeUpdate();
      return up;
   }
   public List MianLogin() {
      String sql = null;
      Query query = null;
      sql = "SELECT baoliu25 FROM tb_system";
      query = this.em.createNativeQuery(sql);
      List login = query.getResultList();
      return login;
   }
   public List selectRenYuan(String tagid) {
      String sql = null;
      Query query = null;
      sql = "SELECT * FROM tb_person WHERE p_tagid = :tagid";
      query = this.em.createNativeQuery(sql);
      query.setParameter("tagid", tagid);
      List ry = query.getResultList();
      return ry;
   }
   //标签地图层信息
   public List<tb_tagfloor> selectTagFloor(){
      String sql = null;
      Query query = null;
      sql = "SELECT p_tagid,p_floor,p_name FROM tb_person";
      query = this.em.createNativeQuery(sql);
      List resultlist = query.getResultList();
      List<tb_tagfloor> tb_personList = new ArrayList();
      for(int i = 0; i < resultlist.size(); ++i) {
         Object[] obj = (Object[])((Object[])resultlist.get(i));
         tb_tagfloor person = new tb_tagfloor();
         person.setTagid(obj[0].toString());
         person.setFloor(obj[1].toString());
         person.setName(obj[2].toString());
         tb_personList.add(person);
      }
      return tb_personList;
   }
}