|
@@ -37,6 +37,7 @@ import java.util.concurrent.atomic.AtomicReference;
|
|
import java.util.regex.Matcher;
|
|
import java.util.regex.Matcher;
|
|
import java.util.regex.Pattern;
|
|
import java.util.regex.Pattern;
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
+import java.util.stream.Stream;
|
|
|
|
|
|
/**
|
|
/**
|
|
* @author yangyj
|
|
* @author yangyj
|
|
@@ -282,7 +283,7 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
tableDatas.forEach(m->{
|
|
tableDatas.forEach(m->{
|
|
for(Map.Entry<String,Object> entry:m.entrySet()){
|
|
for(Map.Entry<String,Object> entry:m.entrySet()){
|
|
if(entry.getValue()!=null){
|
|
if(entry.getValue()!=null){
|
|
- map.merge(entry.getKey(), entry.getValue(), (v1, v2) -> v1 + ";" + v2);
|
|
|
|
|
|
+ map.merge(entry.getKey(), entry.getValue(), (v1, v2) -> v1 + ";;" + v2);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
});
|
|
});
|
|
@@ -300,11 +301,43 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
}
|
|
}
|
|
public FormData createFormDataFast(String name,String code,String values){
|
|
public FormData createFormDataFast(String name,String code,String values){
|
|
if(StringUtils.isNotEmpty(code,values)){
|
|
if(StringUtils.isNotEmpty(code,values)){
|
|
- FormData one= new FormData(code, Arrays.stream(values.split("☆")).map(s->{
|
|
|
|
- String[] t = s.split("_\\^_");
|
|
|
|
- String[] c =t[1].split("_");
|
|
|
|
- return new ElementData(0,0,t[0],Func.toInt(c[1]),Func.toInt(c[0]));
|
|
|
|
- }).collect(Collectors.toList()), null,StringPool.EMPTY);
|
|
|
|
|
|
+ String[] arr=code.split(":");
|
|
|
|
+ String coords = tec.getCoordinateMap().get(arr[0]).get(arr[1]);
|
|
|
|
+ List<Coords> coordsList = Stream.of(coords).flatMap(s -> Arrays.stream(s.split(";"))).map(s -> {
|
|
|
|
+ String[] xy = s.split("_");
|
|
|
|
+ return new Coords(xy[1], xy[0]);
|
|
|
|
+ }).collect(Collectors.toList());
|
|
|
|
+ List<ElementData> eds = new ArrayList<>();
|
|
|
|
+ if(StringUtils.isNotEmpty(values)){
|
|
|
|
+ String[] pages=values.split(";;");
|
|
|
|
+ for(int index=0;index<pages.length;index++){
|
|
|
|
+ String pg=pages[index];
|
|
|
|
+ if(Func.isNotBlank(pg)){
|
|
|
|
+ String[] val = pg.split("☆");
|
|
|
|
+ Map<String,Object> tmpMap = new LinkedHashMap<>();
|
|
|
|
+ for(String s:val){
|
|
|
|
+ String[] t = s.split("_\\^_");
|
|
|
|
+ String[] c =t[1].split("_");
|
|
|
|
+ tmpMap.put(StringUtils.join(code,0,index,Func.toInt(c[1]),Func.toInt(c[0]),StringPool.AT),t[0]);
|
|
|
|
+ }
|
|
|
|
+ for(Coords c:coordsList){
|
|
|
|
+ Object data = null;
|
|
|
|
+ String key =StringUtils.join(code,0,index,c.getX(),c.getY(),StringPool.AT);
|
|
|
|
+ if(tmpMap.containsKey(key)){
|
|
|
|
+ data = tmpMap.get(key);
|
|
|
|
+ }
|
|
|
|
+ eds.add(new ElementData(index,0,data,c.getX(),c.getY()));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ FormData one= new FormData(code,eds, null,StringPool.EMPTY);
|
|
|
|
+// FormData one= new FormData(code, Arrays.stream(values.split("☆")).map(s->{
|
|
|
|
+// String[] t = s.split("_\\^_");
|
|
|
|
+// String[] c =t[1].split("_");
|
|
|
|
+// return new ElementData(0,0,t[0],Func.toInt(c[1]),Func.toInt(c[0]));
|
|
|
|
+// }).collect(Collectors.toList()), null,StringPool.EMPTY);
|
|
one.setEName(name);
|
|
one.setEName(name);
|
|
return one;
|
|
return one;
|
|
}
|
|
}
|
|
@@ -563,7 +596,7 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
if(fd.getCoordsList().size()==1){
|
|
if(fd.getCoordsList().size()==1){
|
|
fd.getValues().get(0).setValue(values.stream().map(StringUtils::handleNull).collect(Collectors.joining("、")));
|
|
fd.getValues().get(0).setValue(values.stream().map(StringUtils::handleNull).collect(Collectors.joining("、")));
|
|
}else{
|
|
}else{
|
|
- copy(fd,values);
|
|
|
|
|
|
+ // copy(fd,values);
|
|
for(int n=0;n<fd.getValues().size();n++){
|
|
for(int n=0;n<fd.getValues().size();n++){
|
|
fd.getValues().get(n).setValue(values.get(n));
|
|
fd.getValues().get(n).setValue(values.get(n));
|
|
}
|
|
}
|
|
@@ -801,7 +834,7 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
Matcher m = RegexUtils.matcher("T\\(com.mixsmart.utils.CustomFunction\\)\\.(converge)\\(([^)]+)\\)",f);
|
|
Matcher m = RegexUtils.matcher("T\\(com.mixsmart.utils.CustomFunction\\)\\.(converge)\\(([^)]+)\\)",f);
|
|
while (m.find()){
|
|
while (m.find()){
|
|
List<FormData> target = getFormDataByCode(m.group(2));
|
|
List<FormData> target = getFormDataByCode(m.group(2));
|
|
- Object data =target.stream().flatMap(e->e.getValues().stream()).map(ElementData::getValue).collect(Collectors.toList());
|
|
|
|
|
|
+ Object data =target.stream().flatMap(e->e.getValues().stream()).map(ElementData::getValue).filter(StringUtils::isNotEmpty).collect(Collectors.toList());
|
|
f=f.replace(m.group(),putDataWithKey(data));
|
|
f=f.replace(m.group(),putDataWithKey(data));
|
|
}
|
|
}
|
|
}
|
|
}
|