| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.iailab.framework.common.service.impl.BaseServiceImpl; |
| | | import com.iailab.module.data.common.enums.DataQualityEnum; |
| | | import com.iailab.module.data.influxdb.pojo.InfluxPointValueDigPOJO; |
| | | import com.iailab.module.data.influxdb.pojo.InfluxPointValuePOJO; |
| | | import com.iailab.module.data.influxdb.pojo.InfluxPointValueSimPOJO; |
| | | import com.iailab.module.data.point.dao.DaPointCollectStatusDao; |
| | | import com.iailab.module.data.point.entity.DaPointCollectStatusEntity; |
| | | import com.iailab.module.data.point.service.DaPointCollectStatusService; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.UUID; |
| | | |
| | | /** |
| | |
| | | } |
| | | |
| | | } |
| | | |
| | | public void recordStatusList(List<InfluxPointValuePOJO> pointValues, Date collectTime) { |
| | | List<String> listGood = new ArrayList<>(); |
| | | List<String> listBad = new ArrayList<>(); |
| | | Object collectValue = null; |
| | | for (InfluxPointValuePOJO pointValue : pointValues) { |
| | | if (pointValue instanceof InfluxPointValueSimPOJO) { |
| | | InfluxPointValueSimPOJO pvo = (InfluxPointValueSimPOJO) pointValue; |
| | | collectValue = pvo.getValue(); |
| | | } else if (pointValue instanceof InfluxPointValueDigPOJO) { |
| | | InfluxPointValueDigPOJO pvo = (InfluxPointValueDigPOJO) pointValue; |
| | | collectValue = pvo.getValue(); |
| | | } else { |
| | | continue; |
| | | } |
| | | switch (DataQualityEnum.getEumByValue(collectValue)) { |
| | | case GOOD: |
| | | listGood.add(pointValue.getPoint()); |
| | | break; |
| | | case BAD: |
| | | listBad.add(pointValue.getPoint()); |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | } |
| | | if (!CollectionUtils.isEmpty(listGood)) { |
| | | QueryWrapper<DaPointCollectStatusEntity> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.in("point_no", listGood); |
| | | DaPointCollectStatusEntity entity = new DaPointCollectStatusEntity(); |
| | | entity.setCollectTime(collectTime); |
| | | entity.setCollectQuality(DataQualityEnum.GOOD.getCode()); |
| | | baseDao.update(entity, queryWrapper); |
| | | } |
| | | if (!CollectionUtils.isEmpty(listBad)) { |
| | | QueryWrapper<DaPointCollectStatusEntity> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.in("point_no", listBad); |
| | | DaPointCollectStatusEntity entity = new DaPointCollectStatusEntity(); |
| | | entity.setCollectTime(collectTime); |
| | | entity.setCollectQuality(DataQualityEnum.BAD.getCode()); |
| | | baseDao.update(entity, queryWrapper); |
| | | } |
| | | } |
| | | } |