Commit 8a063d84 by zhangkb

修改根据短板筛选规则筛选短板单位后台接口逻辑。

parent 0016669c
...@@ -272,6 +272,8 @@ public class ShortboardRuleService { ...@@ -272,6 +272,8 @@ public class ShortboardRuleService {
} }
} }
} }
//如果有填浮动值
if(StringUtils.isNotBlank(shortboardItem.getValue())) {
//分析filterCalResults //分析filterCalResults
for(DriveIndCalResultDef filterCalResult : filterCalResults) { for(DriveIndCalResultDef filterCalResult : filterCalResults) {
//判断是比较差还是百分比 //判断是比较差还是百分比
...@@ -314,6 +316,11 @@ public class ShortboardRuleService { ...@@ -314,6 +316,11 @@ public class ShortboardRuleService {
} }
} }
} }
}else {
if(!filterCalResults.isEmpty()) {
realCalResults.addAll(filterCalResults);
}
}
} }
return realCalResults; return realCalResults;
} }
...@@ -337,7 +344,7 @@ public class ShortboardRuleService { ...@@ -337,7 +344,7 @@ public class ShortboardRuleService {
if(!calResults.isEmpty()) { if(!calResults.isEmpty()) {
maxValue = calResults.get(0).getValue(); maxValue = calResults.get(0).getValue();
} }
if(maxValue!=null) { if(maxValue!=null && StringUtils.isNotBlank(shortboardItem.getValue())) {
for(DriveIndCalResultDef calResult : calResults) { for(DriveIndCalResultDef calResult : calResults) {
if(!"NaN".equals(calResult.getValue()) && !"Infinite".equals(calResult.getValue()) if(!"NaN".equals(calResult.getValue()) && !"Infinite".equals(calResult.getValue())
&& !"0.0000".equals(calResult.getValue()) && !"0".equals(calResult.getValue())) { && !"0.0000".equals(calResult.getValue()) && !"0".equals(calResult.getValue())) {
...@@ -358,6 +365,10 @@ public class ShortboardRuleService { ...@@ -358,6 +365,10 @@ public class ShortboardRuleService {
} }
} }
} }
}else {
if(maxValue!=null && calResults.size()>=2) {
realCalResults.addAll(calResults.subList(1, calResults.size()));
}
} }
} }
return realCalResults; return realCalResults;
...@@ -381,13 +392,14 @@ public class ShortboardRuleService { ...@@ -381,13 +392,14 @@ public class ShortboardRuleService {
String minValue = null; String minValue = null;
if(!calResults.isEmpty()) { if(!calResults.isEmpty()) {
for(int i=(calResults.size()-1);i>=0;i--) { for(int i=(calResults.size()-1);i>=0;i--) {
if(!"NaN".equals(calResults.get(i).getValue()) && !"Infinite".equals(calResults.get(i).getValue()) if(!"NaN".equals(calResults.get(i).getValue()) &&
&& !"0.0000".equals(calResults.get(i).getValue()) && !"0".equals(calResults.get(i).getValue())) { !"Infinite".equals(calResults.get(i).getValue())) {
minValue = calResults.get(i).getValue(); minValue = calResults.get(i).getValue();
break;
} }
} }
} }
if(minValue!=null) { if(minValue!=null && StringUtils.isNotBlank(shortboardItem.getValue())) {
for(DriveIndCalResultDef calResult : calResults) { for(DriveIndCalResultDef calResult : calResults) {
if(!"NaN".equals(calResult.getValue()) && !"Infinite".equals(calResult.getValue()) if(!"NaN".equals(calResult.getValue()) && !"Infinite".equals(calResult.getValue())
&& !"0.0000".equals(calResult.getValue()) && !"0".equals(calResult.getValue())) { && !"0.0000".equals(calResult.getValue()) && !"0".equals(calResult.getValue())) {
...@@ -408,6 +420,10 @@ public class ShortboardRuleService { ...@@ -408,6 +420,10 @@ public class ShortboardRuleService {
} }
} }
} }
}else {
if(minValue!=null && calResults.size()>=2) {
realCalResults.addAll(calResults.subList(0, calResults.size()-1));
}
} }
} }
return realCalResults; return realCalResults;
...@@ -465,13 +481,9 @@ public class ShortboardRuleService { ...@@ -465,13 +481,9 @@ public class ShortboardRuleService {
findByIndIdAndDateAndCompareObj(driveId,(date-100),compareObj,code); findByIndIdAndDateAndCompareObj(driveId,(date-100),compareObj,code);
if(currentIndCalResult!=null && sameIndCalResult!=null) { if(currentIndCalResult!=null && sameIndCalResult!=null) {
if(!"NaN".equals(currentIndCalResult.getValue()) && if(!"NaN".equals(currentIndCalResult.getValue()) &&
!"Infinite".equals(currentIndCalResult.getValue()) && !"Infinite".equals(currentIndCalResult.getValue())) {
!"0.0000".equals(currentIndCalResult.getValue()) &&
!"0".equals(currentIndCalResult.getValue())) {
if(!"NaN".equals(sameIndCalResult.getValue()) && if(!"NaN".equals(sameIndCalResult.getValue()) &&
!"Infinite".equals(sameIndCalResult.getValue()) && !"Infinite".equals(sameIndCalResult.getValue())) {
!"0.0000".equals(sameIndCalResult.getValue()) &&
!"0".equals(sameIndCalResult.getValue())) {
if(StringUtils.isNotBlank(shortboardItem.getValue())) { if(StringUtils.isNotBlank(shortboardItem.getValue())) {
//判断规则选择是大于还是小于 //判断规则选择是大于还是小于
if("0".equals(shortboardItem.getCalType())) {//大于 if("0".equals(shortboardItem.getCalType())) {//大于
...@@ -513,6 +525,19 @@ public class ShortboardRuleService { ...@@ -513,6 +525,19 @@ public class ShortboardRuleService {
} }
} }
} }
}else {
//判断规则选择是大于还是小于
if("0".equals(shortboardItem.getCalType())) {//大于
if(Double.parseDouble(currentIndCalResult.getValue())>
Double.parseDouble(sameIndCalResult.getValue())) {
realCalResults.add(currentIndCalResult);
}
}else {//小于
if(Double.parseDouble(currentIndCalResult.getValue())<
Double.parseDouble(sameIndCalResult.getValue())) {
realCalResults.add(currentIndCalResult);
}
}
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment