From 52cffc4ab8e9787a6f233295502c7c9788dddae1 Mon Sep 17 00:00:00 2001
From: fxl <473369119@qq.com>
Date: 星期二, 07 三月 2023 10:45:17 +0800
Subject: [PATCH] 3.7

---
 src/main/java/com/hxzkoa/services/AnchorService.java |  177 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 171 insertions(+), 6 deletions(-)

diff --git a/src/main/java/com/hxzkoa/services/AnchorService.java b/src/main/java/com/hxzkoa/services/AnchorService.java
index 7ca8f16..66b5647 100644
--- a/src/main/java/com/hxzkoa/services/AnchorService.java
+++ b/src/main/java/com/hxzkoa/services/AnchorService.java
@@ -15,6 +15,7 @@
 
 import com.hxzkoa.json.tb_achor;
 import com.hxzkoa.json.tb_anchor_nearby;
+import com.hxzkoa.json.tb_anchorhistory;
 import com.hxzkoa.json.tb_shebei;
 import com.hxzkoa.json.tb_tongbuanchor;
 import com.hxzkoa.json.tb_wifi;
@@ -120,7 +121,7 @@
 	public List<tb_achor> getAnchorManagementa() {
 		String sql = null;
 		Query query = null;
-		sql = "SELECT id,anchorid,POSX,POSY,POSZ,layer,zu,liangcheng,anchormode,anchorip,version,gonglv,jiaozhundistance,GreateTime FROM (SELECT id,anchorid,POSX,POSY,POSZ,layer,zu,liangcheng,anchormode,anchorip,version,gonglv,jiaozhundistance,GreateTime FROM tb_achor ORDER BY id DESC) s";
+		sql = "SELECT id,anchorid,POSX,POSY,POSZ,layer,zu,liangcheng,anchormode,anchorip,version,gonglv,jiaozhundistance,GreateTime,baoliu6,baoliu7 FROM (SELECT id,anchorid,POSX,POSY,POSZ,layer,zu,liangcheng,anchormode,anchorip,version,gonglv,jiaozhundistance,GreateTime,baoliu6,baoliu7 FROM tb_achor ORDER BY id DESC) s";
 		query = this.em.createNativeQuery(sql);
 		List resultList = query.getResultList();
 		List<tb_achor> tb_achorList = new ArrayList<tb_achor>();
@@ -175,6 +176,36 @@
 		}
 		return tb_achorList;
 	}
+	
+	public List<tb_achor> searchAnchorManagementaa(String input) {
+		String sql = null;
+		Query query = null;
+		sql = "SELECT id,anchorid,POSX,POSY,POSZ,layer,zu,liangcheng,anchormode,anchorip,version,gonglv,jiaozhundistance,GreateTime,baoliu6,baoliu7 FROM tb_achor WHERE anchorid = :anchorid";
+		query = this.em.createNativeQuery(sql);
+		query.setParameter("anchorid", input);
+		List resultList = query.getResultList();
+		List<tb_achor> tb_achorList = new ArrayList<tb_achor>();
+		if (resultList.size() > 0) {
+			for (int i = 0; i < resultList.size(); i++) {
+				tb_achor achor = new tb_achor();
+				Object[] obj = (Object[]) resultList.get(i);
+				achor.setId((int) obj[0]);
+				achor.setAnchormode(obj[8] == null ? "" : obj[8].toString());
+				achor.setAnchorid(obj[1] == null ? "" : obj[1].toString());
+				achor.setPOSX(obj[14] == null ? "" : obj[14].toString());
+				achor.setPOSY(obj[15] == null ? "" : obj[15].toString());
+				achor.setPOSZ(obj[4] == null ? "" : obj[4].toString());
+				achor.setLayer(obj[5] == null ? "" : obj[5].toString());
+				achor.setZu(obj[6] == null ? "" : obj[6].toString());
+				achor.setLiangcheng(obj[7] == null ? "" : obj[7].toString());
+				achor.setAnchorip(obj[9] == null ? "" : obj[9].toString());
+				achor.setVersion(obj[10] == null ? "" : obj[10].toString());
+				achor.setGreateTime(obj[13] == null ? "" : obj[13].toString());
+				tb_achorList.add(achor);
+			}
+		}
+		return tb_achorList;
+	}
 
 	public int getAnchorManagementCount() {
 		String sql = null;
@@ -223,6 +254,46 @@
 		int executeUpdate = query.executeUpdate();
 		return executeUpdate;
 	}
+	
+	@Transactional
+	public int anchorManagement_addaa(tb_achor achor) {
+		//榛樿鍊奸�昏緫澶勭悊
+		if(("").equals(achor.getPOSX())){
+			achor.setPOSX("0");
+		}
+		if(("").equals(achor.getPOSY())){
+			achor.setPOSY("0");
+		}
+		if(("").equals(achor.getPOSZ())){
+			achor.setPOSZ("0");
+		}
+		if(("").equals(achor.getLayer())){
+			achor.setLayer("0");
+		}
+		if(("").equals(achor.getZu())){
+			achor.setZu("0");
+		}
+		if(("").equals(achor.getLiangcheng())){
+			achor.setLiangcheng("鏃犻檺鍒�");
+		}
+		String sql = null;
+		Query query = null;
+		sql = "INSERT INTO tb_achor(anchorid,baoliu6,baoliu7,POSZ,layer,zu,liangcheng,anchorip,anchormode,version,greateTime) VALUES(:anchorid,:POSX,:POSY,:POSZ,:layer,:zu,:liangcheng,:anchorip,:anchormode,:version,now())";
+		cs.tb_caozuo("tb_achor", 1);
+		query = this.em.createNativeQuery(sql);
+		query.setParameter("anchorid", achor.getAnchorid());
+		query.setParameter("POSX", achor.getPOSX());
+		query.setParameter("POSY", achor.getPOSY());
+		query.setParameter("POSZ", achor.getPOSZ());
+		query.setParameter("layer", achor.getLayer());
+		query.setParameter("zu", achor.getZu());
+		query.setParameter("liangcheng", achor.getLiangcheng());
+		query.setParameter("anchorip", achor.getAnchorip());
+		query.setParameter("anchormode", achor.getAnchormode());
+		query.setParameter("version", achor.getVersion());
+		int executeUpdate = query.executeUpdate();
+		return executeUpdate;
+	}
 
 	@Transactional
 	public int anchorManagement_modify(tb_achor achor) {
@@ -242,17 +313,36 @@
 		int aaa = query.executeUpdate();
 		return aaa;
 	}
+	
+	@Transactional
+	public int anchorManagement_modifyaa(tb_achor achor) {
+		String sql = null;
+		Query query = null;
+		sql = "UPDATE tb_achor SET baoliu6=:POSX,baoliu7=:POSY,POSZ=:POSZ,layer=:layer,zu=:zu,liangcheng=:liangcheng,anchorip=:anchorip WHERE anchorid=:anchorid";
+		cs.tb_caozuo("tb_achor", 3);
+		query = this.em.createNativeQuery(sql);
+		query.setParameter("anchorid", achor.getAnchorid());
+		query.setParameter("POSX", achor.getPOSX());
+		query.setParameter("POSY", achor.getPOSY());
+		query.setParameter("POSZ", achor.getPOSZ());
+		query.setParameter("layer", achor.getLayer());
+		query.setParameter("zu", achor.getZu());
+		query.setParameter("liangcheng", achor.getLiangcheng());
+		query.setParameter("anchorip", achor.getAnchorip());
+		int aaa = query.executeUpdate();
+		return aaa;
+	}
 
 	@Transactional
 	public void anchorProx_delete(String[] checkVal) {
 		String sql = null;
 		Query query = null;
 		for (int i = 0; i < checkVal.length; i++) {
-			int id = Integer.parseInt(checkVal[i]);
+//			int id = Integer.parseInt(checkVal[i]);
 			sql = "DELETE FROM tb_anchor_nearby WHERE anchorid = :id";
 			cs.tb_caozuo("tb_anchor_nearby", 2);
 			query = this.em.createNativeQuery(sql);
-			query.setParameter("id", id);
+			query.setParameter("id", checkVal[i]);
 			query.executeUpdate();
 		}
 	}
@@ -293,11 +383,11 @@
 		String sql = null;
 		Query query = null;
 		for (int i = 0; i < checkVal.length; i++) {
-			int id = Integer.parseInt(checkVal[i]);
+//			int id = Integer.parseInt(checkVal[i]);
 			sql = "DELETE FROM tb_tongbuanchor WHERE anchorid = :id";
 			cs.tb_caozuo("tb_tongbuanchor", 2);
 			query = this.em.createNativeQuery(sql);
-			query.setParameter("id", id);
+			query.setParameter("id", checkVal[i]);
 			query.executeUpdate();
 		}
 	}
@@ -666,7 +756,29 @@
 				list.add(shebei);
 			}
 		}
-		//System.out.print(list);
+		return list;
+	}
+	
+	public List<tb_shebei> getbiaoqianshebei2() {
+		String sql = null;
+		Query query = null;
+		sql = "SELECT p.p_tagid,p.p_online,p.p_name,p.p_power,t.version,p.p_addtiem FROM tb_person AS p,tb_tag AS t WHERE p.p_tagid = t.tag_id";
+		query = this.em.createNativeQuery(sql);
+		List resultList = query.getResultList();
+		List<tb_shebei> list = new ArrayList<tb_shebei>();
+		if (resultList.size() > 0) {
+			for (int i = 0; i < resultList.size(); i++) {
+				tb_shebei shebei = new tb_shebei();
+				Object[] obj = (Object[]) resultList.get(i);
+				shebei.setZhuangtai(obj[1] == null ? "" : obj[1].toString());
+				shebei.setId(obj[0] == null ? "" : obj[0].toString());
+				shebei.setDuixiang(obj[2] == null ? "" : obj[2].toString());
+				shebei.setBanben(obj[4] == null ? "" : obj[4].toString());
+				shebei.setXiangqing(obj[3] == null ? "" : obj[3].toString());
+				shebei.setTime(obj[5] == null ? "" : obj[5].toString());
+				list.add(shebei);
+			}
+		}
 		return list;
 	}
 	
@@ -699,4 +811,57 @@
 		}
 		return tb_achorList;
 	}
+	
+	public String searchidAnchorManagement2(String id) {
+		String sql = null;
+		Query query = null;
+		sql = "SELECT anchorid FROM tb_achor WHERE id = :id";
+		query = this.em.createNativeQuery(sql);
+		query.setParameter("id", id);
+		List resultList = query.getResultList();
+		String status = resultList.get(0).toString();
+		return status;
+	}
+	
+	public List<tb_anchorhistory> getAnchorhistory() {
+		String sql = null;
+		Query query = null;
+		sql = "SELECT id,anchorid,state,addtime FROM tb_anchor_history_record ORDER BY id DESC";
+		query = this.em.createNativeQuery(sql);
+		List resultList = query.getResultList();
+		List<tb_anchorhistory> tb_achorList = new ArrayList<tb_anchorhistory>();
+		if (resultList.size() > 0) {
+			for (int i = 0; i < resultList.size(); i++) {
+				tb_anchorhistory achor = new tb_anchorhistory();
+				Object[] obj = (Object[]) resultList.get(i);
+				achor.setId((int) obj[0]);
+				achor.setAnchorid(obj[1] == null ? "" : obj[1].toString());
+				achor.setState(obj[2] == null ? "" : obj[2].toString());
+				achor.setAddtime(obj[3] == null ? "" : obj[3].toString());
+				tb_achorList.add(achor);	
+			}
+		}
+		return tb_achorList;
+	}
+	
+	public List<tb_anchorhistory> getidAnchorhistory(String aaa) {
+		String sql = null;
+		Query query = null;
+		sql = "SELECT id,anchorid,state,addtime FROM tb_anchor_history_record where addtime like '"+aaa+"____________'";
+		query = this.em.createNativeQuery(sql);
+		List resultList = query.getResultList();
+		List<tb_anchorhistory> tb_achorList = new ArrayList<tb_anchorhistory>();
+		if (resultList.size() > 0) {
+			for (int i = 0; i < resultList.size(); i++) {
+				tb_anchorhistory achor = new tb_anchorhistory();
+				Object[] obj = (Object[]) resultList.get(i);
+				achor.setId((int) obj[0]);
+				achor.setAnchorid(obj[1] == null ? "" : obj[1].toString());
+				achor.setState(obj[2] == null ? "" : obj[2].toString());
+				achor.setAddtime(obj[3] == null ? "" : obj[3].toString());
+				tb_achorList.add(achor);	
+			}
+		}
+		return tb_achorList;
+	}
 }

--
Gitblit v1.10.0