Commit 3f7225fc by shenjinzhu

更新检测部分,修改显示bug

parent fba731d6
......@@ -86,7 +86,7 @@ public class DataDaoImpl implements DataDao {
Criteria criteria = new Criteria();
criteria.and("source").is(source);
criteria.and("time").gte(startTime).lt(endTime);
return mongo2.find(Query.query(criteria), EasyNews.class, "net_media_" + year + (month>10?""+month:"0"+month));
return mongo2.find(Query.query(criteria), EasyNews.class, "net_media_" + year + (month>9?""+month:"0"+month));
}
@Override
......@@ -97,7 +97,7 @@ public class DataDaoImpl implements DataDao {
Criteria criteria = new Criteria();
criteria.and("spyderInfoId").is(SpId);
criteria.and("time").gt(startTime).lt(endTime);
return mongo2.find(Query.query(criteria), EasyNews.class, "net_media_" + year + (month>10?""+month:"0"+month));
return mongo2.find(Query.query(criteria), EasyNews.class, "net_media_" + year + (month>9?""+month:"0"+month));
}
@Override
......@@ -108,7 +108,7 @@ public class DataDaoImpl implements DataDao {
int month = c.get(Calendar.MONTH) + 1;
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
return weibo.count(Query.query(Criteria.where("time").gte(sdf.format(startTime)).lt(sdf.format(endTime))),
Weibo.class, "status_" + year + (month>10?""+month:"0"+month));
Weibo.class, "status_" + year + (month>9?""+month:"0"+month));
}
@Override
......@@ -149,7 +149,7 @@ public class DataDaoImpl implements DataDao {
ServerBean.class);
if (ser.isTable()) {
int month=cal.get(Calendar.MONTH)+1;
end = cal.get(Calendar.YEAR) +""+ (month>10?""+month:"0"+month);
end = cal.get(Calendar.YEAR) +""+ (month>9?""+month:"0"+month);
System.out.println(end);
}
MongoClient mongoClient = new MongoClient(ser.getDbHost(), ser.getDbPort());
......@@ -166,7 +166,7 @@ public class DataDaoImpl implements DataDao {
ServerBean.class);
if (ser.isTable()) {
int month=cal.get(Calendar.MONTH)+1;
end = cal.get(Calendar.YEAR) +""+ (month>10?""+month:"0"+month);
end = cal.get(Calendar.YEAR) +""+ (month>9?""+month:"0"+month);
}
MongoClient mongoClient = new MongoClient(ser.getDbHost(), ser.getDbPort());
// 连接到数据库
......@@ -247,7 +247,7 @@ public class DataDaoImpl implements DataDao {
int year = c.get(Calendar.YEAR);
int month = c.get(Calendar.MONTH) + 1;
return mongo2.find(Query.query(Criteria.where("time").gte(startTime).lt(endTime).and("type").is(source)),
EasyNews.class, "net_media_" + year + (month>10?""+month:"0"+month));
EasyNews.class, "net_media_" + year + (month>9?""+month:"0"+month));
}
@SuppressWarnings("unchecked")
......@@ -257,10 +257,10 @@ public class DataDaoImpl implements DataDao {
int year = c.get(Calendar.YEAR);
int month = c.get(Calendar.MONTH) + 1;
try {
return mongo2.getCollection("net_media_" + year + (month>10?""+month:"0"+month)).distinct("source",
return mongo2.getCollection("net_media_" + year + (month>9?""+month:"0"+month)).distinct("source",
new BasicDBObject("source", new BasicDBObject("$regex", param)));
} catch (Exception e) {
return mongo2.getCollection("net_media_" + year + (month>10?""+month:"0"+month)).distinct("source",
return mongo2.getCollection("net_media_" + year + (month>9?""+month:"0"+month)).distinct("source",
new BasicDBObject("source", new BasicDBObject("$regex", param)));
}
}
......@@ -284,7 +284,7 @@ public class DataDaoImpl implements DataDao {
int year = c.get(Calendar.YEAR);
int month = c.get(Calendar.MONTH) + 1;
return mongo2.find(Query.query(Criteria.where("time").gte(startTime).lt(endTime).and("type").is(type)),
EasyNews.class, "net_media_" + year + (month>10?""+month:"0"+month));
EasyNews.class, "net_media_" + year + (month>9?""+month:"0"+month));
}
@SuppressWarnings("unchecked")
......@@ -297,7 +297,7 @@ public class DataDaoImpl implements DataDao {
DBObject obj = new BasicDBObject();
obj.put("pt", new BasicDBObject("$ne", "微信"));
obj.put("type", new BasicDBObject("$regex", param));
return mongo2.getCollection("net_media_" + year + (month>10?""+month:"0"+month)).distinct("type", obj);
return mongo2.getCollection("net_media_" + year + (month>9?""+month:"0"+month)).distinct("type", obj);
} catch (Exception e) {
e.printStackTrace();
}
......@@ -360,7 +360,7 @@ public class DataDaoImpl implements DataDao {
int year = c.get(Calendar.YEAR);
int month = c.get(Calendar.MONTH) + 1;
return mongo2.find(Query.query(Criteria.where("time").gte(startTime).lt(endTime).and("spyderInfoId").is(syId)),
EasyNews.class, "net_media_" + year + (month>10?""+month:"0"+month));
EasyNews.class, "net_media_" + year + (month>9?""+month:"0"+month));
}
}
......@@ -52,13 +52,13 @@ public class NewsDaoImpl implements NewsDao {
query.addCriteria(Criteria.where("source").is(source));
query.with(new Sort(new Order(Direction.DESC, "time")));
query.limit(delayedCount);
return mongo.find(query, News.class, "net_media_" + year + (month>10?""+month:"0"+month));
return mongo.find(query, News.class, "net_media_" + year + (month>9?""+month:"0"+month));
} else {
Query query = new Query();
query.addCriteria(Criteria.where("type").is(type));
query.with(new Sort(new Order(Direction.DESC, "time")));
query.limit(delayedCount);
return mongo.find(query, News.class, "net_media_" + year + (month>10?""+month:"0"+month));
return mongo.find(query, News.class, "net_media_" + year + (month>9?""+month:"0"+month));
}
}
......@@ -72,13 +72,13 @@ public class NewsDaoImpl implements NewsDao {
query.addCriteria(Criteria.where("source").is(source));
query.with(new Sort(new Order(Direction.DESC, "time")));
query.limit(filedCount);
return mongo.find(query, News.class, "net_media_" + year + (month>10?""+month:"0"+month));
return mongo.find(query, News.class, "net_media_" + year + (month>9?""+month:"0"+month));
} else {
Query query = new Query();
query.addCriteria(Criteria.where("type").is(type));
query.with(new Sort(new Order(Direction.DESC, "time")));
query.limit(filedCount);
return mongo.find(query, News.class, "net_media_" + year + (month>10?""+month:"0"+month));
return mongo.find(query, News.class, "net_media_" + year + (month>9?""+month:"0"+month));
}
}
......@@ -90,7 +90,7 @@ public class NewsDaoImpl implements NewsDao {
Criteria criteria = new Criteria();
criteria.and("spyderInfoId").is(spyId);
criteria.and("time").gte(start).lt(end);
return mongo.count(Query.query(criteria), News.class, "net_media_" + year + (month>10?""+month:"0"+month));
return mongo.count(Query.query(criteria), News.class, "net_media_" + year + (month>9?""+month:"0"+month));
}
@Override
......@@ -109,7 +109,7 @@ public class NewsDaoImpl implements NewsDao {
Criteria criteria = new Criteria();
criteria.and("source").is(source);
criteria.and("time").gte(start).lt(end);
return (int) mongo.count(Query.query(criteria), News.class, "net_media_" + year + (month>10?""+month:"0"+month));
return (int) mongo.count(Query.query(criteria), News.class, "net_media_" + year + (month>9?""+month:"0"+month));
}
@Override
......@@ -118,7 +118,7 @@ public class NewsDaoImpl implements NewsDao {
int month = c.get(Calendar.MONTH) + 1;
int year = c.get(Calendar.YEAR);
return mongo.find(Query.query(Criteria.where("time").gte(start).lt(end)), EasyNews.class,
"net_media_" + year + (month>10?""+month:"0"+month));
"net_media_" + year + (month>9?""+month:"0"+month));
}
/**
......@@ -128,6 +128,10 @@ public class NewsDaoImpl implements NewsDao {
@Override
public List<Map<String, Object>> findNews(String host, int port, String dbNamel, String collection, int count,
String id, String pt) {
Calendar cal=Calendar.getInstance();
cal.add(Calendar.DATE, -1);
int month=cal.get(Calendar.MONTH)+1;
String end=cal.get(Calendar.YEAR)+""+(month>9?month:"0"+month);
List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
MongoCollection<Document> col = null;
if (DbDepot.newsCol != null) {
......@@ -138,14 +142,14 @@ public class NewsDaoImpl implements NewsDao {
MongoClient mongoClient = new MongoClient(host, port);
// 连接到数据库
MongoDatabase mongo = mongoClient.getDatabase(dbNamel);
col = mongo.getCollection(collection);
col = mongo.getCollection(collection+end);
DbDepot.newsCol.put(pt, col);
}
} else {
DbDepot.newsCol = new ConcurrentHashMap<String, Object>();
MongoClient mongoClient = new MongoClient(host, port);
MongoDatabase mongo = mongoClient.getDatabase(dbNamel);
col = mongo.getCollection(collection);
col = mongo.getCollection(collection+end);
DbDepot.newsCol.put(pt, col);
}
if (id != null & id.length() > 5) {
......@@ -167,5 +171,10 @@ public class NewsDaoImpl implements NewsDao {
}
return list;
}
public static void main(String[] args) {
MongoClient mongoClient = new MongoClient("115.236.59.91", 27017);
MongoDatabase mongo = mongoClient.getDatabase("mediaspider");
MongoCollection<Document> col = mongo.getCollection("");
}
}
......@@ -44,7 +44,7 @@ public class DbDepot {
if (sb.isTable()) {
if (sb.getTableKind().equals("month")) {
int month=cal.get(Calendar.MONTH) + 1;
end = cal.get(Calendar.YEAR) + (month>10?""+month:"0"+month);
end = cal.get(Calendar.YEAR) + (month>9?""+month:"0"+month);
} else {
}
......@@ -79,7 +79,7 @@ public class DbDepot {
if(sb.isTable()) {
if(sb.getTableKind().equals("month")) {
int month=cal.get(Calendar.MONTH) + 1;
end = cal.get(Calendar.YEAR) + (month>10?""+month:"0"+month);
end = cal.get(Calendar.YEAR) + (month>9?""+month:"0"+month);
}else {
}
......
......@@ -108,7 +108,7 @@ public class Task implements Runnable {
Template tp = MainThread.mainMap.get(field.getTemplateId());
Message msg = new Message();
msg.setCreateDate(new Date());
msg.setErrorMsg("字段检测时发现库内数据小于"+field.getTestCount()+"数据量为"+list);
msg.setErrorMsg("字段检测发现库内的数据小于预设检测数量:"+delayed.getTestCount()+"条,实际数据量为"+list.size());
msg.setHandle(false);
msg.setPt(field.getPt());
msg.setTemplateCreator(tp.getCreator());
......@@ -154,7 +154,7 @@ public class Task implements Runnable {
Template tp = MainThread.mainMap.get(delayed.getTemplateId());
Message msg = new Message();
msg.setCreateDate(new Date());
msg.setErrorMsg("延时检测发现库内的数据小于"+delayed.getTestCount()+"条"+"数据量为"+list);
msg.setErrorMsg("延时检测发现库内的数据小于预设检测数量:"+delayed.getTestCount()+"条,实际数据量为"+list.size());
msg.setHandle(false);
msg.setPt(delayed.getPt());
msg.setTemplateCreator(tp.getCreator());
......@@ -210,5 +210,5 @@ public class Task implements Runnable {
}
}
}
}
......@@ -78,6 +78,14 @@ public class TemplateServiceImpl implements TemplateService {
try {
int count=tempDao.findByUserCount(templateName,pt);
List<Template> data=tempDao.findByTmpName(templateName, pageNo, pageSize,pt);
for(Template tp:data){
if(MainThread.allTmp.get(tp.getTemplateId())==null){
MainThread.allTmp.put(tp.getTemplateId(), tp);
}
if(MainThread.mainMap.get(tp.getTemplateId())!=null){
tp.setOpen(true);
}
}
PageEty page=new PageEty();
if(data.size()==0){
page.setData(new ArrayList<>());
......
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