|
@@ -22,6 +22,7 @@ import org.springframework.web.context.WebApplicationContext;
|
|
|
|
|
|
import java.util.*;
|
|
|
import java.util.concurrent.atomic.AtomicInteger;
|
|
|
+import java.util.function.Function;
|
|
|
import java.util.stream.Collectors;
|
|
|
import java.util.stream.Stream;
|
|
|
|
|
@@ -268,22 +269,47 @@ public class FormulaTurnPoint implements FormulaStrategy {
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
+
|
|
|
+ /*对每组测量值进行汇总*/
|
|
|
private void fh6n(FormData cur,List<List<TurnPoint>> result,TableElementConverter tec){
|
|
|
+ Function<String,String> keyWordFc = name ->{
|
|
|
+ if(name.contains("fh允")){
|
|
|
+ return "fh允";
|
|
|
+ }else if(name.contains("∑h测-∑h理")){
|
|
|
+ return "∑h测-∑h理";
|
|
|
+ }
|
|
|
+ return "NULL";
|
|
|
+ };
|
|
|
+ Map<String, Function<List<TurnPoint>,Object>> functionMap = new HashMap<>();
|
|
|
/*误差计算(mm):_∑h理=_fh允=±6√n=*/
|
|
|
- tec.formDataMap.values().stream().filter(fd->fd.getTableName().equals(cur.getTableName())&&fd.getEName().contains("fh允")&&fd.getCoordsList().size()>0).findFirst().ifPresent(t->{
|
|
|
- double rowSize=cur.getCoordsList().size();
|
|
|
- List<Object> tmp=new ArrayList<>();
|
|
|
- for(List<TurnPoint> list:result){
|
|
|
- double n=list.size();
|
|
|
- double x= Math.sqrt(list.stream().filter(s-> StringUtils.isNumber(s.getBmd())).count())*6;
|
|
|
- int m= (int) Math.ceil(n/rowSize);
|
|
|
- tmp.addAll(Collections.nCopies(m,x));
|
|
|
+ functionMap.put("fh允",list->Math.sqrt(list.stream().filter(s-> StringUtils.isNumber(s.getBmd())).count())*6);
|
|
|
+ /*fh=∑h测-∑h理*/
|
|
|
+ functionMap.put("∑h测-∑h理",list->list.get(list.size()-1).getDxX1000());
|
|
|
+ for(FormData t:tec.formDataMap.values()){
|
|
|
+ if(t.getTableName().equals(cur.getTableName())&&t.getCoordsList().size()>0){
|
|
|
+ Function<List<TurnPoint>,Object> fc= functionMap.get(keyWordFc.apply(t.getEName()));
|
|
|
+ if(fc!=null){
|
|
|
+ double rowSize=cur.getCoordsList().size();
|
|
|
+ List<Object> tmp=new ArrayList<>();
|
|
|
+ for(List<TurnPoint> list:result){
|
|
|
+ double n=list.size();
|
|
|
+ Object x= fc.apply(list);
|
|
|
+ int m= (int) Math.ceil(n/rowSize);
|
|
|
+ tmp.addAll(Collections.nCopies(m,x));
|
|
|
+ }
|
|
|
+ tmp=tmp.stream().map(v->StringUtils.number2String(v,1)).collect(Collectors.toList());
|
|
|
+ FormulaUtils.write(t,tmp);
|
|
|
+ /*阻断任何配置的公式*/
|
|
|
+ t.setUpdate(1);
|
|
|
+ t.setFinished(true);
|
|
|
+ }
|
|
|
}
|
|
|
- tmp=tmp.stream().map(v->StringUtils.number2String(v,1)).collect(Collectors.toList());
|
|
|
- FormulaUtils.write(t,tmp);
|
|
|
- });
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
private String c(String name,List<String> args) {
|
|
|
if (Func.isNotEmpty(name) && Func.isNotEmpty(args)) {
|
|
|
int index = KEYS.indexOf(name);
|