增加日志FTP页面展示及国际化
This commit is contained in:
30
src/main/java/com/nis/domain/log/NtcFtpLog.java
Normal file
30
src/main/java/com/nis/domain/log/NtcFtpLog.java
Normal file
@@ -0,0 +1,30 @@
|
||||
package com.nis.domain.log;
|
||||
|
||||
public class NtcFtpLog extends BaseLogEntity<NtcFtpLog> {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 348767275603485504L;
|
||||
|
||||
private String ftpUrl;//FTP链接
|
||||
private String ftpContent;//FTP内容
|
||||
|
||||
public String getFtpUrl() {
|
||||
return ftpUrl;
|
||||
}
|
||||
public void setFtpUrl(String ftpUrl) {
|
||||
this.ftpUrl = ftpUrl;
|
||||
}
|
||||
public String getFtpContent() {
|
||||
return ftpContent;
|
||||
}
|
||||
public void setFtpContent(String ftpContent) {
|
||||
this.ftpContent = ftpContent;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -300,6 +300,7 @@ public final class Constants {
|
||||
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","");
|
||||
public static final String NTC_FTP_LOG = Configurations.getStringProperty("ntcFtpLog","");
|
||||
//报表类型,1- 配置命中总量业务
|
||||
public static final Integer BUSINESSTYPE_CONFIG=Configurations.getIntProperty("businesstype_config", 1);
|
||||
//报表类型,2- 配置报表业务
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
package com.nis.web.controller.log.ntc;
|
||||
|
||||
import java.io.IOException;
|
||||
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.http.client.ClientProtocolException;
|
||||
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.NtcFtpLog;
|
||||
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(value = "${adminPath}/log/ntc/NtcFtpLogs")
|
||||
public class FtpController extends BaseController{
|
||||
|
||||
/**
|
||||
* @param model
|
||||
* @param entry
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
* @throws ClientProtocolException
|
||||
* @throws IOException
|
||||
*/
|
||||
@RequestMapping(value={"list",""})
|
||||
public String list(Model model,@ModelAttribute("log")NtcFtpLog entry,HttpServletRequest request, HttpServletResponse response) throws ClientProtocolException, IOException {
|
||||
|
||||
try {
|
||||
|
||||
Page<NtcFtpLog> page = new Page<NtcFtpLog>(request, response);
|
||||
Map<String, Object> params=new HashMap<>();
|
||||
params.put("pageSize", page.getPageSize());
|
||||
params.put("pageNo", page.getPageNo());
|
||||
//查询值判断
|
||||
initLogSearchValue(entry,params);
|
||||
|
||||
String url = "";
|
||||
url = Constants.LOG_BASE_URL+Constants.NTC_FTP_LOG;
|
||||
String jsonString = HttpClientUtil.getMsg(url,params,request);
|
||||
|
||||
Gson gson = new GsonBuilder().create();
|
||||
//gson泛型支持
|
||||
LogRecvData<NtcFtpLog> fromJson = gson.fromJson(jsonString, new TypeToken<LogRecvData<NtcFtpLog>>(){}.getType());
|
||||
|
||||
if (fromJson.getStatus().intValue() == 200) {
|
||||
BeanUtils.copyProperties(fromJson.getData(), page);
|
||||
List<NtcFtpLog> list = page.getList();
|
||||
for (NtcFtpLog l : list) {
|
||||
l.setFunctionId(entry.getFunctionId());
|
||||
setLogAction(l);
|
||||
}
|
||||
model.addAttribute("page", page);
|
||||
logger.info("查询Ftp日志成功");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.info("查询Ftp日志失败", e);
|
||||
addMessage(model, e.getMessage());
|
||||
}
|
||||
return "/log/ntc/ftpList";
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user