From bc131131c5c96f8cb3bed679d4a359820c22e335 Mon Sep 17 00:00:00 2001
From: 15832144755 <67030627+15832144755@users.noreply.github.com>
Date: 星期四, 17 三月 2022 09:38:47 +0800
Subject: [PATCH] 3.17

---
 src/main/java/com/hxzkoa/controller/LabelController.java |  354 +++++++++++++++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 321 insertions(+), 33 deletions(-)

diff --git a/src/main/java/com/hxzkoa/controller/LabelController.java b/src/main/java/com/hxzkoa/controller/LabelController.java
index 1cf69b2..a10cbe6 100644
--- a/src/main/java/com/hxzkoa/controller/LabelController.java
+++ b/src/main/java/com/hxzkoa/controller/LabelController.java
@@ -8,6 +8,7 @@
 import java.util.Collections;
 import java.util.Comparator;
 import java.util.List;
+import java.util.Map;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
@@ -15,6 +16,7 @@
 
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RequestParam;
@@ -59,40 +61,40 @@
 	private BasicInfoService basicInfoService;
 	@Autowired
 	private AnchorService anchorService;
-	
+
 	@ResponseBody
 	@RequestMapping(value = "/to_cs_pinlv.do", method = { RequestMethod.POST, RequestMethod.GET })
 	public void pinlv(HttpServletRequest request) {
 		String tag_id = request.getParameter("tag_id");
 		String hz = request.getParameter("hz");
-		String xieyi = "55BB,ALERT_TAG_HZ,"+hz+","+tag_id+",END";
+		String xieyi = "55BB,ALERT_TAG_HZ," + hz + "," + tag_id + ",END";
 		Udp_Out.udp_to_cs(xieyi);
 	}
-	
+
 	@ResponseBody
 	@RequestMapping(value = "/to_cs_xiumian_time.do", method = { RequestMethod.POST, RequestMethod.GET })
 	public void xiumiantime(HttpServletRequest request) {
 		String tag_id = request.getParameter("tag_id");
 		String hz = request.getParameter("hz");
-		String xieyi = "55BB,ALERT_SLEEP_TIME,"+hz+","+tag_id+",END";
+		String xieyi = "55BB,ALERT_SLEEP_TIME," + hz + "," + tag_id + ",END";
 		Udp_Out.udp_to_cs(xieyi);
 	}
-	
+
 	@ResponseBody
 	@RequestMapping(value = "/to_cs_xiumian_.do", method = { RequestMethod.POST, RequestMethod.GET })
 	public void xiumian(HttpServletRequest request) {
 		String tag_id = request.getParameter("tag_id");
 		String hz = request.getParameter("hz");
-		String xieyi = "55BB,OPEN_OR_CLOSE_SLEEP,"+hz+","+tag_id+",END";
+		String xieyi = "55BB,OPEN_OR_CLOSE_SLEEP," + hz + "," + tag_id + ",END";
 		Udp_Out.udp_to_cs(xieyi);
 	}
-	
+
 	@ResponseBody
 	@RequestMapping(value = "/to_cs_zhendong_.do", method = { RequestMethod.POST, RequestMethod.GET })
 	public void zhendong(HttpServletRequest request) {
 		String tag_id = request.getParameter("tag_id");
 		String hz = request.getParameter("hz");
-		String xieyi = "55BB,TAG_SHAKE,"+hz+","+tag_id+",END";
+		String xieyi = "55BB,TAG_SHAKE," + hz + "," + tag_id + ",END";
 		Udp_Out.udp_to_cs(xieyi);
 	}
 
@@ -104,12 +106,35 @@
 		int curPage = 1;
 		int count = labelService.getLabelManagementCount();
 		int minPage = PageUtil.getMinPage(count);
-		//System.out.print(minPage);
+		// System.out.print(minPage);
 		request.setAttribute("pageList", PageUtil.getPage(minPage));
 		request.setAttribute("curPage", curPage);
 		return toPage;
 	}
 
+	@ResponseBody
+	@RequestMapping(value = "/labelManagementa.do", method = { RequestMethod.POST, RequestMethod.GET })
+	public JSONObject labelManagementa(HttpServletRequest request) {
+		List<tb_tag> labelManagementList = labelService.getLabelManagementa();
+		JSONObject json = new JSONObject();
+		json.put("dataList", labelManagementList);
+		return json;
+	}
+	
+	@ResponseBody
+	@RequestMapping(value = "/labelManagementaa.do", method = { RequestMethod.POST, RequestMethod.GET })
+	public JSONObject labelManagementaa(HttpServletRequest request) {
+		JSONObject json = new JSONObject();
+		List<tb_tag> labelManagementList = labelService.getLabelManagement(1);
+		int curPage = 1;
+		int count = labelService.getLabelManagementCount();
+		int minPage = PageUtil.getMinPage(count);
+		json.put("dataList", labelManagementList);
+		json.put("pageList", PageUtil.getPage(minPage));
+		json.put("curPage", curPage);
+		return json;
+	}
+
 	@RequestMapping(value = "/labelManagement_add.do", method = { RequestMethod.POST, RequestMethod.GET })
 	public void labelManagement_add(HttpServletRequest request) throws IOException {
 		tb_tag tag = new tb_tag();
@@ -132,16 +157,17 @@
 		List<tb_tag> searchLabelManagement = labelService.searchLabelManagement(tag_id);
 		if (searchLabelManagement.size() == 0) {
 			labelService.labelManagement_add(tag);
-			if(("").equals(tag.getState())){
+			if (("").equals(tag.getState())) {
 				tag.setState("鏈粦瀹�");
 			}
-			if(("").equals(tag.getGaodu())){
+			if (("").equals(tag.getGaodu())) {
 				tag.setGaodu("150");
 			}
-			if(("").equals(tag.getSudu())){
+			if (("").equals(tag.getSudu())) {
 				tag.setSudu("1000");
 			}
-			String xieyi = "BSTOCS1,ADDTAG,"+tag.getTag_id()+","+tag.getState()+","+tag.getGaodu()+","+tag.getSudu()+","+tag.getPinglv()+",END";
+			String xieyi = "BSTOCS1,ADDTAG," + tag.getTag_id() + "," + tag.getState() + "," + tag.getGaodu() + ","
+					+ tag.getSudu() + "," + tag.getPinglv() + ",END";
 			Udp_Out.udp_to_cs(xieyi);
 			// 鏂板鏍囩鍚屾椂闇�瑕佸湪tb_person涓彃鍏ヤ竴鏉℃暟鎹�
 			tb_person person = new tb_person();
@@ -164,6 +190,64 @@
 		}
 	}
 
+	@ResponseBody
+	@RequestMapping(value = "/labelManagement_adda.do", method = { RequestMethod.POST, RequestMethod.GET })
+	public int labelManagement_adda(HttpServletRequest request) throws IOException {
+		tb_tag tag = new tb_tag();
+		int aaa = 0;
+		String tag_id = request.getParameter("tag_id");
+		if (("").equals(tag_id) || tag_id == null) {
+			// 鎺ュ彛澶勭悊閫昏緫
+			String jsonString = RequestUtils.getRequestJsonString(request, Config.getCharset());
+			tag = (tb_tag) JSONObject.toBean(JSONObject.fromObject(jsonString), tb_tag.class);
+			tag_id = tag.getTag_id();
+		} else {
+			// 缃戦〉璇锋眰閫昏緫
+			tag.setTag_id(request.getParameter("tag_id"));
+			tag.setState(request.getParameter("state"));
+			tag.setGaodu(request.getParameter("gaodu"));
+			tag.setSudu(request.getParameter("sudu"));
+			tag.setPinglv(request.getParameter("pinglv"));
+			tag.setVersion(Config.getVersion());
+		}
+		// 濡傛灉璇ag_id涓嶅瓨鍦紝鏂板涓�鏉�
+		List<tb_tag> searchLabelManagement = labelService.searchLabelManagement(tag_id);
+		if (searchLabelManagement.size() == 0) {
+			aaa = labelService.labelManagement_add(tag);
+			if (("").equals(tag.getState())) {
+				tag.setState("鏈粦瀹�");
+			}
+			if (("").equals(tag.getGaodu())) {
+				tag.setGaodu("150");
+			}
+			if (("").equals(tag.getSudu())) {
+				tag.setSudu("1000");
+			}
+			String xieyi = "BSTOCS1,ADDTAG," + tag.getTag_id() + "," + tag.getState() + "," + tag.getGaodu() + ","
+					+ tag.getSudu() + "," + tag.getPinglv() + ",END";
+			Udp_Out.udp_to_cs(xieyi);
+			// 鏂板鏍囩鍚屾椂闇�瑕佸湪tb_person涓彃鍏ヤ竴鏉℃暟鎹�
+			tb_person person = new tb_person();
+			person.setP_tagid(tag.getTag_id());
+			person.setP_name(tag.getState());
+			person.setP_power(tag.getPower());
+			person.setP_sex("鐢�");
+			person.setP_minzu("姹�");
+			person.setP_phone("131******88");
+			person.setP_department("绯荤粺榛樿");
+			person.setP_x("0");
+			person.setP_y("0");
+			person.setP_floor("0");
+			person.setP_sos("0");
+			person.setP_online("0");
+			person.setP_kaoqing("0");
+			person.setP_fence("0");
+			person.setP_image("image/targeticon/default.png");
+			basicInfoService.personManagement_add(person);
+		}
+		return aaa;
+	}
+
 	@RequestMapping(value = "/labelManagement_modify.do", method = { RequestMethod.POST, RequestMethod.GET })
 	public void labelManagement_modify(HttpServletRequest request) {
 		tb_tag tag = new tb_tag();
@@ -173,11 +257,12 @@
 		tag.setSudu(request.getParameter("sudu"));
 		tag.setPinglv(request.getParameter("pinglv"));
 		labelService.labelManagement_modify(tag);
-		String xieyi = "BSTOCS1,ALTERTAG,"+tag.getTag_id()+","+tag.getState()+","+tag.getGaodu()+","+tag.getSudu()+","+tag.getPinglv()+",END";
+		String xieyi = "BSTOCS1,ALTERTAG," + tag.getTag_id() + "," + tag.getState() + "," + tag.getGaodu() + ","
+				+ tag.getSudu() + "," + tag.getPinglv() + ",END";
 		Udp_Out.udp_to_cs(xieyi);
 		// 淇敼鏍囩鍚屾椂闇�瑕佷慨鏀箃b_person 闇�瑕佸厛鏌ュ啀鏀瑰惁鍒欒鐩栫┖
 		List<tb_person> searchPersonManagement = basicInfoService.searchPersonManagement(tag.getTag_id());
-		if(searchPersonManagement!=null){
+		if (searchPersonManagement != null) {
 			tb_person person = searchPersonManagement.get(0);
 			person.setP_tagid(tag.getTag_id());
 			person.setP_name(tag.getState());
@@ -186,6 +271,94 @@
 		}
 	}
 
+	@ResponseBody
+	@RequestMapping(value = "/labelManagement_modifya.do", method = { RequestMethod.POST, RequestMethod.GET })
+	public int labelManagement_modifya(HttpServletRequest request) {
+		tb_tag tag = new tb_tag();
+		tag.setTag_id(request.getParameter("tag_id"));
+		tag.setState(request.getParameter("state"));
+		tag.setGaodu(request.getParameter("gaodu"));
+		tag.setSudu(request.getParameter("sudu"));
+		tag.setPinglv(request.getParameter("pinglv"));
+		int aaa = labelService.labelManagement_modifya(tag);
+		String xieyi = "BSTOCS1,ALTERTAG," + tag.getTag_id() + "," + tag.getState() + "," + tag.getGaodu() + ","
+				+ tag.getSudu() + "," + tag.getPinglv() + ",END";
+		Udp_Out.udp_to_cs(xieyi);
+		// 淇敼鏍囩鍚屾椂闇�瑕佷慨鏀箃b_person 闇�瑕佸厛鏌ュ啀鏀瑰惁鍒欒鐩栫┖
+		List<tb_person> searchPersonManagement = basicInfoService.searchPersonManagement(tag.getTag_id());
+		if (searchPersonManagement != null) {
+			tb_person person = searchPersonManagement.get(0);
+			person.setP_tagid(tag.getTag_id());
+			person.setP_name(tag.getState());
+			person.setP_power(tag.getPower());
+			basicInfoService.personManagement_modify(person);
+		}
+		return aaa;
+	}
+
+	// 缁戝畾鐢ㄦ埛
+	@ResponseBody
+	@RequestMapping(value = "/labelManagement_modifyaa.do", method = { RequestMethod.POST, RequestMethod.GET }, produces ="application/json; charset=utf-8")
+	public int labelManagement_modifyaa(@RequestBody Map map) {
+		tb_tag tag = new tb_tag();
+		tag.setTag_id(map.get("tag_id").toString());
+		tag.setState(map.get("name").toString());
+		List<tb_tag> searchtagManagement = basicInfoService.searchPersonManagementa(tag.getTag_id());
+		int aaa = 0;
+		if (searchtagManagement != null) {
+			aaa = labelService.labelManagement_modifytag(tag);
+			List<tb_tag> tags = labelService.searchLabelManagement(tag.getTag_id());
+//			String xieyi = "BSTOCS1,ALTERTAG," + tag.getTag_id() + "," + tag.getState() + "," + tags.get(0).getGaodu() + ","
+//					+ tags.get(0).getSudu() + "," + tags.get(0).getPinglv() + ",END";
+//			Udp_Out.udp_to_cs(xieyi);
+			tb_person person = new tb_person();
+			person.setP_tagid(tag.getTag_id());
+			person.setP_name(tag.getState());
+//			person.setP_sex(request.getParameter("sex"));
+//			person.setP_minzu(request.getParameter("minzu"));
+			person.setP_fangkeid(map.get("fangkeid").toString());
+			person.setP_idcardnum(map.get("idcardnum").toString());
+//			person.setP_adress(request.getParameter("adress"));
+			// 淇敼鏍囩鍚屾椂闇�瑕佷慨鏀箃b_person 闇�瑕佸厛鏌ュ啀鏀瑰惁鍒欒鐩栫┖
+			List<tb_person> searchPersonManagement = basicInfoService.searchPersonManagement(tag.getTag_id());
+			if (searchPersonManagement != null) {
+				labelService.labelManagement_modifyperson(person);
+			}
+		}
+		return aaa;
+	}
+
+	// 鐢ㄦ埛瑙g粦
+	@ResponseBody
+	@RequestMapping(value = "/labelManagement_modifyaaa.do", method = { RequestMethod.POST, RequestMethod.GET }, produces ="application/json; charset=utf-8")
+	public int labelManagement_modifyaaa(@RequestBody Map map) {
+		tb_tag tag = new tb_tag();
+		tag.setTag_id(map.get("tag_id").toString());
+		tag.setState("鏈粦瀹�");
+		List<tb_tag> searchtagManagement = basicInfoService.searchPersonManagementa(tag.getTag_id());
+		int aaa = 0;
+		if (searchtagManagement != null) {
+			aaa = labelService.labelManagement_modifytag(tag);
+//			List<tb_tag> tags = labelService.searchLabelManagement(tag.getTag_id());
+//			String xieyi = "BSTOCS1,ALTERTAG,"+tag.getTag_id()+","+tag.getState()+","+tags.get(0).getGaodu()+","+tags.get(0).getSudu()+","+tags.get(0).getPinglv()+",END";
+//			Udp_Out.udp_to_cs(xieyi);
+		tb_person person = new tb_person();
+		person.setP_tagid(tag.getTag_id());
+		person.setP_name(tag.getState());
+		person.setP_sex("-");
+		person.setP_minzu("-");
+		person.setP_phone("-");
+		person.setP_idcardnum("-");
+		person.setP_adress("-");
+		// 淇敼鏍囩鍚屾椂闇�瑕佷慨鏀箃b_person 闇�瑕佸厛鏌ュ啀鏀瑰惁鍒欒鐩栫┖
+		List<tb_person> searchPersonManagement = basicInfoService.searchPersonManagement(tag.getTag_id());
+		if (searchPersonManagement != null) {
+			labelService.labelManagement_modifyperson(person);
+		}
+		}
+		return aaa;
+	}
+
 	@RequestMapping(value = "/labelManagement_modifyAll.do", method = { RequestMethod.POST, RequestMethod.GET })
 	public void labelManagement_modifyAll(HttpServletRequest request) {
 		tb_tag tag = new tb_tag();
@@ -193,7 +366,7 @@
 		tag.setSudu(request.getParameter("sudu"));
 		tag.setPinglv(request.getParameter("pinglv"));
 		labelService.labelManagement_modifyAll(tag);
-		String xieyi = "BSTOCS1,ALTERALLTAG,"+tag.getGaodu()+","+tag.getSudu()+","+tag.getPinglv()+",END";
+		String xieyi = "BSTOCS1,ALTERALLTAG," + tag.getGaodu() + "," + tag.getSudu() + "," + tag.getPinglv() + ",END";
 		Udp_Out.udp_to_cs(xieyi);
 		// 闇�瑕侀亶鍘嗕慨鏀�
 		List<tb_tag> labelList = labelService.getLabelManagement();
@@ -201,7 +374,7 @@
 			String tag_id = labelList.get(i).getTag_id();
 			// 淇敼鏍囩鍚屾椂闇�瑕佷慨鏀箃b_person 闇�瑕佸厛鏌ュ啀鏀瑰惁鍒欒鐩栫┖
 			List<tb_person> searchPersonManagement = basicInfoService.searchPersonManagement(tag_id);
-			if(searchPersonManagement!=null){
+			if (searchPersonManagement != null) {
 				tb_person person = searchPersonManagement.get(0);
 				person.setP_tagid(tag.getTag_id());
 				person.setP_name(tag.getState());
@@ -212,6 +385,33 @@
 	}
 
 	@ResponseBody
+	@RequestMapping(value = "/labelManagement_modifyAlla.do", method = { RequestMethod.POST, RequestMethod.GET })
+	public int labelManagement_modifyAlla(HttpServletRequest request) {
+		tb_tag tag = new tb_tag();
+		tag.setGaodu(request.getParameter("gaodu"));
+		tag.setSudu(request.getParameter("sudu"));
+		tag.setPinglv(request.getParameter("pinglv"));
+		int aaa = labelService.labelManagement_modifyAlla(tag);
+		String xieyi = "BSTOCS1,ALTERALLTAG," + tag.getGaodu() + "," + tag.getSudu() + "," + tag.getPinglv() + ",END";
+		Udp_Out.udp_to_cs(xieyi);
+		// 闇�瑕侀亶鍘嗕慨鏀�
+		List<tb_tag> labelList = labelService.getLabelManagement();
+		for (int i = 0; i < labelList.size(); i++) {
+			String tag_id = labelList.get(i).getTag_id();
+			// 淇敼鏍囩鍚屾椂闇�瑕佷慨鏀箃b_person 闇�瑕佸厛鏌ュ啀鏀瑰惁鍒欒鐩栫┖
+			List<tb_person> searchPersonManagement = basicInfoService.searchPersonManagement(tag_id);
+			if (searchPersonManagement != null) {
+				tb_person person = searchPersonManagement.get(0);
+				person.setP_tagid(tag.getTag_id());
+				person.setP_name(tag.getState());
+				person.setP_power(tag.getPower());
+				basicInfoService.personManagement_modify(person);
+			}
+		}
+		return aaa;
+	}
+
+	@ResponseBody
 	@RequestMapping(value = "/labelManagement_delete.do", method = { RequestMethod.POST, RequestMethod.GET })
 	public void labelManagement_delete(HttpServletRequest request) {
 		String checkValStr = request.getParameter("checkVal");
@@ -219,11 +419,28 @@
 		String[] checkVal = checkValStr.split(",");
 		labelService.labelManagement_delete(checkVal);
 		for (int i = 0; i < checkVal.length; i++) {
-			String xieyi = "BSTOCS1,DELETETAG,"+checkVal[i]+",END";
+			String xieyi = "BSTOCS1,DELETETAG," + checkVal[i] + ",END";
 			Udp_Out.udp_to_cs(xieyi);
 		}
 		// 鍒犻櫎鏍囩鍚屾椂闇�瑕佸垹闄b_person
-		labelService.labelperson_delete(checkVal);	
+		labelService.labelperson_delete(checkVal);
+	}
+
+	@ResponseBody
+	@RequestMapping(value = "/labelManagement_deletea.do", method = { RequestMethod.POST, RequestMethod.GET })
+	public int labelManagement_deletea(HttpServletRequest request) {
+		String checkValStr = request.getParameter("checkVal");
+		checkValStr = checkValStr.replaceAll("\"", "");
+		String[] checkVal = checkValStr.split(",");
+//		String[] tagids = new String[checkVal.length];
+//		for (int i = 0; i < checkVal.length; i++) {
+//			List<tb_tag> tags = labelService.searchidLabelManagement(checkVal[i]);
+//			tagids[i] = tags.get(0).getTag_id();
+//		}
+		int aaa = labelService.labelManagement_deletea(checkVal);
+		// 鍒犻櫎鏍囩鍚屾椂闇�瑕佸垹闄b_person
+		labelService.labelperson_delete(checkVal);
+		return aaa;
 	}
 
 	@ResponseBody
@@ -237,6 +454,17 @@
 	}
 
 	@ResponseBody
+	@RequestMapping(value = "/labelManagement_deleteAlla.do", method = { RequestMethod.POST, RequestMethod.GET })
+	public int labelManagement_deleteAlla(HttpServletRequest request) {
+		int aaa = labelService.labelManagement_deleteAlla();
+		String xieyi = "BSTOCS1,DELETEALLTAG,END";
+		Udp_Out.udp_to_cs(xieyi);
+		// 鍒犻櫎鏍囩鍚屾椂闇�瑕佸垹闄b_person
+		basicInfoService.personManagement_deleteAll();
+		return aaa;
+	}
+
+	@ResponseBody
 	@RequestMapping(value = "/labelManagement_search.do", method = { RequestMethod.POST, RequestMethod.GET })
 	public String labelManagement_search(HttpServletRequest request) throws IOException {
 		JSONObject json = new JSONObject();
@@ -265,6 +493,29 @@
 	}
 
 	@ResponseBody
+	@RequestMapping(value = "/labelManagement_searcha.do", method = { RequestMethod.POST, RequestMethod.GET })
+	public JSONObject labelManagement_searcha(HttpServletRequest request) throws IOException {
+		JSONObject json = new JSONObject();
+		String input = request.getParameter("tagid");
+		if (("").equals(input) || input == null) {
+			String jsonString = RequestUtils.getRequestJsonString(request, Config.getCharset());
+			tb_tag tag = (tb_tag) JSONObject.toBean(JSONObject.fromObject(jsonString), tb_tag.class);
+			input = tag.getTag_id();
+			List<tb_tag> labelManagementList = labelService.searchLabelManagement(input);
+			if (labelManagementList.size() > 0) {
+				json.put("result", labelManagementList.get(0));
+			} else {
+				json.put("result", "null");
+			}
+
+		} else {
+			List<tb_tag> labelManagementList = labelService.searchLabelManagement(input);
+			json.put("dataList", labelManagementList);
+		}
+		return json;
+	}
+
+	@ResponseBody
 	@RequestMapping(value = "/labelManagement_page.do", method = { RequestMethod.POST, RequestMethod.GET })
 	public String labelManagement_page(HttpServletRequest request) {
 		String pageStr = request.getParameter("page");
@@ -298,7 +549,7 @@
 	public String labelManagement_exportTemplate(HttpServletRequest request, HttpServletResponse response) {
 		String toPage = "forward:/hxzk/label/labelManagement.jsp";
 		List<tb_tag> labelTemplateList = labelService.getLabelManagement(1);
-		String[] rowName = { "鏍囩ID", "缁戝畾瀵硅薄"};
+		String[] rowName = { "鏍囩ID", "缁戝畾瀵硅薄" };
 		List<Object[]> dataList = labelTemplateobjectToArray(labelTemplateList);
 		ExcelUtils excel = new ExcelUtils("鏍囩绠$悊", rowName, dataList);
 		OutputStream out;
@@ -398,7 +649,7 @@
 			}
 			for (MultipartFile file : files) {
 				file.transferTo(new File(filePath + file.getOriginalFilename()));
-				//System.out.print(file.getOriginalFilename());
+				// System.out.print(file.getOriginalFilename());
 			}
 		} catch (IOException e) {
 			e.printStackTrace();
@@ -430,6 +681,23 @@
 					tag.setPinglv("鏃�");
 					tag.setVersion("鏃�");
 					result = labelService.labelManagement_add(tag);
+					tb_person person = new tb_person();
+					person.setP_tagid(tag.getTag_id());
+					person.setP_name(tag.getState());
+					person.setP_power(tag.getPower());
+					person.setP_sex("鐢�");
+					person.setP_minzu("姹�");
+					person.setP_phone("131******88");
+					person.setP_department("绯荤粺榛樿");
+					person.setP_x("0");
+					person.setP_y("0");
+					person.setP_floor("0");
+					person.setP_sos("0");
+					person.setP_online("0");
+					person.setP_kaoqing("0");
+					person.setP_fence("0");
+					person.setP_image("image/targeticon/default.png");
+					basicInfoService.personManagement_add(person);
 				}
 			}
 			// 閲婃斁璧勬簮
@@ -737,16 +1005,17 @@
 		json.put("image", imageStr);
 		return json.toString();
 	}
-	
+
 	@ResponseBody
 	@RequestMapping(value = "/labelDeliver_readPoscard.do", method = { RequestMethod.POST, RequestMethod.GET })
 	public String labelDeliver_readPoscard(HttpServletRequest request) {
 		JSONObject json = new JSONObject();
 		List<tb_adress_and_port> adress_and_port = labelService.getAdress_and_port();
 		String rfidnum = "";
-		if(IDcard.M1_MF_HL_Request(adress_and_port)==144) {
-			 rfidnum=String.valueOf(IDcard.kaohao);	
-		};					
+		if (IDcard.M1_MF_HL_Request(adress_and_port) == 144) {
+			rfidnum = String.valueOf(IDcard.kaohao);
+		}
+		;
 		json.put("rfidnum", rfidnum);
 		return json.toString();
 	}
@@ -890,6 +1159,25 @@
 	}
 
 	@ResponseBody
+	@RequestMapping(value = "/historicalPower_searchname.do", method = { RequestMethod.POST, RequestMethod.GET })
+	public String historicalPower_searchname(HttpServletRequest request) {
+		String begin = request.getParameter("begin");
+		String end = request.getParameter("end");
+		String tagida = request.getParameter("tagida");
+		System.out.print(begin + "-----" + end + "--------" + tagida);
+		int curPage = 1;
+		List<Integer> pageList = new ArrayList<Integer>();
+		List<tb_history_power> historicalPowerList = labelService.searchnameHistoricalPower(begin, end, tagida);
+		System.out.print(historicalPowerList.get(0));
+		pageList.add(1);
+		JSONObject json = new JSONObject();
+		json.put("dataList", historicalPowerList);
+		json.put("pageList", pageList);
+		json.put("curPage", curPage);
+		return json.toString();
+	}
+
+	@ResponseBody
 	@RequestMapping(value = "/historicalPower_powerAnalysis.do", method = { RequestMethod.POST, RequestMethod.GET })
 	public String historicalPower_powerAnalysis(HttpServletRequest request) throws Exception {
 		String input = request.getParameter("input");
@@ -897,7 +1185,7 @@
 		List<Integer> pageList = new ArrayList<Integer>();
 		List<tb_history_power> historicalPowerList = labelService.searchPowerAnalysis(input);
 		String sysPath = request.getServletContext().getRealPath("/");
-		LineXy.getJFreeChart_hp(input, historicalPowerList,sysPath);
+		LineXy.getJFreeChart_hp(input, historicalPowerList, sysPath);
 		pageList.add(1);
 		JSONObject json = new JSONObject();
 		String filePath = "hxzk/image/powerAnalysis/" + input + "鐢甸噺鍒嗘瀽.jpeg";
@@ -999,16 +1287,16 @@
 		tb_tag tag = (tb_tag) JSONObject.toBean(JSONObject.fromObject(jsonString), tb_tag.class);
 		// 鏄剧ずsql
 		String sqlString = "UPDATE tb_tag SET power=" + tag.getPower() + " WHERE tag_id=" + tag.getTag_id();
-		String messageJson =  GetNowTime.timestamp2()+ " 鏀讹細"+ sqlString ;
+		String messageJson = GetNowTime.timestamp2() + " 鏀讹細" + sqlString;
 		String BaowenPath = Config.getBaowenConfig();
 		String baowenStatus = ModifyConfig.readData(BaowenPath, "baowenSwitch");
-		if (baowenStatus.equals("1")){
+		if (baowenStatus.equals("1")) {
 			/* Udp_Receive.mysqlMessage.add(messageJson); */
 		}
 		//
 		labelService.label_bw_power(tag);
 	}
-	
+
 	@ResponseBody
 	@RequestMapping(value = "/labeltag_id_search.do", method = { RequestMethod.POST, RequestMethod.GET })
 	public int labeltag_id_search(HttpServletRequest request) throws IOException {
@@ -1036,10 +1324,10 @@
 			json.put("pageList", pageList);
 			json.put("curPage", curPage);
 		}
-		if(null == labelManagementList || labelManagementList.size() ==0 ) {
-			nn=0;
-		}else {
-			nn=1;
+		if (null == labelManagementList || labelManagementList.size() == 0) {
+			nn = 0;
+		} else {
+			nn = 1;
 		}
 		return nn;
 	}

--
Gitblit v1.10.0