已删除1个文件
已修改4个文件
已重命名1个文件
已添加2个文件
| | |
| | | |
| | | import com.iailab.framework.common.constant.CommonConstant; |
| | | import com.iailab.module.data.channel.http.collector.asdb.HttpCollectorForAsdb; |
| | | import com.iailab.module.data.channel.http.collector.asdb.HttpCollectorForAsdc; |
| | | import com.iailab.module.data.channel.http.collector.asdb.HttpCollectorForAsde; |
| | | import com.iailab.module.data.channel.http.collector.asdb.HttpCollectorForAsMediaType; |
| | | import com.iailab.module.data.channel.http.collector.asdb.HttpCollectorForAsdy; |
| | | import com.iailab.module.data.channel.http.collector.ihdb.HttpCollectorForIhd; |
| | | import com.iailab.module.data.channel.http.entity.HttpApiEntity; |
| | |
| | | private HttpCollectorForAsdb httpCollectorForAsdb; |
| | | |
| | | @Autowired |
| | | private HttpCollectorForAsde httpCollectorForAsde; |
| | | |
| | | @Autowired |
| | | private HttpCollectorForAsdc httpCollectorForAsdc; |
| | | private HttpCollectorForAsMediaType httpCollectorForAsMediaType; |
| | | |
| | | @Autowired |
| | | private HttpCollectorForAsdy httpCollectorForAsdy; |
| | |
| | | valueMap = httpCollectorForAsdy.getTagValues(apiId, tagNames); |
| | | break; |
| | | case ASDC: |
| | | valueMap = httpCollectorForAsdc.getTagValues(apiId, tagNames); |
| | | break; |
| | | case ASDE: |
| | | valueMap = httpCollectorForAsde.getTagValues(apiId, tagNames); |
| | | case ASDM: |
| | | valueMap = httpCollectorForAsMediaType.getTagValues(apiId, tagNames); |
| | | break; |
| | | default: |
| | | break; |
| | |
| | | package com.iailab.module.data.channel.http.collector; |
| | | |
| | | import com.iailab.module.data.point.common.ExtremalTypeEnum; |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Getter; |
| | | |
文件名从 iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/collector/asdb/HttpCollectorForAsde.java 修改 |
| | |
| | | import com.iailab.module.data.channel.http.service.HttpApiService; |
| | | import com.iailab.module.data.common.enums.DataSourceType; |
| | | import com.iailab.module.data.common.utils.TagUtils; |
| | | import com.iailab.module.data.point.common.MeasurePointValueType; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.*; |
| | | import java.util.concurrent.TimeUnit; |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Slf4j |
| | | @Component |
| | | public class HttpCollectorForAsde { |
| | | public class HttpCollectorForAsMediaType { |
| | | |
| | | @Autowired |
| | | private HttpApiService httpApiService; |
| | | |
| | | @Autowired |
| | | private RedisTemplate redisTemplate; |
| | | |
| | | @Autowired |
| | | private HttpCollectorForAsag httpCollectorForAsag; |
| | | |
| | | public static final long offset = 10; |
| | | |
| | |
| | | return new HashMap<>(); |
| | | } |
| | | try { |
| | | HttpApiEntity httpApi = this.getHttpApi(params.get(0)[0].toString()); |
| | | this.getByHtp(httpApi.getUrl(), httpApi.getCode(), result, params); |
| | | List<Object[]> paramsDig = new ArrayList<>(); |
| | | List<Object[]> paramsSim = new ArrayList<>(); |
| | | for (Object[] param : params) { |
| | | if (((String) param[3]).equals(MeasurePointValueType.DIGITAL.getCode()) || (Integer) param[2] == 0) { |
| | | paramsDig.add(param); |
| | | } else { |
| | | paramsSim.add(param); |
| | | } |
| | | } |
| | | if (!CollectionUtils.isEmpty(paramsDig)) { |
| | | log.info("查询数字量,paramsDig.size(): " + paramsDig.size()); |
| | | HttpApiEntity httpApi = this.getHttpApi(params.get(0)[0].toString()); |
| | | this.getByHtp(httpApi.getUrl(), httpApi.getCode(), result, paramsDig); |
| | | } |
| | | if (!CollectionUtils.isEmpty(paramsSim)) { |
| | | log.info("查询模拟量,paramsSim.size(): " + paramsSim.size()); |
| | | httpCollectorForAsag.getTagValues(paramsSim, collectTime, result); |
| | | } |
| | | } catch (Exception ex) { |
| | | ex.printStackTrace(); |
| | | } |
| | |
| | | } |
| | | |
| | | private void getByHtp(String url, String sourceName, Map<String, Object> result, List<Object[]> params) { |
| | | log.info("HttpCollectorForAsde.getByHtp:url=" + url); |
| | | log.info("HttpCollectorForAsde.getByHtp:params=" + JSONArray.toJSONString(params)); |
| | | log.info("HttpCollectorForAsMediaType.getByHtp:url=" + url); |
| | | log.info("HttpCollectorForAsMediaType.getByHtp:params=" + JSONArray.toJSONString(params)); |
| | | String responseStr = HttpUtils.sendGet(url, null, ""); |
| | | log.info("HttpCollectorForAsde.getByHtp:responseStr=" + responseStr); |
| | | log.info("HttpCollectorForAsMediaType.getByHtp:responseStr=" + responseStr); |
| | | List<HttpAsdbRespDataVO> dataList = JSON.parseArray(responseStr, HttpAsdbRespDataVO.class); |
| | | Map<String, HttpAsdbRespDataVO> valueGroup = new HashMap<>(); |
| | | for (HttpAsdbRespDataVO data : dataList) { |
对比新文件 |
| | |
| | | package com.iailab.module.data.channel.http.collector.asdb; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | 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; |
| | | import com.iailab.module.data.common.utils.DateUtils; |
| | | import com.iailab.module.data.common.utils.TagUtils; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * 鞍信平均值接口 |
| | | * GET |
| | | * http://10.50.37.1:8806/batch/xxb/getDagongHistoryPointAvg?point=E1Q00001001&startTime=2025-06-25 09:16:00&endTime=2025-06-25 09:17:00 |
| | | * { |
| | | * "E1Q00001001": 16.747500000000002 |
| | | * } |
| | | * |
| | | * @author PanZhibao |
| | | * @Description |
| | | * @createTime 2025年06月27日 |
| | | */ |
| | | @Slf4j |
| | | @Component |
| | | public class HttpCollectorForAsag { |
| | | |
| | | @Autowired |
| | | private HttpApiService httpApiService; |
| | | |
| | | @Autowired |
| | | private RedisTemplate redisTemplate; |
| | | |
| | | public static final long offset = 10; |
| | | |
| | | private final static String API_CODE = "ASAG"; |
| | | |
| | | private static String api_url; |
| | | |
| | | private HttpApiEntity getHttpApi(String id) { |
| | | return httpApiService.getFromCatch(id); |
| | | } |
| | | |
| | | public Map<String, Object> getTagValues(List<Object[]> params, Date collectTime, Map<String, Object> result) { |
| | | try { |
| | | this.getByHtp(result, params, collectTime); |
| | | } catch (Exception ex) { |
| | | log.info("getCurrentValue异常"); |
| | | ex.printStackTrace(); |
| | | throw ex; |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | private void getByHtp(Map<String, Object> result, List<Object[]> params, Date collectTime) { |
| | | if (StringUtils.isBlank(api_url)) { |
| | | HttpApiEntity apiEntity = httpApiService.getByCode(API_CODE); |
| | | api_url = apiEntity.getUrl(); |
| | | } |
| | | for (Object[] item : params) { |
| | | HttpApiEntity httpApi = this.getHttpApi(item[0].toString()); |
| | | String sourceName = httpApi.getCode(); |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(collectTime); |
| | | Date endTime = calendar.getTime(); |
| | | calendar.add(Calendar.MINUTE, (Integer) item[2] * -1); |
| | | Date startTime = calendar.getTime(); |
| | | |
| | | Map<String, String> queryMap = new HashMap<>(); |
| | | String point = item[1].toString(); |
| | | queryMap.put("point", point); |
| | | queryMap.put("startTime", DateUtils.format(startTime, "yyyy-MM-dd HH:mm:ss")); |
| | | queryMap.put("endTime", DateUtils.format(endTime, "yyyy-MM-dd HH:mm:ss")); |
| | | String responseStr = HttpUtils.sendGet(api_url, queryMap, ""); |
| | | JSONObject obj = JSON.parseObject(responseStr); |
| | | if (obj.containsKey(point)) { |
| | | Double value = obj.getDouble(point); |
| | | result.put(TagUtils.genTagId(DataSourceType.HTTP.getCode(), sourceName, point), value); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | import com.iailab.module.data.channel.http.service.HttpApiService; |
| | | import com.iailab.module.data.common.enums.DataSourceType; |
| | | import com.iailab.module.data.common.utils.TagUtils; |
| | | import com.iailab.module.data.point.common.MeasurePointValueType; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | |
| | | |
| | | @Autowired |
| | | private RedisTemplate redisTemplate; |
| | | |
| | | @Autowired |
| | | private HttpCollectorForAsag httpCollectorForAsag; |
| | | |
| | | public static final long offset = 10; |
| | | |
| | |
| | | return new HashMap<>(); |
| | | } |
| | | try { |
| | | HttpApiEntity httpApi = this.getHttpApi(params.get(0)[0].toString()); |
| | | this.getByHtp(httpApi.getUrl(), httpApi.getCode(), result, params); |
| | | List<Object[]> paramsSim = new ArrayList<>(); |
| | | List<Object[]> paramsDig = new ArrayList<>(); |
| | | for (Object[] param : params) { |
| | | if (((String) param[3]).equals(MeasurePointValueType.DIGITAL.getCode()) || (Integer) param[2] == 0) { |
| | | paramsDig.add(param); |
| | | } else { |
| | | paramsSim.add(param); |
| | | } |
| | | } |
| | | if (!CollectionUtils.isEmpty(paramsDig)) { |
| | | log.info("查询数字量,paramsDig.size(): " + paramsDig.size()); |
| | | HttpApiEntity httpApi = this.getHttpApi(params.get(0)[0].toString()); |
| | | this.getByHtp(httpApi.getUrl(), httpApi.getCode(), result, params); |
| | | } |
| | | if (!CollectionUtils.isEmpty(paramsSim)) { |
| | | log.info("查询模拟量,paramsSim.size(): " + paramsSim.size()); |
| | | httpCollectorForAsag.getTagValues(paramsSim, collectTime, result); |
| | | } |
| | | } catch (Exception ex) { |
| | | ex.printStackTrace(); |
| | | } |
| | |
| | | import com.iailab.framework.common.util.string.StrUtils; |
| | | import com.iailab.module.data.channel.http.collector.SourceApiEnum; |
| | | import com.iailab.module.data.channel.http.collector.asdb.HttpCollectorForAsdb; |
| | | import com.iailab.module.data.channel.http.collector.asdb.HttpCollectorForAsdc; |
| | | import com.iailab.module.data.channel.http.collector.asdb.HttpCollectorForAsde; |
| | | import com.iailab.module.data.channel.http.collector.asdb.HttpCollectorForAsMediaType; |
| | | import com.iailab.module.data.channel.http.collector.asdb.HttpCollectorForAsdy; |
| | | import com.iailab.module.data.channel.http.collector.ihdb.HttpCollectorForIhd; |
| | | import com.iailab.module.data.channel.opcda.collector.OpcDACollector; |
| | |
| | | private HttpCollectorForAsdb httpCollectorForAsdb; |
| | | |
| | | @Autowired |
| | | private HttpCollectorForAsde httpCollectorForAsde; |
| | | |
| | | @Autowired |
| | | private HttpCollectorForAsdc httpCollectorForAsdc; |
| | | private HttpCollectorForAsMediaType httpCollectorForAsMediaType; |
| | | |
| | | @Autowired |
| | | private HttpCollectorForAsdy httpCollectorForAsdy; |
| | |
| | | List<Object[]> httpTagAsde = new ArrayList<>(); |
| | | List<Object[]> httpTagAsdc = new ArrayList<>(); |
| | | List<Object[]> httpTagAsdy = new ArrayList<>(); |
| | | List<Object[]> httpTagAsdm = new ArrayList<>(); |
| | | |
| | | dtos.stream().forEach(item -> { |
| | | if (DataSourceType.OPCUA.getCode().equals(item.getSourceType())) { |
| | |
| | | if (item.getTagNo() != null && item.getDimension() != null && item.getValueType() != null) { |
| | | httpTagAsdy.add(new Object[]{item.getSourceId(), item.getTagNo(), item.getDimension(), item.getValueType()}); |
| | | } |
| | | } else if (SourceApiEnum.ASDM.getCode().equals(item.getSourceName())) { |
| | | if (item.getTagNo() != null && item.getDimension() != null && item.getValueType() != null) { |
| | | httpTagAsdm.add(new Object[]{item.getSourceId(), item.getTagNo(), item.getDimension(), item.getValueType()}); |
| | | } |
| | | } |
| | | } |
| | | }); |
| | |
| | | tagValues.putAll(httpCollectorForAsdb.getTagValues(httpTagAsdb, collectTime)); |
| | | } |
| | | if (!CollectionUtils.isEmpty(httpTagAsde)) { |
| | | tagValues.putAll(httpCollectorForAsde.getTagValues(httpTagAsde, collectTime)); |
| | | tagValues.putAll(httpCollectorForAsMediaType.getTagValues(httpTagAsde, collectTime)); |
| | | } |
| | | if (!CollectionUtils.isEmpty(httpTagAsdc)) { |
| | | tagValues.putAll(httpCollectorForAsdc.getTagValues(httpTagAsdc, collectTime)); |
| | | tagValues.putAll(httpCollectorForAsMediaType.getTagValues(httpTagAsdc, collectTime)); |
| | | } |
| | | if (!CollectionUtils.isEmpty(httpTagAsdm)) { |
| | | tagValues.putAll(httpCollectorForAsMediaType.getTagValues(httpTagAsdm, collectTime)); |
| | | } |
| | | if (!CollectionUtils.isEmpty(httpTagAsdy)) { |
| | | tagValues.putAll(httpCollectorForAsdy.getTagValues(httpTagAsdy, collectTime)); |
| | |
| | | } else if (SourceApiEnum.ASDB.getCode().equals(item.getSourceName())) { |
| | | value = httpCollectorForAsdb.getTagValue(item.getSourceId(), item.getTagNo()); |
| | | } else if (SourceApiEnum.ASDE.getCode().equals(item.getSourceName())) { |
| | | value = httpCollectorForAsde.getTagValue(item.getSourceId(), item.getTagNo()); |
| | | value = httpCollectorForAsMediaType.getTagValue(item.getSourceId(), item.getTagNo()); |
| | | } else if (SourceApiEnum.ASDC.getCode().equals(item.getSourceName())) { |
| | | value = httpCollectorForAsdc.getTagValue(item.getSourceId(), item.getTagNo()); |
| | | value = httpCollectorForAsMediaType.getTagValue(item.getSourceId(), item.getTagNo()); |
| | | } else if (SourceApiEnum.ASDM.getCode().equals(item.getSourceName())) { |
| | | value = httpCollectorForAsMediaType.getTagValue(item.getSourceId(), item.getTagNo()); |
| | | } else if (SourceApiEnum.ASDY.getCode().equals(item.getSourceName())) { |
| | | value = httpCollectorForAsdy.getTagValue(item.getSourceId(), item.getTagNo()); |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.data.point.common; |
| | | |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Getter; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @Description |
| | | * @createTime 2025年06月27日 |
| | | */ |
| | | @Getter |
| | | @AllArgsConstructor |
| | | public enum MeasurePointValueType { |
| | | SIMULATE("SIMULATE", "模拟量"), |
| | | DIGITAL("DIGITAL", "数字量"); |
| | | |
| | | private String code; |
| | | private String desc; |
| | | |
| | | public static MeasurePointValueType getEumByCode(String code) { |
| | | if (code == null) { |
| | | return null; |
| | | } |
| | | |
| | | for (MeasurePointValueType statusEnum : MeasurePointValueType.values()) { |
| | | if (statusEnum.getCode().equals(code)) { |
| | | return statusEnum; |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | } |