Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
smf-core
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit e28b51ff
由
LN
编写于
2025-04-07 16:52:17 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
韩华配置界面,ip也可以检查
1 个父辈
61e97bd3
显示空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
49 行增加
和
15 行删除
src/main/java/com/neotel/smfcore/common/utils/HttpHelper.java
src/main/java/com/neotel/smfcore/core/apiInteraction/controller/ApiInteractionController.java
src/main/java/com/neotel/smfcore/core/equipment/rest/EquipConfigController.java
src/main/java/com/neotel/smfcore/custom/panacim/PanaApiController.java
src/main/resources/messages_en_US.properties
src/main/java/com/neotel/smfcore/common/utils/HttpHelper.java
查看文件 @
e28b51f
...
...
@@ -28,6 +28,7 @@ import org.apache.logging.log4j.util.Strings;
import
org.springframework.util.CollectionUtils
;
import
java.io.*
;
import
java.net.InetAddress
;
import
java.net.URI
;
import
java.net.URL
;
import
java.net.URLConnection
;
...
...
@@ -703,5 +704,17 @@ public class HttpHelper {
stringBuffer
.
append
(
paramStr
);
return
stringBuffer
.
toString
();
}
public
static
boolean
pingIP
(
String
ipAddress
,
int
timeout
)
{
try
{
InetAddress
address
=
InetAddress
.
getByName
(
ipAddress
);
if
(
address
.
isReachable
(
timeout
))
{
return
true
;
}
}
catch
(
Exception
e
)
{
log
.
error
(
e
.
toString
());
}
return
false
;
}
}
src/main/java/com/neotel/smfcore/core/apiInteraction/controller/ApiInteractionController.java
查看文件 @
e28b51f
...
...
@@ -55,9 +55,9 @@ public class ApiInteractionController {
List
<
List
<
String
>>
header
=
new
ArrayList
<>();
Locale
locale
=
request
.
getLocale
();
header
.
add
(
Lists
.
newArrayList
(
MessageUtils
.
getText
(
"smfcore.equipApiMsg.updateTime"
,
locale
,
"时间"
)));
header
.
add
(
Lists
.
newArrayList
(
MessageUtils
.
getText
(
"smfcore.equipApiMsg.url"
,
locale
,
"地址"
)));
header
.
add
(
Lists
.
newArrayList
(
MessageUtils
.
getText
(
"smfcore.equipApiMsg.request"
,
locale
,
"参数"
)));
header
.
add
(
Lists
.
newArrayList
(
MessageUtils
.
getText
(
"smfcore.equipApiMsg.response"
,
locale
,
"结果"
)));
header
.
add
(
Lists
.
newArrayList
(
MessageUtils
.
getText
(
"smfcore.equipApiMsg.url"
,
locale
,
"地址"
)));
header
.
add
(
Lists
.
newArrayList
(
MessageUtils
.
getText
(
"smfcore.equipApiMsg.state"
,
locale
,
"状态"
)));
return
header
;
}
...
...
@@ -70,9 +70,9 @@ public class ApiInteractionController {
for
(
ApiInteraction
obj
:
apiInfoList
.
getContent
())
{
List
<
Object
>
data
=
new
ArrayList
<>();
data
.
add
(
DateUtil
.
toDateString
(
obj
.
getRequestDate
()));
data
.
add
(
obj
.
getUrl
());
data
.
add
(
obj
.
getParam
());
data
.
add
(
obj
.
getResult
());
data
.
add
(
obj
.
getUrl
());
data
.
add
(
obj
.
getStatus
());
dataList
.
add
(
data
);
}
...
...
src/main/java/com/neotel/smfcore/core/equipment/rest/EquipConfigController.java
查看文件 @
e28b51f
...
...
@@ -2,6 +2,8 @@ package com.neotel.smfcore.core.equipment.rest;
import
cn.hutool.core.util.ObjectUtil
;
import
com.neotel.smfcore.common.bean.ResultBean
;
import
com.neotel.smfcore.common.utils.Constants
;
import
com.neotel.smfcore.common.utils.HttpHelper
;
import
com.neotel.smfcore.core.equipment.enums.EquipmentType
;
import
com.neotel.smfcore.core.equipment.rest.dto.EquipConfigInfoDto
;
import
com.neotel.smfcore.core.equipment.rest.mapstruct.EquipConfigInfoMapper
;
...
...
@@ -67,15 +69,15 @@ public class EquipConfigController {
if
(
configInfoDto
.
equipType
.
equals
(
EquipmentType
.
T_SOLUTION
.
name
()))
{
EquipConfigInfo
config
=
equipConfigInfoMapper
.
toEntity
(
configInfoDto
);
if
(
configInfoDto
.
apiTestKey
.
equals
(
"webPort"
)
)
{
String
ip
=
config
.
GetConfigValue
(
"host"
,
""
);
int
webPort
=
config
.
GetConfigValue
(
"webPort"
,
0
);
String
webUrl
=
String
.
format
(
"ws://%s:%d/"
,
ip
,
webPort
);
if
(
ObjectUtil
.
isEmpty
(
ip
))
{
return
ResultBean
.
newErrorResult
(
1
,
"smfcore.valueCanotNull"
,
"{0}不能为空"
,
new
String
[]{
"host"
});
}
if
(
ObjectUtil
.
isEmpty
(
webPort
)||
webPort
==
0
)
{
if
(
configInfoDto
.
apiTestKey
.
equals
(
"webPort"
))
{
int
webPort
=
config
.
GetConfigValue
(
"webPort"
,
0
);
String
webUrl
=
String
.
format
(
"ws://%s:%d/"
,
ip
,
webPort
);
if
(
ObjectUtil
.
isEmpty
(
webPort
)
||
webPort
==
0
)
{
return
ResultBean
.
newErrorResult
(
1
,
"smfcore.valueCanotNull"
,
"{0}不能为空"
,
new
String
[]{
"webPort"
});
}
if
(
TMSCommunicator
.
wsURL
.
equals
(
webUrl
))
{
...
...
@@ -83,22 +85,24 @@ public class EquipConfigController {
}
else
{
result
=
tmsApis
.
TestWebSocket
(
ip
,
webPort
);
}
}
else
if
(
configInfoDto
.
apiTestKey
.
equals
(
"host"
))
{
result
=
HttpHelper
.
pingIP
(
ip
,
1000
);
}
else
{
String
ip
=
config
.
GetConfigValue
(
"host"
,
""
);
int
apiPort
=
config
.
GetConfigValue
(
"apiPort"
,
0
);
if
(
ObjectUtil
.
isEmpty
(
ip
))
{
return
ResultBean
.
newErrorResult
(
1
,
"smfcore.valueCanotNull"
,
"{0}不能为空"
,
new
String
[]{
"host"
});
}
if
(
ObjectUtil
.
isEmpty
(
apiPort
)||
apiPort
==
0
)
{
if
(
ObjectUtil
.
isEmpty
(
apiPort
)
||
apiPort
==
0
)
{
return
ResultBean
.
newErrorResult
(
1
,
"smfcore.valueCanotNull"
,
"{0}不能为空"
,
new
String
[]{
"apiPort"
});
}
result
=
tmsApis
.
TestApi
(
ip
,
apiPort
);
result
=
tmsApis
.
TestApi
(
ip
,
apiPort
);
}
}
else
if
(
configInfoDto
.
equipType
.
equals
(
EquipmentType
.
PANACIMNEOLINK
.
name
()))
{
if
(
configInfoDto
.
apiTestKey
.
equals
(
Constants
.
Cache_PanaCIMIP
))
{
result
=
panaApiController
.
TestIp
(
1000
);
}
else
{
result
=
panaApiController
.
TestApi
();
}
}
if
(
result
)
{
...
...
src/main/java/com/neotel/smfcore/custom/panacim/PanaApiController.java
查看文件 @
e28b51f
...
...
@@ -44,6 +44,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
javax.servlet.http.HttpServletRequest
;
import
java.net.InetAddress
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
import
java.util.concurrent.atomic.AtomicLong
;
...
...
@@ -756,4 +757,20 @@ public class PanaApiController extends BaseSmfApiListener {
}
return
false
;
}
public
boolean
TestIp
(
int
timeout
)
{
try
{
if
(
timeout
<=
0
)
{
timeout
=
1000
;
}
InetAddress
address
=
InetAddress
.
getByName
(
PanaCIMIP
);
if
(
address
.
isReachable
(
timeout
))
{
return
true
;
}
}
catch
(
Exception
ex
)
{
log
.
error
(
"TestIp"
+
PanaCIMIP
+
" error :"
+
ex
.
toString
());
}
return
false
;
}
}
src/main/resources/messages_en_US.properties
查看文件 @
e28b51f
...
...
@@ -399,8 +399,8 @@ smfcore.humiture.ntemperature3=Refrigeration zone temperature 3
smfcore.humiture.codetemperature2
=
Cooling Temperature 2
smfcore.humiture.wtemperature
=
Return temperature zone temperature
smfcore.equipconfig.connectTimeout
=
Connection Timeout
smfcore.equipApiMsg.url
=
URL
smfcore.equipApiMsg.url
=
URL
/Source
smfcore.equipApiMsg.request
=
Parameter
smfcore.equipApiMsg.response
=
Result
smfcore.equipApiMsg.response
=
Result
/Details
smfcore.equipApiMsg.updateTime
=
Time
smfcore.equipApiMsg.state
=
Type
\ No newline at end of file
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论