test_class.declarator: apiService
test_class.modifier: @Autowired
      private
test_class.original_string: @Autowired
      private ApiService apiService;
test_class.type: ApiService
test_class.var_name: apiService
test_class.file: frame-ucenter/src/test/java/com/blessedbin/frame/ucenter/service/ApiServiceTest.java
test_class.identifier: ApiServiceTest
test_class.superclass: extends FrameUcenterApplicationTests
test_case.body: @Test
      @Transactional
      public void scanApi() {
          apiService.scanApi();
      }
test_case.class_method_signature: ApiServiceTest.scanApi()
test_case.full_signature: @Test @Transactional public void scanApi()
test_case.identifier: scanApi
test_case.invocations: scanApi
test_case.modifiers: @Test @Transactional public
test_case.parameters: ()
test_case.return: void
test_case.signature: void scanApi()
focal_class.declarator: permissionService
focal_class.modifier: @Autowired
      private
focal_class.original_string: @Autowired
      private ISysPermissionService permissionService;
focal_class.type: ISysPermissionService
focal_class.var_name: permissionService
focal_class.declarator: objectMapper
focal_class.modifier: @Autowired
      private
focal_class.original_string: @Autowired
      private ObjectMapper objectMapper;
focal_class.type: ObjectMapper
focal_class.var_name: objectMapper
focal_class.declarator: discoveryClient
focal_class.modifier: @Autowired
      private
focal_class.original_string: @Autowired
      private DiscoveryClient discoveryClient;
focal_class.type: DiscoveryClient
focal_class.var_name: discoveryClient
focal_class.declarator: scanComplete = new AtomicBoolean(true)
focal_class.modifier: private
focal_class.original_string: private AtomicBoolean scanComplete = new AtomicBoolean(true);
focal_class.type: AtomicBoolean
focal_class.var_name: scanComplete
focal_class.file: frame-ucenter/src/main/java/com/blessedbin/frame/ucenter/service/ApiService.java
focal_class.identifier: ApiService
focal_class.class_method_signature: ApiService.scanApi()
focal_class.full_signature: @Transactional(rollbackFor = Exception.class) @Async public void scanApi()
focal_class.identifier: scanApi
focal_class.modifiers: @Transactional(rollbackFor = Exception.class) @Async public
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void scanApi()
focal_class.class_method_signature: ApiService.doMethod(AtomicInteger addPoint, AtomicInteger updatePoint, ServiceInstance instance, String url, Operation operation, String method)
focal_class.full_signature: private void doMethod(AtomicInteger addPoint, AtomicInteger updatePoint, ServiceInstance instance, String url, Operation operation, String method)
focal_class.identifier: doMethod
focal_class.modifiers: private
focal_class.parameters: (AtomicInteger addPoint, AtomicInteger updatePoint, ServiceInstance instance, String url, Operation operation, String method)
focal_class.return: void
focal_class.signature: void doMethod(AtomicInteger addPoint, AtomicInteger updatePoint, ServiceInstance instance, String url, Operation operation, String method)
focal_class.class_method_signature: ApiService.buildApi(String url, String httpMethod, Operation operation,String serviceId, Integer permissionId)
focal_class.full_signature: private SysApi buildApi(String url, String httpMethod, Operation operation,String serviceId, Integer permissionId)
focal_class.identifier: buildApi
focal_class.modifiers: private
focal_class.parameters: (String url, String httpMethod, Operation operation,String serviceId, Integer permissionId)
focal_class.return: SysApi
focal_class.signature: SysApi buildApi(String url, String httpMethod, Operation operation,String serviceId, Integer permissionId)
focal_class.class_method_signature: ApiService.buildPermission(Operation operation, String code)
focal_class.full_signature: private SysPermission buildPermission(Operation operation, String code)
focal_class.identifier: buildPermission
focal_class.modifiers: private
focal_class.parameters: (Operation operation, String code)
focal_class.return: SysPermission
focal_class.signature: SysPermission buildPermission(Operation operation, String code)
focal_class.class_method_signature: ApiService.getDataTables(Integer pageNum, Integer pageSize, List<String> tagList, List<String> serviceIdList)
focal_class.full_signature: public Pagination<SysApi> getDataTables(Integer pageNum, Integer pageSize, List<String> tagList, List<String> serviceIdList)
focal_class.identifier: getDataTables
focal_class.modifiers: public
focal_class.parameters: (Integer pageNum, Integer pageSize, List<String> tagList, List<String> serviceIdList)
focal_class.return: Pagination<SysApi>
focal_class.signature: Pagination<SysApi> getDataTables(Integer pageNum, Integer pageSize, List<String> tagList, List<String> serviceIdList)
focal_class.class_method_signature: ApiService.selectByUuid(String uuid)
focal_class.full_signature: public List<SysApi> selectByUuid(String uuid)
focal_class.identifier: selectByUuid
focal_class.modifiers: public
focal_class.parameters: (String uuid)
focal_class.return: List<SysApi>
focal_class.signature: List<SysApi> selectByUuid(String uuid)
focal_class.class_method_signature: ApiService.selectByMenuId(Integer menuId)
focal_class.full_signature: public List<SysApi> selectByMenuId(Integer menuId)
focal_class.identifier: selectByMenuId
focal_class.modifiers: public
focal_class.parameters: (Integer menuId)
focal_class.return: List<SysApi>
focal_class.signature: List<SysApi> selectByMenuId(Integer menuId)
focal_class.class_method_signature: ApiService.selectAll()
focal_class.full_signature: public List<SysApi> selectAll()
focal_class.identifier: selectAll
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: List<SysApi>
focal_class.signature: List<SysApi> selectAll()
focal_class.class_method_signature: ApiService.selectByPk(Integer permissionId)
focal_class.full_signature: public SysApi selectByPk(Integer permissionId)
focal_class.identifier: selectByPk
focal_class.modifiers: public
focal_class.parameters: (Integer permissionId)
focal_class.return: SysApi
focal_class.signature: SysApi selectByPk(Integer permissionId)
focal_class.class_method_signature: ApiService.getApi(Integer integer)
focal_class.full_signature: public SysApi getApi(Integer integer)
focal_class.identifier: getApi
focal_class.modifiers: public
focal_class.parameters: (Integer integer)
focal_class.return: SysApi
focal_class.signature: SysApi getApi(Integer integer)
focal_class.class_method_signature: ApiService.getApis(List<Integer> ids)
focal_class.full_signature: public List<SysApi> getApis(List<Integer> ids)
focal_class.identifier: getApis
focal_class.modifiers: public
focal_class.parameters: (List<Integer> ids)
focal_class.return: List<SysApi>
focal_class.signature: List<SysApi> getApis(List<Integer> ids)
focal_class.class_method_signature: ApiService.toSysApi(SysPermission permission)
focal_class.full_signature: private SysApi toSysApi(SysPermission permission)
focal_class.identifier: toSysApi
focal_class.modifiers: private
focal_class.parameters: (SysPermission permission)
focal_class.return: SysApi
focal_class.signature: SysApi toSysApi(SysPermission permission)
focal_method.body: @Transactional(rollbackFor = Exception.class)
      @Async
      public void scanApi() {
  
          synchronized (this){
              if(!scanComplete.get()){
                  throw new ServiceRuntimeException("扫描未完成，请稍后重试");
              }
              scanComplete.set(false);
          }
  
          AtomicInteger addPoint = new AtomicInteger();
          AtomicInteger updatePoint = new AtomicInteger();
  
  
          log.info("开始扫描api列表");
          for(String s: discoveryClient.getServices()){
              List<ServiceInstance> serviceInstances = discoveryClient.getInstances(s);
              ServiceInstance instance = serviceInstances.get(0);
              log.debug("获取到服务：{}",s);
  
              // 判断服务是否可用
              URL url1;
              try {
                  String sUrl = instance.getUri() + "/v2/api-docs";
                  url1 = new URL(sUrl);
                  url1.openStream();
  
                  OpenAPI openAPI = new OpenAPIV3Parser().read(sUrl);
                  log.debug("获取到API信息，开始处理.........");
  
                  openAPI.getPaths().keySet().forEach(url -> {
                      PathItem path = openAPI.getPaths().get(url);
  
                      doMethod(addPoint, updatePoint, instance, url, path.getGet(), "GET");
                      doMethod(addPoint, updatePoint, instance, url, path.getPut(), "PUT");
                      doMethod(addPoint, updatePoint, instance, url, path.getPost(), "POST");
                      doMethod(addPoint, updatePoint, instance, url, path.getDelete(), "DELETE");
                      doMethod(addPoint, updatePoint, instance, url, path.getOptions(), "OPTIONS");
                      doMethod(addPoint, updatePoint, instance, url, path.getHead(), "HEAD");
                      doMethod(addPoint, updatePoint, instance, url, path.getPatch(), "PATCH");
                      doMethod(addPoint, updatePoint, instance, url, path.getTrace(), "TRACE");
  
                  });
  
              } catch (Exception e1) {
                  log.debug("未发现api-docs，跳过,message:{}",e1.getMessage());
              }
          }
  
          log.debug(">>> 新增权限点{}个，更新权限点{}个",addPoint.get(),updatePoint.get());
          scanComplete.set(true);
      }
focal_method.class_method_signature: ApiService.scanApi()
focal_method.full_signature: @Transactional(rollbackFor = Exception.class) @Async public void scanApi()
focal_method.identifier: scanApi
focal_method.invocations: get set info getServices getInstances get debug getUri openStream read debug forEach keySet getPaths get getPaths doMethod getGet doMethod getPut doMethod getPost doMethod getDelete doMethod getOptions doMethod getHead doMethod getPatch doMethod getTrace debug ); debug set
focal_method.modifiers: @Transactional(rollbackFor = Exception.class) @Async public
focal_method.parameters: ()
focal_method.return: void
focal_method.signature: void scanApi()