Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
黄嘉阳
/
iot-platform-server
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
90ec7ecf
authored
Sep 13, 2023
by
huangjy
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
feat,查询设备日志
parent
aa39aee9
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
66 additions
and
3 deletions
saas-module/src/main/java/com/makeit/controller/analysis/SaasDiseaseEvaluateReportController.java
saas-module/src/main/java/com/makeit/controller/analysis/SaasDiseaseModelController.java
saas-module/src/main/java/com/makeit/controller/analysis/SaasElderReportConfigController.java
saas-module/src/main/java/com/makeit/controller/analysis/SaasModelManageController.java
saas-module/src/main/java/com/makeit/controller/analysis/SaasReportManageController.java
saas-module/src/main/java/com/makeit/controller/analysis/SaasSleepAnalysisModelController.java
saas-module/src/main/java/com/makeit/controller/analysis/SaasSleepEvaluateReportController.java
saas-module/src/main/java/com/makeit/controller/analysis/SaasSleepEvaluateStandardReportController.java
server-common/src/main/java/com/makeit/module/iot/service/IotProductDeviceService.java
server-web/src/test/java/com/makeit/iotapi/IotTest.java
saas-module/src/main/java/com/makeit/controller/analysis/SaasDiseaseEvaluateReportController.java
View file @
90ec7ecf
...
...
@@ -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
{
...
...
saas-module/src/main/java/com/makeit/controller/analysis/SaasDiseaseModelController.java
View file @
90ec7ecf
...
...
@@ -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
{
...
...
saas-module/src/main/java/com/makeit/controller/analysis/SaasElderReportConfigController.java
View file @
90ec7ecf
...
...
@@ -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
;
...
...
saas-module/src/main/java/com/makeit/controller/analysis/SaasModelManageController.java
View file @
90ec7ecf
...
...
@@ -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
(){
...
...
saas-module/src/main/java/com/makeit/controller/analysis/SaasReportManageController.java
View file @
90ec7ecf
...
...
@@ -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
(){
...
...
saas-module/src/main/java/com/makeit/controller/analysis/SaasSleepAnalysisModelController.java
View file @
90ec7ecf
...
...
@@ -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
...
...
saas-module/src/main/java/com/makeit/controller/analysis/SaasSleepEvaluateReportController.java
View file @
90ec7ecf
...
...
@@ -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
{
...
...
saas-module/src/main/java/com/makeit/controller/analysis/SaasSleepEvaluateStandardReportController.java
View file @
90ec7ecf
...
...
@@ -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
{
...
...
server-common/src/main/java/com/makeit/module/iot/service/IotProductDeviceService.java
View file @
90ec7ecf
...
...
@@ -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
())
...
...
server-web/src/test/java/com/makeit/iotapi/IotTest.java
View file @
90ec7ecf
...
...
@@ -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"
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment