|
@@ -101,16 +101,21 @@ public class DqHistoryContrastController {
|
|
BigDecimal dqValue = new BigDecimal(dqHistoryContrastDto.getDqValue());
|
|
BigDecimal dqValue = new BigDecimal(dqHistoryContrastDto.getDqValue());
|
|
BigDecimal realValue = new BigDecimal(dqHistoryContrastDto.getRealValue());
|
|
BigDecimal realValue = new BigDecimal(dqHistoryContrastDto.getRealValue());
|
|
dqHistoryContrastDto.setDqDeviation(dqValue.subtract(realValue).toString());
|
|
dqHistoryContrastDto.setDqDeviation(dqValue.subtract(realValue).toString());
|
|
- BigDecimal ratio = dqValue.subtract(realValue).divide(realValue,3,BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")).stripTrailingZeros();
|
|
|
|
|
|
+ // 先判断实际功率是否为0,为0则偏差比为空
|
|
|
|
+ BigDecimal ratio = null;
|
|
String ratioStr = "";
|
|
String ratioStr = "";
|
|
- if (ratio.compareTo(new BigDecimal("0"))>=0){
|
|
|
|
- ratioStr = "+" + ratio.toPlainString() + "%";
|
|
|
|
|
|
+ if (realValue.compareTo(new BigDecimal("0"))==0){
|
|
}
|
|
}
|
|
else{
|
|
else{
|
|
- ratioStr = ratio.toPlainString() + "%";
|
|
|
|
|
|
+ ratio = dqValue.subtract(realValue).divide(realValue,3,BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")).stripTrailingZeros();
|
|
|
|
+ if (ratio.compareTo(new BigDecimal("0"))>=0){
|
|
|
|
+ ratioStr = "+" + ratio.toPlainString() + "%";
|
|
|
|
+ }
|
|
|
|
+ else{
|
|
|
|
+ ratioStr = ratio.toPlainString() + "%";
|
|
|
|
+ }
|
|
}
|
|
}
|
|
dqHistoryContrastDto.setDqDeviationRatio(ratioStr);
|
|
dqHistoryContrastDto.setDqDeviationRatio(ratioStr);
|
|
-
|
|
|
|
dqpcLineList.add(dqHistoryContrastDto.getDqDeviation());
|
|
dqpcLineList.add(dqHistoryContrastDto.getDqDeviation());
|
|
ratioLineList.add(ratio);
|
|
ratioLineList.add(ratio);
|
|
}
|
|
}
|