Selaa lähdekoodia

委托单、试验自检、日志和计量实现通过key签字和保存时数据库实体表字段长度自动扩容

lvy 3 viikkoa sitten
vanhempi
commit
dc851c1fd1

+ 1 - 0
blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/vo/ExcelTabVo1.java

@@ -9,4 +9,5 @@ public class ExcelTabVo1 {
     private String htmlUrl;
     private String name;
     private String fileUrl;
+    private String tabName;
 }

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

@@ -2769,8 +2769,31 @@ public class ExcelTabController extends BladeController {
                     }
                     // 组装电签设置
                     Elements dqids = table.getElementsByAttribute("dqid");
+                    // 电签组装2
+                    String dqSql = "select e_key,GROUP_CONCAT(DISTINCT concat('*✹',id)) ids from u_sign_key_role_info where tab_en_name='" + tableNode.getInitTableName() + "' GROUP BY e_key";
+                    List<Map<String, Object>> mapList = jdbcTemplate.queryForList(dqSql);
+                    if(mapList!=null && mapList.size()>0){
+                        for(Map<String, Object> map : mapList) {
+                            Elements elementsBy = table.getElementsByAttributeValueStarting("keyname", map.get("e_key") + "_");
+                            if(elementsBy!=null && elementsBy.size()>0){
+                                for(Element element : elementsBy){
+                                    String dqIds = (String) map.get("ids");
+                                    dqIds = dqIds.replace(",","");
+                                    dqIds = dqIds.substring(1);
+                                    element.attr("sign_type", dqIds);
+                                    dqids.add(element);
+                                }
+                            }
+
+                        }
+                    }
                     for (Element element : dqids) {
-                        String dqid = element.attr("dqid");
+                        String dqid="";
+                        if(element.hasAttr("sign_type")){
+                            dqid = element.attr("sign_type");
+                        }else{
+                            dqid = element.attr("dqid");
+                        }
                         Elements x11 = element.getElementsByAttribute("x1");
                         if (x11 != null && x11.size() >= 1) {
                             Element element1 = x11.get(x11.size() - 1);
@@ -2780,6 +2803,10 @@ public class ExcelTabController extends BladeController {
                             CellRange cellRange = sheet.getCellRange(y1, x1);
                             if (cellRange != null) {
                                 // 创建字体
+                                String text = cellRange.getText();
+                                if (StringUtil.hasText(text)) {
+                                    dqid = text + "*" + dqid;
+                                }
                                 cellRange.setText(dqid);
                                 cellRange.getCellStyle().getExcelFont().setSize(1);
                                 cellRange.getCellStyle().getExcelFont().setColor(Color.WHITE);

+ 146 - 89
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/ExcelTabServiceImpl.java

@@ -736,6 +736,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
 
             //参数
             LinkedHashMap<String, String> dataMap2 = tableInfo.getDataMap();
+            updateFieldLength(tabName, dataMap2);
             for (String key : dataMap2.keySet()) {
                 keySql.append(", ").append(key);
                 valSql.append(", '").append(dataMap2.get(key)).append("'");
@@ -1105,7 +1106,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
                         for (TableInfo tableInfo : tableInfoList) {
                             //获取字段信息
                             LinkedHashMap<String, String> dataMap2 = tableInfo.getDataMap();
-
+                            updateFieldLength(table.getTabEnName(),dataMap2);
                             //拼接SQL
                             StringBuilder sql = new StringBuilder("INSERT INTO " + table.getTabEnName()),
                                     keySql = new StringBuilder("id, group_id"),
@@ -1233,9 +1234,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
                     String delSql = "delete from " + tabName + " where p_key_id=" + tableInfo.getPkeyId();
                     String sqlInfo = "";
                     LinkedHashMap<String, String> dataMap2 = tableInfo.getDataMap();
-                    if (!updateFieldLength(tabName, dataMap2)) {
-                        throw new ServiceException("字段长度超出限制, 系统无法进行自增,请前往后台管理系统手动设置");
-                    }
+                    updateFieldLength(tabName, dataMap2);
                     /*检查发现有p_key_id缺失的情况,导致表单数据丢失,所以强制覆盖*/
                     dataMap2.put("p_key_id", tableInfo.getPkeyId());
                     //统计保存的字段
@@ -1345,17 +1344,14 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
        // return R.success(fileName1);
     }
 
-    public boolean updateFieldLength(String tableName, Map<String, String> fieldNameAndLengthMap) {
+    public void updateFieldLength(String tableName, Map<String, String> fieldNameAndLengthMap) {
         if (fieldNameAndLengthMap == null || fieldNameAndLengthMap.isEmpty()) {
-            return true;
+            return;
         }
-        fieldNameAndLengthMap.remove("id");
-        fieldNameAndLengthMap.remove("p_key_id");
-        fieldNameAndLengthMap.remove("group_id");
-        if (fieldNameAndLengthMap.isEmpty()) {
-            return true;
+        String fields = fieldNameAndLengthMap.keySet().stream().filter(key -> !key.equals("id") && !key.equals("p_key_id") && !key.equals("group_id")).map(key -> "'" + key + "'").collect(Collectors.joining(","));
+        if (fields.isEmpty()) {
+            return;
         }
-        String fields = fieldNameAndLengthMap.keySet().stream().map(key -> "'" + key + "'").collect(Collectors.joining(","));
         List<Map<String, Object>> fieldMap = jdbcTemplate.queryForList("select distinct COLUMN_NAME as fieldName, CHARACTER_MAXIMUM_LENGTH as fieldLength from information_schema.COLUMNS where  TABLE_NAME = '" + tableName +
                 "' and COLUMN_NAME in (" + fields + ")");
         Map<String, Integer> map = fieldMap.stream().collect(toMap(k -> k.get("fieldName") + "", v -> {
@@ -1396,10 +1392,9 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
             } catch (Exception e) {
                 transactionManager1.rollback(transactionStatus);
                 log.error("更新字段长度失败, error: " + e.getMessage());
-                return false;
+                throw new ServiceException("字段长度超出限制, 系统无法进行自增,请前往后台管理系统手动设置");
             }
         }
-        return true;
     }
 
     public String reason(String log) {
@@ -3717,37 +3712,65 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
                         }
                     }
                 }
+            }
+        }
+        // 组装电签设置
+        Elements dqids = table.getElementsByAttribute("dqid");
+        // 电签组装2
+        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!=null && mapList.size()>0){
+            for(Map<String, Object> map : mapList) {
+                Elements elementsBy = table.getElementsByAttributeValueStarting("keyname", map.get("e_key") + "_");
+                if(elementsBy!=null && elementsBy.size()>0){
+                    for(Element element : elementsBy){
+                        String ids = (String) map.get("ids");
+                        ids = ids.replace(",","");
+                        ids = ids.substring(1);
+                        element.attr("sign_type", ids);
+                        dqids.add(element);
+                    }
+                }
 
-                // 组装电签设置
-                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);
+            }
+        }
+        for (Element element : dqids) {
+            String dqid="";
+            if(element.hasAttr("sign_type")){
+                dqid = element.attr("sign_type");
+            }else{
+                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());//设置字体
+                        CellStyle newStyle = workbook.createCellStyle(); //创建单元格样式
+                        newStyle.cloneStyleFrom(cell.getCellStyle());
+                        newStyle.setFont(redFont);
+                        newStyle.setShrinkToFit(true);
+                        cell.setCellStyle(newStyle);
+                        if (cell.getCellTypeEnum().equals(CellType.STRING)) {
+                            String value = cell.getStringCellValue();
+                            if (StringUtil.hasText(value) && !value.equals("/")) {
+                                dqid = value + "*" + dqid;
                             }
                         }
+                        cell.setCellValue(dqid);
                     }
                 }
             }
@@ -3937,6 +3960,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
                 //新增SQL
                 String sqlInfo = "";
                 LinkedHashMap<String, String> dataMap2 = tableInfo.getDataMap();
+                updateFieldLength(wbsTreePrivate.getInitTableName() ,dataMap2);
                 if(!dataMap2.containsKey("p_key_id")){
                     if(tableInfo.getPkeyId()!=null&&!tableInfo.getPkeyId().equals("")){
                         dataMap2.put("p_key_id",tableInfo.getPkeyId());
@@ -4775,56 +4799,89 @@ 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);
+                            }
 
-                // 组装电签设置
-                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);
-                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 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;
                                     }
-                                    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);
-                                            cell.setCellValue(e.getId() + "");
-                                        } else {
-                                            ObjectUtils.isNotEmpty(cell);
-                                        }
+                                    if (cell.getCellTypeEnum() == CellType.STRING && StringUtil.hasText(cell.getStringCellValue())) {
+                                        id = cell.getStringCellValue() + "*" + id;
                                     }
+                                    cell.setCellValue(id);
+                                } else {
+                                    ObjectUtils.isNotEmpty(cell);
                                 }
                             }
                         }

+ 121 - 31
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/FormulaServiceImpl.java

@@ -7,7 +7,6 @@ import cn.hutool.core.util.HashUtil;
 import cn.hutool.log.StaticLog;
 import com.alibaba.fastjson.JSON;
 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.toolkit.CollectionUtils;
@@ -22,17 +21,14 @@ import lombok.RequiredArgsConstructor;
 import org.apache.poi.ss.usermodel.*;
 import org.apache.poi.ss.util.CellReference;
 import org.apache.poi.util.IOUtils;
-import org.apache.poi.xssf.usermodel.XSSFRichTextString;
 import org.jsoup.Jsoup;
 import org.jsoup.nodes.Document;
 import org.jsoup.nodes.Element;
 import org.jsoup.select.Elements;
 import org.springblade.common.constant.CommonConstant;
-import org.springblade.common.constant.MeasurementStorage;
 import org.springblade.common.utils.BaseUtils;
 import org.springblade.common.utils.CommonUtil;
 import org.springblade.common.utils.SnowFlakeUtil;
-import org.springblade.core.log.exception.ServiceException;
 import org.springblade.core.mp.base.BaseEntity;
 import org.springblade.core.mp.base.BaseServiceImpl;
 import org.springblade.core.mp.support.Condition;
@@ -91,8 +87,6 @@ import java.util.stream.Collectors;
 import java.util.stream.IntStream;
 import java.util.stream.Stream;
 
-import static org.springblade.manager.utils.TableCoordinates.*;
-
 /**
  * @author yangyj
  * @Date 2022/6/9 14:29
@@ -2487,7 +2481,7 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
         String sql = "Select * from s_contract_meter_period where contract_id=" + contractId + " and is_deleted=0" + " order by start_date";
         List<ContractMeterPeriod> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(ContractMeterPeriod.class));
         //获取所有excel报表源数据
-        String sqlForExcel = "SELECT p.p_key_id,e.name,e.id,p.html_url,e.file_url FROM m_wbs_tree_private as p LEFT JOIN m_excel_tab as e on p.excel_id=e.id where p.wbs_type=3 AND p.is_deleted=0 AND p.type=2" + " and p.project_id=" + projectId;
+        String sqlForExcel = "SELECT p.p_key_id,e.name,e.id,p.html_url,e.file_url,p.init_table_name as tabName FROM m_wbs_tree_private as p LEFT JOIN m_excel_tab as e on p.excel_id=e.id where p.wbs_type=3 AND p.is_deleted=0 AND p.type=2" + " and p.project_id=" + projectId;
         List<ExcelTabVo1> excelTabs = jdbcTemplate.query(sqlForExcel, new BeanPropertyRowMapper<>(ExcelTabVo1.class));
         ArrayList<ReportResult> reportResults = new ArrayList<>();
         //中期支付报表封面
@@ -2533,25 +2527,25 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
         String htmlUrl6 = excel6.get().getHtmlUrl();
         Long pKeyId6 = excel6.get().getPKeyId();
         // 获取中期支付报表封面的pdfurl
-        ReportResult CoverOfMidtermPaymentReportPDF = getCoverOfMidtermPaymentReportPDF(url, contractId, periodId, htmlUrl, projectName, list, pKeyId);
+        ReportResult CoverOfMidtermPaymentReportPDF = getCoverOfMidtermPaymentReportPDF(url, contractId, periodId, htmlUrl, projectName, list, pKeyId, excel.get().getTabName());
 
         //获取中间支付审核表的pdfurl
-        ReportResult intermediatePaymentPDF = getIntermediatePaymentPDF(url1, contractId, periodId, list, redisId, htmlUrl1, blReserveFundsRatioNew, projectName, changeMoneyNew, pKeyId1);
+        ReportResult intermediatePaymentPDF = getIntermediatePaymentPDF(url1, contractId, periodId, list, redisId, htmlUrl1, blReserveFundsRatioNew, projectName, changeMoneyNew, pKeyId1, excel1.get().getTabName());
 
         //获取补助款申请支付审核表pdfUrl
-        ReportResult subsidyApplicationPaymentReviewPDF = getSubsidyApplicationPaymentReviewPDF(url2, contractId, periodId, list, htmlUrl2, blReserveFundsRatioNew, projectName, projectId, reportId, pKeyId2);
+        ReportResult subsidyApplicationPaymentReviewPDF = getSubsidyApplicationPaymentReviewPDF(url2, contractId, periodId, list, htmlUrl2, blReserveFundsRatioNew, projectName, projectId, reportId, pKeyId2,excel2.get().getTabName());
 
         //获取中间计量支付证书pdfUrl
-        ReportResult intermediateMeasurementPaymentCertificatePDF = getIntermediateMeasurementPaymentCertificatePDF(url3, contractId, periodId, list, htmlUrl3, blReserveFundsRatioNew, projectName, pKeyId3);
+        ReportResult intermediateMeasurementPaymentCertificatePDF = getIntermediateMeasurementPaymentCertificatePDF(url3, contractId, periodId, list, htmlUrl3, blReserveFundsRatioNew, projectName, pKeyId3,excel3.get().getTabName());
 
         //获取清单支付报表PDF
-        ReportResult inventoryPayReportPDF = getInventoryPayReportPDF(url6, contractId, periodId, projectId, list, redisId, htmlUrl6, pKeyId6);
+        ReportResult inventoryPayReportPDF = getInventoryPayReportPDF(url6, contractId, periodId, projectId, list, redisId, htmlUrl6, pKeyId6, excel6.get().getTabName());
 
         //获取工程支付月报pdfUrl
-        ReportResult monthlyReportPDF = getMonthlyReportPDF(url5, reportId, contractId, periodId, projectId, list, redisId, htmlUrl5, pKeyId5);
+        ReportResult monthlyReportPDF = getMonthlyReportPDF(url5, reportId, contractId, periodId, projectId, list, redisId, htmlUrl5, pKeyId5, excel5.get().getTabName());
 
         //获取中间支付申请表pdfUrl
-        ReportResult intermediateApplyPDF = getIntermediateApplyPDF(url4, periodId, projectId, htmlUrl4, projectName, contractId, pKeyId4);
+        ReportResult intermediateApplyPDF = getIntermediateApplyPDF(url4, periodId, projectId, htmlUrl4, projectName, contractId, pKeyId4, excel4.get().getTabName());
 
         reportResults.add(CoverOfMidtermPaymentReportPDF);
         reportResults.add(intermediatePaymentPDF);
@@ -2569,7 +2563,7 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
     /**
      * 中期支付报表封面
      */
-    private ReportResult getCoverOfMidtermPaymentReportPDF(String url, Long contractId, Long periodId, String htmlUrl, String projectName, List<ContractMeterPeriod> list, Long pkeyId) {
+    private ReportResult getCoverOfMidtermPaymentReportPDF(String url, Long contractId, Long periodId, String htmlUrl, String projectName, List<ContractMeterPeriod> list, Long pkeyId, String tabName) {
 
         //获取本期计量期
         String sqlForMeterPeriodById = "SELECT id,period_number,start_date,end_date FROM s_contract_meter_period WHERE id=" + periodId + " and is_deleted = 0 ";
@@ -2620,7 +2614,7 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
                 Cell c10 = getCellByAddress(sheet, "C10");
                 c10.setCellValue(contractInfo.getSupervisionUnitName());
             }
-            dianqian(htmlUrl, sheet, workbook);
+            dianqian(htmlUrl, sheet, workbook, tabName);
             if (!periodId.equals(1867838908899852290L)) {
                 dianqianTime(htmlUrl, sheet, workbook, pkeyId, periodId, contractId);
             }
@@ -2656,7 +2650,7 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
     }
 
     /*设置电签ID*/
-    public void dianqian(String htmlUrl, Sheet sheet, Workbook workbook) {
+    public void dianqian(String htmlUrl, Sheet sheet, Workbook workbook, String tabName) {
         try {
             InputStream inputStreamByUrl = FileUtils.getInputStreamByUrl(htmlUrl);
             String htmlString = IoUtil.readToString(inputStreamByUrl);
@@ -2664,8 +2658,30 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
             Element table = doc.select("table").first();
             // 组装电签设置
             Elements dqids = table.getElementsByAttribute("dqid");
+            // 电签组装2
+            String dqSql = "select e_key,GROUP_CONCAT(DISTINCT concat('*✹',id)) ids from u_sign_key_role_info where tab_en_name='" + tabName + "' GROUP BY e_key";
+            List<Map<String, Object>> mapList = jdbcTemplate.queryForList(dqSql);
+            if(mapList!=null && mapList.size()>0){
+                for(Map<String, Object> map : mapList) {
+                    Elements elementsBy = table.getElementsByAttributeValueStarting("keyname", map.get("e_key") + "_");
+                    if(elementsBy!=null && elementsBy.size()>0){
+                        for(Element element : elementsBy){
+                            String dqIds = (String) map.get("ids");
+                            dqIds = dqIds.replace(",","");
+                            dqIds = dqIds.substring(1);
+                            element.attr("sign_type", dqIds);
+                            dqids.add(element);
+                        }
+                    }
+                }
+            }
             for (Element element : dqids) {
-                String dqid = element.attr("dqid");
+                String dqid="";
+                if(element.hasAttr("sign_type")){
+                    dqid = element.attr("sign_type");
+                }else{
+                    dqid = element.attr("dqid");
+                }
 
                 int x1 = 0;
                 int y1 = 0;
@@ -2759,7 +2775,7 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
     /**
      * 中间计量支付证书获取PDFurl
      */
-    private ReportResult getIntermediateMeasurementPaymentCertificatePDF(String url3, Long contractId, Long periodId, List<ContractMeterPeriod> list, String htmlUrl, BigDecimal blReserveFundsRatioNew, String projectName, Long pkeyId) {
+    private ReportResult getIntermediateMeasurementPaymentCertificatePDF(String url3, Long contractId, Long periodId, List<ContractMeterPeriod> list, String htmlUrl, BigDecimal blReserveFundsRatioNew, String projectName, Long pkeyId, String tabName) {
         //判断当前是否是第一期
         Boolean isOnePeriod = false;
         ContractMeterPeriod contractMeterPeriod = list.get(0);
@@ -2840,7 +2856,7 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
             Cell c3 = getCellByAddress(sheet, "C3");
             c3.setCellValue(projectName);
 
-            dianqian(htmlUrl, sheet, workbook);
+            dianqian(htmlUrl, sheet, workbook, tabName);
             if (!periodId.equals(1867838908899852290L)) {
                 dianqianTime(htmlUrl, sheet, workbook, pkeyId, periodId, contractId);
             }
@@ -2886,7 +2902,7 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
     /**
      * 补助款申请支付审核表获取PDFurl
      */
-    private ReportResult getSubsidyApplicationPaymentReviewPDF(String url2, Long contractId, Long periodId, List<ContractMeterPeriod> list, String htmlUrl, BigDecimal blReserveFundsRatioNew, String projectName, Long projectId, Long reportId, Long pkeyId) {
+    private ReportResult getSubsidyApplicationPaymentReviewPDF(String url2, Long contractId, Long periodId, List<ContractMeterPeriod> list, String htmlUrl, BigDecimal blReserveFundsRatioNew, String projectName, Long projectId, Long reportId, Long pkeyId, String tabName) {
         //判断当前是否是只有1期计量
         Boolean isOnePeriod = false;
         ContractMeterPeriod contractMeterPeriod = list.get(0);
@@ -3160,7 +3176,7 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
             Cell a2 = getCellByAddress(sheet, "A2");
             a2.setCellValue(projectName);
             // 电签
-            dianqian(htmlUrl, sheet, workbook);
+            dianqian(htmlUrl, sheet, workbook, tabName);
             if (!periodId.equals(1867838908899852290L)) {
                 dianqianTime(htmlUrl, sheet, workbook, pkeyId, periodId, contractId);
             }
@@ -3200,7 +3216,7 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
     /**
      * 中间支付审核表获取PDFurl
      */
-    public ReportResult getIntermediatePaymentPDF(String url, Long contractId, Long periodId, List<ContractMeterPeriod> list, Long redisId, String htmlUrl, BigDecimal blReserveFundsRatioNew, String projectName, BigDecimal changeMoneyNew, Long pkeyId) {
+    public ReportResult getIntermediatePaymentPDF(String url, Long contractId, Long periodId, List<ContractMeterPeriod> list, Long redisId, String htmlUrl, BigDecimal blReserveFundsRatioNew, String projectName, BigDecimal changeMoneyNew, Long pkeyId, String tabName) {
         //判断当前是否是只有1期计量
         Boolean isOnePeriod = false;
         ContractMeterPeriod contractMeterPeriod1 = list.get(0);
@@ -3472,7 +3488,7 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
             //顶部项目名称
             Cell a1 = getCellByAddress(sheet, "A1");
             a1.setCellValue(projectName);
-            dianqian(htmlUrl, sheet, workbook);
+            dianqian(htmlUrl, sheet, workbook, tabName);
             if (!periodId.equals(1867838908899852290L)) {
                 dianqianTime(htmlUrl, sheet, workbook, pkeyId, periodId, contractId);
             }
@@ -3621,9 +3637,10 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
      * 中间支付申请表获取pdfUrl
      *
      * @param url
+     * @param tabName
      * @return
      */
-    public ReportResult getIntermediateApplyPDF(String url, Long periodId, Long projectId, String htmlUrl, String projectName, Long contractId, Long pkeyId) {
+    public ReportResult getIntermediateApplyPDF(String url, Long periodId, Long projectId, String htmlUrl, String projectName, Long contractId, Long pkeyId, String tabName) {
         InputStream modInput = null;
         FileInputStream excelFileInput = null;
         FileOutputStream outputStream = null;
@@ -3633,7 +3650,7 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
             modInput = CommonUtil.getOSSInputStream(url);
             workbook = WorkbookFactory.create(modInput);
             Sheet sheet = workbook.getSheetAt(0);
-            dianqian(htmlUrl, sheet, workbook);
+            dianqian(htmlUrl, sheet, workbook, tabName);
             if (!periodId.equals(1867838908899852290L)) {
                 dianqianTime(htmlUrl, sheet, workbook, pkeyId, periodId, contractId);
             }
@@ -3700,9 +3717,10 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
      * 工程支付月报获取pdfUrl
      *
      * @param url
+     * @param tabName
      * @return
      */
-    public ReportResult getMonthlyReportPDF(String url, Long reportId, Long contractId, Long periodId, Long projectId, List<ContractMeterPeriod> list, Long redisId, String htmlUrl, Long pkeyId) throws IllegalAccessException {
+    public ReportResult getMonthlyReportPDF(String url, Long reportId, Long contractId, Long periodId, Long projectId, List<ContractMeterPeriod> list, Long redisId, String htmlUrl, Long pkeyId, String tabName) throws IllegalAccessException {
         //获取本期计量期
         String sqlForMeterPeriodById = "SELECT id,period_number,start_date,end_date FROM s_contract_meter_period WHERE id=" + periodId + " and is_deleted = 0 ";
         ContractMeterPeriod contractMeterPeriodNow = jdbcTemplate.queryForObject(sqlForMeterPeriodById, new BeanPropertyRowMapper<>(ContractMeterPeriod.class));
@@ -4155,7 +4173,7 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
                     m_3.setCellValue(formattedDate);
                 }
             }
-            dianqian(htmlUrl, sheet, workbook);
+            dianqian(htmlUrl, sheet, workbook, tabName);
             if (!periodId.equals(1867838908899852290L)) {
                 dianqianTime(htmlUrl, sheet, workbook, pkeyId, periodId, contractId);
             }
@@ -4191,10 +4209,11 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
      * 清单支付报表获取PDF
      *
      * @param url
+     * @param tabName
      * @return
      */
 
-    public ReportResult getInventoryPayReportPDF(String url, Long contractId, Long periodId, Long projectId, List<ContractMeterPeriod> list, Long redisId, String htmlUrl, Long pkeyId) throws FileNotFoundException, IllegalAccessException {
+    public ReportResult getInventoryPayReportPDF(String url, Long contractId, Long periodId, Long projectId, List<ContractMeterPeriod> list, Long redisId, String htmlUrl, Long pkeyId, String tabName) throws FileNotFoundException, IllegalAccessException {
         MiddleMeterApply middleMeterApply = new MiddleMeterApply();
         middleMeterApply.setContractId(contractId);
         middleMeterApply.setContractPeriodId(periodId);
@@ -4563,7 +4582,7 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
                             l4.setCellStyle(cellStyle);
                             l4.setCellValue(contractInfo.getSupervisionUnitName());
                         }
-                        dianqian(htmlUrl, sheet, workbook);
+                        dianqian(htmlUrl, sheet, workbook, tabName);
                         if (!periodId.equals(1867838908899852290L)) {
                             dianqianTime(htmlUrl, sheet, workbook, pkeyId, periodId, contractId);
                         }
@@ -6104,7 +6123,10 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
             String initTableName = nt.getInitTableName();
             Document document = documentMap.get(nt.getInitTableName());
             coordinateMap.put(initTableName, FormulaUtils.getElementExcelCoords(document));
-            eSignMaps.put(initTableName, FormulaUtils.getESignMap(document));
+            Map<String, String> eSignMap = FormulaUtils.getESignMap(document);
+            eSignMaps.put(initTableName, eSignMap);
+            // 电签组装2
+            getSignMapBySignConfig(initTableName, document, eSignMap);
         });
         executionTime.info("坐标信息获取");
         /*额外单元格坐标配置*/
@@ -6160,6 +6182,74 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
         return tec.getReportResults();
     }
 
+    private void getSignMapBySignConfig(String initTableName, Document document, Map<String, String> eSignMap) {
+        String dqSql = "select e_key,GROUP_CONCAT(DISTINCT concat('*✹',id)) ids from u_sign_key_role_info where tab_en_name='" + initTableName + "' GROUP BY e_key";
+        List<Map<String, Object>> mapList = jdbcTemplate.queryForList(dqSql);
+        if(!mapList.isEmpty()){
+            for(Map<String, Object> map : mapList) {
+                Elements elementsBy = document.getElementsByAttributeValueStarting("keyname", map.get("e_key") + "_");
+                if(elementsBy!=null && !elementsBy.isEmpty()){
+                    for(Element element : elementsBy){
+                        String dqIds = (String) map.get("ids");
+                        dqIds = dqIds.replace(",","");
+                        dqIds = dqIds.substring(1);
+                        int x1 = -1,y1 = -1;
+                        try {
+                            if (element.hasAttr("x1") && element.hasAttr("y1")) {
+                                x1 = Integer.parseInt(element.attr("x1"));
+                                y1 = Integer.parseInt(element.attr("y1"));
+                            } else {
+                                if (element.tagName().equals("td")) {
+                                    Elements x11 = element.getElementsByAttribute("x1");
+                                    if (x11 != null && !x11.isEmpty()) {
+                                        x1 = Integer.parseInt(x11.attr("x1"));
+                                    }
+                                    Elements y11 = element.getElementsByAttribute("y1");
+                                    if (y11 != null && !y11.isEmpty()) {
+                                        y1 = Integer.parseInt(y11.attr("y1"));
+                                    }
+                                } else {
+                                    Elements parents = element.parents();
+                                    if (parents != null && !parents.isEmpty()) {
+                                        for (Element parent1 : parents) {
+                                            if (parent1.hasAttr("x1") && parent1.hasAttr("y1")) {
+                                                x1 = Integer.parseInt(parent1.attr("x1"));
+                                                y1 = Integer.parseInt(parent1.attr("y1"));
+                                                break;
+                                            }
+                                            if (parent1.tagName().equals("td")) {
+                                                break;
+                                            }
+                                        }
+                                    }
+                                }
+                            }
+                        } catch (Exception e) {
+                            log.error("坐标获取异常", e);
+                        }
+                        if (x1 == -1 || y1 == -1) {
+                            String keyname = element.attr("keyname");
+                            String[] split = keyname.split("__");
+                            if (split.length > 1) {
+                                String value = eSignMap.get(y1 + "_" + x1);
+                                if (StringUtil.hasText(value)) {
+                                    dqIds = value + "*" + dqIds;
+                                }
+                                eSignMap.put(split[1], dqIds);
+                            }
+                        } else {
+                            String value = eSignMap.get(y1 + "_" + x1);
+                            if (StringUtil.hasText(value)) {
+                                dqIds = value + "*" + dqIds;
+                            }
+                            eSignMap.put(y1 + "_" + x1, dqIds);
+                        }
+                    }
+                }
+            }
+        }
+    }
+
     public void saveInterimPayCertificateItems(List<InterimPayCertificateItem> items,Long reportId) {
         if (items != null && items.size() > 0) {
             this.certificateItemClient.saveOrUpdate(items,reportId);