Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
H
haikang-client
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
杨立
haikang-client
Commits
6832128c
提交
6832128c
authored
9月 15, 2021
作者:
wangqiang
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'origin/master'
上级
1cfad9d3
debb9916
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
44 行增加
和
6 行删除
+44
-6
ProgramController.java
...c/main/java/com/priusis/controller/ProgramController.java
+35
-1
application-dev.yml
apq-pc-client/src/main/resources/application-dev.yml
+0
-3
application.yml
apq-pc-client/src/main/resources/application.yml
+9
-2
没有找到文件。
apq-pc-client/src/main/java/com/priusis/controller/ProgramController.java
浏览文件 @
6832128c
...
...
@@ -49,8 +49,13 @@ public class ProgramController {
@Value
(
value
=
"${apq.url.upgrade}"
)
private
String
upgradeUrl
;
@Value
(
value
=
"${apq.url.add-program}"
)
private
String
addProgramUrl
;
private
static
List
<
Map
<
String
,
String
>>
programList
;
private
static
final
double
MIN_MATCH
=
0.5
;
@GetMapping
(
value
=
"{type}/list"
)
public
R
<
Page
<
Map
<
String
,
String
>>>
list
(
@PathVariable
@Pattern
(
regexp
=
"install|upgrade"
)
String
type
,
@RequestParam
(
required
=
false
,
defaultValue
=
"1"
)
Integer
current
,
...
...
@@ -80,7 +85,7 @@ public class ProgramController {
.
entrySet
()
.
stream
()
.
max
(
Map
.
Entry
.
comparingByKey
())
.
filter
(
e
->
e
.
getKey
()
>=
0.5
)
.
filter
(
e
->
e
.
getKey
()
>=
MIN_MATCH
)
.
ifPresent
(
e
->
m
.
put
(
"localVersion"
,
e
.
getValue
())))
.
collect
(
Collectors
.
toList
());
return
R
.
success
(
page
.
setRecords
(
list
));
...
...
@@ -121,6 +126,21 @@ public class ProgramController {
}
}
@GetMapping
(
value
=
"get_version"
)
public
R
<
String
>
getVersion
(
@RequestParam
@NotBlank
String
name
)
throws
IOException
{
if
(
programList
==
null
)
loadProgramListJob
();
return
programList
.
stream
()
.
collect
(
Collectors
.
toMap
(
p
->
StrUtil
.
similar
(
p
.
get
(
"name"
).
toLowerCase
(),
name
.
toLowerCase
()),
p
->
p
.
get
(
"version"
),
(
l
,
r
)
->
r
))
.
entrySet
()
.
stream
()
.
max
(
Map
.
Entry
.
comparingByKey
())
.
filter
(
e
->
e
.
getKey
()
>=
MIN_MATCH
)
.
map
(
Map
.
Entry
::
getValue
)
.
map
(
R:
:
success
)
.
orElseGet
(
R:
:
success
);
}
@Scheduled
(
fixedDelay
=
3000
)
protected
void
loadProgramListJob
()
throws
IOException
{
...
...
@@ -157,4 +177,18 @@ public class ProgramController {
}
return
info
;
}
@Scheduled
(
fixedDelay
=
60000
)
protected
void
addProgram2Platform
()
throws
IOException
{
if
(
programList
==
null
)
loadProgramListJob
();
List
<
String
>
programNames
=
programList
.
stream
().
map
(
p
->
p
.
get
(
"name"
)).
collect
(
Collectors
.
toList
());
String
sn
=
SysConfigUtil
.
getProperty
(
"device.sn"
);
if
(
StrUtil
.
isBlank
(
sn
))
{
log
.
warn
(
"未配置设备SN号"
);
return
;
}
HttpUtil
.
post
(
gateway
+
addProgramUrl
,
JSONUtil
.
createObj
().
set
(
"snNo"
,
sn
).
set
(
"programList"
,
programNames
).
toString
());
}
}
apq-pc-client/src/main/resources/application-dev.yml
浏览文件 @
6832128c
apq
:
iot-gateway
:
192.168.124.19:7002
url
:
install
:
/ops/install/getList?pageNum={}&pageSize={}
upgrade
:
/ops/upgrade/getList?pageNum={}&pageSize={}
apq-pc-client/src/main/resources/application.yml
浏览文件 @
6832128c
...
...
@@ -35,4 +35,12 @@ core:
-
id
:
"
http"
type
:
"
HTTP"
extensionConfiguration
:
http-config.json
\ No newline at end of file
extensionConfiguration
:
http-config.json
apq
:
iot-gateway
:
192.168.124.19:7002
url
:
install
:
/ops/install/getList?pageNum={}&pageSize={}
upgrade
:
/ops/upgrade/getList?pageNum={}&pageSize={}
add-program
:
/ops/program/addFacProgram
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论