Commit be7b80eb by shenjinzhu

更新接受数据方式

parent 5b360970
...@@ -8,4 +8,6 @@ public interface CrawTemplateDao { ...@@ -8,4 +8,6 @@ public interface CrawTemplateDao {
public List<CrawTemplate> findAll(); public List<CrawTemplate> findAll();
public String getSpIdByConfigName(String tempName);
} }
...@@ -5,6 +5,8 @@ import java.util.List; ...@@ -5,6 +5,8 @@ import java.util.List;
import javax.annotation.Resource; import javax.annotation.Resource;
import org.springframework.data.mongodb.core.MongoTemplate; import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import com.zhiwei.manage.bean.CrawTemplate; import com.zhiwei.manage.bean.CrawTemplate;
...@@ -19,4 +21,9 @@ public class CrawTemplateDaoImpl implements CrawTemplateDao{ ...@@ -19,4 +21,9 @@ public class CrawTemplateDaoImpl implements CrawTemplateDao{
return mongo.findAll(CrawTemplate.class); return mongo.findAll(CrawTemplate.class);
} }
@Override
public String getSpIdByConfigName(String tempName) {
return mongo.findOne(Query.query(Criteria.where("configName").is(tempName)), CrawTemplate.class).getId();
}
} }
...@@ -21,7 +21,7 @@ public interface DataDao { ...@@ -21,7 +21,7 @@ public interface DataDao {
public List<EasyNews> findBySourceFromLibrary(Date startTime, Date endTime, String source); public List<EasyNews> findBySourceFromLibrary(Date startTime, Date endTime, String source);
public List<EasyNews> findBySpId(Date startTime, Date endTime, String syId);
/** /**
* 根据数据来源来搜索数据 * 根据数据来源来搜索数据
* @param startTime * @param startTime
...@@ -43,6 +43,8 @@ public interface DataDao { ...@@ -43,6 +43,8 @@ public interface DataDao {
*/ */
public List<EasyNews> findByAccurateSpId(String startTime, String endTime, String SpId); public List<EasyNews> findByAccurateSpId(String startTime, String endTime, String SpId);
/** /**
* 微博数据统计 * 微博数据统计
* @param startTime * @param startTime
......
...@@ -86,7 +86,7 @@ public class DataDaoImpl implements DataDao { ...@@ -86,7 +86,7 @@ public class DataDaoImpl implements DataDao {
Criteria criteria = new Criteria(); Criteria criteria = new Criteria();
criteria.and("source").is(source); criteria.and("source").is(source);
criteria.and("time").gte(startTime).lt(endTime); criteria.and("time").gte(startTime).lt(endTime);
return mongo2.find(Query.query(criteria), EasyNews.class, "net_media_" + year + month); return mongo2.find(Query.query(criteria), EasyNews.class, "net_media_" + year + (month>10?""+month:"0"+month));
} }
@Override @Override
...@@ -97,7 +97,7 @@ public class DataDaoImpl implements DataDao { ...@@ -97,7 +97,7 @@ public class DataDaoImpl implements DataDao {
Criteria criteria = new Criteria(); Criteria criteria = new Criteria();
criteria.and("spyderInfoId").is(SpId); criteria.and("spyderInfoId").is(SpId);
criteria.and("time").gt(startTime).lt(endTime); criteria.and("time").gt(startTime).lt(endTime);
return mongo2.find(Query.query(criteria), EasyNews.class, "net_media_" + year + month); return mongo2.find(Query.query(criteria), EasyNews.class, "net_media_" + year + (month>10?""+month:"0"+month));
} }
@Override @Override
...@@ -108,7 +108,7 @@ public class DataDaoImpl implements DataDao { ...@@ -108,7 +108,7 @@ public class DataDaoImpl implements DataDao {
int month = c.get(Calendar.MONTH) + 1; int month = c.get(Calendar.MONTH) + 1;
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm"); 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))), return weibo.count(Query.query(Criteria.where("time").gte(sdf.format(startTime)).lt(sdf.format(endTime))),
Weibo.class, "status_" + year + month); Weibo.class, "status_" + year + (month>10?""+month:"0"+month));
} }
@Override @Override
...@@ -147,14 +147,14 @@ public class DataDaoImpl implements DataDao { ...@@ -147,14 +147,14 @@ public class DataDaoImpl implements DataDao {
Query.query(Criteria.where("pt").is(pt).andOperator(Criteria.where("other").is("data"))), Query.query(Criteria.where("pt").is(pt).andOperator(Criteria.where("other").is("data"))),
ServerBean.class); ServerBean.class);
if (ser.isTable()) { if (ser.isTable()) {
end = cal.get(Calendar.YEAR) +""+ (cal.get(Calendar.MONTH) + 1) + ""; int month=cal.get(Calendar.MONTH)+1;
end = cal.get(Calendar.YEAR) +""+ (month>10?""+month:"0"+month);
System.out.println(end); System.out.println(end);
} }
MongoClient mongoClient = new MongoClient(ser.getDbHost(), ser.getDbPort()); MongoClient mongoClient = new MongoClient(ser.getDbHost(), ser.getDbPort());
// 连接到数据库 // 连接到数据库
MongoDatabase mongo = mongoClient.getDatabase(ser.getDbName()); MongoDatabase mongo = mongoClient.getDatabase(ser.getDbName());
col = mongo.getCollection(ser.getCollection() + end); col = mongo.getCollection(ser.getCollection() + end);
System.out.println(col);
DbDepot.dataCol.put(pt, col); DbDepot.dataCol.put(pt, col);
DbDepot.month = cal.get(Calendar.MONTH); DbDepot.month = cal.get(Calendar.MONTH);
} }
...@@ -164,7 +164,8 @@ public class DataDaoImpl implements DataDao { ...@@ -164,7 +164,8 @@ public class DataDaoImpl implements DataDao {
Query.query(Criteria.where("pt").is(pt).andOperator(Criteria.where("other").is("data"))), Query.query(Criteria.where("pt").is(pt).andOperator(Criteria.where("other").is("data"))),
ServerBean.class); ServerBean.class);
if (ser.isTable()) { if (ser.isTable()) {
end = cal.get(Calendar.YEAR) + (cal.get(Calendar.MONTH) + 1) + ""; int month=cal.get(Calendar.MONTH)+1;
end = cal.get(Calendar.YEAR) +""+ (month>10?""+month:"0"+month);
} }
MongoClient mongoClient = new MongoClient(ser.getDbHost(), ser.getDbPort()); MongoClient mongoClient = new MongoClient(ser.getDbHost(), ser.getDbPort());
// 连接到数据库 // 连接到数据库
...@@ -207,10 +208,6 @@ public class DataDaoImpl implements DataDao { ...@@ -207,10 +208,6 @@ public class DataDaoImpl implements DataDao {
end.setDate(16); end.setDate(16);
Bson query = new BasicDBObject("time", new BasicDBObject("$gte", start).append("$lte", end)); Bson query = new BasicDBObject("time", new BasicDBObject("$gte", start).append("$lte", end));
System.out.println(col.count(query)); System.out.println(col.count(query));
// Bson query = new BasicDBObject("time", new BasicDBObject("$gte",
// startTime).append("$lte", endTime))
// .append("spyderInfoId", id);
// System.out.println(col.count(query));
} }
@Override @Override
...@@ -240,15 +237,6 @@ public class DataDaoImpl implements DataDao { ...@@ -240,15 +237,6 @@ public class DataDaoImpl implements DataDao {
Bson query = new BasicDBObject("time", new BasicDBObject()); Bson query = new BasicDBObject("time", new BasicDBObject());
long count = col.count(query); long count = col.count(query);
return count; return count;
// Calendar c = Calendar.getInstance();
// c.setTime(startTime);
// int year = c.get(Calendar.YEAR);
// int month = c.get(Calendar.MONTH) + 1;
// return
// mongo2.count(Query.query(Criteria.where("time").gte(startTime).lt(endTime).and("pt").is(pt)),
// News.class,
// "net_media_" + year + month);
} }
@Override @Override
...@@ -257,9 +245,8 @@ public class DataDaoImpl implements DataDao { ...@@ -257,9 +245,8 @@ public class DataDaoImpl implements DataDao {
c.setTime(startTime); c.setTime(startTime);
int year = c.get(Calendar.YEAR); int year = c.get(Calendar.YEAR);
int month = c.get(Calendar.MONTH) + 1; int month = c.get(Calendar.MONTH) + 1;
System.out.println("net_media_" + year + month); return mongo2.find(Query.query(Criteria.where("time").gte(startTime).lt(endTime).and("type").is(source)),
return mongo2.find(Query.query(Criteria.where("time").gte(startTime).lt(endTime).and("source").is(source)), EasyNews.class, "net_media_" + year + (month>10?""+month:"0"+month));
EasyNews.class, "net_media_" + year + month);
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
...@@ -269,10 +256,10 @@ public class DataDaoImpl implements DataDao { ...@@ -269,10 +256,10 @@ public class DataDaoImpl implements DataDao {
int year = c.get(Calendar.YEAR); int year = c.get(Calendar.YEAR);
int month = c.get(Calendar.MONTH) + 1; int month = c.get(Calendar.MONTH) + 1;
try { try {
return mongo2.getCollection("net_media_" + year + month).distinct("source", return mongo2.getCollection("net_media_" + year + (month>10?""+month:"0"+month)).distinct("source",
new BasicDBObject("source", new BasicDBObject("$regex", param))); new BasicDBObject("source", new BasicDBObject("$regex", param)));
} catch (Exception e) { } catch (Exception e) {
return mongo2.getCollection("net_media_" + year + month).distinct("source", return mongo2.getCollection("net_media_" + year + (month>10?""+month:"0"+month)).distinct("source",
new BasicDBObject("source", new BasicDBObject("$regex", param))); new BasicDBObject("source", new BasicDBObject("$regex", param)));
} }
} }
...@@ -296,7 +283,7 @@ public class DataDaoImpl implements DataDao { ...@@ -296,7 +283,7 @@ public class DataDaoImpl implements DataDao {
int year = c.get(Calendar.YEAR); int year = c.get(Calendar.YEAR);
int month = c.get(Calendar.MONTH) + 1; int month = c.get(Calendar.MONTH) + 1;
return mongo2.find(Query.query(Criteria.where("time").gte(startTime).lt(endTime).and("type").is(type)), return mongo2.find(Query.query(Criteria.where("time").gte(startTime).lt(endTime).and("type").is(type)),
EasyNews.class, "net_media_" + year + month); EasyNews.class, "net_media_" + year + (month>10?""+month:"0"+month));
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
...@@ -309,7 +296,7 @@ public class DataDaoImpl implements DataDao { ...@@ -309,7 +296,7 @@ public class DataDaoImpl implements DataDao {
DBObject obj = new BasicDBObject(); DBObject obj = new BasicDBObject();
obj.put("pt", new BasicDBObject("$ne", "微信")); obj.put("pt", new BasicDBObject("$ne", "微信"));
obj.put("type", new BasicDBObject("$regex", param)); obj.put("type", new BasicDBObject("$regex", param));
return mongo2.getCollection("net_media_" + year + month).distinct("type", obj); return mongo2.getCollection("net_media_" + year + (month>10?""+month:"0"+month)).distinct("type", obj);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
...@@ -365,4 +352,14 @@ public class DataDaoImpl implements DataDao { ...@@ -365,4 +352,14 @@ public class DataDaoImpl implements DataDao {
return list; return list;
} }
@Override
public List<EasyNews> findBySpId(Date startTime, Date endTime, String syId) {
Calendar c = Calendar.getInstance();
c.setTime(startTime);
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));
}
} }
...@@ -56,7 +56,7 @@ public class FieldBeanDaoImpl implements FieldBeanDao { ...@@ -56,7 +56,7 @@ public class FieldBeanDaoImpl implements FieldBeanDao {
@Override @Override
public FieldBean getFieldsByPt(String pt) { public FieldBean getFieldsByPt(String pt) {
return mongo.findOne(Query.query(Criteria.where("pt").regex(pt)), FieldBean.class); return mongo.findOne(Query.query(Criteria.where("pt").is(pt)), FieldBean.class);
} }
@Override @Override
...@@ -64,7 +64,7 @@ public class FieldBeanDaoImpl implements FieldBeanDao { ...@@ -64,7 +64,7 @@ public class FieldBeanDaoImpl implements FieldBeanDao {
if(pt==null||pt.equals("")){ if(pt==null||pt.equals("")){
return (int) mongo.count(null, FieldBean.class); return (int) mongo.count(null, FieldBean.class);
}else{ }else{
return (int) mongo.count(Query.query(Criteria.where("pt").regex(pt)), FieldBean.class); return (int) mongo.count(Query.query(Criteria.where("pt").is(pt)), FieldBean.class);
} }
} }
...@@ -73,7 +73,7 @@ public class FieldBeanDaoImpl implements FieldBeanDao { ...@@ -73,7 +73,7 @@ public class FieldBeanDaoImpl implements FieldBeanDao {
if(pt==null||pt.equals("")){ if(pt==null||pt.equals("")){
return mongo.find(Query.query(Criteria.where("_id").exists(true)).skip((pageNo-1)*pageSize).limit(pageSize),FieldBean.class); return mongo.find(Query.query(Criteria.where("_id").exists(true)).skip((pageNo-1)*pageSize).limit(pageSize),FieldBean.class);
}else{ }else{
return mongo.find(Query.query(Criteria.where("pt").regex(pt)).skip((pageNo-1)*pageSize).limit(pageSize),FieldBean.class); return mongo.find(Query.query(Criteria.where("pt").is(pt)).skip((pageNo-1)*pageSize).limit(pageSize),FieldBean.class);
} }
} }
......
...@@ -128,8 +128,12 @@ public class MessageDaoImpl implements MessageDao { ...@@ -128,8 +128,12 @@ public class MessageDaoImpl implements MessageDao {
if (con == null) { if (con == null) {
return false; return false;
} }
System.out.println(con);
for (String msg : messageId) { for (String msg : messageId) {
WriteResult wr = con.remove(new BasicDBObject("_id", new ObjectId(msg))); WriteResult wr = con.remove(new BasicDBObject("_id", new ObjectId(msg)));
if(wr.getN()==0) {
return false;
}
} }
return true; return true;
} }
...@@ -146,9 +150,6 @@ public class MessageDaoImpl implements MessageDao { ...@@ -146,9 +150,6 @@ public class MessageDaoImpl implements MessageDao {
return 0; return 0;
} }
return (int) con.count(new BasicDBObject("handle", false).append("pt",pt )); return (int) con.count(new BasicDBObject("handle", false).append("pt",pt ));
// return (int)
// mongo.count(Query.query(Criteria.where("handle").is(false)),
// Message.class);
} }
@Override @Override
......
...@@ -52,13 +52,13 @@ public class NewsDaoImpl implements NewsDao { ...@@ -52,13 +52,13 @@ public class NewsDaoImpl implements NewsDao {
query.addCriteria(Criteria.where("source").is(source)); query.addCriteria(Criteria.where("source").is(source));
query.with(new Sort(new Order(Direction.DESC, "time"))); query.with(new Sort(new Order(Direction.DESC, "time")));
query.limit(delayedCount); query.limit(delayedCount);
return mongo.find(query, News.class, "net_media_" + year + month); return mongo.find(query, News.class, "net_media_" + year + (month>10?""+month:"0"+month));
} else { } else {
Query query = new Query(); Query query = new Query();
query.addCriteria(Criteria.where("type").is(type)); query.addCriteria(Criteria.where("type").is(type));
query.with(new Sort(new Order(Direction.DESC, "time"))); query.with(new Sort(new Order(Direction.DESC, "time")));
query.limit(delayedCount); query.limit(delayedCount);
return mongo.find(query, News.class, "net_media_" + year + month); return mongo.find(query, News.class, "net_media_" + year + (month>10?""+month:"0"+month));
} }
} }
...@@ -72,13 +72,13 @@ public class NewsDaoImpl implements NewsDao { ...@@ -72,13 +72,13 @@ public class NewsDaoImpl implements NewsDao {
query.addCriteria(Criteria.where("source").is(source)); query.addCriteria(Criteria.where("source").is(source));
query.with(new Sort(new Order(Direction.DESC, "time"))); query.with(new Sort(new Order(Direction.DESC, "time")));
query.limit(filedCount); query.limit(filedCount);
return mongo.find(query, News.class, "net_media_" + year + month); return mongo.find(query, News.class, "net_media_" + year + (month>10?""+month:"0"+month));
} else { } else {
Query query = new Query(); Query query = new Query();
query.addCriteria(Criteria.where("type").is(type)); query.addCriteria(Criteria.where("type").is(type));
query.with(new Sort(new Order(Direction.DESC, "time"))); query.with(new Sort(new Order(Direction.DESC, "time")));
query.limit(filedCount); query.limit(filedCount);
return mongo.find(query, News.class, "net_media_" + year + month); return mongo.find(query, News.class, "net_media_" + year + (month>10?""+month:"0"+month));
} }
} }
...@@ -90,7 +90,7 @@ public class NewsDaoImpl implements NewsDao { ...@@ -90,7 +90,7 @@ public class NewsDaoImpl implements NewsDao {
Criteria criteria = new Criteria(); Criteria criteria = new Criteria();
criteria.and("spyderInfoId").is(spyId); criteria.and("spyderInfoId").is(spyId);
criteria.and("time").gte(start).lt(end); criteria.and("time").gte(start).lt(end);
return mongo.count(Query.query(criteria), News.class, "net_media_" + year + month); return mongo.count(Query.query(criteria), News.class, "net_media_" + year + (month>10?""+month:"0"+month));
} }
@Override @Override
...@@ -109,7 +109,7 @@ public class NewsDaoImpl implements NewsDao { ...@@ -109,7 +109,7 @@ public class NewsDaoImpl implements NewsDao {
Criteria criteria = new Criteria(); Criteria criteria = new Criteria();
criteria.and("source").is(source); criteria.and("source").is(source);
criteria.and("time").gte(start).lt(end); criteria.and("time").gte(start).lt(end);
return (int) mongo.count(Query.query(criteria), News.class, "net_media_" + year + month); return (int) mongo.count(Query.query(criteria), News.class, "net_media_" + year + (month>10?""+month:"0"+month));
} }
@Override @Override
...@@ -118,7 +118,7 @@ public class NewsDaoImpl implements NewsDao { ...@@ -118,7 +118,7 @@ public class NewsDaoImpl implements NewsDao {
int month = c.get(Calendar.MONTH) + 1; int month = c.get(Calendar.MONTH) + 1;
int year = c.get(Calendar.YEAR); int year = c.get(Calendar.YEAR);
return mongo.find(Query.query(Criteria.where("time").gte(start).lt(end)), EasyNews.class, return mongo.find(Query.query(Criteria.where("time").gte(start).lt(end)), EasyNews.class,
"net_media_" + year + month); "net_media_" + year + (month>10?""+month:"0"+month));
} }
/** /**
......
...@@ -37,8 +37,8 @@ public class TemplateDaoImpl implements TemplateDao { ...@@ -37,8 +37,8 @@ public class TemplateDaoImpl implements TemplateDao {
@Override @Override
public boolean insert(Template template) { public boolean insert(Template template) {
DBCollection con = null; DBCollection con = null;
if (DbDepot.dbCons.get(template.getPt()+"msg") != null) { if (DbDepot.dbCons.get(template.getPt()+"temp") != null) {
con = (DBCollection) DbDepot.dbCons.get(template.getPt()+"msg"); con = (DBCollection) DbDepot.dbCons.get(template.getPt()+"temp");
} else { } else {
con = dbDepot.getDBCollection("msg",template.getPt()); con = dbDepot.getDBCollection("msg",template.getPt());
} }
......
...@@ -44,7 +44,8 @@ public class DbDepot { ...@@ -44,7 +44,8 @@ public class DbDepot {
String end = ""; String end = "";
if (sb.isTable()) { if (sb.isTable()) {
if (sb.getTableKind().equals("month")) { if (sb.getTableKind().equals("month")) {
end = cal.get(Calendar.YEAR) + (cal.get(Calendar.MONTH) + 1) + ""; int month=cal.get(Calendar.MONTH) + 1;
end = cal.get(Calendar.YEAR) + (month>10?""+month:"0"+month);
} else { } else {
} }
...@@ -69,15 +70,17 @@ public class DbDepot { ...@@ -69,15 +70,17 @@ public class DbDepot {
ServerBean sb = mongo.findOne( ServerBean sb = mongo.findOne(
Query.query(Criteria.where("pt").is(pt).orOperator(Criteria.where("other").is(other))), Query.query(Criteria.where("pt").is(pt).orOperator(Criteria.where("other").is(other))),
ServerBean.class); ServerBean.class);
System.out.println(pt);
System.out.println(sb);
Calendar cal=Calendar.getInstance(); Calendar cal=Calendar.getInstance();
month=cal.get(Calendar.MONTH+1); month=cal.get(Calendar.MONTH+1);
if (sb != null) { if (sb != null) {
if (sb.getDbType().equals("mongo")) { if (sb.getDbType().equals("mongo")) {
String end=""; String end="";
if(sb.isTable()) { if(sb.isTable()) {
if(sb.getTableKind().equals("month")) { if(sb.getTableKind().equals("month")) {
end = cal.get(Calendar.YEAR) +""+ (cal.get(Calendar.MONTH) + 1) + ""; int month=cal.get(Calendar.MONTH) + 1;
end = cal.get(Calendar.YEAR) + (month>10?""+month:"0"+month);
}else { }else {
} }
......
...@@ -147,12 +147,12 @@ public class MainThread extends Thread { ...@@ -147,12 +147,12 @@ public class MainThread extends Thread {
ServerServiceImpl serverService = BeanFactory.getBean(ServerServiceImpl.class); ServerServiceImpl serverService = BeanFactory.getBean(ServerServiceImpl.class);
MessageServiceImpl msgService = BeanFactory.getBean(MessageServiceImpl.class); MessageServiceImpl msgService = BeanFactory.getBean(MessageServiceImpl.class);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
// int num = 1; // int num = 1;
while (true) { while (true) {
Calendar countTest = Calendar.getInstance(); Calendar countTest = Calendar.getInstance();
Calendar start = Calendar.getInstance(); Calendar start = Calendar.getInstance();
Calendar end = Calendar.getInstance(); Calendar end = Calendar.getInstance();
// start.set(Calendar.HOUR_OF_DAY, 0); // start.set(Calendar.HOUR_OF_DAY, 0);
// end.set(Calendar.HOUR_OF_DAY, 0); // end.set(Calendar.HOUR_OF_DAY, 0);
if (start.get(Calendar.HOUR_OF_DAY) < 1) { if (start.get(Calendar.HOUR_OF_DAY) < 1) {
try { try {
...@@ -162,6 +162,7 @@ public class MainThread extends Thread { ...@@ -162,6 +162,7 @@ public class MainThread extends Thread {
} catch (ParseException e1) { } catch (ParseException e1) {
e1.printStackTrace(); e1.printStackTrace();
} }
// int num = 1;
// for (int i = 0; i < 19; i++) { // for (int i = 0; i < 19; i++) {
start.add(Calendar.DATE, -1); start.add(Calendar.DATE, -1);
countTest.add(Calendar.DATE, -3); countTest.add(Calendar.DATE, -3);
...@@ -184,6 +185,7 @@ public class MainThread extends Thread { ...@@ -184,6 +185,7 @@ public class MainThread extends Thread {
data.setSpyderInfoId(cr.getId()); data.setSpyderInfoId(cr.getId());
dataService.insert(data); dataService.insert(data);
if (count == 0) { if (count == 0) {
// if (num == 1) {
int testCount = (int) dataService.finCountByDayData(countTest.getTime(), int testCount = (int) dataService.finCountByDayData(countTest.getTime(),
end.getTime(), chan.getPt(), cr.getId()); end.getTime(), chan.getPt(), cr.getId());
if (testCount == 0) { if (testCount == 0) {
...@@ -196,6 +198,7 @@ public class MainThread extends Thread { ...@@ -196,6 +198,7 @@ public class MainThread extends Thread {
m.setErrorMsg("未定义," + cr.getConfigName() + "," + chan.getId() + "数据为0"); m.setErrorMsg("未定义," + cr.getConfigName() + "," + chan.getId() + "数据为0");
msgService.insert(m); msgService.insert(m);
} }
// }
} }
log.info(TimeUtil.yearToDay(start.getTime()) + "|" + data.getTempName() + "|入库"); log.info(TimeUtil.yearToDay(start.getTime()) + "|" + data.getTempName() + "|入库");
} }
...@@ -222,9 +225,10 @@ public class MainThread extends Thread { ...@@ -222,9 +225,10 @@ public class MainThread extends Thread {
} finally { } finally {
mainLock.unlock(); mainLock.unlock();
} }
// end.add(Calendar.DATE, -1); // end.add(Calendar.DATE, -1);
// num++;
// } // }
Tools.sleep(1000 * 60*60); Tools.sleep(1000 * 60 * 60);
} }
Tools.sleep(1000 * 30); Tools.sleep(1000 * 30);
} }
......
...@@ -26,6 +26,8 @@ public interface DataService { ...@@ -26,6 +26,8 @@ public interface DataService {
public List<EasyNews> findByAccurateType(Date startTime, Date endTime, String type); public List<EasyNews> findByAccurateType(Date startTime, Date endTime, String type);
public List<EasyNews> findByTempName(Date startTime, Date endTime, String tempName);
public long findWeiboCount(Date start, Date end); public long findWeiboCount(Date start, Date end);
public long findWeixinCount(Date start, Date end,String pt); public long findWeixinCount(Date start, Date end,String pt);
......
...@@ -8,13 +8,15 @@ import org.springframework.stereotype.Service; ...@@ -8,13 +8,15 @@ import org.springframework.stereotype.Service;
import com.zhiwei.manage.bean.Data; import com.zhiwei.manage.bean.Data;
import com.zhiwei.manage.bean.EasyNews; import com.zhiwei.manage.bean.EasyNews;
import com.zhiwei.manage.dao.CrawTemplateDao;
import com.zhiwei.manage.dao.DataDao; import com.zhiwei.manage.dao.DataDao;
@Service @Service
public class DataServiceImpl implements DataService{ public class DataServiceImpl implements DataService{
@Autowired @Autowired
private DataDao dataDao; private DataDao dataDao;
@Autowired
private CrawTemplateDao crd;
@Override @Override
public void insert(Data data) { public void insert(Data data) {
...@@ -91,6 +93,12 @@ public class DataServiceImpl implements DataService{ ...@@ -91,6 +93,12 @@ public class DataServiceImpl implements DataService{
return dataDao.finCountByDayData(startTime, endTime, pt, id); return dataDao.finCountByDayData(startTime, endTime, pt, id);
} }
@Override
public List<EasyNews> findByTempName(Date startTime, Date endTime, String tempName) {
String spId=crd.getSpIdByConfigName(tempName);
return dataDao.findBySpId(startTime, endTime, spId);
}
} }
...@@ -39,7 +39,7 @@ public class MessageServiceImpl implements MessageService { ...@@ -39,7 +39,7 @@ public class MessageServiceImpl implements MessageService {
PageEty page = new PageEty(); PageEty page = new PageEty();
List<Message> data = messageDao.findAll(pageNo, pageSize,pt); List<Message> data = messageDao.findAll(pageNo, pageSize,pt);
int count = messageDao.allCount(pt); int count = messageDao.allCount(pt);
if (count % pageSize == 0) { if (count % pageSize == 0&&count!=0) {
page.setPageCount(count / pageSize); page.setPageCount(count / pageSize);
} else } else
page.setPageCount(count / pageSize + 1); page.setPageCount(count / pageSize + 1);
......
...@@ -17,6 +17,7 @@ import org.apache.commons.logging.Log; ...@@ -17,6 +17,7 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
...@@ -54,32 +55,26 @@ public class DataController { ...@@ -54,32 +55,26 @@ public class DataController {
@RequestMapping(value = "/getDataBySource", produces = "application/json;charset=utf-8") @RequestMapping(value = "/getDataBySource", produces = "application/json;charset=utf-8")
@ResponseBody @ResponseBody
public String getDataBySource(HttpServletRequest request, HttpServletResponse response, long start, long end, public String getDataBySource(HttpServletRequest request, HttpServletResponse response,@RequestBody Map<String, Object> map) {
String source) { long start=(long) map.get("start");
int find = 1; long end=(long) map.get("end");
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); String source=(String) map.get("source");
Calendar startd = Calendar.getInstance(); Calendar startd = Calendar.getInstance();
startd.setTimeInMillis(start); startd.setTimeInMillis(start);
Calendar endd = Calendar.getInstance(); Calendar endd = Calendar.getInstance();
endd.setTimeInMillis(end); endd.setTimeInMillis(end);
System.out.println(sdf.format(startd.getTime()));
System.out.println(sdf.format(endd.getTime()));
if ((end - start) < 1000 * 3600 * 24) {
find = 2;
}
Calendar c = Calendar.getInstance();
c.add(Calendar.DATE, -75);
List<Data> list = dataService.findBySource(startd.getTime(), endd.getTime(), source); List<Data> list = dataService.findBySource(startd.getTime(), endd.getTime(), source);
return JSON.toJSONString(list); return JSON.toJSONString(list);
} }
@RequestMapping(value = "/getDataByTempName", produces = "application/json;charset=utf-8") @RequestMapping(value = "/getDataByTempName", produces = "application/json;charset=utf-8")
@ResponseBody @ResponseBody
public String getDataByTempName(HttpServletRequest request, HttpServletResponse response, public String getDataByTempName(HttpServletRequest request, HttpServletResponse response,@RequestBody Map<String, Object> map)
@RequestParam(value = "start", defaultValue = "0") long start,
@RequestParam(value = "end", defaultValue = "0") long end,
@RequestParam(value = "timeType", defaultValue = "day") String timeType, String method)
throws UnsupportedEncodingException { throws UnsupportedEncodingException {
long start=(long) map.get("start");
long end=(long) map.get("end");
String timeType=(String) map.get("timeType");
String method=(String) map.get("method");
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Calendar startd = Calendar.getInstance(); Calendar startd = Calendar.getInstance();
Calendar endTime = Calendar.getInstance(); Calendar endTime = Calendar.getInstance();
...@@ -106,11 +101,11 @@ public class DataController { ...@@ -106,11 +101,11 @@ public class DataController {
}else{ }else{
if (method.equals("source")) { if (method.equals("source")) {
source = request.getParameter("source"); source = request.getParameter("source");
newsList = dataService.findBySourceFromLibrary(startd.getTime(), endTime.getTime(), source);
} else { } else {
source = request.getParameter("tempName"); source = request.getParameter("tempName");
newsList = dataService.findByTempName(startd.getTime(), endTime.getTime(), source);
} }
System.out.println(source);
newsList = dataService.findBySourceFromLibrary(startd.getTime(), endTime.getTime(), source);
} }
Data data = Change.changeNewsToDate(newsList, startd.getTime()); Data data = Change.changeNewsToDate(newsList, startd.getTime());
list.add(data); list.add(data);
...@@ -146,8 +141,9 @@ public class DataController { ...@@ -146,8 +141,9 @@ public class DataController {
@RequestMapping(value = "/getDataAll", produces = "application/json;charset=utf-8") @RequestMapping(value = "/getDataAll", produces = "application/json;charset=utf-8")
@ResponseBody @ResponseBody
public String getAllData(@RequestParam(value = "start", defaultValue = "0") long start, public String getAllData(@RequestBody Map<String, Object> map) {
@RequestParam(value = "end", defaultValue = "0") long end) { long start=(long) map.get("start");
long end=(long) map.get("end");
try { try {
if (start == 0) { if (start == 0) {
List<Channel> channel = serverService.findDisChannel(); List<Channel> channel = serverService.findDisChannel();
...@@ -163,24 +159,6 @@ public class DataController { ...@@ -163,24 +159,6 @@ public class DataController {
chan.setValue(chan.getValue()); chan.setValue(chan.getValue());
list.add(chan); list.add(chan);
} }
// List<Data> weixin = dataService.findByPt(startTime.getTime(), endTime.getTime(), "微信");
// List<Data> weibo = dataService.findByPt(startTime.getTime(), endTime.getTime(), "微博");
// List<Data> media = dataService.findByPt(startTime.getTime(), endTime.getTime(), "网媒");
// Channel channel = new Channel();
// channel.setList(weixin);
// channel.setPt("微信");
// channel.setValue("wechat");
// Channel cweibo = new Channel();
// cweibo.setList(weibo);
// cweibo.setPt("微博");
// cweibo.setValue("weibo");
// Channel medias = new Channel();
// medias.setList(media);
// medias.setPt("网媒");
// medias.setValue("media");
// list.add(channel);
// list.add(cweibo);
// list.add(medias);
JsonResult result = new JsonResult(true, 200, "请求成功", list); JsonResult result = new JsonResult(true, 200, "请求成功", list);
return JSON.toJSONString(result); return JSON.toJSONString(result);
} else { } else {
...@@ -191,10 +169,6 @@ public class DataController { ...@@ -191,10 +169,6 @@ public class DataController {
List<Channel> channel = serverService.findDisChannel(); List<Channel> channel = serverService.findDisChannel();
List<Channel> list = new ArrayList<>(); List<Channel> list = new ArrayList<>();
// Calendar startTime = Calendar.getInstance();
// start = startTime.getTimeInMillis() - 1000 * 3600 * 24 * 7;
// startTime.setTimeInMillis(start);
// Calendar endTime = Calendar.getInstance();
for(Channel chan:channel){ for(Channel chan:channel){
List<Data> weixin = dataService.findByPt(startTime.getTime(), endTime.getTime(), chan.getPt()); List<Data> weixin = dataService.findByPt(startTime.getTime(), endTime.getTime(), chan.getPt());
chan.setList(weixin); chan.setList(weixin);
...@@ -202,25 +176,6 @@ public class DataController { ...@@ -202,25 +176,6 @@ public class DataController {
chan.setValue(chan.getValue()); chan.setValue(chan.getValue());
list.add(chan); list.add(chan);
} }
// List<Data> weixin = dataService.findByPt(startTime.getTime(), endTime.getTime(), "微信");
// List<Data> weibo = dataService.findByPt(startTime.getTime(), endTime.getTime(), "微博");
// List<Data> media = dataService.findByPt(startTime.getTime(), endTime.getTime(), "网媒");
// List<Channel> list = new ArrayList<Channel>();
// Channel channel = new Channel();
// channel.setList(weixin);
// channel.setPt("微信");
// channel.setValue("wechat");
// Channel cweibo = new Channel();
// cweibo.setList(weibo);
// cweibo.setPt("微博");
// cweibo.setValue("weibo");
// Channel medias = new Channel();
// medias.setList(media);
// medias.setPt("网媒");
// medias.setValue("media");
// list.add(channel);
// list.add(cweibo);
// list.add(medias);
JsonResult result = new JsonResult(true, 200, "请求成功", list); JsonResult result = new JsonResult(true, 200, "请求成功", list);
return JSON.toJSONString(result); return JSON.toJSONString(result);
} }
...@@ -232,7 +187,9 @@ public class DataController { ...@@ -232,7 +187,9 @@ public class DataController {
@RequestMapping(value = "/getSource", produces = "application/json;charset=utf-8") @RequestMapping(value = "/getSource", produces = "application/json;charset=utf-8")
@ResponseBody @ResponseBody
public String getAllDataCountByTime(String value, String method) { public String getAllDataCountByTime(@RequestBody Map<String, Object> map) {
String value=(String) map.get("value");
String method=(String) map.get("method");
if (method != null) { if (method != null) {
if (method.equals("tempName")) { if (method.equals("tempName")) {
List<String> list = dataService.findTmpNameByLikeParam(value); List<String> list = dataService.findTmpNameByLikeParam(value);
...@@ -253,7 +210,9 @@ public class DataController { ...@@ -253,7 +210,9 @@ public class DataController {
@RequestMapping(value = "/getTest", produces = "application/json;charset=utf-8") @RequestMapping(value = "/getTest", produces = "application/json;charset=utf-8")
@ResponseBody @ResponseBody
public String getTestData(String method,String value){ public String getTestData(@RequestBody Map<String, Object> map){
String value=(String) map.get("value");
String method=(String) map.get("method");
Calendar startTime=Calendar.getInstance(); Calendar startTime=Calendar.getInstance();
startTime.add(Calendar.DATE, -6); startTime.add(Calendar.DATE, -6);
Calendar endTime=Calendar.getInstance(); Calendar endTime=Calendar.getInstance();
......
package com.zhiwei.manage.servlet; package com.zhiwei.manage.servlet;
import java.util.List; import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
...@@ -27,8 +28,10 @@ public class FieldController { ...@@ -27,8 +28,10 @@ public class FieldController {
*/ */
@RequestMapping(value = "/getFields", produces = "application/json;charset=utf-8") @RequestMapping(value = "/getFields", produces = "application/json;charset=utf-8")
@ResponseBody @ResponseBody
public String getField(@RequestParam(value = "pageNo", defaultValue = "0") int pageNo, public String getField(@RequestBody Map<String, Object> map) {
@RequestParam(value = "pageSize", defaultValue = "10") int pageSize, String pt) { int pageNo = (int) map.get("pageNo");
int pageSize = (int) map.get("pageSize");
String pt = (String) map.get("pt");
PageEty page = fs.findAllFields(pageNo, pageSize, pt); PageEty page = fs.findAllFields(pageNo, pageSize, pt);
JsonResult result = new JsonResult(true, 200, "获取成功", page); JsonResult result = new JsonResult(true, 200, "获取成功", page);
return JSON.toJSONString(result); return JSON.toJSONString(result);
...@@ -36,7 +39,7 @@ public class FieldController { ...@@ -36,7 +39,7 @@ public class FieldController {
@RequestMapping(value = "/updateFields", produces = "application/json;charset=utf-8") @RequestMapping(value = "/updateFields", produces = "application/json;charset=utf-8")
@ResponseBody @ResponseBody
public String updateField(FieldBean fieldBean) { public String updateField(@RequestBody FieldBean fieldBean) {
boolean b = fs.update(fieldBean); boolean b = fs.update(fieldBean);
JsonResult result = new JsonResult(true, 200, b ? "修改成功" : "修改失败"); JsonResult result = new JsonResult(true, 200, b ? "修改成功" : "修改失败");
return JSON.toJSONString(result); return JSON.toJSONString(result);
...@@ -44,7 +47,8 @@ public class FieldController { ...@@ -44,7 +47,8 @@ public class FieldController {
@RequestMapping(value = "/deleteFields", produces = "application/json;charset=utf-8") @RequestMapping(value = "/deleteFields", produces = "application/json;charset=utf-8")
@ResponseBody @ResponseBody
public String deleteFields(@RequestParam(value = "id[]") List<String> id) { public String deleteFields(@RequestBody Map<String, Object> map) {
List<String> id=(List<String>) map.get("id");
System.out.println(id); System.out.println(id);
boolean b = fs.delete(id); boolean b = fs.delete(id);
JsonResult result = new JsonResult(b, 200, b ? "删除成功" : "删除失败"); JsonResult result = new JsonResult(b, 200, b ? "删除成功" : "删除失败");
...@@ -53,7 +57,7 @@ public class FieldController { ...@@ -53,7 +57,7 @@ public class FieldController {
@RequestMapping(value = "/insertFields", produces = "application/json;charset=utf-8") @RequestMapping(value = "/insertFields", produces = "application/json;charset=utf-8")
@ResponseBody @ResponseBody
public String insertField(FieldBean fieldbean) { public String insertField(@RequestBody FieldBean fieldbean) {
System.out.println(fieldbean); System.out.println(fieldbean);
fs.insert(fieldbean); fs.insert(fieldbean);
JsonResult result = new JsonResult(true, 200, "添加成功"); JsonResult result = new JsonResult(true, 200, "添加成功");
...@@ -62,7 +66,8 @@ public class FieldController { ...@@ -62,7 +66,8 @@ public class FieldController {
@RequestMapping(value = "/getAllFields", produces = "application/json;charset=utf-8") @RequestMapping(value = "/getAllFields", produces = "application/json;charset=utf-8")
@ResponseBody @ResponseBody
public String getAllFields(String pt) { public String getAllFields(@RequestBody Map<String, Object> map) {
String pt=(String) map.get("pt");
FieldBean field = fs.getFieldsByPt(pt); FieldBean field = fs.getFieldsByPt(pt);
String fields[] = null; String fields[] = null;
if (field != null) { if (field != null) {
......
package com.zhiwei.manage.servlet; package com.zhiwei.manage.servlet;
import java.util.List; import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
...@@ -22,48 +25,61 @@ public class MessageConteoller { ...@@ -22,48 +25,61 @@ public class MessageConteoller {
@RequestMapping(value = "/findAllMsg", produces = "application/json;charset=utf-8") @RequestMapping(value = "/findAllMsg", produces = "application/json;charset=utf-8")
@ResponseBody @ResponseBody
public String getAllMessage(@RequestParam(value = "pageNo", defaultValue = "1") int pageNo, public String getAllMessage(@RequestBody Map<String, Object> map) {
@RequestParam(value = "pageSize", defaultValue = "10") int pageSize, String tempName, String tempName = (String) map.get("tempName");
@RequestParam(value = "pt", defaultValue = "网媒")String pt) { int pageNo = (int) map.get("pageNo");
int pageSize = (int) map.get("pageSize");
String pt = (String) map.get("pt");
if (tempName == null || tempName.equals("")) { if (tempName == null || tempName.equals("")) {
PageEty page = msgService.findAll(pageNo, pageSize,pt); PageEty page = msgService.findAll(pageNo, pageSize, pt);
JsonResult result = new JsonResult(true, 200, "请求成功", page); JsonResult result = new JsonResult(true, 200, "请求成功", page);
return JSON.toJSONString(result); return JSON.toJSONString(result);
} else { } else {
PageEty page = msgService.findByTmpName(tempName, pageNo, pageSize,pt); PageEty page = msgService.findByTmpName(tempName, pageNo, pageSize, pt);
JsonResult result = new JsonResult(true, 200, "请求成功", page); JsonResult result = new JsonResult(true, 200, "请求成功", 1);
return JSON.toJSONString(result); return JSON.toJSONString(result);
} }
} }
@RequestMapping(value = "/handle", produces = "application/json;charset=utf-8") @RequestMapping(value = "/handle", produces = "application/json;charset=utf-8")
@ResponseBody @ResponseBody
public String handle(Message message,@RequestParam(value = "pt", defaultValue = "网媒")String pt) { public String handle(@RequestBody Map<String, Object> map) {
System.out.println(message); Message message=new Message();
String str = msgService.update(message,pt); message.setHandle((boolean)map.get("handle"));
message.setMessageId(String.valueOf(map.get("messageId")));
message.setHandler(String.valueOf("handler"));
String pt = (String) map.get("pt");
String str = msgService.update(message, pt);
JsonResult result = new JsonResult(true, 200, str, ""); JsonResult result = new JsonResult(true, 200, str, "");
return JSON.toJSONString(result); return JSON.toJSONString(result);
} }
@RequestMapping(value = "/deleteMsg", produces = "application/json;charset=utf-8") @RequestMapping(value = "/deleteMsg", produces = "application/json;charset=utf-8")
@ResponseBody @ResponseBody
public String delete(@RequestParam(value = "messageId[]") List<String> messageId, public String delete(@RequestBody Map<String, Object> map) {
@RequestParam(value = "pt", defaultValue = "网媒")String pt) { List<String> messageId=(List<String>) map.get("messageId");
msgService.delete(messageId,pt); System.out.println(messageId);
String pt=(String) map.get("pt");
msgService.delete(messageId, pt);
JsonResult result = new JsonResult(true, 200, "删除成功", ""); JsonResult result = new JsonResult(true, 200, "删除成功", "");
return JSON.toJSONString(result); return JSON.toJSONString(result);
} }
@RequestMapping(value = "/findHandleMsg", produces = "application/json;charset=utf-8") @RequestMapping(value = "/findHandleMsg", produces = "application/json;charset=utf-8")
@ResponseBody @ResponseBody
public String getNewMsg(@RequestParam(value = "pageNo", defaultValue = "1") int pageNo, public String getNewMsg(@RequestBody Map<String, Object> map) {
@RequestParam(value = "pageSize", defaultValue = "10") int pageSize, String tempName,String pt) { int pageNo=(int) map.get("pageNo");
int pageSize=(int) map.get("pageSize");
String tempName=(String) map.get("tempName");
String pt=(String) map.get("pt");
if (tempName == null || tempName.equals("")) { if (tempName == null || tempName.equals("")) {
PageEty page = msgService.findByHandle(pageNo, pageSize, true, tempName,pt); PageEty page = msgService.findByHandle(pageNo, pageSize, true, tempName, pt);
JsonResult result = new JsonResult(true, 200, "获取成功", page); JsonResult result = new JsonResult(true, 200, "获取成功", page);
return JSON.toJSONString(result); return JSON.toJSONString(result);
} else { } else {
PageEty page = msgService.findByHandle(pageNo, pageSize, true, tempName,pt); PageEty page = msgService.findByHandle(pageNo, pageSize, true, tempName, pt);
JsonResult result = new JsonResult(true, 200, "获取成功", page); JsonResult result = new JsonResult(true, 200, "获取成功", page);
return JSON.toJSONString(result); return JSON.toJSONString(result);
} }
......
...@@ -2,6 +2,7 @@ package com.zhiwei.manage.servlet; ...@@ -2,6 +2,7 @@ package com.zhiwei.manage.servlet;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.Cookie; import javax.servlet.http.Cookie;
...@@ -9,6 +10,7 @@ import javax.servlet.http.HttpServletRequest; ...@@ -9,6 +10,7 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
...@@ -27,8 +29,10 @@ public class PersonController { ...@@ -27,8 +29,10 @@ public class PersonController {
@RequestMapping(value = "/login", produces = "application/json;charset=utf-8") @RequestMapping(value = "/login", produces = "application/json;charset=utf-8")
@ResponseBody @ResponseBody
public String login(HttpServletRequest req, HttpServletResponse res, String username, String password, public String login(HttpServletRequest req, HttpServletResponse res,@RequestBody Map<String, Object> map) {
boolean isRemember) { boolean isRemember=(boolean) map.get("isRemember");
String username=(String) map.get("username");
String password=(String) map.get("password");
Person p = personService.login(username, password); Person p = personService.login(username, password);
if (p != null) { if (p != null) {
Cookie cookie = new Cookie(username, username); Cookie cookie = new Cookie(username, username);
...@@ -49,7 +53,8 @@ public class PersonController { ...@@ -49,7 +53,8 @@ public class PersonController {
@RequestMapping(value = "/leave", produces = "application/json;charset=utf-8") @RequestMapping(value = "/leave", produces = "application/json;charset=utf-8")
@ResponseBody @ResponseBody
public String leave(HttpServletRequest req, HttpServletResponse res, String username) { public String leave(HttpServletRequest req, HttpServletResponse res, @RequestBody Map<String, Object> map) {
String username=(String) map.get("username");
Cookie[] cookies = req.getCookies(); Cookie[] cookies = req.getCookies();
for (Cookie cookie : cookies) { for (Cookie cookie : cookies) {
if (cookie.getName().equals(username)) { if (cookie.getName().equals(username)) {
...@@ -76,10 +81,11 @@ public class PersonController { ...@@ -76,10 +81,11 @@ public class PersonController {
@RequestMapping(value = "/getPerson", produces = "application/json;charset=utf-8") @RequestMapping(value = "/getPerson", produces = "application/json;charset=utf-8")
@ResponseBody @ResponseBody
public String getPersonByUser(HttpServletResponse res, HttpServletRequest req, String username public String getPersonByUser(HttpServletResponse res, HttpServletRequest req,@RequestBody Map<String, Object> map) {
,@RequestParam(value = "pageNo", defaultValue = "1") int pageNo, String username=(String) map.get("username");
@RequestParam(value = "pageSize", defaultValue = "10")int pageSize, int pageSize=(int) map.get("pageSize");
@RequestParam(value = "lv", defaultValue = "1")int lv) { int pageNo=(int) map.get("pageNo");
int lv=(int) map.get("lv");
if (username == null || username.equals("")) { if (username == null || username.equals("")) {
PageEty page = personService.findAll(pageNo, pageSize,lv); PageEty page = personService.findAll(pageNo, pageSize,lv);
JsonResult result = new JsonResult(true, 200, "获取成功", page); JsonResult result = new JsonResult(true, 200, "获取成功", page);
...@@ -94,7 +100,7 @@ public class PersonController { ...@@ -94,7 +100,7 @@ public class PersonController {
@RequestMapping(value = "/updatePerson", produces = "application/json;charset=utf-8") @RequestMapping(value = "/updatePerson", produces = "application/json;charset=utf-8")
@ResponseBody @ResponseBody
public String updatePerson(Person person){ public String updatePerson(@RequestBody Person person){
boolean b=personService.update(person); boolean b=personService.update(person);
JsonResult result=new JsonResult(b?true:false, 200, b?"操作成功":"操作失败",""); JsonResult result=new JsonResult(b?true:false, 200, b?"操作成功":"操作失败","");
return JSON.toJSONString(result); return JSON.toJSONString(result);
...@@ -102,11 +108,12 @@ public class PersonController { ...@@ -102,11 +108,12 @@ public class PersonController {
@RequestMapping(value = "/deletePerson", produces = "application/json;charset=utf-8") @RequestMapping(value = "/deletePerson", produces = "application/json;charset=utf-8")
@ResponseBody @ResponseBody
public String deletePerson(@RequestParam(value = "personId[]")String[] personId){ public String deletePerson(@RequestBody Map<String, Object> map){
List<String> deleteList=new ArrayList<>(); List<String> deleteList=(List<String>) map.get("personId");
for(String p:personId){ // List<String> deleteList=new ArrayList<>();
deleteList.add(p); // for(String p:personId){
} // deleteList.add(p);
// }
boolean b=personService.delete(deleteList); boolean b=personService.delete(deleteList);
JsonResult result=new JsonResult(b?true:false, 200, b?"操作成功":"操作失败"); JsonResult result=new JsonResult(b?true:false, 200, b?"操作成功":"操作失败");
return JSON.toJSONString(result); return JSON.toJSONString(result);
...@@ -114,7 +121,7 @@ public class PersonController { ...@@ -114,7 +121,7 @@ public class PersonController {
@RequestMapping(value = "/savePerson", produces = "application/json;charset=utf-8") @RequestMapping(value = "/savePerson", produces = "application/json;charset=utf-8")
@ResponseBody @ResponseBody
public String savePerson(HttpServletRequest req,Person person){ public String savePerson(HttpServletRequest req,@RequestBody Person person){
System.out.println(person); System.out.println(person);
Cookie[] cookies = req.getCookies(); Cookie[] cookies = req.getCookies();
for (Cookie cookie : cookies) { for (Cookie cookie : cookies) {
......
...@@ -2,9 +2,11 @@ package com.zhiwei.manage.servlet; ...@@ -2,9 +2,11 @@ package com.zhiwei.manage.servlet;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
...@@ -24,8 +26,10 @@ public class ServerController { ...@@ -24,8 +26,10 @@ public class ServerController {
@RequestMapping(value = "/getServer", produces = "application/json;charset=utf-8") @RequestMapping(value = "/getServer", produces = "application/json;charset=utf-8")
@ResponseBody @ResponseBody
public String getServer(@RequestParam(value = "pageNo", defaultValue = "0") int pageNo, public String getServer(@RequestBody Map<String, Object> map) {
@RequestParam(value = "pageSize", defaultValue = "0") int pageSize, String dbName) { int pageNo=(int) map.get("pageNo");
int pageSize=(int) map.get("pageSize");
String dbName=(String) map.get("dbName");
PageEty page = ss.findDb(pageNo, pageSize, dbName); PageEty page = ss.findDb(pageNo, pageSize, dbName);
JsonResult result = new JsonResult(true, 200, "获取成功", page); JsonResult result = new JsonResult(true, 200, "获取成功", page);
return JSON.toJSONString(result); return JSON.toJSONString(result);
...@@ -33,7 +37,7 @@ public class ServerController { ...@@ -33,7 +37,7 @@ public class ServerController {
@RequestMapping(value = "/updateServer", produces = "application/json;charset=utf-8") @RequestMapping(value = "/updateServer", produces = "application/json;charset=utf-8")
@ResponseBody @ResponseBody
public String updateServer(ServerBean serverBean) { public String updateServer(@RequestBody ServerBean serverBean) {
boolean b = ss.update(serverBean); boolean b = ss.update(serverBean);
JsonResult result = new JsonResult(b, 200, b ? "获取成功" : "获取失败"); JsonResult result = new JsonResult(b, 200, b ? "获取成功" : "获取失败");
return JSON.toJSONString(result); return JSON.toJSONString(result);
...@@ -41,7 +45,8 @@ public class ServerController { ...@@ -41,7 +45,8 @@ public class ServerController {
@RequestMapping(value = "/deleteServer", produces = "application/json;charset=utf-8") @RequestMapping(value = "/deleteServer", produces = "application/json;charset=utf-8")
@ResponseBody @ResponseBody
public String deleteServer(@RequestParam(value = "serverid[]")List<String> serverid) { public String deleteServer(@RequestBody Map<String, Object> map) {
List<String> serverid=(List<String>) map.get("serverid");
boolean b = ss.delete(serverid); boolean b = ss.delete(serverid);
JsonResult result = new JsonResult(true, 200, serverid+(b ? "删除成功" : "删除失败")); JsonResult result = new JsonResult(true, 200, serverid+(b ? "删除成功" : "删除失败"));
return JSON.toJSONString(result); return JSON.toJSONString(result);
...@@ -50,7 +55,7 @@ public class ServerController { ...@@ -50,7 +55,7 @@ public class ServerController {
@RequestMapping(value = "/insertServer", produces = "application/json;charset=utf-8") @RequestMapping(value = "/insertServer", produces = "application/json;charset=utf-8")
@ResponseBody @ResponseBody
public String insertServer(ServerBean serverBean) { public String insertServer(@RequestBody ServerBean serverBean) {
System.out.println(serverBean); System.out.println(serverBean);
ss.insert(serverBean); ss.insert(serverBean);
JsonResult result = new JsonResult(true, 200, "添加成功"); JsonResult result = new JsonResult(true, 200, "添加成功");
...@@ -63,8 +68,9 @@ public class ServerController { ...@@ -63,8 +68,9 @@ public class ServerController {
*/ */
@RequestMapping(value = "/getChannel", produces = "application/json;charset=utf-8") @RequestMapping(value = "/getChannel", produces = "application/json;charset=utf-8")
@ResponseBody @ResponseBody
public String getChannel(@RequestParam(value = "pageNo", defaultValue = "1")int pageNo, public String getChannel(@RequestBody Map<String, Object> map){
@RequestParam(value = "pageSize", defaultValue = "10")int pageSize){ int pageNo=(int) map.get("pageNo");
int pageSize=(int) map.get("pageSize");
PageEty page=ss.findChannel(pageNo, pageSize); PageEty page=ss.findChannel(pageNo, pageSize);
JsonResult result=new JsonResult(true, 200, "获取成功",page); JsonResult result=new JsonResult(true, 200, "获取成功",page);
return JSON.toJSONString(result); return JSON.toJSONString(result);
...@@ -72,7 +78,8 @@ public class ServerController { ...@@ -72,7 +78,8 @@ public class ServerController {
@RequestMapping(value = "/changePt", produces = "application/json;charset=utf-8") @RequestMapping(value = "/changePt", produces = "application/json;charset=utf-8")
@ResponseBody @ResponseBody
public String changePt(String pt) { public String changePt(@RequestBody Map<String, Object> map) {
String pt=(String) map.get("pt");
ss.findPt(pt); ss.findPt(pt);
JsonResult result = new JsonResult(true, 200, "源改变成功"); JsonResult result = new JsonResult(true, 200, "源改变成功");
return JSON.toJSONString(result); return JSON.toJSONString(result);
...@@ -80,7 +87,7 @@ public class ServerController { ...@@ -80,7 +87,7 @@ public class ServerController {
@RequestMapping(value = "/insertChannel", produces = "application/json;charset=utf-8") @RequestMapping(value = "/insertChannel", produces = "application/json;charset=utf-8")
@ResponseBody @ResponseBody
public String insertChannel(Channel channel){ public String insertChannel(@RequestBody Channel channel){
System.out.println(channel); System.out.println(channel);
ss.insertChannels(channel); ss.insertChannels(channel);
JsonResult result=new JsonResult(true, 200, "添加成功"); JsonResult result=new JsonResult(true, 200, "添加成功");
...@@ -89,7 +96,7 @@ public class ServerController { ...@@ -89,7 +96,7 @@ public class ServerController {
@RequestMapping(value = "/updateChannel", produces = "application/json;charset=utf-8") @RequestMapping(value = "/updateChannel", produces = "application/json;charset=utf-8")
@ResponseBody @ResponseBody
public String updateChannel(Channel channel){ public String updateChannel(@RequestBody Channel channel){
boolean b=ss.updateChannel(channel); boolean b=ss.updateChannel(channel);
JsonResult result=new JsonResult(b, 200, b?"修改成功":"修改失败"); JsonResult result=new JsonResult(b, 200, b?"修改成功":"修改失败");
return JSON.toJSONString(result); return JSON.toJSONString(result);
...@@ -97,7 +104,8 @@ public class ServerController { ...@@ -97,7 +104,8 @@ public class ServerController {
@RequestMapping(value = "/deleteChannel", produces = "application/json;charset=utf-8") @RequestMapping(value = "/deleteChannel", produces = "application/json;charset=utf-8")
@ResponseBody @ResponseBody
public String deleteChannel(@RequestParam(value = "id[]")List<String> id) { public String deleteChannel(@RequestBody Map<String, Object> map) {
List<String> id=(List<String>) map.get("id");
boolean b=ss.deleteChannel(id); boolean b=ss.deleteChannel(id);
JsonResult result=new JsonResult(b, 200, id+(b?"删除成功":"删除失败")); JsonResult result=new JsonResult(b, 200, id+(b?"删除成功":"删除失败"));
return JSON.toJSONString(result); return JSON.toJSONString(result);
......
package com.zhiwei.manage.servlet; package com.zhiwei.manage.servlet;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
...@@ -25,10 +29,9 @@ public class TemplateController { ...@@ -25,10 +29,9 @@ public class TemplateController {
@Autowired @Autowired
private FieldBeanService fb; private FieldBeanService fb;
@RequestMapping(value = "/saveTmp", produces = "application/json;charset=utf-8") @RequestMapping(value = "/saveTmp", produces = "application/json;charset=utf-8")
@ResponseBody @ResponseBody
public String saveTmp(Template template) { public String saveTmp(@RequestBody Template template) {
System.out.println(template); System.out.println(template);
if (template != null) { if (template != null) {
if (ts.insert(template)) { if (ts.insert(template)) {
...@@ -42,7 +45,8 @@ public class TemplateController { ...@@ -42,7 +45,8 @@ public class TemplateController {
@RequestMapping(value = "/updateTmp", produces = "application/json;charset=utf-8") @RequestMapping(value = "/updateTmp", produces = "application/json;charset=utf-8")
@ResponseBody @ResponseBody
public String updateTmp(Template template, String username, HttpServletRequest request) { public String updateTmp(@RequestBody Map<String, Object> map, HttpServletRequest request) {
Template template = (Template) map.get("template");
if (template != null) { if (template != null) {
if (ts.update(template)) { if (ts.update(template)) {
JsonResult result = new JsonResult(true, 200, "修改成功"); JsonResult result = new JsonResult(true, 200, "修改成功");
...@@ -55,15 +59,16 @@ public class TemplateController { ...@@ -55,15 +59,16 @@ public class TemplateController {
@RequestMapping(value = "/deleteTmp", produces = "application/json;charset=utf-8") @RequestMapping(value = "/deleteTmp", produces = "application/json;charset=utf-8")
@ResponseBody @ResponseBody
public String deleteTmp(@RequestParam(value = "templateId[]") String[] templateId, public String deleteTmp(@RequestBody Map<String, Object> map) {
@RequestParam(value = "pt", defaultValue = "网媒")String pt) { List<String> templateId = (List<String>) map.get("templateId");
String pt = (String) map.get("pt");
boolean isDelete = false; boolean isDelete = false;
String results=""; String results = "";
for (String l : templateId) { for (String l : templateId) {
System.out.println(l); System.out.println(l);
isDelete = ts.delete(l,pt); isDelete = ts.delete(l, pt);
MainThread.delete(l); MainThread.delete(l);
results+=l+"\n"; results += l + "\n";
} }
JsonResult result = new JsonResult(true, 200, results + "删除" + (isDelete == false ? "成功" : "失败")); JsonResult result = new JsonResult(true, 200, results + "删除" + (isDelete == false ? "成功" : "失败"));
return JSON.toJSONString(result); return JSON.toJSONString(result);
...@@ -71,14 +76,17 @@ public class TemplateController { ...@@ -71,14 +76,17 @@ public class TemplateController {
@RequestMapping(value = "/findAllTmp", produces = "application/json;charset=utf-8") @RequestMapping(value = "/findAllTmp", produces = "application/json;charset=utf-8")
@ResponseBody @ResponseBody
public String findAll(@RequestParam(value = "pageNo", defaultValue = "1") int pageNo, public String findAll(@RequestBody Map<String, Object> map) {
@RequestParam(value = "pageSize", defaultValue = "10") int pageSize, String tempName,String pt) { int pageNo = (int) map.get("pageNo");
int pageSize = (int) map.get("pageSize");
String tempName = (String) map.get("tempName");
String pt = (String) map.get("pt");
if (tempName == null || tempName.equals("")) { if (tempName == null || tempName.equals("")) {
PageEty page = ts.findAll(pageNo, pageSize,pt); PageEty page = ts.findAll(pageNo, pageSize, pt);
JsonResult result = new JsonResult(true, 200, "返回成功", page); JsonResult result = new JsonResult(true, 200, "返回成功", page);
return JSON.toJSONString(result); return JSON.toJSONString(result);
} else { } else {
PageEty page = ts.findByTmpName(tempName, pageNo, pageSize,pt); PageEty page = ts.findByTmpName(tempName, pageNo, pageSize, pt);
if (page != null) { if (page != null) {
JsonResult result = new JsonResult(true, 200, "返回成功", page); JsonResult result = new JsonResult(true, 200, "返回成功", page);
return JSON.toJSONString(result); return JSON.toJSONString(result);
...@@ -91,7 +99,8 @@ public class TemplateController { ...@@ -91,7 +99,8 @@ public class TemplateController {
@RequestMapping(value = "/startTmp", produces = "application/json;charset=utf-8") @RequestMapping(value = "/startTmp", produces = "application/json;charset=utf-8")
@ResponseBody @ResponseBody
public String startTmp(String templateId) { public String startTmp(@RequestBody Map<String, Object> map) {
String templateId = (String) map.get("templateId");
boolean b = MainThread.pushMap(templateId); boolean b = MainThread.pushMap(templateId);
if (b) { if (b) {
JsonResult result = new JsonResult(true, 200, "启动成功"); JsonResult result = new JsonResult(true, 200, "启动成功");
...@@ -104,7 +113,8 @@ public class TemplateController { ...@@ -104,7 +113,8 @@ public class TemplateController {
@RequestMapping(value = "/stopTmp", produces = "application/json;charset=utf-8") @RequestMapping(value = "/stopTmp", produces = "application/json;charset=utf-8")
@ResponseBody @ResponseBody
public String stopTmp(String templateId) { public String stopTmp(@RequestBody Map<String, Object> map) {
String templateId = (String) map.get("templateId");
boolean b = MainThread.removeMap(templateId); boolean b = MainThread.removeMap(templateId);
if (b) { if (b) {
JsonResult result = new JsonResult(true, 200, "关闭成功"); JsonResult result = new JsonResult(true, 200, "关闭成功");
...@@ -117,11 +127,11 @@ public class TemplateController { ...@@ -117,11 +127,11 @@ public class TemplateController {
@RequestMapping(value = "/getField", produces = "application/json;charset=utf-8") @RequestMapping(value = "/getField", produces = "application/json;charset=utf-8")
@ResponseBody @ResponseBody
public String getField(@RequestParam(value = "pt", defaultValue = "网媒")String pt){ public String getField(@RequestBody Map<String, Object> map) {
FieldBean fieldBean=fb.getFieldsByPt(pt); String pt = (String) map.get("pt");
JsonResult result=new JsonResult(true, 200, "获取成功",fieldBean.getField()); FieldBean fieldBean = fb.getFieldsByPt(pt);
JsonResult result = new JsonResult(true, 200, "获取成功", fieldBean.getField());
return JSON.toJSONString(result); return JSON.toJSONString(result);
} }
} }
###生产环境 ###生产环境
#修改模板线程的注释 #修改模板线程的注释
mongo.serverMongoIp=192.168.0.101 #mongo.serverMongoIp=192.168.0.101
mongo.serverMongoIp=115.236.59.91
mongo.serverMongoPort=27017 mongo.serverMongoPort=27017
mongo.spyPlatData.dbName1=dataMonitoring mongo.spyPlatData.dbName1=dataMonitoring
############################################## ##############################################
mongo2.serverMongoIp=192.168.0.101 mongo2.serverMongoIp=115.236.59.91
mongo2.serverMongoPort=27017 mongo2.serverMongoPort=27017
mongo2.spyPlatData.dbName1=mediaspider mongo2.spyPlatData.dbName1=mediaspider
############################################## ##############################################
weibomongo.serverMongoIp=192.168.0.101 weibomongo.serverMongoIp=115.236.59.91
weibomongo.serverMongoPort=27017 weibomongo.serverMongoPort=27017
weibomongo.spyPlatData.dbName1=NetWork weibomongo.spyPlatData.dbName1=NetWork
<!DOCTYPE html><html><head><meta charset=utf-8><meta name=viewport content="width=device-width,initial-scale=1"><title>数据管理系统</title><link rel=stylesheet href=./static/css/style.ini.css><link rel=stylesheet href=./static/datepicker/css/datepicker.css><link rel=stylesheet href=./static/datepicker/css/layout.css><link href=./static/css/app.9c6ab0c57a93c0f894da068b9ee8c4e1.css rel=stylesheet></head><body><div id=app></div><script type=text/javascript src=./static/js/manifest.5cd57a9c9ef9c94717cd.js></script><script type=text/javascript src=./static/js/vendor.c00def797876150978d2.js></script><script type=text/javascript src=./static/js/app.2eb09a796a47906b0321.js></script></body><script src=./static/js/jquery-1.12.4.min.js></script><script src=./static/js/jquery.easing-master/jquery.easing.min.js></script><script src=./static/js/jquery.transit.js></script><script src=./static/datepicker/js/datepicker.js></script><script src=./static/datepicker/js/eye.js></script><script src=./static/datepicker/js/utils.js></script></html> <!DOCTYPE html><html><head><meta charset=utf-8><meta name=viewport content="width=device-width,initial-scale=1"><title>数据管理系统</title><link rel=stylesheet href=./static/css/style.ini.css><link rel=stylesheet href=./static/datepicker/css/datepicker.css><link rel=stylesheet href=./static/datepicker/css/layout.css><link href=./static/css/app.8d461fe49679002724ef47fee8442561.css rel=stylesheet></head><body><div id=app></div><script type=text/javascript src=./static/js/manifest.250aa84209ae998dac1d.js></script><script type=text/javascript src=./static/js/vendor.c00def797876150978d2.js></script><script type=text/javascript src=./static/js/app.e63537b1683f72aab222.js></script></body><script src=./static/js/jquery-1.12.4.min.js></script><script src=./static/js/jquery.easing-master/jquery.easing.min.js></script><script src=./static/js/jquery.transit.js></script><script src=./static/datepicker/js/datepicker.js></script><script src=./static/datepicker/js/eye.js></script><script src=./static/datepicker/js/utils.js></script></html>
\ No newline at end of file \ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
!function(e){function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}var r=window.webpackJsonp;window.webpackJsonp=function(t,c,a){for(var i,u,f,s=0,l=[];s<t.length;s++)u=t[s],o[u]&&l.push(o[u][0]),o[u]=0;for(i in c)Object.prototype.hasOwnProperty.call(c,i)&&(e[i]=c[i]);for(r&&r(t,c,a);l.length;)l.shift()();if(a)for(s=0;s<a.length;s++)f=n(n.s=a[s]);return f};var t={},o={2:0};n.e=function(e){function r(){i.onerror=i.onload=null,clearTimeout(u);var n=o[e];0!==n&&(n&&n[1](new Error("Loading chunk "+e+" failed.")),o[e]=void 0)}var t=o[e];if(0===t)return new Promise(function(e){e()});if(t)return t[2];var c=new Promise(function(n,r){t=o[e]=[n,r]});t[2]=c;var a=document.getElementsByTagName("head")[0],i=document.createElement("script");i.type="text/javascript",i.charset="utf-8",i.async=!0,i.timeout=12e4,n.nc&&i.setAttribute("nonce",n.nc),i.src=n.p+"static/js/"+e+"."+{0:"c00def797876150978d2",1:"2eb09a796a47906b0321"}[e]+".js";var u=setTimeout(r,12e4);return i.onerror=i.onload=r,a.appendChild(i),c},n.m=e,n.c=t,n.d=function(e,r,t){n.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:t})},n.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(r,"a",r),r},n.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},n.p="./",n.oe=function(e){throw console.error(e),e}}([]);
//# sourceMappingURL=manifest.5cd57a9c9ef9c94717cd.js.map
\ No newline at end of file
...@@ -150,10 +150,10 @@ export default { ...@@ -150,10 +150,10 @@ export default {
methods: { methods: {
selectPtChange (n) { selectPtChange (n) {
this.ptSelectedData = n this.ptSelectedData = n
let params = { let data = {
pt: n.pt pt: n.pt
} }
requestChangePt(params, {}, (response) => { requestChangePt({}, data, (response) => {
if (response.data) { if (response.data) {
if (response.data.state) { if (response.data.state) {
this.ptSelectedData = n this.ptSelectedData = n
...@@ -198,10 +198,10 @@ export default { ...@@ -198,10 +198,10 @@ export default {
}, 500) }, 500)
}, },
logout () { logout () {
let params = { let data = {
username: this.userInfo.username username: this.userInfo.username
} }
requestLeave(params, {}, (response) => { requestLeave({}, data, (response) => {
if (response.data) { if (response.data) {
if (response.data.state) { if (response.data.state) {
bus.$emit('alert', response.data.message) bus.$emit('alert', response.data.message)
...@@ -224,10 +224,10 @@ export default { ...@@ -224,10 +224,10 @@ export default {
if (val === undefined) { if (val === undefined) {
return false return false
} }
let params = { let data = {
pt: this.ptSelectedData.pt pt: this.ptSelectedData.pt
} }
requestGetAllFields(params, {}, (response) => { requestGetAllFields({}, data, (response) => {
if (response.data) { if (response.data) {
if (response.data.state) { if (response.data.state) {
this.allFields = response.data.data this.allFields = response.data.data
......
...@@ -165,11 +165,11 @@ export default { ...@@ -165,11 +165,11 @@ export default {
this.option.legend.data = [] this.option.legend.data = []
this.option.legend.selected = {} this.option.legend.selected = {}
this.option.series = [] this.option.series = []
let params = { let data = {
start: this.startTime, start: this.startTime,
end: this.endTime end: this.endTime
} }
requestGetDataAll(params, {}, (response) => { requestGetDataAll({}, data, (response) => {
if (response.data) { if (response.data) {
if (response.data.state) { if (response.data.state) {
this.data = response.data.data this.data = response.data.data
......
...@@ -117,12 +117,12 @@ export default { ...@@ -117,12 +117,12 @@ export default {
}, },
getChannel () { getChannel () {
let pageSize = this.pageSize let pageSize = this.pageSize
let params = { let data = {
pageNo: this.page, pageNo: this.page,
pageSize: pageSize pageSize: pageSize
// tempName: this.tempName // tempName: this.tempName
} }
requestGetChannel(params, {}, (response) => { requestGetChannel({}, data, (response) => {
if (response.data) { if (response.data) {
if (response.data.state) { if (response.data.state) {
this.channelData = response.data.data this.channelData = response.data.data
......
...@@ -118,13 +118,13 @@ export default { ...@@ -118,13 +118,13 @@ export default {
}, },
findAllMsg () { findAllMsg () {
let pageSize = this.pageSize let pageSize = this.pageSize
let params = { let data = {
pageNo: this.page, pageNo: this.page,
pageSize: pageSize, pageSize: pageSize,
tempName: this.tempName, tempName: this.tempName,
pt: this.ptSelectedData.pt pt: this.ptSelectedData.pt
} }
requestFindAllMsg(params, {}, (response) => { requestFindAllMsg({}, data, (response) => {
if (response.data) { if (response.data) {
if (response.data.state) { if (response.data.state) {
this.MsgData = response.data.data this.MsgData = response.data.data
......
...@@ -135,11 +135,11 @@ export default { ...@@ -135,11 +135,11 @@ export default {
this.checkbox = [false, false, false, false, false, false, false, false, false, false] this.checkbox = [false, false, false, false, false, false, false, false, false, false]
}, },
tempToggle (i) { tempToggle (i) {
let params = { let data = {
templateId: this.tempData.data[i].templateId templateId: this.tempData.data[i].templateId
} }
if (!this.toggle[i]) { if (!this.toggle[i]) {
requestStartTmp(params, {}, (response) => { requestStartTmp({}, data, (response) => {
if (response.data) { if (response.data) {
if (response.data.state) { if (response.data.state) {
this.findAllTmp() this.findAllTmp()
...@@ -151,7 +151,7 @@ export default { ...@@ -151,7 +151,7 @@ export default {
} }
}) })
} else { } else {
requestStopTmp(params, {}, (response) => { requestStopTmp({}, data, (response) => {
if (response.data) { if (response.data) {
if (response.data.state) { if (response.data.state) {
this.findAllTmp() this.findAllTmp()
...@@ -179,13 +179,13 @@ export default { ...@@ -179,13 +179,13 @@ export default {
}, },
findAllTmp () { findAllTmp () {
let pageSize = this.pageSize let pageSize = this.pageSize
let params = { let data = {
pageNo: this.page, pageNo: this.page,
pageSize: pageSize, pageSize: pageSize,
tempName: this.tempName, tempName: this.tempName,
pt: this.ptSelectedData.pt pt: this.ptSelectedData.pt
} }
requestFindAllTmp(params, {}, (response) => { requestFindAllTmp({}, data, (response) => {
if (response.data) { if (response.data) {
if (response.data.state) { if (response.data.state) {
this.tempData = response.data.data this.tempData = response.data.data
......
...@@ -141,11 +141,11 @@ export default { ...@@ -141,11 +141,11 @@ export default {
this.checkbox = [false, false, false, false, false, false, false, false, false, false] this.checkbox = [false, false, false, false, false, false, false, false, false, false]
}, },
tempToggle (i) { tempToggle (i) {
let params = { let data = {
templateId: this.DatabaseData.data[i].templateId templateId: this.DatabaseData.data[i].templateId
} }
if (!this.toggle[i]) { if (!this.toggle[i]) {
requestStartTmp(params, {}, (response) => { requestStartTmp({}, data, (response) => {
if (response.data) { if (response.data) {
if (response.data.state) { if (response.data.state) {
this.getServer() this.getServer()
...@@ -157,7 +157,7 @@ export default { ...@@ -157,7 +157,7 @@ export default {
} }
}) })
} else { } else {
requestStopTmp(params, {}, (response) => { requestStopTmp({}, data, (response) => {
if (response.data) { if (response.data) {
if (response.data.state) { if (response.data.state) {
this.getServer() this.getServer()
...@@ -185,12 +185,12 @@ export default { ...@@ -185,12 +185,12 @@ export default {
}, },
getServer () { getServer () {
let pageSize = this.pageSize let pageSize = this.pageSize
let params = { let data = {
pageNo: this.page, pageNo: this.page,
pageSize: pageSize, pageSize: pageSize,
dbName: this.dbName dbName: this.dbName
} }
requestGetServer(params, {}, (response) => { requestGetServer({}, data, (response) => {
if (response.data) { if (response.data) {
if (response.data.state) { if (response.data.state) {
this.DatabaseData = response.data.data this.DatabaseData = response.data.data
......
...@@ -208,11 +208,11 @@ export default { ...@@ -208,11 +208,11 @@ export default {
this.echartsUpdate() this.echartsUpdate()
}, },
searchValue () { searchValue () {
let params = { let data = {
method: this.method, method: this.method,
value: this.methodValue value: this.methodValue
} }
requestGetSource(params, {}, (response) => { requestGetSource({}, data, (response) => {
if (response.data) { if (response.data) {
if (response.data.state) { if (response.data.state) {
this.matchingWord = response.data.data this.matchingWord = response.data.data
...@@ -256,7 +256,8 @@ export default { ...@@ -256,7 +256,8 @@ export default {
bus.$emit('alert', '选择时间段错误!(Error code: 159)') bus.$emit('alert', '选择时间段错误!(Error code: 159)')
return false return false
} }
requestGetDataByTempName(params, {}, (response) => { let data = params
requestGetDataByTempName(params, data, (response) => {
if (response.data) { if (response.data) {
if (response.data.state) { if (response.data.state) {
// 清空 // 清空
......
...@@ -141,12 +141,12 @@ export default { ...@@ -141,12 +141,12 @@ export default {
}, },
getFields () { getFields () {
let pageSize = this.pageSize let pageSize = this.pageSize
let params = { let data = {
pageNo: this.page, pageNo: this.page,
pageSize: pageSize, pageSize: pageSize,
pt: this.pt pt: this.pt
} }
requestGetFields(params, {}, (response) => { requestGetFields({}, data, (response) => {
if (response.data) { if (response.data) {
if (response.data.state) { if (response.data.state) {
this.fieldData = response.data.data this.fieldData = response.data.data
......
...@@ -41,13 +41,13 @@ export default { ...@@ -41,13 +41,13 @@ export default {
bus.$emit('alert', '用户名和密码不可为空!') bus.$emit('alert', '用户名和密码不可为空!')
return false return false
} }
let params = { let data = {
username: this.username, username: this.username,
password: this.password, password: this.password,
isRemember: this.isRemember isRemember: this.isRemember
} }
// this.$router.push({'path': '/checkInfo'}) // this.$router.push({'path': '/checkInfo'})
requestLogin(params, {}, (response) => { requestLogin({}, data, (response) => {
if (response.data) { if (response.data) {
if (response.data.state) { if (response.data.state) {
bus.$emit('setUserInfo', response.data.data) bus.$emit('setUserInfo', response.data.data)
......
...@@ -62,7 +62,13 @@ ...@@ -62,7 +62,13 @@
<!-- 删除处理记录 --> <!-- 删除处理记录 -->
<div class="mask" v-if="popup.processingRecordDelete"> <div class="mask" v-if="popup.processingRecordDelete">
<processing-record-delete @close="popup.processingRecordDelete = false" :children-data="childrenData" :checked-message="checkedMessage" @update="findAllHandleMsg()" @clear-checkbox="clearCheckbox()" /> <processing-record-delete
@close="popup.processingRecordDelete = false"
:children-data="childrenData"
:checked-message="checkedMessage"
@update="findAllHandleMsg()"
@clear-checkbox="clearCheckbox()"
:pt-selected-data="ptSelectedData" />
</div> </div>
</div> </div>
...@@ -121,13 +127,13 @@ export default { ...@@ -121,13 +127,13 @@ export default {
}, },
findAllHandleMsg () { findAllHandleMsg () {
let pageSize = this.pageSize let pageSize = this.pageSize
let params = { let data = {
pageNo: this.page, pageNo: this.page,
pageSize: pageSize, pageSize: pageSize,
tempName: this.tempName, tempName: this.tempName,
pt: this.ptSelectedData.pt pt: this.ptSelectedData.pt
} }
requestFindHandleMsg(params, {}, (response) => { requestFindHandleMsg({}, data, (response) => {
if (response.data) { if (response.data) {
if (response.data.state) { if (response.data.state) {
this.handleData = response.data.data this.handleData = response.data.data
......
...@@ -133,13 +133,13 @@ export default { ...@@ -133,13 +133,13 @@ export default {
}, },
getUserList () { getUserList () {
let pageSize = this.pageSize let pageSize = this.pageSize
let params = { let data = {
pageNo: this.page, pageNo: this.page,
pageSize: pageSize, pageSize: pageSize,
username: this.username, username: this.username,
lv: this.userInfo.lv lv: this.userInfo.lv
} }
requestGetPerson(params, {}, (response) => { requestGetPerson({}, data, (response) => {
if (response.data) { if (response.data) {
if (response.data.state) { if (response.data.state) {
this.userData = response.data.data this.userData = response.data.data
......
...@@ -67,7 +67,8 @@ export default { ...@@ -67,7 +67,8 @@ export default {
bus.$emit('alert', '存在未填写项!') bus.$emit('alert', '存在未填写项!')
return false return false
} }
requestInsertChannel(params, {}, (response) => { let data = params
requestInsertChannel(params, data, (response) => {
if (response.data) { if (response.data) {
if (response.data.state) { if (response.data.state) {
bus.$emit('alert', response.data.message) bus.$emit('alert', response.data.message)
......
...@@ -44,12 +44,12 @@ export default { ...@@ -44,12 +44,12 @@ export default {
}) })
}, },
submit () { submit () {
let params = { let data = {
id: this.checkedChannel.map((n, i) => { id: this.checkedChannel.map((n, i) => {
return n.id return n.id
}) })
} }
requestDeleteChannel(params, {}, (response) => { requestDeleteChannel({}, data, (response) => {
if (response.data) { if (response.data) {
if (response.data.state) { if (response.data.state) {
bus.$emit('alert', response.data.message) bus.$emit('alert', response.data.message)
......
...@@ -73,7 +73,8 @@ export default { ...@@ -73,7 +73,8 @@ export default {
bus.$emit('alert', '存在未填写项!') bus.$emit('alert', '存在未填写项!')
return false return false
} }
requestUpdateChannel(params, {}, (response) => { let data = params
requestUpdateChannel(params, data, (response) => {
if (response.data) { if (response.data) {
if (response.data.state) { if (response.data.state) {
bus.$emit('alert', response.data.message) bus.$emit('alert', response.data.message)
......
...@@ -44,13 +44,13 @@ export default { ...@@ -44,13 +44,13 @@ export default {
}) })
}, },
submit () { submit () {
let params = { let data = {
messageId: this.checkedMessage.map((n, i) => { messageId: this.checkedMessage.map((n, i) => {
return n.messageId return n.messageId
}), }),
pt: this.ptSelectedData.pt pt: this.ptSelectedData.pt
} }
requestDeleteMsg(params, {}, (response) => { requestDeleteMsg({}, data, (response) => {
if (response.data) { if (response.data) {
if (response.data.state) { if (response.data.state) {
bus.$emit('alert', response.data.message) bus.$emit('alert', response.data.message)
......
...@@ -113,7 +113,7 @@ export default { ...@@ -113,7 +113,7 @@ export default {
}) })
}, },
submit () { submit () {
let params = { let data = {
messageId: this.childrenData.messageId, messageId: this.childrenData.messageId,
// templateName: this.childrenData.templateName, // templateName: this.childrenData.templateName,
// handleDate: this.childrenData.handleDate, // handleDate: this.childrenData.handleDate,
...@@ -125,7 +125,7 @@ export default { ...@@ -125,7 +125,7 @@ export default {
handler: this.userInfo.username, handler: this.userInfo.username,
pt: this.ptSelectedData.pt pt: this.ptSelectedData.pt
} }
requestHandle(params, {}, (response) => { requestHandle({}, data, (response) => {
if (response.data) { if (response.data) {
if (response.data.state) { if (response.data.state) {
bus.$emit('alert', response.data.message) bus.$emit('alert', response.data.message)
......
...@@ -231,7 +231,8 @@ export default { ...@@ -231,7 +231,8 @@ export default {
console.log('checkTemplateAdd request params:', params) console.log('checkTemplateAdd request params:', params)
// {tmp: JSON.stringify(params)} // {tmp: JSON.stringify(params)}
requestSaveTmp(params, {}, (response) => { let data = params
requestSaveTmp(params, data, (response) => {
if (response.data) { if (response.data) {
if (response.data.state) { if (response.data.state) {
bus.$emit('alert', response.data.message) bus.$emit('alert', response.data.message)
......
...@@ -44,13 +44,13 @@ export default { ...@@ -44,13 +44,13 @@ export default {
}) })
}, },
submit () { submit () {
let params = { let data = {
templateId: this.checkedTemplate.map((n, i) => { templateId: this.checkedTemplate.map((n, i) => {
return n.templateId return n.templateId
}), }),
pt: this.ptSelectedData.pt pt: this.ptSelectedData.pt
} }
requestDeleteTmp(params, {}, (response) => { requestDeleteTmp({}, data, (response) => {
if (response.data) { if (response.data) {
if (response.data.state) { if (response.data.state) {
bus.$emit('alert', response.data.message) bus.$emit('alert', response.data.message)
......
...@@ -231,9 +231,10 @@ export default { ...@@ -231,9 +231,10 @@ export default {
params.field = this.data.field.join(',') params.field = this.data.field.join(',')
params.templateId = this.childrenData.templateId params.templateId = this.childrenData.templateId
console.log('checkTemplateDetails request params:', params) // console.log('checkTemplateDetails request params:', params)
requestUpdateTmp(params, {}, (response) => { let data = params
requestUpdateTmp(params, data, (response) => {
if (response.data) { if (response.data) {
if (response.data.state) { if (response.data.state) {
bus.$emit('alert', response.data.message) bus.$emit('alert', response.data.message)
......
...@@ -136,7 +136,8 @@ export default { ...@@ -136,7 +136,8 @@ export default {
bus.$emit('alert', '端口必须为数字') bus.$emit('alert', '端口必须为数字')
return false return false
} }
requestInsertServer(params, {}, (response) => { let data = params
requestInsertServer(params, data, (response) => {
if (response.data) { if (response.data) {
if (response.data.state) { if (response.data.state) {
bus.$emit('alert', response.data.message) bus.$emit('alert', response.data.message)
......
...@@ -44,12 +44,12 @@ export default { ...@@ -44,12 +44,12 @@ export default {
}) })
}, },
submit () { submit () {
let params = { let data = {
serverid: this.checkedDatabase.map((n, i) => { serverid: this.checkedDatabase.map((n, i) => {
return n.id return n.id
}) })
} }
requestDeleteServer(params, {}, (response) => { requestDeleteServer({}, data, (response) => {
if (response.data) { if (response.data) {
if (response.data.state) { if (response.data.state) {
bus.$emit('alert', response.data.message) bus.$emit('alert', response.data.message)
......
...@@ -137,7 +137,8 @@ export default { ...@@ -137,7 +137,8 @@ export default {
bus.$emit('alert', '存在未填写项!') bus.$emit('alert', '存在未填写项!')
return false return false
} }
requestUpdateServer(params, {}, (response) => { let data = params
requestUpdateServer(params, data, (response) => {
if (response.data) { if (response.data) {
if (response.data.state) { if (response.data.state) {
bus.$emit('alert', response.data.message) bus.$emit('alert', response.data.message)
......
...@@ -144,7 +144,8 @@ export default { ...@@ -144,7 +144,8 @@ export default {
// } // }
// } // }
params.field = params.field.join(',') params.field = params.field.join(',')
requestInsertFields(params, {}, (response) => { let data = params
requestInsertFields(params, data, (response) => {
if (response.data) { if (response.data) {
if (response.data.state) { if (response.data.state) {
bus.$emit('alert', response.data.message) bus.$emit('alert', response.data.message)
......
...@@ -44,12 +44,12 @@ export default { ...@@ -44,12 +44,12 @@ export default {
}) })
}, },
submit () { submit () {
let params = { let data = {
id: this.checkedField.map((n, i) => { id: this.checkedField.map((n, i) => {
return n.id return n.id
}) })
} }
requestDeleteFields(params, {}, (response) => { requestDeleteFields({}, data, (response) => {
if (response.data) { if (response.data) {
if (response.data.state) { if (response.data.state) {
bus.$emit('alert', response.data.message) bus.$emit('alert', response.data.message)
......
...@@ -154,7 +154,8 @@ export default { ...@@ -154,7 +154,8 @@ export default {
// } // }
params.field = params.field.join(',') params.field = params.field.join(',')
params.id = this.childrenData.id params.id = this.childrenData.id
requestUpdateFields(params, {}, (response) => { let data = params
requestUpdateFields(params, data, (response) => {
if (response.data) { if (response.data) {
if (response.data.state) { if (response.data.state) {
bus.$emit('alert', response.data.message) bus.$emit('alert', response.data.message)
......
...@@ -25,7 +25,7 @@ export default { ...@@ -25,7 +25,7 @@ export default {
return { return {
} }
}, },
props: ['checkedMessage'], props: ['checkedMessage', 'ptSelectedData'],
mounted () { mounted () {
// 弹框弹出动画 // 弹框弹出动画
window.$(() => { window.$(() => {
...@@ -44,12 +44,13 @@ export default { ...@@ -44,12 +44,13 @@ export default {
}) })
}, },
submit () { submit () {
let params = { let data = {
messageId: this.checkedMessage.map((n, i) => { messageId: this.checkedMessage.map((n, i) => {
return n.messageId return n.messageId
}) }),
pt: this.ptSelectedData.pt
} }
requestDeleteMsg(params, {}, (response) => { requestDeleteMsg({}, data, (response) => {
if (response.data) { if (response.data) {
if (response.data.state) { if (response.data.state) {
bus.$emit('alert', response.data.message) bus.$emit('alert', response.data.message)
......
...@@ -62,13 +62,13 @@ export default { ...@@ -62,13 +62,13 @@ export default {
bus.$emit('alert', '等级只能为整数!') bus.$emit('alert', '等级只能为整数!')
return false return false
} }
let params = { let data = {
username: this.username, username: this.username,
password: this.password, password: this.password,
lv: this.lv, lv: this.lv,
creator: this.userInfo.username creator: this.userInfo.username
} }
requestSavePerson(params, {}, (response) => { requestSavePerson({}, data, (response) => {
if (response.data) { if (response.data) {
if (response.data.state) { if (response.data.state) {
bus.$emit('alert', response.data.message) bus.$emit('alert', response.data.message)
......
...@@ -44,12 +44,12 @@ export default { ...@@ -44,12 +44,12 @@ export default {
}) })
}, },
submit () { submit () {
let params = { let data = {
personId: this.checkedUsers.map((n, i) => { personId: this.checkedUsers.map((n, i) => {
return n.personId return n.personId
}) })
} }
requestDeletePerson(params, {}, (response) => { requestDeletePerson({}, data, (response) => {
if (response.data) { if (response.data) {
if (response.data.state) { if (response.data.state) {
bus.$emit('alert', response.data.message) bus.$emit('alert', response.data.message)
......
...@@ -66,13 +66,13 @@ export default { ...@@ -66,13 +66,13 @@ export default {
bus.$emit('alert', '等级只能为整数!') bus.$emit('alert', '等级只能为整数!')
return false return false
} }
let params = { let data = {
username: this.username, username: this.username,
password: this.password, password: this.password,
personId: this.childrenData.personId, personId: this.childrenData.personId,
lv: this.lv lv: this.lv
} }
requestUpdatePerson(params, {}, (response) => { requestUpdatePerson({}, data, (response) => {
if (response.data) { if (response.data) {
if (response.data.state) { if (response.data.state) {
bus.$emit('alert', response.data.message) bus.$emit('alert', response.data.message)
......
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