|
@@ -2,17 +2,11 @@ package test;
|
|
|
|
|
|
import com.gyee.SpringbootStart;
|
|
|
import com.gyee.frame.model.custom.PointData;
|
|
|
-import com.gyee.frame.util.DateUtils;
|
|
|
import com.gyee.frame.util.IRealTimeDataBaseUtil;
|
|
|
import com.gyee.frame.util.RealTimeDataBaseFactory;
|
|
|
import lombok.SneakyThrows;
|
|
|
import org.springframework.boot.SpringApplication;
|
|
|
|
|
|
-import java.text.SimpleDateFormat;
|
|
|
-import java.util.Calendar;
|
|
|
-import java.util.Date;
|
|
|
-import java.util.List;
|
|
|
-
|
|
|
public class MongoDBTest {
|
|
|
|
|
|
@SneakyThrows
|
|
@@ -21,31 +15,31 @@ public class MongoDBTest {
|
|
|
SpringApplication.run(SpringbootStart.class, args);
|
|
|
IRealTimeDataBaseUtil mongodb= RealTimeDataBaseFactory.createRealTimeDataBase();
|
|
|
|
|
|
- Calendar c = Calendar.getInstance();
|
|
|
- c.set(Calendar.MONTH, 3);
|
|
|
- c.set(Calendar.DAY_OF_MONTH, 25);
|
|
|
- c.set(Calendar.HOUR_OF_DAY, 0);
|
|
|
- c.set(Calendar.MINUTE, 0);
|
|
|
- c.set(Calendar.SECOND, 0);
|
|
|
-
|
|
|
- Date beginDate = c.getTime();
|
|
|
- c.add(Calendar.DAY_OF_MONTH, 1);
|
|
|
- Date endDate = c.getTime();
|
|
|
-
|
|
|
- SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH");
|
|
|
- Date nowTime = DateUtils.getNowDate();
|
|
|
- Date endTime = sdf.parse(sdf.format(nowTime));
|
|
|
- SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
- Date beginTime = sdf1.parse(sdf1.format(nowTime));
|
|
|
-//查看历史快照数据
|
|
|
- List<PointData> ls = mongodb.getHistoryDatasSnap("HB_GD_KBF_JS_P4_L19_220_CI0136",
|
|
|
- beginTime.getTime() / 1000, endTime.getTime() / 1000,
|
|
|
- (long) 999, 3600L);
|
|
|
- if (!ls.isEmpty()) {
|
|
|
- ls.forEach(obj -> System.out.println(obj.getEdnaId() + "___" +obj.getPointTime() + "___" + obj.getPointValueInDouble()));
|
|
|
- }
|
|
|
+// Calendar c = Calendar.getInstance();
|
|
|
+// c.set(Calendar.MONTH, 3);
|
|
|
+// c.set(Calendar.DAY_OF_MONTH, 25);
|
|
|
+// c.set(Calendar.HOUR_OF_DAY, 0);
|
|
|
+// c.set(Calendar.MINUTE, 0);
|
|
|
+// c.set(Calendar.SECOND, 0);
|
|
|
+//
|
|
|
+// Date beginDate = c.getTime();
|
|
|
+// c.add(Calendar.DAY_OF_MONTH, 1);
|
|
|
+// Date endDate = c.getTime();
|
|
|
+//
|
|
|
+// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH");
|
|
|
+// Date nowTime = DateUtils.getNowDate();
|
|
|
+// Date endTime = sdf.parse(sdf.format(nowTime));
|
|
|
+// SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
+// Date beginTime = sdf1.parse(sdf1.format(nowTime));
|
|
|
+////查看历史快照数据
|
|
|
+// List<PointData> ls = mongodb.getHistoryDatasSnap("HB_GD_KBF_JS_P4_L19_220_CI0136",
|
|
|
+// beginTime.getTime() / 1000, endTime.getTime() / 1000,
|
|
|
+// (long) 999, 3600L);
|
|
|
+// if (!ls.isEmpty()) {
|
|
|
+// ls.forEach(obj -> System.out.println(obj.getEdnaId() + "___" +obj.getPointTime() + "___" + obj.getPointValueInDouble()));
|
|
|
+// }
|
|
|
//查看实时数据
|
|
|
- PointData real=mongodb.getRealData("HB_GD_KBF_JS_P4_L19_220_CI0136");
|
|
|
+ PointData real=mongodb.getRealData("HB_GD_CLF_JS_XX_XX_XXX_CI0004");
|
|
|
System.out.println(real.getPointValueInDouble());
|
|
|
}
|
|
|
|