邮件日志
This commit is contained in:
@@ -1,11 +1,6 @@
|
||||
package com.nis.domain.log;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.util.Date;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.nis.domain.BaseEntity;
|
||||
import com.nis.util.DateUtils;
|
||||
|
||||
public class BaseLogEntity<T> extends BaseEntity<T> {
|
||||
|
||||
|
||||
44
src/main/java/com/nis/domain/log/NtcMailLog.java
Normal file
44
src/main/java/com/nis/domain/log/NtcMailLog.java
Normal file
@@ -0,0 +1,44 @@
|
||||
package com.nis.domain.log;
|
||||
|
||||
public class NtcMailLog extends BaseLogEntity<NtcMailLog> {
|
||||
|
||||
private static final long serialVersionUID = -2848016592975339617L;
|
||||
|
||||
private String mailProto; //邮件协议类型,不可空 SMTP/POP3/IMAP4
|
||||
private String mailFrom;
|
||||
private String mailTo;
|
||||
private String subject;
|
||||
private String emlFile;
|
||||
|
||||
public String getMailProto() {
|
||||
return mailProto;
|
||||
}
|
||||
public void setMailProto(String mailProto) {
|
||||
this.mailProto = mailProto;
|
||||
}
|
||||
public String getMailFrom() {
|
||||
return mailFrom;
|
||||
}
|
||||
public void setMailFrom(String mailFrom) {
|
||||
this.mailFrom = mailFrom;
|
||||
}
|
||||
public String getMailTo() {
|
||||
return mailTo;
|
||||
}
|
||||
public void setMailTo(String mailTo) {
|
||||
this.mailTo = mailTo;
|
||||
}
|
||||
public String getSubject() {
|
||||
return subject;
|
||||
}
|
||||
public void setSubject(String subject) {
|
||||
this.subject = subject;
|
||||
}
|
||||
public String getEmlFile() {
|
||||
return emlFile;
|
||||
}
|
||||
public void setEmlFile(String emlFile) {
|
||||
this.emlFile = emlFile;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -299,6 +299,7 @@ public final class Constants {
|
||||
public static final String NTC_OPENVPN_LOG = Configurations.getStringProperty("ntcOpenvpnLog","");
|
||||
public static final String NTC_IPSEC_LOG = Configurations.getStringProperty("ntcIpsecLog","");
|
||||
public static final String NTC_SSH_LOG = Configurations.getStringProperty("ntcSshLog","");
|
||||
public static final String NTC_MAIL_LOG = Configurations.getStringProperty("ntcMailLog","");
|
||||
//报表类型,1- 配置命中总量业务
|
||||
public static final Integer BUSINESSTYPE_CONFIG=Configurations.getIntProperty("businesstype_config", 1);
|
||||
//报表类型,2- 配置报表业务
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
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.reflect.TypeToken;
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.log.NtcMailLog;
|
||||
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/mail")
|
||||
public class MailLogController extends BaseController {
|
||||
|
||||
@RequestMapping("list")
|
||||
public String list(@ModelAttribute("log") NtcMailLog log, Model model, HttpServletRequest request, HttpServletResponse response) {
|
||||
try {
|
||||
Page<NtcMailLog> page = new Page<NtcMailLog>(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_MAIL_LOG;
|
||||
String recv = HttpClientUtil.getMsg(url, params, request);
|
||||
|
||||
logger.info("查询结果:" + recv);
|
||||
if (StringUtils.isNotBlank(recv)) {
|
||||
Gson gson = new GsonBuilder().create();
|
||||
LogRecvData<NtcMailLog> fromJson = gson.fromJson(recv, new TypeToken<LogRecvData<NtcMailLog>>(){}.getType());
|
||||
if (fromJson.getStatus().intValue() == 200) {
|
||||
BeanUtils.copyProperties(fromJson.getData(), page);
|
||||
List<NtcMailLog> list = page.getList();
|
||||
for (NtcMailLog 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/mailList";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user