Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
slm-bi
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
林锐标
slm-bi
Commits
c95c3992
Commit
c95c3992
authored
May 10, 2021
by
lin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bi接口
parent
dae1d392
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
19 additions
and
10 deletions
+19
-10
VariableController.java
...java/com/syc/slm/slmbi/controller/VariableController.java
+1
-1
VariableRealTimeDTO.java
src/main/java/com/syc/slm/slmbi/dto/VariableRealTimeDTO.java
+9
-4
VariableService.java
src/main/java/com/syc/slm/slmbi/service/VariableService.java
+1
-1
VariableServiceImpl.java
...a/com/syc/slm/slmbi/service/impl/VariableServiceImpl.java
+8
-4
No files found.
src/main/java/com/syc/slm/slmbi/controller/VariableController.java
View file @
c95c3992
...
...
@@ -89,7 +89,7 @@ public class VariableController extends BaseRestController{
@GetMapping
(
"/real-time"
)
@ApiOperation
(
"获取变量实时数据"
)
@ApiImplicitParam
(
name
=
"appId"
,
value
=
"租户id"
,
required
=
true
,
dataTypeClass
=
String
.
class
)
public
R
<
List
<
Map
<
String
,
Object
>>>
getVariableRealTimeDataList
(
HttpServletRequest
request
,
@PathVariable
String
appId
,
public
R
<
List
<
Map
<
String
,
List
<
Map
<
String
,
Object
>>
>>>
getVariableRealTimeDataList
(
HttpServletRequest
request
,
@PathVariable
String
appId
,
VariableRealTimeDTO
variableDTO
)
{
return
call
(()
->
{
CurrentUser
currentUser
=
getCurrentUser
(
request
);
...
...
src/main/java/com/syc/slm/slmbi/dto/VariableRealTimeDTO.java
View file @
c95c3992
...
...
@@ -4,6 +4,8 @@ import io.swagger.annotations.ApiModel;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.util.Map
;
/**
* slm-bi
* 实时变量DTO
...
...
@@ -15,14 +17,17 @@ import lombok.Data;
public
class
VariableRealTimeDTO
{
@ApiModelProperty
(
value
=
"所属设备"
,
required
=
true
)
private
String
deviceId
;
@ApiModelProperty
(
value
=
"变量id"
,
required
=
true
)
private
String
variableId
;
@ApiModelProperty
(
value
=
"变量Code"
,
required
=
true
)
private
String
variableCode
;
//
@ApiModelProperty(value = "变量id", required = true)
//
private String variableId;
//
@ApiModelProperty(value = "变量Code", required = true)
//
private String variableCode;
@ApiModelProperty
(
value
=
"开始时间(时间戳)"
,
required
=
true
)
private
String
startTime
;
@ApiModelProperty
(
value
=
"结束时间(时间戳)"
,
required
=
true
)
private
String
endTime
;
@ApiModelProperty
(
value
=
"请填时间格式如(yyyy-MM-dd HH:mm:ss)"
,
required
=
true
)
private
String
format
;
@ApiModelProperty
(
value
=
"key 为变量id value 为变量名称"
,
required
=
true
)
Map
<
String
,
String
>
variables
;
}
src/main/java/com/syc/slm/slmbi/service/VariableService.java
View file @
c95c3992
...
...
@@ -47,7 +47,7 @@ public interface VariableService {
* @param user
* @return
*/
List
<
Map
<
String
,
Object
>>
getVariableRealTimeDataList
(
@NonNull
String
uri
,
VariableRealTimeDTO
variableDTO
,
CurrentUser
user
);
List
<
Map
<
String
,
List
<
Map
<
String
,
Object
>>
>>
getVariableRealTimeDataList
(
@NonNull
String
uri
,
VariableRealTimeDTO
variableDTO
,
CurrentUser
user
);
/**
* 获取历史数据
...
...
src/main/java/com/syc/slm/slmbi/service/impl/VariableServiceImpl.java
View file @
c95c3992
...
...
@@ -119,15 +119,19 @@ public class VariableServiceImpl implements VariableService {
}
@Override
public
List
<
Map
<
String
,
Object
>>
getVariableRealTimeDataList
(
@NonNull
String
uri
,
VariableRealTimeDTO
variableDTO
,
CurrentUser
user
)
{
public
List
<
Map
<
String
,
List
<
Map
<
String
,
Object
>>
>>
getVariableRealTimeDataList
(
@NonNull
String
uri
,
VariableRealTimeDTO
variableDTO
,
CurrentUser
user
)
{
if
(
StringUtils
.
isBlank
(
uri
)){
throw
new
SysException
(
"请传入uri"
);
}
if
(
StringUtils
.
isBlank
(
variableDTO
.
getDeviceId
())){
throw
new
SysException
(
"请传入设备id"
);
}
if
(
StringUtils
.
isBlank
(
variableDTO
.
getVariableCode
())){
throw
new
SysException
(
"请传入变量code"
);
if
(
CollectionUtils
.
isEmpty
(
variableDTO
.
getVariables
())){
throw
new
SysException
(
"请传入变量"
);
}
else
{
if
(
variableDTO
.
getVariables
().
values
().
stream
().
anyMatch
(
StringUtils:
:
isBlank
))
{
throw
new
SysException
(
"变量名字不能为空"
);
}
}
if
(
StringUtils
.
isBlank
(
variableDTO
.
getEndTime
())){
throw
new
SysException
(
"请传入结束时间"
);
...
...
@@ -140,7 +144,7 @@ public class VariableServiceImpl implements VariableService {
}
Map
<
String
,
String
>
uriVariables
=
SlmConstants
.
gson
.
fromJson
(
SlmConstants
.
gson
.
toJson
(
variableDTO
),
new
TypeToken
<
Map
<
String
,
String
>>(){}.
getType
());
uriVariables
.
put
(
"appId"
,
user
.
getAppId
());
R
<
List
<
Map
<
String
,
Object
>>>
result
=
RestTemplateUtils
.
get
(
uri
,
new
TypeToken
<
R
<
List
<
Map
<
String
,
Object
>>>>()
{}.
getType
(),
uriVariables
);
R
<
List
<
Map
<
String
,
List
<
Map
<
String
,
Object
>>>>>
result
=
RestTemplateUtils
.
get
(
uri
,
new
TypeToken
<
R
<
List
<
Map
<
String
,
List
<
Map
<
String
,
Object
>>
>>>>()
{}.
getType
(),
uriVariables
);
return
result
.
detach
();
}
...
...
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