Merge branch 'develop' of http://10.0.6.99/gwall/gwall.git into develop

Conflicts:
	src/main/resources/messages/message_en.properties
	src/main/resources/messages/message_ru.properties
	src/main/resources/messages/message_zh_CN.properties
策略分组功能提交
This commit is contained in:
duandongmei
2018-06-20 13:37:07 +08:00
38 changed files with 2957 additions and 249 deletions

View File

@@ -0,0 +1,115 @@
package com.nis.web.controller.basics;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.nis.domain.Page;
import com.nis.domain.basics.PolicyGroupInfo;
import com.nis.domain.basics.ServiceDictInfo;
import com.nis.util.ConfigDictUtils;
import com.nis.util.Configurations;
import com.nis.util.StringUtil;
import com.nis.util.StringUtils;
import com.nis.web.controller.BaseController;
/**
* 协议分组
* @author dell
*
*/
@Controller
@RequestMapping(value = "${adminPath}/basics/policyGroup")
public class PolicyGroupController extends BaseController {
//@RequiresPermissions(value={"basics:policyGroup:view"},logical=Logical.OR)
@RequestMapping(value = {"/policyGroupList", ""})
public String policyGroupList(PolicyGroupInfo cfg,HttpServletRequest request, HttpServletResponse response, Model model) {
if(cfg == null)cfg=new PolicyGroupInfo();
Page<PolicyGroupInfo> pageCondition = new Page<PolicyGroupInfo>(request, response,"r");
Page page = policyGroupInfoService.findPolicyGroupInfoList(pageCondition,cfg);
model.addAttribute("cfg", cfg);
model.addAttribute("page", page);
return "/basics/policyGroupList";
}
/**
* 进入添加或修改页面
* @param serviceDictInfo
* @param model
* @return
*/
//@RequiresPermissions(value={"basics:classification:add","basics:attribute:add","basics:label:add","basics:classification:edit","basics:attribute:edit","basics:label:edit","basics:classification:view","basics:attribute:view","basics:label:view"},logical=Logical.OR)
@RequestMapping(value={"/policyGroupForm"})
public String form(String ids,Model model,String doAction) {
PolicyGroupInfo policyGroup=new PolicyGroupInfo();
if(!StringUtil.isEmpty(ids)){
policyGroup=policyGroupInfoService.getById(Integer.parseInt(ids));
}
model.addAttribute("_cfg", policyGroup);
return "/basics/policyGroupForm";
}
/**
* 新增或修改
* @return
*/
//@RequiresPermissions(value={"basics:classification:add","basics:attribute:add","basics:label:add","basics:classification:edit","basics:attribute:edit","basics:label:edit"},logical=Logical.OR)
@RequestMapping(value = "saveOrUpdate")
public String saveOrUpdate(PolicyGroupInfo cfg,Model model, RedirectAttributes redirectAttributes,String itType) {
try {
policyGroupInfoService.saveOrUpdate(cfg);
if(!StringUtil.isEmpty(cfg.getGroupId())){
addMessage(redirectAttributes, "save_success");
}else{
addMessage(redirectAttributes, "update_success");
}
} catch (Exception e) {
e.printStackTrace();
if(!StringUtil.isEmpty(cfg.getGroupId())){
addMessage(redirectAttributes, "save_failed");
}else{
addMessage(redirectAttributes, "update_failed");
}
}
return "redirect:" + adminPath + "/basics/policyGroup/policyGroupList";
}
/**
* 删除
* @return
*/
//@RequiresPermissions(value={"basics:classification:del","basics:attribute:del","basics:label:del"},logical=Logical.OR)
@RequestMapping(value={"delete"})
public String delete(RedirectAttributes redirectAttributes, String ids,int isValid) {
try {
policyGroupInfoService.deldete(ids,isValid);
addMessage(redirectAttributes, "delete_success");
} catch (Exception e) {
e.printStackTrace();
addMessage(redirectAttributes, "delete_failed");
}
return "redirect:" + adminPath + "/basics/policyGroup/policyGroupList";
}
}

View File

@@ -0,0 +1,67 @@
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.beans.BeanUtils;
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.JsonSyntaxException;
import com.google.gson.reflect.TypeToken;
import com.nis.domain.Page;
import com.nis.domain.log.NtcDnsLog;
import com.nis.domain.maat.LogRecvData;
import com.nis.util.Constants;
import com.nis.util.httpclient.HttpClientUtil;
import com.nis.web.controller.BaseController;
@Controller
@RequestMapping("${adminPath}/log/ntc/dns")
public class DnsLogController extends BaseController {
@RequestMapping("list")
public String list(@ModelAttribute("log") NtcDnsLog log, Model model, HttpServletRequest request, HttpServletResponse response) {
try {
Page<NtcDnsLog> page = new Page<NtcDnsLog>(request, response);
Map<String, Object> params = new HashMap<String, Object>();
params.put("pageSize", page.getPageSize());
params.put("pageNo", page.getPageNo());
if (StringUtils.isNotBlank(log.getqName())) {
params.put("searchQName", log.getqName());
}
initLogSearchValue(log, params);
String url = Constants.LOG_BASE_URL + Constants.NTC_DNS_LOG;
String recv = HttpClientUtil.getMsg(url, params, request);
logger.info("查询结果:" + recv);
Gson gson = new GsonBuilder().create();
LogRecvData<NtcDnsLog> fromJson = gson.fromJson(recv, new TypeToken<LogRecvData<NtcDnsLog>>(){}.getType());
if (fromJson.getStatus().intValue() == 200) {
BeanUtils.copyProperties(fromJson.getData(), page);
List<NtcDnsLog> list = page.getList();
for (NtcDnsLog l : list) {
l.setFunctionId(log.getFunctionId());
setLogAction(l);
}
model.addAttribute("page", page);
}
} catch (Exception e) {
logger.error("查询失败", e);
addMessage(model, e.getMessage());
}
return "/log/ntc/dnsList";
}
}

View File

@@ -0,0 +1,67 @@
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.beans.BeanUtils;
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.JsonSyntaxException;
import com.google.gson.reflect.TypeToken;
import com.nis.domain.Page;
import com.nis.domain.log.NtcHttpLog;
import com.nis.domain.maat.LogRecvData;
import com.nis.util.Constants;
import com.nis.util.httpclient.HttpClientUtil;
import com.nis.web.controller.BaseController;
@Controller
@RequestMapping("${adminPath}/log/ntc/http")
public class HttpLogController extends BaseController {
@RequestMapping("list")
public String list(@ModelAttribute("log") NtcHttpLog log, Model model, HttpServletRequest request, HttpServletResponse response) {
try {
Page<NtcHttpLog> page = new Page<NtcHttpLog>(request, response);
Map<String, Object> params = new HashMap<String, Object>();
params.put("pageSize", page.getPageSize());
params.put("pageNo", page.getPageNo());
if (StringUtils.isNotBlank(log.getUrl())) {
params.put("searchUrl", log.getUrl());
}
initLogSearchValue(log, params);
String url = Constants.LOG_BASE_URL + Constants.NTC_HTTP_LOG;
String recv = HttpClientUtil.getMsg(url, params, request);
logger.info("查询结果:" + recv);
Gson gson = new GsonBuilder().create();
LogRecvData<NtcHttpLog> fromJson = gson.fromJson(recv, new TypeToken<LogRecvData<NtcHttpLog>>(){}.getType());
if (fromJson.getStatus().intValue() == 200) {
BeanUtils.copyProperties(fromJson.getData(), page);
List<NtcHttpLog> list = page.getList();
for (NtcHttpLog l : list) {
l.setFunctionId(log.getFunctionId());
setLogAction(l);
}
model.addAttribute("page", page);
}
} catch (Exception e) {
logger.error("查询失败", e);
addMessage(model, e.getMessage());
}
return "/log/ntc/httpList";
}
}

View File

@@ -9,20 +9,22 @@ import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang3.StringUtils;
import org.aspectj.util.FileUtil;
import org.springframework.beans.BeanUtils;
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 org.springframework.web.bind.annotation.ResponseBody;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonSyntaxException;
import com.google.gson.reflect.TypeToken;
import com.nis.domain.Page;
import com.nis.domain.log.NtcIpLog;
import com.nis.domain.maat.LogRecvData;
import com.nis.exceptions.MaatConvertException;
import com.nis.util.Constants;
import com.nis.util.httpclient.HttpClientUtil;
import com.nis.web.controller.BaseController;
@@ -33,25 +35,53 @@ public class IpLogController extends BaseController {
@RequestMapping("list")
public String list(@ModelAttribute("log") NtcIpLog log, Model model, HttpServletRequest request, HttpServletResponse response) {
try {
Page<NtcIpLog> page = new Page<NtcIpLog>(request, response);
Map<String, Object> params = new HashMap<String, Object>();
params.put("pageSize", page.getPageSize());
params.put("pageNo", page.getPageNo());
initLogSearchValue(log, params);
String url = Constants.LOG_BASE_URL + Constants.NTC_IP_LOG;
String recv = HttpClientUtil.getMsg(url, params, request);
logger.info("查询结果:" + recv);
if (StringUtils.isNotBlank(recv)) {
Gson gson = new GsonBuilder().create();
LogRecvData<NtcIpLog> fromJson = gson.fromJson(recv, new TypeToken<LogRecvData<NtcIpLog>>(){}.getType());
if (fromJson.getStatus().intValue() == 200) {
BeanUtils.copyProperties(fromJson.getData(), page);
List<NtcIpLog> list = page.getList();
for (NtcIpLog l : list) {
l.setFunctionId(log.getFunctionId());
setLogAction(l);
}
model.addAttribute("page", page);
}
}
} catch (Exception e) {
logger.error("查询失败", e);
addMessage(model, e.getMessage());
}
return "/log/ntc/ipList";
}
@RequestMapping("testlist")
public String testlist(@ModelAttribute("log") NtcIpLog log, Model model, HttpServletRequest request, HttpServletResponse response) {
Page<NtcIpLog> page = new Page<NtcIpLog>(request, response);
Map<String, Object> params = new HashMap<String, Object>();
params.put("pageSize", page.getPageSize());
params.put("pageNo", page.getPageNo());
initLogSearchValue(log, params);
String url = Constants.LOG_BASE_URL + Constants.NTC_IP_LOG;
String recv = HttpClientUtil.getMsg(url, params);
// try {
// String path = request.getClass().getClassLoader().getResource("").getPath();
// recv = FileUtil.readAsString(new File(path + "com/nis/web/test/logTest.txt"));
// } catch (IOException e) {
// e.printStackTrace();
// }
Gson gson = new GsonBuilder().create();
String url = "http://10.0.6.121:8080/gwall/test/logTest";
try {
String recv = HttpClientUtil.getMsg(url, params, request);
logger.info("查询结果:" + recv);
Gson gson = new GsonBuilder().create();
LogRecvData<NtcIpLog> fromJson = gson.fromJson(recv, new TypeToken<LogRecvData<NtcIpLog>>(){}.getType());
if (fromJson.getStatus().intValue() == 200) {
BeanUtils.copyProperties(fromJson.getData(), page);
@@ -62,16 +92,12 @@ public class IpLogController extends BaseController {
}
model.addAttribute("page", page);
}
} catch (JsonSyntaxException e) {
logger.info("查询失败");
e.printStackTrace();
} catch (Exception e) {
logger.error("查询失败", e);
addMessage(model, e.getMessage());
}
return "/log/ntc/ipList";
}
@RequestMapping("form")
public String form() {
return "";
}
}

View File

@@ -53,7 +53,7 @@ public class IpsecController extends BaseController{
String url = "";
url = Constants.LOG_BASE_URL+Constants.NTC_IPSEC_LOG;
String jsonString = HttpClientUtil.getMsg(url,params);
String jsonString = HttpClientUtil.getMsg(url,params,request);
Gson gson = new GsonBuilder().create();
//gson泛型支持
@@ -70,8 +70,8 @@ public class IpsecController extends BaseController{
logger.info("查询Ipsec日志成功");
}
} catch (Exception e) {
logger.info("查询Ipsec日志失败");
e.printStackTrace();
logger.info("查询Ipsec日志失败", e);
addMessage(model, e.getMessage());
}
return "/log/ntc/ipsecList";
}

View File

@@ -0,0 +1,65 @@
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.springframework.beans.BeanUtils;
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.JsonSyntaxException;
import com.google.gson.reflect.TypeToken;
import com.nis.domain.Page;
import com.nis.domain.log.NtcL2tpLog;
import com.nis.domain.maat.LogRecvData;
import com.nis.util.Constants;
import com.nis.util.httpclient.HttpClientUtil;
import com.nis.web.controller.BaseController;
@Controller
@RequestMapping("${adminPath}/log/ntc/l2tpLogs")
public class L2tpLogController extends BaseController {
@RequestMapping(value = {"/list"})
public String list(HttpServletRequest request, HttpServletResponse response, Model model, @ModelAttribute("log")NtcL2tpLog ntcL2tpLog) {
Page<NtcL2tpLog> page = new Page<NtcL2tpLog>(request,response);
Map<String, Object> params = new HashMap<String,Object>();
params.put("pageSize", page.getPageSize());
params.put("pageNo", page.getPageNo());
// 请求参数判断
initLogSearchValue(ntcL2tpLog, params);
try {
// 请求接口
String url = Constants.LOG_BASE_URL + Constants.NTC_L2TP_LOG;
String resJson = HttpClientUtil.getMsg(url, params, request);
Gson gson = new GsonBuilder().create();
LogRecvData<NtcL2tpLog> fromJson = gson.fromJson(resJson, new TypeToken<LogRecvData<NtcL2tpLog>>() {}.getType());
if(fromJson.getStatus().intValue() == 200) {
Page<NtcL2tpLog> fromPage = fromJson.getData();
BeanUtils.copyProperties(fromPage, page);
List<NtcL2tpLog> list = fromPage.getList();
for (NtcL2tpLog log : list) {
log.setFunctionId(ntcL2tpLog.getFunctionId());
setLogAction(log);
}
model.addAttribute("page", page);
}
} catch (Exception e) {
logger.info("L2TP日志查询失败", e);
addMessage(model, e.getMessage());
}
return "/log/ntc/l2tpLogList";
}
}

View File

@@ -53,7 +53,7 @@ public class OpenVpnController extends BaseController{
String url = "";
url = Constants.LOG_BASE_URL+Constants.NTC_OPENVPN_LOG;
String jsonString = HttpClientUtil.getMsg(url,params);
String jsonString = HttpClientUtil.getMsg(url,params,request);
Gson gson = new GsonBuilder().create();
//gson泛型支持
@@ -70,8 +70,8 @@ public class OpenVpnController extends BaseController{
logger.info("查询OpenVpn日志成功");
}
} catch (Exception e) {
logger.info("查询OpenVpn日志失败");
e.printStackTrace();
logger.info("查询OpenVpn日志失败", e);
addMessage(model, e.getMessage());
}
return "/log/ntc/openVpnList";
}

View File

@@ -0,0 +1,65 @@
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.springframework.beans.BeanUtils;
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.JsonSyntaxException;
import com.google.gson.reflect.TypeToken;
import com.nis.domain.Page;
import com.nis.domain.log.NtcPptpLog;
import com.nis.domain.maat.LogRecvData;
import com.nis.util.Constants;
import com.nis.util.httpclient.HttpClientUtil;
import com.nis.web.controller.BaseController;
@Controller
@RequestMapping("${adminPath}/log/ntc/pptpLogs")
public class PptpLogController extends BaseController {
@RequestMapping(value = {"/list"})
public String list(HttpServletRequest request, HttpServletResponse response, Model model, @ModelAttribute("log")NtcPptpLog ntcPptpLog) {
Page<NtcPptpLog> page = new Page<NtcPptpLog>(request,response);
Map<String, Object> params = new HashMap<String,Object>();
params.put("pageSize", page.getPageSize());
params.put("pageNo", page.getPageNo());
// 请求参数判断
initLogSearchValue(ntcPptpLog, params);
try {
// 请求接口
String url = Constants.LOG_BASE_URL + Constants.NTC_PPTP_LOG;
String resJson = HttpClientUtil.getMsg(url, params, request);
Gson gson = new GsonBuilder().create();
LogRecvData<NtcPptpLog> fromJson = gson.fromJson(resJson, new TypeToken<LogRecvData<NtcPptpLog>>() {}.getType());
if(fromJson.getStatus().intValue() == 200) {
Page<NtcPptpLog> fromPage = fromJson.getData();
BeanUtils.copyProperties(fromPage, page);
List<NtcPptpLog> list = fromPage.getList();
for (NtcPptpLog log : list) {
log.setFunctionId(ntcPptpLog.getFunctionId());
setLogAction(log);
}
model.addAttribute("page", page);
}
} catch (JsonSyntaxException e) {
logger.info("PPTP日志查询失败", e);
addMessage(model, e.getMessage());
}
return "/log/ntc/pptpLogList";
}
}

View File

@@ -53,7 +53,7 @@ public class SshController extends BaseController{
String url = "";
url = Constants.LOG_BASE_URL+Constants.NTC_SSH_LOG;
String jsonString = HttpClientUtil.getMsg(url,params);
String jsonString = HttpClientUtil.getMsg(url,params,request);
Gson gson = new GsonBuilder().create();
//gson泛型支持
@@ -70,8 +70,8 @@ public class SshController extends BaseController{
logger.info("查询Ssh日志成功");
}
} catch (Exception e) {
logger.info("查询Ssh日志失败");
e.printStackTrace();
logger.info("查询Ssh日志失败", e);
addMessage(model, e.getMessage());
}
return "/log/ntc/sshList";
}

View File

@@ -0,0 +1,68 @@
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.springframework.beans.BeanUtils;
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.JsonSyntaxException;
import com.google.gson.reflect.TypeToken;
import com.nis.domain.Page;
import com.nis.domain.log.NtcSslLog;
import com.nis.domain.maat.LogRecvData;
import com.nis.util.Constants;
import com.nis.util.StringUtils;
import com.nis.util.httpclient.HttpClientUtil;
import com.nis.web.controller.BaseController;
@Controller
@RequestMapping("${adminPath}/log/ntc/sslLogs")
public class SslLogController extends BaseController {
@RequestMapping(value = {"/list"})
public String list(HttpServletRequest request, HttpServletResponse response, Model model, @ModelAttribute("log")NtcSslLog ntcSslLog) {
Page<NtcSslLog> page = new Page<NtcSslLog>(request,response);
Map<String, Object> params = new HashMap<String,Object>();
params.put("pageSize", page.getPageSize());
params.put("pageNo", page.getPageNo());
// 请求参数判断
initLogSearchValue(ntcSslLog, params);
if(StringUtils.isNotBlank(ntcSslLog.getSni())) {
params.put("SearchSni", ntcSslLog.getSni());
}
try {
// 请求接口
String url = Constants.LOG_BASE_URL + Constants.NTC_SSL_LOG;
String resJson = HttpClientUtil.getMsg(url, params, request);
Gson gson = new GsonBuilder().create();
LogRecvData<NtcSslLog> fromJson = gson.fromJson(resJson, new TypeToken<LogRecvData<NtcSslLog>>() {}.getType());
if(fromJson.getStatus().intValue() == 200) {
Page<NtcSslLog> fromPage = fromJson.getData();
BeanUtils.copyProperties(fromPage, page);
List<NtcSslLog> list = fromPage.getList();
for (NtcSslLog log : list) {
log.setFunctionId(ntcSslLog.getFunctionId());
setLogAction(log);
}
model.addAttribute("page", page);
}
} catch (Exception e) {
logger.info("SSL日志查询失败", e);
addMessage(model, e.getMessage());
}
return "/log/ntc/sslLogList";
}
}