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; ...@@ -4,37 +4,57 @@ import java.io.Serializable;
import java.util.List; import java.util.List;
public class PageVO <T> implements Serializable { public class PageVO <T> implements Serializable {
int index; /**
* 当前页数
int pageSize; */
private int page;
long total; /**
* 总记录数
*/
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() { public int getTotal() {
return index; return total;
} }
public void setIndex(int index) { public void setTotal(int total) {
this.index = index; this.total = total;
} }
public int getPageSize() { public int getTotalPage() {
return pageSize; return totalPage;
} }
public void setPageSize(int pageSize) { public void setTotalPage(int totalPage) {
this.pageSize = pageSize; this.totalPage = totalPage;
} }
public long getTotal() { public int getPageLimit() {
return total; return pageLimit;
} }
public void setTotal(long total) { public void setPageLimit(int pageLimit) {
this.total = total; this.pageLimit = pageLimit;
} }
public List<T> getList() { public List<T> getList() {
...@@ -45,10 +65,11 @@ public class PageVO <T> implements Serializable { ...@@ -45,10 +65,11 @@ public class PageVO <T> implements Serializable {
this.list = list; this.list = list;
} }
public PageVO (int index, int pageSize, long total, List<T> t) { public PageVO (int page, int pageSize, int total, List<T> t) {
this.index = index; this.page = page;
this.pageSize = pageSize; this.pageLimit = pageSize;
this.total = total; this.total = total;
this.totalPage = (total + pageSize - 1) / pageSize;
this.list = t; this.list = t;
} }
} }
...@@ -14,6 +14,8 @@ public class TemplateRecord { ...@@ -14,6 +14,8 @@ public class TemplateRecord {
*/ */
private String templateId; private String templateId;
private String title;
private String esId; private String esId;
private String url; private String url;
...@@ -38,8 +40,9 @@ public class TemplateRecord { ...@@ -38,8 +40,9 @@ public class TemplateRecord {
public 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.templateId = templateId;
this.title = title;
this.mupdate = mupdate; this.mupdate = mupdate;
this.esId = esId; this.esId = esId;
this.url = url; this.url = url;
...@@ -52,6 +55,7 @@ public class TemplateRecord { ...@@ -52,6 +55,7 @@ public class TemplateRecord {
public JSONObject toJson() { public JSONObject toJson() {
JSONObject json = new JSONObject(); JSONObject json = new JSONObject();
json.put("title", title);
json.put("url", url); json.put("url", url);
json.put("pt", pt); json.put("pt", pt);
json.put("source", source); json.put("source", source);
......
...@@ -59,10 +59,6 @@ public class TemplateTitleServiceImpl implements TemplateTitleService { ...@@ -59,10 +59,6 @@ public class TemplateTitleServiceImpl implements TemplateTitleService {
} }
int i = 0; int i = 0;
for (String key : templateTitleVoMap.keySet()) { for (String key : templateTitleVoMap.keySet()) {
// 返回数量达到指定分页数
if (res.size() == size) {
break;
}
TemplateTitleVo templateTitleVo = templateTitleVoMap.get(key); TemplateTitleVo templateTitleVo = templateTitleVoMap.get(key);
long createTime = templateTitleVo.getCreateTime().getTime(); long createTime = templateTitleVo.getCreateTime().getTime();
long updateTime = templateTitleVo.getUpdateTime().getTime(); long updateTime = templateTitleVo.getUpdateTime().getTime();
...@@ -80,10 +76,10 @@ public class TemplateTitleServiceImpl implements TemplateTitleService { ...@@ -80,10 +76,10 @@ public class TemplateTitleServiceImpl implements TemplateTitleService {
continue; continue;
} }
i++; i++;
// 分页过滤 // // 分页过滤
if (limit >= i) { // if (limit >= i) {
continue; // continue;
} // }
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("templateTitle", key); map.put("templateTitle", key);
map.put("project", project); map.put("project", project);
...@@ -94,11 +90,12 @@ public class TemplateTitleServiceImpl implements TemplateTitleService { ...@@ -94,11 +90,12 @@ public class TemplateTitleServiceImpl implements TemplateTitleService {
map.put("daySum", templateTitleVo.getDaySum()); map.put("daySum", templateTitleVo.getDaySum());
map.put("mtag", templateTitleVo.getMtag()); map.put("mtag", templateTitleVo.getMtag());
map.put("url", templateTitleVo.getUrl()); map.put("url", templateTitleVo.getUrl());
map.put("id", templateTitleVo.getId());
res.add(map); res.add(map);
} }
Tools.sortByField(res, orderField, isAsc); Tools.sortByField(res, orderField, isAsc);
resultMap.put("count", templateTitleVoMap.size()); resultMap.put("count", templateTitleVoMap.size());
resultMap.put("list", res); resultMap.put("list", res.subList(limit, Math.min((limit + size), res.size())));
return resultMap; return resultMap;
} }
...@@ -201,9 +198,9 @@ public class TemplateTitleServiceImpl implements TemplateTitleService { ...@@ -201,9 +198,9 @@ public class TemplateTitleServiceImpl implements TemplateTitleService {
.skip(skip).limit(pageSize).with(Sort.by(Sort.Direction.DESC, "_id")); .skip(skip).limit(pageSize).with(Sort.by(Sort.Direction.DESC, "_id"));
long count = templateRecordDao.count(query); long count = templateRecordDao.count(query);
if (count == 0) { 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 ...@@ -243,7 +243,7 @@ public class TaskServiceCommon extends BaseTaskTypePair<TaskServiceCommon.TaskCo
templateTitleVo.refreshMark(); templateTitleVo.refreshMark();
String id = sourceObj.getString("_id"); 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])); 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), 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