//
|
// Source code recreated from a .class file by IntelliJ IDEA
|
// (powered by FernFlower decompiler)
|
//
|
|
package com.hxzkoa.controller;
|
|
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;
|
import com.hxzkoa.udp.Udp_Out;
|
import com.hxzkoa.util.Config;
|
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;
|
|
public AnchorController() {
|
}
|
|
@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) {
|
anchor.setAnchorid(anchorid);
|
anchor.setPOSX(request.getParameter("POSX"));
|
anchor.setPOSY(request.getParameter("POSY"));
|
anchor.setPOSZ(request.getParameter("POSZ"));
|
anchor.setLayer(request.getParameter("layer"));
|
anchor.setZu(request.getParameter("zu"));
|
anchor.setLiangcheng(request.getParameter("liangcheng"));
|
if ("".equals(anchor.getLiangcheng())) {
|
anchor.setLiangcheng("100000");
|
}
|
|
anchor.setAnchorip(request.getParameter("anchorip"));
|
anchor.setAnchormode("1");
|
anchor.setVersion(Config.getVersion());
|
List<tb_achor> searchAnchorList = this.anchorService.searchAnchorManagement(anchorid);
|
if (searchAnchorList.size() == 0) {
|
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");
|
this.anchorService.proximityConfiguration_add(nearby);
|
tb_tongbuanchor tongbu = new tb_tongbuanchor();
|
tongbu.setAnchorid(anchor.getAnchorid());
|
tongbu.setType(anchor.getAnchormode());
|
tongbu.setState("0");
|
this.anchorService.syncConfiguration_add(tongbu);
|
}
|
|
@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"));
|
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"));
|
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());
|
this.anchorService.syncConfiguration_modify(tongbu);
|
}
|
|
@ResponseBody
|
@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(",");
|
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);
|
}
|
|
this.anchorService.anchorProx_delete(anchorid);
|
this.anchorService.anchorSync_delete(anchorid);
|
}
|
|
@ResponseBody
|
@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) {
|
this.anchorService.anchorManagement_deleteAll();
|
String xieyi = "BSTOCS1,DELETEALLANC,END";
|
Udp_Out.udp_to_cs(xieyi);
|
}
|
|
@ResponseBody
|
@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");
|
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);
|
input = anchor.getAnchorid();
|
anchorManagementList = this.anchorService.searchAnchorManagement(input);
|
if (anchorManagementList.size() > 0) {
|
json.put("result", anchorManagementList.get(0));
|
} else {
|
json.put("result", "null");
|
}
|
}
|
|
return json.toString();
|
}
|
|
@ResponseBody
|
@RequestMapping(
|
value = {"/anchorManagement_searcha.do"},
|
method = {RequestMethod.POST, RequestMethod.GET}
|
)
|
public JSONObject anchorManagement_searcha(HttpServletRequest request) throws IOException {
|
JSONObject json = new JSONObject();
|
String input = request.getParameter("anchorid");
|
if (!"".equals(input) && input != null) {
|
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 = this.anchorService.getAnchorManagementCount();
|
int minPage = PageUtil.getMinPage(count);
|
int curPage = Integer.parseInt(curPageStr);
|
int page = 1;
|
if ("pre".equals(pageStr)) {
|
if (curPage > 1) {
|
page = curPage - 1;
|
}
|
} else if ("next".equals(pageStr)) {
|
if (curPage < minPage) {
|
page = curPage + 1;
|
}
|
} else {
|
page = Integer.parseInt(pageStr);
|
}
|
|
List<tb_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);
|
json.put("pageList", pageList);
|
json.put("curPage", page);
|
return json.toString();
|
}
|
|
@ResponseBody
|
@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 = 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);
|
|
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);
|
OutputStream out = response.getOutputStream();
|
excel.export(out);
|
out.flush();
|
out.close();
|
} 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();
|
tb_achor achor = (tb_achor)achorList.get(i);
|
words.add(achor.getAnchorid());
|
words.add(achor.getPOSX());
|
words.add(achor.getPOSY());
|
words.add(achor.getPOSZ());
|
words.add(achor.getLayer());
|
words.add(achor.getAnchormode());
|
words.add(achor.getAnchorip());
|
String[] array = (String[])words.toArray(new String[0]);
|
reList.add(array);
|
}
|
|
return reList;
|
}
|
|
@ResponseBody
|
@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) {
|
String[] fileNameArr = path.split("\\\\");
|
String fileName = fileNameArr[fileNameArr.length - 1];
|
path = "C:/hxzkoa/" + fileName;
|
}
|
|
int result = 0;
|
|
try {
|
File file = new File(path);
|
Workbook workbook = Workbook.getWorkbook(file);
|
Sheet sheet = workbook.getSheet(0);
|
int rows = sheet.getRows();
|
|
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();
|
String POSZ = sheet.getCell(3, i).getContents();
|
String layer = sheet.getCell(4, i).getContents();
|
String anchormode = sheet.getCell(7, i).getContents();
|
String anchorip = sheet.getCell(8, 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("0");
|
anchor.setLiangcheng("无");
|
anchor.setAnchormode(anchormode);
|
anchor.setAnchorip(anchorip);
|
anchor.setVersion(Config.getVersion());
|
result = this.anchorService.anchorManagement_add(anchor);
|
}
|
}
|
|
workbook.close();
|
} catch (BiffException var17) {
|
var17.printStackTrace();
|
} catch (IOException var18) {
|
var18.printStackTrace();
|
}
|
|
JSONObject json = new JSONObject();
|
json.put("result", result);
|
return json.toString();
|
}
|
|
@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();
|
}
|
|
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()));
|
}
|
} catch (IOException var25) {
|
var25.printStackTrace();
|
}
|
|
int result = 0;
|
String path = filePath + filename;
|
|
int rows;
|
int i;
|
try {
|
File file = new File(path);
|
Workbook workbook = Workbook.getWorkbook(file);
|
Sheet sheet = workbook.getSheet(0);
|
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();
|
String POSZ = sheet.getCell(3, i).getContents();
|
String layer = sheet.getCell(4, i).getContents();
|
String anchormode = sheet.getCell(5, i).getContents();
|
String anchorip = sheet.getCell(6, i).getContents();
|
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 var23) {
|
var23.printStackTrace();
|
} catch (IOException var24) {
|
var24.printStackTrace();
|
}
|
|
request.setAttribute("resultList", result);
|
List<tb_achor> achorManagementList = this.anchorService.getAnchorManagement(1);
|
request.setAttribute("achorManagementList", achorManagementList);
|
int curPage = 1;
|
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}
|
)
|
public String historicalPower_export(HttpServletRequest request, HttpServletResponse response) {
|
String toPage = "forward:/hxzk/label/anchorManagement.jsp";
|
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);
|
|
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);
|
OutputStream out = response.getOutputStream();
|
excel.export(out);
|
out.flush();
|
out.close();
|
} catch (Exception var11) {
|
var11.printStackTrace();
|
}
|
|
return toPage;
|
}
|
|
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();
|
tb_achor achor = (tb_achor)vo_tp_t_pList.get(i);
|
words.add(achor.getAnchorid());
|
words.add(achor.getPOSX());
|
words.add(achor.getPOSY());
|
words.add(achor.getPOSZ());
|
words.add(achor.getLayer());
|
words.add(achor.getZu());
|
words.add(achor.getLiangcheng());
|
words.add(achor.getAnchormode());
|
words.add(achor.getAnchorip());
|
words.add(achor.getVersion());
|
words.add(achor.getGreateTime());
|
String[] array = (String[])words.toArray(new String[0]);
|
reList.add(array);
|
}
|
|
return reList;
|
}
|
|
@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 = this.anchorService.getProximityConfiguration();
|
request.setAttribute("proximityConfigurationList", proximityConfigurationList);
|
return toPage;
|
}
|
|
@ResponseBody
|
@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();
|
String[] rows = tableData.split(";");
|
|
for(int i = 0; i < rows.length; ++i) {
|
String row = rows[i];
|
String[] columns = row.split(",", -1);
|
tb_anchor_nearby anchor_nearby = new tb_anchor_nearby();
|
String anchorid = columns[0];
|
String near1 = columns[1];
|
String near2 = columns[2];
|
String near3 = columns[3];
|
String near4 = columns[4];
|
String near5 = columns[5];
|
String near6 = columns[6];
|
String near7 = columns[7];
|
String near8 = columns[8];
|
if (anchorid.equals(replace_a)) {
|
anchor_nearby.setAnchorid(replace_b);
|
} 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) {
|
anchor_nearby.setQiehuan("");
|
} 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}
|
)
|
public String proximityConfiguration_four(HttpServletRequest request) {
|
String tableData = request.getParameter("tableData");
|
List<tb_anchor_nearby> tb_anchor_nearbyList = new ArrayList();
|
List<tb_anchor_nearby> reList = new ArrayList();
|
String[] rows = tableData.split(";");
|
|
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);
|
}
|
|
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) {
|
if (i != 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;
|
} else if (count == 1) {
|
tb_anchor_nearby_i.setNear2(tb_anchor_nearby_j.getAnchorid());
|
++count;
|
} else if (count == 2) {
|
tb_anchor_nearby_i.setNear3(tb_anchor_nearby_j.getAnchorid());
|
++count;
|
} else if (count == 3) {
|
tb_anchor_nearby_i.setNear4(tb_anchor_nearby_j.getAnchorid());
|
++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}
|
)
|
public void proximityConfiguration_save(HttpServletRequest request) {
|
String tableData = request.getParameter("tableData");
|
String[] rows = tableData.split(";");
|
this.anchorService.proximityConfiguration_delete();
|
|
for(int i = 0; i < rows.length; ++i) {
|
String row = rows[i];
|
String[] columns = row.split(",", -1);
|
tb_anchor_nearby anchor_nearby = new tb_anchor_nearby();
|
anchor_nearby.setAnchorid(columns[0]);
|
anchor_nearby.setNear1(columns[1]);
|
anchor_nearby.setNear2(columns[2]);
|
anchor_nearby.setNear3(columns[3]);
|
anchor_nearby.setNear4(columns[4]);
|
anchor_nearby.setNear5(columns[5]);
|
anchor_nearby.setNear6(columns[6]);
|
anchor_nearby.setNear7(columns[7]);
|
anchor_nearby.setNear8(columns[8]);
|
if (columns.length == 9) {
|
anchor_nearby.setQiehuan("");
|
} else {
|
anchor_nearby.setQiehuan(columns[9]);
|
}
|
|
this.anchorService.proximityConfiguration_add(anchor_nearby);
|
}
|
|
}
|
|
@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 = this.anchorService.searchAnchornearby(anchor_nearby.getAnchorid());
|
if (searchList.size() == 0) {
|
this.anchorService.proximityConfiguration_add(anchor_nearby);
|
}
|
|
}
|
|
@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 = this.anchorService.getSyncConfiguration();
|
request.setAttribute("syncConfigurationList", syncConfigurationList);
|
return toPage;
|
}
|
|
@ResponseBody
|
@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 = 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");
|
tongbuanchor.setType("1");
|
tongbuanchor.setState("1");
|
} else {
|
tongbuanchor.setRootanchorid(syncAnchorText);
|
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}
|
)
|
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();
|
String[] rows = tableData.split(";");
|
|
for(int i = 0; i < rows.length; ++i) {
|
String row = rows[i];
|
String[] columns = row.split(",", -1);
|
tb_tongbuanchor tongbuanchor = new tb_tongbuanchor();
|
String anchorid = columns[0];
|
String rootanchorid = columns[1];
|
if (anchorid.equals(replace_a)) {
|
tongbuanchor.setAnchorid(replace_b);
|
} 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}
|
)
|
public void syncConfiguration_save(HttpServletRequest request) {
|
String tableData = request.getParameter("tableData");
|
String[] rows = tableData.split(";");
|
this.anchorService.syncConfiguration_delete();
|
|
for(int i = 0; i < rows.length; ++i) {
|
String row = rows[i];
|
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]);
|
this.anchorService.syncConfiguration_add(tongbuanchor);
|
}
|
|
}
|
|
@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 = this.anchorService.searchTongbuanchor(tongbuanchor.getAnchorid());
|
if (searchList.size() == 0) {
|
this.anchorService.syncConfiguration_add(tongbuanchor);
|
}
|
|
}
|
|
@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();
|
}
|
|
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 var10) {
|
var10.printStackTrace();
|
}
|
|
return toPage;
|
}
|
|
@RequestMapping(
|
value = {"/wifiManagement.do"},
|
method = {RequestMethod.POST, RequestMethod.GET}
|
)
|
public String wifiManagement(HttpServletRequest request) {
|
String toPage = "forward:/hxzk/anchor/wifiConfiguration.jsp";
|
tb_wifi wifi = this.anchorService.getWifiManagement();
|
request.setAttribute("wifi", wifi);
|
return toPage;
|
}
|
|
@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")));
|
wifi.setWebname(request.getParameter("webname"));
|
wifi.setWebPass(request.getParameter("webPass"));
|
wifi.setAnchorid(request.getParameter("anchorid"));
|
wifi.setPort(request.getParameter("port"));
|
wifi.setXieyitype(request.getParameter("xieyitype"));
|
wifi.setModel(request.getParameter("model"));
|
wifi.setWifiname(request.getParameter("wifiname"));
|
wifi.setWifipass(request.getParameter("wifipass"));
|
wifi.setIp(request.getParameter("ip"));
|
wifi.setWangguan(request.getParameter("wangguan"));
|
wifi.setZiwang(request.getParameter("ziwang"));
|
wifi.setFuwuip(request.getParameter("fuwuip"));
|
wifi.setJiamileixing(request.getParameter("jiamileixing"));
|
wifi.setJiamisuanfa(request.getParameter("jiamisuanfa"));
|
wifi.setSousuoport(request.getParameter("sousuoport"));
|
wifi.setKeyword(request.getParameter("keyword"));
|
this.anchorService.wifiManagement_modify(wifi);
|
}
|
|
@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 var3) {
|
var3.printStackTrace();
|
}
|
|
}
|
|
@ResponseBody
|
@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;
|
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);
|
anchorid = anchor.getAnchorid();
|
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 {
|
nn = 0;
|
}
|
|
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;
|
}
|
}
|