日志分页增加最后一页last跟总记录数count显示,同配置分页

This commit is contained in:
zhanghongqing
2018-11-07 10:05:50 +08:00
parent c23a376b31
commit 704653e204
35 changed files with 202 additions and 47 deletions

View File

@@ -34,7 +34,7 @@ public class PageLog<T> {
private long count;// 总记录数,设置为“-1”表示不查询总数
private int first;// 首页索引
// private int last;// 尾页索引
private int last;// 尾页索引
private int prev;// 上一页索引
private int next;// 下一页索引
@@ -42,8 +42,8 @@ public class PageLog<T> {
private boolean firstPage;//是否是第一页
private boolean lastPage;//是否是最后一页
// private int length = 8;// 显示页面长度
// private int slider = 1;// 前后显示页面长度
private int length = 8;// 显示页面长度
private int slider = 1;// 前后显示页面长度
private List<T> list = new ArrayList<T>();
@@ -266,7 +266,49 @@ public class PageLog<T> {
//1
this.first = 1;
// 控制接口是否启用count last
if (this.count!=0) {
this.last = (int)(count / (this.pageSize < 1 ? 20 : this.pageSize) + first - 1);
if (this.count % this.pageSize != 0 || this.last == 0) {
this.last++;
}
if (this.last < this.first) {
this.last = this.first;
}
if (this.pageNo <= 1) {
this.pageNo = this.first;
this.firstPage=true;
}
if (this.pageNo >= this.last) {
this.pageNo = this.last;
this.lastPage=true;
}
if (this.pageNo < this.last - 1) {
this.next = this.pageNo + 1;
} else {
this.next = this.last;
}
if (this.pageNo > 1) {
this.prev = this.pageNo - 1;
} else {
this.prev = this.first;
}
//2
if (this.pageNo < this.first) {// 如果当前页小于首页
this.pageNo = this.first;
}
if (this.pageNo > this.last) {// 如果当前页大于尾页
this.pageNo = this.last;
}
}else {
//首页
if (this.pageNo <= 1) {
this.pageNo = this.first;
@@ -293,7 +335,7 @@ public class PageLog<T> {
if (this.pageNo < this.first) {// 如果当前页小于首页
this.pageNo = this.first;
}
}
}
@@ -303,14 +345,92 @@ public class PageLog<T> {
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
// 控制接口返回count last 切换分页
if (this.count!=0) {
if(list != null && list.isEmpty()) {
return "<div class=\"none-data\"><i class=\"fa fa-warning font-red-flamingo\"></i>&nbsp;&nbsp;"+requestContext.getMessage("noneData")+"</div>";
}
if (pageNo == first) {// 如果是首页
sb.append("<li class=\"disabled\"><a href=\"javascript:\">&#171; "+requestContext.getMessage("previousPage")+"</a></li>\n");
} else {
sb.append("<li><a href=\"javascript:\" onclick=\""+funcName+"("+prev+","+pageSize+",'"+funcParam+"');\">&#171; "+requestContext.getMessage("previousPage")+"</a></li>\n");
}
int begin = pageNo - (length / 2);
if (begin < first) {
begin = first;
}
int end = begin + length - 1;
if (end >= last) {
end = last;
begin = end - length + 1;
if (begin < first) {
begin = first;
}
}
if (begin > first) {
int i = 0;
for (i = first; i < first + slider && i < begin; i++) {
sb.append("<li><a href=\"javascript:\" onclick=\""+funcName+"("+i+","+pageSize+",'"+funcParam+"');\">"
+ (i + 1 - first) + "</a></li>\n");
}
if (i < begin) {
sb.append("<li class=\"disabled\"><a href=\"javascript:\">...</a></li>\n");
}
}
for (int i = begin; i <= end; i++) {
if (i == pageNo) {
sb.append("<li class=\"active\"><a href=\"javascript:\">" + (i + 1 - first)
+ "</a></li>\n");
} else {
sb.append("<li><a href=\"javascript:\" onclick=\""+funcName+"("+i+","+pageSize+",'"+funcParam+"');\">"
+ (i + 1 - first) + "</a></li>\n");
}
}
if (last - end > slider) {
sb.append("<li class=\"disabled\"><a href=\"javascript:\">...</a></li>\n");
end = last - slider;
}
for (int i = end + 1; i <= last; i++) {
sb.append("<li><a href=\"javascript:\" onclick=\""+funcName+"("+i+","+pageSize+",'"+funcParam+"');\">"
+ (i + 1 - first) + "</a></li>\n");
}
if (pageNo == last) {
sb.append("<li class=\"disabled\"><a href=\"javascript:\">"+requestContext.getMessage("nextPage")+" &#187;</a></li>\n");
} else {
sb.append("<li><a href=\"javascript:\" onclick=\""+funcName+"("+next+","+pageSize+",'"+funcParam+"');\">"
+ ""+requestContext.getMessage("nextPage")+" &#187;</a></li>\n");
}
sb.append("<li class=\"disabled controls\"><a href=\"javascript:\">"+requestContext.getMessage("current")+" ");
sb.append("<input type=\"text\" value=\""+pageNo+"\" onkeypress=\"var e=window.event||this;var c=e.keyCode||e.which;if(c==13)");
sb.append(funcName+"(this.value,"+pageSize+",'"+funcParam+"');\" onclick=\"this.select();\"/> / ");
sb.append("<input type=\"text\" value=\""+last+"\" onkeypress=\"var e=window.event||this;var c=e.keyCode||e.which;if(c==13)");
sb.append(funcName+"("+pageNo+",this.value,'"+funcParam+"');\" onclick=\"this.select();\"/> "+requestContext.getMessage("page")+"");
sb.append(""+requestContext.getMessage("total")+" <span id='showTotalCount'>" + count + "</span> "+requestContext.getMessage("count")+""+(message!=null?message:"")+"</a></li>\n");
sb.insert(0,"<ul>\n").append("</ul>\n");
sb.append("<div style=\"clear:both;\"></div>");
// sb.insert(0,"<div class=\"page\">\n").append("</div>\n");
}else {
if(list != null && list.isEmpty()&&pageNo<=1) {
return "<div class=\"none-data\"><i class=\"fa fa-warning font-red-flamingo\"></i>&nbsp;&nbsp;"+requestContext.getMessage("noneData")+"</div>";
}
StringBuilder sb = new StringBuilder();
sb.append("<li><a href=\"javascript:\" onclick=\""+funcName+"("+first+","+pageSize+",'"+funcParam+"');\">"+requestContext.getMessage("firstPage")+"</a></li>\n");
if (pageNo == first) {// 如果是首页
@@ -335,7 +455,7 @@ public class PageLog<T> {
sb.insert(0,"<ul>\n").append("</ul>\n");
sb.append("<div style=\"clear:both;\"></div>");
}
return sb.toString();
}
@@ -413,7 +533,21 @@ public class PageLog<T> {
return first;
}
/**
* 尾页索引
* @return
*/
public int getLast() {
return last;
}
/**
* 获取页面总数
* @return getLast();
*/
@JsonIgnore
public int getTotalPage() {
return getLast();
}
/**
* 是否为第一页
* @return

View File

@@ -9,6 +9,7 @@ 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;
@@ -81,7 +82,8 @@ public class DkBehaviorLogController extends BaseController{
if (fromJson.getStatus().intValue() == 200) {
Page<DkBehaviorLog> data = fromJson.getData();
page.setList(data.getList());
BeanUtils.copyProperties(fromJson.getData(), page, new String[] {"pageSize","pageNo"});
page.setList(fromJson.getData().getList());
List<DkBehaviorLog> list = page.getList();
for (DkBehaviorLog l : list) {
l.setFunctionId(entry.getFunctionId());

View File

@@ -75,7 +75,7 @@ public class AppLogController extends BaseController{
if (fromJson.getStatus().intValue() == 200) {
Page<NtcAppLog> data = fromJson.getData();
page.setList(data.getList());
BeanUtils.copyProperties(fromJson.getData(), page, new String[] {"pageSize","pageNo"});page.setList(fromJson.getData().getList());
List<NtcAppLog> list = page.getList();
for (NtcAppLog l : list) {
l.setFunctionId(entry.getFunctionId());

View File

@@ -8,6 +8,7 @@ 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;
@@ -50,7 +51,7 @@ public class BgpLogController extends BaseController {
Gson gson = new GsonBuilder().create();
LogRecvData<NtcBGPLog> fromJson = gson.fromJson(recv, new TypeToken<LogRecvData<NtcBGPLog>>(){}.getType());
if (fromJson.getStatus().intValue() == 200) {
page.setList(fromJson.getData().getList());
BeanUtils.copyProperties(fromJson.getData(), page, new String[] {"pageSize","pageNo"});page.setList(fromJson.getData().getList());
List<NtcBGPLog> list = page.getList();
for (NtcBGPLog l : list) {
l.setFunctionId(log.getFunctionId());

View File

@@ -1,7 +1,6 @@
package com.nis.web.controller.log.ntc;
import java.io.IOException;
import java.sql.Timestamp;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
@@ -11,6 +10,7 @@ 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;
@@ -23,7 +23,6 @@ import com.google.gson.JsonDeserializer;
import com.google.gson.JsonElement;
import com.google.gson.JsonParseException;
import com.google.gson.reflect.TypeToken;
import com.google.protobuf.DescriptorProtos.FieldDescriptorProto.Type;
import com.nis.domain.FunctionServiceDict;
import com.nis.domain.Page;
import com.nis.domain.PageLog;
@@ -33,7 +32,6 @@ import com.nis.util.Constants;
import com.nis.util.DictUtils;
import com.nis.util.httpclient.HttpClientUtil;
import com.nis.web.controller.BaseController;
import com.sun.jna.platform.win32.OaIdl.DATE;
@Controller
@RequestMapping(value = "${adminPath}/log/ntc/ntcDdosLogs")
@@ -87,7 +85,7 @@ public class DdosLogController extends BaseController{
if (fromJson.getStatus().intValue() == 200) {
Page<NtcDdosLog> data = fromJson.getData();
page.setList(data.getList());
BeanUtils.copyProperties(fromJson.getData(), page, new String[] {"pageSize","pageNo"});page.setList(fromJson.getData().getList());
List<NtcDdosLog> list = page.getList();
for (NtcDdosLog l : list) {
l.setFunctionId(entry.getFunctionId());

View File

@@ -56,7 +56,7 @@ public class DnsLogController extends BaseController {
LogRecvData<NtcDnsLog> fromJson = gson.fromJson(recv, new TypeToken<LogRecvData<NtcDnsLog>>(){}.getType());
if (fromJson.getStatus().intValue() == 200) {
// BeanUtils.copyProperties(fromJson.getData(), page);
page.setList(fromJson.getData().getList());
BeanUtils.copyProperties(fromJson.getData(), page, new String[] {"pageSize","pageNo"});page.setList(fromJson.getData().getList());
List<NtcDnsLog> list = page.getList();
for (NtcDnsLog l : list) {
l.setFunctionId(log.getFunctionId());

View File

@@ -68,7 +68,7 @@ public class FtpLogController extends BaseController{
if (fromJson.getStatus().intValue() == 200) {
// BeanUtils.copyProperties(fromJson.getData(), page);
Page<NtcFtpLog> data = fromJson.getData();
page.setList(data.getList());
BeanUtils.copyProperties(fromJson.getData(), page, new String[] {"pageSize","pageNo"});page.setList(fromJson.getData().getList());
List<NtcFtpLog> list = page.getList();
for (NtcFtpLog l : list) {
l.setFunctionId(entry.getFunctionId());

View File

@@ -56,7 +56,7 @@ public class HttpKeyLogController extends BaseController {
LogRecvData<NtcKeywordsUrlLog> fromJson = gson.fromJson(recv, new TypeToken<LogRecvData<NtcKeywordsUrlLog>>(){}.getType());
if (fromJson.getStatus().intValue() == 200) {
Page<NtcKeywordsUrlLog> data = fromJson.getData();
page.setList(data.getList());
BeanUtils.copyProperties(fromJson.getData(), page, new String[] {"pageSize","pageNo"});page.setList(fromJson.getData().getList());
List<NtcKeywordsUrlLog> list = page.getList();
for (NtcKeywordsUrlLog l : list) {
l.setFunctionId(log.getFunctionId());

View File

@@ -55,7 +55,7 @@ public class HttpLogController extends BaseController {
LogRecvData<NtcHttpLog> fromJson = gson.fromJson(recv, new TypeToken<LogRecvData<NtcHttpLog>>(){}.getType());
if (fromJson.getStatus().intValue() == 200) {
Page<NtcHttpLog> data = fromJson.getData();
page.setList(data.getList());
BeanUtils.copyProperties(fromJson.getData(), page, new String[] {"pageSize","pageNo"});page.setList(fromJson.getData().getList());
List<NtcHttpLog> list = page.getList();
for (NtcHttpLog l : list) {
l.setFunctionId(log.getFunctionId());

View File

@@ -56,7 +56,7 @@ public class IpLogController extends BaseController {
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);
BeanUtils.copyProperties(fromJson.getData(), page, new String[] {"pageSize","pageNo"});
page.setList(fromJson.getData().getList());
List<NtcIpLog> list = page.getList();
for (NtcIpLog l : list) {

View File

@@ -67,6 +67,7 @@ public class IpsecLogController extends BaseController{
if (fromJson.getStatus().intValue() == 200) {
List<NtcIpsecLog> list = fromJson.getData().getList();
BeanUtils.copyProperties(fromJson.getData(), page, new String[] {"pageSize","pageNo"});
page.setList(list);
for (NtcIpsecLog l : list) {
l.setFunctionId(entry.getFunctionId());

View File

@@ -53,7 +53,7 @@ public class L2tpLogController extends BaseController {
LogRecvData<NtcL2tpLog> fromJson = gson.fromJson(resJson, new TypeToken<LogRecvData<NtcL2tpLog>>() {}.getType());
if(fromJson.getStatus().intValue() == 200) {
Page<NtcL2tpLog> fromPage = fromJson.getData();
page.setList(fromPage.getList());
BeanUtils.copyProperties(fromJson.getData(), page, new String[] {"pageSize","pageNo"});page.setList(fromJson.getData().getList());
List<NtcL2tpLog> list = fromPage.getList();
for (NtcL2tpLog log : list) {
log.setFunctionId(ntcL2tpLog.getFunctionId());

View File

@@ -51,7 +51,7 @@ public class MailLogController extends BaseController {
Gson gson = new GsonBuilder().create();
LogRecvData<NtcMailLog> fromJson = gson.fromJson(recv, new TypeToken<LogRecvData<NtcMailLog>>(){}.getType());
if (fromJson.getStatus().intValue() == 200) {
page.setList(fromJson.getData().getList());
BeanUtils.copyProperties(fromJson.getData(), page, new String[] {"pageSize","pageNo"});page.setList(fromJson.getData().getList());
List<NtcMailLog> list = page.getList();
for (NtcMailLog l : list) {
l.setFunctionId(log.getFunctionId());

View File

@@ -9,6 +9,7 @@ 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;
@@ -66,7 +67,7 @@ public class MmAvIpLogController extends BaseController{
if (fromJson.getStatus().intValue() == 200) {
Page<MmAvIpLog> data = fromJson.getData();
page.setList(data.getList());
BeanUtils.copyProperties(fromJson.getData(), page, new String[] {"pageSize","pageNo"});page.setList(fromJson.getData().getList());
List<MmAvIpLog> list = page.getList();
for (MmAvIpLog l : list) {
l.setFunctionId(entry.getFunctionId());

View File

@@ -9,6 +9,7 @@ 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;
@@ -66,7 +67,7 @@ public class MmAvUrlLogController extends BaseController{
if (fromJson.getStatus().intValue() == 200) {
Page<NtcStreamMediaLog> data = fromJson.getData();
page.setList(data.getList());
BeanUtils.copyProperties(fromJson.getData(), page, new String[] {"pageSize","pageNo"});page.setList(fromJson.getData().getList());
List<NtcStreamMediaLog> list = page.getList();
for (NtcStreamMediaLog l : list) {
l.setFunctionId(entry.getFunctionId());

View File

@@ -9,6 +9,7 @@ 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;
@@ -66,7 +67,7 @@ public class MmFileDigestLogController extends BaseController{
if (fromJson.getStatus().intValue() == 200) {
Page<MmFileDigestLog> data = fromJson.getData();
page.setList(data.getList());
BeanUtils.copyProperties(fromJson.getData(), page, new String[] {"pageSize","pageNo"});page.setList(fromJson.getData().getList());
List<MmFileDigestLog> list = page.getList();
for (MmFileDigestLog l : list) {
l.setFunctionId(entry.getFunctionId());

View File

@@ -7,6 +7,7 @@ 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;
@@ -51,7 +52,7 @@ public class MmPicIpLogController extends BaseController {
LogRecvData<MmPicIpLog> fromJson = gson.fromJson(resJson, new TypeToken<LogRecvData<MmPicIpLog>>() {}.getType());
if(fromJson.getStatus().intValue() == 200) {
Page<MmPicIpLog> fromPage = fromJson.getData();
page.setList(fromPage.getList());
BeanUtils.copyProperties(fromJson.getData(), page, new String[] {"pageSize","pageNo"});page.setList(fromJson.getData().getList());
List<MmPicIpLog> list = fromPage.getList();
for (MmPicIpLog log : list) {
log.setFunctionId(mmPicIpLog.getFunctionId());

View File

@@ -7,6 +7,7 @@ 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;
@@ -51,7 +52,7 @@ public class MmPicUrlController extends BaseController{
LogRecvData<MmPicUrlLog> fromJson = gson.fromJson(resJson, new TypeToken<LogRecvData<MmPicUrlLog>>() {}.getType());
if(fromJson.getStatus().intValue() == 200) {
Page<MmPicUrlLog> fromPage = fromJson.getData();
page.setList(fromPage.getList());
BeanUtils.copyProperties(fromJson.getData(), page, new String[] {"pageSize","pageNo"});page.setList(fromJson.getData().getList());
List<MmPicUrlLog> list = fromPage.getList();
for (MmPicUrlLog log : list) {
log.setFunctionId(mmPicUrlLog.getFunctionId());

View File

@@ -7,6 +7,7 @@ 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;
@@ -53,7 +54,7 @@ public class MmPornAvSampleController extends BaseController {
if (fromJson.getStatus().intValue() == 200) {
Page<MmAvIpLog> data = fromJson.getData();
page.setList(data.getList());
BeanUtils.copyProperties(fromJson.getData(), page, new String[] {"pageSize","pageNo"});page.setList(fromJson.getData().getList());
List<MmAvIpLog> list = page.getList();
for (MmAvIpLog l : list) {
l.setFunctionId(entry.getFunctionId());
@@ -94,7 +95,7 @@ public class MmPornAvSampleController extends BaseController {
if (fromJson.getStatus().intValue() == 200) {
Page<MmAvIpLog> data = fromJson.getData();
page.setList(data.getList());
BeanUtils.copyProperties(fromJson.getData(), page, new String[] {"pageSize","pageNo"});page.setList(fromJson.getData().getList());
List<MmAvIpLog> list = page.getList();
for (MmAvIpLog l : list) {
l.setFunctionId(entry.getFunctionId());

View File

@@ -7,6 +7,7 @@ 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;
@@ -51,7 +52,7 @@ public class MmSampleAudioController extends BaseController{
LogRecvData<MmSampleAudioLog> fromJson = gson.fromJson(resJson, new TypeToken<LogRecvData<MmSampleAudioLog>>() {}.getType());
if(fromJson.getStatus().intValue() == 200) {
Page<MmSampleAudioLog> fromPage = fromJson.getData();
page.setList(fromPage.getList());
BeanUtils.copyProperties(fromJson.getData(), page, new String[] {"pageSize","pageNo"});page.setList(fromJson.getData().getList());
List<MmSampleAudioLog> list = fromPage.getList();
for (MmSampleAudioLog log : list) {
log.setFunctionId(sampleAudioLog.getFunctionId());

View File

@@ -7,6 +7,7 @@ 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;
@@ -51,7 +52,7 @@ public class MmSampleFaceController extends BaseController{
LogRecvData<MmSamplePicLog> fromJson = gson.fromJson(resJson, new TypeToken<LogRecvData<MmSamplePicLog>>() {}.getType());
if(fromJson.getStatus().intValue() == 200) {
Page<MmSamplePicLog> fromPage = fromJson.getData();
page.setList(fromPage.getList());
BeanUtils.copyProperties(fromJson.getData(), page, new String[] {"pageSize","pageNo"});page.setList(fromJson.getData().getList());
List<MmSamplePicLog> list = fromPage.getList();
for (MmSamplePicLog log : list) {
log.setFunctionId(samplePicLog.getFunctionId());

View File

@@ -7,6 +7,7 @@ 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;
@@ -51,7 +52,7 @@ public class MmSampleLogoController extends BaseController{
LogRecvData<MmSamplePicLog> fromJson = gson.fromJson(resJson, new TypeToken<LogRecvData<MmSamplePicLog>>() {}.getType());
if(fromJson.getStatus().intValue() == 200) {
Page<MmSamplePicLog> fromPage = fromJson.getData();
page.setList(fromPage.getList());
BeanUtils.copyProperties(fromJson.getData(), page, new String[] {"pageSize","pageNo"});page.setList(fromJson.getData().getList());
List<MmSamplePicLog> list = fromPage.getList();
for (MmSamplePicLog log : list) {
log.setFunctionId(samplePicLog.getFunctionId());

View File

@@ -1,3 +1,4 @@
package com.nis.web.controller.log.ntc;
import java.util.HashMap;
@@ -7,6 +8,7 @@ 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;
@@ -51,7 +53,7 @@ public class MmSamplePicController extends BaseController{
LogRecvData<MmSamplePicLog> fromJson = gson.fromJson(resJson, new TypeToken<LogRecvData<MmSamplePicLog>>() {}.getType());
if(fromJson.getStatus().intValue() == 200) {
Page<MmSamplePicLog> fromPage = fromJson.getData();
page.setList(fromPage.getList());
BeanUtils.copyProperties(fromJson.getData(), page, new String[] {"pageSize","pageNo"});page.setList(fromJson.getData().getList());
List<MmSamplePicLog> list = fromPage.getList();
for (MmSamplePicLog log : list) {
log.setFunctionId(samplePicLog.getFunctionId());

View File

@@ -7,6 +7,7 @@ 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;
@@ -51,7 +52,7 @@ public class MmSampleSpeakerController extends BaseController{
LogRecvData<MmSamplePicLog> fromJson = gson.fromJson(resJson, new TypeToken<LogRecvData<MmSamplePicLog>>() {}.getType());
if(fromJson.getStatus().intValue() == 200) {
Page<MmSamplePicLog> fromPage = fromJson.getData();
page.setList(fromPage.getList());
BeanUtils.copyProperties(fromJson.getData(), page, new String[] {"pageSize","pageNo"});page.setList(fromJson.getData().getList());
List<MmSamplePicLog> list = fromPage.getList();
for (MmSamplePicLog log : list) {
log.setFunctionId(samplePicLog.getFunctionId());

View File

@@ -7,6 +7,7 @@ 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;
@@ -51,7 +52,7 @@ public class MmSampleVideoController extends BaseController{
LogRecvData<MmSampleVideoLog> fromJson = gson.fromJson(resJson, new TypeToken<LogRecvData<MmSampleVideoLog>>() {}.getType());
if(fromJson.getStatus().intValue() == 200) {
Page<MmSampleVideoLog> fromPage = fromJson.getData();
page.setList(fromPage.getList());
BeanUtils.copyProperties(fromJson.getData(), page, new String[] {"pageSize","pageNo"});page.setList(fromJson.getData().getList());
List<MmSampleVideoLog> list = fromPage.getList();
for (MmSampleVideoLog log : list) {
log.setFunctionId(sampleVideoLog.getFunctionId());

View File

@@ -1,6 +1,5 @@
package com.nis.web.controller.log.ntc;
import java.io.File;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
@@ -10,7 +9,7 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.http.client.ClientProtocolException;
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;
@@ -58,7 +57,7 @@ public class MmSampleVoipLogController extends BaseController {
if (fromJson.getStatus().intValue() == 200) {
Page<MmVoipLog> data = fromJson.getData();
page.setList(data.getList());
BeanUtils.copyProperties(fromJson.getData(), page, new String[] {"pageSize","pageNo"});page.setList(fromJson.getData().getList());
List<MmVoipLog> list = page.getList();
for (MmVoipLog l : list) {
l.setFunctionId(entry.getFunctionId());

View File

@@ -9,6 +9,7 @@ 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;
@@ -65,7 +66,7 @@ public class MmVoipAccountLogController extends BaseController{
if (fromJson.getStatus().intValue() == 200) {
Page<MmVoipLog> data = fromJson.getData();
page.setList(data.getList());
BeanUtils.copyProperties(fromJson.getData(), page, new String[] {"pageSize","pageNo"});page.setList(fromJson.getData().getList());
List<MmVoipLog> list = page.getList();
for (MmVoipLog l : list) {
l.setFunctionId(entry.getFunctionId());

View File

@@ -9,6 +9,7 @@ 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;
@@ -65,7 +66,7 @@ public class MmVoipIpLogController extends BaseController{
if (fromJson.getStatus().intValue() == 200) {
Page<MmVoipLog> data = fromJson.getData();
page.setList(data.getList());
BeanUtils.copyProperties(fromJson.getData(), page, new String[] {"pageSize","pageNo"});page.setList(fromJson.getData().getList());
List<MmVoipLog> list = page.getList();
for (MmVoipLog l : list) {
l.setFunctionId(entry.getFunctionId());

View File

@@ -9,6 +9,7 @@ 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;
@@ -65,7 +66,7 @@ public class MmVoipLogController extends BaseController{
if (fromJson.getStatus().intValue() == 200) {
Page<MmVoipLog> data = fromJson.getData();
page.setList(data.getList());
BeanUtils.copyProperties(fromJson.getData(), page, new String[] {"pageSize","pageNo"});page.setList(fromJson.getData().getList());
List<MmVoipLog> list = page.getList();
for (MmVoipLog l : list) {
l.setFunctionId(entry.getFunctionId());

View File

@@ -67,7 +67,7 @@ public class OpenVpnLogController extends BaseController{
if (fromJson.getStatus().intValue() == 200) {
Page<NtcOpenVpnLog> data = fromJson.getData();
page.setList(data.getList());
BeanUtils.copyProperties(fromJson.getData(), page, new String[] {"pageSize","pageNo"});page.setList(fromJson.getData().getList());
List<NtcOpenVpnLog> list = page.getList();
for (NtcOpenVpnLog l : list) {
l.setFunctionId(entry.getFunctionId());

View File

@@ -8,10 +8,12 @@ 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;
@@ -47,7 +49,7 @@ public class P2pLogController extends BaseController {
Gson gson = new GsonBuilder().create();
LogRecvData<NtcP2pLog> fromJson = gson.fromJson(recv, new TypeToken<LogRecvData<NtcP2pLog>>(){}.getType());
if (fromJson.getStatus().intValue() == 200) {
page.setList(fromJson.getData().getList());
BeanUtils.copyProperties(fromJson.getData(), page, new String[] {"pageSize","pageNo"});page.setList(fromJson.getData().getList());
List<NtcP2pLog> list = page.getList();
for (NtcP2pLog l : list) {
l.setFunctionId(log.getFunctionId());

View File

@@ -54,6 +54,7 @@ public class PptpLogController extends BaseController {
if(fromJson.getStatus().intValue() == 200) {
Page<NtcPptpLog> fromPage = fromJson.getData();
List<NtcPptpLog> list = fromPage.getList();
BeanUtils.copyProperties(fromJson.getData(), page, new String[] {"pageSize","pageNo"});
page.setList(list);
for (NtcPptpLog log : list) {
log.setFunctionId(ntcPptpLog.getFunctionId());

View File

@@ -67,7 +67,7 @@ public class SshLogController extends BaseController{
if (fromJson.getStatus().intValue() == 200) {
Page<NtcSshLog> data = fromJson.getData();
page.setList(data.getList());
BeanUtils.copyProperties(fromJson.getData(), page, new String[] {"pageSize","pageNo"});page.setList(fromJson.getData().getList());
List<NtcSshLog> list = page.getList();
for (NtcSshLog l : list) {
l.setFunctionId(entry.getFunctionId());

View File

@@ -58,6 +58,7 @@ public class SslLogController extends BaseController {
if(fromJson.getStatus().intValue() == 200) {
Page<NtcSslLog> fromPage = fromJson.getData();
List<NtcSslLog> list = fromPage.getList();
BeanUtils.copyProperties(fromJson.getData(), page, new String[] {"pageSize","pageNo"});
page.setList(list);
for (NtcSslLog log : list) {
log.setFunctionId(ntcSslLog.getFunctionId());

View File

@@ -7,7 +7,7 @@ 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;
@@ -54,7 +54,7 @@ public class PxyHttpLogController extends BaseController {
LogRecvData<PxyHttpLog> fromJson = gson.fromJson(recv, new TypeToken<LogRecvData<PxyHttpLog>>(){}.getType());
if (fromJson.getStatus().intValue() == 200) {
page.setList(fromJson.getData().getList());
BeanUtils.copyProperties(fromJson.getData(), page, new String[] {"pageSize","pageNo"});page.setList(fromJson.getData().getList());
List<PxyHttpLog> list = page.getList();
for (PxyHttpLog l : list) {
l.setFunctionId(log.getFunctionId());