Эх сурвалжийг харах

Merge remote-tracking branch 'origin/master'

liuyc 1 жил өмнө
parent
commit
4dc8146cd8

+ 15 - 0
blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/dto/TableFormMapper.java

@@ -0,0 +1,15 @@
+package org.springblade.manager.dto;
+
+import lombok.Data;
+
+/**
+ * @author yangyj
+ * @Date 2023/10/12 17:12
+ * @description TODO
+ */
+@Data
+public class TableFormMapper {
+    private Long pkeyId;
+    private String tableName;
+    private String url;
+}

+ 5 - 4
blade-service/blade-land/src/main/java/org/springblade/land/service/impl/ClearingAgreementInfoServiceImpl.java

@@ -134,6 +134,7 @@ public class ClearingAgreementInfoServiceImpl extends BaseServiceImpl<ClearingAg
         //生成补偿费发放统计表
         buildPdf3(linkTables.get(2),ids);
         //生成补偿费明细表
+//        buildPdf4();
         //生成补偿资金数量分配表
         //生成面积统计明细表
         //合并PDF
@@ -228,7 +229,7 @@ public class ClearingAgreementInfoServiceImpl extends BaseServiceImpl<ClearingAg
                     if (!batchKey.contains(dict)) {
                         TableDataVO vo = listMap2.get(dict).get(0);
                         switch (dict) {
-                            case 20:
+                            case 301:
                                 //合计补偿总计
                                 DataInfo.put(vo.getTabKey(), big);
                                 break;
@@ -270,7 +271,7 @@ public class ClearingAgreementInfoServiceImpl extends BaseServiceImpl<ClearingAg
                 for (Integer dict : elementMap.keySet()) {
                     String s1 = tableKeys.get(elementMap.get(dict));
                     switch (dict){
-                        case 99:
+                        case 198:
                             //当天日期
                             DataInfo.put(s1,LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy年MM月dd日")));
                             break;
@@ -342,11 +343,11 @@ public class ClearingAgreementInfoServiceImpl extends BaseServiceImpl<ClearingAg
                 for (Integer dict : elementMap.keySet()) {
                     String s1 = tableKeys.get(elementMap.get(dict));
                     switch (dict){
-                        case 99:
+                        case 198:
                             //当天日期
                             DataInfo.put(s1,LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy年MM月dd日")));
                             break;
-                        case 100:
+                        case 199:
                             //周期
                             DataInfo.put(s1,stage);
                             break;

+ 18 - 14
blade-service/blade-land/src/main/java/org/springblade/land/service/impl/CompensationInfoServiceImpl.java

@@ -248,8 +248,10 @@ public class CompensationInfoServiceImpl extends BaseServiceImpl<CompensationInf
         BigDecimal b2 = new BigDecimal(0);
         //地面附着物
         BigDecimal b3 = new BigDecimal(0);
-        //金额总计
+        //时段奖
         BigDecimal b4 = new BigDecimal(0);
+        //金额总计
+        BigDecimal b5 = new BigDecimal(0);
         //农用地面积
         BigDecimal a1 = new BigDecimal(0);
         //建设用地面积
@@ -293,7 +295,7 @@ public class CompensationInfoServiceImpl extends BaseServiceImpl<CompensationInf
                     //循环统计字段
                     for (WbsFormElement element : elements) {
                         Integer dict = element.getDynamicDict();
-                        if (dict.equals(7)){
+                        if (dict.equals(41)){
                             continue;
                         }
                         //获取当前统计字段所有填写的值
@@ -303,10 +305,10 @@ public class CompensationInfoServiceImpl extends BaseServiceImpl<CompensationInf
                             continue;
                         }
                         //单独计算面积
-                        if (dict.equals(6)) {
-                            //统计面积,去找到当前行的地类dict为7
-                            List<WbsFormElement> collect = elements.stream().filter(l -> l.getDynamicDict().equals(7)).collect(Collectors.toList());
-                            //获取dict为7的key,如果key不存在则提示未配置土地性质
+                        if (dict.equals(42)) {
+                            //统计面积,去找到当前行的地类dict为41
+                            List<WbsFormElement> collect = elements.stream().filter(l -> l.getDynamicDict().equals(41)).collect(Collectors.toList());
+                            //获取dict为41的key,如果key不存在则提示未配置土地性质
                             if (collect == null || collect.size() == 0){
                                 throw new ServiceException("未配置地类");
                             }
@@ -341,16 +343,18 @@ public class CompensationInfoServiceImpl extends BaseServiceImpl<CompensationInf
                         }else {
                             //当前统计值
                             try {
-                                if (dict.equals(1)) {
+                                if (dict.equals(80)) {
+                                    str.add(StringUtils.join(vos.stream().map(l -> l.getTabVal()).collect(Collectors.toList()), "、") + "、");
+                                } else if (dict.equals(82)) {
                                     b1 = b1.add(vos.stream().map(l -> new BigDecimal(l.getTabVal())).reduce(BigDecimal.valueOf(0), BigDecimal::add));
-                                } else if (dict.equals(2)) {
+                                } else if (dict.equals(83)) {
                                     b2 = b2.add(vos.stream().map(l -> new BigDecimal(l.getTabVal())).reduce(BigDecimal.valueOf(0), BigDecimal::add));
-                                } else if (dict.equals(3)) {
+                                } else if (dict.equals(84)) {
                                     b3 = b3.add(vos.stream().map(l -> new BigDecimal(l.getTabVal())).reduce(BigDecimal.valueOf(0), BigDecimal::add));
-                                } else if (dict.equals(4)) {
-                                    str.add(StringUtils.join(vos.stream().map(l -> l.getTabVal()).collect(Collectors.toList()), "、") + "、");
-                                } else if (dict.equals(5)) {
+                                } else if (dict.equals(85)){
                                     b4 = b4.add(vos.stream().map(l -> new BigDecimal(l.getTabVal())).reduce(BigDecimal.valueOf(0), BigDecimal::add));
+                                } else if (dict.equals(86)) {
+                                    b5 = b5.add(vos.stream().map(l -> new BigDecimal(l.getTabVal())).reduce(BigDecimal.valueOf(0), BigDecimal::add));
                                 }
                             } catch (Exception e) {
                                 throw new ServiceException("金额字段不能包含其他字符,请重新填写");
@@ -367,10 +371,10 @@ public class CompensationInfoServiceImpl extends BaseServiceImpl<CompensationInf
                 //设置金额
                 info.setLandMoney(b1);
                 info.setCropsMoney(b2.add(b3));
-                if (!info.getLandMoney().add(info.getCropsMoney()).equals(b4)){
+                if (!info.getLandMoney().add(info.getCropsMoney()).add(b4).equals(b5)){
                     throw new ServiceException("补偿金额合计不对,请校验土地、青苗、等金额之和,是否等于补偿金额合计");
                 }
-                info.setAllMoney(b4);
+                info.setAllMoney(b5);
                 //设置面积
                 info.setAreaA(a1);
                 info.setAreaB(a2);

+ 42 - 16
blade-service/blade-manager/src/main/java/com/mixsmart/utils/FormulaUtils.java

@@ -47,6 +47,7 @@ import java.security.NoSuchAlgorithmException;
 import java.util.*;
 import java.util.List;
 import java.util.concurrent.atomic.AtomicInteger;
+import java.util.function.Function;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 import java.util.stream.Collectors;
@@ -151,7 +152,7 @@ public class FormulaUtils {
     }*/
 
 
-    /**默认去空*/
+    /**写人元素数据,每个元素都是一个集合,每页的单元格数量乘以页数就是总长度*/
     public  static void write(FormData fd, Object data){
         write(fd,data,false);
     }
@@ -174,12 +175,20 @@ public class FormulaUtils {
                 }
                 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{
                             /*日期类型的元素只获取最后一个非空*/
                             if(StringUtils.isEquals(4,fd.getEType())){
                                 fd.getValues().get(0).setValue(values.stream().filter(StringUtils::isNotEmpty).reduce((first, second) -> second).orElse(null));
+                            }else if(values.stream().filter(StringUtils::isNotEmpty).distinct().count()==1L){
+                                /*如果输入元素全是是一样的内容,则输入出元素则每个单元格也写入一样的内容*/
+                                 values.stream().filter(StringUtils::isNotEmpty).findFirst().ifPresent(t->{
+                                     for(int n=0;n<fd.getValues().size();n++){
+                                         fd.getValues().get(n).setValue(t);
+                                     }
+                                 });
                             }else{
                                 fd.getValues().get(0).setValue(values.stream().map(StringUtils::handleNull).collect(Collectors.joining("、")));
                             }
@@ -752,25 +761,42 @@ public class FormulaUtils {
 public static List<FormData>  registerFd(List<String> curTableNames, List<FormData> processFds){
         Map<Boolean,List<FormData>> group = processFds.stream().collect(Collectors.partitioningBy(e->curTableNames.contains(e.getTableName())));
         List<FormData> curFormDatas =group.get(true);
+        /*提交叶包含元素*/
+        List<FormData> initiator= new ArrayList<>(curFormDatas);
         List<FormData> other=group.get(false);
-        List<FormData> curFormDatasAdd;
-        int loop=0;
-        do{
-            loop++;
-            Set<String> codeSet= curFormDatas.stream().map(FormData::getCode).collect(Collectors.toSet());
-            Map<Boolean,List<FormData>> groupTmp = other.stream().collect(Collectors.partitioningBy(e->codeSet.contains(e.getCode())));
-             curFormDatasAdd=groupTmp.get(true);
-            if(curFormDatasAdd.isEmpty()){
-                loop=MAX_LOOP;
-            }else{
-                curFormDatas.addAll(curFormDatasAdd);
-            }
-            other=groupTmp.get(false);
-            /*无元素可添加或者没有添加新的元素或者循环次数超过20则结束*/
-        }while (!other.isEmpty()&&loop<MAX_LOOP);
+    /*当前提交页元素影响到的元素都要重新执行公式*/
+        pick(curFormDatas,other,curFormDatas,fds->fds.stream().map(FormData::getCode).collect(Collectors.toSet()));
+    /*当前提交页的元素公式依赖加载*/
+        pick(initiator,other,curFormDatas,fds->fds.stream().filter(FormData::executable).flatMap(f->f.getFormula().getRelyList().stream()).collect(Collectors.toSet()));
         return curFormDatas;
 }
 
+
+    /**
+     * @Description  调训符合条件的元素
+     * @Param [initiator 初始集合, other 待选集合, curFormDatas 结果集, function:挑选方法]
+     * @return void
+     * @Author yangyj
+     * @Date 2023.10.12 14:53
+     **/
+public static void pick(List<FormData> initiator,List<FormData> other,List<FormData> curFormDatas ,Function<List<FormData>,Set<String>> function){
+    List<FormData>  curFormDatasAdd=new ArrayList<>(initiator);
+    int loop=0;
+    do{
+        loop++;
+        Set<String> codeSet= function.apply(curFormDatasAdd);
+        Map<Boolean,List<FormData>> groupTmp = other.stream().collect(Collectors.partitioningBy(e->codeSet.contains(e.getCode())));
+        curFormDatasAdd=groupTmp.get(true);
+        if(curFormDatasAdd.isEmpty()){
+            loop=MAX_LOOP;
+        }else{
+            curFormDatas.addAll(curFormDatasAdd);
+        }
+        other=groupTmp.get(false);
+    }while (!other.isEmpty()&&loop<MAX_LOOP);
+}
+
+
 /**最小加载页面*/
 public static Map<String,List<Long>> relatedPages(List<FormData> curFormDatas ,List<NodeTable> tableAll){
    Set<String> initTableNames= curFormDatas.stream().map(FormData::getTableName).collect(Collectors.toSet());

+ 1 - 1
blade-service/blade-manager/src/main/java/org/springblade/manager/formula/ITurnPointCalculator.java

@@ -17,7 +17,7 @@ import static org.springblade.manager.formula.TurnPoint.*;
  * @author yangyj
  */
 public interface ITurnPointCalculator {
-    Long VERSION=2309151430L;
+    Long VERSION=202310121730L;
      String ZD_REG="(?i)zd\\d+";
     static List<TurnPoint> create(List<Map<String, Object>> data, LinkedHashMap<String, String> configMap,LevelInfo levelInfo) {
         /*1.验证数据的合理性,如果已经合理则不需要计算

+ 139 - 45
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/FormulaServiceImpl.java

@@ -33,6 +33,7 @@ import org.springblade.manager.vo.AppWbsTreeContractVO;
 import org.springblade.manager.vo.CurrentNode;
 import org.springframework.context.annotation.Scope;
 import org.springframework.context.annotation.ScopedProxyMode;
+import org.springframework.http.converter.json.MappingJacksonValue;
 import org.springframework.jdbc.core.JdbcTemplate;
 import org.springframework.stereotype.Service;
 import org.springframework.web.context.WebApplicationContext;
@@ -132,11 +133,12 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
             /*公式参数*/
             option();
             /*评定表*/
-            assessmentForm();
+            assessmentForm2();
         }
         return this;
     }
 
+    /*單元格配置信息*/
     public  void option(){
             FormulaOption formulaOption = this.formulaOptionService.getById(tec.getCurrentNode().getPkId());
             if (formulaOption != null) {
@@ -360,7 +362,95 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
             e.printStackTrace();
         }
     }
-
+    public void assessmentForm2(){
+        if(!ExecuteType.INSPECTION.equals(tec.getExecuteType())){
+            return;
+        }
+        try {
+            if (tec.getTableAll().stream().anyMatch(e -> StringUtils.isEquals(e.getTableType(), 5))) {
+                /*评定节点*/
+                FormulaDataBlock fdb = findFdb();
+                if (!StringUtils.isEquals("[]", fdb.getVal())) {
+                    List<ElementBlock> elementBlockList = JSON.parseArray(fdb.getVal(), ElementBlock.class);
+                    Map<String, Measurement> itemsMap = new HashMap<>();
+                    tec.formDataMap.values().stream().filter(FormData::getIsCurrentNodeElement).forEach(e -> {
+                        String eName = e.getEName();
+                        if (eName.contains("实测") && !eName.contains("平均") && !eName.contains("合格率") && !eName.contains("判")) {
+                            String point = FormulaUtils.parseItemName(eName);
+                            /*评定匹配检验单的元素用相似匹配*/
+                            Measurement measurement = itemsMap.computeIfAbsent(point, k -> new Measurement(point));
+                            measurement.setValue(e);
+                        }
+                    });
+                    if (itemsMap.size() > 0) {
+                        /*表内用同行匹配*/
+                        List<FormData> primary = tec.getFormDataMap().values().stream().filter(FormData::getIsCurrentNodeElement).filter(v -> v.getEName().contains("率") || v.getEName().contains("判")).collect(Collectors.toList());
+                        itemsMap.values().forEach(i -> {
+                            FormData vf = i.getValue();
+                            primary.stream().filter(p -> vf.getMaxRow().equals(p.getMaxRow()) && vf.getTableName().equals(p.getTableName())).forEach(t -> {
+                                if (t.getEName().contains("合格率")) {
+                                    i.setPass(t);
+                                } else if (t.getEName().contains("判")) {
+                                    i.setJudge(t);
+                                }
+                            });
+                        });
+                        AtomicBoolean update = new AtomicBoolean(false);
+                        itemsMap.values().stream().filter(Measurement::isMatching).forEach(t -> {
+                            ElementBlock g = null;
+                            FormData vfd = t.getValue();
+                            if (vfd.executable() && vfd.getFormula().getRelyList() != null) {
+                                List<String> relyList = vfd.getFormula().getRelyList();
+                                /*先从公式去匹配*/
+                                Optional<ElementBlock> op = elementBlockList.stream().filter(e -> relyList.contains(e.getCode())).findAny();
+                                if (op.isPresent()) {
+                                    g = op.get();
+                                }
+                            }else{
+                                /*只有不存在配置的前提下才能尝试自动匹配*/
+                                Optional<ElementBlock> op = elementBlockList.stream().filter(w -> FormulaUtils.similarity(w.getEName(), t.getPoint()) > 0.3).max(Comparator.comparingDouble((ElementBlock b) -> FormulaUtils.similarity(b.getEName(), t.getPoint())));
+                                /*相似匹配*/
+                                if (op.isPresent()) {
+                                    g = op.get();
+                                }
+                            }
+                            if (g != null) {
+                                List<ItemBlock> itemBlockList = g.getList();
+                                int originSize = itemBlockList.size();
+                                List<Long> ids =getNodeType46().stream().map(CurrentNode::getPkId).collect(Collectors.toList());
+                                /*清除那些已经不存在的工序*/
+                                itemBlockList.removeIf(ik -> !ids.contains(ik.getPkeyId()));
+                                if (itemBlockList.size() > 0) {
+                                    int total = itemBlockList.stream().mapToInt(ItemBlock::getSubTotal).sum();
+                                    int passNum = itemBlockList.stream().mapToInt(ItemBlock::getSubPass).sum();
+                                    double passRate = 100 * (double) passNum / (double) total;
+                                    FormulaUtils.write(t.getPass(), StringUtils.number2String(passRate, 1), false);
+                                    if (passRate >= 60) {
+                                        FormulaUtils.write(t.getJudge(), "合格", false);
+                                    }
+//                                    itemBlockList.sort(Comparator.comparingInt(a -> ids.indexOf(a.getPkeyId())));
+                                    List<String> values = itemBlockList.stream().map(ItemBlock::getData).flatMap(v -> v.stream().flatMap(Collection::stream)).map(Object::toString).collect(Collectors.toList());
+                                    int scale = StringUtils.getScale(values);
+                                    FormulaUtils.write(t.getValue(), values.stream().map(u -> StringUtils.number2String(u, scale)).collect(Collectors.toList()), true);
+//
+                                }
+                                t.flush();
+                                if (originSize > 0 && originSize != itemBlockList.size()) {
+                                    g.setList(itemBlockList);
+                                    update.set(true);
+                                }
+                            }
+                        });
+                        if (update.get()) {
+                            this.formulaDataBlockService.saveOrUpdate(fdb);
+                        }
+                    }
+                }
+            }
+        }catch (Exception e){
+            e.printStackTrace();
+        }
+    }
 
     public void  descendantType46(Object id, List<Map<String,Object>> listMaps){
         String sql="select p_Key_id pkId,id,node_type nodeType,table_type tableType  from m_wbs_tree_contract where parent_id =? and is_deleted=0";
@@ -452,51 +542,54 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
         /*数据池里面没有任何元素匹配和当前依赖匹配*/
         if(Func.isNotEmpty(missingList)){
             StaticLog.info("需要挂载的元素{}", String.join(";", missingList));
-           // Map<String, Object> elementInfoMap=this.getElementInfoByCodes(String.join(",",missingList));
             Map<String,FormData> fdsMap = this.createFormDataByCode(String.join(",",missingList));
             /*1从当前节点其它表格中查找匹配的元素*/
             List<String> removeList=new ArrayList<>();
-            for (String r : missingList) {
-                String tn = r.substring(0, r.indexOf(StringPool.COLON));
-                String key = r.substring(r.indexOf(StringPool.COLON) + 1);
-                FormData fd=  fdsMap.get(r);
-             /*   if (tec.getTableAll().stream().anyMatch(e->StringUtils.isEquals(e.getInitTableName(),fd.getTableName()))) {
-                    removeList.add(r);
-                    String tableName = fd.getTableName();
-                    if (!tec.getCoordinateMap().containsKey(tableName)) {
-                        tec.getCoordinateMap().put(tableName, FormulaUtils.getElementCell());
-                    }
-                    List<Map<String, Object>> tableDatas = this.jdbcTemplate.queryForList("select * from " + tableName + " where p_key_id in(" + nodeList.stream().map(NodeTable::getPKeyId).map(StringUtils::handleNull).collect(Collectors.joining(",")) + ")");
-                    fill(tableDatas, removeList, tn, key, StringUtils.handleNull(elementInfo.get("ename")));
-                }*/
-            }
-            if (Func.isNotEmpty(removeList)) {
-                    /*移除已经找到的元素数据*/
-                missingList.removeIf(removeList::contains);
-            }
-            if(Func.isNotEmpty(missingList)){
-                /*2从当前节点的兄弟节点中查找匹配的元素*/
-                CurrentNode currentNode = tec.getCurrentNode();
-                List<Map<String,Object>> tableNamePkIdsMaps= this.jdbcTemplate.queryForList("select c.init_table_name tableName,c.p_key_id pkId,c.html_url url from (select b.id from m_wbs_tree_contract a join m_wbs_tree_contract b on (a.contract_id=b.contract_id and b.ancestors like CONCAT(a.ancestors,'%')) where a.p_key_id="+currentNode.getPkId()+" and b.is_deleted=0 and b.node_type=6 ORDER BY b.sort) k join m_wbs_tree_contract c on c.parent_id = k.id where  c.contract_id="+tec.getContractId()+" and c.is_deleted=0 ");
-                if(Func.isNotEmpty(tableNamePkIdsMaps)){
-                    // removeList.clear();
-                    missingList.forEach(miss->{
-                      /*  Map<String,Object> elementInfo= (Map<String, Object>) elementInfoMap.get(miss);
-                        String tn = miss.substring(0,miss.indexOf(StringPool.COLON));
-                        String key =miss.substring(miss.indexOf(StringPool.COLON)+1);
-                        String targetIds=tableNamePkIdsMaps.stream().filter(m->StringUtils.isEquals(m.get("tableName"),tn)).map(m->m.get("pkId")).map(StringUtils::handleNull).collect(Collectors.joining(","));
-                        if(Func.isNotEmpty(targetIds)){
-                            if(!this.tec.getCoordinateMap().containsKey(tn)){
-                                tableNamePkIdsMaps.stream().filter(m->StringUtils.isEquals(m.get("tableName"),tn)).findAny().ifPresent(m->{
-                                    this.tec.getCoordinateMap().put(tn,FormulaUtils.getElementCell(StringUtils.handleNull(m.get("url"))));
-                                });
+            /*2从当前节点的兄弟节点中查找匹配的元素*/
+            CurrentNode currentNode = tec.getCurrentNode();
+            String sql= "select c.init_table_name tableName,c.p_key_id pkeyId,c.html_url url from (select b.id from m_wbs_tree_contract a join m_wbs_tree_contract b on (a.contract_id=b.contract_id and b.ancestors like CONCAT(a.ancestors,'%')) where a.p_key_id="+currentNode.getPkId()+" and b.is_deleted=0 and b.node_type=6 ORDER BY b.sort) k join m_wbs_tree_contract c on c.parent_id = k.id where  c.contract_id="+tec.getContractId()+" and c.is_deleted=0 ";
+            List<TableFormMapper> tableNamePkIdsList = this.getSqlList(sql,TableFormMapper.class);
+            if(Func.isNotEmpty(tableNamePkIdsList)) {
+                List<Long> pkeyIds=tec.getTableAll().stream().map(NodeTable::getPKeyId).collect(Collectors.toList());
+                Map<String,List<Long>>tableNamePkIdsMaps=tableNamePkIdsList.stream().filter(m->!pkeyIds.contains(m.getPkeyId())).collect(Collectors.groupingBy(TableFormMapper::getTableName,Collectors.mapping(TableFormMapper::getPkeyId,Collectors.toList())));
+                Map<String,String> tableNameUrlMaps=tableNamePkIdsList.stream().collect(Collectors.toMap(TableFormMapper::getTableName,TableFormMapper::getUrl,(p,n)->p));
+                List<FormData> fds=new ArrayList<>(fdsMap.values());
+                Map<String,List<FormData>> group = fds.stream().collect(Collectors.groupingBy(FormData::getTableName,Collectors.toList()));
+                group.forEach((k,v)->{
+                    String ids =tableNamePkIdsMaps.get(k).stream().map(Objects::toString).collect(Collectors.joining(","));
+                    String sqlTableDataInfo="select id,p_key_id pageId,tab_key tabKey ,key_val value from table_data_info where  p_key_id in("+ids+")";
+                    List<CellDataVo> list= this.getSqlList(sqlTableDataInfo,CellDataVo.class);
+                    if(list!=null){
+                        Set<String> set= v.stream().map(FormData::getTableName).collect(Collectors.toSet());
+                        Map<String, List<CellDataVo>>  targetGroup=list.stream().filter(e->set.contains(e.getKey())).collect(Collectors.groupingBy(CellDataVo::getKey,Collectors.toList()));
+                        for(FormData fd:v){
+                            fd.setCellDataVoList(targetGroup.get(fd.getKey()));
+                            if(fd.getCellDataVoList()!=null) {
+                                List<Long> pageIds = tableNamePkIdsMaps.get(fd.getTableName());
+                                String coords =tec.getCoordinateMap().computeIfAbsent(fd.getTableName(), x -> FormulaUtils.getElementCell(tableNameUrlMaps.get(x))).get(fd.getKey());
+                                if(Func.isNotBlank(coords)){
+                                    fd.flushCoords(coords);
+                                }else{
+                                    tec.getLog().put(FormulaLog.POSITION,fd.getCode()+"("+fd.getEName()+")");
+                                    continue;
+                                }
+                                List<Coords> coordsList = fd.getCoordsList();
+                                List<ElementData> eds = fd.getValues();
+                                Map<String, Object> map = fd.getCellDataVoList().stream().collect(Collectors.toMap(e -> StringUtils.join(pageIds.indexOf(e.getPageId()), e.getX(), e.getY(), StringPool.AT), CellDataVo::getValue));
+                                for (int i = 0; i < pageIds.size(); i++) {
+                                    for (Coords c : coordsList) {
+                                        String key = StringUtils.join(i, c.getX(), c.getY(), StringPool.AT);
+                                        eds.add(new ElementData(i, 0, map.get(key), c.getX(), c.getY()));
+                                    }
+                                }
+                                /*数据初始化加载*/
+                                fd.setInitReady(true);
+                                /*备份原始数据,用于更新比较*/
+                                fd.init();
                             }
-                            List<Map<String,Object>> tableDatas= this.jdbcTemplate.queryForList("select * from "+tn+" where p_key_id in ("+targetIds+")");
-                            String tmp =elementInfo==null?"":StringUtils.handleNull(elementInfo.get("ename"));
-                            fill(tableDatas,removeList,tn,key,tmp);
-                        }*/
-                    });
-                }
+                        }
+                    }
+                });
             }
             if(Func.isNotEmpty(removeList)){
                 /*移除已经找到的元素数据*/
@@ -2139,12 +2232,11 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
 
     @Override
     public List<FormData> createFormDataByTableName(String tableNames) {
-        List<FormData>  fds =this.getSqlList("select b.id, CONCAT(a.tab_en_name,':',b.e_key) code,a.tab_ch_name tableChName,b.e_name eName ,b.e_allow_deviation eAllowDeviation ,b.e_length eLength,c.dict_value eType " +
+        return this.getSqlList("select b.id, CONCAT(a.tab_en_name,':',b.e_key) code,a.tab_ch_name tableChName,b.e_name eName ,b.e_allow_deviation eAllowDeviation ,b.e_length eLength,c.dict_value eType " +
                         "from m_table_info a JOIN m_wbs_form_element b on a.id=b.f_id and b.is_deleted=0  " +
                         "LEFT JOIN (select dict_key, dict_value from blade_dict where code ='data_type' and parent_id > 0 and is_sealed = 0 and is_deleted = 0 )c on b.e_type=c.dict_key" +
                         " where  a.tab_en_name in( "+ tableNames+")"
                 ,  FormData.class);
-        return fds;
     }
 
     @Override
@@ -2164,6 +2256,8 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
              });
 
     }
+
+
 }