From 7f0bcd00c556889ba890e5e68c681f1b5d4267e1 Mon Sep 17 00:00:00 2001
From: dengzedong <dengzedong@email>
Date: 星期四, 19 十二月 2024 18:07:20 +0800
Subject: [PATCH] 预测项状态添加模型结果异常

---
 iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/service/impl/DaPointServiceImpl.java |   48 ++++++++++++++++++++++++++++++++++--------------
 1 files changed, 34 insertions(+), 14 deletions(-)

diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/service/impl/DaPointServiceImpl.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/service/impl/DaPointServiceImpl.java
index 000e7e4..b9742f0 100644
--- a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/service/impl/DaPointServiceImpl.java
+++ b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/service/impl/DaPointServiceImpl.java
@@ -9,6 +9,7 @@
 import com.iailab.framework.common.pojo.PageResult;
 import com.iailab.framework.common.util.object.BeanUtils;
 import com.iailab.framework.common.util.object.ConvertUtils;
+import com.iailab.module.data.api.point.dto.ApiPointDTO;
 import com.iailab.module.data.channel.common.service.ChannelSourceService;
 import com.iailab.module.data.common.enums.CommonConstant;
 import com.iailab.module.data.common.enums.IsEnableEnum;
@@ -64,7 +65,10 @@
     @Resource
     private ChannelSourceService channelSourceService;
 
-    private static Map<String, DaPointDTO> pointIdMap = new ConcurrentHashMap<>();
+    @Resource
+    private DaPointCollectStatusService daPointCollectStatusService;
+
+    private static Map<String, ApiPointDTO> pointIdMap = new ConcurrentHashMap<>();
 
     private static Map<String, DaPointDTO> pointNoMap = new ConcurrentHashMap<>();
 
@@ -109,22 +113,22 @@
     }
 
     @Override
-    public DaPointDTO getSimpleInfoById(String id) {
+    public ApiPointDTO getSimpleInfoById(String id) {
         if (pointIdMap.containsKey(id)) {
             return pointIdMap.get(id);
         }
-        DaPointDTO dto = ConvertUtils.sourceToTarget(daPointDao.selectById(id), DaPointDTO.class);
+        ApiPointDTO dto = ConvertUtils.sourceToTarget(daPointDao.selectById(id), ApiPointDTO.class);
         if (dto == null) {
             return null;
         }
         pointIdMap.put(id, dto);
-        return pointIdMap.get(id);
+        return dto;
     }
 
     @Override
     public DaPointDTO getSimpleInfoByNo(String no) {
-        QueryWrapper<DaPointEntity> queryWrapper = new QueryWrapper();
-        queryWrapper.eq("pointNo", no);
+        QueryWrapper<DaPointEntity> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("point_no", no);
         return ConvertUtils.sourceToTarget(daPointDao.selectOne(queryWrapper), DaPointDTO.class);
     }
 
@@ -182,6 +186,7 @@
         daPointEntity.setCreateTime(new Date());
         daPointDao.insert(daPointEntity);
 
+        daPointCollectStatusService.add(daPointEntity.getPointNo());
         // 清空缓存
         clearCache();
     }
@@ -215,10 +220,11 @@
 
     @Override
     @DSTransactional(rollbackFor = Exception.class)
-    public void delete(String[] id) {
-        daPointDao.deleteBatchIds(Arrays.asList(id));
-        daMeasurePointService.deleteByPoint(id);
-        daMathPointService.deleteByPoint(id);
+    public void delete(String[] ids) {
+        daPointDao.deleteBatchIds(Arrays.asList(ids));
+        daMeasurePointService.deleteByPoint(ids);
+        daMathPointService.deleteByPoint(ids);
+        daCumulatePointService.deleteByPoint(ids);
         // 清空缓存
         clearCache();
     }
@@ -319,10 +325,19 @@
 
     @Override
     public List<DaPointDTO> getCumulatePoint(String freq) {
-        Map<String, Object> params = new HashMap<>();
+        Map<String, Object> params = new HashMap<>(3);
         params.put("pointType", PointTypeEnum.CUMULATE.getCode());
         params.put("isEnable", CommonConstant.IS_ENABLE);
         params.put("minfreqid", freq);
+        return daPointDao.getCumulatePoint(params);
+    }
+
+    @Override
+    public List<DaPointDTO> getCumulatePoint(DaPointPageReqVO reqVO) {
+        Map<String, Object> params = new HashMap<>(3);
+        params.put("pointType", PointTypeEnum.CUMULATE.getCode());
+        params.put("pointNo", reqVO.getPointNo());
+        params.put("pointName", reqVO.getPointName());
         return daPointDao.getCumulatePoint(params);
     }
 
@@ -395,11 +410,19 @@
                     case CONSTANT:
                         daPointEntity.setPointNo(daSequenceNumService.getAndIncreaseByCode(IncreaseCodeEnum.POINT_F.name()));
                         break;
+                    case CUMULATE:
+                        DaCumulatePointDTO cumulatePoint = new DaCumulatePointDTO();
+                        cumulatePoint.setMomentPoint(importPoint.getMomentPoint());
+                        cumulatePoint.setLength(importPoint.getLength());
+                        cumulatePoint.setDivisor(importPoint.getDivisor());
+                        daCumulatePointService.add(cumulatePoint, daPointEntity.getId());
+                        daPointEntity.setPointNo(daSequenceNumService.getAndIncreaseByCode(IncreaseCodeEnum.POINT_L.name()));
                     default:
                         break;
                 }
 
                 daPointDao.insert(daPointEntity);
+                daPointCollectStatusService.add(daPointEntity.getPointNo());
                 respVO.getCreatePointnames().add(importPoint.getPointName());
                 return;
             }
@@ -418,9 +441,6 @@
             measurePoint.setSourceId(sourcesIdMap.get(importPoint.getSourceType()).get(importPoint.getSourceName()));
             measurePoint.setTagNo(importPoint.getTagNo());
             daMeasurePointService.update(measurePoint, new QueryWrapper<DaMeasurePointEntity>().eq("point_id",updatePoint.getId()));
-
-
-
             respVO.getUpdatePointnames().add(importPoint.getPointName());
         });
         return respVO;

--
Gitblit v1.9.3