| | |
| | | // |
| | | // Source code recreated from a .class file by IntelliJ IDEA |
| | | // (powered by FernFlower decompiler) |
| | | // |
| | | |
| | | package com.hxzkoa.controller; |
| | | |
| | | |
| | | import com.hxzkoa.json.*; |
| | | import com.hxzkoa.services.MapService; |
| | | import com.hxzkoa.services.SysSettingService; |
| | | import com.hxzkoa.services.ZhwService; |
| | | import com.hxzkoa.udp.Panduan; |
| | | import com.hxzkoa.udp.Udp_Out; |
| | | import com.hxzkoa.util.Config; |
| | | import com.hxzkoa.util.DatabaseUtil; |
| | | import com.hxzkoa.util.ExcelUtils; |
| | | import com.hxzkoa.util.HttpUtil; |
| | | import com.hxzkoa.util.ModifyConfig; |
| | | import com.hxzkoa.util.PageUtil; |
| | | import com.hxzkoa.util.RequestUtils; |
| | | import java.io.BufferedOutputStream; |
| | | import java.io.File; |
| | | import java.io.FileNotFoundException; |
| | |
| | | import java.net.SocketException; |
| | | import java.net.UnknownHostException; |
| | | import java.util.ArrayList; |
| | | import java.util.Collections; |
| | | import java.util.Comparator; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | import net.sf.json.JSONObject; |
| | | import org.apache.commons.httpclient.util.DateUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Controller; |
| | |
| | | import org.springframework.web.bind.annotation.RequestMethod; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | |
| | | import com.hxzkoa.json.tb_achor; |
| | | import com.hxzkoa.json.tb_bsbaowen; |
| | | import com.hxzkoa.json.tb_forward_data; |
| | | import com.hxzkoa.json.tb_map; |
| | | import com.hxzkoa.json.tb_nav; |
| | | import com.hxzkoa.json.tb_suanfa; |
| | | import com.hxzkoa.json.tb_system; |
| | | import com.hxzkoa.json.tb_tag; |
| | | import com.hxzkoa.json.tb_user; |
| | | import com.hxzkoa.json.tb_yuan_shi_bao_wen; |
| | | import com.hxzkoa.services.MapService; |
| | | import com.hxzkoa.services.SysSettingService; |
| | | import com.hxzkoa.services.ZhwService; |
| | | import com.hxzkoa.udp.Panduan; |
| | | import com.hxzkoa.udp.Udp_Out; |
| | | /*import com.hxzkoa.udp.Udp_Receive;*/ |
| | | import com.hxzkoa.util.Config; |
| | | import com.hxzkoa.util.DatabaseUtil; |
| | | import com.hxzkoa.util.ExcelUtils; |
| | | import com.hxzkoa.util.HttpUtil; |
| | | import com.hxzkoa.util.ModifyConfig; |
| | | import com.hxzkoa.util.PageUtil; |
| | | import com.hxzkoa.util.RequestUtils; |
| | | |
| | | import net.sf.json.JSONObject; |
| | | |
| | | @Controller |
| | | public class SysSettingController { |
| | | |
| | | @Autowired |
| | | private SysSettingService sysSettingService; |
| | | @Autowired |
| | | private MapService mapService; |
| | | @Autowired |
| | | private ZhwService zhwService; |
| | | |
| | | |
| | | public SysSettingController() { |
| | | } |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "/to_cs_start_.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | @RequestMapping( |
| | | value = {"/to_cs_start_.do"}, |
| | | method = {RequestMethod.POST, RequestMethod.GET} |
| | | ) |
| | | public void kaishi(HttpServletRequest request) { |
| | | String leixing = request.getParameter("leixing"); |
| | | String tagid = request.getParameter("tagid"); |
| | | String xieyi = "BSTOCS1,START,"+leixing+","+tagid+",END"; |
| | | String xieyi = "BSTOCS1,START," + leixing + "," + tagid + ",END"; |
| | | Udp_Out.udp_to_cs(xieyi); |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "/baowenrefresh.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | @RequestMapping( |
| | | value = {"/baowenrefresh.do"}, |
| | | method = {RequestMethod.POST, RequestMethod.GET} |
| | | ) |
| | | public List<tb_bsbaowen> shuaxin(HttpServletRequest request) { |
| | | List<tb_bsbaowen> baowen = sysSettingService.bsbaowen(); |
| | | // 升序排序 |
| | | // Collections.sort(baowen, new Comparator<tb_bsbaowen>() { |
| | | // @Override |
| | | // public int compare(tb_bsbaowen h1, tb_bsbaowen h2) { |
| | | // return h1.getReceive_time().compareTo(h2.getReceive_time()); |
| | | // } |
| | | // }); |
| | | // Collections.reverse(baowen); |
| | | List<tb_bsbaowen> baowen = this.sysSettingService.bsbaowen(); |
| | | return baowen; |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "/to_cs_stop.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | @RequestMapping( |
| | | value = {"/to_cs_stop.do"}, |
| | | method = {RequestMethod.POST, RequestMethod.GET} |
| | | ) |
| | | public void zanting(HttpServletRequest request) { |
| | | String xieyi = "BSTOCS1,STOP,END"; |
| | | Udp_Out.udp_to_cs(xieyi); |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "/to_cs_clean.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | @RequestMapping( |
| | | value = {"/to_cs_clean.do"}, |
| | | method = {RequestMethod.POST, RequestMethod.GET} |
| | | ) |
| | | public void qingkong(HttpServletRequest request) { |
| | | String xieyi = "BSTOCS1,CLEAR,END"; |
| | | Udp_Out.udp_to_cs(xieyi); |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "/to_cs_close.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | @RequestMapping( |
| | | value = {"/to_cs_close.do"}, |
| | | method = {RequestMethod.POST, RequestMethod.GET} |
| | | ) |
| | | public void jieshu(HttpServletRequest request) { |
| | | String xieyi = "BSTOCS1,CLOSE,END"; |
| | | Udp_Out.udp_to_cs(xieyi); |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "/panduan.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | @RequestMapping( |
| | | value = {"/panduan.do"}, |
| | | method = {RequestMethod.POST, RequestMethod.GET} |
| | | ) |
| | | public boolean panduan(HttpServletRequest request) { |
| | | String tagid = request.getParameter("tagid"); |
| | | String rees = request.getParameter("rees"); |
| | | boolean abb = Panduan.panduan(tagid, rees); |
| | | // if (rees.startsWith("display")) { |
| | | // String tagid1 = Dell_display.gettagid(rees); |
| | | // abb = tagid1.equals(tagid); |
| | | // } else if (rees.startsWith("$GNGGA")) { |
| | | // String tagid2 = Dell_GNGGA.gettagid(rees); |
| | | // abb = tagid2.equals(tagid); |
| | | // } |
| | | return abb; |
| | | } |
| | | |
| | | @RequestMapping(value = "/message.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | @RequestMapping( |
| | | value = {"/message.do"}, |
| | | method = {RequestMethod.POST, RequestMethod.GET} |
| | | ) |
| | | public String message(HttpServletRequest request) { |
| | | String toPage = "forward:/hxzk/sysSetting/message.jsp"; |
| | | List<tb_tag> labelList = sysSettingService.getLabel(); |
| | | List<tb_tag> labelList = this.sysSettingService.getLabel(); |
| | | request.setAttribute("labelList", labelList); |
| | | return toPage; |
| | | } |
| | | |
| | | @RequestMapping(value = "/messageTransfer.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | @RequestMapping( |
| | | value = {"/messageTransfer.do"}, |
| | | method = {RequestMethod.POST, RequestMethod.GET} |
| | | ) |
| | | public String messageTransfer(HttpServletRequest request) { |
| | | String toPage = "forward:/hxzk/sysSetting/messageTransfer.jsp"; |
| | | List<tb_forward_data> messageTransferList = sysSettingService.getmessageTransfer(1); |
| | | List<tb_forward_data> messageTransferList = this.sysSettingService.getmessageTransfer(1); |
| | | request.setAttribute("messageTransferList", messageTransferList); |
| | | int curPage = 1; |
| | | int count = sysSettingService.getmessageTransferCount(); |
| | | int count = this.sysSettingService.getmessageTransferCount(); |
| | | 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 = "/messageTransfer_search.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | @RequestMapping( |
| | | value = {"/messageTransfer_search.do"}, |
| | | method = {RequestMethod.POST, RequestMethod.GET} |
| | | ) |
| | | public String messageTransfer_search(HttpServletRequest request) { |
| | | String input = request.getParameter("input"); |
| | | int curPage = 1; |
| | | List<Integer> pageList = new ArrayList<Integer>(); |
| | | List<tb_forward_data> messageTransferList = sysSettingService.searchmessageTransfer(input); |
| | | List<Integer> pageList = new ArrayList(); |
| | | List<tb_forward_data> messageTransferList = this.sysSettingService.searchmessageTransfer(input); |
| | | pageList.add(1); |
| | | JSONObject json = new JSONObject(); |
| | | json.put("dataList", messageTransferList); |
| | | json.put("pageList", pageList); |
| | | json.put("curPage", curPage); |
| | | json.put("curPage", Integer.valueOf(curPage)); |
| | | return json.toString(); |
| | | } |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "/messageTransfer_page.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | @RequestMapping( |
| | | value = {"/messageTransfer_page.do"}, |
| | | method = {RequestMethod.POST, RequestMethod.GET} |
| | | ) |
| | | public String labelManagement_page(HttpServletRequest request) { |
| | | String pageStr = request.getParameter("page"); |
| | | String curPageStr = request.getParameter("curPage"); |
| | | int count = sysSettingService.getmessageTransferCount(); |
| | | int count = this.sysSettingService.getmessageTransferCount(); |
| | | int minPage = PageUtil.getMinPage(count); |
| | | int curPage = Integer.parseInt(curPageStr); |
| | | int page = 1; |
| | |
| | | } else { |
| | | page = Integer.parseInt(pageStr); |
| | | } |
| | | List<tb_forward_data> messageTransferList = sysSettingService.getmessageTransfer(page); |
| | | |
| | | List<tb_forward_data> messageTransferList = this.sysSettingService.getmessageTransfer(page); |
| | | List<Integer> pageList = PageUtil.getPage(PageUtil.getLocPage(page, curPage), page, minPage); |
| | | JSONObject json = new JSONObject(); |
| | | json.put("dataList", messageTransferList); |
| | |
| | | } |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "/messageTransfer_delete.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | @RequestMapping( |
| | | value = {"/messageTransfer_delete.do"}, |
| | | method = {RequestMethod.POST, RequestMethod.GET} |
| | | ) |
| | | public void labelManagement_delete(HttpServletRequest request) { |
| | | String checkValStr = request.getParameter("checkVal"); |
| | | checkValStr = checkValStr.replaceAll("\"", ""); |
| | | String[] checkVal = checkValStr.split(","); |
| | | sysSettingService.messageTransfer_delete(checkVal); |
| | | for (int i = 0; i<checkVal.length; i++) { |
| | | String xieyi = "BSTOCS1,DELETEFORWARD,"+checkVal[i]+",END"; |
| | | this.sysSettingService.messageTransfer_delete(checkVal); |
| | | |
| | | for(int i = 0; i < checkVal.length; ++i) { |
| | | String xieyi = "BSTOCS1,DELETEFORWARD," + checkVal[i] + ",END"; |
| | | Udp_Out.udp_to_cs(xieyi); |
| | | } |
| | | |
| | | } |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "/messageTransfer_deleteAll.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | @RequestMapping( |
| | | value = {"/messageTransfer_deleteAll.do"}, |
| | | method = {RequestMethod.POST, RequestMethod.GET} |
| | | ) |
| | | public void labelManagement_deleteAll(HttpServletRequest request) { |
| | | sysSettingService.messageTransfer_deleteAll(); |
| | | this.sysSettingService.messageTransfer_deleteAll(); |
| | | String xieyi = "BSTOCS1,DELETEALLFORWARD,END"; |
| | | Udp_Out.udp_to_cs(xieyi); |
| | | } |
| | | |
| | | @RequestMapping(value = "/messageTransfer_add.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | @RequestMapping( |
| | | value = {"/messageTransfer_add.do"}, |
| | | method = {RequestMethod.POST, RequestMethod.GET} |
| | | ) |
| | | public void messageTransfer_add(HttpServletRequest request) { |
| | | tb_forward_data data = new tb_forward_data(); |
| | | data.setType(request.getParameter("protocalType")); |
| | | data.setIp(request.getParameter("mesIp")); |
| | | data.setPort(request.getParameter("mesPort")); |
| | | data.setDatatype(request.getParameter("mesCon")); |
| | | sysSettingService.messageTransfer_add(data); |
| | | String xieyi = "BSTOCS1,ADDFORWARD,"+data.getType()+","+data.getIp()+","+data.getPort()+","+data.getDatatype()+",END"; |
| | | this.sysSettingService.messageTransfer_add(data); |
| | | String xieyi = "BSTOCS1,ADDFORWARD," + data.getType() + "," + data.getIp() + "," + data.getPort() + "," + data.getDatatype() + ",END"; |
| | | Udp_Out.udp_to_cs(xieyi); |
| | | } |
| | | |
| | | @RequestMapping(value = "/userManagement_check.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | @RequestMapping( |
| | | value = {"/userManagement_check.do"}, |
| | | method = {RequestMethod.POST, RequestMethod.GET} |
| | | ) |
| | | @ResponseBody |
| | | public String iconManagement_check(HttpServletRequest request) { |
| | | String name = (request.getParameter("name")); |
| | | int exist = sysSettingService.userManagement_check(name); |
| | | String name = request.getParameter("name"); |
| | | int exist = this.sysSettingService.userManagement_check(name); |
| | | return String.valueOf(exist); |
| | | } |
| | | |
| | | @RequestMapping(value = "/messageTransfer_modify.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | @RequestMapping( |
| | | value = {"/messageTransfer_modify.do"}, |
| | | method = {RequestMethod.POST, RequestMethod.GET} |
| | | ) |
| | | public void messageTransfer_modify(HttpServletRequest request) { |
| | | tb_forward_data data = new tb_forward_data(); |
| | | data.setId(Integer.parseInt(request.getParameter("id"))); |
| | |
| | | data.setIp(request.getParameter("mesIp")); |
| | | data.setPort(request.getParameter("mesPort")); |
| | | data.setDatatype(request.getParameter("mesCon")); |
| | | sysSettingService.messageTransfer_modify(data); |
| | | String xieyi = "BSTOCS1,ALTERFORWARD,"+data.getId()+","+data.getType()+","+data.getIp()+","+data.getPort()+","+data.getDatatype()+",END"; |
| | | this.sysSettingService.messageTransfer_modify(data); |
| | | String xieyi = "BSTOCS1,ALTERFORWARD," + data.getId() + "," + data.getType() + "," + data.getIp() + "," + data.getPort() + "," + data.getDatatype() + ",END"; |
| | | Udp_Out.udp_to_cs(xieyi); |
| | | } |
| | | |
| | | @RequestMapping(value = "/userManagement.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | @RequestMapping( |
| | | value = {"/userManagement.do"}, |
| | | method = {RequestMethod.POST, RequestMethod.GET} |
| | | ) |
| | | public String userManagement(HttpServletRequest request) { |
| | | String toPage = "forward:/hxzk/sysSetting/userManagement.jsp"; |
| | | List<tb_user> userManagementList = sysSettingService.getuserManagement(1); |
| | | List<tb_user> userManagementList = this.sysSettingService.getuserManagement(1); |
| | | request.setAttribute("userManagementList", userManagementList); |
| | | int curPage = 1; |
| | | int count = sysSettingService.getuserManagementCount(); |
| | | int count = this.sysSettingService.getuserManagementCount(); |
| | | 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 = "/userManagementa.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | @RequestMapping( |
| | | value = {"/userManagementa.do"}, |
| | | method = {RequestMethod.POST, RequestMethod.GET} |
| | | ) |
| | | public JSONObject userManagementa(HttpServletRequest request) { |
| | | List<tb_user> userManagementList = sysSettingService.getuserManagement2(); |
| | | List<tb_user> userManagementList = this.sysSettingService.getuserManagement2(); |
| | | JSONObject json = new JSONObject(); |
| | | json.put("dataList", userManagementList); |
| | | return json; |
| | | } |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "/userManagement_search.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | @RequestMapping( |
| | | value = {"/userManagement_search.do"}, |
| | | method = {RequestMethod.POST, RequestMethod.GET} |
| | | ) |
| | | public String userManagement_search(HttpServletRequest request) { |
| | | String input = request.getParameter("input"); |
| | | int curPage = 1; |
| | | List<Integer> pageList = new ArrayList<Integer>(); |
| | | List<tb_user> userManagementList = sysSettingService.searchuserManagement(input); |
| | | List<Integer> pageList = new ArrayList(); |
| | | List<tb_user> userManagementList = this.sysSettingService.searchuserManagement(input); |
| | | pageList.add(1); |
| | | JSONObject json = new JSONObject(); |
| | | json.put("dataList", userManagementList); |
| | | json.put("pageList", pageList); |
| | | json.put("curPage", curPage); |
| | | json.put("curPage", Integer.valueOf(curPage)); |
| | | return json.toString(); |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "/userManagement_searcha.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | @RequestMapping( |
| | | value = {"/userManagement_searcha.do"}, |
| | | method = {RequestMethod.POST, RequestMethod.GET} |
| | | ) |
| | | public JSONObject userManagement_searcha(HttpServletRequest request) { |
| | | String input = request.getParameter("username"); |
| | | List<tb_user> userManagementList = sysSettingService.searchuserManagement(input); |
| | | List<tb_user> userManagementList = this.sysSettingService.searchuserManagement(input); |
| | | JSONObject json = new JSONObject(); |
| | | json.put("dataList", userManagementList); |
| | | return json; |
| | | } |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "/userManagement_page.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | @RequestMapping( |
| | | value = {"/userManagement_page.do"}, |
| | | method = {RequestMethod.POST, RequestMethod.GET} |
| | | ) |
| | | public String userManagement_page(HttpServletRequest request) { |
| | | String pageStr = request.getParameter("page"); |
| | | String curPageStr = request.getParameter("curPage"); |
| | | int count = sysSettingService.getuserManagementCount(); |
| | | int count = this.sysSettingService.getuserManagementCount(); |
| | | int minPage = PageUtil.getMinPage(count); |
| | | int curPage = Integer.parseInt(curPageStr); |
| | | int page = 1; |
| | |
| | | } else { |
| | | page = Integer.parseInt(pageStr); |
| | | } |
| | | List<tb_user> userManagementList = sysSettingService.getuserManagement(page); |
| | | |
| | | List<tb_user> userManagementList = this.sysSettingService.getuserManagement(page); |
| | | List<Integer> pageList = PageUtil.getPage(PageUtil.getLocPage(page, curPage), page, minPage); |
| | | JSONObject json = new JSONObject(); |
| | | json.put("dataList", userManagementList); |
| | |
| | | json.put("curPage", page); |
| | | return json.toString(); |
| | | } |
| | | |
| | | // 对象转数组 |
| | | public static List<Object[]> objectToArray(List<tb_user> userManagementList) { |
| | | List<Object[]> reList = new ArrayList<>(); |
| | | for (int i = 0; i < userManagementList.size(); i++) { |
| | | List<String> words = new ArrayList<String>(); |
| | | tb_user user = (tb_user) userManagementList.get(i); |
| | | words.add(String.valueOf(user.getId())); |
| | | words.add(user.getUsername()); |
| | | words.add(user.getSuperuser()); |
| | | words.add(user.getDeleteq()); |
| | | words.add(user.getDeleteall()); |
| | | words.add(user.getAlertq()); |
| | | words.add(user.getJustlook()); |
| | | words.add(user.getFenceq()); |
| | | words.add(String.valueOf(user.getAddtime())); |
| | | String[] array = words.toArray(new String[0]); |
| | | reList.add(array); |
| | | } |
| | | return reList; |
| | | |
| | | public static List<Object[]> objectToArray(List<tb_user> userManagementList) { |
| | | List<Object[]> reList = new ArrayList(); |
| | | |
| | | for(int i = 0; i < userManagementList.size(); ++i) { |
| | | List<String> words = new ArrayList(); |
| | | tb_user user = (tb_user)userManagementList.get(i); |
| | | words.add(String.valueOf(user.getId())); |
| | | words.add(user.getUsername()); |
| | | words.add(user.getSuperuser()); |
| | | words.add(user.getDeleteq()); |
| | | words.add(user.getDeleteall()); |
| | | words.add(user.getAlertq()); |
| | | words.add(user.getJustlook()); |
| | | words.add(user.getFenceq()); |
| | | words.add(String.valueOf(user.getAddtime())); |
| | | String[] array = (String[])words.toArray(new String[0]); |
| | | reList.add(array); |
| | | } |
| | | |
| | | |
| | | return reList; |
| | | } |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "/userManagement_export.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | @RequestMapping( |
| | | value = {"/userManagement_export.do"}, |
| | | method = {RequestMethod.POST, RequestMethod.GET} |
| | | ) |
| | | public String userManagement_export(HttpServletRequest request, HttpServletResponse response) { |
| | | String toPage = "forward:/hxzk/sysSetting/userManagement.jsp"; |
| | | List<tb_user> userManagementList = sysSettingService.getuserManagement(); |
| | | String[] rowName = { "序号","用户","级别","删除","修改","全部删除","仅观看","新增","添加时间"}; |
| | | List<tb_user> userManagementList = this.sysSettingService.getuserManagement(); |
| | | String[] rowName = new String[]{"序号", "用户", "级别", "删除", "修改", "全部删除", "仅观看", "新增", "添加时间"}; |
| | | List<Object[]> dataList = objectToArray(userManagementList); |
| | | 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; |
| | | } |
| | | |
| | | @RequestMapping(value = "/replay.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | @RequestMapping( |
| | | value = {"/replay.do"}, |
| | | method = {RequestMethod.POST, RequestMethod.GET} |
| | | ) |
| | | public String replay(HttpServletRequest request) { |
| | | String toPage = "forward:/hxzk/sysSetting/replay.jsp"; |
| | | List<tb_yuan_shi_bao_wen> replayList = sysSettingService.getreplay(); |
| | | List<tb_yuan_shi_bao_wen> replayList = this.sysSettingService.getreplay(); |
| | | request.setAttribute("replayList", replayList); |
| | | return toPage; |
| | | } |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "/userManagement_delete.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | @RequestMapping( |
| | | value = {"/userManagement_delete.do"}, |
| | | method = {RequestMethod.POST, RequestMethod.GET} |
| | | ) |
| | | public void userManagement_delete(HttpServletRequest request) { |
| | | String checkValStr = request.getParameter("checkVal"); |
| | | checkValStr = checkValStr.replaceAll("\"", ""); |
| | | String[] checkVal = checkValStr.split(","); |
| | | sysSettingService.userManagement_delete(checkVal); |
| | | this.sysSettingService.userManagement_delete(checkVal); |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "/userManagement_deletea.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | @RequestMapping( |
| | | value = {"/userManagement_deletea.do"}, |
| | | method = {RequestMethod.POST, RequestMethod.GET} |
| | | ) |
| | | public int userManagement_deletea(HttpServletRequest request) { |
| | | String checkValStr = request.getParameter("checkVal"); |
| | | checkValStr = checkValStr.replaceAll("\"", ""); |
| | | String[] checkVal = checkValStr.split(","); |
| | | int aaa = sysSettingService.userManagement_deletea(checkVal); |
| | | int aaa = this.sysSettingService.userManagement_deletea(checkVal); |
| | | return aaa; |
| | | } |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "/userManagement_deleteAll.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | @RequestMapping( |
| | | value = {"/userManagement_deleteAll.do"}, |
| | | method = {RequestMethod.POST, RequestMethod.GET} |
| | | ) |
| | | public void userManagement_deleteAll(HttpServletRequest request) { |
| | | sysSettingService.userManagement_deleteAll(); |
| | | this.sysSettingService.userManagement_deleteAll(); |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "/userManagement_deleteAlla.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | @RequestMapping( |
| | | value = {"/userManagement_deleteAlla.do"}, |
| | | method = {RequestMethod.POST, RequestMethod.GET} |
| | | ) |
| | | public int userManagement_deleteAlla(HttpServletRequest request) { |
| | | int aaa = sysSettingService.userManagement_deleteAlla(); |
| | | int aaa = this.sysSettingService.userManagement_deleteAlla(); |
| | | return aaa; |
| | | } |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "/userManagement_adda.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | @RequestMapping( |
| | | value = {"/userManagement_adda.do"}, |
| | | method = {RequestMethod.POST, RequestMethod.GET} |
| | | ) |
| | | public int userManagement_adda(HttpServletRequest request) { |
| | | tb_user user = new tb_user(); |
| | | user.setUsername(request.getParameter("username")); |
| | |
| | | user.setAlertq(request.getParameter("alertq")); |
| | | user.setDeleteall(request.getParameter("deleteall")); |
| | | user.setJustlook(request.getParameter("justlook")); |
| | | int bb = sysSettingService.userManagement_add(user); |
| | | int bb = this.sysSettingService.userManagement_add(user); |
| | | return bb; |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "/userManagement_add.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | @RequestMapping( |
| | | value = {"/userManagement_add.do"}, |
| | | method = {RequestMethod.POST, RequestMethod.GET} |
| | | ) |
| | | public void userManagement_add(HttpServletRequest request) { |
| | | tb_user user = new tb_user(); |
| | | user.setUsername(request.getParameter("username")); |
| | |
| | | user.setDeleteall(request.getParameter("deleteall")); |
| | | user.setJustlook(request.getParameter("justlook")); |
| | | user.setFenceq(request.getParameter("insert")); |
| | | sysSettingService.userManagement_add(user); |
| | | this.sysSettingService.userManagement_add(user); |
| | | } |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "/userManagement_modifya.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | @RequestMapping( |
| | | value = {"/userManagement_modifya.do"}, |
| | | method = {RequestMethod.POST, RequestMethod.GET} |
| | | ) |
| | | public int userManagement_modifya(HttpServletRequest request) { |
| | | tb_user user = new tb_user(); |
| | | user.setId(Integer.parseInt(request.getParameter("id"))); |
| | |
| | | user.setAlertq(request.getParameter("alertq")); |
| | | user.setDeleteall(request.getParameter("deleteall")); |
| | | user.setJustlook(request.getParameter("justlook")); |
| | | int bb = sysSettingService.userManagement_modify(user); |
| | | int bb = this.sysSettingService.userManagement_modify(user); |
| | | return bb; |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "/userManagement_modify.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | @RequestMapping( |
| | | value = {"/userManagement_modify.do"}, |
| | | method = {RequestMethod.POST, RequestMethod.GET} |
| | | ) |
| | | public void userManagement_modify(HttpServletRequest request) { |
| | | tb_user user = new tb_user(); |
| | | user.setId(Integer.parseInt(request.getParameter("id"))); |
| | |
| | | user.setDeleteall(request.getParameter("deleteall")); |
| | | user.setJustlook(request.getParameter("justlook")); |
| | | user.setFenceq(request.getParameter("insert")); |
| | | sysSettingService.userManagement_modify(user); |
| | | this.sysSettingService.userManagement_modify(user); |
| | | } |
| | | |
| | | @RequestMapping(value = "/sysSetting.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | @RequestMapping(value = {"/sysSetting.do"}, method = {RequestMethod.POST, RequestMethod.GET} |
| | | ) |
| | | public String sysSetting(HttpServletRequest request) { |
| | | String toPage = "forward:hxzk/sysSetting/sysSetting.jsp"; |
| | | List<tb_system> settingList = sysSettingService.getSetting(); |
| | | List<tb_map> maplist = mapService.getMapManagement(); |
| | | List<tb_nav> navList = zhwService.getnav(); |
| | | List<tb_system> settingList = this.sysSettingService.getSetting(); |
| | | List<tb_map> maplist = this.mapService.getMapManagement(); |
| | | List<tb_nav> navList = this.zhwService.getnav(); |
| | | List<tb_version> versions =zhwService.findversion(); |
| | | request.setAttribute("dataList", navList); |
| | | request.setAttribute("settingList", settingList); |
| | | request.setAttribute("maplist", maplist); |
| | | request.setAttribute("versionList", versions); |
| | | return toPage; |
| | | } |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "/getSysSetting.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | @RequestMapping(value = {"/getSysSetting.do"}, method = {RequestMethod.POST, RequestMethod.GET} |
| | | ) |
| | | public String getSysSetting(HttpServletRequest request) { |
| | | JSONObject json = new JSONObject(); |
| | | List<tb_system> settingList = sysSettingService.getSetting(); |
| | | List<tb_system> settingList = this.sysSettingService.getSetting(); |
| | | json.put("result", settingList.get(0)); |
| | | return json.toString(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/sysSetting_modify.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | @RequestMapping(value = {"/sysSetting_modify.do"}, method = {RequestMethod.POST, RequestMethod.GET} |
| | | ) |
| | | public void sysSetting_modify(HttpServletRequest request) { |
| | | tb_system setting = new tb_system(); |
| | | setting.setDataname(request.getParameter("dataname")); |
| | |
| | | setting.setOffView(request.getParameter("offView")); |
| | | setting.setAnckicon(request.getParameter("anckicon")); |
| | | setting.setGas_show(request.getParameter("gas_show")); |
| | | // setting.setQuiet(request.getParameter("quiet")); |
| | | setting.setReal_trak_time(request.getParameter("real_trak_time")); |
| | | setting.setReal_trak_color(request.getParameter("real_trak_color")); |
| | | setting.setYulan_map(request.getParameter("yulan_map_tu")); |
| | |
| | | setting.setGas_port(request.getParameter("gas_port")); |
| | | setting.setGas_hz(request.getParameter("gas_hz")); |
| | | setting.setRssid(request.getParameter("rssid")); |
| | | setting.setBaoliu25(request.getParameter("baoliu25")); |
| | | setting.setBaoliu26(request.getParameter("baoliu26")); |
| | | setting.setFence_show(request.getParameter("fence_show")); |
| | | tb_nav nav = new tb_nav(); |
| | | nav.setLabel(request.getParameter("label")); |
| | |
| | | nav.setBasiclnfo(request.getParameter("basiclnfo")); |
| | | nav.setVideo(request.getParameter("video")); |
| | | nav.setGas(request.getParameter("gas")); |
| | | sysSettingService.sysSetting_modify(setting); |
| | | zhwService.updatenav(nav); |
| | | String time=request.getParameter("time"); |
| | | String Bsversion = request.getParameter("BsVersion"); |
| | | this.sysSettingService.addVersion(time,Bsversion); |
| | | this.sysSettingService.sysSetting_modify(setting); |
| | | this.zhwService.updatenav(nav); |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "/sysSetting_modifya.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | @RequestMapping( |
| | | value = {"/sysSetting_modifya.do"}, |
| | | method = {RequestMethod.POST, RequestMethod.GET} |
| | | ) |
| | | public String sysSetting_modifya(HttpServletRequest request) { |
| | | tb_system setting = new tb_system(); |
| | | setting.setUdpAdress(request.getParameter("ip")); |
| | |
| | | setting.setBaoliu16(request.getParameter("showtracks")); |
| | | setting.setBaoliu17(request.getParameter("shownews")); |
| | | setting.setYulan_map(request.getParameter("map")); |
| | | String xieyi = "BSTOCS1,U1ALTERSYSTEM,"+setting.getUdpAdress()+","+setting.getBaoliu20()+","+setting.getBaoliu13()+","+setting.getBaoliu14()+","+setting.getBaoliu15()+","+setting.getReal_trak_time()+","+setting.getFence_show()+","+setting.getViewAnckid()+","+setting.getBaoliu16()+","+setting.getBaoliu17()+","+setting.getYulan_map()+",END"; |
| | | String xieyi = "BSTOCS1,U1ALTERSYSTEM," + setting.getUdpAdress() + "," + setting.getBaoliu20() + "," + setting.getBaoliu13() + "," + setting.getBaoliu14() + "," + setting.getBaoliu15() + "," + setting.getReal_trak_time() + "," + setting.getFence_show() + "," + setting.getViewAnckid() + "," + setting.getBaoliu16() + "," + setting.getBaoliu17() + "," + setting.getYulan_map() + ",END"; |
| | | Udp_Out.udp_to_cs(xieyi); |
| | | int aaa = sysSettingService.sysSetting_modifya(setting); |
| | | return ""+aaa; |
| | | int aaa = this.sysSettingService.sysSetting_modifya(setting); |
| | | return "" + aaa; |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "/getSysSettinga.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | @RequestMapping( |
| | | value = {"/getSysSettinga.do"}, |
| | | method = {RequestMethod.POST, RequestMethod.GET} |
| | | ) |
| | | public JSONObject getSysSettinga(HttpServletRequest request) { |
| | | JSONObject json = new JSONObject(); |
| | | List<tb_system> settingList = sysSettingService.getSetting(); |
| | | List<tb_system> settingList = this.sysSettingService.getSetting(); |
| | | json.put("dataList", settingList); |
| | | return json; |
| | | } |
| | | |
| | | @RequestMapping(value = "/algorithmConfiguration.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | @RequestMapping( |
| | | value = {"/algorithmConfiguration.do"}, |
| | | method = {RequestMethod.POST, RequestMethod.GET} |
| | | ) |
| | | public String algorithmConfiguration(HttpServletRequest request) { |
| | | String toPage = "forward:hxzk/sysSetting/algorithmConfiguration.jsp"; |
| | | List<tb_achor> layerList = sysSettingService.getLayer(); |
| | | List<tb_achor> layerList = this.sysSettingService.getLayer(); |
| | | request.setAttribute("layerList", layerList); |
| | | List<tb_achor> groupList = sysSettingService.getGroup(); |
| | | List<tb_achor> groupList = this.sysSettingService.getGroup(); |
| | | request.setAttribute("groupList", groupList); |
| | | return toPage; |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "/algorithmConfiguration_search.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | @RequestMapping( |
| | | value = {"/algorithmConfiguration_search.do"}, |
| | | method = {RequestMethod.POST, RequestMethod.GET} |
| | | ) |
| | | public String algorithmConfiguration_search(HttpServletRequest request) throws IOException { |
| | | JSONObject json = new JSONObject(); |
| | | String input = request.getParameter("input"); |
| | | String jsonString = RequestUtils.getRequestJsonString(request, Config.getCharset()); |
| | | tb_suanfa suanfa = (tb_suanfa) JSONObject.toBean(JSONObject.fromObject(jsonString), tb_suanfa.class); |
| | | tb_suanfa suanfa = (tb_suanfa)JSONObject.toBean(JSONObject.fromObject(jsonString), tb_suanfa.class); |
| | | input = suanfa.getAnchorid(); |
| | | List<tb_suanfa> anchorManagementList = sysSettingService.searchAlgorithmConfiguration(input); |
| | | List<tb_suanfa> anchorManagementList = this.sysSettingService.searchAlgorithmConfiguration(input); |
| | | json.put("result", anchorManagementList.get(0)); |
| | | return json.toString(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/algorithmConfiguration_modify.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | @RequestMapping( |
| | | value = {"/algorithmConfiguration_modify.do"}, |
| | | method = {RequestMethod.POST, RequestMethod.GET} |
| | | ) |
| | | public void algorithmConfiguration_modify(HttpServletRequest request) { |
| | | tb_suanfa suanfa = new tb_suanfa(); |
| | | suanfa.setFloor(request.getParameter("floor")); |
| | |
| | | suanfa.setDunjiao(request.getParameter("kuansong_model")); |
| | | suanfa.setBujuqu_youxiao(request.getParameter("kuansong_model")); |
| | | suanfa.setBujuqu_youxian(request.getParameter("kuansong_model")); |
| | | sysSettingService.algorithmConfiguration_modify(suanfa); |
| | | this.sysSettingService.algorithmConfiguration_modify(suanfa); |
| | | } |
| | | |
| | | // 所有报文 |
| | | @RequestMapping(value = "/getMessage.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | @RequestMapping( |
| | | value = {"/getMessage.do"}, |
| | | method = {RequestMethod.POST, RequestMethod.GET} |
| | | ) |
| | | protected void doPost(HttpServletRequest request) throws IOException { |
| | | String jsonString = RequestUtils.getRequestJsonString(request, Config.getCharset()); |
| | | //System.out.print("result" + jsonString); |
| | | JSONObject json_test = JSONObject.fromObject(jsonString); |
| | | String result = json_test.getString("result"); |
| | | |
| | | try { |
| | | File file = new File(request.getServletContext().getRealPath("/")+Config.getMessagePath()); |
| | | File file = new File(request.getServletContext().getRealPath("/") + Config.getMessagePath()); |
| | | if (!file.exists()) { |
| | | file.createNewFile(); |
| | | } |
| | | // FileWriter fw = new FileWriter(file, true); // 设置成true就是追加 |
| | | // fw.write(result); |
| | | // fw.write("\r\n"); |
| | | // ; |
| | | // fw.close(); |
| | | FileOutputStream fos = new FileOutputStream(file,true); |
| | | BufferedOutputStream bos = new BufferedOutputStream(fos); |
| | | bos.write((result+"\r\n").getBytes()); |
| | | bos.flush(); |
| | | bos.close(); |
| | | } catch (FileNotFoundException e) { |
| | | e.printStackTrace(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | |
| | | FileOutputStream fos = new FileOutputStream(file, true); |
| | | BufferedOutputStream bos = new BufferedOutputStream(fos); |
| | | bos.write((result + "\r\n").getBytes()); |
| | | bos.flush(); |
| | | bos.close(); |
| | | } catch (FileNotFoundException var8) { |
| | | var8.printStackTrace(); |
| | | } catch (IOException var9) { |
| | | var9.printStackTrace(); |
| | | } |
| | | |
| | | } |
| | | |
| | | // 清空文件内容 |
| | | public void clearInfoForFile(String fileName) { |
| | | File file = new File(fileName); |
| | | |
| | | try { |
| | | if (!file.exists()) { |
| | | file.createNewFile(); |
| | | } |
| | | |
| | | FileWriter fileWriter = new FileWriter(file); |
| | | fileWriter.write(""); |
| | | fileWriter.flush(); |
| | | fileWriter.close(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } catch (IOException var4) { |
| | | var4.printStackTrace(); |
| | | } |
| | | |
| | | } |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "/displayMessage.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | @RequestMapping( |
| | | value = {"/displayMessage.do"}, |
| | | method = {RequestMethod.POST, RequestMethod.GET} |
| | | ) |
| | | protected List<String> displayMessage(HttpServletRequest request) { |
| | | try { |
| | | List<String> tmp = new ArrayList<String>(); |
| | | /* |
| | | * tmp.addAll(Udp_Receive.allMessage); Udp_Receive.allMessage.clear(); |
| | | * Udp_Receive.zhuceMessage.clear(); Udp_Receive.debugMessage.clear(); |
| | | * Udp_Receive.mysqlMessage.clear(); Udp_Receive.hexMessage.clear(); |
| | | * Udp_Receive.gasMessage.clear(); Udp_Receive.tcpMessage.clear(); |
| | | * Udp_Receive.yuanshiMessage.clear(); Udp_Receive.udpMessage.clear(); |
| | | */ |
| | | List<String> tmp = new ArrayList(); |
| | | return tmp; |
| | | } catch (Exception e) { |
| | | // TODO Auto-generated catch block |
| | | e.printStackTrace(); |
| | | } catch (Exception var3) { |
| | | var3.printStackTrace(); |
| | | return null; |
| | | } |
| | | |
| | | } |
| | | |
| | | // 原始报文 |
| | | @RequestMapping(value = "/yuanshiMessage.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | @RequestMapping( |
| | | value = {"/yuanshiMessage.do"}, |
| | | method = {RequestMethod.POST, RequestMethod.GET} |
| | | ) |
| | | protected void yuanshiMessage(HttpServletRequest request) throws IOException { |
| | | String jsonString = RequestUtils.getRequestJsonString(request, Config.getCharset()); |
| | | //System.out.print("result" + jsonString); |
| | | JSONObject json_test = JSONObject.fromObject(jsonString); |
| | | JSONObject json_test = JSONObject.fromObject(jsonString); |
| | | String result = json_test.getString("result"); |
| | | |
| | | try { |
| | | File file = new File(request.getServletContext().getRealPath("/")+Config.getYuanshiMessagePath()); |
| | | File file = new File(request.getServletContext().getRealPath("/") + Config.getYuanshiMessagePath()); |
| | | if (!file.exists()) { |
| | | file.createNewFile(); |
| | | } |
| | | FileOutputStream fos = new FileOutputStream(file,true); |
| | | BufferedOutputStream bos = new BufferedOutputStream(fos); |
| | | bos.write((result+"\r\n").getBytes()); |
| | | bos.flush(); |
| | | bos.close(); |
| | | } catch (FileNotFoundException e) { |
| | | e.printStackTrace(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | |
| | | FileOutputStream fos = new FileOutputStream(file, true); |
| | | BufferedOutputStream bos = new BufferedOutputStream(fos); |
| | | bos.write((result + "\r\n").getBytes()); |
| | | bos.flush(); |
| | | bos.close(); |
| | | } catch (FileNotFoundException var8) { |
| | | var8.printStackTrace(); |
| | | } catch (IOException var9) { |
| | | var9.printStackTrace(); |
| | | } |
| | | |
| | | } |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "/displayYuanshiMessage.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | @RequestMapping( |
| | | value = {"/displayYuanshiMessage.do"}, |
| | | method = {RequestMethod.POST, RequestMethod.GET} |
| | | ) |
| | | protected List<String> displayYuanshiMessage(HttpServletRequest request) { |
| | | try { |
| | | List<String> tmp = new ArrayList<String>(); |
| | | /* |
| | | * tmp.addAll(Udp_Receive.yuanshiMessage); Udp_Receive.allMessage.clear(); |
| | | * Udp_Receive.zhuceMessage.clear(); Udp_Receive.debugMessage.clear(); |
| | | * Udp_Receive.mysqlMessage.clear(); Udp_Receive.hexMessage.clear(); |
| | | * Udp_Receive.gasMessage.clear(); Udp_Receive.tcpMessage.clear(); |
| | | * Udp_Receive.yuanshiMessage.clear(); Udp_Receive.udpMessage.clear(); |
| | | */ |
| | | List<String> tmp = new ArrayList(); |
| | | return tmp; |
| | | } catch (Exception e) { |
| | | // TODO Auto-generated catch block |
| | | e.printStackTrace(); |
| | | } catch (Exception var3) { |
| | | var3.printStackTrace(); |
| | | return null; |
| | | } |
| | | |
| | | } |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "/displayUDPMessage.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | @RequestMapping( |
| | | value = {"/displayUDPMessage.do"}, |
| | | method = {RequestMethod.POST, RequestMethod.GET} |
| | | ) |
| | | protected List<String> displayUDPMessage(HttpServletRequest request) { |
| | | try { |
| | | List<String> tmp = new ArrayList<String>(); |
| | | /* |
| | | * tmp.addAll(Udp_Receive.udpMessage); Udp_Receive.allMessage.clear(); |
| | | * Udp_Receive.zhuceMessage.clear(); Udp_Receive.debugMessage.clear(); |
| | | * Udp_Receive.mysqlMessage.clear(); Udp_Receive.hexMessage.clear(); |
| | | * Udp_Receive.gasMessage.clear(); Udp_Receive.tcpMessage.clear(); |
| | | * Udp_Receive.yuanshiMessage.clear(); Udp_Receive.udpMessage.clear(); |
| | | */ |
| | | List<String> tmp = new ArrayList(); |
| | | return tmp; |
| | | } catch (Exception e) { |
| | | // TODO Auto-generated catch block |
| | | e.printStackTrace(); |
| | | } catch (Exception var3) { |
| | | var3.printStackTrace(); |
| | | return null; |
| | | } |
| | | |
| | | } |
| | | |
| | | // TCP |
| | | @ResponseBody |
| | | @RequestMapping(value = "/displayTCPMessage.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | @RequestMapping( |
| | | value = {"/displayTCPMessage.do"}, |
| | | method = {RequestMethod.POST, RequestMethod.GET} |
| | | ) |
| | | protected List<String> displayTCPMessage(HttpServletRequest request) { |
| | | try { |
| | | List<String> tmp = new ArrayList<String>(); |
| | | /* |
| | | * tmp.addAll(Udp_Receive.tcpMessage); Udp_Receive.allMessage.clear(); |
| | | * Udp_Receive.zhuceMessage.clear(); Udp_Receive.debugMessage.clear(); |
| | | * Udp_Receive.mysqlMessage.clear(); Udp_Receive.hexMessage.clear(); |
| | | * Udp_Receive.gasMessage.clear(); Udp_Receive.tcpMessage.clear(); |
| | | * Udp_Receive.yuanshiMessage.clear(); Udp_Receive.udpMessage.clear(); |
| | | */ |
| | | List<String> tmp = new ArrayList(); |
| | | return tmp; |
| | | } catch (Exception e) { |
| | | // TODO Auto-generated catch block |
| | | e.printStackTrace(); |
| | | } catch (Exception var3) { |
| | | var3.printStackTrace(); |
| | | return null; |
| | | } |
| | | |
| | | } |
| | | |
| | | // 调试报文 |
| | | @RequestMapping(value = "/debugMessage.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | @RequestMapping( |
| | | value = {"/debugMessage.do"}, |
| | | method = {RequestMethod.POST, RequestMethod.GET} |
| | | ) |
| | | protected void debugMessage(HttpServletRequest request) throws IOException { |
| | | String jsonString = RequestUtils.getRequestJsonString(request, Config.getCharset()); |
| | | //System.out.print("result" + jsonString); |
| | | JSONObject json_test = JSONObject.fromObject(jsonString); |
| | | JSONObject json_test = JSONObject.fromObject(jsonString); |
| | | String result = json_test.getString("result"); |
| | | |
| | | try { |
| | | File file = new File(request.getServletContext().getRealPath("/")+Config.getDebugMessagePath()); |
| | | File file = new File(request.getServletContext().getRealPath("/") + Config.getDebugMessagePath()); |
| | | if (!file.exists()) { |
| | | file.createNewFile(); |
| | | } |
| | | FileWriter fw = new FileWriter(file,true); //设置成true就是追加 |
| | | fw.write(result); |
| | | fw.write("\r\n");; |
| | | fw.close(); |
| | | } catch (FileNotFoundException e) { |
| | | e.printStackTrace(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | |
| | | FileWriter fw = new FileWriter(file, true); |
| | | fw.write(result); |
| | | fw.write("\r\n"); |
| | | fw.close(); |
| | | } catch (FileNotFoundException var7) { |
| | | var7.printStackTrace(); |
| | | } catch (IOException var8) { |
| | | var8.printStackTrace(); |
| | | } |
| | | |
| | | } |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "/displayDebugMessage.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | @RequestMapping( |
| | | value = {"/displayDebugMessage.do"}, |
| | | method = {RequestMethod.POST, RequestMethod.GET} |
| | | ) |
| | | protected List<String> displayDebugMessage(HttpServletRequest request) { |
| | | try { |
| | | List<String> tmp = new ArrayList<String>(); |
| | | /* |
| | | * tmp.addAll(Udp_Receive.debugMessage); Udp_Receive.allMessage.clear(); |
| | | * Udp_Receive.zhuceMessage.clear(); Udp_Receive.debugMessage.clear(); |
| | | * Udp_Receive.mysqlMessage.clear(); Udp_Receive.hexMessage.clear(); |
| | | * Udp_Receive.gasMessage.clear(); Udp_Receive.tcpMessage.clear(); |
| | | * Udp_Receive.yuanshiMessage.clear(); Udp_Receive.udpMessage.clear(); |
| | | */ |
| | | List<String> tmp = new ArrayList(); |
| | | return tmp; |
| | | } catch (Exception e) { |
| | | // TODO Auto-generated catch block |
| | | e.printStackTrace(); |
| | | } catch (Exception var3) { |
| | | var3.printStackTrace(); |
| | | return null; |
| | | } |
| | | |
| | | } |
| | | |
| | | // 注册报文 |
| | | @RequestMapping(value = "/zhuceMessage.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | @RequestMapping( |
| | | value = {"/zhuceMessage.do"}, |
| | | method = {RequestMethod.POST, RequestMethod.GET} |
| | | ) |
| | | protected void zhuceMessage(HttpServletRequest request) throws IOException { |
| | | String jsonString = RequestUtils.getRequestJsonString(request, Config.getCharset()); |
| | | //System.out.print("result" + jsonString); |
| | | JSONObject json_test = JSONObject.fromObject(jsonString); |
| | | JSONObject json_test = JSONObject.fromObject(jsonString); |
| | | String result = json_test.getString("result"); |
| | | |
| | | try { |
| | | File file = new File(request.getServletContext().getRealPath("/")+Config.getZhuceMessagePath()); |
| | | File file = new File(request.getServletContext().getRealPath("/") + Config.getZhuceMessagePath()); |
| | | if (!file.exists()) { |
| | | file.createNewFile(); |
| | | } |
| | | FileWriter fw = new FileWriter(file,true); //设置成true就是追加 |
| | | fw.write(result); |
| | | fw.write("\r\n");; |
| | | fw.close(); |
| | | } catch (FileNotFoundException e) { |
| | | e.printStackTrace(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | |
| | | FileWriter fw = new FileWriter(file, true); |
| | | fw.write(result); |
| | | fw.write("\r\n"); |
| | | fw.close(); |
| | | } catch (FileNotFoundException var7) { |
| | | var7.printStackTrace(); |
| | | } catch (IOException var8) { |
| | | var8.printStackTrace(); |
| | | } |
| | | |
| | | } |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "/displayZhuceMessage.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | @RequestMapping( |
| | | value = {"/displayZhuceMessage.do"}, |
| | | method = {RequestMethod.POST, RequestMethod.GET} |
| | | ) |
| | | protected List<String> displayZhuceMessage(HttpServletRequest request) { |
| | | try { |
| | | List<String> tmp = new ArrayList<String>(); |
| | | /* |
| | | * tmp.addAll(Udp_Receive.zhuceMessage); Udp_Receive.allMessage.clear(); |
| | | * Udp_Receive.zhuceMessage.clear(); Udp_Receive.debugMessage.clear(); |
| | | * Udp_Receive.mysqlMessage.clear(); Udp_Receive.hexMessage.clear(); |
| | | * Udp_Receive.gasMessage.clear(); Udp_Receive.tcpMessage.clear(); |
| | | * Udp_Receive.yuanshiMessage.clear(); Udp_Receive.udpMessage.clear(); |
| | | */ |
| | | List<String> tmp = new ArrayList(); |
| | | return tmp; |
| | | } catch (Exception e) { |
| | | // TODO Auto-generated catch block |
| | | e.printStackTrace(); |
| | | } catch (Exception var3) { |
| | | var3.printStackTrace(); |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | @RequestMapping( |
| | | value = {"/mysqlMessage.do"}, |
| | | method = {RequestMethod.POST, RequestMethod.GET} |
| | | ) |
| | | protected void mysqlMessage(HttpServletRequest request) throws IOException { |
| | | String jsonString = RequestUtils.getRequestJsonString(request, Config.getCharset()); |
| | | JSONObject json_test = JSONObject.fromObject(jsonString); |
| | | String result = json_test.getString("result"); |
| | | |
| | | try { |
| | | File file = new File(request.getServletContext().getRealPath("/") + Config.getMysqlMessagePath()); |
| | | if (!file.exists()) { |
| | | file.createNewFile(); |
| | | } |
| | | |
| | | FileWriter fw = new FileWriter(file, true); |
| | | fw.write(result); |
| | | fw.write("\r\n"); |
| | | fw.close(); |
| | | } catch (FileNotFoundException var7) { |
| | | var7.printStackTrace(); |
| | | } catch (IOException var8) { |
| | | var8.printStackTrace(); |
| | | } |
| | | |
| | | } |
| | | |
| | | // mysql报文 |
| | | @RequestMapping(value = "/mysqlMessage.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | protected void mysqlMessage(HttpServletRequest request) throws IOException { |
| | | String jsonString = RequestUtils.getRequestJsonString(request, Config.getCharset()); |
| | | //System.out.print("result" + jsonString); |
| | | JSONObject json_test = JSONObject.fromObject(jsonString); |
| | | String result = json_test.getString("result"); |
| | | try { |
| | | File file = new File(request.getServletContext().getRealPath("/")+Config.getMysqlMessagePath()); |
| | | if (!file.exists()) { |
| | | file.createNewFile(); |
| | | } |
| | | FileWriter fw = new FileWriter(file,true); //设置成true就是追加 |
| | | fw.write(result); |
| | | fw.write("\r\n");; |
| | | fw.close(); |
| | | } catch (FileNotFoundException e) { |
| | | e.printStackTrace(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | // 数据库数 |
| | | @ResponseBody |
| | | @RequestMapping(value = "/displayMysqlMessage.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | @RequestMapping( |
| | | value = {"/displayMysqlMessage.do"}, |
| | | method = {RequestMethod.POST, RequestMethod.GET} |
| | | ) |
| | | protected List<String> displayMysqlMessage(HttpServletRequest request) { |
| | | try { |
| | | List<String> tmp = new ArrayList<String>(); |
| | | /* |
| | | * tmp.addAll(Udp_Receive.mysqlMessage); Udp_Receive.allMessage.clear(); |
| | | * Udp_Receive.zhuceMessage.clear(); Udp_Receive.debugMessage.clear(); |
| | | * Udp_Receive.mysqlMessage.clear(); Udp_Receive.hexMessage.clear(); |
| | | * Udp_Receive.gasMessage.clear(); Udp_Receive.tcpMessage.clear(); |
| | | * Udp_Receive.yuanshiMessage.clear(); Udp_Receive.udpMessage.clear(); |
| | | */ |
| | | List<String> tmp = new ArrayList(); |
| | | return tmp; |
| | | } catch (Exception e) { |
| | | // TODO Auto-generated catch block |
| | | e.printStackTrace(); |
| | | } catch (Exception var3) { |
| | | var3.printStackTrace(); |
| | | return null; |
| | | } |
| | | |
| | | } |
| | | |
| | | // 气体报文 |
| | | @RequestMapping(value = "/gasMessage.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | @RequestMapping( |
| | | value = {"/gasMessage.do"}, |
| | | method = {RequestMethod.POST, RequestMethod.GET} |
| | | ) |
| | | protected void gasMessage(HttpServletRequest request) throws IOException { |
| | | String jsonString = RequestUtils.getRequestJsonString(request, Config.getCharset()); |
| | | //System.out.print("result" + jsonString); |
| | | JSONObject json_test = JSONObject.fromObject(jsonString); |
| | | JSONObject json_test = JSONObject.fromObject(jsonString); |
| | | String result = json_test.getString("result"); |
| | | |
| | | try { |
| | | File file = new File(request.getServletContext().getRealPath("/")+Config.getGasMessagePath()); |
| | | File file = new File(request.getServletContext().getRealPath("/") + Config.getGasMessagePath()); |
| | | if (!file.exists()) { |
| | | file.createNewFile(); |
| | | } |
| | | FileWriter fw = new FileWriter(file,true); //设置成true就是追加 |
| | | fw.write(result); |
| | | fw.write("\r\n");; |
| | | fw.close(); |
| | | } catch (FileNotFoundException e) { |
| | | e.printStackTrace(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | |
| | | FileWriter fw = new FileWriter(file, true); |
| | | fw.write(result); |
| | | fw.write("\r\n"); |
| | | fw.close(); |
| | | } catch (FileNotFoundException var7) { |
| | | var7.printStackTrace(); |
| | | } catch (IOException var8) { |
| | | var8.printStackTrace(); |
| | | } |
| | | |
| | | } |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "/displayGasMessage.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | @RequestMapping( |
| | | value = {"/displayGasMessage.do"}, |
| | | method = {RequestMethod.POST, RequestMethod.GET} |
| | | ) |
| | | protected List<String> displayGasMessage(HttpServletRequest request) { |
| | | try { |
| | | List<String> tmp = new ArrayList<String>(); |
| | | /* |
| | | * tmp.addAll(Udp_Receive.gasMessage); Udp_Receive.allMessage.clear(); |
| | | * Udp_Receive.zhuceMessage.clear(); Udp_Receive.debugMessage.clear(); |
| | | * Udp_Receive.mysqlMessage.clear(); Udp_Receive.hexMessage.clear(); |
| | | * Udp_Receive.gasMessage.clear(); Udp_Receive.tcpMessage.clear(); |
| | | * Udp_Receive.yuanshiMessage.clear(); Udp_Receive.udpMessage.clear(); |
| | | */ |
| | | List<String> tmp = new ArrayList(); |
| | | return tmp; |
| | | } catch (Exception e) { |
| | | // TODO Auto-generated catch block |
| | | e.printStackTrace(); |
| | | } catch (Exception var3) { |
| | | var3.printStackTrace(); |
| | | return null; |
| | | } |
| | | |
| | | } |
| | | |
| | | // HEX显示 |
| | | @RequestMapping(value = "/HEXMessage.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | @RequestMapping( |
| | | value = {"/HEXMessage.do"}, |
| | | method = {RequestMethod.POST, RequestMethod.GET} |
| | | ) |
| | | protected void HEXMessage(HttpServletRequest request) throws IOException { |
| | | String jsonString = RequestUtils.getRequestJsonString(request, Config.getCharset()); |
| | | //System.out.print("result" + jsonString); |
| | | JSONObject json_test = JSONObject.fromObject(jsonString); |
| | | JSONObject json_test = JSONObject.fromObject(jsonString); |
| | | String result = json_test.getString("result"); |
| | | |
| | | try { |
| | | File file = new File(request.getServletContext().getRealPath("/")+Config.getHEXMessagePath()); |
| | | File file = new File(request.getServletContext().getRealPath("/") + Config.getHEXMessagePath()); |
| | | if (!file.exists()) { |
| | | file.createNewFile(); |
| | | } |
| | | FileWriter fw = new FileWriter(file,true); //设置成true就是追加 |
| | | fw.write(result); |
| | | fw.write("\r\n");; |
| | | fw.close(); |
| | | } catch (FileNotFoundException e) { |
| | | e.printStackTrace(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | |
| | | FileWriter fw = new FileWriter(file, true); |
| | | fw.write(result); |
| | | fw.write("\r\n"); |
| | | fw.close(); |
| | | } catch (FileNotFoundException var7) { |
| | | var7.printStackTrace(); |
| | | } catch (IOException var8) { |
| | | var8.printStackTrace(); |
| | | } |
| | | |
| | | } |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "/displayHEXMessage.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | @RequestMapping( |
| | | value = {"/displayHEXMessage.do"}, |
| | | method = {RequestMethod.POST, RequestMethod.GET} |
| | | ) |
| | | protected List<String> displayHEXMessage(HttpServletRequest request) { |
| | | try { |
| | | List<String> tmp = new ArrayList<String>(); |
| | | /* |
| | | * tmp.addAll(Udp_Receive.hexMessage); Udp_Receive.allMessage.clear(); |
| | | * Udp_Receive.zhuceMessage.clear(); Udp_Receive.debugMessage.clear(); |
| | | * Udp_Receive.mysqlMessage.clear(); Udp_Receive.hexMessage.clear(); |
| | | * Udp_Receive.gasMessage.clear(); Udp_Receive.tcpMessage.clear(); |
| | | * Udp_Receive.yuanshiMessage.clear(); Udp_Receive.udpMessage.clear(); |
| | | */ |
| | | List<String> tmp = new ArrayList(); |
| | | return tmp; |
| | | } catch (Exception e) { |
| | | // TODO Auto-generated catch block |
| | | e.printStackTrace(); |
| | | } catch (Exception var3) { |
| | | var3.printStackTrace(); |
| | | return null; |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "/startMessage.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | @RequestMapping( |
| | | value = {"/startMessage.do"}, |
| | | method = {RequestMethod.POST, RequestMethod.GET} |
| | | ) |
| | | protected void startMessage(HttpServletRequest request) { |
| | | String BaowenPath = Config.getBaowenConfig(); |
| | | /* |
| | | * Udp_Receive.allMessage.clear(); Udp_Receive.zhuceMessage.clear(); |
| | | * Udp_Receive.debugMessage.clear(); Udp_Receive.mysqlMessage.clear(); |
| | | * Udp_Receive.hexMessage.clear(); Udp_Receive.gasMessage.clear(); |
| | | * Udp_Receive.tcpMessage.clear(); Udp_Receive.yuanshiMessage.clear(); |
| | | * Udp_Receive.udpMessage.clear(); |
| | | */ |
| | | ModifyConfig.writeData(BaowenPath, "baowenSwitch", "1"); |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "/stopMessage.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | @RequestMapping( |
| | | value = {"/stopMessage.do"}, |
| | | method = {RequestMethod.POST, RequestMethod.GET} |
| | | ) |
| | | protected void stopMessage(HttpServletRequest request) { |
| | | String BaowenPath = Config.getBaowenConfig(); |
| | | /* |
| | | * Udp_Receive.allMessage.clear(); Udp_Receive.zhuceMessage.clear(); |
| | | * Udp_Receive.debugMessage.clear(); Udp_Receive.mysqlMessage.clear(); |
| | | * Udp_Receive.hexMessage.clear(); Udp_Receive.gasMessage.clear(); |
| | | * Udp_Receive.tcpMessage.clear(); Udp_Receive.yuanshiMessage.clear(); |
| | | * Udp_Receive.udpMessage.clear(); |
| | | */ |
| | | ModifyConfig.writeData(BaowenPath, "baowenSwitch", "0"); |
| | | } |
| | | |
| | | @RequestMapping(value = "/doMessageTransfer.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | @RequestMapping( |
| | | value = {"/doMessageTransfer.do"}, |
| | | method = {RequestMethod.POST, RequestMethod.GET} |
| | | ) |
| | | public void doMessageTransfer(HttpServletRequest request) throws IOException, InterruptedException { |
| | | String jsonString = RequestUtils.getRequestJsonString(request, Config.getCharset()); |
| | | JSONObject jsonResult = JSONObject.fromObject(jsonString); |
| | | String dataType = jsonResult.getString("dataType"); |
| | | String result = jsonResult.getString("result"); |
| | | String wifi_model = sysSettingService.getSetting().get(0).getWifi_mdel(); |
| | | List<tb_forward_data> messageTransferList = sysSettingService.getALLMessageTransfer(dataType); |
| | | //System.out.print(messageTransferList); |
| | | String wifi_model = ((tb_system)this.sysSettingService.getSetting().get(0)).getWifi_mdel(); |
| | | List<tb_forward_data> messageTransferList = this.sysSettingService.getALLMessageTransfer(dataType); |
| | | DatagramPacket packet = null; |
| | | DatagramSocket socket = new DatagramSocket(); |
| | | if (messageTransferList.size() > 0) { |
| | | for (int i = 0; i < messageTransferList.size(); i++) { |
| | | String ip = messageTransferList.get(i).getIp(); |
| | | String port = messageTransferList.get(i).getPort(); |
| | | String type = messageTransferList.get(i).getType(); |
| | | for(int i = 0; i < messageTransferList.size(); ++i) { |
| | | String ip = ((tb_forward_data)messageTransferList.get(i)).getIp(); |
| | | String port = ((tb_forward_data)messageTransferList.get(i)).getPort(); |
| | | String type = ((tb_forward_data)messageTransferList.get(i)).getType(); |
| | | String BaowenPath; |
| | | String baowenStatus; |
| | | if (type.equals("UDP")) { |
| | | try { |
| | | packet = new DatagramPacket(result.getBytes(), result.getBytes().length, InetAddress.getByName(ip), |
| | | Integer.parseInt(port)); |
| | | } catch (NumberFormatException e1) { |
| | | // TODO Auto-generated catch block |
| | | e1.printStackTrace(); |
| | | packet = new DatagramPacket(result.getBytes(), result.getBytes().length, InetAddress.getByName(ip), Integer.parseInt(port)); |
| | | } catch (NumberFormatException var21) { |
| | | var21.printStackTrace(); |
| | | } |
| | | |
| | | try { |
| | | socket.send(packet); |
| | | //延时 |
| | | Thread.sleep(100); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | Thread.sleep(100L); |
| | | } catch (IOException var20) { |
| | | var20.printStackTrace(); |
| | | } |
| | | |
| | | try { |
| | | |
| | | socket.close(); |
| | | } catch (Exception e) { |
| | | // TODO Auto-generated catch block |
| | | e.printStackTrace(); |
| | | } catch (Exception var19) { |
| | | var19.printStackTrace(); |
| | | } |
| | | // 保存UDP转发报文 |
| | | |
| | | try { |
| | | String BaowenPath = Config.getBaowenConfig(); |
| | | String baowenStatus = ModifyConfig.readData(BaowenPath, "baowenSwitch"); |
| | | if (baowenStatus.equals("1")){ |
| | | /* Udp_Receive.udpMessage.add("发:"+result); */ |
| | | } |
| | | } catch (Exception e) { |
| | | // TODO Auto-generated catch block |
| | | e.printStackTrace(); |
| | | |
| | | try { |
| | | BaowenPath = Config.getBaowenConfig(); |
| | | baowenStatus = ModifyConfig.readData(BaowenPath, "baowenSwitch"); |
| | | if (baowenStatus.equals("1")) { |
| | | } |
| | | |
| | | } catch (Exception var18) { |
| | | var18.printStackTrace(); |
| | | } |
| | | } else if (type.equals("TCP")) { |
| | | // TCP |
| | | // if(Systems.sys().getWifi_model().equals("1")) { |
| | | if (wifi_model.equals("1")) { |
| | | port = "8234"; |
| | | } |
| | | |
| | | try { |
| | | Socket sck=new Socket(ip,Integer.parseInt(port)); |
| | | //2.传输内容 |
| | | byte[] bstream=result.getBytes("GBK"); //转化为字节流 |
| | | OutputStream os=sck.getOutputStream(); //输出流 |
| | | Socket sck = new Socket(ip, Integer.parseInt(port)); |
| | | byte[] bstream = result.getBytes("GBK"); |
| | | OutputStream os = sck.getOutputStream(); |
| | | os.write(bstream); |
| | | //3.关闭连接 |
| | | // Thread.sleep(1000); |
| | | sck.close(); |
| | | } catch (Exception e1) { |
| | | // TODO Auto-generated catch block |
| | | //e1.printStackTrace(); |
| | | } catch (Exception var22) { |
| | | continue; |
| | | } |
| | | // 保存TCP转发报文 |
| | | |
| | | try { |
| | | String BaowenPath = Config.getBaowenConfig(); |
| | | String baowenStatus = ModifyConfig.readData(BaowenPath, "baowenSwitch"); |
| | | if (baowenStatus.equals("1")){ |
| | | /* Udp_Receive.udpMessage.add("发:"+result); */ |
| | | } |
| | | } catch (Exception e) { |
| | | // TODO Auto-generated catch block |
| | | e.printStackTrace(); |
| | | try { |
| | | BaowenPath = Config.getBaowenConfig(); |
| | | baowenStatus = ModifyConfig.readData(BaowenPath, "baowenSwitch"); |
| | | if (baowenStatus.equals("1")) { |
| | | } |
| | | |
| | | } else if (type.equals("HTTP")) { |
| | | // http/https |
| | | String url = "http://" + ip + ":" + port; |
| | | String str = "{\"result\":\"" + result + "\"}"; |
| | | JSONObject json = JSONObject.fromObject(str); |
| | | HttpUtil.doPost(url, json, "UTF-8"); |
| | | } else if (type.equals("HTTPS")) { |
| | | // http/https |
| | | String url = "https://" + ip + ":" + port; |
| | | String str = "{\"result\":\"" + result + "\"}"; |
| | | JSONObject json = JSONObject.fromObject(str); |
| | | HttpUtil.doPost(url, json, "UTF-8"); |
| | | } catch (Exception var17) { |
| | | var17.printStackTrace(); |
| | | } |
| | | } else { |
| | | JSONObject json; |
| | | if (type.equals("HTTP")) { |
| | | BaowenPath = "http://" + ip + ":" + port; |
| | | baowenStatus = "{\"result\":\"" + result + "\"}"; |
| | | json = JSONObject.fromObject(baowenStatus); |
| | | HttpUtil.doPost(BaowenPath, json, "UTF-8"); |
| | | } else if (type.equals("HTTPS")) { |
| | | BaowenPath = "https://" + ip + ":" + port; |
| | | baowenStatus = "{\"result\":\"" + result + "\"}"; |
| | | json = JSONObject.fromObject(baowenStatus); |
| | | HttpUtil.doPost(BaowenPath, json, "UTF-8"); |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "/saveMessage.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | @RequestMapping( |
| | | value = {"/saveMessage.do"}, |
| | | method = {RequestMethod.POST, RequestMethod.GET} |
| | | ) |
| | | protected void saveMessage(HttpServletRequest request) { |
| | | String data = request.getParameter("data"); |
| | | String[] lines = data.split("\\r?\\n"); |
| | | System.out.println(data); |
| | | int count = 1; |
| | | for (String line : lines) { |
| | | String[] var5 = lines; |
| | | int var6 = lines.length; |
| | | |
| | | for(int var7 = 0; var7 < var6; ++var7) { |
| | | String line = var5[var7]; |
| | | System.out.println("line " + count++ + " : " + line); |
| | | tb_yuan_shi_bao_wen yuanshibaowen = new tb_yuan_shi_bao_wen(); |
| | | String str1=line.substring(0, line.indexOf(":")); |
| | | String str2=line.substring(str1.length()+1, line.length()); |
| | | String str1 = line.substring(0, line.indexOf(":")); |
| | | String str2 = line.substring(str1.length() + 1, line.length()); |
| | | yuanshibaowen.setStr(str2); |
| | | sysSettingService.baowen_add(yuanshibaowen); |
| | | this.sysSettingService.baowen_add(yuanshibaowen); |
| | | } |
| | | |
| | | } |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "/sendMessage.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | @RequestMapping( |
| | | value = {"/sendMessage.do"}, |
| | | method = {RequestMethod.POST, RequestMethod.GET} |
| | | ) |
| | | protected void sendMessage(HttpServletRequest request) throws SocketException, NumberFormatException, UnknownHostException { |
| | | try { |
| | | String ip = request.getParameter("ip"); |
| | |
| | | DatagramPacket packet = null; |
| | | DatagramSocket socket = null; |
| | | InetAddress address = null; |
| | | |
| | | try { |
| | | address = InetAddress.getByName(ip); |
| | | } catch (UnknownHostException e) { |
| | | e.printStackTrace(); |
| | | } catch (UnknownHostException var13) { |
| | | var13.printStackTrace(); |
| | | } |
| | | |
| | | try { |
| | | socket = new DatagramSocket(); |
| | | } catch (SocketException e) { |
| | | e.printStackTrace(); |
| | | } catch (SocketException var12) { |
| | | var12.printStackTrace(); |
| | | } |
| | | |
| | | try { |
| | | packet = new DatagramPacket(content.getBytes(), content.getBytes().length, address, |
| | | Integer.parseInt(port)); |
| | | } catch (Exception e1) { |
| | | // TODO Auto-generated catch block |
| | | e1.printStackTrace(); |
| | | packet = new DatagramPacket(content.getBytes(), content.getBytes().length, address, Integer.parseInt(port)); |
| | | } catch (Exception var11) { |
| | | var11.printStackTrace(); |
| | | } |
| | | |
| | | try { |
| | | socket.send(packet); |
| | | Thread.sleep(100); |
| | | //System.out.print("udp发送成功"); |
| | | |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | Thread.sleep(100L); |
| | | } catch (IOException var10) { |
| | | var10.printStackTrace(); |
| | | } |
| | | |
| | | try { |
| | | |
| | | socket.close(); |
| | | } catch (Exception e) { |
| | | // TODO Auto-generated catch block |
| | | e.printStackTrace(); |
| | | } catch (Exception var9) { |
| | | var9.printStackTrace(); |
| | | } |
| | | } catch (Exception e) { |
| | | // TODO Auto-generated catch block |
| | | e.printStackTrace(); |
| | | } catch (Exception var14) { |
| | | var14.printStackTrace(); |
| | | } |
| | | |
| | | } |
| | | |
| | | @RequestMapping(value = "/startDebug.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | @RequestMapping( |
| | | value = {"/startDebug.do"}, |
| | | method = {RequestMethod.POST, RequestMethod.GET} |
| | | ) |
| | | protected void startDebug(HttpServletRequest request) { |
| | | String filePath = Config.getBaowenConfig(); |
| | | ModifyConfig.writeData(filePath, "debugSwitch", "1"); |
| | | } |
| | | |
| | | @RequestMapping(value = "/stopDebug.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | @RequestMapping( |
| | | value = {"/stopDebug.do"}, |
| | | method = {RequestMethod.POST, RequestMethod.GET} |
| | | ) |
| | | protected void stopDebug(HttpServletRequest request) { |
| | | String filePath = Config.getBaowenConfig(); |
| | | ModifyConfig.writeData(filePath, "debugSwitch", "0"); |
| | | } |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "/sysSetting_bw.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | @RequestMapping( |
| | | value = {"/sysSetting_bw.do"}, |
| | | method = {RequestMethod.POST, RequestMethod.GET} |
| | | ) |
| | | public String sysSetting_bw(HttpServletRequest request) { |
| | | JSONObject json = new JSONObject(); |
| | | List<tb_system> settingList = sysSettingService.getSetting(); |
| | | List<tb_system> settingList = this.sysSettingService.getSetting(); |
| | | json.put("result", settingList.get(0)); |
| | | return json.toString(); |
| | | } |
| | | |
| | | // @ResponseBody |
| | | // @RequestMapping(value = "/backup.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | // public String backup(HttpServletRequest request) { |
| | | // String name = DateUtil.formatDate(new Date(),"yyyyMMddHHmmss"); |
| | | // String filePath = request.getServletContext().getRealPath("/")+"backup\\"; |
| | | // File uploadDir = new File(filePath); |
| | | // if(!uploadDir.exists()){//如果文件夹不存在 |
| | | // uploadDir.mkdir();//创建文件夹 |
| | | // } |
| | | // String mysqlDumpPath = Config.getMysqlDumpPath(); |
| | | // String database =sysSettingService.getSetting().get(0).getDataname(); |
| | | // String password = sysSettingService.getSetting().get(0).getDatapass(); |
| | | // String cmd = "cmd /c "+ mysqlDumpPath + " -uroot" + " -p" + password + " " + database + " > " |
| | | // + filePath + database + "_" + name + ".sql"; |
| | | // //System.out.print(cmd); |
| | | // |
| | | // //执行备份命令 |
| | | // try { |
| | | // Runtime.getRuntime().exec(cmd); |
| | | // } catch (Exception ex) { |
| | | // return ex.getMessage(); |
| | | // } |
| | | // return filePath; |
| | | // } |
| | | |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "/backup.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | @RequestMapping( |
| | | value = {"/backup.do"}, |
| | | method = {RequestMethod.POST, RequestMethod.GET} |
| | | ) |
| | | public String backup(HttpServletRequest request) { |
| | | String name = DateUtil.formatDate(new Date(),"yyyyMMddHHmmss"); |
| | | String savePath = "d:\\" + name + ".sql"; |
| | | String host = Config.getMysqlHost(); |
| | | String port = Config.getMysqlPort(); |
| | | String database =sysSettingService.getSetting().get(0).getDataname(); |
| | | String password = sysSettingService.getSetting().get(0).getDatapass(); |
| | | String cmd ="mysqldump -h "+host+" -P "+ port+ " -uroot" + " -p" + password + " " + database; |
| | | //System.out.print(cmd); |
| | | return savePath; |
| | | String name = DateUtil.formatDate(new Date(), "yyyyMMddHHmmss"); |
| | | String savePath = "d:\\" + name + ".sql"; |
| | | String host = Config.getMysqlHost(); |
| | | String port = Config.getMysqlPort(); |
| | | String database = ((tb_system)this.sysSettingService.getSetting().get(0)).getDataname(); |
| | | String password = ((tb_system)this.sysSettingService.getSetting().get(0)).getDatapass(); |
| | | (new StringBuilder()).append("mysqldump -h ").append(host).append(" -P ").append(port).append(" -uroot -p").append(password).append(" ").append(database).toString(); |
| | | return savePath; |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "/recovery.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | @RequestMapping( |
| | | value = {"/recovery.do"}, |
| | | method = {RequestMethod.POST, RequestMethod.GET} |
| | | ) |
| | | public String recovery(HttpServletRequest request) throws IOException { |
| | | String fileName = request.getParameter("filename"); |
| | | if (fileName != ""){ |
| | | String recoverPath ="d:\\"+fileName; |
| | | String database =sysSettingService.getSetting().get(0).getDataname(); |
| | | String password = sysSettingService.getSetting().get(0).getDatapass(); |
| | | String host = Config.getMysqlHost(); |
| | | String port = Config.getMysqlPort(); |
| | | String cmd = "mysql -h "+host+" -P "+port+ " -uroot" + " -p" + password + " " + database; |
| | | //System.out.print(cmd); |
| | | boolean b2 = new DatabaseUtil().recover(cmd, recoverPath); |
| | | return String.valueOf(b2); |
| | | if (fileName != "") { |
| | | String recoverPath = "d:\\" + fileName; |
| | | String database = ((tb_system)this.sysSettingService.getSetting().get(0)).getDataname(); |
| | | String password = ((tb_system)this.sysSettingService.getSetting().get(0)).getDatapass(); |
| | | String host = Config.getMysqlHost(); |
| | | String port = Config.getMysqlPort(); |
| | | String cmd = "mysql -h " + host + " -P " + port + " -uroot -p" + password + " " + database; |
| | | boolean b2 = (new DatabaseUtil()).recover(cmd, recoverPath); |
| | | return String.valueOf(b2); |
| | | } else { |
| | | return "0"; |
| | | } |
| | | |
| | | } |
| | | |
| | | @RequestMapping(value = "/systemDebug.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | |
| | | @RequestMapping( |
| | | value = {"/systemDebug.do"}, |
| | | method = {RequestMethod.POST, RequestMethod.GET} |
| | | ) |
| | | public String systemDebug(HttpServletRequest request) { |
| | | String toPage = "forward:/hxzk/sysSetting/systemDebug.jsp"; |
| | | List<tb_tag> labelList = sysSettingService.getLabel(); |
| | | List<tb_tag> labelList = this.sysSettingService.getLabel(); |
| | | request.setAttribute("labelList", labelList); |
| | | return toPage; |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "/shiyan.do", method = { RequestMethod.POST, RequestMethod.GET }) |
| | | @RequestMapping( |
| | | value = {"/shiyan.do"}, |
| | | method = {RequestMethod.POST, RequestMethod.GET} |
| | | ) |
| | | public void shiyan(HttpServletRequest request) throws IOException { |
| | | String jsonString = RequestUtils.getRequestJsonString(request, Config.getCharset()); |
| | | //System.out.print(jsonString); |
| | | //System.out.print("执行了"); |
| | | } |
| | | } |