| | |
| | | |
| | | public static final String PV = "point_value:"; |
| | | |
| | | public static final long offset = 60 * 3L; |
| | | public static final long offset = 60 * 2L; |
| | | |
| | | /** |
| | | * 采集 |
| | |
| | | List<String> listBad = new ArrayList<>(); |
| | | log.info("读取常量点"); |
| | | List<DaPointDTO> pointConstantList = daPointService.getConstantPoint(minfreq); |
| | | pointValues.addAll(constantHandle.handle(collectTime, pointConstantList, dataMap,listGood,listBad)); |
| | | pointValues.addAll(constantHandle.handle(collectTime, pointConstantList, dataMap, listGood, listBad)); |
| | | |
| | | log.info("读取测量点"); |
| | | List<DaPointDTO> pointMeasureList = daPointService.getMeasurePoint(minfreq); |
| | | pointValues.addAll(measureHandle.handle(collectTime, pointMeasureList, dataMap,listGood,listBad)); |
| | | pointValues.addAll(measureHandle.handle(collectTime, pointMeasureList, dataMap, listGood, listBad)); |
| | | |
| | | log.info("读取计算点"); |
| | | List<DaPointDTO> pointCalculateList = daPointService.getMathPoint(minfreq); |
| | | pointValues.addAll(calculateHandle.handle(collectTime, pointCalculateList, dataMap,listGood,listBad)); |
| | | pointValues.addAll(calculateHandle.handle(collectTime, pointCalculateList, dataMap, listGood, listBad)); |
| | | |
| | | log.info("读取累计点"); |
| | | List<DaPointDTO> pointCumulateList = daPointService.getCumulatePoint(minfreq); |
| | | pointValues.addAll(cumulateHandle.handle(collectTime, pointCumulateList,listGood,listBad)); |
| | | pointValues.addAll(cumulateHandle.handle(collectTime, pointCumulateList, listGood, listBad)); |
| | | |
| | | log.info("存入时序库"); |
| | | influxDBService.asyncWritePointValues(pointValues); |
| | |
| | | } |
| | | } |
| | | log.info("更新采集状态"); |
| | | daPointCollectStatusService.recordStatusList(listGood,listBad, collectTime); |
| | | daPointCollectStatusService.recordStatusList(listGood, listBad, collectTime); |
| | | log.info("采集完成"); |
| | | } catch (Exception ex) { |
| | | log.info("采集异常!"); |
| | |
| | | package com.iailab.module.data.point.collection.handler; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.iailab.framework.common.util.string.StrUtils; |
| | | import com.iailab.module.data.common.enums.CommonConstant; |
| | | import com.iailab.module.data.common.enums.DataTypeEnum; |
| | |
| | | if (CollectionUtils.isEmpty(dtos)) { |
| | | return result; |
| | | } |
| | | log.info(JSON.toJSONString(listBad)); |
| | | dtos.forEach(dto -> { |
| | | try { |
| | | Object value = singleCompute(dto, dataMap, listGood, listBad); |
| | |
| | | |
| | | private Object singleCompute(DaPointDTO dto, Map<String, Object> dataMap,List<String> listGood,List<String> listBad) { |
| | | String expression = dto.getExpression(); |
| | | log.info("PointNo=" + dto.getPointNo() + ";SourceExpression=" + expression); |
| | | String[] arr = expression.split(regex); |
| | | // 判断arr都在dataMap中包含 |
| | | if (!Arrays.stream(arr).allMatch(dataMap::containsKey)) { |
| | | log.info("dataMap not contains key"); |
| | | listBad.add(dto.getPointNo()); |
| | | return CommonConstant.BAD_VALUE; |
| | | } |