Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in / Register
Toggle navigation
E
energyai_java
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
葛齐林
energyai_java
Commits
86d54a50
Commit
86d54a50
authored
Jul 03, 2021
by
李杨
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
人工模式,启停资源点
parent
792a9028
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
5 deletions
+35
-5
EquipmentController.java
...form/admin/modules/eq/controller/EquipmentController.java
+35
-5
No files found.
microservice-admin/src/main/java/com/devplatform/admin/modules/eq/controller/EquipmentController.java
View file @
86d54a50
...
...
@@ -29,10 +29,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.web.bind.annotation.*
;
import
java.text.SimpleDateFormat
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.*
;
/**
* 设备控制
...
...
@@ -57,6 +54,8 @@ public class EquipmentController extends AbstractController {
private
LiStationService
liStationService
;
@Autowired
private
WebSocket
webSocket
;
@Autowired
private
LiResourceService
liResourceService
;
/**
* 获取每个设备最新的参数值
...
...
@@ -333,9 +332,15 @@ public class EquipmentController extends AbstractController {
Map
<
String
,
Object
>
list
=
equipmentService
.
getList
();
webSocket
.
sendAllMessage
(
JSONObject
.
toJSONString
(
list
));
// 控制资源点启停
checkModelOnOrOff
(
type
,
status
);
return
R
.
ok
();
}
/**
* 查询定时温控里面的数据
* @return
...
...
@@ -365,7 +370,29 @@ public class EquipmentController extends AbstractController {
@PostMapping
(
"/onOrOff"
)
public
Map
<
String
,
Object
>
doorOnOff
(
@RequestBody
LiResourceModel
model
)
{
// String postUrl = getUrl(model.getStationId());
String
postUrl
=
"http://localhost:8089/command/operation"
;
return
onOrOff
(
model
);
}
/**
* 根据选择人工模式,来控制资源点啊启停
* @param type 1=供暖模式,2=机械通风,3=自然通风
* @param status 1=开启,2=关闭
*/
private
void
checkModelOnOrOff
(
Integer
type
,
Integer
status
)
{
List
<
LiResource
>
list
=
new
ArrayList
();
// 查询所有模式匹配的资源点
// list = liResourceService.
for
(
int
i
=
0
;
i
<
list
.
size
();
i
++)
{
LiResourceModel
model
=
new
LiResourceModel
();
model
.
setStatus
(
status
);
//操作类型,1=开关
model
.
setActionType
(
1
);
onOrOff
(
model
);
}
}
private
Map
<
String
,
Object
>
onOrOff
(
LiResourceModel
model
)
{
String
postUrl
=
"http://10.2.72.33:8089/command/operation"
;
Map
<
String
,
String
>
postParam
=
new
HashMap
<
String
,
String
>(
10
);
postParam
.
put
(
"liResourceId"
,
model
.
getId
());
postParam
.
put
(
"params"
,
model
.
getStatus
().
toString
());
...
...
@@ -380,10 +407,13 @@ public class EquipmentController extends AbstractController {
map
=
JSONObject
.
parseObject
(
resultMap
.
get
(
"data"
).
toString
(),
Map
.
class
);
}
return
map
;
}
private
String
getUrl
(
String
stationId
)
{
LiStation
liStation
=
liStationService
.
getById
(
stationId
);
return
liStation
.
getByx1
();
}
}
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