Просмотр исходного кода

保存html上input对象的dqid无法删除
委托单pdf上一个空配置2个电签的问题
附件表

zhuwei 1 неделя назад
Родитель
Сommit
bd7c0d8134

+ 1 - 1
blade-service/blade-manager/src/main/java/org/springblade/manager/controller/TextdictInfoController.java

@@ -670,7 +670,7 @@ public class TextdictInfoController extends BladeController {
                 element.removeAttr(":readonly");
             }
         }
-        Elements tryInfo = doc.select("td[dqid]");
+        Elements tryInfo = doc.getElementsByAttribute("dqid");// doc.select("td[dqid]");
         if (tryInfo != null && !tryInfo.isEmpty()) {
             for (Element element : tryInfo) {
                 element.removeAttr("dqid");

+ 26 - 5
blade-service/blade-manager/src/main/java/org/springblade/manager/formula/impl/SubTable.java

@@ -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,6 +181,9 @@ 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());
         }
     }
 
@@ -196,11 +205,18 @@ public class SubTable {
     }
     /*用原有数据初始化*/
     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());
         }
+        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)) {
@@ -216,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;
                     }
@@ -261,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) {

+ 28 - 83
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/ExcelTabServiceImpl.java

@@ -5756,90 +5756,35 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
                         }
                     }
                 }
-            }
-        }
-        // 组装电签设置
-        QueryWrapper<TextdictInfo> queryWrapper = new QueryWrapper<>();
-        queryWrapper.select("col_key", "id");
-        queryWrapper.in("type", 2, 6);
-        queryWrapper.eq("tab_id", wbsTreePrivate.getPKeyId());
-        List<TextdictInfo> textdictInfos = textdictInfoService.getBaseMapper().selectList(queryWrapper);
-        String dqSql = "select e_key,GROUP_CONCAT(DISTINCT concat('*✹',id)) ids from u_sign_key_role_info where tab_en_name='" + wbsTreePrivate.getInitTableName() + "' GROUP BY e_key";
-        List<Map<String, Object>> mapList = jdbcTemplate.queryForList(dqSql);
-        if(!mapList.isEmpty()){
-            for(Map<String, Object> map : mapList) {
-                Elements elementsBy = table.getElementsByAttributeValueStarting("keyname", map.get("e_key") + "__");
-                if(elementsBy!=null && !elementsBy.isEmpty()){
-                    String ids = map.get("ids").toString();
-                    ids = ids.replace(",","");
-                    String[] split = ids.split("\\*✹");
-                    for(Element element : elementsBy){
-                        for (String s : split) {
-                            if (s.isEmpty()) {
-                                continue;
-                            }
-                            try {
-                                TextdictInfo info = new TextdictInfo();
-                                info.setColKey(element.attr("keyname"));
-                                info.setId(Long.parseLong(s));
-                                info.setType(-1);
-                                textdictInfos.add(info);
-                            } catch (Exception e) {
-                                e.printStackTrace();
-                            }
-                        }
-                    }
-                }
-            }
-        }
-        if (textdictInfos != null && !textdictInfos.isEmpty()) {
-            for (TextdictInfo e : textdictInfos) {
-                String key = e.getColKey();
-                String[] keys = key.split("__");
-                String[] trtd = keys[1].split("_");
-                if (Integer.parseInt(trtd[0]) < trs.size()) {
-                    Element ytzData = trs.get(Integer.parseInt(trtd[0]));
-                    if (ytzData != null) {
-                        Elements tdsx = ytzData.select("td");
-                        if (Integer.parseInt(trtd[1]) < tdsx.size()) {
-                            Element data = ytzData.select("td").get(Integer.parseInt(trtd[1]));
-                            if (data.html().contains("el-tooltip")) {
-                                data = data.children().get(0);
-                            }
 
-                            int x1 = Integer.parseInt(data.children().get(0).attr("x1"));
-                            if (x1 == 0) {
-                                x1 = 1;
-                            }
-                            int y1 = Integer.parseInt(data.children().get(0).attr("y1"));
-
-                            Row row = sheet.getRow(y1 - 1);
-                            if (row != null) {
-                                Cell cell = sheet.getRow(y1 - 1).getCell(x1 - 1);
-                                if (cell != null) {
-                                    short fontIndex = cell.getCellStyle().getFontIndex();
-                                    Font oldfontAt = workbook.getFontAt(fontIndex);
-
-                                    Font redFont = workbook.createFont();
-                                    redFont.setColor(IndexedColors.WHITE.getIndex()); //设置字体颜色
-                                    redFont.setFontHeightInPoints(Short.valueOf("1"));//设置字体大小
-                                    redFont.setFontName(oldfontAt.getFontName());//设置字体
-
-                                    CellStyle newStyle = workbook.createCellStyle(); //创建单元格样式
-                                    newStyle.cloneStyleFrom(cell.getCellStyle());
-                                    newStyle.setFont(redFont);
-                                    cell.setCellStyle(newStyle);
-                                    String id = e.getId() + "";
-                                    if (e.getType() != null && e.getType() == -1) {
-                                        id = "✹" + id;
-                                    }
-                                    if (cell.getCellTypeEnum() == CellType.STRING && StringUtil.hasText(cell.getStringCellValue())) {
-                                        id = cell.getStringCellValue() + "*" + id;
-                                    }
-                                    cell.setCellValue(id);
-                                } else {
-                                    ObjectUtils.isNotEmpty(cell);
-                                }
+                // 组装电签设置
+                Elements dqids = table.getElementsByAttribute("dqid");
+                for (Element element : dqids) {
+                    String dqid = element.attr("dqid");
+                    Elements x11 = element.getElementsByAttribute("x1");
+                    if (x11 != null && x11.size() >= 1) {
+                        Element element1 = x11.get(x11.size() - 1);
+                        int x1 = Func.toInt(element1.attr("x1"));
+                        int y1 = Func.toInt(element1.attr("y1"));
+
+                        Row row = sheet.getRow(y1 - 1);
+                        if (row != null) {
+                            Cell cell = row.getCell(x1 - 1);
+                            if (cell != null || ObjectUtils.isNotEmpty(cell)) {
+                                short fontIndex = cell.getCellStyle().getFontIndex();
+                                Font oldfontAt = workbook.getFontAt(fontIndex);
+                                Font redFont = workbook.createFont();
+                                redFont.setColor(IndexedColors.WHITE.getIndex()); //设置字体颜色
+                                redFont.setFontHeightInPoints(Short.valueOf("1"));//设置字体大小
+                                redFont.setFontName(oldfontAt.getFontName());//设置字体
+                                String CellValue = cell.getStringCellValue().trim();
+
+                                CellStyle newStyle = workbook.createCellStyle(); //创建单元格样式
+                                newStyle.cloneStyleFrom(cell.getCellStyle());
+                                newStyle.setFont(redFont);
+                                newStyle.setShrinkToFit(true);
+                                cell.setCellStyle(newStyle);
+                                cell.setCellValue(dqid);
                             }
                         }
                     }

Разница между файлами не показана из-за своего большого размера
+ 229 - 204
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/FormulaServiceImpl.java


Некоторые файлы не были показаны из-за большого количества измененных файлов