yzt
2023-05-05 4c558c77a6a9d23f057f094c4dc3e315eabef497
src/main/java/com/hxzkoa/controller/AnchorController.java
@@ -1,26 +1,13 @@
//
// 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.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
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.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import com.hxzkoa.json.tb_achor;
import com.hxzkoa.json.tb_anchor_nearby;
import com.hxzkoa.json.tb_anchorhistory;
import com.hxzkoa.json.tb_tongbuanchor;
import com.hxzkoa.json.tb_wifi;
import com.hxzkoa.services.AnchorService;
@@ -29,49 +16,102 @@
import com.hxzkoa.util.ExcelUtils;
import com.hxzkoa.util.PageUtil;
import com.hxzkoa.util.RequestUtils;
import java.io.File;
import java.io.IOException;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import jxl.Sheet;
import jxl.Workbook;
import jxl.read.biff.BiffException;
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.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
@Controller
public class AnchorController {
   @Autowired
   private AnchorService anchorService;
   @RequestMapping(value = "/anchorManagement.do", method = { RequestMethod.POST, RequestMethod.GET })
   public String anchorManagement(HttpServletRequest request) {
      String toPage = "forward:/hxzk/anchor/anchorManagement.jsp";
      List<tb_achor> achorManagementList = anchorService.getAnchorManagement(1);
      request.setAttribute("achorManagementList", achorManagementList);
      int curPage = 1;
      int count = anchorService.getAnchorManagementCount();
      int minPage = PageUtil.getMinPage(count);
      request.setAttribute("pageList", PageUtil.getPage(minPage));
      request.setAttribute("curPage", curPage);
      return toPage;
   }
   @RequestMapping(value = "/anchor_bw_status.do", method = { RequestMethod.POST, RequestMethod.GET })
   public void anchor_bw_status(HttpServletRequest request) throws IOException {
      String jsonString = RequestUtils.getRequestJsonString(request, Config.getCharset());
      tb_achor anchor = (tb_achor) JSONObject.toBean(JSONObject.fromObject(jsonString), tb_achor.class);
      anchorService.anchor_modify_status(anchor);
   public AnchorController() {
   }
   @RequestMapping(value = "/anchorManagement_add.do", method = { RequestMethod.POST, RequestMethod.GET })
   @RequestMapping(value = {"/anchorManagement.do"}, method = {RequestMethod.POST, RequestMethod.GET}
   )
   public String anchorManagement(HttpServletRequest request) {
      String toPage = "forward:/hxzk/anchor/anchorManagement.jsp";
      List<tb_achor> achorManagementList = this.anchorService.getAnchorManagement(1);
      request.setAttribute("achorManagementList", achorManagementList);
      int curPage = 1;
      int count = this.anchorService.getAnchorManagementCount();
      int minPage = PageUtil.getMinPage(count);
      request.setAttribute("pageList", PageUtil.getPage(minPage));
      request.setAttribute("curPage", Integer.valueOf(curPage));
      return toPage;
   }
   @ResponseBody
   @RequestMapping(
         value = {"/anchorManagementaa.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   public JSONObject anchorManagementaa(HttpServletRequest request) {
      JSONObject json = new JSONObject();
      List<tb_achor> achorManagementList = this.anchorService.getAnchorManagement(1);
      int curPage = 1;
      int count = this.anchorService.getAnchorManagementCount();
      int minPage = PageUtil.getMinPage(count);
      json.put("dataList", achorManagementList);
      json.put("pageList", PageUtil.getPage(minPage));
      json.put("curPage", Integer.valueOf(curPage));
      return json;
   }
   @ResponseBody
   @RequestMapping(
         value = {"/anchorManagementa.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   public JSONObject anchorManagementa(HttpServletRequest request) {
      JSONObject json = new JSONObject();
      List<tb_achor> achorManagementList = this.anchorService.getAnchorManagementa();
      for(int i = 0; i < achorManagementList.size(); ++i) {
         if (!((tb_achor)achorManagementList.get(i)).getPOSX().equals("") && !((tb_achor)achorManagementList.get(i)).getPOSY().equals("")) {
            ((tb_achor)achorManagementList.get(i)).setPOSX("" + (double)Math.round(Double.parseDouble(((tb_achor)achorManagementList.get(i)).getPOSX())) / 100.0);
            ((tb_achor)achorManagementList.get(i)).setPOSY("" + (double)Math.round(Double.parseDouble(((tb_achor)achorManagementList.get(i)).getPOSY())) / 100.0);
         }
      }
      json.put("dataList", achorManagementList);
      return json;
   }
   @RequestMapping(
         value = {"/anchor_bw_status.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   public void anchor_bw_status(HttpServletRequest request) throws IOException {
      String jsonString = RequestUtils.getRequestJsonString(request, Config.getCharset());
      tb_achor anchor = (tb_achor)JSONObject.toBean(JSONObject.fromObject(jsonString), tb_achor.class);
      this.anchorService.anchor_modify_status(anchor);
   }
   @RequestMapping(
         value = {"/anchorManagement_add.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   public void anchorManagement_add(HttpServletRequest request) throws IOException {
      tb_achor anchor = new tb_achor();
      String anchorid = request.getParameter("anchorid");
      if (("").equals(anchorid) || anchorid == null) {
         String jsonString = RequestUtils.getRequestJsonString(request, Config.getCharset());
         anchor = (tb_achor) JSONObject.toBean(JSONObject.fromObject(jsonString), tb_achor.class);
         List<tb_achor> searchAnchorList = anchorService.searchAnchorManagement(anchor.getAnchorid());
         if (searchAnchorList.size() == 0) {
            anchorService.anchorManagement_add(anchor);
         }
      } else {
      if (!"".equals(anchorid) && anchorid != null) {
         anchor.setAnchorid(anchorid);
         anchor.setPOSX(request.getParameter("POSX"));
         anchor.setPOSY(request.getParameter("POSY"));
@@ -79,33 +119,84 @@
         anchor.setLayer(request.getParameter("layer"));
         anchor.setZu(request.getParameter("zu"));
         anchor.setLiangcheng(request.getParameter("liangcheng"));
         if(("").equals(anchor.getLiangcheng())){
         if ("".equals(anchor.getLiangcheng())) {
            anchor.setLiangcheng("100000");
         }
         anchor.setAnchorip(request.getParameter("anchorip"));
         anchor.setAnchormode("1");
         anchor.setVersion(Config.getVersion());
         // 如果该anchorid不存在,新增一条
         List<tb_achor> searchAnchorList = anchorService.searchAnchorManagement(anchorid);
         List<tb_achor> searchAnchorList = this.anchorService.searchAnchorManagement(anchorid);
         if (searchAnchorList.size() == 0) {
            anchorService.anchorManagement_add(anchor);
            String xieyi = "BSTOCS1,ADDANC,"+anchor.getAnchorid()+","+anchor.getPOSX()+","+anchor.getPOSY()+","+anchor.getPOSZ()+","+anchor.getLayer()+","+anchor.getZu()+","+anchor.getLiangcheng()+","+anchor.getAnchorip()+",END";
            this.anchorService.anchorManagement_add(anchor);
            String xieyi = "BSTOCS1,ADDANC," + anchor.getAnchorid() + "," + anchor.getPOSX() + "," + anchor.getPOSY() + "," + anchor.getPOSZ() + "," + anchor.getLayer() + "," + anchor.getZu() + "," + anchor.getLiangcheng() + "," + anchor.getAnchorip() + ",END";
            Udp_Out.udp_to_cs(xieyi);
         }
      } else {
         String jsonString = RequestUtils.getRequestJsonString(request, Config.getCharset());
         anchor = (tb_achor)JSONObject.toBean(JSONObject.fromObject(jsonString), tb_achor.class);
         List<tb_achor> searchAnchorList = this.anchorService.searchAnchorManagement(anchor.getAnchorid());
         if (searchAnchorList.size() == 0) {
            this.anchorService.anchorManagement_add(anchor);
         }
      }
      //新增临近基站和同步基站
      tb_anchor_nearby nearby = new tb_anchor_nearby();
      nearby.setAnchorid(anchor.getAnchorid());
      nearby.setQiehuan("0");
      anchorService.proximityConfiguration_add(nearby);
      this.anchorService.proximityConfiguration_add(nearby);
      tb_tongbuanchor tongbu = new tb_tongbuanchor();
      tongbu.setAnchorid(anchor.getAnchorid());
      tongbu.setType(anchor.getAnchormode());
      tongbu.setState("0");
      anchorService.syncConfiguration_add(tongbu);
      this.anchorService.syncConfiguration_add(tongbu);
   }
   @RequestMapping(value = "/anchorManagement_modify.do", method = { RequestMethod.POST, RequestMethod.GET })
   @ResponseBody
   @RequestMapping(
         value = {"/anchorManagement_adda.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   public String anchorManagement_adda(HttpServletRequest request) throws IOException {
      tb_achor anchor = new tb_achor();
      String aaa = "";
      String anchorid = request.getParameter("anchorid");
      if (!"".equals(anchorid) && anchorid != null) {
         anchor.setAnchorid(anchorid);
         anchor.setPOSX("0");
         anchor.setPOSY("0");
         anchor.setPOSZ(request.getParameter("POSZ"));
         anchor.setLayer("0");
         anchor.setZu("0");
         anchor.setLiangcheng("0");
         anchor.setAnchorip("0");
         anchor.setAnchormode("1");
         anchor.setVersion(Config.getVersion());
         List<tb_achor> searchAnchorList = this.anchorService.searchAnchorManagement(anchorid);
         if (searchAnchorList.size() == 0) {
            String xieyi = "BSTOCS1,ADDANC," + anchor.getAnchorid() + "," + anchor.getPOSX() + "," + anchor.getPOSY() + "," + anchor.getPOSZ() + "," + anchor.getLayer() + "," + anchor.getZu() + "," + anchor.getLiangcheng() + "," + anchor.getAnchorip() + ",END";
            System.out.print("++++++++" + xieyi);
            Udp_Out.udp_to_cs(xieyi);
            aaa = "1";
         } else {
            aaa = "基站ID已存在";
         }
      } else {
         String jsonString = RequestUtils.getRequestJsonString(request, Config.getCharset());
         anchor = (tb_achor)JSONObject.toBean(JSONObject.fromObject(jsonString), tb_achor.class);
         List<tb_achor> searchAnchorList = this.anchorService.searchAnchorManagement(anchor.getAnchorid());
         if (searchAnchorList.size() == 0) {
            this.anchorService.anchorManagement_addaa(anchor);
         }
      }
      return aaa;
   }
   @RequestMapping(
         value = {"/anchorManagement_modify.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   public void anchorManagement_modify(HttpServletRequest request) {
      tb_achor anchor = new tb_achor();
      anchor.setAnchorid(request.getParameter("anchorid"));
@@ -116,89 +207,185 @@
      anchor.setZu(request.getParameter("zu"));
      anchor.setLiangcheng(request.getParameter("liangcheng"));
      anchor.setAnchorip(request.getParameter("anchorip"));
      anchorService.anchorManagement_modify(anchor);
      String xieyi = "BSTOCS1,ALTERANC,"+anchor.getAnchorid()+","+anchor.getPOSX()+","+anchor.getPOSY()+","+anchor.getPOSZ()+","+anchor.getLayer()+","+anchor.getZu()+","+anchor.getLiangcheng()+","+anchor.getAnchorip()+",END";
      this.anchorService.anchorManagement_modify(anchor);
      String xieyi = "BSTOCS1,ALTERANC," + anchor.getAnchorid() + "," + anchor.getPOSX() + "," + anchor.getPOSY() + "," + anchor.getPOSZ() + "," + anchor.getLayer() + "," + anchor.getZu() + "," + anchor.getLiangcheng() + "," + anchor.getAnchorip() + ",END";
      Udp_Out.udp_to_cs(xieyi);
      //修改临近基站和同步基站
      tb_tongbuanchor tongbu = new tb_tongbuanchor();
      tongbu.setAnchorid(anchor.getAnchorid());
      tongbu.setType(anchor.getAnchormode());
      anchorService.syncConfiguration_modify(tongbu);
   }
   @RequestMapping(value = "/anchorManagement_heart.do", method = { RequestMethod.POST, RequestMethod.GET })
   public void anchorManagement_heart(HttpServletRequest request) throws IOException {
      String jsonString = RequestUtils.getRequestJsonString(request, Config.getCharset());
      tb_achor achor = (tb_achor) JSONObject.toBean(JSONObject.fromObject(jsonString), tb_achor.class);
      achor.setAnchormode("1");
      anchorService.anchorManagement_modify_mode(achor);
   }
   @RequestMapping(value = "/anchorManagement_heart_tongbu.do", method = { RequestMethod.POST, RequestMethod.GET })
   public void anchorManagement_heart_tongbu(HttpServletRequest request) throws IOException {
      String jsonString = RequestUtils.getRequestJsonString(request, Config.getCharset());
      tb_tongbuanchor tongbuanchor = (tb_tongbuanchor) JSONObject.toBean(JSONObject.fromObject(jsonString), tb_tongbuanchor.class);
      anchorService.syncConfiguration_update_state(tongbuanchor);
      this.anchorService.syncConfiguration_modify(tongbu);
   }
   @ResponseBody
   @RequestMapping(value = "/anchorManagement_delete.do", method = { RequestMethod.POST, RequestMethod.GET })
   @RequestMapping(
         value = {"/anchorManagement_modifya.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   public String anchorManagement_modifya(HttpServletRequest request) {
      tb_achor anchor = new tb_achor();
      anchor.setAnchorid(request.getParameter("anchorid"));
      anchor.setPOSX(request.getParameter("POSX"));
      anchor.setPOSY(request.getParameter("POSY"));
      anchor.setPOSZ(request.getParameter("POSZ"));
      anchor.setLayer(request.getParameter("layer"));
      anchor.setZu(request.getParameter("zu"));
      anchor.setLiangcheng(request.getParameter("liangcheng"));
      anchor.setAnchorip(request.getParameter("anchorip"));
      String xieyi = "BSTOCS1,ALTERANC," + anchor.getAnchorid() + "," + anchor.getPOSX() + "," + anchor.getPOSY() + "," + anchor.getPOSZ() + "," + anchor.getLayer() + "," + anchor.getZu() + "," + anchor.getLiangcheng() + "," + anchor.getAnchorip() + ",END";
      Udp_Out.udp_to_cs(xieyi);
      return "1";
   }
   @RequestMapping(
         value = {"/anchorManagement_heart.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   public void anchorManagement_heart(HttpServletRequest request) throws IOException {
      String jsonString = RequestUtils.getRequestJsonString(request, Config.getCharset());
      tb_achor achor = (tb_achor)JSONObject.toBean(JSONObject.fromObject(jsonString), tb_achor.class);
      achor.setAnchormode("1");
      this.anchorService.anchorManagement_modify_mode(achor);
   }
   @RequestMapping(
         value = {"/anchorManagement_heart_tongbu.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   public void anchorManagement_heart_tongbu(HttpServletRequest request) throws IOException {
      String jsonString = RequestUtils.getRequestJsonString(request, Config.getCharset());
      tb_tongbuanchor tongbuanchor = (tb_tongbuanchor)JSONObject.toBean(JSONObject.fromObject(jsonString), tb_tongbuanchor.class);
      this.anchorService.syncConfiguration_update_state(tongbuanchor);
   }
   @ResponseBody
   @RequestMapping(
         value = {"/anchorManagement_delete.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   public void anchorManagement_delete(HttpServletRequest request) {
      String checkValStr = request.getParameter("checkVal");
      String anchorids = request.getParameter("anchorids");
      checkValStr = checkValStr.replaceAll("\"", "");
      String[] checkVal = checkValStr.split(",");
      String[] anchorid = anchorids.split(",");
      anchorService.anchorManagement_delete(checkVal);
      for(int i = 0; i < anchorid.length; i++) {
         String xieyi = "BSTOCS1,DELETEANC,"+anchorid[i]+",END";
      this.anchorService.anchorManagement_delete(checkVal);
      for(int i = 0; i < anchorid.length; ++i) {
         String xieyi = "BSTOCS1,DELETEANC," + anchorid[i] + ",END";
         Udp_Out.udp_to_cs(xieyi);
      }
      anchorService.anchorProx_delete(anchorid);
      anchorService.anchorSync_delete(anchorid);
      this.anchorService.anchorProx_delete(anchorid);
      this.anchorService.anchorSync_delete(anchorid);
   }
   @ResponseBody
   @RequestMapping(value = "/anchorManagement_deleteAll.do", method = { RequestMethod.POST, RequestMethod.GET })
   @RequestMapping(
         value = {"/anchorManagement_deletea.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   public String anchorManagement_deletea(HttpServletRequest request) {
      String checkValStr = request.getParameter("checkVal");
      checkValStr = checkValStr.replaceAll("\"", "");
      String[] checkVal = checkValStr.split(",");
      for(int i = 0; i < checkVal.length; ++i) {
         String xieyi = "BSTOCS1,DELETEANC," + checkVal[i] + ",END";
         Udp_Out.udp_to_cs(xieyi);
      }
      return "1";
   }
   @ResponseBody
   @RequestMapping(
         value = {"/anchorManagement_deleteAll.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   public void anchorManagement_deleteAll(HttpServletRequest request) {
      anchorService.anchorManagement_deleteAll();
      this.anchorService.anchorManagement_deleteAll();
      String xieyi = "BSTOCS1,DELETEALLANC,END";
      Udp_Out.udp_to_cs(xieyi);
   }
   @ResponseBody
   @RequestMapping(value = "/anchorManagement_search.do", method = { RequestMethod.POST, RequestMethod.GET })
   @RequestMapping(
         value = {"/anchorManagement_deleteAlla.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   public String anchorManagement_deleteAlla(HttpServletRequest request) {
      String xieyi = "BSTOCS1,DELETEALLANC,END";
      Udp_Out.udp_to_cs(xieyi);
      return "1";
   }
   @ResponseBody
   @RequestMapping(
         value = {"/anchorManagement_search.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   public String anchorManagement_search(HttpServletRequest request) throws IOException {
      JSONObject json = new JSONObject();
      String input = request.getParameter("input");
      if (("").equals(input) || input == null) {
      List anchorManagementList;
      if (!"".equals(input) && input != null) {
         int curPage = 1;
         List<Integer> pageList = new ArrayList();
         anchorManagementList = this.anchorService.searchAnchorManagement(input);
         pageList.add(1);
         json.put("dataList", anchorManagementList);
         json.put("pageList", pageList);
         json.put("curPage", Integer.valueOf(curPage));
      } else {
         String jsonString = RequestUtils.getRequestJsonString(request, Config.getCharset());
         tb_achor anchor = (tb_achor) JSONObject.toBean(JSONObject.fromObject(jsonString), tb_achor.class);
         tb_achor anchor = (tb_achor)JSONObject.toBean(JSONObject.fromObject(jsonString), tb_achor.class);
         input = anchor.getAnchorid();
         List<tb_achor> anchorManagementList = anchorService.searchAnchorManagement(input);
         if (anchorManagementList.size()>0){
         anchorManagementList = this.anchorService.searchAnchorManagement(input);
         if (anchorManagementList.size() > 0) {
            json.put("result", anchorManagementList.get(0));
         } else {
            json.put("result", "null");
         }
      } else {
         int curPage = 1;
         List<Integer> pageList = new ArrayList<Integer>();
         List<tb_achor> anchorManagementList = anchorService.searchAnchorManagement(input);
         pageList.add(1);
         json.put("dataList", anchorManagementList);
         json.put("pageList", pageList);
         json.put("curPage", curPage);
      }
      return json.toString();
   }
   @ResponseBody
   @RequestMapping(value = "/anchorManagement_page.do", method = { RequestMethod.POST, RequestMethod.GET })
   @RequestMapping(
         value = {"/anchorManagement_searcha.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   public JSONObject anchorManagement_searcha(HttpServletRequest request) throws IOException {
      JSONObject json = new JSONObject();
      String input = request.getParameter("anchorid");
      if (!"".equals(input) && input != null) {
         List<tb_achor> anchorManagementList = this.anchorService.searchAnchorManagementaa(input);
         json.put("dataList", anchorManagementList);
      } else {
         String jsonString = RequestUtils.getRequestJsonString(request, Config.getCharset());
         tb_achor anchor = (tb_achor)JSONObject.toBean(JSONObject.fromObject(jsonString), tb_achor.class);
         input = anchor.getAnchorid();
         List<tb_achor> anchorManagementList = this.anchorService.searchAnchorManagementaa(input);
         if (anchorManagementList.size() > 0) {
            json.put("result", anchorManagementList.get(0));
         } else {
            json.put("result", "null");
         }
      }
      return json;
   }
   @ResponseBody
   @RequestMapping(
         value = {"/anchorManagement_page.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   public String anchorManagement_page(HttpServletRequest request) {
      String pageStr = request.getParameter("page");
      String curPageStr = request.getParameter("curPage");
      int count = anchorService.getAnchorManagementCount();
      int count = this.anchorService.getAnchorManagementCount();
      int minPage = PageUtil.getMinPage(count);
      int curPage = Integer.parseInt(curPageStr);
      int page = 1;
@@ -213,7 +400,8 @@
      } else {
         page = Integer.parseInt(pageStr);
      }
      List<tb_achor> anchorManagementList = anchorService.getAnchorManagement(page);
      List<tb_achor> anchorManagementList = this.anchorService.getAnchorManagement(page);
      List<Integer> pageList = PageUtil.getPage(PageUtil.getLocPage(page, curPage), page, minPage);
      JSONObject json = new JSONObject();
      json.put("dataList", anchorManagementList);
@@ -223,35 +411,39 @@
   }
   @ResponseBody
   @RequestMapping(value = "/anchorManagement_exportTemplate.do", method = { RequestMethod.POST, RequestMethod.GET })
   @RequestMapping(
         value = {"/anchorManagement_exportTemplate.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   public String anchorManagement_exportTemplate(HttpServletRequest request, HttpServletResponse response) {
      String toPage = "forward:/hxzk/anchor/anchorManagement.jsp";
      List<tb_achor> anchorTemplateList = anchorService.getAnchorManagement(1);
      String[] rowName = { "基站ID", "X坐标/cm", "Y坐标/cm", "Z坐标/cm", "层", "同步", "ip地址"};
      List<tb_achor> anchorTemplateList = this.anchorService.getAnchorManagement(1);
      String[] rowName = new String[]{"基站ID", "X坐标/cm", "Y坐标/cm", "Z坐标/cm", "层", "同步", "ip地址"};
      List<Object[]> dataList = anchorTemplateobjectToArray(anchorTemplateList);
      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;
   }
   // 对象转数组
   public static List<Object[]> anchorTemplateobjectToArray(List<tb_achor> achorList) {
      List<Object[]> reList = new ArrayList<>();
      for (int i = 0; i < achorList.size(); i++) {
         List<String> words = new ArrayList<String>();
         tb_achor achor = (tb_achor) achorList.get(i);
      List<Object[]> reList = new ArrayList();
      for(int i = 0; i < achorList.size(); ++i) {
         List<String> words = new ArrayList();
         tb_achor achor = (tb_achor)achorList.get(i);
         words.add(achor.getAnchorid());
         words.add(achor.getPOSX());
         words.add(achor.getPOSY());
@@ -259,14 +451,18 @@
         words.add(achor.getLayer());
         words.add(achor.getAnchormode());
         words.add(achor.getAnchorip());
         String[] array = words.toArray(new String[0]);
         String[] array = (String[])words.toArray(new String[0]);
         reList.add(array);
      }
      return reList;
   }
   @ResponseBody
   @RequestMapping(value = "/anchorManagement_import.do", method = { RequestMethod.POST, RequestMethod.GET })
   @RequestMapping(
         value = {"/anchorManagement_import.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   public String anchorManagement_import(HttpServletRequest request) {
      String path = request.getParameter("path");
      if (path.indexOf("fakepath") != -1) {
@@ -274,19 +470,16 @@
         String fileName = fileNameArr[fileNameArr.length - 1];
         path = "C:/hxzkoa/" + fileName;
      }
      ;
      int result = 0;
      // 选取Excel文件得到工作薄
      Workbook workbook;
      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 = 1; i < rows; i++) {
            // 读取信息,通过Cell的getContents方法读取单元格的值把单元格中的信息以字符的形式读取出来
         for(int i = 1; i < rows; ++i) {
            String anchorid = sheet.getCell(0, i).getContents();
            String POSX = sheet.getCell(1, i).getContents();
            String POSY = sheet.getCell(2, i).getContents();
@@ -294,7 +487,7 @@
            String layer = sheet.getCell(4, i).getContents();
            String anchormode = sheet.getCell(7, i).getContents();
            String anchorip = sheet.getCell(8, i).getContents();
            if (!("").equals(anchorid)) {
            if (!"".equals(anchorid)) {
               tb_achor anchor = new tb_achor();
               anchor.setAnchorid(anchorid);
               anchor.setPOSX(POSX);
@@ -306,51 +499,57 @@
               anchor.setAnchormode(anchormode);
               anchor.setAnchorip(anchorip);
               anchor.setVersion(Config.getVersion());
               result = anchorService.anchorManagement_add(anchor);
               result = this.anchorService.anchorManagement_add(anchor);
            }
         }
         // 释放资源
         workbook.close();
      } catch (BiffException e) {
         e.printStackTrace();
      } catch (IOException e) {
         e.printStackTrace();
      } catch (BiffException var17) {
         var17.printStackTrace();
      } catch (IOException var18) {
         var18.printStackTrace();
      }
      JSONObject json = new JSONObject();
      json.put("result", result);
      return json.toString();
   }
   @RequestMapping(value = "/uploadAnchor.do")
   @RequestMapping({"/uploadAnchor.do"})
   public String uploadPerson(@RequestParam("file") MultipartFile[] files, HttpServletRequest request) {
      String toPage = "forward:/hxzk/anchor/anchorManagement.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 var25) {
         var25.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方法读取单元格的值把单元格中的信息以字符的形式读取出来
         rows = sheet.getRows();
         for(i = 3; i < rows; ++i) {
            String anchorid = sheet.getCell(0, i).getContents();
            String POSX = sheet.getCell(1, i).getContents();
            String POSY = sheet.getCell(2, i).getContents();
@@ -358,71 +557,81 @@
            String layer = sheet.getCell(4, i).getContents();
            String anchormode = sheet.getCell(5, i).getContents();
            String anchorip = sheet.getCell(6, i).getContents();
            if (!("").equals(anchorid)) {
               tb_achor anchor = new tb_achor();
               anchor.setAnchorid(anchorid);
               anchor.setPOSX(POSX);
               anchor.setPOSY(POSY);
               anchor.setPOSZ(POSZ);
               anchor.setLayer(layer);
               anchor.setZu("无");
               anchor.setLiangcheng("无");
               anchor.setAnchormode(anchormode);
               anchor.setAnchorip(anchorip);
               anchor.setVersion(Config.getVersion());
               result = anchorService.anchorManagement_add(anchor);
            if (!"".equals(anchorid)) {
               List<tb_achor> anchorManagementList = this.anchorService.searchAnchorManagement(anchorid);
               if (anchorManagementList.size() == 0) {
                  tb_achor anchor = new tb_achor();
                  anchor.setAnchorid(anchorid);
                  anchor.setPOSX(POSX);
                  anchor.setPOSY(POSY);
                  anchor.setPOSZ(POSZ);
                  anchor.setLayer(layer);
                  anchor.setZu("无");
                  anchor.setLiangcheng("无");
                  anchor.setAnchormode(anchormode);
                  anchor.setAnchorip(anchorip);
                  anchor.setVersion(Config.getVersion());
                  result = this.anchorService.anchorManagement_add(anchor);
                  String xieyi = "BSTOCS1,ADDANC," + anchor.getAnchorid() + "," + anchor.getPOSX() + "," + anchor.getPOSY() + "," + anchor.getPOSZ() + "," + anchor.getLayer() + "," + anchor.getZu() + "," + anchor.getLiangcheng() + "," + anchor.getAnchorip() + ",END";
                  Udp_Out.udp_to_cs(xieyi);
               }
            }
         }
         // 释放资源
         workbook.close();
      } catch (BiffException e) {
         e.printStackTrace();
      } catch (IOException e) {
         e.printStackTrace();
      } catch (BiffException var23) {
         var23.printStackTrace();
      } catch (IOException var24) {
         var24.printStackTrace();
      }
      request.setAttribute("resultList", result);
      List<tb_achor> achorManagementList = anchorService.getAnchorManagement(1);
      List<tb_achor> achorManagementList = this.anchorService.getAnchorManagement(1);
      request.setAttribute("achorManagementList", achorManagementList);
      int curPage = 1;
      int count = anchorService.getAnchorManagementCount();
      int minPage = PageUtil.getMinPage(count);
      request.setAttribute("pageList", PageUtil.getPage(minPage));
      request.setAttribute("curPage", curPage);
      rows = this.anchorService.getAnchorManagementCount();
      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;
   }
   @ResponseBody
   @RequestMapping(value = "/anchorManagement_export.do", method = { RequestMethod.POST, RequestMethod.GET })
   @RequestMapping(
         value = {"/anchorManagement_export.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   public String historicalPower_export(HttpServletRequest request, HttpServletResponse response) {
      String toPage = "forward:/hxzk/label/anchorManagement.jsp";
      List<tb_achor> anchorManagementList = anchorService.getAnchorManagement();
      String[] rowName = { "基站ID", "X坐标/CM", "Y坐标/CM", "Z坐标/CM", "层", "组", "量程/CM", "同步", "IP地址", "版本", "更新时间" };
      List<tb_achor> anchorManagementList = this.anchorService.getAnchorManagement();
      String[] rowName = new String[]{"基站ID", "X坐标/CM", "Y坐标/CM", "Z坐标/CM", "层", "组", "量程/CM", "同步", "IP地址", "版本", "更新时间"};
      List<Object[]> dataList = objectToArray_anchorManagement(anchorManagementList);
      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_achor 导出表格 对象转数组
   public static List<Object[]> objectToArray_anchorManagement(List<tb_achor> vo_tp_t_pList) {
      List<Object[]> reList = new ArrayList<>();
      for (int i = 0; i < vo_tp_t_pList.size(); i++) {
         List<String> words = new ArrayList<String>();
         tb_achor achor = (tb_achor) vo_tp_t_pList.get(i);
      List<Object[]> reList = new ArrayList();
      for(int i = 0; i < vo_tp_t_pList.size(); ++i) {
         List<String> words = new ArrayList();
         tb_achor achor = (tb_achor)vo_tp_t_pList.get(i);
         words.add(achor.getAnchorid());
         words.add(achor.getPOSX());
         words.add(achor.getPOSY());
@@ -434,31 +643,39 @@
         words.add(achor.getAnchorip());
         words.add(achor.getVersion());
         words.add(achor.getGreateTime());
         String[] array = words.toArray(new String[0]);
         String[] array = (String[])words.toArray(new String[0]);
         reList.add(array);
      }
      return reList;
   }
   @RequestMapping(value = "/proximityConfiguration.do", method = { RequestMethod.POST, RequestMethod.GET })
   @RequestMapping(
         value = {"/proximityConfiguration.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   public String proximityConfiguration(HttpServletRequest request) {
      String toPage = "forward:/hxzk/anchor/proximityConfiguration.jsp";
      List<tb_anchor_nearby> proximityConfigurationList = anchorService.getProximityConfiguration();
      List<tb_anchor_nearby> proximityConfigurationList = this.anchorService.getProximityConfiguration();
      request.setAttribute("proximityConfigurationList", proximityConfigurationList);
      return toPage;
   }
   @ResponseBody
   @RequestMapping(value = "/proximityConfiguration_replace.do", method = { RequestMethod.POST, RequestMethod.GET })
   @RequestMapping(
         value = {"/proximityConfiguration_replace.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   public String proximityConfiguration_replace(HttpServletRequest request) {
      String tableData = request.getParameter("tableData");
      String replace_a = request.getParameter("replace_a");
      String replace_b = request.getParameter("replace_b");
      List<tb_anchor_nearby> reList = new ArrayList<tb_anchor_nearby>();
      List<tb_anchor_nearby> reList = new ArrayList();
      String[] rows = tableData.split(";");
      for (int i = 0; i < rows.length; i++) {
      for(int i = 0; i < rows.length; ++i) {
         String row = rows[i];
         String[] columns = row.split(",",-1);
         String[] columns = row.split(",", -1);
         tb_anchor_nearby anchor_nearby = new tb_anchor_nearby();
         String anchorid = columns[0];
         String near1 = columns[1];
@@ -474,112 +691,134 @@
         } else {
            anchor_nearby.setAnchorid(anchorid);
         }
         if (near1.equals(replace_a)) {
            anchor_nearby.setNear1(replace_b);
         } else {
            anchor_nearby.setNear1(near1);
         }
         if (near2.equals(replace_a)) {
            anchor_nearby.setNear2(replace_b);
         } else {
            anchor_nearby.setNear2(near2);
         }
         if (near3.equals(replace_a)) {
            anchor_nearby.setNear3(replace_b);
         } else {
            anchor_nearby.setNear3(near3);
         }
         if (near4.equals(replace_a)) {
            anchor_nearby.setNear4(replace_b);
         } else {
            anchor_nearby.setNear4(near4);
         }
         if (near5.equals(replace_a)) {
            anchor_nearby.setNear5(replace_b);
         } else {
            anchor_nearby.setNear5(near5);
         }
         if (near6.equals(replace_a)) {
            anchor_nearby.setNear6(replace_b);
         } else {
            anchor_nearby.setNear6(near6);
         }
         if (near7.equals(replace_a)) {
            anchor_nearby.setNear7(replace_b);
         } else {
            anchor_nearby.setNear7(near7);
         }
         if (near8.equals(replace_a)) {
            anchor_nearby.setNear8(replace_b);
         } else {
            anchor_nearby.setNear8(near8);
         }
         if (columns.length==9){
         if (columns.length == 9) {
            anchor_nearby.setQiehuan("");
         }else {
         } else {
            anchor_nearby.setQiehuan(columns[9]);
         }
         reList.add(anchor_nearby);
      }
      JSONObject json = new JSONObject();
      json.put("dataList", reList);
      return json.toString();
   }
   @ResponseBody
   @RequestMapping(value = "/proximityConfiguration_four.do", method = { RequestMethod.POST, RequestMethod.GET })
   @RequestMapping(
         value = {"/proximityConfiguration_four.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   public String proximityConfiguration_four(HttpServletRequest request) {
      String tableData = request.getParameter("tableData");
      List<tb_anchor_nearby> tb_anchor_nearbyList = new ArrayList<tb_anchor_nearby>();
      List<tb_anchor_nearby> reList = new ArrayList<tb_anchor_nearby>();
      List<tb_anchor_nearby> tb_anchor_nearbyList = new ArrayList();
      List<tb_anchor_nearby> reList = new ArrayList();
      String[] rows = tableData.split(";");
      for (int i = 0; i < rows.length; i++) {
         String row = rows[i];
         String[] columns = row.split(",",-1);
      int count;
      for(count = 0; count < rows.length; ++count) {
         String row = rows[count];
         String[] columns = row.split(",", -1);
         tb_anchor_nearby anchor_nearby = new tb_anchor_nearby();
         anchor_nearby.setAnchorid(columns[0]);
         anchor_nearby.setQiehuan(columns[9]);
         tb_anchor_nearbyList.add(anchor_nearby);
      }
      int count;
      for (int i = 0; i < tb_anchor_nearbyList.size(); i++) {
         tb_anchor_nearby tb_anchor_nearby_i = tb_anchor_nearbyList.get(i);
      for(int i = 0; i < tb_anchor_nearbyList.size(); ++i) {
         tb_anchor_nearby tb_anchor_nearby_i = (tb_anchor_nearby)tb_anchor_nearbyList.get(i);
         count = 0;
         for (int j = 0; j < tb_anchor_nearbyList.size(); j++) {
         for(int j = 0; j < tb_anchor_nearbyList.size(); ++j) {
            if (i != j) {
               tb_anchor_nearby tb_anchor_nearby_j = tb_anchor_nearbyList.get(j);
               tb_anchor_nearby tb_anchor_nearby_j = (tb_anchor_nearby)tb_anchor_nearbyList.get(j);
               if (count == 0) {
                  tb_anchor_nearby_i.setNear1(tb_anchor_nearby_j.getAnchorid());
                  count++;
                  ++count;
               } else if (count == 1) {
                  tb_anchor_nearby_i.setNear2(tb_anchor_nearby_j.getAnchorid());
                  count++;
                  ++count;
               } else if (count == 2) {
                  tb_anchor_nearby_i.setNear3(tb_anchor_nearby_j.getAnchorid());
                  count++;
                  ++count;
               } else if (count == 3) {
                  tb_anchor_nearby_i.setNear4(tb_anchor_nearby_j.getAnchorid());
                  count++;
                  ++count;
               }
            }
         }
         reList.add(tb_anchor_nearby_i);
      }
      JSONObject json = new JSONObject();
      json.put("dataList", reList);
      return json.toString();
   }
   @ResponseBody
   @RequestMapping(value = "/proximityConfiguration_save.do", method = { RequestMethod.POST, RequestMethod.GET })
   @RequestMapping(
         value = {"/proximityConfiguration_save.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   public void proximityConfiguration_save(HttpServletRequest request) {
      String tableData = request.getParameter("tableData");
      // 解析表格
      String[] rows = tableData.split(";");
      anchorService.proximityConfiguration_delete();
      for (int i = 0; i < rows.length; i++) {
      this.anchorService.proximityConfiguration_delete();
      for(int i = 0; i < rows.length; ++i) {
         String row = rows[i];
         String[] columns = row.split(",",-1);
         String[] columns = row.split(",", -1);
         tb_anchor_nearby anchor_nearby = new tb_anchor_nearby();
         anchor_nearby.setAnchorid(columns[0]);
         anchor_nearby.setNear1(columns[1]);
@@ -590,43 +829,54 @@
         anchor_nearby.setNear6(columns[6]);
         anchor_nearby.setNear7(columns[7]);
         anchor_nearby.setNear8(columns[8]);
         if (columns.length==9){
         if (columns.length == 9) {
            anchor_nearby.setQiehuan("");
         }else {
         } else {
            anchor_nearby.setQiehuan(columns[9]);
         }
         anchorService.proximityConfiguration_add(anchor_nearby);
         this.anchorService.proximityConfiguration_add(anchor_nearby);
      }
   }
   @RequestMapping(value = "/proximityConfiguration_add.do", method = { RequestMethod.POST, RequestMethod.GET })
   @RequestMapping(
         value = {"/proximityConfiguration_add.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   public void proximityConfiguration_add(HttpServletRequest request) throws IOException {
      String jsonString = RequestUtils.getRequestJsonString(request, Config.getCharset());
      tb_anchor_nearby anchor_nearby = (tb_anchor_nearby) JSONObject.toBean(JSONObject.fromObject(jsonString),
            tb_anchor_nearby.class);
      List<tb_anchor_nearby> searchList = anchorService.searchAnchornearby(anchor_nearby.getAnchorid());
      tb_anchor_nearby anchor_nearby = (tb_anchor_nearby)JSONObject.toBean(JSONObject.fromObject(jsonString), tb_anchor_nearby.class);
      List<tb_anchor_nearby> searchList = this.anchorService.searchAnchornearby(anchor_nearby.getAnchorid());
      if (searchList.size() == 0) {
         anchorService.proximityConfiguration_add(anchor_nearby);
      }
         this.anchorService.proximityConfiguration_add(anchor_nearby);
      }
   }
   @RequestMapping(value = "/syncConfiguration.do", method = { RequestMethod.POST, RequestMethod.GET })
   @RequestMapping(
         value = {"/syncConfiguration.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   public String syncConfiguration(HttpServletRequest request) {
      String toPage = "forward:/hxzk/anchor/syncConfiguration.jsp";
      List<tb_tongbuanchor> syncConfigurationList = anchorService.getSyncConfiguration();
      List<tb_tongbuanchor> syncConfigurationList = this.anchorService.getSyncConfiguration();
      request.setAttribute("syncConfigurationList", syncConfigurationList);
      return toPage;
   }
   @ResponseBody
   @RequestMapping(value = "/syncConfiguration_syncAnchor.do", method = { RequestMethod.POST, RequestMethod.GET })
   @RequestMapping(
         value = {"/syncConfiguration_syncAnchor.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   public String syncConfiguration_syncAnchor(HttpServletRequest request) {
      String syncAnchorText = request.getParameter("syncAnchorText");
      List<tb_tongbuanchor> syncConfigurationList = anchorService.getSyncConfiguration();
      List<tb_tongbuanchor> reList = new ArrayList<tb_tongbuanchor>();
      for (int i = 0; i < syncConfigurationList.size(); i++) {
         tb_tongbuanchor tongbuanchor = syncConfigurationList.get(i);
      List<tb_tongbuanchor> syncConfigurationList = this.anchorService.getSyncConfiguration();
      List<tb_tongbuanchor> reList = new ArrayList();
      for(int i = 0; i < syncConfigurationList.size(); ++i) {
         tb_tongbuanchor tongbuanchor = (tb_tongbuanchor)syncConfigurationList.get(i);
         String anchorid = tongbuanchor.getAnchorid();
         if (syncAnchorText.equals(anchorid)) {
            tongbuanchor.setRootanchorid("0");
@@ -637,24 +887,30 @@
            tongbuanchor.setType("0");
            tongbuanchor.setState("1");
         }
         reList.add(tongbuanchor);
      }
      JSONObject json = new JSONObject();
      json.put("dataList", reList);
      return json.toString();
   }
   @ResponseBody
   @RequestMapping(value = "/syncConfiguration_replace.do", method = { RequestMethod.POST, RequestMethod.GET })
   @RequestMapping(
         value = {"/syncConfiguration_replace.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   public String syncConfiguration_replace(HttpServletRequest request) {
      String tableData = request.getParameter("tableData");
      String replace_a = request.getParameter("replace_a");
      String replace_b = request.getParameter("replace_b");
      List<tb_tongbuanchor> reList = new ArrayList<tb_tongbuanchor>();
      List<tb_tongbuanchor> reList = new ArrayList();
      String[] rows = tableData.split(";");
      for (int i = 0; i < rows.length; i++) {
      for(int i = 0; i < rows.length; ++i) {
         String row = rows[i];
         String[] columns = row.split(",",-1);
         String[] columns = row.split(",", -1);
         tb_tongbuanchor tongbuanchor = new tb_tongbuanchor();
         String anchorid = columns[0];
         String rootanchorid = columns[1];
@@ -663,78 +919,101 @@
         } else {
            tongbuanchor.setAnchorid(anchorid);
         }
         if (rootanchorid.equals(replace_a)) {
            tongbuanchor.setRootanchorid(replace_b);
         } else {
            tongbuanchor.setRootanchorid(rootanchorid);
         }
         tongbuanchor.setType(columns[2]);
         tongbuanchor.setState(columns[3]);
         tongbuanchor.setAddtime(columns[4]);
         reList.add(tongbuanchor);
      }
      JSONObject json = new JSONObject();
      json.put("dataList", reList);
      return json.toString();
   }
   @ResponseBody
   @RequestMapping(value = "/syncConfiguration_save.do", method = { RequestMethod.POST, RequestMethod.GET })
   @RequestMapping(
         value = {"/syncConfiguration_save.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   public void syncConfiguration_save(HttpServletRequest request) {
      String tableData = request.getParameter("tableData");
      // 解析表格
      String[] rows = tableData.split(";");
      anchorService.syncConfiguration_delete();
      for (int i = 0; i < rows.length; i++) {
      this.anchorService.syncConfiguration_delete();
      for(int i = 0; i < rows.length; ++i) {
         String row = rows[i];
         String[] columns = row.split(",",-1);
         String[] columns = row.split(",", -1);
         tb_tongbuanchor tongbuanchor = new tb_tongbuanchor();
         tongbuanchor.setAnchorid(columns[0]);
         tongbuanchor.setRootanchorid(columns[1]);
         tongbuanchor.setType(columns[2]);
         tongbuanchor.setState(columns[3]);
         anchorService.syncConfiguration_add(tongbuanchor);
         this.anchorService.syncConfiguration_add(tongbuanchor);
      }
   }
   @RequestMapping(value = "/syncConfiguration_add.do", method = { RequestMethod.POST, RequestMethod.GET })
   @RequestMapping(
         value = {"/syncConfiguration_add.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   public void syncConfiguration_add(HttpServletRequest request) throws IOException {
      String jsonString = RequestUtils.getRequestJsonString(request, Config.getCharset());
      tb_tongbuanchor tongbuanchor = (tb_tongbuanchor) JSONObject.toBean(JSONObject.fromObject(jsonString),
            tb_tongbuanchor.class);
      List<tb_tongbuanchor> searchList = anchorService.searchTongbuanchor(tongbuanchor.getAnchorid());
      tb_tongbuanchor tongbuanchor = (tb_tongbuanchor)JSONObject.toBean(JSONObject.fromObject(jsonString), tb_tongbuanchor.class);
      List<tb_tongbuanchor> searchList = this.anchorService.searchTongbuanchor(tongbuanchor.getAnchorid());
      if (searchList.size() == 0) {
         anchorService.syncConfiguration_add(tongbuanchor);
      }
         this.anchorService.syncConfiguration_add(tongbuanchor);
      }
   }
   @RequestMapping(value = "/upload.do")
   @RequestMapping({"/upload.do"})
   public String upload(@RequestParam("file") MultipartFile[] files, HttpServletRequest request) {
      String toPage = "forward:/hxzk/anchor/anchorManagement.jsp";
      String filePath = request.getServletContext().getRealPath("/") + "upload/";
      try {
         File existFile = new File(filePath);
         if (!existFile.exists()) {
            existFile.mkdir();
         }
         for (MultipartFile file : files) {
         MultipartFile[] var6 = files;
         int var7 = files.length;
         for(int var8 = 0; var8 < var7; ++var8) {
            MultipartFile file = var6[var8];
            file.transferTo(new File(filePath + file.getOriginalFilename()));
         }
      } catch (IOException e) {
         e.printStackTrace();
      } catch (IOException var10) {
         var10.printStackTrace();
      }
      return toPage;
   }
   @RequestMapping(value = "/wifiManagement.do", method = { RequestMethod.POST, RequestMethod.GET })
   @RequestMapping(
         value = {"/wifiManagement.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   public String wifiManagement(HttpServletRequest request) {
      String toPage = "forward:/hxzk/anchor/wifiConfiguration.jsp";
      tb_wifi wifi = anchorService.getWifiManagement();
      tb_wifi wifi = this.anchorService.getWifiManagement();
      request.setAttribute("wifi", wifi);
      return toPage;
   }
   @RequestMapping(value = "/wifiManagement_modify.do", method = { RequestMethod.POST, RequestMethod.GET })
   @RequestMapping(
         value = {"/wifiManagement_modify.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   public void wifiManagement_add(HttpServletRequest request) {
      tb_wifi wifi = new tb_wifi();
      wifi.setId(Integer.parseInt(request.getParameter("id")));
@@ -754,49 +1033,85 @@
      wifi.setJiamisuanfa(request.getParameter("jiamisuanfa"));
      wifi.setSousuoport(request.getParameter("sousuoport"));
      wifi.setKeyword(request.getParameter("keyword"));
      anchorService.wifiManagement_modify(wifi);
      this.anchorService.wifiManagement_modify(wifi);
   }
   @RequestMapping(value = "/networkManagement_more.do", method = { RequestMethod.POST, RequestMethod.GET })
   @RequestMapping(
         value = {"/networkManagement_more.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   public void networkManagement_more(HttpServletRequest request) {
      try {
         Runtime.getRuntime().exec("cmd /c systemFiles\\IP\\anchormage.exe");
      } catch (IOException e1) {
         e1.printStackTrace();
      } catch (IOException var3) {
         var3.printStackTrace();
      }
   }
   @ResponseBody
   @RequestMapping(value = "/anchorid_search.do", method = { RequestMethod.POST, RequestMethod.GET })
   @RequestMapping(
         value = {"/anchorid_search.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   public int anchorid_search(HttpServletRequest request) throws IOException {
      JSONObject json = new JSONObject();
      String anchorid = request.getParameter("anchorid");
      List<tb_achor> anchorManagementList = null;
      int nn;
      if (("").equals(anchorid) || anchorid == null) {
      if (!"".equals(anchorid) && anchorid != null) {
         int curPage = 1;
         List<Integer> pageList = new ArrayList();
         anchorManagementList = this.anchorService.searchAnchorManagement(anchorid);
         pageList.add(1);
         json.put("dataList", anchorManagementList);
         json.put("pageList", pageList);
         json.put("curPage", Integer.valueOf(curPage));
      } else {
         String jsonString = RequestUtils.getRequestJsonString(request, Config.getCharset());
         tb_achor anchor = (tb_achor) JSONObject.toBean(JSONObject.fromObject(jsonString), tb_achor.class);
         tb_achor anchor = (tb_achor)JSONObject.toBean(JSONObject.fromObject(jsonString), tb_achor.class);
         anchorid = anchor.getAnchorid();
         anchorManagementList = anchorService.searchAnchorManagement(anchorid);
         if (anchorManagementList.size()>0){
         anchorManagementList = this.anchorService.searchAnchorManagement(anchorid);
         if (anchorManagementList.size() > 0) {
            json.put("result", anchorManagementList.get(0));
         } else {
            json.put("result", "null");
         }
      }
      byte nn;
      if (null != anchorManagementList && anchorManagementList.size() != 0) {
         nn = 1;
      } else {
         int curPage = 1;
         List<Integer> pageList = new ArrayList<Integer>();
         anchorManagementList = anchorService.searchAnchorManagement(anchorid);
         pageList.add(1);
         json.put("dataList", anchorManagementList);
         json.put("pageList", pageList);
         json.put("curPage", curPage);
         nn = 0;
      }
      if(null == anchorManagementList || anchorManagementList.size() ==0 ) {
         nn=0;
      }else {
         nn=1;
      }
      return nn;
   }
   @ResponseBody
   @RequestMapping(
         value = {"/anchorhistory.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   public JSONObject anchorhistory(HttpServletRequest request) {
      JSONObject json = new JSONObject();
      List<tb_anchorhistory> achorManagementList = this.anchorService.getAnchorhistory();
      json.put("dataList", achorManagementList);
      return json;
   }
   @ResponseBody
   @RequestMapping(
         value = {"/findidanchorhistory.do"},
         method = {RequestMethod.POST, RequestMethod.GET}
   )
   public JSONObject anchorhistoryaa(HttpServletRequest request) {
      String date = request.getParameter("date");
      StringBuffer string = new StringBuffer(date);
      String insert = string.insert(4, "-").toString();
      JSONObject json = new JSONObject();
      List<tb_anchorhistory> achorManagementList = this.anchorService.getidAnchorhistory(insert);
      json.put("dataList", achorManagementList);
      return json;
   }
}