|
@@ -1,5 +1,6 @@
|
|
package org.springblade.manager.formula.impl;
|
|
package org.springblade.manager.formula.impl;
|
|
|
|
|
|
|
|
+import com.mixsmart.utils.CustomFunction;
|
|
import com.mixsmart.utils.FormulaUtils;
|
|
import com.mixsmart.utils.FormulaUtils;
|
|
import com.mixsmart.utils.ListUtils;
|
|
import com.mixsmart.utils.ListUtils;
|
|
import com.mixsmart.utils.StringUtils;
|
|
import com.mixsmart.utils.StringUtils;
|
|
@@ -28,7 +29,7 @@ import java.util.stream.Collectors;
|
|
public class FormulaMileage implements FormulaStrategy {
|
|
public class FormulaMileage implements FormulaStrategy {
|
|
private FormData cur;
|
|
private FormData cur;
|
|
private final MileageClient mileageClient;
|
|
private final MileageClient mileageClient;
|
|
- public static final Pattern MILE_ARGS= Pattern.compile("(?<=FC.MILE\\()[^>]+(?=\\))");
|
|
|
|
|
|
+ public static final Pattern MILE_ARGS= Pattern.compile("(?<=T\\(com.mixsmart.utils.CustomFunction\\)\\.MILE\\()[^)]+(?=\\))");
|
|
public static final String ZH="桩号";
|
|
public static final String ZH="桩号";
|
|
public static final String PW="偏位";
|
|
public static final String PW="偏位";
|
|
public static final String SJX="设计值X";
|
|
public static final String SJX="设计值X";
|
|
@@ -46,21 +47,10 @@ public class FormulaMileage implements FormulaStrategy {
|
|
public void execute(List<FormData> fds, Map<String,Object> constantMap) {
|
|
public void execute(List<FormData> fds, Map<String,Object> constantMap) {
|
|
List<ElementData> eds = cur.getValues();
|
|
List<ElementData> eds = cur.getValues();
|
|
Map<String,String[]> mileages = getCoordinate(cur.getFormula().getFormula(),fds, Func.toLong(constantMap.get("contractId")));
|
|
Map<String,String[]> mileages = getCoordinate(cur.getFormula().getFormula(),fds, Func.toLong(constantMap.get("contractId")));
|
|
- if(ListUtils.isNotEmpty(eds)){
|
|
|
|
- Matcher m= MILE_ARGS.matcher(cur.getCode());
|
|
|
|
- String f= cur.getFormula().getFormula();
|
|
|
|
- f=f.replace("MILE-","");
|
|
|
|
- Map<String,String> keyMap = BaseUtils.string2Map(f);
|
|
|
|
- if(keyMap.size()<MIN_ELE_SIZE){
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
- Map<String,FormData> mapFd=new HashMap<>(100);
|
|
|
|
- keys.forEach(e->mapFd.put(e,fds.stream().filter(k->e.equals(k.getCode())).findFirst().orElseGet(null)));
|
|
|
|
-
|
|
|
|
|
|
+ if(ListUtils.isNotEmpty(eds)&&!mileages.isEmpty()){
|
|
|
|
+ Matcher m= MILE_ARGS.matcher(cur.getFormula().getFormula());
|
|
if(m.find()){
|
|
if(m.find()){
|
|
- String tmp =m.group();
|
|
|
|
- tmp=tmp.replace("E[","").replace("]","");
|
|
|
|
- List<String> cp = Arrays.asList(tmp.split(","));
|
|
|
|
|
|
+ List<String> cp =cur.getFormula().getRelyList();
|
|
Map<String,FormData> map = new LinkedHashMap<>();
|
|
Map<String,FormData> map = new LinkedHashMap<>();
|
|
List<FormData> listFd = new ArrayList<>();
|
|
List<FormData> listFd = new ArrayList<>();
|
|
fds.forEach(e->{
|
|
fds.forEach(e->{
|
|
@@ -112,15 +102,15 @@ public class FormulaMileage implements FormulaStrategy {
|
|
}
|
|
}
|
|
this.cur.setFinished(Boolean.TRUE);
|
|
this.cur.setFinished(Boolean.TRUE);
|
|
}
|
|
}
|
|
- public static final Pattern MILE_P = Pattern.compile("(?<=FC.MILE\\()([^,]+),([^,]+)(?=,)");
|
|
|
|
|
|
+ public static final Pattern MILE_P = Pattern.compile("(?<=T\\(com.mixsmart.utils.CustomFunction\\).MILE\\()([^,]+),([^,]+)(?=,)");
|
|
|
|
|
|
public Map<String,String[]> getCoordinate(String tmp,List<FormData> fds,Long contractId){
|
|
public Map<String,String[]> getCoordinate(String tmp,List<FormData> fds,Long contractId){
|
|
Matcher mile=MILE_P.matcher(tmp);
|
|
Matcher mile=MILE_P.matcher(tmp);
|
|
List<String> zhs;
|
|
List<String> zhs;
|
|
List<String> jzs;
|
|
List<String> jzs;
|
|
if (mile.find()){
|
|
if (mile.find()){
|
|
- String zh= mile.group(1);
|
|
|
|
- String jz= mile.group(2);
|
|
|
|
|
|
+ String zh= mile.group(1).replaceAll("E\\['","").replaceAll("']","");
|
|
|
|
+ String jz= mile.group(2).replaceAll("E\\['","").replaceAll("']","");
|
|
/*查找桩号元素*/
|
|
/*查找桩号元素*/
|
|
Optional<FormData> op=fds.stream().filter(e->e.getCode().equals(zh)).findFirst();
|
|
Optional<FormData> op=fds.stream().filter(e->e.getCode().equals(zh)).findFirst();
|
|
if(op.isPresent()){
|
|
if(op.isPresent()){
|
|
@@ -146,7 +136,7 @@ public class FormulaMileage implements FormulaStrategy {
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
- return new HashMap<>();
|
|
|
|
|
|
+ return new HashMap<>(20);
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|