|
@@ -186,7 +186,7 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
for(String s:cki){
|
|
for(String s:cki){
|
|
FormData fdTmp=this.formDataMap.get(s);
|
|
FormData fdTmp=this.formDataMap.get(s);
|
|
if(fdTmp!=null&&fdTmp.getValues().stream().map(ElementData::getValue).anyMatch(e->StringUtils.isNotEmpty(e)&&StringUtils.isNotEquals("/",e))){
|
|
if(fdTmp!=null&&fdTmp.getValues().stream().map(ElementData::getValue).anyMatch(e->StringUtils.isNotEmpty(e)&&StringUtils.isNotEquals("/",e))){
|
|
- sb.append(fdTmp.getEName().split("[((].+[))]")[0]).append(",");
|
|
|
|
|
|
+ sb.append(fdTmp.getEName().replaceAll("^[^\\u4e00-\\u9fa5]+","").split("[((].+[))]|_")[0]).append(",");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if(sb.length()>1){
|
|
if(sb.length()>1){
|
|
@@ -425,17 +425,6 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
}
|
|
}
|
|
String tmp =fd.getFormula().getFormula();
|
|
String tmp =fd.getFormula().getFormula();
|
|
tmp = tmp.replace(FC, CustomFunction.CLASS_CALL);
|
|
tmp = tmp.replace(FC, CustomFunction.CLASS_CALL);
|
|
-// if(tmp.contains(CustomFunction.CLASS_CALL+"ifelse")){
|
|
|
|
-// Matcher im =IF.matcher(tmp);
|
|
|
|
-// while (im.find()){
|
|
|
|
-// String rep =im.group();
|
|
|
|
-// Matcher fm=P.matcher(rep);
|
|
|
|
-// while (fm.find()){
|
|
|
|
-// rep=rep.replace(fm.group(),"'"+fm.group()+"'");
|
|
|
|
-// }
|
|
|
|
-// tmp=tmp.replace(im.group(),rep);
|
|
|
|
-// }
|
|
|
|
-// }
|
|
|
|
if(tmp.contains("E[")||tmp.contains("WP[")){
|
|
if(tmp.contains("E[")||tmp.contains("WP[")){
|
|
Matcher am = AP.matcher(tmp);
|
|
Matcher am = AP.matcher(tmp);
|
|
while (am.find()){
|
|
while (am.find()){
|
|
@@ -553,53 +542,8 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
}
|
|
}
|
|
|
|
|
|
public void write(FormData fd,Object data){
|
|
public void write(FormData fd,Object data){
|
|
- if(data instanceof List){
|
|
|
|
- List<Object> values = (List<Object>) data;
|
|
|
|
- if(values.size()>fd.getValues().size()){
|
|
|
|
- /*当生成的数据超过实际容量的时候,会自动追加页数*/
|
|
|
|
- if(fd.getCoordsList().size()==1){
|
|
|
|
- fd.getValues().get(0).setValue(values.stream().map(StringUtils::handleNull).collect(Collectors.joining("、")));
|
|
|
|
- }else{
|
|
|
|
- // copy(fd,values);
|
|
|
|
- for(int n=0;n<fd.getValues().size();n++){
|
|
|
|
- fd.getValues().get(n).setValue(values.get(n));
|
|
|
|
- }
|
|
|
|
- List<Object> overList=values.stream().skip(fd.getValues().size()).collect(Collectors.toList());
|
|
|
|
- List<Coords> coordsList = fd.getCoordsList();
|
|
|
|
- int addPage=(int)Math.ceil((double)overList.size()/(double)coordsList.size());
|
|
|
|
- fd.setAddPages(addPage);
|
|
|
|
- ElementData last =fd.getValues().get(fd.getValues().size()-1);
|
|
|
|
- int indexBase=last.getIndex()+1;
|
|
|
|
- List<ElementData> addList= new ArrayList<>();
|
|
|
|
- for(int i=0;i<addPage;i++){
|
|
|
|
- for(int j=0;j<coordsList.size();j++){
|
|
|
|
- /*超页就尽管写进去,格式化阶段再加表*/
|
|
|
|
- Coords coords = coordsList.get(j);
|
|
|
|
- Object v=null;
|
|
|
|
- int st=i*coordsList.size()+j;
|
|
|
|
- if(st<overList.size()){
|
|
|
|
- v= overList.get(st);
|
|
|
|
- }
|
|
|
|
- addList.add(new ElementData(indexBase+i,last.getGroupId(),v,coords.getX(),coords.getY()));
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- fd.getValues().addAll(addList);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- }else{
|
|
|
|
- for(int n=0;n<values.size();n++){
|
|
|
|
- fd.getValues().get(n).setValue(values.get(n));
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }else{
|
|
|
|
- if(Formula.FULL.equals(fd.getFormula().getOutm())){
|
|
|
|
- /*填充策略*/
|
|
|
|
- fd.getValues().forEach(e->e.setValue(data));
|
|
|
|
- }else{
|
|
|
|
- fd.getValues().get(0).setValue(data);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
|
|
+ /*如果需要向额外元素或对象输出数据,在此处修改*/
|
|
|
|
+ FormulaUtils.write(fd,data);
|
|
}
|
|
}
|
|
|
|
|
|
/**加页增容*/
|
|
/**加页增容*/
|
|
@@ -673,11 +617,29 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ try {
|
|
|
|
+ /*检验单附表处理*/
|
|
|
|
+ List<FormData> inspectionList= new ArrayList<>();
|
|
|
|
+ this.tec.getTableAll().stream().filter(e->e.getNodeName().contains("检验单")).forEach(e->{
|
|
|
|
+ this.tec.getKeyMappers().stream().filter(p->p.getPkId().equals(e.getPKeyId())).forEach(k->{
|
|
|
|
+ this.formDataMap.values().stream().filter(f->f.getCode().equals(k.getCode())&&f.getAddPages()>0).forEach(inspectionList::add);
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+ if(Func.isNotEmpty(inspectionList)){
|
|
|
|
+ Map<String,List<ElementData>> overMap=new HashMap<>();
|
|
|
|
+ inspectionList.forEach(f->{
|
|
|
|
+
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ }catch (Exception e){
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ }
|
|
|
|
+
|
|
/*检查超页情况*/
|
|
/*检查超页情况*/
|
|
this.formDataMap.values().stream().filter(e->e.getUpdate()==1&&e.getAddPages()>0).sorted(Comparator.comparing(FormData::getAddPages).reversed())
|
|
this.formDataMap.values().stream().filter(e->e.getUpdate()==1&&e.getAddPages()>0).sorted(Comparator.comparing(FormData::getAddPages).reversed())
|
|
.collect(Collectors.groupingBy(FormData::getTableName,LinkedHashMap::new,Collectors.toList())).values()
|
|
.collect(Collectors.groupingBy(FormData::getTableName,LinkedHashMap::new,Collectors.toList())).values()
|
|
- .forEach(l->copy(l.get(0)));;
|
|
|
|
-
|
|
|
|
|
|
+ .forEach(l->copy(l.get(0)));
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|