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/FenceService.java |  413 ++++++++++++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 384 insertions(+), 29 deletions(-)

diff --git a/src/main/java/com/hxzkoa/services/FenceService.java b/src/main/java/com/hxzkoa/services/FenceService.java
index 36e9ff9..726ffa0 100644
--- a/src/main/java/com/hxzkoa/services/FenceService.java
+++ b/src/main/java/com/hxzkoa/services/FenceService.java
@@ -14,6 +14,8 @@
 
 import com.hxzkoa.json.tb_achor;
 import com.hxzkoa.json.tb_fence;
+import com.hxzkoa.json.tb_fence2;
+import com.hxzkoa.json.tb_jobhistory;
 import com.hxzkoa.json.tb_shipin;
 import com.hxzkoa.json.tb_xunjianbaobiao;
 import com.hxzkoa.json.tb_xunjianset;
@@ -30,7 +32,7 @@
 	public List<tb_fence> getFenceList() {
 		String sql = null;
 		Query query = null;
-		sql = "SELECT id,floor,type,bumen,name,zuobiao,shape,start,stop,addtime,color FROM tb_fence";
+		sql = "SELECT id,floor,type,bumen,name,zuobiao,shape,start,stop,addtime,color,baoliu1 FROM tb_fence";
 		query = this.em.createNativeQuery(sql);
 		List resultList = query.getResultList();
 		List<tb_fence> tb_fenceList = new ArrayList<tb_fence>();
@@ -49,6 +51,180 @@
 				fence.setStop(obj[8] == null ? "" : obj[8].toString());
 				fence.setAddtime(obj[9] == null ? "" : obj[9].toString());
 				fence.setColor(obj[10] == null ? "" : obj[10].toString());
+				fence.setBaoliu1(obj[11] == null ? "" : obj[11].toString());
+				tb_fenceList.add(fence);
+			}
+		}
+		return tb_fenceList;
+	}
+	
+	public List<tb_fence> getFenceLista() {
+		String sql = null;
+		Query query = null;
+		sql = "SELECT id,floor,type,bumen,name,zuobiao,shape,start,stop,addtime,color,baoliu1,baoliu3,baoliu4,baoliu6,baoliu7 FROM tb_fence";
+		query = this.em.createNativeQuery(sql);
+		List resultList = query.getResultList();
+		List<tb_fence> tb_fenceList = new ArrayList<tb_fence>();
+		if (resultList.size() > 0) {
+			for (int i = 0; i < resultList.size(); i++) {
+				tb_fence fence = new tb_fence();
+				Object[] obj = (Object[]) resultList.get(i);
+				fence.setId((int) obj[0]);
+				fence.setFloor(obj[1] == null ? "" : obj[1].toString());
+				fence.setType(obj[2] == null ? "" : obj[2].toString());
+				fence.setBumen(obj[3] == null ? "" : obj[3].toString());
+				fence.setName(obj[4] == null ? "" : obj[4].toString());
+				fence.setZuobiao(obj[5] == null ? "" : obj[5].toString());
+				fence.setShape(obj[6] == null ? "" : obj[6].toString());
+				fence.setStart(obj[7] == null ? "" : obj[7].toString());
+				fence.setStop(obj[8] == null ? "" : obj[8].toString());
+				fence.setAddtime(obj[9] == null ? "" : obj[9].toString());
+				fence.setColor(obj[10] == null ? "" : obj[10].toString());
+				fence.setBaoliu1(obj[11] == null ? "" : obj[11].toString());
+				fence.setBaoliu3(obj[12] == null ? "" : obj[12].toString());
+				fence.setBaoliu4(obj[13] == null ? "" : obj[13].toString());
+				fence.setBaoliu6(obj[14] == null ? "" : obj[14].toString());
+				fence.setBaoliu7(obj[15] == null ? "" : obj[15].toString());
+				tb_fenceList.add(fence);
+			}
+		}
+		return tb_fenceList;
+	}
+	
+	public List<tb_fence2> getFenceListaaa() {
+		String sql = null;
+		Query query = null;
+		sql = "SELECT id,floor,type,bumen,name,zuobiao,shape,start,stop,addtime,color,baoliu1,baoliu3,baoliu4,baoliu6,baoliu7 FROM tb_fence where type!='鍙樼數绔�'";
+		query = this.em.createNativeQuery(sql);
+		List resultList = query.getResultList();
+		List<tb_fence2> tb_fenceList = new ArrayList<tb_fence2>();
+		if (resultList.size() > 0) {
+			for (int i = 0; i < resultList.size(); i++) {
+				tb_fence2 fence = new tb_fence2();
+				Object[] obj = (Object[]) resultList.get(i);
+				fence.setId((int) obj[0]);
+				fence.setFloor(obj[1] == null ? "" : obj[1].toString());
+				fence.setType(obj[2] == null ? "" : obj[2].toString());
+				fence.setBumen(obj[3] == null ? "" : obj[3].toString());
+				fence.setName(obj[4] == null ? "" : obj[4].toString());
+				String[] zuobiaos = obj[5].toString().split(";");
+				for (int j = 0; j < zuobiaos.length; j++) {
+					String[] zuobiao = zuobiaos[j].split(",");
+					zuobiaos[j] = ((double)Math.round(Double.parseDouble(zuobiao[0]))/100)+","+((double)Math.round(Double.parseDouble(zuobiao[1]))/100);
+				}
+				fence.setZuobiao(zuobiaos);
+//				fence.setZuobiao(obj[5].toString().split(";"));
+				fence.setShape(obj[6] == null ? "" : obj[6].toString());
+				fence.setStart(obj[7] == null ? "" : obj[7].toString());
+				fence.setStop(obj[8] == null ? "" : obj[8].toString());
+				fence.setAddtime(obj[9] == null ? "" : obj[9].toString());
+				fence.setColor(obj[10] == null ? "" : obj[10].toString());
+				fence.setBaoliu1(obj[11] == null ? "" : obj[11].toString());
+				fence.setBaoliu3(obj[12] == null ? "" : obj[12].toString());
+				fence.setBaoliu4(obj[13] == null ? "" : obj[13].toString());
+				fence.setBaoliu6(obj[14] == null ? "" : obj[14].toString());
+				fence.setBaoliu7(obj[15] == null ? "" : obj[15].toString());
+				tb_fenceList.add(fence);
+			}
+		}
+		return tb_fenceList;
+	}
+	
+	public List<tb_fence> getFenceListaa() {
+		String sql = null;
+		Query query = null;
+		sql = "SELECT id,floor,type,bumen,name,zuobiao,shape,start,stop,addtime,color,baoliu1,baoliu3,baoliu4,baoliu6,baoliu7 FROM tb_fence WHERE baoliu7 = '1' ORDER BY addtime DESC LIMIT 0,5";
+		query = this.em.createNativeQuery(sql);
+		List resultList = query.getResultList();
+		List<tb_fence> tb_fenceList = new ArrayList<tb_fence>();
+		if (resultList.size() > 0) {
+			for (int i = 0; i < resultList.size(); i++) {
+				tb_fence fence = new tb_fence();
+				Object[] obj = (Object[]) resultList.get(i);
+				fence.setId((int) obj[0]);
+				fence.setFloor(obj[1] == null ? "" : obj[1].toString());
+				fence.setType(obj[2] == null ? "" : obj[2].toString());
+				fence.setBumen(obj[3] == null ? "" : obj[3].toString());
+				fence.setName(obj[4] == null ? "" : obj[4].toString());
+				fence.setZuobiao(obj[5] == null ? "" : obj[5].toString());
+				fence.setShape(obj[6] == null ? "" : obj[6].toString());
+				fence.setStart(obj[7] == null ? "" : obj[7].toString());
+				fence.setStop(obj[8] == null ? "" : obj[8].toString());
+				fence.setAddtime(obj[9] == null ? "" : obj[9].toString());
+				fence.setColor(obj[10] == null ? "" : obj[10].toString());
+				fence.setBaoliu1(obj[11] == null ? "" : obj[11].toString());
+				fence.setBaoliu3(obj[12] == null ? "" : obj[12].toString());
+				fence.setBaoliu4(obj[13] == null ? "" : obj[13].toString());
+				fence.setBaoliu6(obj[14] == null ? "" : obj[14].toString());
+				fence.setBaoliu7(obj[15] == null ? "" : obj[15].toString());
+				tb_fenceList.add(fence);
+			}
+		}
+		return tb_fenceList;
+	}
+	
+	public List<tb_fence2> getFenceListm() {
+		String sql = null;
+		Query query = null;
+		sql = "SELECT id,floor,type,bumen,name,zuobiao,shape,start,stop,addtime,color,baoliu1,baoliu3,baoliu4,baoliu6,baoliu7 FROM tb_fence WHERE baoliu7 = '1' and type!='鍙樼數绔�' ORDER BY addtime DESC LIMIT 0,5";
+		query = this.em.createNativeQuery(sql);
+		List resultList = query.getResultList();
+		List<tb_fence2> tb_fenceList = new ArrayList<tb_fence2>();
+		if (resultList.size() > 0) {
+			for (int i = 0; i < resultList.size(); i++) {
+				tb_fence2 fence = new tb_fence2();
+				Object[] obj = (Object[]) resultList.get(i);
+				fence.setId((int) obj[0]);
+				fence.setFloor(obj[1] == null ? "" : obj[1].toString());
+				fence.setType(obj[2] == null ? "" : obj[2].toString());
+				fence.setBumen(obj[3] == null ? "" : obj[3].toString());
+				fence.setName(obj[4] == null ? "" : obj[4].toString());
+				String[] zuobiaos = obj[5].toString().split(";");
+				for (int j = 0; j < zuobiaos.length; j++) {
+					String[] zuobiao = zuobiaos[j].split(",");
+					zuobiaos[j] = ((double)Math.round(Double.parseDouble(zuobiao[0]))/100)+","+((double)Math.round(Double.parseDouble(zuobiao[1]))/100);
+				}
+				fence.setZuobiao(zuobiaos);
+//				fence.setZuobiao(obj[5].toString().split(";"));
+				fence.setShape(obj[6] == null ? "" : obj[6].toString());
+				fence.setStart(obj[7] == null ? "" : obj[7].toString());
+				fence.setStop(obj[8] == null ? "" : obj[8].toString());
+				fence.setAddtime(obj[9] == null ? "" : obj[9].toString());
+				fence.setColor(obj[10] == null ? "" : obj[10].toString());
+				fence.setBaoliu1(obj[11] == null ? "" : obj[11].toString());
+				fence.setBaoliu3(obj[12] == null ? "" : obj[12].toString());
+				fence.setBaoliu4(obj[13] == null ? "" : obj[13].toString());
+				fence.setBaoliu6(obj[14] == null ? "" : obj[14].toString());
+				fence.setBaoliu7(obj[15] == null ? "" : obj[15].toString());
+				tb_fenceList.add(fence);
+			}
+		}
+		return tb_fenceList;
+	}
+	
+	public List<tb_fence> getFenceList2() {
+		String sql = null;
+		Query query = null;
+		sql = "SELECT id,floor,type,bumen,name,zuobiao,shape,start,stop,addtime,color,baoliu1 FROM tb_fence Where floor != '鐧惧害鍦板浘'";
+		query = this.em.createNativeQuery(sql);
+		List resultList = query.getResultList();
+		List<tb_fence> tb_fenceList = new ArrayList<tb_fence>();
+		if (resultList.size() > 0) {
+			for (int i = 0; i < resultList.size(); i++) {
+				tb_fence fence = new tb_fence();
+				Object[] obj = (Object[]) resultList.get(i);
+				fence.setId((int) obj[0]);
+				fence.setFloor(obj[1] == null ? "" : obj[1].toString());
+				fence.setType(obj[2] == null ? "" : obj[2].toString());
+				fence.setBumen(obj[3] == null ? "" : obj[3].toString());
+				fence.setName(obj[4] == null ? "" : obj[4].toString());
+				fence.setZuobiao(obj[5] == null ? "" : obj[5].toString());
+				fence.setShape(obj[6] == null ? "" : obj[6].toString());
+				fence.setStart(obj[7] == null ? "" : obj[7].toString());
+				fence.setStop(obj[8] == null ? "" : obj[8].toString());
+				fence.setAddtime(obj[9] == null ? "" : obj[9].toString());
+				fence.setColor(obj[10] == null ? "" : obj[10].toString());
+				fence.setBaoliu1(obj[11] == null ? "" : obj[11].toString());
 				tb_fenceList.add(fence);
 			}
 		}
@@ -70,14 +246,15 @@
 				Object[] obj = (Object[]) resultList.get(i);
 				shipin.setId((int) obj[0]);
 				shipin.setFencename(obj[1] == null ? "" : obj[1].toString());
-				shipin.setShebeiid(obj[2] == null ? "" : obj[2].toString());
-				shipin.setTongdaoid(obj[3] == null ? "" : obj[3].toString());
+				shipin.setYonghuming(obj[2] == null ? "" : obj[2].toString());
+				shipin.setMima(obj[3] == null ? "" : obj[3].toString());
 				shipin.setAddtime(obj[4] == null ? "" : obj[4].toString());
 				shipin.setPosx(obj[5] == null ? "" : obj[5].toString());
 				shipin.setPosy(obj[6] == null ? "" : obj[6].toString());
 				shipin.setPosz(obj[7] == null ? "" : obj[7].toString());
 				shipin.setFloor(obj[8] == null ? "" : obj[8].toString());
 				shipin.setName(obj[9] == null ? "" : obj[9].toString());
+				shipin.setBaoliu1(obj[10] == null ? "" : obj[10].toString());
 				tb_shipinList.add(shipin);
 			}
 		}
@@ -96,17 +273,31 @@
 	public int shipinManagement_add(tb_shipin shipin) {
 		String sql = null;
 		Query query = null;
-		sql = "INSERT INTO tb_shipin(fencename,shebeiid,tongdaoid,addtime,posx,posy,posz,floor,name) VALUES(:fencename,:shebeiid,:tongdaoid,now(),:posx,:posy,:posz,:floor,:name)";
+		sql = "INSERT INTO tb_shipin(fencename,shebeiid,tongdaoid,addtime,posx,posy,posz,floor,name,baoliu1) VALUES(:fencename,:shebeiid,:tongdaoid,now(),:posx,:posy,:posz,:floor,:name,:baoliu1)";
 		query = this.em.createNativeQuery(sql);
 		query.setParameter("fencename", shipin.getFencename());
-		query.setParameter("shebeiid", shipin.getShebeiid());
-		query.setParameter("tongdaoid", shipin.getTongdaoid());
+		query.setParameter("shebeiid", shipin.getYonghuming());
+		query.setParameter("tongdaoid", shipin.getMima());
 		query.setParameter("posx", shipin.getPosx());
 		query.setParameter("posy", shipin.getPosy());
 		query.setParameter("posz", shipin.getPosz());
 		query.setParameter("floor", shipin.getFloor());
 		query.setParameter("name", shipin.getName());
+		query.setParameter("baoliu1", shipin.getBaoliu1());
 		int executeUpdate = query.executeUpdate();
+//		String sql2 = null;
+//		Query query2 = null;
+//		sql2 = "SELECT id FROM tb_shipin WHERE shebeiid=:shebeiid";
+//		query2 = this.em.createNativeQuery(sql2);
+//		query2.setParameter("shebeiid",shipin.getShebeiid());
+//		List resultList2 = query2.getResultList();
+//		String id = null;
+//		if (resultList2.size() > 0) {
+//			Object[] obj = (Object[])resultList2.get(0);
+//			id = obj[0].toString();
+//		}
+//		String xieyi = "BSTOCS1,ADDVIDEO,"+id+","+shipin.getFencename()+","+shipin.getShebeiid()+","+shipin.getTongdaoid()+","+shipin.getPosx()+","+shipin.getPosy()+","+shipin.getPosz()+","+shipin.getFloor()+","+shipin.getName()+",END";
+//		Udp_
 		return executeUpdate;
 	}
 	
@@ -114,12 +305,13 @@
 	public void shipinManagement_modify(tb_shipin shipin) {
 		String sql = null;
 		Query query = null;
-		sql = "UPDATE tb_shipin SET fencename=:fencename,shebeiid=:shebeiid,tongdaoid=:tongdaoid,posx=:posx,posy=:posy,posz=:posz,floor=:floor,name=:name WHERE id=:id";
+		sql = "UPDATE tb_shipin SET fencename=:fencename,shebeiid=:shebeiid,tongdaoid=:tongdaoid,posx=:posx,posy=:posy,posz=:posz,floor=:floor,name=:name,baoliu1=:baoliu1 WHERE id=:id";
 		query = this.em.createNativeQuery(sql);
 		query.setParameter("id", shipin.getId());
 		query.setParameter("fencename", shipin.getFencename());
-		query.setParameter("shebeiid", shipin.getShebeiid());
-		query.setParameter("tongdaoid", shipin.getTongdaoid());
+		query.setParameter("shebeiid", shipin.getYonghuming());
+		query.setParameter("tongdaoid", shipin.getMima());
+		query.setParameter("baoliu1", shipin.getBaoliu1());
 		query.setParameter("posx", shipin.getPosx());
 		query.setParameter("posy", shipin.getPosy());
 		query.setParameter("posz", shipin.getPosz());
@@ -142,6 +334,17 @@
 	}
 	
 	@Transactional
+	public List idfindshebeiid(String id) {
+		String sql = null;
+		Query query = null;
+		sql = "SELECT shebeiid FROM tb_shipin WHERE id = :id";
+		query = this.em.createNativeQuery(sql);
+		query.setParameter("id", id);
+		List resultList = query.getResultList();
+		return resultList;
+	}
+	
+	@Transactional
 	public void shipinManagement_deleteAll() {
 		String sql = null;
 		Query query = null;
@@ -153,10 +356,9 @@
 	public List<tb_shipin> searchshipinManagement(String input) {
 		String sql = null;
 		Query query = null;
-		System.out.print(input);
-		sql = "SELECT * FROM tb_shipin WHERE fencename = :fencename";
+		sql = "SELECT * FROM tb_shipin WHERE fencename = :name";
 		query = this.em.createNativeQuery(sql);
-		query.setParameter("fencename", input);
+		query.setParameter("name", input);
 		List resultList = query.getResultList();
 		List<tb_shipin> tb_shipinList = new ArrayList<tb_shipin>();
 		if (resultList.size() > 0) {
@@ -165,9 +367,15 @@
 				Object[] obj = (Object[]) resultList.get(i);
 				shipin.setId((int) obj[0]);
 				shipin.setFencename(obj[1] == null ? "" : obj[1].toString());
-				shipin.setShebeiid(obj[2] == null ? "" : obj[2].toString());
-				shipin.setTongdaoid(obj[3] == null ? "" : obj[3].toString());
+				shipin.setYonghuming(obj[2] == null ? "" : obj[2].toString());
+				shipin.setMima(obj[3] == null ? "" : obj[3].toString());
 				shipin.setAddtime(obj[4] == null ? "" : obj[4].toString());
+				shipin.setPosx(obj[5] == null ? "" : obj[5].toString());
+				shipin.setPosy(obj[6] == null ? "" : obj[6].toString());
+				shipin.setPosz(obj[7] == null ? "" : obj[7].toString());
+				shipin.setFloor(obj[8] == null ? "" : obj[8].toString());
+				shipin.setName(obj[9] == null ? "" : obj[9].toString());
+				shipin.setBaoliu1(obj[10] == null ? "" : obj[10].toString());
 				tb_shipinList.add(shipin);
 			}
 		}
@@ -208,12 +416,75 @@
 		}
 		return tb_fenceList;
 	}
+	
+	public List<tb_fence> searchFenceLisa(String input) throws ParseException {
 
-	@Transactional
-	public void fenceList_modify(tb_fence fence) {
 		String sql = null;
 		Query query = null;
-		sql = "UPDATE tb_fence SET bumen=:bumen,name=:name,zuobiao=:zuobiao,start=:start,stop=:stop WHERE id=:id";
+		sql = "SELECT id,floor,type,bumen,`name`,zuobiao,shape,`start`,`stop`,addtime,color FROM tb_fence WHERE id = :id";
+		query = this.em.createNativeQuery(sql);
+		query.setParameter("id", input);
+		List resultList = query.getResultList();
+		List<tb_fence> tb_fenceList = new ArrayList<tb_fence>();
+		if (resultList.size() > 0) {
+			for (int i = 0; i < resultList.size(); i++) {
+				Object[] obj = (Object[]) resultList.get(i);
+				tb_fence fence = new tb_fence();
+				fence.setFloor(obj[1] == null ? "" : obj[1].toString());
+				fence.setType(obj[2] == null ? "" : obj[2].toString());
+				fence.setBumen(obj[3] == null ? "" : obj[3].toString());
+				fence.setName(obj[4] == null ? "" : obj[4].toString());
+				fence.setZuobiao(obj[5] == null ? "" : obj[5].toString());
+				fence.setShape(obj[6] == null ? "" : obj[6].toString());
+				// fence.setStart(new Time(new
+				// SimpleDateFormat("hh:mm:ss").parse(obj[7] == null ? "" :
+				// obj[7].toString()).getTime()));
+				// fence.setStop(new Time(new
+				// SimpleDateFormat("hh:mm:ss").parse(obj[8] == null ? "" :
+				// obj[8].toString()).getTime()));
+				fence.setStart(obj[7] == null ? "" : obj[7].toString());
+				fence.setStop(obj[8] == null ? "" : obj[8].toString());
+				fence.setAddtime(obj[9] == null ? "" : obj[9].toString());
+				fence.setColor(obj[10] == null ? "" : obj[10].toString());
+				tb_fenceList.add(fence);
+			}
+		}
+		return tb_fenceList;
+	}
+	
+	public List<tb_fence> searchFenceLista(String input) {
+		String sql = null;
+		Query query = null;
+		sql = "SELECT id,floor,type,bumen,`name`,zuobiao,shape,`start`,`stop`,addtime,color FROM tb_fence WHERE floor = :floor";
+		query = this.em.createNativeQuery(sql);
+		query.setParameter("floor", input);
+		List resultList = query.getResultList();
+		List<tb_fence> tb_fenceList = new ArrayList<tb_fence>();
+		if (resultList.size() > 0) {
+			for (int i = 0; i < resultList.size(); i++) {
+				Object[] obj = (Object[]) resultList.get(i);
+				tb_fence fence = new tb_fence();
+				fence.setFloor(obj[1] == null ? "" : obj[1].toString());
+				fence.setType(obj[2] == null ? "" : obj[2].toString());
+				fence.setBumen(obj[3] == null ? "" : obj[3].toString());
+				fence.setName(obj[4] == null ? "" : obj[4].toString());
+				fence.setZuobiao(obj[5] == null ? "" : obj[5].toString());
+				fence.setShape(obj[6] == null ? "" : obj[6].toString());
+				fence.setStart(obj[7] == null ? "" : obj[7].toString());
+				fence.setStop(obj[8] == null ? "" : obj[8].toString());
+				fence.setAddtime(obj[9] == null ? "" : obj[9].toString());
+				fence.setColor(obj[10] == null ? "" : obj[10].toString());
+				tb_fenceList.add(fence);
+			}
+		}
+		return tb_fenceList;
+	}
+	
+	@Transactional
+	public int fenceList_modifya(tb_fence fence) {
+		String sql = null;
+		Query query = null;
+		sql = "UPDATE tb_fence SET bumen=:bumen,name=:name,zuobiao=:zuobiao,start=:start,stop=:stop,baoliu1=:baoliu1 WHERE id=:id";
 		cs.tb_caozuo("tb_fence", 3);
 		query = this.em.createNativeQuery(sql);
 		query.setParameter("bumen", fence.getBumen());
@@ -222,13 +493,36 @@
 		query.setParameter("start", fence.getStart());
 		query.setParameter("stop", fence.getStop());
 		query.setParameter("id", fence.getId());
-		query.executeUpdate();
+		query.setParameter("baoliu1", fence.getBaoliu1());
+		int aaa = query.executeUpdate();
+		return aaa;
 	}
 
 	@Transactional
-	public void fenceList_delete(String[] checkVal) {
+	public int fenceList_modify(tb_fence fence) {
 		String sql = null;
 		Query query = null;
+		sql = "UPDATE tb_fence SET bumen=:bumen,name=:name,zuobiao=:zuobiao,start=:start,stop=:stop,baoliu1=:baoliu1,baoliu3=:baoliu3,baoliu4=:baoliu4 WHERE id=:id";
+		cs.tb_caozuo("tb_fence", 3);
+		query = this.em.createNativeQuery(sql);
+		query.setParameter("bumen", fence.getBumen());
+		query.setParameter("name", fence.getName());
+		query.setParameter("zuobiao", fence.getZuobiao());
+		query.setParameter("start", fence.getStart());
+		query.setParameter("stop", fence.getStop());
+		query.setParameter("id", fence.getId());
+		query.setParameter("baoliu1", fence.getBaoliu1());
+		query.setParameter("baoliu3", fence.getBaoliu3());
+		query.setParameter("baoliu4", fence.getBaoliu4());
+		int aaa = query.executeUpdate();
+		return aaa;
+	}
+
+	@Transactional
+	public int fenceList_delete(String[] checkVal) {
+		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_fence WHERE id = :id";
@@ -237,16 +531,18 @@
 			query.setParameter("id", id);
 			query.executeUpdate();
 		}
+		return aaa;
 	}
 
 	@Transactional
-	public void fenceList_deleteAll() {
+	public int fenceList_deleteAll() {
 		String sql = null;
 		Query query = null;
 		sql = "DELETE FROM tb_fence";
 		cs.tb_caozuo("tb_fence", 2);
 		query = this.em.createNativeQuery(sql);
-		query.executeUpdate();
+		int aaa = query.executeUpdate();
+		return aaa;
 	}
 
 	public List<tb_xunjianset> getInspectionSettings() {
@@ -447,9 +743,9 @@
 		int id = input;
 		String sql = null;
 		Query query = null;
-		sql = "SELECT id,floor,type,bumen,`name`,zuobiao,shape,`start`,`stop`,addtime,color FROM tb_fence WHERE id = :id";
+		sql = "SELECT id,floor,type,bumen,name,zuobiao,shape,start,stop,addtime,color FROM tb_fence WHERE id = :id";
 		query = this.em.createNativeQuery(sql);
-		query.setParameter("id", id);
+		query.setParameter("id", input);
 		List resultList = query.getResultList();
 		List<tb_fence> tb_fenceList = new ArrayList<tb_fence>();
 		if (resultList.size() > 0) {
@@ -462,12 +758,6 @@
 				fence.setName(obj[4] == null ? "" : obj[4].toString());
 				fence.setZuobiao(obj[5] == null ? "" : obj[5].toString());
 				fence.setShape(obj[6] == null ? "" : obj[6].toString());
-				// fence.setStart(new Time(new
-				// SimpleDateFormat("hh:mm:ss").parse(obj[7] == null ? "" :
-				// obj[7].toString()).getTime()));
-				// fence.setStop(new Time(new
-				// SimpleDateFormat("hh:mm:ss").parse(obj[8] == null ? "" :
-				// obj[8].toString()).getTime()));
 				fence.setStart(obj[7] == null ? "" : obj[7].toString());
 				fence.setStop(obj[8] == null ? "" : obj[8].toString());
 				fence.setAddtime(obj[9] == null ? "" : obj[9].toString());
@@ -477,5 +767,70 @@
 		}
 		return tb_fenceList;
 	}
+	
+	public String searchFenceListid2(int tagid) {
+		String sql = null;
+		Query query = null;
+		sql = "SELECT name from tb_fence WHERE id=:id";
+		query = this.em.createNativeQuery(sql);
+		query.setParameter("id", tagid);
+		List resultList = query.getResultList();
+		String status = resultList.get(0).toString();
+		return status;
+	}
 
+	@Transactional
+	public int zuoyeadd(tb_jobhistory job) {
+		String sql = null;
+		Query query = null;
+		sql = "INSERT INTO tb_jobhistory(type,fencename,department,tagid,high,fenceaddtime,addtime,beizhu) VALUES(:type,:fencename,:department,:tagid,:high,:fenceaddtime,now(),:beizhu)";
+		query = this.em.createNativeQuery(sql);
+		query.setParameter("type", job.getType());
+		query.setParameter("fencename", job.getFencename());
+		query.setParameter("department", job.getDepartment());
+		query.setParameter("tagid", job.getTagid());
+		query.setParameter("high", job.getHigh());
+		query.setParameter("fenceaddtime", job.getFenceaddtime());
+		query.setParameter("beizhu", job.getBeizhu());
+		int executeUpdate = query.executeUpdate();
+		return executeUpdate;
+	}
+	
+	public List<tb_jobhistory> getzuoye() {
+		String sql = null;
+		Query query = null;
+		sql = "SELECT id,type,fencename,department,tagid,high,fenceaddtime,addtime,beizhu FROM tb_jobhistory";
+		query = this.em.createNativeQuery(sql);
+		List resultList = query.getResultList();
+		List<tb_jobhistory> tb_jobhistorys = new ArrayList<tb_jobhistory>();
+		if (resultList.size() > 0) {
+			for (int i = 0; i < resultList.size(); i++) {
+				tb_jobhistory job = new tb_jobhistory();
+				Object[] obj = (Object[]) resultList.get(i);
+				job.setId((int) obj[0]);
+				job.setType(obj[1] == null ? "" : obj[1].toString());
+				job.setFencename(obj[2] == null ? "" : obj[2].toString());
+				job.setDepartment(obj[3] == null ? "" : obj[3].toString());
+				job.setTagid(obj[4] == null ? "" : obj[4].toString());
+				job.setHigh(obj[5] == null ? "" : obj[5].toString());
+				job.setFenceaddtime(obj[6] == null ? "" : obj[6].toString());
+				job.setAddtime(obj[7] == null ? "" : obj[7].toString());
+				job.setBeizhu(obj[8] == null ? "" : obj[8].toString());
+				tb_jobhistorys.add(job);
+			}
+		}
+		return tb_jobhistorys;
+	}
+	
+	@Transactional
+	public int enablefence(tb_fence fence) {
+		String sql = null;
+		Query query = null;
+		sql = "UPDATE tb_fence SET baoliu7=:baoliu7 WHERE id=:id";
+		query = this.em.createNativeQuery(sql);
+		query.setParameter("id", fence.getId());
+		query.setParameter("baoliu7", fence.getBaoliu7());
+		int aaa = query.executeUpdate();
+		return aaa;
+	}
 }

--
Gitblit v1.10.0