Commit 3b7a3ea3 by huangjy

feat,设备日志

parent 7e7df2c5
...@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON; ...@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.makeit.module.iot.dto.IotQueryParam; import com.makeit.module.iot.dto.IotQueryParam;
import com.makeit.module.iot.dto.IotSort;
import com.makeit.module.iot.dto.Term; import com.makeit.module.iot.dto.Term;
import com.makeit.module.iot.util.HttpRequest; import com.makeit.module.iot.util.HttpRequest;
import com.makeit.module.iot.vo.DeviceInstanceEntity; import com.makeit.module.iot.vo.DeviceInstanceEntity;
...@@ -193,7 +194,15 @@ public class IotProductDeviceService extends IotCommonService { ...@@ -193,7 +194,15 @@ public class IotProductDeviceService extends IotCommonService {
return getDeviceLog(deviceId, 10, typeValue); return getDeviceLog(deviceId, 10, typeValue);
} }
/**
*
* @param deviceId
* @param typeValue
* @param pageSize
* @param startTime
* @param endTime
* @return
*/
public List<DeviceOperationLogEntity> getDeviceLogByTimeRange(String deviceId, String typeValue, int pageSize, String startTime, String endTime) { public List<DeviceOperationLogEntity> getDeviceLogByTimeRange(String deviceId, String typeValue, int pageSize, String startTime, String endTime) {
IotQueryParam iotQueryParam = buildQueryParam(pageSize); IotQueryParam iotQueryParam = buildQueryParam(pageSize);
List<Term> terms = Lists.newArrayList(); List<Term> terms = Lists.newArrayList();
...@@ -226,6 +235,14 @@ public class IotProductDeviceService extends IotCommonService { ...@@ -226,6 +235,14 @@ public class IotProductDeviceService extends IotCommonService {
terms.add(term1); terms.add(term1);
terms.add(term2); terms.add(term2);
iotQueryParam.setTerms(terms); iotQueryParam.setTerms(terms);
List<IotSort> iotSortList = Lists.newArrayList();
IotSort iotSort = new IotSort();
iotSort.setOrder("asc");
iotSort.setName("timestamp");
iotSortList.add(iotSort);
iotQueryParam.setSorts(iotSortList);
String body = JsonUtil.toJson(iotQueryParam); String body = JsonUtil.toJson(iotQueryParam);
String url = iotUrl + DEVICE_PREFIX_URL + deviceId + "/logs"; String url = iotUrl + DEVICE_PREFIX_URL + deviceId + "/logs";
HttpRequest request = buildRequest(url, body); HttpRequest request = buildRequest(url, body);
......
package com.makeit.module.iot.vo.analysis;
import lombok.Data;
@Data
public class SleepTimeAnalysisVO {
private String startSleepTime; // 入睡时间开始
private String endSleepTime; // 入睡时间结束
}
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 sign in to comment