From 0ed8ac1f3171e0d43d07f0c1bac32fc3712bd15b Mon Sep 17 00:00:00 2001
From: 潘志宝 <979469083@qq.com>
Date: 星期五, 29 十一月 2024 13:20:46 +0800
Subject: [PATCH] 累计点配置

---
 iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/service/impl/DaPointServiceImpl.java |   55 ++++++++++++++++++++++++++++++++++++++-----------------
 1 files changed, 38 insertions(+), 17 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 59c5821..c5b0f3d 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
@@ -15,18 +15,18 @@
 import com.iailab.module.data.common.enums.IncreaseCodeEnum;
 import com.iailab.module.data.point.common.PointTypeEnum;
 import com.iailab.module.data.point.dao.DaPointDao;
+import com.iailab.module.data.point.dto.DaCumulatePointDTO;
+import com.iailab.module.data.point.dto.DaMathPointDTO;
 import com.iailab.module.data.point.dto.DaMeasurePointDTO;
 import com.iailab.module.data.point.dto.DaPointDTO;
 import com.iailab.module.data.point.entity.DaMeasurePointEntity;
 import com.iailab.module.data.point.entity.DaPointEntity;
-import com.iailab.module.data.point.service.DaMathPointService;
-import com.iailab.module.data.point.service.DaMeasurePointService;
-import com.iailab.module.data.point.service.DaPointService;
-import com.iailab.module.data.point.service.DaSequenceNumService;
+import com.iailab.module.data.point.service.*;
 import com.iailab.module.data.point.vo.DaPointPageReqVO;
 import com.iailab.module.data.point.vo.PointImportExcelVO;
 import com.iailab.module.data.point.vo.PointImportRespVO;
 import org.apache.commons.lang3.ObjectUtils;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.util.CollectionUtils;
 
@@ -46,13 +46,16 @@
 @Service
 public class DaPointServiceImpl extends ServiceImpl<DaPointDao, DaPointEntity> implements DaPointService {
 
-    @Resource
+    @Autowired
     private DaMeasurePointService daMeasurePointService;
 
-    @Resource
+    @Autowired
     private DaMathPointService daMathPointService;
 
-    @Resource
+    @Autowired
+    private DaCumulatePointService daCumulatePointService;
+
+    @Autowired
     private DaSequenceNumService daSequenceNumService;
     
     @Resource
@@ -80,16 +83,27 @@
     public DaPointDTO info(String id) {
         DaPointEntity entity = daPointDao.selectById(id);
         DaPointDTO result = ConvertUtils.sourceToTarget(entity, DaPointDTO.class);
-        if (PointTypeEnum.MEASURE_POINT.getCode().equals(result.getPointType())) {
-            DaMeasurePointDTO measurePoint = daMeasurePointService.getByPoint(id);
-            result.setMeasurePoint(measurePoint);
-            List<String> sourceOption = new ArrayList<>();
-            sourceOption.add(measurePoint.getSourceType());
-            sourceOption.add(measurePoint.getSourceId());
-            sourceOption.add(measurePoint.getTagNo());
-            result.setSourceOption(sourceOption);
-        } else if (PointTypeEnum.CALCULATE_POINT.getCode().equals(result.getPointType())) {
-            result.setMathPoint(daMathPointService.getByPoint(id));
+        result.setMeasurePoint(new DaMeasurePointDTO());
+        result.setMathPoint(new DaMathPointDTO());
+        result.setCumulatePoint(new DaCumulatePointDTO());
+        switch (PointTypeEnum.getEumByCode(result.getPointType())) {
+            case MEASURE_POINT:
+                DaMeasurePointDTO measurePoint = daMeasurePointService.getByPoint(id);
+                result.setMeasurePoint(measurePoint);
+                List<String> sourceOption = new ArrayList<>();
+                sourceOption.add(measurePoint.getSourceType());
+                sourceOption.add(measurePoint.getSourceId());
+                sourceOption.add(measurePoint.getTagNo());
+                result.setSourceOption(sourceOption);
+                break;
+            case CALCULATE_POINT:
+                result.setMathPoint(daMathPointService.getByPoint(id));
+                break;
+            case CUMULATE:
+                result.setCumulatePoint(daCumulatePointService.getByPoint(id));
+                break;
+            default:
+                break;
         }
         return result;
     }
@@ -157,6 +171,10 @@
             case CONSTANT:
                 daPointEntity.setPointNo(daSequenceNumService.getAndIncreaseByCode(IncreaseCodeEnum.POINT_F.name()));
                 break;
+            case CUMULATE:
+                daCumulatePointService.add(dataPoint.getCumulatePoint(), daPointEntity.getId());
+                daPointEntity.setPointNo(daSequenceNumService.getAndIncreaseByCode(IncreaseCodeEnum.POINT_L.name()));
+                break;
             default:
                 break;
         }
@@ -185,6 +203,9 @@
             case CALCULATE_POINT:
                 daMathPointService.update(dataPoint.getMathPoint());
                 break;
+            case CUMULATE:
+                daCumulatePointService.update(dataPoint.getCumulatePoint());
+                break;
             default:
                 break;
         }

--
Gitblit v1.9.3