Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
device-platform
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
赵啸非
device-platform
Commits
fc09fa35
Commit
fc09fa35
authored
Mar 10, 2022
by
赵啸非
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改pom文件
parent
c823a09a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
3 deletions
+24
-3
device-manager/src/main/java/com/mortals/xhx/busiz/web/DeviceApiController.java
...n/java/com/mortals/xhx/busiz/web/DeviceApiController.java
+24
-3
No files found.
device-manager/src/main/java/com/mortals/xhx/busiz/web/DeviceApiController.java
View file @
fc09fa35
...
@@ -23,7 +23,7 @@ import org.springframework.web.bind.annotation.RestController;
...
@@ -23,7 +23,7 @@ import org.springframework.web.bind.annotation.RestController;
import
java.util.Date
;
import
java.util.Date
;
/**
/**
*
流程定义部署接口类
*
设备
*
*
* @author: zxfei
* @author: zxfei
* @date: 2021/8/24 20:28
* @date: 2021/8/24 20:28
...
@@ -47,6 +47,7 @@ public class DeviceApiController {
...
@@ -47,6 +47,7 @@ public class DeviceApiController {
*/
*/
@PostMapping
(
"upload"
)
@PostMapping
(
"upload"
)
public
String
upload
(
DeviceReq
req
)
{
public
String
upload
(
DeviceReq
req
)
{
log
.
info
(
"【设备数据上报】【请求体】--> "
+
JSONObject
.
toJSONString
(
req
));
ApiResp
rsp
=
new
ApiResp
<>();
ApiResp
rsp
=
new
ApiResp
<>();
rsp
.
setMsg
(
ApiRespCodeEnum
.
SUCCESS
.
getLabel
());
rsp
.
setMsg
(
ApiRespCodeEnum
.
SUCCESS
.
getLabel
());
rsp
.
setCode
(
ApiRespCodeEnum
.
SUCCESS
.
getValue
());
rsp
.
setCode
(
ApiRespCodeEnum
.
SUCCESS
.
getValue
());
...
@@ -80,7 +81,27 @@ public class DeviceApiController {
...
@@ -80,7 +81,27 @@ public class DeviceApiController {
}
}
}
else
{
}
else
{
throw
new
AppException
(
"未找到当前设备,devicenum:"
+
req
.
getDevicenum
());
//新增设备
deviceEntity
=
new
DeviceEntity
();
deviceEntity
.
initAttrValue
();
deviceEntity
.
setDeviceCode
(
req
.
getDevicenum
());
deviceEntity
.
setOnlineTime
(
new
Date
());
deviceEntity
.
setDeviceOnlineStatus
(
DeviceOnlineStatusEnum
.
在线
.
getValue
());
deviceEntity
.
setIp
(
req
.
getIp
());
deviceEntity
.
setPort
(
req
.
getPort
());
deviceEntity
.
setSiteNum
(
req
.
getSitenum
());
deviceEntity
.
setCenternum
(
req
.
getCenternum
());
deviceService
.
save
(
deviceEntity
);
DeviceLogEntity
deviceLogEntity
=
new
DeviceLogEntity
();
deviceLogEntity
.
initAttrValue
();
deviceLogEntity
.
setDeviceId
(
deviceEntity
.
getId
());
deviceLogEntity
.
setDeviceName
(
deviceEntity
.
getDeviceName
());
deviceLogEntity
.
setDeviceNum
(
deviceEntity
.
getDeviceCode
());
deviceLogEntity
.
setContent
(
JSONObject
.
toJSONString
(
req
));
deviceLogEntity
.
setCreateTime
(
new
Date
());
deviceLogService
.
save
(
deviceLogEntity
);
WebSocketUtil
.
broadcast
(
SendToAllRequest
.
TYPE
,
new
SendToAllRequest
().
setContent
(
JSON
.
toJSONString
(
deviceEntity
)));
}
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
...
@@ -90,7 +111,7 @@ public class DeviceApiController {
...
@@ -90,7 +111,7 @@ public class DeviceApiController {
return
JSON
.
toJSONString
(
rsp
);
return
JSON
.
toJSONString
(
rsp
);
}
}
log
.
info
(
"响应【
启动
】【响应体】--> "
+
JSONObject
.
toJSONString
(
rsp
));
log
.
info
(
"响应【
设备数据上报
】【响应体】--> "
+
JSONObject
.
toJSONString
(
rsp
));
return
JSON
.
toJSONString
(
rsp
);
return
JSON
.
toJSONString
(
rsp
);
}
}
...
...
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