package com.hxzkoa.controller;
|
|
import java.io.FileOutputStream;
|
import java.io.IOException;
|
import java.io.OutputStream;
|
import java.util.ArrayList;
|
import java.util.List;
|
|
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletResponse;
|
|
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_historyinwarning;
|
import com.hxzkoa.json.tb_jobhistory;
|
import com.hxzkoa.json.tb_lixianrecord;
|
import com.hxzkoa.json.tb_message_history;
|
import com.hxzkoa.json.tb_permission;
|
import com.hxzkoa.json.tb_person;
|
import com.hxzkoa.json.tb_realinwarning;
|
import com.hxzkoa.json.tb_realkaoqing;
|
import com.hxzkoa.json.tb_tag;
|
import com.hxzkoa.json.tb_warning;
|
import com.hxzkoa.services.LabelService;
|
import com.hxzkoa.services.WarningService;
|
import com.hxzkoa.udp.GetNowTime;
|
import com.hxzkoa.udp.Udp_Out;
|
/*import com.hxzkoa.udp.Udp_Receive;*/
|
import com.hxzkoa.util.Config;
|
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 WarningController {
|
@Autowired
|
private WarningService warningService;
|
@Autowired
|
private LabelService labelService;
|
|
@RequestMapping(value = "/warningSummary.do", method = { RequestMethod.POST, RequestMethod.GET })
|
public String warningSummary(HttpServletRequest request) {
|
String toPage = "forward:/hxzk/warning/warningSummary.jsp";
|
List<tb_warning> warningSummaryList = warningService.getWarningSummary(1);
|
request.setAttribute("warningSummaryList", warningSummaryList);
|
int curPage = 1;
|
int count = warningService.getWarningSummaryCount();
|
int minPage = PageUtil.getMinPage(count);
|
request.setAttribute("pageList", PageUtil.getPage(minPage));
|
request.setAttribute("curPage", curPage);
|
return toPage;
|
}
|
|
@ResponseBody
|
@RequestMapping(value = "/warningSummarya.do", method = { RequestMethod.POST, RequestMethod.GET })
|
public JSONObject warningSummarya(HttpServletRequest request) {
|
JSONObject json = new JSONObject();
|
List<tb_warning> warningSummaryList = warningService.getWarningSummarya();
|
json.put("dataList", warningSummaryList);
|
return json;
|
}
|
|
@ResponseBody
|
@RequestMapping(value = "/warningSummary_search.do", method = { RequestMethod.POST, RequestMethod.GET })
|
public String warningSummary_search(HttpServletRequest request) throws IOException {
|
JSONObject json = new JSONObject();
|
String input = request.getParameter("input");
|
if (("").equals(input) || input == null) {
|
String jsonString = RequestUtils.getRequestJsonString(request, Config.getCharset());
|
tb_tag tag = (tb_tag) JSONObject.toBean(JSONObject.fromObject(jsonString), tb_tag.class);
|
input = tag.getTag_id();
|
List<tb_warning> warningSummaryList = warningService.searchWarningSummary(input);
|
if (warningSummaryList.size()>0){
|
json.put("result", warningSummaryList.get(0));
|
} else {
|
json.put("result", "null");
|
}
|
} else {
|
int curPage = 1;
|
List<Integer> pageList = new ArrayList<Integer>();
|
List<tb_warning> warningSummaryList = warningService.searchWarningSummary(input);
|
pageList.add(1);
|
json.put("dataList", warningSummaryList);
|
json.put("pageList", pageList);
|
json.put("curPage", curPage);
|
}
|
return json.toString();
|
}
|
|
@ResponseBody
|
@RequestMapping(value = "/warningSummary_searcha.do", method = { RequestMethod.POST, RequestMethod.GET })
|
public JSONObject warningSummary_searcha(HttpServletRequest request) throws IOException {
|
JSONObject json = new JSONObject();
|
String input = request.getParameter("tagid");
|
if (("").equals(input) || input == null) {
|
String jsonString = RequestUtils.getRequestJsonString(request, Config.getCharset());
|
tb_tag tag = (tb_tag) JSONObject.toBean(JSONObject.fromObject(jsonString), tb_tag.class);
|
input = tag.getTag_id();
|
List<tb_warning> warningSummaryList = warningService.searchWarningSummary(input);
|
if (warningSummaryList.size()>0){
|
json.put("result", warningSummaryList.get(0));
|
} else {
|
json.put("result", "null");
|
}
|
} else {
|
List<tb_warning> warningSummaryList = warningService.searchWarningSummary(input);
|
json.put("dataList", warningSummaryList);
|
}
|
return json;
|
}
|
|
@ResponseBody
|
@RequestMapping(value = "/warningSummary_page.do", method = { RequestMethod.POST, RequestMethod.GET })
|
public String warningSummary_page(HttpServletRequest request) {
|
String pageStr = request.getParameter("page");
|
String curPageStr = request.getParameter("curPage");
|
int count = warningService.getWarningSummaryCount();
|
int minPage = PageUtil.getMinPage(count);
|
int curPage = Integer.parseInt(curPageStr);
|
int page = 1;
|
if ("pre".equals(pageStr)) {
|
if (curPage > 1) {
|
page = curPage - 1;
|
}
|
} else if ("next".equals(pageStr)) {
|
if (curPage < minPage) {
|
page = curPage + 1;
|
}
|
} else {
|
page = Integer.parseInt(pageStr);
|
}
|
List<tb_warning> labelManagementList = warningService.getWarningSummary(page);
|
List<Integer> pageList = PageUtil.getPage(PageUtil.getLocPage(page, curPage), page, minPage);
|
JSONObject json = new JSONObject();
|
json.put("dataList", labelManagementList);
|
json.put("pageList", pageList);
|
json.put("curPage", page);
|
return json.toString();
|
}
|
|
@ResponseBody
|
@RequestMapping(value = "/warningSummary_export.do", method = { RequestMethod.POST, RequestMethod.GET })
|
public String warningSummary_export(HttpServletRequest request, HttpServletResponse response) {
|
String toPage = "forward:/hxzk/label/labelManagement.jsp";
|
List<tb_warning> tb_warningList = warningService.getWarningSummary();
|
String[] rowName = { "序号", "警告类型", "设备ID", "处理情况", "更新时间" };
|
List<Object[]> dataList = objectToArray_warningSummary(tb_warningList);
|
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();
|
excel.export(out);
|
out.flush();
|
out.close();
|
} catch (Exception e) {
|
e.printStackTrace();
|
}
|
return toPage;
|
}
|
|
// tb_warning 导出表格 对象转数组
|
public static List<Object[]> objectToArray_warningSummary(List<tb_warning> tb_warningList) {
|
List<Object[]> reList = new ArrayList<>();
|
for (int i = 0; i < tb_warningList.size(); i++) {
|
List<String> words = new ArrayList<String>();
|
tb_warning warn = (tb_warning) tb_warningList.get(i);
|
words.add(warn.getId() + "");
|
words.add(warn.getType());
|
words.add(warn.getObjectid());
|
words.add(warn.getStatus());
|
words.add(warn.getTime());
|
String[] array = words.toArray(new String[0]);
|
reList.add(array);
|
}
|
return reList;
|
}
|
|
@RequestMapping(value = "/realTimeWarning.do", method = { RequestMethod.POST, RequestMethod.GET })
|
public String realTimeWarning(HttpServletRequest request) {
|
String toPage = "forward:/hxzk/warning/realTimeWarning.jsp";
|
List<tb_realinwarning> realTimeWarningList = warningService.getRealinWarning(1);
|
request.setAttribute("realTimeWarningList", realTimeWarningList);
|
int curPage = 1;
|
int count = warningService.getRealinWarningCount();
|
int minPage = PageUtil.getMinPage(count);
|
request.setAttribute("pageList", PageUtil.getPage(minPage));
|
request.setAttribute("curPage", curPage);
|
return toPage;
|
}
|
|
@ResponseBody
|
@RequestMapping(value = "/realTimeWarninga.do", method = { RequestMethod.POST, RequestMethod.GET })
|
public JSONObject realTimeWarninga(HttpServletRequest request) {
|
JSONObject json = new JSONObject();
|
List<tb_realinwarning> realTimeWarningList = warningService.getRealinWarninga();
|
json.put("dataList", realTimeWarningList);
|
return json;
|
}
|
|
@ResponseBody
|
@RequestMapping(value = "/realTimeWarning_delete.do", method = { RequestMethod.POST, RequestMethod.GET })
|
public void realTimeWarning_delete(HttpServletRequest request) {
|
String checkValStr = request.getParameter("checkVal");
|
checkValStr = checkValStr.replaceAll("\"", "");
|
String[] checkVal = checkValStr.split(",");
|
warningService.realinWarning_delete(checkVal);
|
}
|
|
@ResponseBody
|
@RequestMapping(value = "/realTimeWarning_deletea.do", method = { RequestMethod.POST, RequestMethod.GET })
|
public int realTimeWarning_deletea(HttpServletRequest request) {
|
String checkValStr = request.getParameter("checkVal");
|
checkValStr = checkValStr.replaceAll("\"", "");
|
String[] checkVal = checkValStr.split(",");
|
int aaa = warningService.realinWarning_deletea(checkVal);
|
return aaa;
|
}
|
|
@ResponseBody
|
@RequestMapping(value = "/realTimeWarning_deleteAll.do", method = { RequestMethod.POST, RequestMethod.GET })
|
public void realTimeWarning_deleteAll(HttpServletRequest request) {
|
warningService.realinWarning_deleteAll();
|
}
|
|
@ResponseBody
|
@RequestMapping(value = "/realTimeWarning_deleteAlla.do", method = { RequestMethod.POST, RequestMethod.GET })
|
public int realTimeWarning_deleteAlla(HttpServletRequest request) {
|
int aaa = warningService.realinWarning_deleteAlla();
|
return aaa;
|
}
|
|
@ResponseBody
|
@RequestMapping(value = "/realTimeWarning_search.do", method = { RequestMethod.POST, RequestMethod.GET })
|
public String realTimeWarning_search(HttpServletRequest request) throws IOException {
|
JSONObject json = new JSONObject();
|
String input = request.getParameter("input");
|
if (("").equals(input) || input == null) {
|
String jsonString = RequestUtils.getRequestJsonString(request, Config.getCharset());
|
tb_tag tag = (tb_tag) JSONObject.toBean(JSONObject.fromObject(jsonString), tb_tag.class);
|
input = tag.getTag_id();
|
List<tb_realinwarning> realTimeWarningList = warningService.searchRealinWarning(input);
|
if (realTimeWarningList.size()>0){
|
json.put("result", realTimeWarningList.get(0));
|
} else {
|
json.put("result", "null");
|
}
|
} else {
|
int curPage = 1;
|
List<Integer> pageList = new ArrayList<Integer>();
|
List<tb_realinwarning> realTimeWarningList = warningService.searchRealinWarning(input);
|
pageList.add(1);
|
json.put("dataList", realTimeWarningList);
|
json.put("pageList", pageList);
|
json.put("curPage", curPage);
|
}
|
return json.toString();
|
}
|
|
@ResponseBody
|
@RequestMapping(value = "/realTimeWarning_searcha.do", method = { RequestMethod.POST, RequestMethod.GET })
|
public JSONObject realTimeWarning_searcha(HttpServletRequest request) throws IOException {
|
JSONObject json = new JSONObject();
|
String input = request.getParameter("tagid");
|
if (("").equals(input) || input == null) {
|
String jsonString = RequestUtils.getRequestJsonString(request, Config.getCharset());
|
tb_tag tag = (tb_tag) JSONObject.toBean(JSONObject.fromObject(jsonString), tb_tag.class);
|
input = tag.getTag_id();
|
List<tb_realinwarning> realTimeWarningList = warningService.searchRealinWarning(input);
|
if (realTimeWarningList.size()>0){
|
json.put("result", realTimeWarningList.get(0));
|
} else {
|
json.put("result", "null");
|
}
|
} else {
|
List<tb_realinwarning> realTimeWarningList = warningService.searchRealinWarning(input);
|
json.put("dataList", realTimeWarningList);
|
}
|
return json;
|
}
|
|
@ResponseBody
|
@RequestMapping(value = "/realTimeWarning_page.do", method = { RequestMethod.POST, RequestMethod.GET })
|
public String realTimeWarning_page(HttpServletRequest request) {
|
String pageStr = request.getParameter("page");
|
String curPageStr = request.getParameter("curPage");
|
int count = warningService.getRealinWarningCount();
|
int minPage = PageUtil.getMinPage(count);
|
int curPage = Integer.parseInt(curPageStr);
|
int page = 1;
|
if ("pre".equals(pageStr)) {
|
if (curPage > 1) {
|
page = curPage - 1;
|
}
|
} else if ("next".equals(pageStr)) {
|
if (curPage < minPage) {
|
page = curPage + 1;
|
}
|
} else {
|
page = Integer.parseInt(pageStr);
|
}
|
List<tb_realinwarning> realTimeWarningList = warningService.getRealinWarning(page);
|
List<Integer> pageList = PageUtil.getPage(PageUtil.getLocPage(page, curPage), page, minPage);
|
JSONObject json = new JSONObject();
|
json.put("dataList", realTimeWarningList);
|
json.put("pageList", pageList);
|
json.put("curPage", page);
|
return json.toString();
|
}
|
|
@ResponseBody
|
@RequestMapping(value = "/realTimeWarning_export.do", method = { RequestMethod.POST, RequestMethod.GET })
|
public String realTimeWarning_export(HttpServletRequest request, HttpServletResponse response) {
|
String toPage = "forward:/hxzk/warning/realTimeWarning.jsp";
|
List<tb_realinwarning> realinWarningList = warningService.getRealinWarning();
|
String[] rowName = { "区域", "名称", "部门", "标签ID", "进入时间" };
|
List<Object[]> dataList = objectToArray_realTimeWarning(realinWarningList);
|
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();
|
excel.export(out);
|
out.flush();
|
out.close();
|
} catch (Exception e) {
|
e.printStackTrace();
|
}
|
return toPage;
|
}
|
|
// tb_realinwarning 导出表格 对象转数组
|
public static List<Object[]> objectToArray_realTimeWarning(List<tb_realinwarning> realinWarningList) {
|
List<Object[]> reList = new ArrayList<>();
|
for (int i = 0; i < realinWarningList.size(); i++) {
|
List<String> words = new ArrayList<String>();
|
tb_realinwarning warn = (tb_realinwarning) realinWarningList.get(i);
|
words.add(warn.getArea());
|
words.add(warn.getName());
|
words.add(warn.getBumen());
|
words.add(warn.getTagid());
|
words.add(warn.getIntime());
|
String[] array = words.toArray(new String[0]);
|
reList.add(array);
|
}
|
return reList;
|
}
|
|
@RequestMapping(value = "/historicalWarning.do", method = { RequestMethod.POST, RequestMethod.GET })
|
public String historicalWarning(HttpServletRequest request) {
|
String toPage = "forward:/hxzk/warning/historicalWarning.jsp";
|
List<tb_historyinwarning> historicalWarningList = warningService.getHistoricalWarning(1);
|
request.setAttribute("historicalWarningList", historicalWarningList);
|
int curPage = 1;
|
int count = warningService.getHistoricalWarningCount();
|
int minPage = PageUtil.getMinPage(count);
|
request.setAttribute("pageList", PageUtil.getPage(minPage));
|
request.setAttribute("curPage", curPage);
|
return toPage;
|
}
|
|
@ResponseBody
|
@RequestMapping(value = "/historicalWarninga.do", method = { RequestMethod.POST, RequestMethod.GET })
|
public JSONObject historicalWarninga(HttpServletRequest request) {
|
JSONObject json = new JSONObject();
|
List<tb_historyinwarning> historicalWarningList = warningService.getHistoricalWarninga();
|
json.put("dataList", historicalWarningList);
|
return json;
|
}
|
|
@ResponseBody
|
@RequestMapping(value = "/historicalWarning_delete.do", method = { RequestMethod.POST, RequestMethod.GET })
|
public void historicalWarning_delete(HttpServletRequest request) {
|
String checkValStr = request.getParameter("checkVal");
|
checkValStr = checkValStr.replaceAll("\"", "");
|
String[] checkVal = checkValStr.split(",");
|
warningService.historicalWarning_delete(checkVal);
|
}
|
|
@ResponseBody
|
@RequestMapping(value = "/historicalWarning_deletea.do", method = { RequestMethod.POST, RequestMethod.GET })
|
public int historicalWarning_deletea(HttpServletRequest request) {
|
String checkValStr = request.getParameter("checkVal");
|
checkValStr = checkValStr.replaceAll("\"", "");
|
String[] checkVal = checkValStr.split(",");
|
int aaa = warningService.historicalWarning_deletea(checkVal);
|
return aaa;
|
}
|
|
@ResponseBody
|
@RequestMapping(value = "/Warning_delete.do", method = { RequestMethod.POST, RequestMethod.GET })
|
public void Warning_delete(HttpServletRequest request) {
|
String checkValStr = request.getParameter("checkVal");
|
String tagids = request.getParameter("tagids");
|
String types = request.getParameter("types");
|
checkValStr = checkValStr.replaceAll("\"", "");
|
tagids = tagids.replaceAll("\"", "");
|
types = types.replaceAll("\"", "");
|
String[] checkVal = checkValStr.split(",");
|
String[] tagid = tagids.split(",");
|
String[] typess = types.split(",");
|
warningService.Warning_delete(checkVal);
|
for (int i = 0; i < tagid.length; i++) {
|
String xieyi = "BSTOCS1,DELETEWARN," +tagid[i]+ "," +typess[i]+ ",END";
|
Udp_Out.udp_to_cs(xieyi);
|
}
|
}
|
|
@ResponseBody
|
@RequestMapping(value = "/Warning_deletea.do", method = { RequestMethod.POST, RequestMethod.GET })
|
public int Warning_deletea(HttpServletRequest request) {
|
String checkValStr = request.getParameter("checkVal");
|
String tagids = request.getParameter("tagids");
|
String types = request.getParameter("types");
|
checkValStr = checkValStr.replaceAll("\"", "");
|
tagids = tagids.replaceAll("\"", "");
|
types = types.replaceAll("\"", "");
|
String[] checkVal = checkValStr.split(",");
|
String[] tagid = tagids.split(",");
|
String[] typess = types.split(",");
|
int aaa = warningService.Warning_deletea(checkVal);
|
for (int i = 0; i < tagid.length; i++) {
|
String xieyi = "BSTOCS1,DELETEWARN," +tagid[i]+ "," +typess[i]+ ",END";
|
Udp_Out.udp_to_cs(xieyi);
|
}
|
return aaa;
|
}
|
|
@ResponseBody
|
@RequestMapping(value = "/historicalWarning_deleteAll.do", method = { RequestMethod.POST, RequestMethod.GET })
|
public void historicalWarning_deleteAll(HttpServletRequest request) {
|
warningService.historicalWarning_deleteAll();
|
}
|
|
@ResponseBody
|
@RequestMapping(value = "/historicalWarning_deleteAlla.do", method = { RequestMethod.POST, RequestMethod.GET })
|
public int historicalWarning_deleteAlla(HttpServletRequest request) {
|
int aaa = warningService.historicalWarning_deleteAlla();
|
return aaa;
|
}
|
|
@ResponseBody
|
@RequestMapping(value = "/Warning_deleteAll.do", method = { RequestMethod.POST, RequestMethod.GET })
|
public void Warning_deleteAll(HttpServletRequest request) {
|
String input = request.getParameter("fenlei");
|
if (input.equals("全部")) {
|
warningService.Warning_deleteAll();
|
String xieyi = "BSTOCS1,DELETEWARNALL,END";
|
Udp_Out.udp_to_cs(xieyi);
|
} else {
|
warningService.Warning_deletefenlei(input);
|
}
|
}
|
|
@ResponseBody
|
@RequestMapping(value = "/Warning_deleteAlla.do", method = { RequestMethod.POST, RequestMethod.GET })
|
public int Warning_deleteAlla(HttpServletRequest request) {
|
String input = request.getParameter("fenlei");
|
int aaa = 0;
|
if (input.equals("全部")) {
|
aaa = warningService.Warning_deleteAlla();
|
String xieyi = "BSTOCS1,DELETEWARNALL,END";
|
Udp_Out.udp_to_cs(xieyi);
|
} else {
|
warningService.Warning_deletefenlei(input);
|
}
|
return aaa;
|
}
|
|
@ResponseBody
|
@RequestMapping(value = "/historicalWarning_search.do", method = { RequestMethod.POST, RequestMethod.GET })
|
public String historicalWarning_search(HttpServletRequest request) {
|
String input = request.getParameter("input");
|
int curPage = 1;
|
List<Integer> pageList = new ArrayList<Integer>();
|
List<tb_historyinwarning> historicalWarningList = warningService.searchHistoricalWarning(input);
|
pageList.add(1);
|
JSONObject json = new JSONObject();
|
json.put("dataList", historicalWarningList);
|
json.put("pageList", pageList);
|
json.put("curPage", curPage);
|
return json.toString();
|
}
|
|
@ResponseBody
|
@RequestMapping(value = "/historicalWarning_searcha.do", method = { RequestMethod.POST, RequestMethod.GET })
|
public JSONObject historicalWarning_searcha(HttpServletRequest request) {
|
String input = request.getParameter("tagid");
|
List<tb_historyinwarning> historicalWarningList = warningService.searchHistoricalWarning(input);
|
JSONObject json = new JSONObject();
|
json.put("dataList", historicalWarningList);
|
return json;
|
}
|
|
@ResponseBody
|
@RequestMapping(value = "/historicalWarning_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 = warningService.getHistoricalWarningCount();
|
int minPage = PageUtil.getMinPage(count);
|
int curPage = Integer.parseInt(curPageStr);
|
int page = 1;
|
if ("pre".equals(pageStr)) {
|
if (curPage > 1) {
|
page = curPage - 1;
|
}
|
} else if ("next".equals(pageStr)) {
|
if (curPage < minPage) {
|
page = curPage + 1;
|
}
|
} else {
|
page = Integer.parseInt(pageStr);
|
}
|
List<tb_historyinwarning> historyinwarningList = warningService.getHistoricalWarning(page);
|
List<Integer> pageList = PageUtil.getPage(PageUtil.getLocPage(page, curPage), page, minPage);
|
JSONObject json = new JSONObject();
|
json.put("dataList", historyinwarningList);
|
json.put("pageList", pageList);
|
json.put("curPage", page);
|
return json.toString();
|
}
|
|
@ResponseBody
|
@RequestMapping(value = "/historicalWarning_export.do", method = { RequestMethod.POST, RequestMethod.GET })
|
public String historicalWarning_export(HttpServletRequest request, HttpServletResponse response) {
|
String toPage = "forward:/hxzk/warning/historicalWarning.jsp";
|
List<tb_historyinwarning> historyinwarningList = warningService.getHistoricalWarning();
|
String[] rowName = { "序号", "区域", "名称", "部门", "标签ID", "进入时间", "出去时间", "停留时长", "备注" };
|
List<Object[]> dataList = objectToArray_historicalWarning(historyinwarningList);
|
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();
|
excel.export(out);
|
out.flush();
|
out.close();
|
} catch (Exception e) {
|
e.printStackTrace();
|
}
|
return toPage;
|
}
|
|
// tb_historyinwarning 导出表格 对象转数组
|
public static List<Object[]> objectToArray_historicalWarning(List<tb_historyinwarning> historyinwarningList) {
|
List<Object[]> reList = new ArrayList<>();
|
for (int i = 0; i < historyinwarningList.size(); i++) {
|
List<String> words = new ArrayList<String>();
|
tb_historyinwarning warn = (tb_historyinwarning) historyinwarningList.get(i);
|
words.add(warn.getId() + "");
|
words.add(warn.getArea());
|
words.add(warn.getName());
|
words.add(warn.getBumen());
|
words.add(warn.getTagid());
|
words.add(warn.getIntime());
|
words.add(warn.getOuttime());
|
words.add(warn.getAlltime());
|
words.add(warn.getBeizhu());
|
String[] array = words.toArray(new String[0]);
|
reList.add(array);
|
}
|
return reList;
|
}
|
|
@ResponseBody
|
@RequestMapping(value = "/historicalWarning_handle.do", method = { RequestMethod.POST, RequestMethod.GET })
|
public void historicalWarning_handle(HttpServletRequest request) {
|
String checkValStr = request.getParameter("checkVal");
|
String types = request.getParameter("types");
|
types = types.replaceAll("\"", "");
|
String[] typess = types.split(",");
|
checkValStr = checkValStr.replaceAll("\"", "");
|
String[] checkVal = checkValStr.split(",");
|
warningService.historicalWarning_handle(checkVal);
|
for (int i = 0; i < checkVal.length; i++) {
|
String xieyi = "BSTOCS1,DELLWARN," +checkVal[i]+ "," +typess[i]+ ",END";
|
Udp_Out.udp_to_cs(xieyi);
|
}
|
}
|
|
@ResponseBody
|
@RequestMapping(value = "/historicalWarning_handlea.do", method = { RequestMethod.POST, RequestMethod.GET })
|
public int historicalWarning_handlea(HttpServletRequest request) {
|
String checkValStr = request.getParameter("checkVal");
|
String types = request.getParameter("types");
|
types = types.replaceAll("\"", "");
|
String[] typess = types.split(",");
|
checkValStr = checkValStr.replaceAll("\"", "");
|
String[] checkVal = checkValStr.split(",");
|
int aaa = warningService.historicalWarning_handle(checkVal);
|
for (int i = 0; i < checkVal.length; i++) {
|
String xieyi = "BSTOCS1,DELLWARN," +checkVal[i]+ "," +typess[i]+ ",END";
|
Udp_Out.udp_to_cs(xieyi);
|
}
|
return aaa;
|
}
|
|
@ResponseBody
|
@RequestMapping(value = "/historicalWarning_handleAll.do", method = { RequestMethod.POST, RequestMethod.GET })
|
public void historicalWarning_handleAll(HttpServletRequest request) {
|
warningService.historicalWarning_handleAll();
|
warningService.historicalWarning_handleAll_realpositoin();
|
String xieyi = "BSTOCS1,DELLWARNALL,END";
|
Udp_Out.udp_to_cs(xieyi);
|
}
|
|
@ResponseBody
|
@RequestMapping(value = "/historicalWarning_handleAlla.do", method = { RequestMethod.POST, RequestMethod.GET })
|
public int historicalWarning_handleAlla(HttpServletRequest request) {
|
int aaa = warningService.historicalWarning_handleAll();
|
warningService.historicalWarning_handleAll_realpositoin();
|
String xieyi = "BSTOCS1,DELLWARNALL,END";
|
Udp_Out.udp_to_cs(xieyi);
|
return aaa;
|
}
|
|
@RequestMapping(value = "/warning_bw_add.do", method = { RequestMethod.POST, RequestMethod.GET })
|
public void warning_bw_add(HttpServletRequest request) throws IOException {
|
String jsonString = RequestUtils.getRequestJsonString(request, Config.getCharset());
|
tb_warning warning = (tb_warning) JSONObject.toBean(JSONObject.fromObject(jsonString), tb_warning.class);
|
//显示sql
|
String sqlString = "INSERT tb_warning (type,objectid,status,time) VALUES ("+warning.getType()+","+warning.getObjectid()+","+warning.getStatus()+","+GetNowTime.timestamp2()+")";
|
String messageJson = GetNowTime.timestamp2()+ " 收:"+ sqlString ;
|
String BaowenPath = Config.getBaowenConfig();
|
String baowenStatus = ModifyConfig.readData(BaowenPath, "baowenSwitch");
|
if (baowenStatus.equals("1")){
|
/* Udp_Receive.mysqlMessage.add(messageJson); */
|
}
|
//
|
warningService.warning_add(warning);
|
}
|
|
@RequestMapping(value = "/realinwarning_bw_add.do", method = { RequestMethod.POST, RequestMethod.GET })
|
public void realinwarning_bw_add(HttpServletRequest request) throws IOException {
|
String jsonString = RequestUtils.getRequestJsonString(request, Config.getCharset());
|
tb_realinwarning realinwarning = (tb_realinwarning) JSONObject.toBean(JSONObject.fromObject(jsonString),
|
tb_realinwarning.class);
|
//显示sql
|
String sqlString = "INSERT tb_realinwarning (area,name,bumen,tagid,intime) VALUES ("+realinwarning.getArea()+","+realinwarning.getName()+","+realinwarning.getBumen()+","+realinwarning.getTagid()+","+GetNowTime.timestamp2()+")";
|
String messageJson = GetNowTime.timestamp2()+ " 收:"+ sqlString ;
|
String BaowenPath = Config.getBaowenConfig();
|
String baowenStatus = ModifyConfig.readData(BaowenPath, "baowenSwitch");
|
if (baowenStatus.equals("1")){
|
/* Udp_Receive.mysqlMessage.add(messageJson); */
|
}
|
//
|
warningService.realinwarning_add(realinwarning);
|
}
|
|
@RequestMapping(value = "/realinwarning_bw_remove.do", method = { RequestMethod.POST, RequestMethod.GET })
|
public void realinwarning_bw_remove(HttpServletRequest request) throws IOException {
|
String jsonString = RequestUtils.getRequestJsonString(request, Config.getCharset());
|
tb_realinwarning realinwarning = (tb_realinwarning) JSONObject.toBean(JSONObject.fromObject(jsonString),
|
tb_realinwarning.class);
|
//显示sql
|
String sqlString = "DELETE FROM tb_realinwarning WHERE id = " + realinwarning.getId();
|
String messageJson = GetNowTime.timestamp2()+ " 收:"+ sqlString ;
|
String BaowenPath = Config.getBaowenConfig();
|
String baowenStatus = ModifyConfig.readData(BaowenPath, "baowenSwitch");
|
if (baowenStatus.equals("1")){
|
/* Udp_Receive.mysqlMessage.add(messageJson); */
|
}
|
//
|
String[] checkVal = { realinwarning.getTagid() };
|
warningService.realinWarning_delete(checkVal);
|
}
|
|
@ResponseBody
|
@RequestMapping(value = "/shaileixing.do", method = { RequestMethod.POST, RequestMethod.GET })
|
public String shaileixing(HttpServletRequest request) {
|
String fenlei = request.getParameter("fenlei");
|
List<tb_warning> labelManagementList = warningService.getleixing(fenlei);
|
JSONObject json = new JSONObject();
|
json.put("dataList", labelManagementList);
|
return json.toString();
|
}
|
|
@ResponseBody
|
@RequestMapping(value = "/shaizhuangtai.do", method = { RequestMethod.POST, RequestMethod.GET })
|
public String shaizhuangtai(HttpServletRequest request) {
|
String fenlei = request.getParameter("fenlei");
|
List<tb_warning> labelManagementList = warningService.getzhuangtai(fenlei);
|
JSONObject json = new JSONObject();
|
json.put("dataList", labelManagementList);
|
return json.toString();
|
}
|
|
@ResponseBody
|
@RequestMapping(value = "/shuangshai.do", method = { RequestMethod.POST, RequestMethod.GET })
|
public String shuangshai(HttpServletRequest request) {
|
String fenlei = request.getParameter("fenlei");
|
String fenlei2 = request.getParameter("fenlei2");
|
List<tb_warning> labelManagementList = warningService.getshuangshai(fenlei,fenlei2);
|
JSONObject json = new JSONObject();
|
json.put("dataList", labelManagementList);
|
return json.toString();
|
}
|
|
@ResponseBody
|
@RequestMapping(value = "/warningexport.do", method = { RequestMethod.POST, RequestMethod.GET })
|
public String warningexport(HttpServletRequest request, HttpServletResponse response) {
|
List<tb_warning> warningSummaryList = warningService.getWarningSummarya();
|
String[] rowName = { "序号", "围栏名称", "关联部门", "关联标签", "告警时间", "告警原因", "坐标" };
|
List<Object[]> dataList = objectToArray_job(warningSummaryList);
|
ExcelUtils excel = new ExcelUtils("告警历史", rowName, dataList);
|
OutputStream out;
|
String fileName = "";
|
try {
|
fileName = "Excel-" + String.valueOf(System.currentTimeMillis()).substring(4, 13) + ".xls";
|
String filePath2 = request.getServletContext().getRealPath("/") + "hxzk/image/excels/"+fileName;
|
out = new FileOutputStream(filePath2);
|
excel.export(out);
|
out.flush();
|
out.close();
|
} catch (Exception e) {
|
e.printStackTrace();
|
}
|
return fileName;
|
}
|
|
@RequestMapping(value = "/permissionManagement.do", method = { RequestMethod.POST, RequestMethod.GET })
|
public String permissionManagement(HttpServletRequest request) {
|
String toPage = "forward:/hxzk/warning/permissionManagement.jsp";
|
List<tb_tag> labelManagementList = warningService.getPermissionManagement(1);
|
List<tb_tag> labelManagementListaa = labelService.getLabelManagementa();
|
request.setAttribute("labelManagementList", labelManagementList);
|
request.setAttribute("labelManagementListaa", labelManagementListaa);
|
int curPage = 1;
|
int count = labelService.getLabelManagementCount();
|
int minPage = PageUtil.getMinPage(count);
|
request.setAttribute("pageList", PageUtil.getPage(minPage));
|
request.setAttribute("curPage", curPage);
|
return toPage;
|
}
|
|
@ResponseBody
|
@RequestMapping(value = "/permissionManagement_page.do", method = { RequestMethod.POST, RequestMethod.GET })
|
public String permissionManagement_page(HttpServletRequest request) {
|
String pageStr = request.getParameter("page");
|
String curPageStr = request.getParameter("curPage");
|
int count = labelService.getLabelManagementCount();
|
int minPage = PageUtil.getMinPage(count);
|
int curPage = Integer.parseInt(curPageStr);
|
int page = 1;
|
if ("pre".equals(pageStr)) {
|
if (curPage > 1) {
|
page = curPage - 1;
|
}
|
} else if ("next".equals(pageStr)) {
|
if (curPage < minPage) {
|
page = curPage + 1;
|
}
|
} else {
|
page = Integer.parseInt(pageStr);
|
}
|
// List<tb_tag> labelManagementList = labelService.getLabelManagement(page);
|
List<tb_tag> labelManagementList = warningService.getPermissionManagement(page);
|
List<Integer> pageList = PageUtil.getPage(PageUtil.getLocPage(page, curPage), page, minPage);
|
JSONObject json = new JSONObject();
|
json.put("dataList", labelManagementList);
|
json.put("pageList", pageList);
|
json.put("curPage", page);
|
return json.toString();
|
}
|
|
@ResponseBody
|
@RequestMapping(value = "/permissionManagementupdate.do", method = { RequestMethod.POST, RequestMethod.GET })
|
public void permissionManagementupdate(HttpServletRequest request) {
|
String checkValStr = request.getParameter("tagids");
|
String panduan = request.getParameter("checkbox");
|
checkValStr = checkValStr.replaceAll("\"", "");
|
String[] checkVal = checkValStr.split(",");
|
for (int i = 0; i < checkVal.length; i++) {
|
warningService.permissionupdate(panduan,checkVal[i]);
|
String xieyi = "BSTOCS1,EDITPER,"+checkVal[i]+","+panduan+",END";
|
Udp_Out.udp_to_cs(xieyi);
|
String person = labelService.findpname(checkVal[i]);
|
tb_permission per = new tb_permission();
|
per.setType("授权记录");
|
per.setName(person);
|
per.setTagid(checkVal[i]);
|
if (panduan.equals("1")) {
|
per.setEvent("授权");
|
} else {
|
per.setEvent("解权");
|
}
|
warningService.permission_add(per);
|
}
|
// for (int i = 0; i < checkVal.length; i++) {
|
// String xieyi = "BSTOCS1,DELETETAG," + checkVal[i] + ",END";
|
// Udp_Out.udp_to_cs(xieyi);
|
// }
|
}
|
|
@ResponseBody
|
@RequestMapping(value = "findidpermission.do", method = {RequestMethod.POST,RequestMethod.GET})
|
public String findidpermission(HttpServletRequest request) {
|
JSONObject json = new JSONObject();
|
String tagid = request.getParameter("input");
|
List<tb_tag> tag = warningService.getPermissionid(tagid);
|
json.put("dataList", tag);
|
return json.toString();
|
}
|
|
@RequestMapping(value = "/permissionManagement2.do", method = { RequestMethod.POST, RequestMethod.GET })
|
public String permissionManagement2(HttpServletRequest request) {
|
String toPage = "forward:/hxzk/warning/permissionManagement2.jsp";
|
List<tb_permission> labelManagementList = warningService.findpermission(1);
|
request.setAttribute("labelManagementList", labelManagementList);
|
int curPage = 1;
|
int count = warningService.getperManagementCount();
|
int minPage = PageUtil.getMinPage(count);
|
request.setAttribute("pageList", PageUtil.getPage(minPage));
|
request.setAttribute("curPage", curPage);
|
return toPage;
|
}
|
|
@RequestMapping(value = "deletepermission.do", method= {RequestMethod.POST,RequestMethod.GET})
|
public void deletepermission(HttpServletRequest request) {
|
String checkValStr = request.getParameter("checkVal");
|
checkValStr = checkValStr.replaceAll("\"", "");
|
String[] checkVal = checkValStr.split(",");
|
for (int i = 0; i < checkVal.length; i++) {
|
warningService.Warning_deleteper(checkVal[i]);
|
}
|
}
|
|
@RequestMapping(value = "deletepermission2.do", method= {RequestMethod.POST,RequestMethod.GET})
|
public void deletepermission2(HttpServletRequest request) {
|
warningService.Warning_deleteper2();
|
}
|
|
@ResponseBody
|
@RequestMapping(value = "/permission_page.do", method = { RequestMethod.POST, RequestMethod.GET })
|
public String permission_page(HttpServletRequest request) {
|
String pageStr = request.getParameter("page");
|
String curPageStr = request.getParameter("curPage");
|
int count = warningService.getperManagementCount();
|
int minPage = PageUtil.getMinPage(count);
|
int curPage = Integer.parseInt(curPageStr);
|
int page = 1;
|
if ("pre".equals(pageStr)) {
|
if (curPage > 1) {
|
page = curPage - 1;
|
}
|
} else if ("next".equals(pageStr)) {
|
if (curPage < minPage) {
|
page = curPage + 1;
|
}
|
} else {
|
page = Integer.parseInt(pageStr);
|
}
|
List<tb_permission> labelManagementList = warningService.findpermission(page);
|
List<Integer> pageList = PageUtil.getPage(PageUtil.getLocPage(page, curPage), page, minPage);
|
JSONObject json = new JSONObject();
|
json.put("dataList", labelManagementList);
|
json.put("pageList", pageList);
|
json.put("curPage", page);
|
return json.toString();
|
}
|
|
@ResponseBody
|
@RequestMapping(value = "findidpermission2.do", method = {RequestMethod.POST,RequestMethod.GET})
|
public String findidpermission2(HttpServletRequest request) {
|
JSONObject json = new JSONObject();
|
String tagid = request.getParameter("input");
|
List<tb_permission> tag = warningService.findidpermission2(tagid);
|
json.put("dataList", tag);
|
return json.toString();
|
}
|
|
@RequestMapping(value="tomessagem.do",method= {RequestMethod.POST,RequestMethod.GET})
|
public String tomessagem(HttpServletRequest request) {
|
String toPage = "forward:/hxzk/label/messageManagement.jsp";
|
List<tb_message_history> mess = warningService.findmessage(1);
|
request.setAttribute("dataList", mess);
|
int curPage = 1;
|
int count = warningService.getmessageManagementCount();
|
int minPage = PageUtil.getMinPage(count);
|
request.setAttribute("pageList", PageUtil.getPage(minPage));
|
request.setAttribute("curPage", curPage);
|
return toPage;
|
}
|
|
@ResponseBody
|
@RequestMapping(value = "/message_page.do", method = { RequestMethod.POST, RequestMethod.GET })
|
public String message_page(HttpServletRequest request) {
|
String pageStr = request.getParameter("page");
|
String curPageStr = request.getParameter("curPage");
|
int count = warningService.getmessageManagementCount();
|
int minPage = PageUtil.getMinPage(count);
|
int curPage = Integer.parseInt(curPageStr);
|
int page = 1;
|
if ("pre".equals(pageStr)) {
|
if (curPage > 1) {
|
page = curPage - 1;
|
}
|
} else if ("next".equals(pageStr)) {
|
if (curPage < minPage) {
|
page = curPage + 1;
|
}
|
} else {
|
page = Integer.parseInt(pageStr);
|
}
|
List<tb_message_history> labelManagementList = warningService.findmessage(page);
|
List<Integer> pageList = PageUtil.getPage(PageUtil.getLocPage(page, curPage), page, minPage);
|
JSONObject json = new JSONObject();
|
json.put("dataList", labelManagementList);
|
json.put("pageList", pageList);
|
json.put("curPage", page);
|
return json.toString();
|
}
|
|
@ResponseBody
|
@RequestMapping(value = "/message_export.do", method = { RequestMethod.POST, RequestMethod.GET })
|
public String message_export(HttpServletRequest request, HttpServletResponse response) {
|
String toPage = "forward:/hxzk/label/messageManagement.jsp";
|
List<tb_message_history> tb_warningList = warningService.findmessage2();
|
String[] rowName = { "序号", "标签ID", "接收人", "发送人", "信息", "发送时间", "回复时间", "是否响应"};
|
List<Object[]> dataList = objectToArray_warningSummary2(tb_warningList);
|
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();
|
excel.export(out);
|
out.flush();
|
out.close();
|
} catch (Exception e) {
|
e.printStackTrace();
|
}
|
return toPage;
|
}
|
|
@ResponseBody
|
@RequestMapping(value = "/message_delete.do", method = { RequestMethod.POST, RequestMethod.GET })
|
public void message_delete(HttpServletRequest request) {
|
String checkValStr = request.getParameter("checkVal");
|
checkValStr = checkValStr.replaceAll("\"", "");
|
String[] checkVal = checkValStr.split(",");
|
warningService.message_delete(checkVal);
|
}
|
|
@ResponseBody
|
@RequestMapping(value = "/message_deletea.do", method = { RequestMethod.POST, RequestMethod.GET })
|
public void message_deletea(HttpServletRequest request) {
|
warningService.message_deletea();
|
}
|
|
@ResponseBody
|
@RequestMapping(value = "/message_search.do", method = { RequestMethod.POST, RequestMethod.GET })
|
public String message_search(HttpServletRequest request) throws IOException {
|
JSONObject json = new JSONObject();
|
String input = request.getParameter("input");
|
if (("").equals(input) || input == null) {
|
String jsonString = RequestUtils.getRequestJsonString(request, Config.getCharset());
|
tb_tag tag = (tb_tag) JSONObject.toBean(JSONObject.fromObject(jsonString), tb_tag.class);
|
input = tag.getTag_id();
|
List<tb_message_history> warningSummaryList = warningService.findmessage3(input);
|
if (warningSummaryList.size()>0){
|
json.put("result", warningSummaryList.get(0));
|
} else {
|
json.put("result", "null");
|
}
|
} else {
|
int curPage = 1;
|
List<Integer> pageList = new ArrayList<Integer>();
|
List<tb_message_history> warningSummaryList = warningService.findmessage3(input);
|
pageList.add(1);
|
json.put("dataList", warningSummaryList);
|
json.put("pageList", pageList);
|
json.put("curPage", curPage);
|
}
|
return json.toString();
|
}
|
|
@RequestMapping(value="tolixian.do",method= {RequestMethod.POST,RequestMethod.GET})
|
public String tolixian(HttpServletRequest request) {
|
String toPage = "forward:/hxzk/label/lixianManagement.jsp";
|
List<tb_lixianrecord> mess = warningService.findlixian(1);
|
request.setAttribute("dataList", mess);
|
int curPage = 1;
|
int count = warningService.getlixianManagementCount();
|
int minPage = PageUtil.getMinPage(count);
|
request.setAttribute("pageList", PageUtil.getPage(minPage));
|
request.setAttribute("curPage", curPage);
|
return toPage;
|
}
|
|
@ResponseBody
|
@RequestMapping(value = "/lixian_page.do", method = { RequestMethod.POST, RequestMethod.GET })
|
public String lixian_page(HttpServletRequest request) {
|
String pageStr = request.getParameter("page");
|
String curPageStr = request.getParameter("curPage");
|
int count = warningService.getlixianManagementCount();
|
int minPage = PageUtil.getMinPage(count);
|
int curPage = Integer.parseInt(curPageStr);
|
int page = 1;
|
if ("pre".equals(pageStr)) {
|
if (curPage > 1) {
|
page = curPage - 1;
|
}
|
} else if ("next".equals(pageStr)) {
|
if (curPage < minPage) {
|
page = curPage + 1;
|
}
|
} else {
|
page = Integer.parseInt(pageStr);
|
}
|
List<tb_lixianrecord> labelManagementList = warningService.findlixian(page);
|
List<Integer> pageList = PageUtil.getPage(PageUtil.getLocPage(page, curPage), page, minPage);
|
JSONObject json = new JSONObject();
|
json.put("dataList", labelManagementList);
|
json.put("pageList", pageList);
|
json.put("curPage", page);
|
return json.toString();
|
}
|
|
@ResponseBody
|
@RequestMapping(value = "/lixian_export.do", method = { RequestMethod.POST, RequestMethod.GET })
|
public String lixian_export(HttpServletRequest request, HttpServletResponse response) {
|
String toPage = "forward:/hxzk/label/lixianManagement.jsp";
|
List<tb_lixianrecord> tb_warningList = warningService.findlixian2();
|
String[] rowName = { "序号", "标签ID", "姓名", "部门", "时长/S", "记录时间"};
|
List<Object[]> dataList = objectToArray_warningSummary3(tb_warningList);
|
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();
|
excel.export(out);
|
out.flush();
|
out.close();
|
} catch (Exception e) {
|
e.printStackTrace();
|
}
|
return toPage;
|
}
|
|
@ResponseBody
|
@RequestMapping(value = "/lixian_delete.do", method = { RequestMethod.POST, RequestMethod.GET })
|
public void lixian_delete(HttpServletRequest request) {
|
String checkValStr = request.getParameter("checkVal");
|
checkValStr = checkValStr.replaceAll("\"", "");
|
String[] checkVal = checkValStr.split(",");
|
warningService.lixian_delete(checkVal);
|
}
|
|
@ResponseBody
|
@RequestMapping(value = "/lixian_deletea.do", method = { RequestMethod.POST, RequestMethod.GET })
|
public void lixian_deletea(HttpServletRequest request) {
|
warningService.lixian_deletea();
|
}
|
|
@ResponseBody
|
@RequestMapping(value = "/lixian_search.do", method = { RequestMethod.POST, RequestMethod.GET })
|
public String lixian_search(HttpServletRequest request) throws IOException {
|
JSONObject json = new JSONObject();
|
String input = request.getParameter("input");
|
if (("").equals(input) || input == null) {
|
String jsonString = RequestUtils.getRequestJsonString(request, Config.getCharset());
|
tb_tag tag = (tb_tag) JSONObject.toBean(JSONObject.fromObject(jsonString), tb_tag.class);
|
input = tag.getTag_id();
|
List<tb_lixianrecord> warningSummaryList = warningService.findlixian3(input);
|
if (warningSummaryList.size()>0){
|
json.put("result", warningSummaryList.get(0));
|
} else {
|
json.put("result", "null");
|
}
|
} else {
|
int curPage = 1;
|
List<Integer> pageList = new ArrayList<Integer>();
|
List<tb_lixianrecord> warningSummaryList = warningService.findlixian3(input);
|
pageList.add(1);
|
json.put("dataList", warningSummaryList);
|
json.put("pageList", pageList);
|
json.put("curPage", curPage);
|
}
|
return json.toString();
|
}
|
|
// 作业信息 导出表格 对象转数组
|
public static List<Object[]> objectToArray_job(List<tb_warning> history_powerList) {
|
List<Object[]> reList = new ArrayList<>();
|
for (int i = 0; i < history_powerList.size(); i++) {
|
List<String> words = new ArrayList<String>();
|
tb_warning history_power = (tb_warning) history_powerList.get(i);
|
words.add(history_power.getId() + "");
|
words.add(history_power.getBaoliu2());
|
words.add(history_power.getBaoliu3());
|
words.add(history_power.getObjectid());
|
words.add(history_power.getTime());
|
words.add(history_power.getType());
|
words.add(history_power.getBaoliu1());
|
String[] array = words.toArray(new String[0]);
|
reList.add(array);
|
}
|
return reList;
|
}
|
|
public static List<Object[]> objectToArray_warningSummary2(List<tb_message_history> tb_warningList) {
|
List<Object[]> reList = new ArrayList<>();
|
for (int i = 0; i < tb_warningList.size(); i++) {
|
List<String> words = new ArrayList<String>();
|
tb_message_history warn = tb_warningList.get(i);
|
words.add(warn.getId() + "");
|
words.add(warn.getTagid());
|
words.add(warn.getBaoliu1());
|
words.add(warn.getUsername());
|
words.add(warn.getInfo());
|
words.add(warn.getSendtime());
|
words.add(warn.getReplytime());
|
words.add(warn.getBaoliu2());
|
String[] array = words.toArray(new String[0]);
|
reList.add(array);
|
}
|
return reList;
|
}
|
|
public static List<Object[]> objectToArray_warningSummary3(List<tb_lixianrecord> tb_warningList) {
|
List<Object[]> reList = new ArrayList<>();
|
for (int i = 0; i < tb_warningList.size(); i++) {
|
List<String> words = new ArrayList<String>();
|
tb_lixianrecord warn = tb_warningList.get(i);
|
words.add(warn.getId() + "");
|
words.add(warn.getTagid());
|
words.add(warn.getName());
|
words.add(warn.getBumen());
|
words.add(warn.getPhone());
|
words.add(warn.getTime());
|
String[] array = words.toArray(new String[0]);
|
reList.add(array);
|
}
|
return reList;
|
}
|
}
|