// // Source code recreated from a .class file by IntelliJ IDEA // (powered by FernFlower decompiler) // package com.hxzkoa.controller; import com.hxzkoa.json.tb_achor; import com.hxzkoa.json.tb_department; import com.hxzkoa.json.tb_login; import com.hxzkoa.json.tb_person; import com.hxzkoa.json.tb_shebei; import com.hxzkoa.json.tb_shishi; import com.hxzkoa.json.tb_system; import com.hxzkoa.json.tb_tag; import com.hxzkoa.services.AnchorService; import com.hxzkoa.services.AttendanceService; import com.hxzkoa.services.BasicInfoService; import com.hxzkoa.services.LabelService; import com.hxzkoa.services.LoginService; import com.hxzkoa.services.SysSettingService; import com.hxzkoa.services.WarningService; import com.hxzkoa.services.ZhwService; import com.hxzkoa.util.Config; import com.hxzkoa.util.ModifyConfig; import java.io.File; import java.io.FileWriter; import java.io.IOException; import java.net.InetAddress; import java.net.UnknownHostException; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.Map; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession; import net.sf.json.JSONObject; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; @Controller public class ShowController { @Autowired private AnchorService anchorService; @Autowired private LabelService labelService; @Autowired private AttendanceService attendanceService; @Autowired private WarningService warningService; @Autowired private SysSettingService sysSettingService; @Autowired private LoginService loginService; @Autowired private ZhwService zhwService; @Autowired private BasicInfoService basicInfoService; public ShowController() { } public void clearInfoForFile(String fileName) { File file = new File(fileName); try { if (!file.exists()) { file.createNewFile(); System.out.println("file" + file); } System.out.println("file" + file); FileWriter fileWriter = new FileWriter(file); fileWriter.write(""); fileWriter.flush(); fileWriter.close(); } catch (IOException var4) { var4.printStackTrace(); } } @RequestMapping( value = {"/show.do"}, method = {RequestMethod.POST, RequestMethod.GET} ) public String show(HttpServletRequest request) { HttpSession session = request.getSession(); String toPage = "forward:/hxzk/index.jsp"; String ip = request.getHeader("x-forwarded-for"); request.setAttribute("personListRight", this.zhwService.getRight(1)); if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { ip = request.getHeader("X-Real-IP"); } if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { ip = request.getHeader("X-Forwarded-For"); } if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { ip = request.getHeader("Proxy-Client-IP"); } if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { ip = request.getHeader("WL-Proxy-Client-IP"); } if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { ip = request.getHeader("HTTP_CLIENT_IP"); } if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { ip = request.getHeader("HTTP_X_FORWARDED_FOR"); } if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { ip = request.getRemoteAddr(); if (ip.equals("127.0.0.1") || ip.equals("0:0:0:0:0:0:0:1")) { InetAddress inet = null; try { inet = InetAddress.getLocalHost(); } catch (UnknownHostException var27) { var27.printStackTrace(); } ip = inet.getHostAddress(); } } if (ip != null && ip.length() > 15 && ip.indexOf(",") > 0) { ip = ip.substring(0, ip.indexOf(",")); } String username = (String)session.getAttribute("username"); tb_login login = new tb_login(); login.setIp(ip); login.setUsername(username); this.loginService.login_add(login); List anchorManagementList = this.anchorService.getAnchorManagementsi(); List labelManagementList = this.labelService.getLabelManagement(1); List reLabelManagementList = new ArrayList(); int i; String time; if (labelManagementList.size() > 6) { for(i = 0; i < 6; ++i) { time = ((tb_tag)labelManagementList.get(i)).getAddtime(); time = time.split(" ")[1]; ((tb_tag)labelManagementList.get(i)).setAddtime(time); reLabelManagementList.add(labelManagementList.get(i)); } } else { for(i = 0; i < labelManagementList.size(); ++i) { time = ((tb_tag)labelManagementList.get(i)).getAddtime(); time = time.split(" ")[1]; ((tb_tag)labelManagementList.get(i)).setAddtime(time); reLabelManagementList.add(labelManagementList.get(i)); } } Map warningSummaryTypeMap = this.warningService.getWarningSummaryType(); List reWarningSummary_k = new ArrayList(); List reWarningSummary_v = new ArrayList(); Iterator warningSummaryTypeIter = warningSummaryTypeMap.keySet().iterator(); while(warningSummaryTypeIter.hasNext()) { String key = (String)warningSummaryTypeIter.next(); reWarningSummary_k.add(key); reWarningSummary_v.add((Integer)warningSummaryTypeMap.get(key)); } List dapartments = this.basicInfoService.getDepartmentManagement(); List realAttendance_k = new ArrayList(); List realAttendance_v = new ArrayList(); for(int k = 0; k < dapartments.size(); ++k) { int num = this.labelService.getdepartmentCount2(((tb_department)dapartments.get(k)).getDepartmentName()); realAttendance_k.add(((tb_department)dapartments.get(k)).getDepartmentName()); realAttendance_v.add(num); } List shishilist = this.attendanceService.gettongjishuju(); List realtongji_k = (List)shishilist.get(0); List realtongji_v = (List)shishilist.get(1); List systemlist = this.sysSettingService.getSetting(); List persons = this.zhwService.getbumen(); request.setAttribute("persons", persons); request.setAttribute("anchorManagementList", anchorManagementList); request.setAttribute("labelManagementList", reLabelManagementList); request.setAttribute("reWarningSummary_k", reWarningSummary_k); request.setAttribute("reWarningSummary_v", reWarningSummary_v); request.setAttribute("realAttendance_k", realAttendance_k); request.setAttribute("realAttendance_v", realAttendance_v); request.setAttribute("realtongji_k", realtongji_k); request.setAttribute("realtongji_v", realtongji_v); request.setAttribute("systemlist", systemlist); File file = new File(Config.getBaowenConfig()); if (!file.exists()) { try { file.createNewFile(); } catch (IOException var26) { var26.printStackTrace(); } } File file2 = new File(Config.getMapConfig()); if (!file2.exists()) { try { file2.createNewFile(); } catch (IOException var25) { var25.printStackTrace(); } } String filePath = Config.getBaowenConfig(); ModifyConfig.writeData(filePath, "baowenSwitch", "0"); ModifyConfig.writeData(filePath, "debugSwitch", "0"); this.clearInfoForFile(request.getServletContext().getRealPath("/") + Config.getYuanshiMessagePath()); this.clearInfoForFile(request.getServletContext().getRealPath("/") + Config.getHEXMessagePath()); this.clearInfoForFile(request.getServletContext().getRealPath("/") + Config.getGasMessagePath()); this.clearInfoForFile(request.getServletContext().getRealPath("/") + Config.getTCPMessagePath()); this.clearInfoForFile(request.getServletContext().getRealPath("/") + Config.getUDPMessagePath()); this.clearInfoForFile(request.getServletContext().getRealPath("/") + Config.getZhuceMessagePath()); this.clearInfoForFile(request.getServletContext().getRealPath("/") + Config.getDebugMessagePath()); this.clearInfoForFile(request.getServletContext().getRealPath("/") + Config.getMessagePath()); return toPage; } @RequestMapping( value = {"/setshow.do"}, method = {RequestMethod.POST, RequestMethod.GET} ) @ResponseBody public List setshow(HttpServletRequest request) { List shishilist = this.attendanceService.getRealshishiType(); return shishilist; } @RequestMapping( value = {"/setweizhi.do"}, method = {RequestMethod.POST, RequestMethod.GET} ) @ResponseBody public String setweizhi(HttpServletRequest request) { List shishilist = this.attendanceService.getRealshishiType(); String weizhi = ((tb_shishi)shishilist.get(0)).getNum(); return weizhi; } @RequestMapping(value = {"/setshebei.do"}, method = {RequestMethod.POST, RequestMethod.GET} ) @ResponseBody public List setshebei(HttpServletRequest request) { List achorlist = this.anchorService.getjizhanshebei(); // List taglist = this.anchorService.getbiaoqianshebei2(); // for(int i = 0; i < taglist.size(); ++i) { // achorlist.add(taglist.get(i)); // } return achorlist; } @RequestMapping( value = {"/settongjishuju.do"}, method = {RequestMethod.POST, RequestMethod.GET} ) @ResponseBody public List settongjishuju(HttpServletRequest request) { List shishilist = this.attendanceService.gettongjishuju(); return shishilist; } @RequestMapping( value = {"/setgongzhongnum.do"}, method = {RequestMethod.POST, RequestMethod.GET} ) @ResponseBody public List setgongzhongnum() { List gongzhongnum = new ArrayList(); List dapartments = this.basicInfoService.getDepartmentManagement(); List gongzhongk = new ArrayList(); List gongzhong = new ArrayList(); for(int i = 0; i < dapartments.size(); ++i) { int num = this.labelService.getdepartmentCount2(((tb_department)dapartments.get(i)).getDepartmentName()); gongzhongk.add(((tb_department)dapartments.get(i)).getDepartmentName()); gongzhong.add(num); } gongzhongnum.add(gongzhongk); gongzhongnum.add(gongzhong); return gongzhongnum; } @RequestMapping( value = {"/setgaojingnum.do"}, method = {RequestMethod.POST, RequestMethod.GET} ) @ResponseBody public JSONObject setgaojingnum() { JSONObject jsons = new JSONObject(); Map warningSummaryTypeMap = this.warningService.getWarningSummaryType(); List reWarningSummary_k = new ArrayList(); List reWarningSummary_v = new ArrayList(); Iterator warningSummaryTypeIter = warningSummaryTypeMap.keySet().iterator(); while(warningSummaryTypeIter.hasNext()) { String key = (String)warningSummaryTypeIter.next(); reWarningSummary_k.add(key); reWarningSummary_v.add((Integer)warningSummaryTypeMap.get(key)); } jsons.put("key", reWarningSummary_k); jsons.put("value", reWarningSummary_v); return jsons; } @ResponseBody @RequestMapping( value = {"RenYuanXianShi.do"}, method = {RequestMethod.POST, RequestMethod.GET} ) public List selectRenYuan(HttpServletRequest request) { String tagid = request.getParameter("tagid"); List ry = this.zhwService.selectRenYuan(tagid); return ry; } }