|
@@ -303,6 +303,24 @@ public class PostgreSQLClient implements ApplicationRunner {
|
|
tagQuery.eq("interlock_condition_id",id).eq("parameter_type","8");
|
|
tagQuery.eq("interlock_condition_id",id).eq("parameter_type","8");
|
|
InterlockTag interlockTag = tagService.getOne(tagQuery);
|
|
InterlockTag interlockTag = tagService.getOne(tagQuery);
|
|
IotedgeCollectData iotedgeData = iotedgeCollectDataService.getOneInfo(interlockTag.getDeviceId(),interlockTag.getModuleName(),interlockTag.getTagName(),beginDate);
|
|
IotedgeCollectData iotedgeData = iotedgeCollectDataService.getOneInfo(interlockTag.getDeviceId(),interlockTag.getModuleName(),interlockTag.getTagName(),beginDate);
|
|
|
|
+ BigDecimal beginValue = new BigDecimal("0");
|
|
|
|
+ if(iotedgeData != null){
|
|
|
|
+ beginValue = new BigDecimal(iotedgeData.getValue());
|
|
|
|
+ }
|
|
|
|
+ BigDecimal num = BigDecimal.valueOf(Double.parseDouble(ybValueTag)).subtract(beginValue);
|
|
|
|
+ // (高限-底限) * 阈值 (数据库中的阈值是去掉百分比的直接乘即可)
|
|
|
|
+ BigDecimal up = BigDecimal.valueOf(Double.parseDouble(upperLimit));
|
|
|
|
+ BigDecimal lower = BigDecimal.valueOf(Double.parseDouble(lowerLimit));
|
|
|
|
+ BigDecimal number = up.subtract(lower);
|
|
|
|
+ BigDecimal newYz = number.multiply(BigDecimal.valueOf(Double.parseDouble(yz)));
|
|
|
|
+ BigDecimal orgYz = new BigDecimal(100);//默认增量百分比为百分百
|
|
|
|
+ if(!beginValue.equals(new BigDecimal("0"))){
|
|
|
|
+ orgYz = num.divide(beginValue,2,RoundingMode.HALF_UP);
|
|
|
|
+ }
|
|
|
|
+ if ((orgYz.compareTo(newYz)) > 0){
|
|
|
|
+ ybStatus = baseYbAbnormalStatus;
|
|
|
|
+ }
|
|
|
|
+ /*//添加突变超限问题修改之前
|
|
BigDecimal beginValue = BigDecimal.valueOf(Double.parseDouble(iotedgeData.getValue()));
|
|
BigDecimal beginValue = BigDecimal.valueOf(Double.parseDouble(iotedgeData.getValue()));
|
|
BigDecimal num = BigDecimal.valueOf(Double.parseDouble(ybValueTag)).subtract(beginValue);
|
|
BigDecimal num = BigDecimal.valueOf(Double.parseDouble(ybValueTag)).subtract(beginValue);
|
|
// (高限-底限) * 阈值 (数据库中的阈值是去掉百分比的直接乘即可)
|
|
// (高限-底限) * 阈值 (数据库中的阈值是去掉百分比的直接乘即可)
|
|
@@ -314,6 +332,8 @@ public class PostgreSQLClient implements ApplicationRunner {
|
|
if ((nowNum.compareTo(newYz)) > 0){
|
|
if ((nowNum.compareTo(newYz)) > 0){
|
|
ybStatus = baseYbAbnormalStatus;
|
|
ybStatus = baseYbAbnormalStatus;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ */
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|