Commit 0880a0f8 by liuyu

Merge branch 'release' into 'master'

Release

See merge request !71
parents db299a6f a28cd5b2
......@@ -4,37 +4,57 @@ import java.io.Serializable;
import java.util.List;
public class PageVO <T> implements Serializable {
int index;
int pageSize;
long total;
/**
* 当前页数
*/
private int page;
/**
* 总记录数
*/
private int total;
/**
* 总页数
*/
private int totalPage;
/**
* 每页显示的记录数
*/
private int pageLimit;
/**
* 每页显示数据记录的集合;
*/
private List<T> list;
public int getPage() {
return page;
}
List<T> list;
public void setPage(int page) {
this.page = page;
}
public int getIndex() {
return index;
public int getTotal() {
return total;
}
public void setIndex(int index) {
this.index = index;
public void setTotal(int total) {
this.total = total;
}
public int getPageSize() {
return pageSize;
public int getTotalPage() {
return totalPage;
}
public void setPageSize(int pageSize) {
this.pageSize = pageSize;
public void setTotalPage(int totalPage) {
this.totalPage = totalPage;
}
public long getTotal() {
return total;
public int getPageLimit() {
return pageLimit;
}
public void setTotal(long total) {
this.total = total;
public void setPageLimit(int pageLimit) {
this.pageLimit = pageLimit;
}
public List<T> getList() {
......@@ -45,10 +65,11 @@ public class PageVO <T> implements Serializable {
this.list = list;
}
public PageVO (int index, int pageSize, long total, List<T> t) {
this.index = index;
this.pageSize = pageSize;
public PageVO (int page, int pageSize, int total, List<T> t) {
this.page = page;
this.pageLimit = pageSize;
this.total = total;
this.totalPage = (total + pageSize - 1) / pageSize;
this.list = t;
}
}
......@@ -14,6 +14,8 @@ public class TemplateRecord {
*/
private String templateId;
private String title;
private String esId;
private String url;
......@@ -38,8 +40,9 @@ public class TemplateRecord {
public TemplateRecord() {}
public TemplateRecord(String templateId, String esId, String url, String pt, String source, String realSource, String time, String mupdate) {
public TemplateRecord(String templateId, String title, String esId, String url, String pt, String source, String realSource, String time, String mupdate) {
this.templateId = templateId;
this.title = title;
this.mupdate = mupdate;
this.esId = esId;
this.url = url;
......@@ -52,6 +55,7 @@ public class TemplateRecord {
public JSONObject toJson() {
JSONObject json = new JSONObject();
json.put("title", title);
json.put("url", url);
json.put("pt", pt);
json.put("source", source);
......
......@@ -59,10 +59,6 @@ public class TemplateTitleServiceImpl implements TemplateTitleService {
}
int i = 0;
for (String key : templateTitleVoMap.keySet()) {
// 返回数量达到指定分页数
if (res.size() == size) {
break;
}
TemplateTitleVo templateTitleVo = templateTitleVoMap.get(key);
long createTime = templateTitleVo.getCreateTime().getTime();
long updateTime = templateTitleVo.getUpdateTime().getTime();
......@@ -80,10 +76,10 @@ public class TemplateTitleServiceImpl implements TemplateTitleService {
continue;
}
i++;
// 分页过滤
if (limit >= i) {
continue;
}
// // 分页过滤
// if (limit >= i) {
// continue;
// }
Map<String, Object> map = new HashMap<>();
map.put("templateTitle", key);
map.put("project", project);
......@@ -94,11 +90,12 @@ public class TemplateTitleServiceImpl implements TemplateTitleService {
map.put("daySum", templateTitleVo.getDaySum());
map.put("mtag", templateTitleVo.getMtag());
map.put("url", templateTitleVo.getUrl());
map.put("id", templateTitleVo.getId());
res.add(map);
}
Tools.sortByField(res, orderField, isAsc);
resultMap.put("count", templateTitleVoMap.size());
resultMap.put("list", res);
resultMap.put("list", res.subList(limit, Math.min((limit + size), res.size())));
return resultMap;
}
......@@ -201,9 +198,9 @@ public class TemplateTitleServiceImpl implements TemplateTitleService {
.skip(skip).limit(pageSize).with(Sort.by(Sort.Direction.DESC, "_id"));
long count = templateRecordDao.count(query);
if (count == 0) {
return new PageVO<>(skip, pageSize, count, Collections.emptyList());
return new PageVO<>(skip, pageSize, (int) count, Collections.emptyList());
}
return new PageVO<>(skip, pageSize, count, templateRecordDao.findTemplateRecord(query).stream().map(TemplateRecord::toJson).collect(Collectors.toList()));
return new PageVO<>(skip, pageSize, (int) count, templateRecordDao.findTemplateRecord(query).stream().map(TemplateRecord::toJson).collect(Collectors.toList()));
}
......
......@@ -243,7 +243,7 @@ public class TaskServiceCommon extends BaseTaskTypePair<TaskServiceCommon.TaskCo
templateTitleVo.refreshMark();
String id = sourceObj.getString("_id");
// // 特征值记录
templateTitleService.insertTemplateRecord(new TemplateRecord(templateTitleVo.getId(), id, getUrl(markInfo), getPlatform(markInfo),
templateTitleService.insertTemplateRecord(new TemplateRecord(templateTitleVo.getId(), title, id, getUrl(markInfo), getPlatform(markInfo),
sourceObj.getString("source"), sourceObj.getString("real_source"), Tools.TIME_FORMAT.format(sourceObj.getLong("time")), updates[0]));
// 测试环境临时添加,用于对比
templateRecordDao.tempRecord(new TemplateTempRecord(templateTitleVo.getId(), templateTitleVo.getTemplateTitle(), group, getUrl(markInfo),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment