From e150655a785de36a65a26a0dc4d3d6d65fe7e9d0 Mon Sep 17 00:00:00 2001
From: fxl <473369119@qq.com>
Date: 星期四, 04 五月 2023 18:03:37 +0800
Subject: [PATCH] 11111
---
src/main/java/com/hxzkoa/controller/GasController.java | 447 +++++++++++++++++++++++++++++++++----------------------
1 files changed, 269 insertions(+), 178 deletions(-)
diff --git a/src/main/java/com/hxzkoa/controller/GasController.java b/src/main/java/com/hxzkoa/controller/GasController.java
index 4d188b8..77d6758 100644
--- a/src/main/java/com/hxzkoa/controller/GasController.java
+++ b/src/main/java/com/hxzkoa/controller/GasController.java
@@ -1,13 +1,27 @@
+//
+// Source code recreated from a .class file by IntelliJ IDEA
+// (powered by FernFlower decompiler)
+//
+
package com.hxzkoa.controller;
+import com.hxzkoa.json.tb_collector;
+import com.hxzkoa.json.tb_gas;
+import com.hxzkoa.json.tb_gas_history;
+import com.hxzkoa.services.GasService;
+import com.hxzkoa.udp.GetNowTime;
+import com.hxzkoa.util.Config;
+import com.hxzkoa.util.ExcelUtils;
+import com.hxzkoa.util.ModifyConfig;
+import com.hxzkoa.util.PageUtil;
+import com.hxzkoa.util.RequestUtils;
import java.io.IOException;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.List;
-
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-
+import net.sf.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -16,59 +30,57 @@
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
-import com.hxzkoa.json.tb_collector;
-import com.hxzkoa.json.tb_gas;
-import com.hxzkoa.json.tb_gas_history;
-import com.hxzkoa.json.tb_person;
-import com.hxzkoa.json.tb_tag;
-import com.hxzkoa.services.GasService;
-import com.hxzkoa.udp.GetNowTime;
-/*import com.hxzkoa.udp.Udp_Receive;*/
-import com.hxzkoa.util.Config;
-import com.hxzkoa.util.ExcelUtils;
-import com.hxzkoa.util.HttpUtil;
-import com.hxzkoa.util.ModifyConfig;
-import com.hxzkoa.util.PageUtil;
-import com.hxzkoa.util.RequestUtils;
-
-import net.sf.json.JSONObject;
-
@Controller
public class GasController {
@Autowired
private GasService gasService;
-
- @RequestMapping(value = "/sensorManagement.do", method = { RequestMethod.POST, RequestMethod.GET })
+ final Logger logger = LoggerFactory.getLogger(this.getClass());
+
+ public GasController() {
+ }
+
+ @RequestMapping(
+ value = {"/sensorManagement.do"},
+ method = {RequestMethod.POST, RequestMethod.GET}
+ )
public String sensorManagement(HttpServletRequest request) {
String toPage = "forward:/hxzk/gas/sensorManagement.jsp";
- List<tb_gas> sensorManagementList = gasService.getSensorManagement(1);
+ List<tb_gas> sensorManagementList = this.gasService.getSensorManagement(1);
request.setAttribute("sensorManagementList", sensorManagementList);
- List<tb_collector> collectorList = gasService.getcollectorList();
+ List<tb_collector> collectorList = this.gasService.getcollectorList();
request.setAttribute("collectorList", collectorList);
int curPage = 1;
- int count = gasService.getSensorManagementCount();
+ int count = this.gasService.getSensorManagementCount();
int minPage = PageUtil.getMinPage(count);
request.setAttribute("pageList", PageUtil.getPage(minPage));
- request.setAttribute("curPage", curPage);
+ request.setAttribute("curPage", Integer.valueOf(curPage));
return toPage;
}
-
+
@ResponseBody
- @RequestMapping(value = "/sensorManagementsan.do", method = { RequestMethod.POST, RequestMethod.GET })
+ @RequestMapping(
+ value = {"/sensorManagementsan.do"},
+ method = {RequestMethod.POST, RequestMethod.GET}
+ )
public List<tb_gas> sensorManagementsan(HttpServletRequest request) {
- List<tb_gas> sensorManagementList = gasService.getSensorManagement();
- for (int i = 0; i < sensorManagementList.size();i++) {
- sensorManagementList.get(i).setGas_type(sensorManagementList.get(i).getGas_type().replace(" ", ""));
+ List<tb_gas> sensorManagementList = this.gasService.getSensorManagement();
+
+ for(int i = 0; i < sensorManagementList.size(); ++i) {
+ ((tb_gas)sensorManagementList.get(i)).setGas_type(((tb_gas)sensorManagementList.get(i)).getGas_type().replace(" ", ""));
}
+
return sensorManagementList;
}
-
+
@ResponseBody
- @RequestMapping(value = "/sensorManagement_page.do", method = { RequestMethod.POST, RequestMethod.GET })
+ @RequestMapping(
+ value = {"/sensorManagement_page.do"},
+ method = {RequestMethod.POST, RequestMethod.GET}
+ )
public String sensorManagement_page(HttpServletRequest request) {
String pageStr = request.getParameter("page");
String curPageStr = request.getParameter("curPage");
- int count = gasService.getSensorManagementCount();
+ int count = this.gasService.getSensorManagementCount();
int minPage = PageUtil.getMinPage(count);
int curPage = Integer.parseInt(curPageStr);
int page = 1;
@@ -83,7 +95,8 @@
} else {
page = Integer.parseInt(pageStr);
}
- List<tb_gas> sensorManagementList = gasService.getSensorManagement(page);
+
+ List<tb_gas> sensorManagementList = this.gasService.getSensorManagement(page);
List<Integer> pageList = PageUtil.getPage(PageUtil.getLocPage(page, curPage), page, minPage);
JSONObject json = new JSONObject();
json.put("dataList", sensorManagementList);
@@ -91,41 +104,53 @@
json.put("curPage", page);
return json.toString();
}
-
+
@ResponseBody
- @RequestMapping(value = "/sensorManagement_search.do", method = { RequestMethod.POST, RequestMethod.GET })
+ @RequestMapping(
+ value = {"/sensorManagement_search.do"},
+ method = {RequestMethod.POST, RequestMethod.GET}
+ )
public String sensorManagement_search(HttpServletRequest request) {
String input = request.getParameter("input");
int curPage = 1;
- List<Integer> pageList = new ArrayList<Integer>();
- List<tb_gas> sensorManagementList = gasService.searchSensorManagement(input);
+ List<Integer> pageList = new ArrayList();
+ List<tb_gas> sensorManagementList = this.gasService.searchSensorManagement(input);
pageList.add(1);
JSONObject json = new JSONObject();
json.put("dataList", sensorManagementList);
json.put("pageList", pageList);
- json.put("curPage", curPage);
+ json.put("curPage", Integer.valueOf(curPage));
return json.toString();
}
-
+
@ResponseBody
- @RequestMapping(value = "/sensorManagement_delete.do", method = { RequestMethod.POST, RequestMethod.GET })
+ @RequestMapping(
+ value = {"/sensorManagement_delete.do"},
+ method = {RequestMethod.POST, RequestMethod.GET}
+ )
public void labelManagement_delete(HttpServletRequest request) {
String checkValStr = request.getParameter("checkVal");
checkValStr = checkValStr.replaceAll("\"", "");
String[] checkVal = checkValStr.split(",");
- gasService.sensorManagement_delete(checkVal);
+ this.gasService.sensorManagement_delete(checkVal);
}
@ResponseBody
- @RequestMapping(value = "/sensorManagement_deleteAll.do", method = { RequestMethod.POST, RequestMethod.GET })
+ @RequestMapping(
+ value = {"/sensorManagement_deleteAll.do"},
+ method = {RequestMethod.POST, RequestMethod.GET}
+ )
public void labelManagement_deleteAll(HttpServletRequest request) {
- gasService.sensorManagement_deleteAll();
+ this.gasService.sensorManagement_deleteAll();
}
-
- @RequestMapping(value = "/sensorManagement_add.do", method = { RequestMethod.POST, RequestMethod.GET })
+
+ @RequestMapping(
+ value = {"/sensorManagement_add.do"},
+ method = {RequestMethod.POST, RequestMethod.GET}
+ )
public void sensorManagement_add(HttpServletRequest request) {
- List<tb_collector> macNameList = gasService.getmacName(request.getParameter("gasMacid"));
- String macName = macNameList.get(0).getMacname();
+ List<tb_collector> macNameList = this.gasService.getmacName(request.getParameter("gasMacid"));
+ String macName = ((tb_collector)macNameList.get(0)).getMacname();
String id = request.getParameter("gasId");
tb_gas gas = new tb_gas();
gas.setTong_dao(request.getParameter("gasTd"));
@@ -137,18 +162,22 @@
gas.setY(request.getParameter("gasY"));
gas.setWei_zhi(macName);
gas.setId(Integer.parseInt(request.getParameter("gasId")));
- int exist = gasService.sensor_exist(id);
+ int exist = this.gasService.sensor_exist(id);
if (exist > 0) {
- gasService.sensorManagement_modify(gas);
+ this.gasService.sensorManagement_modify(gas);
} else {
- gasService.sensorManagement_add(gas);
- }
+ this.gasService.sensorManagement_add(gas);
+ }
+
}
-
- @RequestMapping(value = "/sensorManagement_modify.do", method = { RequestMethod.POST, RequestMethod.GET })
+
+ @RequestMapping(
+ value = {"/sensorManagement_modify.do"},
+ method = {RequestMethod.POST, RequestMethod.GET}
+ )
public void sensorManagement_modify(HttpServletRequest request) {
- List<tb_collector> macNameList = gasService.getmacName(request.getParameter("gasMacid"));
- String macName = macNameList.get(0).getMacname();
+ List<tb_collector> macNameList = this.gasService.getmacName(request.getParameter("gasMacid"));
+ String macName = ((tb_collector)macNameList.get(0)).getMacname();
String id = request.getParameter("gasId");
tb_gas gas = new tb_gas();
gas.setTong_dao(request.getParameter("gasTd"));
@@ -159,16 +188,16 @@
gas.setX(request.getParameter("gasX"));
gas.setY(request.getParameter("gasY"));
gas.setWei_zhi(macName);
- gas.setId(Integer.parseInt(request.getParameter("gasId")));
- gasService.sensorManagement_modify(gas);
+ gas.setId(Integer.parseInt(request.getParameter("gasId")));
+ this.gasService.sensorManagement_modify(gas);
}
-
- // 瀵硅薄杞暟缁�
+
public static List<Object[]> objectToArray(List<tb_gas> sensorManagementList) {
- List<Object[]> reList = new ArrayList<>();
- for (int i = 0; i < sensorManagementList.size(); i++) {
- List<String> words = new ArrayList<String>();
- tb_gas gas = (tb_gas) sensorManagementList.get(i);
+ List<Object[]> reList = new ArrayList();
+
+ for(int i = 0; i < sensorManagementList.size(); ++i) {
+ List<String> words = new ArrayList();
+ tb_gas gas = (tb_gas)sensorManagementList.get(i);
words.add(String.valueOf(gas.getId()));
words.add(gas.getWei_zhi());
words.add(gas.getGas_type());
@@ -181,70 +210,84 @@
words.add(gas.getX());
words.add(gas.getY());
words.add(gas.getAddtime());
- String[] array = words.toArray(new String[0]);
+ String[] array = (String[])words.toArray(new String[0]);
reList.add(array);
}
+
return reList;
}
-
+
@ResponseBody
- @RequestMapping(value = "/sensorManagement_export.do", method = { RequestMethod.POST, RequestMethod.GET })
+ @RequestMapping(
+ value = {"/sensorManagement_export.do"},
+ method = {RequestMethod.POST, RequestMethod.GET}
+ )
public String sensorManagement_export(HttpServletRequest request, HttpServletResponse response) {
String toPage = "forward:/hxzk/gas/sensorManagement.jsp";
- List<tb_gas> sensorManagementList = gasService.getSensorManagement();
- String[] rowName = { "璁惧缂栧彿","瀹夎浣嶇疆","姘斾綋绫诲瀷","娴撳害鍊�","鍛婅鎯呭喌","閲囬泦浠湴鍧�","鎵�鍦ㄩ�氶亾","鍛婅闃堝��","IP鍦板潃"," X鍧愭爣 ","Y鍧愭爣","鏇存柊鏃堕棿"};
+ List<tb_gas> sensorManagementList = this.gasService.getSensorManagement();
+ String[] rowName = new String[]{"璁惧缂栧彿", "瀹夎浣嶇疆", "姘斾綋绫诲瀷", "娴撳害鍊�", "鍛婅鎯呭喌", "閲囬泦浠湴鍧�", "鎵�鍦ㄩ�氶亾", "鍛婅闃堝��", "IP鍦板潃", "\tX鍧愭爣\t", "Y鍧愭爣", "鏇存柊鏃堕棿"};
List<Object[]> dataList = objectToArray(sensorManagementList);
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;
}
- @RequestMapping(value = "/historicalDetection.do", method = { RequestMethod.POST, RequestMethod.GET })
+ @RequestMapping(
+ value = {"/historicalDetection.do"},
+ method = {RequestMethod.POST, RequestMethod.GET}
+ )
public String historicalDetection(HttpServletRequest request) {
String toPage = "forward:/hxzk/gas/historicalDetection.jsp";
- List<tb_gas_history> historicalDetectionList = gasService.getHistoricalDetection(1);
+ List<tb_gas_history> historicalDetectionList = this.gasService.getHistoricalDetection(1);
request.setAttribute("historicalDetectionList", historicalDetectionList);
int curPage = 1;
- int count = gasService.getHistoricalDetectionCount();
+ int count = this.gasService.getHistoricalDetectionCount();
int minPage = PageUtil.getMinPage(count);
request.setAttribute("pageList", PageUtil.getPage(minPage));
- request.setAttribute("curPage", curPage);
+ request.setAttribute("curPage", Integer.valueOf(curPage));
return toPage;
}
-
+
@ResponseBody
- @RequestMapping(value = "/historicalDetection_search.do", method = { RequestMethod.POST, RequestMethod.GET })
+ @RequestMapping(
+ value = {"/historicalDetection_search.do"},
+ method = {RequestMethod.POST, RequestMethod.GET}
+ )
public String historicalDetection_search(HttpServletRequest request) {
String input = request.getParameter("input");
int curPage = 1;
- List<Integer> pageList = new ArrayList<Integer>();
- List<tb_gas_history> historicalDetectionList = gasService.searchHistoricalDetection(input);
+ List<Integer> pageList = new ArrayList();
+ List<tb_gas_history> historicalDetectionList = this.gasService.searchHistoricalDetection(input);
pageList.add(1);
JSONObject json = new JSONObject();
json.put("dataList", historicalDetectionList);
json.put("pageList", pageList);
- json.put("curPage", curPage);
+ json.put("curPage", Integer.valueOf(curPage));
return json.toString();
}
@ResponseBody
- @RequestMapping(value = "/historicalDetection_page.do", method = { RequestMethod.POST, RequestMethod.GET })
+ @RequestMapping(
+ value = {"/historicalDetection_page.do"},
+ method = {RequestMethod.POST, RequestMethod.GET}
+ )
public String historicalDetection_page(HttpServletRequest request) {
String pageStr = request.getParameter("page");
String curPageStr = request.getParameter("curPage");
- int count = gasService.getHistoricalDetectionCount();
+ int count = this.gasService.getHistoricalDetectionCount();
int minPage = PageUtil.getMinPage(count);
int curPage = Integer.parseInt(curPageStr);
int page = 1;
@@ -259,7 +302,8 @@
} else {
page = Integer.parseInt(pageStr);
}
- List<tb_gas_history> historicalDetectionList = gasService.getHistoricalDetection(page);
+
+ List<tb_gas_history> historicalDetectionList = this.gasService.getHistoricalDetection(page);
List<Integer> pageList = PageUtil.getPage(PageUtil.getLocPage(page, curPage), page, minPage);
JSONObject json = new JSONObject();
json.put("dataList", historicalDetectionList);
@@ -267,28 +311,34 @@
json.put("curPage", page);
return json.toString();
}
-
+
@ResponseBody
- @RequestMapping(value = "/historicalDetection_delete.do", method = { RequestMethod.POST, RequestMethod.GET })
+ @RequestMapping(
+ value = {"/historicalDetection_delete.do"},
+ method = {RequestMethod.POST, RequestMethod.GET}
+ )
public void historicalDetection_delete(HttpServletRequest request) {
String checkValStr = request.getParameter("checkVal");
checkValStr = checkValStr.replaceAll("\"", "");
String[] checkVal = checkValStr.split(",");
- gasService.historicalDetection_delete(checkVal);
+ this.gasService.historicalDetection_delete(checkVal);
}
@ResponseBody
- @RequestMapping(value = "/historicalDetection_deleteAll.do", method = { RequestMethod.POST, RequestMethod.GET })
+ @RequestMapping(
+ value = {"/historicalDetection_deleteAll.do"},
+ method = {RequestMethod.POST, RequestMethod.GET}
+ )
public void historicalDetection_deleteAll(HttpServletRequest request) {
- gasService.historicalDetection_deleteAll();
+ this.gasService.historicalDetection_deleteAll();
}
-
- // 瀵硅薄杞暟缁�
+
public static List<Object[]> hisobjectToArray(List<tb_gas_history> historicalDetectionList) {
- List<Object[]> reList = new ArrayList<>();
- for (int i = 0; i < historicalDetectionList.size(); i++) {
- List<String> words = new ArrayList<String>();
- tb_gas_history gas_history = (tb_gas_history) historicalDetectionList.get(i);
+ List<Object[]> reList = new ArrayList();
+
+ for(int i = 0; i < historicalDetectionList.size(); ++i) {
+ List<String> words = new ArrayList();
+ tb_gas_history gas_history = (tb_gas_history)historicalDetectionList.get(i);
words.add(String.valueOf(gas_history.getId()));
words.add(gas_history.getMacid());
words.add(gas_history.getName());
@@ -298,72 +348,84 @@
words.add(String.valueOf(gas_history.getY()));
words.add(gas_history.getDeep());
words.add(gas_history.getAddtime());
- String[] array = words.toArray(new String[0]);
+ String[] array = (String[])words.toArray(new String[0]);
reList.add(array);
}
+
return reList;
}
-
+
@ResponseBody
- @RequestMapping(value = "/historicalDetection_export.do", method = { RequestMethod.POST, RequestMethod.GET })
+ @RequestMapping(
+ value = {"/historicalDetection_export.do"},
+ method = {RequestMethod.POST, RequestMethod.GET}
+ )
public String historicalDetection_export(HttpServletRequest request, HttpServletResponse response) {
String toPage = "forward:/hxzk/gas/historicalDetection.jsp";
- List<tb_gas_history> historicalDetectionList = gasService.getHistoricalDetection();
- String[] rowName = {"搴忓彿","璁惧閫氶亾 ","瀹夎浣嶇疆","姘斾綋绫诲瀷","鍛婅鐘舵��","X鍧愭爣","Y鍧愭爣","娴撳害鍊�","娣诲姞鏃堕棿"};
+ List<tb_gas_history> historicalDetectionList = this.gasService.getHistoricalDetection();
+ String[] rowName = new String[]{"搴忓彿", "璁惧閫氶亾\t", "瀹夎浣嶇疆", "姘斾綋绫诲瀷", "鍛婅鐘舵��", "X鍧愭爣", "Y鍧愭爣", "娴撳害鍊�", "娣诲姞鏃堕棿"};
List<Object[]> dataList = hisobjectToArray(historicalDetectionList);
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;
}
-
-
- @RequestMapping(value = "/collectorManagement.do", method = { RequestMethod.POST, RequestMethod.GET })
+ @RequestMapping(
+ value = {"/collectorManagement.do"},
+ method = {RequestMethod.POST, RequestMethod.GET}
+ )
public String collectorManagement(HttpServletRequest request) {
String toPage = "forward:/hxzk/gas/collectorManagement.jsp";
- List<tb_collector> collectorManagementList = gasService.getCollectorManagement(1);
+ List<tb_collector> collectorManagementList = this.gasService.getCollectorManagement(1);
request.setAttribute("collectorManagementList", collectorManagementList);
int curPage = 1;
- int count = gasService.getCollectorManagementCount();
+ int count = this.gasService.getCollectorManagementCount();
int minPage = PageUtil.getMinPage(count);
request.setAttribute("pageList", PageUtil.getPage(minPage));
- request.setAttribute("curPage", curPage);
+ request.setAttribute("curPage", Integer.valueOf(curPage));
return toPage;
}
-
+
@ResponseBody
- @RequestMapping(value = "/collectorManagement_search.do", method = { RequestMethod.POST, RequestMethod.GET })
+ @RequestMapping(
+ value = {"/collectorManagement_search.do"},
+ method = {RequestMethod.POST, RequestMethod.GET}
+ )
public String collectorManagement_search(HttpServletRequest request) {
String input = request.getParameter("input");
int curPage = 1;
- List<Integer> pageList = new ArrayList<Integer>();
- List<tb_collector> collectorManagementList = gasService.searchCollectorManagement(input);
+ List<Integer> pageList = new ArrayList();
+ List<tb_collector> collectorManagementList = this.gasService.searchCollectorManagement(input);
pageList.add(1);
JSONObject json = new JSONObject();
json.put("dataList", collectorManagementList);
json.put("pageList", pageList);
- json.put("curPage", curPage);
+ json.put("curPage", Integer.valueOf(curPage));
return json.toString();
}
@ResponseBody
- @RequestMapping(value = "/collectorManagement_page.do", method = { RequestMethod.POST, RequestMethod.GET })
+ @RequestMapping(
+ value = {"/collectorManagement_page.do"},
+ method = {RequestMethod.POST, RequestMethod.GET}
+ )
public String collectorManagement_page(HttpServletRequest request) {
String pageStr = request.getParameter("page");
String curPageStr = request.getParameter("curPage");
- int count = gasService.getCollectorManagementCount();
+ int count = this.gasService.getCollectorManagementCount();
int minPage = PageUtil.getMinPage(count);
int curPage = Integer.parseInt(curPageStr);
int page = 1;
@@ -378,7 +440,8 @@
} else {
page = Integer.parseInt(pageStr);
}
- List<tb_collector> labelManagementList = gasService.getCollectorManagement(page);
+
+ List<tb_collector> labelManagementList = this.gasService.getCollectorManagement(page);
List<Integer> pageList = PageUtil.getPage(PageUtil.getLocPage(page, curPage), page, minPage);
JSONObject json = new JSONObject();
json.put("dataList", labelManagementList);
@@ -386,23 +449,32 @@
json.put("curPage", page);
return json.toString();
}
-
+
@ResponseBody
- @RequestMapping(value = "/collectorManagement_delete.do", method = { RequestMethod.POST, RequestMethod.GET })
+ @RequestMapping(
+ value = {"/collectorManagement_delete.do"},
+ method = {RequestMethod.POST, RequestMethod.GET}
+ )
public void collectorManagement_delete(HttpServletRequest request) {
String checkValStr = request.getParameter("checkVal");
checkValStr = checkValStr.replaceAll("\"", "");
String[] checkVal = checkValStr.split(",");
- gasService.collectorManagement_delete(checkVal);
+ this.gasService.collectorManagement_delete(checkVal);
}
@ResponseBody
- @RequestMapping(value = "/collectorManagement_deleteAll.do", method = { RequestMethod.POST, RequestMethod.GET })
+ @RequestMapping(
+ value = {"/collectorManagement_deleteAll.do"},
+ method = {RequestMethod.POST, RequestMethod.GET}
+ )
public void collectorManagement_deleteAll(HttpServletRequest request) {
- gasService.collectorManagement_deleteAll();
+ this.gasService.collectorManagement_deleteAll();
}
-
- @RequestMapping(value = "/collectorManagement_add.do", method = { RequestMethod.POST, RequestMethod.GET })
+
+ @RequestMapping(
+ value = {"/collectorManagement_add.do"},
+ method = {RequestMethod.POST, RequestMethod.GET}
+ )
public void collectorManagement_add(HttpServletRequest request) {
tb_collector collector = new tb_collector();
collector.setMacid(Integer.parseInt(request.getParameter("hostId")));
@@ -412,10 +484,13 @@
collector.setMacname(request.getParameter("insLoc"));
collector.setPosx(Integer.parseInt(request.getParameter("coordX")));
collector.setPosy(Integer.parseInt(request.getParameter("coordY")));
- gasService.collectorManagement_add(collector);
+ this.gasService.collectorManagement_add(collector);
}
-
- @RequestMapping(value = "/collectorManagement_modify.do", method = { RequestMethod.POST, RequestMethod.GET })
+
+ @RequestMapping(
+ value = {"/collectorManagement_modify.do"},
+ method = {RequestMethod.POST, RequestMethod.GET}
+ )
public void collectorManagement_modify(HttpServletRequest request) {
tb_collector collector = new tb_collector();
collector.setId(Integer.parseInt(request.getParameter("id")));
@@ -425,16 +500,16 @@
collector.setIp(request.getParameter("intId"));
collector.setMacname(request.getParameter("insLoc"));
collector.setPosx(Integer.parseInt(request.getParameter("coordX")));
- collector.setPosy(Integer.parseInt(request.getParameter("coordY")));
- gasService.collectorManagement_modify(collector);
+ collector.setPosy(Integer.parseInt(request.getParameter("coordY")));
+ this.gasService.collectorManagement_modify(collector);
}
-
- // 瀵硅薄杞暟缁�
+
public static List<Object[]> collectorobjectToArray(List<tb_collector> collectorManagementList) {
- List<Object[]> reList = new ArrayList<>();
- for (int i = 0; i < collectorManagementList.size(); i++) {
- List<String> words = new ArrayList<String>();
- tb_collector collector = (tb_collector) collectorManagementList.get(i);
+ List<Object[]> reList = new ArrayList();
+
+ for(int i = 0; i < collectorManagementList.size(); ++i) {
+ List<String> words = new ArrayList();
+ tb_collector collector = (tb_collector)collectorManagementList.get(i);
words.add(String.valueOf(collector.getId()));
words.add(String.valueOf(collector.getMacid()));
words.add(String.valueOf(collector.getStartip()));
@@ -444,100 +519,116 @@
words.add(String.valueOf(collector.getPosx()));
words.add(String.valueOf(collector.getPosy()));
words.add(String.valueOf(collector.getAddtime()));
- String[] array = words.toArray(new String[0]);
+ String[] array = (String[])words.toArray(new String[0]);
reList.add(array);
}
+
return reList;
}
-
+
@ResponseBody
- @RequestMapping(value = "/collectorManagement_export.do", method = { RequestMethod.POST, RequestMethod.GET })
+ @RequestMapping(
+ value = {"/collectorManagement_export.do"},
+ method = {RequestMethod.POST, RequestMethod.GET}
+ )
public String collectorManagement_export(HttpServletRequest request, HttpServletResponse response) {
String toPage = "forward:/hxzk/gas/collectorManagement.jsp";
- List<tb_collector> collectorManagementList = gasService.getCollectorManagement();
- String[] rowName = {"搴忓彿","涓绘満鍦板潃","璧峰鍦板潃","鏁版嵁闀垮害","IP鍦板潃","瀹夎浣嶇疆","X鍧愭爣","Y鍧愭爣","娣诲姞鏃堕棿"};
+ List<tb_collector> collectorManagementList = this.gasService.getCollectorManagement();
+ String[] rowName = new String[]{"搴忓彿", "涓绘満鍦板潃", "璧峰鍦板潃", "鏁版嵁闀垮害", "IP鍦板潃", "瀹夎浣嶇疆", "X鍧愭爣", "Y鍧愭爣", "娣诲姞鏃堕棿"};
List<Object[]> dataList = collectorobjectToArray(collectorManagementList);
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;
}
-
- final Logger logger = LoggerFactory.getLogger(getClass());
- @RequestMapping(value = "/collectorManagement_bw.do", method = { RequestMethod.POST, RequestMethod.GET })
+ @RequestMapping(
+ value = {"/collectorManagement_bw.do"},
+ method = {RequestMethod.POST, RequestMethod.GET}
+ )
public void collectorManagement_bw(HttpServletRequest request) throws IOException {
String jsonString = RequestUtils.getRequestJsonString(request, Config.getCharset());
- logger.info("浼犲叆鏁版嵁IData锛�" + jsonString);
- tb_collector collector = (tb_collector) JSONObject.toBean(JSONObject.fromObject(jsonString), tb_collector.class);
- gasService.collectorManagement_add(collector);
+ this.logger.info("浼犲叆鏁版嵁IData锛�" + jsonString);
+ tb_collector collector = (tb_collector)JSONObject.toBean(JSONObject.fromObject(jsonString), tb_collector.class);
+ this.gasService.collectorManagement_add(collector);
}
-
- @RequestMapping(value = "/sensorManagement_bw.do", method = { RequestMethod.POST, RequestMethod.GET })
+
+ @RequestMapping(
+ value = {"/sensorManagement_bw.do"},
+ method = {RequestMethod.POST, RequestMethod.GET}
+ )
public void sensorManagement_bw(HttpServletRequest request) throws IOException {
String jsonString = RequestUtils.getRequestJsonString(request, Config.getCharset());
- tb_gas gas = (tb_gas) JSONObject.toBean(JSONObject.fromObject(jsonString), tb_gas.class);
- int exist = gasService.sensor_exist(String.valueOf(gas.getId()));
+ tb_gas gas = (tb_gas)JSONObject.toBean(JSONObject.fromObject(jsonString), tb_gas.class);
+ int exist = this.gasService.sensor_exist(String.valueOf(gas.getId()));
if (exist == 0) {
- gasService.sensorManagement_add(gas);
- }
+ this.gasService.sensorManagement_add(gas);
+ }
+
}
-
- @RequestMapping(value = "/modifyWarning.do", method = { RequestMethod.POST, RequestMethod.GET })
+
+ @RequestMapping(
+ value = {"/modifyWarning.do"},
+ method = {RequestMethod.POST, RequestMethod.GET}
+ )
public void modifyWarning(HttpServletRequest request) throws IOException {
String jsonString = RequestUtils.getRequestJsonString(request, Config.getCharset());
- tb_gas gas = (tb_gas) JSONObject.toBean(JSONObject.fromObject(jsonString), tb_gas.class);
- //鏄剧ずsql
- String sqlString = "UPDATE tb_gas SET status = "+gas.getStatus()+",nong_du="+gas.getNong_du()+",addtime="+GetNowTime.timestamp2()+" WHERE id=" + gas.getId();
- String messageJson = GetNowTime.timestamp2()+ " 鏀讹細"+ sqlString ;
+ tb_gas gas = (tb_gas)JSONObject.toBean(JSONObject.fromObject(jsonString), tb_gas.class);
+ String sqlString = "UPDATE tb_gas SET status = " + gas.getStatus() + ",nong_du=" + gas.getNong_du() + ",addtime=" + GetNowTime.timestamp2() + " WHERE id=" + gas.getId();
+ (new StringBuilder()).append(GetNowTime.timestamp2()).append(" 鏀讹細").append(sqlString).toString();
String BaowenPath = Config.getBaowenConfig();
String baowenStatus = ModifyConfig.readData(BaowenPath, "baowenSwitch");
- if (baowenStatus.equals("1")){
- /* Udp_Receive.mysqlMessage.add(messageJson); */
+ if (baowenStatus.equals("1")) {
}
- //
- gasService.modifyWarning(gas);
+
+ this.gasService.modifyWarning(gas);
}
-
+
@ResponseBody
- @RequestMapping(value = "/getGasLength.do", method = { RequestMethod.POST, RequestMethod.GET })
+ @RequestMapping(
+ value = {"/getGasLength.do"},
+ method = {RequestMethod.POST, RequestMethod.GET}
+ )
public String getGasLength(HttpServletRequest request) throws IOException {
JSONObject json = new JSONObject();
String jsonString = RequestUtils.getRequestJsonString(request, Config.getCharset());
- tb_gas gas = (tb_gas) JSONObject.toBean(JSONObject.fromObject(jsonString), tb_gas.class);
+ tb_gas gas = (tb_gas)JSONObject.toBean(JSONObject.fromObject(jsonString), tb_gas.class);
String ip = gas.getCollect_ip();
- Integer length = gasService.getGasNumber(ip);
+ Integer length = this.gasService.getGasNumber(ip);
json.put("length", length);
return json.toString();
}
-
+
@ResponseBody
- @RequestMapping(value = "/getGas.do", method = { RequestMethod.POST, RequestMethod.GET })
+ @RequestMapping(
+ value = {"/getGas.do"},
+ method = {RequestMethod.POST, RequestMethod.GET}
+ )
public String getGas(HttpServletRequest request) throws IOException {
JSONObject json = new JSONObject();
String jsonString = RequestUtils.getRequestJsonString(request, Config.getCharset());
- tb_gas gas = (tb_gas) JSONObject.toBean(JSONObject.fromObject(jsonString), tb_gas.class);
+ tb_gas gas = (tb_gas)JSONObject.toBean(JSONObject.fromObject(jsonString), tb_gas.class);
String tongdao = gas.getTong_dao();
String ip = gas.getCollect_ip();
- List<tb_gas> gasList = gasService.getGas(tongdao,ip);
+ List<tb_gas> gasList = this.gasService.getGas(tongdao, ip);
if (gasList.size() > 0) {
json.put("result", gasList.get(0));
} else {
json.put("result", "null");
}
+
return json.toString();
}
-
-
}
--
Gitblit v1.10.0