Browse Source

系统类别从新增联锁条件那里改为放在新增系统中

sl 9 months ago
parent
commit
68dafdc5c8

+ 15 - 0
jeecg-module-interlock/src/main/java/org/jeecg/modules/base/controller/InterlockBaseController.java

@@ -356,4 +356,19 @@ public class InterlockBaseController extends JeecgController<InterlockBase, IInt
 		 return interlockBaseService.listByUser();
 	 }
 
+	 /**
+	  *   添加装置系统
+	  *
+	  * @param interlockBase
+	  * @return
+	  */
+	 @AutoLog(value = "联锁基础表-添加装置系统")
+	 @ApiOperation(value="联锁基础表-添加装置系统", notes="联锁基础表-添加装置系统")
+	 //@RequiresPermissions("org.jeecg.modules:interlock_base:add")
+	 @PostMapping(value = "/addAppSys")
+	 public Result<String> addAppSys(@RequestBody InterlockBase interlockBase) {
+		 interlockBaseService.addInterlockBase1(interlockBase);
+		 return Result.OK("添加成功!");
+	 }
+
 }

+ 15 - 0
jeecg-module-interlock/src/main/java/org/jeecg/modules/base/entity/InterlockBase.java

@@ -111,4 +111,19 @@ public class InterlockBase implements Serializable {
     private java.lang.String iotedgeGroupId;
 
 
+    /**系统类别*/
+//    @Excel(name = "系统类别", width = 15)
+    @ApiModelProperty(value = "系统类别")
+    @Dict(dicCode = "system_type")
+    private java.lang.String systemType;
+    /**高限默认值*/
+//    @Excel(name = "高限默认值", width = 15)
+    @ApiModelProperty(value = "高限默认值")
+    @Dict(dicCode = "upper_limit_default")
+    private java.lang.String upperLimitDefault;
+    /**低限默认值*/
+//    @Excel(name = "低限默认值", width = 15)
+    @ApiModelProperty(value = "低限默认值")
+    @Dict(dicCode = "lower_limit_default")
+    private java.lang.String lowerLimitDefault;
 }

+ 16 - 0
jeecg-module-interlock/src/main/java/org/jeecg/modules/base/entity/InterlockBaseHy.java

@@ -73,4 +73,20 @@ public class InterlockBaseHy implements Serializable {
     @ApiModelProperty(value = "控制系统状态名称")
     private java.lang.String controlSystemStatusName;
 
+    /**系统类别*/
+//    @Excel(name = "系统类别", width = 15)
+    @ApiModelProperty(value = "系统类别")
+    @Dict(dicCode = "system_type")
+    private java.lang.String systemType;
+    /**高限默认值*/
+//    @Excel(name = "高限默认值", width = 15)
+    @ApiModelProperty(value = "高限默认值")
+    @Dict(dicCode = "upper_limit_default")
+    private java.lang.String upperLimitDefault;
+    /**低限默认值*/
+//    @Excel(name = "低限默认值", width = 15)
+    @ApiModelProperty(value = "低限默认值")
+    @Dict(dicCode = "lower_limit_default")
+    private java.lang.String lowerLimitDefault;
+
 }

+ 8 - 0
jeecg-module-interlock/src/main/java/org/jeecg/modules/base/service/IInterlockBaseService.java

@@ -105,4 +105,12 @@ public interface IInterlockBaseService extends IService<InterlockBase> {
 	 *   date: 2024/7/30
 	 */
 	List<InterlockBaseLimit> listByUser();
+
+	/**
+	 * 新增装置系统
+	 *
+	 * @param interlockBase
+	 */
+	void addInterlockBase1(InterlockBase interlockBase);
+
 }

+ 53 - 0
jeecg-module-interlock/src/main/java/org/jeecg/modules/base/service/impl/InterlockBaseServiceImpl.java

@@ -343,4 +343,57 @@ public class InterlockBaseServiceImpl extends ServiceImpl<InterlockBaseMapper, I
     public List<InterlockBaseLimit> listByUser(){
         return interlockBaseMapper.listByUser();
     }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public void addInterlockBase1(InterlockBase interlockBase) {
+        //新增时设置hasChild为0
+        interlockBase.setHasChild(IInterlockBaseService.NOCHILD);
+        if(oConvertUtils.isEmpty(interlockBase.getPid())){
+            interlockBase.setPid(IInterlockBaseService.ROOT_PID_VALUE);
+        }else{
+            //如果当前节点父ID不为空 则设置父节点的hasChildren 为1
+            InterlockBase parent = baseMapper.selectById(interlockBase.getPid());
+            if(parent!=null && !"1".equals(parent.getHasChild())){
+                parent.setHasChild("1");
+                baseMapper.updateById(parent);
+            }
+        }
+        baseMapper.insert(interlockBase);
+
+        // 如果新增的是系统, 同时新增base_hy
+        if(interlockBase.getInterlockType().equals(InterlockAllStatus.INTERLOCK_TYPE_XT)){
+            List<InterlockBaseHy> baseHyList = toBaseHy1(interlockBase);
+            hyService.saveBatch(baseHyList);
+        }
+    }
+
+    private List<InterlockBaseHy> toBaseHy1(InterlockBase base){
+        List<InterlockBaseHy> list = new ArrayList<>();
+        InterlockBaseHy yhy = InterlockBaseConvert.INSTANCE.toInterlockBaseHy(
+                base.getId(),
+                base.getInterlockStatusTy(),
+                base.getInterlockStatusTyName(),
+                base.getBypassYes(),
+                base.getBypassYesName(),
+                base.getInstrumentStatusNormal(),
+                base.getInstrumentStatusNormalName(),
+                base.getControlSystemStatusNormal(),
+                base.getControlSystemStatusNormalName()
+        );
+        list.add(yhy);
+        InterlockBaseHy zhhy = InterlockBaseConvert.INSTANCE.toInterlockBaseHy(
+                base.getId(),
+                zh(base.getInterlockStatusTy()),
+                base.getInterlockStatusWtyName(),
+                zh(base.getBypassYes()),
+                base.getBypassNoName(),
+                zh(base.getInstrumentStatusNormal()),
+                base.getInstrumentStatusAbnormalName(),
+                zh(base.getControlSystemStatusNormal()),
+                base.getControlSystemStatusAbnormalName()
+        );
+        list.add(zhhy);
+        return list;
+    }
 }

+ 6 - 0
jeecg-module-interlock/src/main/java/org/jeecg/modules/detail/dto/InterlockDetailAddDTO.java

@@ -250,4 +250,10 @@ public class InterlockDetailAddDTO {
     private java.lang.String mpStatusPs;
     /**MP状态-名称*/
     private java.lang.String mpStatusName;
+
+    /**系统类别 仪表状态中高低限判断以及突变判断用到*/
+//    @Excel(name = "系统类别", width = 15)
+    @ApiModelProperty(value = "系统类别")
+    @Dict(dicCode = "system_type")
+    private java.lang.String systemType;
 }

+ 6 - 0
jeecg-module-interlock/src/main/java/org/jeecg/modules/detail/entity/InterlockDetail.java

@@ -272,4 +272,10 @@ public class InterlockDetail implements Serializable {
     /**MP状态-名称*/
     private java.lang.String mpStatusName;
 
+    /**系统类别 仪表状态中高低限判断以及突变判断用到*/
+//    @Excel(name = "系统类别", width = 15)
+    @ApiModelProperty(value = "系统类别")
+    @Dict(dicCode = "system_type")
+    private java.lang.String systemType;
+
 }

+ 6 - 0
jeecg-module-interlock/src/main/java/org/jeecg/modules/detail/vo/InterlockDetailEditQueryVO.java

@@ -207,4 +207,10 @@ public class InterlockDetailEditQueryVO {
     @Excel(name = "点位当前时间", width = 15)
     @ApiModelProperty(value = "点位当前时间")
     private java.lang.String tagTime;
+
+    /**系统类别 仪表状态中高低限判断以及突变判断用到*/
+//    @Excel(name = "系统类别", width = 15)
+    @ApiModelProperty(value = "系统类别")
+    @Dict(dicCode = "system_type")
+    private java.lang.String systemType;
 }

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

@@ -299,7 +299,11 @@ public class InterlockSummaryServiceImpl extends ServiceImpl<InterlockSummaryMap
 
                         BigDecimal number = upperLimit.subtract(lowerLimit);
                         BigDecimal newYz = number.multiply(new BigDecimal(yz));
-                        if ((num.divide(beginValue).compareTo(newYz)) > 0){
+//                        if ((num.divide(beginValue).compareTo(newYz)) > 0){
+//                            dto.setInstrumentStatus(instrumentStatusAbnormal); // 故障
+//                        }else dto.setInstrumentStatus(instrumentStatusNormal); // 正常
+                        //有可能出现无限循环小数,保留三位小数
+                        if ((num.divide(beginValue,2,RoundingMode.HALF_UP).compareTo(newYz)) > 0){
                             dto.setInstrumentStatus(instrumentStatusAbnormal); // 故障
                         }else dto.setInstrumentStatus(instrumentStatusNormal); // 正常
                     }
@@ -455,6 +459,7 @@ public class InterlockSummaryServiceImpl extends ServiceImpl<InterlockSummaryMap
             } else dto.setControlSystemStatus(controlSystemStatusNormal); // 正常
 
             InterlockDetail detail = InterlockDetailConvert.INSTANCE.toEntity(dto, interlockAddDTO.getInterlockName(), formattedDateTime, interlockAddDTO.getInterlockSystemId());
+//            detail.setSystemType(dto.getSystemType());
             //新增联锁详细信息表数据
             interlockDetailMapper.insert(detail);
             //新增联锁详细信息表临时表数据