Commit 90ec7ecf by huangjy

feat,查询设备日志

parent aa39aee9
......@@ -10,6 +10,7 @@ import com.makeit.entity.saas.analysis.SaasSleepEvaluateReport;
import com.makeit.global.annotation.Action;
import com.makeit.service.saas.SaasDiseaseEvaluateReportService;
import com.makeit.service.saas.SaasSleepEvaluateReportService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
......@@ -28,6 +29,7 @@ import org.springframework.web.bind.annotation.RestController;
*/
@RestController
@RequestMapping("/saas/diseaseEvaluateReport")
@Api(tags = "saas端-报告管理")
public class SaasDiseaseEvaluateReportController {
......
......@@ -8,6 +8,7 @@ import com.makeit.dto.saas.analysis.SaasDiseaseModelDTO;
import com.makeit.entity.saas.analysis.SaasDiseaseModel;
import com.makeit.global.annotation.Action;
import com.makeit.service.saas.SaasDiseaseModelService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
......@@ -26,6 +27,7 @@ import org.springframework.web.bind.annotation.RestController;
*/
@RestController
@RequestMapping("/saas/diseaseModel")
@Api(tags = "saas端-模型管理")
public class SaasDiseaseModelController {
......
......@@ -8,6 +8,7 @@ import com.makeit.dto.saas.analysis.SaasElderReportConfigDTO;
import com.makeit.entity.saas.analysis.SaasElderReportConfig;
import com.makeit.global.annotation.Action;
import com.makeit.service.saas.SaasElderReportConfigService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
......@@ -26,6 +27,7 @@ import org.springframework.web.bind.annotation.RestController;
*/
@RestController
@RequestMapping("/saas/elderReportConfig")
@Api(tags = "saas端-报告管理")
public class SaasElderReportConfigController {
@Autowired
private SaasElderReportConfigService saasElderReportConfigService;
......
......@@ -9,6 +9,7 @@ import com.makeit.entity.saas.analysis.SaasModelManage;
import com.makeit.global.annotation.Action;
import com.makeit.module.admin.vo.plat.PlatTenantVO;
import com.makeit.service.saas.SaasModelManageService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
......@@ -28,13 +29,14 @@ import java.util.List;
*/
@RestController
@RequestMapping("/saas/modelManage")
@Api(tags = "saas端-报告管理")
public class SaasModelManageController {
@Autowired
private SaasModelManageService saasModelManageService;
@Action(module = "租户管理-租户", name = "分页列表", code = "saas:modelManage:page")
@Action(module = "数据分析-模型管理", name = "分页列表", code = "saas:modelManage:page")
@ApiOperation("分页列表")
@PostMapping("list")
public ApiResponseEntity<List<SaasModelManage>> list(){
......
......@@ -8,6 +8,7 @@ import com.makeit.entity.saas.analysis.SaasReportManage;
import com.makeit.global.annotation.Action;
import com.makeit.service.saas.SaasModelManageService;
import com.makeit.service.saas.SaasReportManageService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
......@@ -26,13 +27,14 @@ import java.util.List;
*/
@RestController
@RequestMapping("/saas/reportManage")
@Api(tags = "saas端-报告管理")
public class SaasReportManageController {
@Autowired
private SaasReportManageService saasReportManageService;
@Action(module = "租户管理-租户", name = "分页列表", code = "saas:reportManage:page")
@Action(module = "数据分析-报告管理", name = "分页列表", code = "saas:reportManage:page")
@ApiOperation("分页列表")
@PostMapping("list")
public ApiResponseEntity<List<SaasReportManage>> list(){
......
......@@ -9,6 +9,7 @@ import com.makeit.entity.saas.analysis.SaasSleepAnalysisModel;
import com.makeit.global.annotation.Action;
import com.makeit.module.admin.dto.plat.PlatTenantDTOVO;
import com.makeit.service.saas.SaasSleepAnalysisModelService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
......@@ -27,6 +28,7 @@ import org.springframework.web.bind.annotation.RestController;
*/
@RestController
@RequestMapping("/saas/sleepAnalysisModel")
@Api(tags = "saas端-模型管理")
public class SaasSleepAnalysisModelController {
@Autowired
......
......@@ -8,6 +8,7 @@ import com.makeit.dto.saas.analysis.SaasSleepEvaluateReportDTO;
import com.makeit.entity.saas.analysis.SaasSleepEvaluateReport;
import com.makeit.global.annotation.Action;
import com.makeit.service.saas.SaasSleepEvaluateReportService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
......@@ -26,6 +27,7 @@ import org.springframework.web.bind.annotation.RestController;
*/
@RestController
@RequestMapping("/saas/sleepEvaluateReport")
@Api(tags = "saas端-报告管理")
public class SaasSleepEvaluateReportController {
......
......@@ -8,6 +8,7 @@ import com.makeit.dto.saas.analysis.SaasSleepEvaluateStandardReportDTO;
import com.makeit.entity.saas.analysis.SaasSleepEvaluateStandardReport;
import com.makeit.global.annotation.Action;
import com.makeit.service.saas.SaasSleepEvaluateStandardReportService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
......@@ -26,6 +27,7 @@ import org.springframework.web.bind.annotation.RestController;
*/
@RestController
@RequestMapping("/saas/sleepEvaluateStandardReport")
@Api(tags = "saas端-报告管理")
public class SaasSleepEvaluateStandardReportController {
......
......@@ -128,6 +128,48 @@ public class IotProductDeviceService extends IotCommonService {
return getDeviceLog(deviceId, 10,typeValue);
}
public List<DeviceOperationLogEntity> getDeviceLogByTimeRange(String deviceId, int pageSize,String startTime,String endTime) {
IotQueryParam iotQueryParam = buildQueryParam(pageSize);
List<Term> terms = Lists.newArrayList();
Term term1 = Term.builder()
.column("timestamp")
.termType("gte")
.type(Term.Type.or)
.value(startTime)
.terms(Lists.newArrayList())
.options(Lists.newArrayList())
.build();
Term term2 = Term.builder()
.column("timestamp")
.termType("lte")
.type(Term.Type.and)
.value(endTime)
.terms(Lists.newArrayList())
.options(Lists.newArrayList())
.build();
terms.add(term1);
terms.add(term2);
iotQueryParam.setTerms(terms);
String body = JsonUtil.toJson(iotQueryParam);
String url = iotUrl + DEVICE_PREFIX_URL + deviceId + "/logs";
HttpRequest request = buildRequest(url, body);
try {
ResponseMessage responseMessage = sendPost(url, request);
if (responseMessage.getStatus() == 200) {
IotPagerResult pagerResult = JSON.parseObject(responseMessage.getResult().toString(), IotPagerResult.class);
List<DeviceOperationLogEntity> deviceOperationLogEntities = JSONArray.parseArray(pagerResult.getData().toString()).toJavaList(DeviceOperationLogEntity.class);
//Map maps = (Map) JSON.parse(datum.getContent().toString());
return deviceOperationLogEntities;
}
log.error("获取设备接口失败:{}", responseMessage.getMessage());
} catch (IOException e) {
log.error("调用:{}接口异常:{}", url, e.getMessage());
}
return Lists.newArrayList();
}
/**
* 获取设备的日志
*
......@@ -141,7 +183,7 @@ public class IotProductDeviceService extends IotCommonService {
List<Term> terms = Lists.newArrayList();
Term term = Term.builder()
.column("type")
.termType("eq")
.termType("btw")
.type(Term.Type.or)
.value(typeValue)
.terms(Lists.newArrayList())
......
......@@ -63,6 +63,11 @@ public class IotTest {
}
@Test
void getDeviceLogByTimeRange() {
iotProductDeviceService.getDeviceLogByTimeRange("1701127702523473920",100,"2023-09-12 00:00:00","2023-09-12 23:59:00");
}
@Test
void getIotOrgInfo() {
iotOrgService.getIotOrgInfo("1698964909267415040");
}
......
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