From 24e1c6a1c3d5331b5a4f1111dcbae3ef148eda1a Mon Sep 17 00:00:00 2001
From: yzt <Xynz17@163.com>
Date: 星期一, 08 五月 2023 12:08:12 +0800
Subject: [PATCH] BS版本 1.20
---
src/main/java/com/hxzkoa/controller/ShowController.java | 421 ++++++++++++++++++++++++++++-----------------------
1 files changed, 230 insertions(+), 191 deletions(-)
diff --git a/src/main/java/com/hxzkoa/controller/ShowController.java b/src/main/java/com/hxzkoa/controller/ShowController.java
index 805c5b0..45b5fca 100644
--- a/src/main/java/com/hxzkoa/controller/ShowController.java
+++ b/src/main/java/com/hxzkoa/controller/ShowController.java
@@ -1,40 +1,46 @@
+//
+// 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 org.hibernate.dialect.function.VarArgsSQLFunction;
+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;
-import com.hxzkoa.json.tb_achor;
-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.json.vo_kaoqin_p;
-import com.hxzkoa.services.AnchorService;
-import com.hxzkoa.services.AttendanceService;
-import com.hxzkoa.services.LabelService;
-import com.hxzkoa.services.SysSettingService;
-import com.hxzkoa.services.WarningService;
-/*import com.hxzkoa.udp.Udp_Receive;*/
-import com.hxzkoa.util.Config;
-import com.hxzkoa.util.HttpUtil;
-import com.hxzkoa.util.ModifyConfig;
-
-import net.sf.json.JSONObject;
-
@Controller
public class ShowController {
@Autowired
@@ -47,154 +53,143 @@
private WarningService warningService;
@Autowired
private SysSettingService sysSettingService;
-
- /* Udp_Receive receive; */
-
- // 娓呯┖鏂囦欢鍐呭
+ @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);
}
- System.out.println("file"+file);
+
+ System.out.println("file" + file);
FileWriter fileWriter = new FileWriter(file);
fileWriter.write("");
fileWriter.flush();
fileWriter.close();
- } catch (IOException e) {
- e.printStackTrace();
+ } catch (IOException var4) {
+ var4.printStackTrace();
}
+
}
-
- @RequestMapping(value = "/show.do", method = { RequestMethod.POST, RequestMethod.GET })
+ @RequestMapping(
+ value = {"/show.do"},
+ method = {RequestMethod.POST, RequestMethod.GET}
+ )
public String show(HttpServletRequest request) {
-// tb_system system = new tb_system();
-// system.setUdpPort("8234");
-// JSONObject jsonObject = JSONObject.fromObject(system);
-// String postUrl = Config.getPostUrl();
-// String url_setting_bw = postUrl + "getSysSetting.do";
-// JSONObject re_tb_setting = HttpUtil.doPost(url_setting_bw, jsonObject.toString(), "UTF-8");
-// tb_system re_setting = (tb_system) JSONObject.toBean(JSONObject.fromObject(re_tb_setting.get("result").toString()),
-// tb_system.class);
-// String port = re_setting.getUdpPort();
-// // 寮�鍚姤鏂囨帴鏀�
-// try {
-// receive = new Udp_Receive(port);
-// } catch (Exception e) {
-// e.printStackTrace();
-// }
-// if (Config.getUdpRunning().equals("1")) {
-// try {
-// receive.startThread();
-// } catch (Exception e) {
-// e.printStackTrace();
-// }
-// }
+ HttpSession session = request.getSession();
String toPage = "forward:/hxzk/index.jsp";
- // 鍩虹珯淇℃伅
- List<tb_achor> anchorManagementList = anchorService.getAnchorManagementsi();
-// List<tb_shebei> shebei = anchorService.getShebei();
- /*
- * List<tb_achor> reAnchorManagementList = new ArrayList<tb_achor>(); if
- * (anchorManagementList.size()>5){ for (int i = 0; i < 5; i++) { String time
- * =anchorManagementList.get(i).getGreateTime(); time = time.split(" ")[1];
- * anchorManagementList.get(i).setGreateTime(time);
- * reAnchorManagementList.add(anchorManagementList.get(i)); } } else { for (int
- * i = 0; i < anchorManagementList.size(); i++) { String time
- * =anchorManagementList.get(i).getGreateTime(); time = time.split(" ")[1];
- * anchorManagementList.get(i).setGreateTime(time);
- * reAnchorManagementList.add(anchorManagementList.get(i)); } }
- */
-
- // 鏍囩淇℃伅
- List<tb_tag> labelManagementList = labelService.getLabelManagement(1);
- List<tb_tag> reLabelManagementList = new ArrayList<tb_tag>();
- if (labelManagementList.size()>6){
- for (int i = 0; i < 6; i++) {
- String time =labelManagementList.get(i).getAddtime();
+ 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<tb_achor> anchorManagementList = this.anchorService.getAnchorManagementsi();
+ List<tb_tag> labelManagementList = this.labelService.getLabelManagement(1);
+ List<tb_tag> 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];
- labelManagementList.get(i).setAddtime(time);
+ ((tb_tag)labelManagementList.get(i)).setAddtime(time);
reLabelManagementList.add(labelManagementList.get(i));
}
} else {
- for (int i = 0; i < labelManagementList.size(); i++) {
- String time =labelManagementList.get(i).getAddtime();
+ for(i = 0; i < labelManagementList.size(); ++i) {
+ time = ((tb_tag)labelManagementList.get(i)).getAddtime();
time = time.split(" ")[1];
- labelManagementList.get(i).setAddtime(time);
+ ((tb_tag)labelManagementList.get(i)).setAddtime(time);
reLabelManagementList.add(labelManagementList.get(i));
}
}
- // 瀹炴椂鑰冨嫟
- List<vo_kaoqin_p> realAttendanceList = attendanceService.getRealAttendance(1);
- List<vo_kaoqin_p> reRealAttendanceList = new ArrayList<vo_kaoqin_p>();
- if (realAttendanceList.size()>4){
- for (int i = 0; i < 4; i++) {
- String time =realAttendanceList.get(i).getIntime();
- time = time.split(" ")[1];
- time = time.split("\\.")[0];
- realAttendanceList.get(i).setIntime(time);
- reRealAttendanceList.add(realAttendanceList.get(i));
- }
- } else {
- for (int i = 0; i < realAttendanceList.size(); i++) {
- String time =realAttendanceList.get(i).getIntime();
- time = time.split(" ")[1];
- time = time.split("\\.")[0];
- realAttendanceList.get(i).setIntime(time);
- reRealAttendanceList.add(realAttendanceList.get(i));
- }
- }
-
- // 鍛婅姹囨��
- Map warningSummaryTypeMap = warningService.getWarningSummaryType();
- List<String> reWarningSummary_k = new ArrayList<String>();
- List<Integer> reWarningSummary_v = new ArrayList<Integer>();
+ Map warningSummaryTypeMap = this.warningService.getWarningSummaryType();
+ List<String> reWarningSummary_k = new ArrayList();
+ List<Integer> reWarningSummary_v = new ArrayList();
Iterator<String> warningSummaryTypeIter = warningSummaryTypeMap.keySet().iterator();
- while (warningSummaryTypeIter.hasNext()) {
- String key = warningSummaryTypeIter.next();
+
+ while(warningSummaryTypeIter.hasNext()) {
+ String key = (String)warningSummaryTypeIter.next();
reWarningSummary_k.add(key);
- reWarningSummary_v.add((int) warningSummaryTypeMap.get(key));
+ reWarningSummary_v.add((Integer)warningSummaryTypeMap.get(key));
}
- // 鐜板満宸ョ
- 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> dapartments = this.basicInfoService.getDepartmentManagement();
+ List<String> realAttendance_k = new ArrayList();
+ List<Integer> 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);
}
- // 缁熻鏁版嵁
- Map realtongjiTypeMap = attendanceService.getRealtongjiType();
- List<String> realtongji_k = new ArrayList<String>();
- List<Integer> realtongji_v = new ArrayList<Integer>();
- Iterator<String> realtongjiTypeIter = realtongjiTypeMap.keySet().iterator();
- while (realtongjiTypeIter.hasNext()) {
- String key = realtongjiTypeIter.next();
- realtongji_k.add(key);
- realtongji_v.add((int) realtongjiTypeMap.get(key));
- }
- // 绯荤粺璁剧疆
- List<tb_system> systemlist = sysSettingService.getSetting();
- // 瀹炴椂鏁版嵁
-// Map realshishiTypeMap = attendanceService.getRealshishiType();
-// List<String> realshishi_k = new ArrayList<String>();
-// List<Integer> realshishi_v = new ArrayList<Integer>();
-// Iterator<String> realshishiTypeIter = realshishiTypeMap.keySet().iterator();
-// while (realshishiTypeIter.hasNext()) {
-// String key = realshishiTypeIter.next();
-// realshishi_k.add(key);
-// realshishi_v.add((int) realshishiTypeMap.get(key));
-// }
-// request.setAttribute("shebei", shebei);
+
+ List<Object> shishilist = this.attendanceService.gettongjishuju();
+ List<String> realtongji_k = (List)shishilist.get(0);
+ List<String> realtongji_v = (List)shishilist.get(1);
+ List<tb_system> systemlist = this.sysSettingService.getSetting();
+ List<tb_person> persons = this.zhwService.getbumen();
+ request.setAttribute("persons", persons);
request.setAttribute("anchorManagementList", anchorManagementList);
request.setAttribute("labelManagementList", reLabelManagementList);
- request.setAttribute("realAttendanceList", reRealAttendanceList);
request.setAttribute("reWarningSummary_k", reWarningSummary_k);
request.setAttribute("reWarningSummary_v", reWarningSummary_v);
request.setAttribute("realAttendance_k", realAttendance_k);
@@ -202,92 +197,136 @@
request.setAttribute("realtongji_k", realtongji_k);
request.setAttribute("realtongji_v", realtongji_v);
request.setAttribute("systemlist", systemlist);
-// request.setAttribute("realshishi_k", realshishi_k);
-// request.setAttribute("realshishi_v", realshishi_v);
-
- //鍒濆鍖栭厤缃枃浠�
File file = new File(Config.getBaowenConfig());
- if (!file.exists()){
+ if (!file.exists()) {
try {
file.createNewFile();
- } catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
+ } catch (IOException var26) {
+ var26.printStackTrace();
}
}
+
File file2 = new File(Config.getMapConfig());
- if (!file2.exists()){
+ if (!file2.exists()) {
try {
file2.createNewFile();
- } catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
+ } catch (IOException var25) {
+ var25.printStackTrace();
}
}
+
String filePath = Config.getBaowenConfig();
ModifyConfig.writeData(filePath, "baowenSwitch", "0");
- System.out.print(filePath);
ModifyConfig.writeData(filePath, "debugSwitch", "0");
- clearInfoForFile(request.getServletContext().getRealPath("/")+Config.getYuanshiMessagePath());
- clearInfoForFile(request.getServletContext().getRealPath("/")+Config.getHEXMessagePath());
- clearInfoForFile(request.getServletContext().getRealPath("/")+Config.getGasMessagePath());
- clearInfoForFile(request.getServletContext().getRealPath("/")+Config.getTCPMessagePath());
- clearInfoForFile(request.getServletContext().getRealPath("/")+Config.getUDPMessagePath());
- clearInfoForFile(request.getServletContext().getRealPath("/")+Config.getZhuceMessagePath());
- clearInfoForFile(request.getServletContext().getRealPath("/")+Config.getDebugMessagePath());
- clearInfoForFile(request.getServletContext().getRealPath("/")+Config.getMessagePath());
+ 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 })
+
+ @RequestMapping(
+ value = {"/setshow.do"},
+ method = {RequestMethod.POST, RequestMethod.GET}
+ )
@ResponseBody
public List<tb_shishi> setshow(HttpServletRequest request) {
- // 瀹炴椂鏁版嵁
- List<tb_shishi> shishilist = attendanceService.getRealshishiType();
+ List<tb_shishi> shishilist = this.attendanceService.getRealshishiType();
return shishilist;
}
-
- @RequestMapping(value = "/setweizhi.do", method = { RequestMethod.POST, RequestMethod.GET })
+
+ @RequestMapping(
+ value = {"/setweizhi.do"},
+ method = {RequestMethod.POST, RequestMethod.GET}
+ )
@ResponseBody
public String setweizhi(HttpServletRequest request) {
- // 瀹炴椂鏁版嵁
- List<tb_shishi> shishilist = attendanceService.getRealshishiType();
- String weizhi = shishilist.get(0).getNum();
+ List<tb_shishi> shishilist = this.attendanceService.getRealshishiType();
+ String weizhi = ((tb_shishi)shishilist.get(0)).getNum();
return weizhi;
}
-
- @RequestMapping(value = "/setshebei.do", method = { RequestMethod.POST, RequestMethod.GET })
+
+ @RequestMapping(value = {"/setshebei.do"}, method = {RequestMethod.POST, RequestMethod.GET}
+ )
@ResponseBody
public List<tb_shebei> setshebei(HttpServletRequest request) {
- // 璁惧鏁版嵁
- List<tb_shebei> achorlist = anchorService.getjizhanshebei();
- List<tb_shebei> taglist = anchorService.getbiaoqianshebei();
- for(int i = 0;i <taglist.size();i++) {
- achorlist.add(taglist.get(i));
- }
+ List<tb_shebei> achorlist = this.anchorService.getjizhanshebei();
+// List<tb_shebei> 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 })
+
+ @RequestMapping(
+ value = {"/settongjishuju.do"},
+ method = {RequestMethod.POST, RequestMethod.GET}
+ )
@ResponseBody
public List<Object> settongjishuju(HttpServletRequest request) {
- List<Object> shishilist = attendanceService.gettongjishuju();
+ List<Object> shishilist = this.attendanceService.gettongjishuju();
return shishilist;
}
-
- @RequestMapping(value = "/setgongzhongnum.do", method = { RequestMethod.POST, RequestMethod.GET })
+
+ @RequestMapping(
+ value = {"/setgongzhongnum.do"},
+ method = {RequestMethod.POST, RequestMethod.GET}
+ )
@ResponseBody
- public List<Integer> setgongzhongnum(){
- List<Integer> gongzhongnum = attendanceService.getgongzhongnum();
+ public List<Object> setgongzhongnum() {
+ List<Object> gongzhongnum = new ArrayList();
+ List<tb_department> dapartments = this.basicInfoService.getDepartmentManagement();
+ List<String> gongzhongk = new ArrayList();
+ List<Integer> 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 })
+
+ @RequestMapping(
+ value = {"/setgaojingnum.do"},
+ method = {RequestMethod.POST, RequestMethod.GET}
+ )
@ResponseBody
- public List<Integer> setgaojingnum(){
- List<Integer> gaojingnum = attendanceService.getgaojingnum();
- return gaojingnum;
+ public JSONObject setgaojingnum() {
+ JSONObject jsons = new JSONObject();
+ Map warningSummaryTypeMap = this.warningService.getWarningSummaryType();
+ List<String> reWarningSummary_k = new ArrayList();
+ List<Integer> reWarningSummary_v = new ArrayList();
+ Iterator<String> 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;
+ }
}
--
Gitblit v1.10.0