|
@@ -1,8 +1,12 @@
|
|
|
package com.tidecloud.dataacceptance.entity;
|
|
|
|
|
|
import java.io.Serializable;
|
|
|
+import java.text.ParseException;
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
import java.util.Date;
|
|
|
|
|
|
+import com.tidecloud.dataacceptance.common.DateUtil;
|
|
|
+
|
|
|
/**
|
|
|
* @author: chudk
|
|
|
* @date: 2017年9月18日 上午11:04:09
|
|
@@ -81,10 +85,11 @@ public class Device implements Serializable{
|
|
|
+ electric + ", step=" + step + ", terminalState=" + terminalState + ", deviceId=" + deviceId + "]";
|
|
|
}
|
|
|
public static String buildDeviceStr(Device device){
|
|
|
-
|
|
|
+ Date timestamp = device.getTimestamp();
|
|
|
+ timestamp = DateUtil.calculateByHour(timestamp, 8);
|
|
|
StringBuilder builder = new StringBuilder();
|
|
|
builder.append(device.getDeviceId()).append(",");
|
|
|
- builder.append(device.getTimestamp().getTime() / 1000).append(",");
|
|
|
+ builder.append(1).append(",");
|
|
|
builder.append(device.getItemState()).append(",");
|
|
|
builder.append(device.getLng()).append(",");
|
|
|
builder.append(device.getLat()).append(",");
|
|
@@ -93,4 +98,16 @@ public class Device implements Serializable{
|
|
|
|
|
|
return builder.toString();
|
|
|
}
|
|
|
+
|
|
|
+ public static void main(String[] args) {
|
|
|
+ Date parse;
|
|
|
+ try {
|
|
|
+ parse = new SimpleDateFormat("yyMMddHHmmss").parse("170228235504");
|
|
|
+ Date calculateByDate = DateUtil.calculateByHour(parse, 8);
|
|
|
+ String format = new SimpleDateFormat("yy-MM-dd HH:mm:ss").format(calculateByDate);
|
|
|
+ System.out.println(format);
|
|
|
+ } catch (ParseException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|