Browse Source

新增联锁时新增总表临时表、详细信息临时表数据

LLL 5 months ago
parent
commit
267fbe3162

+ 37 - 7
jeecg-module-interlock/src/main/java/org/jeecg/modules/summary/service/impl/InterlockSummaryServiceImpl.java

@@ -18,6 +18,11 @@ import org.jeecg.modules.summary.mapper.InterlockSummaryMapper;
 import org.jeecg.modules.summary.service.IInterlockSummaryService;
 import org.jeecg.modules.tag.entity.InterlockTag;
 import org.jeecg.modules.tag.service.IInterlockTagService;
+import org.jeecg.modules.temp.convert.TempConvert;
+import org.jeecg.modules.temp.entity.InterlockDetailTemp;
+import org.jeecg.modules.temp.entity.InterlockSummaryTemp;
+import org.jeecg.modules.temp.mapper.InterlockDetailTempMapper;
+import org.jeecg.modules.temp.mapper.InterlockSummaryTempMapper;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -42,6 +47,12 @@ public class InterlockSummaryServiceImpl extends ServiceImpl<InterlockSummaryMap
     private InterlockSummaryMapper interlockSummaryMapper;
     @Autowired
     @SuppressWarnings("all")
+    private InterlockSummaryTempMapper summaryTempMapper;
+    @Autowired
+    @SuppressWarnings("all")
+    private InterlockDetailTempMapper detailTempMapper;
+    @Autowired
+    @SuppressWarnings("all")
     private InterlockDetailMapper interlockDetailMapper;
     @Autowired
     @SuppressWarnings("all")
@@ -150,9 +161,12 @@ public class InterlockSummaryServiceImpl extends ServiceImpl<InterlockSummaryMap
             //联锁状态  0未投用1投用
             if(dto.getIfBypass()!=null ){
                 //是否旁路,0否(手动输入)1是(再看点位)
-                // TODO
-                if("1".equals(dto.getIfBypass())) if(dto.getBypass()!=null && "1".equals(dto.getBypass())) interlockStatus = "0";//旁路状态是多个的话,任何一个旁路是1(是),则联锁状态是0未投用。
-                else if("0".equals(dto.getIfBypass()))  if(dto.getBypass()!=null && "1".equals(dto.getBypass())) interlockStatus = "0";//旁路状态是多个的话,任何一个旁路是1(是),则联锁状态是0未投用。
+                //旁路状态是多个的话,任何一个旁路是1(是),则联锁状态是0未投用。
+                if("1".equals(dto.getIfBypass())) if(dto.getBypass()!=null && "1".equals(dto.getBypass())) interlockStatus = "0";
+                else if("0".equals(dto.getIfBypass())){  //是否旁路,0否(手动输入)
+                    //手动输入1是0否,不输入相当于“无旁路”--看做0否;TODO
+                    if(dto.getBypass()!=null && "1".equals(dto.getBypass())) interlockStatus = "0";
+                }
             }
 
             //仪表状态:0正常1故障
@@ -180,6 +194,9 @@ public class InterlockSummaryServiceImpl extends ServiceImpl<InterlockSummaryMap
 
             //新增联锁详细信息表数据
             interlockDetailMapper.insert(detail);
+            //新增联锁详细信息表临时表数据
+            InterlockDetailTemp detailTemp = TempConvert.INSTANCE.toInterlockDetailTemp(detail);
+            detailTempMapper.insert(detailTemp);
 
             //新增对应联锁详细信息的点位列表
             interlockTagService.saveBatch(toTagList(dto,detail.getId(),summaryId));
@@ -196,6 +213,9 @@ public class InterlockSummaryServiceImpl extends ServiceImpl<InterlockSummaryMap
         InterlockSummary interlockSummary = InterlockSummaryConvert.INSTANCE.toInterlockSummary1(interlockAddDTO,interlockStatus,loopHealthLevel);
         //修改联锁总表数据
         interlockSummaryMapper.updateById(interlockSummary);
+        //新增联锁总表临时表数据
+        InterlockSummaryTemp interlockSummaryTemp = TempConvert.INSTANCE.toInterlockSummaryTemp(interlockSummary);
+        summaryTempMapper.insert(interlockSummaryTemp);
     }
 
     /**
@@ -229,11 +249,15 @@ public class InterlockSummaryServiceImpl extends ServiceImpl<InterlockSummaryMap
         for (InterlockDetailAddDTO dto : interlockDetailAddDTOList){
             dto.setSummaryid(summaryId);
 
-            //联锁状态  0未投用1投用
+            //联锁状态  0未投用1投用; 旁路状态是多个的话,任何一个旁路是1(是),则联锁状态是0未投用。
             if(dto.getIfBypass()!=null ){
-                //是否旁路,0否(手动输入)1是(再看点位)TODO
-                if("1".equals(dto.getIfBypass())) if(dto.getBypass()!=null && "1".equals(dto.getBypass())) interlockStatus = "0";//旁路状态是多个的话,任何一个旁路是1(是),则联锁状态是0未投用。
-                else if("0".equals(dto.getIfBypass()))  if(dto.getBypass()!=null && "1".equals(dto.getBypass())) interlockStatus = "0";//旁路状态是多个的话,任何一个旁路是1(是),则联锁状态是0未投用。
+                //是否旁路,0否(手动输入)1是(再看点位)
+                //旁路状态是多个的话,任何一个旁路是1(是),则联锁状态是0未投用。
+                if("1".equals(dto.getIfBypass())) if(dto.getBypass()!=null && "1".equals(dto.getBypass())) interlockStatus = "0";
+                else if("0".equals(dto.getIfBypass())){  //是否旁路,0否(手动输入)
+                    //手动输入1是0否,不输入相当于“无旁路”--看做0否;TODO
+                    if(dto.getBypass()!=null && "1".equals(dto.getBypass())) interlockStatus = "0";
+                }
             }
 
             //仪表状态:0正常1故障
@@ -260,6 +284,9 @@ public class InterlockSummaryServiceImpl extends ServiceImpl<InterlockSummaryMap
             InterlockDetail detail = InterlockDetailConvert.INSTANCE.toEntity(dto,interlockAddDTO.getInterlockName(), formattedDateTime);
             //新增联锁详细信息表数据
             interlockDetailMapper.insert(detail);
+            //新增联锁详细信息表临时表数据
+            InterlockDetailTemp detailTemp = TempConvert.INSTANCE.toInterlockDetailTemp(detail);
+            detailTempMapper.insert(detailTemp);
 
             //新增对应联锁详细信息的点位列表
             interlockTagService.saveBatch(toTagList(dto,detail.getId(),summaryId));
@@ -276,6 +303,9 @@ public class InterlockSummaryServiceImpl extends ServiceImpl<InterlockSummaryMap
         interlockSummary = InterlockSummaryConvert.INSTANCE.toInterlockSummary2(interlockSummary,interlockStatus,loopHealthLevel);
         //修改联锁总表数据
         interlockSummaryMapper.updateById(interlockSummary);
+        //新增联锁总表临时表数据
+        InterlockSummaryTemp interlockSummaryTemp = TempConvert.INSTANCE.toInterlockSummaryTemp(interlockSummary);
+        summaryTempMapper.insert(interlockSummaryTemp);
     }
 
     private List<InterlockTag> toTagList(InterlockDetailAddDTO dto,String interlockConditionId,String interlockSummaryId){

+ 25 - 0
jeecg-module-interlock/src/main/java/org/jeecg/modules/temp/convert/TempConvert.java

@@ -0,0 +1,25 @@
+package org.jeecg.modules.temp.convert;
+
+import org.jeecg.modules.detail.entity.InterlockDetail;
+import org.jeecg.modules.summary.entity.InterlockSummary;
+import org.jeecg.modules.temp.entity.InterlockDetailTemp;
+import org.jeecg.modules.temp.entity.InterlockSummaryTemp;
+import org.mapstruct.Mapper;
+import org.mapstruct.factory.Mappers;
+
+/**
+ * 功能描述
+ *
+ * @author: nn
+ * @date: 2024年06月05日 15:46
+ */
+@Mapper
+public interface TempConvert {
+
+    TempConvert INSTANCE = Mappers.getMapper(TempConvert.class);
+
+    InterlockDetailTemp toInterlockDetailTemp(InterlockDetail interlockDetail);
+
+    InterlockSummaryTemp toInterlockSummaryTemp(InterlockSummary interlockSummary);
+
+}