| | |
| | | // |
| | | // Source code recreated from a .class file by IntelliJ IDEA |
| | | // (powered by FernFlower decompiler) |
| | | // |
| | | |
| | | package com.hxzkoa.controller; |
| | | |
| | | import com.hxzkoa.json.tb_map; |
| | | import com.hxzkoa.services.MapService; |
| | | import com.hxzkoa.udp.Udp_Out; |
| | | import com.hxzkoa.util.Config; |
| | | import com.hxzkoa.util.ExcelUtils; |
| | | import com.hxzkoa.util.PageUtil; |
| | | import com.hxzkoa.util.RequestUtils; |
| | | import java.io.BufferedReader; |
| | | import java.io.File; |
| | | import java.io.FileInputStream; |
| | |
| | | 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.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import com.hxzkoa.json.tb_map; |
| | | import com.hxzkoa.json.tb_system; |
| | | import com.hxzkoa.services.MapService; |
| | | import com.hxzkoa.udp.Udp_Out; |
| | | import com.hxzkoa.util.Config; |
| | | import com.hxzkoa.util.ExcelUtils; |
| | | import com.hxzkoa.util.PageUtil; |
| | | import com.hxzkoa.util.RequestUtils; |
| | | |
| | | import net.sf.json.JSONObject; |
| | | |
| | | @Controller |
| | | public class MapController { |
| | | @Autowired |
| | | private MapService mapService; |
| | | |
| | | @RequestMapping(value = "/mapManagement.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | public MapController() { |
| | | } |
| | | |
| | | @RequestMapping( |
| | | value = {"/mapManagement.do"}, |
| | | method = {RequestMethod.POST, RequestMethod.GET} |
| | | ) |
| | | public String mapManagement(HttpServletRequest request) { |
| | | String toPage = "forward:/hxzk/map/mapManagement.jsp"; |
| | | List<tb_map> mapManagementList = mapService.getMapManagement(1); |
| | | List<tb_map> mapManagementList = this.mapService.getMapManagement(1); |
| | | request.setAttribute("mapManagementList", mapManagementList); |
| | | int curPage = 1; |
| | | int count = mapService.getMapManagementCount(); |
| | | int count = this.mapService.getMapManagementCount(); |
| | | 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 = "/mapManagement_page.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | @RequestMapping( |
| | | value = {"/mapManagement_page.do"}, |
| | | method = {RequestMethod.POST, RequestMethod.GET} |
| | | ) |
| | | public String mapManagement_page(HttpServletRequest request) { |
| | | String pageStr = request.getParameter("page"); |
| | | String curPageStr = request.getParameter("curPage"); |
| | | int count = mapService.getMapManagementCount(); |
| | | int count = this.mapService.getMapManagementCount(); |
| | | int minPage = PageUtil.getMinPage(count); |
| | | int curPage = Integer.parseInt(curPageStr); |
| | | int page = 1; |
| | |
| | | } else { |
| | | page = Integer.parseInt(pageStr); |
| | | } |
| | | List<tb_map> mapManagementList = mapService.getMapManagement(page); |
| | | |
| | | List<tb_map> mapManagementList = this.mapService.getMapManagement(page); |
| | | List<Integer> pageList = PageUtil.getPage(PageUtil.getLocPage(page, curPage), page, minPage); |
| | | JSONObject json = new JSONObject(); |
| | | json.put("dataList", mapManagementList); |
| | |
| | | } |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "/mapManagement_search.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | @RequestMapping( |
| | | value = {"/mapManagement_search.do"}, |
| | | method = {RequestMethod.POST, RequestMethod.GET} |
| | | ) |
| | | public String mapManagement_search(HttpServletRequest request) { |
| | | String input = request.getParameter("input"); |
| | | int curPage = 1; |
| | | List<Integer> pageList = new ArrayList<Integer>(); |
| | | List<tb_map> mapManagementList = mapService.searchMapService(input); |
| | | List<Integer> pageList = new ArrayList(); |
| | | List<tb_map> mapManagementList = this.mapService.searchMapService(input); |
| | | pageList.add(1); |
| | | JSONObject json = new JSONObject(); |
| | | json.put("dataList", mapManagementList); |
| | | json.put("pageList", pageList); |
| | | json.put("curPage", curPage); |
| | | json.put("curPage", Integer.valueOf(curPage)); |
| | | return json.toString(); |
| | | } |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "/mapManagement_delete.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | @RequestMapping( |
| | | value = {"/mapManagement_delete.do"}, |
| | | method = {RequestMethod.POST, RequestMethod.GET} |
| | | ) |
| | | public void mapManagement_delete(HttpServletRequest request) { |
| | | String checkValStr = request.getParameter("checkVal"); |
| | | checkValStr = checkValStr.replaceAll("\"", ""); |
| | | String[] checkVal = checkValStr.split(","); |
| | | mapService.mapManagement_delete(checkVal); |
| | | for(int i = 0;i<checkVal.length;i++) { |
| | | String xieyi = "BSTOCS1,DELETEMAP,"+checkVal[i]+",END"; |
| | | this.mapService.mapManagement_delete(checkVal); |
| | | |
| | | for(int i = 0; i < checkVal.length; ++i) { |
| | | String xieyi = "BSTOCS1,DELETEMAP," + checkVal[i] + ",END"; |
| | | Udp_Out.udp_to_cs(xieyi); |
| | | } |
| | | |
| | | } |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "/mapManagement_deleteAll.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | @RequestMapping( |
| | | value = {"/mapManagement_deleteAll.do"}, |
| | | method = {RequestMethod.POST, RequestMethod.GET} |
| | | ) |
| | | public void mapManagement_deleteAll(HttpServletRequest request) { |
| | | mapService.mapManagement_deleteAll(); |
| | | this.mapService.mapManagement_deleteAll(); |
| | | String xieyi = "BSTOCS1,DELETEALLMAP,END"; |
| | | Udp_Out.udp_to_cs(xieyi); |
| | | } |
| | | |
| | | @RequestMapping(value = "/uploadMap.do") |
| | | @RequestMapping({"/uploadMap.do"}) |
| | | public String upload(@RequestParam("file") MultipartFile[] files, HttpServletRequest request) { |
| | | String toPage = "redirect:/mapManagement.do"; |
| | | String filePath1 = Config.getMapPath() + "/"; |
| | |
| | | map.setY_Pixel(request.getParameter("pixelY_a")); |
| | | map.setBaoliu3(request.getParameter("baoliu3")); |
| | | map.setBaoliu4(request.getParameter("baoliu4")); |
| | | mapService.mapManagement_add(map); |
| | | String xieyi = "BSTOCS1,ADDMAP,"+map.getFloor()+","+map.getMapname()+","+map.getX_Truelength()+","+map.getY_Truewidth()+","+map.getX0_length()+","+map.getY0_width()+","+map.getX_Pixel()+","+map.getY_Pixel()+",END"; |
| | | this.mapService.mapManagement_add(map); |
| | | String xieyi = "BSTOCS1,ADDMAP," + map.getFloor() + "," + map.getMapname() + "," + map.getX_Truelength() + "," + map.getY_Truewidth() + "," + map.getX0_length() + "," + map.getY0_width() + "," + map.getX_Pixel() + "," + map.getY_Pixel() + ",END"; |
| | | Udp_Out.udp_to_cs(xieyi); |
| | | |
| | | File existFile2; |
| | | MultipartFile[] var10; |
| | | int var11; |
| | | int var12; |
| | | MultipartFile file; |
| | | try { |
| | | File existFile1 = new File(filePath1); |
| | | if (!existFile1.exists()) { |
| | | existFile1.mkdir(); |
| | | } |
| | | for (MultipartFile file : files) { |
| | | file.transferTo(new File(filePath1 + file.getOriginalFilename())); |
| | | } |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | try { |
| | | File existFile2 = new File(filePath2); |
| | | existFile2 = new File(filePath1); |
| | | if (!existFile2.exists()) { |
| | | existFile2.mkdir(); |
| | | } |
| | | for (MultipartFile file : files) { |
| | | |
| | | var10 = files; |
| | | var11 = files.length; |
| | | |
| | | for(var12 = 0; var12 < var11; ++var12) { |
| | | file = var10[var12]; |
| | | file.transferTo(new File(filePath1 + file.getOriginalFilename())); |
| | | } |
| | | } catch (IOException var15) { |
| | | var15.printStackTrace(); |
| | | } |
| | | |
| | | try { |
| | | existFile2 = new File(filePath2); |
| | | if (!existFile2.exists()) { |
| | | existFile2.mkdir(); |
| | | } |
| | | |
| | | var10 = files; |
| | | var11 = files.length; |
| | | |
| | | for(var12 = 0; var12 < var11; ++var12) { |
| | | file = var10[var12]; |
| | | file.transferTo(new File(filePath2 + file.getOriginalFilename())); |
| | | } |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } catch (IOException var14) { |
| | | var14.printStackTrace(); |
| | | } |
| | | |
| | | return toPage; |
| | | } |
| | | |
| | | @RequestMapping(value = "/modifyMap.do") |
| | | @RequestMapping({"/modifyMap.do"}) |
| | | public String modify(@RequestParam("file") MultipartFile[] files, HttpServletRequest request) { |
| | | String toPage = "redirect:/mapManagement.do"; |
| | | String filePath1 = Config.getMapPath() + "/"; |
| | | String filePath2 = request.getServletContext().getRealPath("/") + "hxzk/image/mapfile/"; |
| | | String filename = files[0].getOriginalFilename(); |
| | | tb_map map = new tb_map(); |
| | | if (filename!=""){ |
| | | if (filename != "") { |
| | | map.setFloor(request.getParameter("floor_m")); |
| | | map.setMapname(filename); |
| | | map.setId(Integer.parseInt(request.getParameter("mapId"))); |
| | | //System.out.print(request.getParameter("mapId")); |
| | | map.setX_Truelength(request.getParameter("realX_m")); |
| | | map.setY_Truewidth(request.getParameter("realY_m")); |
| | | map.setX0_length(request.getParameter("x0_m")); |
| | |
| | | map.setY_Pixel(request.getParameter("pixelY_m")); |
| | | map.setBaoliu3(request.getParameter("baoliu3")); |
| | | map.setBaoliu4(request.getParameter("baoliu4")); |
| | | mapService.mapManagement_modify(map); |
| | | String xieyi = "BSTOCS1,ALTERMAP,"+map.getFloor()+","+map.getMapname()+","+map.getX_Truelength()+","+map.getY_Truewidth()+","+map.getX0_length()+","+map.getY0_width()+","+map.getX_Pixel()+","+map.getY_Pixel()+",END"; |
| | | this.mapService.mapManagement_modify(map); |
| | | String xieyi = "BSTOCS1,ALTERMAP," + map.getFloor() + "," + map.getMapname() + "," + map.getX_Truelength() + "," + map.getY_Truewidth() + "," + map.getX0_length() + "," + map.getY0_width() + "," + map.getX_Pixel() + "," + map.getY_Pixel() + ",END"; |
| | | Udp_Out.udp_to_cs(xieyi); |
| | | |
| | | MultipartFile[] var9; |
| | | int var10; |
| | | int var11; |
| | | MultipartFile file; |
| | | File existFile2; |
| | | try { |
| | | existFile2 = new File(filePath1); |
| | | if (!existFile2.exists()) { |
| | | existFile2.mkdir(); |
| | | } |
| | | |
| | | var9 = files; |
| | | var10 = files.length; |
| | | |
| | | for(var11 = 0; var11 < var10; ++var11) { |
| | | file = var9[var11]; |
| | | file.transferTo(new File(filePath1 + file.getOriginalFilename())); |
| | | } |
| | | } catch (IOException var14) { |
| | | var14.printStackTrace(); |
| | | } |
| | | |
| | | try { |
| | | existFile2 = new File(filePath2); |
| | | if (!existFile2.exists()) { |
| | | existFile2.mkdir(); |
| | | } |
| | | |
| | | var9 = files; |
| | | var10 = files.length; |
| | | |
| | | for(var11 = 0; var11 < var10; ++var11) { |
| | | file = var9[var11]; |
| | | file.transferTo(new File(filePath2 + file.getOriginalFilename())); |
| | | } |
| | | } catch (IOException var13) { |
| | | var13.printStackTrace(); |
| | | } |
| | | |
| | | return toPage; |
| | | } else { |
| | | map.setFloor(request.getParameter("floor_m")); |
| | | map.setId(Integer.parseInt(request.getParameter("mapId"))); |
| | | //System.out.print(request.getParameter("mapId")); |
| | | map.setX_Truelength(request.getParameter("realX_m")); |
| | | map.setY_Truewidth(request.getParameter("realY_m")); |
| | | map.setX0_length(request.getParameter("x0_m")); |
| | |
| | | map.setY_Pixel(request.getParameter("pixelY_m")); |
| | | map.setBaoliu3(request.getParameter("baoliu3")); |
| | | map.setBaoliu4(request.getParameter("baoliu4")); |
| | | mapService.mapManagement_modify2(map); |
| | | this.mapService.mapManagement_modify2(map); |
| | | return toPage; |
| | | } |
| | | |
| | | try { |
| | | File existFile1 = new File(filePath1); |
| | | if (!existFile1.exists()) { |
| | | existFile1.mkdir(); |
| | | } |
| | | for (MultipartFile file : files) { |
| | | file.transferTo(new File(filePath1 + file.getOriginalFilename())); |
| | | } |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | try { |
| | | File existFile2 = new File(filePath2); |
| | | if (!existFile2.exists()) { |
| | | existFile2.mkdir(); |
| | | } |
| | | for (MultipartFile file : files) { |
| | | file.transferTo(new File(filePath2 + file.getOriginalFilename())); |
| | | } |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return toPage; |
| | | } |
| | | |
| | | // 对象转数组 |
| | | public static List<Object[]> objectToArray(List<tb_map> mapList) { |
| | | List<Object[]> reList = new ArrayList<>(); |
| | | for (int i = 0; i < mapList.size(); i++) { |
| | | List<String> words = new ArrayList<String>(); |
| | | tb_map map = (tb_map) mapList.get(i); |
| | | List<Object[]> reList = new ArrayList(); |
| | | |
| | | for(int i = 0; i < mapList.size(); ++i) { |
| | | List<String> words = new ArrayList(); |
| | | tb_map map = (tb_map)mapList.get(i); |
| | | words.add(String.valueOf(map.getId())); |
| | | words.add(map.getFloor()); |
| | | words.add(map.getMapname()); |
| | |
| | | words.add(map.getX_Pixel()); |
| | | words.add(map.getY_Pixel()); |
| | | words.add(String.valueOf(map.getAddTime())); |
| | | String[] array = words.toArray(new String[0]); |
| | | String[] array = (String[])words.toArray(new String[0]); |
| | | reList.add(array); |
| | | } |
| | | |
| | | return reList; |
| | | } |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "/mapManagement_export.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | @RequestMapping( |
| | | value = {"/mapManagement_export.do"}, |
| | | method = {RequestMethod.POST, RequestMethod.GET} |
| | | ) |
| | | public String mapManagement_export(HttpServletRequest request, HttpServletResponse response) { |
| | | String toPage = "forward:/hxzk/map/mapManagement.jsp"; |
| | | List<tb_map> mapList = mapService.getMapManagement(); |
| | | String[] rowName = { "序号", "图层", "地图名称", "X实长", "Y实长", "X0坐标", "Y0坐标", "X像素", "Y像素", "时间" }; |
| | | List<tb_map> mapList = this.mapService.getMapManagement(); |
| | | String[] rowName = new String[]{"序号", "图层", "地图名称", "X实长", "Y实长", "X0坐标", "Y0坐标", "X像素", "Y像素", "时间"}; |
| | | List<Object[]> dataList = objectToArray(mapList); |
| | | 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; |
| | | } |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "/map_bw_floor.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | @RequestMapping( |
| | | value = {"/map_bw_floor.do"}, |
| | | method = {RequestMethod.POST, RequestMethod.GET} |
| | | ) |
| | | public String getMap_floor(HttpServletRequest request) throws IOException { |
| | | JSONObject json = new JSONObject(); |
| | | String jsonString = RequestUtils.getRequestJsonString(request, Config.getCharset()); |
| | | tb_map map = (tb_map) JSONObject.toBean(JSONObject.fromObject(jsonString), tb_map.class); |
| | | List<tb_map> map_floorList = mapService.getMap_floor(map.getFloor()); |
| | | if (map_floorList.size()>0){ |
| | | tb_map map = (tb_map)JSONObject.toBean(JSONObject.fromObject(jsonString), tb_map.class); |
| | | List<tb_map> map_floorList = this.mapService.getMap_floor(map.getFloor()); |
| | | if (map_floorList.size() > 0) { |
| | | json.put("result", map_floorList.get(0)); |
| | | }else { |
| | | } else { |
| | | json.put("result", "null"); |
| | | } |
| | | } |
| | | |
| | | return json.toString(); |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "/mapfloor_search.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | @RequestMapping( |
| | | value = {"/mapfloor_search.do"}, |
| | | method = {RequestMethod.POST, RequestMethod.GET} |
| | | ) |
| | | public int mapfloor_search(HttpServletRequest request) { |
| | | int nn; |
| | | String floor = request.getParameter("floor"); |
| | | List<tb_map> mapManagementList = mapService.searchMapfloorService(floor); |
| | | if(null == mapManagementList || mapManagementList.size() ==0 ) { |
| | | nn=0; |
| | | }else { |
| | | nn=1; |
| | | List<tb_map> mapManagementList = this.mapService.searchMapfloorService(floor); |
| | | byte nn; |
| | | if (null != mapManagementList && mapManagementList.size() != 0) { |
| | | nn = 1; |
| | | } else { |
| | | nn = 0; |
| | | } |
| | | |
| | | return nn; |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "/getmap.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | @RequestMapping( |
| | | value = {"/getmap.do"}, |
| | | method = {RequestMethod.POST, RequestMethod.GET} |
| | | ) |
| | | public JSONObject getmap(HttpServletRequest request) { |
| | | JSONObject json = new JSONObject(); |
| | | List<tb_map> mapManagementList = mapService.getMapManagementa(); |
| | | List<tb_map> mapManagementList = this.mapService.getMapManagementa(); |
| | | json.put("dataList", mapManagementList); |
| | | return json; |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "/addMap.do") |
| | | @RequestMapping({"/addMap.do"}) |
| | | public String addMap(@RequestParam("file") MultipartFile[] files, HttpServletRequest request) { |
| | | String filePath1 = Config.getMapPath() + "/"; |
| | | String filePath2 = request.getServletContext().getRealPath("/") + "hxzk/image/mapfile/"; |
| | |
| | | map.setY0_width(request.getParameter("y0_a")); |
| | | map.setX_Pixel(request.getParameter("pixelX_a")); |
| | | map.setY_Pixel(request.getParameter("pixelY_a")); |
| | | int aaa = mapService.mapManagement_add(map); |
| | | String xieyi = "BSTOCS1,ADDMAP,"+map.getFloor()+","+map.getMapname()+","+map.getX_Truelength()+","+map.getY_Truewidth()+","+map.getX0_length()+","+map.getY0_width()+","+map.getX_Pixel()+","+map.getY_Pixel()+",END"; |
| | | int aaa = this.mapService.mapManagement_add(map); |
| | | String xieyi = "BSTOCS1,ADDMAP," + map.getFloor() + "," + map.getMapname() + "," + map.getX_Truelength() + "," + map.getY_Truewidth() + "," + map.getX0_length() + "," + map.getY0_width() + "," + map.getX_Pixel() + "," + map.getY_Pixel() + ",END"; |
| | | Udp_Out.udp_to_cs(xieyi); |
| | | |
| | | File existFile2; |
| | | MultipartFile[] var10; |
| | | int var11; |
| | | int var12; |
| | | MultipartFile file; |
| | | try { |
| | | File existFile1 = new File(filePath1); |
| | | if (!existFile1.exists()) { |
| | | existFile1.mkdir(); |
| | | } |
| | | for (MultipartFile file : files) { |
| | | file.transferTo(new File(filePath1 + file.getOriginalFilename())); |
| | | } |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | try { |
| | | File existFile2 = new File(filePath2); |
| | | existFile2 = new File(filePath1); |
| | | if (!existFile2.exists()) { |
| | | existFile2.mkdir(); |
| | | } |
| | | for (MultipartFile file : files) { |
| | | |
| | | var10 = files; |
| | | var11 = files.length; |
| | | |
| | | for(var12 = 0; var12 < var11; ++var12) { |
| | | file = var10[var12]; |
| | | file.transferTo(new File(filePath1 + file.getOriginalFilename())); |
| | | } |
| | | } catch (IOException var15) { |
| | | var15.printStackTrace(); |
| | | } |
| | | |
| | | try { |
| | | existFile2 = new File(filePath2); |
| | | if (!existFile2.exists()) { |
| | | existFile2.mkdir(); |
| | | } |
| | | |
| | | var10 = files; |
| | | var11 = files.length; |
| | | |
| | | for(var12 = 0; var12 < var11; ++var12) { |
| | | file = var10[var12]; |
| | | file.transferTo(new File(filePath2 + file.getOriginalFilename())); |
| | | } |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } catch (IOException var14) { |
| | | var14.printStackTrace(); |
| | | } |
| | | return ""+aaa; |
| | | |
| | | return "" + aaa; |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "/modifyMapa.do") |
| | | @RequestMapping({"/modifyMapa.do"}) |
| | | public String modifya(HttpServletRequest request) { |
| | | tb_map map = new tb_map(); |
| | | map.setFloor(request.getParameter("floor_m")); |
| | | map.setMapname(request.getParameter("filename")); |
| | | map.setId(Integer.parseInt(request.getParameter("mapId"))); |
| | | //System.out.print(request.getParameter("mapId")); |
| | | map.setX_Truelength(request.getParameter("realX_m")); |
| | | map.setY_Truewidth(request.getParameter("realY_m")); |
| | | map.setX0_length(request.getParameter("x0_m")); |
| | | map.setY0_width(request.getParameter("y0_m")); |
| | | map.setX_Pixel(request.getParameter("pixelX_m")); |
| | | map.setY_Pixel(request.getParameter("pixelY_m")); |
| | | int aaa = mapService.mapManagement_modify(map); |
| | | String xieyi = "BSTOCS1,ALTERMAP,"+map.getFloor()+","+map.getMapname()+","+map.getX_Truelength()+","+map.getY_Truewidth()+","+map.getX0_length()+","+map.getY0_width()+","+map.getX_Pixel()+","+map.getY_Pixel()+",END"; |
| | | Udp_Out.udp_to_cs(xieyi); |
| | | return ""+aaa; |
| | | map.setFloor(request.getParameter("floor_m")); |
| | | map.setMapname(request.getParameter("filename")); |
| | | map.setId(Integer.parseInt(request.getParameter("mapId"))); |
| | | map.setX_Truelength(request.getParameter("realX_m")); |
| | | map.setY_Truewidth(request.getParameter("realY_m")); |
| | | map.setX0_length(request.getParameter("x0_m")); |
| | | map.setY0_width(request.getParameter("y0_m")); |
| | | map.setX_Pixel(request.getParameter("pixelX_m")); |
| | | map.setY_Pixel(request.getParameter("pixelY_m")); |
| | | int aaa = this.mapService.mapManagement_modify(map); |
| | | String xieyi = "BSTOCS1,ALTERMAP," + map.getFloor() + "," + map.getMapname() + "," + map.getX_Truelength() + "," + map.getY_Truewidth() + "," + map.getX0_length() + "," + map.getY0_width() + "," + map.getX_Pixel() + "," + map.getY_Pixel() + ",END"; |
| | | Udp_Out.udp_to_cs(xieyi); |
| | | return "" + aaa; |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "/mapManagement_deletea.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | @RequestMapping( |
| | | value = {"/mapManagement_deletea.do"}, |
| | | method = {RequestMethod.POST, RequestMethod.GET} |
| | | ) |
| | | public String mapManagement_deletea(HttpServletRequest request) { |
| | | String checkValStr = request.getParameter("checkVal"); |
| | | checkValStr = checkValStr.replaceAll("\"", ""); |
| | | String[] checkVal = checkValStr.split(","); |
| | | mapService.mapManagement_delete(checkVal); |
| | | for(int i = 0;i<checkVal.length;i++) { |
| | | String xieyi = "BSTOCS1,DELETEMAP,"+checkVal[i]+",END"; |
| | | this.mapService.mapManagement_delete(checkVal); |
| | | |
| | | for(int i = 0; i < checkVal.length; ++i) { |
| | | String xieyi = "BSTOCS1,DELETEMAP," + checkVal[i] + ",END"; |
| | | Udp_Out.udp_to_cs(xieyi); |
| | | } |
| | | return ""+checkVal.length; |
| | | |
| | | return "" + checkVal.length; |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "getmapid.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | @RequestMapping( |
| | | value = {"getmapid.do"}, |
| | | method = {RequestMethod.POST, RequestMethod.GET} |
| | | ) |
| | | public JSONObject getmapid() { |
| | | JSONObject json = new JSONObject(); |
| | | String path = this.getClass().getClassLoader().getResource("").getPath(); |
| | | File file = new File(path+"fengmap.properties"); |
| | | File file = new File(path + "fengmap.properties"); |
| | | String mapid = ""; |
| | | String themeid = ""; |
| | | String[] strs = new String[2]; |
| | | String origon = ""; |
| | | String target = ""; |
| | | String type = ""; |
| | | String[] strs = new String[5]; |
| | | |
| | | try { |
| | | InputStream in = new FileInputStream(file); |
| | | InputStreamReader inr = new InputStreamReader(in); |
| | | BufferedReader br = new BufferedReader(inr); |
| | | for (int i=0; i<2; i++) { |
| | | |
| | | for(int i = 0; i < 5; ++i) { |
| | | strs[i] = br.readLine(); |
| | | } |
| | | |
| | | mapid = strs[0].split("=")[1]; |
| | | themeid = strs[1].split("=")[1]; |
| | | origon = strs[2].split("=")[1]; |
| | | target = strs[3].split("=")[1]; |
| | | type = strs[4].split("=")[1]; |
| | | br.close(); |
| | | inr.close(); |
| | | in.close(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } catch (Exception var14) { |
| | | var14.printStackTrace(); |
| | | } |
| | | |
| | | json.put("mapid", mapid); |
| | | json.put("themeid", themeid); |
| | | json.put("origon", origon); |
| | | json.put("target", target); |
| | | json.put("type", type); |
| | | return json; |
| | | } |
| | | |
| | | } |