|
@@ -256,6 +256,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
List<TableInfo> result = new ArrayList<>();
|
|
List<TableInfo> result = new ArrayList<>();
|
|
for (int m = 0; m < dataArray.size(); m++) {
|
|
for (int m = 0; m < dataArray.size(); m++) {
|
|
TableInfo tableInfo = new TableInfo();
|
|
TableInfo tableInfo = new TableInfo();
|
|
|
|
+ tableInfo.setToBeUpdated(true);
|
|
JSONObject dataInfo2 = dataArray.getJSONObject(m);
|
|
JSONObject dataInfo2 = dataArray.getJSONObject(m);
|
|
//
|
|
//
|
|
tableInfo.setContractId(dataInfo2.getString("contractId"));
|
|
tableInfo.setContractId(dataInfo2.getString("contractId"));
|
|
@@ -351,6 +352,42 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
FormulaLog log = new FormulaLog();
|
|
FormulaLog log = new FormulaLog();
|
|
/*每次都是部分表单提交,保证跨节点跨表取数正常,其次是反向依赖的被动刷新*/
|
|
/*每次都是部分表单提交,保证跨节点跨表取数正常,其次是反向依赖的被动刷新*/
|
|
List<NodeTable> tableAll = createNodeTables(nodeId, tableInfoList.get(0).getContractId(), tableInfoList.get(0).getProjectId(), type);
|
|
List<NodeTable> tableAll = createNodeTables(nodeId, tableInfoList.get(0).getContractId(), tableInfoList.get(0).getProjectId(), type);
|
|
|
|
+ if(tableAll.size()>tableInfoList.size()){
|
|
|
|
+ TableInfo example = tableInfoList.get(0);
|
|
|
|
+ /*补充缺失的数据*/
|
|
|
|
+ List<Long> cp= tableInfoList.stream().map(TableInfo::getPkeyId).map(Long::parseLong).collect(Collectors.toList());
|
|
|
|
+ List<Long> load=tableAll.stream().map(NodeTable::getPKeyId).filter(pk->!cp.contains(pk)).collect(Collectors.toList());
|
|
|
|
+ Map<Long,String> keyMap=tableAll.stream().collect(Collectors.toMap(NodeTable::getPKeyId,NodeTable::getInitTableName));
|
|
|
|
+ Map<String,List<Long>> loadMap=load.stream().collect(Collectors.groupingBy(keyMap::get,Collectors.toList()));
|
|
|
|
+ loadMap.entrySet().parallelStream().forEach(entry->{
|
|
|
|
+ /*init_table_name*/
|
|
|
|
+ String k=entry.getKey();
|
|
|
|
+ /*pkeyId集合*/
|
|
|
|
+ List<Long> v= entry.getValue();
|
|
|
|
+ List<Map<String,Object>> dataMap= this.jdbcTemplate.queryForList("select * from "+k+" where p_key_id in ("+v.stream().map(Objects::toString).collect(Collectors.joining(","))+")");
|
|
|
|
+ if(dataMap.size()>0){
|
|
|
|
+ dataMap.forEach(map->{
|
|
|
|
+ TableInfo e = new TableInfo();
|
|
|
|
+ e.setPkeyId(map.get("p_key_id").toString());
|
|
|
|
+ e.setDataMap(new LinkedHashMap<>());
|
|
|
|
+ e.setToBeUpdated(false);
|
|
|
|
+ e.setBusinessId(null);
|
|
|
|
+ e.setContractId(example.getContractId());
|
|
|
|
+ e.setClassify(example.getClassify());
|
|
|
|
+ e.setProjectId(example.getProjectId());
|
|
|
|
+ e.setGroupId(example.getGroupId());
|
|
|
|
+ map.forEach((key,value)->{
|
|
|
|
+ if(key.startsWith("key_")){
|
|
|
|
+ e.getDataMap().put(key,Func.toStr(value));
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ tableInfoList.add(e);
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ List<Long> tableAllIds=tableAll.stream().map(NodeTable::getPKeyId).collect(Collectors.toList());
|
|
|
|
+ tableInfoList.sort(Comparator.comparingInt(a -> tableAllIds.indexOf(Long.parseLong(a.getPkeyId()))));
|
|
|
|
+ }
|
|
StopWatch stopWatch = new StopWatch();
|
|
StopWatch stopWatch = new StopWatch();
|
|
List<KeyMapper> keyMappers = this.formulaService.getKeyMapperList(tableAll.stream().map(NodeTable::getPKeyId).filter(Func::isNotEmpty).collect(Collectors.toList()), tableInfoList.get(0).getProjectId(), String.valueOf(nodeId), type);
|
|
List<KeyMapper> keyMappers = this.formulaService.getKeyMapperList(tableAll.stream().map(NodeTable::getPKeyId).filter(Func::isNotEmpty).collect(Collectors.toList()), tableInfoList.get(0).getProjectId(), String.valueOf(nodeId), type);
|
|
if (Func.isNotEmpty(keyMappers) && Func.isNotEmpty(tableAll)) {
|
|
if (Func.isNotEmpty(keyMappers) && Func.isNotEmpty(tableAll)) {
|