| | |
| | | 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; |
| | | |
| | | |
| | |
| | | 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; |
| | |
| | | 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; |
| | | |
| | |
| | | @Autowired |
| | | private GpsService gpsService; |
| | | @Autowired |
| | | private LabelService labelService; |
| | | @Autowired |
| | | private SysSettingService sysSettingService; |
| | | |
| | | @ResponseBody |
| | |
| | | } |
| | | |
| | | @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"); |
| | |
| | | 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状态","卫星数","海拔高","差分站ID","电量","更新时间"}; |
| | | List<Object[]> dataList = objectToArray(historicalLocationList); |
| | |
| | | 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<>(); |