| | |
| | | import com.alibaba.nacos.api.exception.NacosException; |
| | | import com.alibaba.nacos.api.naming.NamingService; |
| | | import com.alibaba.nacos.api.naming.pojo.Instance; |
| | | import com.alibaba.nacos.api.naming.pojo.ServiceInfo; |
| | | import com.vci.ubcs.common.constant.LauncherConstant; |
| | | import com.vci.ubcs.omd.dto.BtmAndLinkTypeDdlDTO; |
| | | import com.vci.ubcs.omd.vo.BtmTypeVO; |
| | | import com.vci.ubcs.omd.vo.DomainVO; |
| | | import com.vci.ubcs.omd.vo.LinkTypeVO; |
| | | import com.vci.ubcs.starter.web.enumpck.NewAppConstantEnum; |
| | | import org.springblade.core.launch.constant.AppConstant; |
| | | import org.springblade.core.secure.utils.AuthUtil; |
| | | import org.springblade.core.tool.api.R; |
| | | import org.springblade.core.tool.utils.StringPool; |
| | | import org.springblade.core.tool.utils.StringUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.http.*; |
| | | import org.springframework.stereotype.Component; |
| | |
| | | * @return 不包含默认服务的其他服务 |
| | | * @throws NacosException |
| | | */ |
| | | public static List<String> getDomain() throws NacosException { |
| | | public static List<DomainVO> getDomain() throws NacosException { |
| | | RestTemplate restTemplate = new RestTemplate(); |
| | | String url = "http://" +LauncherConstant.NACOS_DEV_ADDR + "/nacos/v1/ns/service/list?pageNo=1&pageSize=50"; |
| | | String forObject = restTemplate.getForObject(url, String.class); |
| | | JSONObject jsonObject = JSON.parseObject(forObject); |
| | | return (List<String>) jsonObject.get("doms"); |
| | | List<String> doms = (List<String>) jsonObject.get("doms"); |
| | | NewAppConstantEnum[] apps = NewAppConstantEnum.values(); |
| | | return Arrays.stream(apps).filter(app -> doms.stream().anyMatch(s -> StringUtil.equals(app.getName(), s))).map(app -> { |
| | | DomainVO domain = new DomainVO(); |
| | | domain.setValue(app.getName()); |
| | | domain.setLabel(app.getText()); |
| | | return domain; |
| | | }).collect(Collectors.toList()); |
| | | } |
| | | } |