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
ed536606
Commit
ed536606
authored
Oct 17, 2022
by
赵啸非
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更改上传文件大小限制
parent
ac6d2318
Changes
25
Hide whitespace changes
Inline
Side-by-side
Showing
25 changed files
with
702 additions
and
411 deletions
+702
-411
common-lib/src/main/java/com/mortals/xhx/queue/TbQueueCoreSettings.java
.../main/java/com/mortals/xhx/queue/TbQueueCoreSettings.java
+1
-2
common-lib/src/main/java/com/mortals/xhx/queue/rabbitmq/TbRabbitMqSettings.java
...va/com/mortals/xhx/queue/rabbitmq/TbRabbitMqSettings.java
+1
-2
db/base.sql
db/base.sql
+3
-15
db/menu.sql
db/menu.sql
+1
-0
db/module.sql
db/module.sql
+211
-201
db/params.sql
db/params.sql
+25
-2
device-manager/pom.xml
device-manager/pom.xml
+54
-12
device-manager/src/main/java/com/mortals/xhx/base/framework/aspect/OperlogAspect.java
.../com/mortals/xhx/base/framework/aspect/OperlogAspect.java
+4
-31
device-manager/src/main/java/com/mortals/xhx/base/framework/config/RabbitConfig.java
...a/com/mortals/xhx/base/framework/config/RabbitConfig.java
+6
-7
device-manager/src/main/java/com/mortals/xhx/base/framework/config/RedissonConfig.java
...com/mortals/xhx/base/framework/config/RedissonConfig.java
+4
-5
device-manager/src/main/java/com/mortals/xhx/base/framework/listener/DirectDynamicListener.java
...ls/xhx/base/framework/listener/DirectDynamicListener.java
+1
-4
device-manager/src/main/java/com/mortals/xhx/base/system/message/MessageCallbackService.java
...rtals/xhx/base/system/message/MessageCallbackService.java
+8
-0
device-manager/src/main/java/com/mortals/xhx/base/system/message/MessageService.java
...a/com/mortals/xhx/base/system/message/MessageService.java
+0
-1
device-manager/src/main/java/com/mortals/xhx/base/system/message/RabbitMessageService.java
...mortals/xhx/base/system/message/RabbitMessageService.java
+1
-9
device-manager/src/main/java/com/mortals/xhx/base/system/message/impl/MessageCallbackServiceImpl.java
.../base/system/message/impl/MessageCallbackServiceImpl.java
+26
-0
device-manager/src/main/java/com/mortals/xhx/base/system/message/impl/MessageProducer.java
...mortals/xhx/base/system/message/impl/MessageProducer.java
+4
-13
device-manager/src/main/java/com/mortals/xhx/base/system/message/impl/MessageServiceImpl.java
...tals/xhx/base/system/message/impl/MessageServiceImpl.java
+0
-6
device-manager/src/main/java/com/mortals/xhx/busiz/req/TestReq.java
...ager/src/main/java/com/mortals/xhx/busiz/req/TestReq.java
+148
-0
device-manager/src/main/java/com/mortals/xhx/busiz/web/DeviceApiController.java
...n/java/com/mortals/xhx/busiz/web/DeviceApiController.java
+6
-18
device-manager/src/main/java/com/mortals/xhx/busiz/web/TestSendMsgController.java
...java/com/mortals/xhx/busiz/web/TestSendMsgController.java
+104
-0
device-manager/src/main/java/com/mortals/xhx/daemon/applicationservice/NettyStartedService.java
...ls/xhx/daemon/applicationservice/NettyStartedService.java
+1
-4
device-manager/src/main/java/com/mortals/xhx/daemon/netty/server/controlserver/ControlServer.java
.../xhx/daemon/netty/server/controlserver/ControlServer.java
+1
-3
device-manager/src/main/java/com/mortals/xhx/module/device/service/impl/DeviceServiceImpl.java
...als/xhx/module/device/service/impl/DeviceServiceImpl.java
+0
-30
device-manager/src/main/resources/bootstrap.yml
device-manager/src/main/resources/bootstrap.yml
+1
-46
device-manager/src/test/java/producer/ProducerTest.java
device-manager/src/test/java/producer/ProducerTest.java
+91
-0
No files found.
common-lib/src/main/java/com/mortals/xhx/queue/TbQueueCoreSettings.java
View file @
ed536606
...
...
@@ -2,10 +2,9 @@ package com.mortals.xhx.queue;
import
lombok.Data
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Component
;
@Data
@Component
//
@Component
public
class
TbQueueCoreSettings
{
@Value
(
"${queue.core.topic}"
)
...
...
common-lib/src/main/java/com/mortals/xhx/queue/rabbitmq/TbRabbitMqSettings.java
View file @
ed536606
...
...
@@ -7,7 +7,6 @@ import lombok.Getter;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnExpression
;
import
org.springframework.stereotype.Component
;
import
javax.annotation.PostConstruct
;
...
...
@@ -20,7 +19,7 @@ public class TbRabbitMqSettings {
private
String
exchangeName
;
@Value
(
"${queue.rabbitmq.host:}"
)
private
String
host
;
@Value
(
"${queue.rabbitmq.port:}"
)
@Value
(
"${queue.rabbitmq.port:
0
}"
)
private
int
port
;
@Value
(
"${queue.rabbitmq.virtual_host:}"
)
private
String
virtualHost
;
...
...
db/base.sql
View file @
ed536606
/*
Navicat MySQL Data Transfer
Source Server : localhost
Source Server Type : MySQL
Source Server Version : 80018
Source Host : localhost:3306
Source Schema : base-platform
Target Server Type : MySQL
Target Server Version : 80018
File Encoding : 65001
Date: 05/11/2021 09:39:57
*/
DROP
database
if
exists
`device-platform`
;
CREATE
database
`device-platform`
default
charset
=
utf8
;
use
`device-platform`
;
SET
NAMES
utf8mb4
;
SET
FOREIGN_KEY_CHECKS
=
0
;
...
...
db/menu.sql
View file @
ed536606
use
`device-platform`
;
-- ----------------------------
-- 设备生产厂商菜单 SQL
-- ----------------------------
...
...
db/module.sql
View file @
ed536606
use
`device-platform`
;
-- ----------------------------
-- 设备表
-- ----------------------------
DROP
TABLE
IF
EXISTS
`mortals_xhx_device`
;
CREATE
TABLE
mortals_xhx_device
(
`id`
bigint
(
20
)
AUTO_INCREMENT
COMMENT
'主键ID,主键,自增长'
,
`deviceName`
varchar
(
20
)
NOT
NULL
COMMENT
'设备名称'
,
`deviceCode`
varchar
(
256
)
COMMENT
'设备编码,SN码等,默认为MAC地址'
,
`deviceSN`
varchar
(
256
)
COMMENT
'设备SN码'
,
`deviceMac`
varchar
(
64
)
COMMENT
'设备的MAC地址'
,
`siteId`
bigint
(
20
)
COMMENT
'站点Id,来源基础服务平台'
,
`siteCode`
varchar
(
256
)
COMMENT
'站点编号,来源基础服务平台'
,
`siteName`
varchar
(
256
)
COMMENT
'站点名称'
,
`platformId`
bigint
(
20
)
COMMENT
'平台系统Id'
,
`platformName`
varchar
(
256
)
COMMENT
'平台系统名称'
,
`productId`
bigint
(
20
)
COMMENT
'产品Id'
,
`productName`
varchar
(
256
)
COMMENT
'产品名称'
,
`skinId`
bigint
(
20
)
NOT
NULL
COMMENT
'皮肤id'
,
`skinName`
varchar
(
20
)
NOT
NULL
COMMENT
'皮肤名称'
,
`homeUrl`
varchar
(
512
)
COMMENT
'首页地址'
,
`deviceFirmId`
bigint
(
20
)
COMMENT
'设备生产厂商ID'
,
`deviceFirmname`
varchar
(
20
)
COMMENT
'设备生产厂商名称'
,
`deviceSrc`
tinyint
(
2
)
COMMENT
'设备来源(0.子设备,1.网关设备,2.直连设备)'
,
`deviceDataSourceWay`
tinyint
(
2
)
COMMENT
'数据获取方式(0.主动上报,1.被动拉取)'
,
`lon`
varchar
(
32
)
COMMENT
'经度'
,
`lati`
varchar
(
32
)
COMMENT
'经度'
,
`deviceInBuilding`
tinyint
(
2
)
COMMENT
'所属楼栋'
,
`deviceInFloor`
tinyint
(
2
)
COMMENT
'所属楼层'
,
`defectsLiabilityPeriod`
datetime
COMMENT
'保修期至'
,
`leadingOfficial`
varchar
(
64
)
COMMENT
'负责人'
,
`leadingOfficialTelephone`
varchar
(
64
)
COMMENT
'联系电话'
,
`isReceiveMess`
tinyint
(
2
)
COMMENT
'是否接收异常短(0.否,1.是)'
,
`devicePhotoPath`
varchar
(
256
)
COMMENT
'设备图片'
,
`ip`
varchar
(
64
)
COMMENT
'设备访问ip'
,
`centernum`
varchar
(
64
)
COMMENT
'中心设备编码'
,
`port`
varchar
(
64
)
COMMENT
'端口'
,
`deviceTopic`
varchar
(
100
)
COMMENT
'设备topic信息'
,
`deviceStatus`
tinyint
(
2
)
COMMENT
'设备状态 (0.未激活,1.离线,2.在线)'
,
`enabled`
tinyint
(
2
)
COMMENT
'启用状态 (0.停止,1.启用)'
,
`deviceAuthCode`
varchar
(
512
)
COMMENT
'设备授权码'
,
`deviceRemark`
varchar
(
256
)
COMMENT
'备注'
,
`onlineTime`
datetime
COMMENT
'最近上线时间'
,
`offlineTime`
datetime
COMMENT
'最近离线时间'
,
`deleted`
tinyint
(
2
)
COMMENT
'是否删除(0.否,1.是)'
,
`deviceVersion`
varchar
(
64
)
COMMENT
'设备版本'
,
`source`
tinyint
(
2
)
COMMENT
'设备来源(0.旧设备,1.新设备)'
,
`createUserId`
bigint
(
20
)
NOT
NULL
COMMENT
'创建用户'
,
`createTime`
datetime
NOT
NULL
COMMENT
'创建时间'
,
`updateUserId`
bigint
(
20
)
COMMENT
'更新用户'
,
`updateTime`
datetime
COMMENT
'更新时间'
,
PRIMARY
KEY
(
`id`
)
CREATE
TABLE
`mortals_xhx_device`
(
`id`
bigint
(
20
)
NOT
NULL
AUTO_INCREMENT
COMMENT
'主键ID,主键,自增长'
,
`deviceName`
varchar
(
20
)
NOT
NULL
COMMENT
'设备名称'
,
`deviceCode`
varchar
(
256
)
DEFAULT
NULL
COMMENT
'设备编码'
,
`deviceSN`
varchar
(
512
)
DEFAULT
NULL
COMMENT
'设备SN码'
,
`deviceMac`
varchar
(
64
)
DEFAULT
NULL
COMMENT
'设备的MAC地址'
,
`siteId`
bigint
(
20
)
DEFAULT
NULL
COMMENT
'站点Id,来源基础服务平台'
,
`siteCode`
varchar
(
256
)
DEFAULT
NULL
COMMENT
'站点编号,来源基础服务平台'
,
`siteName`
varchar
(
256
)
DEFAULT
NULL
COMMENT
'站点名称'
,
`platformId`
bigint
(
20
)
DEFAULT
NULL
COMMENT
'平台系统Id'
,
`platformName`
varchar
(
256
)
DEFAULT
NULL
COMMENT
'平台系统名称'
,
`productId`
bigint
(
20
)
DEFAULT
NULL
COMMENT
'产品Id'
,
`productName`
varchar
(
256
)
DEFAULT
NULL
COMMENT
'产品名称'
,
`skinId`
bigint
(
20
)
DEFAULT
NULL
COMMENT
'皮肤id'
,
`skinName`
varchar
(
512
)
DEFAULT
NULL
COMMENT
'皮肤名称'
,
`homeUrl`
varchar
(
512
)
DEFAULT
NULL
COMMENT
'首页地址'
,
`deviceFirmId`
bigint
(
20
)
DEFAULT
NULL
COMMENT
'设备生产厂商ID'
,
`deviceFirmname`
varchar
(
20
)
DEFAULT
NULL
COMMENT
'设备生产厂商名称'
,
`deviceSrc`
tinyint
(
2
)
DEFAULT
NULL
COMMENT
'设备来源(0.子设备,1.网关设备,2.直连设备)'
,
`deviceDataSourceWay`
tinyint
(
2
)
DEFAULT
NULL
COMMENT
'数据获取方式(0.主动上报,1被动拉取)'
,
`lon`
varchar
(
32
)
DEFAULT
NULL
COMMENT
'经度'
,
`lati`
varchar
(
32
)
DEFAULT
NULL
COMMENT
'经度'
,
`deviceInBuilding`
tinyint
(
2
)
DEFAULT
NULL
COMMENT
'所属楼栋'
,
`deviceInFloor`
tinyint
(
2
)
DEFAULT
NULL
COMMENT
'所属楼层'
,
`defectsLiabilityPeriod`
datetime
DEFAULT
NULL
COMMENT
'保修期至'
,
`leadingOfficial`
varchar
(
10
)
DEFAULT
NULL
COMMENT
'负责人'
,
`leadingOfficialTelephone`
varchar
(
11
)
DEFAULT
NULL
COMMENT
'联系电话'
,
`isReceiveMess`
tinyint
(
2
)
DEFAULT
NULL
COMMENT
'是否接收异常短(0.否,1.是)'
,
`ip`
varchar
(
64
)
DEFAULT
NULL
COMMENT
'设备访问ip'
,
`centernum`
varchar
(
64
)
DEFAULT
NULL
COMMENT
'中心设备编码'
,
`port`
varchar
(
64
)
DEFAULT
NULL
COMMENT
'端口'
,
`deviceTopic`
varchar
(
100
)
DEFAULT
NULL
COMMENT
'设备topic信息'
,
`deviceStatus`
tinyint
(
2
)
DEFAULT
NULL
COMMENT
'设备状态 (0.未激活,1.离线,2.在线)'
,
`enabled`
tinyint
(
2
)
DEFAULT
NULL
COMMENT
'启用状态 (0.停止,1.启用)'
,
`deviceAuthCode`
varchar
(
255
)
DEFAULT
NULL
,
`deviceRemark`
varchar
(
256
)
DEFAULT
NULL
COMMENT
'备注'
,
`onlineTime`
datetime
DEFAULT
NULL
COMMENT
'最近上线时间'
,
`offlineTime`
datetime
DEFAULT
NULL
COMMENT
'最近离线时间'
,
`devicePhotoPath`
varchar
(
255
)
DEFAULT
NULL
,
`deleted`
tinyint
(
2
)
DEFAULT
NULL
COMMENT
'是否删除,(0.否,1.是)'
,
`deviceVersion`
varchar
(
64
)
DEFAULT
NULL
COMMENT
'设备版本'
,
`source`
tinyint
(
2
)
DEFAULT
NULL
,
`createUserId`
bigint
(
20
)
NOT
NULL
COMMENT
'创建用户'
,
`createTime`
datetime
NOT
NULL
COMMENT
'创建时间'
,
`updateUserId`
bigint
(
20
)
DEFAULT
NULL
COMMENT
'更新用户'
,
`updateTime`
datetime
DEFAULT
NULL
COMMENT
'更新时间'
,
PRIMARY
KEY
(
`id`
)
USING
BTREE
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8
COMMENT
=
'设备'
;
-- ----------------------------
-- 平台系统表
-- ----------------------------
DROP
TABLE
IF
EXISTS
`mortals_xhx_platform`
;
CREATE
TABLE
mortals_xhx_platform
(
`id`
bigint
(
20
)
AUTO_INCREMENT
COMMENT
'主键ID,主键,自增长'
,
`platformName`
varchar
(
20
)
NOT
NULL
COMMENT
'平台名称,名称唯一'
,
`platformSn`
varchar
(
256
)
NOT
NULL
COMMENT
'平台编码,编码唯一(编码加上站点编码,如phxt-51010251-1做Vhost虚拟机编码)'
,
`sendMsgType`
tinyint
(
2
)
NOT
NULL
COMMENT
'发送第三方平台消息类型(0.http,1.jms)'
,
`sendUrl`
varchar
(
512
)
COMMENT
'发送参数请求地址'
,
`callbackUrl`
varchar
(
512
)
COMMENT
'回调参数地址'
,
`sendSwitch`
tinyint
(
2
)
NOT
NULL
COMMENT
'是否启用发送消息(0.停用,1.启用)'
,
`homeUrl`
varchar
(
512
)
COMMENT
'首页地址'
,
`platformRemark`
varchar
(
256
)
COMMENT
'备注'
,
`createUserId`
bigint
(
20
)
NOT
NULL
COMMENT
'创建用户'
,
`createTime`
datetime
NOT
NULL
COMMENT
'创建时间'
,
`updateUserId`
bigint
(
20
)
COMMENT
'更新用户'
,
`updateTime`
datetime
COMMENT
'更新时间'
,
PRIMARY
KEY
(
`id`
)
CREATE
TABLE
mortals_xhx_platform
(
`id`
bigint
(
20
)
AUTO_INCREMENT
COMMENT
'主键ID,主键,自增长'
,
`platformName`
varchar
(
20
)
NOT
NULL
COMMENT
'平台名称,名称唯一'
,
`platformSn`
varchar
(
256
)
NOT
NULL
COMMENT
'平台编码,编码唯一(编码加上站点编码,如phxt-51010251-1做Vhost虚拟机编码)'
,
`sendMsgType`
tinyint
(
2
)
NOT
NULL
COMMENT
'发送第三方平台消息类型(0.http,1.jms)'
,
`sendUrl`
varchar
(
512
)
COMMENT
'发送参数请求地址'
,
`callbackUrl`
varchar
(
512
)
COMMENT
'回调参数地址'
,
`sendSwitch`
tinyint
(
2
)
NOT
NULL
COMMENT
'是否启用发送消息(0.停用,1.启用)'
,
`homeUrl`
varchar
(
512
)
COMMENT
'首页地址'
,
`platformRemark`
varchar
(
256
)
COMMENT
'备注'
,
`createUserId`
bigint
(
20
)
NOT
NULL
COMMENT
'创建用户'
,
`createTime`
datetime
NOT
NULL
COMMENT
'创建时间'
,
`updateUserId`
bigint
(
20
)
COMMENT
'更新用户'
,
`updateTime`
datetime
COMMENT
'更新时间'
,
PRIMARY
KEY
(
`id`
)
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8
COMMENT
=
'平台系统'
;
-- ----------------------------
-- 产品表
-- ----------------------------
DROP
TABLE
IF
EXISTS
`mortals_xhx_product`
;
CREATE
TABLE
mortals_xhx_product
(
`id`
bigint
(
20
)
AUTO_INCREMENT
COMMENT
'主键ID,主键,自增长'
,
`platformId`
bigint
(
20
)
NOT
NULL
AUTO_INCREMENT
COMMENT
'关联平台'
,
`productName`
varchar
(
20
)
NOT
NULL
COMMENT
'产品名称,名称唯一'
,
`productCode`
varchar
(
256
)
NOT
NULL
COMMENT
'产品编码'
,
`homeUrl`
varchar
(
512
)
NOT
NULL
COMMENT
'首页地址'
,
`productRemark`
varchar
(
256
)
COMMENT
'备注'
,
`createUserId`
bigint
(
20
)
NOT
NULL
COMMENT
'创建用户'
,
`createTime`
datetime
NOT
NULL
COMMENT
'创建时间'
,
`updateUserId`
bigint
(
20
)
COMMENT
'更新用户'
,
`updateTime`
datetime
COMMENT
'更新时间'
,
PRIMARY
KEY
(
`id`
)
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8
COMMENT
=
'产品'
;
CREATE
TABLE
`mortals_xhx_product`
(
`id`
bigint
(
20
)
NOT
NULL
AUTO_INCREMENT
COMMENT
'主键ID,主键,自增长'
,
`platformId`
bigint
(
20
)
DEFAULT
NULL
,
`productName`
varchar
(
20
)
NOT
NULL
COMMENT
'产品名称,名称唯一'
,
`productCode`
varchar
(
256
)
NOT
NULL
COMMENT
'产品编码,编码唯一'
,
`skinId`
bigint
(
20
)
DEFAULT
NULL
COMMENT
'皮肤id'
,
`skinName`
varchar
(
512
)
DEFAULT
NULL
COMMENT
'皮肤名称'
,
`homeUrl`
varchar
(
255
)
DEFAULT
NULL
COMMENT
'首页'
,
`productRemark`
varchar
(
256
)
DEFAULT
NULL
COMMENT
'备注'
,
`createUserId`
bigint
(
20
)
NOT
NULL
COMMENT
'创建用户'
,
`createTime`
datetime
NOT
NULL
COMMENT
'创建时间'
,
`updateUserId`
bigint
(
20
)
DEFAULT
NULL
COMMENT
'更新用户'
,
`updateTime`
datetime
DEFAULT
NULL
COMMENT
'更新时间'
,
PRIMARY
KEY
(
`id`
)
USING
BTREE
)
ENGINE
=
InnoDB
AUTO_INCREMENT
=
16
DEFAULT
CHARSET
=
utf8
COMMENT
=
'产品'
;
...
...
@@ -102,37 +106,39 @@ PRIMARY KEY (`id`)
-- 设备生产厂商表
-- ----------------------------
DROP
TABLE
IF
EXISTS
`mortals_xhx_firm`
;
CREATE
TABLE
mortals_xhx_firm
(
`id`
bigint
(
20
)
AUTO_INCREMENT
COMMENT
'主键ID,主键,自增长'
,
`firmName`
varchar
(
128
)
NOT
NULL
COMMENT
'设备生产厂商名称'
,
`firmCode`
varchar
(
128
)
COMMENT
'设备生产商编码'
,
`firmRemark`
varchar
(
64
)
COMMENT
'备注'
,
`createUserId`
bigint
(
20
)
NOT
NULL
COMMENT
'创建用户'
,
`createTime`
datetime
NOT
NULL
COMMENT
'创建时间'
,
`updateUserId`
bigint
(
20
)
COMMENT
'更新用户'
,
`updateTime`
datetime
COMMENT
'更新时间'
,
PRIMARY
KEY
(
`id`
)
CREATE
TABLE
mortals_xhx_firm
(
`id`
bigint
(
20
)
AUTO_INCREMENT
COMMENT
'主键ID,主键,自增长'
,
`firmName`
varchar
(
128
)
NOT
NULL
COMMENT
'设备生产厂商名称'
,
`firmCode`
varchar
(
128
)
COMMENT
'设备生产商编码'
,
`firmRemark`
varchar
(
64
)
COMMENT
'备注'
,
`createUserId`
bigint
(
20
)
NOT
NULL
COMMENT
'创建用户'
,
`createTime`
datetime
NOT
NULL
COMMENT
'创建时间'
,
`updateUserId`
bigint
(
20
)
COMMENT
'更新用户'
,
`updateTime`
datetime
COMMENT
'更新时间'
,
PRIMARY
KEY
(
`id`
)
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8
COMMENT
=
'设备生产厂商'
;
-- ----------------------------
-- 设备告警日志表
-- ----------------------------
DROP
TABLE
IF
EXISTS
`mortals_xhx_device_alarm_info`
;
CREATE
TABLE
mortals_xhx_device_alarm_info
(
`id`
bigint
(
20
)
AUTO_INCREMENT
COMMENT
'主键ID,主键,自增长'
,
`alarmTime`
datetime
NOT
NULL
COMMENT
'告警时间'
,
`alarmDevice`
bigint
(
20
)
NOT
NULL
COMMENT
'告警设备Id'
,
`siteId`
bigint
(
20
)
COMMENT
'站点Id,来源基础服务平台'
,
`alarmType`
tinyint
(
2
)
NOT
NULL
COMMENT
'告警类型,(0.离线)'
,
`alarmLevel`
tinyint
(
2
)
NOT
NULL
COMMENT
'告警级别(0.危险,1.次要,2.一般)'
,
`alarmReceivePersonnel`
varchar
(
32
)
NOT
NULL
COMMENT
'接收人员[设备管理的责任人]'
,
`receivePersonnelTelephone`
varchar
(
11
)
NOT
NULL
COMMENT
'接收人员电话'
,
`alarmStatus`
tinyint
(
2
)
COMMENT
'告警状态,来自工单系统(0.未清除,1.清除未确认,2.清除已确认)'
,
`alarmContent`
varchar
(
512
)
NOT
NULL
COMMENT
'告警详细内容'
,
`createTime`
datetime
NOT
NULL
COMMENT
'创建时间'
,
`updateUserId`
bigint
(
20
)
COMMENT
'更新用户'
,
`updateTime`
datetime
COMMENT
'更新时间'
,
PRIMARY
KEY
(
`id`
)
CREATE
TABLE
mortals_xhx_device_alarm_info
(
`id`
bigint
(
20
)
AUTO_INCREMENT
COMMENT
'主键ID,主键,自增长'
,
`alarmTime`
datetime
NOT
NULL
COMMENT
'告警时间'
,
`alarmDevice`
bigint
(
20
)
NOT
NULL
COMMENT
'告警设备Id'
,
`siteId`
bigint
(
20
)
COMMENT
'站点Id,来源基础服务平台'
,
`alarmType`
tinyint
(
2
)
NOT
NULL
COMMENT
'告警类型,(0.离线)'
,
`alarmLevel`
tinyint
(
2
)
NOT
NULL
COMMENT
'告警级别(0.危险,1.次要,2.一般)'
,
`alarmReceivePersonnel`
varchar
(
32
)
NOT
NULL
COMMENT
'接收人员[设备管理的责任人]'
,
`receivePersonnelTelephone`
varchar
(
11
)
NOT
NULL
COMMENT
'接收人员电话'
,
`alarmStatus`
tinyint
(
2
)
COMMENT
'告警状态,来自工单系统(0.未清除,1.清除未确认,2.清除已确认)'
,
`alarmContent`
varchar
(
512
)
NOT
NULL
COMMENT
'告警详细内容'
,
`createTime`
datetime
NOT
NULL
COMMENT
'创建时间'
,
`updateUserId`
bigint
(
20
)
COMMENT
'更新用户'
,
`updateTime`
datetime
COMMENT
'更新时间'
,
PRIMARY
KEY
(
`id`
)
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8
COMMENT
=
'设备告警日志'
;
...
...
@@ -141,30 +147,32 @@ PRIMARY KEY (`id`)
-- 设备模块信息表
-- ----------------------------
DROP
TABLE
IF
EXISTS
`mortals_xhx_device_module`
;
CREATE
TABLE
mortals_xhx_device_module
(
`id`
bigint
(
20
)
AUTO_INCREMENT
COMMENT
'主键ID,主键,自增长'
,
`moduleName`
varchar
(
256
)
NOT
NULL
COMMENT
'模块名称'
,
`moduleMsgCode`
varchar
(
256
)
NOT
NULL
COMMENT
'模块消息编码,与上报消息头编码一致,唯一'
,
`createTime`
datetime
COMMENT
'创建时间'
,
`updateUserId`
bigint
(
20
)
COMMENT
'更新用户'
,
`updateTime`
datetime
COMMENT
'更新时间'
,
PRIMARY
KEY
(
`id`
)
CREATE
TABLE
mortals_xhx_device_module
(
`id`
bigint
(
20
)
AUTO_INCREMENT
COMMENT
'主键ID,主键,自增长'
,
`moduleName`
varchar
(
256
)
NOT
NULL
COMMENT
'模块名称'
,
`moduleMsgCode`
varchar
(
256
)
NOT
NULL
COMMENT
'模块消息编码,与上报消息头编码一致,唯一'
,
`createTime`
datetime
COMMENT
'创建时间'
,
`updateUserId`
bigint
(
20
)
COMMENT
'更新用户'
,
`updateTime`
datetime
COMMENT
'更新时间'
,
PRIMARY
KEY
(
`id`
)
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8
COMMENT
=
'设备模块信息'
;
-- ----------------------------
-- 设备模块使用频率表
-- ----------------------------
DROP
TABLE
IF
EXISTS
`mortals_xhx_device_module_use`
;
CREATE
TABLE
mortals_xhx_device_module_use
(
`id`
bigint
(
20
)
AUTO_INCREMENT
COMMENT
'主键ID,主键,自增长'
,
`moduleName`
varchar
(
256
)
NOT
NULL
COMMENT
'模块名称'
,
`moduleMsgCode`
varchar
(
256
)
NOT
NULL
COMMENT
'模块消息编码'
,
`deviceId`
bigint
(
20
)
NOT
NULL
COMMENT
'所属设备'
,
`useNum`
int
COMMENT
'调用次数'
,
`createTime`
datetime
COMMENT
'创建时间'
,
`updateUserId`
bigint
(
20
)
COMMENT
'更新用户'
,
`updateTime`
datetime
COMMENT
'更新时间'
,
PRIMARY
KEY
(
`id`
)
CREATE
TABLE
mortals_xhx_device_module_use
(
`id`
bigint
(
20
)
AUTO_INCREMENT
COMMENT
'主键ID,主键,自增长'
,
`moduleName`
varchar
(
256
)
NOT
NULL
COMMENT
'模块名称'
,
`moduleMsgCode`
varchar
(
256
)
NOT
NULL
COMMENT
'模块消息编码'
,
`deviceId`
bigint
(
20
)
NOT
NULL
COMMENT
'所属设备'
,
`useNum`
int
COMMENT
'调用次数'
,
`createTime`
datetime
COMMENT
'创建时间'
,
`updateUserId`
bigint
(
20
)
COMMENT
'更新用户'
,
`updateTime`
datetime
COMMENT
'更新时间'
,
PRIMARY
KEY
(
`id`
)
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8
COMMENT
=
'设备模块使用频率'
;
...
...
@@ -172,40 +180,40 @@ PRIMARY KEY (`id`)
-- 设备告警配置表
-- ----------------------------
DROP
TABLE
IF
EXISTS
`mortals_xhx_alarm_config`
;
CREATE
TABLE
mortals_xhx_alarm_config
(
`id`
bigint
(
20
)
AUTO_INCREMENT
COMMENT
'主键ID,主键,自增长'
,
`productId`
bigint
(
20
)
NOT
NULL
COMMENT
'产品'
,
`alarmType`
tinyint
(
2
)
NOT
NULL
COMMENT
'告警类型(0.离线)'
,
`alarmLevel`
tinyint
(
2
)
NOT
NULL
COMMENT
'告警级别,(0.危险,1.次要,2.一般)'
,
`alarmPusW1ay`
tinyint
(
2
)
NOT
NULL
COMMENT
'推送方式,(0.不推送,1.短信)'
,
`enabled`
tinyint
(
2
)
NOT
NULL
COMMENT
'是否启用(0.不启用,1.启用)'
,
`remark`
varchar
(
2048
)
COMMENT
'备注'
,
`createTime`
datetime
NOT
NULL
COMMENT
'创建时间'
,
`updateUserId`
bigint
(
20
)
COMMENT
'更新用户'
,
`updateTime`
datetime
COMMENT
'更新时间'
,
PRIMARY
KEY
(
`id`
)
CREATE
TABLE
mortals_xhx_alarm_config
(
`id`
bigint
(
20
)
AUTO_INCREMENT
COMMENT
'主键ID,主键,自增长'
,
`productId`
bigint
(
20
)
NOT
NULL
COMMENT
'产品'
,
`alarmType`
tinyint
(
2
)
NOT
NULL
COMMENT
'告警类型(0.离线)'
,
`alarmLevel`
tinyint
(
2
)
NOT
NULL
COMMENT
'告警级别,(0.危险,1.次要,2.一般)'
,
`alarmPusW1ay`
tinyint
(
2
)
NOT
NULL
COMMENT
'推送方式,(0.不推送,1.短信)'
,
`enabled`
tinyint
(
2
)
NOT
NULL
COMMENT
'是否启用(0.不启用,1.启用)'
,
`remark`
varchar
(
2048
)
COMMENT
'备注'
,
`createTime`
datetime
NOT
NULL
COMMENT
'创建时间'
,
`updateUserId`
bigint
(
20
)
COMMENT
'更新用户'
,
`updateTime`
datetime
COMMENT
'更新时间'
,
PRIMARY
KEY
(
`id`
)
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8
COMMENT
=
'设备告警配置'
;
-- ----------------------------
-- 短信发送记录表
-- ----------------------------
DROP
TABLE
IF
EXISTS
`mortals_xhx_alarm_sms_send`
;
CREATE
TABLE
mortals_xhx_alarm_sms_send
(
`id`
bigint
(
20
)
AUTO_INCREMENT
COMMENT
'主键ID,主键,自增长'
,
`mobile`
varchar
(
11
)
NOT
NULL
COMMENT
'联系电话'
,
`receiver`
varchar
(
200
)
NOT
NULL
COMMENT
'接收人员'
,
`sendMess`
varchar
(
200
)
NOT
NULL
COMMENT
'发送内容'
,
`sendStatus`
tinyint
(
2
)
NOT
NULL
COMMENT
'发送状态(0.未发送,1.提交,2.发送成功,3.发生失败)'
,
`sendTime`
datetime
NOT
NULL
COMMENT
'发送时间'
,
`siteId`
bigint
(
20
)
COMMENT
'站点Id,来源基础服务平台'
,
`createTime`
datetime
NOT
NULL
COMMENT
'创建时间'
,
`updateUserId`
bigint
(
20
)
COMMENT
'更新用户'
,
`updateTime`
datetime
COMMENT
'更新时间'
,
PRIMARY
KEY
(
`id`
)
CREATE
TABLE
mortals_xhx_alarm_sms_send
(
`id`
bigint
(
20
)
AUTO_INCREMENT
COMMENT
'主键ID,主键,自增长'
,
`mobile`
varchar
(
11
)
NOT
NULL
COMMENT
'联系电话'
,
`receiver`
varchar
(
200
)
NOT
NULL
COMMENT
'接收人员'
,
`sendMess`
varchar
(
200
)
NOT
NULL
COMMENT
'发送内容'
,
`sendStatus`
tinyint
(
2
)
NOT
NULL
COMMENT
'发送状态(0.未发送,1.提交,2.发送成功,3.发生失败)'
,
`sendTime`
datetime
NOT
NULL
COMMENT
'发送时间'
,
`siteId`
bigint
(
20
)
COMMENT
'站点Id,来源基础服务平台'
,
`createTime`
datetime
NOT
NULL
COMMENT
'创建时间'
,
`updateUserId`
bigint
(
20
)
COMMENT
'更新用户'
,
`updateTime`
datetime
COMMENT
'更新时间'
,
PRIMARY
KEY
(
`id`
)
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8
COMMENT
=
'短信发送记录'
;
...
...
@@ -213,60 +221,62 @@ PRIMARY KEY (`id`)
-- 设备日志表
-- ----------------------------
DROP
TABLE
IF
EXISTS
`mortals_xhx_device_log`
;
CREATE
TABLE
mortals_xhx_device_log
(
`id`
bigint
(
20
)
AUTO_INCREMENT
COMMENT
'主键ID,主键,自增长'
,
`traceID`
varchar
(
64
)
COMMENT
'traceId,日志追踪id'
,
`siteId`
bigint
(
20
)
COMMENT
'站点Id,来源基础服务平台'
,
`deviceId`
bigint
(
20
)
COMMENT
'设备ID'
,
`deviceCode`
varchar
(
32
)
NOT
NULL
COMMENT
'设备编号'
,
`deviceName`
varchar
(
32
)
NOT
NULL
COMMENT
'设备名称,设置设备名称。'
,
`messageHead`
varchar
(
64
)
NOT
NULL
COMMENT
'业务消息头标识'
,
`logType`
tinyint
(
2
)
NOT
NULL
COMMENT
'消息类型,(0.上行,1.下行)'
,
`content`
varchar
(
2048
)
COMMENT
'内容'
,
`createUserId`
bigint
(
20
)
NOT
NULL
COMMENT
'创建用户'
,
`createTime`
datetime
NOT
NULL
COMMENT
'创建时间'
,
`updateUserId`
bigint
(
20
)
COMMENT
'更新用户'
,
`updateTime`
datetime
COMMENT
'更新时间'
,
PRIMARY
KEY
(
`id`
)
CREATE
TABLE
mortals_xhx_device_log
(
`id`
bigint
(
20
)
AUTO_INCREMENT
COMMENT
'主键ID,主键,自增长'
,
`traceID`
varchar
(
64
)
COMMENT
'traceId,日志追踪id'
,
`siteId`
bigint
(
20
)
COMMENT
'站点Id,来源基础服务平台'
,
`deviceId`
bigint
(
20
)
COMMENT
'设备ID'
,
`deviceCode`
varchar
(
32
)
NOT
NULL
COMMENT
'设备编号'
,
`deviceName`
varchar
(
32
)
NOT
NULL
COMMENT
'设备名称,设置设备名称。'
,
`messageHead`
varchar
(
64
)
NOT
NULL
COMMENT
'业务消息头标识'
,
`logType`
tinyint
(
2
)
NOT
NULL
COMMENT
'消息类型,(0.上行,1.下行)'
,
`content`
varchar
(
2048
)
COMMENT
'内容'
,
`createUserId`
bigint
(
20
)
NOT
NULL
COMMENT
'创建用户'
,
`createTime`
datetime
NOT
NULL
COMMENT
'创建时间'
,
`updateUserId`
bigint
(
20
)
COMMENT
'更新用户'
,
`updateTime`
datetime
COMMENT
'更新时间'
,
PRIMARY
KEY
(
`id`
)
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8
COMMENT
=
'设备日志'
;
-- ----------------------------
-- 站点统计表
-- ----------------------------
DROP
TABLE
IF
EXISTS
`mortals_xhx_sitestat`
;
CREATE
TABLE
mortals_xhx_sitestat
(
`id`
bigint
(
20
)
AUTO_INCREMENT
COMMENT
'主键ID,主键,自增长'
,
`siteId`
bigint
(
20
)
COMMENT
'站点Id,来源基础服务平台'
,
`siteCode`
varchar
(
256
)
COMMENT
'站点编号,来源基础服务平台'
,
`siteName`
varchar
(
256
)
COMMENT
'站点名称'
,
`deviceTotal`
int
(
9
)
COMMENT
'设备总数'
,
`onlineCount`
int
(
9
)
COMMENT
'在线数量'
,
`offlineCount`
int
(
9
)
COMMENT
'离线数量'
,
`stopCount`
int
(
9
)
COMMENT
'停用数量'
,
`unActiveCount`
int
(
9
)
NOT
NULL
COMMENT
'待激活数量'
,
`createTime`
datetime
NOT
NULL
COMMENT
'创建时间'
,
`updateUserId`
bigint
(
20
)
COMMENT
'更新用户'
,
`updateTime`
datetime
COMMENT
'更新时间'
,
PRIMARY
KEY
(
`id`
)
CREATE
TABLE
mortals_xhx_sitestat
(
`id`
bigint
(
20
)
AUTO_INCREMENT
COMMENT
'主键ID,主键,自增长'
,
`siteId`
bigint
(
20
)
COMMENT
'站点Id,来源基础服务平台'
,
`siteCode`
varchar
(
256
)
COMMENT
'站点编号,来源基础服务平台'
,
`siteName`
varchar
(
256
)
COMMENT
'站点名称'
,
`deviceTotal`
int
(
9
)
COMMENT
'设备总数'
,
`onlineCount`
int
(
9
)
COMMENT
'在线数量'
,
`offlineCount`
int
(
9
)
COMMENT
'离线数量'
,
`stopCount`
int
(
9
)
COMMENT
'停用数量'
,
`unActiveCount`
int
(
9
)
NOT
NULL
COMMENT
'待激活数量'
,
`createTime`
datetime
NOT
NULL
COMMENT
'创建时间'
,
`updateUserId`
bigint
(
20
)
COMMENT
'更新用户'
,
`updateTime`
datetime
COMMENT
'更新时间'
,
PRIMARY
KEY
(
`id`
)
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8
COMMENT
=
'站点统计'
;
-- ----------------------------
-- 设备统计表
-- ----------------------------
DROP
TABLE
IF
EXISTS
`mortals_xhx_device_stat`
;
CREATE
TABLE
mortals_xhx_device_stat
(
`id`
bigint
(
20
)
AUTO_INCREMENT
COMMENT
'ID'
,
`siteId`
bigint
(
20
)
COMMENT
'站点Id,来源基础服务平台'
,
`deviceTotalCount`
int
(
9
)
COMMENT
'设备总数'
,
`deviceAddCount`
int
(
9
)
COMMENT
'昨日新增减少设备数量'
,
`siteTotalCount`
int
(
9
)
COMMENT
'监控站点数量'
,
`siteAddCount`
int
(
9
)
COMMENT
'昨日新增站点数量'
,
`deviceOnlineCount`
int
(
9
)
COMMENT
'在线设备数量'
,
`deviceOnlineRatio`
double
(
6
,
2
)
COMMENT
'在线率'
,
CREATE
TABLE
mortals_xhx_device_stat
(
`id`
bigint
(
20
)
AUTO_INCREMENT
COMMENT
'ID'
,
`siteId`
bigint
(
20
)
COMMENT
'站点Id,来源基础服务平台'
,
`deviceTotalCount`
int
(
9
)
COMMENT
'设备总数'
,
`deviceAddCount`
int
(
9
)
COMMENT
'昨日新增减少设备数量'
,
`siteTotalCount`
int
(
9
)
COMMENT
'监控站点数量'
,
`siteAddCount`
int
(
9
)
COMMENT
'昨日新增站点数量'
,
`deviceOnlineCount`
int
(
9
)
COMMENT
'在线设备数量'
,
`deviceOnlineRatio`
double
(
6
,
2
)
COMMENT
'在线率'
,
`deviceOfflineCount`
int
(
9
)
NOT
NULL
COMMENT
'离线设备数量'
,
`deviceOfflineRatio`
double
(
6
,
2
)
NOT
NULL
COMMENT
'离线率'
,
`deviceStopCount`
int
(
9
)
NOT
NULL
COMMENT
'停用设备数量'
,
...
...
@@ -290,23 +300,23 @@ PRIMARY KEY (`id`)
-- ----------------------------
-- 产品客户端版本表
-- ----------------------------
DROP
TABLE
IF
EXISTS
`mortals_xhx_product_version`
;
CREATE
TABLE
mortals_xhx_product_version
(
`id`
bigint
(
20
)
AUTO_INCREMENT
COMMENT
'主键ID,主键,自增长'
,
`productId`
bigint
(
20
)
COMMENT
'产品Id'
,
`productCode`
varchar
(
256
)
COMMENT
'产品编码'
,
`productName`
varchar
(
256
)
COMMENT
'产品名称'
,
`filePath`
varchar
(
256
)
COMMENT
'文件相对路径地址'
,
`version`
int
(
4
)
COMMENT
'版本号'
,
`remark`
varchar
(
256
)
COMMENT
'备注信息'
,
`createTime`
datetime
COMMENT
'创建时间'
,
`updateUserId`
bigint
(
20
)
COMMENT
'更新用户'
,
`updateTime`
datetime
COMMENT
'更新时间'
,
PRIMARY
KEY
(
`id`
)
CREATE
TABLE
mortals_xhx_product_version
(
`id`
bigint
(
20
)
AUTO_INCREMENT
COMMENT
'主键ID,主键,自增长'
,
`productId`
bigint
(
20
)
COMMENT
'产品Id'
,
`productCode`
varchar
(
256
)
COMMENT
'产品编码'
,
`productName`
varchar
(
256
)
COMMENT
'产品名称'
,
`filePath`
varchar
(
256
)
COMMENT
'文件相对路径地址'
,
`version`
int
(
4
)
COMMENT
'版本号'
,
`remark`
varchar
(
256
)
COMMENT
'备注信息'
,
`createTime`
datetime
COMMENT
'创建时间'
,
`updateUserId`
bigint
(
20
)
COMMENT
'更新用户'
,
`updateTime`
datetime
COMMENT
'更新时间'
,
PRIMARY
KEY
(
`id`
)
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8
COMMENT
=
'产品客户端版本'
;
...
...
db/params.sql
View file @
ed536606
use
`device-platform`
;
-- ----------------------------
-- 设备生产厂商参数 SQL
-- ----------------------------
...
...
@@ -32,4 +32,27 @@ INSERT INTO `mortals_xhx_param` VALUES (null, '日志类型,', 'DeviceLog', 'l
INSERT
INTO
`mortals_xhx_param`
VALUES
(
null
,
'日志类型,'
,
'DeviceLog'
,
'logType'
,
'1'
,
'下发服务'
,
1
,
4
,
0
,
'logType'
,
NULL
,
NULL
,
NULL
);
INSERT
INTO
`mortals_xhx_param`
VALUES
(
null
,
'数据获取方式'
,
'Device'
,
'deviceDataSourceWay'
,
'1'
,
'被动拉取'
,
1
,
4
,
0
,
'deviceDataSourceWay'
,
NULL
,
NULL
,
NULL
);
\ No newline at end of file
INSERT
INTO
`mortals_xhx_param`
VALUES
(
null
,
'数据获取方式'
,
'Device'
,
'deviceDataSourceWay'
,
'1'
,
'被动拉取'
,
1
,
4
,
0
,
'deviceDataSourceWay'
,
NULL
,
NULL
,
NULL
);
INSERT
INTO
`mortals_xhx_platform`
VALUES
(
1
,
'排号系统'
,
'phxt'
,
0
,
'http://192.168.0.98:8090'
,
''
,
1
,
''
,
''
,
1
,
'2022-05-31 15:56:20'
,
1
,
'2022-07-02 11:46:48'
);
INSERT
INTO
`mortals_xhx_platform`
VALUES
(
2
,
'无感一码通'
,
'noninductive'
,
0
,
'baidu.com'
,
''
,
1
,
'baidu.com'
,
'noninductivenoninductive'
,
1
,
'2022-07-07 15:24:31'
,
1
,
'2022-07-07 15:24:40'
);
INSERT
INTO
`mortals_xhx_platform`
VALUES
(
3
,
'短信系统'
,
'information'
,
0
,
'baidu.baodu'
,
''
,
0
,
'baidu.baodu'
,
'baidu.baodu'
,
1
,
'2022-07-07 15:26:03'
,
1
,
'2022-07-07 15:26:03'
);
INSERT
INTO
`mortals_xhx_platform`
VALUES
(
4
,
'存取件平台'
,
'cqj'
,
0
,
'http://192.168.0.98:8090'
,
''
,
0
,
''
,
''
,
1
,
'2022-07-26 10:28:08'
,
1
,
'2022-07-29 10:09:11'
);
INSERT
INTO
`mortals_xhx_platform`
VALUES
(
5
,
'信息发布系统'
,
'xxfbxt'
,
0
,
'http://192.168.0.98:8090'
,
''
,
1
,
''
,
''
,
1
,
'2022-08-04 09:46:43'
,
1
,
'2022-08-04 14:52:56'
);
INSERT
INTO
`mortals_xhx_platform`
VALUES
(
6
,
'评价系统'
,
'pjxt'
,
0
,
'http://192.168.0.98:8090'
,
''
,
1
,
''
,
''
,
1
,
'2022-08-17 16:33:34'
,
1
,
'2022-08-17 16:34:22'
);
INSERT
INTO
`mortals_xhx_product`
VALUES
(
1
,
1
,
'排队机'
,
'pdj'
,
1
,
'1920x1080'
,
'/homeDeviceUrl/pdj/1920x1080'
,
''
,
1
,
'2022-05-12 10:35:18'
,
1
,
'2022-08-03 10:14:18'
);
INSERT
INTO
`mortals_xhx_product`
VALUES
(
2
,
1
,
'窗口屏'
,
'ckp'
,
1
,
'1920x1080'
,
'/homeDeviceUrl/ckp/1920x1080'
,
'1111'
,
1
,
'2022-05-31 15:52:59'
,
1
,
'2022-08-01 16:59:54'
);
INSERT
INTO
`mortals_xhx_product`
VALUES
(
3
,
1
,
'呼叫器'
,
'hjq'
,
1
,
'1920x1080'
,
'/homeDeviceUrl/hjq/1920x1080'
,
''
,
1
,
'2022-05-31 15:53:12'
,
1
,
'2022-08-02 09:28:19'
);
INSERT
INTO
`mortals_xhx_product`
VALUES
(
4
,
1
,
'集中显示屏'
,
'jzxsp'
,
1
,
'1920x1080'
,
'/homeDeviceUrl/jzxsp/1920x1080'
,
''
,
1
,
'2022-05-31 15:53:27'
,
1
,
'2022-08-02 09:28:28'
);
INSERT
INTO
`mortals_xhx_product`
VALUES
(
5
,
1
,
'导视机'
,
'dsj'
,
NULL
,
NULL
,
NULL
,
''
,
1
,
'2022-05-31 15:53:41'
,
1
,
'2022-05-31 15:53:41'
);
INSERT
INTO
`mortals_xhx_product`
VALUES
(
6
,
1
,
'评价器'
,
'pjq'
,
NULL
,
NULL
,
NULL
,
''
,
1
,
'2022-05-31 15:53:55'
,
1
,
'2022-09-19 09:41:01'
);
INSERT
INTO
`mortals_xhx_product`
VALUES
(
7
,
1
,
'自助服务终端'
,
'zzfwzd'
,
NULL
,
NULL
,
NULL
,
''
,
1
,
'2022-05-31 15:54:09'
,
1
,
'2022-05-31 15:54:09'
);
INSERT
INTO
`mortals_xhx_product`
VALUES
(
8
,
1
,
'填单机'
,
'tdj'
,
NULL
,
NULL
,
NULL
,
''
,
1
,
'2022-05-31 15:54:20'
,
1
,
'2022-05-31 15:54:20'
);
INSERT
INTO
`mortals_xhx_product`
VALUES
(
9
,
1
,
'样表机'
,
'ybj'
,
NULL
,
NULL
,
NULL
,
''
,
1
,
'2022-05-31 15:54:29'
,
1
,
'2022-05-31 15:54:29'
);
INSERT
INTO
`mortals_xhx_product`
VALUES
(
10
,
2
,
'一码通'
,
'ymt'
,
NULL
,
NULL
,
NULL
,
'123'
,
1
,
'2022-07-12 15:08:51'
,
1
,
'2022-07-12 15:08:51'
);
INSERT
INTO
`mortals_xhx_product`
VALUES
(
11
,
1
,
'LED通屏'
,
'ledtp'
,
NULL
,
NULL
,
'http://www.baidu.com'
,
''
,
1
,
'2022-07-19 10:13:06'
,
1
,
'2022-07-19 10:13:06'
);
INSERT
INTO
`mortals_xhx_product`
VALUES
(
13
,
4
,
'取件柜'
,
'qjg'
,
NULL
,
NULL
,
'http://www.baidu.com'
,
''
,
1
,
'2022-07-26 10:28:42'
,
1
,
'2022-07-26 10:28:42'
);
INSERT
INTO
`mortals_xhx_product`
VALUES
(
14
,
5
,
'信息发布屏'
,
'xxfbp'
,
NULL
,
''
,
''
,
''
,
1
,
'2022-08-04 09:42:01'
,
1
,
'2022-08-04 09:46:51'
);
INSERT
INTO
`mortals_xhx_product`
VALUES
(
15
,
6
,
'背靠背评价设备'
,
'bkb'
,
NULL
,
''
,
''
,
'背靠背评价设备'
,
1
,
'2022-08-17 16:35:05'
,
1
,
'2022-08-17 16:35:05'
);
\ No newline at end of file
device-manager/pom.xml
View file @
ed536606
...
...
@@ -36,12 +36,11 @@
<profiles.redis.database>
7
</profiles.redis.database>
<profiles.kafka.brokers>
192.168.0.251:9092
</profiles.kafka.brokers>
<profiles.queue.type>
rabbitmq
</profiles.queue.type>
<profiles.rabbitmq.host>
1
27.0.0.1
</profiles.rabbitmq.host>
<profiles.rabbitmq.host>
1
92.168.0.98
</profiles.rabbitmq.host>
<profiles.rabbitmq.port>
5672
</profiles.rabbitmq.port>
<profiles.rabbitmq.username>
guest
</profiles.rabbitmq.username>
<profiles.rabbitmq.password>
guest
</profiles.rabbitmq.password>
<profiles.rabbitmq.virtualhost>
/test
</profiles.rabbitmq.virtualhost>
<profiles.rabbitmq.virtualhost1>
/
</profiles.rabbitmq.virtualhost1>
<profiles.rabbitmq.username>
taxi_mq
</profiles.rabbitmq.username>
<profiles.rabbitmq.password>
admin@2020
</profiles.rabbitmq.password>
<profiles.rabbitmq.virtualhost>
/
</profiles.rabbitmq.virtualhost>
<profiles.rabbitmq.exchange>
amp.direct
</profiles.rabbitmq.exchange>
<profiles.sms.smsSendUrl>
http://127.0.0.1:8089/api/index/index
</profiles.sms.smsSendUrl>
<profiles.sms.apiId>
k6BVS1PEbyzcJAE4
</profiles.sms.apiId>
...
...
@@ -78,8 +77,7 @@
<profiles.rabbitmq.port>
5672
</profiles.rabbitmq.port>
<profiles.rabbitmq.username>
taxi_mq
</profiles.rabbitmq.username>
<profiles.rabbitmq.password>
admin@2020
</profiles.rabbitmq.password>
<profiles.rabbitmq.virtualhost>
/test
</profiles.rabbitmq.virtualhost>
<profiles.rabbitmq.virtualhost1>
/test
</profiles.rabbitmq.virtualhost1>
<profiles.rabbitmq.virtualhost>
/
</profiles.rabbitmq.virtualhost>
<profiles.rabbitmq.exchange>
amp.direct
</profiles.rabbitmq.exchange>
<profiles.sms.smsSendUrl>
http://127.0.0.1:8089/api/index/index
</profiles.sms.smsSendUrl>
<profiles.sms.apiId>
k6BVS1PEbyzcJAE4
</profiles.sms.apiId>
...
...
@@ -97,14 +95,35 @@
<id>
product
</id>
<properties>
<profiles.active>
product
</profiles.active>
<profiles.server.port>
17214
</profiles.server.port>
<profiles.server.port>
18222
</profiles.server.port>
<profiles.platform.type>
cloud
</profiles.platform.type>
<profiles.queue.type>
rabbitmq
</profiles.queue.type>
<profiles.kafka.brokers>
192.168.0.100:9092
</profiles.kafka.brokers>
<profiles.rabbitmq.host>
192.168.0.100
</profiles.rabbitmq.host>
<profiles.datasource.uri>
<![CDATA[jdbc:mysql://127.0.0.1:3306/device-platform?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=Hongkong]]>
</profiles.datasource.uri>
<profiles.datasource.username>
root
</profiles.datasource.username>
<profiles.datasource.password>
12345678
</profiles.datasource.password>
<profiles.redis.uri>
127.0.0.1
</profiles.redis.uri>
<profiles.redis.port>
6379
</profiles.redis.port>
<profiles.redis.username></profiles.redis.username>
<profiles.redis.password>
12345678
</profiles.redis.password>
<profiles.redis.database>
6
</profiles.redis.database>
<profiles.kafka.brokers>
192.168.0.251:9092
</profiles.kafka.brokers>
<profiles.queue.type>
rabbitmq
</profiles.queue.type>
<profiles.rabbitmq.host>
192.168.0.251
</profiles.rabbitmq.host>
<profiles.rabbitmq.port>
5672
</profiles.rabbitmq.port>
<profiles.nacos.server-addr>
192.168.0.100:8848
</profiles.nacos.server-addr>
<profiles.rabbitmq.username>
root_mq
</profiles.rabbitmq.username>
<profiles.rabbitmq.password>
xhx@2022
</profiles.rabbitmq.password>
<profiles.rabbitmq.virtualhost>
/
</profiles.rabbitmq.virtualhost>
<profiles.rabbitmq.exchange>
amp.direct
</profiles.rabbitmq.exchange>
<profiles.sms.smsSendUrl>
http://127.0.0.1:8089/api/index/index
</profiles.sms.smsSendUrl>
<profiles.sms.apiId>
k6BVS1PEbyzcJAE4
</profiles.sms.apiId>
<profiles.sms.type>
3
</profiles.sms.type>
<profiles.filepath>
/mortals/app/data
</profiles.filepath>
<profiles.log.level>
INFO
</profiles.log.level>
<profiles.data.path>
/data
</profiles.data.path>
<profiles.nacos.server-addr>
127.0.0.1:8848
</profiles.nacos.server-addr>
<profiles.nacos.group>
DEFAULT_GROUP
</profiles.nacos.group>
<profiles.nacos.namespace>
s
tp
</profiles.nacos.namespace>
<profiles.nacos.namespace>
s
mart-gov
</profiles.nacos.namespace>
<profiles.log.path>
/mortals/app/logs
</profiles.log.path>
</properties>
</profile>
...
...
@@ -168,6 +187,12 @@
<scope>
test
</scope>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-test
</artifactId>
<scope>
test
</scope>
</dependency>
</dependencies>
...
...
@@ -228,6 +253,23 @@
</resources>
</configuration>
</execution>
<execution>
<id>
copy-db
</id>
<phase>
package
</phase>
<goals>
<goal>
copy-resources
</goal>
</goals>
<configuration>
<encoding>
UTF-8
</encoding>
<outputDirectory>
${project.parent.basedir}/dist/${project.parent.artifactId}/db
</outputDirectory>
<resources>
<resource>
<directory>
../db/
</directory>
<filtering>
true
</filtering>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
...
...
device-manager/src/main/java/com/mortals/xhx/base/framework/aspect/OperlogAspect.java
View file @
ed536606
...
...
@@ -2,8 +2,8 @@ package com.mortals.xhx.base.framework.aspect;
import
com.mortals.framework.model.OperateLogPdu
;
import
com.mortals.framework.service.ILogService
;
import
com.mortals.framework.service.IMessageProduceService
;
import
com.mortals.framework.service.impl.FileLogServiceImpl
;
import
com.mortals.xhx.base.system.message.impl.MessageProducer
;
import
com.mortals.xhx.base.system.oper.service.OperLogService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -24,7 +24,8 @@ public class OperlogAspect extends FileLogServiceImpl implements ILogService {
@Autowired
private
OperLogService
operLogService
;
@Autowired
private
IMessageProduceService
messageProduceService
;
private
MessageProducer
messageProducer
;
//private IMessageProduceService messageProduceService;
@Override
public
void
doHandlerLog
(
String
platformMark
,
Long
userId
,
String
userName
,
String
loginName
,
String
requestUrl
,
...
...
@@ -42,7 +43,7 @@ public class OperlogAspect extends FileLogServiceImpl implements ILogService {
operateLogPdu
.
setLogDate
(
logDate
);
operateLogPdu
.
setContent
(
content
);
operateLogPdu
.
setOperType
(
1
);
messageProduce
Service
.
syncOperSend
(
operateLogPdu
);
messageProduce
r
.
syncOperSend
(
operateLogPdu
);
}
...
...
@@ -54,32 +55,4 @@ public class OperlogAspect extends FileLogServiceImpl implements ILogService {
}
/*@Pointcut("execution(public * com.mortals.xhx..*Controller.*(..))")
public void accessLog() {
}
@Before("accessLog()")
public void doBefore(JoinPoint joinPoint) {
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
HttpServletRequest request = attributes.getRequest();
// url
log.info("ip[{}]url[{}]", request.getRemoteAddr(), request.getRequestURL());
// 参数第1和第2个参数为HttpServletRequest request, HttpServletResponse
// response
if (joinPoint.getArgs().length > 2) {
log.info("args={}", joinPoint.getArgs()[2]);
} else {
log.info("args={}", joinPoint.getArgs());
}
}
@AfterReturning(returning = "object", pointcut = "accessLog()")
public void doAfterReturning(Object object) {
if (null != object) {
log.info("response={}", object.toString());
}
}*/
}
device-manager/src/main/java/com/mortals/xhx/base/framework/config/RabbitConfig.java
View file @
ed536606
package
com.mortals.xhx.base.framework.config
;
import
com.mortals.xhx.base.framework.listener.DirectDynamicListener
;
import
com.mortals.xhx.base.framework.listener.RabbitLoggingErrorHandler
;
import
com.mortals.xhx.base.framework.listener.SimpleDynamicListener
;
import
com.mortals.xhx.base.system.message.MessageCallbackService
;
import
com.mortals.xhx.base.system.message.impl.MessageProducer
;
import
com.mortals.xhx.base.system.message.impl.MessageServiceImpl
;
import
org.checkerframework.checker.units.qual.A
;
import
org.springframework.amqp.core.AcknowledgeMode
;
import
org.springframework.amqp.core.MessageListener
;
import
org.springframework.amqp.rabbit.AsyncRabbitTemplate
;
import
org.springframework.amqp.rabbit.config.SimpleRabbitListenerContainerFactory
;
import
org.springframework.amqp.rabbit.connection.CachingConnectionFactory
;
...
...
@@ -30,11 +29,11 @@ public class RabbitConfig {
@Autowired
private
SimpleDynamicListener
simpleDynamicListener
;
@Autowired
private
DirectDynamicListener
directDynamicListener
;
@Autowired
private
RabbitLoggingErrorHandler
rabbitLoggingErrorHandler
;
@Autowired
private
MessageProducer
messageProducer
;
@Autowired
private
MessageCallbackService
messageCallbackService
;
//@Bean("simpleMessageListenerContainer")
public
SimpleMessageListenerContainer
simpleMessageListenerContainer
(
CachingConnectionFactory
cachingConnectionFactory
)
{
...
...
@@ -69,8 +68,8 @@ public class RabbitConfig {
@Bean
public
RabbitTemplate
rabbitTemplate
(
ConnectionFactory
connectionFactory
)
{
RabbitTemplate
rabbitTemplate
=
new
RabbitTemplate
(
connectionFactory
);
rabbitTemplate
.
setReturnCallback
(
message
Producer
);
rabbitTemplate
.
setConfirmCallback
(
message
Producer
);
rabbitTemplate
.
setReturnCallback
(
message
CallbackService
);
rabbitTemplate
.
setConfirmCallback
(
message
CallbackService
);
return
rabbitTemplate
;
}
...
...
device-manager/src/main/java/com/mortals/xhx/base/framework/config/RedissonConfig.java
View file @
ed536606
...
...
@@ -7,8 +7,6 @@ import org.redisson.api.RedissonClient;
import
org.redisson.client.codec.Codec
;
import
org.redisson.codec.JsonJacksonCodec
;
import
org.redisson.config.Config
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.boot.context.properties.ConfigurationProperties
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
...
...
@@ -19,8 +17,8 @@ import org.springframework.context.annotation.Configuration;
* @author: zxfei
* @date: 2022/8/8 16:02
*/
//
@Configuration
//
@ConfigurationProperties(prefix = "spring.redis")
@Configuration
@ConfigurationProperties
(
prefix
=
"spring.redis"
)
@Slf4j
@Data
public
class
RedissonConfig
{
...
...
@@ -33,12 +31,13 @@ public class RedissonConfig {
private
int
database
;
//
@Bean
@Bean
public
RedissonClient
redissonClient
()
{
RedissonClient
redissonClient
;
Config
config
=
new
Config
();
String
url
=
"redis://"
+
host
+
":"
+
port
;
// 单节点配置
if
(
""
.
equalsIgnoreCase
(
password
))
password
=
null
;
config
.
useSingleServer
().
setAddress
(
url
).
setDatabase
(
database
).
setPassword
(
password
);
//使用json序列化方式
Codec
codec
=
new
JsonJacksonCodec
();
...
...
device-manager/src/main/java/com/mortals/xhx/base/framework/listener/DirectDynamicListener.java
View file @
ed536606
...
...
@@ -18,12 +18,9 @@ import com.mortals.xhx.module.platform.model.PlatformEntity;
import
com.mortals.xhx.module.platform.service.PlatformService
;
import
com.mortals.xhx.module.product.model.ProductEntity
;
import
com.mortals.xhx.module.product.service.ProductService
;
import
com.mortals.xhx.queue.DefaultTbQueueMsg
;
import
com.rabbitmq.client.Channel
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.amqp.core.Message
;
import
org.springframework.amqp.core.MessageListener
;
import
org.springframework.amqp.rabbit.listener.api.ChannelAwareMessageListener
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.ObjectUtils
;
...
...
@@ -62,7 +59,7 @@ public class DirectDynamicListener implements MessageListener {
String
queue
=
message
.
getMessageProperties
().
getConsumerQueue
();
byte
[]
body
=
message
.
getBody
();
String
data
=
new
String
(
body
);
log
.
info
(
"接收到:{} ,\n消息内容为:{}"
,
queue
,
data
);
//
log.info("接收到:{} ,\n消息内容为:{}", queue, data);
DefaultQueueMsg
queueMsg
=
JSON
.
parseObject
(
data
,
DefaultQueueMsg
.
class
);
//做相应业务,做日志操作
String
deviceCode
=
queueMsg
.
getHeaders
().
getData
().
get
(
DEVICECODE
);
...
...
device-manager/src/main/java/com/mortals/xhx/base/system/message/MessageCallbackService.java
0 → 100644
View file @
ed536606
package
com.mortals.xhx.base.system.message
;
import
org.springframework.amqp.rabbit.core.RabbitTemplate
;
public
interface
MessageCallbackService
extends
RabbitTemplate
.
ConfirmCallback
,
RabbitTemplate
.
ReturnCallback
{
}
\ No newline at end of file
device-manager/src/main/java/com/mortals/xhx/base/system/message/MessageService.java
View file @
ed536606
...
...
@@ -9,7 +9,6 @@ import com.mortals.xhx.queue.TopicPartitionInfo;
public
interface
MessageService
{
/**
* 发送消息
*
...
...
device-manager/src/main/java/com/mortals/xhx/base/system/message/RabbitMessageService.java
View file @
ed536606
package
com.mortals.xhx.base.system.message
;
import
com.mortals.xhx.busiz.req.DeviceReq
;
import
com.mortals.xhx.busiz.rsp.ApiResp
;
import
com.mortals.xhx.queue.TbQueueCallback
;
import
com.mortals.xhx.queue.TbQueueMsgHeaders
;
import
com.mortals.xhx.queue.TopicPartitionInfo
;
import
org.springframework.amqp.rabbit.core.RabbitTemplate
;
public
interface
RabbitMessageService
extends
RabbitTemplate
.
ConfirmCallback
,
RabbitTemplate
.
ReturnCallback
{
public
interface
RabbitMessageService
{
/**
...
...
device-manager/src/main/java/com/mortals/xhx/base/system/message/impl/MessageCallbackServiceImpl.java
0 → 100644
View file @
ed536606
package
com.mortals.xhx.base.system.message.impl
;
import
com.alibaba.fastjson.JSON
;
import
com.mortals.xhx.base.system.message.MessageCallbackService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.amqp.core.Message
;
import
org.springframework.amqp.rabbit.connection.CorrelationData
;
import
org.springframework.stereotype.Service
;
@Service
@Slf4j
public
class
MessageCallbackServiceImpl
implements
MessageCallbackService
{
@Override
public
void
confirm
(
CorrelationData
correlationData
,
boolean
ack
,
String
cause
)
{
log
.
info
(
"returnedMessage,correlationData:{},ack:{},cause:{},routingKey:{}"
,
JSON
.
toJSONString
(
correlationData
),
ack
,
cause
);
}
@Override
public
void
returnedMessage
(
Message
message
,
int
replyCode
,
String
replyText
,
String
exchange
,
String
routingKey
)
{
log
.
info
(
"returnedMessage,replyCode:{},replyText:{},exchange:{},routingKey:{}"
,
replyCode
,
replyText
,
exchange
,
routingKey
);
}
}
\ No newline at end of file
device-manager/src/main/java/com/mortals/xhx/base/system/message/impl/MessageProducer.java
View file @
ed536606
...
...
@@ -44,13 +44,15 @@ public class MessageProducer implements IMessageProduceService, RabbitMessageSer
@Override
public
void
syncErrorSend
(
ErrorLogPdu
errorLogPdu
)
{
rabbitTemplate
.
convertAndSend
(
QueueKey
.
EXCHANGE
,
QueueKey
.
ERROR_LOG_QUEUE
,
JSON
.
toJSONString
(
errorLogPdu
));
}
@Override
public
void
syncOperSend
(
OperateLogPdu
operLogPdu
)
{
log
.
info
(
"send poerate log ==>{}"
,
JSON
.
toJSONString
(
operLogPdu
));
rabbitTemplate
.
convertAndSend
(
QueueKey
.
EXCHANGE
,
QueueKey
.
OPERATION_LOG_QUEUE
,
JSON
.
toJSONString
(
operLogPdu
));
log
.
info
(
"send poerate log ==>{}"
,
JSON
.
toJSONString
(
operLogPdu
));
String
send
=
JSON
.
toJSONString
(
operLogPdu
);
rabbitTemplate
.
convertAndSend
(
QueueKey
.
EXCHANGE
,
QueueKey
.
OPERATION_LOG_QUEUE
,
send
);
}
@Override
...
...
@@ -81,17 +83,6 @@ public class MessageProducer implements IMessageProduceService, RabbitMessageSer
return
rabbitAdmin
.
deleteQueue
(
queue
);
}
@Override
public
void
confirm
(
CorrelationData
correlationData
,
boolean
ack
,
String
cause
)
{
}
@Override
public
void
returnedMessage
(
Message
message
,
int
replyCode
,
String
replyText
,
String
exchange
,
String
routingKey
)
{
}
@Override
public
void
afterPropertiesSet
()
throws
Exception
{
System
.
out
.
println
(
111
);
...
...
device-manager/src/main/java/com/mortals/xhx/base/system/message/impl/MessageServiceImpl.java
View file @
ed536606
...
...
@@ -167,19 +167,13 @@ public class MessageServiceImpl implements MessageService{
public
static
void
main
(
String
[]
args
)
{
try
{
throw
new
Exception
(
"1213"
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
String
stacktrace
=
ExceptionUtil
.
stacktraceToString
(
e
.
fillInStackTrace
());
JSONObject
jsonObject
=
new
JSONObject
();
jsonObject
.
put
(
"stacktrace"
,
stacktrace
);
System
.
out
.
println
(
JSON
.
toJSONString
(
jsonObject
));
}
...
...
device-manager/src/main/java/com/mortals/xhx/busiz/req/TestReq.java
0 → 100644
View file @
ed536606
package
com.mortals.xhx.busiz.req
;
import
com.fasterxml.jackson.databind.annotation.JsonDeserialize
;
import
com.mortals.xhx.base.framework.CustomJsonDateDeserializer
;
import
lombok.Data
;
import
java.io.Serializable
;
import
java.util.Date
;
@Data
public
class
TestReq
implements
Serializable
{
/**
* 1:新增,2:修改,3:删除,4:激活,5:启用,6:停用
*/
private
Integer
receiveMethod
;
// /**
// * 平台系统id
// */
// private Long platformId;
// /**
// * 平台系统编码
// */
// private String platformCode;
/**
* 产品id
*/
private
Long
productId
;
/**
* 产品编码
*/
private
String
productCode
;
/**
* 设备生产厂商ID
*/
private
Long
deviceFirmId
;
/**
* 设备生产厂商名称
*/
private
String
deviceFirmname
;
/**
* 设备名称
*/
private
String
deviceName
;
/**
* 设备编码(暂定mac地址)
*/
private
String
deviceCode
;
/**
* 设备Mac
*/
private
String
deviceMac
;
/**
* 所属站点Id
*/
private
Long
siteId
;
/**
* 所属站点编码
*/
private
String
siteCode
;
/**
* 所属站点名称
*/
private
String
siteName
;
/**
* 设备备注信息
*/
private
String
deviceRemark
;
/**
* 设备
*/
private
String
homeUrl
;
/**
* 设备访问ip
*/
private
String
ip
;
/**
* 中心设备编码
*/
private
String
centernum
;
/**
* 端口
*/
private
String
port
;
/**
* 经度
*/
private
String
lon
;
/**
* 纬度
*/
private
String
lati
;
/**
* 楼层
*/
private
Integer
deviceInBuilding
;
/**
* 所属楼栋
*/
private
Integer
deviceInFloor
;
/**
* 负责人
*/
private
String
leadingOfficial
;
/**
* 联系电话
*/
private
String
leadingOfficialTelephone
;
/**
* 保修期至
*/
@JsonDeserialize
(
using
=
CustomJsonDateDeserializer
.
class
)
private
Date
defectsLiabilityPeriod
;
/**
* 设备状态 (0.未激活,1.离线,2.在线)
*/
private
Integer
deviceStatus
;
/**
* 设备来源(0.旧设备,1.新设备)
*/
private
Integer
source
;
/**
* 激活(0.否,1.是)
*/
private
Integer
active
;
/**
* 设备版本信息
*/
private
String
deviceVersion
;
}
device-manager/src/main/java/com/mortals/xhx/busiz/web/DeviceApiController.java
View file @
ed536606
package
com.mortals.xhx.busiz.web
;
import
cn.hutool.core.date.DateUnit
;
import
cn.hutool.core.date.DateUtil
;
import
cn.hutool.core.net.url.UrlBuilder
;
import
cn.hutool.core.util.IdUtil
;
import
cn.hutool.extra.servlet.ServletUtil
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.TypeReference
;
import
com.mortals.framework.annotation.UnAuth
;
import
com.mortals.framework.ap.GlobalSysInfo
;
import
com.mortals.framework.common.Rest
;
import
com.mortals.framework.exception.AppException
;
import
com.mortals.framework.model.OrderCol
;
import
com.mortals.framework.service.IAuthTokenService
;
import
com.mortals.framework.service.ICacheService
;
import
com.mortals.framework.service.ILogService
;
import
com.mortals.framework.service.IUser
;
import
com.mortals.framework.service.impl.FileLogServiceImpl
;
import
com.mortals.framework.util.DateUtils
;
import
com.mortals.framework.util.StringUtils
;
import
com.mortals.xhx.base.framework.annotation.ApiUserAuth
;
import
com.mortals.xhx.base.login.web.LoginForm
;
import
com.mortals.xhx.base.system.message.impl.MessageProducer
;
...
...
@@ -34,8 +28,6 @@ import com.mortals.xhx.common.key.Constant;
import
com.mortals.xhx.common.key.QueueKey
;
import
com.mortals.xhx.common.model.DefaultTbQueueMsgHeaders
;
import
com.mortals.xhx.common.model.MessageHeader
;
import
com.mortals.xhx.common.pdu.DefaultQueueMsg
;
import
com.mortals.xhx.common.pdu.DefaultQueueMsgHeader
;
import
com.mortals.xhx.common.pdu.RespData
;
import
com.mortals.xhx.common.pdu.site.SitePdu
;
import
com.mortals.xhx.common.utils.BeanUtil
;
...
...
@@ -49,7 +41,6 @@ import com.mortals.xhx.module.device.service.DeviceService;
import
com.mortals.xhx.module.firm.model.FirmEntity
;
import
com.mortals.xhx.module.firm.service.FirmService
;
import
com.mortals.xhx.module.platform.model.PlatformEntity
;
import
com.mortals.xhx.module.platform.model.PlatformQuery
;
import
com.mortals.xhx.module.platform.service.PlatformService
;
import
com.mortals.xhx.module.product.model.ProductEntity
;
import
com.mortals.xhx.module.product.model.ProductQuery
;
...
...
@@ -62,14 +53,12 @@ import com.mortals.xhx.module.site.service.SiteService;
import
com.mortals.xhx.queue.DefaultTbQueueMsg
;
import
com.mortals.xhx.queue.TbQueueMsg
;
import
com.mortals.xhx.queue.TbQueueMsgHeaders
;
import
com.mortals.xhx.queue.TopicPartitionInfo
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.context.request.ServletRequestAttributes
;
import
javax.servlet.http.HttpServletRequest
;
import
java.util.ArrayList
;
...
...
@@ -78,7 +67,6 @@ import java.util.Date;
import
java.util.List
;
import
java.util.stream.Collectors
;
import
static
com
.
mortals
.
framework
.
ap
.
SysConstains
.
PROP_PLATFORM_MARK
;
import
static
com
.
mortals
.
xhx
.
common
.
key
.
Constant
.*;
import
static
com
.
mortals
.
xhx
.
common
.
key
.
ErrorCode
.*;
import
static
com
.
mortals
.
xhx
.
common
.
key
.
RedisKey
.
KEY_TOKEN_API_CACHE
;
...
...
@@ -103,17 +91,17 @@ public class DeviceApiController {
private
ProductVersionService
productVersionService
;
@Autowired
private
PlatformService
platformService
;
@Value
(
"${
queue.rabbitmq.virtual_
host:}"
)
@Value
(
"${
rabbitmq.virtual-
host:}"
)
private
String
virtualHost
;
@Value
(
"${
queue.
rabbitmq.password:}"
)
@Value
(
"${rabbitmq.password:}"
)
private
String
password
;
@Value
(
"${
queue.
rabbitmq.host:}"
)
@Value
(
"${rabbitmq.host:}"
)
private
String
host
;
@Value
(
"${
queue.rabbitmq.port:
}"
)
@Value
(
"${
rabbitmq.port:0
}"
)
private
int
port
;
@Value
(
"${
queue.
rabbitmq.username:}"
)
@Value
(
"${rabbitmq.username:}"
)
private
String
username
;
@Value
(
"${
queue.
rabbitmq.queue-properties.x-message-ttl:86400000}"
)
@Value
(
"${rabbitmq.queue-properties.x-message-ttl:86400000}"
)
private
String
messageTtl
;
@Value
(
"${token.secret}"
)
private
String
secret
;
...
...
device-manager/src/main/java/com/mortals/xhx/busiz/web/TestSendMsgController.java
0 → 100644
View file @
ed536606
package
com.mortals.xhx.busiz.web
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.mortals.framework.service.ICacheService
;
import
com.mortals.framework.service.ILogService
;
import
com.mortals.framework.service.impl.FileLogServiceImpl
;
import
com.mortals.xhx.base.system.message.impl.MessageProducer
;
import
com.mortals.xhx.base.system.user.service.UserService
;
import
com.mortals.xhx.busiz.req.TestReq
;
import
com.mortals.xhx.busiz.rsp.ApiResp
;
import
com.mortals.xhx.busiz.rsp.DeviceResp
;
import
com.mortals.xhx.common.code.ApiRespCodeEnum
;
import
com.mortals.xhx.common.utils.SendTaskThreadPool
;
import
com.mortals.xhx.feign.site.ISiteFeign
;
import
com.mortals.xhx.module.device.service.DeviceLogService
;
import
com.mortals.xhx.module.device.service.DeviceService
;
import
com.mortals.xhx.module.firm.service.FirmService
;
import
com.mortals.xhx.module.platform.service.PlatformService
;
import
com.mortals.xhx.module.product.service.ProductService
;
import
com.mortals.xhx.module.product.service.ProductVersionService
;
import
com.mortals.xhx.module.site.service.SiteService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
/**
* 设备
*
* @author: zxfei
* @date: 2021/8/24 20:28
*/
@RestController
@Slf4j
@RequestMapping
(
"/test"
)
public
class
TestSendMsgController
{
@Autowired
private
DeviceService
deviceService
;
@Autowired
private
ProductService
productService
;
@Autowired
private
UserService
userService
;
@Autowired
private
ProductVersionService
productVersionService
;
@Autowired
private
PlatformService
platformService
;
@Value
(
"${queue.rabbitmq.virtual_host:}"
)
private
String
virtualHost
;
@Value
(
"${queue.rabbitmq.password:}"
)
private
String
password
;
@Value
(
"${queue.rabbitmq.host:}"
)
private
String
host
;
@Value
(
"${queue.rabbitmq.port:0}"
)
private
int
port
;
@Value
(
"${queue.rabbitmq.username:}"
)
private
String
username
;
@Value
(
"${queue.rabbitmq.queue-properties.x-message-ttl:86400000}"
)
private
String
messageTtl
;
@Value
(
"${token.secret}"
)
private
String
secret
;
@Autowired
private
SendTaskThreadPool
sendTaskThreadPool
;
@Autowired
private
ISiteFeign
siteFeign
;
@Value
(
"${platform.type:cloud}"
)
private
String
platFormType
;
//版本,默认云服务版本
@Autowired
private
SiteService
siteService
;
@Autowired
private
FirmService
firmService
;
@Autowired
private
DeviceLogService
deviceLogService
;
@Autowired
private
ICacheService
cacheService
;
@Autowired
private
MessageProducer
messageProducer
;
@Autowired
protected
ILogService
logService
=
FileLogServiceImpl
.
getInstance
();
/**
* 发送日志消息
*
* @param req
* @return
*/
@PostMapping
(
"log"
)
public
String
register
(
@RequestBody
TestReq
req
)
{
log
.
info
(
"【测试消息】【请求体】--> "
+
JSONObject
.
toJSONString
(
req
));
ApiResp
<
DeviceResp
>
rsp
=
new
ApiResp
<>();
rsp
.
setCode
(
ApiRespCodeEnum
.
SUCCESS
.
getValue
());
log
.
info
(
"响应【设备注册】【响应体】--> "
+
JSONObject
.
toJSONString
(
rsp
));
return
JSON
.
toJSONString
(
rsp
);
}
}
device-manager/src/main/java/com/mortals/xhx/daemon/applicationservice/NettyStartedService.java
View file @
ed536606
package
com.mortals.xhx.daemon.applicationservice
;
import
com.mortals.framework.springcloud.service.IApplicationStartedService
;
import
com.mortals.xhx.daemon.netty.config.NettyServerConfig
;
import
com.mortals.xhx.daemon.netty.server.controlserver.ControlServer
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.logging.Log
;
import
org.apache.commons.logging.LogFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
...
...
@@ -40,7 +37,7 @@ public class NettyStartedService implements IApplicationStartedService {
@Override
public
void
stop
()
{
log
.
info
(
"停止服务.."
);
log
.
info
(
"
netty
停止服务.."
);
if
(
thread
!=
null
)
{
thread
.
interrupt
();
}
...
...
device-manager/src/main/java/com/mortals/xhx/daemon/netty/server/controlserver/ControlServer.java
View file @
ed536606
package
com.mortals.xhx.daemon.netty.server.controlserver
;
import
com.mortals.xhx.daemon.netty.config.NettyServerConfig
;
import
com.mortals.xhx.module.device.service.DeviceService
;
import
io.netty.bootstrap.Bootstrap
;
import
io.netty.channel.Channel
;
...
...
@@ -14,7 +13,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.stereotype.Component
;
import
javax.annotation.PreDestroy
;
import
javax.annotation.Resource
;
import
java.net.Inet4Address
;
@Component
...
...
@@ -63,9 +61,9 @@ public class ControlServer {
@PreDestroy
public
void
release
()
{
isClosed
=
true
;
closeChannel
();
closeServerBootstrap
();
isClosed
=
true
;
}
/**
...
...
device-manager/src/main/java/com/mortals/xhx/module/device/service/impl/DeviceServiceImpl.java
View file @
ed536606
...
...
@@ -170,8 +170,6 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D
resp
.
setCode
(
ApiRespCodeEnum
.
SUCCESS
.
getValue
());
resp
.
setMsg
(
ApiRespCodeEnum
.
SUCCESS
.
getLabel
());
//messageProducer.sendMsg();
messageService
.
send
(
info
,
header
,
message
,
callback
);
return
resp
;
}
...
...
@@ -272,39 +270,11 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D
super
.
saveAfter
(
entity
,
context
);
}
/* private void registerRabbitQueue(DeviceEntity entity, PlatformEntity platformEntity, ProductEntity productEntity) {
String exchangeName = platformEntity.getPlatformSn() + Constant.EXCHANGE_SPLIT + productEntity.getProductCode();
TopicPartitionInfo info = TopicPartitionInfo.builder().exchangeName(exchangeName).topic(Constant.UPLOAD_TOPIC + entity.getDeviceCode()).build();
TbQueueCallback callback = new TbQueueCallback() {
@Override
public void onSuccess(TbQueueMsgMetadata metadata) {
log.debug("队列创建成功,设备编码:{}", entity.getDeviceCode());
}
@Override
public void onFailure(Throwable t) {
log.error("队列创建失败,设备通道编码:{},{}", entity.getDeviceCode(), t);
}
};
messageService.queueDeclare(info, callback);
//消费监听线程添加当前声明队列
Set<TopicPartitionInfo> partitions = new HashSet<>();
partitions.add(info);
consumerService.getMainConsumer().subscribe(partitions);
//创建下行队列
info = TopicPartitionInfo.builder().exchangeName(exchangeName).topic(Constant.DOWN_TOPIC + entity.getDeviceCode()).build();
messageService.queueDeclare(info, callback);
}*/
@Override
protected
void
updateAfter
(
DeviceEntity
entity
,
Context
context
)
throws
AppException
{
PlatformEntity
platformEntity
=
platformService
.
get
(
entity
.
getPlatformId
());
ProductEntity
productEntity
=
productService
.
get
(
entity
.
getProductId
());
if
(!
ObjectUtils
.
isEmpty
(
platformEntity
)
&&
!
ObjectUtils
.
isEmpty
(
productEntity
))
{
//新增设备通知第三方平台 激活后的设备才通知和更新
if
(
entity
.
getDeviceStatus
()
>
0
)
{
//注册rabbmit相关队列与绑定
...
...
device-manager/src/main/resources/bootstrap.yml
View file @
ed536606
...
...
@@ -20,11 +20,6 @@ spring:
default-property-inclusion
:
NON_NULL
# time-zone: GMT+8
# date-format: yyyy-MM-dd HH:mm:ss
security
:
enable
:
true
user
:
name
:
admin
password
:
1
redis
:
host
:
@
profiles.redis.uri@
port
:
@
profiles.redis.port@
...
...
@@ -58,7 +53,7 @@ spring:
username
:
@
profiles.rabbitmq.username@
password
:
@
profiles.rabbitmq.password@
exchange-name
:
@
profiles.rabbitmq.exchange@
virtual-host
:
@
profiles.rabbitmq.virtualhost
1
@
virtual-host
:
@
profiles.rabbitmq.virtualhost@
publisher-returns
:
true
publisher-confirm-type
:
correlated
dao
:
...
...
@@ -98,44 +93,4 @@ sms:
apiId
:
@
profiles.sms.apiId@
type
:
@
profiles.sms.type@
queue
:
type
:
@
profiles.queue.type@
# memory or kafka (Apache Kafka) or rabbitmq (RabbitMQ)
core
:
topic
:
tb_core
poll-interval
:
25
partitions
:
10
pack-processing-timeout
:
2000
in_memory
:
stats
:
print-interval-ms
:
60000
kafka
:
bootstrap.servers
:
@
profiles.kafka.brokers@
acks
:
all
retries
:
1
batch.size
:
16384
linger.ms
:
1
buffer.memory
:
33554432
replication_factor
:
1
max_poll_interval_ms
:
300000
max_poll_records
:
8192
max_partition_fetch_bytes
:
16777216
fetch_max_bytes
:
134217728
use_confluent_cloud
:
false
consumer-stats
:
enabled
:
true
print-interval-ms
:
60000
kafka-response-timeout-ms
:
1000
rabbitmq
:
exchange_name
:
@
profiles.rabbitmq.exchange@
host
:
@
profiles.rabbitmq.host@
port
:
@
profiles.rabbitmq.port@
virtual_host
:
@
profiles.rabbitmq.virtualhost@
username
:
@
profiles.rabbitmq.username@
password
:
@
profiles.rabbitmq.password@
automatic_recovery_enabled
:
false
connection_timeout
:
5000
handshake_timeout
:
10000
queue-properties
:
x-message-ttl
:
86400000
x-max-length-bytes
:
1048576000
device-manager/src/test/java/producer/ProducerTest.java
0 → 100644
View file @
ed536606
package
producer
;
//package producer;
import
cn.hutool.core.util.IdUtil
;
import
com.mortals.framework.model.AccessLogPdu
;
import
com.mortals.framework.model.BizLogPdu
;
import
com.mortals.framework.model.ErrorLogPdu
;
import
com.mortals.framework.model.OperateLogPdu
;
import
com.mortals.framework.service.IMessageProduceService
;
import
com.mortals.xhx.ManagerApplication
;
import
lombok.extern.slf4j.Slf4j
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.test.context.SpringBootTest
;
import
org.springframework.test.context.junit4.SpringRunner
;
import
java.util.Date
;
@RunWith
(
SpringRunner
.
class
)
@SpringBootTest
(
classes
=
ManagerApplication
.
class
)
@Slf4j
public
class
ProducerTest
{
@Autowired
private
IMessageProduceService
producer
;
// private MessageProducer producer;
@Test
public
void
testSyncAccessSend
()
{
for
(
int
i
=
0
;
i
<
50
;
i
++)
{
AccessLogPdu
accessLogPdu
=
new
AccessLogPdu
();
accessLogPdu
.
initAttrValue
();
accessLogPdu
.
setTraceID
(
IdUtil
.
fastSimpleUUID
());
accessLogPdu
.
setLogTime
(
new
Date
());
producer
.
syncAccessSend
(
accessLogPdu
);
log
.
info
(
"[testSyncSend][发送编号:[{}] 发送成功]"
,
accessLogPdu
.
getTraceID
());
}
}
@Test
public
void
testSyncBizSend
()
{
for
(
int
i
=
0
;
i
<
10
;
i
++)
{
BizLogPdu
bizLogEntity
=
new
BizLogPdu
();
bizLogEntity
.
initAttrValue
();
bizLogEntity
.
setTraceID
(
IdUtil
.
fastSimpleUUID
());
bizLogEntity
.
setLogTime
(
new
Date
());
producer
.
syncBizSend
(
bizLogEntity
);
log
.
info
(
"[testSyncSend][发送编号:[{}] 发送成功]"
,
bizLogEntity
.
getTraceID
());
}
}
@Test
public
void
testSyncErrorSend
()
{
for
(
int
i
=
0
;
i
<
10
;
i
++)
{
ErrorLogPdu
errorLogPdu
=
new
ErrorLogPdu
();
errorLogPdu
.
initAttrValue
();
errorLogPdu
.
setTraceID
(
IdUtil
.
fastSimpleUUID
());
errorLogPdu
.
setLogTime
(
new
Date
());
producer
.
syncErrorSend
(
errorLogPdu
);
log
.
info
(
"[testSyncSend][发送编号:[{}] 发送成功]"
,
errorLogPdu
.
getTraceID
());
}
}
@Test
public
void
testSyncOperSend
()
{
for
(
int
i
=
0
;
i
<
5
;
i
++)
{
OperateLogPdu
operateLogPdu
=
new
OperateLogPdu
();
operateLogPdu
.
initAttrValue
();
operateLogPdu
.
setIp
(
"192.168.0.98"
);
operateLogPdu
.
setRequestUrl
(
"requestUrl"
);
operateLogPdu
.
setUserId
(
1L
);
operateLogPdu
.
setUserName
(
"userName"
);
operateLogPdu
.
setLoginName
(
"loginName"
);
operateLogPdu
.
setPlatformMark
(
"platformMark"
);
operateLogPdu
.
setLogDate
(
new
Date
());
operateLogPdu
.
setContent
(
"content"
);
operateLogPdu
.
setOperType
(
1
);
producer
.
syncOperSend
(
operateLogPdu
);
log
.
info
(
"[testSyncOperSend][发送成功]"
);
}
}
}
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