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/AnchorController.java |  145 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 144 insertions(+), 1 deletions(-)

diff --git a/src/main/java/com/hxzkoa/controller/AnchorController.java b/src/main/java/com/hxzkoa/controller/AnchorController.java
index 92ecea2..3fdffa5 100644
--- a/src/main/java/com/hxzkoa/controller/AnchorController.java
+++ b/src/main/java/com/hxzkoa/controller/AnchorController.java
@@ -53,6 +53,29 @@
 		return toPage;
 	}
 	
+	@ResponseBody
+	@RequestMapping(value = "/anchorManagementaa.do", method = { RequestMethod.POST, RequestMethod.GET })
+	public JSONObject anchorManagementaa(HttpServletRequest request) {
+		JSONObject json = new JSONObject();
+		List<tb_achor> achorManagementList = anchorService.getAnchorManagement(1);
+		int curPage = 1;
+		int count = anchorService.getAnchorManagementCount();
+		int minPage = PageUtil.getMinPage(count);
+		json.put("dataList", achorManagementList);
+		json.put("pageList", PageUtil.getPage(minPage));
+		json.put("curPage", curPage);
+		return json;
+	}
+	
+	@ResponseBody
+	@RequestMapping(value = "/anchorManagementa.do", method = { RequestMethod.POST, RequestMethod.GET })
+	public JSONObject anchorManagementa(HttpServletRequest request) {
+		JSONObject json = new JSONObject();
+		List<tb_achor> achorManagementList = anchorService.getAnchorManagementa();
+		json.put("dataList", achorManagementList);
+		return json;
+	}
+	
 	@RequestMapping(value = "/anchor_bw_status.do", method = { RequestMethod.POST, RequestMethod.GET })
 	public void anchor_bw_status(HttpServletRequest request) throws IOException {
 		String jsonString = RequestUtils.getRequestJsonString(request, Config.getCharset());
@@ -104,6 +127,54 @@
 		tongbu.setState("0");
 		anchorService.syncConfiguration_add(tongbu);
 	}
+	
+	@ResponseBody
+	@RequestMapping(value = "/anchorManagement_adda.do", method = { RequestMethod.POST, RequestMethod.GET })
+	public int anchorManagement_adda(HttpServletRequest request) throws IOException {
+		tb_achor anchor = new tb_achor();
+		int aaa = 0;
+		String anchorid = request.getParameter("anchorid");
+		if (("").equals(anchorid) || anchorid == null) {
+			String jsonString = RequestUtils.getRequestJsonString(request, Config.getCharset());
+			anchor = (tb_achor) JSONObject.toBean(JSONObject.fromObject(jsonString), tb_achor.class);
+			List<tb_achor> searchAnchorList = anchorService.searchAnchorManagement(anchor.getAnchorid());
+			if (searchAnchorList.size() == 0) {
+				anchorService.anchorManagement_add(anchor);
+			}
+		} else {
+			anchor.setAnchorid(anchorid);
+			anchor.setPOSX(request.getParameter("POSX"));
+			anchor.setPOSY(request.getParameter("POSY"));
+			anchor.setPOSZ(request.getParameter("POSZ"));
+			anchor.setLayer(request.getParameter("layer"));
+			anchor.setZu(request.getParameter("zu"));
+			anchor.setLiangcheng(request.getParameter("liangcheng"));
+			if(("").equals(anchor.getLiangcheng())){
+				anchor.setLiangcheng("100000");
+			}
+			anchor.setAnchorip(request.getParameter("anchorip"));
+			anchor.setAnchormode("1");
+			anchor.setVersion(Config.getVersion());
+			// 濡傛灉璇nchorid涓嶅瓨鍦紝鏂板涓�鏉�
+			List<tb_achor> searchAnchorList = anchorService.searchAnchorManagement(anchorid);
+			if (searchAnchorList.size() == 0) {
+				aaa = anchorService.anchorManagement_add(anchor);
+				String xieyi = "BSTOCS1,ADDANC,"+anchor.getAnchorid()+","+anchor.getPOSX()+","+anchor.getPOSY()+","+anchor.getPOSZ()+","+anchor.getLayer()+","+anchor.getZu()+","+anchor.getLiangcheng()+","+anchor.getAnchorip()+",END";
+				Udp_Out.udp_to_cs(xieyi);
+			}
+		}
+		//鏂板涓磋繎鍩虹珯鍜屽悓姝ュ熀绔�
+		tb_anchor_nearby nearby = new tb_anchor_nearby();
+		nearby.setAnchorid(anchor.getAnchorid());
+		nearby.setQiehuan("0");
+		anchorService.proximityConfiguration_add(nearby);
+		tb_tongbuanchor tongbu = new tb_tongbuanchor();
+		tongbu.setAnchorid(anchor.getAnchorid());
+		tongbu.setType(anchor.getAnchormode());
+		tongbu.setState("0");
+		anchorService.syncConfiguration_add(tongbu);
+		return aaa;
+	}
 
 	@RequestMapping(value = "/anchorManagement_modify.do", method = { RequestMethod.POST, RequestMethod.GET })
 	public void anchorManagement_modify(HttpServletRequest request) {
@@ -125,6 +196,29 @@
 		tongbu.setType(anchor.getAnchormode());
 		anchorService.syncConfiguration_modify(tongbu);
 	}
+	
+	@ResponseBody
+	@RequestMapping(value = "/anchorManagement_modifya.do", method = { RequestMethod.POST, RequestMethod.GET })
+	public int anchorManagement_modifya(HttpServletRequest request) {
+		tb_achor anchor = new tb_achor();
+		anchor.setAnchorid(request.getParameter("anchorid"));
+		anchor.setPOSX(request.getParameter("POSX"));
+		anchor.setPOSY(request.getParameter("POSY"));
+		anchor.setPOSZ(request.getParameter("POSZ"));
+		anchor.setLayer(request.getParameter("layer"));
+		anchor.setZu(request.getParameter("zu"));
+		anchor.setLiangcheng(request.getParameter("liangcheng"));
+		anchor.setAnchorip(request.getParameter("anchorip"));
+		int aaa = anchorService.anchorManagement_modify(anchor);
+		String xieyi = "BSTOCS1,ALTERANC,"+anchor.getAnchorid()+","+anchor.getPOSX()+","+anchor.getPOSY()+","+anchor.getPOSZ()+","+anchor.getLayer()+","+anchor.getZu()+","+anchor.getLiangcheng()+","+anchor.getAnchorip()+",END";
+		Udp_Out.udp_to_cs(xieyi);
+		//淇敼涓磋繎鍩虹珯鍜屽悓姝ュ熀绔�
+		tb_tongbuanchor tongbu = new tb_tongbuanchor();
+		tongbu.setAnchorid(anchor.getAnchorid());
+		tongbu.setType(anchor.getAnchormode());
+		anchorService.syncConfiguration_modify(tongbu);
+		return aaa;
+	}
 
 	@RequestMapping(value = "/anchorManagement_heart.do", method = { RequestMethod.POST, RequestMethod.GET })
 	public void anchorManagement_heart(HttpServletRequest request) throws IOException {
@@ -157,6 +251,24 @@
 		anchorService.anchorProx_delete(anchorid);
 		anchorService.anchorSync_delete(anchorid);
 	}
+	
+	@ResponseBody
+	@RequestMapping(value = "/anchorManagement_deletea.do", method = { RequestMethod.POST, RequestMethod.GET })
+	public int anchorManagement_deletea(HttpServletRequest request) {
+		String checkValStr = request.getParameter("checkVal");
+		checkValStr = checkValStr.replaceAll("\"", "");
+		String[] checkVal = checkValStr.split(",");
+//		String[] anchorid = new String[checkVal.length];
+//		for (int i = 0; i < checkVal.length; i++) {
+//			List<tb_achor> anchors = anchorService.searchidAnchorManagement(checkVal[i]);
+//			System.out.print(anchors.get(0).getAnchorid());
+//			anchorid[i] = anchors.get(0).getAnchorid();
+//		}
+		int aaa = anchorService.anchorManagement_deletea(checkVal);
+		anchorService.anchorProx_delete(checkVal);
+		anchorService.anchorSync_delete(checkVal);
+		return aaa;
+	}
 
 	@ResponseBody
 	@RequestMapping(value = "/anchorManagement_deleteAll.do", method = { RequestMethod.POST, RequestMethod.GET })
@@ -165,6 +277,15 @@
 		String xieyi = "BSTOCS1,DELETEALLANC,END";
 		Udp_Out.udp_to_cs(xieyi);
 	}
+	
+	@ResponseBody
+	@RequestMapping(value = "/anchorManagement_deleteAlla.do", method = { RequestMethod.POST, RequestMethod.GET })
+	public int anchorManagement_deleteAlla(HttpServletRequest request) {
+		int aaa = anchorService.anchorManagement_deleteAll();
+		String xieyi = "BSTOCS1,DELETEALLANC,END";
+		Udp_Out.udp_to_cs(xieyi);
+		return aaa;
+	}
 
 	@ResponseBody
 	@RequestMapping(value = "/anchorManagement_search.do", method = { RequestMethod.POST, RequestMethod.GET })
@@ -192,6 +313,28 @@
 		}
 		return json.toString();
 	}
+	
+	@ResponseBody
+	@RequestMapping(value = "/anchorManagement_searcha.do", method = { RequestMethod.POST, RequestMethod.GET })
+	public JSONObject anchorManagement_searcha(HttpServletRequest request) throws IOException {
+		JSONObject json = new JSONObject();
+		String input = request.getParameter("anchorid");
+		if (("").equals(input) || input == null) {
+			String jsonString = RequestUtils.getRequestJsonString(request, Config.getCharset());
+			tb_achor anchor = (tb_achor) JSONObject.toBean(JSONObject.fromObject(jsonString), tb_achor.class);
+			input = anchor.getAnchorid();
+			List<tb_achor> anchorManagementList = anchorService.searchAnchorManagement(input);
+			if (anchorManagementList.size()>0){
+				json.put("result", anchorManagementList.get(0));
+			} else {
+				json.put("result", "null");
+			}
+		} else {
+			List<tb_achor> anchorManagementList = anchorService.searchAnchorManagement(input);
+			json.put("dataList", anchorManagementList);
+		}
+		return json;
+	}
 
 	@ResponseBody
 	@RequestMapping(value = "/anchorManagement_page.do", method = { RequestMethod.POST, RequestMethod.GET })
@@ -333,7 +476,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();

--
Gitblit v1.10.0