fxl
2023-05-04 e150655a785de36a65a26a0dc4d3d6d65fe7e9d0
src/main/java/com/hxzkoa/controller/ZhwController.java
@@ -1,54 +1,38 @@
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//
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;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
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;
import com.hxzkoa.json.tb_department;
import com.hxzkoa.json.tb_fence;
import com.hxzkoa.json.tb_fence_inout;
import com.hxzkoa.json.tb_gas;
import com.hxzkoa.json.tb_gps;
import com.hxzkoa.json.tb_jingwei;
import com.hxzkoa.json.tb_jobhistory;
import com.hxzkoa.json.tb_map;
import com.hxzkoa.json.tb_message;
import com.hxzkoa.json.tb_nav;
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;
import com.hxzkoa.json.tb_system;
import com.hxzkoa.json.tb_tag;
import com.hxzkoa.json.tb_track;
import com.hxzkoa.services.AnchorService;
import com.hxzkoa.services.AttendanceService;
import com.hxzkoa.services.BasicInfoService;
import com.hxzkoa.services.FenceService;
import com.hxzkoa.services.GpsService;
import com.hxzkoa.services.LabelService;
import com.hxzkoa.services.MapService;
import com.hxzkoa.services.SysSettingService;
import com.hxzkoa.services.ZhwService;
import com.hxzkoa.services.AnchorService;
import com.hxzkoa.services.FenceService;
import com.hxzkoa.udp.Dell_Ip;
import com.hxzkoa.udp.GetNowTime;
import com.hxzkoa.udp.ReadPeizhiMessage;
import com.hxzkoa.udp.Read_Write_Anchor_Message;
@@ -60,239 +44,736 @@
import com.hxzkoa.util.PageUtil;
import com.hxzkoa.util.RequestUtils;
import com.hxzkoa.util.ResourceUtils;
import com.hxzkoa.util.RtspToMP4;
import java.awt.geom.Point2D;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.URL;
import java.net.URLEncoder;
import java.sql.Timestamp;
import java.text.DecimalFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import jxl.Sheet;
import jxl.Workbook;
import jxl.read.biff.BiffException;
import net.sf.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
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;
@Controller
public class ZhwController {
   private Logger logger = LoggerFactory.getLogger(this.getClass());
   public static String MSG_LOGIN_FAIL = ResourceUtils
         .getString("msg.login.fail");
   public static String MSG_LOGIN_FAIL = ResourceUtils.getString("msg.login.fail");
   @Autowired
   private ZhwService ZhwService;
   @Autowired
   private SysSettingService sysSettingService;
   private SysSettingService sysSettingService;
   @Autowired
   private AnchorService AnchorService;
   private AnchorService AnchorService;
   @Autowired
   private FenceService fenceService;
   @Autowired
   private AttendanceService attendanceService;
   @Autowired
   private BasicInfoService basicInfoService;
   @Autowired
   private LabelService labelService;
   @Autowired
   private MapService mapService;
   @Autowired
   private GpsService gpsService;
   httpsos sos = new httpsos();
   @RequestMapping(value = "/drawFence_init.do", method = { RequestMethod.POST, RequestMethod.GET })
   public String drawFence_init(HttpServletRequest request,  HttpServletResponse response) throws ServletException, IOException {
      String toPage = "forward:/hxzk/fence/drawFence.jsp";
      List<tb_map> floorList = ZhwService.getFloor();
      List<tb_fence> fenceList = fenceService.getFenceList();
      List<String> fencenames = new ArrayList<>();
      for (int i =0;i < fenceList.size(); i++) {
         fencenames.add(fenceList.get(i).getName());
   Process process;
   private Map<Integer, Process> map = new HashMap();
   private Map<String, String[]> persons = new HashMap();
   static double a = 6378.137;
   static double e = 0.0818192;
   static double k0 = 0.9996;
   static double e2;
   static double e4;
   static double e6;
   static double E0;
   static double N0;
   static String floor;
   static double lat_a;
   static double lon_a;
   static double lon_b;
   static double lat_b;
   static double xa;
   static double ya;
   static double xb;
   static double yb;
   static int k;
   static int sizes;
   static double[] xycs;
   static double utme0;
   static double utmn0;
   static double c;
   static double s;
   static double t;
   static double f;
   public ZhwController() {
   }
   @ResponseBody
   @RequestMapping({"/Shipinstart"})
   public void Start(Integer id, String FileName) {
      String ffmpegPath = "F:\\ffmpeg\\ffmpeg-4.4-essentials_build\\bin\\ffmpeg.exe";
      String streamUrl = "rtsp://admin:hxzk20151102@192.168.1.64:554/Streaming/Channels/101";
      String FilePath = "E:\\data\\MP4\\" + FileName;
      RtspToMP4 tomp4 = new RtspToMP4();
      Process process = tomp4.StartRecord(ffmpegPath, streamUrl, FilePath);
      if (null != process) {
         this.map.put(id, process);
      }
   }
   @RequestMapping({"/Shipinstop"})
   public void stop(Integer id) {
      if (this.map.containsKey(id)) {
         Process process = (Process)this.map.get(id);
         if (null != process) {
            RtspToMP4 tomp4 = new RtspToMP4();
            tomp4.stopRecord(process);
         }
      }
   }
   @RequestMapping(value = {"/drawFence_init.do"}, method = {RequestMethod.POST, RequestMethod.GET}
   )
   public String drawFence_init(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
      String toPage = "forward:/hxzk/fence/drawFence.jsp";
      List<tb_map> floorList = this.ZhwService.getFloor();
      List<tb_fence> fenceList = this.fenceService.getFenceList();
      List<String> fencenames = new ArrayList();
      for (int i=0;i<floorList.size();i++){
         if(floorList.get(i).getMapname().contains(".")){
            String[] name=floorList.get(i).getMapname().split("\\.");
            floorList.get(i).setMapname(name[0]);
            fencenames.add((floorList.get(i)).getMapname());
         }
      }
      List<String> realAttendance_k = new ArrayList();
      List<tb_department> departments = this.basicInfoService.getDepartmentManagement2();
      for(int i = 0; i < departments.size(); ++i) {
         realAttendance_k.add(((tb_department)departments.get(i)).getDepartmentName());
      }
      request.setAttribute("guanlianList", realAttendance_k);
      request.setAttribute("fenceList", fencenames);
      request.setAttribute("floorList", floorList);
      return toPage;
   }
   @RequestMapping(value = "/drawFence.do", method = { RequestMethod.POST, RequestMethod.GET })
   public String drawFence(HttpServletRequest request,  HttpServletResponse response) throws ServletException, IOException {
   @RequestMapping(
         value = {"/xiangdaototwo.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   public String xiangdaototwo(HttpServletRequest request) {
      String toPage = "forward:/hxzk/fence/drawFencexiangdao.jsp";
      List<tb_map> floorList = this.ZhwService.getFloor();
      List<tb_fence> fenceList = this.fenceService.getFenceList();
      List<String> fencenames = new ArrayList();
      for(int i = 0; i < fenceList.size(); ++i) {
         fencenames.add(((tb_fence)fenceList.get(i)).getName());
      }
      List<String> realAttendance_k = new ArrayList();
      List<tb_department> departments = this.basicInfoService.getDepartmentManagement2();
      for(int i = 0; i < departments.size(); ++i) {
         realAttendance_k.add(((tb_department)departments.get(i)).getDepartmentName());
      }
      List<tb_tag> labelManagementListaa = this.labelService.getLabelManagementa();
      request.setAttribute("labelManagementListaa", labelManagementListaa);
      request.setAttribute("guanlianList", realAttendance_k);
      request.setAttribute("fenceList", fencenames);
      request.setAttribute("floorList", floorList);
      return toPage;
   }
   @RequestMapping(
         value = {"/drawFence.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   public String drawFence(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
      String floor_number = request.getParameter("value");
      String toPage = "forward:/hxzk/fence/drawFence.jsp";
      List<tb_map> mapList = ZhwService.getMap(floor_number);
      List<tb_map> mapList = this.ZhwService.getMap(floor_number);
      request.setAttribute("value", mapList);
      request.getRequestDispatcher(toPage).forward(request, response);
      return toPage;
   }
   @RequestMapping(value="/floornumTomap.do", method = { RequestMethod.POST, RequestMethod.GET })
   @RequestMapping(
         value = {"/floornumTomap.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   @ResponseBody
   public List<tb_map> floorNumtoMap(HttpServletRequest request) {
       String floor_number = request.getParameter("value");
      final List<tb_map> mapList = ZhwService.getMap(floor_number);
   public List<tb_map> floorNumtoMap(HttpServletRequest request) {
      String floor_number = request.getParameter("value");
      List<tb_map> mapList = this.ZhwService.getMap(floor_number);
      return mapList;
   }
   @RequestMapping(value="/floornumTomap_all.do", method = { RequestMethod.POST, RequestMethod.GET })
   @RequestMapping(
         value = {"/floornumTomap_all.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   @ResponseBody
   public List<tb_map> floornumTomap_all(HttpServletRequest request) {
      final List<tb_map> mapList = ZhwService.getMap_all();
   public List<tb_map> floornumTomap_all(HttpServletRequest request) {
      List<tb_map> mapList = this.ZhwService.getMap_all();
      return mapList;
   }
   @RequestMapping(value="/getFloorByMapname.do", method = { RequestMethod.POST, RequestMethod.GET })
   @RequestMapping(
         value = {"/floornumTomap_all2.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   @ResponseBody
   public List<tb_map> getFloorByMapname(HttpServletRequest request) {
       String mapname = request.getParameter("map");
      final List<tb_map> mapList = ZhwService.getFloorByMapname(mapname);
   public List<tb_map> floornumTomap_all2(HttpServletRequest request) {
      String floor = request.getParameter("floor");
      List<tb_map> mapList = this.ZhwService.getMap_all2(floor);
      return mapList;
   }
   @RequestMapping(value="/getFloorFence.do", method = { RequestMethod.POST, RequestMethod.GET })
   @RequestMapping(
         value = {"/getFloorByMapname.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   @ResponseBody
   public List<tb_fence> getFloorFence(HttpServletRequest request) {
       String floor_number = request.getParameter("value");
      final List<tb_fence> fenceList = ZhwService.getFence(floor_number);
   public List<tb_map> getFloorByMapname(HttpServletRequest request) {
      String mapname = request.getParameter("map");
      List<tb_map> mapList = this.ZhwService.getFloorByMapname(mapname);
      return mapList;
   }
   @RequestMapping(
         value = {"/getFloorFence.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   @ResponseBody
   public List<tb_fence> getFloorFence(HttpServletRequest request) {
      String floor_number = request.getParameter("value");
      List<tb_fence> fenceList = this.ZhwService.getFence(floor_number);
      List<tb_fence> fenceList2 = new ArrayList();
      for(int i = 0; i < fenceList.size(); ++i) {
         if (!((tb_fence)fenceList.get(i)).getType().equals("变电站")) {
            fenceList2.add(fenceList.get(i));
         }
      }
      return fenceList2;
   }
   @RequestMapping(
         value = {"/getFloorFence_all.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   @ResponseBody
   public List<tb_fence> getFloorFence_all(HttpServletRequest request) {
      List<tb_fence> fenceList = this.ZhwService.getFence_all();
      return fenceList;
   }
   @RequestMapping(value="/getFloorFence_all.do", method = { RequestMethod.POST, RequestMethod.GET })
   @RequestMapping(
         value = {"/getGas_list.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   @ResponseBody
   public List<tb_fence> getFloorFence_all(HttpServletRequest request) {
      final List<tb_fence> fenceList = ZhwService.getFence_all();
   public List<tb_gas> getGas_list(HttpServletRequest request) {
      List<tb_gas> fenceList = this.ZhwService.getGas();
      return fenceList;
   }
   @RequestMapping(value="/getGas_list.do", method = { RequestMethod.POST, RequestMethod.GET })
   @ResponseBody
   public List<tb_gas> getGas_list(HttpServletRequest request) {
      final List<tb_gas> fenceList = ZhwService.getGas();
      return fenceList;
   }
   @RequestMapping(value = "/saveFence.do", method = { RequestMethod.POST, RequestMethod.GET })
   @RequestMapping(
         value = {"/saveFence.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   @ResponseBody
   public int drawFence_add(HttpServletRequest request) {
      tb_fence fence = new tb_fence();
      String layer = request.getParameter("layer");
      if(!layer.equals("百度地图")) {
         Integer layerjj = Integer.parseInt(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"));
      String zuobiao =(String) request.getParameter("zuobiao");
      int aaa = 1;
      List<tb_fence> fencesss = this.ZhwService.getFenceaaa(fence.getName());
      if (fencesss.size() == 0) {
         aaa = 0;
         String xingzhuang = request.getParameter("xingzhuang");
         fence.setShape(xingzhuang);
         String zuobiao = request.getParameter("zuobiao");
         String baowen = "";
         String str;
         if (!xingzhuang.equals("多边形")) {
            baowen = zuobiao.replace(",", ":");
         } else {
            String[] zuobiaos = zuobiao.split(",");
            str = "";
            for(int i = 0; i < zuobiaos.length; ++i) {
               if (i == zuobiaos.length - 1) {
                  str = str + zuobiaos[i];
                  break;
               }
               if (i % 2 == 0) {
                  str = str + zuobiaos[i] + ":";
               } else {
                  str = str + zuobiaos[i] + ";";
               }
            }
            baowen = str;
         }
         fence.setZuobiao(zuobiao);
         String start = "00:00:00";
         str = "23:59:59";
         fence.setStart(start);
         fence.setStop(str);
         fence.setColor(request.getParameter("yanse"));
         String xieyi = "BSTOCS1,ADDFENCE," + fence.getFloor() + "," + fence.getType() + "," + fence.getBumen() + "," + fence.getName() + "," + baowen + "," + 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("巡检区域")) {
            this.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_inout + zb_list[i];
               if (i % 2 == 0) {
                  zb_inout = zb_inout + ",";
               } else if (i % 2 == 1 && i != zb_list.length - 1) {
                  zb_inout = zb_inout + ";";
               }
            }
            this.ZhwService.fenceInout_add(name, zb_inout, shape, floor);
         }
      }
      return aaa;
   }
   @ResponseBody
   @RequestMapping(
         value = {"/begindrawa.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   public String begindraw(HttpServletRequest request) {
      String tagid = request.getParameter("tagid");
      String xieyi = "BSTOCS1,drawfence,outwarning," + tagid + ",start,end";
      Udp_Out.udp_to_cs(xieyi);
      return "1";
   }
   @ResponseBody
   @RequestMapping(
         value = {"/enddrawa.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   public String enddrawa(HttpServletRequest request) {
      String tagid = request.getParameter("tagid");
      String xieyi = "BSTOCS1,drawfence,outwarning," + tagid + ",stop,end";
      Udp_Out.udp_to_cs(xieyi);
      return "1";
   }
   @RequestMapping(
         value = {"/xiangdaoone.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   public String xiangdaoone(HttpServletRequest request) {
      String toPage = "forward:/hxzk/label/labelManagementxiangdaoone.jsp";
      List<tb_tag> labelManagementList = this.labelService.getLabelManagement(1);
      List<tb_tag> labelManagementListaa = this.labelService.getLabelManagementa();
      request.setAttribute("labelManagementList", labelManagementList);
      request.setAttribute("labelManagementListaa", labelManagementListaa);
      int curPage = 1;
      int count = this.labelService.getLabelManagementCount();
      int minPage = PageUtil.getMinPage(count);
      request.setAttribute("pageList", PageUtil.getPage(minPage));
      request.setAttribute("curPage", Integer.valueOf(curPage));
      return toPage;
   }
   @RequestMapping(
         value = {"/saveFence2.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   public String drawFence_add2(HttpServletRequest request) {
      String toPage = "forward:/hxzk/label/labelManagementxiangdaothree.jsp";
      tb_fence fence = new tb_fence();
      fence.setFloor(request.getParameter("layer"));
      fence.setType(request.getParameter("weilanleixing"));
      fence.setBaoliu2(request.getParameter("tagid"));
      fence.setName(request.getParameter("quyumingcheng"));
      String zuobiao = this.ZhwService.getfencezuobiao();
      fence.setZuobiao(zuobiao);
      fence.setShape(request.getParameter("xingzhuang"));
      fence.setShape("多边形");
      String start = "00:00:00";
      String end = "23:59:59";
      fence.setStart(start);
      fence.setStop(end);
      fence.setColor(request.getParameter("yanse"));
      ZhwService.drawFence_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";
      List<String> realAttendance_k = new ArrayList();
      List<tb_department> departments = this.basicInfoService.getDepartmentManagement2();
      for(int i = 0; i < departments.size(); ++i) {
         realAttendance_k.add(((tb_department)departments.get(i)).getDepartmentName());
      }
      request.setAttribute("guanlianList", realAttendance_k);
      request.setAttribute("fence", fence);
      return toPage;
   }
   @RequestMapping(
         value = {"/saveFence3.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   @ResponseBody
   public void drawFence_add3(HttpServletRequest request) {
      tb_fence fence = new tb_fence();
      fence.setFloor(request.getParameter("floor"));
      fence.setType(request.getParameter("type"));
      fence.setBaoliu2(request.getParameter("baoliu2"));
      fence.setName(request.getParameter("name"));
      String zuobiao = this.ZhwService.getfencezuobiao();
      fence.setZuobiao(zuobiao);
      String haibagao = this.ZhwService.getfencehaibagao();
      fence.setBaoliu6(haibagao);
      fence.setShape(request.getParameter("shape"));
      fence.setStart(request.getParameter("start"));
      fence.setStop(request.getParameter("stop"));
      fence.setColor(request.getParameter("color"));
      fence.setBaoliu3(request.getParameter("baoliu3"));
      fence.setBaoliu1(request.getParameter("baoliu1"));
      fence.setBumen(request.getParameter("bumen"));
      fence.setBaoliu4(request.getParameter("baoliu4"));
      this.ZhwService.drawFence_add2(fence);
      String xieyi = "BSTOCS1,ADDFENCE," + fence.getFloor() + "," + fence.getType() + "," + fence.getBumen() + "," + fence.getName() + "," + fence.getZuobiao().replace(",", ":") + "," + fence.getShape() + "," + fence.getStart() + "," + fence.getStop() + "," + GetNowTime.now() + "," + fence.getColor() + "," + fence.getBaoliu1() + "," + fence.getBaoliu6() + "," + fence.getBaoliu2() + "," + fence.getBaoliu3() + "," + fence.getBaoliu4() + ",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);
      String type = request.getParameter("type");
      String name = request.getParameter("name");
      String floor = request.getParameter("floor");
      String shape = request.getParameter("shape");
      if (type.equals("巡检区域")) {
         this.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 += ";";
         for(int i = 0; i < zb_list.length; ++i) {
            zb_inout = zb_inout + zb_list[i];
            if (i % 2 == 0) {
               zb_inout = zb_inout + ",";
            } else if (i % 2 == 1 && i != zb_list.length - 1) {
               zb_inout = zb_inout + ";";
            }
         }
         ZhwService.fenceInout_add(name,zb_inout,shape,floor);
         this.ZhwService.fenceInout_add(name, zb_inout, shape, floor);
      }
      return 0;
   }
   @RequestMapping(value = "/sanweiFence.do", method = { RequestMethod.POST, RequestMethod.GET })
   @RequestMapping(
         value = {"/addfence0.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   @ResponseBody
   public String addfence0(HttpServletRequest request) {
      tb_fence fence = new tb_fence();
      fence.setFloor(request.getParameter("floor"));
      fence.setType("变电站");
      fence.setName(request.getParameter("name") + 1);
      fence.setBaoliu7(request.getParameter("baoliu7"));
      String zuobiao = this.ZhwService.getfencezuobiao();
      fence.setZuobiao(zuobiao);
      String haibagao = this.ZhwService.getfencehaibagao();
      fence.setBaoliu6(haibagao);
      fence.setShape("多边形");
      fence.setStart("00:00:00");
      fence.setStop("23:59:59");
      fence.setColor(request.getParameter("color"));
      fence.setBaoliu3(request.getParameter("baoliu3"));
      fence.setBaoliu1(request.getParameter("baoliu1"));
      fence.setBumen(request.getParameter("bumen"));
      fence.setBaoliu4(request.getParameter("baoliu4"));
      int aaa = this.ZhwService.drawFence_add2(fence);
      String xieyi = "BSTOCS1,ADDFENCE," + fence.getFloor() + "," + fence.getType() + "," + fence.getBumen() + "," + request.getParameter("name") + "," + fence.getZuobiao().replace(",", ":") + "," + fence.getShape() + "," + fence.getStart() + "," + fence.getStop() + "," + GetNowTime.now() + "," + fence.getColor() + "," + fence.getBaoliu1() + "," + fence.getBaoliu7() + ",," + fence.getBaoliu3() + "," + fence.getBaoliu4() + ",END";
      Udp_Out.udp_to_cs(xieyi);
      String type = request.getParameter("type");
      String name = request.getParameter("name");
      String floor = request.getParameter("floor");
      String shape = request.getParameter("shape");
      return "" + aaa;
   }
   @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("百度地图") && !layer.equals("手动输入") && !layer.equals("自动输入")) {
         Integer layerjj = Integer.parseInt(layer);
      if (!layer.equals("百度地图") && !layer.equals("手动输入") && !layer.equals("自动输入")) {
         Integer layerjj = Integer.parseInt(layer);
         layer = layerjj.toString();
      }else {
      } else {
         layer = "百度地图";
      }
      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");
      String zuobiaodufen = (String) request.getParameter("zuobiaodufen");
      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()+","+zuobiao+","+fence.getShape()+","+fence.getStart()+","+fence.getStop()+","+GetNowTime.now()+","+fence.getColor()+","+fence.getBaoliu1()+",END";
      Udp_Out.udp_to_cs(xieyi);
      sysSettingService.guiling();
      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 += ";";
      int aaa = 1;
      List<tb_fence> fencesss = this.ZhwService.getFenceaaa(fence.getName());
      if (fencesss.size() == 0) {
         aaa = 0;
         fence.setBaoliu1(request.getParameter("fencegao"));
         String zuobiao = request.getParameter("zuobiao");
         String zuobiaodufen = request.getParameter("zuobiaodufen");
         zuobiao = zuobiao.replace(",", ":");
         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"));
         String xieyi = "BSTOCS1,ADDFENCE," + fence.getFloor() + "," + fence.getType() + "," + fence.getBumen() + "," + fence.getName() + "," + zuobiao + "," + fence.getShape() + "," + fence.getStart() + "," + fence.getStop() + "," + GetNowTime.now() + "," + fence.getColor() + "," + fence.getBaoliu1() + ",END";
         Udp_Out.udp_to_cs(xieyi);
         this.sysSettingService.guiling();
         String type = request.getParameter("weilanleixing");
         String name = request.getParameter("quyumingcheng");
         String floor = request.getParameter("layer");
         String shape = request.getParameter("xingzhuang");
         if (type.equals("巡检区域")) {
            this.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_inout + zb_list[i];
               if (i % 2 == 0) {
                  zb_inout = zb_inout + ",";
               } else if (i % 2 == 1 && i != zb_list.length - 1) {
                  zb_inout = zb_inout + ";";
               }
            }
            this.ZhwService.fenceInout_add(name, zb_inout, shape, floor);
         }
         ZhwService.fenceInout_add(name,zb_inout,shape,floor);
      }
      return 0;
      return aaa;
   }
   @RequestMapping(value = "/queryLocation.do", method = { RequestMethod.POST, RequestMethod.GET })
   public String queryLocation(HttpServletRequest request,  HttpServletResponse response) throws ServletException, IOException {
   @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";
      List<tb_map> floorList = ZhwService.getFloor();
      List<tb_map> floorList = this.ZhwService.getFloor();
      for (int i=0;i<floorList.size();i++){
         String mapname = floorList.get(i).getMapname();
         if (mapname.contains(".")){
            String[] mapnames =mapname.split("\\.");
            floorList.get(i).setMapname(mapnames[0]);
         }
      }
      List<tb_fence> fenceList = this.fenceService.getFenceList2();
      request.setAttribute("fenceList", fenceList);
      request.setAttribute("floorList", floorList);
      return toPage;
   }
   @RequestMapping(value="/trackTagid.do", method = { RequestMethod.POST, RequestMethod.GET })
   @RequestMapping(
         value = {"/trackTagid2.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   @ResponseBody
   public List<tb_track> queryTagid(HttpServletRequest request) throws ParseException {
       String tag_id = request.getParameter("tag_value");
       String begin_time = request.getParameter("begin_value");
       String end_time = request.getParameter("end_value");
       String floor = request.getParameter("floor_value");
      final List<tb_track> tagList = ZhwService.getTagtrack(tag_id, begin_time, end_time, floor);
   public List<tb_track> queryTagid2(HttpServletRequest request) throws ParseException {
      String tag_id = request.getParameter("tag_value");
      String begin_time = request.getParameter("begin_value");
      String end_time = request.getParameter("end_value");
      String floor = request.getParameter("floor_value");
      List<tb_track> tagList = this.ZhwService.getTagtrack(tag_id, begin_time, end_time, floor);
      return tagList;
   }
   @RequestMapping(value="/getRealPosition.do", method = { RequestMethod.POST, RequestMethod.GET })
   @RequestMapping(
         value = {"/trackTagid.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   @ResponseBody
   public List<tb_realpositoin> getRealPosition(HttpServletRequest request) {
   public List<tb_track> queryTagid(HttpServletRequest request) throws ParseException {
      String panduan = request.getParameter("panduan");
      String tag_id = request.getParameter("tag_value");
      String begin_time = request.getParameter("begin_value");
      String end_time = request.getParameter("end_value");
      String floor = request.getParameter("floor_value");
      String fence = request.getParameter("fence");
      List tagList;
      if (fence.equals("空")) {
         new ArrayList();
         if (panduan.equals("true")) {
            tagList = this.ZhwService.getTagtrack(tag_id, begin_time, end_time, floor);
         } else {
            tagList = this.ZhwService.getTagtrack2(tag_id, begin_time, end_time, floor);
         }
         return tagList;
      } else {
         new ArrayList();
         if (panduan.equals("true")) {
            tagList = this.ZhwService.getTagtrack(tag_id, begin_time, end_time, floor);
         } else {
            tagList = this.ZhwService.getTagtrack2(tag_id, begin_time, end_time, floor);
         }
         List<tb_track> tagList2 = new ArrayList();
         for(int i = 0; i < tagList.size(); ++i) {
            Point2D.Double dian = new Point2D.Double(Double.parseDouble(((tb_track)tagList.get(i)).getX()), Double.parseDouble(((tb_track)tagList.get(i)).getY()));
            String[] fences = fence.split(";");
            List<Point2D.Double> fencedian = new ArrayList();
            for(int j = 0; j < fences.length; ++j) {
               String[] aaa = fences[j].split(",");
               Point2D.Double diana = new Point2D.Double(Double.parseDouble(aaa[0]), Double.parseDouble(aaa[1]));
               fencedian.add(diana);
            }
            if (isInPolygon(dian, fencedian)) {
               tagList2.add((tb_track) tagList.get(i));
            }
         }
         return tagList2;
      }
   }
   @RequestMapping(value = {"/trackTagid3.do"}, method = {RequestMethod.POST, RequestMethod.GET})
   @ResponseBody
   public List<tb_track> queryTagid3(HttpServletRequest request) throws ParseException {
      String tag_id = request.getParameter("tagid");
      String begin_time = request.getParameter("begin");
      String end_time = request.getParameter("end");
      List<tb_track> tagList = this.ZhwService.getTagtrack3(tag_id, begin_time, end_time);
      return tagList;
   }
   @RequestMapping(
         value = {"/trackTagida.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   @ResponseBody
   public JSONObject queryTagida(HttpServletRequest request) throws ParseException {
      String tag_id = request.getParameter("tag_value");
      String begin_time = request.getParameter("begin_value");
      String end_time = request.getParameter("end_value");
      String floor = request.getParameter("floor_value");
      String fence = request.getParameter("fence");
      JSONObject json = new JSONObject();
      List tagList;
      if (fence.equals("空")) {
         tagList = this.ZhwService.getTagtrack(tag_id, begin_time, end_time, floor);
         json.put("dataList", tagList);
         return json;
      } else {
         tagList = this.ZhwService.getTagtrack(tag_id, begin_time, end_time, floor);
         List<tb_track> tagList2 = new ArrayList();
         for(int i = 0; i < tagList.size(); ++i) {
            Point2D.Double dian = new Point2D.Double(Double.parseDouble(((tb_track)tagList.get(i)).getX()), Double.parseDouble(((tb_track)tagList.get(i)).getY()));
            String[] fences = fence.split(";");
            List<Point2D.Double> fencedian = new ArrayList();
            for(int j = 0; j < fences.length; ++j) {
               String[] aaa = fences[j].split(",");
               Point2D.Double diana = new Point2D.Double(Double.parseDouble(aaa[0]), Double.parseDouble(aaa[1]));
               fencedian.add(diana);
            }
            if (isInPolygon(dian, fencedian)) {
               tagList2.add((tb_track) tagList.get(i));
            }
         }
         json.put("dataList", tagList2);
         return json;
      }
   }
   @RequestMapping(
         value = {"/getRealPosition.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   @ResponseBody
   public List<tb_realpositoin> getRealPosition(HttpServletRequest request) {
      String floor = request.getParameter("floor");
      //根据时间筛选出数据
      List<tb_person> realLocationList = ZhwService.getpersonLocation(floor);
      List<tb_realpositoin> finalPositionList = new ArrayList<tb_realpositoin>();
      //根据每个tagid取tb_tag:[tag_id,state(静止1or运动0),power,status(在线1or离线0),addtime],放入tb_position中
      for (tb_person node : realLocationList) {
      List<tb_person> realLocationList = this.ZhwService.getpersonLocation(floor);
      List<tb_realpositoin> finalPositionList = new ArrayList();
      Iterator var5 = realLocationList.iterator();
      while(var5.hasNext()) {
         tb_person node = (tb_person)var5.next();
         String tagid = node.getP_tagid();
         tb_realpositoin position = new tb_realpositoin();
         position.setTagid(tagid);
@@ -306,23 +787,68 @@
         position.setFence(node.getP_fence());
         position.setSousuo(node.getP_sousuo());
         position.setShipin(node.getP_shipin());
         position.setBumen(node.getP_department());
         position.setBaoliu22(node.getBaoliu22());
         finalPositionList.add(position);
      }
      return finalPositionList;
   }
   @RequestMapping(value="/getRealPosition_all.do", method = { RequestMethod.POST, RequestMethod.GET })
   @RequestMapping(
         value = {"/getRealPositiona.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   @ResponseBody
   public List<tb_realpositoin> getRealPosition_all(HttpServletRequest request) {
      //根据时间筛选出数据
      List<tb_person> realLocationList = ZhwService.getpersonLocation_all();
      List<tb_realpositoin> finalPositionList = new ArrayList<tb_realpositoin>();
      //根据每个tagid取tb_tag:[tag_id,state(静止1or运动0),power,status(在线1or离线0),addtime],放入tb_position中
      for (tb_person node : realLocationList) {
   public JSONObject getRealPositiona(HttpServletRequest request) {
      String floor = request.getParameter("floor");
      JSONObject json = new JSONObject();
      List<tb_person> realLocationList = this.ZhwService.getpersonLocation(floor);
      List<tb_realpositoin> finalPositionList = new ArrayList();
      Iterator var6 = realLocationList.iterator();
      while(var6.hasNext()) {
         tb_person node = (tb_person)var6.next();
         if (node.getP_online().equals("1")) {
            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("" + (double)Math.round(Double.parseDouble(node.getP_x())) / 100.0);
            position.setPosy("" + (double)Math.round(Double.parseDouble(node.getP_y())) / 100.0);
            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.setBumen(node.getP_department());
            position.setPhone(node.getP_phone());
            position.setIdcardnum(node.getP_idcardnum());
            position.setJingdu(node.getP_jingdu());
            position.setWeidu(node.getP_weidu());
            position.setGaocheng(node.getBaoliu10());
            finalPositionList.add(position);
         }
      }
      json.put("dataList", finalPositionList);
      return json;
   }
   @RequestMapping(
         value = {"/getRealPosition_all.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   @ResponseBody
   public List<tb_realpositoin> getRealPosition_all(HttpServletRequest request) {
      List<tb_person> realLocationList = this.ZhwService.getpersonLocation_all2();
      List<tb_realpositoin> finalPositionList = new ArrayList();
      Iterator var4 = realLocationList.iterator();
      while(var4.hasNext()) {
         tb_person node = (tb_person)var4.next();
         String tagid = node.getP_tagid();
         tb_realpositoin position = new tb_realpositoin();
         position.setTagid(tagid);
@@ -335,199 +861,380 @@
         position.setSos(node.getP_sos());
         position.setTime(node.getP_addtiem());
         position.setFence(node.getP_fence());
         position.setShipin(node.getP_shipin());
         position.setShipingname(node.getP_shipingname());
         position.setChaichu(node.getBaoliu6());
         position.setBaoliu20(node.getBaoliu20());
         position.setBaoliu21(node.getBaoliu21());
         position.setBaoliu25(node.getBaoliu25());
         position.setBaoliu26(node.getBaoliu26());
         position.setBaoliu27(node.getBaoliu27());
         position.setBaoliu28(node.getBaoliu28());
         position.setBaoliu29(node.getBaoliu29());
         position.setBaoliu30(node.getBaoliu30());
         position.setBaoliu31(node.getBaoliu31());
         position.setBaoliu32(node.getBaoliu32());
         finalPositionList.add(position);
      }
      return finalPositionList;
   }
   @RequestMapping(value="/getRealTrack.do", method = { RequestMethod.POST, RequestMethod.GET })
   @ResponseBody
   @RequestMapping(
         value = {"/getpersonid.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   public JSONObject getpersonid(HttpServletRequest request) {
      String tagid = request.getParameter("tagid");
      List<tb_person> realTrackList = this.ZhwService.getpersonid(tagid);
      JSONObject json = new JSONObject();
      json.put("X", ((tb_person)realTrackList.get(0)).getP_x());
      json.put("Y", ((tb_person)realTrackList.get(0)).getP_y());
      json.put("time", ((tb_person)realTrackList.get(0)).getP_addtiem());
      return json;
   }
   @ResponseBody
   @RequestMapping(
         value = {"/getgpsid.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   public JSONObject getgpsid(HttpServletRequest request) {
      String tagid = request.getParameter("tagid");
      List<tb_gps> realTrackList = this.ZhwService.getgpsid(tagid);
      JSONObject json = new JSONObject();
      json.put("jingdu", ((tb_gps)realTrackList.get(0)).getGsp_jingdu());
      json.put("weidu", ((tb_gps)realTrackList.get(0)).getGps_weidu());
      json.put("haibagao", ((tb_gps)realTrackList.get(0)).getGps_haiba_gao());
      return json;
   }
   @RequestMapping(
         value = {"/getRealTrack.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   @ResponseBody
   public List<ArrayList<tb_track>> getRealTrack(HttpServletRequest request) {
      String tagid = request.getParameter("tagid");
      String[] taglist = tagid.split(",");
      String floor = request.getParameter("floor");
      Long time_range = Long.parseLong(request.getParameter("time")) * 1000;// ms*1000=s
      long timeNow =  System.currentTimeMillis();
      Long time_range = Long.parseLong(request.getParameter("time")) * 1000L;
      long timeNow = System.currentTimeMillis();
      long timeStart = timeNow - time_range;
//    long timeStart = 0;
      Timestamp ts=new Timestamp(timeStart);
      String start_str=ts.toString(); // start time string
      //start_str="2021-03-01 10:26:00";
      List<tb_track> realTrackList = ZhwService.getRealPosTrack(taglist, start_str, floor);
      Timestamp ts = new Timestamp(timeStart);
      String start_str = ts.toString();
      List<tb_track> realTrackList = this.ZhwService.getRealPosTrack(taglist, start_str, floor);
      List<String> tagList = new ArrayList();
      Iterator var14 = realTrackList.iterator();
      //get all tag in a list
      List<String> tagList = new ArrayList<String>();
      for (tb_track node : realTrackList) {
         if (tagList.contains(node.getTagid())) {
            continue;
         } else {
      while(var14.hasNext()) {
         tb_track node = (tb_track)var14.next();
         if (!tagList.contains(node.getTagid())) {
            tagList.add(node.getTagid());
         }
      }
      // sort all track data by tagid
      List<ArrayList<tb_track>> tmpRealTrackList = new ArrayList<ArrayList<tb_track>>();
      List<ArrayList<tb_track>> finalRealTrackList = new ArrayList<ArrayList<tb_track>>();
      for (String tag : tagList) {
         tmpRealTrackList.add(new ArrayList<tb_track>());
      List<ArrayList<tb_track>> tmpRealTrackList = new ArrayList();
      new ArrayList();
      Iterator var16 = tagList.iterator();
      while(var16.hasNext()) {
         String tag = (String)var16.next();
         tmpRealTrackList.add(new ArrayList());
      }
      for (tb_track node : realTrackList) {
      var16 = realTrackList.iterator();
      while(var16.hasNext()) {
         tb_track node = (tb_track)var16.next();
         int index = tagList.indexOf(node.getTagid());
         tmpRealTrackList.get(index).add(node);
         ((ArrayList)tmpRealTrackList.get(index)).add(node);
      }
      return tmpRealTrackList;
   }
   @RequestMapping(value="/getRealTrack_all.do", method = { RequestMethod.POST, RequestMethod.GET })
   @RequestMapping(
         value = {"/getRealTrack_all.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   @ResponseBody
   public List<tb_track> getRealTrack_all(HttpServletRequest request) {
      String tagid = request.getParameter("tagid");
      String[] taglist = tagid.split(",");
      Long time_range = Long.parseLong(request.getParameter("time")) * 1000;// ms*1000=s
      long timeNow =  System.currentTimeMillis();
      Long time_range = Long.parseLong(request.getParameter("time")) * 1000L;
      long timeNow = System.currentTimeMillis();
      long timeStart = timeNow - time_range;
//    long timeStart = 0;
      Timestamp ts=new Timestamp(timeStart);
      String start_str=ts.toString(); // start time string
//    String start_str="2021-03-01 10:26:00";
      List<tb_track> realTrackList = ZhwService.getRealPosTrack_all(taglist, start_str);
//    List<tb_track> finalRealTrackList = new ArrayList<tb_track>();
      Timestamp ts = new Timestamp(timeStart);
      String start_str = ts.toString();
      List<tb_track> realTrackList = this.ZhwService.getRealPosTrack_all(taglist, start_str);
      return realTrackList;
//    if (realTrackList.size()<=100) {
//       return realTrackList;
//    } else {
//       int lenth = realTrackList.size();
//       int interval = (int) Math.floor(lenth/100);
//       for (int i=0;i<lenth;i+=interval) {
//          finalRealTrackList.add(realTrackList.get(i));
//       }
//       return finalRealTrackList;
//    }
   }
   @RequestMapping(value = "/anchorConfiguration.do", method = { RequestMethod.POST, RequestMethod.GET })
   public String anchorConfiguration(HttpServletRequest request,  HttpServletResponse response) throws ServletException, IOException {
   @RequestMapping(
         value = {"/anchorConfiguration.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   public String anchorConfiguration(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
      String toPage = "forward:/hxzk/anchor/anchorConfiguration.jsp";
      List<tb_achor> anchorList = ZhwService.getAnchor();
      List<tb_achor> anchorList = this.ZhwService.getAnchor();
      request.setAttribute("anchorList", anchorList);
      return toPage;
   }
   @RequestMapping(value="/getAnchorip.do", method = { RequestMethod.POST, RequestMethod.GET })
   @RequestMapping(
         value = {"/getAnchorip.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   @ResponseBody
   public List<tb_achor> getAnchorip(HttpServletRequest request) {
       String anchorid = request.getParameter("anchorid");
      final List<tb_achor> anchoripList = ZhwService.getAnchorip(anchorid);
   public List<tb_achor> getAnchorip(HttpServletRequest request) {
      String anchorid = request.getParameter("anchorid");
      List<tb_achor> anchoripList = this.ZhwService.getAnchorip(anchorid);
      return anchoripList;
   }
   @RequestMapping(value="/getSysSetting_list.do", method = { RequestMethod.POST, RequestMethod.GET })
   @RequestMapping(
         value = {"/getSysSetting_list.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   @ResponseBody
   public List<tb_system> getSysSetting_list(HttpServletRequest request) {
      List<tb_system> settingList = sysSettingService.getSetting();
      List<tb_system> settingList = this.sysSettingService.getSetting();
      return settingList;
   }
   @RequestMapping(value="/getAnchorInfo.do", method = { RequestMethod.POST, RequestMethod.GET })
   @RequestMapping(
         value = {"/getSysSetting_list2.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   @ResponseBody
   public List<tb_achor> getAnchorInfo(HttpServletRequest request) {
   public String getSysSetting_list2(HttpServletRequest request) {
      JSONObject json = new JSONObject();
      List<tb_system> settingList = this.sysSettingService.getSetting();
      List<tb_nav> navList = this.ZhwService.getnav();
      List<tb_person> persons = this.ZhwService.getbumen();
      List<String> realAttendance_k = new ArrayList();
      List<tb_department> departments = this.basicInfoService.getDepartmentManagement2();
      for(int i = 0; i < departments.size(); ++i) {
         realAttendance_k.add(((tb_department)departments.get(i)).getDepartmentName());
      }
      json.put("dataList", settingList);
      json.put("dataList2", navList);
      json.put("dataList3", persons);
      json.put("dataList4", realAttendance_k);
      return json.toString();
   }
   @RequestMapping(
         value = {"/getSysSetting_list3.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   @ResponseBody
   public String getSysSetting_list3(HttpServletRequest request) {
      JSONObject json = new JSONObject();
      List<tb_system> settingList = this.sysSettingService.getSetting();
      List<tb_nav> navList = this.ZhwService.getnav();
      List<tb_person> persons = this.ZhwService.getbumen();
      List<String> realAttendance_k = new ArrayList();
      List<tb_department> departments = this.basicInfoService.getDepartmentManagement2();
      for(int i = 0; i < departments.size(); ++i) {
         realAttendance_k.add(((tb_department)departments.get(i)).getDepartmentName());
      }
      HttpSession session = request.getSession();
      ServletContext application = session.getServletContext();
      String username = application.getAttribute("username").toString();
      json.put("xianuser", username);
      json.put("dataList", settingList);
      json.put("dataList2", navList);
      json.put("dataList3", persons);
      json.put("dataList4", realAttendance_k);
      return json.toString();
   }
   @RequestMapping(
         value = {"/getAnchorInfo.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   @ResponseBody
   public List<tb_achor> getAnchorInfo(HttpServletRequest request) {
      String floor = request.getParameter("floor");
      final List<tb_achor> anchoripList = ZhwService.getAnchorInfo(floor);
      List<tb_achor> anchoripList = this.ZhwService.getAnchorInfo(floor);
      return anchoripList;
   }
   @RequestMapping(value="/getAnchorInfo_all.do", method = { RequestMethod.POST, RequestMethod.GET })
   @RequestMapping(
         value = {"/getAnchorInfo_all.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   @ResponseBody
   public List<tb_achor> getAnchorInfo_all(HttpServletRequest request) {
      final List<tb_achor> anchoripList = ZhwService.getAnchorInfo_all();
   public List<tb_achor> getAnchorInfo_all(HttpServletRequest request) {
      List<tb_achor> anchoripList = this.ZhwService.getAnchorInfo_all();
      return anchoripList;
   }
   @RequestMapping(value="/getGPS.do", method = { RequestMethod.POST, RequestMethod.GET })
   @RequestMapping(
         value = {"/getGPS.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   @ResponseBody
   public List<tb_gps> getGPS(HttpServletRequest request) {
      final List<tb_gps> gpsList = ZhwService.getGPS();
      List<tb_gps> finalGPSList = new ArrayList<tb_gps>();
      for ( tb_gps node : gpsList) {
   public List<tb_gps> getGPS(HttpServletRequest request) {
      List<tb_gps> gpsList = this.ZhwService.getGPS();
      List<tb_gps> finalGPSList = new ArrayList();
      Iterator var4 = gpsList.iterator();
      while(var4.hasNext()) {
         tb_gps node = (tb_gps)var4.next();
         if (node.getGsp_jingdu() != null && !node.getGsp_jingdu().equals("00000.000000") && node.getGps_weidu() != null && !node.getGps_weidu().equals("00000.000000")) {
            String[] jingdu = node.getGsp_jingdu().split("\\.");
            String[] weidu = node.getGps_weidu().split("\\.");
            finalGPSList.add(node);
         }
      };
      }
      return finalGPSList;
   }
   @RequestMapping(value="/getGPSTrack.do", method = { RequestMethod.POST, RequestMethod.GET })
   @RequestMapping(value = {"/getGPSa.do"}, method = {RequestMethod.POST, RequestMethod.GET})
   @ResponseBody
   public List<tb_gps> getGPSTrack(HttpServletRequest request) throws ParseException {
       String tag_id = request.getParameter("tag_value");
       String begin_time = request.getParameter("begin_value");
       String end_time = request.getParameter("end_value");
      final List<tb_gps> finalGPSList = ZhwService.getGPStrack(tag_id, begin_time, end_time);
   public JSONObject getGPSa(HttpServletRequest request) {
      JSONObject json = new JSONObject();
      List<tb_gps> gpsList = this.ZhwService.getGPS();
      List<tb_gps> finalGPSList = new ArrayList();
      Iterator var5 = gpsList.iterator();
      while(var5.hasNext()) {
         tb_gps node = (tb_gps)var5.next();
         if (node.getGsp_jingdu() != null && !node.getGsp_jingdu().equals("00000.000000") && node.getGps_weidu() != null && !node.getGps_weidu().equals("00000.000000")) {
            String[] jingdu = node.getGsp_jingdu().split("\\.");
            String[] weidu = node.getGps_weidu().split("\\.");
            if (jingdu[0].length() == 3 && weidu[0].length() == 2) {
               finalGPSList.add(node);
            }
         }
      }
      json.put("dataList", finalGPSList);
      return json;
   }
   @RequestMapping(
         value = {"/getGPSTrack.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   @ResponseBody
   public List<tb_gps> getGPSTrack(HttpServletRequest request) throws ParseException {
      String tag_id = request.getParameter("tag_value");
      String begin_time = request.getParameter("begin_value");
      String end_time = request.getParameter("end_value");
      List<tb_gps> finalGPSList = this.ZhwService.getGPStrack(tag_id, begin_time, end_time);
      return finalGPSList;
   }
   @RequestMapping(value="/qiehuanditu_option.do", method = { RequestMethod.POST, RequestMethod.GET })
   @RequestMapping(
         value = {"/getGPSTracka.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   @ResponseBody
   public List<tb_map> qiehuanditu_option(HttpServletRequest request) {
      List<tb_map> mapList = ZhwService.getFloor();
   public JSONObject getGPSTracka(HttpServletRequest request) throws ParseException {
      String tag_id = request.getParameter("tag_value");
      String begin_time = request.getParameter("begin_value");
      String end_time = request.getParameter("end_value");
      List<tb_gps> finalGPSList = this.ZhwService.getGPStrack(tag_id, begin_time, end_time);
      JSONObject json = new JSONObject();
      json.put("dataList", finalGPSList);
      return json;
   }
   @RequestMapping(
         value = {"/qiehuanditu_option.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   @ResponseBody
   public List<tb_map> qiehuanditu_option(HttpServletRequest request) {
      List<tb_map> mapList = this.ZhwService.getFloor();
      return mapList;
   }
   @RequestMapping(value = "/qiehuanditu_save.do", method = { RequestMethod.POST, RequestMethod.GET })
   public String qiehuanditu_save(HttpServletRequest request,  HttpServletResponse response) throws ServletException, IOException {
      //String toPage = "forward:/show.do";
   @RequestMapping(value = {"/qiehuanditu_option2.do"}, method = {RequestMethod.POST, RequestMethod.GET})
   @ResponseBody
   public List<tb_map> qiehuanditu_option2(HttpServletRequest request) {
      String floor = request.getParameter("floor");
      List<tb_map> mapList = this.ZhwService.getFloor2(floor);
      return mapList;
   }
   @RequestMapping(
         value = {"/qiehuanditu_save.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   public String qiehuanditu_save(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
      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"));
      ModifyConfig.writeData(filePath, "map_now", map_now);
      return "1";
   }
   @RequestMapping(value="/qiehuanditu_get.do", method = { RequestMethod.POST, RequestMethod.GET })
   @RequestMapping(
         value = {"/qiehuanditu_get.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   @ResponseBody
   public List<String> qiehuanditu_get(HttpServletRequest request) {
//    String filePath = Config.getMapConfig();
//    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);
      List<tb_system> systemlist = sysSettingService.getSetting();
      List<String> maplist = new ArrayList<String>();
      String map = systemlist.get(0).getYulan_map();
   public List<String> qiehuanditu_get(HttpServletRequest request) {
      List<tb_system> systemlist = this.sysSettingService.getSetting();
      List<String> maplist = new ArrayList();
      String map = ((tb_system)systemlist.get(0)).getYulan_map();
      maplist.add(map);
      return maplist;
   }
   @RequestMapping(value = "/getAnchor_read_config.do", method = { RequestMethod.POST, RequestMethod.GET })
   public void getAnchor_read_config(HttpServletRequest request,  HttpServletResponse response) throws ServletException, IOException {
      byte[] byt=Read_Write_Anchor_Message.ReadData((byte)0x2,(byte)0x50);
      System.out.println("读取配置信息:"+BytesToHex.bytesToHex(byt));
      String ip = request.getParameter("ip");
      List<tb_system> settingList = sysSettingService.getSetting();
      Udp_Out.out(byt, byt.length, ip, settingList.get(0).getUdpPort().toString(), settingList.get(0).getWifi_mdel().toString()); //( , , ,udp_port, wifi_mode)
   @RequestMapping(
         value = {"/qiehuanditu1.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   @ResponseBody
   public List<String> qiehuanditu1(HttpServletRequest request) {
      List<tb_map> maps = this.mapService.getMapManagement();
      List<String> maplist = new ArrayList();
      String map = ((tb_map)maps.get(0)).getMapname();
      maplist.add(map);
      return maplist;
   }
   @RequestMapping(value = "/modify_anchor_version.do", method = { RequestMethod.POST, RequestMethod.GET })
   @RequestMapping(
         value = {"/getAnchor_read_config.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   public void getAnchor_read_config(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
      byte[] byt = Read_Write_Anchor_Message.ReadData((byte)2, (byte)80);
      System.out.println("读取配置信息:" + BytesToHex.bytesToHex(byt));
      String ip = request.getParameter("ip");
      List<tb_system> settingList = this.sysSettingService.getSetting();
      Udp_Out.out(byt, byt.length, ip, ((tb_system)settingList.get(0)).getUdpPort().toString(), ((tb_system)settingList.get(0)).getWifi_mdel().toString());
   }
   @RequestMapping(
         value = {"/modify_anchor_version.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   public void modify_anchor_version(HttpServletRequest request) throws IOException {
      String jsonString = RequestUtils.getRequestJsonString(request, Config.getCharset());
      tb_achor anchor = (tb_achor) JSONObject.toBean(JSONObject.fromObject(jsonString), tb_achor.class);
      AnchorService.anchorManagement_modify_ip_ver(anchor);
      tb_achor anchor = (tb_achor)JSONObject.toBean(JSONObject.fromObject(jsonString), tb_achor.class);
      this.AnchorService.anchorManagement_modify_ip_ver(anchor);
   }
   @RequestMapping(value="/read_anchor_config_done.do", method = { RequestMethod.POST, RequestMethod.GET })
   @RequestMapping(
         value = {"/read_anchor_config_done.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   @ResponseBody
   public List<String> read_anchor_config_done(HttpServletRequest request) {
   public List<String> read_anchor_config_done(HttpServletRequest request) {
      String filePath = Config.getAnchorConfig();
      List<String> peizhilist = new ArrayList<String>();
      List<String> peizhilist = new ArrayList();
      String peizhi = ModifyConfig.readData(filePath, "readpeizhi");
      peizhilist.add(peizhi);
      String shebeimoshi = ModifyConfig.readData(filePath, "shebeimoshi");
@@ -578,13 +1285,16 @@
      peizhilist.add(qiehuanjuli);
      return peizhilist;
   }
   @RequestMapping(value="/modify_anchor_config_done.do", method = { RequestMethod.POST, RequestMethod.GET })
   @RequestMapping(
         value = {"/modify_anchor_config_done.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   @ResponseBody
   public List<String> modify_anchor_config_done(HttpServletRequest request) {
      String ip=request.getParameter("ip");
   public List<String> modify_anchor_config_done(HttpServletRequest request) {
      String ip = request.getParameter("ip");
      String filePath = Config.getAnchorConfig();
      List<String> peizhilist = new ArrayList<String>();
      new ArrayList();
      String peizhi = ModifyConfig.readData(filePath, "readpeizhi");
      if (peizhi.equals("done")) {
         ModifyConfig.writeData(filePath, "shebeimoshi", request.getParameter("shebeimoshi"));
@@ -610,22 +1320,23 @@
         ModifyConfig.writeData(filePath, "linjinjizhan7", request.getParameter("linjinjizhan7"));
         ModifyConfig.writeData(filePath, "linjinjizhan8", request.getParameter("linjinjizhan8"));
         ModifyConfig.writeData(filePath, "qiehuanjuli", request.getParameter("qiehuanjuli"));
         byte[] byt = ReadPeizhiMessage.save(request.getParameter("jizhanid"), request.getParameter("fashegonglv"), request.getParameter("wuchajiaozhun"), request.getParameter("lvbocanshu"), request.getParameter("tongxunxiaozu"), request.getParameter("tongxunpinlv"), request.getParameter("tongxunshangxian"), request.getParameter("shebeimoshi"), request.getParameter("linjinjizhanshuliang"), request.getParameter("linjinjizhan1"), request.getParameter("linjinjizhan2"),  request.getParameter("linjinjizhan3"), request.getParameter("linjinjizhan4"), request.getParameter("linjinjizhan5"), request.getParameter("linjinjizhan6"), request.getParameter("linjinjizhan7"), request.getParameter("linjinjizhan8"), "", request.getParameter("qiehuanjuli"), request.getParameter("zhudongceju"), request.getParameter("kaiqixintiao"), request.getParameter("tongbujizhan"), request.getParameter("tongbuleixing"));
         List<tb_system> settingList = sysSettingService.getSetting();
         System.out.println("保存配置信息是:"+BytesToHex.bytesToHex(byt));
         Udp_Out.out(byt,byt.length,ip, settingList.get(0).getUdpPort().toString(), settingList.get(0).getWifi_mdel().toString() );
         byte[] byt = ReadPeizhiMessage.save(request.getParameter("jizhanid"), request.getParameter("fashegonglv"), request.getParameter("wuchajiaozhun"), request.getParameter("lvbocanshu"), request.getParameter("tongxunxiaozu"), request.getParameter("tongxunpinlv"), request.getParameter("tongxunshangxian"), request.getParameter("shebeimoshi"), request.getParameter("linjinjizhanshuliang"), request.getParameter("linjinjizhan1"), request.getParameter("linjinjizhan2"), request.getParameter("linjinjizhan3"), request.getParameter("linjinjizhan4"), request.getParameter("linjinjizhan5"), request.getParameter("linjinjizhan6"), request.getParameter("linjinjizhan7"), request.getParameter("linjinjizhan8"), "", request.getParameter("qiehuanjuli"), request.getParameter("zhudongceju"), request.getParameter("kaiqixintiao"), request.getParameter("tongbujizhan"), request.getParameter("tongbuleixing"));
         List<tb_system> settingList = this.sysSettingService.getSetting();
         System.out.println("保存配置信息是:" + BytesToHex.bytesToHex(byt));
         Udp_Out.out(byt, byt.length, ip, ((tb_system)settingList.get(0)).getUdpPort().toString(), ((tb_system)settingList.get(0)).getWifi_mdel().toString());
      }
      List<String> modi = new ArrayList<String>();
      List<String> modi = new ArrayList();
      modi.add("1");
      return modi;
   }
   @RequestMapping(value="/modify_all_anchor_config.do", method = { RequestMethod.POST, RequestMethod.GET })
   @RequestMapping(
         value = {"/modify_all_anchor_config.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   @ResponseBody
   public List<String> modify_all_anchor_config(HttpServletRequest request) {
   public List<String> modify_all_anchor_config(HttpServletRequest request) {
      String filePath = Config.getAnchorConfig();
      ModifyConfig.writeData(filePath, "fashegonglv", request.getParameter("fashegonglv"));
      ModifyConfig.writeData(filePath, "wuchajiaozhun", request.getParameter("wuchajiaozhun"));
@@ -635,227 +1346,329 @@
      ModifyConfig.writeData(filePath, "tongxunshangxian", request.getParameter("tongxunshangxian"));
      ModifyConfig.writeData(filePath, "tongbujizhan", request.getParameter("tongbujizhan"));
      ModifyConfig.writeData(filePath, "tongbuleixing", request.getParameter("tongbuleixing"));
      byte[] byt = ReadPeizhiMessage.alert_all_anchor(request.getParameter("fashegonglv"), request.getParameter("wuchajiaozhun"),
            request.getParameter("lvbocanshu"), request.getParameter("tongxunxiaozu"), request.getParameter("tongxunpinlv"),
            request.getParameter("tongxunshangxian"), request.getParameter("tongbujizhan"), request.getParameter("tongbuleixing"));
      List<tb_system> settingList = sysSettingService.getSetting();
      String port = settingList.get(0).getUdpPort().toString();
      String wifi_mode = settingList.get(0).getWifi_mdel().toString();
      System.out.println("修改所有基站信息是:"+BytesToHex.bytesToHex(byt));
      List<tb_achor> anchorIpList = ZhwService.getALlAnchor();
      if (anchorIpList.size()!=0) {
         for(int i=0; i<anchorIpList.size();i++) {
            String ip = anchorIpList.get(i).getAnchorip();
      byte[] byt = ReadPeizhiMessage.alert_all_anchor(request.getParameter("fashegonglv"), request.getParameter("wuchajiaozhun"), request.getParameter("lvbocanshu"), request.getParameter("tongxunxiaozu"), request.getParameter("tongxunpinlv"), request.getParameter("tongxunshangxian"), request.getParameter("tongbujizhan"), request.getParameter("tongbuleixing"));
      List<tb_system> settingList = this.sysSettingService.getSetting();
      String port = ((tb_system)settingList.get(0)).getUdpPort().toString();
      String wifi_mode = ((tb_system)settingList.get(0)).getWifi_mdel().toString();
      System.out.println("修改所有基站信息是:" + BytesToHex.bytesToHex(byt));
      List<tb_achor> anchorIpList = this.ZhwService.getALlAnchor();
      if (anchorIpList.size() != 0) {
         for(int i = 0; i < anchorIpList.size(); ++i) {
            String ip = ((tb_achor)anchorIpList.get(i)).getAnchorip();
            Udp_Out.out(byt, byt.length, ip, port, wifi_mode);
         }
      }
      List<String> modi = new ArrayList<String>();
      List<String> modi = new ArrayList();
      modi.add("1");
      return modi;
   }
   @RequestMapping(value="/restart_anchor.do", method = { RequestMethod.POST, RequestMethod.GET })
   @RequestMapping(
         value = {"/restart_anchor.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   @ResponseBody
   public List<String> restart_anchor(HttpServletRequest request) {
      byte[] byt=Read_Write_Anchor_Message.WriteData((byte)0x60,(byte)0x2,1);
      System.out.println("重启基站信息是:"+BytesToHex.bytesToHex(byt));
      String ip=request.getParameter("ip");
      List<tb_system> settingList = sysSettingService.getSetting();
      Udp_Out.out(byt,byt.length,ip,settingList.get(0).getUdpPort().toString(), settingList.get(0).getWifi_mdel().toString());
      List<String> rslt = new ArrayList<String>();
   public List<String> restart_anchor(HttpServletRequest request) {
      byte[] byt = Read_Write_Anchor_Message.WriteData((byte)96, (byte)2, 1);
      System.out.println("重启基站信息是:" + BytesToHex.bytesToHex(byt));
      String ip = request.getParameter("ip");
      List<tb_system> settingList = this.sysSettingService.getSetting();
      Udp_Out.out(byt, byt.length, ip, ((tb_system)settingList.get(0)).getUdpPort().toString(), ((tb_system)settingList.get(0)).getWifi_mdel().toString());
      List<String> rslt = new ArrayList();
      rslt.add("1");
      return rslt;
   }
   @RequestMapping(value="/reset_anchor.do", method = { RequestMethod.POST, RequestMethod.GET })
   @RequestMapping(
         value = {"/reset_anchor.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   @ResponseBody
   public List<String> reset_anchor(HttpServletRequest request) {
      byte[] byt=Read_Write_Anchor_Message.WriteData((byte)0x62,(byte)0x2,1);
      System.out.println("恢复出厂设置信息是:"+BytesToHex.bytesToHex(byt));
      String ip=request.getParameter("ip");
      List<tb_system> settingList = sysSettingService.getSetting();
      Udp_Out.out(byt,byt.length,ip,settingList.get(0).getUdpPort().toString(), settingList.get(0).getWifi_mdel().toString());
      List<String> rslt = new ArrayList<String>();
   public List<String> reset_anchor(HttpServletRequest request) {
      byte[] byt = Read_Write_Anchor_Message.WriteData((byte)98, (byte)2, 1);
      System.out.println("恢复出厂设置信息是:" + BytesToHex.bytesToHex(byt));
      String ip = request.getParameter("ip");
      List<tb_system> settingList = this.sysSettingService.getSetting();
      Udp_Out.out(byt, byt.length, ip, ((tb_system)settingList.get(0)).getUdpPort().toString(), ((tb_system)settingList.get(0)).getWifi_mdel().toString());
      List<String> rslt = new ArrayList();
      rslt.add("1");
      return rslt;
   }
   @RequestMapping(value="/anchorCeju.do", method = { RequestMethod.POST, RequestMethod.GET })
   @RequestMapping(
         value = {"/anchorCeju.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   @ResponseBody
   public List<String> anchorCeju(HttpServletRequest request) {
      String begin=request.getParameter("begin");
      System.out.println("begin"+begin);
      List<tb_system> settingList = sysSettingService.getSetting();
   public List<String> anchorCeju(HttpServletRequest request) {
      String begin = request.getParameter("begin");
      System.out.println("begin" + begin);
      List<tb_system> settingList = this.sysSettingService.getSetting();
      String ip_a;
      String ip_b;
      byte[] byt2;
      if (begin.equals("true")) {
         //点击了开始测距
         String ip_a = request.getParameter("beice");
         String beice_anchor = request.getParameter("beice_anchor");
         ip_a = request.getParameter("beice");
         ip_b = request.getParameter("beice_anchor");
         String filePath = Config.getAnchorConfig();
         ModifyConfig.writeData(filePath, "beice_anchor", beice_anchor);
         byte[] byt=Read_Write_Anchor_Message.WriteData((byte)0x10,(byte)0x2,1);
         System.out.println("基站开始测距:"+BytesToHex.bytesToHex(byt));
         Udp_Out.out(byt,byt.length,ip_a, settingList.get(0).getUdpPort().toString(), settingList.get(0).getWifi_mdel().toString());
         ModifyConfig.writeData(filePath, "beice_anchor", ip_b);
         byt2 = Read_Write_Anchor_Message.WriteData((byte)16, (byte)2, 1);
         System.out.println("基站开始测距:" + BytesToHex.bytesToHex(byt2));
         Udp_Out.out(byt2, byt2.length, ip_a, ((tb_system)settingList.get(0)).getUdpPort().toString(), ((tb_system)settingList.get(0)).getWifi_mdel().toString());
      } else if (begin.equals("false")) {
         //点击了取消测距
         String ip_a = request.getParameter("beice");
         String ip_b = request.getParameter("ceju");
         byte[] byt=Read_Write_Anchor_Message.WriteData((byte)0x10,(byte)0x2,0);
         System.out.println("基站取消测距:"+BytesToHex.bytesToHex(byt));
         Udp_Out.out(byt,byt.length,ip_a,settingList.get(0).getUdpPort().toString(), settingList.get(0).getWifi_mdel().toString());
         byte[] byt2=Read_Write_Anchor_Message.WriteData((byte)0x10,(byte)0x2,0);
         System.out.println("基站取消测距:"+BytesToHex.bytesToHex(byt2));
         Udp_Out.out(byt2,byt2.length,ip_b, settingList.get(0).getUdpPort().toString(), settingList.get(0).getWifi_mdel().toString());
         ip_a = request.getParameter("beice");
         ip_b = request.getParameter("ceju");
         byte[] byt = Read_Write_Anchor_Message.WriteData((byte)16, (byte)2, 0);
         System.out.println("基站取消测距:" + BytesToHex.bytesToHex(byt));
         Udp_Out.out(byt, byt.length, ip_a, ((tb_system)settingList.get(0)).getUdpPort().toString(), ((tb_system)settingList.get(0)).getWifi_mdel().toString());
         byt2 = Read_Write_Anchor_Message.WriteData((byte)16, (byte)2, 0);
         System.out.println("基站取消测距:" + BytesToHex.bytesToHex(byt2));
         Udp_Out.out(byt2, byt2.length, ip_b, ((tb_system)settingList.get(0)).getUdpPort().toString(), ((tb_system)settingList.get(0)).getWifi_mdel().toString());
      }
      List<String> rslt = new ArrayList<String>();
      List<String> rslt = new ArrayList();
      rslt.add("1");
      return rslt;
   }
   @RequestMapping(value="/getAnchorhuce.do", method = { RequestMethod.POST, RequestMethod.GET })
   @RequestMapping(
         value = {"/getAnchorhuce.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   @ResponseBody
   public List<String> getAnchorhuce(HttpServletRequest request) {
   public List<String> getAnchorhuce(HttpServletRequest request) {
      String filePath = Config.getAnchorConfig();
      String huceju = ModifyConfig.readData(filePath, "huceju");
      System.out.println("huceju"+huceju);
      List<String> rslt = new ArrayList<String>();
      System.out.println("huceju" + huceju);
      List<String> rslt = new ArrayList();
      rslt.add(huceju);
      return rslt;
   }
   @RequestMapping(value = "/gpsRecord_add.do", method = { RequestMethod.POST, RequestMethod.GET })
   @RequestMapping(
         value = {"/gpsRecord_add.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   public void gpsRecord_add(HttpServletRequest request) throws IOException {
      String jsonString = RequestUtils.getRequestJsonString(request, Config.getCharset());
      logger.info("传入数据IData:" + jsonString);
      tb_gps gps = (tb_gps) JSONObject.toBean(JSONObject.fromObject(jsonString), tb_gps.class);
      List<tb_gps> searchGpsList = ZhwService.searchGps(gps.getTagid());
      if (searchGpsList.size()>0){
         ZhwService.gpsRecord_modify(gps);
      this.logger.info("传入数据IData:" + jsonString);
      tb_gps gps = (tb_gps)JSONObject.toBean(JSONObject.fromObject(jsonString), tb_gps.class);
      List<tb_gps> searchGpsList = this.ZhwService.searchGps(gps.getTagid());
      if (searchGpsList.size() > 0) {
         this.ZhwService.gpsRecord_modify(gps);
      } else {
         ZhwService.gpsRecord_add(gps);
      }
         this.ZhwService.gpsRecord_add(gps);
      }
   }
   @RequestMapping(value = "/gpsTrack_add.do", method = { RequestMethod.POST, RequestMethod.GET })
   @RequestMapping(
         value = {"/gpsTrack_add.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   public void gpsTrack_add(HttpServletRequest request) throws IOException {
      String jsonString = RequestUtils.getRequestJsonString(request, Config.getCharset());
      logger.info("传入数据IData:" + jsonString);
      tb_gps gps = (tb_gps) JSONObject.toBean(JSONObject.fromObject(jsonString), tb_gps.class);
      ZhwService.gpsTrack_add(gps);
      this.logger.info("传入数据IData:" + jsonString);
      tb_gps gps = (tb_gps)JSONObject.toBean(JSONObject.fromObject(jsonString), tb_gps.class);
      this.ZhwService.gpsTrack_add(gps);
   }
   @RequestMapping(value = "/httpsos.do", method = { RequestMethod.POST, RequestMethod.GET })
   @RequestMapping(
         value = {"/httpsos.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   public void http(HttpServletRequest request) throws IOException {
      String jsonString = RequestUtils.getRequestJsonString(request, Config.getCharset());
      JSONObject str = JSONObject.fromObject(jsonString);
      sos = (httpsos)JSONObject.toBean(str, httpsos.class);
      this.sos = (httpsos)JSONObject.toBean(str, httpsos.class);
   }
   @RequestMapping(value = "/sosgaojing.do", method = { RequestMethod.POST, RequestMethod.GET })
   @RequestMapping(
         value = {"/qugaojing.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   public void sosgaojing(HttpServletRequest request) throws IOException {
      String tagid=request.getParameter("tagid");
      ZhwService.sosgao(tagid);
      String xieyi = "BSTOCS1,DELLWARN," +tagid+ ",SOS,END";
      String tagid = request.getParameter("tagid");
      String type = request.getParameter("type");
      this.ZhwService.sosgao2(tagid, type);
      String xieyi = "BSTOCS1,DELLWARN," + tagid + ",SOS,END";
      Udp_Out.udp_to_cs(xieyi);
   }
   @RequestMapping(value = "/fencegaojing.do", method = { RequestMethod.POST, RequestMethod.GET })
   @RequestMapping(
         value = {"/fencegaojing.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   public void fencegaojing(HttpServletRequest request) throws IOException {
      String tagid=request.getParameter("tagid");
      String type=request.getParameter("type");
      ZhwService.fencegao(tagid);
      String xieyi = "BSTOCS1,DELLWARN," +tagid+ ","+type+",END";
      String tagid = request.getParameter("tagid");
      String type = request.getParameter("type");
      this.ZhwService.fencegao(tagid);
      String xieyi = "BSTOCS1,DELLWARN," + tagid + "," + type + ",END";
      Udp_Out.udp_to_cs(xieyi);
   }
   @RequestMapping(value = "/chaichugaojing.do", method = { RequestMethod.POST, RequestMethod.GET })
   @RequestMapping(
         value = {"/chaichugaojing.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   public void chaichugaojing(HttpServletRequest request) throws IOException {
      String tagid=request.getParameter("tagid");
      ZhwService.chaichugao(tagid);
      String xieyi = "BSTOCS1,DELLWARN," +tagid+ ",被拆除,END";
      String tagid = request.getParameter("tagid");
      this.ZhwService.chaichugao(tagid);
      String xieyi = "BSTOCS1,DELLWARN," + tagid + ",被拆除,END";
      Udp_Out.udp_to_cs(xieyi);
   }
   @RequestMapping(value = "/gaojingzongchuli.do", method = { RequestMethod.POST, RequestMethod.GET })
   public void gaojingzongchuli(HttpServletRequest request) throws IOException {
      List<tb_person> soslist = ZhwService.getsosgaojing();
      for (int i=0; i<soslist.size(); i++) {
         String tagid = soslist.get(i).getP_tagid();
         ZhwService.sosgao(tagid);
         String xieyi = "BSTOCS1,DELLWARN," +tagid+ ",SOS,END";
         Udp_Out.udp_to_cs(xieyi);
      }
      List<tb_person> fencelist = ZhwService.getfencegaojing();
      for (int i=0; i<fencelist.size(); i++) {
         String tagid = fencelist.get(i).getP_tagid();
         ZhwService.fencegao(tagid);
         String xieyi = "BSTOCS1,DELLWARN," +tagid+ ",危险区域,END";
         Udp_Out.udp_to_cs(xieyi);
      }
      List<tb_person> chufencelist = ZhwService.getchufencegaojing();
      for (int i=0; i<fencelist.size(); i++) {
         String tagid = chufencelist.get(i).getP_tagid();
         ZhwService.fencegao(tagid);
         String xieyi = "BSTOCS1,DELLWARN," +tagid+ ",出区域告警,END";
         Udp_Out.udp_to_cs(xieyi);
      }
   @RequestMapping(
         value = {"/jinmengaojing.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   public void jinmengaojing(HttpServletRequest request) throws IOException {
      String tagid = request.getParameter("tagid");
      this.ZhwService.jinmengao(tagid);
      String xieyi = "BSTOCS1,DELLWARN," + tagid + ",未授权进入告警,END";
      Udp_Out.udp_to_cs(xieyi);
   }
   @RequestMapping(
         value = {"/chumengaojing.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   public void chumengaojing(HttpServletRequest request) throws IOException {
      String tagid = request.getParameter("tagid");
      this.ZhwService.chumengao(tagid);
      String xieyi = "BSTOCS1,DELLWARN," + tagid + ",未授权出门告警,END";
      Udp_Out.udp_to_cs(xieyi);
   }
   @RequestMapping(
         value = {"/gaojingzongchuli.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   public void gaojingzongchuli(HttpServletRequest request) throws IOException {
      List<tb_person> soslist = this.ZhwService.getsosgaojing();
      String xieyi = "BSTOCS1,DELLWARNALL,END";
      Udp_Out.udp_to_cs(xieyi);
      for(int i = 0; i < soslist.size(); ++i) {
         String tagid = ((tb_person)soslist.get(i)).getP_tagid();
         this.ZhwService.sosgao(tagid);
      }
      List<tb_person> fencelist = this.ZhwService.getfencegaojing();
      for(int i = 0; i < fencelist.size(); ++i) {
         String tagid = ((tb_person)fencelist.get(i)).getP_tagid();
         this.ZhwService.fencegao(tagid);
      }
      List<tb_person> chufencelist = this.ZhwService.getchufencegaojing();
      for(int i = 0; i < fencelist.size(); ++i) {
         String tagid = ((tb_person)chufencelist.get(i)).getP_tagid();
         this.ZhwService.fencegao(tagid);
      }
      List<tb_person> jinchumenlist = this.ZhwService.getjinchumengaojing();
      for(int i = 0; i < fencelist.size(); ++i) {
         String tagid = ((tb_person)chufencelist.get(i)).getP_tagid();
         this.ZhwService.jinmengao(tagid);
         this.ZhwService.chumengao(tagid);
      }
   }
   @ResponseBody
   @RequestMapping(value = "/shipinzhuangtai.do", method = { RequestMethod.POST, RequestMethod.GET })
   public List<tb_shipin> shipinzhuangtai(HttpServletRequest request){
      String tagid=request.getParameter("tagid");
      ZhwService.shipin(tagid);
      List<tb_person> fencename = ZhwService.getfencename(tagid);
//    //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());
      List<tb_shipin> bb =null;
   @RequestMapping(
         value = {"/shipinzhuangtai.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   public List<tb_shipin> shipinzhuangtai(HttpServletRequest request) {
      String tagid = request.getParameter("tagid");
      this.ZhwService.shipin(tagid);
      List<tb_person> fencename = this.ZhwService.getfencename(tagid);
      List<tb_shipin> id = this.ZhwService.getshebeiid(((tb_person)fencename.get(0)).getP_fencename());
      List<tb_shipin> bb = null;
      return id;
   }
   @RequestMapping(value = "/sousuo.do", method = { RequestMethod.POST, RequestMethod.GET })
   public void sousuo(HttpServletRequest request,  HttpServletResponse response) throws ServletException, IOException {
   @RequestMapping(
         value = {"/shipinzhuangtai2.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   public void shipinzhuangtai2(HttpServletRequest request) {
      String tagid = request.getParameter("tagid");
      this.ZhwService.shipin(tagid);
   }
   @RequestMapping(
         value = {"/sousuo.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   public void sousuo(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
      String tagid = request.getParameter("tagid");
      String[] tagids = tagid.split(",");
      String xieyi = "BSTOCS1,sousuo,"+tagids[0]+",END";
      String xieyi = "BSTOCS1,sousuo," + tagids[0] + ",END";
      Udp_Out.udp_to_cs(xieyi);
   }
   @RequestMapping(value = "/sousuoquxiao.do", method = { RequestMethod.POST, RequestMethod.GET })
   public void sousuoquxiao(HttpServletRequest request,  HttpServletResponse response) throws ServletException, IOException {
   @RequestMapping(
         value = {"/sousuoquxiao.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   public void sousuoquxiao(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
      String xieyi = "BSTOCS1,give_up_sousuo,END";
      Udp_Out.udp_to_cs(xieyi);
   }
   @RequestMapping(value = "/qihouManagement.do", method = { RequestMethod.POST, RequestMethod.GET })
   @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);
      List<tb_qihou> qihouManagementList = this.ZhwService.qihoucha(1);
      request.setAttribute("qihouManagementList", qihouManagementList);
      int curPage = 1;
      int count = ZhwService.getqihouManagementCount();
      int count = this.ZhwService.getqihouManagementCount();
      int minPage = PageUtil.getMinPage(count);
      request.setAttribute("pageList", PageUtil.getPage(minPage));
      request.setAttribute("curPage", curPage);
      request.setAttribute("curPage", Integer.valueOf(curPage));
      return toPage;
   }
   @RequestMapping(value = "/qihouManagement_add.do", method = { RequestMethod.POST, RequestMethod.GET })
   @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);
      this.ZhwService.qihouzeng(qihou);
   }
   @RequestMapping(value = "/qihouManagement_modify.do", method = { RequestMethod.POST, RequestMethod.GET })
   @ResponseBody
   @RequestMapping(value = {"/xiugaibiaoti.do"}, method = {RequestMethod.POST, RequestMethod.GET}
   )
   public int xiugaiBiaoTi() {
      return this.ZhwService.XiuGaiBiaoTi();
   }
   @ResponseBody
   @RequestMapping(value = {"/xiugaibiaoti1.do"}, method = {RequestMethod.POST, RequestMethod.GET}
   )
   public int xiugaiBiaoTi1() {
      return this.ZhwService.XiuGaiBiaoTi1();
   }
   @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");
@@ -864,103 +1677,95 @@
      qihou.setWeather(request.getParameter("weather"));
      qihou.setWd(request.getParameter("wd"));
      qihou.setSd(request.getParameter("sd"));
      ZhwService.qihougai(qihou);
      this.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();
//       // 修改标签同时需要修改tb_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 })
   @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);
      this.ZhwService.qihoudelete(checkVal);
   }
   @ResponseBody
   @RequestMapping(value = "/qihouManagement_deleteAll.do", method = { RequestMethod.POST, RequestMethod.GET })
   @RequestMapping(
         value = {"/qihouManagement_deleteAll.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   public void qihouManagement_deleteAll(HttpServletRequest request) {
      ZhwService.qihoudeleteAll();
      this.ZhwService.qihoudeleteAll();
   }
   @ResponseBody
   @RequestMapping(value = "/qihouManagement_export.do", method = { RequestMethod.POST, RequestMethod.GET })
   @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<tb_qihou> tb_qihouList = this.ZhwService.qihoucha();
      String[] rowName = new String[]{"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();
         OutputStream out = response.getOutputStream();
         excel.export(out);
         out.flush();
         out.close();
      } catch (Exception e) {
         e.printStackTrace();
      } catch (Exception var11) {
         var11.printStackTrace();
      }
      return toPage;
   }
   @ResponseBody
   @RequestMapping(value = "/qihouManagement_exportTemplate.do", method = { RequestMethod.POST, RequestMethod.GET })
   @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<tb_qihou> qihouTemplateList = this.ZhwService.qihoucha(1);
      String[] rowName = new String[]{"时间", "地点", "天气", "温度", "湿度"};
      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();
         OutputStream out = response.getOutputStream();
         excel.export(out);
         out.flush();
         out.close();
      } catch (Exception e) {
         e.printStackTrace();
      } catch (Exception var11) {
         var11.printStackTrace();
      }
      return toPage;
   }
   @ResponseBody
   @RequestMapping(value = "/qihouManagement_page.do", method = { RequestMethod.POST, RequestMethod.GET })
   @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 count = this.ZhwService.getqihouManagementCount();
      int minPage = PageUtil.getMinPage(count);
      int curPage = Integer.parseInt(curPageStr);
      int page = 1;
@@ -975,7 +1780,8 @@
      } else {
         page = Integer.parseInt(pageStr);
      }
      List<tb_qihou> qihouManagementList = ZhwService.qihoucha(page);
      List<tb_qihou> qihouManagementList = this.ZhwService.qihoucha(page);
      List<Integer> pageList = PageUtil.getPage(PageUtil.getLocPage(page, curPage), page, minPage);
      JSONObject json = new JSONObject();
      json.put("dataList", qihouManagementList);
@@ -983,93 +1789,102 @@
      json.put("curPage", page);
      return json.toString();
   }
   @RequestMapping(value = "/uploadqihou.do")
   @RequestMapping({"/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) {
         MultipartFile[] var7 = files;
         int var8 = files.length;
         for(int var9 = 0; var9 < var8; ++var9) {
            MultipartFile file = var7[var9];
            file.transferTo(new File(filePath + file.getOriginalFilename()));
            //System.out.print(file.getOriginalFilename());
         }
      } catch (IOException e) {
         e.printStackTrace();
      } catch (IOException var21) {
         var21.printStackTrace();
      }
      int result = 0;
      String path = filePath + filename;
      // 选取Excel文件得到工作薄
      Workbook workbook;
      int rows;
      int i;
      try {
         File file = new File(path);
         workbook = Workbook.getWorkbook(file);
         // 选择工作表,通过Workbook的getSheet方法选择第一个工作表(从0开始)
         Workbook workbook = Workbook.getWorkbook(file);
         Sheet sheet = workbook.getSheet(0);
         int rows = sheet.getRows();
         // 选择Cell,读取单元格 通过Sheet的getCell方法选择位置为C2的单元格(两个参数都从0开始)
         for (int i = 3; i < rows; i++) {
            // 读取信息,通过Cell的getContents方法读取单元格的值把单元格中的信息以字符的形式读取出来
            // String status = sheet.getCell(0, i).getContents();
         rows = sheet.getRows();
         for(i = 3; i < rows; ++i) {
            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);
            tb_qihou qihou = new tb_qihou();
            qihou.setTime(time);
            qihou.setPlace(place);
            qihou.setWeather(weather);
            qihou.setWd(wd);
            qihou.setSd(sd);
            result = this.ZhwService.qihouzeng(qihou);
         }
         // 释放资源
         workbook.close();
      } catch (BiffException e) {
         e.printStackTrace();
      } catch (IOException e) {
         e.printStackTrace();
      } catch (BiffException var19) {
         var19.printStackTrace();
      } catch (IOException var20) {
         var20.printStackTrace();
      }
      request.setAttribute("resultList", result);
      List<tb_qihou> qihouManagementList = ZhwService.qihoucha(1);
      List<tb_qihou> qihouManagementList = this.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);
      rows = this.ZhwService.getqihouManagementCount();
      i = PageUtil.getMinPage(rows);
      request.setAttribute("pageList", PageUtil.getPage(i));
      request.setAttribute("curPage", Integer.valueOf(curPage));
      File file = new File(path);
      file.delete();
      return toPage;
   }
   @RequestMapping(value="/getRealPositionsan.do", method = { RequestMethod.POST, RequestMethod.GET })
   @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) {
   public List<tb_realpositoin> getRealPositionsan(HttpServletRequest request) {
      long timeStart = 0L;
      List<tb_person> realLocationList = this.ZhwService.getpersonLocationsan();
      Iterator var5 = realLocationList.iterator();
      while(var5.hasNext()) {
         tb_person node = (tb_person)var5.next();
         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());
         Double xo = x / 100.0;
         Double yo = -y / 100.0;
         List<Double> xy = cal2(xo, yo);
         node.setP_x(((Double)xy.get(0)).toString());
         node.setP_y(((Double)xy.get(1)).toString());
      }
      List<tb_realpositoin> finalPositionList = new ArrayList<tb_realpositoin>();
      //根据每个tagid取tb_tag:[tag_id,state(静止1or运动0),power,status(在线1or离线0),addtime],放入tb_position中
      for (tb_person node : realLocationList) {
      List<tb_realpositoin> finalPositionList = new ArrayList();
      Iterator var13 = realLocationList.iterator();
      while(var13.hasNext()) {
         tb_person node = (tb_person)var13.next();
         String tagid = node.getP_tagid();
         tb_realpositoin position = new tb_realpositoin();
         position.setTagid(tagid);
@@ -1084,77 +1899,978 @@
         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 })
   @RequestMapping(
         value = {"/getRealPositionsan2.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   @ResponseBody
   public List<tb_realkaoqing> getkaoqinsan(HttpServletRequest request) {
      List<tb_realkaoqing> realkaoqingList = ZhwService.getkaoqinsan();
   public List<tb_realpositoin> getRealPositionsan2(HttpServletRequest request) {
      long timeStart = 0L;
      List<tb_person> realLocationList = this.ZhwService.getpersonLocationsan();
      List<tb_realpositoin> finalPositionList = new ArrayList();
      Iterator var6 = realLocationList.iterator();
      while(var6.hasNext()) {
         tb_person node = (tb_person)var6.next();
         double jiao = 0.0;
         if (this.persons.containsKey(node.getP_tagid())) {
            double x1 = Double.valueOf(node.getP_x());
            double y1 = Double.valueOf(node.getP_y());
            double x2 = Double.valueOf(((String[])this.persons.get(node.getP_tagid()))[0]);
            double y2 = Double.valueOf(((String[])this.persons.get(node.getP_tagid()))[1]);
            double c = x1 - x2;
            double a = y1 - y2;
            if (node.getBaoliu22() != null && node.getBaoliu22() != "") {
               if (node.getBaoliu22().equals("0")) {
                  jiao = Math.toDegrees(Math.atan2(c, a));
               } else {
                  String[] xy = node.getBaoliu23().split(",");
                  jiao = Math.toDegrees(Math.atan2(Double.valueOf(xy[0]), Double.valueOf(xy[1])));
               }
               if (String.valueOf(jiao).equals("0.0")) {
                  jiao = Double.valueOf(((String[])this.persons.get(node.getP_tagid()))[2]);
               }
            }
         }
         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.setSex(node.getP_sex());
         position.setMinzu(node.getP_minzu());
         position.setPhone(node.getP_phone());
         position.setBumen(node.getP_department());
         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());
         position.setJiao(String.valueOf(jiao));
         position.setBaoliu19(node.getBaoliu19());
         position.setBaoliu22(node.getBaoliu22());
         position.setBaoliu23(node.getBaoliu23());
         position.setBaoliu24(node.getBaoliu24());
         position.setBaoliu2(node.getP_jingdu());
         position.setBaoliu3(node.getP_weidu());
         String[] bb = new String[]{node.getP_x(), node.getP_y(), String.valueOf(jiao)};
         this.persons.put(node.getP_tagid(), bb);
         finalPositionList.add(position);
      }
      return finalPositionList;
   }
   @RequestMapping(
         value = {"/getRealPositionsanw.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   @ResponseBody
   public List<tb_realpositoin> getRealPositionsanw(HttpServletRequest request) {
      long timeStart = 0L;
      List<tb_person> realLocationList = this.ZhwService.getpersonLocationsan();
      List<tb_realpositoin> finalPositionList = new ArrayList();
      Iterator var6 = realLocationList.iterator();
      while(var6.hasNext()) {
         tb_person node = (tb_person)var6.next();
         String tagid = node.getP_tagid();
         tb_gps gps = this.gpsService.gettagidgps(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.setSex(node.getP_sex());
         position.setMinzu(node.getP_minzu());
         position.setPhone(node.getP_phone());
         position.setBumen(node.getP_department());
         position.setPosx(gps.getGps_weidu());
         position.setPosy(gps.getGsp_jingdu());
         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());
         position.setJiao("0");
         position.setBaoliu19(node.getBaoliu19());
         position.setBaoliu22(node.getBaoliu22());
         position.setBaoliu23(node.getBaoliu23());
         position.setBaoliu24(node.getBaoliu24());
         finalPositionList.add(position);
      }
      return finalPositionList;
   }
   @RequestMapping(
         value = {"/getRealPositionsan3.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   @ResponseBody
   public List<tb_realpositoin> getRealPositionsan3(HttpServletRequest request) {
      long timeStart = 0L;
      String floor = request.getParameter("floor");
      List<tb_person> realLocationList = this.ZhwService.getpersonLocationsan3(floor);
      List<tb_realpositoin> finalPositionList = new ArrayList();
      Iterator var7 = realLocationList.iterator();
      while(var7.hasNext()) {
         tb_person node = (tb_person)var7.next();
         double jiao = 0.0;
         if (this.persons.containsKey(node.getP_tagid())) {
            double x1 = Double.valueOf(node.getP_x());
            double y1 = Double.valueOf(node.getP_y());
            double x2 = Double.valueOf(((String[])this.persons.get(node.getP_tagid()))[0]);
            double y2 = Double.valueOf(((String[])this.persons.get(node.getP_tagid()))[1]);
            double c = x1 - x2;
            double a = y1 - y2;
            if (node.getBaoliu22().equals("0")) {
               jiao = Math.toDegrees(Math.atan2(c, a));
            } else {
               String[] xy = node.getBaoliu23().split(",");
               jiao = Math.toDegrees(Math.atan2(Double.valueOf(xy[0]), Double.valueOf(xy[1])));
            }
            if (String.valueOf(jiao).equals("0.0")) {
               jiao = Double.valueOf(((String[])this.persons.get(node.getP_tagid()))[2]);
            }
         }
         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.setSex(node.getP_sex());
         position.setMinzu(node.getP_minzu());
         position.setPhone(node.getP_phone());
         position.setBumen(node.getP_department());
         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());
         position.setJiao(String.valueOf(jiao));
         position.setBaoliu22(node.getBaoliu22());
         position.setBaoliu23(node.getBaoliu23());
         position.setBaoliu24(node.getBaoliu24());
         String[] bb = new String[]{node.getP_x(), node.getP_y(), String.valueOf(jiao)};
         this.persons.put(node.getP_tagid(), bb);
         finalPositionList.add(position);
      }
      return finalPositionList;
   }
   public double qiujiao(int a, int b, int c) {
      double angle = 0.0;
      if (a + b - c != 0) {
         angle = Math.toDegrees(Math.acos((double)((a * a + b * b - c * c) / (2 * a * b))));
      }
      return angle;
   }
   @RequestMapping(value = {"/getRealPositionsana.do"}, method = {RequestMethod.POST, RequestMethod.GET})
   @ResponseBody
   public JSONObject getRealPositionsana(HttpServletRequest request) {
      long timeStart = 0L;
      JSONObject json = new JSONObject();
      List<tb_person> realLocationList = this.ZhwService.getpersonLocationsan2();
      List<tb_realpositoin> finalPositionList = new ArrayList();
      Iterator var7 = realLocationList.iterator();
      while(var7.hasNext()) {
         tb_person node = (tb_person)var7.next();
         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.setIdcardnum(node.getP_idcardnum());
         position.setPosx(node.getP_x());
         position.setPosy(node.getP_y());
         position.setFloor(node.getP_floor());
         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());
         position.setFangkeid(node.getP_fangkeid());
         position.setJingdu(node.getP_jingdu());
         position.setWeidu(node.getP_weidu());
         position.setGaocheng(node.getP_gaocheng());
         position.setPhone(node.getP_phone());
         position.setType(node.getP_type());
         finalPositionList.add(position);
      }
      json.put("dataList", finalPositionList);
      return json;
   }
   @RequestMapping(
         value = {"/getkaoqinsan.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   @ResponseBody
   public List<tb_realkaoqing> getkaoqinsan(HttpServletRequest request) {
      List<tb_realkaoqing> realkaoqingList = this.ZhwService.getkaoqinsan();
      return realkaoqingList;
   }
   @RequestMapping(value = "/xiafazhendong.do", method = { RequestMethod.POST, RequestMethod.GET })
   @RequestMapping(
         value = {"/xiafazhendong.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   public void xiafazhendong(HttpServletRequest request) throws IOException {
      String tagid=request.getParameter("tagid");
      String xieyi = "55BB,TAG_SHAKE,10,"+tagid+",END";
      String tagid = request.getParameter("tagid");
      String xieyi = "55BB,TAG_SHAKE,10," + tagid + ",END";
      Udp_Out.udp_to_cs(xieyi);
   }
   @RequestMapping({"bofang.do"})
   public void shangchuan2(HttpServletRequest request) {
      String name = request.getParameter("name");
      List<tb_shipin> shipins = this.fenceService.searchshipinManagement(name);
      String yonghuming = ((tb_shipin)shipins.get(0)).getYonghuming();
      String mima = ((tb_shipin)shipins.get(0)).getMima();
      String ipdizhi = ((tb_shipin)shipins.get(0)).getBaoliu1();
      String ffmpegPath = "E:\\ffmpeg\\ffmpeg-4.4-essentials_build\\bin\\";
      try {
         String command = ffmpegPath + "ffmpeg -rtsp_transport tcp";
         command = command + " -i \"rtsp://" + yonghuming + ":" + mima + "@" + ipdizhi + ":554/Streaming/Channels/102\"";
         command = command + " -q 0 -f mpegts -codec:v mpeg1video -s 1280x720 http://127.0.0.1:8081/123456";
         System.out.println("ffmpeg推流命令:" + command);
         this.process = Runtime.getRuntime().exec(command);
         BufferedReader br = new BufferedReader(new InputStreamReader(this.process.getErrorStream()));
         String line = "";
         while((line = br.readLine()) != null) {
            System.out.println("视频推流信息[" + line + "]");
         }
         int flag = this.process.waitFor();
      } catch (Exception var12) {
         var12.printStackTrace();
      }
   }
   @RequestMapping({"tingzhibofang.do"})
   public void tingzhibofang() {
      this.process.destroy();
   }
   @RequestMapping(
         value = {"jingweijuli.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   public String tojisuan(HttpServletRequest request, HttpServletResponse response) {
      String toPage = "forward:/hxzk/basicInfo/jisuan.jsp";
      List<tb_jingwei> findjingwei = this.ZhwService.getjingwei();
      request.setAttribute("dataList", findjingwei);
      System.out.println(toPage + "1111111111111111111111111111111111111111111");
      return toPage;
   }
   @ResponseBody
   @RequestMapping(
         value = {"jisuanjingwei.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   public JSONObject jisuanjingwei(String str) {
      JSONObject json = new JSONObject();
      String disab = disab(str);
      String[] split = str.split(";");
      String qishi = split[1] + "/" + split[0];
      String zhongzhi = split[3] + "/" + split[2];
      tb_jingwei jingwei = new tb_jingwei();
      SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
      String format = simpleDateFormat.format(new Date());
      jingwei.setQishi(qishi);
      jingwei.setZhongzhi(zhongzhi);
      jingwei.setJieguo(disab);
      jingwei.setAddtime(format);
      this.ZhwService.addjingwei(jingwei);
      List<tb_jingwei> findjingwei = this.ZhwService.getjingwei();
      json.put("jieguo", disab);
      json.put("dataList", findjingwei);
      return json;
   }
   @ResponseBody
   @RequestMapping(
         value = {"jisuanjingwei2.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   public JSONObject jisuanjingwei2(String str) {
      JSONObject json = new JSONObject();
      String[] split = str.split(";");
      double[] sy = gpstodu(split[1], split[0]);
      String str2 = sy[1] + ";" + sy[0];
      json.put("jieguo", str2);
      return json;
   }
   @ResponseBody
   @RequestMapping(
         value = {"jisuanjingwei3.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   public JSONObject jisuanjingwei3(HttpServletRequest request) {
      JSONObject json = new JSONObject();
      String qidian = request.getParameter("qidian");
      String zhongdian = request.getParameter("zhongdian");
      String[] qidians = qidian.split(",");
      String[] zhongdians = zhongdian.split(",");
      String str = qidians[2] + ";" + qidians[4] + ";" + zhongdians[2] + ";" + zhongdians[4];
      String disab = disab(str);
      String[] split = str.split(";");
      String qishi = split[1] + "/" + split[0];
      String zhongzhi = split[3] + "/" + split[2];
      tb_jingwei jingwei = new tb_jingwei();
      SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
      String format = simpleDateFormat.format(new Date());
      jingwei.setQishi(qishi);
      jingwei.setZhongzhi(zhongzhi);
      jingwei.setJieguo(disab);
      jingwei.setAddtime(format);
      this.ZhwService.addjingwei(jingwei);
      List<tb_jingwei> findjingwei = this.ZhwService.getjingwei();
      json.put("jieguo", disab);
      json.put("dataList", findjingwei);
      return json;
   }
   @ResponseBody
   @RequestMapping(
         value = {"/startjob.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   public String startjob(HttpServletRequest request) {
      List<tb_fence> fences = this.fenceService.getFenceLista();
      for(int i = 0; i < fences.size(); ++i) {
         tb_jobhistory job = new tb_jobhistory();
         job.setFencename(((tb_fence)fences.get(i)).getName());
         job.setDepartment(((tb_fence)fences.get(i)).getBumen());
         job.setTagid(((tb_fence)fences.get(i)).getBaoliu2());
         job.setHigh(((tb_fence)fences.get(i)).getBaoliu1());
         job.setFenceaddtime(((tb_fence)fences.get(i)).getAddtime());
         job.setType("开始作业");
         job.setBeizhu("");
         this.fenceService.zuoyeadd(job);
      }
      String xieyi = "BSTOCS1,WORK,START,END";
      Udp_Out.udp_to_cs(xieyi);
      return "1";
   }
   @ResponseBody
   @RequestMapping(
         value = {"/endjob.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   public String endjob(HttpServletRequest request) {
      List<tb_fence> fences = this.fenceService.getFenceLista();
      for(int i = 0; i < fences.size(); ++i) {
         tb_jobhistory job = new tb_jobhistory();
         job.setFencename(((tb_fence)fences.get(i)).getName());
         job.setDepartment(((tb_fence)fences.get(i)).getBumen());
         job.setTagid(((tb_fence)fences.get(i)).getBaoliu2());
         job.setHigh(((tb_fence)fences.get(i)).getBaoliu1());
         job.setFenceaddtime(((tb_fence)fences.get(i)).getAddtime());
         job.setType("结束作业");
         job.setBeizhu("");
         this.fenceService.zuoyeadd(job);
      }
      String xieyi = "BSTOCS1,WORK,STOP,END";
      Udp_Out.udp_to_cs(xieyi);
      return "1";
   }
   @ResponseBody
   @RequestMapping(
         value = {"/suspendjob.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   public String suspendjob(HttpServletRequest request) {
      List<tb_fence> fences = this.fenceService.getFenceLista();
      for(int i = 0; i < fences.size(); ++i) {
         tb_jobhistory job = new tb_jobhistory();
         job.setFencename(((tb_fence)fences.get(i)).getName());
         job.setDepartment(((tb_fence)fences.get(i)).getBumen());
         job.setTagid(((tb_fence)fences.get(i)).getBaoliu2());
         job.setHigh(((tb_fence)fences.get(i)).getBaoliu1());
         job.setFenceaddtime(((tb_fence)fences.get(i)).getAddtime());
         job.setType("暂停作业");
         job.setBeizhu("");
         this.fenceService.zuoyeadd(job);
      }
      String xieyi = "BSTOCS1,WORK,PAUSE,END";
      Udp_Out.udp_to_cs(xieyi);
      return "1";
   }
   @ResponseBody
   @RequestMapping(
         value = {"/getzuoye.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   public JSONObject getzuoye(HttpServletRequest request) {
      JSONObject json = new JSONObject();
      List<tb_jobhistory> tb_jobhistorys = this.fenceService.getzuoye();
      json.put("dataList", tb_jobhistorys);
      return json;
   }
   @ResponseBody
   @RequestMapping(
         value = {"/jobexport.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   public String jobexport(HttpServletRequest request, HttpServletResponse response) {
      List<tb_jobhistory> tb_jobhistorys = this.fenceService.getzuoye();
      String[] rowName = new String[]{"序号", "操作步骤", "围栏名称", "关联部门", "关联标签", "围栏高度", "围栏绘制时间", "记录时间", "备注"};
      List<Object[]> dataList = objectToArray_job(tb_jobhistorys);
      ExcelUtils excel = new ExcelUtils("作业历史", rowName, dataList);
      String fileName = "";
      try {
         fileName = "Excel-" + String.valueOf(System.currentTimeMillis()).substring(4, 13) + ".xls";
         String filePath2 = request.getServletContext().getRealPath("/") + "hxzk/image/excels/" + fileName;
         OutputStream out = new FileOutputStream(filePath2);
         excel.export(out);
         out.flush();
         out.close();
      } catch (Exception var10) {
         var10.printStackTrace();
      }
      return fileName;
   }
   @RequestMapping(
         value = {"/tiaozhuanfa.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   public String tiaozhuanfa(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
      String floor = request.getParameter("floor");
      String toPage = "forward:/hxzk/mapshow/mapShowfa.jsp";
      request.setAttribute("floor", floor);
      return toPage;
   }
   @ResponseBody
   @RequestMapping(
         value = {"/getmessagea.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   public String getmessagea(HttpServletRequest request) {
      JSONObject json = new JSONObject();
      List<tb_message> messages = this.ZhwService.getmessage();
      Date date = new Date();
      SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
      Calendar cal = Calendar.getInstance();
      cal.setTime(date);
      cal.add(5, -3);
      String date2 = simpleDateFormat.format(cal.getTime());
      this.ZhwService.deletemessage(date2);
      json.put("dataList", messages);
      return json.toString();
   }
   @RequestMapping(
         value = {"/sendmessage.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   public void sendmessage(HttpServletRequest request) {
      HttpSession session = request.getSession();
      ServletContext application = session.getServletContext();
      String username = application.getAttribute("username").toString();
      String arr = request.getParameter("arr");
      String message = request.getParameter("message");
      int i;
      String xieyi;
      if (arr.equals("all")) {
         List<tb_person> persons = this.ZhwService.getbumen();
         for(i = 0; i < persons.size(); ++i) {
            xieyi = "BSTOCS1,TOMESSAGE," + ((tb_person)persons.get(i)).getP_tagid() + "," + message + "," + username + ",END";
            Udp_Out.udp_to_cs(xieyi);
         }
      } else {
         String[] tagids = arr.split(",");
         for(i = 0; i < tagids.length; ++i) {
            xieyi = "BSTOCS1,TOMESSAGE," + tagids[i] + "," + message + "," + username + ",END";
            Udp_Out.udp_to_cs(xieyi);
         }
      }
   }
   @ResponseBody
   @RequestMapping(
         value = {"getlixiana.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   public String getlixiana() {
      String pan = this.ZhwService.getlixian();
      SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
      String date = sf.format(new Date());
      int aaa = get_time_cha_s(date, pan);
      String bbb = "";
      if (aaa < 20) {
         bbb = "true";
      } else {
         bbb = "false";
      }
      return bbb;
   }
   @RequestMapping(
         value = {"updateexe.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   public void tiaoguo(HttpServletResponse response, HttpServletRequest request) {
      String url = "file:///D:\\eclipseworkspace\\定位引擎软件\\定位引擎软件.rar";
      try {
         response.setHeader("Content-Disposition", "attachment;filename=\"" + URLEncoder.encode("定位平台软件.rar", "UTF-8") + "\"");
         response.setContentType("APPLICATION/OCTET-STREAM");
         BufferedInputStream in = new BufferedInputStream((new URL(url)).openStream());
         BufferedOutputStream out = new BufferedOutputStream(response.getOutputStream());
         byte[] dataBuffer = new byte[1024];
         int bytesRead;
         while((bytesRead = in.read(dataBuffer, 0, 1024)) != -1) {
            out.write(dataBuffer, 0, bytesRead);
         }
         out.flush();
      } catch (IOException var8) {
         var8.printStackTrace();
      }
   }
   @RequestMapping(
         value = {"todownload.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   public String todownload(HttpServletRequest request) {
      String toPage = "forward:/hxzk/gujian/download.html";
      return toPage;
   }
   @RequestMapping(
         value = {"download.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   public String download(HttpServletRequest request, HttpServletResponse response) {
      String toPage = "forward:/hxzk/gujian/download.html";
      String filename = request.getParameter("name");
      String filepath = "D:\\gujian\\";
      File file = new File(filepath + filename);
      try {
         response.setHeader("Content-Disposition", "attachment;filename=\"" + URLEncoder.encode(filename, "UTF-8") + "\"");
         response.setContentType("APPLICATION/OCTET-STREAM");
         FileInputStream ina = new FileInputStream(file);
         BufferedInputStream in = new BufferedInputStream(ina);
         BufferedOutputStream out = new BufferedOutputStream(response.getOutputStream());
         int len;
         while((len = in.read()) != -1) {
            out.write(len);
         }
         out.flush();
         out.close();
         in.close();
      } catch (Exception var11) {
         var11.printStackTrace();
      }
      return toPage;
   }
   @RequestMapping(
         value = {"/mapdisplay.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   public String mapdisplay(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
      String toPage = "forward:/hxzk/mapdisplay/mapdisplay.jsp";
      return toPage;
   }
   @RequestMapping(
         value = {"/tomap.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   public String tomap(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
      String toPage = "forward:/hxzk/mapshow/mapShowfeng3.jsp";
      return toPage;
   }
   public static int get_time_cha_s(String a, String b) {
      String yyyyMMddHHmmss = "yyyy-MM-dd HH:mm:ss";
      Date date1 = parseDateByPattern(a, "yyyy-MM-dd HH:mm:ss");
      Date date2 = parseDateByPattern(b, "yyyy-MM-dd HH:mm:ss");
      return getTimeDelta(date1, date2);
   }
   public static Date parseDateByPattern(String dateStr, String dateFormat) {
      SimpleDateFormat sdf = new SimpleDateFormat(dateFormat);
      try {
         return sdf.parse(dateStr);
      } catch (ParseException var4) {
         var4.printStackTrace();
         return null;
      }
   }
   public static int getTimeDelta(Date date1, Date date2) {
      long timeDelta = (date1.getTime() - date2.getTime()) / 1000L;
      int secondsDelta = timeDelta > 0L ? (int)timeDelta : (int)Math.abs(timeDelta);
      return secondsDelta;
   }
   public static int get_time_cha_HMS(String a, String b) {
      String HHmmss = "HH:mm:ss";
      Date date1 = parseDateByPattern(a, "HH:mm:ss");
      Date date2 = parseDateByPattern(b, "HH:mm:ss");
      return getTimeDelta(date1, date2);
   }
   public static boolean shijiancha(String time, int p) {
      boolean a = false;
      int b = get_time_cha_s(GetNowTime.now(), time);
      if (b > p) {
         a = true;
      }
      return a;
   }
   public static List<Object[]> objectToArray_job(List<tb_jobhistory> history_powerList) {
      List<Object[]> reList = new ArrayList();
      for(int i = 0; i < history_powerList.size(); ++i) {
         List<String> words = new ArrayList();
         tb_jobhistory history_power = (tb_jobhistory)history_powerList.get(i);
         words.add(history_power.getId() + "");
         words.add(history_power.getType());
         words.add(history_power.getFencename());
         words.add(history_power.getDepartment());
         words.add(history_power.getTagid());
         words.add(history_power.getHigh());
         words.add(history_power.getFenceaddtime());
         words.add(history_power.getAddtime());
         words.add(history_power.getBeizhu());
         String[] array = (String[])words.toArray(new String[0]);
         reList.add(array);
      }
      return reList;
   }
   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);
      List<Object[]> reList = new ArrayList();
      for(int i = 0; i < tb_qihouList.size(); ++i) {
         List<String> words = new ArrayList();
         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]);
         String[] array = (String[])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;
   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();
         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 = (String[])words.toArray(new String[0]);
         reList.add(array);
      }
      /**
        * 以K0 + 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;
       }
      return reList;
   }
   private static List<Double> cal2(double px, double py) {
      double mx1 = 1.27383942203293E7;
      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();
      xy.add(mx);
      xy.add(my);
      return xy;
   }
   public static boolean isInPolygon(Point2D.Double point, List<Point2D.Double> pts) {
      int N = pts.size();
      boolean boundOrVertex = true;
      int intersectCount = 0;
      double precision = 2.0E-10;
      Point2D.Double p = point;
      Point2D.Double p1 = (Point2D.Double)pts.get(0);
      for(int i = 1; i <= N; ++i) {
         if (p.equals(p1)) {
            return boundOrVertex;
         }
         Point2D.Double p2 = (Point2D.Double)pts.get(i % N);
         if (!(p.x < Math.min(p1.x, p2.x)) && !(p.x > Math.max(p1.x, p2.x))) {
            if (p.x > Math.min(p1.x, p2.x) && p.x < Math.max(p1.x, p2.x)) {
               if (p.y <= Math.max(p1.y, p2.y)) {
                  if (p1.x == p2.x && p.y >= Math.min(p1.y, p2.y)) {
                     return boundOrVertex;
                  }
                  if (p1.y == p2.y) {
                     if (p1.y == p.y) {
                        return boundOrVertex;
                     }
                     ++intersectCount;
                  } else {
                     double xinters = (p.x - p1.x) * (p2.y - p1.y) / (p2.x - p1.x) + p1.y;
                     if (Math.abs(p.y - xinters) < precision) {
                        return boundOrVertex;
                     }
                     if (p.y < xinters) {
                        ++intersectCount;
                     }
                  }
               }
            } else if (p.x == p2.x && p.y <= p2.y) {
               Point2D.Double p3 = (Point2D.Double)pts.get((i + 1) % N);
               if (p.x >= Math.min(p1.x, p3.x) && p.x <= Math.max(p1.x, p3.x)) {
                  ++intersectCount;
               } else {
                  intersectCount += 2;
               }
            }
            p1 = p2;
         } else {
            p1 = p2;
         }
      }
      if (intersectCount % 2 == 0) {
         return false;
      } else {
         return true;
      }
   }
   public static String todu(String strs) {
      int i = strs.indexOf(46);
      String strDu = strs.substring(0, i);
      String strFen = "";
      String strMiao = "";
      if (i > 0) {
         Float fen = Float.parseFloat(strs.substring(i));
         strFen = Float.toString(fen * 60.0F);
         i = strFen.indexOf(46);
         if (i > 0) {
            Float miao = Float.parseFloat(strFen.substring(i));
            strFen = strFen.substring(0, i);
            strMiao = Float.toString(miao * 60.0F);
            i = strMiao.indexOf(46);
            strMiao = strMiao.substring(0, i + 4);
            strMiao = String.format("%.2f", Float.parseFloat(strMiao));
         }
      }
      String Du = strDu + strFen + strMiao;
      return Du;
   }
   public static String disab(String jwd) {
      DecimalFormat df = new DecimalFormat("0.00");
      String[] bb = jwd.split(";");
      double jd0 = Double.parseDouble(bb[1]);
      double wd0 = Double.parseDouble(bb[0]);
      double jd1 = Double.parseDouble(bb[3]);
      double wd1 = Double.parseDouble(bb[2]);
      double[] a = run_gps2xyurt(wd0, jd0, wd1, jd1);
      double disa = a[0] * a[0] + a[1] * a[1];
      double dis = Math.sqrt(Math.abs(disa)) * 100.0;
      String temp = df.format(dis);
      System.out.println(jwd + "的距离是:" + temp);
      return temp;
   }
   public static double[] run_gps2xyurt(double lat0, double lon0, double lat, double lon) {
      int[] realxy = new int[2];
      double[] xycs = initiize_ublox_zeropoint(lat0, lon0, 0.0);
      double x0 = xycs[0];
      double y0 = xycs[1];
      double c = xycs[2];
      double s = xycs[3];
      double[] xy = new double[2];
      double x = ubloxraw2xy(lat, lon)[0] - x0;
      double y = ubloxraw2xy(lat, lon)[1] - y0;
      xy[0] = c * x - s * y;
      xy[1] = s * x + c * y;
      return xy;
   }
   public static double[] initiize_ublox_zeropoint(double lat, double lon, double th) {
      double[] xycs = new double[]{ubloxraw2xy(lat, lon)[0], ubloxraw2xy(lat, lon)[1], 0.0, 0.0};
      double th1 = th * Math.PI / 180.0;
      xycs[2] = Math.cos(th1);
      xycs[3] = Math.sin(th1);
      return xycs;
   }
   public static double[] ubloxraw2xy(double lat, double lon) {
      double[] xy = new double[3];
      double lond = ublox_dm2d(lon);
      double latd = ublox_dm2d(lat);
      double[] dxy = utm(latd, lond);
      xy[0] = dxy[0] * 1000.0;
      xy[1] = dxy[1] * 1000.0;
      xy[2] = dxy[2];
      return xy;
   }
   public static double ublox_dm2d(double ddmm_dot_m) {
      double d0 = Math.floor(ddmm_dot_m / 100.0);
      double d = d0 + (ddmm_dot_m - d0 * 100.0) / 60.0;
      return d;
   }
   public static double[] utm(double lat, double lon) {
      double[] dxy = new double[3];
      double zonenum1 = lon / 6.0;
      if (zonenum1 > 0.0) {
         zonenum1 = Math.floor(zonenum1);
      } else {
         zonenum1 = Math.ceil(zonenum1);
      }
      double Zonenum = zonenum1 + 31.0;
      double lambda0 = ((Zonenum - 1.0) * 6.0 - 180.0 + 3.0) * Math.PI / 180.0;
      double phi = lat * Math.PI / 180.0;
      double lambda = lon * Math.PI / 180.0;
      double v = 1.0 / Math.sqrt(1.0 - e2 * Math.pow(Math.sin(phi), 2.0));
      double A = (lambda - lambda0) * Math.cos(phi);
      double A2 = A * A;
      double A3 = A2 * A;
      double A4 = A3 * A;
      double A5 = A4 * A;
      double A6 = A5 * A;
      double T = Math.tan(phi) * Math.tan(phi);
      double T2 = T * T;
      double C = e2 * Math.cos(phi) * Math.cos(phi) / (1.0 - e2);
      double C2 = C * C;
      double s = (1.0 - e2 / 4.0 - 3.0 * e4 / 64.0 - 5.0 * e6 / 256.0) * phi - (3.0 * e2 / 8.0 + 3.0 * e4 / 32.0 + 45.0 * e6 / 1024.0) * Math.sin(2.0 * phi) + (15.0 * e4 / 256.0 + 45.0 * e6 / 1024.0) * Math.sin(4.0 * phi) - 35.0 * e6 / 3072.0 * Math.sin(6.0 * phi);
      dxy[0] = E0 + k0 * a * v * (A + (1.0 - T + C) * A3 / 6.0 + (5.0 - 18.0 * T + T2) * A5 / 120.0);
      dxy[1] = N0 + k0 * a * (s + v * Math.tan(phi) * (A2 / 2.0 + (5.0 - T + 9.0 * C + 4.0 * C2) * A4 / 24.0 + (61.0 - 58.0 * T + T2) * A6 / 720.0));
      dxy[2] = Zonenum;
      return dxy;
   }
   public static String todufen(String Du, String Fen, String Miao) {
      Float strDu = Float.valueOf(Du);
      Float strFen = Float.valueOf(Fen) / 60.0F;
      Float strMiao = Float.valueOf(Miao) / 60.0F;
      Float dufenmiao = strDu + strFen + strMiao;
      String format = String.format("%.6f", dufenmiao);
      return format;
   }
   public static double[] gpstodu(String gps_weidu, String gps_jingdu) {
      double[] a = new double[]{0.0, 0.0};
      String weidu = todufen(gps_weidu.substring(0, 2), gps_weidu.substring(2, 4), gps_weidu.substring(4));
      String jingdu = todufen(gps_jingdu.substring(0, 3), gps_jingdu.substring(3, 5), gps_jingdu.substring(5));
      a[0] = Double.parseDouble(weidu);
      a[1] = Double.parseDouble(jingdu);
      return a;
   }
   @ResponseBody
   @RequestMapping(value = {"MianLogin.do"}, method = {RequestMethod.POST, RequestMethod.GET})
   public List mianLogin() {
      List login = this.ZhwService.MianLogin();
      return login;
   }
//
   static {
      e2 = e * e;
      e4 = e2 * e2;
      e6 = e4 * e2;
      E0 = 500.0;
      N0 = 0.0;
      floor = "0";
      lat_a = 0.0;
      lon_a = 0.0;
      lon_b = 0.0;
      lat_b = 0.0;
      xa = 0.0;
      ya = 0.0;
      xb = 0.0;
      yb = 0.0;
      k = 0;
      sizes = 2;
      xycs = null;
   }
}