From 7b4c8991dca9cf2a809a95e239d144697d3afb56 Mon Sep 17 00:00:00 2001
From: 15832144755 <67030627+15832144755@users.noreply.github.com>
Date: 星期四, 06 一月 2022 12:15:34 +0800
Subject: [PATCH] 2022.1.6

---
 src/main/java/com/hxzkoa/controller/GpsController.java |   59 ++++++++++++++++++++++++++++++++++++++++-------------------
 1 files changed, 40 insertions(+), 19 deletions(-)

diff --git a/src/main/java/com/hxzkoa/controller/GpsController.java b/src/main/java/com/hxzkoa/controller/GpsController.java
index d25111d..54911f3 100644
--- a/src/main/java/com/hxzkoa/controller/GpsController.java
+++ b/src/main/java/com/hxzkoa/controller/GpsController.java
@@ -1,12 +1,14 @@
 package com.hxzkoa.controller;
 
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
 import java.io.OutputStream;
 import java.sql.SQLException;
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.util.ArrayList;
 import java.util.Date;
-import java.util.Enumeration;
 import java.util.List;
 
 
@@ -21,11 +23,10 @@
 import org.springframework.web.servlet.ModelAndView;
 
 import com.hxzkoa.json.tb_gps;
-import com.hxzkoa.json.tb_person;
-import com.hxzkoa.json.tb_realocation;
 import com.hxzkoa.json.tb_system;
-import com.hxzkoa.json.tb_track;
+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;
@@ -34,7 +35,6 @@
 import com.hxzkoa.util.ExcelUtils;
 import com.hxzkoa.util.ModifyConfig;
 import com.hxzkoa.util.PageUtil;
-import com.hxzkoa.util.RequestUtils;
 
 import net.sf.json.JSONObject;
 
@@ -43,6 +43,8 @@
 	@Autowired
 	private GpsService gpsService;
 	@Autowired
+	private LabelService labelService;
+	@Autowired
 	private SysSettingService sysSettingService;
 	
 	@ResponseBody
@@ -56,13 +58,13 @@
 	@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));
+		//System.out.print(baowen.get(0));
 		return baowen;
 	}
 	
 	@RequestMapping(value = "/huifang.do",method = { RequestMethod.POST, RequestMethod.GET })
 	public String huifang(HttpServletRequest request) {
-		String toPage = "forward:/hxzk/GPS/gpsHuifang.jsp";
+		String toPage = "forward:/hxzk/baidu.jsp";
 		return toPage;
 	}
 	
@@ -271,6 +273,15 @@
 	}
 	
 	@ResponseBody
+	@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);
+		return zhuangtai;
+	}
+	
+	@ResponseBody
 	@RequestMapping(value = "/historicalgpsLocation_search.do", method = { RequestMethod.POST, RequestMethod.GET })
 	public String historicalgpsLocation_search(HttpServletRequest request) {
 		String input = request.getParameter("input");
@@ -294,21 +305,10 @@
 		String begin = request.getParameter("begintime");
 		String end = request.getParameter("endtime");
 		String date = request.getParameter("date");
-//		Enumeration<String> paraNames=request.getParameterNames();
-//		String thisName = null;
-//		String thisValue = null;
-//		String[] value = null;
-//		int i = 0;
-//		for(Enumeration<String> e=paraNames;e.hasMoreElements();){
-//	        thisName=e.nextElement()+"";  //name鍚�
-//	        thisValue=request.getParameter(thisName);   //name鍚嶅搴旂殑鍊�
-//	        value[i] = thisValue;
-//	        i++;
-//	    }
 		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));
+		//System.out.print(dataList.get(0));
 		ExcelUtils excel = new ExcelUtils("GPS鏁版嵁", rowName, dataList);
 		OutputStream out;
 		try {
@@ -326,6 +326,27 @@
 		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<>();

--
Gitblit v1.10.0