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
ba4f7702
Commit
ba4f7702
authored
1 year ago
by
赵啸非
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加资源扫描接口
parent
3e2c8992
master
reg
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
2 deletions
+13
-2
device-manager/src/main/java/com/mortals/xhx/base/system/resource/service/impl/ResourceServiceImpl.java
...ase/system/resource/service/impl/ResourceServiceImpl.java
+1
-1
device-manager/src/main/java/com/mortals/xhx/busiz/web/DeviceSendMsgController.java
...va/com/mortals/xhx/busiz/web/DeviceSendMsgController.java
+11
-0
device-manager/src/main/java/com/mortals/xhx/common/utils/ControllerScanUtil.java
...java/com/mortals/xhx/common/utils/ControllerScanUtil.java
+1
-1
No files found.
device-manager/src/main/java/com/mortals/xhx/base/system/resource/service/impl/ResourceServiceImpl.java
View file @
ba4f7702
...
...
@@ -93,7 +93,7 @@ public class ResourceServiceImpl extends AbstractCRUDServiceImpl<ResourceDao, Re
public
Rest
<
String
>
refreshResourceUrl
(
String
packageName
,
Context
context
)
{
List
<
Class
<?>>
classList
=
ControllerScanUtil
.
getAllClassByPackageName
(
packageName
);
//System.out.println(classList); //获取到了所有的类
List
<
ResourceEntity
>
newResourcelist
=
ControllerScanUtil
.
getAnnotationInfo
(
classList
);
List
<
ResourceEntity
>
newResourcelist
=
ControllerScanUtil
.
getAnnotationInfo
(
classList
)
.
stream
().
filter
(
f
->!
ObjectUtils
.
isEmpty
(
f
.
getUrl
())).
collect
(
Collectors
.
toList
())
;
Map
<
String
,
List
<
ResourceEntity
>>
localResourceMap
=
this
.
find
(
new
ResourceQuery
()).
stream
().
collect
(
Collectors
.
groupingBy
(
x
->
x
.
getName
()));
Map
<
String
,
List
<
ResourceEntity
>>
newResourceMap
=
newResourcelist
.
stream
().
collect
(
Collectors
.
groupingBy
(
x
->
x
.
getName
()));
...
...
This diff is collapsed.
Click to expand it.
device-manager/src/main/java/com/mortals/xhx/busiz/web/DeviceSendMsgController.java
View file @
ba4f7702
...
...
@@ -3,6 +3,7 @@ package com.mortals.xhx.busiz.web;
import
cn.hutool.core.codec.Base64
;
import
cn.hutool.core.collection.ListUtil
;
import
cn.hutool.core.util.IdUtil
;
import
cn.hutool.core.util.StrUtil
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.mortals.framework.annotation.UnAuth
;
...
...
@@ -167,5 +168,15 @@ public class DeviceSendMsgController {
return
JSON
.
toJSONString
(
rsp
);
}
public
static
void
main
(
String
[]
args
)
{
String
input
=
"/example/path/to/file"
;
// 去掉开头和结尾的 \
String
result
=
StrUtil
.
removeSuffix
(
StrUtil
.
removePrefix
(
input
,
"/"
),
"/"
);
System
.
out
.
println
(
"处理前: "
+
input
);
System
.
out
.
println
(
"处理后: "
+
result
);
}
}
This diff is collapsed.
Click to expand it.
device-manager/src/main/java/com/mortals/xhx/common/utils/ControllerScanUtil.java
View file @
ba4f7702
...
...
@@ -73,7 +73,7 @@ public class ControllerScanUtil {
if
(
ObjectUtils
.
isEmpty
(
result
))
{
if
(
requestMappingCls
!=
null
)
{
result
=
requestMappingCls
.
value
()[
0
].
toUpperCase
(
)
+
"接口模块"
;
result
=
StrUtil
.
removeSuffix
(
StrUtil
.
removePrefix
(
requestMappingCls
.
value
()[
0
].
toUpperCase
(),
"/"
),
"/"
)
+
"接口模块"
;
}
resourceViewEntity
.
setName
(
result
+
"-查看"
);
resourceEditEntity
.
setName
(
result
+
"-维护"
);
...
...
This diff is collapsed.
Click to expand it.
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