|
@@ -157,68 +157,72 @@ public class FormulaUtils {
|
|
|
/*无定位信息不写入*/
|
|
|
return;
|
|
|
}
|
|
|
- /*一个单元格且存在多张,全部设置为自动拓展 20230816*/
|
|
|
- if(fd.getCoordsList().size()==1&&fd.getValues().size()>1&&fd.getFormula()!=null){
|
|
|
- fd.getFormula().setOutm(Formula.FULL);
|
|
|
- }
|
|
|
- /*写入前清空内容*/
|
|
|
- fd.getValues().forEach(t->t.setValue(null));
|
|
|
- if(data instanceof List){
|
|
|
- List<Object> values = (List<Object>) data;
|
|
|
- if(!nullOrBlank){
|
|
|
- values=values.stream().filter(StringUtils::isNotEmpty).collect(Collectors.toList());
|
|
|
+ try {
|
|
|
+ /*一个单元格且存在多张,全部设置为自动拓展 20230816*/
|
|
|
+ if(fd.getCoordsList().size()==1&&fd.getValues().size()>1&&fd.getFormula()!=null){
|
|
|
+ fd.getFormula().setOutm(Formula.FULL);
|
|
|
}
|
|
|
- if(values.size()>fd.getValues().size()){
|
|
|
- /*当生成的数据超过实际容量的时候,会自动追加页数*/
|
|
|
- if(fd.getCoordsList().size()==1){
|
|
|
- if(values.stream().filter(CustomFunction::containsZH).anyMatch(e->e.toString().contains("\n"))){
|
|
|
- fd.getValues().get(0).setValue(values.stream().filter(Objects::nonNull).map(Object::toString).collect(Collectors.joining()));
|
|
|
+ /*写入前清空内容*/
|
|
|
+ fd.getValues().forEach(t->t.setValue(null));
|
|
|
+ if(data instanceof List){
|
|
|
+ List<Object> values = (List<Object>) data;
|
|
|
+ if(!nullOrBlank){
|
|
|
+ values=values.stream().filter(StringUtils::isNotEmpty).collect(Collectors.toList());
|
|
|
+ }
|
|
|
+ if(values.size()>fd.getValues().size()){
|
|
|
+ /*当生成的数据超过实际容量的时候,会自动追加页数*/
|
|
|
+ if(fd.getCoordsList().size()==1){
|
|
|
+ if(values.stream().filter(CustomFunction::containsZH).anyMatch(e->e.toString().contains("\n"))){
|
|
|
+ fd.getValues().get(0).setValue(values.stream().filter(Objects::nonNull).map(Object::toString).collect(Collectors.joining()));
|
|
|
+ }else{
|
|
|
+ fd.getValues().get(0).setValue(values.stream().map(StringUtils::handleNull).collect(Collectors.joining("、")));
|
|
|
+ }
|
|
|
}else{
|
|
|
- fd.getValues().get(0).setValue(values.stream().map(StringUtils::handleNull).collect(Collectors.joining("、")));
|
|
|
+ // 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{
|
|
|
- // copy(fd,values);
|
|
|
- for(int n=0;n<fd.getValues().size();n++){
|
|
|
+ for(int n=0;n<values.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));
|
|
|
+ if(Formula.FULL.equals(fd.getFormula().getOutm())){
|
|
|
+ /*填充策略*/
|
|
|
+ fd.getValues().forEach(e->e.setValue(data));
|
|
|
+ }else{
|
|
|
+ fd.getValues().get(0).setValue(data);
|
|
|
}
|
|
|
}
|
|
|
- }else{
|
|
|
- if(Formula.FULL.equals(fd.getFormula().getOutm())){
|
|
|
- /*填充策略*/
|
|
|
- fd.getValues().forEach(e->e.setValue(data));
|
|
|
- }else{
|
|
|
- fd.getValues().get(0).setValue(data);
|
|
|
- }
|
|
|
+ fd.setUpdate(1);
|
|
|
+ }catch (Exception e){
|
|
|
+ e.printStackTrace();
|
|
|
}
|
|
|
- fd.setUpdate(1);
|
|
|
}
|
|
|
- public static List<TableInfo> getTableInfoList(JSONArray dataArray) {
|
|
|
+ /*public static List<TableInfo> getTableInfoList(JSONArray dataArray) {
|
|
|
if (dataArray != null && !dataArray.isEmpty()) {
|
|
|
List<TableInfo> result = new ArrayList<>();
|
|
|
for (int m = 0; m < dataArray.size(); m++) {
|
|
@@ -299,8 +303,8 @@ public class FormulaUtils {
|
|
|
return result;
|
|
|
}
|
|
|
return null;
|
|
|
- }
|
|
|
-
|
|
|
+ }*/
|
|
|
+/*
|
|
|
public static void setFirstData(JSONObject dataInfo2, TableInfo tableInfo) {
|
|
|
//huangjn 判断是否是首件
|
|
|
if (dataInfo2.containsKey("isFirst")) {
|
|
@@ -334,9 +338,9 @@ public class FormulaUtils {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
+ *//**
|
|
|
* 设置日志信息
|
|
|
- */
|
|
|
+ *//*
|
|
|
public static void setTheLogData(JSONObject dataInfo2, TableInfo tableInfo) {
|
|
|
//huangjn 判断是否是日志
|
|
|
if (dataInfo2.containsKey("isTheLog")) {
|
|
@@ -366,7 +370,7 @@ public class FormulaUtils {
|
|
|
tableInfo.setBusinessId(dataInfo2.getString("id"));
|
|
|
}
|
|
|
//huangjn 每份填报数据的id,目前日志专用
|
|
|
- }
|
|
|
+ }*/
|
|
|
|
|
|
/**从元素名称中解析项目名称,细化项目匹配用*/
|
|
|
public static String parseItemName(String eName){
|
|
@@ -734,7 +738,7 @@ public class FormulaUtils {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- /*从方法参数中获取全部code*/
|
|
|
+ /**从方法参数中获取全部code*/
|
|
|
public static List<String> getCodeList(String param){
|
|
|
List<String> list = new ArrayList<>();
|
|
|
if(StringUtils.isNotEmpty(param)){
|