From 4a36dc08e7478742f21b1f00893cdba70a454d42 Mon Sep 17 00:00:00 2001 From: leijun Date: Wed, 12 Dec 2018 16:47:08 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20RADIUS=E5=8D=8F=E8=AE=AE?= =?UTF-8?q?=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../nis/domain/log/NtcCollectRadiusLog.java | 39 ++ src/main/java/com/nis/util/Constants.java | 1 + .../ntc/NtcCollectRadiusLogController.java | 74 ++++ .../resources/messages/message_en.properties | 6 +- .../messages/message_zh_CN.properties | 6 +- src/main/resources/nis.properties | 3 +- .../resources/sql/20181212/add_sys_menu.sql | 2 + .../WEB-INF/views/log/ntc/radiusLogList.jsp | 346 ++++++++++++++++++ 8 files changed, 474 insertions(+), 3 deletions(-) create mode 100644 src/main/java/com/nis/domain/log/NtcCollectRadiusLog.java create mode 100644 src/main/java/com/nis/web/controller/log/ntc/NtcCollectRadiusLogController.java create mode 100644 src/main/resources/sql/20181212/add_sys_menu.sql create mode 100644 src/main/webapp/WEB-INF/views/log/ntc/radiusLogList.jsp diff --git a/src/main/java/com/nis/domain/log/NtcCollectRadiusLog.java b/src/main/java/com/nis/domain/log/NtcCollectRadiusLog.java new file mode 100644 index 000000000..3f932f91b --- /dev/null +++ b/src/main/java/com/nis/domain/log/NtcCollectRadiusLog.java @@ -0,0 +1,39 @@ +package com.nis.domain.log; + +public class NtcCollectRadiusLog extends BaseLogEntity { + + private static final long serialVersionUID = -4947912502754359817L; + + protected Integer code; + protected String nasIp; + protected String framedIp; + protected String account; + public Integer getCode() { + return code; + } + public void setCode(Integer code) { + this.code = code; + } + public String getNasIp() { + return nasIp; + } + public void setNasIp(String nasIp) { + this.nasIp = nasIp; + } + public String getFramedIp() { + return framedIp; + } + public void setFramedIp(String framedIp) { + this.framedIp = framedIp; + } + public String getAccount() { + return account; + } + public void setAccount(String account) { + this.account = account; + } + + + + +} diff --git a/src/main/java/com/nis/util/Constants.java b/src/main/java/com/nis/util/Constants.java index 6b91904e5..da6769de8 100644 --- a/src/main/java/com/nis/util/Constants.java +++ b/src/main/java/com/nis/util/Constants.java @@ -766,4 +766,5 @@ public final class Constants { //日志查询接口URL public static final String DNS_SPOOFING_IP_DESC = Configurations.getStringProperty("dns_spoofing_ip_desc",""); public static final String DNS_SPOOFING_IP_IP = Configurations.getStringProperty("dns_spoofing_ip_ip",""); + public static final String NTC_COLLECT_RADIUS_LOG =Configurations.getStringProperty("ntcCollectRadiusLog",""); } diff --git a/src/main/java/com/nis/web/controller/log/ntc/NtcCollectRadiusLogController.java b/src/main/java/com/nis/web/controller/log/ntc/NtcCollectRadiusLogController.java new file mode 100644 index 000000000..77506b14c --- /dev/null +++ b/src/main/java/com/nis/web/controller/log/ntc/NtcCollectRadiusLogController.java @@ -0,0 +1,74 @@ +package com.nis.web.controller.log.ntc; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.web.bind.annotation.RequestMapping; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.reflect.TypeToken; +import com.nis.domain.FunctionServiceDict; +import com.nis.domain.Page; +import com.nis.domain.PageLog; +import com.nis.domain.log.IrDnatLog; +import com.nis.domain.log.IrSnatLog; +import com.nis.domain.log.NtcCollectRadiusLog; +import com.nis.domain.maat.LogRecvData; +import com.nis.util.Constants; +import com.nis.util.DictUtils; +import com.nis.util.httpclient.HttpClientUtil; +import com.nis.web.controller.BaseController; + +@Controller +@RequestMapping("${adminPath}/log/ntc/radiusLogs") +public class NtcCollectRadiusLogController extends BaseController { + + @RequestMapping(value = {"list", ""}) + public String list(@ModelAttribute("log") IrSnatLog log, Model model, HttpServletRequest request, HttpServletResponse response) { + try { + PageLog page = new PageLog(request, response); + Map params = new HashMap(); + params.put("pageSize", page.getPageSize()); + params.put("pageNo", page.getPageNo()); + initLogSearchValue(log, params); + + List serviceList = DictUtils.getFunctionServiceDictList(log.getFunctionId()); + model.addAttribute("serviceList", serviceList); + + String url =Constants.LOG_BASE_URL + Constants.NTC_COLLECT_RADIUS_LOG; + String recv = HttpClientUtil.getMsg(url, params, request); + + if (StringUtils.isNotBlank(recv)) { + Gson gson = new GsonBuilder().create(); + LogRecvData fromJson = gson.fromJson(recv, new TypeToken>(){}.getType()); + if (fromJson.getStatus().intValue() == 200) { + Page data = fromJson.getData(); + page.setCount(data.getCount()); + page.setLast(data.getLast()); + page.setList(data.getList()); + List list = page.getList(); + for (NtcCollectRadiusLog l : list) { + l.setFunctionId(log.getFunctionId()); + setLogAction(l,serviceList); + } + model.addAttribute("page", page); + } + } + } catch (Exception e) { + logger.error("查询失败", e); + addMessageLog(model, e.getMessage()); + } + + return "/log/ntc/radiusLogList"; + } + +} diff --git a/src/main/resources/messages/message_en.properties b/src/main/resources/messages/message_en.properties index 0882e126e..faea3285c 100644 --- a/src/main/resources/messages/message_en.properties +++ b/src/main/resources/messages/message_en.properties @@ -1358,4 +1358,8 @@ show_available_ips=View available IP log_search_http_monit=HTTP Monitor log_search_http_reject=HTTP Block log_search_keyword_monit=Keyword Monitor -log_search_keyword_reject=Keyword Block \ No newline at end of file +log_search_keyword_reject=Keyword Block +radius_log=RADIUS Identify +message_type=Message Type +nas_ip=ISN Access IP +framed_ip=User Address Sent By Server diff --git a/src/main/resources/messages/message_zh_CN.properties b/src/main/resources/messages/message_zh_CN.properties index b1d33cace..bf246d908 100644 --- a/src/main/resources/messages/message_zh_CN.properties +++ b/src/main/resources/messages/message_zh_CN.properties @@ -1358,4 +1358,8 @@ website_keyword_reject=\u5173\u952E\u5B57\u963B\u65AD log_search_http_monit=HTTP\u76D1\u6D4B log_search_http_reject=HTTP\u963B\u65AD log_search_keyword_monit=\u5173\u952E\u5B57\u76D1\u6D4B -log_search_keyword_reject=\u5173\u952E\u5B57\u963B\u65AD \ No newline at end of file +log_search_keyword_reject=\u5173\u952E\u5B57\u963B\u65AD +radius_log=RADIUS\u534F\u8BAE +message_type=\u62A5\u6587\u7C7B\u578B +nas_ip=ISN\u63A5\u5165IP +framed_ip=\u670D\u52A1\u5668\u4E0B\u53D1\u7684\u7528\u6237\u5730\u5740 diff --git a/src/main/resources/nis.properties b/src/main/resources/nis.properties index f933d8452..f8ebfbee7 100644 --- a/src/main/resources/nis.properties +++ b/src/main/resources/nis.properties @@ -582,4 +582,5 @@ redis.expire=1800 redis.timeout=10000 dns_spoofing_ip_desc=Default Spoofing IP dns_spoofing_ip_ip=1.1.1.1 -trafficBandwidthTransTwo=trafficBandwidthTransTwo \ No newline at end of file +trafficBandwidthTransTwo=trafficBandwidthTransTwo +ntcCollectRadiusLog=ntcCollectRadiusLogs \ No newline at end of file diff --git a/src/main/resources/sql/20181212/add_sys_menu.sql b/src/main/resources/sql/20181212/add_sys_menu.sql new file mode 100644 index 000000000..4c6717657 --- /dev/null +++ b/src/main/resources/sql/20181212/add_sys_menu.sql @@ -0,0 +1,2 @@ +#添加 RADIUS协议日志 +INSERT INTO `sys_menu` (`id`, `parent_id`, `parent_ids`, `code`, `name`, `sort`, `href`, `target`, `icon`, `is_show`, `permission`, `create_by`, `create_date`, `update_by`, `update_date`, `remarks`, `del_flag`, `menu_bg`, `quick_action`, `is_top`, `function_id`) VALUES ('1179', '1131', '0,1,152,1131,', 'radius_log', 'RADIUS协议日志', '80', '/log/ntc/radiusLogs', '', '', '1', '', '1', '2018-12-12 15:14:37', '1', '2018-12-12 15:14:37', '', '1', NULL, '0', '0', '650'); diff --git a/src/main/webapp/WEB-INF/views/log/ntc/radiusLogList.jsp b/src/main/webapp/WEB-INF/views/log/ntc/radiusLogList.jsp new file mode 100644 index 000000000..e1f078a18 --- /dev/null +++ b/src/main/webapp/WEB-INF/views/log/ntc/radiusLogList.jsp @@ -0,0 +1,346 @@ +<%@ page contentType="text/html;charset=UTF-8"%> +<%@ include file="/WEB-INF/include/taglib.jsp"%> + + + + IP<spring:message code="log"></spring:message> + + + + + +
+ +

+ +

+ +
+
+
+
+ + + + + + + + + +
+
+ + + + + + + + + + +
+
+
+
+ +
+ +
+
+
+
+
+ +
+ +
+
+
+ + + +
+ +
+ + + +
+
+
+
+ + + + + + + +
+
+ +
+
+ + + + + + + +
+
+ +
+
+ + + + + + + +
+
+ +
+
+ + +
+
+ +
+
+ + +
+
+ +
+
+ + +
+
+
+
+
+ + +
+
+
+ +
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ <%-- --%> + + ${log.cfgId } + ${log.action } + + + ${dict.itemValue} + + + + ${log.foundTime }${log.recvTime } + ${log.entranceId } + + + ${dic.itemValue} + + + + ${log.code }${log.nasIp }${log.framedIp }${log.account }${fns:abbr(log.capIp, 42)} + ${log.transProto } + + + ${dic.itemValue} + + + + + ${log.addrType } + + + ${dic.itemValue} + + + + ${fns:abbr(log.dIp, 42)}${fns:abbr(log.sIp, 42)}${log.dPort }${log.sPort } + ${log.deviceId } + + + ${device.itemValue} + + + + + ${log.linkId } + + + ${link.itemValue} + + + + + ${log.encapType } + + + ${encapType.itemValue} + + + + + ${log.direction } + + + ${direction.itemValue} + + + + ${log.innerSmac }${log.innerDmac } + ${log.streamDir } + + + ${streamType.itemValue} + + + + ${log.addrList }${log.serverLocate}${log.clientLocate}${log.sAsn}${log.dAsn}${log.sSubscribeId}${log.dSubscribeId}${log.userRegion}${log.sceneFile}
+
${page}
+
+
+
+
+
+ + \ No newline at end of file