Commit 8a063d84 by zhangkb

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

parent 0016669c
...@@ -272,47 +272,54 @@ public class ShortboardRuleService { ...@@ -272,47 +272,54 @@ public class ShortboardRuleService {
} }
} }
} }
//分析filterCalResults //如果有填浮动值
for(DriveIndCalResultDef filterCalResult : filterCalResults) { if(StringUtils.isNotBlank(shortboardItem.getValue())) {
//判断是比较差还是百分比 //分析filterCalResults
if("0".equals(shortboardItem.getAnalysisType())) {//绝对值 for(DriveIndCalResultDef filterCalResult : filterCalResults) {
//判断有没有实际的平均值 //判断是比较差还是百分比
if(filterCalResult.getValue()!=null&&filterCalResult.getActualAverage()!=null&&!"0.0".equals(filterCalResult.getActualAverage())) { if("0".equals(shortboardItem.getAnalysisType())) {//绝对值
//获取差值绝对值 //判断有没有实际的平均值
Double differ = Math.abs(Double.parseDouble(filterCalResult.getActualAverage()) if(filterCalResult.getValue()!=null&&filterCalResult.getActualAverage()!=null&&!"0.0".equals(filterCalResult.getActualAverage())) {
-Double.parseDouble(filterCalResult.getValue())); //获取差值绝对值
if(differ > Double.parseDouble(shortboardItem.getValue())) { Double differ = Math.abs(Double.parseDouble(filterCalResult.getActualAverage())
realCalResults.add(filterCalResult);
}
}else {
//获取差值绝对值
if(filterCalResult.getAverage()!=null&&filterCalResult.getValue()!=null){
Double differ = Math.abs(Double.parseDouble(filterCalResult.getAverage())
-Double.parseDouble(filterCalResult.getValue())); -Double.parseDouble(filterCalResult.getValue()));
if(differ > Double.parseDouble(shortboardItem.getValue())) { if(differ > Double.parseDouble(shortboardItem.getValue())) {
realCalResults.add(filterCalResult); realCalResults.add(filterCalResult);
} }
} }else {
//获取差值绝对值
if(filterCalResult.getAverage()!=null&&filterCalResult.getValue()!=null){
Double differ = Math.abs(Double.parseDouble(filterCalResult.getAverage())
-Double.parseDouble(filterCalResult.getValue()));
if(differ > Double.parseDouble(shortboardItem.getValue())) {
realCalResults.add(filterCalResult);
}
}
}
}else {//百分比
//判断有没有实际的平均值
if(filterCalResult.getActualAverage()!=null&&!"0.0".equals(filterCalResult.getActualAverage())) {
Double percentage = Math.abs(Double.parseDouble(CalculateUtils.calGowth(
filterCalResult.getValue(), filterCalResult.getActualAverage(),
driveIndDef.getGrowCalType())));
if(percentage > Double.parseDouble(shortboardItem.getValue())) {
realCalResults.add(filterCalResult);
} }
}else { }else {//百分比
Double percentage = Math.abs(Double.parseDouble(CalculateUtils.calGowth( //判断有没有实际的平均值
filterCalResult.getValue(), filterCalResult.getAverage(), if(filterCalResult.getActualAverage()!=null&&!"0.0".equals(filterCalResult.getActualAverage())) {
driveIndDef.getGrowCalType()))); Double percentage = Math.abs(Double.parseDouble(CalculateUtils.calGowth(
if(percentage > Double.parseDouble(shortboardItem.getValue())) { filterCalResult.getValue(), filterCalResult.getActualAverage(),
realCalResults.add(filterCalResult); driveIndDef.getGrowCalType())));
if(percentage > Double.parseDouble(shortboardItem.getValue())) {
realCalResults.add(filterCalResult);
}
}else {
Double percentage = Math.abs(Double.parseDouble(CalculateUtils.calGowth(
filterCalResult.getValue(), filterCalResult.getAverage(),
driveIndDef.getGrowCalType())));
if(percentage > Double.parseDouble(shortboardItem.getValue())) {
realCalResults.add(filterCalResult);
}
} }
} }
} }
}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