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
9a6245b4
Commit
9a6245b4
authored
Apr 28, 2021
by
梁光意
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/develop' into develop
parents
0cb0f7de
09dc7f7f
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
81 additions
and
13 deletions
+81
-13
BaseRestController.java
...java/com/syc/slm/slmbi/controller/BaseRestController.java
+2
-0
DeptController.java
...ain/java/com/syc/slm/slmbi/controller/DeptController.java
+16
-0
VariableController.java
...java/com/syc/slm/slmbi/controller/VariableController.java
+1
-1
SendDeviceCommandsDTO.java
...ain/java/com/syc/slm/slmbi/dto/SendDeviceCommandsDTO.java
+25
-0
VariableSendDTO.java
src/main/java/com/syc/slm/slmbi/dto/VariableSendDTO.java
+5
-4
InstrumentPanelConfigServiceImpl.java
.../slmbi/service/impl/InstrumentPanelConfigServiceImpl.java
+6
-2
VariableServiceImpl.java
...a/com/syc/slm/slmbi/service/impl/VariableServiceImpl.java
+24
-6
application.yml
src/main/resources/application.yml
+2
-0
No files found.
src/main/java/com/syc/slm/slmbi/controller/BaseRestController.java
View file @
9a6245b4
...
...
@@ -59,6 +59,8 @@ public class BaseRestController {
protected
String
variableRealTimeDataList
;
@Value
(
"${dc_client.interfaces.filedValue}"
)
protected
String
filedValue
;
@Value
(
"${dc_client.interfaces.send}"
)
protected
String
send
;
...
...
src/main/java/com/syc/slm/slmbi/controller/DeptController.java
View file @
9a6245b4
package
com
.
syc
.
slm
.
slmbi
.
controller
;
import
com.google.common.collect.Maps
;
import
com.google.gson.reflect.TypeToken
;
import
com.syc.slm.common.core.util.R
;
import
com.syc.slm.common.core.util.RestTemplateUtils
;
import
com.syc.slm.slmbi.entity.CurrentUser
;
import
com.syc.slm.slmbi.service.DeptService
;
import
com.syc.slm.slmbi.vo.DeptVo
;
...
...
@@ -13,6 +16,7 @@ import org.springframework.web.bind.annotation.*;
import
javax.servlet.http.HttpServletRequest
;
import
java.util.List
;
import
java.util.Map
;
/**
* slm-bi
...
...
@@ -40,4 +44,16 @@ public class DeptController extends BaseRestController{
return
deptService
.
selectPositionList
(
dcClientHost
+
deptListUrl
,
currentUser
.
getToken
(),
appId
,
deptName
);
});
}
@GetMapping
(
"/base"
)
@ApiOperation
(
"部门查询"
)
public
R
<
List
<
DeptVo
>>
base
(
HttpServletRequest
request
,
@PathVariable
String
appId
)
{
return
call
(()
->
{
Map
<
String
,
String
>
uriVariables
=
Maps
.
newHashMap
();
uriVariables
.
put
(
"appId"
,
appId
);
String
uri
=
dcClientHost
+
"/{appId}/base"
;
RestTemplateUtils
.
get
(
uri
,
new
TypeToken
<
R
<
List
<
DeptVo
>>>()
{}.
getType
(),
uriVariables
);
return
null
;
});
}
}
src/main/java/com/syc/slm/slmbi/controller/VariableController.java
View file @
9a6245b4
...
...
@@ -133,7 +133,7 @@ public class VariableController extends BaseRestController{
public
R
<
Object
>
send
(
HttpServletRequest
request
,
@PathVariable
String
appId
,
@RequestBody
VariableSendDTO
sendDTO
)
{
return
call
(()
->
{
CurrentUser
currentUser
=
getCurrentUser
(
request
);
variableService
.
send
(
sendDTO
,
currentUser
,
dcClientHost
+
deptsRoles
);
variableService
.
send
(
sendDTO
,
currentUser
,
dcClientHost
+
send
);
});
}
}
src/main/java/com/syc/slm/slmbi/dto/SendDeviceCommandsDTO.java
0 → 100644
View file @
9a6245b4
package
com
.
syc
.
slm
.
slmbi
.
dto
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.util.Map
;
/**
* 创建时间:2019-03-21
* <p>修改时间:2019-03-21
* <p>类说明:TOTO
*
* @author luke
* @version 1.0
*/
@Data
public
class
SendDeviceCommandsDTO
{
@ApiModelProperty
(
value
=
"token"
,
required
=
true
)
private
String
token
;
@ApiModelProperty
(
value
=
"appId"
,
required
=
true
)
private
String
appId
;
@ApiModelProperty
(
value
=
"key 是变量得id , value 是下发得值"
,
required
=
true
)
private
Map
<
String
,
Object
>
commandMap
;
}
src/main/java/com/syc/slm/slmbi/dto/VariableSendDTO.java
View file @
9a6245b4
...
...
@@ -5,6 +5,7 @@ import io.swagger.annotations.ApiModelProperty;
import
lombok.Data
;
import
java.util.List
;
import
java.util.Map
;
/**
* slm-bi
...
...
@@ -19,10 +20,10 @@ public class VariableSendDTO {
private
String
accessType
;
@ApiModelProperty
(
value
=
"权限控制"
,
required
=
true
)
private
List
<
CustomPermissionDTO
>
permissions
;
@ApiModelProperty
(
value
=
"变量id"
,
required
=
true
)
private
String
variableId
;
@ApiModelProperty
(
value
=
"设备id"
,
required
=
true
)
private
String
equipmentId
;
@ApiModelProperty
(
value
=
"权限为私有的时候需要把创建人传入"
,
required
=
true
)
private
String
userId
;
@ApiModelProperty
(
value
=
"key 是变量得id , value 是下发得值"
,
required
=
true
)
private
Map
<
String
,
Object
>
commandMap
;
}
src/main/java/com/syc/slm/slmbi/service/impl/InstrumentPanelConfigServiceImpl.java
View file @
9a6245b4
...
...
@@ -278,6 +278,8 @@ public class InstrumentPanelConfigServiceImpl extends ServiceImpl<InstrumentPane
where
.
eq
(
BaseEntity:
:
getRecordStatus
,
SlmConstants
.
DATA_VALID
);
where
.
eq
(
InstrumentPanelConfig:
:
getPanelId
,
panelId
);
List
<
InstrumentPanelConfig
>
configs
=
baseMapper
.
selectList
(
where
);
String
waitPublished
=
null
;
String
published
=
null
;
if
(
CollectionUtils
.
isNotEmpty
(
configs
)){
InstrumentPanelConfig
waitConfig
=
configs
.
stream
()
.
filter
(
x
->
PublishedStatus
.
WAIT_PUBLISHED
.
value
.
equals
(
x
.
getPublished
()))
...
...
@@ -285,7 +287,7 @@ public class InstrumentPanelConfigServiceImpl extends ServiceImpl<InstrumentPane
.
orElse
(
null
);
if
(
ObjectUtils
.
isNotEmpty
(
waitConfig
)){
try
{
maps
.
put
(
PublishedStatus
.
WAIT_PUBLISHED
.
value
,
URLDecoder
.
decode
(
waitConfig
.
getConfigDetails
(),
StandardCharsets
.
UTF_8
.
name
()
));
waitPublished
=
URLDecoder
.
decode
(
waitConfig
.
getConfigDetails
(),
StandardCharsets
.
UTF_8
.
name
(
));
}
catch
(
Exception
e
){
e
.
printStackTrace
();
}
...
...
@@ -296,12 +298,14 @@ public class InstrumentPanelConfigServiceImpl extends ServiceImpl<InstrumentPane
.
orElse
(
null
);
if
(
ObjectUtils
.
isNotEmpty
(
publishConfig
)){
try
{
maps
.
put
(
PublishedStatus
.
PUBLISHED
.
value
,
URLDecoder
.
decode
(
publishConfig
.
getConfigDetails
(),
StandardCharsets
.
UTF_8
.
name
()
));
published
=
URLDecoder
.
decode
(
publishConfig
.
getConfigDetails
(),
StandardCharsets
.
UTF_8
.
name
(
));
}
catch
(
Exception
e
){
e
.
printStackTrace
();
}
}
}
maps
.
put
(
PublishedStatus
.
WAIT_PUBLISHED
.
value
,
waitPublished
);
maps
.
put
(
PublishedStatus
.
PUBLISHED
.
value
,
published
);
return
maps
;
}
...
...
src/main/java/com/syc/slm/slmbi/service/impl/VariableServiceImpl.java
View file @
9a6245b4
...
...
@@ -2,6 +2,7 @@ package com.syc.slm.slmbi.service.impl;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.core.toolkit.CollectionUtils
;
import
com.baomidou.mybatisplus.core.toolkit.ObjectUtils
;
import
com.baomidou.mybatisplus.core.toolkit.StringUtils
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.google.common.collect.Lists
;
...
...
@@ -22,6 +23,7 @@ import org.springframework.stereotype.Service;
import
org.springframework.transaction.annotation.Transactional
;
import
java.math.BigDecimal
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
...
...
@@ -194,12 +196,7 @@ public class VariableServiceImpl implements VariableService {
if
(
StringUtils
.
isBlank
(
sendDTO
.
getAccessType
()))
{
throw
new
SysException
(
"请传入访问类型"
);
}
if
(
StringUtils
.
isBlank
(
sendDTO
.
getEquipmentId
()))
{
throw
new
SysException
(
"请传入设备id"
);
}
if
(
StringUtils
.
isBlank
(
sendDTO
.
getVariableId
()))
{
throw
new
SysException
(
"请传入变量id"
);
}
if
(
AccessType
.
PRIVATE
.
value
.
equals
(
sendDTO
.
getAccessType
())){
if
(
StringUtils
.
isBlank
(
sendDTO
.
getUserId
()))
{
throw
new
SysException
(
"访问类型为私有,请传入创建人"
);
...
...
@@ -247,8 +244,29 @@ public class VariableServiceImpl implements VariableService {
}
}
}
//# todo 准备下发接口
Map
<
String
,
Object
>
commandMap
=
sendDTO
.
getCommandMap
();
if
(
CollectionUtils
.
isEmpty
(
commandMap
)){
throw
new
SysException
(
"变量值必传"
);
}
if
(
commandMap
.
keySet
().
stream
().
anyMatch
(
StringUtils:
:
isBlank
)){
throw
new
SysException
(
"变量id 不能为空"
);
}
if
(
commandMap
.
values
().
stream
().
anyMatch
(
ObjectUtils:
:
isEmpty
)){
throw
new
SysException
(
"变量对应得value 值不能为空"
);
}
SendDeviceCommandsDTO
dto
=
new
SendDeviceCommandsDTO
();
dto
.
setCommandMap
(
commandMap
);
dto
.
setToken
(
currentUser
.
getToken
());
dto
.
setAppId
(
currentUser
.
getAppId
());
Map
<
String
,
String
>
uriVariables
=
Maps
.
newHashMap
();
uriVariables
.
put
(
"appId"
,
currentUser
.
getAppId
());
RestTemplateUtils
.
post
(
uri
,
dto
,
new
TypeToken
<
R
<
List
<
Map
<
String
,
Object
>>>>()
{}.
getType
(),
uriVariables
);
}
private
R
<
Map
<
String
,
String
>>
setDeptAndRole
(
CurrentUser
user
,
String
uri
){
...
...
src/main/resources/application.yml
View file @
9a6245b4
...
...
@@ -61,3 +61,4 @@ dc_client:
variableHistoryDataList
:
/{appId}/variables/history?deviceId={deviceId}&endTime={endTime}&startTime={startTime}&statisticsType={statisticsType}&variableCode={variableCode}&variableId={variableId}&x={x}&format={format}
variableRealTimeDataList
:
/{appId}/variables/real-time?deviceId={deviceId}&endTime={endTime}&startTime={startTime}&variableCode={variableCode}&variableId={variableId}&format={format}
filedValue
:
/{appId}/business/{tableName}/{filed}/filed-value?current={current}&size={size}&name={name}
#/{appId}/business/{tableName}/{filed}/filed-value?current={current}&size={size}&name={name}
send
:
/{appId}/variables/monitor/device/commands
\ No newline at end of file
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