|
@@ -75,7 +75,6 @@ public class AsyncTask {
|
|
|
log.error("-------------------------------更新预测准确度的时候异常,异常信息为{}", e.getMessage());
|
|
|
}
|
|
|
log.info("进入了定时任务保存工业库数据并触发报警操作");
|
|
|
-// tXinyiIndustry.setCsTn(new BigDecimal(17));
|
|
|
//获取配置表
|
|
|
List<TXinyiNormConfig> tXinyiNormConfigs = this.xinyiNormConfigMapper.selectTXinyiNormConfigList(null);
|
|
|
if(CollectionUtils.isEmpty(tXinyiNormConfigs))
|
|
@@ -114,22 +113,28 @@ public class AsyncTask {
|
|
|
if("cod".equals(tXinyiForecastComparison.getCategory())){
|
|
|
tXinyiForecastComparison.setRealOne(csCod);
|
|
|
if(!Objects.isNull(csCod) && csCod.compareTo(BigDecimal.ZERO) > 0){
|
|
|
- tXinyiForecastComparison.setHsErrorRateOne((csCod.subtract(hsForecastOne)).divide(csCod, NUMBER_SCALE_4, RoundingMode.HALF_UP));
|
|
|
- tXinyiForecastComparison.setYyErrorRateOne((csCod.subtract(yyForecastOne)).divide(csCod, NUMBER_SCALE_4, RoundingMode.HALF_UP));
|
|
|
+ if(!Objects.isNull(hsForecastOne))
|
|
|
+ tXinyiForecastComparison.setHsErrorRateOne((csCod.subtract(hsForecastOne)).divide(csCod, NUMBER_SCALE_4, RoundingMode.HALF_UP));
|
|
|
+ if(!Objects.isNull(yyForecastOne))
|
|
|
+ tXinyiForecastComparison.setYyErrorRateOne((csCod.subtract(yyForecastOne)).divide(csCod, NUMBER_SCALE_4, RoundingMode.HALF_UP));
|
|
|
}
|
|
|
}
|
|
|
if("ss".equals(tXinyiForecastComparison.getCategory())){
|
|
|
tXinyiForecastComparison.setRealOne(csSs);
|
|
|
if(!Objects.isNull(csSs) && csSs.compareTo(BigDecimal.ZERO) > 0){
|
|
|
- tXinyiForecastComparison.setHsErrorRateOne((csSs.subtract(hsForecastOne)).divide(csSs, NUMBER_SCALE_4, RoundingMode.HALF_UP));
|
|
|
- tXinyiForecastComparison.setYyErrorRateOne((csSs.subtract(yyForecastOne)).divide(csSs, NUMBER_SCALE_4, RoundingMode.HALF_UP));
|
|
|
+ if(!Objects.isNull(hsForecastOne))
|
|
|
+ tXinyiForecastComparison.setHsErrorRateOne((csSs.subtract(hsForecastOne)).divide(csSs, NUMBER_SCALE_4, RoundingMode.HALF_UP));
|
|
|
+ if(!Objects.isNull(yyForecastOne))
|
|
|
+ tXinyiForecastComparison.setYyErrorRateOne((csSs.subtract(yyForecastOne)).divide(csSs, NUMBER_SCALE_4, RoundingMode.HALF_UP));
|
|
|
}
|
|
|
}
|
|
|
if("tn".equals(tXinyiForecastComparison.getCategory())){
|
|
|
tXinyiForecastComparison.setRealOne(csTn);
|
|
|
if(!Objects.isNull(csTn) && csTn.compareTo(BigDecimal.ZERO) > 0){
|
|
|
- tXinyiForecastComparison.setHsErrorRateOne((csTn.subtract(hsForecastOne)).divide(csTn, NUMBER_SCALE_4, RoundingMode.HALF_UP));
|
|
|
- tXinyiForecastComparison.setYyErrorRateOne((csTn.subtract(yyForecastOne)).divide(csTn, NUMBER_SCALE_4, RoundingMode.HALF_UP));
|
|
|
+ if(!Objects.isNull(hsForecastOne))
|
|
|
+ tXinyiForecastComparison.setHsErrorRateOne((csTn.subtract(hsForecastOne)).divide(csTn, NUMBER_SCALE_4, RoundingMode.HALF_UP));
|
|
|
+ if(!Objects.isNull(yyForecastOne))
|
|
|
+ tXinyiForecastComparison.setYyErrorRateOne((csTn.subtract(yyForecastOne)).divide(csTn, NUMBER_SCALE_4, RoundingMode.HALF_UP));
|
|
|
}
|
|
|
}
|
|
|
//2024年6月20日11:16:55 出水总磷的真实值从化验室获取
|
|
@@ -143,8 +148,10 @@ public class AsyncTask {
|
|
|
if("nh3".equals(tXinyiForecastComparison.getCategory())){
|
|
|
tXinyiForecastComparison.setRealOne(csNh3);
|
|
|
if(!Objects.isNull(csNh3) && csNh3.compareTo(BigDecimal.ZERO) > 0){
|
|
|
- tXinyiForecastComparison.setHsErrorRateOne((csNh3.subtract(hsForecastOne)).divide(csNh3, NUMBER_SCALE_4, RoundingMode.HALF_UP));
|
|
|
- tXinyiForecastComparison.setYyErrorRateOne((csNh3.subtract(yyForecastOne)).divide(csNh3, NUMBER_SCALE_4, RoundingMode.HALF_UP));
|
|
|
+ if(!Objects.isNull(hsForecastOne))
|
|
|
+ tXinyiForecastComparison.setHsErrorRateOne((csNh3.subtract(hsForecastOne)).divide(csNh3, NUMBER_SCALE_4, RoundingMode.HALF_UP));
|
|
|
+ if(!Objects.isNull(yyForecastOne))
|
|
|
+ tXinyiForecastComparison.setYyErrorRateOne((csNh3.subtract(yyForecastOne)).divide(csNh3, NUMBER_SCALE_4, RoundingMode.HALF_UP));
|
|
|
}
|
|
|
}
|
|
|
this.xinyiForecastComparisonMapper.updateTXinyiForecastComparison(tXinyiForecastComparison);
|
|
@@ -159,22 +166,28 @@ public class AsyncTask {
|
|
|
if("cod".equals(tXinyiForecastComparison.getCategory())){
|
|
|
tXinyiForecastComparison.setRealTwo(csCod);
|
|
|
if(!Objects.isNull(csCod) && csCod.compareTo(BigDecimal.ZERO) > 0){
|
|
|
- tXinyiForecastComparison.setHsErrorRateTwo((csCod.subtract(hsForecastTwo)).divide(csCod, NUMBER_SCALE_4, RoundingMode.HALF_UP));
|
|
|
- tXinyiForecastComparison.setYyErrorRateTwo((csCod.subtract(yyForecastTwo)).divide(csCod, NUMBER_SCALE_4, RoundingMode.HALF_UP));
|
|
|
+ if(!Objects.isNull(hsForecastTwo))
|
|
|
+ tXinyiForecastComparison.setHsErrorRateTwo((csCod.subtract(hsForecastTwo)).divide(csCod, NUMBER_SCALE_4, RoundingMode.HALF_UP));
|
|
|
+ if(!Objects.isNull(yyForecastTwo))
|
|
|
+ tXinyiForecastComparison.setYyErrorRateTwo((csCod.subtract(yyForecastTwo)).divide(csCod, NUMBER_SCALE_4, RoundingMode.HALF_UP));
|
|
|
}
|
|
|
}
|
|
|
if("ss".equals(tXinyiForecastComparison.getCategory())){
|
|
|
tXinyiForecastComparison.setRealTwo(csSs);
|
|
|
if(!Objects.isNull(csSs) && csSs.compareTo(BigDecimal.ZERO) > 0){
|
|
|
- tXinyiForecastComparison.setHsErrorRateTwo((csSs.subtract(hsForecastTwo)).divide(csSs, NUMBER_SCALE_4, RoundingMode.HALF_UP));
|
|
|
- tXinyiForecastComparison.setYyErrorRateTwo((csSs.subtract(yyForecastTwo)).divide(csSs, NUMBER_SCALE_4, RoundingMode.HALF_UP));
|
|
|
+ if(!Objects.isNull(hsForecastTwo))
|
|
|
+ tXinyiForecastComparison.setHsErrorRateTwo((csSs.subtract(hsForecastTwo)).divide(csSs, NUMBER_SCALE_4, RoundingMode.HALF_UP));
|
|
|
+ if(!Objects.isNull(yyForecastTwo))
|
|
|
+ tXinyiForecastComparison.setYyErrorRateTwo((csSs.subtract(yyForecastTwo)).divide(csSs, NUMBER_SCALE_4, RoundingMode.HALF_UP));
|
|
|
}
|
|
|
}
|
|
|
if("tn".equals(tXinyiForecastComparison.getCategory())){
|
|
|
tXinyiForecastComparison.setRealTwo(csTn);
|
|
|
if(!Objects.isNull(csTn) && csTn.compareTo(BigDecimal.ZERO) > 0){
|
|
|
- tXinyiForecastComparison.setHsErrorRateTwo((csTn.subtract(hsForecastTwo)).divide(csTn, NUMBER_SCALE_4, RoundingMode.HALF_UP));
|
|
|
- tXinyiForecastComparison.setYyErrorRateTwo((csTn.subtract(yyForecastTwo)).divide(csTn, NUMBER_SCALE_4, RoundingMode.HALF_UP));
|
|
|
+ if(!Objects.isNull(hsForecastTwo))
|
|
|
+ tXinyiForecastComparison.setHsErrorRateTwo((csTn.subtract(hsForecastTwo)).divide(csTn, NUMBER_SCALE_4, RoundingMode.HALF_UP));
|
|
|
+ if(!Objects.isNull(yyForecastTwo))
|
|
|
+ tXinyiForecastComparison.setYyErrorRateTwo((csTn.subtract(yyForecastTwo)).divide(csTn, NUMBER_SCALE_4, RoundingMode.HALF_UP));
|
|
|
}
|
|
|
}
|
|
|
//2024年6月20日11:16:55 出水总磷的真实值从化验室获取
|
|
@@ -188,8 +201,10 @@ public class AsyncTask {
|
|
|
if("nh3".equals(tXinyiForecastComparison.getCategory())){
|
|
|
tXinyiForecastComparison.setRealTwo(csNh3);
|
|
|
if(!Objects.isNull(csNh3) && csNh3.compareTo(BigDecimal.ZERO) > 0){
|
|
|
- tXinyiForecastComparison.setHsErrorRateTwo((csNh3.subtract(hsForecastTwo)).divide(csNh3, NUMBER_SCALE_4, RoundingMode.HALF_UP));
|
|
|
- tXinyiForecastComparison.setYyErrorRateTwo((csNh3.subtract(yyForecastTwo)).divide(csNh3, NUMBER_SCALE_4, RoundingMode.HALF_UP));
|
|
|
+ if(!Objects.isNull(hsForecastTwo))
|
|
|
+ tXinyiForecastComparison.setHsErrorRateTwo((csNh3.subtract(hsForecastTwo)).divide(csNh3, NUMBER_SCALE_4, RoundingMode.HALF_UP));
|
|
|
+ if(!Objects.isNull(yyForecastTwo))
|
|
|
+ tXinyiForecastComparison.setYyErrorRateTwo((csNh3.subtract(yyForecastTwo)).divide(csNh3, NUMBER_SCALE_4, RoundingMode.HALF_UP));
|
|
|
}
|
|
|
}
|
|
|
this.xinyiForecastComparisonMapper.updateTXinyiForecastComparison(tXinyiForecastComparison);
|
|
@@ -204,22 +219,28 @@ public class AsyncTask {
|
|
|
if("cod".equals(tXinyiForecastComparison.getCategory())){
|
|
|
tXinyiForecastComparison.setRealThree(csCod);
|
|
|
if(!Objects.isNull(csCod) && csCod.compareTo(BigDecimal.ZERO) > 0){
|
|
|
- tXinyiForecastComparison.setHsErrorRateThree((csCod.subtract(hsForecastThree)).divide(csCod, NUMBER_SCALE_4, RoundingMode.HALF_UP));
|
|
|
- tXinyiForecastComparison.setYyErrorRateThree((csCod.subtract(yyForecastThree)).divide(csCod, NUMBER_SCALE_4, RoundingMode.HALF_UP));
|
|
|
+ if(!Objects.isNull(hsForecastThree))
|
|
|
+ tXinyiForecastComparison.setHsErrorRateThree((csCod.subtract(hsForecastThree)).divide(csCod, NUMBER_SCALE_4, RoundingMode.HALF_UP));
|
|
|
+ if(!Objects.isNull(yyForecastThree))
|
|
|
+ tXinyiForecastComparison.setYyErrorRateThree((csCod.subtract(yyForecastThree)).divide(csCod, NUMBER_SCALE_4, RoundingMode.HALF_UP));
|
|
|
}
|
|
|
}
|
|
|
if("ss".equals(tXinyiForecastComparison.getCategory())){
|
|
|
tXinyiForecastComparison.setRealThree(csSs);
|
|
|
if(!Objects.isNull(csSs) && csSs.compareTo(BigDecimal.ZERO) > 0){
|
|
|
- tXinyiForecastComparison.setHsErrorRateThree((csSs.subtract(hsForecastThree)).divide(csSs, NUMBER_SCALE_4, RoundingMode.HALF_UP));
|
|
|
- tXinyiForecastComparison.setYyErrorRateThree((csSs.subtract(yyForecastThree)).divide(csSs, NUMBER_SCALE_4, RoundingMode.HALF_UP));
|
|
|
+ if(!Objects.isNull(hsForecastThree))
|
|
|
+ tXinyiForecastComparison.setHsErrorRateThree((csSs.subtract(hsForecastThree)).divide(csSs, NUMBER_SCALE_4, RoundingMode.HALF_UP));
|
|
|
+ if(!Objects.isNull(yyForecastThree))
|
|
|
+ tXinyiForecastComparison.setYyErrorRateThree((csSs.subtract(yyForecastThree)).divide(csSs, NUMBER_SCALE_4, RoundingMode.HALF_UP));
|
|
|
}
|
|
|
}
|
|
|
if("tn".equals(tXinyiForecastComparison.getCategory())){
|
|
|
tXinyiForecastComparison.setRealThree(csTn);
|
|
|
if(!Objects.isNull(csTn) && csTn.compareTo(BigDecimal.ZERO) > 0){
|
|
|
- tXinyiForecastComparison.setHsErrorRateThree((csTn.subtract(hsForecastThree)).divide(csTn, NUMBER_SCALE_4, RoundingMode.HALF_UP));
|
|
|
- tXinyiForecastComparison.setYyErrorRateThree((csTn.subtract(yyForecastThree)).divide(csTn, NUMBER_SCALE_4, RoundingMode.HALF_UP));
|
|
|
+ if(!Objects.isNull(hsForecastThree))
|
|
|
+ tXinyiForecastComparison.setHsErrorRateThree((csTn.subtract(hsForecastThree)).divide(csTn, NUMBER_SCALE_4, RoundingMode.HALF_UP));
|
|
|
+ if(!Objects.isNull(yyForecastThree))
|
|
|
+ tXinyiForecastComparison.setYyErrorRateThree((csTn.subtract(yyForecastThree)).divide(csTn, NUMBER_SCALE_4, RoundingMode.HALF_UP));
|
|
|
}
|
|
|
}
|
|
|
//2024年6月20日11:16:55 出水总磷的真实值从化验室获取
|
|
@@ -233,8 +254,10 @@ public class AsyncTask {
|
|
|
if("nh3".equals(tXinyiForecastComparison.getCategory())){
|
|
|
tXinyiForecastComparison.setRealThree(csNh3);
|
|
|
if(!Objects.isNull(csNh3) && csNh3.compareTo(BigDecimal.ZERO) > 0){
|
|
|
- tXinyiForecastComparison.setHsErrorRateThree((csNh3.subtract(hsForecastThree)).divide(csNh3, NUMBER_SCALE_4, RoundingMode.HALF_UP));
|
|
|
- tXinyiForecastComparison.setYyErrorRateThree((csNh3.subtract(yyForecastThree)).divide(csNh3, NUMBER_SCALE_4, RoundingMode.HALF_UP));
|
|
|
+ if(!Objects.isNull(hsForecastThree))
|
|
|
+ tXinyiForecastComparison.setHsErrorRateThree((csNh3.subtract(hsForecastThree)).divide(csNh3, NUMBER_SCALE_4, RoundingMode.HALF_UP));
|
|
|
+ if(!Objects.isNull(yyForecastThree))
|
|
|
+ tXinyiForecastComparison.setYyErrorRateThree((csNh3.subtract(yyForecastThree)).divide(csNh3, NUMBER_SCALE_4, RoundingMode.HALF_UP));
|
|
|
}
|
|
|
}
|
|
|
this.xinyiForecastComparisonMapper.updateTXinyiForecastComparison(tXinyiForecastComparison);
|