|
@@ -1121,15 +1121,37 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
|
/*检验单附表处理*/
|
|
|
List<FormData> inspectionList = new ArrayList<>();
|
|
|
/*1检验表5评定表*/
|
|
|
- tec.getTableAll().stream().filter(e -> e.getTableType().equals(1) ||e.getTableType().equals(5)).forEach(e -> {
|
|
|
- /*获取所有挂在检验单、评定表里的元素映射关系*/
|
|
|
- tec.getKeyMappers().stream().filter(p -> p.getPkId().equals(e.getPKeyId())).forEach(k -> {
|
|
|
- /*筛选元素长度超1页的元素*/
|
|
|
- List<FormData> target = tec.formDataMap.values().stream().filter(f -> f.getCode().equals(k.getCode()) && f.getAddPages() > 0).collect(Collectors.toList());
|
|
|
- if (Func.isNotEmpty(target)) {
|
|
|
- inspectionList.addAll(target);
|
|
|
- }
|
|
|
+ List<NodeTable> mainTable = tec.getTableAll().stream().filter(e -> (e.getTableType().equals(1) ||e.getTableType().equals(5))&&!e.getNodeName().contains("附表")).collect(Collectors.toList());
|
|
|
+ if(Func.isEmpty(mainTable)){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ NodeTable main = mainTable.get(0);
|
|
|
+ if(mainTable.size()>1){
|
|
|
+ /*超过一页全部删除*/
|
|
|
+ List<Long> removeIds = mainTable.stream().skip(1L).map(NodeTable::getPKeyId).collect(Collectors.toList());
|
|
|
+ tec.getKeyMappers().removeIf(e->removeIds.contains(e.getPkId()));
|
|
|
+ this.wbsTreeContractMapper.deleteByIds(removeIds);
|
|
|
+ /*多余的表删除之后需要,裁剪多余表头数据保留全部实测数据然后重新设置增页大小*/
|
|
|
+ tec.getKeyMappers().stream().filter(e->e.getPkId().equals(main.getPKeyId())).map(KeyMapper::getCode).forEach(e->{
|
|
|
+ FormData target= tec.formDataMap.get(e);
|
|
|
+ int capacity=target.getCoordsList().size();
|
|
|
+ List<ElementData> eds = target.getValues();
|
|
|
+ if(eds.size()>capacity){
|
|
|
+ if(capacity>1){
|
|
|
+ target.setAddPages((eds.size()/capacity)-1);
|
|
|
+ }else{
|
|
|
+ target.setValues(eds.stream().limit(capacity).collect(Collectors.toList()));
|
|
|
+ }
|
|
|
+ }
|
|
|
});
|
|
|
+ }
|
|
|
+ /*获取所有挂在检验单、评定表里的元素映射关系*/
|
|
|
+ tec.getKeyMappers().stream().filter(p -> p.getPkId().equals(main.getPKeyId())).forEach(k -> {
|
|
|
+ /*筛选元素长度超1页的元素*/
|
|
|
+ List<FormData> target = tec.formDataMap.values().stream().filter(f -> f.getCode().equals(k.getCode()) && f.getAddPages() > 0).collect(Collectors.toList());
|
|
|
+ if (Func.isNotEmpty(target)) {
|
|
|
+ inspectionList.addAll(target);
|
|
|
+ }
|
|
|
});
|
|
|
if (Func.isNotEmpty(inspectionList)) {
|
|
|
/*检查是否存在附表,不存在挂载*/
|
|
@@ -1154,14 +1176,16 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
|
List<ElementData> overList = f.getValues().stream().skip(f.getCoordsList().size()).collect(Collectors.toList());
|
|
|
f.setValues(f.getValues().stream().limit(f.getCoordsList().size()).collect(Collectors.toList()));
|
|
|
f.setAddPages(0);
|
|
|
- String itemName=FormulaUtils.parseItemName(f.getEName());
|
|
|
- String key=itemName.trim();
|
|
|
- /*同项目*/
|
|
|
- Optional<FormData> designFdOp= tec.formDataMap.values().stream().filter(o->o.getTableName().equals(f.getTableName())&&!o.equals(f)&&f.getMaxRow().equals(o.getMaxRow())&&o.getEName().contains("设计")).findAny();
|
|
|
- if(designFdOp.isPresent()){
|
|
|
- key+="@"+designFdOp.get().getValues().stream().map(ElementData::getValue).filter(StringUtils::isNotEmpty).findAny().orElse("");
|
|
|
+ if(overList.stream().anyMatch(ElementData::isNotEmpty)) {
|
|
|
+ String itemName = FormulaUtils.parseItemName(f.getEName());
|
|
|
+ String key = itemName.trim();
|
|
|
+ /*同项目*/
|
|
|
+ Optional<FormData> designFdOp = tec.formDataMap.values().stream().filter(o -> o.getTableName().equals(f.getTableName()) && !o.equals(f) && f.getMaxRow().equals(o.getMaxRow()) && o.getEName().contains("设计")).findAny();
|
|
|
+ if (designFdOp.isPresent()) {
|
|
|
+ key += "@" + designFdOp.get().getValues().stream().map(ElementData::getValue).filter(StringUtils::isNotEmpty).findAny().orElse("");
|
|
|
+ }
|
|
|
+ sta.put(key, FormulaUtils.setScale(null, overList));
|
|
|
}
|
|
|
- sta.put(key,FormulaUtils.setScale(null,overList));
|
|
|
});
|
|
|
if(sta.checked()){
|
|
|
/*把附表数据刷入对应的附表元素对象*/
|
|
@@ -2628,7 +2652,7 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
|
/*元素创建*/
|
|
|
Map<String,String> parent= getWtpParent(meterType.getName(),contractInfo.getPId());
|
|
|
List<NodeTable> tableList=getTableListMeter(parent);
|
|
|
- Map<String,Map<String,String>> coordinateMap=tableList.parallelStream().collect(Collectors.toMap(NodeTable::getInitTableName,m->FormulaUtils.getElementCell(m.getHtmlUrl()),(v1,v2)->v2));
|
|
|
+ Map<String,Map<String,String>> coordinateMap=tableList.parallelStream().collect(Collectors.toMap(NodeTable::getInitTableName,m->FormulaUtils.getElementExcelCoords(m.getHtmlUrl()),(v1,v2)->v2));
|
|
|
List<FormData> processFds = this.createFormDataByTableName(tableList.stream().map(NodeTable::getInitTableName).collect(Collectors.joining("','")));
|
|
|
listForMeter(processFds,contractInfo.getPId(),parent.get("id"));
|
|
|
|