|
@@ -40,22 +40,22 @@ public class OperatingInterfacesDubboServiceImpl implements OperatingInterfacesD
|
|
|
@Resource
|
|
|
private RedisTemplate redisTemplate;
|
|
|
|
|
|
- // private Map<String, InterfacesDTO> map = new HashMap<>();
|
|
|
+ private Map<String, InterfacesDTO> map = new HashMap<>();
|
|
|
|
|
|
@Override
|
|
|
public Result<InterfacesDTO> detailForGateway(String servicePath) {
|
|
|
servicePath = servicePath.replaceAll("/\\d+$", "");
|
|
|
- // InterfacesDTO interfaces = map.get(servicePath);
|
|
|
- // if (null != interfaces) {
|
|
|
- // return Result.success(interfaces);
|
|
|
- // } else {
|
|
|
+ InterfacesDTO interfaces = map.get(servicePath);
|
|
|
+ if (null != interfaces) {
|
|
|
+ return Result.success(interfaces);
|
|
|
+ } else {
|
|
|
// 处理 通配符 * 部分
|
|
|
- // for (String key : map.keySet()) {
|
|
|
- // InterfacesDTO temp = map.get(key);
|
|
|
- // if (key.contains("*") && servicePath.startsWith(key.substring(0, key.indexOf("*")))) {
|
|
|
- // return Result.success(temp);
|
|
|
- // }
|
|
|
- // }
|
|
|
+ for (String key : map.keySet()) {
|
|
|
+ InterfacesDTO temp = map.get(key);
|
|
|
+ if (key.contains("*") && servicePath.startsWith(key.substring(0, key.indexOf("*")))) {
|
|
|
+ return Result.success(temp);
|
|
|
+ }
|
|
|
+ }
|
|
|
// 查询数据库
|
|
|
InterfacesDTO dto = null;
|
|
|
List<Interfaces> all = interfacesService.findAll();
|
|
@@ -93,10 +93,10 @@ public class OperatingInterfacesDubboServiceImpl implements OperatingInterfacesD
|
|
|
.build();
|
|
|
interfacesService.save(build);
|
|
|
dto = InterfacesDTO.generator(build);
|
|
|
- // map.put(servicePath, dto);
|
|
|
+ map.put(servicePath, dto);
|
|
|
return Result.success(dto);
|
|
|
// return Result.fail("未找到接口");
|
|
|
- // }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
|