Commit 553eca9a by shenjinzhu

更新排序

parent 934e63d0
......@@ -73,7 +73,7 @@ public class MessageDaoImpl implements MessageDao {
return null;
}
DBCursor cursor = con.find(new BasicDBObject("pt", pt).append("handle", false)).skip((pageNo - 1) * pageSize)
.limit(pageSize).sort(new BasicDBObject("createDate", -1));
.limit(pageSize).sort(new BasicDBObject("templateLv",1).append("createDate", -1));
while (cursor.hasNext()) {
Map<String, Object> map = (Map<String, Object>) cursor.next();
Message msg = Change.toBean(Message.class, map);
......
......@@ -153,7 +153,7 @@ public class NewsDaoImpl implements NewsDao {
DbDepot.newsCol.put(pt, col);
}
if (id != null & id.length() > 5) {
Bson sort = new BasicDBObject("rsid", -1);
Bson sort = new BasicDBObject("savetime", -1);
FindIterable<Document> doc = col.find(new BasicDBObject("spyderInfoId", id)).sort(sort).limit(count);
MongoCursor<Document> mongoCursor = doc.iterator();
while (mongoCursor.hasNext()) {
......@@ -161,7 +161,7 @@ public class NewsDaoImpl implements NewsDao {
list.add(map);
}
}else{
Bson sort = new BasicDBObject("rsid", -1);
Bson sort = new BasicDBObject("savetime", -1);
FindIterable<Document> doc = col.find().sort(sort).limit(count);
MongoCursor<Document> mongoCursor = doc.iterator();
while (mongoCursor.hasNext()) {
......
......@@ -120,7 +120,6 @@ public class Task implements Runnable {
}
String[] fields = field.getField().split(",");
int count = list.size();
for (String fid : fields) {
String str="";
int num = count;
......@@ -194,10 +193,12 @@ public class Task implements Runnable {
}
}
Collections.sort(dNum);
System.out.println(sum);
int cutSize=(int) (dNum.size()*0.8/1);
for(int i=cutSize;i<dNum.size();i++) {
sum-=dNum.get(i);
}
System.out.println(sum);
if (sum / 1.0 / 1000 / 60/cutSize > delayed.getNewsDelayed()) {
Template tp = MainThread.mainMap.get(delayed.getTemplateId());
Message msg = new Message();
......
......@@ -71,9 +71,6 @@ public class DataController {
@ResponseBody
public String getDataByTempName(HttpServletRequest request, HttpServletResponse response,@RequestBody Map<String, Object> map)
throws UnsupportedEncodingException {
// Calendar c=Calendar.getInstance();
// c.setTimeInMillis((long) map.get("end"));
// System.out.println(new SimpleDateFormat("yyyy-MM-dd HH:mm:mm").format(c.getTime()));
long start=(long) map.get("start");
long end=(long) map.get("end");
String timeType=(String) map.get("timeType");
......
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