|
|
@@ -2,6 +2,7 @@ package org.springblade.manager.formula.impl;
|
|
|
|
|
|
import com.mixsmart.utils.FormulaUtils;
|
|
|
import com.mixsmart.utils.StringUtils;
|
|
|
+import io.swagger.models.auth.In;
|
|
|
import lombok.Data;
|
|
|
import org.springblade.core.tool.utils.Func;
|
|
|
import org.springblade.core.tool.utils.StringPool;
|
|
|
@@ -34,6 +35,7 @@ public class SubTable {
|
|
|
private LinkedHashMap<String, Item> original = new LinkedHashMap<>();
|
|
|
/**检验单检查项目元素,用来排序*/
|
|
|
private List<FormData> mainList = new ArrayList<>();
|
|
|
+ private List<FormData> inspectionListInfo = new ArrayList<>();
|
|
|
/**项目名称*/
|
|
|
private FormData itemName;
|
|
|
/**设计值*/
|
|
|
@@ -42,7 +44,7 @@ public class SubTable {
|
|
|
private FormData data;
|
|
|
|
|
|
private TableElementConverter tec;
|
|
|
-
|
|
|
+ private List<Long> delTabList = new ArrayList<>();
|
|
|
|
|
|
public SubTable() {
|
|
|
}
|
|
|
@@ -93,8 +95,10 @@ public class SubTable {
|
|
|
|
|
|
/*解析项目信息*/
|
|
|
public void put(List<FormData> inspectionList) {
|
|
|
+
|
|
|
/*根据行号排序*/
|
|
|
inspectionList.sort(Comparator.comparingInt(e->e.getCoordsList().get(0).getY()));
|
|
|
+ inspectionListInfo = inspectionList;
|
|
|
/*检验单、评定表不能超过一页,多余的需要删除并把检测项数据写人附表*/
|
|
|
/*检验单或者评定表存的超页数据汇总到附表对象*/
|
|
|
for(FormData fd:inspectionList) {
|
|
|
@@ -107,20 +111,22 @@ public class SubTable {
|
|
|
Optional<FormData> designFdOp = tec.formDataMap.values().stream().filter(o -> o.getTableName().equals(fd.getTableName()) && !o.equals(fd) && fd.getMaxRow().equals(o.getMaxRow()) && o.getEName().contains("设计")).findAny();
|
|
|
designFdOp.ifPresent(formData -> item.setDesign(formData.getValues().stream().map(ElementData::stringValue).filter(StringUtils::isNotEmpty).collect(Collectors.toList())));
|
|
|
item.setData(FormulaUtils.setScale(null, overList).stream().map(ElementData::getValue).filter(StringUtils::isNotEmpty).collect(Collectors.toList()));
|
|
|
+ item.setColFullName(fd.getEName());
|
|
|
group.put(item.getName(), item);
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
/**将项目信息写入附表元素*/
|
|
|
- public void flush(boolean isUpdate) {
|
|
|
+ public void flush() {
|
|
|
if(!checked()){
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
/*获取项目数据*/
|
|
|
- List<Item> itemList =getPutOutList(isUpdate);
|
|
|
+ List<Item> itemList =getPutOutList();
|
|
|
if (itemList.size() > 0) {
|
|
|
/*行号,起始为0,当前行号整除列大小余0就是每页首行*/
|
|
|
AtomicInteger index=new AtomicInteger(0);
|
|
|
@@ -175,13 +181,16 @@ public class SubTable {
|
|
|
FormulaUtils.write(data, dataList, true);
|
|
|
itemName.setUpdate(1);
|
|
|
data.setUpdate(1);
|
|
|
+ }else{
|
|
|
+ List<NodeTable> mainFBTable = tec.getTableAll().stream().filter(e -> (e.getTableType().equals(1) || e.getTableType().equals(5)) && e.getNodeName().contains("附表") && tec.getCurrentNode().getNodeType() > 3).collect(Collectors.toList());
|
|
|
+ delTabList = mainFBTable.stream().map(e -> e.getPKeyId()).collect(Collectors.toList());
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/*获取最终输出的项目信息*/
|
|
|
- public List<Item> getPutOutList(boolean isUpdate){
|
|
|
+ public List<Item> getPutOutList(){
|
|
|
/*初始化group,保留原先内容,只做同KEY覆盖*/
|
|
|
- initOriginal(isUpdate);
|
|
|
+ initOriginal();
|
|
|
List<Item> itemList = new ArrayList<>(group.values());
|
|
|
if(this.mainList!=null){
|
|
|
List<String> itemNameIndex = this.mainList.stream().map(e->FormulaUtils.parseItemName(e.getEName()).trim()).collect(Collectors.toList());
|
|
|
@@ -195,51 +204,21 @@ public class SubTable {
|
|
|
return itemList;
|
|
|
}
|
|
|
/*用原有数据初始化*/
|
|
|
- private void initOriginal(boolean isUpdate){
|
|
|
- List<String> itemName = new ArrayList<>();
|
|
|
-
|
|
|
- if(isUpdate){
|
|
|
- List<String> itemName2= this.itemName.getValues().stream().map(ElementData::stringValue).collect(Collectors.toList());
|
|
|
- for(String name : itemName2){
|
|
|
- if(StringUtils.isEmpty(name)){
|
|
|
- itemName.add(name);
|
|
|
- continue;
|
|
|
- }
|
|
|
- String lastName = "";
|
|
|
- int count = 0;
|
|
|
- for(FormData df :this.mainList){
|
|
|
- //箍筋、构造钢筋、螺旋筋间距(mm)
|
|
|
- String test = df.getEName().replaceAll("、","").trim();
|
|
|
- if(test.indexOf(name)>=0){
|
|
|
- lastName = null;
|
|
|
- count = 11;
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- if(count==11){
|
|
|
- itemName.add(lastName);
|
|
|
- }else{
|
|
|
- itemName.add(name);
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
- }else{
|
|
|
- itemName = this.itemName.getValues().stream().map(ElementData::stringValue).collect(Collectors.toList());
|
|
|
- }
|
|
|
-
|
|
|
+ private void initOriginal(){
|
|
|
+ Map<String, String> keyMap = new HashMap<>();
|
|
|
+ List<String> itemName = this.itemName.getValues().stream().map(ElementData::stringValue).collect(Collectors.toList());
|
|
|
List<String> designs=null;
|
|
|
if(this.design!=null) {
|
|
|
designs = this.design.getValues().stream().map(ElementData::stringValue).collect(Collectors.toList());
|
|
|
}
|
|
|
- List<Object> data = this.data.getRawValue();
|
|
|
- String name = "";
|
|
|
- for (int i = 0; i < itemName.size(); i++) {
|
|
|
- name = itemName.get(i);
|
|
|
- if (StringUtils.isNotEmpty( name)) {
|
|
|
- break;
|
|
|
- }
|
|
|
+ for(FormData item:this.mainList){
|
|
|
+ String key = FormulaUtils.parseItemName(item.getEName()).trim();
|
|
|
+ keyMap.put(key, "1");
|
|
|
}
|
|
|
|
|
|
+ // 计算元素是否需要覆盖
|
|
|
+ List<Object> data = this.data.getRawValue();
|
|
|
+ String name = itemName.get(0);
|
|
|
if(StringUtils.isNotEmpty(name)) {
|
|
|
int head = 0;
|
|
|
//计算 最后一行之前的数据
|
|
|
@@ -253,13 +232,17 @@ public class SubTable {
|
|
|
item.setDesign(designs.subList(head, i).stream().filter(StringUtils::isNotEmpty).distinct().collect(Collectors.toList()));
|
|
|
}
|
|
|
item.setData(new ArrayList<>(data.subList(head*15, i*ROW_SIZE)));
|
|
|
- original.put(name,item);
|
|
|
+ if(!(inspectionListInfo.size()==0 && keyMap.containsKey(name)) ){
|
|
|
+ original.put(name,item);
|
|
|
+ }
|
|
|
head = i;
|
|
|
name = x;
|
|
|
}else{
|
|
|
Item item = original.get(name);
|
|
|
item.getData().addAll(new ArrayList<>(data.subList(head*15, i*ROW_SIZE)));
|
|
|
- original.put(name,item);
|
|
|
+ if(!(inspectionListInfo.size()==0 && keyMap.containsKey(name)) ){
|
|
|
+ original.put(name,item);
|
|
|
+ }
|
|
|
head = i;
|
|
|
name = x;
|
|
|
}
|
|
|
@@ -298,6 +281,7 @@ public class SubTable {
|
|
|
public static class Item{
|
|
|
/*项目的顺序要根据检验单上的自上到下的顺序,相同项目名需要合并,如果存在不同设计值则连续显示;空白行要去除*/
|
|
|
private String name;
|
|
|
+ private String colFullName; //列全名
|
|
|
private List<String>design;
|
|
|
private List<Object> data;
|
|
|
public Item(String name) {
|