| | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.google.gson.Gson; |
| | | import com.iailab.framework.common.constant.CommonConstant; |
| | | import com.iailab.framework.common.util.http.HttpUtils; |
| | | import com.iailab.module.data.channel.http.entity.HttpApiEntity; |
| | | import com.iailab.module.data.channel.http.service.HttpApiService; |
| | | import com.iailab.module.data.common.enums.DataSourceType; |
| | |
| | | */ |
| | | private static final String T = "t"; |
| | | |
| | | /** |
| | | * 数据质量G:good,B:bad |
| | | */ |
| | | private static final String Q = "q"; |
| | | |
| | | private HttpApiEntity getHttpApi(String id) { |
| | | if (apiMap.containsKey(id)) { |
| | | return apiMap.get(id); |
| | |
| | | tagSb.append(jsonString); |
| | | tagSb.append("]"); |
| | | String currentDate = DateUtils.format(new Date(), pattern); |
| | | String responseStr = HttpRequest.sendPost(httpApi.getUrl() + "/" + currentDate, tagSb.toString()); |
| | | String responseStr = HttpUtils.sendPost(httpApi.getUrl() + "/" + currentDate, tagSb.toString()); |
| | | JSONObject responseObj = JSON.parseObject(responseStr); |
| | | if (STA_TRUE.equals(responseObj.get(IS_SUCCESS).toString())) { |
| | | JSONArray tagValueList = responseObj.getJSONArray("data"); |
| | |
| | | log.info("body=====" + tagSb); |
| | | String currentDate = DateUtils.format(new Date(), pattern); |
| | | String responseStr = ""; |
| | | responseStr = HttpRequest.sendPost(httpApi.getUrl().replace("getPointdatasAvg", "getPointslast") + "/" + currentDate, tagSb); |
| | | responseStr = HttpUtils.sendPost(httpApi.getUrl().replace("getPointdatasAvg", "getPointslast") + "/" + currentDate, tagSb); |
| | | JSONObject responseObj = JSON.parseObject(responseStr); |
| | | if (STA_TRUE.equals(responseObj.get(IS_SUCCESS).toString())) { |
| | | JSONArray tagValueList = responseObj.getJSONArray("data"); |
| | |
| | | tagSb.append("]"); |
| | | log.info("body=====" + tagSb); |
| | | String currentDate = DateUtils.format(collectTime, pattern); |
| | | String responseStr = HttpRequest.sendPost(url + "/" + currentDate, tagSb.toString()); |
| | | String responseStr = HttpUtils.sendPost(url + "/" + currentDate, tagSb.toString()); |
| | | JSONObject responseObj = JSON.parseObject(responseStr); |
| | | log.info("responseObj=====" + responseObj.toJSONString()); |
| | | if (STA_TRUE.equals(responseObj.get(IS_SUCCESS).toString())) { |
| | |
| | | if (!CollectionUtils.isEmpty(tagValueList)) { |
| | | for (int i = 0; i < tagValueList.size(); i++) { |
| | | JSONObject item = tagValueList.getJSONObject(i); |
| | | result.put(TagUtils.genTagId(DataSourceType.HTTP.getCode(), sourceName, item.get(N).toString()), item.get(V)); |
| | | if (item.get(Q).toString().equals("G")) { |
| | | result.put(TagUtils.genTagId(DataSourceType.HTTP.getCode(), sourceName, item.get(N).toString()), item.get(V)); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | tagSb.append("]"); |
| | | log.info("body=====" + tagSb); |
| | | String currentDate = DateUtils.format(collectTime, pattern); |
| | | String responseStr = HttpRequest.sendPost(url + "/" + currentDate, tagSb.toString()); |
| | | String responseStr = HttpUtils.sendPost(url + "/" + currentDate, tagSb.toString()); |
| | | JSONObject responseObj = JSON.parseObject(responseStr); |
| | | log.info("responseObj=====" + responseObj.toJSONString()); |
| | | if (STA_TRUE.equals(responseObj.get(IS_SUCCESS).toString())) { |