Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
device-new-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-new-platform
Commits
5936ef35
Commit
5936ef35
authored
Jul 12, 2022
by
赵啸非
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加前端页面
parent
01f5afb1
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
28 additions
and
3 deletions
+28
-3
device-manager-ui/admin/src/views/device/list.vue
device-manager-ui/admin/src/views/device/list.vue
+1
-2
device-manager/src/main/java/com/mortals/xhx/busiz/web/DeviceApiController.java
...n/java/com/mortals/xhx/busiz/web/DeviceApiController.java
+4
-1
device-manager/src/main/java/com/mortals/xhx/common/utils/DownMsgTask.java
...c/main/java/com/mortals/xhx/common/utils/DownMsgTask.java
+21
-0
device-manager/src/main/java/com/mortals/xhx/module/device/service/impl/DeviceServiceImpl.java
...als/xhx/module/device/service/impl/DeviceServiceImpl.java
+2
-0
No files found.
device-manager-ui/admin/src/views/device/list.vue
View file @
5936ef35
...
...
@@ -206,7 +206,7 @@ export default {
},
/** 重写编辑方法 */
toEdit
(
row
)
{
this
.
$refs
.
d
ialog
form
.
edit
(
row
);
this
.
$refs
.
d
rawerView
form
.
edit
(
row
);
},
/** 重写查看方法 */
toView
(
row
)
{
...
...
@@ -357,7 +357,6 @@ export default {
<
div
>
<
table
-
buttons
noAdd
row
=
{
row
}
onEdit
=
{
this
.
toEdit
}
onView
=
{
this
.
toView
}
...
...
device-manager/src/main/java/com/mortals/xhx/busiz/web/DeviceApiController.java
View file @
5936ef35
...
...
@@ -27,6 +27,7 @@ import com.mortals.xhx.common.utils.EncryptUtil;
import
com.mortals.xhx.common.utils.SendTaskThreadPool
;
import
com.mortals.xhx.feign.site.ISiteFeign
;
import
com.mortals.xhx.module.device.model.DeviceEntity
;
import
com.mortals.xhx.module.device.service.DeviceLogService
;
import
com.mortals.xhx.module.device.service.DeviceService
;
import
com.mortals.xhx.module.firm.model.FirmEntity
;
import
com.mortals.xhx.module.firm.service.FirmService
;
...
...
@@ -94,6 +95,8 @@ public class DeviceApiController {
private
ISiteFeign
siteFeign
;
@Autowired
private
FirmService
firmService
;
@Autowired
private
DeviceLogService
deviceLogService
;
/**
* 设备注册
...
...
@@ -398,7 +401,7 @@ public class DeviceApiController {
rsp
.
setMsg
(
ApiRespCodeEnum
.
SUCCESS
.
getLabel
());
rsp
.
setCode
(
ApiRespCodeEnum
.
SUCCESS
.
getValue
());
try
{
DownMsgTask
downMsgTask
=
new
DownMsgTask
(
list
,
platformService
,
productService
,
deviceService
);
DownMsgTask
downMsgTask
=
new
DownMsgTask
(
list
,
platformService
,
productService
,
deviceService
,
deviceLogService
);
sendTaskThreadPool
.
execute
(
downMsgTask
);
}
catch
(
Exception
e
)
{
log
.
error
(
"接收数据失败"
,
e
);
...
...
device-manager/src/main/java/com/mortals/xhx/common/utils/DownMsgTask.java
View file @
5936ef35
...
...
@@ -7,6 +7,7 @@ import com.mortals.xhx.base.framework.ws.util.WebSocketUtil;
import
com.mortals.xhx.busiz.req.DeviceMsgReq
;
import
com.mortals.xhx.busiz.req.DeviceReq
;
import
com.mortals.xhx.common.code.DeviceOnlineStatusEnum
;
import
com.mortals.xhx.common.code.LogTypeEnum
;
import
com.mortals.xhx.common.key.Constant
;
import
com.mortals.xhx.common.model.DefaultTbQueueMsgHeaders
;
import
com.mortals.xhx.common.model.MessageHeader
;
...
...
@@ -28,6 +29,8 @@ import java.util.Comparator;
import
java.util.Date
;
import
java.util.List
;
import
static
com
.
mortals
.
xhx
.
common
.
model
.
MessageHeader
.
MESSAGETYPE
;
/**
* 接收消息
*
...
...
@@ -42,6 +45,7 @@ public class DownMsgTask implements Runnable {
private
PlatformService
platformService
;
private
ProductService
productService
;
private
DeviceService
deviceService
;
private
DeviceLogService
deviceLogService
;
@Override
public
void
run
()
{
...
...
@@ -67,6 +71,23 @@ public class DownMsgTask implements Runnable {
header
.
put
(
MessageHeader
.
MESSAGETYPE
,
item
.
getMessageType
());
header
.
put
(
MessageHeader
.
TIMESTAMP
,
item
.
getTimestamp
().
toString
());
deviceService
.
sendDeviceMessage
(
deviceEntity
,
info
,
header
,
JSON
.
toJSONString
(
item
.
getData
()),
null
);
//下行业务消息保存日志
if
(!
Constant
.
MESSAGETYPE_HEARTBEAT
.
equals
(
item
.
getMessageType
()))
{
DeviceLogEntity
deviceLogEntity
=
new
DeviceLogEntity
();
deviceLogEntity
.
initAttrValue
();
deviceLogEntity
.
setDeviceId
(
deviceEntity
.
getId
());
deviceLogEntity
.
setDeviceName
(
deviceEntity
.
getDeviceName
());
deviceLogEntity
.
setDeviceCode
(
deviceEntity
.
getDeviceCode
());
deviceLogEntity
.
setMessageHead
(
item
.
getMessageType
());
deviceLogEntity
.
setContent
(
JSON
.
toJSONString
(
item
.
getData
()));
deviceLogEntity
.
setLogType
(
LogTypeEnum
.
上报事件
.
getValue
());
deviceLogEntity
.
setCreateUserId
(
1L
);
deviceLogEntity
.
setCreateTime
(
new
Date
());
deviceLogService
.
save
(
deviceLogEntity
);
}
}
});
}
catch
(
Exception
e
)
{
...
...
device-manager/src/main/java/com/mortals/xhx/module/device/service/impl/DeviceServiceImpl.java
View file @
5936ef35
...
...
@@ -293,6 +293,8 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D
entity
.
setDeviceCode
(
StrUtil
.
replace
(
entity
.
getDeviceCode
(),
":"
,
"-"
));
if
(
ObjectUtils
.
isEmpty
(
entity
.
getDeviceMac
()))
{
entity
.
setDeviceMac
(
entity
.
getDeviceCode
());
}
else
{
entity
.
setDeviceMac
(
StrUtil
.
replace
(
entity
.
getDeviceMac
(),
":"
,
"-"
));
}
//产品编码唯一
...
...
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