From 6b13839488edcd06046e26a41fe897358176689c Mon Sep 17 00:00:00 2001 From: 潘志宝 <979469083@qq.com> Date: 星期五, 13 十二月 2024 17:56:41 +0800 Subject: [PATCH] 采集质量 --- iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/service/impl/DaPointCollectStatusServiceImpl.java | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 43 insertions(+), 0 deletions(-) diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/service/impl/DaPointCollectStatusServiceImpl.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/service/impl/DaPointCollectStatusServiceImpl.java new file mode 100644 index 0000000..74e4931 --- /dev/null +++ b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/service/impl/DaPointCollectStatusServiceImpl.java @@ -0,0 +1,43 @@ +package com.iailab.module.data.point.service.impl; + +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.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 java.util.Date; +import java.util.UUID; + +/** + * @author PanZhibao + * @Description + * @createTime 2024年12月13日 + */ +@Service +public class DaPointCollectStatusServiceImpl extends BaseServiceImpl<DaPointCollectStatusDao, DaPointCollectStatusEntity> + implements DaPointCollectStatusService { + + public void recordStatus(String pointNo, String collectValue, Date collectTime) { + QueryWrapper<DaPointCollectStatusEntity> queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("point_no", pointNo); + DaPointCollectStatusEntity entity = baseDao.selectOne(queryWrapper); + if (entity == null) { + entity = new DaPointCollectStatusEntity(); + entity.setId(UUID.randomUUID().toString()); + entity.setPointNo(pointNo); + entity.setCollectValue(collectValue); + entity.setCollectQuality(DataQualityEnum.getEumByValue(collectValue).getCode()); + entity.setCollectTime(collectTime); + baseDao.insert(entity); + } else { + entity.setCollectValue(collectValue); + entity.setCollectQuality(DataQualityEnum.getEumByValue(collectValue).getCode()); + entity.setCollectTime(collectTime); + baseDao.updateById(entity); + } + + } +} \ No newline at end of file -- Gitblit v1.9.3