From 37336922a1df99ac1636e398e12e64dedfba10e5 Mon Sep 17 00:00:00 2001
From: 15832144755 <67030627+15832144755@users.noreply.github.com>
Date: 星期四, 18 十一月 2021 16:15:16 +0800
Subject: [PATCH] 11.18完整39
---
src/main/java/com/hxzkoa/controller/ZhwController.java | 475 +++++++++++++++++++++++++++++++++++++++++++++++++++-------
1 files changed, 413 insertions(+), 62 deletions(-)
diff --git a/src/main/java/com/hxzkoa/controller/ZhwController.java b/src/main/java/com/hxzkoa/controller/ZhwController.java
index a5ede81..df1f8cc 100644
--- a/src/main/java/com/hxzkoa/controller/ZhwController.java
+++ b/src/main/java/com/hxzkoa/controller/ZhwController.java
@@ -1,6 +1,8 @@
package com.hxzkoa.controller;
+import java.io.File;
import java.io.IOException;
+import java.io.OutputStream;
import java.sql.Date;
import java.sql.Time;
import java.sql.Timestamp;
@@ -22,7 +24,9 @@
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.multipart.MultipartFile;
import com.hxzkoa.json.httpsos;
import com.hxzkoa.json.tb_achor;
@@ -32,6 +36,8 @@
import com.hxzkoa.json.tb_gps;
import com.hxzkoa.json.tb_map;
import com.hxzkoa.json.tb_person;
+import com.hxzkoa.json.tb_qihou;
+import com.hxzkoa.json.tb_realkaoqing;
import com.hxzkoa.json.tb_realocation;
import com.hxzkoa.json.tb_realpositoin;
import com.hxzkoa.json.tb_shipin;
@@ -48,10 +54,15 @@
import com.hxzkoa.udp.Udp_Out;
import com.hxzkoa.util.BytesToHex;
import com.hxzkoa.util.Config;
+import com.hxzkoa.util.ExcelUtils;
import com.hxzkoa.util.ModifyConfig;
+import com.hxzkoa.util.PageUtil;
import com.hxzkoa.util.RequestUtils;
import com.hxzkoa.util.ResourceUtils;
+import jxl.Sheet;
+import jxl.Workbook;
+import jxl.read.biff.BiffException;
import net.sf.json.JSONObject;
@@ -137,7 +148,12 @@
@ResponseBody
public int drawFence_add(HttpServletRequest request) {
tb_fence fence = new tb_fence();
- fence.setFloor(request.getParameter("layer"));
+ String layer = request.getParameter("layer");
+ if(!layer.equals("鐧惧害鍦板浘")) {
+ Integer layerjj = Integer.parseInt(layer);
+ layer = layerjj.toString();
+ }
+ fence.setFloor(layer);
fence.setType(request.getParameter("weilanleixing"));
fence.setBumen(request.getParameter("guanlianduixiang"));
fence.setName(request.getParameter("quyumingcheng"));
@@ -181,6 +197,59 @@
return 0;
}
+ @RequestMapping(value = "/sanweiFence.do", method = { RequestMethod.POST, RequestMethod.GET })
+ @ResponseBody
+ public int sanweiFence_add(HttpServletRequest request) {
+ tb_fence fence = new tb_fence();
+ String layer = request.getParameter("layer");
+ if(!layer.equals("鐧惧害鍦板浘")) {
+ Integer layerjj = Integer.parseInt(layer);
+ layer = layerjj.toString();
+ }
+ fence.setFloor(layer);
+ fence.setType(request.getParameter("weilanleixing"));
+ fence.setBumen(request.getParameter("guanlianduixiang"));
+ fence.setName(request.getParameter("quyumingcheng"));
+ fence.setBaoliu1(request.getParameter("fencegao"));
+ String zuobiao =(String) request.getParameter("zuobiao");
+ fence.setZuobiao(zuobiao);
+
+ fence.setShape(request.getParameter("xingzhuang"));
+
+ String start = "00:00:00";
+ String end = "23:59:59";
+ fence.setStart(start);
+ fence.setStop(end);
+
+ fence.setColor(request.getParameter("yanse"));
+ ZhwService.sanweiFence_add(fence);
+ String xieyi = "BSTOCS1,ADDFENCE,"+fence.getFloor()+","+fence.getType()+","+fence.getBumen()+","+fence.getName()+","+fence.getZuobiao()+","+fence.getShape()+","+fence.getStart()+","+fence.getStop()+","+GetNowTime.now()+","+fence.getColor()+",END";
+ Udp_Out.udp_to_cs(xieyi);
+
+ String type = request.getParameter("weilanleixing");
+ String name = request.getParameter("quyumingcheng");
+ String floor = request.getParameter("layer");
+ String shape = request.getParameter("xingzhuang");
+
+ if(type.equals("宸℃鍖哄煙")) {
+ ZhwService.xunjianSet_add(name);
+ } else if (type.equals("瀹氫綅鍖哄煙")) {
+ String[] zb_list = zuobiao.split(",");
+ String zb_inout = "";
+ for (int i=0;i<zb_list.length;i++) {
+ zb_inout += zb_list[i];
+ if (i%2==0) {
+ zb_inout += ",";
+ } else if (i%2==1 && i!=zb_list.length-1) {
+ zb_inout += ";";
+ }
+ }
+ ZhwService.fenceInout_add(name,zb_inout,shape,floor);
+ }
+
+ return 0;
+ }
+
@RequestMapping(value = "/queryLocation.do", method = { RequestMethod.POST, RequestMethod.GET })
public String queryLocation(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String toPage = "forward:/hxzk/location/queryLocation.jsp";
@@ -203,46 +272,20 @@
@RequestMapping(value="/getRealPosition.do", method = { RequestMethod.POST, RequestMethod.GET })
@ResponseBody
public List<tb_realpositoin> getRealPosition(HttpServletRequest request) {
- //浠巘b_person涓彇鏈�鏂版洿鏂扮殑[p_tagid,p_x,p_y,p_floor,p_addtime]
String floor = request.getParameter("floor");
-// long timeNow = System.currentTimeMillis();
-// long timeStart = timeNow - 10000; //鍙�10s鍐呮渶鏂扮殑涓�鏉℃暟鎹綔涓哄綋鍓嶇殑瀹炴椂浣嶇疆锛屽悗鏈熷彲鏇存敼锛屾澶勪负ms鍗曚綅
- long timeStart = 0;
//鏍规嵁鏃堕棿绛涢�夊嚭鏁版嵁
List<tb_person> realLocationList = ZhwService.getpersonLocation(floor);
- List<tb_person> personLocationList = new ArrayList<tb_person>();
- for ( tb_person node : realLocationList) {
- String timeRecent = node.getP_addtiem();
- Timestamp ts = Timestamp.valueOf(timeRecent);
- long times = ts.getTime();
- System.out.println("times"+times);
- if (times >= timeStart) {
- personLocationList.add(node);
- }
- }
List<tb_realpositoin> finalPositionList = new ArrayList<tb_realpositoin>();
//鏍规嵁姣忎釜tagid鍙杢b_tag:[tag_id,state(闈欐1or杩愬姩0),power,status(鍦ㄧ嚎1or绂荤嚎0),addtime]锛屾斁鍏b_position涓�
- for (tb_person node : personLocationList) {
- List<tb_tag> taglist = new ArrayList<tb_tag>();
- List<tb_person> personlist = new ArrayList<tb_person>();
-
+ for (tb_person node : realLocationList) {
String tagid = node.getP_tagid();
- taglist = ZhwService.getRealTagState(tagid);
- personlist = ZhwService.getRealpersonState(tagid);
-
tb_realpositoin position = new tb_realpositoin();
position.setTagid(tagid);
-
- if (personlist.isEmpty()) {
- position.setPower("");
- position.setLife("");
- } else {
- position.setPower(personlist.get(0).getP_power());
- position.setLife(personlist.get(0).getP_online());
- }
+ position.setPower(node.getP_power());
+ position.setLife(node.getP_online());
position.setName(node.getP_name());
position.setPosx(node.getP_x());
position.setPosy(node.getP_y());
@@ -260,43 +303,19 @@
@RequestMapping(value="/getRealPosition_all.do", method = { RequestMethod.POST, RequestMethod.GET })
@ResponseBody
public List<tb_realpositoin> getRealPosition_all(HttpServletRequest request) {
- //浠巘b_person涓彇鏈�鏂版洿鏂扮殑[p_tagid,p_x,p_y,p_floor,p_addtime]
-// long timeNow = System.currentTimeMillis();
- //long timeStart = timeNow - 10000; //鍙�10s鍐呮渶鏂扮殑涓�鏉℃暟鎹綔涓哄綋鍓嶇殑瀹炴椂浣嶇疆锛屽悗鏈熷彲鏇存敼锛屾澶勪负ms鍗曚綅
- long timeStart = 0;
//鏍规嵁鏃堕棿绛涢�夊嚭鏁版嵁
List<tb_person> realLocationList = ZhwService.getpersonLocation_all();
- List<tb_person> personLocationList = new ArrayList<tb_person>();
- for ( tb_person node : realLocationList) {
- String timeRecent = node.getP_addtiem();
- Timestamp ts = Timestamp.valueOf(timeRecent);
- long times = ts.getTime();
- System.out.println("times"+times);
- if (times >= timeStart) {
- personLocationList.add(node);
- }
- }
List<tb_realpositoin> finalPositionList = new ArrayList<tb_realpositoin>();
//鏍规嵁姣忎釜tagid鍙杢b_tag:[tag_id,state(闈欐1or杩愬姩0),power,status(鍦ㄧ嚎1or绂荤嚎0),addtime]锛屾斁鍏b_position涓�
- for (tb_person node : personLocationList) {
- List<tb_tag> taglist = new ArrayList<tb_tag>();
-
+ for (tb_person node : realLocationList) {
String tagid = node.getP_tagid();
- taglist = ZhwService.getRealTagState(tagid);
-
tb_realpositoin position = new tb_realpositoin();
position.setTagid(tagid);
-
- if (taglist.isEmpty()) {
- position.setPower("");
- position.setLife("");
- } else {
- position.setPower(taglist.get(0).getPower());
- position.setLife(taglist.get(0).getStatus());
- }
+ position.setPower(node.getP_power());
+ position.setLife(node.getP_online());
position.setFloor(node.getP_floor());
position.setName(node.getP_name());
position.setPosx(node.getP_x());
@@ -433,7 +452,20 @@
// Timestamp ts = Timestamp.valueOf(timeRecent);
// long times = ts.getTime();
// if (times >= timeStart) {
+// int jingdu = node.getGsp_jingdu().length();
+// //System.out.print("鎵ц浜�"+jingdu);
+ if (node.getGsp_jingdu() != null && !node.getGsp_jingdu().equals("00000.000000") && node.getGps_weidu() != null && !node.getGps_weidu().equals("00000.000000")) {
+// String weidu = node.getGps_weidu().substring(0,node.getGps_weidu().length()-1);
+// node.setGps_weidu(weidu);
+// String jingdu2 = node.getGsp_jingdu().substring(0, node.getGsp_jingdu().length()-1);
+// node.setGsp_jingdu(jingdu2);
finalGPSList.add(node);
+ }
+// String weidu = node.getGps_weidu().substring(0,node.getGps_weidu().length()-1);
+// node.setGps_weidu(weidu);
+// String jingdu = node.getGsp_jingdu().substring(0, node.getGsp_jingdu().length()-1);
+// node.setGsp_jingdu(jingdu);
+// finalGPSList.add(node);
// }
};
return finalGPSList;
@@ -462,7 +494,7 @@
String map_now = request.getParameter("map_now");
String filePath = Config.getMapConfig();
ModifyConfig.writeData(filePath,"map_now",map_now);
- System.out.print(ModifyConfig.readData(filePath, "map_now"));
+ //System.out.print(ModifyConfig.readData(filePath, "map_now"));
return "1";
}
@@ -473,8 +505,8 @@
// String map = ModifyConfig.readData(filePath, "map_now");
// List<String> maplist = new ArrayList<String>();
// maplist.add(map);
-// System.out.print("read data");
-// System.out.print(map);
+// //System.out.print("read data");
+// //System.out.print(map);
List<tb_system> systemlist = sysSettingService.getSetting();
List<String> maplist = new ArrayList<String>();
String map = systemlist.get(0).getYulan_map();
@@ -749,9 +781,9 @@
String tagid=request.getParameter("tagid");
ZhwService.shipin(tagid);
List<tb_person> fencename = ZhwService.getfencename(tagid);
-// System.out.print(fencename.get(0).getP_fencename());
+// //System.out.print(fencename.get(0).getP_fencename());
List<tb_shipin> id = ZhwService.getshebeiid(fencename.get(0).getP_fencename());
-// System.out.print(id.get(0).getShebeiid());
+// //System.out.print(id.get(0).getShebeiid());
List<tb_shipin> bb =null;
return id;
}
@@ -769,4 +801,323 @@
String xieyi = "BSTOCS1,give_up_sousuo,END";
Udp_Out.udp_to_cs(xieyi);
}
+
+ @RequestMapping(value = "/qihouManagement.do", method = { RequestMethod.POST, RequestMethod.GET })
+ public String qihouManagement(HttpServletRequest request) {
+ String toPage = "forward:/hxzk/qihou.jsp";
+ List<tb_qihou> qihouManagementList = ZhwService.qihoucha(1);
+ request.setAttribute("qihouManagementList", qihouManagementList);
+ int curPage = 1;
+ int count = ZhwService.getqihouManagementCount();
+ int minPage = PageUtil.getMinPage(count);
+ request.setAttribute("pageList", PageUtil.getPage(minPage));
+ request.setAttribute("curPage", curPage);
+ return toPage;
+ }
+
+ @RequestMapping(value = "/qihouManagement_add.do", method = { RequestMethod.POST, RequestMethod.GET })
+ public void qihouManagement_add(HttpServletRequest request) throws IOException {
+ tb_qihou qihou = new tb_qihou();
+ qihou.setPlace(request.getParameter("place"));
+ qihou.setWeather(request.getParameter("weather"));
+ qihou.setWd(request.getParameter("wd"));
+ qihou.setSd(request.getParameter("sd"));
+ ZhwService.qihouzeng(qihou);
+ }
+
+ @RequestMapping(value = "/qihouManagement_modify.do", method = { RequestMethod.POST, RequestMethod.GET })
+ public void qihouManagement_modify(HttpServletRequest request) {
+ tb_qihou qihou = new tb_qihou();
+ String id = request.getParameter("id");
+ qihou.setId(Integer.parseInt(id));
+ qihou.setPlace(request.getParameter("place"));
+ qihou.setWeather(request.getParameter("weather"));
+ qihou.setWd(request.getParameter("wd"));
+ qihou.setSd(request.getParameter("sd"));
+ ZhwService.qihougai(qihou);
+ }
+
+// @RequestMapping(value = "/labelManagement_modifyAll.do", method = { RequestMethod.POST, RequestMethod.GET })
+// public void labelManagement_modifyAll(HttpServletRequest request) {
+// tb_tag tag = new tb_tag();
+// tag.setGaodu(request.getParameter("gaodu"));
+// 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";
+// 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);
+// }
+// }
+// }
+
+ @ResponseBody
+ @RequestMapping(value = "/qihouManagement_delete.do", method = { RequestMethod.POST, RequestMethod.GET })
+ public void qihouManagement_delete(HttpServletRequest request) {
+ String checkValStr = request.getParameter("checkVal");
+ checkValStr = checkValStr.replaceAll("\"", "");
+ String[] checkVal = checkValStr.split(",");
+ ZhwService.qihoudelete(checkVal);
+ }
+
+ @ResponseBody
+ @RequestMapping(value = "/qihouManagement_deleteAll.do", method = { RequestMethod.POST, RequestMethod.GET })
+ public void qihouManagement_deleteAll(HttpServletRequest request) {
+ ZhwService.qihoudeleteAll();
+ }
+
+ @ResponseBody
+ @RequestMapping(value = "/qihouManagement_export.do", method = { RequestMethod.POST, RequestMethod.GET })
+ public String qihouManagement_export(HttpServletRequest request, HttpServletResponse response) {
+ String toPage = "forward:/hxzk/qihou.jsp";
+ List<tb_qihou> tb_qihouList = ZhwService.qihoucha();
+ String[] rowName = { "ID", "鏃堕棿", "鍦扮偣", "澶╂皵", "娓╁害", "婀垮害" };
+ List<Object[]> dataList = objectToArray_qihouManagement(tb_qihouList);
+ ExcelUtils excel = new ExcelUtils("姘斿�欐暟鎹�", rowName, dataList);
+ OutputStream out;
+ try {
+ String fileName = "Excel-" + String.valueOf(System.currentTimeMillis()).substring(4, 13) + ".xls";
+ String headStr = "attachment; filename=\"" + fileName + "\"";
+ response.setContentType("APPLICATION/OCTET-STREAM");
+ response.setHeader("Content-Disposition", headStr);
+ out = response.getOutputStream();
+ excel.export(out);
+ out.flush();
+ out.close();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ return toPage;
+ }
+
+ @ResponseBody
+ @RequestMapping(value = "/qihouManagement_exportTemplate.do", method = { RequestMethod.POST, RequestMethod.GET })
+ public String qihouManagement_exportTemplate(HttpServletRequest request, HttpServletResponse response) {
+ String toPage = "forward:/hxzk/qihou.jsp";
+ List<tb_qihou> qihouTemplateList = ZhwService.qihoucha(1);
+ String[] rowName = { "鏃堕棿", "鍦扮偣", "澶╂皵", "娓╁害", "婀垮害"};
+ List<Object[]> dataList = objectToArray_qihouManagement2(qihouTemplateList);
+ ExcelUtils excel = new ExcelUtils("姘斿�欐ā鏉�", rowName, dataList);
+ OutputStream out;
+ try {
+ String fileName = "Excel-" + String.valueOf(System.currentTimeMillis()).substring(4, 13) + ".xls";
+ String headStr = "attachment; filename=\"" + fileName + "\"";
+ response.setContentType("APPLICATION/OCTET-STREAM");
+ response.setHeader("Content-Disposition", headStr);
+ out = response.getOutputStream();
+ excel.export(out);
+ out.flush();
+ out.close();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ return toPage;
+ }
+
+ @ResponseBody
+ @RequestMapping(value = "/qihouManagement_page.do", method = { RequestMethod.POST, RequestMethod.GET })
+ public String qihouManagement_page(HttpServletRequest request) {
+ String pageStr = request.getParameter("page");
+ String curPageStr = request.getParameter("curPage");
+ int count = ZhwService.getqihouManagementCount();
+ int minPage = PageUtil.getMinPage(count);
+ int curPage = Integer.parseInt(curPageStr);
+ int page = 1;
+ if ("pre".equals(pageStr)) {
+ if (curPage > 1) {
+ page = curPage - 1;
+ }
+ } else if ("next".equals(pageStr)) {
+ if (curPage < minPage) {
+ page = curPage + 1;
+ }
+ } else {
+ page = Integer.parseInt(pageStr);
+ }
+ List<tb_qihou> qihouManagementList = ZhwService.qihoucha(page);
+ List<Integer> pageList = PageUtil.getPage(PageUtil.getLocPage(page, curPage), page, minPage);
+ JSONObject json = new JSONObject();
+ json.put("dataList", qihouManagementList);
+ json.put("pageList", pageList);
+ json.put("curPage", page);
+ return json.toString();
+ }
+
+ @RequestMapping(value = "/uploadqihou.do")
+ public String uploadqihou(@RequestParam("file") MultipartFile[] files, HttpServletRequest request) {
+ String toPage = "forward:/hxzk/qihou.jsp";
+ String filePath = request.getServletContext().getRealPath("/") + "hxzk\\upload\\";
+ String filename = files[0].getOriginalFilename();
+ try {
+ File existFile = new File(filePath);
+ if (!existFile.exists()) {
+ existFile.mkdir();
+ }
+ for (MultipartFile file : files) {
+ file.transferTo(new File(filePath + file.getOriginalFilename()));
+ //System.out.print(file.getOriginalFilename());
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ int result = 0;
+ String path = filePath + filename;
+ // 閫夊彇Excel鏂囦欢寰楀埌宸ヤ綔钖�
+ Workbook workbook;
+ try {
+ File file = new File(path);
+ workbook = Workbook.getWorkbook(file);
+ // 閫夋嫨宸ヤ綔琛紝閫氳繃Workbook鐨刧etSheet鏂规硶閫夋嫨绗竴涓伐浣滆〃锛堜粠0寮�濮嬶級
+ Sheet sheet = workbook.getSheet(0);
+ int rows = sheet.getRows();
+ // 閫夋嫨Cell锛岃鍙栧崟鍏冩牸 閫氳繃Sheet鐨刧etCell鏂规硶閫夋嫨浣嶇疆涓篊2鐨勫崟鍏冩牸锛堜袱涓弬鏁伴兘浠�0寮�濮嬶級
+ for (int i = 3; i < rows; i++) {
+ // 璇诲彇淇℃伅锛岄�氳繃Cell鐨刧etContents鏂规硶璇诲彇鍗曞厓鏍肩殑鍊兼妸鍗曞厓鏍间腑鐨勪俊鎭互瀛楃鐨勫舰寮忚鍙栧嚭鏉�
+ // String status = sheet.getCell(0, i).getContents();
+ String time = sheet.getCell(0, i).getContents();
+ String place = sheet.getCell(1, i).getContents();
+ String weather = sheet.getCell(2, i).getContents();
+ String wd = sheet.getCell(3, i).getContents();
+ String sd = sheet.getCell(4, i).getContents();
+ tb_qihou qihou = new tb_qihou();
+ // tag.setStatus(status);
+ qihou.setTime(time);
+ qihou.setPlace(place);
+ qihou.setWeather(weather);
+ qihou.setWd(wd);
+ qihou.setSd(sd);
+ result = ZhwService.qihouzeng(qihou);
+ }
+ // 閲婃斁璧勬簮
+ workbook.close();
+ } catch (BiffException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ request.setAttribute("resultList", result);
+ List<tb_qihou> qihouManagementList = ZhwService.qihoucha(1);
+ request.setAttribute("qihouManagementList", qihouManagementList);
+ int curPage = 1;
+ int count = ZhwService.getqihouManagementCount();
+ int minPage = PageUtil.getMinPage(count);
+ request.setAttribute("pageList", PageUtil.getPage(minPage));
+ request.setAttribute("curPage", curPage);
+ File file = new File(path);
+ file.delete();
+ return toPage;
+ }
+
+ @RequestMapping(value="/getRealPositionsan.do", method = { RequestMethod.POST, RequestMethod.GET })
+ @ResponseBody
+ public List<tb_realpositoin> getRealPositionsan(HttpServletRequest request) {
+ long timeStart = 0;
+
+ //鏍规嵁鏃堕棿绛涢�夊嚭鏁版嵁
+ List<tb_person> realLocationList = ZhwService.getpersonLocationsan();
+ for ( tb_person node : realLocationList) {
+ Double x = Double.valueOf(node.getP_x());
+ Double y = Double.valueOf(node.getP_y());
+ Double xo = (x-54732)/100;
+ Double yo = -(y+10268)/100;
+ List<Double> xy = ZhwController.cal2(xo, yo);
+ node.setP_x((xy.get(0)).toString());
+ node.setP_y((xy.get(1)).toString());
+ }
+
+ List<tb_realpositoin> finalPositionList = new ArrayList<tb_realpositoin>();
+
+ //鏍规嵁姣忎釜tagid鍙杢b_tag:[tag_id,state(闈欐1or杩愬姩0),power,status(鍦ㄧ嚎1or绂荤嚎0),addtime]锛屾斁鍏b_position涓�
+ for (tb_person node : realLocationList) {
+ String tagid = node.getP_tagid();
+ tb_realpositoin position = new tb_realpositoin();
+ position.setTagid(tagid);
+ position.setPower(node.getP_power());
+ position.setLife(node.getP_online());
+ position.setName(node.getP_name());
+ position.setPosx(node.getP_x());
+ position.setPosy(node.getP_y());
+ position.setSos(node.getP_sos());
+ position.setTime(node.getP_addtiem());
+ position.setFence(node.getP_fence());
+ position.setSousuo(node.getP_sousuo());
+ position.setShipin(node.getP_shipin());
+ position.setInkaoqing(node.getP_kaoqing());
+
+ finalPositionList.add(position);
+ }
+ return finalPositionList;
+ }
+
+ @RequestMapping(value="/getkaoqinsan.do", method = { RequestMethod.POST, RequestMethod.GET })
+ @ResponseBody
+ public List<tb_realkaoqing> getkaoqinsan(HttpServletRequest request) {
+ List<tb_realkaoqing> realkaoqingList = ZhwService.getkaoqinsan();
+ return realkaoqingList;
+ }
+
+ public static List<Object[]> objectToArray_qihouManagement2(List<tb_qihou> tb_qihouList) {
+ List<Object[]> reList = new ArrayList<>();
+ for (int i = 0; i < tb_qihouList.size(); i++) {
+ List<String> words = new ArrayList<String>();
+ tb_qihou qihou = (tb_qihou) tb_qihouList.get(i);
+ words.add(qihou.getTime());
+ words.add(qihou.getPlace());
+ words.add(qihou.getWeather());
+ words.add(qihou.getWd());
+ words.add(qihou.getSd());
+ String[] array = words.toArray(new String[0]);
+ reList.add(array);
+ }
+ return reList;
+ }
+
+ // tb_qihou 瀵煎嚭琛ㄦ牸 瀵硅薄杞暟缁�
+ public static List<Object[]> objectToArray_qihouManagement(List<tb_qihou> tb_qihouList) {
+ List<Object[]> reList = new ArrayList<>();
+ for (int i = 0; i < tb_qihouList.size(); i++) {
+ List<String> words = new ArrayList<String>();
+ tb_qihou qihou = (tb_qihou) tb_qihouList.get(i);
+ words.add(String.valueOf(qihou.getId()));
+ words.add(qihou.getTime());
+ words.add(qihou.getPlace());
+ words.add(qihou.getWeather());
+ words.add(qihou.getWd());
+ words.add(qihou.getSd());
+ String[] array = words.toArray(new String[0]);
+ reList.add(array);
+ }
+ return reList;
+ }
+
+ /**
+ * 浠0 + 877涓哄師鐐�
+ * @param px X鍧愭爣
+ * @param py y鍧愭爣
+ */
+ private static List<Double> cal2(double px, double py) {
+ double mx1 = 12738394.2203293;
+ double my1 = 4586352.97186441;
+ double rx = 1.0439323780911336;
+ double ry = 1.0443204318588795;
+
+ double mx = mx1 + px * rx;
+ double my = my1 + py * ry;
+
+ List<Double> xy = new ArrayList<Double>();
+ xy.add(mx);
+ xy.add(my);
+ return xy;
+ }
}
--
Gitblit v1.10.0