yzt
2023-05-08 24e1c6a1c3d5331b5a4f1111dcbae3ef148eda1a
src/main/java/com/hxzkoa/controller/FenceController.java
@@ -1,34 +1,15 @@
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//
package com.hxzkoa.controller;
import java.io.IOException;
import java.io.OutputStream;
import java.math.BigDecimal;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
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.ResponseBody;
import com.hxzkoa.json.tb_achor;
import com.hxzkoa.json.tb_anchor_nearby;
import com.hxzkoa.json.tb_department;
import com.hxzkoa.json.tb_fence;
import com.hxzkoa.json.tb_fence2;
import com.hxzkoa.json.tb_map;
import com.hxzkoa.json.tb_shipin;
import com.hxzkoa.json.tb_system;
import com.hxzkoa.json.tb_tag;
import com.hxzkoa.json.tb_tongbuanchor;
import com.hxzkoa.json.tb_xunjianbaobiao;
import com.hxzkoa.json.tb_xunjianset;
import com.hxzkoa.services.AttendanceService;
@@ -39,14 +20,28 @@
import com.hxzkoa.services.ZhwService;
import com.hxzkoa.udp.GetNowTime;
import com.hxzkoa.udp.Udp_Out;
/*import com.hxzkoa.udp.Udp_Receive;*/
import com.hxzkoa.util.Config;
import com.hxzkoa.util.ExcelUtils;
import com.hxzkoa.util.ModifyConfig;
import com.hxzkoa.util.PageUtil;
import com.hxzkoa.util.RequestUtils;
import java.io.IOException;
import java.io.OutputStream;
import java.math.BigDecimal;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import net.sf.json.JSONObject;
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.ResponseBody;
@Controller
public class FenceController {
@@ -63,172 +58,221 @@
   @Autowired
   private AttendanceService attendanceService;
   @RequestMapping(value = "/fenceList.do", method = { RequestMethod.POST, RequestMethod.GET })
   public FenceController() {
   }
   @RequestMapping(value = {"/fenceList.do"}, method = {RequestMethod.POST, RequestMethod.GET}
   )
   public String fenceList(HttpServletRequest request) throws ParseException {
      String toPage = "forward:/hxzk/fence/fenceList.jsp";
      List<tb_fence> fenceList = fenceService.getFenceList();
      List<tb_fence> fenceList = this.fenceService.getFenceList();
      request.setAttribute("fenceList", fenceList);
      List<tb_department> department = basicInfoService.getAllDepartmentManagement();
      List<tb_department> department = this.basicInfoService.getAllDepartmentManagement();
      request.setAttribute("department", department);
      return toPage;
   }
   @ResponseBody
   @RequestMapping(value = "/fenceLista.do", method = { RequestMethod.POST, RequestMethod.GET })
   @RequestMapping(
         value = {"/fenceLista.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   public JSONObject fenceLista(HttpServletRequest request) throws ParseException {
      JSONObject json = new JSONObject();
      List<tb_fence2> fenceList = fenceService.getFenceListaaa();
      List<tb_fence2> fenceList = this.fenceService.getFenceListaaa();
      if (fenceList.size() > 0) {
         double xmaxz = Double.parseDouble(fenceList.get(0).getZuobiao()[0].split(",")[0]);
         double ymaxz = Double.parseDouble(fenceList.get(0).getZuobiao()[0].split(",")[1]);
         double xminz = Double.parseDouble(fenceList.get(0).getZuobiao()[0].split(",")[0]);
         double yminz = Double.parseDouble(fenceList.get(0).getZuobiao()[0].split(",")[1]);
         for(int i = 0; i < fenceList.size(); i++) {
            Map<BigDecimal,BigDecimal> bigDecimals = new HashMap<>();
            String[] aaa = fenceList.get(i).getZuobiao();
            for(int j = 0; j < aaa.length; j++) {
               String[] bbb = aaa[j].split(",");
               bigDecimals.put(new BigDecimal(bbb[0]),new BigDecimal(bbb[1]));
         double xmaxz = Double.parseDouble(((tb_fence2)fenceList.get(0)).getZuobiao()[0].split(",")[0]);
         double ymaxz = Double.parseDouble(((tb_fence2)fenceList.get(0)).getZuobiao()[0].split(",")[1]);
         double xminz = Double.parseDouble(((tb_fence2)fenceList.get(0)).getZuobiao()[0].split(",")[0]);
         double yminz = Double.parseDouble(((tb_fence2)fenceList.get(0)).getZuobiao()[0].split(",")[1]);
         int i;
         for(i = 0; i < fenceList.size(); ++i) {
            Map<BigDecimal, BigDecimal> bigDecimals = new HashMap();
            String[] aaa = ((tb_fence2)fenceList.get(i)).getZuobiao();
            String[] zuobiaos;
            for(int j = 0; j < aaa.length; ++j) {
               zuobiaos = aaa[j].split(",");
               bigDecimals.put(new BigDecimal(zuobiaos[0]), new BigDecimal(zuobiaos[1]));
            }
            String vvv = getPoint(bigDecimals);
            fenceList.get(i).setCenterpoint(vvv);
            String[] zuobiaos = fenceList.get(i).getZuobiao();
            ((tb_fence2)fenceList.get(i)).setCenterpoint(vvv);
            zuobiaos = ((tb_fence2)fenceList.get(i)).getZuobiao();
            double xmax = Double.parseDouble(zuobiaos[0].split(",")[0]);
            double ymax = Double.parseDouble(zuobiaos[0].split(",")[1]);
            double xmin = Double.parseDouble(zuobiaos[0].split(",")[0]);
            double ymin = Double.parseDouble(zuobiaos[0].split(",")[1]);
            for (int j = 0;j < zuobiaos.length; j++) {
            for(int j = 0; j < zuobiaos.length; ++j) {
               String[] zuobiao = zuobiaos[j].split(",");
               if (Double.parseDouble(zuobiao[0]) > xmax) {
                  xmax = Double.parseDouble(zuobiao[0]);
               }
               if (Double.parseDouble(zuobiao[1]) > ymax) {
                  ymax = Double.parseDouble(zuobiao[1]);
               }
               if (Double.parseDouble(zuobiao[0]) < xmin) {
                  xmin = Double.parseDouble(zuobiao[0]);
               }
               if (Double.parseDouble(zuobiao[1]) < ymin) {
                  ymin = Double.parseDouble(zuobiao[1]);
               }
            }
            if (xmax > xmaxz) {
               xmaxz = xmax;
            }
            if (ymax > ymaxz) {
               ymaxz = ymax;
            }
            if (xmin < xminz) {
               xminz = xmin;
            }
            if (ymin < yminz) {
               yminz = ymin;
            }
         }
         for (int i = 0; i < fenceList.size(); i++) {
            fenceList.get(i).setMax(xmaxz+","+ymaxz);
            fenceList.get(i).setMin(xminz+","+yminz);
         for(i = 0; i < fenceList.size(); ++i) {
            ((tb_fence2)fenceList.get(i)).setMax(xmaxz + "," + ymaxz);
            ((tb_fence2)fenceList.get(i)).setMin(xminz + "," + yminz);
         }
      }
      json.put("dataList", fenceList);
      return json;
   }
   @ResponseBody
   @RequestMapping(value = "/findidfence.do", method = { RequestMethod.POST, RequestMethod.GET })
   @RequestMapping(
         value = {"/findidfence.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   public JSONObject findidfence(HttpServletRequest request) throws ParseException {
      JSONObject json = new JSONObject();
      List<tb_fence2> fenceList = fenceService.getFenceListm();
      List<tb_fence2> fenceList = this.fenceService.getFenceListm();
      if (fenceList.size() > 0) {
         double xmaxz = Double.parseDouble(fenceList.get(0).getZuobiao()[0].split(",")[0]);
         double ymaxz = Double.parseDouble(fenceList.get(0).getZuobiao()[0].split(",")[1]);
         double xminz = Double.parseDouble(fenceList.get(0).getZuobiao()[0].split(",")[0]);
         double yminz = Double.parseDouble(fenceList.get(0).getZuobiao()[0].split(",")[1]);
         for(int i = 0; i < fenceList.size(); i++) {
            Map<BigDecimal,BigDecimal> bigDecimals = new HashMap<>();
            String[] aaa = fenceList.get(i).getZuobiao();
            for(int j = 0; j < aaa.length; j++) {
               String[] bbb = aaa[j].split(",");
               bigDecimals.put(new BigDecimal(bbb[0]),new BigDecimal(bbb[1]));
         double xmaxz = Double.parseDouble(((tb_fence2)fenceList.get(0)).getZuobiao()[0].split(",")[0]);
         double ymaxz = Double.parseDouble(((tb_fence2)fenceList.get(0)).getZuobiao()[0].split(",")[1]);
         double xminz = Double.parseDouble(((tb_fence2)fenceList.get(0)).getZuobiao()[0].split(",")[0]);
         double yminz = Double.parseDouble(((tb_fence2)fenceList.get(0)).getZuobiao()[0].split(",")[1]);
         int i;
         for(i = 0; i < fenceList.size(); ++i) {
            Map<BigDecimal, BigDecimal> bigDecimals = new HashMap();
            String[] aaa = ((tb_fence2)fenceList.get(i)).getZuobiao();
            String[] zuobiaos;
            for(int j = 0; j < aaa.length; ++j) {
               zuobiaos = aaa[j].split(",");
               bigDecimals.put(new BigDecimal(zuobiaos[0]), new BigDecimal(zuobiaos[1]));
            }
            String vvv = getPoint(bigDecimals);
            fenceList.get(i).setCenterpoint(vvv);
            String[] zuobiaos = fenceList.get(i).getZuobiao();
            ((tb_fence2)fenceList.get(i)).setCenterpoint(vvv);
            zuobiaos = ((tb_fence2)fenceList.get(i)).getZuobiao();
            double xmax = Double.parseDouble(zuobiaos[0].split(",")[0]);
            double ymax = Double.parseDouble(zuobiaos[0].split(",")[1]);
            double xmin = Double.parseDouble(zuobiaos[0].split(",")[0]);
            double ymin = Double.parseDouble(zuobiaos[0].split(",")[1]);
            for (int j = 0;j < zuobiaos.length; j++) {
            for(int j = 0; j < zuobiaos.length; ++j) {
               String[] zuobiao = zuobiaos[j].split(",");
               if (Double.parseDouble(zuobiao[0]) > xmax) {
                  xmax = Double.parseDouble(zuobiao[0]);
               }
               if (Double.parseDouble(zuobiao[1]) > ymax) {
                  ymax = Double.parseDouble(zuobiao[1]);
               }
               if (Double.parseDouble(zuobiao[0]) < xmin) {
                  xmin = Double.parseDouble(zuobiao[0]);
               }
               if (Double.parseDouble(zuobiao[1]) < ymin) {
                  ymin = Double.parseDouble(zuobiao[1]);
               }
            }
            if (xmax > xmaxz) {
               xmaxz = xmax;
            }
            if (ymax > ymaxz) {
               ymaxz = ymax;
            }
            if (xmin < xminz) {
               xminz = xmin;
            }
            if (ymin < yminz) {
               yminz = ymin;
            }
         }
         for (int i = 0; i < fenceList.size(); i++) {
            fenceList.get(i).setMax(xmaxz+","+ymaxz);
            fenceList.get(i).setMin(xminz+","+yminz);
         for(i = 0; i < fenceList.size(); ++i) {
            ((tb_fence2)fenceList.get(i)).setMax(xmaxz + "," + ymaxz);
            ((tb_fence2)fenceList.get(i)).setMin(xminz + "," + yminz);
         }
      }
      json.put("dataList", fenceList);
      return json;
   }
   @RequestMapping(value = "/jiankongManagement.do", method = { RequestMethod.POST, RequestMethod.GET })
   @RequestMapping(
         value = {"/jiankongManagement.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   public String jiankongManagement(HttpServletRequest request) {
      String toPage = "forward:/hxzk/fence/jiankongManagement.jsp";
      List<tb_shipin> shipinManagementList = fenceService.getShipinManagement(1);
      List<tb_shipin> shipinManagementList = this.fenceService.getShipinManagement(1);
      request.setAttribute("shipinManagementList", shipinManagementList);
      List<tb_fence> fenceList = fenceService.getFenceList();
      List<tb_fence> fenceList = this.fenceService.getFenceList();
      request.setAttribute("fences", fenceList);
      int curPage = 1;
      int count = fenceService.getShipinManagementCount();
      int count = this.fenceService.getShipinManagementCount();
      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 = "/shipinManagement_add.do", method = { RequestMethod.POST, RequestMethod.GET })
   @RequestMapping(
         value = {"/shipinManagement_add.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   public void shipinManagement_add(HttpServletRequest request) throws IOException {
         tb_shipin shipin = new tb_shipin();
         shipin.setFencename(request.getParameter("fencename"));
         shipin.setYonghuming(request.getParameter("yonghuming"));
         shipin.setMima(request.getParameter("mima"));
         shipin.setPosx(request.getParameter("posx"));
         shipin.setPosy(request.getParameter("posy"));
         shipin.setPosz(request.getParameter("posz"));
         shipin.setFloor(request.getParameter("floor"));
         shipin.setName(request.getParameter("name"));
         shipin.setBaoliu1(request.getParameter("baoliu1"));
         fenceService.shipinManagement_add(shipin);
         List<tb_shipin> shipins = fenceService.searchshipinManagement(shipin.getName());
         String xieyi = "BSTOCS1,ADDSP,"+shipin.getFencename()+","+shipin.getYonghuming()+","+shipin.getMima()+","+shipin.getPosx()+","+shipin.getPosy()+","+shipin.getPosz()+","+shipin.getFloor()+","+shipin.getName()+",END";
         Udp_Out.udp_to_cs(xieyi);
      tb_shipin shipin = new tb_shipin();
      shipin.setFencename(request.getParameter("fencename"));
      shipin.setYonghuming(request.getParameter("yonghuming"));
      shipin.setMima(request.getParameter("mima"));
      shipin.setPosx(request.getParameter("posx"));
      shipin.setPosy(request.getParameter("posy"));
      shipin.setPosz(request.getParameter("posz"));
      shipin.setFloor(request.getParameter("floor"));
      shipin.setName(request.getParameter("name"));
      shipin.setBaoliu1(request.getParameter("baoliu1"));
      this.fenceService.shipinManagement_add(shipin);
      List<tb_shipin> shipins = this.fenceService.searchshipinManagement(shipin.getName());
      String xieyi = "BSTOCS1,ADDSP," + shipin.getFencename() + "," + shipin.getYonghuming() + "," + shipin.getMima() + "," + shipin.getPosx() + "," + shipin.getPosy() + "," + shipin.getPosz() + "," + shipin.getFloor() + "," + shipin.getName() + ",END";
      Udp_Out.udp_to_cs(xieyi);
   }
   @RequestMapping(value = "/shipinManagement_modify.do", method = { RequestMethod.POST, RequestMethod.GET })
   @RequestMapping(
         value = {"/shipinManagement_modify.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   public void shipinManagement_modify(HttpServletRequest request) {
      tb_shipin shipin = new tb_shipin();
      String idstr = request.getParameter("id");
@@ -244,74 +288,86 @@
      shipin.setFloor(request.getParameter("floor"));
      shipin.setName(request.getParameter("name"));
      shipin.setBaoliu1(request.getParameter("baoliu1"));
      fenceService.shipinManagement_modify(shipin);
      String xieyi = "BSTOCS1,ALTERSP,"+shipin.getFencename()+","+shipin.getYonghuming()+","+shipin.getMima()+","+shipin.getPosx()+","+shipin.getPosy()+","+shipin.getPosz()+","+shipin.getFloor()+","+shipin.getName()+",END";
      this.fenceService.shipinManagement_modify(shipin);
      String xieyi = "BSTOCS1,ALTERSP," + shipin.getFencename() + "," + shipin.getYonghuming() + "," + shipin.getMima() + "," + shipin.getPosx() + "," + shipin.getPosy() + "," + shipin.getPosz() + "," + shipin.getFloor() + "," + shipin.getName() + ",END";
      Udp_Out.udp_to_cs(xieyi);
   }
   @ResponseBody
   @RequestMapping(value = "/shipinManagement_delete.do", method = { RequestMethod.POST, RequestMethod.GET })
   @RequestMapping(
         value = {"/shipinManagement_delete.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   public void shipinManagement_delete(HttpServletRequest request) {
      String checkValStr = request.getParameter("checkVal");
      checkValStr = checkValStr.replaceAll("\"", "");
      String[] checkVal = checkValStr.split(",");
      for (int i = 0;i < checkVal.length;i++) {
         //System.out.print("执行了"+checkVal[i]);
         List shebeiid = fenceService.idfindshebeiid(checkVal[i]);
         String xieyi = "BSTOCS1,DELETESP,"+shebeiid.get(0)+",END";
      for(int i = 0; i < checkVal.length; ++i) {
         List shebeiid = this.fenceService.idfindshebeiid(checkVal[i]);
         String xieyi = "BSTOCS1,DELETESP," + shebeiid.get(0) + ",END";
         Udp_Out.udp_to_cs(xieyi);
      }
      fenceService.shipinManagement_delete(checkVal);
      this.fenceService.shipinManagement_delete(checkVal);
   }
   @ResponseBody
   @RequestMapping(value = "/shipinManagement_deleteAll.do", method = { RequestMethod.POST, RequestMethod.GET })
   @RequestMapping(
         value = {"/shipinManagement_deleteAll.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   public void shipinManagement_deleteAll(HttpServletRequest request) {
      fenceService.shipinManagement_deleteAll();
      this.fenceService.shipinManagement_deleteAll();
      String xieyi = "BSTOCS1,DELETEALLSP,END";
      Udp_Out.udp_to_cs(xieyi);
   }
   @ResponseBody
   @RequestMapping(value = "/shipinManagement_search.do", method = { RequestMethod.POST, RequestMethod.GET })
   @RequestMapping(
         value = {"/shipinManagement_search.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   public String shipinManagement_search(HttpServletRequest request) throws IOException {
      JSONObject json = new JSONObject();
      String input = request.getParameter("input");
      //System.out.print(input);
      int curPage = 1;
      List<Integer> pageList = new ArrayList<Integer>();
      List<tb_shipin> shipinManagementList = fenceService.searchshipinManagement(input);
      List<Integer> pageList = new ArrayList();
      List<tb_shipin> shipinManagementList = this.fenceService.searchshipinManagement(input);
      pageList.add(1);
      json.put("dataList", shipinManagementList);
      json.put("pageList", pageList);
      json.put("curPage", curPage);
      //System.out.print(json.toString());
      json.put("curPage", Integer.valueOf(curPage));
      return json.toString();
   }
   @ResponseBody
   @RequestMapping(value = "/shipinManagement_ssearch.do", method = { RequestMethod.POST, RequestMethod.GET })
   @RequestMapping(
         value = {"/shipinManagement_ssearch.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   public String shipinManagement_ssearch(HttpServletRequest request) throws IOException {
      JSONObject json = new JSONObject();
      String input = request.getParameter("input");
      //System.out.print(input);
      int curPage = 1;
      List<Integer> pageList = new ArrayList<Integer>();
      List<tb_shipin> shipinManagementList = fenceService.searchshipinManagement(input);
      List<Integer> pageList = new ArrayList();
      List<tb_shipin> shipinManagementList = this.fenceService.searchshipinManagement(input);
      pageList.add(1);
      json.put("dataList", shipinManagementList);
      json.put("pageList", pageList);
      json.put("curPage", curPage);
      //System.out.print(json.toString());
      json.put("curPage", Integer.valueOf(curPage));
      return json.toString();
   }
   @ResponseBody
   @RequestMapping(value = "/shipinManagement_page.do", method = { RequestMethod.POST, RequestMethod.GET })
   @RequestMapping(
         value = {"/shipinManagement_page.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   public String shipinManagement_page(HttpServletRequest request) {
      String pageStr = request.getParameter("page");
      String curPageStr = request.getParameter("curPage");
      int count = fenceService.getShipinManagementCount();
      int count = this.fenceService.getShipinManagementCount();
      int minPage = PageUtil.getMinPage(count);
      int curPage = Integer.parseInt(curPageStr);
      int page = 1;
@@ -326,7 +382,8 @@
      } else {
         page = Integer.parseInt(pageStr);
      }
      List<tb_shipin> anchorManagementList = fenceService.getShipinManagement(page);
      List<tb_shipin> anchorManagementList = this.fenceService.getShipinManagement(page);
      List<Integer> pageList = PageUtil.getPage(PageUtil.getLocPage(page, curPage), page, minPage);
      JSONObject json = new JSONObject();
      json.put("dataList", anchorManagementList);
@@ -335,7 +392,10 @@
      return json.toString();
   }
   @RequestMapping(value = "/fenceList_modify.do", method = { RequestMethod.POST, RequestMethod.GET })
   @RequestMapping(
         value = {"/fenceList_modify.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   public void fenceList_modify(HttpServletRequest request) throws ParseException {
      tb_fence fence = new tb_fence();
      fence.setBumen(request.getParameter("bumen"));
@@ -345,35 +405,43 @@
      fence.setStop(request.getParameter("stop"));
      fence.setBaoliu1(request.getParameter("gaodu"));
      fence.setId(Integer.parseInt(request.getParameter("id")));
      List<tb_fence> fenceaa = fenceService.searchFenceLisa(String.valueOf(fence.getId()));
      List<tb_fence> fenceaa = this.fenceService.searchFenceLisa(String.valueOf(fence.getId()));
      String baowen = "";
      if (fenceaa.get(0).getShape().equals("多边形")) {
      String str;
      if (((tb_fence)fenceaa.get(0)).getShape().equals("多边形")) {
         String[] zuobiaos = zuobiao.split(",");
         String str = "";
         for (int i=0; i<zuobiaos.length; i++) {
            if (i == zuobiaos.length-1) {
               str += zuobiaos[i];
         str = "";
         for(int i = 0; i < zuobiaos.length; ++i) {
            if (i == zuobiaos.length - 1) {
               str = str + zuobiaos[i];
               break;
            }
            if (i%2 == 0) {
               str += zuobiaos[i]+":";
            if (i % 2 == 0) {
               str = str + zuobiaos[i] + ":";
            } else {
               str += zuobiaos[i]+";";
               str = str + zuobiaos[i] + ";";
            }
         }
         baowen = str;
      } else {
         baowen = zuobiao.replace(",", ":");
      }
      fence.setZuobiao(zuobiao);
      fenceService.fenceList_modifya(fence);
      List<tb_fence> fenceListList = fenceService.searchFenceListid(fence.getId());
      String xieyi = "BSTOCS1,ALTERFENCE,"+fenceListList.get(0).getFloor()+","+fenceListList.get(0).getType()+","+fence.getBumen()+","+fence.getName()+","+baowen+","+fenceListList.get(0).getShape()+","+fence.getStart()+","+fence.getStop()+","+fenceListList.get(0).getAddtime()+","+fenceListList.get(0).getColor()+",END";
      Udp_Out.udp_to_cs(xieyi);
      this.fenceService.fenceList_modifya(fence);
      List<tb_fence> fenceListList = this.fenceService.searchFenceListid(fence.getId());
      str = "BSTOCS1,ALTERFENCE," + ((tb_fence)fenceListList.get(0)).getFloor() + "," + ((tb_fence)fenceListList.get(0)).getType() + "," + fence.getBumen() + "," + fence.getName() + "," + baowen + "," + ((tb_fence)fenceListList.get(0)).getShape() + "," + fence.getStart() + "," + fence.getStop() + "," + ((tb_fence)fenceListList.get(0)).getAddtime() + "," + ((tb_fence)fenceListList.get(0)).getColor() + ",END";
      Udp_Out.udp_to_cs(str);
   }
   @ResponseBody
   @RequestMapping(value = "/fenceList_modifya.do", method = { RequestMethod.POST, RequestMethod.GET })
   @RequestMapping(
         value = {"/fenceList_modifya.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   public String fenceList_modifya(HttpServletRequest request) throws ParseException {
      tb_fence fence = new tb_fence();
      fence.setBumen(request.getParameter("bumen"));
@@ -385,92 +453,121 @@
      fence.setBaoliu3(request.getParameter("baoliu3"));
      fence.setBaoliu4(request.getParameter("baoliu4"));
      fence.setId(Integer.parseInt(request.getParameter("id")));
      int aaa = fenceService.fenceList_modify(fence);
      List<tb_fence> fenceListList = fenceService.searchFenceListid(fence.getId());
      String xieyi = "BSTOCS1,ALTERFENCE,"+fenceListList.get(0).getFloor()+","+fenceListList.get(0).getType()+","+fence.getBumen()+","+fence.getName()+","+fence.getZuobiao()+","+fenceListList.get(0).getShape()+","+fence.getStart()+","+fence.getStop()+","+fenceListList.get(0).getAddtime()+","+fenceListList.get(0).getColor()+",END";
      int aaa = this.fenceService.fenceList_modify(fence);
      List<tb_fence> fenceListList = this.fenceService.searchFenceListid(fence.getId());
      String xieyi = "BSTOCS1,ALTERFENCE," + ((tb_fence)fenceListList.get(0)).getFloor() + "," + ((tb_fence)fenceListList.get(0)).getType() + "," + fence.getBumen() + "," + fence.getName() + "," + fence.getZuobiao() + "," + ((tb_fence)fenceListList.get(0)).getShape() + "," + fence.getStart() + "," + fence.getStop() + "," + ((tb_fence)fenceListList.get(0)).getAddtime() + "," + ((tb_fence)fenceListList.get(0)).getColor() + ",END";
      Udp_Out.udp_to_cs(xieyi);
      return ""+aaa;
      return "" + aaa;
   }
   @ResponseBody
   @RequestMapping(value = "/fenceList_delete.do", method = { RequestMethod.POST, RequestMethod.GET })
   @RequestMapping(
         value = {"/fenceList_delete.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   public void fenceList_delete(HttpServletRequest request) throws NumberFormatException, ParseException {
      String checkValStr = request.getParameter("checkVal");
      checkValStr = checkValStr.replaceAll("\"", "");
      String[] checkVal = checkValStr.split(",");
      for (int i = 0; i < checkVal.length; i++) {
         String fences = fenceService.searchFenceListid2(Integer.parseInt(checkVal[i]));
         String xieyi = "BSTOCS1,DELETEFECNCE,"+fences+",END";
      for(int i = 0; i < checkVal.length; ++i) {
         String fences = this.fenceService.searchFenceListid2(Integer.parseInt(checkVal[i]));
         String xieyi = "BSTOCS1,DELETEFECNCE," + fences + ",END";
         Udp_Out.udp_to_cs(xieyi);
      }
      fenceService.fenceList_delete(checkVal);
      this.fenceService.fenceList_delete(checkVal);
   }
   @ResponseBody
   @RequestMapping(value = "/fenceList_deletea.do", method = { RequestMethod.POST, RequestMethod.GET })
   @RequestMapping(
         value = {"/fenceList_deletea.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   public String fenceList_deletea(HttpServletRequest request) throws NumberFormatException, ParseException {
      String checkValStr = request.getParameter("checkVal");
      checkValStr = checkValStr.replaceAll("\"", "");
      String[] checkVal = checkValStr.split(",");
      for (int i = 0; i < checkVal.length; i++) {
         List<tb_fence> fences = fenceService.searchFenceListid(Integer.parseInt(checkVal[i]));
         tb_fence fence = new tb_fence();
         fence = fences.get(0);
         String xieyi = "BSTOCS1,DELETEFECNCE,"+fence.getName()+",END";
      int aaa;
      for(aaa = 0; aaa < checkVal.length; ++aaa) {
         List<tb_fence> fences = this.fenceService.searchFenceListid(Integer.parseInt(checkVal[aaa]));
         new tb_fence();
         tb_fence fence = (tb_fence)fences.get(0);
         String xieyi = "BSTOCS1,DELETEFECNCE," + fence.getName() + ",END";
         Udp_Out.udp_to_cs(xieyi);
      }
      int aaa = fenceService.fenceList_delete(checkVal);
      return ""+aaa;
      aaa = this.fenceService.fenceList_delete(checkVal);
      return "" + aaa;
   }
   @ResponseBody
   @RequestMapping(value = "/fenceList_deleteAll.do", method = { RequestMethod.POST, RequestMethod.GET })
   @RequestMapping(
         value = {"/fenceList_deleteAll.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   public void fenceList_deleteAll(HttpServletRequest request) {
      fenceService.fenceList_deleteAll();
      this.fenceService.fenceList_deleteAll();
      String xieyi = "BSTOCS1,DELETEALLFENCE,END";
      Udp_Out.udp_to_cs(xieyi);
   }
   @ResponseBody
   @RequestMapping(value = "/fenceList_deleteAlla.do", method = { RequestMethod.POST, RequestMethod.GET })
   public String fenceList_deleteAlla(HttpServletRequest request) {
      int aaa = fenceService.fenceList_deleteAll();
      String xieyi = "BSTOCS1,DELETEALLFENCE,END";
      Udp_Out.udp_to_cs(xieyi);
      return ""+aaa;
   }
   @ResponseBody
   @RequestMapping(value = "/fenceList_search.do", method = { RequestMethod.POST, RequestMethod.GET })
   @RequestMapping(
         value = {"/fenceList_deleteAlla.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   public String fenceList_deleteAlla(HttpServletRequest request) {
      int aaa = this.fenceService.fenceList_deleteAll();
      String xieyi = "BSTOCS1,DELETEALLFENCE,END";
      Udp_Out.udp_to_cs(xieyi);
      return "" + aaa;
   }
   @ResponseBody
   @RequestMapping(
         value = {"/fenceList_search.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   public String fenceList_search(HttpServletRequest request) throws ParseException {
      String input = request.getParameter("input");
      List<tb_fence> fenceListList = fenceService.searchFenceList(input);
      List<tb_fence> fenceListList = this.fenceService.searchFenceList(input);
      JSONObject json = new JSONObject();
      json.put("dataList", fenceListList);
      return json.toString();
   }
   @ResponseBody
   @RequestMapping(value = "/fenceList_searcha.do", method = { RequestMethod.POST, RequestMethod.GET })
   @RequestMapping(
         value = {"/fenceList_searcha.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   public JSONObject fenceList_searcha(HttpServletRequest request) throws ParseException {
      String input = request.getParameter("type");
      List<tb_fence> fenceListList = fenceService.searchFenceList(input);
      List<tb_fence> fenceListList = this.fenceService.searchFenceList(input);
      JSONObject json = new JSONObject();
      json.put("dataList", fenceListList);
      return json;
   }
   @RequestMapping(value = "/inspectionSettings.do", method = { RequestMethod.POST, RequestMethod.GET })
   @RequestMapping(
         value = {"/inspectionSettings.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   public String inspectionSettings(HttpServletRequest request) {
      String toPage = "forward:/hxzk/fence/inspectionSettings.jsp";
      List<tb_xunjianset> inspectionSettingsList = fenceService.getInspectionSettings();
      List<tb_xunjianset> inspectionSettingsList = this.fenceService.getInspectionSettings();
      request.setAttribute("inspectionSettingsList", inspectionSettingsList);
      List<String> tagidList = labelService.getLabelManagementTagid();
      List<String> tagidList = this.labelService.getLabelManagementTagid();
      request.setAttribute("tagidList", tagidList);
      return toPage;
   }
   @RequestMapping(value = "/inspectionSettings_modify.do", method = { RequestMethod.POST, RequestMethod.GET })
   @RequestMapping(
         value = {"/inspectionSettings_modify.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   public void inspectionRecord_modify(HttpServletRequest request) {
      tb_xunjianset xunjianset = new tb_xunjianset();
      xunjianset.setQuyu(request.getParameter("quyu"));
@@ -479,63 +576,78 @@
      xunjianset.setCishu(request.getParameter("cishu"));
      xunjianset.setNeedstoptime(request.getParameter("needstoptime"));
      xunjianset.setStoptime(request.getParameter("stoptime"));
      fenceService.inspectionSettings_modify(xunjianset);
      String xieyi = "BSTOCS1,ALTERXUNJIAN,"+xunjianset.getQuyu()+","+xunjianset.getStoptime()+","+xunjianset.getXunshu()+","+xunjianset.getTagid()+","+xunjianset.getNeedstoptime()+","+xunjianset.getCishu()+",END";
      this.fenceService.inspectionSettings_modify(xunjianset);
      String xieyi = "BSTOCS1,ALTERXUNJIAN," + xunjianset.getQuyu() + "," + xunjianset.getStoptime() + "," + xunjianset.getXunshu() + "," + xunjianset.getTagid() + "," + xunjianset.getNeedstoptime() + "," + xunjianset.getCishu() + ",END";
      Udp_Out.udp_to_cs(xieyi);
   }
   @RequestMapping(value = "/inspectionRecord.do", method = { RequestMethod.POST, RequestMethod.GET })
   @RequestMapping(
         value = {"/inspectionRecord.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   public String inspectionRecord(HttpServletRequest request) {
      String toPage = "forward:/hxzk/fence/inspectionRecord.jsp";
      String pagePath = Config.getPageConfig();
      Integer perPage = Integer.parseInt(ModifyConfig.readData(pagePath, "perPage"));
      List<tb_xunjianbaobiao> inspectionRecordList = fenceService.getInspectionRecord(1,perPage);
      List<tb_xunjianbaobiao> inspectionRecordList = this.fenceService.getInspectionRecord(1, perPage);
      request.setAttribute("inspectionRecordList", inspectionRecordList);
      int curPage = 1;
      int count = fenceService.getInspectionRecordCount();
      int count = this.fenceService.getInspectionRecordCount();
      int minPage = PageUtil.getMinPage(count);
      request.setAttribute("pageList", PageUtil.getPage(minPage));
      request.setAttribute("curPage", curPage);
      request.setAttribute("perPage",perPage);
      request.setAttribute("curPage", Integer.valueOf(curPage));
      request.setAttribute("perPage", perPage);
      return toPage;
   }
   @ResponseBody
   @RequestMapping(value = "/inspectionRecord_delete.do", method = { RequestMethod.POST, RequestMethod.GET })
   @RequestMapping(
         value = {"/inspectionRecord_delete.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   public void inspectionRecord_delete(HttpServletRequest request) {
      String checkValStr = request.getParameter("checkVal");
      checkValStr = checkValStr.replaceAll("\"", "");
      String[] checkVal = checkValStr.split(",");
      fenceService.inspectionRecord_delete(checkVal);
      this.fenceService.inspectionRecord_delete(checkVal);
   }
   @ResponseBody
   @RequestMapping(value = "/inspectionRecord_deleteAll.do", method = { RequestMethod.POST, RequestMethod.GET })
   @RequestMapping(
         value = {"/inspectionRecord_deleteAll.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   public void inspectionRecord_deleteAll(HttpServletRequest request) {
      fenceService.inspectionRecord_deleteAll();
      this.fenceService.inspectionRecord_deleteAll();
   }
   @ResponseBody
   @RequestMapping(value = "/inspectionRecord_search.do", method = { RequestMethod.POST, RequestMethod.GET })
   @RequestMapping(
         value = {"/inspectionRecord_search.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   public String inspectionRecord_search(HttpServletRequest request) {
      String input = request.getParameter("input");
      int curPage = 1;
      List<Integer> pageList = new ArrayList<Integer>();
      List<tb_xunjianbaobiao> inspectionRecordList = fenceService.searchInspectionRecord(input);
      List<Integer> pageList = new ArrayList();
      List<tb_xunjianbaobiao> inspectionRecordList = this.fenceService.searchInspectionRecord(input);
      pageList.add(1);
      JSONObject json = new JSONObject();
      json.put("dataList", inspectionRecordList);
      json.put("pageList", pageList);
      json.put("curPage", curPage);
      json.put("curPage", Integer.valueOf(curPage));
      return json.toString();
   }
   @ResponseBody
   @RequestMapping(value = "/inspectionRecord_page.do", method = { RequestMethod.POST, RequestMethod.GET })
   @RequestMapping(
         value = {"/inspectionRecord_page.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   public String inspectionRecord_page(HttpServletRequest request) {
      String pageStr = request.getParameter("page");
      String curPageStr = request.getParameter("curPage");
      int count = fenceService.getInspectionRecordCount();
      int count = this.fenceService.getInspectionRecordCount();
      int minPage = PageUtil.getMinPage(count);
      int curPage = Integer.parseInt(curPageStr);
      int page = 1;
@@ -550,9 +662,10 @@
      } else {
         page = Integer.parseInt(pageStr);
      }
      String pagePath = Config.getPageConfig();
      Integer perPage = Integer.parseInt(ModifyConfig.readData(pagePath, "perPage"));
      List<tb_xunjianbaobiao> inspectionRecordList = fenceService.getInspectionRecord(page,perPage);
      List<tb_xunjianbaobiao> inspectionRecordList = this.fenceService.getInspectionRecord(page, perPage);
      List<Integer> pageList = PageUtil.getPage(PageUtil.getLocPage(page, curPage), page, minPage);
      JSONObject json = new JSONObject();
      json.put("dataList", inspectionRecordList);
@@ -562,35 +675,39 @@
   }
   @ResponseBody
   @RequestMapping(value = "/inspectionRecord_export.do", method = { RequestMethod.POST, RequestMethod.GET })
   @RequestMapping(
         value = {"/inspectionRecord_export.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   public String fenceList_export(HttpServletRequest request, HttpServletResponse response) throws ParseException {
      String toPage = "forward:/hxzk/fence/inspectionRecord.jsp";
      List<tb_xunjianbaobiao> tb_xunjianbaobiaoList = fenceService.getInspectionRecord();
      String[] rowName = { "序号", "姓名", "设备id", "区域名称", "区域序号", "进入时间", "出去时间", "停留时间/s", "是否完成巡检", "添加时间" };
      List<tb_xunjianbaobiao> tb_xunjianbaobiaoList = this.fenceService.getInspectionRecord();
      String[] rowName = new String[]{"序号", "姓名", "设备id", "区域名称", "区域序号", "进入时间", "出去时间", "停留时间/s", "是否完成巡检", "添加时间"};
      List<Object[]> dataList = objectToArray_inspectionRecord(tb_xunjianbaobiaoList);
      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;
   }
   // tb_fence 导出表格 对象转数组
   public static List<Object[]> objectToArray_inspectionRecord(List<tb_xunjianbaobiao> tb_xunjianbaobiaoList) {
      List<Object[]> reList = new ArrayList<>();
      for (int i = 0; i < tb_xunjianbaobiaoList.size(); i++) {
         List<String> words = new ArrayList<String>();
         tb_xunjianbaobiao xunjianbaobiao = (tb_xunjianbaobiao) tb_xunjianbaobiaoList.get(i);
      List<Object[]> reList = new ArrayList();
      for(int i = 0; i < tb_xunjianbaobiaoList.size(); ++i) {
         List<String> words = new ArrayList();
         tb_xunjianbaobiao xunjianbaobiao = (tb_xunjianbaobiao)tb_xunjianbaobiaoList.get(i);
         words.add(xunjianbaobiao.getId() + "");
         words.add(xunjianbaobiao.getName());
         words.add(xunjianbaobiao.getTagid());
@@ -601,172 +718,203 @@
         words.add(xunjianbaobiao.getAlltime());
         words.add(xunjianbaobiao.getSucc());
         words.add(xunjianbaobiao.getAddtime());
         String[] array = words.toArray(new String[0]);
         String[] array = (String[])words.toArray(new String[0]);
         reList.add(array);
      }
      return reList;
   }
   @ResponseBody
   @RequestMapping(value = "/modifyPerPage.do", method = { RequestMethod.POST, RequestMethod.GET })
   @RequestMapping(
         value = {"/modifyPerPage.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   public String modifyPerPage(HttpServletRequest request) {
      JSONObject json = new JSONObject();
      String perPage = request.getParameter("perPage");
      if (perPage=="") {
      if (perPage == "") {
         perPage = "10";
      }
      String pagePath = Config.getPageConfig();
      ModifyConfig.writeData(pagePath, "perPage", perPage);
      String readData = ModifyConfig.readData(pagePath, "perPage");
      json.put("result", readData);
      return json.toString();
   }
   @ResponseBody
   @RequestMapping(value = "/fenceList_bw.do", method = { RequestMethod.POST, RequestMethod.GET })
   @RequestMapping(
         value = {"/fenceList_bw.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   public String fenceList_bw(HttpServletRequest request) throws IOException {
      JSONObject json = new JSONObject();
      List<tb_fence> fenceList = fenceService.getFenceList();
      List<tb_fence> fenceList = this.fenceService.getFenceList();
      json.put("result", fenceList);
      return json.toString();
   }
   @ResponseBody
   @RequestMapping(value = "/xunjiansetList_bw.do", method = { RequestMethod.POST, RequestMethod.GET })
   @RequestMapping(
         value = {"/xunjiansetList_bw.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   public String xunjiansetList_bw(HttpServletRequest request) {
      JSONObject json = new JSONObject();
      List<tb_xunjianset> inspectionSettingsList = fenceService.getInspectionSettings();
      List<tb_xunjianset> inspectionSettingsList = this.fenceService.getInspectionSettings();
      json.put("result", inspectionSettingsList);
      return json.toString();
   }
   @ResponseBody
   @RequestMapping(value = "/xunjianbaobiaoList_bw.do", method = { RequestMethod.POST, RequestMethod.GET })
   @RequestMapping(
         value = {"/xunjianbaobiaoList_bw.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   public String xunjianbaobiaoList_bw(HttpServletRequest request) throws IOException {
      String jsonString = RequestUtils.getRequestJsonString(request, Config.getCharset());
      tb_xunjianbaobiao xunjianbaobiao = (tb_xunjianbaobiao) JSONObject.toBean(JSONObject.fromObject(jsonString),
            tb_xunjianbaobiao.class);
      tb_xunjianbaobiao xunjianbaobiao = (tb_xunjianbaobiao)JSONObject.toBean(JSONObject.fromObject(jsonString), tb_xunjianbaobiao.class);
      String tagid = xunjianbaobiao.getTagid();
      String quyu = xunjianbaobiao.getQuyu();
      JSONObject json = new JSONObject();
      List<tb_xunjianbaobiao> xunjianbaobiaoList = fenceService.getXunjianbaobiao(tagid,quyu);
      if (xunjianbaobiaoList.size()>0){
      List<tb_xunjianbaobiao> xunjianbaobiaoList = this.fenceService.getXunjianbaobiao(tagid, quyu);
      if (xunjianbaobiaoList.size() > 0) {
         json.put("result", xunjianbaobiaoList);
      } else {
         json.put("result", "null");
      }
      return json.toString();
   }
   @RequestMapping(value = "/xunjianbaobiao_bw_add.do", method = { RequestMethod.POST, RequestMethod.GET })
   @RequestMapping(
         value = {"/xunjianbaobiao_bw_add.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   public void xunjianbaobiao_bw_add(HttpServletRequest request) throws IOException {
      String jsonString = RequestUtils.getRequestJsonString(request, Config.getCharset());
      tb_xunjianbaobiao xunjianbaobiao = (tb_xunjianbaobiao) JSONObject.toBean(JSONObject.fromObject(jsonString),
            tb_xunjianbaobiao.class);
      //显示sql
      String sqlString = "INSERT tb_xunjianbaobiao (name,tagid,quyu,bianhao,addtime) VALUES ("+xunjianbaobiao.getName()+
            "," +xunjianbaobiao.getTagid()+","+xunjianbaobiao.getQuyu()+","+xunjianbaobiao.getBianhao()+","+GetNowTime.timestamp2()+")";
      String messageJson =  GetNowTime.timestamp2()+ " 收:"+ sqlString ;
      tb_xunjianbaobiao xunjianbaobiao = (tb_xunjianbaobiao)JSONObject.toBean(JSONObject.fromObject(jsonString), tb_xunjianbaobiao.class);
      String sqlString = "INSERT tb_xunjianbaobiao (name,tagid,quyu,bianhao,addtime) VALUES (" + xunjianbaobiao.getName() + "," + xunjianbaobiao.getTagid() + "," + xunjianbaobiao.getQuyu() + "," + xunjianbaobiao.getBianhao() + "," + GetNowTime.timestamp2() + ")";
      (new StringBuilder()).append(GetNowTime.timestamp2()).append(" 收:").append(sqlString).toString();
      String BaowenPath = Config.getBaowenConfig();
      String baowenStatus = ModifyConfig.readData(BaowenPath, "baowenSwitch");
      if (baowenStatus.equals("1")){
         /* Udp_Receive.mysqlMessage.add(messageJson); */
      if (baowenStatus.equals("1")) {
      }
      //
      fenceService.xunjianbaobiao_add(xunjianbaobiao);
      this.fenceService.xunjianbaobiao_add(xunjianbaobiao);
   }
   @RequestMapping(value = "/xunjianbaobiao_bw_modify.do", method = { RequestMethod.POST, RequestMethod.GET })
   @RequestMapping(
         value = {"/xunjianbaobiao_bw_modify.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   public void xunjianbaobiao_bw_modify(HttpServletRequest request) throws IOException {
      String jsonString = RequestUtils.getRequestJsonString(request, Config.getCharset());
      tb_xunjianbaobiao xunjianbaobiao = (tb_xunjianbaobiao) JSONObject.toBean(JSONObject.fromObject(jsonString),
            tb_xunjianbaobiao.class);
      //显示sql
      String sqlString = "INSERT tb_xunjianbaobiao (name,tagid,quyu,bianhao,intime,addtime) VALUES ("+xunjianbaobiao.getName()+
            "," +xunjianbaobiao.getTagid()+","+xunjianbaobiao.getQuyu()+","+xunjianbaobiao.getBianhao()+","+GetNowTime.timestamp2()+GetNowTime.timestamp2()+")";
      String messageJson =  GetNowTime.timestamp2()+ " 收:"+ sqlString ;
      tb_xunjianbaobiao xunjianbaobiao = (tb_xunjianbaobiao)JSONObject.toBean(JSONObject.fromObject(jsonString), tb_xunjianbaobiao.class);
      String sqlString = "INSERT tb_xunjianbaobiao (name,tagid,quyu,bianhao,intime,addtime) VALUES (" + xunjianbaobiao.getName() + "," + xunjianbaobiao.getTagid() + "," + xunjianbaobiao.getQuyu() + "," + xunjianbaobiao.getBianhao() + "," + GetNowTime.timestamp2() + GetNowTime.timestamp2() + ")";
      (new StringBuilder()).append(GetNowTime.timestamp2()).append(" 收:").append(sqlString).toString();
      String BaowenPath = Config.getBaowenConfig();
      String baowenStatus = ModifyConfig.readData(BaowenPath, "baowenSwitch");
      if (baowenStatus.equals("1")){
         /* Udp_Receive.mysqlMessage.add(messageJson); */
      if (baowenStatus.equals("1")) {
      }
      //
      fenceService.xunjianbaobiao_add(xunjianbaobiao);
      this.fenceService.xunjianbaobiao_add(xunjianbaobiao);
   }
   @ResponseBody
   @RequestMapping(value = "/baidufence.do", method = { RequestMethod.POST, RequestMethod.GET })
   @RequestMapping(
         value = {"/baidufence.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   public String baidufence(HttpServletRequest request) {
      JSONObject json = new JSONObject();
      List<tb_fence> fences = fenceService.getFenceList();
      List<String> fences2 = new ArrayList<>();
      for (int i=0; i<fences.size(); i++) {
         if (fences.get(i).getFloor().equals("百度地图") ) {
            fences2.add(fences.get(i).getZuobiao());
      List<tb_fence> fences = this.fenceService.getFenceList();
      List<String> fences2 = new ArrayList();
      for(int i = 0; i < fences.size(); ++i) {
         if (((tb_fence)fences.get(i)).getFloor().equals("百度地图")) {
            fences2.add(((tb_fence)fences.get(i)).getZuobiao());
         }
      }
      json.put("fences", fences2);
      return json.toString();
   }
   @ResponseBody
   @RequestMapping(value = "/kaishijianting.do", method = { RequestMethod.POST, RequestMethod.GET })
   @RequestMapping(
         value = {"/kaishijianting.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   public void kaishijianting(HttpServletRequest request) {
      String tagid = request.getParameter("tagid");
      String xieyi = "BSTOCS1,URTADDFENCE,出去告警,Start,"+tagid+",END";
      String xieyi = "BSTOCS1,URTADDFENCE,出去告警,Start," + tagid + ",END";
      Udp_Out.udp_to_cs(xieyi);
   }
   @ResponseBody
   @RequestMapping(value = "/jieshujianting.do", method = { RequestMethod.POST, RequestMethod.GET })
   @RequestMapping(
         value = {"/jieshujianting.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   public void jieshujianting(HttpServletRequest request) {
      String tagid = request.getParameter("tagid");
      String xieyi = "BSTOCS1,URTADDFENCE,出去告警,Stop,"+tagid+",END";
      String xieyi = "BSTOCS1,URTADDFENCE,出去告警,Stop," + tagid + ",END";
      Udp_Out.udp_to_cs(xieyi);
   }
   @ResponseBody
   @RequestMapping(value = "/huoquzuobiao.do", method = { RequestMethod.POST, RequestMethod.GET })
   @RequestMapping(
         value = {"/huoquzuobiao.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   public String huoquzuobiao(HttpServletRequest request) {
      JSONObject json = new JSONObject();
      List<tb_system> systems = sysSettingService.getSetting();
      List<tb_system> systems = this.sysSettingService.getSetting();
      json.put("dataList", systems);
      return json.toString();
   }
   @ResponseBody
   @RequestMapping(value = "/enablefence.do", method = { RequestMethod.POST, RequestMethod.GET })
   @RequestMapping(
         value = {"/enablefence.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   public String enablefence(HttpServletRequest request) {
      tb_fence fence = new tb_fence();
      fence.setBaoliu7(request.getParameter("str"));
      fence.setId(Integer.valueOf(request.getParameter("id")));
      int aaa = fenceService.enablefence(fence);
      return ""+aaa;
      int aaa = this.fenceService.enablefence(fence);
      return "" + aaa;
   }
   private static String getPoint(Map<BigDecimal, BigDecimal> bigDecimals) {
        int point_num = bigDecimals.size(); //坐标点个数
        double X = 0;
        double Y = 0;
        double Z = 0;
        for(Map.Entry entry : bigDecimals.entrySet()) {
            double lat = Float.parseFloat(entry.getKey().toString()) * Math.PI / 180;
            double lng = Float.parseFloat(entry.getValue().toString()) * Math.PI / 180;
            double x = Math.cos(lat) * Math.cos(lng);
            double y = Math.cos(lat) * Math.sin(lng);
            double z = Math.sin(lat);
            X += x;
            Y += y;
            Z += z;
        }
        X = X / point_num;
        Y = Y / point_num;
        Z = Z / point_num;
      int point_num = bigDecimals.size();
      double X = 0.0;
      double Y = 0.0;
      double Z = 0.0;
        double tmp_lng = Math.atan2(Y, X);
        double tmp_lat = Math.atan2(Z, Math.sqrt(X * X + Y * Y));
      double tmp_lat;
      double z;
      for(Iterator var8 = bigDecimals.entrySet().iterator(); var8.hasNext(); Z += z) {
         Map.Entry entry = (Map.Entry)var8.next();
         tmp_lat = (double)Float.parseFloat(entry.getKey().toString()) * Math.PI / 180.0;
         double lng = (double)Float.parseFloat(entry.getValue().toString()) * Math.PI / 180.0;
         double x = Math.cos(tmp_lat) * Math.cos(lng);
         double y = Math.cos(tmp_lat) * Math.sin(lng);
         z = Math.sin(tmp_lat);
         X += x;
         Y += y;
      }
        String vvv = Math.round(tmp_lat * 180 / Math.PI * 100.0)/100.0 + "," + Math.round(tmp_lng * 180 / Math.PI * 100.0)/100.0;
        return vvv;
    }
      X /= (double)point_num;
      Y /= (double)point_num;
      Z /= (double)point_num;
      double tmp_lng = Math.atan2(Y, X);
      tmp_lat = Math.atan2(Z, Math.sqrt(X * X + Y * Y));
      String vvv = (double)Math.round(tmp_lat * 180.0 / Math.PI * 100.0) / 100.0 + "," + (double)Math.round(tmp_lng * 180.0 / Math.PI * 100.0) / 100.0;
      return vvv;
   }
}