| | |
| | | package com.hxzkoa.controller; |
| | | |
| | | import java.awt.geom.Point2D; |
| | | import java.io.BufferedInputStream; |
| | | import java.io.BufferedOutputStream; |
| | | import java.io.BufferedReader; |
| | | import java.io.File; |
| | | import java.io.FileInputStream; |
| | | import java.io.FileNotFoundException; |
| | | import java.io.FileOutputStream; |
| | | import java.io.IOException; |
| | | import java.io.InputStreamReader; |
| | | import java.io.OutputStream; |
| | | import java.sql.Date; |
| | | import java.net.URL; |
| | | import java.net.URLEncoder; |
| | | //import java.sql.Date; |
| | | import java.util.Date; |
| | | import java.sql.Time; |
| | | import java.sql.Timestamp; |
| | | import java.text.DecimalFormat; |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.Calendar; |
| | | import java.util.HashMap; |
| | | import java.util.Iterator; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import javax.servlet.ServletContext; |
| | | import javax.servlet.ServletException; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import javax.servlet.http.HttpSession; |
| | | |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | |
| | | |
| | | import com.hxzkoa.json.httpsos; |
| | | import com.hxzkoa.json.tb_achor; |
| | | import com.hxzkoa.json.tb_department; |
| | | import com.hxzkoa.json.tb_fence; |
| | | import com.hxzkoa.json.tb_fence_inout; |
| | | import com.hxzkoa.json.tb_gas; |
| | | import com.hxzkoa.json.tb_gps; |
| | | import com.hxzkoa.json.tb_history_power; |
| | | import com.hxzkoa.json.tb_jingwei; |
| | | import com.hxzkoa.json.tb_jobhistory; |
| | | import com.hxzkoa.json.tb_map; |
| | | import com.hxzkoa.json.tb_message; |
| | | import com.hxzkoa.json.tb_nav; |
| | | import com.hxzkoa.json.tb_person; |
| | | import com.hxzkoa.json.tb_qihou; |
| | | import com.hxzkoa.json.tb_realkaoqing; |
| | |
| | | import com.hxzkoa.services.ZhwService; |
| | | import com.hxzkoa.services.AnchorService; |
| | | import com.hxzkoa.services.AttendanceService; |
| | | import com.hxzkoa.services.BasicInfoService; |
| | | import com.hxzkoa.services.FenceService; |
| | | import com.hxzkoa.services.LabelService; |
| | | import com.hxzkoa.services.MapService; |
| | | import com.hxzkoa.udp.Dell_Ip; |
| | | import com.hxzkoa.udp.GetNowTime; |
| | | import com.hxzkoa.udp.ReadPeizhiMessage; |
| | |
| | | private FenceService fenceService; |
| | | @Autowired |
| | | private AttendanceService attendanceService; |
| | | @Autowired |
| | | private BasicInfoService basicInfoService; |
| | | @Autowired |
| | | private LabelService labelService; |
| | | @Autowired |
| | | private MapService mapService; |
| | | |
| | | httpsos sos = new httpsos(); |
| | | |
| | | Process process ; |
| | | |
| | | private Map<Integer,Process> map=new HashMap<>(); |
| | | private Map<String,String[]> persons=new HashMap<>(); |
| | | |
| | | @ResponseBody |
| | | @RequestMapping("/Shipinstart") |
| | |
| | | for (int i =0;i < fenceList.size(); i++) { |
| | | fencenames.add(fenceList.get(i).getName()); |
| | | } |
| | | Map realAttendanceTypeMap = attendanceService.getRealAttendanceType(); |
| | | List<String> realAttendance_k = new ArrayList<String>(); |
| | | // List<Integer> realAttendance_v = new ArrayList<Integer>(); |
| | | Iterator<String> realAttendanceTypeIter = realAttendanceTypeMap.keySet().iterator(); |
| | | while (realAttendanceTypeIter.hasNext()) { |
| | | String key = realAttendanceTypeIter.next(); |
| | | realAttendance_k.add(key); |
| | | // realAttendance_v.add((int) realAttendanceTypeMap.get(key)); |
| | | List<tb_department> departments = basicInfoService.getDepartmentManagement2(); |
| | | for (int i =0;i < departments.size(); i++) { |
| | | realAttendance_k.add(departments.get(i).getDepartmentName()); |
| | | } |
| | | request.setAttribute("guanlianList", realAttendance_k); |
| | | request.setAttribute("fenceList", fencenames); |
| | |
| | | return toPage; |
| | | } |
| | | |
| | | @RequestMapping(value = "/xiangdaototwo.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | public String xiangdaototwo(HttpServletRequest request) { |
| | | String toPage = "forward:/hxzk/fence/drawFencexiangdao.jsp"; |
| | | List<tb_map> floorList = ZhwService.getFloor(); |
| | | List<tb_fence> fenceList = fenceService.getFenceList(); |
| | | List<String> fencenames = new ArrayList<>(); |
| | | for (int i =0;i < fenceList.size(); i++) { |
| | | fencenames.add(fenceList.get(i).getName()); |
| | | } |
| | | List<String> realAttendance_k = new ArrayList<String>(); |
| | | List<tb_department> departments = basicInfoService.getDepartmentManagement2(); |
| | | for (int i =0;i < departments.size(); i++) { |
| | | realAttendance_k.add(departments.get(i).getDepartmentName()); |
| | | } |
| | | List<tb_tag> labelManagementListaa = labelService.getLabelManagementa(); |
| | | request.setAttribute("labelManagementListaa", labelManagementListaa); |
| | | request.setAttribute("guanlianList", realAttendance_k); |
| | | request.setAttribute("fenceList", fencenames); |
| | | request.setAttribute("floorList", floorList); |
| | | return toPage; |
| | | } |
| | | |
| | | @RequestMapping(value = "/drawFence.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | public String drawFence(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { |
| | | String floor_number = request.getParameter("value"); |
| | |
| | | return mapList; |
| | | } |
| | | |
| | | @RequestMapping(value="/floornumTomap_all2.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | @ResponseBody |
| | | public List<tb_map> floornumTomap_all2(HttpServletRequest request) { |
| | | String floor = request.getParameter("floor"); |
| | | final List<tb_map> mapList = ZhwService.getMap_all2(floor); |
| | | return mapList; |
| | | } |
| | | |
| | | @RequestMapping(value="/getFloorByMapname.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | @ResponseBody |
| | | public List<tb_map> getFloorByMapname(HttpServletRequest request) { |
| | |
| | | public List<tb_fence> getFloorFence(HttpServletRequest request) { |
| | | String floor_number = request.getParameter("value"); |
| | | final List<tb_fence> fenceList = ZhwService.getFence(floor_number); |
| | | return fenceList; |
| | | final List<tb_fence> fenceList2 = new ArrayList<tb_fence>(); |
| | | for (int i = 0; i < fenceList.size(); i++) { |
| | | if (!fenceList.get(i).getType().equals("变电站")) { |
| | | fenceList2.add(fenceList.get(i)); |
| | | } |
| | | } |
| | | return fenceList2; |
| | | } |
| | | |
| | | @RequestMapping(value="/getFloorFence_all.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | |
| | | fence.setBumen(request.getParameter("guanlianduixiang")); |
| | | fence.setName(request.getParameter("quyumingcheng")); |
| | | |
| | | String zuobiao =(String) request.getParameter("zuobiao"); |
| | | int aaa = 1; |
| | | List<tb_fence> fencesss = ZhwService.getFenceaaa(fence.getName()); |
| | | if (fencesss.size() == 0) { |
| | | aaa = 0; |
| | | String xingzhuang = request.getParameter("xingzhuang"); |
| | | fence.setShape(xingzhuang); |
| | | |
| | | String zuobiao =(String) request.getParameter("zuobiao"); |
| | | String baowen = ""; |
| | | if (xingzhuang.equals("多边形")) { |
| | | String[] zuobiaos = zuobiao.split(","); |
| | | String str = ""; |
| | | for (int i=0; i<zuobiaos.length; i++) { |
| | | if (i == zuobiaos.length-1) { |
| | | str += zuobiaos[i]; |
| | | break; |
| | | } |
| | | if (i%2 == 0) { |
| | | str += zuobiaos[i]+":"; |
| | | } else { |
| | | str += zuobiaos[i]+";"; |
| | | } |
| | | } |
| | | baowen = str; |
| | | } else { |
| | | baowen = zuobiao.replace(",", ":"); |
| | | } |
| | | fence.setZuobiao(zuobiao); |
| | | |
| | | String start = "00:00:00"; |
| | | String end = "23:59:59"; |
| | | fence.setStart(start); |
| | | fence.setStop(end); |
| | | |
| | | fence.setColor(request.getParameter("yanse")); |
| | | //ZhwService.drawFence_add(fence); |
| | | String xieyi = "BSTOCS1,ADDFENCE,"+fence.getFloor()+","+fence.getType()+","+fence.getBumen()+","+fence.getName()+","+baowen+","+fence.getShape()+","+fence.getStart()+","+fence.getStop()+","+GetNowTime.now()+","+fence.getColor()+",END"; |
| | | Udp_Out.udp_to_cs(xieyi); |
| | | |
| | | String type = request.getParameter("weilanleixing"); |
| | | String name = request.getParameter("quyumingcheng"); |
| | | String floor = request.getParameter("layer"); |
| | | String shape = request.getParameter("xingzhuang"); |
| | | |
| | | if(type.equals("巡检区域")) { |
| | | ZhwService.xunjianSet_add(name); |
| | | } else if (type.equals("定位区域")) { |
| | | String[] zb_list = zuobiao.split(","); |
| | | String zb_inout = ""; |
| | | for (int i=0;i<zb_list.length;i++) { |
| | | zb_inout += zb_list[i]; |
| | | if (i%2==0) { |
| | | zb_inout += ","; |
| | | } else if (i%2==1 && i!=zb_list.length-1) { |
| | | zb_inout += ";"; |
| | | } |
| | | } |
| | | ZhwService.fenceInout_add(name,zb_inout,shape,floor); |
| | | } |
| | | } |
| | | return aaa; |
| | | } |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "/begindrawa.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | public String begindraw(HttpServletRequest request) { |
| | | String tagid = request.getParameter("tagid"); |
| | | String xieyi = "BSTOCS1,drawfence,outwarning,"+tagid+",start,end"; |
| | | Udp_Out.udp_to_cs(xieyi); |
| | | return "1"; |
| | | } |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "/enddrawa.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | public String enddrawa(HttpServletRequest request) { |
| | | String tagid = request.getParameter("tagid"); |
| | | String xieyi = "BSTOCS1,drawfence,outwarning,"+tagid+",stop,end"; |
| | | Udp_Out.udp_to_cs(xieyi); |
| | | return "1"; |
| | | } |
| | | |
| | | @RequestMapping(value = "/xiangdaoone.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | public String xiangdaoone(HttpServletRequest request) { |
| | | String toPage = "forward:/hxzk/label/labelManagementxiangdaoone.jsp"; |
| | | List<tb_tag> labelManagementList = labelService.getLabelManagement(1); |
| | | List<tb_tag> labelManagementListaa = labelService.getLabelManagementa(); |
| | | request.setAttribute("labelManagementList", labelManagementList); |
| | | request.setAttribute("labelManagementListaa", labelManagementListaa); |
| | | int curPage = 1; |
| | | int count = labelService.getLabelManagementCount(); |
| | | int minPage = PageUtil.getMinPage(count); |
| | | // System.out.print(minPage); |
| | | request.setAttribute("pageList", PageUtil.getPage(minPage)); |
| | | request.setAttribute("curPage", curPage); |
| | | return toPage; |
| | | } |
| | | |
| | | @RequestMapping(value = "/saveFence2.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | public String drawFence_add2(HttpServletRequest request) { |
| | | String toPage = "forward:/hxzk/label/labelManagementxiangdaothree.jsp"; |
| | | tb_fence fence = new tb_fence(); |
| | | fence.setFloor(request.getParameter("layer")); |
| | | fence.setType(request.getParameter("weilanleixing")); |
| | | fence.setBaoliu2(request.getParameter("tagid")); |
| | | fence.setName(request.getParameter("quyumingcheng")); |
| | | // String zuobiao =(String) request.getParameter("zuobiao"); |
| | | String zuobiao = ZhwService.getfencezuobiao(); |
| | | fence.setZuobiao(zuobiao); |
| | | |
| | | fence.setShape(request.getParameter("xingzhuang")); |
| | | |
| | | |
| | | fence.setShape("多边形"); |
| | | |
| | | String start = "00:00:00"; |
| | | String end = "23:59:59"; |
| | | fence.setStart(start); |
| | | fence.setStop(end); |
| | | |
| | | fence.setColor(request.getParameter("yanse")); |
| | | int aaa = ZhwService.drawFence_add(fence); |
| | | String xieyi = "BSTOCS1,ADDFENCE,"+fence.getFloor()+","+fence.getType()+","+fence.getBumen()+","+fence.getName()+","+fence.getZuobiao()+","+fence.getShape()+","+fence.getStart()+","+fence.getStop()+","+GetNowTime.now()+","+fence.getColor()+",END"; |
| | | Udp_Out.udp_to_cs(xieyi); |
| | | |
| | | String type = request.getParameter("weilanleixing"); |
| | | String name = request.getParameter("quyumingcheng"); |
| | | String floor = request.getParameter("layer"); |
| | | String shape = request.getParameter("xingzhuang"); |
| | | |
| | | if(type.equals("巡检区域")) { |
| | | ZhwService.xunjianSet_add(name); |
| | | } else if (type.equals("定位区域")) { |
| | | String[] zb_list = zuobiao.split(","); |
| | | String zb_inout = ""; |
| | | for (int i=0;i<zb_list.length;i++) { |
| | | zb_inout += zb_list[i]; |
| | | if (i%2==0) { |
| | | zb_inout += ","; |
| | | } else if (i%2==1 && i!=zb_list.length-1) { |
| | | zb_inout += ";"; |
| | | } |
| | | } |
| | | ZhwService.fenceInout_add(name,zb_inout,shape,floor); |
| | | List<String> realAttendance_k = new ArrayList<String>(); |
| | | List<tb_department> departments = basicInfoService.getDepartmentManagement2(); |
| | | for (int i =0;i < departments.size(); i++) { |
| | | realAttendance_k.add(departments.get(i).getDepartmentName()); |
| | | } |
| | | request.setAttribute("guanlianList", realAttendance_k); |
| | | request.setAttribute("fence", fence); |
| | | return toPage; |
| | | } |
| | | |
| | | @RequestMapping(value = "/saveFence3.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | @ResponseBody |
| | | public void drawFence_add3(HttpServletRequest request) { |
| | | tb_fence fence = new tb_fence(); |
| | | fence.setFloor(request.getParameter("floor")); |
| | | fence.setType(request.getParameter("type")); |
| | | fence.setBaoliu2(request.getParameter("baoliu2")); |
| | | fence.setName(request.getParameter("name")); |
| | | // String zuobiao =(String) request.getParameter("zuobiao"); |
| | | String zuobiao = ZhwService.getfencezuobiao(); |
| | | fence.setZuobiao(zuobiao); |
| | | |
| | | return aaa; |
| | | String haibagao = ZhwService.getfencehaibagao(); |
| | | fence.setBaoliu6(haibagao); |
| | | |
| | | fence.setShape(request.getParameter("shape")); |
| | | fence.setStart(request.getParameter("start")); |
| | | fence.setStop(request.getParameter("stop")); |
| | | fence.setColor(request.getParameter("color")); |
| | | fence.setBaoliu3(request.getParameter("baoliu3")); |
| | | fence.setBaoliu1(request.getParameter("baoliu1")); |
| | | fence.setBumen(request.getParameter("bumen")); |
| | | fence.setBaoliu4(request.getParameter("baoliu4")); |
| | | int aaa = ZhwService.drawFence_add2(fence); |
| | | String xieyi = "BSTOCS1,ADDFENCE,"+fence.getFloor()+","+fence.getType()+","+fence.getBumen()+","+fence.getName()+","+fence.getZuobiao().replace(",", ":")+","+fence.getShape()+","+fence.getStart()+","+fence.getStop()+","+GetNowTime.now()+","+fence.getColor()+","+fence.getBaoliu1()+","+fence.getBaoliu6()+","+fence.getBaoliu2()+","+fence.getBaoliu3()+","+fence.getBaoliu4()+",END"; |
| | | Udp_Out.udp_to_cs(xieyi); |
| | | String type = request.getParameter("type"); |
| | | String name = request.getParameter("name"); |
| | | String floor = request.getParameter("floor"); |
| | | String shape = request.getParameter("shape"); |
| | | |
| | | if(type.equals("巡检区域")) { |
| | | ZhwService.xunjianSet_add(name); |
| | | } else if (type.equals("定位区域")) { |
| | | String[] zb_list = zuobiao.split(","); |
| | | String zb_inout = ""; |
| | | for (int i=0;i<zb_list.length;i++) { |
| | | zb_inout += zb_list[i]; |
| | | if (i%2==0) { |
| | | zb_inout += ","; |
| | | } else if (i%2==1 && i!=zb_list.length-1) { |
| | | zb_inout += ";"; |
| | | } |
| | | } |
| | | ZhwService.fenceInout_add(name,zb_inout,shape,floor); |
| | | } |
| | | } |
| | | |
| | | @RequestMapping(value = "/addfence0.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | @ResponseBody |
| | | public String addfence0(HttpServletRequest request) { |
| | | tb_fence fence = new tb_fence(); |
| | | fence.setFloor(request.getParameter("floor")); |
| | | fence.setType("变电站"); |
| | | // fence.setBaoliu2(request.getParameter("baoliu2")); |
| | | fence.setName(request.getParameter("name")+1); |
| | | fence.setBaoliu7(request.getParameter("baoliu7")); |
| | | // String zuobiao =(String) request.getParameter("zuobiao"); |
| | | String zuobiao = ZhwService.getfencezuobiao(); |
| | | fence.setZuobiao(zuobiao); |
| | | |
| | | String haibagao = ZhwService.getfencehaibagao(); |
| | | fence.setBaoliu6(haibagao); |
| | | |
| | | fence.setShape("多边形"); |
| | | fence.setStart("00:00:00"); |
| | | fence.setStop("23:59:59"); |
| | | fence.setColor(request.getParameter("color")); |
| | | fence.setBaoliu3(request.getParameter("baoliu3")); |
| | | fence.setBaoliu1(request.getParameter("baoliu1")); |
| | | fence.setBumen(request.getParameter("bumen")); |
| | | fence.setBaoliu4(request.getParameter("baoliu4")); |
| | | int aaa = ZhwService.drawFence_add2(fence); |
| | | String xieyi = "BSTOCS1,ADDFENCE,"+fence.getFloor()+","+fence.getType()+","+fence.getBumen()+","+request.getParameter("name")+","+fence.getZuobiao().replace(",", ":")+","+fence.getShape()+","+fence.getStart()+","+fence.getStop()+","+GetNowTime.now()+","+fence.getColor()+","+fence.getBaoliu1()+","+fence.getBaoliu7()+",,"+fence.getBaoliu3()+","+fence.getBaoliu4()+",END"; |
| | | Udp_Out.udp_to_cs(xieyi); |
| | | String type = request.getParameter("type"); |
| | | String name = request.getParameter("name"); |
| | | String floor = request.getParameter("floor"); |
| | | String shape = request.getParameter("shape"); |
| | | |
| | | // if(type.equals("巡检区域")) { |
| | | // ZhwService.xunjianSet_add(name); |
| | | // } else if (type.equals("定位区域")) { |
| | | // String[] zb_list = zuobiao.split(","); |
| | | // String zb_inout = ""; |
| | | // for (int i=0;i<zb_list.length;i++) { |
| | | // zb_inout += zb_list[i]; |
| | | // if (i%2==0) { |
| | | // zb_inout += ","; |
| | | // } else if (i%2==1 && i!=zb_list.length-1) { |
| | | // zb_inout += ";"; |
| | | // } |
| | | // } |
| | | // ZhwService.fenceInout_add(name,zb_inout,shape,floor); |
| | | // } |
| | | return ""+aaa; |
| | | } |
| | | |
| | | @RequestMapping(value = "/sanweiFence.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | |
| | | fence.setType(request.getParameter("weilanleixing")); |
| | | fence.setBumen(request.getParameter("guanlianduixiang")); |
| | | fence.setName(request.getParameter("quyumingcheng")); |
| | | fence.setBaoliu1(request.getParameter("fencegao")); |
| | | String zuobiao =(String) request.getParameter("zuobiao"); |
| | | String zuobiaodufen = (String) request.getParameter("zuobiaodufen"); |
| | | fence.setZuobiao(zuobiao); |
| | | |
| | | fence.setShape(request.getParameter("xingzhuang")); |
| | | |
| | | String start = "00:00:00"; |
| | | String end = "23:59:59"; |
| | | fence.setStart(start); |
| | | fence.setStop(end); |
| | | |
| | | fence.setColor(request.getParameter("yanse")); |
| | | int aaa = ZhwService.sanweiFence_add(fence); |
| | | String xieyi = "BSTOCS1,ADDFENCE,"+fence.getFloor()+","+fence.getType()+","+fence.getBumen()+","+fence.getName()+","+zuobiao+","+fence.getShape()+","+fence.getStart()+","+fence.getStop()+","+GetNowTime.now()+","+fence.getColor()+","+fence.getBaoliu1()+",END"; |
| | | Udp_Out.udp_to_cs(xieyi); |
| | | sysSettingService.guiling(); |
| | | String type = request.getParameter("weilanleixing"); |
| | | String name = request.getParameter("quyumingcheng"); |
| | | String floor = request.getParameter("layer"); |
| | | String shape = request.getParameter("xingzhuang"); |
| | | |
| | | if(type.equals("巡检区域")) { |
| | | ZhwService.xunjianSet_add(name); |
| | | } else if (type.equals("定位区域")) { |
| | | String[] zb_list = zuobiao.split(","); |
| | | String zb_inout = ""; |
| | | for (int i=0;i<zb_list.length;i++) { |
| | | zb_inout += zb_list[i]; |
| | | if (i%2==0) { |
| | | zb_inout += ","; |
| | | } else if (i%2==1 && i!=zb_list.length-1) { |
| | | zb_inout += ";"; |
| | | int aaa = 1; |
| | | List<tb_fence> fencesss = ZhwService.getFenceaaa(fence.getName()); |
| | | if (fencesss.size() == 0) { |
| | | aaa = 0; |
| | | fence.setBaoliu1(request.getParameter("fencegao")); |
| | | String zuobiao =(String) request.getParameter("zuobiao"); |
| | | String zuobiaodufen = (String) request.getParameter("zuobiaodufen"); |
| | | zuobiao = zuobiao.replace(",", ":"); |
| | | fence.setZuobiao(zuobiao); |
| | | |
| | | fence.setShape(request.getParameter("xingzhuang")); |
| | | |
| | | String start = "00:00:00"; |
| | | String end = "23:59:59"; |
| | | fence.setStart(start); |
| | | fence.setStop(end); |
| | | |
| | | fence.setColor(request.getParameter("yanse")); |
| | | // ZhwService.sanweiFence_add(fence); |
| | | String xieyi = "BSTOCS1,ADDFENCE,"+fence.getFloor()+","+fence.getType()+","+fence.getBumen()+","+fence.getName()+","+zuobiao+","+fence.getShape()+","+fence.getStart()+","+fence.getStop()+","+GetNowTime.now()+","+fence.getColor()+","+fence.getBaoliu1()+",END"; |
| | | Udp_Out.udp_to_cs(xieyi); |
| | | sysSettingService.guiling(); |
| | | String type = request.getParameter("weilanleixing"); |
| | | String name = request.getParameter("quyumingcheng"); |
| | | String floor = request.getParameter("layer"); |
| | | String shape = request.getParameter("xingzhuang"); |
| | | |
| | | if(type.equals("巡检区域")) { |
| | | ZhwService.xunjianSet_add(name); |
| | | } else if (type.equals("定位区域")) { |
| | | String[] zb_list = zuobiao.split(","); |
| | | String zb_inout = ""; |
| | | for (int i=0;i<zb_list.length;i++) { |
| | | zb_inout += zb_list[i]; |
| | | if (i%2==0) { |
| | | zb_inout += ","; |
| | | } else if (i%2==1 && i!=zb_list.length-1) { |
| | | zb_inout += ";"; |
| | | } |
| | | } |
| | | ZhwService.fenceInout_add(name,zb_inout,shape,floor); |
| | | } |
| | | ZhwService.fenceInout_add(name,zb_inout,shape,floor); |
| | | } |
| | | |
| | | return aaa; |
| | | } |
| | | |
| | |
| | | @RequestMapping(value="/trackTagid.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | @ResponseBody |
| | | public List<tb_track> queryTagid(HttpServletRequest request) throws ParseException { |
| | | String panduan = request.getParameter("panduan"); |
| | | String tag_id = request.getParameter("tag_value"); |
| | | String begin_time = request.getParameter("begin_value"); |
| | | String end_time = request.getParameter("end_value"); |
| | | String floor = request.getParameter("floor_value"); |
| | | String fence = request.getParameter("fence"); |
| | | if (fence.equals("空")) { |
| | | final List<tb_track> tagList = ZhwService.getTagtrack(tag_id, begin_time, end_time, floor); |
| | | List<tb_track> tagList = new ArrayList<>(); |
| | | if (panduan.equals("true")) { |
| | | tagList = ZhwService.getTagtrack(tag_id, begin_time, end_time, floor); |
| | | } else { |
| | | tagList = ZhwService.getTagtrack2(tag_id, begin_time, end_time, floor); |
| | | } |
| | | return tagList; |
| | | } else { |
| | | final List<tb_track> tagList = ZhwService.getTagtrack(tag_id, begin_time, end_time, floor); |
| | | List<tb_track> tagList = new ArrayList<>(); |
| | | if (panduan.equals("true")) { |
| | | tagList = ZhwService.getTagtrack(tag_id, begin_time, end_time, floor); |
| | | } else { |
| | | tagList = ZhwService.getTagtrack2(tag_id, begin_time, end_time, floor); |
| | | } |
| | | final List<tb_track> tagList2 = new ArrayList<>(); |
| | | for (int i=0;i<tagList.size();i++) { |
| | | Point2D.Double dian = new Point2D.Double(Double.parseDouble(tagList.get(i).getX()),Double.parseDouble(tagList.get(i).getY())); |
| | |
| | | } |
| | | } |
| | | |
| | | @RequestMapping(value="/trackTagid3.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | @ResponseBody |
| | | public List<tb_track> queryTagid3(HttpServletRequest request) throws ParseException { |
| | | String tag_id = request.getParameter("tagid"); |
| | | String begin_time = request.getParameter("begin"); |
| | | String end_time = request.getParameter("end"); |
| | | List<tb_track> tagList = ZhwService.getTagtrack3(tag_id, begin_time, end_time); |
| | | return tagList; |
| | | } |
| | | |
| | | @RequestMapping(value="/trackTagida.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | @ResponseBody |
| | | public JSONObject queryTagida(HttpServletRequest request) throws ParseException { |
| | |
| | | position.setFence(node.getP_fence()); |
| | | position.setSousuo(node.getP_sousuo()); |
| | | position.setShipin(node.getP_shipin()); |
| | | position.setBumen(node.getP_department()); |
| | | position.setBaoliu22(node.getBaoliu22()); |
| | | // position.setPhone(node.getP_phone()); |
| | | // position.setIdcardnum(node.getP_idcardnum()); |
| | | // position.setJingdu(node.getP_jingdu()); |
| | | // position.setWeidu(node.getP_weidu()); |
| | | // position.setGaocheng(node.getBaoliu10()); |
| | | |
| | | finalPositionList.add(position); |
| | | } |
| | | return finalPositionList; |
| | | } |
| | | |
| | | @RequestMapping(value="/getRealPositiona.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | @ResponseBody |
| | | public JSONObject getRealPositiona(HttpServletRequest request) { |
| | | String floor = request.getParameter("floor"); |
| | | JSONObject json = new JSONObject(); |
| | | //根据时间筛选出数据 |
| | | List<tb_person> realLocationList = ZhwService.getpersonLocation(floor); |
| | | |
| | | List<tb_realpositoin> finalPositionList = new ArrayList<tb_realpositoin>(); |
| | | |
| | | //根据每个tagid取tb_tag:[tag_id,state(静止1or运动0),power,status(在线1or离线0),addtime],放入tb_position中 |
| | | for (tb_person node : realLocationList) { |
| | | if (node.getP_online().equals("1")) { |
| | | String tagid = node.getP_tagid(); |
| | | tb_realpositoin position = new tb_realpositoin(); |
| | | position.setTagid(tagid); |
| | | position.setPower(node.getP_power()); |
| | | position.setLife(node.getP_online()); |
| | | position.setName(node.getP_name()); |
| | | position.setPosx(""+((double)Math.round(Double.parseDouble(node.getP_x()))/100)); |
| | | position.setPosy(""+((double)Math.round(Double.parseDouble(node.getP_y()))/100)); |
| | | position.setSos(node.getP_sos()); |
| | | position.setTime(node.getP_addtiem()); |
| | | position.setFence(node.getP_fence()); |
| | | position.setSousuo(node.getP_sousuo()); |
| | | position.setShipin(node.getP_shipin()); |
| | | position.setBumen(node.getP_department()); |
| | | position.setPhone(node.getP_phone()); |
| | | position.setIdcardnum(node.getP_idcardnum()); |
| | | position.setJingdu(node.getP_jingdu()); |
| | | position.setWeidu(node.getP_weidu()); |
| | | position.setGaocheng(node.getBaoliu10()); |
| | | |
| | | finalPositionList.add(position); |
| | | } |
| | | } |
| | | json.put("dataList", finalPositionList); |
| | | return json; |
| | | } |
| | | |
| | | @RequestMapping(value="/getRealPosition_all.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | @ResponseBody |
| | | public List<tb_realpositoin> getRealPosition_all(HttpServletRequest request) { |
| | |
| | | position.setSos(node.getP_sos()); |
| | | position.setTime(node.getP_addtiem()); |
| | | position.setFence(node.getP_fence()); |
| | | position.setShipin(node.getP_shipin()); |
| | | position.setShipingname(node.getP_shipingname()); |
| | | position.setChaichu(node.getBaoliu6()); |
| | | position.setBaoliu20(node.getBaoliu20()); |
| | | position.setBaoliu21(node.getBaoliu21()); |
| | | finalPositionList.add(position); |
| | | } |
| | | |
| | |
| | | JSONObject json = new JSONObject(); |
| | | json.put("X", realTrackList.get(0).getP_x()); |
| | | json.put("Y", realTrackList.get(0).getP_y()); |
| | | json.put("time", realTrackList.get(0).getP_addtiem()); |
| | | return json; |
| | | } |
| | | |
| | |
| | | return settingList; |
| | | } |
| | | |
| | | @RequestMapping(value="/getSysSetting_list2.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | @ResponseBody |
| | | public String getSysSetting_list2(HttpServletRequest request) { |
| | | JSONObject json = new JSONObject(); |
| | | List<tb_system> settingList = sysSettingService.getSetting(); |
| | | List<tb_nav> navList = ZhwService.getnav(); |
| | | List<tb_person> persons = ZhwService.getbumen(); |
| | | List<String> realAttendance_k = new ArrayList<String>(); |
| | | List<tb_department> departments = basicInfoService.getDepartmentManagement2(); |
| | | for (int i =0;i < departments.size(); i++) { |
| | | realAttendance_k.add(departments.get(i).getDepartmentName()); |
| | | } |
| | | json.put("dataList", settingList); |
| | | json.put("dataList2", navList); |
| | | json.put("dataList3", persons); |
| | | json.put("dataList4", realAttendance_k); |
| | | return json.toString(); |
| | | } |
| | | |
| | | @RequestMapping(value="/getSysSetting_list3.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | @ResponseBody |
| | | public String getSysSetting_list3(HttpServletRequest request) { |
| | | JSONObject json = new JSONObject(); |
| | | List<tb_system> settingList = sysSettingService.getSetting(); |
| | | List<tb_nav> navList = ZhwService.getnav(); |
| | | List<tb_person> persons = ZhwService.getbumen(); |
| | | List<String> realAttendance_k = new ArrayList<String>(); |
| | | List<tb_department> departments = basicInfoService.getDepartmentManagement2(); |
| | | for (int i =0;i < departments.size(); i++) { |
| | | realAttendance_k.add(departments.get(i).getDepartmentName()); |
| | | } |
| | | HttpSession session = request.getSession(); |
| | | ServletContext application = session.getServletContext(); |
| | | String username = application.getAttribute("username").toString(); |
| | | json.put("xianuser", username); |
| | | json.put("dataList", settingList); |
| | | json.put("dataList2", navList); |
| | | json.put("dataList3", persons); |
| | | json.put("dataList4", realAttendance_k); |
| | | return json.toString(); |
| | | } |
| | | |
| | | @RequestMapping(value="/getAnchorInfo.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | @ResponseBody |
| | | public List<tb_achor> getAnchorInfo(HttpServletRequest request) { |
| | |
| | | return mapList; |
| | | } |
| | | |
| | | @RequestMapping(value="/qiehuanditu_option2.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | @ResponseBody |
| | | public List<tb_map> qiehuanditu_option2(HttpServletRequest request) { |
| | | String floor = request.getParameter("floor"); |
| | | List<tb_map> mapList = ZhwService.getFloor2(floor); |
| | | return mapList; |
| | | } |
| | | |
| | | @RequestMapping(value = "/qiehuanditu_save.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | public String qiehuanditu_save(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { |
| | | //String toPage = "forward:/show.do"; |
| | |
| | | @RequestMapping(value="/qiehuanditu_get.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | @ResponseBody |
| | | public List<String> qiehuanditu_get(HttpServletRequest request) { |
| | | // String filePath = Config.getMapConfig(); |
| | | // String map = ModifyConfig.readData(filePath, "map_now"); |
| | | // List<String> maplist = new ArrayList<String>(); |
| | | // maplist.add(map); |
| | | // //System.out.print("read data"); |
| | | // //System.out.print(map); |
| | | List<tb_system> systemlist = sysSettingService.getSetting(); |
| | | List<String> maplist = new ArrayList<String>(); |
| | | String map = systemlist.get(0).getYulan_map(); |
| | |
| | | return maplist; |
| | | } |
| | | |
| | | @RequestMapping(value="/qiehuanditu1.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | @ResponseBody |
| | | public List<String> qiehuanditu1(HttpServletRequest request) { |
| | | List<tb_map> maps = mapService.getMapManagement(); |
| | | List<String> maplist = new ArrayList<String>(); |
| | | String map = maps.get(0).getMapname(); |
| | | maplist.add(map); |
| | | return maplist; |
| | | } |
| | | |
| | | @RequestMapping(value = "/getAnchor_read_config.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | public void getAnchor_read_config(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { |
| | | byte[] byt=Read_Write_Anchor_Message.ReadData((byte)0x2,(byte)0x50); |
| | |
| | | Udp_Out.udp_to_cs(xieyi); |
| | | } |
| | | |
| | | @RequestMapping(value = "/jinmengaojing.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | public void jinmengaojing(HttpServletRequest request) throws IOException { |
| | | String tagid=request.getParameter("tagid"); |
| | | ZhwService.jinmengao(tagid); |
| | | String xieyi = "BSTOCS1,DELLWARN," +tagid+ ",未授权进入告警,END"; |
| | | Udp_Out.udp_to_cs(xieyi); |
| | | } |
| | | |
| | | @RequestMapping(value = "/chumengaojing.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | public void chumengaojing(HttpServletRequest request) throws IOException { |
| | | String tagid=request.getParameter("tagid"); |
| | | ZhwService.chumengao(tagid); |
| | | String xieyi = "BSTOCS1,DELLWARN," +tagid+ ",未授权出门告警,END"; |
| | | Udp_Out.udp_to_cs(xieyi); |
| | | } |
| | | |
| | | @RequestMapping(value = "/gaojingzongchuli.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | public void gaojingzongchuli(HttpServletRequest request) throws IOException { |
| | | List<tb_person> soslist = ZhwService.getsosgaojing(); |
| | | String xieyi = "BSTOCS1,DELLWARNALL,END"; |
| | | Udp_Out.udp_to_cs(xieyi); |
| | | for (int i=0; i<soslist.size(); i++) { |
| | | String tagid = soslist.get(i).getP_tagid(); |
| | | ZhwService.sosgao(tagid); |
| | | String xieyi = "BSTOCS1,DELLWARN," +tagid+ ",SOS,END"; |
| | | Udp_Out.udp_to_cs(xieyi); |
| | | // String xieyi = "BSTOCS1,DELLWARN," +tagid+ ",SOS,END"; |
| | | // Udp_Out.udp_to_cs(xieyi); |
| | | } |
| | | List<tb_person> fencelist = ZhwService.getfencegaojing(); |
| | | for (int i=0; i<fencelist.size(); i++) { |
| | | String tagid = fencelist.get(i).getP_tagid(); |
| | | ZhwService.fencegao(tagid); |
| | | String xieyi = "BSTOCS1,DELLWARN," +tagid+ ",危险区域,END"; |
| | | Udp_Out.udp_to_cs(xieyi); |
| | | // String xieyi = "BSTOCS1,DELLWARN," +tagid+ ",危险区域,END"; |
| | | // Udp_Out.udp_to_cs(xieyi); |
| | | } |
| | | List<tb_person> chufencelist = ZhwService.getchufencegaojing(); |
| | | for (int i=0; i<fencelist.size(); i++) { |
| | | String tagid = chufencelist.get(i).getP_tagid(); |
| | | ZhwService.fencegao(tagid); |
| | | String xieyi = "BSTOCS1,DELLWARN," +tagid+ ",出区域告警,END"; |
| | | Udp_Out.udp_to_cs(xieyi); |
| | | // String xieyi = "BSTOCS1,DELLWARN," +tagid+ ",出区域告警,END"; |
| | | // Udp_Out.udp_to_cs(xieyi); |
| | | } |
| | | List<tb_person> jinchumenlist = ZhwService.getjinchumengaojing(); |
| | | for (int i=0; i<fencelist.size(); i++) { |
| | | String tagid = chufencelist.get(i).getP_tagid(); |
| | | ZhwService.jinmengao(tagid); |
| | | ZhwService.chumengao(tagid); |
| | | // String xieyi = "BSTOCS1,DELLWARN," +tagid+ ",出区域告警,END"; |
| | | // Udp_Out.udp_to_cs(xieyi); |
| | | } |
| | | } |
| | | |
| | |
| | | return id; |
| | | } |
| | | |
| | | @RequestMapping(value = "/shipinzhuangtai2.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | public void shipinzhuangtai2(HttpServletRequest request){ |
| | | String tagid=request.getParameter("tagid"); |
| | | ZhwService.shipin(tagid); |
| | | } |
| | | |
| | | @RequestMapping(value = "/sousuo.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | public void sousuo(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { |
| | | String tagid = request.getParameter("tagid"); |
| | |
| | | for ( tb_person node : realLocationList) { |
| | | Double x = Double.valueOf(node.getP_x()); |
| | | Double y = Double.valueOf(node.getP_y()); |
| | | Double xo = (x-54732)/100; |
| | | Double yo = -(y+10268)/100; |
| | | Double xo = (x)/100;//-54732 |
| | | Double yo = -(y)/100;//+10268 |
| | | List<Double> xy = ZhwController.cal2(xo, yo); |
| | | node.setP_x((xy.get(0)).toString()); |
| | | node.setP_y((xy.get(1)).toString()); |
| | |
| | | return finalPositionList; |
| | | } |
| | | |
| | | @RequestMapping(value="/getRealPositionsana.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | @RequestMapping(value="/getRealPositionsan2.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | @ResponseBody |
| | | public JSONObject getRealPositionsana(HttpServletRequest request) { |
| | | public List<tb_realpositoin> getRealPositionsan2(HttpServletRequest request) { |
| | | long timeStart = 0; |
| | | |
| | | JSONObject json = new JSONObject(); |
| | | |
| | | //根据时间筛选出数据 |
| | | List<tb_person> realLocationList = ZhwService.getpersonLocationsan(); |
| | | for ( tb_person node : realLocationList) { |
| | | Double x = Double.valueOf(node.getP_x()); |
| | | Double y = Double.valueOf(node.getP_y()); |
| | | Double xo = (x-54732)/100; |
| | | Double yo = -(y+10268)/100; |
| | | List<Double> xy = ZhwController.cal2(xo, yo); |
| | | node.setP_x((xy.get(0)).toString()); |
| | | node.setP_y((xy.get(1)).toString()); |
| | | } |
| | | |
| | | List<tb_realpositoin> finalPositionList = new ArrayList<tb_realpositoin>(); |
| | | |
| | | //根据每个tagid取tb_tag:[tag_id,state(静止1or运动0),power,status(在线1or离线0),addtime],放入tb_position中 |
| | | for (tb_person node : realLocationList) { |
| | | double jiao = 0.00; |
| | | if (persons.containsKey(node.getP_tagid())) { |
| | | double x1 = Double.valueOf(node.getP_x()); |
| | | double y1 = Double.valueOf(node.getP_y()); |
| | | double x2 = Double.valueOf(persons.get(node.getP_tagid())[0]); |
| | | double y2 = Double.valueOf(persons.get(node.getP_tagid())[1]); |
| | | double c = x1-x2; |
| | | double a = y1-y2; |
| | | |
| | | if (node.getBaoliu22() != null && node.getBaoliu22() != "") { |
| | | if (node.getBaoliu22().equals("0")) { |
| | | jiao = Math.toDegrees(Math.atan2(c, a)); |
| | | } else { |
| | | String[] xy = node.getBaoliu23().split(","); |
| | | jiao = Math.toDegrees(Math.atan2(Double.valueOf(xy[0]), Double.valueOf(xy[1]))); |
| | | } |
| | | |
| | | if (String.valueOf(jiao).equals("0.0")) { |
| | | jiao = Double.valueOf(persons.get(node.getP_tagid())[2]).doubleValue(); |
| | | } |
| | | } |
| | | } |
| | | String tagid = node.getP_tagid(); |
| | | tb_realpositoin position = new tb_realpositoin(); |
| | | position.setTagid(tagid); |
| | | position.setPower(node.getP_power()); |
| | | position.setLife(node.getP_online()); |
| | | position.setName(node.getP_name()); |
| | | position.setSex(node.getP_sex()); |
| | | position.setMinzu(node.getP_minzu()); |
| | | position.setPhone(node.getP_phone()); |
| | | position.setBumen(node.getP_department()); |
| | | position.setPosx(node.getP_x()); |
| | | position.setPosy(node.getP_y()); |
| | | position.setSos(node.getP_sos()); |
| | |
| | | position.setSousuo(node.getP_sousuo()); |
| | | position.setShipin(node.getP_shipin()); |
| | | position.setInkaoqing(node.getP_kaoqing()); |
| | | position.setFangkeid(node.getP_fangkeid()); |
| | | position.setJingdu(node.getP_jingdu()); |
| | | position.setWeidu(node.getP_weidu()); |
| | | position.setGaocheng(node.getP_gaocheng()); |
| | | position.setJiao(String.valueOf(jiao)); |
| | | position.setBaoliu22(node.getBaoliu22()); |
| | | position.setBaoliu23(node.getBaoliu23()); |
| | | position.setBaoliu24(node.getBaoliu24()); |
| | | |
| | | String[] bb = new String[]{node.getP_x(),node.getP_y(),String.valueOf(jiao)}; |
| | | persons.put(node.getP_tagid(), bb); |
| | | |
| | | finalPositionList.add(position); |
| | | } |
| | | return finalPositionList; |
| | | } |
| | | |
| | | @RequestMapping(value="/getRealPositionsan3.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | @ResponseBody |
| | | public List<tb_realpositoin> getRealPositionsan3(HttpServletRequest request) { |
| | | long timeStart = 0; |
| | | String floor = request.getParameter("floor"); |
| | | //根据时间筛选出数据 |
| | | List<tb_person> realLocationList = ZhwService.getpersonLocationsan3(floor); |
| | | |
| | | List<tb_realpositoin> finalPositionList = new ArrayList<tb_realpositoin>(); |
| | | |
| | | //根据每个tagid取tb_tag:[tag_id,state(静止1or运动0),power,status(在线1or离线0),addtime],放入tb_position中 |
| | | for (tb_person node : realLocationList) { |
| | | double jiao = 0.00; |
| | | if (persons.containsKey(node.getP_tagid())) { |
| | | double x1 = Double.valueOf(node.getP_x()); |
| | | double y1 = Double.valueOf(node.getP_y()); |
| | | double x2 = Double.valueOf(persons.get(node.getP_tagid())[0]); |
| | | double y2 = Double.valueOf(persons.get(node.getP_tagid())[1]); |
| | | double c = x1-x2; |
| | | double a = y1-y2; |
| | | |
| | | if (node.getBaoliu22().equals("0")) { |
| | | jiao = Math.toDegrees(Math.atan2(c, a)); |
| | | } else { |
| | | String[] xy = node.getBaoliu23().split(","); |
| | | jiao = Math.toDegrees(Math.atan2(Double.valueOf(xy[0]), Double.valueOf(xy[1]))); |
| | | } |
| | | |
| | | if (String.valueOf(jiao).equals("0.0")) { |
| | | jiao = Double.valueOf(persons.get(node.getP_tagid())[2]).doubleValue(); |
| | | } |
| | | } |
| | | String tagid = node.getP_tagid(); |
| | | tb_realpositoin position = new tb_realpositoin(); |
| | | position.setTagid(tagid); |
| | | position.setPower(node.getP_power()); |
| | | position.setLife(node.getP_online()); |
| | | position.setName(node.getP_name()); |
| | | position.setSex(node.getP_sex()); |
| | | position.setMinzu(node.getP_minzu()); |
| | | position.setPhone(node.getP_phone()); |
| | | position.setBumen(node.getP_department()); |
| | | position.setPosx(node.getP_x()); |
| | | position.setPosy(node.getP_y()); |
| | | position.setSos(node.getP_sos()); |
| | | position.setTime(node.getP_addtiem()); |
| | | position.setFence(node.getP_fence()); |
| | | position.setSousuo(node.getP_sousuo()); |
| | | position.setShipin(node.getP_shipin()); |
| | | position.setInkaoqing(node.getP_kaoqing()); |
| | | position.setJiao(String.valueOf(jiao)); |
| | | position.setBaoliu22(node.getBaoliu22()); |
| | | position.setBaoliu23(node.getBaoliu23()); |
| | | position.setBaoliu24(node.getBaoliu24()); |
| | | |
| | | String[] bb = new String[]{node.getP_x(),node.getP_y(),String.valueOf(jiao)}; |
| | | persons.put(node.getP_tagid(), bb); |
| | | |
| | | finalPositionList.add(position); |
| | | } |
| | | return finalPositionList; |
| | | } |
| | | |
| | | public double qiujiao(int a,int b,int c) { |
| | | double angle = 0.00; |
| | | if (a+b-c!=0) { |
| | | angle=Math.toDegrees(Math.acos((a*a+b*b-c*c)/(2*a*b)));//C的角度 |
| | | } |
| | | return angle; |
| | | } |
| | | |
| | | @RequestMapping(value="/getRealPositionsana.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | @ResponseBody |
| | | public JSONObject getRealPositionsana(HttpServletRequest request) { |
| | | long timeStart = 0; |
| | | |
| | | JSONObject json = new JSONObject(); |
| | | |
| | | //根据时间筛选出数据 |
| | | List<tb_person> realLocationList = ZhwService.getpersonLocationsan2(); |
| | | // for ( tb_person node : realLocationList) { |
| | | // Double x = Double.valueOf(node.getP_x()); |
| | | // Double y = Double.valueOf(node.getP_y()); |
| | | // Double xo = (x-54732)/100; |
| | | // Double yo = -(y+10268)/100; |
| | | // List<Double> xy = ZhwController.cal2(xo, yo); |
| | | // node.setP_x((xy.get(0)).toString()); |
| | | // node.setP_y((xy.get(1)).toString()); |
| | | // } |
| | | |
| | | List<tb_realpositoin> finalPositionList = new ArrayList<tb_realpositoin>(); |
| | | |
| | | //根据每个tagid取tb_tag:[tag_id,state(静止1or运动0),power,status(在线1or离线0),addtime],放入tb_position中 |
| | | for (tb_person node : realLocationList) { |
| | | // if (node.getP_online().equals("1")) { |
| | | String tagid = node.getP_tagid(); |
| | | tb_realpositoin position = new tb_realpositoin(); |
| | | position.setTagid(tagid); |
| | | position.setPower(node.getP_power()); |
| | | position.setLife(node.getP_online()); |
| | | position.setName(node.getP_name()); |
| | | position.setIdcardnum(node.getP_idcardnum()); |
| | | position.setPosx(node.getP_x()); |
| | | position.setPosy(node.getP_y()); |
| | | position.setFloor(node.getP_floor()); |
| | | position.setSos(node.getP_sos()); |
| | | position.setTime(node.getP_addtiem()); |
| | | position.setFence(node.getP_fence()); |
| | | position.setSousuo(node.getP_sousuo()); |
| | | position.setShipin(node.getP_shipin()); |
| | | position.setInkaoqing(node.getP_kaoqing()); |
| | | position.setFangkeid(node.getP_fangkeid()); |
| | | position.setJingdu(node.getP_jingdu()); |
| | | position.setWeidu(node.getP_weidu()); |
| | | position.setGaocheng(node.getP_gaocheng()); |
| | | position.setPhone(node.getP_phone()); |
| | | position.setType(node.getP_type()); |
| | | finalPositionList.add(position); |
| | | // } |
| | | } |
| | | json.put("dataList", finalPositionList); |
| | | return json; |
| | | } |
| | |
| | | @ResponseBody |
| | | public List<tb_realkaoqing> getkaoqinsan(HttpServletRequest request) { |
| | | List<tb_realkaoqing> realkaoqingList = ZhwService.getkaoqinsan(); |
| | | System.out.print("------------------------"); |
| | | System.out.print("------------------------"+realkaoqingList.get(0).getName()); |
| | | return realkaoqingList; |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | @RequestMapping("bofang.do") |
| | | public void shangchuan2() { |
| | | public void shangchuan2(HttpServletRequest request) { |
| | | String name = request.getParameter("name"); |
| | | List<tb_shipin> shipins = fenceService.searchshipinManagement(name); |
| | | String yonghuming = shipins.get(0).getYonghuming(); |
| | | String mima = shipins.get(0).getMima(); |
| | | String ipdizhi = shipins.get(0).getBaoliu1(); |
| | | int flag = -1; |
| | | // 输出ffmpeg推流日志 |
| | | String ffmpegPath = "F:\\ffmpeg\\ffmpeg-4.4-essentials_build\\bin\\"; |
| | | try { |
| | | String command = ffmpegPath; |
| | | command += "ffmpeg -rtsp_transport tcp"; // ffmpeg开头,-re代表按照帧率发送,在推流时必须有 |
| | | command += " -i \"rtsp://admin:hxzk20151102@192.168.3.64:554/Streaming/Channels/102\""; // 指定要推送的视频 |
| | | command += " -i \"rtsp://"+yonghuming+":"+mima+"@"+ipdizhi+":554/Streaming/Channels/102\""; // 指定要推送的视频 |
| | | command += " -q 0 -f mpegts -codec:v mpeg1video -s 1280x720 http://127.0.0.1:8081/123456"; // 指定推送服务器,-f:指定格式 1280 720 |
| | | System.out.println("ffmpeg推流命令:" + command); |
| | | process = Runtime.getRuntime().exec(command); |
| | |
| | | process.destroy(); |
| | | } |
| | | |
| | | @RequestMapping(value = "jingweijuli.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | public String tojisuan(HttpServletRequest request, HttpServletResponse response){ |
| | | String toPage = "forward:/hxzk/basicInfo/jisuan.jsp"; |
| | | List<tb_jingwei> findjingwei = ZhwService.getjingwei(); |
| | | request.setAttribute("dataList", findjingwei); |
| | | return toPage; |
| | | } |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "jisuanjingwei.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | public JSONObject jisuanjingwei (String str) { |
| | | JSONObject json = new JSONObject(); |
| | | String disab = disab(str); |
| | | String[] split = str.split(";"); |
| | | String qishi = split[1]+"/"+split[0]; |
| | | String zhongzhi = split[3]+"/"+split[2]; |
| | | tb_jingwei jingwei = new tb_jingwei(); |
| | | SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | String format = simpleDateFormat.format(new Date()); |
| | | jingwei.setQishi(qishi); |
| | | jingwei.setZhongzhi(zhongzhi); |
| | | jingwei.setJieguo(disab); |
| | | jingwei.setAddtime(format); |
| | | ZhwService.addjingwei(jingwei); |
| | | List<tb_jingwei> findjingwei = ZhwService.getjingwei(); |
| | | json.put("jieguo",disab); |
| | | json.put("dataList",findjingwei); |
| | | return json; |
| | | } |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "jisuanjingwei2.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | public JSONObject jisuanjingwei2 (String str) { |
| | | JSONObject json = new JSONObject(); |
| | | String[] split = str.split(";"); |
| | | double[] sy = gpstodu(split[1], split[0]); |
| | | String str2 = sy[1]+";"+sy[0]; |
| | | json.put("jieguo",str2); |
| | | return json; |
| | | } |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "jisuanjingwei3.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | public JSONObject jisuanjingwei3 (HttpServletRequest request) { |
| | | JSONObject json = new JSONObject(); |
| | | String qidian = request.getParameter("qidian"); |
| | | String zhongdian = request.getParameter("zhongdian"); |
| | | String[] qidians = qidian.split(","); |
| | | String[] zhongdians = zhongdian.split(","); |
| | | String str = qidians[2]+";"+qidians[4]+";"+zhongdians[2]+";"+zhongdians[4]; |
| | | String disab = disab(str); |
| | | String[] split = str.split(";"); |
| | | String qishi = split[1]+"/"+split[0]; |
| | | String zhongzhi = split[3]+"/"+split[2]; |
| | | tb_jingwei jingwei = new tb_jingwei(); |
| | | SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | String format = simpleDateFormat.format(new Date()); |
| | | jingwei.setQishi(qishi); |
| | | jingwei.setZhongzhi(zhongzhi); |
| | | jingwei.setJieguo(disab); |
| | | jingwei.setAddtime(format); |
| | | ZhwService.addjingwei(jingwei); |
| | | List<tb_jingwei> findjingwei = ZhwService.getjingwei(); |
| | | json.put("jieguo",disab); |
| | | json.put("dataList",findjingwei); |
| | | return json; |
| | | } |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "/startjob.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | public String startjob(HttpServletRequest request) { |
| | | List<tb_fence> fences = fenceService.getFenceLista(); |
| | | for (int i = 0;i<fences.size();i++) { |
| | | tb_jobhistory job = new tb_jobhistory(); |
| | | job.setFencename(fences.get(i).getName()); |
| | | job.setDepartment(fences.get(i).getBumen()); |
| | | job.setTagid(fences.get(i).getBaoliu2()); |
| | | job.setHigh(fences.get(i).getBaoliu1()); |
| | | job.setFenceaddtime(fences.get(i).getAddtime()); |
| | | job.setType("开始作业"); |
| | | job.setBeizhu(""); |
| | | fenceService.zuoyeadd(job); |
| | | } |
| | | String xieyi = "BSTOCS1,WORK,START,END"; |
| | | Udp_Out.udp_to_cs(xieyi); |
| | | return "1"; |
| | | } |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "/endjob.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | public String endjob(HttpServletRequest request) { |
| | | List<tb_fence> fences = fenceService.getFenceLista(); |
| | | for (int i = 0;i<fences.size();i++) { |
| | | tb_jobhistory job = new tb_jobhistory(); |
| | | job.setFencename(fences.get(i).getName()); |
| | | job.setDepartment(fences.get(i).getBumen()); |
| | | job.setTagid(fences.get(i).getBaoliu2()); |
| | | job.setHigh(fences.get(i).getBaoliu1()); |
| | | job.setFenceaddtime(fences.get(i).getAddtime()); |
| | | job.setType("结束作业"); |
| | | job.setBeizhu(""); |
| | | fenceService.zuoyeadd(job); |
| | | } |
| | | String xieyi = "BSTOCS1,WORK,STOP,END"; |
| | | Udp_Out.udp_to_cs(xieyi); |
| | | return "1"; |
| | | } |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "/suspendjob.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | public String suspendjob(HttpServletRequest request) { |
| | | List<tb_fence> fences = fenceService.getFenceLista(); |
| | | for (int i = 0;i<fences.size();i++) { |
| | | tb_jobhistory job = new tb_jobhistory(); |
| | | job.setFencename(fences.get(i).getName()); |
| | | job.setDepartment(fences.get(i).getBumen()); |
| | | job.setTagid(fences.get(i).getBaoliu2()); |
| | | job.setHigh(fences.get(i).getBaoliu1()); |
| | | job.setFenceaddtime(fences.get(i).getAddtime()); |
| | | job.setType("暂停作业"); |
| | | job.setBeizhu(""); |
| | | fenceService.zuoyeadd(job); |
| | | } |
| | | String xieyi = "BSTOCS1,WORK,PAUSE,END"; |
| | | Udp_Out.udp_to_cs(xieyi); |
| | | return "1"; |
| | | } |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "/getzuoye.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | public JSONObject getzuoye(HttpServletRequest request) { |
| | | JSONObject json = new JSONObject(); |
| | | List<tb_jobhistory> tb_jobhistorys = fenceService.getzuoye(); |
| | | json.put("dataList", tb_jobhistorys); |
| | | return json; |
| | | } |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "/jobexport.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | public String jobexport(HttpServletRequest request, HttpServletResponse response) { |
| | | List<tb_jobhistory> tb_jobhistorys = fenceService.getzuoye(); |
| | | String[] rowName = { "序号", "操作步骤", "围栏名称", "关联部门", "关联标签", "围栏高度", "围栏绘制时间", "记录时间", "备注" }; |
| | | List<Object[]> dataList = objectToArray_job(tb_jobhistorys); |
| | | ExcelUtils excel = new ExcelUtils("作业历史", rowName, dataList); |
| | | OutputStream out; |
| | | String fileName = ""; |
| | | try { |
| | | fileName = "Excel-" + String.valueOf(System.currentTimeMillis()).substring(4, 13) + ".xls"; |
| | | String filePath2 = request.getServletContext().getRealPath("/") + "hxzk/image/excels/"+fileName; |
| | | out = new FileOutputStream(filePath2); |
| | | excel.export(out); |
| | | out.flush(); |
| | | out.close(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return fileName; |
| | | } |
| | | |
| | | @RequestMapping(value = "/tiaozhuanfa.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | public String tiaozhuanfa(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { |
| | | String floor = request.getParameter("floor"); |
| | | String toPage = "forward:/hxzk/mapshow/mapShowfa.jsp"; |
| | | request.setAttribute("floor", floor); |
| | | return toPage; |
| | | } |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "/getmessagea.do", method = { RequestMethod.POST, RequestMethod.GET}) |
| | | public String getmessagea(HttpServletRequest request) { |
| | | JSONObject json = new JSONObject(); |
| | | List<tb_message> messages = ZhwService.getmessage(); |
| | | Date date = new Date(); |
| | | SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | Calendar cal = Calendar.getInstance(); |
| | | cal.setTime(date); |
| | | cal.add(Calendar.DATE, -3); |
| | | String date2 = simpleDateFormat.format(cal.getTime()); |
| | | ZhwService.deletemessage(date2); |
| | | json.put("dataList", messages); |
| | | return json.toString(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/sendmessage.do", method = {RequestMethod.POST, RequestMethod.GET}) |
| | | public void sendmessage(HttpServletRequest request) { |
| | | HttpSession session = request.getSession(); |
| | | ServletContext application = session.getServletContext(); |
| | | String username = application.getAttribute("username").toString(); |
| | | String arr = request.getParameter("arr"); |
| | | String message = request.getParameter("message"); |
| | | if (arr.equals("all")) { |
| | | List<tb_person> persons = ZhwService.getbumen(); |
| | | for (int i=0; i<persons.size(); i++) { |
| | | String xieyi = "BSTOCS1,TOMESSAGE,"+persons.get(i).getP_tagid()+","+message+","+username+",END"; |
| | | Udp_Out.udp_to_cs(xieyi); |
| | | } |
| | | } else { |
| | | String[] tagids = arr.split(","); |
| | | for (int i=0; i<tagids.length; i++) { |
| | | String xieyi = "BSTOCS1,TOMESSAGE,"+tagids[i]+","+message+","+username+",END"; |
| | | Udp_Out.udp_to_cs(xieyi); |
| | | } |
| | | } |
| | | } |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value="getlixiana.do",method= {RequestMethod.POST,RequestMethod.GET}) |
| | | public String getlixiana() { |
| | | String pan = ZhwService.getlixian(); |
| | | SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | String date = sf.format(new Date()); |
| | | int aaa = get_time_cha_s(date,pan); |
| | | String bbb = ""; |
| | | if (aaa < 20) { |
| | | bbb = "true"; |
| | | } else { |
| | | bbb = "false"; |
| | | } |
| | | return bbb; |
| | | } |
| | | |
| | | @RequestMapping(value = "updateexe.do",method= {RequestMethod.POST,RequestMethod.GET}) |
| | | public void tiaoguo(HttpServletResponse response, HttpServletRequest request) { |
| | | String url = "file:///D:\\eclipseworkspace\\定位引擎软件\\定位引擎软件.rar"; |
| | | try { |
| | | response.setHeader("Content-Disposition", "attachment;filename=\"" + URLEncoder.encode("定位平台软件.rar","UTF-8") + "\""); |
| | | response.setContentType("APPLICATION/OCTET-STREAM"); |
| | | BufferedInputStream in = new BufferedInputStream(new URL(url).openStream()); |
| | | BufferedOutputStream out = new BufferedOutputStream(response.getOutputStream()); |
| | | byte dataBuffer[] = new byte[1024]; |
| | | int bytesRead; |
| | | while ((bytesRead = in.read(dataBuffer, 0, 1024)) != -1) { |
| | | out.write(dataBuffer, 0, bytesRead); |
| | | } |
| | | out.flush(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | @RequestMapping(value = "todownload.do", method = {RequestMethod.POST,RequestMethod.GET}) |
| | | public String todownload(HttpServletRequest request) { |
| | | String toPage = "forward:/hxzk/gujian/download.html"; |
| | | return toPage; |
| | | } |
| | | |
| | | @RequestMapping(value = "download.do", method = {RequestMethod.POST,RequestMethod.GET}) |
| | | public String download(HttpServletRequest request,HttpServletResponse response) { |
| | | String toPage = "forward:/hxzk/gujian/download.html"; |
| | | String filename = request.getParameter("name"); |
| | | String filepath = "D:\\gujian\\"; |
| | | File file = new File(filepath+filename); |
| | | try { |
| | | response.setHeader("Content-Disposition", "attachment;filename=\"" + URLEncoder.encode(filename,"UTF-8") + "\""); |
| | | response.setContentType("APPLICATION/OCTET-STREAM"); |
| | | FileInputStream ina = new FileInputStream(file); |
| | | BufferedInputStream in = new BufferedInputStream(ina); |
| | | BufferedOutputStream out = new BufferedOutputStream(response.getOutputStream()); |
| | | int len = 0; |
| | | while ((len = in.read()) != -1) { |
| | | out.write(len); |
| | | } |
| | | out.flush(); |
| | | out.close(); |
| | | in.close(); |
| | | } catch (Exception e) { |
| | | // TODO 自动生成的 catch 块 |
| | | e.printStackTrace(); |
| | | } |
| | | return toPage; |
| | | } |
| | | |
| | | @RequestMapping(value = "/mapdisplay.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | public String mapdisplay(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { |
| | | String toPage = "forward:/hxzk/mapdisplay/mapdisplay.jsp"; |
| | | return toPage; |
| | | } |
| | | |
| | | @RequestMapping(value = "/tomap.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | public String tomap(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { |
| | | String toPage = "forward:/hxzk/mapshow/mapShowfeng3.jsp"; |
| | | return toPage; |
| | | } |
| | | |
| | | public static int get_time_cha_s(String a,String b) { |
| | | final String yyyyMMddHHmmss = "yyyy-MM-dd HH:mm:ss"; |
| | | Date date1=parseDateByPattern(a, yyyyMMddHHmmss); |
| | | Date date2=parseDateByPattern(b, yyyyMMddHHmmss); |
| | | return getTimeDelta(date1, date2); |
| | | } |
| | | |
| | | public static Date parseDateByPattern(String dateStr,String dateFormat){ |
| | | SimpleDateFormat sdf = new SimpleDateFormat(dateFormat); |
| | | try { |
| | | return sdf.parse(dateStr); |
| | | } catch (ParseException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | | public static int getTimeDelta(Date date1,Date date2){ |
| | | long timeDelta=(date1.getTime()-date2.getTime())/1000;//单位是秒 |
| | | int secondsDelta=timeDelta>0?(int)timeDelta:(int)Math.abs(timeDelta); |
| | | return secondsDelta; |
| | | } |
| | | |
| | | /**计算2个时分秒的差*/ |
| | | public static int get_time_cha_HMS(String a,String b) { |
| | | final String HHmmss = "HH:mm:ss"; |
| | | Date date1=parseDateByPattern(a, HHmmss); |
| | | Date date2=parseDateByPattern(b, HHmmss); |
| | | return getTimeDelta(date1, date2); |
| | | } |
| | | |
| | | |
| | | /**计算时间差返回boolean*/ |
| | | public static boolean shijiancha(String time,int p) { |
| | | boolean a=false; |
| | | int b= get_time_cha_s(GetNowTime.now(),time); |
| | | //当前时间和之前时间差大于某个数值p |
| | | if(b>p) { |
| | | a=true; |
| | | } |
| | | return a; |
| | | } |
| | | |
| | | // 作业信息 导出表格 对象转数组 |
| | | public static List<Object[]> objectToArray_job(List<tb_jobhistory> history_powerList) { |
| | | List<Object[]> reList = new ArrayList<>(); |
| | | for (int i = 0; i < history_powerList.size(); i++) { |
| | | List<String> words = new ArrayList<String>(); |
| | | tb_jobhistory history_power = (tb_jobhistory) history_powerList.get(i); |
| | | words.add(history_power.getId() + ""); |
| | | words.add(history_power.getType()); |
| | | words.add(history_power.getFencename()); |
| | | words.add(history_power.getDepartment()); |
| | | words.add(history_power.getTagid()); |
| | | words.add(history_power.getHigh()); |
| | | words.add(history_power.getFenceaddtime()); |
| | | words.add(history_power.getAddtime()); |
| | | words.add(history_power.getBeizhu()); |
| | | String[] array = words.toArray(new String[0]); |
| | | reList.add(array); |
| | | } |
| | | return reList; |
| | | } |
| | | |
| | | public static List<Object[]> objectToArray_qihouManagement2(List<tb_qihou> tb_qihouList) { |
| | | List<Object[]> reList = new ArrayList<>(); |
| | | for (int i = 0; i < tb_qihouList.size(); i++) { |
| | |
| | | return true; |
| | | } |
| | | } |
| | | |
| | | public static String todu(String strs) { |
| | | int i = strs.indexOf('.'); |
| | | String strDu = 1 < 0 ? strs : strs.substring(0, i); |
| | | String strFen = ""; |
| | | String strMiao = ""; |
| | | if (i > 0) { |
| | | Float fen = Float.parseFloat(strs.substring(i)); |
| | | strFen = Float.toString(fen * 60); |
| | | i = strFen.indexOf('.'); |
| | | if (i > 0) { |
| | | Float miao = Float.parseFloat(strFen.substring(i)); |
| | | strFen = strFen.substring(0, i); |
| | | strMiao = Float.toString(miao * 60); |
| | | i = strMiao.indexOf('.'); |
| | | strMiao = strMiao.substring(0, i + 4); |
| | | strMiao = String.format("%.2f", Float.parseFloat(strMiao)); |
| | | } |
| | | } |
| | | String Du = strDu + strFen + strMiao; |
| | | return Du; |
| | | } |
| | | static double a=6378.137; |
| | | static double e=0.0818192; |
| | | static double k0=0.9996; |
| | | static double e2=e*e; |
| | | static double e4=e2*e2; |
| | | static double e6=e4*e2; |
| | | static double E0=500; |
| | | static double N0=0; |
| | | static String floor="0"; |
| | | static double lat_a =0; |
| | | static double lon_a =0; |
| | | static double lon_b=0; |
| | | static double lat_b=0; |
| | | static double xa=0; |
| | | static double ya=0; |
| | | static double xb=0; |
| | | static double yb=0; |
| | | static int k=0; |
| | | static int sizes=2; |
| | | static double[] xycs=null; |
| | | static double utme0; |
| | | static double utmn0; |
| | | static double c; |
| | | static double s; |
| | | static double t; |
| | | static double f; |
| | | |
| | | |
| | | /**计算2个经纬度的距离*/ |
| | | public static String disab(String jwd) { |
| | | DecimalFormat df = new DecimalFormat("0.00"); |
| | | String[] bb=jwd.split(";"); |
| | | double jd0=Double.parseDouble(bb[1]); |
| | | double wd0=Double.parseDouble(bb[0]); |
| | | double jd1=Double.parseDouble(bb[3]); |
| | | double wd1=Double.parseDouble(bb[2]); |
| | | double[] a=run_gps2xyurt(wd0,jd0,wd1,jd1); |
| | | double disa=a[0]*a[0]+a[1]*a[1]; |
| | | double dis=Math.sqrt(Math.abs(disa))*100; |
| | | String temp = df.format(dis); |
| | | System.out.println(jwd+"的距离是:"+temp); |
| | | return temp; |
| | | |
| | | } |
| | | |
| | | |
| | | public static double[] run_gps2xyurt( |
| | | double lat0, |
| | | double lon0, |
| | | double lat, |
| | | double lon) { |
| | | int[] realxy=new int[2]; |
| | | double[] xycs=initiize_ublox_zeropoint(lat0, lon0,0); |
| | | double x0=xycs[0]; |
| | | double y0=xycs[1]; |
| | | double c=xycs[2]; |
| | | double s=xycs[3]; |
| | | |
| | | double[] xy=new double[2]; |
| | | double x= ubloxraw2xy(lat,lon)[0]-x0; |
| | | double y=ubloxraw2xy(lat,lon)[1]-y0; |
| | | xy[0] =c*x - s*y; |
| | | xy[1] =s*x + c*y; |
| | | |
| | | // double x1=xy[1]*100; |
| | | // double y1=xy[0]*100; |
| | | // |
| | | // realxy[0]=(int)x1; |
| | | // realxy[1]=(int)y1; |
| | | return xy; |
| | | } |
| | | |
| | | |
| | | public static double[] initiize_ublox_zeropoint(double lat, double lon, double th){ |
| | | double[] xycs=new double[4]; |
| | | xycs[0]=ubloxraw2xy(lat,lon)[0]; |
| | | xycs[1]=ubloxraw2xy(lat,lon)[1]; |
| | | double th1=th*Math.PI/180;//x轴与正北方向夹角th(单位是度) |
| | | xycs[2]=Math.cos(th1); |
| | | xycs[3]=Math.sin(th1); |
| | | return xycs; |
| | | } |
| | | |
| | | |
| | | public static double[] ubloxraw2xy(double lat, double lon) { |
| | | double[] xy=new double[3]; |
| | | double lond = ublox_dm2d(lon); |
| | | double latd = ublox_dm2d(lat); |
| | | double[] dxy = utm(latd, lond); |
| | | xy[0]= dxy[0]* 1000; |
| | | xy[1]= dxy[1]* 1000; |
| | | xy[2]= dxy[2]; |
| | | return xy; |
| | | |
| | | } |
| | | |
| | | |
| | | public static double ublox_dm2d(double ddmm_dot_m) { |
| | | double d0=Math.floor(ddmm_dot_m/100); |
| | | double d=d0+(ddmm_dot_m-d0*100)/60; |
| | | return d; |
| | | } |
| | | |
| | | |
| | | public static double[] utm(double lat,double lon) { |
| | | double[] dxy=new double[3]; |
| | | |
| | | double zonenum1=lon/6; |
| | | //floor是地板的意思,表示向下取整 |
| | | if(zonenum1>0) { |
| | | zonenum1=Math.floor(zonenum1); |
| | | }else {//向上取整 |
| | | zonenum1=Math.ceil(zonenum1);//向上取整 |
| | | } |
| | | |
| | | double Zonenum=zonenum1+31; |
| | | |
| | | double lambda0=((Zonenum-1)*6-180+3)*(Math.PI)/180; |
| | | |
| | | double phi=lat*(Math.PI)/180; |
| | | |
| | | double lambda=lon*(Math.PI)/180; |
| | | |
| | | double v=1/Math.sqrt((1-e2*Math.pow(Math.sin(phi),2))); |
| | | |
| | | double A=(lambda-lambda0)* Math.cos(phi); |
| | | double A2=A*A; |
| | | double A3=A2*A; |
| | | double A4=A3*A; |
| | | double A5=A4*A; |
| | | double A6=A5*A; |
| | | |
| | | double T=Math.tan(phi)* Math.tan(phi); |
| | | double T2=T*T; |
| | | |
| | | double C=e2* Math.cos(phi)* Math.cos(phi)/(1-e2); |
| | | double C2=C*C; |
| | | |
| | | double s=(1-e2/4-3*e4/64-5*e6/256)* phi- |
| | | (3*e2/8+3*e4/32+45*e6/1024)* Math.sin(2*phi)+ |
| | | (15*e4/256+45*e6/1024)* Math.sin(4* phi)-35*e6/3072* Math.sin(6*phi); |
| | | |
| | | dxy[0]=E0+k0*a*v*(A+(1-T+C)*A3/6+(5-18*T+T2)*A5/120); |
| | | |
| | | dxy[1]=N0+k0*a*(s+v* Math.tan(phi)*(A2/2+(5-T+9*C+4*C2)*A4/24+(61-58*T+T2)*A6/720)); |
| | | dxy[2]=Zonenum; |
| | | return dxy; |
| | | } |
| | | |
| | | //度分转度 |
| | | public static String todufen(String Du, String Fen, String Miao) { |
| | | Float strDu = Float.valueOf(Du); |
| | | Float strFen = Float.valueOf(Fen) / 60; |
| | | Float strMiao = Float.valueOf(Miao) / 60; |
| | | Float dufenmiao = strDu + strFen + strMiao; |
| | | String format = String.format("%.6f", dufenmiao); |
| | | return format; |
| | | } |
| | | |
| | | public static double[] gpstodu(String gps_weidu, String gps_jingdu) { |
| | | double[] a = {0, 0}; |
| | | String weidu = todufen(gps_weidu.substring(0, 2), gps_weidu.substring(2, 4), gps_weidu.substring(4)); |
| | | String jingdu = todufen(gps_jingdu.substring(0, 3), gps_jingdu.substring(3, 5), gps_jingdu.substring(5)); |
| | | a[0] = Double.parseDouble(weidu); |
| | | a[1] = Double.parseDouble(jingdu); |
| | | return a; |
| | | } |
| | | } |