增加日志FTP页面展示及国际化
This commit is contained in:
@@ -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