|
@@ -41,6 +41,7 @@ import javax.validation.constraints.NotNull;
|
|
|
import java.io.File;
|
|
|
import java.io.FileInputStream;
|
|
|
import java.io.FileNotFoundException;
|
|
|
+import java.math.BigDecimal;
|
|
|
import java.util.*;
|
|
|
import java.util.concurrent.atomic.AtomicBoolean;
|
|
|
import java.util.concurrent.atomic.AtomicInteger;
|
|
@@ -724,14 +725,22 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
|
}
|
|
|
if(fd.getCoordsList().size()>1&&f.split("[/+\\-*]").length>1){
|
|
|
LinkedHashMap<String,FormData> fdMap =new LinkedHashMap<>();
|
|
|
- Optional<FormData> tto= ele.stream().max(Comparator.comparingInt(fe->fe.getValues().size()));
|
|
|
- Optional<FormData> tts= ele.stream().min(Comparator.comparingInt(fe->fe.getValues().size()));
|
|
|
- if(tto.isPresent()&&tts.isPresent()){
|
|
|
- if(tto.get().getValues().size()!=tts.get().getValues().size()){
|
|
|
- int baseLength=tto.get().getValues().size();
|
|
|
- ele.forEach(e->{
|
|
|
- e.setStep(baseLength/e.getValues().size());
|
|
|
- });
|
|
|
+// Optional<FormData> tto= ele.stream().max(Comparator.comparingInt(fe->fe.getValues().size()));
|
|
|
+// Optional<FormData> tts= ele.stream().min(Comparator.comparingInt(fe->fe.getValues().size()));
|
|
|
+// if(tto.isPresent()&&tts.isPresent()){
|
|
|
+// if(tto.get().getValues().size()!=tts.get().getValues().size()){
|
|
|
+// int baseLength=tto.get().getValues().size();
|
|
|
+// ele.forEach(e->{
|
|
|
+// e.setStep(baseLength/e.getValues().size());
|
|
|
+// });
|
|
|
+// }
|
|
|
+// }
|
|
|
+ FormData maxFormData = Collections.max(ele, Comparator.comparingInt((FormData ef)->ef.getValues().size()));
|
|
|
+ FormData minFormData = Collections.min(ele, Comparator.comparingInt((FormData ef)->ef.getValues().size()));
|
|
|
+ if (maxFormData.getValues().size() != minFormData.getValues().size()) {
|
|
|
+ int baseLength = maxFormData.getValues().size();
|
|
|
+ for (FormData formData : ele) {
|
|
|
+ formData.setStep(baseLength / formData.getValues().size());
|
|
|
}
|
|
|
}
|
|
|
ele.forEach(e->{
|
|
@@ -742,12 +751,17 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
|
while (cda.hasNext()){
|
|
|
LinkedHashMap<String,ElementData> tip= cda.next();
|
|
|
Map<String, Object> variable = new HashMap<>(tec.constantMap);
|
|
|
+ @SuppressWarnings("unchecked")
|
|
|
Map<String,Object> em= (Map<String, Object>) variable.computeIfAbsent(E, k->new HashMap<>());
|
|
|
int index= new ArrayList<>(tip.values()).get(0).getIndex();
|
|
|
for(Map.Entry<String,ElementData> se:tip.entrySet()){
|
|
|
Object value=se.getValue().getValue();
|
|
|
if(CustomFunction.isNumber(value)){
|
|
|
- em.put(se.getKey(),StringUtils.obj2Double(value));
|
|
|
+ if(StringUtils.isDouble(value)){
|
|
|
+ em.put(se.getKey(), new BigDecimal(value.toString()));
|
|
|
+ }else{
|
|
|
+ em.put(se.getKey(),StringUtils.handleObj2Integer(value));
|
|
|
+ }
|
|
|
}else{
|
|
|
em.put(se.getKey(),value);
|
|
|
}
|
|
@@ -757,13 +771,10 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
|
}
|
|
|
if(local.size()>0){
|
|
|
List<Object> values = slice(local,tec.constantMap,f);
|
|
|
- if(fd.getTableName().equals(checkTable)){
|
|
|
- FormulaUtils.write(fd,values,false);
|
|
|
- }else{
|
|
|
- FormulaUtils.write(fd,values,true);
|
|
|
- }
|
|
|
+ FormulaUtils.write(fd,values, !fd.getTableName().equals(checkTable));
|
|
|
}
|
|
|
}else{
|
|
|
+ @SuppressWarnings("unchecked")
|
|
|
Map<String,Object> em = (Map<String, Object>) currentMap.computeIfAbsent(E,(k)-> new HashMap<>());
|
|
|
ele.forEach(e->{
|
|
|
em.put(e.getCode(),e.getValues().stream().map(ElementData::getValue).collect(Collectors.toList()));
|
|
@@ -771,6 +782,8 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
|
Object data =Expression.parse(formula.getFormula()).calculate(currentMap);
|
|
|
write(fd,data);
|
|
|
}
|
|
|
+ /*重置*/
|
|
|
+ ele.stream().filter(s->s.getOffset()>0).forEach(FormData::restore);
|
|
|
}else{
|
|
|
Object data =Expression.parse(formula.getFormula()).calculate(currentMap);
|
|
|
write(fd,data);
|
|
@@ -784,6 +797,7 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
|
fd.setUpdate(1);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
/**附表处理*/
|
|
|
public void forSubTb(){
|
|
@@ -834,6 +848,7 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
|
for (WbsTreeContract data : subTabList) {
|
|
|
/*自动挂载附表情况下,装配TableInfo数据*/
|
|
|
R bussDataInfo = this.getBussDataInfo(data.getPKeyId(), 1);
|
|
|
+ @SuppressWarnings("unchecked")
|
|
|
Map<String, Object> data1 = (Map<String, Object>) bussDataInfo.getData();
|
|
|
data1.put("pkeyId",data.getPKeyId());
|
|
|
dataArray.add(data1);
|