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/GpsController.java | 629 +++++++++++++++++++++++++++++++++++++++++++--------------
1 files changed, 473 insertions(+), 156 deletions(-)
diff --git a/src/main/java/com/hxzkoa/controller/GpsController.java b/src/main/java/com/hxzkoa/controller/GpsController.java
index 54911f3..924c7f4 100644
--- a/src/main/java/com/hxzkoa/controller/GpsController.java
+++ b/src/main/java/com/hxzkoa/controller/GpsController.java
@@ -1,5 +1,26 @@
+//
+// Source code recreated from a .class file by IntelliJ IDEA
+// (powered by FernFlower decompiler)
+//
+
package com.hxzkoa.controller;
+import com.hxzkoa.json.tb_gps;
+import com.hxzkoa.json.tb_rtkanchor;
+import com.hxzkoa.json.tb_system;
+import com.hxzkoa.json.tb_tag;
+import com.hxzkoa.services.GpsService;
+import com.hxzkoa.services.LabelService;
+import com.hxzkoa.services.LocationService;
+import com.hxzkoa.services.SysSettingService;
+import com.hxzkoa.udp.Dell_GNGGA;
+import com.hxzkoa.udp.Udp_Out;
+import com.hxzkoa.util.AddTxt;
+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.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
@@ -10,11 +31,9 @@
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
-
-
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-
+import net.sf.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
@@ -22,22 +41,6 @@
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
-import com.hxzkoa.json.tb_gps;
-import com.hxzkoa.json.tb_system;
-import com.hxzkoa.json.tb_tag;
-import com.hxzkoa.services.GpsService;
-import com.hxzkoa.services.LabelService;
-import com.hxzkoa.services.SysSettingService;
-import com.hxzkoa.udp.Dell_GNGGA;
-import com.hxzkoa.udp.Udp_Out;
-import com.hxzkoa.util.AddTxt;
-import com.hxzkoa.util.Config;
-import com.hxzkoa.util.ExcelUtils;
-import com.hxzkoa.util.ModifyConfig;
-import com.hxzkoa.util.PageUtil;
-
-import net.sf.json.JSONObject;
-
@Controller
public class GpsController {
@Autowired
@@ -46,55 +49,77 @@
private LabelService labelService;
@Autowired
private SysSettingService sysSettingService;
-
+ @Autowired
+ private LocationService locationService;
+
+ public GpsController() {
+ }
+
@ResponseBody
- @RequestMapping(value = "/updateperson.do",method = { RequestMethod.POST, RequestMethod.GET })
+ @RequestMapping(
+ value = {"/updateperson.do"},
+ method = {RequestMethod.POST, RequestMethod.GET}
+ )
public void updateperson(HttpServletRequest request) {
String strs = request.getParameter("strs");
Dell_GNGGA.dell_gps(strs);
}
-
+
@ResponseBody
- @RequestMapping(value = "/xinhuifang.do",method = { RequestMethod.POST, RequestMethod.GET })
+ @RequestMapping(
+ value = {"/xinhuifang.do"},
+ method = {RequestMethod.POST, RequestMethod.GET}
+ )
public ArrayList<String> xinhuifang(HttpServletRequest request) {
ArrayList<String> baowen = AddTxt.txt2String();
- //System.out.print(baowen.get(0));
return baowen;
}
-
- @RequestMapping(value = "/huifang.do",method = { RequestMethod.POST, RequestMethod.GET })
+
+ @RequestMapping(
+ value = {"/huifang.do"},
+ method = {RequestMethod.POST, RequestMethod.GET}
+ )
public String huifang(HttpServletRequest request) {
String toPage = "forward:/hxzk/baidu.jsp";
return toPage;
}
-
- @RequestMapping(value = "/huifangdodo.do",method = { RequestMethod.POST, RequestMethod.GET })
+
+ @RequestMapping(
+ value = {"/huifangdodo.do"},
+ method = {RequestMethod.POST, RequestMethod.GET}
+ )
public List<String> huifangdodo(HttpServletRequest request) {
- List<String> sb = gpsService.txt();
+ List<String> sb = this.gpsService.txt();
return sb;
}
-
- @RequestMapping(value = "/gpsManagement.do", method = { RequestMethod.POST, RequestMethod.GET })
+
+ @RequestMapping(
+ value = {"/gpsManagement.do"},
+ method = {RequestMethod.POST, RequestMethod.GET}
+ )
public String gpsManagement(HttpServletRequest request) {
String toPage = "forward:/hxzk/GPS/gpsManagement.jsp";
- List<tb_gps> gpsManagementList = gpsService.getGpsManagement(1);
+ List<tb_gps> gpsManagementList = this.gpsService.getGpsManagement(1);
request.setAttribute("gpsManagementList", gpsManagementList);
- List<tb_system> settingList = sysSettingService.getSetting();
+ List<tb_system> settingList = this.sysSettingService.getSetting();
request.setAttribute("settingList", settingList);
int curPage = 1;
- int count = gpsService.getGpsManagementCount();
+ int count = this.gpsService.getGpsManagementCount();
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 = "/gpsManagement_page.do", method = { RequestMethod.POST, RequestMethod.GET })
+ @RequestMapping(
+ value = {"/gpsManagement_page.do"},
+ method = {RequestMethod.POST, RequestMethod.GET}
+ )
public String gpsManagement_page(HttpServletRequest request) {
String pageStr = request.getParameter("page");
String curPageStr = request.getParameter("curPage");
- int count = gpsService.getGpsManagementCount();
+ int count = this.gpsService.getGpsManagementCount();
int minPage = PageUtil.getMinPage(count);
int curPage = Integer.parseInt(curPageStr);
int page = 1;
@@ -109,7 +134,8 @@
} else {
page = Integer.parseInt(pageStr);
}
- List<tb_gps> gpsManagementList = gpsService.getGpsManagement(page);
+
+ List<tb_gps> gpsManagementList = this.gpsService.getGpsManagement(page);
List<Integer> pageList = PageUtil.getPage(PageUtil.getLocPage(page, curPage), page, minPage);
JSONObject json = new JSONObject();
json.put("dataList", gpsManagementList);
@@ -117,113 +143,173 @@
json.put("curPage", page);
return json.toString();
}
-
+
@ResponseBody
- @RequestMapping(value = "/gpsManagement_search.do", method = { RequestMethod.POST, RequestMethod.GET })
+ @RequestMapping(
+ value = {"/gpsManagement_search.do"},
+ method = {RequestMethod.POST, RequestMethod.GET}
+ )
public String gpsManagement_search(HttpServletRequest request) {
String input = request.getParameter("input");
int curPage = 1;
- List<Integer> pageList = new ArrayList<Integer>();
- List<tb_gps> gpsManagementList = gpsService.searchGpsManagement(input);
+ List<Integer> pageList = new ArrayList();
+ List<tb_gps> gpsManagementList = this.gpsService.searchGpsManagement(input);
pageList.add(1);
JSONObject json = new JSONObject();
json.put("dataList", gpsManagementList);
json.put("pageList", pageList);
- json.put("curPage", curPage);
+ json.put("curPage", Integer.valueOf(curPage));
return json.toString();
}
-
+
@ResponseBody
- @RequestMapping(value = "/gpsManagement_delete.do", method = { RequestMethod.POST, RequestMethod.GET })
+ @RequestMapping(
+ value = {"/gpsManagement_delete.do"},
+ method = {RequestMethod.POST, RequestMethod.GET}
+ )
public void gpsManagement_delete(HttpServletRequest request) throws ParseException {
String checkValStr = request.getParameter("checkVal");
checkValStr = checkValStr.replaceAll("\"", "");
String[] checkVal = checkValStr.split(",");
- gpsService.gpsManagement_delete(checkVal);
- for(int i = 0; i < checkVal.length; i++) {
- String xieyi = "BSTOCS1,DELETEGPS,"+checkVal[i]+",END";
+ this.gpsService.gpsManagement_delete(checkVal);
+
+ for(int i = 0; i < checkVal.length; ++i) {
+ String xieyi = "BSTOCS1,DELETEGPS," + checkVal[i] + ",END";
Udp_Out.udp_to_cs(xieyi);
}
+
}
-
+
@ResponseBody
- @RequestMapping(value = "/gpsManagement_export.do", method = { RequestMethod.POST, RequestMethod.GET })
+ @RequestMapping(
+ value = {"/gpsManagement_deletea.do"},
+ method = {RequestMethod.POST, RequestMethod.GET}
+ )
+ public int gpsManagement_deletea(HttpServletRequest request) throws ParseException {
+ String checkValStr = request.getParameter("checkVal");
+ checkValStr = checkValStr.replaceAll("\"", "");
+ String[] checkVal = checkValStr.split(",");
+ int aaa = this.gpsService.gpsManagement_deletea(checkVal);
+
+ for(int i = 0; i < checkVal.length; ++i) {
+ String xieyi = "BSTOCS1,DELETEGPS," + checkVal[i] + ",END";
+ Udp_Out.udp_to_cs(xieyi);
+ }
+
+ return aaa;
+ }
+
+ @ResponseBody
+ @RequestMapping(
+ value = {"/gpsManagement_export.do"},
+ method = {RequestMethod.POST, RequestMethod.GET}
+ )
public String gpsManagement_export(HttpServletRequest request, HttpServletResponse response) {
String toPage = "forward:/hxzk/GPS/gpsManagement.jsp";
- List<tb_gps> gpsManagementList = gpsService.getGpsManagement();
- String[] rowName = {"搴忓彿", "璁惧缂栧彿","绾害","缁忓害","GPS鐘舵��","鍗槦鏁�","娴锋嫈楂�","宸垎绔橧D","鐢甸噺","鏇存柊鏃堕棿"};
+ List<tb_gps> gpsManagementList = this.gpsService.getGpsManagement();
+ String[] rowName = new String[]{"璁惧缂栧彿", "鍗″彿"};
List<Object[]> dataList = objectToArray(gpsManagementList);
ExcelUtils excel = new ExcelUtils("gps瀹氫綅", 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 = "/gpsManagement_zeng.do",method = { RequestMethod.POST, RequestMethod.GET })
- public ModelAndView zeng(tb_system request) throws Exception{
+
+ @RequestMapping(
+ value = {"/gpsManagement_zeng.do"},
+ method = {RequestMethod.POST, RequestMethod.GET}
+ )
+ public ModelAndView zeng(tb_system request) throws Exception {
ModelAndView mv = new ModelAndView();
- gpsService.gpszeng(request);
+ this.gpsService.gpszeng(request);
mv.setViewName("redirect:/gpsManagement.do");
return mv;
}
-
- @RequestMapping(value = "/historicalgpsLocation.do", method = { RequestMethod.POST, RequestMethod.GET })
+
+ @RequestMapping(
+ value = {"/historicalgpsLocation.do"},
+ method = {RequestMethod.POST, RequestMethod.GET}
+ )
public String historicalgpsLocation(HttpServletRequest request) throws SQLException {
String toPage = "forward:/hxzk/GPS/historicalgpsLocation.jsp";
String pagePath = Config.getPageConfig();
Integer perPage = Integer.parseInt(ModifyConfig.readData(pagePath, "perPage"));
- // List<tb_realocation> historicalLocationList =
- // locationService.getRealTimeLocation(1,perPage);
Date date = new Date(System.currentTimeMillis());
SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMdd");
String currentDate = formatter.format(date);
- List<tb_gps> trackList = gpsService.getTrack(currentDate, 1, perPage);
+ List<tb_gps> trackList = this.gpsService.getTrack(currentDate, 1, perPage);
request.setAttribute("historicalLocationList", trackList);
int curPage = 1;
- int count = gpsService.getgpsRealTimeLocationCount(currentDate);
+ int count = this.gpsService.getgpsRealTimeLocationCount(currentDate);
int minPage = PageUtil.getMinPage(count);
request.setAttribute("pageList", PageUtil.getPage(minPage));
- request.setAttribute("curPage", curPage);
+ request.setAttribute("curPage", Integer.valueOf(curPage));
request.setAttribute("perPage", perPage);
- // 澶勭悊鏃ユ湡鏌ヨ鍒楄〃
- List<String> trackDateList = gpsService.getgpsTrackDateList();
- List<String> trackDateReList = new ArrayList<String>();
+ List<String> trackDateList = this.gpsService.getgpsTrackDateList();
+ List<String> trackDateReList = new ArrayList();
trackDateReList.add(currentDate);
- for (int i = 0; i < trackDateList.size(); i++) {
- String listdate = trackDateList.get(i);
- if (!(currentDate).equals(listdate)) {
+
+ for(int i = 0; i < trackDateList.size(); ++i) {
+ String listdate = (String)trackDateList.get(i);
+ if (!currentDate.equals(listdate)) {
trackDateReList.add(listdate);
}
}
+
request.setAttribute("dateList", trackDateReList);
return toPage;
}
-
+
@ResponseBody
- @RequestMapping(value = "/historicalgpsLocation_page.do", method = { RequestMethod.POST, RequestMethod.GET })
+ @RequestMapping(
+ value = {"/historicalgpsLocationa.do"},
+ method = {RequestMethod.POST, RequestMethod.GET}
+ )
+ public JSONObject historicalgpsLocationa(HttpServletRequest request) throws SQLException {
+ JSONObject json = new JSONObject();
+ String date = request.getParameter("date");
+ int aaa = this.locationService.searchtablenameLocation("tb_gps_track_" + date);
+ if (aaa != 0) {
+ List<tb_gps> trackList = this.gpsService.getTracka(date);
+ json.put("dateList", trackList);
+ } else {
+ List<tb_gps> trackList = new ArrayList();
+ json.put("dateList", trackList);
+ }
+
+ return json;
+ }
+
+ @ResponseBody
+ @RequestMapping(
+ value = {"/historicalgpsLocation_page.do"},
+ method = {RequestMethod.POST, RequestMethod.GET}
+ )
public String historicalgpsLocation_page(HttpServletRequest request) {
String pageStr = request.getParameter("page");
String curPageStr = request.getParameter("curPage");
String date = request.getParameter("date");
- int count = gpsService.getgpsRealTimeLocationCount(date);
+ int count = this.gpsService.getgpsRealTimeLocationCount(date);
int minPage = PageUtil.getMinPage(count);
int curPage = Integer.parseInt(curPageStr);
String pagePath = Config.getPageConfig();
Integer perPage = Integer.parseInt(ModifyConfig.readData(pagePath, "perPage"));
- if (("").equals(pageStr) || pageStr == null) {
+ if ("".equals(pageStr) || pageStr == null) {
pageStr = curPageStr;
}
+
int page = 1;
if ("pre".equals(pageStr)) {
if (curPage > 1) {
@@ -236,9 +322,8 @@
} else {
page = Integer.parseInt(pageStr);
}
- // List<tb_realocation> historicalLocationList =
- // locationService.getRealTimeLocation(page,perPage);
- List<tb_gps> trackList = gpsService.getTrack(date, page, perPage);
+
+ List<tb_gps> trackList = this.gpsService.getTrack(date, page, perPage);
List<Integer> pageList = PageUtil.getPage(PageUtil.getLocPage(page, curPage), page, minPage);
JSONObject json = new JSONObject();
json.put("dataList", trackList);
@@ -246,127 +331,359 @@
json.put("curPage", page);
return json.toString();
}
-
+
@ResponseBody
- @RequestMapping(value = "/historicalgpsLocation_delete.do", method = { RequestMethod.POST, RequestMethod.GET })
+ @RequestMapping(
+ value = {"/historicalgpsLocation_delete.do"},
+ method = {RequestMethod.POST, RequestMethod.GET}
+ )
public void historicalgpsLocation_delete(HttpServletRequest request) {
String checkValStr = request.getParameter("checkVal");
String datea = request.getParameter("datea");
checkValStr = checkValStr.replaceAll("\"", "");
String[] checkVal = checkValStr.split(",");
- gpsService.realTimegpsLocation_delete(checkVal,datea);
+ this.gpsService.realTimegpsLocation_delete(checkVal, datea);
}
-
+
@ResponseBody
- @RequestMapping(value = "/historicalgpsLocation_deleteAll.do", method = { RequestMethod.POST, RequestMethod.GET })
+ @RequestMapping(
+ value = {"/historicalgpsLocation_deletea.do"},
+ method = {RequestMethod.POST, RequestMethod.GET}
+ )
+ public int historicalgpsLocation_deletea(HttpServletRequest request) {
+ String checkValStr = request.getParameter("checkVal");
+ String datea = request.getParameter("datea");
+ checkValStr = checkValStr.replaceAll("\"", "");
+ String[] checkVal = checkValStr.split(",");
+ int bbb = this.locationService.searchtablenameLocation("tb_gps_track_" + datea);
+ int aaa = 0;
+ if (bbb != 0) {
+ aaa = this.gpsService.realTimegpsLocation_deletea(checkVal, datea);
+ }
+
+ return aaa;
+ }
+
+ @ResponseBody
+ @RequestMapping(
+ value = {"/historicalgpsLocation_deleteAll.do"},
+ method = {RequestMethod.POST, RequestMethod.GET}
+ )
public void historicalLocation_deleteAll(HttpServletRequest request) {
String date = request.getParameter("aaaa");
- gpsService.realTimegpsLocation_deleteAll(date);
+ this.gpsService.realTimegpsLocation_deleteAll(date);
}
-
+
@ResponseBody
- @RequestMapping(value = "/getstatus.do", method = { RequestMethod.POST, RequestMethod.GET })
+ @RequestMapping(
+ value = {"/historicalgpsLocation_deleteAlla.do"},
+ method = {RequestMethod.POST, RequestMethod.GET}
+ )
+ public int historicalLocation_deleteAlla(HttpServletRequest request) {
+ String date = request.getParameter("date");
+ int bbb = this.locationService.searchtablenameLocation("tb_gps_track_" + date);
+ int aaa = 0;
+ if (bbb != 0) {
+ aaa = this.gpsService.realTimegpsLocation_deleteAlla(date);
+ }
+
+ return aaa;
+ }
+
+ @ResponseBody
+ @RequestMapping(
+ value = {"/getstatus.do"},
+ method = {RequestMethod.POST, RequestMethod.GET}
+ )
public String getstatus(HttpServletRequest request) {
String tagid = request.getParameter("tagid");
- String zhuangtai = gpsService.getpersontagid(tagid);
+ String zhuangtai = this.gpsService.getpersontagid(tagid);
return zhuangtai;
}
-
+
@ResponseBody
- @RequestMapping(value = "/getstatusss.do", method = { RequestMethod.POST, RequestMethod.GET })
+ @RequestMapping(
+ value = {"/getstatusss.do"},
+ method = {RequestMethod.POST, RequestMethod.GET}
+ )
public String getstatusss(HttpServletRequest request) {
String tagid = "8888";
- //System.out.print("鎵ц浜�");
- String zhuangtai = gpsService.getpersontagid(tagid);
+ String zhuangtai = this.gpsService.getpersontagid(tagid);
return zhuangtai;
}
-
+
@ResponseBody
- @RequestMapping(value = "/historicalgpsLocation_search.do", method = { RequestMethod.POST, RequestMethod.GET })
+ @RequestMapping(
+ value = {"/historicalgpsLocation_search.do"},
+ method = {RequestMethod.POST, RequestMethod.GET}
+ )
public String historicalgpsLocation_search(HttpServletRequest request) {
- String input = request.getParameter("input");
String date = request.getParameter("tttt");
- int curPage = 1;
- List<Integer> pageList = new ArrayList<Integer>();
- List<tb_gps> historicalLocationList = gpsService.searchRealTimegpsLocation(input,date);
+ String input = request.getParameter("input");
+ List<Integer> pageList = new ArrayList();
+ List<tb_gps> historicalLocationList = this.gpsService.searchRealTimegpsLocation(input, date, 1);
pageList.add(1);
JSONObject json = new JSONObject();
+ int curPage = 1;
+ int count = this.gpsService.getgpsRealTimeLocationCount2(date, input);
+ int minPage = PageUtil.getMinPage2(count);
+ json.put("dataList", historicalLocationList);
+ json.put("pageList", PageUtil.getPage(minPage));
+ json.put("curPage", Integer.valueOf(curPage));
+ return json.toString();
+ }
+
+ @ResponseBody
+ @RequestMapping(
+ value = {"/historicalgpsLocation_search2.do"},
+ method = {RequestMethod.POST, RequestMethod.GET}
+ )
+ public String historicalgpsLocation_search2(HttpServletRequest request) {
+ String pageStr = request.getParameter("page");
+ String curPageStr = request.getParameter("curPage");
+ String date = request.getParameter("date");
+ String input = request.getParameter("input");
+ int count = this.gpsService.getgpsRealTimeLocationCount2(date, input);
+ int minPage = PageUtil.getMinPage2(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_gps> historicalLocationList = this.gpsService.searchRealTimegpsLocation(input, date, page);
+ List<Integer> pageList = PageUtil.getPage(PageUtil.getLocPage(page, curPage), page, minPage);
+ JSONObject json = new JSONObject();
json.put("dataList", historicalLocationList);
json.put("pageList", pageList);
- json.put("curPage", curPage);
+ json.put("curPage", page);
return json.toString();
}
-
+
@ResponseBody
- @RequestMapping(value = "/historicalgpsLocation_export.do", method = { RequestMethod.POST, RequestMethod.GET })
+ @RequestMapping(
+ value = {"/historicalgpsLocation_searcha.do"},
+ method = {RequestMethod.POST, RequestMethod.GET}
+ )
+ public JSONObject historicalgpsLocation_searcha(HttpServletRequest request) {
+ String input = request.getParameter("tagid");
+ String date = request.getParameter("date");
+ JSONObject json = new JSONObject();
+ int aaa = this.locationService.searchtablenameLocation("tb_gps_track_" + date);
+ if (aaa != 0) {
+ List<tb_gps> historicalLocationList = this.gpsService.searchRealTimegpsLocation(input, date, 1);
+ json.put("dataList", historicalLocationList);
+ } else {
+ List<tb_gps> abc = new ArrayList();
+ json.put("dataList", abc);
+ }
+
+ return json;
+ }
+
+ @ResponseBody
+ @RequestMapping(
+ value = {"/historicalgpsLocation_export.do"},
+ method = {RequestMethod.POST, RequestMethod.GET}
+ )
public String gpshistoricalPower_export(HttpServletRequest request, HttpServletResponse response) {
String toPage = "forward:/hxzk/label/historicalgpsLocation.jsp";
String tagid = request.getParameter("tagid");
String begin = request.getParameter("begintime");
String end = request.getParameter("endtime");
String date = request.getParameter("date");
- List<tb_gps> historicalLocationList = gpsService.getRealTimegpsLocation(tagid,begin,end,date);
- String[] rowName = {"搴忓彿", "璁惧缂栧彿","绾害","缁忓害","GPS鐘舵��","鍗槦鏁�","娴锋嫈楂�","宸垎绔橧D","鐢甸噺","鏇存柊鏃堕棿"};
- List<Object[]> dataList = objectToArray(historicalLocationList);
- //System.out.print(dataList.get(0));
+ List<tb_gps> historicalLocationList = this.gpsService.getRealTimegpsLocation(tagid, begin, end, date);
+ String[] rowName = new String[]{"搴忓彿", "璁惧缂栧彿", "绾害", "缁忓害", "GPS鐘舵��", "鍗槦鏁�", "娴锋嫈楂�", "宸垎绔橧D", "姘村钩绮惧害鍥犲瓙", "宸垎鏃堕棿", "鐢甸噺", "鏇存柊鏃堕棿"};
+ List<Object[]> dataList = objectToArray2(historicalLocationList);
ExcelUtils excel = new ExcelUtils("GPS鏁版嵁", 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();
- }
- return toPage;
- }
-
- @ResponseBody
- @RequestMapping(value = "/totxt.do", method = { RequestMethod.POST, RequestMethod.GET })
- public String totxt(HttpServletRequest request,HttpServletResponse response) throws IOException {
- String toPage = "forward:/hxzk/label/historicalgpsLocation.jsp";
- String date = request.getParameter("date");
- InputStream is;
- OutputStream os;
- String filename = date + ".txt";
- response.setHeader("Content-Disposition", "attachement;filename=" + filename);
- is = new FileInputStream("C:\\" +date+ ".txt");
- os = response.getOutputStream();
- int len = 0;
- byte[] buffer = new byte[1024];
- while ((len = is.read(buffer)) != -1) {
- os.write(buffer, 0, len);
- }
- os.close();
- is.close();
- return toPage;
- }
-
- // 瀵硅薄杞暟缁�
- public static List<Object[]> objectToArray(List<tb_gps> sensorManagementList) {
- List<Object[]> reList = new ArrayList<>();
- for (int i = 0; i < sensorManagementList.size(); i++) {
- List<String> words = new ArrayList<String>();
- tb_gps gps = (tb_gps) sensorManagementList.get(i);
- words.add(String.valueOf(gps.getId()));
- words.add(gps.getTagid());
- words.add(gps.getGps_weidu());
- words.add(gps.getGsp_jingdu());
- words.add(gps.getGps_state());
- words.add(gps.getGps_num());
- words.add(gps.getGps_haiba_gao());
- words.add(gps.getGps_chafen_id());
- words.add(gps.getGps_power());
- words.add(gps.getAddtime());
- String[] array = words.toArray(new String[0]);
- reList.add(array);
- }
- return reList;
+ } catch (Exception var15) {
+ var15.printStackTrace();
}
+ return toPage;
+ }
+
+ @ResponseBody
+ @RequestMapping(
+ value = {"/totxt.do"},
+ method = {RequestMethod.POST, RequestMethod.GET}
+ )
+ public String totxt(HttpServletRequest request, HttpServletResponse response) throws IOException {
+ String toPage = "forward:/hxzk/label/historicalgpsLocation.jsp";
+ String date = request.getParameter("date");
+ String filename = date + ".txt";
+ response.setHeader("Content-Disposition", "attachement;filename=" + filename);
+ InputStream is = new FileInputStream("C:\\" + date + ".txt");
+ OutputStream os = response.getOutputStream();
+ byte[] buffer = new byte[1024];
+
+ int len;
+ while((len = is.read(buffer)) != -1) {
+ os.write(buffer, 0, len);
+ }
+
+ os.close();
+ is.close();
+ return toPage;
+ }
+
+ public static List<Object[]> objectToArray(List<tb_gps> sensorManagementList) {
+ List<Object[]> reList = new ArrayList();
+
+ for(int i = 0; i < sensorManagementList.size(); ++i) {
+ List<String> words = new ArrayList();
+ tb_gps gps = (tb_gps)sensorManagementList.get(i);
+ words.add(gps.getTagid());
+ words.add(gps.getCcid());
+ String[] array = (String[])words.toArray(new String[0]);
+ reList.add(array);
+ }
+
+ return reList;
+ }
+
+ public static List<Object[]> objectToArray2(List<tb_gps> sensorManagementList) {
+ List<Object[]> reList = new ArrayList();
+
+ for(int i = 0; i < sensorManagementList.size(); ++i) {
+ List<String> words = new ArrayList();
+ tb_gps gps = (tb_gps)sensorManagementList.get(i);
+ words.add(gps.getId() + "");
+ words.add(gps.getTagid());
+ words.add(gps.getGps_weidu());
+ words.add(gps.getGsp_jingdu());
+ words.add(gps.getGps_state());
+ words.add(gps.getGps_num());
+ words.add(gps.getGps_haiba_gao());
+ words.add(gps.getGps_chafen_id());
+ words.add(gps.getGps_hdop());
+ words.add(gps.getGps_chafen_time());
+ words.add(gps.getGps_power());
+ words.add(gps.getAddtime());
+ String[] array = (String[])words.toArray(new String[0]);
+ reList.add(array);
+ }
+
+ return reList;
+ }
+
+ @RequestMapping(
+ value = {"tortkanchor.do"},
+ method = {RequestMethod.POST, RequestMethod.GET}
+ )
+ public String tortkanchor(HttpServletRequest request) {
+ String toPage = "forward:/hxzk/GPS/rtkanchorManagement.jsp";
+ List<tb_rtkanchor> mess = this.gpsService.findrtkanchor(1);
+ request.setAttribute("dataList", mess);
+ int curPage = 1;
+ int count = this.gpsService.getrtkanchorManagementCount();
+ int minPage = PageUtil.getMinPage(count);
+ request.setAttribute("pageList", PageUtil.getPage(minPage));
+ request.setAttribute("curPage", Integer.valueOf(curPage));
+ return toPage;
+ }
+
+ @ResponseBody
+ @RequestMapping(
+ value = {"/rtkanchor_delete.do"},
+ method = {RequestMethod.POST, RequestMethod.GET}
+ )
+ public void rtkanchor_delete(HttpServletRequest request) {
+ String checkValStr = request.getParameter("checkVal");
+ checkValStr = checkValStr.replaceAll("\"", "");
+ String[] checkVal = checkValStr.split(",");
+ this.gpsService.rtkanchor_delete(checkVal);
+ }
+
+ @ResponseBody
+ @RequestMapping(
+ value = {"/rtkanchor_deletea.do"},
+ method = {RequestMethod.POST, RequestMethod.GET}
+ )
+ public void rtkanchor_deletea(HttpServletRequest request) {
+ this.gpsService.rtkanchor_deletea();
+ }
+
+ @ResponseBody
+ @RequestMapping(
+ value = {"/rtkanchor_search.do"},
+ method = {RequestMethod.POST, RequestMethod.GET}
+ )
+ public String rtkanchor_search(HttpServletRequest request) throws IOException {
+ JSONObject json = new JSONObject();
+ String input = request.getParameter("input");
+ List warningSummaryList;
+ if (!"".equals(input) && input != null) {
+ int curPage = 1;
+ List<Integer> pageList = new ArrayList();
+ warningSummaryList = this.gpsService.findrtkanchor3(input);
+ pageList.add(1);
+ json.put("dataList", warningSummaryList);
+ json.put("pageList", pageList);
+ json.put("curPage", Integer.valueOf(curPage));
+ } else {
+ String jsonString = RequestUtils.getRequestJsonString(request, Config.getCharset());
+ tb_tag tag = (tb_tag)JSONObject.toBean(JSONObject.fromObject(jsonString), tb_tag.class);
+ input = tag.getTag_id();
+ warningSummaryList = this.gpsService.findrtkanchor3(input);
+ if (warningSummaryList.size() > 0) {
+ json.put("result", warningSummaryList.get(0));
+ } else {
+ json.put("result", "null");
+ }
+ }
+
+ return json.toString();
+ }
+
+ @ResponseBody
+ @RequestMapping(
+ value = {"/rtkanchor_page.do"},
+ method = {RequestMethod.POST, RequestMethod.GET}
+ )
+ public String rtkanchor_page(HttpServletRequest request) {
+ String pageStr = request.getParameter("page");
+ String curPageStr = request.getParameter("curPage");
+ int count = this.gpsService.getrtkanchorManagementCount();
+ 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_rtkanchor> labelManagementList = this.gpsService.findrtkanchor(page);
+ List<Integer> pageList = PageUtil.getPage(PageUtil.getLocPage(page, curPage), page, minPage);
+ JSONObject json = new JSONObject();
+ json.put("dataList", labelManagementList);
+ json.put("pageList", pageList);
+ json.put("curPage", page);
+ return json.toString();
+ }
}
--
Gitblit v1.10.0