Commit 553eca9a by shenjinzhu

更新排序

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