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
40657a89
Commit
40657a89
authored
Jan 15, 2023
by
赵啸非
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改设备获取服务器地址方式
parent
b99c19a7
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
67 additions
and
27 deletions
+67
-27
common-lib/pom.xml
common-lib/pom.xml
+0
-1
device-manager/db/module.sql
device-manager/db/module.sql
+23
-2
device-manager/db/params.sql
device-manager/db/params.sql
+9
-1
device-manager/pom.xml
device-manager/pom.xml
+5
-5
device-manager/src/main/bin/deploy.sh
device-manager/src/main/bin/deploy.sh
+1
-1
device-manager/src/main/java/com/mortals/xhx/busiz/web/DeviceApiController.java
...n/java/com/mortals/xhx/busiz/web/DeviceApiController.java
+18
-5
device-manager/src/main/java/com/mortals/xhx/common/key/Constant.java
...er/src/main/java/com/mortals/xhx/common/key/Constant.java
+1
-1
device-manager/src/main/java/com/mortals/xhx/daemon/netty/server/controlserver/handler/NettyUDPServerHandler.java
...y/server/controlserver/handler/NettyUDPServerHandler.java
+10
-11
No files found.
common-lib/pom.xml
View file @
40657a89
...
@@ -16,7 +16,6 @@
...
@@ -16,7 +16,6 @@
<groupId>
com.mortals.xhx
</groupId>
<groupId>
com.mortals.xhx
</groupId>
<artifactId>
device-new-platform
</artifactId>
<artifactId>
device-new-platform
</artifactId>
<version>
1.0.0-SNAPSHOT
</version>
<version>
1.0.0-SNAPSHOT
</version>
<relativePath/>
</parent>
</parent>
<properties>
<properties>
<rabbitmq.version>
4.8.0
</rabbitmq.version>
<rabbitmq.version>
4.8.0
</rabbitmq.version>
...
...
device-manager/db/module.sql
View file @
40657a89
use
`device-platform`
;
use
`device-platform`
;
-- ----------------------------
-- ----------------------------
-- 设备表
-- 设备表
-- ----------------------------
-- ----------------------------
...
@@ -84,7 +85,7 @@ DROP TABLE IF EXISTS `mortals_xhx_product`;
...
@@ -84,7 +85,7 @@ DROP TABLE IF EXISTS `mortals_xhx_product`;
CREATE
TABLE
mortals_xhx_product
CREATE
TABLE
mortals_xhx_product
(
(
`id`
bigint
(
20
)
AUTO_INCREMENT
COMMENT
'主键ID,主键,自增长'
,
`id`
bigint
(
20
)
AUTO_INCREMENT
COMMENT
'主键ID,主键,自增长'
,
`platformId`
bigint
(
20
)
NOT
NULL
COMMENT
'关联平台'
,
`platformId`
bigint
(
20
)
NOT
NULL
COMMENT
'关联平台'
,
`productName`
varchar
(
20
)
NOT
NULL
COMMENT
'产品名称,名称唯一'
,
`productName`
varchar
(
20
)
NOT
NULL
COMMENT
'产品名称,名称唯一'
,
`productCode`
varchar
(
256
)
COMMENT
'产品编码'
,
`productCode`
varchar
(
256
)
COMMENT
'产品编码'
,
`skinId`
bigint
(
20
)
NOT
NULL
COMMENT
'皮肤id'
,
`skinId`
bigint
(
20
)
NOT
NULL
COMMENT
'皮肤id'
,
...
@@ -298,6 +299,26 @@ PRIMARY KEY (`id`)
...
@@ -298,6 +299,26 @@ PRIMARY KEY (`id`)
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8
COMMENT
=
'设备统计'
;
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8
COMMENT
=
'设备统计'
;
DROP
TABLE
IF
EXISTS
`mortals_xhx_device_module_distribute`
;
CREATE
TABLE
`mortals_xhx_device_module_distribute`
(
`id`
bigint
(
20
)
NOT
NULL
AUTO_INCREMENT
COMMENT
'主键ID,主键,自增长'
,
`productId`
bigint
(
20
)
NULL
DEFAULT
NULL
COMMENT
'产品Id'
,
`productCode`
varchar
(
256
)
CHARACTER
SET
utf8
COLLATE
utf8_general_ci
NULL
DEFAULT
NULL
COMMENT
'产品编码'
,
`productName`
varchar
(
256
)
CHARACTER
SET
utf8
COLLATE
utf8_general_ci
NULL
DEFAULT
NULL
COMMENT
'产品名称'
,
`imageResolution`
varchar
(
256
)
CHARACTER
SET
utf8
COLLATE
utf8_general_ci
NOT
NULL
COMMENT
'分辨率'
,
`imageResolutionValue`
varchar
(
256
)
CHARACTER
SET
utf8
COLLATE
utf8_general_ci
NOT
NULL
COMMENT
'分辨率值'
,
`filePath`
varchar
(
256
)
CHARACTER
SET
utf8
COLLATE
utf8_general_ci
NULL
DEFAULT
NULL
COMMENT
'文件相对路径地址'
,
`distributeFilePath`
varchar
(
256
)
CHARACTER
SET
utf8
COLLATE
utf8_general_ci
NULL
DEFAULT
NULL
COMMENT
'文件部署路径地址'
,
`version`
varchar
(
256
)
CHARACTER
SET
utf8
COLLATE
utf8_general_ci
NULL
DEFAULT
NULL
COMMENT
'版本号'
,
`distribute`
tinyint
(
2
)
NOT
NULL
COMMENT
'是否部署(0.否,1.是)'
,
`createTime`
datetime
(
0
)
NULL
DEFAULT
NULL
COMMENT
'创建时间'
,
`updateUserId`
bigint
(
20
)
NULL
DEFAULT
NULL
COMMENT
'更新用户'
,
`updateTime`
datetime
(
0
)
NULL
DEFAULT
NULL
COMMENT
'更新时间'
,
PRIMARY
KEY
(
`id`
)
USING
BTREE
)
ENGINE
=
InnoDB
AUTO_INCREMENT
=
9
CHARACTER
SET
=
utf8
COLLATE
=
utf8_general_ci
COMMENT
=
'设备前端模块部署'
ROW_FORMAT
=
Dynamic
;
-- ----------------------------
-- ----------------------------
-- 产品客户端版本表
-- 产品客户端版本表
...
...
device-manager/db/params.sql
View file @
40657a89
...
@@ -60,4 +60,12 @@ INSERT INTO `mortals_xhx_product` VALUES (11, 1, 'LED通屏', 'ledtp', NULL, NUL
...
@@ -60,4 +60,12 @@ INSERT INTO `mortals_xhx_product` VALUES (11, 1, 'LED通屏', 'ledtp', NULL, NUL
INSERT
INTO
`mortals_xhx_product`
VALUES
(
13
,
4
,
'取件柜'
,
'qjg'
,
NULL
,
NULL
,
'http://www.baidu.com'
,
NULL
,
''
,
1
,
'2022-07-26 10:28:42'
,
1
,
'2022-07-26 10:28:42'
);
INSERT
INTO
`mortals_xhx_product`
VALUES
(
13
,
4
,
'取件柜'
,
'qjg'
,
NULL
,
NULL
,
'http://www.baidu.com'
,
NULL
,
''
,
1
,
'2022-07-26 10:28:42'
,
1
,
'2022-07-26 10:28:42'
);
INSERT
INTO
`mortals_xhx_product`
VALUES
(
14
,
5
,
'信息发布屏'
,
'xxfbp'
,
NULL
,
''
,
''
,
NULL
,
''
,
1
,
'2022-08-04 09:42:01'
,
1
,
'2022-08-04 09:46:51'
);
INSERT
INTO
`mortals_xhx_product`
VALUES
(
14
,
5
,
'信息发布屏'
,
'xxfbp'
,
NULL
,
''
,
''
,
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
,
''
,
''
,
NULL
,
'背靠背评价设备'
,
1
,
'2022-08-17 16:35:05'
,
1
,
'2022-08-17 16:35:05'
);
INSERT
INTO
`mortals_xhx_product`
VALUES
(
15
,
6
,
'背靠背评价设备'
,
'bkb'
,
NULL
,
''
,
''
,
NULL
,
'背靠背评价设备'
,
1
,
'2022-08-17 16:35:05'
,
1
,
'2022-08-17 16:35:05'
);
INSERT
INTO
`mortals_xhx_product`
VALUES
(
16
,
7
,
'数字样表机'
,
'szybj'
,
NULL
,
''
,
''
,
NULL
,
''
,
1
,
'2022-10-27 16:21:41'
,
1
,
'2022-10-27 16:21:41'
);
INSERT
INTO
`mortals_xhx_product`
VALUES
(
16
,
7
,
'数字样表机'
,
'szybj'
,
NULL
,
''
,
''
,
NULL
,
''
,
1
,
'2022-10-27 16:21:41'
,
1
,
'2022-10-27 16:21:41'
);
\ No newline at end of file
INSERT
INTO
`mortals_xhx_task`
VALUES
(
3
,
'设备状态任务'
,
'deviceStatTask'
,
0
,
'DeviceStatTask'
,
NULL
,
''
,
4
,
60
,
'00'
,
NULL
,
'192.168.56.1'
,
'2022-07-06 10:18:29'
,
0
,
'2022-03-09 15:59:51'
,
1
,
'系统管理员'
);
INSERT
INTO
`mortals_xhx_task`
VALUES
(
4
,
'站点设备统计'
,
'siteStatTask'
,
0
,
'SiteStatTask'
,
NULL
,
NULL
,
4
,
60
,
'00'
,
NULL
,
'127.0.1.1'
,
'2023-01-13 14:41:36'
,
0
,
'2022-06-30 17:15:21'
,
1
,
'系统管理员'
);
INSERT
INTO
`mortals_xhx_task`
VALUES
(
5
,
'设备统计任务'
,
'deviceTotalStatTask'
,
0
,
'DeviceTotalStatTask'
,
NULL
,
NULL
,
4
,
120
,
'00:00'
,
NULL
,
'127.0.1.1'
,
'2023-01-13 14:41:35'
,
0
,
'2022-07-05 16:33:30'
,
1
,
'系统管理员'
);
INSERT
INTO
`mortals_xhx_task`
VALUES
(
6
,
'短信发送任务'
,
'smsSendTask'
,
0
,
'SmsSendTask'
,
NULL
,
NULL
,
4
,
10
,
'00'
,
NULL
,
'127.0.1.1'
,
'2023-01-13 14:42:18'
,
0
,
'2022-07-05 16:34:25'
,
1
,
'系统管理员'
);
INSERT
INTO
`mortals_xhx_task`
VALUES
(
7
,
'用户同步'
,
'syncUserTask'
,
0
,
'SyncUserTask'
,
NULL
,
NULL
,
4
,
120
,
'00'
,
NULL
,
'127.0.1.1'
,
'2023-01-13 14:41:35'
,
0
,
'2022-07-06 10:49:48'
,
1
,
'系统管理员'
);
INSERT
INTO
`mortals_xhx_task`
VALUES
(
9
,
'设备状态修正任务'
,
'deviceStatTask'
,
0
,
'DeviceStatTask'
,
NULL
,
NULL
,
4
,
120
,
'00'
,
NULL
,
'127.0.1.1'
,
'2023-01-13 14:41:35'
,
0
,
'2022-07-20 16:50:42'
,
1
,
'系统管理员'
);
device-manager/pom.xml
View file @
40657a89
...
@@ -137,27 +137,27 @@
...
@@ -137,27 +137,27 @@
<profiles.server.port>
18222
</profiles.server.port>
<profiles.server.port>
18222
</profiles.server.port>
<profiles.platform.type>
cloud
</profiles.platform.type>
<profiles.platform.type>
cloud
</profiles.platform.type>
<profiles.datasource.uri>
<profiles.datasource.uri>
<![CDATA[jdbc:mysql://1
27.0.0.
1:3306/device-platform?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=Hongkong]]>
</profiles.datasource.uri>
<![CDATA[jdbc:mysql://1
72.15.28.12
1:3306/device-platform?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=Hongkong]]>
</profiles.datasource.uri>
<profiles.datasource.username>
root
</profiles.datasource.username>
<profiles.datasource.username>
root
</profiles.datasource.username>
<profiles.datasource.password>
xhx@2022
</profiles.datasource.password>
<profiles.datasource.password>
xhx@2022
</profiles.datasource.password>
<profiles.redis.uri>
1
27.0.0.1
</profiles.redis.uri>
<profiles.redis.uri>
1
72.15.28.120
</profiles.redis.uri>
<profiles.redis.port>
6379
</profiles.redis.port>
<profiles.redis.port>
6379
</profiles.redis.port>
<profiles.redis.username></profiles.redis.username>
<profiles.redis.username></profiles.redis.username>
<profiles.redis.password>
hotel@2020
</profiles.redis.password>
<profiles.redis.password>
hotel@2020
</profiles.redis.password>
<profiles.redis.database>
6
</profiles.redis.database>
<profiles.redis.database>
6
</profiles.redis.database>
<profiles.rabbitmq.host>
1
27.0.0.1
</profiles.rabbitmq.host>
<profiles.rabbitmq.host>
1
72.15.28.120
</profiles.rabbitmq.host>
<profiles.rabbitmq.port>
5672
</profiles.rabbitmq.port>
<profiles.rabbitmq.port>
5672
</profiles.rabbitmq.port>
<profiles.rabbitmq.username>
taxi_mq
</profiles.rabbitmq.username>
<profiles.rabbitmq.username>
taxi_mq
</profiles.rabbitmq.username>
<profiles.rabbitmq.password>
admin@2020
</profiles.rabbitmq.password>
<profiles.rabbitmq.password>
admin@2020
</profiles.rabbitmq.password>
<profiles.rabbitmq.virtualhost>
/
</profiles.rabbitmq.virtualhost>
<profiles.rabbitmq.virtualhost>
/
</profiles.rabbitmq.virtualhost>
<profiles.rabbitmq.exchange>
amp.direct
</profiles.rabbitmq.exchange>
<profiles.rabbitmq.exchange>
amp.direct
</profiles.rabbitmq.exchange>
<profiles.sms.smsSendUrl>
http://1
27.0.0.1
:8089/api/index/index
</profiles.sms.smsSendUrl>
<profiles.sms.smsSendUrl>
http://1
72.15.28.114
:8089/api/index/index
</profiles.sms.smsSendUrl>
<profiles.sms.apiId>
k6BVS1PEbyzcJAE4
</profiles.sms.apiId>
<profiles.sms.apiId>
k6BVS1PEbyzcJAE4
</profiles.sms.apiId>
<profiles.sms.type>
3
</profiles.sms.type>
<profiles.sms.type>
3
</profiles.sms.type>
<profiles.log.path>
/home/mortals/app/logs
</profiles.log.path>
<profiles.log.path>
/home/mortals/app/logs
</profiles.log.path>
<profiles.filepath>
/home/mortals/app/data
</profiles.filepath>
<profiles.filepath>
/home/mortals/app/data
</profiles.filepath>
<profiles.log.level>
INFO
</profiles.log.level>
<profiles.log.level>
INFO
</profiles.log.level>
<profiles.nacos.server-addr>
1
27.0.0.1
:8848
</profiles.nacos.server-addr>
<profiles.nacos.server-addr>
1
72.15.28.120
:8848
</profiles.nacos.server-addr>
<profiles.nacos.group>
DEFAULT_GROUP
</profiles.nacos.group>
<profiles.nacos.group>
DEFAULT_GROUP
</profiles.nacos.group>
<profiles.nacos.namespace>
smart-gov
</profiles.nacos.namespace>
<profiles.nacos.namespace>
smart-gov
</profiles.nacos.namespace>
<package.environment>
yibin
</package.environment>
<package.environment>
yibin
</package.environment>
...
...
device-manager/src/main/bin/deploy.sh
View file @
40657a89
...
@@ -93,7 +93,7 @@ project_deploy() {
...
@@ -93,7 +93,7 @@ project_deploy() {
project_ui_deploy
()
{
project_ui_deploy
()
{
writelog
"
${
PROJECT_NAME
}
_ui_deploy"
writelog
"
${
PROJECT_NAME
}
_ui_deploy"
clear_ui_deploy
${
PROJECT_UI_EXECPATH
}
clear_ui_deploy
${
PROJECT_UI_EXECPATH
}
tar
-zvx
f
./
${
PROJECT_UI_FILENAME
}
-C
${
PUBLISH_PATH
}
tar
-zvx
./
${
PROJECT_UI_FILENAME
}
-C
${
PUBLISH_PATH
}
writelog
"
${
PROJECT_NAME
}
_ui_deploy_finish"
writelog
"
${
PROJECT_NAME
}
_ui_deploy_finish"
}
}
...
...
device-manager/src/main/java/com/mortals/xhx/busiz/web/DeviceApiController.java
View file @
40657a89
...
@@ -2,6 +2,7 @@ package com.mortals.xhx.busiz.web;
...
@@ -2,6 +2,7 @@ package com.mortals.xhx.busiz.web;
import
cn.hutool.core.net.url.UrlBuilder
;
import
cn.hutool.core.net.url.UrlBuilder
;
import
cn.hutool.core.util.IdUtil
;
import
cn.hutool.core.util.IdUtil
;
import
cn.hutool.core.util.URLUtil
;
import
cn.hutool.extra.servlet.ServletUtil
;
import
cn.hutool.extra.servlet.ServletUtil
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
...
@@ -61,6 +62,7 @@ import org.springframework.util.ObjectUtils;
...
@@ -61,6 +62,7 @@ import org.springframework.util.ObjectUtils;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletRequest
;
import
java.net.URL
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Arrays
;
import
java.util.Date
;
import
java.util.Date
;
...
@@ -137,10 +139,13 @@ public class DeviceApiController {
...
@@ -137,10 +139,13 @@ public class DeviceApiController {
ApiResp
<
DeviceResp
>
rsp
=
new
ApiResp
<>();
ApiResp
<
DeviceResp
>
rsp
=
new
ApiResp
<>();
rsp
.
setCode
(
ApiRespCodeEnum
.
SUCCESS
.
getValue
());
rsp
.
setCode
(
ApiRespCodeEnum
.
SUCCESS
.
getValue
());
DeviceResp
deviceResp
=
new
DeviceResp
();
DeviceResp
deviceResp
=
new
DeviceResp
();
URL
url
=
getServerUrl
();
try
{
try
{
DeviceEntity
deviceEntity
=
checkDeviceExistAndCreate
(
req
);
DeviceEntity
deviceEntity
=
checkDeviceExistAndCreate
(
req
);
DeviceQueueAuthInfo
authInfo
=
new
DeviceQueueAuthInfo
();
DeviceQueueAuthInfo
authInfo
=
new
DeviceQueueAuthInfo
();
authInfo
.
setHost
(
host
);
// authInfo.setHost(host);
authInfo
.
setHost
(
url
.
getHost
());
authInfo
.
setPort
(
port
);
authInfo
.
setPort
(
port
);
authInfo
.
setUsername
(
username
);
authInfo
.
setUsername
(
username
);
authInfo
.
setPassword
(
password
);
authInfo
.
setPassword
(
password
);
...
@@ -214,6 +219,12 @@ public class DeviceApiController {
...
@@ -214,6 +219,12 @@ public class DeviceApiController {
return
JSON
.
toJSONString
(
rsp
);
return
JSON
.
toJSONString
(
rsp
);
}
}
private
static
URL
getServerUrl
()
{
String
domain
=
GlobalSysInfo
.
getParamValue
(
PARAM_SERVER_HTTP_URL
,
"http://192.168.0.98:11091"
);
URL
url
=
URLUtil
.
url
(
domain
);
return
url
;
}
/**
/**
* 获取Token
* 获取Token
...
@@ -376,7 +387,9 @@ public class DeviceApiController {
...
@@ -376,7 +387,9 @@ public class DeviceApiController {
}
}
DeviceQueueAuthInfo
authInfo
=
new
DeviceQueueAuthInfo
();
DeviceQueueAuthInfo
authInfo
=
new
DeviceQueueAuthInfo
();
authInfo
.
setHost
(
host
);
URL
url
=
getServerUrl
();
//authInfo.setHost(host);
authInfo
.
setHost
(
url
.
getHost
());
authInfo
.
setPort
(
port
);
authInfo
.
setPort
(
port
);
authInfo
.
setUsername
(
username
);
authInfo
.
setUsername
(
username
);
authInfo
.
setPassword
(
password
);
authInfo
.
setPassword
(
password
);
...
@@ -837,15 +850,15 @@ public class DeviceApiController {
...
@@ -837,15 +850,15 @@ public class DeviceApiController {
if
(!
ObjectUtils
.
isEmpty
(
deviceEntity
.
getHomeUrl
()))
{
if
(!
ObjectUtils
.
isEmpty
(
deviceEntity
.
getHomeUrl
()))
{
homeUrl
=
deviceEntity
.
getHomeUrl
();
homeUrl
=
deviceEntity
.
getHomeUrl
();
}
}
String
domain
=
GlobalSysInfo
.
getParamValue
(
PARAM_SERVER_HTTP_URL
,
"http://192.168.0.98:11078"
);
log
.
info
(
"domain:"
+
GlobalSysInfo
.
getParamValue
(
PARAM_SERVER_HTTP_URL
,
""
)
);
String
domain
=
GlobalSysInfo
.
getParamValue
(
PARAM_SERVER_HTTP_URL
,
"http://192.168.3.24:11078"
);
serverInfo
.
setHomeUrl
(
UrlBuilder
.
of
(
domain
).
addPath
(
homeUrl
).
toString
());
serverInfo
.
setHomeUrl
(
UrlBuilder
.
of
(
domain
).
addPath
(
homeUrl
).
toString
());
log
.
info
(
"homeurl:"
+
serverInfo
.
getHomeUrl
());
serverInfo
.
setEventUrl
(
productEntity
.
getEventUrl
());
serverInfo
.
setEventUrl
(
productEntity
.
getEventUrl
());
}
}
private
void
buildDownloadUrl
(
ProductVersionEntity
productVersionEntity
,
ProductVersionInfo
productVersionInfo
)
{
private
void
buildDownloadUrl
(
ProductVersionEntity
productVersionEntity
,
ProductVersionInfo
productVersionInfo
)
{
String
download
=
""
;
String
download
=
""
;
if
(!
ObjectUtils
.
isEmpty
(
productVersionEntity
.
getFilePath
()))
{
if
(!
ObjectUtils
.
isEmpty
(
productVersionEntity
.
getFilePath
()))
{
download
=
productVersionEntity
.
getFilePath
();
download
=
productVersionEntity
.
getFilePath
();
}
}
...
...
device-manager/src/main/java/com/mortals/xhx/common/key/Constant.java
View file @
40657a89
...
@@ -77,7 +77,7 @@ public final class Constant {
...
@@ -77,7 +77,7 @@ public final class Constant {
public
final
static
String
BASEMANAGER_VERSION
=
"Z-BASE.MANAGER-S1.0.0"
;
public
final
static
String
BASEMANAGER_VERSION
=
"Z-BASE.MANAGER-S1.0.0"
;
/**
/**
* 服务器http
* 服务器http
映射外网可访问地址
*/
*/
public
final
static
String
PARAM_SERVER_HTTP_URL
=
"server_http_url"
;
public
final
static
String
PARAM_SERVER_HTTP_URL
=
"server_http_url"
;
...
...
device-manager/src/main/java/com/mortals/xhx/daemon/netty/server/controlserver/handler/NettyUDPServerHandler.java
View file @
40657a89
package
com.mortals.xhx.daemon.netty.server.controlserver.handler
;
package
com.mortals.xhx.daemon.netty.server.controlserver.handler
;
import
cn.hutool.core.util.URLUtil
;
import
cn.hutool.core.util.URLUtil
;
import
cn.hutool.extra.spring.SpringUtil
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.mortals.framework.ap.GlobalSysInfo
;
import
com.mortals.framework.ap.GlobalSysInfo
;
...
@@ -56,7 +55,8 @@ public class NettyUDPServerHandler extends SimpleChannelInboundHandler<DatagramP
...
@@ -56,7 +55,8 @@ public class NettyUDPServerHandler extends SimpleChannelInboundHandler<DatagramP
@Override
@Override
protected
void
channelRead0
(
ChannelHandlerContext
ctx
,
DatagramPacket
packet
)
throws
Exception
{
protected
void
channelRead0
(
ChannelHandlerContext
ctx
,
DatagramPacket
packet
)
throws
Exception
{
String
serverPort
=
SpringUtil
.
getProperty
(
"server.port"
);
// String serverPort = SpringUtil.getProperty("server.port");
String
serverPort
=
"11091"
;
ByteBuf
byteBuf
=
packet
.
copy
().
content
();
ByteBuf
byteBuf
=
packet
.
copy
().
content
();
byte
[]
bytes
=
new
byte
[
byteBuf
.
readableBytes
()];
byte
[]
bytes
=
new
byte
[
byteBuf
.
readableBytes
()];
...
@@ -73,17 +73,15 @@ public class NettyUDPServerHandler extends SimpleChannelInboundHandler<DatagramP
...
@@ -73,17 +73,15 @@ public class NettyUDPServerHandler extends SimpleChannelInboundHandler<DatagramP
String
action
=
jsonObject
.
getString
(
"action"
);
String
action
=
jsonObject
.
getString
(
"action"
);
resp
.
setMsg
(
"获取服务端地址成功!"
);
resp
.
setMsg
(
"获取服务端地址成功!"
);
if
(!
ObjectUtils
.
isEmpty
(
action
)
&&
"findserver"
.
equals
(
action
))
{
if
(!
ObjectUtils
.
isEmpty
(
action
)
&&
"findserver"
.
equals
(
action
))
{
String
domain
=
""
;
String
domain
=
GlobalSysInfo
.
getParamValue
(
PARAM_SERVER_HTTP_URL
,
"http://192.168.0.98:11091"
)
;
String
currentIp
=
getInet4Address
();
/*
String currentIp = getInet4Address();
if (currentIp != null) {
if (currentIp != null) {
domain = "http://" + currentIp + ":" + serverPort;
domain = "http://" + currentIp + ":" + serverPort;
} else {
} else {
domain = GlobalSysInfo.getParamValue(PARAM_SERVER_HTTP_URL, "http://192.168.0.98:11091");
domain = GlobalSysInfo.getParamValue(PARAM_SERVER_HTTP_URL, "http://192.168.0.98:11091");
}
}
*/
URL
url
=
URLUtil
.
url
(
domain
);
URL
url
=
URLUtil
.
url
(
domain
);
log
.
info
(
"getServerUrl:"
+
domain
);
log
.
info
(
"getServerUrl:"
+
domain
);
String
deviceRegisterApi
=
servletPath
+
registerApiPath
;
String
deviceRegisterApi
=
servletPath
+
registerApiPath
;
String
deviceInitApi
=
servletPath
+
deviceInitApiPath
;
String
deviceInitApi
=
servletPath
+
deviceInitApiPath
;
String
deviceUpdateApi
=
servletPath
+
deviceUpdateApiPath
;
String
deviceUpdateApi
=
servletPath
+
deviceUpdateApiPath
;
...
@@ -165,14 +163,15 @@ public class NettyUDPServerHandler extends SimpleChannelInboundHandler<DatagramP
...
@@ -165,14 +163,15 @@ public class NettyUDPServerHandler extends SimpleChannelInboundHandler<DatagramP
public
static
void
main
(
String
[]
args
)
{
public
static
void
main
(
String
[]
args
)
{
/*
String domain="http://192.168.0.98:11801";
String
domain
=
"http://192.168.0.98:11801"
;
URL
url
=
URLUtil
.
url
(
domain
);
URL
url
=
URLUtil
.
url
(
domain
);
System
.
out
.
println
(
url
.
getHost
());
System
.
out
.
println
(
url
.
getHost
());
System.out.println(url.getPort());
*/
System
.
out
.
println
(
url
.
getPort
());
InetAddress
currentIp
=
NettyUDPServerHandler
.
getCurrentIp
();
/*
InetAddress currentIp = NettyUDPServerHandler.getCurrentIp();
System.out.println(currentIp.getHostName());
System.out.println(currentIp.getHostName());
System
.
out
.
println
(
getInet4Address
());
System.out.println(getInet4Address());
*/
}
}
}
}
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