1
zj
2024-07-16 aac94d3eed9fc8f1958a24f06b3ca5c41fe11718
src/main/java/com/nq/service/impl/StockServiceImpl.java
@@ -242,6 +242,28 @@
        return ServerResponse.createBySuccess(map);
    }
    public String doGet(String pid, EStockType eStockType) {
        String apiUrl = eStockType.getStockUrl() + "/indices?country_id="+eStockType.getContryId()+"&key=" + eStockType.getStockKey();
        try {
            URL url = new URL(apiUrl);
            HttpURLConnection connection = (HttpURLConnection) url.openConnection();
            connection.setRequestMethod("GET");
            BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
            String inputLine;
            StringBuffer response = new StringBuffer();
            while ((inputLine = in.readLine()) != null) {
                response.append(inputLine);
            }
            in.close();
            return response.toString();
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }
    public Map getSingleStock(String code) {
        if (StringUtils.isBlank(code))
            return null;