hongchuangyanfa 2 жил өмнө
parent
commit
6d1b2a0927

+ 1 - 1
blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/entity/TextdictInfo.java

@@ -39,7 +39,7 @@ import lombok.EqualsAndHashCode;
 	@TableName("m_textdict_info")
 	@ApiModel(value = "Dict对象", description = "Dict对象")
 	public class TextdictInfo implements  Serializable {
-	private static final long serialVersionUID = 1L;
+
 	@ApiModelProperty("主键id")
 	@TableId(
 			value = "id",

+ 1 - 1
blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/entity/WbsTreeContract.java

@@ -171,7 +171,7 @@ public class WbsTreeContract extends BaseEntity {
     /**
      * 清表Id
      */
-    @ApiModelProperty(value = "清表Id")
+    @ApiModelProperty(name = "excel_id", value = "excel_id")
     private Long excelId;
 
     /**

+ 52 - 0
blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/vo/TextdictBy345VO.java

@@ -0,0 +1,52 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.manager.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * 参数信息表视图实体类
+ *
+ * @author BladeX
+ * @since 2022-06-17
+ */
+@Data
+public class TextdictBy345VO implements Serializable  {
+	private static final long serialVersionUID = 1L;
+
+
+	@ApiModelProperty(value = "tr")
+	private Integer trIndex;
+
+	@ApiModelProperty(value = "td")
+	private Integer tdIndex;
+
+	@ApiModelProperty(value = "文本类型Id")
+	private String textId;
+
+	@ApiModelProperty(value = "表Id")
+	private Long tableId;
+
+	@ApiModelProperty(value = "操作类型")
+	private Integer type;
+
+
+}

+ 121 - 221
blade-service/blade-manager/src/main/java/org/springblade/manager/controller/ExcelTabController.java

@@ -3,6 +3,7 @@ package org.springblade.manager.controller;
 
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
@@ -12,11 +13,11 @@ import com.itextpdf.html2pdf.resolver.font.DefaultFontProvider;
 import com.itextpdf.io.font.FontProgram;
 import com.itextpdf.io.font.FontProgramFactory;
 import com.itextpdf.layout.font.FontProvider;
-import com.spire.xls.ExcelPicture;
-import com.spire.xls.ExcelVersion;
-import com.spire.xls.Workbook;
-import com.spire.xls.Worksheet;
+import com.spire.xls.*;
+import com.spire.xls.core.IStyle;
 import com.spire.xls.core.spreadsheet.HTMLOptions;
+import com.spire.xls.core.spreadsheet.pivottables.PivotStyle;
+import com.spire.xls.core.spreadsheet.shapes.XlsTextBoxShape;
 import io.swagger.annotations.*;
 import lombok.AllArgsConstructor;
 import lombok.SneakyThrows;
@@ -25,8 +26,6 @@ import org.jsoup.Jsoup;
 import org.jsoup.nodes.Document;
 import org.jsoup.nodes.Element;
 import org.jsoup.select.Elements;
-import org.springblade.business.feign.FileUtilsClient;
-import org.springblade.business.feign.InformationQueryClient;
 import org.springblade.common.constant.CommonConstant;
 import org.springblade.common.utils.CommonUtil;
 import org.springblade.common.utils.MathUtil;
@@ -59,16 +58,21 @@ import org.springframework.web.multipart.MultipartFile;
 
 import javax.imageio.ImageIO;
 import javax.validation.Valid;
+import java.awt.*;
 import java.awt.image.BufferedImage;
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.util.*;
+import java.util.List;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 import java.util.stream.Collectors;
 
+import static com.baomidou.mybatisplus.core.toolkit.Wrappers.lambdaQuery;
+import static com.baomidou.mybatisplus.core.toolkit.Wrappers.query;
+
 
 /**
  * 清表基础数据表 控制器
@@ -96,9 +100,6 @@ public class ExcelTabController extends BladeController {
     // 私有项目wbs
     private final IWbsTreePrivateService wbsTreePrivateService;
 
-    // 清表表格解析信息
-    //private final ILinkdataInfoService linkdataInfoService;
-
     // 元素信息表-
     private final IWbsFormElementService wbsFormElementService;
 
@@ -109,8 +110,6 @@ public class ExcelTabController extends BladeController {
 
     private final JdbcTemplate jdbcTemplate;
 
-    //客户端资料查询接口
-    private final InformationQueryClient informationQueryClient;
 
     // 表单附件信息
     private final ITableFileService tableFileService;
@@ -118,8 +117,8 @@ public class ExcelTabController extends BladeController {
     // pdf转换
     private final CommonFileClient commonFileClient;
 
-
-    private final IWbsParamService wbsParamService;
+    // 表单字典信息表
+    private final ITextdictInfoService textdictInfoService;
 
     /**
      * 详情
@@ -402,7 +401,6 @@ public class ExcelTabController extends BladeController {
                     updateWrapper.set("excel_id", excelTab.getId());
 
                     wbsTreePrivateService.update(updateWrapper);
-
                 }
             }
         }
@@ -434,7 +432,7 @@ public class ExcelTabController extends BladeController {
     })
     public R<List<ExceTabTreVO>> saveLinkeTab(Long exceTabId, Long tabId) throws IOException {
         String file_path = ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
-        // 查询私有项目信息
+        // 关联 私有项目 wbs 数据信息
         WbsTreePrivate wbsTree = new WbsTreePrivate();
         wbsTree.setPKeyId(tabId);
         WbsTreePrivate aPrivate = wbsTreePrivateService.getOne(Condition.getQueryWrapper(wbsTree));
@@ -516,9 +514,17 @@ public class ExcelTabController extends BladeController {
         FileUtil.writeToFile(writefile, doc.html(), Boolean.parseBoolean("UTF-8"));
 
 
-        //日志表单关联解决
+        //由于日志无法拿到基本节点,将 关联html的id 放入在父节点excelId 处理
         if (aPrivate.getWbsType().equals("4")) {
-            updateWrapper.set("excel_id", aPrivate.getPKeyId());
+            WbsTreePrivate wbsTreePrivate = wbsTreePrivateService.getBaseMapper().selectOne(Wrappers.<WbsTreePrivate>query().lambda()
+                    .eq(WbsTreePrivate::getId, aPrivate.getParentId())  // 获取父节点Id
+                    .eq(WbsTreePrivate::getWbsType, "4")  // 内型为4
+                    .eq(WbsTreePrivate::getProjectId, aPrivate.getProjectId()));  // 项目Id
+
+            UpdateWrapper<WbsTreePrivate> pupdate = new UpdateWrapper<>();
+            pupdate.in("p_key_id", wbsTreePrivate.getPKeyId());
+            pupdate.set("excel_id", aPrivate.getPKeyId());
+            wbsTreePrivateService.update(pupdate);
         }
         wbsTreePrivateService.update(updateWrapper);
         //关联项目下所有的合同段
@@ -630,158 +636,6 @@ public class ExcelTabController extends BladeController {
     }
 
 
-    /**
-     * 保存用户填报数据接口
-     */
-    @PostMapping("/save_buss_data_bak")
-    @ApiOperationSupport(order = 13)
-    @ApiOperation(value = "填报页面数据保存", notes = "填报页面数据保存")
-    public R<String> saveBussData(@Valid @RequestBody JSONObject dataInfo, BladeUser bladeUser) throws IOException {
-
-        JSONArray dataArray = new JSONArray();
-        if (dataInfo.containsKey("dataInfo")) { // 节点保存
-            JSONObject jsonObject = dataInfo.getJSONObject("dataInfo");
-            dataArray = jsonObject.getJSONArray("orderList");
-        } else { // 单个保存
-            dataArray.add(dataInfo);
-        }
-
-        for (int m = 0; m < dataArray.size(); m++) {
-            JSONObject dataInfo2 = dataArray.getJSONObject(m);
-            //
-            String contractId = dataInfo2.getString("contractId");
-            String pkeyId = dataInfo2.getString("pkeyId");
-            String projectId = dataInfo2.getString("projectId");
-            //huangjn 填报的类型,施工或监理
-            String classify = dataInfo2.getString("classify");
-
-            //huangjn 填报的类型,施工或监理
-            // 去掉
-            dataInfo2.remove("contractId");
-            dataInfo2.remove("pkeyId");
-            dataInfo2.remove("p_key_id");
-            dataInfo2.remove("projectId");
-            dataInfo2.remove("classify");
-            dataInfo2.remove("pickerKey");
-            dataInfo2.remove("id");
-            dataInfo2.remove("");
-
-            // 计算数据
-            Map<String, String> dataMap = new HashMap<>();
-            for (String k : dataInfo2.keySet()) {
-                if (k.indexOf("__") >= 0) {
-                    String key = k.split("__")[0];
-                    if (dataMap.containsKey(key)) {
-                        dataMap.put(key, dataMap.get(key) + "," + k);
-                    } else {
-                        dataMap.put(key, k);
-                    }
-                }
-            }
-
-            Map<String, String> dataMap2 = new HashMap<>();
-
-
-            // 字段组合
-            for (String k : dataMap.keySet()) {
-                if (dataMap.get(k).indexOf(",") >= 0 && dataMap.get(k).indexOf("000Z") < 0) {
-                    String[] ziduan = dataMap.get(k).split(",");
-                    String temp = "";
-                    for (int i = 0; i < ziduan.length - 1; i++) {
-                        for (int j = 0; j < ziduan.length - i - 1; j++) {
-                            Integer tr = Integer.parseInt((ziduan[j].split("__")[1]).split("_")[0]);
-                            Integer td = Integer.parseInt(ziduan[j].split("__")[1].split("_")[1]);
-
-                            Integer tr_1 = Integer.parseInt(ziduan[j + 1].split("__")[1].split("_")[0]);
-                            Integer td_1 = Integer.parseInt(ziduan[j + 1].split("__")[1].split("_")[1]);
-
-                            if (tr > tr_1 && td == td_1) { //纵向排序
-                                temp = ziduan[j];
-                                ziduan[j] = ziduan[j + 1];
-                                ziduan[j + 1] = temp;
-                            }
-                        }
-                    }
-
-                    String lastStr = dataInfo2.getString(ziduan[0]) + "__" + ziduan[0].split("__")[1];
-                    for (int i = 1; i < ziduan.length; i++) {
-                        String keyData = dataInfo2.getString(ziduan[i]);
-                        if (!keyData.equals("")) {
-                            lastStr += "," + dataInfo2.getString(ziduan[i]) + "__" + ziduan[i].split("__")[1];
-                        }
-
-                    }
-                    dataMap2.put(k, lastStr);
-                } else {
-                    String dataVal = dataInfo2.getString(dataMap.get(k));
-                    if (!dataVal.equals("") || !dataVal.equals("[]")) {
-                        System.out.println(k + "__" + dataMap.get(k));
-                        dataMap2.put(k, dataVal + "__" + dataMap.get(k).split("__")[1]);
-                    }
-                }
-            }
-
-            dataMap2.put("p_key_id", pkeyId);
-
-            WbsTreeContract wbsTreeContract = wbsTreeContractService.getBaseMapper().selectOne(Wrappers.<WbsTreeContract>query().lambda()
-                    .eq(WbsTreeContract::getPKeyId, pkeyId));
-            if (wbsTreeContract == null) {
-                continue;
-            }
-
-            String tabName = wbsTreeContract.getInitTableName();
-
-            // 判读修改还是 添加
-            // String querySql = "select * from "+tabName+" where p_key_id="+pkeyId ;
-            //   List<Map<String, Object>> dataIn = jdbcTemplate.queryForList(querySql);
-
-            String delSql = "delete from " + tabName + " where p_key_id=" + pkeyId;
-            ;
-
-            String sqlInfo = "";
-
-            // if(dataIn.isEmpty()){ //插入
-            sqlInfo = "INSERT INTO " + tabName + " ( ";
-            String keyStr = "id,";
-            String valStr = SnowFlakeUtil.getId() + ",";
-            for (String keys : dataMap2.keySet()) {
-                keyStr += keys + ",";
-                valStr += "'" + dataMap2.get(keys) + "',";
-            }
-            keyStr = keyStr.substring(0, keyStr.lastIndexOf(","));
-            valStr = valStr.substring(0, valStr.lastIndexOf(","));
-            sqlInfo = sqlInfo + keyStr + ") VALUES (" + valStr + ")";
-
-
-            WbsTreeContract wbsTreeContractByP = wbsTreeContractService.getBaseMapper().selectOne(Wrappers.<WbsTreeContract>query().lambda()
-                    .eq(WbsTreeContract::getId, wbsTreeContract.getParentId()).eq(WbsTreeContract::getContractId, contractId));
-
-            //处理文件提名
-            String fileName = this.wbsParamService.createFileTitle(Func.isNotEmpty(wbsTreeContractByP.getOldId())? Long.valueOf(wbsTreeContractByP.getOldId()) :wbsTreeContractByP.getId(), Long.parseLong(wbsTreeContractByP.getContractId()));
-            fileName = StringUtils.isNotEmpty(fileName) ? fileName : "缺少文件提名配置";
-
-            //huangjn 保存成功后调用生成资料查询列表数据
-            this.informationQueryClient.saveOrUpdateInformationQueryData(wbsTreeContractByP.getPKeyId() + "", "业务ID(主要将来给首件使用)", fileName, Integer.parseInt(classify), 2, "是否是首件(临时,暂时没用到)");
-/*        }else{ //更新
-            sqlInfo = "update  "+tabName+" set ";
-            for (String keys : dataMap2.keySet()){
-                sqlInfo += keys+"='"+dataMap2.get(keys)+"',";
-            }
-            sqlInfo=sqlInfo.substring(0,sqlInfo.lastIndexOf(","));
-            sqlInfo = sqlInfo + " where p_key_id="+pkeyId;
-        }*/
-
-            UpdateWrapper<WbsTreeContract> updateWrapper = new UpdateWrapper<>();
-            updateWrapper.in("p_key_id", pkeyId);
-            updateWrapper.set("is_tab_pdf", 2);
-            wbsTreeContractService.update(updateWrapper);
-
-            jdbcTemplate.execute(sqlInfo);
-            // this.getBussPdfInfo(Long.parseLong(pkeyId));
-        }
-        return R.success("1");
-    }
-
     // 上传解析 html
     public void expailHtmlInfo(String thmlUrl, Long excelId) throws FileNotFoundException {
 
@@ -807,7 +661,6 @@ public class ExcelTabController extends BladeController {
 
         // 获取图片信息
         Elements imgs = doc.select("img");
-        System.out.println(imgs.get(0));
         int imgIndex = 0;
 
 
@@ -816,7 +669,7 @@ public class ExcelTabController extends BladeController {
 
         // 获取总行列数
         int maxCol = doc.select("Col").size();
-        String[] rowData = new String[trs.size() + 1];
+        String[] rowData = new String[trs.size() + 5]; //本来加一的 害怕出现特殊情况 故意 加 5
 
         // 行的状态
         boolean index_state = false;
@@ -1010,10 +863,11 @@ public class ExcelTabController extends BladeController {
                             colTitle.add(exctabCell);
                             data.attr("title", "签字时间");
 
-                        }else if(trHtml.indexOf("Important")>=0){ // 图片处理方式
-                            data.empty().append(imgs.get(imgIndex)+"");
-                            imgIndex = imgIndex+1;
-                        } else {
+                        }//else if(trHtml.indexOf("Important")>=0){ // 图片处理方式
+                           // data.empty().append(imgs.get(imgIndex)+"");
+                          //  imgIndex = imgIndex+1;
+                       // }
+                        else {
                             if (index_state) {
                                 if (rowspan >= 1) {
                                     data.empty().append("<el-input type='textarea'  @contextmenu.prevent.native='RightClick(" + parm + ")' trIndex=" + i + " tdIndex=" + j + "  x1=" + x1 + " x2=" + x2 + " y1=" + y1 + " y2=" + y2 + " style='width:100%;height:100%;'   :rows=" + rowspan * 2 + " placeholder=''> </el-input>");
@@ -1211,6 +1065,14 @@ public class ExcelTabController extends BladeController {
         WbsTreeContract wbsTreeContract = wbsTreeContractService.getBaseMapper().selectOne(Wrappers.<WbsTreeContract>query().lambda()
                 .eq(WbsTreeContract::getPKeyId, pkeyId));
 
+        QueryWrapper<TextdictInfo> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("type", 4);
+        queryWrapper.eq("tab_id", wbsTreeContract.getIsTypePrivatePid());
+
+        // 获取默认值
+        final List<TextdictInfo> textdictInfos = textdictInfoService.getBaseMapper().selectList(queryWrapper);
+
+
         if (wbsTreeContract == null) {
             return R.data(reData);
         }
@@ -1275,6 +1137,13 @@ public class ExcelTabController extends BladeController {
             }
         }
 
+        // 移除Id 和 p_key_id
+        reData.remove("id");
+        reData.remove("p_key_id");
+        reData.remove("classify");
+        reData.remove("contractId");
+        reData.remove("pkeyId");
+        reData.remove("projectId");
         return R.data(reData);
     }
 
@@ -1292,6 +1161,8 @@ public class ExcelTabController extends BladeController {
         WbsTreeContract wbsTreeContract = wbsTreeContractService.getBaseMapper().selectOne(Wrappers.<WbsTreeContract>query().lambda()
                 .eq(WbsTreeContract::getPKeyId, pkeyId));
 
+
+
         if (wbsTreeContract == null) {
             return R.fail("该数据下无此节点!");
         }
@@ -1322,72 +1193,101 @@ public class ExcelTabController extends BladeController {
 
 
         // 数据不为空 &&
-        if (ObjectUtil.isNotEmpty(DataInfo) && StringUtils.isNotEmpty(wbsTreeContract.getHtmlUrl())) {
+        if (StringUtils.isNotEmpty(wbsTreeContract.getHtmlUrl())) {
             File htmlFile = ResourceUtil.getFile(wbsTreeContract.getHtmlUrl());
             if (htmlFile.exists()) {
-
                 String htmlString = IoUtil.readToString(new FileInputStream(htmlFile));
                 Document doc = Jsoup.parse(htmlString);
                 Element table = doc.select("table").first();
                 Elements trs = table.select("tr");
 
-                for (String val : DataInfo.keySet()) {
-                    if (val.indexOf("__") >= 0) {
-                        String DataVal[] = val.split("__");
-                        String[] xy = DataVal[1].split("_");
-                        Element data = trs.get(Integer.parseInt(xy[0])).select("td").get(Integer.parseInt(xy[1]));
-                        if (data.html().indexOf("x1") >= 0 && data.html().indexOf("y1") >= 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"));
-                            String myData = DataInfo.get(val) + "";
-                            if (myData.indexOf("T") >= 0 && myData.indexOf("-") >= 0) {
-                                if (myData.indexOf(",") >= 0 && myData.indexOf("]") >= 0) {
-                                    myData = myData.replace("[", "").replace("]", "");
-                                    String[] dataVal = myData.split(",");
-                                    String Start_dataStr[] = dataVal[0].split("T")[0].split("-");
-                                    String StartDate = StringUtil.format("{}年{}月{}日", new Object[]{Start_dataStr[0], Start_dataStr[1], Integer.parseInt(Start_dataStr[2]) + 1});
-
-                                    String end_dataStr[] = dataVal[1].split("T")[0].split("-");
-                                    String endDate = StringUtil.format("{}年{}月{}日", new Object[]{end_dataStr[0], end_dataStr[1], Integer.parseInt(end_dataStr[2]) + 1});
-
-                                    if (StartDate.equals(endDate)) {
-                                        myData = StartDate;
+                if(ObjectUtil.isNotEmpty(DataInfo)) {
+                    for (String val : DataInfo.keySet()) {
+                        if (val.indexOf("__") >= 0) {
+                            String DataVal[] = val.split("__");
+                            String[] xy = DataVal[1].split("_");
+                            Element data = trs.get(Integer.parseInt(xy[0])).select("td").get(Integer.parseInt(xy[1]));
+                            if (data.html().indexOf("x1") >= 0 && data.html().indexOf("y1") >= 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"));
+                                String myData = DataInfo.get(val) + "";
+                                if (myData.indexOf("T") >= 0 && myData.indexOf("-") >= 0) {
+                                    if (myData.indexOf(",") >= 0 && myData.indexOf("]") >= 0) {
+                                        myData = myData.replace("[", "").replace("]", "");
+                                        String[] dataVal = myData.split(",");
+                                        String Start_dataStr[] = dataVal[0].split("T")[0].split("-");
+                                        String StartDate = StringUtil.format("{}年{}月{}日", new Object[]{Start_dataStr[0], Start_dataStr[1], Integer.parseInt(Start_dataStr[2]) + 1});
+
+                                        String end_dataStr[] = dataVal[1].split("T")[0].split("-");
+                                        String endDate = StringUtil.format("{}年{}月{}日", new Object[]{end_dataStr[0], end_dataStr[1], Integer.parseInt(end_dataStr[2]) + 1});
+
+                                        if (StartDate.equals(endDate)) {
+                                            myData = StartDate;
+                                        } else {
+                                            myData = StartDate + "-" + endDate;
+                                        }
                                     } else {
-                                        myData = StartDate + "-" + endDate;
+                                        String dataStr[] = myData.split("T")[0].split("-");
+                                        myData = StringUtil.format("{}年{}月{}日", new Object[]{dataStr[0], dataStr[1], Integer.parseInt(dataStr[2]) + 1});
                                     }
-                                } else {
-                                    String dataStr[] = myData.split("T")[0].split("-");
-                                    myData = StringUtil.format("{}年{}月{}日", new Object[]{dataStr[0], dataStr[1], Integer.parseInt(dataStr[2]) + 1});
                                 }
-                            }
-                            //https:bladex-test-info.oss-cn-chengdu.aliyuncs.com//upload/20220819/b53cb6700db369381e3b03d7737bcdec.jpg__16_1
-                            if (myData.indexOf("https") >= 0 && myData.indexOf("aliyuncs") >= 0) {
-                                Element element = trs.get(y1).select("td").get(x1);
-                                String styles[] = element.attr("style").split(";");
-                                int Height = 0;
-                                for (String sty : styles) {
-                                    if (sty.indexOf("height:") >= 0) {
-                                        Height = Integer.parseInt(sty.replace("height:", "").replace("px", ""));
+                                //https:bladex-test-info.oss-cn-chengdu.aliyuncs.com//upload/20220819/b53cb6700db369381e3b03d7737bcdec.jpg__16_1
+                                if (myData.indexOf("https") >= 0 && myData.indexOf("aliyuncs") >= 0) {
+                                    Element element = trs.get(y1).select("td").get(x1);
+                                    String styles[] = element.attr("style").split(";");
+                                    int Height = 0;
+                                    for (String sty : styles) {
+                                        if (sty.indexOf("height:") >= 0) {
+                                            Height = Integer.parseInt(sty.replace("height:", "").replace("px", ""));
+                                        }
                                     }
-                                }
 
-                                BufferedImage image = ImageIO.read(CommonUtil.getOSSInputStream(myData));
-                                ExcelPicture pic = sheet.getPictures().add(y1, x1, image);
-                                pic.setHeight(Height);
-                                sheet.getCellRange(y1, x1).getStyle().setShrinkToFit(true);
+                                    BufferedImage image = ImageIO.read(CommonUtil.getOSSInputStream(myData));
+                                    ExcelPicture pic = sheet.getPictures().add(y1, x1, image);
+                                    pic.setHeight(Height);
+                                    sheet.getCellRange(y1, x1).getStyle().setShrinkToFit(true);
 
-                            } else {
-                                sheet.getCellRange(y1, x1).setText(myData);
+                                } else {
+                                    sheet.getCellRange(y1, x1).setText(myData);
+                                }
                             }
                         }
                     }
                 }
+
+                // 组装电签设置
+                QueryWrapper<TextdictInfo> queryWrapper = new QueryWrapper<>();
+                queryWrapper.eq("type", 2);
+                queryWrapper.eq("tab_id", wbsTreeContract.getIsTypePrivatePid());
+
+                final List<TextdictInfo> textdictInfos = textdictInfoService.getBaseMapper().selectList(queryWrapper);
+                if(textdictInfos!=null && !textdictInfos.isEmpty()){
+                    textdictInfos.forEach(e->{
+                        String key = e.getColKey();
+                        String keys[] = key.split("__");
+                        String[] trtd = keys[1].split("_");
+                        Element data = trs.get(Integer.parseInt(trtd[0])).select("td").get(Integer.parseInt(trtd[1]));
+                        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"));
+
+                        final CellRange cellRange = sheet.getCellRange(y1, x1);
+                        cellRange.setText(e.getId()+"");
+                        cellRange.getCellStyle().getFont().setColor(Color.white);
+
+                    });
+                }
             }
         }
 
+
+
+
         sheet.saveToPdf(pdfPath);
 
         BladeFile bladeFile = newIOSSClient.uploadFile(pkeyId + ".pdf", pdfPath);

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

@@ -39,6 +39,7 @@ import org.springblade.manager.entity.WbsFormElement;
 import org.springblade.manager.entity.WbsTreeContract;
 import org.springblade.manager.entity.WbsTreePrivate;
 import org.springblade.manager.mapper.WbsTreePrivateMapper;
+import org.springblade.manager.vo.TextdictBy345VO;
 import org.springblade.manager.vo.TextdictDataInfoVO;
 import org.springblade.manager.vo.TextdictInfo_vo;
 import org.springframework.jdbc.core.JdbcTemplate;
@@ -214,7 +215,8 @@ public class TextdictInfoController extends BladeController {
 			}
 			radioText += "</template>";
 			element.empty().append(radioText);
-			element.children().get(0).attr("@focus","getInformation("+oncklickText+")");
+			element.children().get(0).attr("v-on:click","getInformation("+oncklickText+")");
+			element.attr("tabindex","-1");
 		}else if(textdictInfo.getTextId().equals("checkbox")){ // 多选框
 
 			String checkbox = "<template v-model="+vmode+" keyname="+keyname+" weighing="+weighing+" placeholder="+placeholder+" trIndex="+trindex+" tdIndex="+tdindex+"  x1="+x1+" x2="+x2+" y1="+y1+" y2="+y2+">";
@@ -226,16 +228,21 @@ public class TextdictInfoController extends BladeController {
 			checkbox += "</template>";
 			element.empty().append(checkbox);
 			element.children().get(0).attr("@focus","getInformation("+oncklickText+")");
+			element.attr("tabindex","-1");
 		}else if(textdictInfo.getTextId().equals("date")){ // 日期
+
 			element.empty().append("<el-date-picker v-model="+vmode+" type='date' format='YYYY年MM月DD日' placeholder="+placeholder+" keyname="+keyname+" weighing="+weighing+"  @contextmenu.prevent.native='RightClick("+parm+")' trIndex="+trindex+" tdIndex="+tdindex+"  x1="+x1+" x2="+x2+" y1="+y1+" y2="+y2+" style='width:100%;height:100%'   placeholder='"+placeholder+"'> </el-date-picker>");
 			element.children().get(0).attr("@focus","getInformation("+oncklickText+")");
-		}else if(textdictInfo.getTextId().equals("daterange")){ // 时间段
 
+		}else if(textdictInfo.getTextId().equals("daterange")){ // 时间段
 			element.empty().append("<el-date-picker  v-model="+vmode+" type='datetimerange' placeholder="+placeholder+"  start-placeholder='开始日期'  end-placeholder='结束日期' format='YYYY年MM月DD日' trIndex="+trindex+" keyname="+keyname+" weighing="+weighing+" tdIndex="+tdindex+"  x1="+x1+" x2="+x2+" y1="+y1+" y2="+y2+">");
 			element.children().get(0).attr("@focus","getInformation("+oncklickText+")");
 			element.children().get(0).attr("@change","datePickerChange($event,'"+keyname+"')");
 		}else if(textdictInfo.getTextId().equals("img")){
-			element.empty().append("<el-upload placeholder="+placeholder+" v-model="+vmode+" keyname="+keyname+" weighing="+weighing+"  class='hc-upload-table-form' action='/api/blade-resource/oss/endpoint/put-file' trIndex="+trindex+" tdIndex="+tdindex+"  x1="+x1+" x2="+x2+" y1="+y1+" y2="+y2+"  @exceed='formUploadExceed' accept='image/png,image/jpg,image/jpeg' :headers='getTokenHeader' :show-file-list='false' > <img v-if='"+vmode+"' :src="+vmode+" class='hc-table-form-img' /> <div class='hc-table-form-icon' v-else> 点此选择文件并上传 </div> </el-upload>");
+			element.empty().append("<el-upload :disabled='formUploadLoading' v-loading='formUploadLoading' element-loading-text='上传中...' :on-progress='uploadprogress' @exceed='formUploadExceed' :on-error='formUploadError' placeholder="+placeholder+" v-model="+vmode+" keyname="+keyname+" weighing="+weighing+"  class='hc-upload-table-form' action='/api/blade-resource/oss/endpoint/put-file' trIndex="+trindex+" tdIndex="+tdindex+"  x1="+x1+" x2="+x2+" y1="+y1+" y2="+y2+"  accept='image/png,image/jpg,image/jpeg' :headers='getTokenHeader' :show-file-list='false' > <img v-if='"+vmode+"' :src="+vmode+" class='hc-table-form-img' /> <div class='hc-table-form-icon' v-else> 点此选择文件并上传 </div> <div v-if="+vmode+" class='hc-table-form-del' >" +
+					"        <el-button type='danger'"+ " plain @click.stop=delTableFormFile('"+keyname+"')>删除当前文件</el-button> " +
+					"    </div></el-upload>");
+
 			element.children().get(0).attr("@success","formUploadSuccess($event,'"+keyname+"')");
 			element.attr("@focus","getInformation("+oncklickText+")");
 			element.attr("tabindex","-1");
@@ -303,9 +310,100 @@ public class TextdictInfoController extends BladeController {
 			textdictInfo.setPyzbx(jsonObject.getDouble("pyzbx"));
 			textdictInfo.setPyzby(jsonObject.getDouble("pyzby"));
 			textdictInfo.setIsDeleted(0);
-			textdictInfos.add(textdictInfo);
+			textdictInfoService.saveOrUpdate(textdictInfo);
+			element.attr("dqId",textdictInfo.getId()+"");
+			element.children().get(0).attr("readonly");
+		}
+
+		// 写入 excel
+		File writefile = new File(wbsTreePrivate.getHtmlUrl());
+		FileUtil.writeToFile(writefile, doc.html(), Boolean.parseBoolean("UTF-8"));
+		return R.success("操作成功");
+	}
+
+	/**
+	 *保存电签
+	 */
+	@PostMapping("/save_defaulVal")
+	@ApiOperationSupport(order = 7)
+	@ApiOperation(value = "保存默认值", notes = "保存默认值")
+	public R<String> saveDefaulVal(@Valid @RequestBody TextdictBy345VO textdictInfo) throws IOException {
+		WbsTreePrivate wbsTreePrivate = wbsTreePrivateMapper.getByPKeyId(textdictInfo.getTableId());
+
+		// 读取html页面信息
+		File file1 = ResourceUtil.getFile(wbsTreePrivate.getHtmlUrl());
+		String htmlString =  IoUtil.readToString(new FileInputStream(file1));
+		// 样式集合
+		Document doc = Jsoup.parse(htmlString);
+		//解析
+		Element table = doc.select("table").first();
+		Elements trs = table.select("tr");
+		Element element = trs.get(textdictInfo.getTrIndex()).select("td").get(textdictInfo.getTdIndex());
+
+		//
+		String placeholder = "";
+		String id = element.children().get(0).attr("keyname");
+		if(element.html().indexOf("el-tooltip")>=0){
+			placeholder = element.children().get(0).children().get(0).attr("placeholder").replaceAll("[^(\u4E00-\u9FA5_)]", "");
+			id = element.children().get(0).children().get(0).attr("keyname");
+		}else{
+			placeholder = element.children().get(0).attr("placeholder").replaceAll("[^(\u4E00-\u9FA5_)]", "");
+			id = element.children().get(0).attr("keyname");
 		}
-		textdictInfoService.saveOrUpdateBatch(textdictInfos);
+
+		TextdictInfo textdictBean = new TextdictInfo();
+		textdictBean.setIsDeleted(0);
+		textdictBean.setTabId(textdictInfo.getTableId()+"");
+
+		textdictBean.setColKey(id);
+		textdictBean.setColName(placeholder);
+		textdictBean.setSigRoleName(textdictInfo.getTextId());
+
+		if(textdictInfo.getType()==4){ //默认值
+			textdictBean.setType(4);
+			textdictBean.setName("编辑默认值");
+		}
+		if(textdictInfo.getType()==5){ // 提示语
+			textdictBean.setType(5);
+			textdictBean.setName("提示信息");
+			String lastHmtl ="";
+			if(element.html().indexOf("el-tooltip")>=0){
+				element.children().attr("content",textdictInfo.getTextId());
+			}else{
+				lastHmtl = " <el-tooltip content='"+textdictInfo.getTextId()+"' placement='top' effect='customized'>"+element.html()+"</el-tooltip>";
+				element.empty().append(lastHmtl);
+			}
+			File writefile = new File(wbsTreePrivate.getHtmlUrl());
+			FileUtil.writeToFile(writefile, doc.html(), Boolean.parseBoolean("UTF-8"));
+		}
+
+		// 删除
+		textdictInfoService.getBaseMapper().delete(Wrappers.<TextdictInfo>query().lambda().eq(TextdictInfo::getTabId, textdictInfo.getTableId())
+				.eq(TextdictInfo::getType,textdictInfo.getType()).eq(TextdictInfo::getColKey,id));
+
+		textdictInfoService.saveOrUpdate(textdictBean);
 		return R.success("操作成功");
 	}
+
+/*	public static void main(String[] args) throws FileNotFoundException {
+		File file1 = ResourceUtil.getFile("/Users/hongchuangyanfa/Desktop/privateUrl/1567789917445029888.html");
+		String htmlString =  IoUtil.readToString(new FileInputStream(file1));
+		// 样式集合
+		Document doc = Jsoup.parse(htmlString);
+		//解析
+		Element table = doc.select("table").first();
+		Elements trs = table.select("tr");
+		Element element = trs.get(3).select("td").get(1);
+		System.out.println(element.html());
+		if(element.html().indexOf("el-tooltip")>=0){
+			element.children().attr("content","111");
+		}
+
+		String lastHmtl = " <el-tooltip content='Bottom center' effect='customized'>"+element.html()+"</el-tooltip>";
+		element.empty().append(lastHmtl);
+		File writefile = new File("/Users/hongchuangyanfa/Desktop/privateUrl/1567789917445029888.html");
+		FileUtil.writeToFile(writefile, doc.html(), Boolean.parseBoolean("UTF-8"));
+
+		System.out.println();
+	}*/
 }

+ 1 - 1
blade-service/blade-manager/src/main/java/org/springblade/manager/mapper/TextdictInfoMapper.xml

@@ -19,7 +19,7 @@
     </resultMap>
 
     <select id="selectTextdictInfoPage" resultMap="textdictInfoResultMap">
-        select * from m_textdict_info where is_deleted = 0
+        select * from m_textdict_info where is_deleted = 0 and type =#{param2.type}
     </select>
 
 </mapper>

+ 2 - 1
blade-service/blade-manager/src/main/java/org/springblade/manager/mapper/WbsTreeContractMapper.xml

@@ -192,7 +192,8 @@
                dept_name,
                full_name,
                dept_category,
-               excel_id
+               excel_id,
+               is_link_table
         from m_wbs_tree_private
         where is_deleted = 0
           and major_data_type = 5