Commit ba4f7702 authored by 赵啸非's avatar 赵啸非

添加资源扫描接口

No related merge requests found
......@@ -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()));
......
......@@ -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);
}
}
......@@ -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 + "-维护");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment