|
@@ -2,6 +2,7 @@ package com.pavis.ai.app.fda.common.utils;
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.pavis.ai.app.fda.common.config.constants.Constants;
|
|
import com.pavis.ai.app.fda.common.config.constants.Constants;
|
|
|
|
+import com.pavis.ai.app.fda.form.inc.IncInfo;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import org.joda.time.DateTime;
|
|
import org.joda.time.DateTime;
|
|
|
|
|
|
@@ -295,23 +296,71 @@ public class DateUtils {
|
|
// 去重
|
|
// 去重
|
|
List<Float> distinctFloats = floats.stream()
|
|
List<Float> distinctFloats = floats.stream()
|
|
.distinct()
|
|
.distinct()
|
|
|
|
+ .filter(x -> x!=null)
|
|
.collect(Collectors.toList());
|
|
.collect(Collectors.toList());
|
|
- // 排序
|
|
|
|
- distinctFloats.sort(Comparator.reverseOrder());
|
|
|
|
- System.err.println(JSON.toJSONString(distinctFloats));
|
|
|
|
- // String result = floats.stream().reduce((first, second) -> second).orElse("no last element");
|
|
|
|
- Float firstNum = distinctFloats.stream().findFirst().orElse( 0F );
|
|
|
|
- Float lastNum = distinctFloats.stream().reduce((first, second) -> second).orElse(0F);
|
|
|
|
- System.err.println(firstNum + " <> " + lastNum);
|
|
|
|
- // 求各值间隔。 是否应该除以个数 todo 待讨论。
|
|
|
|
- Float num = (firstNum - lastNum) / 10;
|
|
|
|
- System.err.println(num);
|
|
|
|
|
|
+ // distinctFloats.stream().filter(s -> s == null)
|
|
|
|
+ // .collect(Collectors.toList());
|
|
|
|
+ // distinctFloats = distinctFloats.stream().filter(x -> x!=null).collect(Collectors.toList());
|
|
List<Float> finalFloats = new ArrayList<>();
|
|
List<Float> finalFloats = new ArrayList<>();
|
|
- for (Float aFloat : distinctFloats) {
|
|
|
|
- finalFloats.add(aFloat / 10);
|
|
|
|
|
|
+ if(distinctFloats.size() > 0){
|
|
|
|
+ System.err.println(JSON.toJSONString(distinctFloats));
|
|
|
|
+ // 排序
|
|
|
|
+ distinctFloats.sort(Comparator.reverseOrder());
|
|
|
|
+ System.err.println(JSON.toJSONString(distinctFloats));
|
|
|
|
+ // String result = floats.stream().reduce((first, second) -> second).orElse("no last element");
|
|
|
|
+ Float firstNum = distinctFloats.stream().findFirst().orElse( 0F );
|
|
|
|
+ Float lastNum = distinctFloats.stream().reduce((first, second) -> second).orElse(0F);
|
|
|
|
+ System.err.println(firstNum + " <> " + lastNum);
|
|
|
|
+ // 求各值间隔。 是否应该除以个数 todo 待讨论。
|
|
|
|
+ Float num = (firstNum - lastNum) / 10;
|
|
|
|
+ System.err.println(num);
|
|
|
|
+ for (Float aFloat : distinctFloats) {
|
|
|
|
+ finalFloats.add(aFloat / 10);
|
|
|
|
+ }
|
|
|
|
+ System.err.println(JSON.toJSONString(finalFloats));
|
|
|
|
+ }else {
|
|
|
|
+ finalFloats.add(0.0F);
|
|
|
|
+ return finalFloats;
|
|
}
|
|
}
|
|
- System.err.println(JSON.toJSONString(finalFloats));
|
|
|
|
return finalFloats;
|
|
return finalFloats;
|
|
}
|
|
}
|
|
|
|
+ /**
|
|
|
|
+ * 计算坐标轴Y
|
|
|
|
+ * @param floats
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ public static List<Integer> getAxisList(List<Integer> floats){
|
|
|
|
+ // 去重
|
|
|
|
+ List<Integer> distinctFloats = floats.stream()
|
|
|
|
+ .distinct()
|
|
|
|
+ .filter(x -> x!=0)
|
|
|
|
+ .collect(Collectors.toList());
|
|
|
|
+ // distinctFloats.stream().filter(s -> s == null)
|
|
|
|
+ // .collect(Collectors.toList());
|
|
|
|
+ // distinctFloats = distinctFloats.stream().filter(x -> x!=null).collect(Collectors.toList());
|
|
|
|
+ List<Integer> finals = new ArrayList<>();
|
|
|
|
+ if(distinctFloats.size() > 0){
|
|
|
|
+ System.err.println(JSON.toJSONString(distinctFloats));
|
|
|
|
+ // 排序
|
|
|
|
+ distinctFloats.sort(Comparator.reverseOrder());
|
|
|
|
+ System.err.println(JSON.toJSONString(distinctFloats));
|
|
|
|
+ // String result = floats.stream().reduce((first, second) -> second).orElse("no last element");
|
|
|
|
+ Integer firstNum = distinctFloats.stream().findFirst().orElse( 0);
|
|
|
|
+ Integer lastNum = distinctFloats.stream().reduce((first, second) -> second).orElse(0);
|
|
|
|
+ System.err.println(firstNum + " <> " + lastNum);
|
|
|
|
+ // 求各值间隔。 是否应该除以个数 todo 待讨论。
|
|
|
|
+ Integer num = (firstNum - lastNum) / 6;
|
|
|
|
+ finals.add(lastNum);
|
|
|
|
+ for (int i = 0; i < 7; i++) {
|
|
|
|
+ finals.add(lastNum += num);
|
|
|
|
+ }
|
|
|
|
+ System.err.println(JSON.toJSONString(finals));
|
|
|
|
+ }else {
|
|
|
|
+ finals.add(0);
|
|
|
|
+ finals.add(100);
|
|
|
|
+ return finals;
|
|
|
|
+ }
|
|
|
|
+ return finals;
|
|
|
|
+ }
|
|
|
|
|
|
}
|
|
}
|