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:
54
src/main/java/com/nis/domain/basics/PolicyGroupInfo.java
Normal file
54
src/main/java/com/nis/domain/basics/PolicyGroupInfo.java
Normal file
@@ -0,0 +1,54 @@
|
||||
package com.nis.domain.basics;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
import com.nis.domain.configuration.BaseCfg;
|
||||
import com.nis.domain.configuration.CfgIndexInfo;
|
||||
|
||||
/**
|
||||
* @ClassName: PolicyGroupInfo.java
|
||||
* @Description: 策略分组
|
||||
* @version V1.0
|
||||
*/
|
||||
public class PolicyGroupInfo extends BaseCfg<PolicyGroupInfo> implements Serializable{
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 7931466570918016654L;
|
||||
|
||||
private Integer groupId;
|
||||
private String groupName;
|
||||
private Integer groupType;
|
||||
|
||||
public Integer getGroupId() {
|
||||
return groupId;
|
||||
}
|
||||
public void setGroupId(Integer groupId) {
|
||||
this.groupId = groupId;
|
||||
}
|
||||
public String getGroupName() {
|
||||
return groupName;
|
||||
}
|
||||
public void setGroupName(String groupName) {
|
||||
this.groupName = groupName;
|
||||
}
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
public Date getEditTime() {
|
||||
return editTime;
|
||||
}
|
||||
public void setEditTime(Date editTime) {
|
||||
this.editTime = editTime;
|
||||
}
|
||||
public Integer getGroupType() {
|
||||
return groupType;
|
||||
}
|
||||
public void setGroupType(Integer groupType) {
|
||||
this.groupType = groupType;
|
||||
}
|
||||
}
|
||||
109
src/main/java/com/nis/domain/log/NtcDnsLog.java
Normal file
109
src/main/java/com/nis/domain/log/NtcDnsLog.java
Normal file
@@ -0,0 +1,109 @@
|
||||
package com.nis.domain.log;
|
||||
|
||||
public class NtcDnsLog extends BaseLogEntity<NtcDnsLog> {
|
||||
|
||||
private static final long serialVersionUID = -3763888115864065019L;
|
||||
|
||||
private Integer qr;
|
||||
private Integer rd;
|
||||
private Integer ra;
|
||||
private String rr;
|
||||
private Integer qType;
|
||||
private Integer qClass;
|
||||
private Integer opCode;
|
||||
private String qName;
|
||||
private String cName;
|
||||
private Integer dnsSub;
|
||||
|
||||
/*以下字段无需反馈到界面*/
|
||||
private String cheatType;
|
||||
private Integer cheatRcode;
|
||||
private String cheatStrategy;
|
||||
private String cheatRr;
|
||||
|
||||
|
||||
public String getCheatType() {
|
||||
return cheatType;
|
||||
}
|
||||
public void setCheatType(String cheatType) {
|
||||
this.cheatType = cheatType;
|
||||
}
|
||||
public Integer getCheatRcode() {
|
||||
return cheatRcode;
|
||||
}
|
||||
public void setCheatRcode(Integer cheatRcode) {
|
||||
this.cheatRcode = cheatRcode;
|
||||
}
|
||||
public String getCheatStrategy() {
|
||||
return cheatStrategy;
|
||||
}
|
||||
public void setCheatStrategy(String cheatStrategy) {
|
||||
this.cheatStrategy = cheatStrategy;
|
||||
}
|
||||
public String getCheatRr() {
|
||||
return cheatRr;
|
||||
}
|
||||
public void setCheatRr(String cheatRr) {
|
||||
this.cheatRr = cheatRr;
|
||||
}
|
||||
public Integer getQr() {
|
||||
return qr;
|
||||
}
|
||||
public void setQr(Integer qr) {
|
||||
this.qr = qr;
|
||||
}
|
||||
public Integer getRd() {
|
||||
return rd;
|
||||
}
|
||||
public void setRd(Integer rd) {
|
||||
this.rd = rd;
|
||||
}
|
||||
public Integer getRa() {
|
||||
return ra;
|
||||
}
|
||||
public void setRa(Integer ra) {
|
||||
this.ra = ra;
|
||||
}
|
||||
public String getRr() {
|
||||
return rr;
|
||||
}
|
||||
public void setRr(String rr) {
|
||||
this.rr = rr;
|
||||
}
|
||||
public Integer getqType() {
|
||||
return qType;
|
||||
}
|
||||
public void setqType(Integer qType) {
|
||||
this.qType = qType;
|
||||
}
|
||||
public Integer getqClass() {
|
||||
return qClass;
|
||||
}
|
||||
public void setqClass(Integer qClass) {
|
||||
this.qClass = qClass;
|
||||
}
|
||||
public Integer getOpCode() {
|
||||
return opCode;
|
||||
}
|
||||
public void setOpCode(Integer opCode) {
|
||||
this.opCode = opCode;
|
||||
}
|
||||
public String getqName() {
|
||||
return qName;
|
||||
}
|
||||
public void setqName(String qName) {
|
||||
this.qName = qName;
|
||||
}
|
||||
public String getcName() {
|
||||
return cName;
|
||||
}
|
||||
public void setcName(String cName) {
|
||||
this.cName = cName;
|
||||
}
|
||||
public Integer getDnsSub() {
|
||||
return dnsSub;
|
||||
}
|
||||
public void setDnsSub(Integer dnsSub) {
|
||||
this.dnsSub = dnsSub;
|
||||
}
|
||||
}
|
||||
137
src/main/java/com/nis/domain/log/NtcHttpLog.java
Normal file
137
src/main/java/com/nis/domain/log/NtcHttpLog.java
Normal file
@@ -0,0 +1,137 @@
|
||||
package com.nis.domain.log;
|
||||
|
||||
public class NtcHttpLog extends BaseLogEntity<NtcHttpLog> {
|
||||
|
||||
private static final long serialVersionUID = -7697668215327123848L;
|
||||
|
||||
private String url;
|
||||
private String reqHdrFile;
|
||||
private String reqBodyFile;
|
||||
private String resHdrFile;
|
||||
private String resBodyFile;
|
||||
|
||||
/*以下字段无需反馈到界面*/
|
||||
private Integer c2sIsn;
|
||||
private Integer pxyFlag;
|
||||
private Integer httpSeq;
|
||||
private String reqLine;
|
||||
private String resLine;
|
||||
private String cookie;
|
||||
private String refefer;
|
||||
private String userAgent;
|
||||
private String userDefineKey;
|
||||
private String userDefineValue;
|
||||
private String contentLen;
|
||||
private String contentType;
|
||||
private String setCookie;
|
||||
|
||||
|
||||
public String getReqHdrFile() {
|
||||
return reqHdrFile;
|
||||
}
|
||||
public void setReqHdrFile(String reqHdrFile) {
|
||||
this.reqHdrFile = reqHdrFile;
|
||||
}
|
||||
public String getReqBodyFile() {
|
||||
return reqBodyFile;
|
||||
}
|
||||
public void setReqBodyFile(String reqBodyFile) {
|
||||
this.reqBodyFile = reqBodyFile;
|
||||
}
|
||||
public String getResHdrFile() {
|
||||
return resHdrFile;
|
||||
}
|
||||
public void setResHdrFile(String resHdrFile) {
|
||||
this.resHdrFile = resHdrFile;
|
||||
}
|
||||
public String getResBodyFile() {
|
||||
return resBodyFile;
|
||||
}
|
||||
public void setResBodyFile(String resBodyFile) {
|
||||
this.resBodyFile = resBodyFile;
|
||||
}
|
||||
public Integer getPxyFlag() {
|
||||
return pxyFlag;
|
||||
}
|
||||
public void setPxyFlag(Integer pxyFlag) {
|
||||
this.pxyFlag = pxyFlag;
|
||||
}
|
||||
public String getCookie() {
|
||||
return cookie;
|
||||
}
|
||||
public void setCookie(String cookie) {
|
||||
this.cookie = cookie;
|
||||
}
|
||||
public String getRefefer() {
|
||||
return refefer;
|
||||
}
|
||||
public void setRefefer(String refefer) {
|
||||
this.refefer = refefer;
|
||||
}
|
||||
public String getUserAgent() {
|
||||
return userAgent;
|
||||
}
|
||||
public void setUserAgent(String userAgent) {
|
||||
this.userAgent = userAgent;
|
||||
}
|
||||
public String getUserDefineKey() {
|
||||
return userDefineKey;
|
||||
}
|
||||
public void setUserDefineKey(String userDefineKey) {
|
||||
this.userDefineKey = userDefineKey;
|
||||
}
|
||||
public String getUserDefineValue() {
|
||||
return userDefineValue;
|
||||
}
|
||||
public void setUserDefineValue(String userDefineValue) {
|
||||
this.userDefineValue = userDefineValue;
|
||||
}
|
||||
public String getContentLen() {
|
||||
return contentLen;
|
||||
}
|
||||
public void setContentLen(String contentLen) {
|
||||
this.contentLen = contentLen;
|
||||
}
|
||||
public String getContentType() {
|
||||
return contentType;
|
||||
}
|
||||
public void setContentType(String contentType) {
|
||||
this.contentType = contentType;
|
||||
}
|
||||
public String getSetCookie() {
|
||||
return setCookie;
|
||||
}
|
||||
public void setSetCookie(String setCookie) {
|
||||
this.setCookie = setCookie;
|
||||
}
|
||||
public Integer getC2sIsn() {
|
||||
return c2sIsn;
|
||||
}
|
||||
public void setC2sIsn(Integer c2sIsn) {
|
||||
this.c2sIsn = c2sIsn;
|
||||
}
|
||||
public Integer getHttpSeq() {
|
||||
return httpSeq;
|
||||
}
|
||||
public void setHttpSeq(Integer httpSeq) {
|
||||
this.httpSeq = httpSeq;
|
||||
}
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
public void setUrl(String url) {
|
||||
this.url = url;
|
||||
}
|
||||
public String getReqLine() {
|
||||
return reqLine;
|
||||
}
|
||||
public void setReqLine(String reqLine) {
|
||||
this.reqLine = reqLine;
|
||||
}
|
||||
public String getResLine() {
|
||||
return resLine;
|
||||
}
|
||||
public void setResLine(String resLine) {
|
||||
this.resLine = resLine;
|
||||
}
|
||||
}
|
||||
30
src/main/java/com/nis/domain/log/NtcL2tpLog.java
Normal file
30
src/main/java/com/nis/domain/log/NtcL2tpLog.java
Normal file
@@ -0,0 +1,30 @@
|
||||
package com.nis.domain.log;
|
||||
|
||||
public class NtcL2tpLog extends BaseLogEntity<NtcL2tpLog> {
|
||||
|
||||
private static final long serialVersionUID = -3547128625966615793L;
|
||||
|
||||
private Integer tunnelType;// 通道类型
|
||||
private Integer encryptMode;// 加密方式
|
||||
private String chapName; // 用户名称
|
||||
|
||||
public String getChapName() {
|
||||
return chapName;
|
||||
}
|
||||
public void setChapName(String chapName) {
|
||||
this.chapName = chapName;
|
||||
}
|
||||
public Integer getTunnelType() {
|
||||
return tunnelType;
|
||||
}
|
||||
public void setTunnelType(Integer tunnelType) {
|
||||
this.tunnelType = tunnelType;
|
||||
}
|
||||
public Integer getEncryptMode() {
|
||||
return encryptMode;
|
||||
}
|
||||
public void setEncryptMode(Integer encryptMode) {
|
||||
this.encryptMode = encryptMode;
|
||||
}
|
||||
|
||||
}
|
||||
23
src/main/java/com/nis/domain/log/NtcPptpLog.java
Normal file
23
src/main/java/com/nis/domain/log/NtcPptpLog.java
Normal file
@@ -0,0 +1,23 @@
|
||||
package com.nis.domain.log;
|
||||
|
||||
public class NtcPptpLog extends BaseLogEntity<NtcPptpLog> {
|
||||
|
||||
private static final long serialVersionUID = 6527360739786343374L;
|
||||
|
||||
private Integer tunnelType;// 通道类型
|
||||
private Integer encryptMode;// 加密方式
|
||||
|
||||
public Integer getTunnelType() {
|
||||
return tunnelType;
|
||||
}
|
||||
public void setTunnelType(Integer tunnelType) {
|
||||
this.tunnelType = tunnelType;
|
||||
}
|
||||
public Integer getEncryptMode() {
|
||||
return encryptMode;
|
||||
}
|
||||
public void setEncryptMode(Integer encryptMode) {
|
||||
this.encryptMode = encryptMode;
|
||||
}
|
||||
|
||||
}
|
||||
37
src/main/java/com/nis/domain/log/NtcSslLog.java
Normal file
37
src/main/java/com/nis/domain/log/NtcSslLog.java
Normal file
@@ -0,0 +1,37 @@
|
||||
package com.nis.domain.log;
|
||||
|
||||
public class NtcSslLog extends BaseLogEntity<NtcSslLog>{
|
||||
|
||||
private static final long serialVersionUID = 533266057780162781L;
|
||||
|
||||
private String version;// 版本号
|
||||
private String sni;// SNI
|
||||
private String san;// SAN
|
||||
private String ca;// CA
|
||||
|
||||
public String getVersion() {
|
||||
return version;
|
||||
}
|
||||
public void setVersion(String version) {
|
||||
this.version = version;
|
||||
}
|
||||
public String getSni() {
|
||||
return sni;
|
||||
}
|
||||
public void setSni(String sni) {
|
||||
this.sni = sni;
|
||||
}
|
||||
public String getSan() {
|
||||
return san;
|
||||
}
|
||||
public void setSan(String san) {
|
||||
this.san = san;
|
||||
}
|
||||
public String getCa() {
|
||||
return ca;
|
||||
}
|
||||
public void setCa(String ca) {
|
||||
this.ca = ca;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,12 +9,15 @@
|
||||
package com.nis.util.httpclient;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.SocketTimeoutException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.apache.http.HttpStatus;
|
||||
import org.apache.http.NameValuePair;
|
||||
import org.apache.http.client.ClientProtocolException;
|
||||
@@ -24,6 +27,7 @@ import org.apache.http.client.methods.CloseableHttpResponse;
|
||||
import org.apache.http.client.methods.HttpGet;
|
||||
import org.apache.http.client.methods.HttpPost;
|
||||
import org.apache.http.client.utils.URIBuilder;
|
||||
import org.apache.http.conn.ConnectTimeoutException;
|
||||
import org.apache.http.impl.client.CloseableHttpClient;
|
||||
import org.apache.http.impl.client.DefaultHttpRequestRetryHandler;
|
||||
import org.apache.http.impl.client.HttpClients;
|
||||
@@ -31,6 +35,9 @@ import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
|
||||
import org.apache.http.message.BasicNameValuePair;
|
||||
import org.apache.http.util.EntityUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.web.servlet.support.RequestContext;
|
||||
|
||||
import com.nis.exceptions.MaatConvertException;
|
||||
|
||||
/**
|
||||
* @ClassName: HttpClientBean.java
|
||||
@@ -118,7 +125,9 @@ public class HttpClientUtil {
|
||||
* @param params 参数列表
|
||||
* @return 查询结果数据json
|
||||
*/
|
||||
public static String getMsg(String destUrl, Map<String, Object> params) {
|
||||
public static String getMsg(String destUrl, Map<String, Object> params, HttpServletRequest req) {
|
||||
RequestContext requestContext = new RequestContext(req);
|
||||
|
||||
CloseableHttpResponse response = null;
|
||||
String result = null;
|
||||
try {
|
||||
@@ -134,10 +143,20 @@ public class HttpClientUtil {
|
||||
if (status == HttpStatus.SC_OK) {
|
||||
result = EntityUtils.toString(response.getEntity());
|
||||
logger.debug("获取消息成功,相应内容如下: " + result);
|
||||
}
|
||||
} else {
|
||||
throw new MaatConvertException(requestContext.getMessage("request_service_failed") + ":" + status);
|
||||
}
|
||||
} catch (SocketTimeoutException e) {
|
||||
logger.error("获取消息失败 ", e);
|
||||
throw new MaatConvertException(requestContext.getMessage("request_service_failed") + ":timeout");
|
||||
} catch (MaatConvertException e) {
|
||||
throw e;
|
||||
} catch (ConnectTimeoutException e) {
|
||||
logger.error("获取消息失败 ", e);
|
||||
throw new MaatConvertException(requestContext.getMessage("request_service_failed") + ":timeout");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.debug("获取消息失败,相应内容如下: " + e);
|
||||
logger.error("获取消息失败 ", e);
|
||||
throw new MaatConvertException(requestContext.getMessage("request_service_failed"));
|
||||
} finally {
|
||||
try {
|
||||
if (response != null) {
|
||||
|
||||
@@ -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";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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";
|
||||
}
|
||||
}
|
||||
@@ -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";
|
||||
}
|
||||
}
|
||||
@@ -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 "";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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";
|
||||
}
|
||||
|
||||
@@ -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";
|
||||
}
|
||||
}
|
||||
@@ -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";
|
||||
}
|
||||
|
||||
@@ -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";
|
||||
}
|
||||
}
|
||||
@@ -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";
|
||||
}
|
||||
|
||||
@@ -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";
|
||||
}
|
||||
}
|
||||
15
src/main/java/com/nis/web/dao/basics/PolicyGroupInfoDao.java
Normal file
15
src/main/java/com/nis/web/dao/basics/PolicyGroupInfoDao.java
Normal file
@@ -0,0 +1,15 @@
|
||||
package com.nis.web.dao.basics;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
import com.nis.domain.basics.PolicyGroupInfo;
|
||||
import com.nis.web.dao.CrudDao;
|
||||
import com.nis.web.dao.MyBatisDao;
|
||||
|
||||
@MyBatisDao
|
||||
public interface PolicyGroupInfoDao extends CrudDao<PolicyGroupInfo> {
|
||||
List<PolicyGroupInfo> findPolicyGroupInfoList(PolicyGroupInfo policyGroupInfo);
|
||||
PolicyGroupInfo getById(int id);
|
||||
|
||||
}
|
||||
110
src/main/java/com/nis/web/dao/basics/PolicyGroupInfoDao.xml
Normal file
110
src/main/java/com/nis/web/dao/basics/PolicyGroupInfoDao.xml
Normal file
@@ -0,0 +1,110 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
<mapper namespace="com.nis.web.dao.basics.PolicyGroupInfoDao" >
|
||||
|
||||
<resultMap id="PolicyGroupInfoMap" type="com.nis.domain.basics.PolicyGroupInfo" >
|
||||
<id column="group_id" property="groupId" jdbcType="INTEGER" />
|
||||
<result column="group_name" property="groupName" jdbcType="VARCHAR" />
|
||||
<result column="group_type" property="groupType" jdbcType="INTEGER" />
|
||||
<result column="is_valid" property="isValid" jdbcType="INTEGER" />
|
||||
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
|
||||
<result column="edit_time" property="editTime" jdbcType="TIMESTAMP" />
|
||||
<result column="creator_id" property="creatorId" jdbcType="INTEGER" />
|
||||
<result column="editor_id" property="editorId" jdbcType="INTEGER" />
|
||||
</resultMap>
|
||||
<sql id="PolicyGroupInfoColumns">
|
||||
r.group_id,r.group_name,r.group_type,r.is_valid,
|
||||
r.create_time,r.edit_time,r.creator_id,r.editor_id
|
||||
</sql>
|
||||
|
||||
<!-- 查出所有 有效数据-->
|
||||
<select id="findPolicyGroupInfoList" resultMap="PolicyGroupInfoMap">
|
||||
SELECT
|
||||
<include refid="PolicyGroupInfoColumns"/>
|
||||
<trim prefix="," prefixOverrides=",">
|
||||
, s.name as creator_name
|
||||
,e.name as editor_name
|
||||
</trim>
|
||||
FROM policy_group_info r
|
||||
left join sys_user s on r.creator_id=s.id
|
||||
left join sys_user e on r.editor_id=e.id
|
||||
|
||||
<trim prefix="WHERE" prefixOverrides="AND |OR ">
|
||||
<if test="page !=null and page.where != null and page.where != ''">
|
||||
AND ${page.where}
|
||||
</if>
|
||||
<if test="groupName != null and groupName != ''">
|
||||
AND r.group_name like concat(concat('%',#{groupName,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
<if test="groupType != null">
|
||||
AND r.group_type =#{groupType }
|
||||
</if>
|
||||
AND r.IS_VALID =1
|
||||
<if test="creatorName != null and creatorName != ''">
|
||||
AND CREATOR_NAME like concat(concat('%',#{creatorName,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
<if test="editorName != null and editorName != ''">
|
||||
AND r.EDITOR_NAME like concat(concat('%',#{editorName,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
<!-- 数据范围过滤 -->
|
||||
${sqlMap.dsf}
|
||||
</trim>
|
||||
<choose>
|
||||
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
|
||||
ORDER BY ${page.orderBy}
|
||||
</when>
|
||||
<otherwise>
|
||||
ORDER BY r.group_id desc
|
||||
</otherwise>
|
||||
</choose>
|
||||
|
||||
</select>
|
||||
<insert id="insert" parameterType="com.nis.domain.basics.PolicyGroupInfo" >
|
||||
insert into policy_group_info(
|
||||
IS_VALID,
|
||||
CREATOR_ID,
|
||||
CREATE_TIME,
|
||||
GROUP_NAME,
|
||||
GROUP_TYPE
|
||||
)values (
|
||||
1,
|
||||
#{creatorId,jdbcType=INTEGER},
|
||||
#{createTime,jdbcType=TIMESTAMP},
|
||||
#{groupName,jdbcType=VARCHAR},
|
||||
#{groupType,jdbcType=INTEGER}
|
||||
)
|
||||
</insert>
|
||||
<update id="update" parameterType="com.nis.domain.basics.PolicyGroupInfo" >
|
||||
update policy_group_info
|
||||
<set >
|
||||
<trim suffixOverrides=",">
|
||||
<if test="groupName != null and groupName != ''" >
|
||||
group_name = #{groupName,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="groupType != null" >
|
||||
group_type = #{groupType,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="isValid != null" >
|
||||
is_valid = #{isValid,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="editorId != null" >
|
||||
editor_id = #{editorId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="editTime != null and editTime != ''" >
|
||||
edit_time = #{editTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
</trim>
|
||||
</set>
|
||||
<where>
|
||||
<if test="groupId != null" >
|
||||
and group_id = #{groupId,jdbcType=INTEGER}
|
||||
</if>
|
||||
</where>
|
||||
</update>
|
||||
|
||||
<select id="getById" resultType="com.nis.domain.basics.PolicyGroupInfo">
|
||||
select <include refid="PolicyGroupInfoColumns"/>
|
||||
from policy_group_info r
|
||||
where r.group_id =#{groupId}
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,83 @@
|
||||
package com.nis.web.service.basics;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.basics.PolicyGroupInfo;
|
||||
import com.nis.domain.configuration.AreaIpCfg;
|
||||
import com.nis.domain.configuration.AvVoipAccountCfg;
|
||||
import com.nis.domain.configuration.AvVoipIpCfg;
|
||||
import com.nis.domain.configuration.CfgIndexInfo;
|
||||
import com.nis.exceptions.MaatConvertException;
|
||||
import com.nis.util.ConfigServiceUtil;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.web.dao.basics.PolicyGroupInfoDao;
|
||||
import com.nis.web.security.UserUtils;
|
||||
import com.nis.web.service.BaseService;
|
||||
|
||||
@Service
|
||||
public class PolicyGroupInfoService extends BaseService{
|
||||
|
||||
@Autowired
|
||||
private PolicyGroupInfoDao policyGroupInfoDao;
|
||||
|
||||
/**
|
||||
* @param page
|
||||
* @param entity
|
||||
* @return
|
||||
*/
|
||||
public Page<PolicyGroupInfo> findPolicyGroupInfoList(Page<PolicyGroupInfo> page, PolicyGroupInfo entity) {
|
||||
entity.getSqlMap().put("dsf", configScopeFilter(entity.getCurrentUser(),"r"));
|
||||
entity.setPage(page);
|
||||
List<PolicyGroupInfo> list=policyGroupInfoDao.findPolicyGroupInfoList(entity);
|
||||
page.setList(list);
|
||||
return page;
|
||||
}
|
||||
|
||||
public PolicyGroupInfo getById(int id) {
|
||||
PolicyGroupInfo policyGroupInfo=policyGroupInfoDao.getById(id);
|
||||
return policyGroupInfo;
|
||||
}
|
||||
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public void saveOrUpdate(PolicyGroupInfo entity){
|
||||
entity.setIsValid(1);
|
||||
//新增
|
||||
if(entity.getGroupId()==null){
|
||||
Date createTime=new Date();
|
||||
entity.setCreatorId(UserUtils.getUser().getId());
|
||||
entity.setCreateTime(createTime);
|
||||
policyGroupInfoDao.insert(entity);
|
||||
//修改
|
||||
}else{
|
||||
Date editTime=new Date();
|
||||
entity.setEditorId(UserUtils.getUser().getId());
|
||||
entity.setEditTime(editTime);
|
||||
policyGroupInfoDao.update(entity);
|
||||
}
|
||||
}
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public void deldete(String ids, int isValid){
|
||||
PolicyGroupInfo entity=new PolicyGroupInfo();
|
||||
Date editTime=new Date();
|
||||
entity.setEditorId(UserUtils.getUser().getId());
|
||||
entity.setEditTime(editTime);
|
||||
entity.setIsValid(isValid);
|
||||
if(!StringUtil.isEmpty(ids)){
|
||||
for (String id : ids.split(",")) {
|
||||
if(!StringUtil.isEmpty(id)){
|
||||
entity.setGroupId(Integer.parseInt(id));
|
||||
policyGroupInfoDao.update(entity);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -3,7 +3,12 @@ package com.nis.web.test;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.aspectj.util.FileUtil;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
@@ -12,8 +17,28 @@ import com.nis.domain.Page;
|
||||
import com.nis.domain.log.NtcIpLog;
|
||||
import com.nis.domain.maat.LogRecvData;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("test")
|
||||
public class LogTest {
|
||||
|
||||
@ResponseBody
|
||||
@RequestMapping("logTest")
|
||||
public String testservice(HttpServletRequest request) {
|
||||
String recv = "";
|
||||
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();
|
||||
}
|
||||
try {
|
||||
Thread.sleep(61000);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws IOException {
|
||||
String readAsString = FileUtil.readAsString(new File("d:/test/logTest.txt"));
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
"serverPort":"8080",
|
||||
"clientPort":"8080",
|
||||
"serviceType":10,
|
||||
"entranceId":112,
|
||||
"entranceId":21,
|
||||
"deviceId":2,
|
||||
"direction":1,
|
||||
"streamType":0,
|
||||
|
||||
Reference in New Issue
Block a user