| | |
| | | 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; |