From e150655a785de36a65a26a0dc4d3d6d65fe7e9d0 Mon Sep 17 00:00:00 2001
From: fxl <473369119@qq.com>
Date: 星期四, 04 五月 2023 18:03:37 +0800
Subject: [PATCH] 11111

---
 src/main/java/com/hxzkoa/services/GpsService.java |  530 +++++++++++++++++++++++++++++++++++++++++-----------------
 1 files changed, 372 insertions(+), 158 deletions(-)

diff --git a/src/main/java/com/hxzkoa/services/GpsService.java b/src/main/java/com/hxzkoa/services/GpsService.java
index ecbf8b3..aa9aa45 100644
--- a/src/main/java/com/hxzkoa/services/GpsService.java
+++ b/src/main/java/com/hxzkoa/services/GpsService.java
@@ -1,140 +1,86 @@
+//
+// Source code recreated from a .class file by IntelliJ IDEA
+// (powered by FernFlower decompiler)
+//
+
 package com.hxzkoa.services;
 
+import com.hxzkoa.json.tb_gps;
+import com.hxzkoa.json.tb_rtkanchor;
+import com.hxzkoa.json.tb_system;
+import com.hxzkoa.util.Config;
+import com.hxzkoa.util.ModifyConfig;
 import java.io.BufferedReader;
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.FileNotFoundException;
-import java.io.FileReader;
 import java.io.IOException;
 import java.io.InputStreamReader;
-import java.io.Reader;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
 import java.util.ArrayList;
-import java.util.Date;
 import java.util.LinkedList;
 import java.util.List;
-
 import javax.persistence.EntityManager;
 import javax.persistence.PersistenceContext;
 import javax.persistence.Query;
-
-import org.apache.commons.io.FileUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
-import com.hxzkoa.json.tb_fence;
-import com.hxzkoa.json.tb_gas;
-import com.hxzkoa.json.tb_gps;
-import com.hxzkoa.json.tb_person;
-import com.hxzkoa.json.tb_realocation;
-import com.hxzkoa.json.tb_system;
-import com.hxzkoa.json.tb_track;
-import com.hxzkoa.util.Config;
-import com.hxzkoa.util.ModifyConfig;
-
 @Service
 public class GpsService {
 	@PersistenceContext
 	private EntityManager em;
 	@Autowired
 	private CaozuoService cs;
-	
-	
+
+	public GpsService() {
+	}
+
 	public List<String> txt() {
-		List<String> list = new LinkedList<>();
-		
-		String filePath="D:\\baowen.txt";
-		
-        File file=new File(filePath);
-        
-        BufferedReader reader = null;//瀛楃杈撳叆娴佽繘琛岃鍙栨搷浣滆鍙�
-       
-        String tempString = null;//姣忎竴琛岀殑鍐呭
-        
-        int line =1;//琛屽彿
-        
-        try {
-        	//杈撳叆瀛楄妭娴侊紝FileInputStream涓昏鐢ㄦ潵鎿嶄綔鏂囦欢杈撳叆娴�
-        	FileInputStream intput = new FileInputStream(file);
-        	
-            // System.out.println("浠ヨ涓哄崟浣嶈鍙栨枃浠跺唴瀹癸紝涓�娆¤涓�鏁磋锛�")
-        	//InputStreamReader鏄浆鎹㈡祦锛屽皢瀛楄妭娴佽浆鎴愬瓧绗︽祦
-            reader = new BufferedReader(new InputStreamReader(intput));
-            
-            while ((tempString = reader.readLine()) != null) {
-                list.add(tempString);
-            }
-            
-        } catch (FileNotFoundException e) {
-            e.printStackTrace();
-        } catch (IOException e) {
-            e.printStackTrace();
-        }finally{
-            if(reader != null){
-                try {
-                    reader.close();
-                } catch (IOException e) {
-                    e.printStackTrace();
-                }
-            }
-        }
-    return list;
-  }
-	
+		List<String> list = new LinkedList();
+		String filePath = "D:\\baowen.txt";
+		File file = new File(filePath);
+		BufferedReader reader = null;
+		String tempString = null;
+
+
+		try {
+			FileInputStream intput = new FileInputStream(file);
+			reader = new BufferedReader(new InputStreamReader(intput));
+
+			while((tempString = reader.readLine()) != null) {
+				list.add(tempString);
+			}
+		} catch (FileNotFoundException var18) {
+			var18.printStackTrace();
+		} catch (IOException var19) {
+			var19.printStackTrace();
+		} finally {
+			if (reader != null) {
+				try {
+					reader.close();
+				} catch (IOException var17) {
+					var17.printStackTrace();
+				}
+			}
+
+		}
+
+		return list;
+	}
+
 	public List<tb_gps> getGpsManagement() {
 		String sql = null;
 		Query query = null;
-		sql = "SELECT id,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_kahao,gps_power,gps_sos,addtime FROM tb_gps";
+		sql = "SELECT id,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_kahao,gps_power,gps_sos,addtime,ccid FROM tb_gps";
 		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.setId((int) obj[0]);
-				gps.setGps_utc_time(obj[1] == null ? "" : obj[1].toString());
-				gps.setGps_weidu(obj[2] == null ? "" : obj[2].toString());
-				gps.setGps_NS(obj[3] == null ? "" : obj[3].toString());
-				gps.setGsp_jingdu(obj[4] == null ? "" : obj[4].toString());
-				gps.setGps_EW(obj[5] == null ? "" : obj[5].toString());
-				gps.setGps_state(obj[6] == null ? "" : obj[6].toString());
-				gps.setGps_num(obj[7] == null ? "" : obj[7].toString());
-				gps.setGps_hdop(obj[8] == null ? "" : obj[8].toString());
-				gps.setGps_haiba_gao(obj[9] == null ? "" : obj[9].toString());
-				gps.setGps_tuoqiu(obj[10] == null ? "" : obj[10].toString());
-				gps.setGps_chafen_time(obj[11] == null ? "" : obj[11].toString());
-				gps.setGps_chafen_id(obj[12] == null ? "" : obj[12].toString());
-				gps.setTagid(obj[13] == null ? "" : obj[13].toString());
-				gps.setGps_kahao(obj[14] == null ? "" : obj[14].toString());
-				gps.setGps_power(obj[15] == null ? "" : obj[15].toString());
-				gps.setGps_sos(obj[16] == null ? "" : obj[16].toString());
-				gps.setAddtime(obj[17] == null ? "" : obj[17].toString());
-				tb_gpsList.add(gps);
-			}
-		}
-		return tb_gpsList;
-	}
-	
-	public List<tb_gps> getGpsManagement(int page) {
-		int perPage = Integer.parseInt(ModifyConfig.readData(Config.getPageConfig(), "perPage"));
-		int start = (page - 1) * perPage;
-		int end = perPage;
-		String sql = null;
-		Query query = null;
-		sql = "SELECT id,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_kahao,gps_power,gps_sos,addtime FROM tb_gps order by addtime desc LIMIT :start,:end";
-		query = this.em.createNativeQuery(sql);
-		query.setParameter("start", start);
-		query.setParameter("end", end);
-		List resultList = query.getResultList();
-		List<tb_gps> tb_gpsList = new ArrayList<tb_gps>();
-		if (resultList.size() > 0) {
-			for (int i = 0; i < resultList.size(); i++) {
-				tb_gps gps = new tb_gps();
-				Object[] obj = (Object[]) resultList.get(i);
-				gps.setId((int) obj[0]);
+				Object[] obj = (Object[])((Object[])resultList.get(i));
+				gps.setId((Integer)obj[0]);
 				gps.setGps_utc_time(obj[1] == null ? "" : obj[1].toString());
 				gps.setGps_weidu(obj[2] == null ? "" : obj[2].toString());
 				gps.setGps_NS(obj[3] == null ? "" : obj[3].toString());
@@ -153,12 +99,57 @@
 				gps.setGps_power(obj[16] == null ? "" : obj[16].toString());
 				gps.setGps_sos(obj[17] == null ? "" : obj[17].toString());
 				gps.setAddtime(obj[18] == null ? "" : obj[18].toString());
+				gps.setCcid(obj[19] == null ? "" : obj[19].toString());
 				tb_gpsList.add(gps);
 			}
 		}
+
 		return tb_gpsList;
 	}
-	
+
+	public List<tb_gps> getGpsManagement(int page) {
+		int perPage = Integer.parseInt(ModifyConfig.readData(Config.getPageConfig(), "perPage"));
+		int start = (page - 1) * perPage;
+		int end = 50;
+		String sql = null;
+		Query query = null;
+		sql = "SELECT id,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_kahao,gps_power,gps_sos,addtime,ccid FROM tb_gps order by addtime desc LIMIT :start,:end";
+		query = this.em.createNativeQuery(sql);
+		query.setParameter("start", start);
+		query.setParameter("end", Integer.valueOf(end));
+		List resultList = query.getResultList();
+		List<tb_gps> tb_gpsList = new ArrayList();
+		if (resultList.size() > 0) {
+			for(int i = 0; i < resultList.size(); ++i) {
+				tb_gps gps = new tb_gps();
+				Object[] obj = (Object[])((Object[])resultList.get(i));
+				gps.setId((Integer)obj[0]);
+				gps.setGps_utc_time(obj[1] != null && obj[1] != "" ? obj[1].toString() : "鑾峰彇澶辫触");
+				gps.setGps_weidu(obj[2] != null && obj[2] != "" ? obj[2].toString() : "鑾峰彇澶辫触");
+				gps.setGps_NS(obj[3] != null && obj[3] != "" ? obj[3].toString() : "鑾峰彇澶辫触");
+				gps.setGsp_jingdu(obj[4] != null && obj[4] != "" ? obj[4].toString() : "鑾峰彇澶辫触");
+				gps.setGps_EW(obj[5] != null && obj[5] != "" ? obj[5].toString() : "鑾峰彇澶辫触");
+				gps.setGps_state(obj[6] != null && obj[6] != "" ? obj[6].toString() : "鑾峰彇澶辫触");
+				gps.setGps_num(obj[7] != null && obj[7] != "" ? obj[7].toString() : "鑾峰彇澶辫触");
+				gps.setGps_hdop(obj[8] != null && obj[8] != "" ? obj[8].toString() : "鑾峰彇澶辫触");
+				gps.setGps_haiba_gao(obj[9] != null && obj[9] != "" ? obj[9].toString() : "鑾峰彇澶辫触");
+				gps.setGps_tuoqiu(obj[10] != null && obj[10] != "" ? obj[10].toString() : "鑾峰彇澶辫触");
+				gps.setGps_chafen_time(obj[11] != null && obj[11] != "" ? obj[11].toString() : "鑾峰彇澶辫触");
+				gps.setGps_chafen_id(obj[12] != null && obj[12] != "" ? obj[12].toString() : "鑾峰彇澶辫触");
+				gps.setGps_jiaoyan(obj[13] != null && obj[13] != "" ? obj[13].toString() : "鑾峰彇澶辫触");
+				gps.setTagid(obj[14] != null && obj[14] != "" ? obj[14].toString() : "鑾峰彇澶辫触");
+				gps.setGps_kahao(obj[15] != null && obj[15] != "" ? obj[15].toString() : "鑾峰彇澶辫触");
+				gps.setGps_power(obj[16] != null && obj[16] != "" ? obj[16].toString() : "鑾峰彇澶辫触");
+				gps.setGps_sos(obj[17] != null && obj[17] != "" ? obj[17].toString() : "鑾峰彇澶辫触");
+				gps.setAddtime(obj[18] != null && obj[18] != "" ? obj[18].toString() : "鑾峰彇澶辫触");
+				gps.setCcid(obj[19] != null && obj[19] != "" ? obj[19].toString() : "鑾峰彇澶辫触");
+				tb_gpsList.add(gps);
+			}
+		}
+
+		return tb_gpsList;
+	}
+
 	public int getGpsManagementCount() {
 		String sql = null;
 		Query query = null;
@@ -168,19 +159,18 @@
 	}
 
 	public List<tb_gps> searchGpsManagement(String input) {
-		String tagid = input;
 		String sql = null;
 		Query query = null;
-		sql = "SELECT id,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_kahao,gps_power,gps_sos,addtime FROM tb_gps WHERE tagid = :tagid";
+		sql = "SELECT g.id,g.gps_utc_time,g.gps_weidu,g.gps_NS,g.gsp_jingdu,g.gps_EW,g.gps_state,g.gps_num,g.gps_hdop,g.gps_haiba_gao,g.gps_tuoqiu,g.gps_chafen_time,g.gps_chafen_id,g.gps_jiaoyan,g.tagid,g.gps_kahao,g.gps_power,g.gps_sos,g.addtime,g.ccid FROM tb_gps g,tb_person p WHERE p.p_tagid = g.tagid AND g.tagid = :tagid OR p.p_tagid = g.tagid AND p.p_name = :tagid";
 		query = this.em.createNativeQuery(sql);
-		query.setParameter("tagid", tagid);
+		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.setId((int) obj[0]);
+				Object[] obj = (Object[])((Object[])resultList.get(i));
+				gps.setId((Integer)obj[0]);
 				gps.setGps_utc_time(obj[1] == null ? "" : obj[1].toString());
 				gps.setGps_weidu(obj[2] == null ? "" : obj[2].toString());
 				gps.setGps_NS(obj[3] == null ? "" : obj[3].toString());
@@ -199,22 +189,41 @@
 				gps.setGps_power(obj[16] == null ? "" : obj[16].toString());
 				gps.setGps_sos(obj[17] == null ? "" : obj[17].toString());
 				gps.setAddtime(obj[18] == null ? "" : obj[18].toString());
+				gps.setCcid(obj[19] == null ? "" : obj[19].toString());
 				tb_gpsList.add(gps);
 			}
 		}
+
 		return tb_gpsList;
 	}
-	
+
+	public tb_gps gettagidgps(String input) {
+		String sql = null;
+		Query query = null;
+		sql = "SELECT gps_weidu,gsp_jingdu FROM tb_gps WHERE tagid = :tagid";
+		query = this.em.createNativeQuery(sql);
+		query.setParameter("tagid", input);
+		List resultlist = query.getResultList();
+		tb_gps gps = new tb_gps();
+		if (resultlist.size() != 0) {
+			Object[] obj = (Object[])((Object[])resultlist.get(0));
+			gps.setGps_weidu(obj[0] == null ? "" : obj[0].toString());
+			gps.setGsp_jingdu(obj[1] == null ? "" : obj[1].toString());
+		}
+
+		return gps;
+	}
+
 	@Transactional
 	public void gpszeng(tb_system system) {
 		String sql = null;
 		Query query = null;
 		sql = "UPDATE tb_system SET origin_jingdu=:origin_jingdu,origin_weidu=:origin_weidu,origin_jiaodu=:origin_jiaodu WHERE id=1";
-		cs.tb_caozuo("tb_system", 3);
+		this.cs.tb_caozuo("tb_system", 3);
 		query = this.em.createNativeQuery(sql);
-		query.setParameter("origin_jingdu",system.getOrigin_jingdu());
-		query.setParameter("origin_weidu",system.getOrigin_weidu());
-		query.setParameter("origin_jiaodu",system.getOrigin_jiaodu());
+		query.setParameter("origin_jingdu", system.getOrigin_jingdu());
+		query.setParameter("origin_weidu", system.getOrigin_weidu());
+		query.setParameter("origin_jiaodu", system.getOrigin_jiaodu());
 		query.executeUpdate();
 	}
 
@@ -222,31 +231,50 @@
 	public void gpsManagement_delete(String[] checkVal) {
 		String sql = null;
 		Query query = null;
-		for (int i = 0; i < checkVal.length; i++) {
+
+		for(int i = 0; i < checkVal.length; ++i) {
 			int tagid = Integer.parseInt(checkVal[i]);
 			sql = "DELETE FROM tb_gps WHERE tagid = :tagid";
-			cs.tb_caozuo("tb_gps", 2);
+			this.cs.tb_caozuo("tb_gps", 2);
 			query = this.em.createNativeQuery(sql);
 			query.setParameter("tagid", tagid);
 			query.executeUpdate();
 		}
+
 	}
-	
-	public List<tb_gps> getTrack(String date,int page,int perPage) {
-		// 鏃ユ湡鏍煎紡 渚�20210101 
+
+	@Transactional
+	public int gpsManagement_deletea(String[] checkVal) {
 		String sql = null;
 		Query query = null;
-		sql = "SELECT * FROM tb_gps_track_"+ date +" LIMIT :start,:end";
+		int aaa = checkVal.length;
+
+		for(int i = 0; i < checkVal.length; ++i) {
+			int tagid = Integer.parseInt(checkVal[i]);
+			sql = "DELETE FROM tb_gps WHERE tagid = :tagid";
+			this.cs.tb_caozuo("tb_gps", 2);
+			query = this.em.createNativeQuery(sql);
+			query.setParameter("tagid", tagid);
+			query.executeUpdate();
+		}
+
+		return aaa;
+	}
+
+	public List<tb_gps> getTrack(String date, int page, int perPage) {
+		String sql = null;
+		Query query = null;
+		sql = "SELECT * FROM tb_gps_track_" + date + " LIMIT :start,:end";
 		query = this.em.createNativeQuery(sql);
 		query.setParameter("start", (page - 1) * perPage);
-		query.setParameter("end", perPage);
+		query.setParameter("end", 50);
 		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.setId((int) obj[0]);
+				Object[] obj = (Object[])((Object[])resultList.get(i));
+				gps.setId((Integer)obj[0]);
 				gps.setGps_utc_time(obj[1] == null ? "" : obj[1].toString());
 				gps.setGps_weidu(obj[2] == null ? "" : obj[2].toString());
 				gps.setGps_NS(obj[3] == null ? "" : obj[3].toString());
@@ -268,17 +296,64 @@
 				tb_trackList.add(gps);
 			}
 		}
+
 		return tb_trackList;
 	}
-	
+
+	public List<tb_gps> getTracka(String date) {
+		String sql = null;
+		Query query = null;
+		sql = "SELECT * FROM tb_gps_track_" + date + "";
+		query = this.em.createNativeQuery(sql);
+		List resultList = query.getResultList();
+		List<tb_gps> tb_trackList = new ArrayList();
+		if (resultList.size() > 0) {
+			for(int i = 0; i < resultList.size(); ++i) {
+				tb_gps gps = new tb_gps();
+				Object[] obj = (Object[])((Object[])resultList.get(i));
+				gps.setId((Integer)obj[0]);
+				gps.setGps_utc_time(obj[1] == null ? "" : obj[1].toString());
+				gps.setGps_weidu(obj[2] == null ? "" : obj[2].toString());
+				gps.setGps_NS(obj[3] == null ? "" : obj[3].toString());
+				gps.setGsp_jingdu(obj[4] == null ? "" : obj[4].toString());
+				gps.setGps_EW(obj[5] == null ? "" : obj[5].toString());
+				gps.setGps_state(obj[6] == null ? "" : obj[6].toString());
+				gps.setGps_num(obj[7] == null ? "" : obj[7].toString());
+				gps.setGps_hdop(obj[8] == null ? "" : obj[8].toString());
+				gps.setGps_haiba_gao(obj[9] == null ? "" : obj[9].toString());
+				gps.setGps_tuoqiu(obj[10] == null ? "" : obj[10].toString());
+				gps.setGps_chafen_time(obj[11] == null ? "" : obj[11].toString());
+				gps.setGps_chafen_id(obj[12] == null ? "" : obj[12].toString());
+				gps.setGps_jiaoyan(obj[13] == null ? "" : obj[13].toString());
+				gps.setTagid(obj[14] == null ? "" : obj[14].toString());
+				gps.setGps_kahao(obj[15] == null ? "" : obj[15].toString());
+				gps.setGps_power(obj[16] == null ? "" : obj[16].toString());
+				gps.setGps_sos(obj[17] == null ? "" : obj[17].toString());
+				gps.setAddtime(obj[18] == null ? "" : obj[18].toString());
+				tb_trackList.add(gps);
+			}
+		}
+
+		return tb_trackList;
+	}
+
 	public int getgpsRealTimeLocationCount(String date) {
 		String sql = null;
 		Query query = null;
-		sql = "SELECT count(1) FROM tb_gps_track_" +date+ "";
+		sql = "SELECT count(1) FROM tb_gps_track_" + date + "";
 		query = this.em.createNativeQuery(sql);
 		return Integer.parseInt(query.getSingleResult().toString());
 	}
-	
+
+	public int getgpsRealTimeLocationCount2(String date, String input) {
+		String sql = null;
+		Query query = null;
+		sql = "SELECT count(1) FROM tb_gps_track_" + date + " where tagid = :tagid";
+		query = this.em.createNativeQuery(sql);
+		query.setParameter("tagid", input);
+		return Integer.parseInt(query.getSingleResult().toString());
+	}
+
 	public List<String> getgpsTrackDateList() {
 		String sql = null;
 		Query query = null;
@@ -287,42 +362,71 @@
 		List<String> resultList = query.getResultList();
 		return resultList;
 	}
-	
+
 	@Transactional
-	public void realTimegpsLocation_delete(String[] checkVal,String date) {
+	public void realTimegpsLocation_delete(String[] checkVal, String date) {
 		String sql = null;
 		Query query = null;
-		for (int i = 0; i < checkVal.length; i++) {
+
+		for(int i = 0; i < checkVal.length; ++i) {
 			int id = Integer.parseInt(checkVal[i]);
-			sql = "DELETE FROM tb_gps_track_" +date+ " WHERE id = :id";
+			sql = "DELETE FROM tb_gps_track_" + date + " WHERE id = :id";
 			query = this.em.createNativeQuery(sql);
 			query.setParameter("id", id);
 			query.executeUpdate();
 		}
+
 	}
-	
+
+	@Transactional
+	public int realTimegpsLocation_deletea(String[] checkVal, String date) {
+		String sql = null;
+		Query query = null;
+		int aaa = checkVal.length;
+
+		for(int i = 0; i < checkVal.length; ++i) {
+			int id = Integer.parseInt(checkVal[i]);
+			sql = "DELETE FROM tb_gps_track_" + date + " WHERE id = :id";
+			query = this.em.createNativeQuery(sql);
+			query.setParameter("id", id);
+			query.executeUpdate();
+		}
+
+		return aaa;
+	}
+
 	@Transactional
 	public void realTimegpsLocation_deleteAll(String date) {
 		String sql = null;
 		Query query = null;
-		sql = "DELETE FROM tb_gps_track_" +date+ "";
+		sql = "DELETE FROM tb_gps_track_" + date + "";
 		query = this.em.createNativeQuery(sql);
 		query.executeUpdate();
 	}
-	
-	public List<tb_gps> searchRealTimegpsLocation(String input,String date) {
+
+	@Transactional
+	public int realTimegpsLocation_deleteAlla(String date) {
 		String sql = null;
 		Query query = null;
-		sql = "SELECT * FROM tb_gps_track_" + date + " WHERE tagid = :p_tagid";
+		sql = "DELETE FROM tb_gps_track_" + date + "";
+		query = this.em.createNativeQuery(sql);
+		int aaa = query.executeUpdate();
+		return aaa;
+	}
+
+	public List<tb_gps> searchRealTimegpsLocation(String input, String date, int page) {
+		String sql = null;
+		Query query = null;
+		sql = "SELECT * FROM tb_gps_track_" + date + " WHERE tagid = :p_tagid ORDER BY id DESC LIMIT 0,100";
 		query = this.em.createNativeQuery(sql);
 		query.setParameter("p_tagid", input);
 		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.setId((int) obj[0]);
+				Object[] obj = (Object[])((Object[])resultList.get(i));
+				gps.setId((Integer)obj[0]);
 				gps.setGps_utc_time(obj[1] == null ? "" : obj[1].toString());
 				gps.setGps_weidu(obj[2] == null ? "" : obj[2].toString());
 				gps.setGps_NS(obj[3] == null ? "" : obj[3].toString());
@@ -344,22 +448,22 @@
 				tb_trackList.add(gps);
 			}
 		}
+
 		return tb_trackList;
 	}
-	
-	public List<tb_gps> getRealTimegpsLocation(String tagid,String begin,String end,String date) {
+
+	public List<tb_gps> getRealTimegpsLocation(String tagid, String begin, String end, String date) {
 		String sql = null;
 		Query query = null;
-		sql = "SELECT id,gps_weidu,gsp_jingdu,gps_state,gps_num,gps_haiba_gao,gps_chafen_id,tagid,gps_power,addtime FROM tb_gps_track_"+date+" WHERE tagid = '"+tagid+"' AND addtime>= '"+begin+"' AND addtime<= '"+end+"' ORDER BY addtime";
-		//System.out.print(sql);
+		sql = "SELECT id,gps_weidu,gsp_jingdu,gps_state,gps_num,gps_haiba_gao,gps_chafen_id,tagid,gps_hdop,gps_chafen_time,gps_power,addtime FROM tb_gps_track_" + date + " WHERE tagid = '" + tagid + "' AND addtime>= '" + begin + "' AND addtime<= '" + end + "' ORDER BY addtime";
 		query = this.em.createNativeQuery(sql);
 		List resultList = query.getResultList();
-		List<tb_gps> tb_realocationList = new ArrayList<tb_gps>();
+		List<tb_gps> 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_gps realocation = new tb_gps();
-				Object[] obj = (Object[]) resultList.get(i);
-				realocation.setId((int) obj[0]);
+				Object[] obj = (Object[])((Object[])resultList.get(i));
+				realocation.setId((Integer)obj[0]);
 				realocation.setGps_weidu(obj[1] == null ? "" : obj[1].toString());
 				realocation.setGsp_jingdu(obj[2] == null ? "" : obj[2].toString());
 				realocation.setGps_state(obj[3] == null ? "" : obj[3].toString());
@@ -367,22 +471,132 @@
 				realocation.setGps_haiba_gao(obj[5] == null ? "" : obj[5].toString());
 				realocation.setGps_chafen_id(obj[6] == null ? "" : obj[6].toString());
 				realocation.setTagid(obj[7] == null ? "" : obj[7].toString());
-				realocation.setGps_power(obj[8] == null ? "" : obj[8].toString());
-				realocation.setAddtime(obj[9] == null ? "" : obj[9].toString());
+				realocation.setGps_hdop(obj[8] == null ? "" : obj[8].toString());
+				realocation.setGps_chafen_time(obj[9] == null ? "" : obj[9].toString());
+				realocation.setGps_power(obj[10] == null ? "" : obj[10].toString());
+				realocation.setAddtime(obj[11] == null ? "" : obj[11].toString());
 				tb_realocationList.add(realocation);
 			}
 		}
+
 		return tb_realocationList;
 	}
-	
+
 	public String getpersontagid(String tagid) {
 		String sql = null;
 		Query query = null;
-		sql = "SELECT p_online FROM tb_person WHERE p_tagid ='" +tagid+ "'";
+		sql = "SELECT p_online FROM tb_person WHERE p_tagid ='" + tagid + "'";
 		query = this.em.createNativeQuery(sql);
-		//query.setParameter("tagid", tagid);
 		List resultList = query.getResultList();
 		String zhuantai = resultList.get(0).toString();
 		return zhuantai;
 	}
+
+	public List getBuJu() {
+		String sql = null;
+		Query query = null;
+		sql = "SELECT anchorid,tagid,AQBJ_SCZ FROM tb_buju";
+		query = this.em.createNativeQuery(sql);
+		List resultList = query.getResultList();
+		return resultList;
+	}
+
+	public List<tb_rtkanchor> findrtkanchor(int page) {
+		String sql = null;
+		Query query = null;
+		sql = "select id,acid,state,jingdu,weidu,gaodu,posx,posy,floor,distance,port,baoliu1,baoliu2,addtime from tb_rtkanchor ORDER BY addtime DESC LIMIT :start,:end";
+		query = this.em.createNativeQuery(sql);
+		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_rtkanchor> permissions = new ArrayList();
+		if (resultlist.size() > 0) {
+			for(int i = 0; i < resultlist.size(); ++i) {
+				Object[] obj = (Object[])((Object[])resultlist.get(i));
+				tb_rtkanchor per = new tb_rtkanchor();
+				per.setId((Integer)obj[0]);
+				per.setAcid(obj[1] == null ? null : obj[1].toString());
+				per.setState(obj[2] == null ? null : obj[2].toString());
+				per.setJingdu(obj[3] == null ? null : obj[3].toString());
+				per.setWeidu(obj[4] == null ? null : obj[4].toString());
+				per.setGaodu(obj[5] == null ? null : obj[5].toString());
+				per.setPosx(obj[6] == null ? null : obj[6].toString());
+				per.setPosy(obj[7] == null ? null : obj[7].toString());
+				per.setFloor(obj[8] == null ? null : obj[8].toString());
+				per.setDistance(obj[9] == null ? null : obj[9].toString());
+				per.setPort(obj[10] == null ? null : obj[10].toString());
+				per.setBaoliu1(obj[11] == null ? null : obj[11].toString());
+				per.setBaoliu2(obj[12] == null ? null : obj[12].toString());
+				per.setAddtime(obj[13] == null ? null : obj[13].toString());
+				permissions.add(per);
+			}
+		}
+
+		return permissions;
+	}
+
+	public List<tb_rtkanchor> findrtkanchor3(String input) {
+		String sql = null;
+		Query query = null;
+		sql = "select id,acid,state,jingdu,weidu,gaodu,posx,posy,floor,distance,port,baoliu1,baoliu2,addtime from tb_rtkanchor WHERE acid = :acid ORDER BY addtime DESC";
+		query = this.em.createNativeQuery(sql);
+		query.setParameter("acid", input);
+		List resultlist = query.getResultList();
+		List<tb_rtkanchor> permissions = new ArrayList();
+		if (resultlist.size() > 0) {
+			for(int i = 0; i < resultlist.size(); ++i) {
+				Object[] obj = (Object[])((Object[])resultlist.get(i));
+				tb_rtkanchor per = new tb_rtkanchor();
+				per.setId((Integer)obj[0]);
+				per.setAcid(obj[1] == null ? null : obj[1].toString());
+				per.setState(obj[2] == null ? null : obj[2].toString());
+				per.setJingdu(obj[3] == null ? null : obj[3].toString());
+				per.setWeidu(obj[4] == null ? null : obj[4].toString());
+				per.setGaodu(obj[5] == null ? null : obj[5].toString());
+				per.setPosx(obj[6] == null ? null : obj[6].toString());
+				per.setPosy(obj[7] == null ? null : obj[7].toString());
+				per.setFloor(obj[8] == null ? null : obj[8].toString());
+				per.setDistance(obj[9] == null ? null : obj[9].toString());
+				per.setPort(obj[10] == null ? null : obj[10].toString());
+				per.setBaoliu1(obj[11] == null ? null : obj[11].toString());
+				per.setBaoliu2(obj[12] == null ? null : obj[12].toString());
+				per.setAddtime(obj[13] == null ? null : obj[13].toString());
+				permissions.add(per);
+			}
+		}
+
+		return permissions;
+	}
+
+	public int getrtkanchorManagementCount() {
+		String sql = null;
+		Query query = null;
+		sql = "SELECT count(1) FROM tb_rtkanchor";
+		query = this.em.createNativeQuery(sql);
+		return Integer.parseInt(query.getSingleResult().toString());
+	}
+
+	@Transactional
+	public void rtkanchor_delete(String[] checkVal) {
+		String sql = null;
+		Query query = null;
+
+		for(int i = 0; i < checkVal.length; ++i) {
+			int id = Integer.parseInt(checkVal[i]);
+			sql = "DELETE FROM tb_rtkanchor WHERE id = :id";
+			query = this.em.createNativeQuery(sql);
+			query.setParameter("id", id);
+			query.executeUpdate();
+		}
+
+	}
+
+	@Transactional
+	public void rtkanchor_deletea() {
+		String sql = null;
+		Query query = null;
+		sql = "DELETE FROM tb_rtkanchor";
+		query = this.em.createNativeQuery(sql);
+		query.executeUpdate();
+	}
 }

--
Gitblit v1.10.0