Commit 8a063d84 by zhangkb

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

parent 0016669c
......@@ -272,47 +272,54 @@ public class ShortboardRuleService {
}
}
}
//分析filterCalResults
for(DriveIndCalResultDef filterCalResult : filterCalResults) {
//判断是比较差还是百分比
if("0".equals(shortboardItem.getAnalysisType())) {//绝对值
//判断有没有实际的平均值
if(filterCalResult.getValue()!=null&&filterCalResult.getActualAverage()!=null&&!"0.0".equals(filterCalResult.getActualAverage())) {
//获取差值绝对值
Double differ = Math.abs(Double.parseDouble(filterCalResult.getActualAverage())
-Double.parseDouble(filterCalResult.getValue()));
if(differ > Double.parseDouble(shortboardItem.getValue())) {
realCalResults.add(filterCalResult);
}
}else {
//获取差值绝对值
if(filterCalResult.getAverage()!=null&&filterCalResult.getValue()!=null){
Double differ = Math.abs(Double.parseDouble(filterCalResult.getAverage())
//如果有填浮动值
if(StringUtils.isNotBlank(shortboardItem.getValue())) {
//分析filterCalResults
for(DriveIndCalResultDef filterCalResult : filterCalResults) {
//判断是比较差还是百分比
if("0".equals(shortboardItem.getAnalysisType())) {//绝对值
//判断有没有实际的平均值
if(filterCalResult.getValue()!=null&&filterCalResult.getActualAverage()!=null&&!"0.0".equals(filterCalResult.getActualAverage())) {
//获取差值绝对值
Double differ = Math.abs(Double.parseDouble(filterCalResult.getActualAverage())
-Double.parseDouble(filterCalResult.getValue()));
if(differ > Double.parseDouble(shortboardItem.getValue())) {
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 {
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(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 {
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;
......@@ -337,7 +344,7 @@ public class ShortboardRuleService {
if(!calResults.isEmpty()) {
maxValue = calResults.get(0).getValue();
}
if(maxValue!=null) {
if(maxValue!=null && StringUtils.isNotBlank(shortboardItem.getValue())) {
for(DriveIndCalResultDef calResult : calResults) {
if(!"NaN".equals(calResult.getValue()) && !"Infinite".equals(calResult.getValue())
&& !"0.0000".equals(calResult.getValue()) && !"0".equals(calResult.getValue())) {
......@@ -358,6 +365,10 @@ public class ShortboardRuleService {
}
}
}
}else {
if(maxValue!=null && calResults.size()>=2) {
realCalResults.addAll(calResults.subList(1, calResults.size()));
}
}
}
return realCalResults;
......@@ -381,13 +392,14 @@ public class ShortboardRuleService {
String minValue = null;
if(!calResults.isEmpty()) {
for(int i=(calResults.size()-1);i>=0;i--) {
if(!"NaN".equals(calResults.get(i).getValue()) && !"Infinite".equals(calResults.get(i).getValue())
&& !"0.0000".equals(calResults.get(i).getValue()) && !"0".equals(calResults.get(i).getValue())) {
if(!"NaN".equals(calResults.get(i).getValue()) &&
!"Infinite".equals(calResults.get(i).getValue())) {
minValue = calResults.get(i).getValue();
break;
}
}
}
if(minValue!=null) {
if(minValue!=null && StringUtils.isNotBlank(shortboardItem.getValue())) {
for(DriveIndCalResultDef calResult : calResults) {
if(!"NaN".equals(calResult.getValue()) && !"Infinite".equals(calResult.getValue())
&& !"0.0000".equals(calResult.getValue()) && !"0".equals(calResult.getValue())) {
......@@ -408,6 +420,10 @@ public class ShortboardRuleService {
}
}
}
}else {
if(minValue!=null && calResults.size()>=2) {
realCalResults.addAll(calResults.subList(0, calResults.size()-1));
}
}
}
return realCalResults;
......@@ -465,13 +481,9 @@ public class ShortboardRuleService {
findByIndIdAndDateAndCompareObj(driveId,(date-100),compareObj,code);
if(currentIndCalResult!=null && sameIndCalResult!=null) {
if(!"NaN".equals(currentIndCalResult.getValue()) &&
!"Infinite".equals(currentIndCalResult.getValue()) &&
!"0.0000".equals(currentIndCalResult.getValue()) &&
!"0".equals(currentIndCalResult.getValue())) {
!"Infinite".equals(currentIndCalResult.getValue())) {
if(!"NaN".equals(sameIndCalResult.getValue()) &&
!"Infinite".equals(sameIndCalResult.getValue()) &&
!"0.0000".equals(sameIndCalResult.getValue()) &&
!"0".equals(sameIndCalResult.getValue())) {
!"Infinite".equals(sameIndCalResult.getValue())) {
if(StringUtils.isNotBlank(shortboardItem.getValue())) {
//判断规则选择是大于还是小于
if("0".equals(shortboardItem.getCalType())) {//大于
......@@ -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