| | |
| | | @GetMapping("/map/getData/{lev}/auth") |
| | | @ManagerAuth |
| | | public String getMapData(@PathVariable("lev") Integer lev) { |
| | | try { |
| | | String mapFilename = "map.json"; |
| | | String fileName = this.getClass().getClassLoader().getResource(mapFilename).getPath();//获取文件路径 |
| | | File file = new File(fileName); |
| | | StringBuffer stringBuffer = new StringBuffer(); |
| | | if (file.isFile() && file.exists()) { |
| | | InputStreamReader isr = new InputStreamReader(new FileInputStream(file), "GBK"); |
| | | BufferedReader br = new BufferedReader(isr); |
| | | String lineTxt = null; |
| | | while ((lineTxt = br.readLine()) != null) { |
| | | stringBuffer.append(lineTxt); |
| | | } |
| | | br.close(); |
| | | |
| | | BasMap basMap = basMapService.selectLatestMap(lev); |
| | | //解析json地图数据 |
| | | List<ArrayList> arrayLists = JSON.parseArray(stringBuffer.toString(), ArrayList.class); |
| | | List<ArrayList> arrayLists = JSON.parseArray(basMap.getData(), ArrayList.class); |
| | | // ArrayList<HashMap<String, Integer>> lineRows = new ArrayList<>(); |
| | | // int dataRow = 0; |
| | | // int dataRowCount = 0; |
| | |
| | | } |
| | | |
| | | return JSONObject.toJSONString(arrayLists); |
| | | } else { |
| | | System.out.println("文件不存在!"); |
| | | } |
| | | } catch (IOException ioException) { |
| | | ioException.printStackTrace(); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | @RequestMapping("/map/searchData/auth") |