| | |
| | | public class NkyServiceImpl implements INkyService { |
| | | |
| | | |
| | | private static final String API_PREFIX = "https://sk.hubeishuiyi.cn/warnIp/"; |
| | | private static final String API_PREFIX = "http://10.42.7.146:9503/"; |
| | | private static final String LOCAL_API_PREFIX = "https://sk.hubeishuiyi.cn/warnIp/"; |
| | | // ARIMA预测接口URL |
| | | private static final String ARIMA_PREDICT = API_PREFIX + "predict/arimaPredict"; |
| | | private static final String ARIMA_PREDICT = LOCAL_API_PREFIX + "predict/arimaPredict"; |
| | | // ARIMA预测结果接口 |
| | | private static final String ARIMA_QUERY = API_PREFIX+"predict/arimaQuery"; |
| | | private static final String ARIMA_QUERY = LOCAL_API_PREFIX+"predict/arimaQuery"; |
| | | // HST预测接口URL |
| | | private static final String HST_PREDICT =API_PREFIX+ "predict/hstPredict"; |
| | | private static final String HST_PREDICT =LOCAL_API_PREFIX+ "predict/hstPredict"; |
| | | // HST预测结果接口 |
| | | private static final String HST_QUERY =API_PREFIX+ "predict/hstQuery"; |
| | | private static final String HST_QUERY =LOCAL_API_PREFIX+ "predict/hstQuery"; |
| | | |
| | | //按库传输数据接口 |
| | | private static final String ORIGIN_BATCHDATA = API_PREFIX + "origin/batchData"; |
| | | private static final String ORIGIN_BATCHDATA = LOCAL_API_PREFIX + "origin/batchData"; |
| | | |
| | | //判定异常 |
| | | private static final String ALARM_GET = API_PREFIX+"alarm/get"; |
| | | private static final String ALARM_GET = LOCAL_API_PREFIX+"alarm/get"; |
| | | |
| | | @Override |
| | | public Boolean arimaPredict(ArimaPredictReqPo po) { |
| | |
| | | @Override |
| | | public HstPredict hstQuery(QueryReqPo po) { |
| | | JSONObject jsonObject = requestNkyApi(HST_QUERY, JSON.toJSONString(po)); |
| | | HstPredict hstPredict = jsonObject.toJavaObject(HstPredict.class); |
| | | return hstPredict; |
| | | if (jsonObject == null){ |
| | | return null; |
| | | } |
| | | JSONArray data = jsonObject.getJSONArray("data"); |
| | | |
| | | if (data.size()>0){ |
| | | HstPredict hstPredict = data.getJSONObject(0).toJavaObject(HstPredict.class); |
| | | return hstPredict; |
| | | |
| | | }else { |
| | | return null; |
| | | } |
| | | |
| | | } |
| | | |
| | | @Override |
| | |
| | | headers.add("Accept", MediaType.APPLICATION_JSON.toString()); |
| | | |
| | | HttpEntity<String> httpEntity = new HttpEntity(jsonparams, headers); |
| | | |
| | | System.out.println("请求参数:"+ jsonparams); |
| | | RestTemplate template = new RestTemplate(); |
| | | String resultStr = template.postForObject(url, httpEntity, String.class); |
| | | System.out.println(resultStr); |