|
@@ -762,66 +762,14 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
|
continue;
|
|
|
}
|
|
|
if(fd.getCoordsList().size()>1&&f.split("[/+\\-*]").length>1){
|
|
|
- LinkedHashMap<String,FormData> fdMap =new LinkedHashMap<>();
|
|
|
- FormData maxFormData = Collections.max(ele, Comparator.comparingInt((FormData ef)->ef.getValues().size()));
|
|
|
- FormData minFormData = Collections.min(ele, Comparator.comparingInt((FormData ef)->ef.getValues().size()));
|
|
|
- if (maxFormData.getValues().size() != minFormData.getValues().size()) {
|
|
|
- int baseLength = maxFormData.getValues().size();
|
|
|
- for (FormData formData : ele) {
|
|
|
- formData.setStep(baseLength / formData.getValues().size());
|
|
|
- }
|
|
|
- }
|
|
|
- ele.forEach(e->{
|
|
|
- fdMap.put(e.getCode(),e);
|
|
|
- });
|
|
|
- CompositeDataAccess cda = new CompositeDataAccess(fdMap);
|
|
|
- List<LocalVariable> local= new ArrayList<>();
|
|
|
- while (cda.hasNext()){
|
|
|
- LinkedHashMap<String,ElementData> tip= cda.next();
|
|
|
- Map<String, Object> variable = new HashMap<>(tec.constantMap);
|
|
|
- @SuppressWarnings("unchecked")
|
|
|
- Map<String,Object> em= (Map<String, Object>) variable.computeIfAbsent(E, k->new HashMap<>());
|
|
|
- int index= new ArrayList<>(tip.values()).get(0).getIndex();
|
|
|
- for(Map.Entry<String,ElementData> se:tip.entrySet()){
|
|
|
- Object value=se.getValue().getValue();
|
|
|
- if(CustomFunction.isNumber(value)){
|
|
|
- if(StringUtils.isDouble(value)||f.contains("/")){
|
|
|
- em.put(se.getKey(),Double.parseDouble(value.toString()));
|
|
|
- }else{
|
|
|
- em.put(se.getKey(),StringUtils.handleObj2Integer(value));
|
|
|
- }
|
|
|
- }else{
|
|
|
- em.put(se.getKey(),StringUtils.handleNull(value).replaceAll("[ ]+","").trim());
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
- local.add(new LocalVariable(index,f,variable));
|
|
|
- }
|
|
|
+ LinkedHashMap<String,FormData> fdMap=step(ele);
|
|
|
+ List<LocalVariable> local= slice2Local(f,fdMap);
|
|
|
if(local.size()>0){
|
|
|
List<Object> values = FormulaUtils.slice(local,f);
|
|
|
FormulaUtils.write(fd,values, !fd.getTableName().equals(checkTable));
|
|
|
}
|
|
|
}else{
|
|
|
- @SuppressWarnings("unchecked")
|
|
|
- Map<String,Object> em = (Map<String, Object>) currentMap.computeIfAbsent(E,(k)-> new HashMap<>());
|
|
|
- if(f.split("[/+\\-*]").length>1&&ele.stream().map(e->e.getCoordsList().size()).max(Comparator.comparingInt(e->e)).orElse(1)==1&&fd.getCoordsList().size()==1){
|
|
|
- ele.forEach(e->{
|
|
|
- Object value=e.getValues().get(0).getValue();
|
|
|
- if(CustomFunction.isNumber(value)){
|
|
|
- if(StringUtils.isDouble(value)||f.contains("/")){
|
|
|
- em.put(e.getCode(), Double.parseDouble(value.toString()));
|
|
|
- }else{
|
|
|
- em.put(e.getCode(),StringUtils.handleObj2Integer(value));
|
|
|
- }
|
|
|
- }else{
|
|
|
- em.put(e.getCode(),value);
|
|
|
- }
|
|
|
- });
|
|
|
- }else{
|
|
|
- ele.forEach(e->{
|
|
|
- em.put(e.getCode(),e.getRawValue());
|
|
|
- });
|
|
|
- }
|
|
|
+ putEle(f,ele,currentMap,fd);
|
|
|
Object data =Expression.parse(formula.getFormula()).calculate(currentMap);
|
|
|
write(fd,data);
|
|
|
}
|
|
@@ -843,6 +791,72 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
|
}
|
|
|
|
|
|
}
|
|
|
+ /*确定各个元素在计算时的步长,算法:step=最长单元格数/当前元素单元格数*/
|
|
|
+ private LinkedHashMap<String,FormData> step(List<FormData> ele){
|
|
|
+ LinkedHashMap<String,FormData> fdMap =new LinkedHashMap<>();
|
|
|
+ FormData maxFormData = Collections.max(ele, Comparator.comparingInt((FormData ef)->ef.getValues().size()));
|
|
|
+ FormData minFormData = Collections.min(ele, Comparator.comparingInt((FormData ef)->ef.getValues().size()));
|
|
|
+ if (maxFormData.getValues().size() != minFormData.getValues().size()) {
|
|
|
+ int baseLength = maxFormData.getValues().size();
|
|
|
+ for (FormData formData : ele) {
|
|
|
+ formData.setStep(baseLength / formData.getValues().size());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ele.forEach(e->{
|
|
|
+ fdMap.put(e.getCode(),e);
|
|
|
+ });
|
|
|
+ return fdMap;
|
|
|
+ }
|
|
|
+ /*确定公式执行环境变量*/
|
|
|
+ private List<LocalVariable> slice2Local(String f, LinkedHashMap<String,FormData> fdMap){
|
|
|
+ CompositeDataAccess cda = new CompositeDataAccess(fdMap);
|
|
|
+ List<LocalVariable> local= new ArrayList<>();
|
|
|
+ while (cda.hasNext()){
|
|
|
+ LinkedHashMap<String,ElementData> tip= cda.next();
|
|
|
+ Map<String, Object> variable = new HashMap<>(tec.constantMap);
|
|
|
+ @SuppressWarnings("unchecked")
|
|
|
+ Map<String,Object> em= (Map<String, Object>) variable.computeIfAbsent(E, k->new HashMap<>());
|
|
|
+ int index= new ArrayList<>(tip.values()).get(0).getIndex();
|
|
|
+ for(Map.Entry<String,ElementData> se:tip.entrySet()){
|
|
|
+ Object value=se.getValue().getValue();
|
|
|
+ if(CustomFunction.isNumber(value)){
|
|
|
+ if(StringUtils.isDouble(value)||f.contains("/")){
|
|
|
+ em.put(se.getKey(),Double.parseDouble(value.toString()));
|
|
|
+ }else{
|
|
|
+ em.put(se.getKey(),StringUtils.handleObj2Integer(value));
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ em.put(se.getKey(),StringUtils.handleNull(value).replaceAll("[ ]+","").trim());
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ local.add(new LocalVariable(index,f,variable));
|
|
|
+ }
|
|
|
+ return local;
|
|
|
+ }
|
|
|
+
|
|
|
+ private void putEle(String f,List<FormData> ele,Map<String, Object> currentMap,FormData fd){
|
|
|
+ @SuppressWarnings("unchecked")
|
|
|
+ Map<String,Object> em = (Map<String, Object>) currentMap.computeIfAbsent(E,(k)-> new HashMap<>());
|
|
|
+ if(f.split("[/+\\-*]").length>1&&ele.stream().map(e->e.getCoordsList().size()).max(Comparator.comparingInt(e->e)).orElse(1)==1&&fd.getCoordsList().size()==1){
|
|
|
+ ele.forEach(e->{
|
|
|
+ Object value=e.getValues().get(0).getValue();
|
|
|
+ if(CustomFunction.isNumber(value)){
|
|
|
+ if(StringUtils.isDouble(value)||f.contains("/")){
|
|
|
+ em.put(e.getCode(), Double.parseDouble(value.toString()));
|
|
|
+ }else{
|
|
|
+ em.put(e.getCode(),StringUtils.handleObj2Integer(value));
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ em.put(e.getCode(),value);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }else{
|
|
|
+ ele.forEach(e->{
|
|
|
+ em.put(e.getCode(),e.getRawValue());
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
/**附表处理*/
|
|
|
public void forSubTb(){
|
|
@@ -864,7 +878,8 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
|
/*检查是否存在附表,不存在挂载*/
|
|
|
List<NodeTable> subTabList = this.tec.getTableAll().stream().filter(e -> e.getNodeName().contains("附表")).collect(Collectors.toList());
|
|
|
if (subTabList.size() == 0) {
|
|
|
- boolean pd=tec.getTableAll().stream().anyMatch(e->e.getTableType().equals(5));
|
|
|
+ linkSub(subTabList);
|
|
|
+ /* boolean pd=tec.getTableAll().stream().anyMatch(e->e.getTableType().equals(5));
|
|
|
WbsTreePrivate sub = wbsTreePrivateService.getOne(Wrappers.<WbsTreePrivate>lambdaQuery().and(e->e.eq(WbsTreePrivate::getNodeName, pd?"质量检验评定表(附表)":"质量检验表(附表)").or().eq(WbsTreePrivate::getFullName, pd?"质量检验评定表(附表)":"质量检验表(附表)")).eq(WbsTreePrivate::getProjectId, tec.getProjectId()).eq(WbsTreePrivate::getIsLinkTable,2));
|
|
|
if (sub == null) {
|
|
|
this.tec.getLog().put(FormulaLog.SUB_TAB,"该项目没有挂有附表信息");
|
|
@@ -873,25 +888,26 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
|
NodeTable one = this.tec.getTableAll().get(0);
|
|
|
WbsTreeContract wtc = this.wbsTreeContractService.getOne(Wrappers.<WbsTreeContract>lambdaQuery().eq(WbsTreeContract::getParentId, one.getParentId()).eq(WbsTreeContract::getContractId,tec.getContractId()).eq(WbsTreeContract::getWbsId, one.getWbsId()).and(e->e.eq(WbsTreeContract::getNodeName, pd?"质量检验评定表(附表)":"质量检验表(附表)").or().eq(WbsTreeContract::getFullName, pd?"质量检验评定表(附表)":"质量检验表(附表)")));
|
|
|
if (wtc != null) {
|
|
|
- /*附表的顺序在检验单或者评定表之后,默认最后*/
|
|
|
+ *//*附表的顺序在检验单或者评定表之后,默认最后*//*
|
|
|
int sort=this.tec.getTableAll().stream().filter(e ->e.getTableType().equals(1) || e.getTableType().equals(5)).map(NodeTable::getSort).max(Integer::compareTo).orElse(1000);
|
|
|
this.wbsTreeContractService.update(Wrappers.<WbsTreeContract>lambdaUpdate()
|
|
|
.set(WbsTreeContract::getSort,sort).set(WbsTreeContract::getContractType,-1).set(WbsTreeContract::getAncestors,one.getAncestors())
|
|
|
.set(WbsTreeContract::getIsCopeTab,2)
|
|
|
.eq(WbsTreeContract::getPKeyId,wtc.getPKeyId()));
|
|
|
- /*只需要挂载一张*/
|
|
|
+ *//*只需要挂载一张*//*
|
|
|
NodeTable obj = BeanUtil.copy(wtc, NodeTable.class);
|
|
|
tec.getTableAll().add(obj);
|
|
|
subTabList.add(obj);
|
|
|
}
|
|
|
- }
|
|
|
+ }*/
|
|
|
}
|
|
|
NodeTable first = subTabList.get(0);
|
|
|
if (tec.getTableInfoList().stream().noneMatch(e -> StringUtils.isEquals(e.getPkeyId(), first.getPKeyId()))) {
|
|
|
/*找不到附表表单数据,则从数据库加载*/
|
|
|
- JSONArray dataArray = new JSONArray();
|
|
|
+ loadSubData(subTabList,first);
|
|
|
+ /* JSONArray dataArray = new JSONArray();
|
|
|
for (NodeTable data : subTabList) {
|
|
|
- /*自动挂载附表情况下,装配TableInfo数据*/
|
|
|
+ *//*自动挂载附表情况下,装配TableInfo数据*//*
|
|
|
R bussDataInfo = this.excelTabService.getBussDataInfo(data.getPKeyId(), 1);
|
|
|
@SuppressWarnings("unchecked")
|
|
|
Map<String, Object> data1 = (Map<String, Object>) bussDataInfo.getData();
|
|
@@ -909,14 +925,14 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
|
e.setGroupId(example.getGroupId());
|
|
|
});
|
|
|
tec.getTableInfoList().addAll(subTableInfo);
|
|
|
- /*获取附表元素定位集*/
|
|
|
- /*tec.getCoordinateMap().put(subTabList.get(0).getInitTableName(), FormulaUtils.getElementCell(first.getHtmlUrl()));*/
|
|
|
+ *//*获取附表元素定位集*//*
|
|
|
+ *//*tec.getCoordinateMap().put(subTabList.get(0).getInitTableName(), FormulaUtils.getElementCell(first.getHtmlUrl()));*//*
|
|
|
tec.getCoordinateMap().computeIfAbsent(subTabList.get(0).getInitTableName(),k->FormulaUtils.getElementCell(first.getHtmlUrl()));
|
|
|
- /*附表元素关键信息*/
|
|
|
+ *//*附表元素关键信息*//*
|
|
|
List<Map<String, Object>> elementMaps = this.jdbcTemplate.queryForList("select b.e_name ename , CONCAT(a.tab_en_name,':',b.e_key) code , b.e_key ekey ,b.id fieldId,a.tab_en_name tableName from m_table_info a join m_wbs_form_element b on a.id = b.f_id where a.tab_en_name='" + first.getInitTableName() + "' and b.is_deleted=0 ");
|
|
|
if (Func.isNotEmpty(elementMaps)) {
|
|
|
elementMaps.forEach(e->{
|
|
|
- /*装配元素*/
|
|
|
+ *//*装配元素*//*
|
|
|
String values=subTableInfo.stream().map(TableInfo::getDataMap).map(m->m.get(StringUtils.handleNull(e.get("ekey")))).filter(StringUtils::isNotEmpty).collect(Collectors.joining(";;"));
|
|
|
FormData tmp= createFormDataFast(StringUtils.handleNull(e.get("ename")),StringUtils.handleNull(e.get("code")),values);
|
|
|
if(tmp!=null){
|
|
@@ -929,7 +945,7 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
|
tec.formDataList.add(tmp);
|
|
|
}
|
|
|
});
|
|
|
- /*生成元素映射关系*/
|
|
|
+ *//*生成元素映射关系*//*
|
|
|
subTabList.forEach(s->{
|
|
|
elementMaps.forEach(e->{
|
|
|
KeyMapper km = new KeyMapper();
|
|
@@ -941,7 +957,7 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- }
|
|
|
+ }*/
|
|
|
}
|
|
|
/*获取封装好的附表元素*/
|
|
|
List<FormData> subTableFds=tec.formDataMap.values().stream().filter(e->StringUtils.isEquals(first.getInitTableName(),e.getTableName())).collect(Collectors.toList());
|
|
@@ -969,7 +985,8 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
|
sta.flush();
|
|
|
}
|
|
|
/*把主表的表头表尾信息拷贝*/
|
|
|
- String mainTableName = this.tec.getTableAll().stream().filter(e -> e.getTableType().equals(1) || e.getTableType().equals(5)).map(NodeTable::getInitTableName).findFirst().orElse("");
|
|
|
+ headerFooterSub(subTableFds);
|
|
|
+ /* String mainTableName = tec.getTableAll().stream().filter(e -> e.getTableType().equals(1) || e.getTableType().equals(5)).map(NodeTable::getInitTableName).findFirst().orElse("");
|
|
|
if(Func.isNotBlank(mainTableName)){
|
|
|
List<FormData> sourceFds=tec.getFormDataMap().values().stream().filter(s->!s.empty()).filter(s->StringUtils.isEquals(s.getTableName(),mainTableName)).collect(Collectors.toList());
|
|
|
Map<String,Object> copyMap= new HashMap<>();
|
|
@@ -983,7 +1000,7 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
|
t.getValues().forEach(e->e.setValue(val));
|
|
|
t.setUpdate(1);
|
|
|
});
|
|
|
- }
|
|
|
+ }*/
|
|
|
}
|
|
|
|
|
|
} catch (Exception e) {
|
|
@@ -992,6 +1009,106 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
|
}
|
|
|
|
|
|
|
|
|
+ /*引入附表*/
|
|
|
+ private void linkSub( List<NodeTable> subTabList ){
|
|
|
+ boolean pd=tec.getTableAll().stream().anyMatch(e->e.getTableType().equals(5));
|
|
|
+ WbsTreePrivate sub = wbsTreePrivateService.getOne(Wrappers.<WbsTreePrivate>lambdaQuery().and(e->e.eq(WbsTreePrivate::getNodeName, pd?"质量检验评定表(附表)":"质量检验表(附表)").or().eq(WbsTreePrivate::getFullName, pd?"质量检验评定表(附表)":"质量检验表(附表)")).eq(WbsTreePrivate::getProjectId, tec.getProjectId()).eq(WbsTreePrivate::getIsLinkTable,2));
|
|
|
+ if (sub == null) {
|
|
|
+ this.tec.getLog().put(FormulaLog.SUB_TAB,"该项目没有挂有附表信息");
|
|
|
+ } else {
|
|
|
+ this.wbsTreePrivateService.addWbsTreeContractInfo(this.tec.getCurrentNode().getPkId().toString(), sub.getPKeyId().toString(), tec.getContractId());
|
|
|
+ NodeTable one = this.tec.getTableAll().get(0);
|
|
|
+ WbsTreeContract wtc = this.wbsTreeContractService.getOne(Wrappers.<WbsTreeContract>lambdaQuery().eq(WbsTreeContract::getParentId, one.getParentId()).eq(WbsTreeContract::getContractId,tec.getContractId()).eq(WbsTreeContract::getWbsId, one.getWbsId()).and(e->e.eq(WbsTreeContract::getNodeName, pd?"质量检验评定表(附表)":"质量检验表(附表)").or().eq(WbsTreeContract::getFullName, pd?"质量检验评定表(附表)":"质量检验表(附表)")));
|
|
|
+ if (wtc != null) {
|
|
|
+ /*附表的顺序在检验单或者评定表之后,默认最后*/
|
|
|
+ int sort=this.tec.getTableAll().stream().filter(e ->e.getTableType().equals(1) || e.getTableType().equals(5)).map(NodeTable::getSort).max(Integer::compareTo).orElse(1000);
|
|
|
+ this.wbsTreeContractService.update(Wrappers.<WbsTreeContract>lambdaUpdate()
|
|
|
+ .set(WbsTreeContract::getSort,sort).set(WbsTreeContract::getContractType,-1).set(WbsTreeContract::getAncestors,one.getAncestors())
|
|
|
+ .set(WbsTreeContract::getIsCopeTab,2)
|
|
|
+ .eq(WbsTreeContract::getPKeyId,wtc.getPKeyId()));
|
|
|
+ /*只需要挂载一张*/
|
|
|
+ NodeTable obj = BeanUtil.copy(wtc, NodeTable.class);
|
|
|
+ tec.getTableAll().add(obj);
|
|
|
+ subTabList.add(obj);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ /*载入附表数据*/
|
|
|
+ private void loadSubData(List<NodeTable> subTabList,NodeTable first ){
|
|
|
+ /*找不到附表表单数据,则从数据库加载*/
|
|
|
+ JSONArray dataArray = new JSONArray();
|
|
|
+ for (NodeTable data : subTabList) {
|
|
|
+ /*自动挂载附表情况下,装配TableInfo数据*/
|
|
|
+ R bussDataInfo = this.excelTabService.getBussDataInfo(data.getPKeyId(), 1);
|
|
|
+ @SuppressWarnings("unchecked")
|
|
|
+ Map<String, Object> data1 = (Map<String, Object>) bussDataInfo.getData();
|
|
|
+ data1.put("pkeyId",data.getPKeyId());
|
|
|
+ dataArray.add(data1);
|
|
|
+ }
|
|
|
+ List<TableInfo> subTableInfo = this.excelTabService.getTableInfoList(dataArray);
|
|
|
+ TableInfo example = tec.getTableInfoList().get(0);
|
|
|
+ subTableInfo.forEach(e -> {
|
|
|
+ e.setToBeUpdated(true);
|
|
|
+ e.setBusinessId(null);
|
|
|
+ e.setContractId(example.getContractId());
|
|
|
+ e.setClassify(example.getClassify());
|
|
|
+ e.setProjectId(example.getProjectId());
|
|
|
+ e.setGroupId(example.getGroupId());
|
|
|
+ });
|
|
|
+ tec.getTableInfoList().addAll(subTableInfo);
|
|
|
+ /*获取附表元素定位集*/
|
|
|
+ /*tec.getCoordinateMap().put(subTabList.get(0).getInitTableName(), FormulaUtils.getElementCell(first.getHtmlUrl()));*/
|
|
|
+ tec.getCoordinateMap().computeIfAbsent(subTabList.get(0).getInitTableName(),k->FormulaUtils.getElementCell(first.getHtmlUrl()));
|
|
|
+ /*附表元素关键信息*/
|
|
|
+ List<Map<String, Object>> elementMaps = this.jdbcTemplate.queryForList("select b.e_name ename , CONCAT(a.tab_en_name,':',b.e_key) code , b.e_key ekey ,b.id fieldId,a.tab_en_name tableName from m_table_info a join m_wbs_form_element b on a.id = b.f_id where a.tab_en_name='" + first.getInitTableName() + "' and b.is_deleted=0 ");
|
|
|
+ if (Func.isNotEmpty(elementMaps)) {
|
|
|
+ elementMaps.forEach(e->{
|
|
|
+ /*装配元素*/
|
|
|
+ String values=subTableInfo.stream().map(TableInfo::getDataMap).map(m->m.get(StringUtils.handleNull(e.get("ekey")))).filter(StringUtils::isNotEmpty).collect(Collectors.joining(";;"));
|
|
|
+ FormData tmp= createFormDataFast(StringUtils.handleNull(e.get("ename")),StringUtils.handleNull(e.get("code")),values);
|
|
|
+ if(tmp!=null){
|
|
|
+ String idStr =StringUtils.handleNull(e.get("fieldId"));
|
|
|
+ if(Func.isNotEmpty(idStr)) {
|
|
|
+ tmp.setId(Func.toLong(idStr));
|
|
|
+ }
|
|
|
+ tmp.setIsCurrentNodeElement(true);
|
|
|
+ tec.formDataMap.put(tmp.getCode(),tmp);
|
|
|
+ tec.formDataList.add(tmp);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ /*生成元素映射关系*/
|
|
|
+ subTabList.forEach(s->{
|
|
|
+ elementMaps.forEach(e->{
|
|
|
+ KeyMapper km = new KeyMapper();
|
|
|
+ km.setPkId(s.getPKeyId());
|
|
|
+ km.setField(StringUtils.handleNull(e.get("ekey")));
|
|
|
+ km.setFieldId(Func.toLong(e.get("fieldId")));
|
|
|
+ km.setTableName(StringUtils.handleNull(e.get("tableName")));
|
|
|
+ this.tec.getKeyMappers().add(km);
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /*同步主表的表头表尾信息*/
|
|
|
+ private void headerFooterSub(List<FormData> subTableFds){
|
|
|
+ String mainTableName = tec.getTableAll().stream().filter(e -> e.getTableType().equals(1) || e.getTableType().equals(5)).map(NodeTable::getInitTableName).findFirst().orElse("");
|
|
|
+ if(Func.isNotBlank(mainTableName)){
|
|
|
+ List<FormData> sourceFds=tec.getFormDataMap().values().stream().filter(s->!s.empty()).filter(s->StringUtils.isEquals(s.getTableName(),mainTableName)).collect(Collectors.toList());
|
|
|
+ Map<String,Object> copyMap= new HashMap<>();
|
|
|
+ if(sourceFds.size()>0){
|
|
|
+ sourceFds.forEach(d->{
|
|
|
+ copyMap.put(d.getSimplifyName(),d.getValues().stream().map(ElementData::getValue).filter(StringUtils::isNotEmpty).findAny().orElse(""));
|
|
|
+ });
|
|
|
+ }
|
|
|
+ subTableFds.stream().filter(s-> !SubTable.KEYS.contains(s.getEName().trim())).filter(s->copyMap.containsKey(s.getSimplifyName())).forEach(t->{
|
|
|
+ Object val = copyMap.get(t.getSimplifyName());
|
|
|
+ t.getValues().forEach(e->e.setValue(val));
|
|
|
+ t.setUpdate(1);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
/**汇总处理*/
|
|
|
public void summaryCalc(){
|