|
@@ -602,7 +602,11 @@ public class InterlockSummaryServiceImpl extends ServiceImpl<InterlockSummaryMap
|
|
String beginDate = beginDateTime.format(formatter); // 开始时间 规定时间的开始时间
|
|
String beginDate = beginDateTime.format(formatter); // 开始时间 规定时间的开始时间
|
|
|
|
|
|
IotedgeCollectData iotedgeData = iotedgeCollectDataService.getOneInfo(dto.getYsmnlDeviceId(),dto.getYsmnlModuleName(),dto.getYsmnlTag(),beginDate);
|
|
IotedgeCollectData iotedgeData = iotedgeCollectDataService.getOneInfo(dto.getYsmnlDeviceId(),dto.getYsmnlModuleName(),dto.getYsmnlTag(),beginDate);
|
|
- BigDecimal beginValue = new BigDecimal(iotedgeData.getValue());
|
|
|
|
|
|
+ BigDecimal beginValue = new BigDecimal("0");
|
|
|
|
+ if(iotedgeData != null){
|
|
|
|
+ beginValue = new BigDecimal(iotedgeData.getValue());
|
|
|
|
+ }
|
|
|
|
+// BigDecimal beginValue = new BigDecimal(iotedgeData.getValue());
|
|
BigDecimal num = ysmnlValue.subtract(beginValue);
|
|
BigDecimal num = ysmnlValue.subtract(beginValue);
|
|
|
|
|
|
// (高限-底限) * 阈值 (数据库中的阈值是去掉百分比的直接乘即可)
|
|
// (高限-底限) * 阈值 (数据库中的阈值是去掉百分比的直接乘即可)
|
|
@@ -611,10 +615,18 @@ public class InterlockSummaryServiceImpl extends ServiceImpl<InterlockSummaryMap
|
|
|
|
|
|
BigDecimal number = upperLimit.subtract(lowerLimit);
|
|
BigDecimal number = upperLimit.subtract(lowerLimit);
|
|
BigDecimal newYz = number.multiply(new BigDecimal(yz));
|
|
BigDecimal newYz = number.multiply(new BigDecimal(yz));
|
|
- BigDecimal nowNum = num.divide(beginValue,2, RoundingMode.HALF_UP);
|
|
|
|
- if ((nowNum.compareTo(newYz)) > 0){
|
|
|
|
|
|
+ BigDecimal orgYz = new BigDecimal(100);//默认增量百分比为百分百
|
|
|
|
+ if(!beginValue.equals(new BigDecimal("0"))){
|
|
|
|
+ orgYz = num.divide(beginValue,2,RoundingMode.HALF_UP);
|
|
|
|
+ }
|
|
|
|
+ if ((orgYz.compareTo(newYz)) > 0){
|
|
dto.setInstrumentStatus(instrumentStatusAbnormal); // 故障
|
|
dto.setInstrumentStatus(instrumentStatusAbnormal); // 故障
|
|
}else dto.setInstrumentStatus(instrumentStatusNormal); // 正常
|
|
}else dto.setInstrumentStatus(instrumentStatusNormal); // 正常
|
|
|
|
+
|
|
|
|
+// BigDecimal nowNum = num.divide(beginValue,2, RoundingMode.HALF_UP);
|
|
|
|
+// if ((nowNum.compareTo(newYz)) > 0){
|
|
|
|
+// dto.setInstrumentStatus(instrumentStatusAbnormal); // 故障
|
|
|
|
+// }else dto.setInstrumentStatus(instrumentStatusNormal); // 正常
|
|
}
|
|
}
|
|
} else if(InterlockAllStatus.INSTRUMENT_STATUS_JUDGE3.equals(dto.getInstrumentStatusJuge())){
|
|
} else if(InterlockAllStatus.INSTRUMENT_STATUS_JUDGE3.equals(dto.getInstrumentStatusJuge())){
|
|
//3默认正常
|
|
//3默认正常
|