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

Merge remote-tracking branch 'origin/master' into master

yangyj 1 жил өмнө
parent
commit
9bd2163641
13 өөрчлөгдсөн 620 нэмэгдсэн , 479 устгасан
  1. 3 0
      blade-service-api/blade-business-api/src/main/java/org/springblade/business/entity/ImageClassificationFile.java
  2. 10 0
      blade-service-api/blade-business-api/src/main/java/org/springblade/business/feign/ContractLogClient.java
  3. 1 0
      blade-service-api/blade-business-api/src/main/java/org/springblade/business/vo/ImageClassificationFileVO.java
  4. 39 1
      blade-service/blade-business/src/main/java/org/springblade/business/controller/ContractLogController.java
  5. 25 2
      blade-service/blade-business/src/main/java/org/springblade/business/controller/ImageClassificationFileController.java
  6. 44 24
      blade-service/blade-business/src/main/java/org/springblade/business/feignClient/ContractLogClientImpl.java
  7. 1 1
      blade-service/blade-business/src/main/java/org/springblade/business/mapper/ImageClassificationFileMapper.java
  8. 5 1
      blade-service/blade-business/src/main/java/org/springblade/business/mapper/ImageClassificationFileMapper.xml
  9. 1 1
      blade-service/blade-business/src/main/java/org/springblade/business/service/IImageClassificationFileService.java
  10. 14 2
      blade-service/blade-business/src/main/java/org/springblade/business/service/impl/ContractLogServiceImpl.java
  11. 2 2
      blade-service/blade-business/src/main/java/org/springblade/business/service/impl/ImageClassificationFileServiceImpl.java
  12. 388 369
      blade-service/blade-manager/src/main/java/org/springblade/manager/controller/ExcelTabController.java
  13. 87 76
      blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/ExcelTabServiceImpl.java

+ 3 - 0
blade-service-api/blade-business-api/src/main/java/org/springblade/business/entity/ImageClassificationFile.java

@@ -127,4 +127,7 @@ public class ImageClassificationFile extends BaseEntity {
     @ApiModelProperty("合并后的PDF")
     private String margePdfUrl;
 
+    @ApiModelProperty("视频封面图Url地址")
+    private String videoCoverUrl;
+
 }

+ 10 - 0
blade-service-api/blade-business-api/src/main/java/org/springblade/business/feign/ContractLogClient.java

@@ -1,6 +1,7 @@
 package org.springblade.business.feign;
 
 import com.alibaba.fastjson.JSONObject;
+import org.springblade.business.entity.ContractLog;
 import org.springblade.business.vo.SaveContractLogVO;
 import org.springblade.common.constant.BusinessConstant;
 import org.springframework.cloud.openfeign.FeignClient;
@@ -30,12 +31,21 @@ public interface ContractLogClient {
     @PostMapping(API_PREFIX + "/updateTheLogPdfUrl")
     void updateTheLogPdfUrl(@RequestParam String theLogId, @RequestParam String pdfUrl);
 
+    @PostMapping(API_PREFIX + "/updateTheLogPdfUrlByIds")
+    void updateTheLogPdfUrlByIds(@RequestParam String theLogId, @RequestParam String pdfUrl);
+
     @GetMapping(API_PREFIX + "/queryContractLogByPrimaryKeyIdAndRecordTime")
     JSONObject queryContractLogByPrimaryKeyIdAndRecordTime(@RequestParam String nodePrimaryKeyId, @RequestParam String recordTime, @RequestParam String contractId);
 
+    @GetMapping(API_PREFIX + "/queryContractLogByPrimaryKeyIdAndRecordTimeList")
+    List<ContractLog> queryContractLogByPrimaryKeyIdAndRecordTimeList(@RequestParam String nodePrimaryKeyId, @RequestParam String recordTime, @RequestParam String contractId);
+
     @GetMapping(API_PREFIX + "/queryContractLogById")
     JSONObject queryContractLogById(@RequestParam String theLogId);
 
+    @GetMapping(API_PREFIX + "/queryContractLogByIdToObj")
+    ContractLog queryContractLogByIdToObj(@RequestParam String theLogId);
+
     @PostMapping(API_PREFIX + "/queryContractLogByIdList")
     List<JSONObject> queryContractLogByIds(@RequestBody List<String> theLogIds);
 

+ 1 - 0
blade-service-api/blade-business-api/src/main/java/org/springblade/business/vo/ImageClassificationFileVO.java

@@ -85,4 +85,5 @@ public class ImageClassificationFileVO extends ImageClassificationFile {
     @ApiModelProperty("是否是App")
     private Integer isApp;
 
+
 }

+ 39 - 1
blade-service/blade-business/src/main/java/org/springblade/business/controller/ContractLogController.java

@@ -174,7 +174,7 @@ public class ContractLogController extends BladeController {
             @ApiImplicitParam(name = "recordTime", value = "当前选择的填写日期,即右侧日期控件所选日期,格式为 yyyy-MM-dd", required = true)
     })
     public R<Integer> checkTheLogTaskStatus(@RequestParam String nodePrimaryKeyId, @RequestParam String recordTime, @RequestParam String contractId) {
-        ContractLog log = this.contractLogService.getOne(Wrappers.<ContractLog>lambdaQuery()
+        /*ContractLog log = this.contractLogService.getOne(Wrappers.<ContractLog>lambdaQuery()
                 .eq(ContractLog::getWbsNodeId, nodePrimaryKeyId)
                 .eq(ContractLog::getContractId, contractId)
                 .eq(ContractLog::getRecordTime, recordTime)
@@ -198,6 +198,44 @@ public class ContractLogController extends BladeController {
                     status = 4;
                     break;
             }
+        }*/
+
+        List<ContractLog> log = this.contractLogService.getBaseMapper().selectList(Wrappers.<ContractLog>lambdaQuery()
+                .eq(ContractLog::getWbsNodeId, nodePrimaryKeyId)
+                .eq(ContractLog::getContractId, contractId)
+                .eq(ContractLog::getRecordTime, recordTime)
+                .eq(ContractLog::getCreateUser, AuthUtil.getUserId()));
+
+        //默认未上报
+        int status = 1;
+        if (!log.isEmpty()) {
+            int highestStatus = 1; //初始化为默认值
+            for (ContractLog contractLog : log) {
+                int logStatus = contractLog.getStatus();
+
+                switch (logStatus) {
+                    case 0:
+                    case 3:
+                        //已填报未上报 或 已填报已废除
+                        if (highestStatus < 2) {
+                            highestStatus = 2;
+                        }
+                        break;
+                    case 1:
+                        //待审批
+                        if (highestStatus < 3) {
+                            highestStatus = 3;
+                        }
+                        break;
+                    case 2:
+                        //已审批
+                        if (highestStatus < 4) {
+                            highestStatus = 4;
+                        }
+                        break;
+                }
+            }
+            status = highestStatus;
         }
 
         return R.data(status);

+ 25 - 2
blade-service/blade-business/src/main/java/org/springblade/business/controller/ImageClassificationFileController.java

@@ -484,7 +484,11 @@ public class ImageClassificationFileController extends BladeController {
             }
 
             //获取当前节点下的文件
-            Integer count = this.imageClassificationFileService.queryCurrentClassifyAllFileCount(projectId, contractId, vo.getId());
+            String type = "1";
+            if (vo.getId().toString().equals("1526085356632051714") || vo.getId().toString().equals("1526085256795033601")) {
+                type = "2";
+            }
+            Integer count = this.imageClassificationFileService.queryCurrentClassifyAllFileCount(projectId, contractId, vo.getId(), type);
             vo.setCount(count);
 
         });
@@ -530,7 +534,7 @@ public class ImageClassificationFileController extends BladeController {
             @ApiImplicitParam(name = "staDate", value = "开始时间"),
             @ApiImplicitParam(name = "endDate", value = "结束时间")
     })
-    public R<Object> page(ImageClassificationFileVO fileVO, Query query) {
+    public R<Object> page(ImageClassificationFileVO fileVO, Query query) throws Exception {
         IPage<ImageClassificationFileVO> page = this.imageClassificationFileService.selectImageClassificationFilePage(Condition.getPage(query), fileVO);
         List<ImageClassificationFileVO> sortedRecords = page.getRecords().stream()
                 .filter(vos -> vos.getCreateTime() != null)//过滤掉创建时间为null的记录
@@ -553,6 +557,14 @@ public class ImageClassificationFileController extends BladeController {
                 List<ImageClassificationFileVO> value = stringObjectEntry.getValue();
                 Map<String, Object> stringObjectMap = new HashMap<>();
                 stringObjectMap.put("name", date);
+
+                for (ImageClassificationFileVO vo : value) {
+                    if (StringUtils.isNotEmpty(vo.getImageUrl()) && isVideoUrl(vo.getImageUrl()) && StringUtils.isEmpty(vo.getVideoCoverUrl())) {
+                        //设置默认视频封面logo
+                        vo.setVideoCoverUrl("https://bladex-chongqing-info.oss-cn-hangzhou.aliyuncs.com//upload/20230904/b86888a3fcd280d56053639dbfddb35d.jpg");
+                    }
+                }
+
                 stringObjectMap.put("child", value);
                 list.add(stringObjectMap);
             }
@@ -560,7 +572,18 @@ public class ImageClassificationFileController extends BladeController {
         }
         page.setRecords(sortedRecords);
         return R.data(page);
+    }
 
+    /**
+     * 根据Url地址后缀判断是否为视频地址
+     */
+    public static boolean isVideoUrl(String url) {
+        String lowercaseUrl = url.toLowerCase(); //将URL转换为小写,以便不区分大小写
+        return lowercaseUrl.endsWith(".mp4") || lowercaseUrl.endsWith(".avi") || lowercaseUrl.endsWith(".mov")
+                || lowercaseUrl.endsWith(".wmv") || lowercaseUrl.endsWith(".mkv") || lowercaseUrl.endsWith(".flv")
+                || lowercaseUrl.endsWith(".3gp")
+                || lowercaseUrl.endsWith(".m4v")
+                || lowercaseUrl.endsWith(".webm");
     }
 
     /**

+ 44 - 24
blade-service/blade-business/src/main/java/org/springblade/business/feignClient/ContractLogClientImpl.java

@@ -81,6 +81,13 @@ public class ContractLogClientImpl implements ContractLogClient {
         this.contractLogService.update(Wrappers.<ContractLog>lambdaUpdate().set(ContractLog::getPdfUrl, pdfUrl).eq(ContractLog::getId, theLogId));
     }
 
+    @Override
+    public void updateTheLogPdfUrlByIds(String theLogId, String pdfUrl) {
+        for (String id : theLogId.split(",")) {
+            this.contractLogService.update(Wrappers.<ContractLog>lambdaUpdate().set(ContractLog::getPdfUrl, pdfUrl).eq(ContractLog::getId, id));
+        }
+    }
+
     @Override
     public JSONObject queryContractLogByPrimaryKeyIdAndRecordTime(String nodePrimaryKeyId, String recordTime, String contractId) {
         ContractLog log = this.contractLogService.getOne(Wrappers.<ContractLog>lambdaQuery()
@@ -91,12 +98,26 @@ public class ContractLogClientImpl implements ContractLogClient {
         return log != null ? JSONObject.parseObject(JSONObject.toJSONString(log)) : null;
     }
 
+    @Override
+    public List<ContractLog> queryContractLogByPrimaryKeyIdAndRecordTimeList(String nodePrimaryKeyId, String recordTime, String contractId) {
+        return this.contractLogService.getBaseMapper().selectList(Wrappers.<ContractLog>lambdaQuery()
+                .eq(ContractLog::getWbsNodeId, nodePrimaryKeyId)
+                .eq(ContractLog::getRecordTime, recordTime)
+                .eq(ContractLog::getContractId, contractId)
+                .eq(ContractLog::getCreateUser, AuthUtil.getUserId()));
+    }
+
     @Override
     public JSONObject queryContractLogById(String theLogId) {
         ContractLog log = this.contractLogService.getById(theLogId);
         return log != null ? JSONObject.parseObject(JSONObject.toJSONString(log)) : null;
     }
 
+    @Override
+    public ContractLog queryContractLogByIdToObj(String theLogId) {
+        return this.contractLogService.getById(theLogId);
+    }
+
     @Override
     public List<JSONObject> queryContractLogByIds(List<String> theLogIds) {
         List<ContractLog> logList = this.contractLogService.list(Wrappers.<ContractLog>lambdaQuery().in(ContractLog::getId, theLogIds));
@@ -109,7 +130,7 @@ public class ContractLogClientImpl implements ContractLogClient {
         //复制数据
         BeanUtils.copyProperties(saveContractLogVO, contractLog);
 
-        //查询是否存在旧数据
+        /*//查询是否存在旧数据
         JSONObject logJson = this.queryContractLogByPrimaryKeyIdAndRecordTime(saveContractLogVO.getWbsNodeId().toString(), saveContractLogVO.getRecordTime(), saveContractLogVO.getContractId().toString());
 
         if (logJson != null) {
@@ -131,31 +152,30 @@ public class ContractLogClientImpl implements ContractLogClient {
             this.contractLogService.update(Wrappers.<ContractLog>lambdaUpdate().set(ContractLog::getDataId, contractLog.getDataId()).eq(ContractLog::getId, logJson.getString("id")));
 
             return logJson.getString("id");
-        } else {
-            //获取节点信息
-            WbsTreePrivate node = this.wbsTreePrivateClient.queryByPKeyIds(Func.toStrList(saveContractLogVO.getWbsNodeId().toString())).get(0);
-
-            //新增
-            contractLog.setId(SnowFlakeUtil.getId());
-            contractLog.setCreateTime(new Date());
-            contractLog.setCreateUser(AuthUtil.getUserId());
-            contractLog.setCreateUserName(AuthUtil.getNickName());
-            contractLog.setStatus(0);
-            contractLog.setFileName(saveContractLogVO.getRecordTime() + " " + node.getNodeName() + " " + AuthUtil.getNickName());
-
-            if (saveContractLogVO.getCorrelationIds() != null && saveContractLogVO.getCorrelationIds().size() > 0) {
-                List<JSONObject> list = saveContractLogVO.getCorrelationIds();
-                List<ContractLogWbs> logWbsList = new ArrayList<>();
-                //处理数据
-                list.forEach(json -> logWbsList.add(this.createContractLogWbs(json, contractLog)));
-                this.contractLogWbsService.saveBatch(logWbsList);
-            }
-
-            this.contractLogService.save(contractLog);
-
-            return contractLog.getId().toString();
+        } else {*/
+        //获取节点信息
+        WbsTreePrivate node = this.wbsTreePrivateClient.queryByPKeyIds(Func.toStrList(saveContractLogVO.getWbsNodeId().toString())).get(0);
+
+        //新增
+        contractLog.setId(SnowFlakeUtil.getId());
+        contractLog.setCreateTime(new Date());
+        contractLog.setCreateUser(AuthUtil.getUserId());
+        contractLog.setCreateUserName(AuthUtil.getNickName());
+        contractLog.setStatus(0);
+        contractLog.setFileName(saveContractLogVO.getRecordTime() + " " + node.getNodeName() + " " + AuthUtil.getNickName());
+
+        if (saveContractLogVO.getCorrelationIds() != null && saveContractLogVO.getCorrelationIds().size() > 0) {
+            List<JSONObject> list = saveContractLogVO.getCorrelationIds();
+            List<ContractLogWbs> logWbsList = new ArrayList<>();
+            //处理数据
+            list.forEach(json -> logWbsList.add(this.createContractLogWbs(json, contractLog)));
+            this.contractLogWbsService.saveBatch(logWbsList);
         }
 
+        this.contractLogService.save(contractLog);
+
+        return contractLog.getId().toString();
+        //}
     }
 
     private ContractLogWbs createContractLogWbs(JSONObject json, ContractLog contractLog) {

+ 1 - 1
blade-service/blade-business/src/main/java/org/springblade/business/mapper/ImageClassificationFileMapper.java

@@ -44,7 +44,7 @@ public interface ImageClassificationFileMapper extends BaseMapper<ImageClassific
      * @param classifyId 分类ID
      * @return 结果
      */
-    Integer queryCurrentClassifyAllFileCount(@Param("projectId") String projectId, @Param("contractId") String contractId, @Param("classifyId") Long classifyId);
+    Integer queryCurrentClassifyAllFileCount(@Param("projectId") String projectId, @Param("contractId") String contractId, @Param("classifyId") Long classifyId, @Param("type") String type);
 
     /**
      * 获取当前分类下当前项目的拍摄时间

+ 5 - 1
blade-service/blade-business/src/main/java/org/springblade/business/mapper/ImageClassificationFileMapper.xml

@@ -52,7 +52,11 @@
         <if test="projectId != null and projectId != ''">
             and project_id = #{projectId}
         </if>
-            and a.wbs_id in (select p_key_id from m_wbs_tree_contract where is_deleted = 0 and status = 1 and contract_id = #{contractId})
+        <choose>
+            <when test="type == 1">
+                and a.wbs_id in (select p_key_id from m_wbs_tree_contract where is_deleted = 0 and status = 1 and contract_id = #{contractId})
+            </when>
+        </choose>
     </select>
 
     <select id="selectShootingTimeByClassifyAndProjectId" resultType="java.util.Date">

+ 1 - 1
blade-service/blade-business/src/main/java/org/springblade/business/service/IImageClassificationFileService.java

@@ -27,7 +27,7 @@ public interface IImageClassificationFileService extends BaseService<ImageClassi
      * @param classifyId 分类ID
      * @return 结果
      */
-    Integer queryCurrentClassifyAllFileCount(String projectId, String contractId, Long classifyId);
+    Integer queryCurrentClassifyAllFileCount(String projectId, String contractId, Long classifyId,String type);
 
     /**
      * 获取当前分类下当前项目的拍摄时间

+ 14 - 2
blade-service/blade-business/src/main/java/org/springblade/business/service/impl/ContractLogServiceImpl.java

@@ -32,7 +32,10 @@ import org.springframework.stereotype.Service;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 
 import java.util.ArrayList;
+import java.util.Comparator;
+import java.util.LinkedList;
 import java.util.List;
+import java.util.stream.Collectors;
 
 /**
  * 日志通用表 服务实现类
@@ -93,14 +96,23 @@ public class ContractLogServiceImpl extends BaseServiceImpl<ContractLogMapper, C
         }
         //有数据,转换成VO
         List<ContractLogVO> voResult = JSONArray.parseArray(JSONObject.toJSONString(result), ContractLogVO.class);
-        voResult.forEach(vo -> {
+        List<ContractLogVO> deduplicatedList = new ArrayList<>(voResult.stream()
+                .filter(vo -> vo.getPdfUrl() != null && !vo.getPdfUrl().isEmpty())
+                .collect(Collectors.toMap(
+                        ContractLogVO::getPdfUrl, //根据pdfUrl字段作为去重,现在修改了需求后,所有的合并的表url都一样
+                        vo -> vo,
+                        (existing, replacement) -> existing
+                ))
+                .values());
+        deduplicatedList.sort(Comparator.comparing(ContractLogVO::getRecordTime).reversed());
+        deduplicatedList.forEach(vo -> {
             vo.setName(vo.getFileName());
             vo.setStatusValue(new Integer("0").equals(vo.getStatus()) ? "未上报" : new Integer("1").equals(vo.getStatus()) ? "待审批" : new Integer("2").equals(vo.getStatus()) ? "已审批" : "已废除");
         });
 
         IPage<ContractLogVO> iPage = Condition.getPage(query);
         iPage.setTotal(count);
-        return iPage.setRecords(voResult);
+        return iPage.setRecords(deduplicatedList);
     }
 
 }

+ 2 - 2
blade-service/blade-business/src/main/java/org/springblade/business/service/impl/ImageClassificationFileServiceImpl.java

@@ -63,8 +63,8 @@ public class ImageClassificationFileServiceImpl extends BaseServiceImpl<ImageCla
     }
 
     @Override
-    public Integer queryCurrentClassifyAllFileCount(String projectId, String contractId, Long classifyId) {
-        return this.baseMapper.queryCurrentClassifyAllFileCount(projectId, contractId, classifyId);
+    public Integer queryCurrentClassifyAllFileCount(String projectId, String contractId, Long classifyId, String type) {
+        return this.baseMapper.queryCurrentClassifyAllFileCount(projectId, contractId, classifyId, type);
     }
 
     @Override

+ 388 - 369
blade-service/blade-manager/src/main/java/org/springblade/manager/controller/ExcelTabController.java

@@ -24,6 +24,7 @@ import org.jsoup.Jsoup;
 import org.jsoup.nodes.Document;
 import org.jsoup.nodes.Element;
 import org.jsoup.select.Elements;
+import org.springblade.business.entity.ContractLog;
 import org.springblade.business.feign.ContractLogClient;
 import org.springblade.business.feign.InformationQueryClient;
 import org.springblade.business.vo.SaveContractLogVO;
@@ -48,6 +49,7 @@ import org.springblade.manager.enums.ExecuteType;
 import org.springblade.manager.mapper.ExcelTabMapper;
 import org.springblade.manager.mapper.WbsTreePrivateMapper;
 import org.springblade.manager.service.*;
+import org.springblade.manager.service.impl.WbsTreeContractServiceImpl;
 import org.springblade.manager.utils.ExcelInfoUtils;
 import org.springblade.manager.utils.FileUtils;
 import org.springblade.manager.utils.RegularExpressionUtil;
@@ -109,6 +111,8 @@ public class ExcelTabController extends BladeController {
     // 元素信息表-
     private final IWbsTreeContractService wbsTreeContractService;
 
+    private final WbsTreeContractServiceImpl wbsTreeContractServiceImpl;
+
     private final WbsTreePrivateMapper wbsTreePrivateMapper;
 
     private final JdbcTemplate jdbcTemplate;
@@ -297,7 +301,7 @@ public class ExcelTabController extends BladeController {
         String exceUrl = file_path + filecode + "123.xlsx";
         //ExcelInfoUtils.excelInfo(file.getInputStream(),exceUrl,thmlUrl,"1");
         // 上传excel文件
-       // BladeFile bladeFile = newIOSSClient.uploadFile(file.getOriginalFilename(),exceUrl);
+        // BladeFile bladeFile = newIOSSClient.uploadFile(file.getOriginalFilename(),exceUrl);
         // 解析原始excel
         Workbook wb = new Workbook();
         wb.loadFromMHtml(file.getInputStream());
@@ -797,7 +801,7 @@ public class ExcelTabController extends BladeController {
     @ApiImplicitParams(value = {
             @ApiImplicitParam(name = "pkeyId", value = "pkeyId", required = true)
     })
-    public R getExcelHtmlTwo(Long pkeyId) throws IOException, InterruptedException {
+    public R getExcelHtmlTwo(Long pkeyId) throws Exception {
 
         Thread.sleep(200);
         WbsTreePrivate wbsTreePrivate = wbsTreePrivateMapper.getByPKeyId(pkeyId);
@@ -808,10 +812,16 @@ public class ExcelTabController extends BladeController {
             return R.fail("请上传清表!");
         }
 
-        File file1 = ResourceUtil.getFile(wbsTreePrivate.getHtmlUrl());
-//        File file1 = ResourceUtil.getFile("D:\\develop\\1633344465559093248.html");
+        String htmlString = this.getHtmlString(pkeyId.toString());
+        if (StringUtils.isEmpty(htmlString)) {
+            return R.fail("未获取到表单信息");
+        }
+
+        /*File file1 = ResourceUtil.getFile(wbsTreePrivate.getHtmlUrl());
+        File file1 = ResourceUtil.getFile("D:\\develop\\1633344465559093248.html");
         FileInputStream fileInputStream = new FileInputStream(file1);
-        String htmlString = IoUtil.readToString(fileInputStream);
+        String htmlString = IoUtil.readToString(fileInputStream);*/
+
         // 解析 style
         htmlString = htmlString.replaceAll("placeholder", "placeholderxx");
         htmlString = htmlString.replaceAll("title", "titlexx");
@@ -819,7 +829,9 @@ public class ExcelTabController extends BladeController {
         // 远程搜索配置
         Document doc = Jsoup.parse(htmlString);
         Element table = doc.select("table").first();
-        Elements col = doc.select("Col");
+
+        //Elements col = doc.select("Col");
+
         doc.select("Col").remove();
         ProjectInfo projectInfo = projectInfoService.getById(wbsTreePrivate.getProjectId());
         // 添加标题显示
@@ -829,9 +841,9 @@ public class ExcelTabController extends BladeController {
             Elements tds = tr.select("td");
             for (int j = 0; j < tds.size(); j++) {
                 Element data = tds.get(j);
-                int colspan = data.attr("COLSPAN").equals("") ? 0 : Integer.parseInt(data.attr("COLSPAN"));
+                //int colspan = data.attr("COLSPAN").equals("") ? 0 : Integer.parseInt(data.attr("COLSPAN"));
                 String style = data.attr("style");
-                if (style.indexOf("font-size") >= 0) {
+                if (style.contains("font-size")) {
                     int fontsize = Integer.parseInt(style.substring(style.indexOf("font-size:") + 10, style.indexOf(".0pt")));
                     if (StringUtils.isNotEmpty(data.text()) && fontsize >= 12) {
                         trs.get(i - 1).select("td").get(0).text(projectInfo.getProjectName());
@@ -840,10 +852,35 @@ public class ExcelTabController extends BladeController {
                 }
             }
         }
-        fileInputStream.close();
+
+        //fileInputStream.close();
+
         return R.data(table + "");
     }
 
+    private String getHtmlString(String pkeyId) throws Exception {
+        String file_path = ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
+        String sys_file_net_url = ParamCache.getValue(CommonConstant.SYS_FILE_NET_URL);
+        WbsTreePrivate wbsTreePrivate = wbsTreePrivateMapper.selectOne(Wrappers.<WbsTreePrivate>query().lambda()
+                .select(WbsTreePrivate::getHtmlUrl)
+                .eq(WbsTreePrivate::getPKeyId, pkeyId));
+        if (wbsTreePrivate == null || wbsTreePrivate.getHtmlUrl() == null) {
+            return "";
+        }
+        String fileUrl = wbsTreePrivate.getHtmlUrl();
+        File file1 = ResourceUtil.getFile(fileUrl);
+        InputStream fileInputStream;
+        if (file1.exists()) {
+            fileInputStream = new FileInputStream(file1);
+        } else {
+            String path = sys_file_net_url + fileUrl.replaceAll("//", "/").replaceAll(file_path, "");
+            fileInputStream = CommonUtil.getOSSInputStream(path);
+        }
+        String htmlString = IoUtil.readToString(fileInputStream);
+        htmlString = htmlString.replaceAll("placeholder", "placeholderxx");
+        Document doc = Jsoup.parse(htmlString);
+        return doc.select("table").first() + "";
+    }
 
     // 上传解析 html
     public void expailHtmlInfo12231(String thmlUrl, Long excelId) throws Exception {
@@ -904,12 +941,15 @@ public class ExcelTabController extends BladeController {
 
                     // 计算
                     int x1 = Integer.parseInt(data.attr("x1"));
-                    int x2 = Integer.parseInt(data.attr("x2"));;
-                    int y1 = Integer.parseInt(data.attr("y1"));;
-                    int y2 = Integer.parseInt(data.attr("y2"));;
+                    int x2 = Integer.parseInt(data.attr("x2"));
+                    ;
+                    int y1 = Integer.parseInt(data.attr("y1"));
+                    ;
+                    int y2 = Integer.parseInt(data.attr("y2"));
+                    ;
 
                     String textInfo = data.text().trim().replaceAll(" ", "");
-                    System.out.println("-------=="+textInfo);
+                    System.out.println("-------==" + textInfo);
 
                     data.text(textInfo.replaceAll(" ", ""));
                     if (textInfo.indexOf("□") < 0 && !textInfo.isEmpty() && !(textInfo.equals("/") && textInfo.length() < 2) && !(textInfo.indexOf("年") >= 0 && textInfo.indexOf("月") >= 0 && textInfo.indexOf("日") >= 0) && !textInfo.equals("—") && !textInfo.equals("-")) {  // 标题区域
@@ -1120,7 +1160,7 @@ public class ExcelTabController extends BladeController {
 
         //对excel 的图片进行操作
         ExcelTab exceltab = excelTabService.getById(excelId);
-        if(exceltab!=null){
+        if (exceltab != null) {
             // 获取excle 的数据
             String fileUrl = exceltab.getFileUrl();
             InputStream ossInputStream = CommonUtil.getOSSInputStream(fileUrl);
@@ -1128,14 +1168,14 @@ public class ExcelTabController extends BladeController {
             wb.loadFromMHtml(ossInputStream);
             Worksheet sheet = wb.getWorksheets().get(0);
             PicturesCollection pictures = sheet.getPictures();
-            if(pictures!=null && pictures.size()>=1){
-                for (int i=0 ; i<pictures.size() ; i++){
+            if (pictures != null && pictures.size() >= 1) {
+                for (int i = 0; i < pictures.size(); i++) {
                     ExcelPicture pic = pictures.get(i);
                     int x = pic.getLeftColumn();
                     int y = pic.getBottomRow();
                     Elements select = doc.select("el-input[x1=" + x + "][y1=" + y + "]");
 
-                    if(select!=null && select.size()>=1){
+                    if (select != null && select.size() >= 1) {
                         Element element = select.get(0);
                         Element elementP = element.parent();
                         element.remove();
@@ -1218,10 +1258,10 @@ public class ExcelTabController extends BladeController {
                     Boolean isText = false;
                     //判断高度
                     String style = data.attr("style");
-                    if (StringUtils.isNotBlank(style)){
+                    if (StringUtils.isNotBlank(style)) {
                         String substring = style.substring(style.lastIndexOf(":") + 1);
                         String height = substring.substring(0, substring.length() - 3);
-                        if (Integer.parseInt(height) > 90){
+                        if (Integer.parseInt(height) > 90) {
                             isText = true;
                         }
                     }
@@ -2174,210 +2214,191 @@ public class ExcelTabController extends BladeController {
     @ApiOperationSupport(order = 25)
     @ApiOperation(value = "日志预览")
     @ApiImplicitParams({
-            @ApiImplicitParam(name = "theLogId", value = "日志记录的id,可能为空"),
             @ApiImplicitParam(name = "nodePrimaryKeyId", value = "当前操作的日志类型ID,即左侧列表的节点primaryKeyId"),
+            @ApiImplicitParam(name = "String pkeyId", value = "当前表pKeyId"),
             @ApiImplicitParam(name = "recordTime", value = "当前选择的填写日期,即右侧日期控件所选日期,格式为 yyyy-MM-dd")
     })
-    public R<String> getTheLogPdInfo(String theLogId, String nodePrimaryKeyId, String recordTime, String contractId) throws Exception {
+    public R<String> getTheLogPdInfo(String pkeyId, String nodePrimaryKeyId, String recordTime, String contractId) throws Exception {
         //获取配置的路径
         String file_path = ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
-
-        //获取对应的日志
-        JSONObject theLogJson;
-        if (StringUtils.isNotEmpty(theLogId)) {
-            theLogJson = this.contractLogClient.queryContractLogById(theLogId);
-        } else {
-            if (StringUtils.isEmpty(recordTime)) {
-                recordTime = DateUtil.format(DateUtil.now(), "yyyy-MM-dd");
-            }
-            theLogJson = this.contractLogClient.queryContractLogByPrimaryKeyIdAndRecordTime(nodePrimaryKeyId, recordTime, contractId);
+        if (StringUtils.isEmpty(recordTime)) {
+            recordTime = DateUtil.format(DateUtil.now(), "yyyy-MM-dd");
         }
+        List<ContractLog> contractLogList = this.contractLogClient.queryContractLogByPrimaryKeyIdAndRecordTimeList(nodePrimaryKeyId, recordTime, contractId);
+        List<String> ids = contractLogList.stream().map(ContractLog::getId).map(String::valueOf).collect(Collectors.toList());
+        if (ids.size() > 0) {
+            //PDF路径
+            List<String> pdfUrls = new ArrayList<>();
+            for (String dataId : ids) {
+                //查询对应的html
+                WbsTreePrivate tableNode = this.wbsTreePrivateService.getOne(Wrappers.<WbsTreePrivate>lambdaQuery().eq(WbsTreePrivate::getPKeyId, pkeyId));
 
-        if (theLogJson != null) {
-//            String evPdf = theLogJson.getString("eVisaPdfUrl");
-//            if(StringUtils.isNotEmpty(evPdf)){
-//                return R.data(evPdf);
-//            }
-
-            theLogId = theLogJson.getString("id");
-            //查询对应的html
-            WbsTreePrivate tableNode = this.wbsTreePrivateService.getOne(Wrappers.<WbsTreePrivate>lambdaQuery().eq(WbsTreePrivate::getPKeyId, theLogJson.getString("tableId")));
+                if (tableNode == null) {
+                    return R.fail("该数据下无此节点!");
+                }
 
-            if (tableNode == null) {
-                return R.fail("该数据下无此节点!");
-            }
+                String htmlString = this.getHtmlString(pkeyId);
 
-            if (StringUtils.isEmpty(tableNode.getHtmlUrl())) {
-                return R.fail("请关联清表!");
-            }
+                if (StringUtils.isEmpty(tableNode.getHtmlUrl()) || StringUtils.isEmpty(htmlString)) {
+                    return R.fail("未获取到元素表信息!");
+                }
 
-            // 获取清表信息
-            ExcelTab excelTab = excelTabService.getById(tableNode.getExcelId());
-            if (excelTab == null) {
-                return R.fail("失败");
-            }
+                // 获取清表信息
+                ExcelTab excelTab = excelTabService.getById(tableNode.getExcelId());
+                if (excelTab == null) {
+                    return R.fail("失败");
+                }
 
-            //获取数据
-            List<Map<String, Object>> businessDataMapList = this.getTheLogBusinessData(theLogId, nodePrimaryKeyId, recordTime, contractId).getData();
-            //PDF路径
-            List<String> pdfUrls = new ArrayList<>();
-            ProjectInfo projectInfo = projectInfoService.getById(tableNode.getProjectId());
-            //处理数据
-            for (Map<String, Object> dataMap : businessDataMapList) {
-                // 获取excel流 和 html流
-                Workbook wb = new Workbook();
-                wb.loadFromMHtml(CommonUtil.getOSSInputStream(excelTab.getFileUrl()));
-                //获取工作表
-                Worksheet sheet = wb.getWorksheets().get(0);
-                // 数据不为空 &&
-                if (StringUtils.isNotEmpty(tableNode.getHtmlUrl())) {
-                    File htmlFile = ResourceUtil.getFile(tableNode.getHtmlUrl());
-//                    File htmlFile = ResourceUtil.getFile("D:\\develop\\1633344465559093248.html");
-                    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");
-                        //添加标题
-                        CellRange[] columns = sheet.getMergedCells();
-                        for (int i = 0; i < columns.length; i++) {
-                            CellRange cellRange = columns[i];
-                            System.out.println(cellRange.getStyle().getFont().getSize());
-                            if (cellRange.getStyle().getFont().getSize() >= 12) {
-                                String title = projectInfo.getProjectName();
-                                if (title.length() >= 30) {
-                                    cellRange.setRowHeight(40);
-                                    cellRange.getStyle().setWrapText(true);
-                                }
-                                cellRange.getStyle().getFont().setSize(18);
-                                cellRange.getStyle().setHorizontalAlignment(HorizontalAlignType.Center);
-                                cellRange.setText(projectInfo.getProjectName());
-                                break;
+                //获取数据
+                List<Map<String, Object>> businessDataMapList = this.getTheLogBusinessData(dataId, nodePrimaryKeyId, recordTime, contractId).getData();
+                ProjectInfo projectInfo = projectInfoService.getById(tableNode.getProjectId());
+                //处理数据
+                for (Map<String, Object> dataMap : businessDataMapList) {
+                    // 获取excel流 和 html流
+                    Workbook wb = new Workbook();
+                    wb.loadFromMHtml(CommonUtil.getOSSInputStream(excelTab.getFileUrl()));
+                    //获取工作表
+                    Worksheet sheet = wb.getWorksheets().get(0);
+                    Document doc = Jsoup.parse(htmlString);
+                    Element table = doc.select("table").first();
+                    Elements trs = table.select("tr");
+                    //添加标题
+                    CellRange[] columns = sheet.getMergedCells();
+                    for (int i = 0; i < columns.length; i++) {
+                        CellRange cellRange = columns[i];
+                        System.out.println(cellRange.getStyle().getFont().getSize());
+                        if (cellRange.getStyle().getFont().getSize() >= 12) {
+                            String title = projectInfo.getProjectName();
+                            if (title.length() >= 30) {
+                                cellRange.setRowHeight(40);
+                                cellRange.getStyle().setWrapText(true);
                             }
+                            cellRange.getStyle().getFont().setSize(18);
+                            cellRange.getStyle().setHorizontalAlignment(HorizontalAlignType.Center);
+                            cellRange.setText(projectInfo.getProjectName());
+                            break;
                         }
+                    }
 
-                        if (ObjectUtil.isNotEmpty(dataMap)) {
-                            for (String val : dataMap.keySet()) {
-                                if (val.indexOf("__") >= 0) {
-                                    String[] DataVal = val.split("__");
-                                    String[] xy = DataVal[1].split("_");
-                                    if (trs.size() > Integer.parseInt(xy[0])) {
-                                        Element trData = trs.get(Integer.parseInt(xy[0]));
-                                        Elements tdDatas = trData.select("td");
-                                        if (tdDatas.size() > Integer.parseInt(xy[1])) {
-                                            Element data = tdDatas.get(Integer.parseInt(xy[1]));
-
-                                            if (data.html().indexOf("x1") >= 0 && data.html().indexOf("y1") >= 0) {
-                                                int x1, y1;
-
-                                                if (data.html().indexOf("el-tooltip") >= 0) {
-                                                    x1 = Integer.parseInt(data.children().get(0).children().get(0).attr("x1"));
-                                                    y1 = Integer.parseInt(data.children().get(0).children().get(0).attr("y1"));
-                                                } else {
-                                                    x1 = Integer.parseInt(data.children().get(0).attr("x1"));
-                                                    y1 = Integer.parseInt(data.children().get(0).attr("y1"));
-                                                }
-                                                if (x1 == 0) {
-                                                    x1 = 1;
-                                                }
-                                                String myData = dataMap.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("{}年{}月{}日", 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("{}年{}月{}日", end_dataStr[0], end_dataStr[1], Integer.parseInt(end_dataStr[2]) + 1);
-
-                                                        if (StartDate.equals(endDate)) {
-                                                            myData = StartDate;
-                                                        } else {
-                                                            myData = StartDate + "-" + endDate;
-                                                        }
+                    if (ObjectUtil.isNotEmpty(dataMap)) {
+                        for (String val : dataMap.keySet()) {
+                            if (val.indexOf("__") >= 0) {
+                                String[] DataVal = val.split("__");
+                                String[] xy = DataVal[1].split("_");
+                                if (trs.size() > Integer.parseInt(xy[0])) {
+                                    Element trData = trs.get(Integer.parseInt(xy[0]));
+                                    Elements tdDatas = trData.select("td");
+                                    if (tdDatas.size() > Integer.parseInt(xy[1])) {
+                                        Element data = tdDatas.get(Integer.parseInt(xy[1]));
+
+                                        if (data.html().indexOf("x1") >= 0 && data.html().indexOf("y1") >= 0) {
+                                            int x1, y1;
+
+                                            if (data.html().indexOf("el-tooltip") >= 0) {
+                                                x1 = Integer.parseInt(data.children().get(0).children().get(0).attr("x1"));
+                                                y1 = Integer.parseInt(data.children().get(0).children().get(0).attr("y1"));
+                                            } else {
+                                                x1 = Integer.parseInt(data.children().get(0).attr("x1"));
+                                                y1 = Integer.parseInt(data.children().get(0).attr("y1"));
+                                            }
+                                            if (x1 == 0) {
+                                                x1 = 1;
+                                            }
+                                            String myData = dataMap.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("{}年{}月{}日", 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("{}年{}月{}日", end_dataStr[0], end_dataStr[1], Integer.parseInt(end_dataStr[2]) + 1);
+
+                                                    if (StartDate.equals(endDate)) {
+                                                        myData = StartDate;
                                                     } else {
-                                                        String[] dataStr = myData.split("T")[0].split("-");
-                                                        myData = StringUtil.format("{}年{}月{}日", dataStr[0], dataStr[1], Integer.parseInt(dataStr[2]));
+                                                        myData = StartDate + "-" + endDate;
                                                     }
+                                                } else {
+                                                    String[] dataStr = myData.split("T")[0].split("-");
+                                                    myData = StringUtil.format("{}年{}月{}日", dataStr[0], dataStr[1], Integer.parseInt(dataStr[2]));
                                                 }
+                                            }
 
-                                                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", ""));
-                                                        }
+                                            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 {
-                                                    final CellRange cellRange = sheet.getCellRange(y1, x1);
-                                                    cellRange.setText(myData);
-                                                }
+                                            } else {
+                                                final CellRange cellRange = sheet.getCellRange(y1, x1);
+                                                cellRange.setText(myData);
                                             }
                                         }
                                     }
                                 }
                             }
                         }
-                        // 组装电签设置
-                        QueryWrapper<TextdictInfo> queryWrapper = new QueryWrapper<>();
-                        queryWrapper.eq("type", 2);
-                        queryWrapper.eq("tab_id", tableNode.getPKeyId());
-
-                        final List<TextdictInfo> textdictInfos = this.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("_");
-                                if (trs.size() > (Integer.parseInt(trtd[0]))) {
-                                    Element trData = trs.get(Integer.parseInt(trtd[0]));
-                                    Elements tdDatas = trData.select("td");
-                                    if (tdDatas.size() > Integer.parseInt(trtd[1])) {
-                                        Element data = tdDatas.get(Integer.parseInt(trtd[1]));
-//                                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);
+                    }
+                    // 组装电签设置
+                    QueryWrapper<TextdictInfo> queryWrapper = new QueryWrapper<>();
+                    queryWrapper.eq("type", 2);
+                    queryWrapper.eq("tab_id", tableNode.getPKeyId());
 
-                                        cellRange.setText(e.getId() + "");
-                                        cellRange.getCellStyle().getFont().setColor(Color.white);
+                    final List<TextdictInfo> textdictInfos = this.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("_");
+                            if (trs.size() > (Integer.parseInt(trtd[0]))) {
+                                Element trData = trs.get(Integer.parseInt(trtd[0]));
+                                Elements tdDatas = trData.select("td");
+                                if (tdDatas.size() > Integer.parseInt(trtd[1])) {
+                                    Element data = tdDatas.get(Integer.parseInt(trtd[1]));
+                                    //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);
                                 }
-                            });
-                        }
+
+                            }
+                        });
                     }
-                }
 
-                Long fileName = SnowFlakeUtil.getId();
-                String onePdfPath = file_path + "/pdf//" + fileName + ".pdf";
-//                wb.saveToFile("d://777.xls", ExcelVersion.Version2010);
-                sheet.saveToPdf(onePdfPath);
+                    Long fileName = SnowFlakeUtil.getId();
+                    String onePdfPath = file_path + "/pdf//" + fileName + ".pdf";
+                    sheet.saveToPdf(onePdfPath);
 
-                BladeFile bladeFile = this.newIOSSClient.uploadFile(fileName + ".pdf", onePdfPath);
+                    BladeFile bladeFile = this.newIOSSClient.uploadFile(fileName + ".pdf", onePdfPath);
 
-                pdfUrls.add(bladeFile.getLink());
+                    pdfUrls.add(bladeFile.getLink());
 
-                wb.dispose();
+                    wb.dispose();
+                }
             }
-
             if (pdfUrls.size() > 0) {
                 try {
-                    String mergePdfPath = file_path + "/pdf//" + theLogId + ".pdf";
+                    String mergePdfPath = file_path + "/pdf//" + SnowFlakeUtil.getId() + ".pdf";
                     File oldMergePdf = ResourceUtil.getFile(mergePdfPath);
                     if (oldMergePdf.exists()) {
                         oldMergePdf.delete();
@@ -2385,10 +2406,10 @@ public class ExcelTabController extends BladeController {
 
                     FileUtils.mergePdfPublicMethods(pdfUrls, mergePdfPath);
 
-                    BladeFile mergeFile = this.newIOSSClient.uploadFile(theLogId + new Date().getTime() + ".pdf", mergePdfPath);
+                    BladeFile mergeFile = this.newIOSSClient.uploadFile(SnowFlakeUtil.getId() + new Date().getTime() + ".pdf", mergePdfPath);
 
-                    //修改记录
-                    this.contractLogClient.updateTheLogPdfUrl(theLogJson.getString("id"), mergeFile.getLink());
+                    //修改记录,当天的日志所有表的合并pdf都一样,即ids都修改成一样的
+                    this.contractLogClient.updateTheLogPdfUrlByIds(StringUtils.join(ids, ","), mergeFile.getLink());
 
                     return R.data(mergeFile.getLink());
                 } catch (Exception e) {
@@ -2396,7 +2417,6 @@ public class ExcelTabController extends BladeController {
                     return R.fail("数据异常");
                 }
             }
-
         }
 
         return R.data(null);
@@ -2410,229 +2430,228 @@ public class ExcelTabController extends BladeController {
     @ApiOperationSupport(order = 26)
     @ApiOperation(value = "获取当前用户当前日期的填报记录")
     @ApiImplicitParams({
-            @ApiImplicitParam(name = "theLogId", value = "日志记录的id,可能为空"),
+            @ApiImplicitParam(name = "theLogId", value = "日志记录的ids,可能为空(多张表)"),
             @ApiImplicitParam(name = "nodePrimaryKeyId", value = "当前操作的日志类型ID,即左侧列表的节点primaryKeyId"),
             @ApiImplicitParam(name = "recordTime", value = "当前选择的填写日期,即右侧日期控件所选日期,格式为 yyyy-MM-dd")
     })
     public R<List<Map<String, Object>>> getTheLogBusinessData(String theLogId, String nodePrimaryKeyId, String recordTime, String contractId) {
         List<Map<String, Object>> resultMapList = new ArrayList<>();
-        //数据结果
-        Map<String, Object> reData = new HashMap<>();
         //获取对应的记录
-        JSONObject theLogJson;
+        String dataIds;
         if (StringUtils.isNotEmpty(theLogId)) {
-            //
-            theLogJson = this.contractLogClient.queryContractLogById(theLogId);
+            String[] split = theLogId.split(",");
+            List<String> ids = new LinkedList<>();
+            for (String logId : split) {
+                ContractLog contractLog = this.contractLogClient.queryContractLogByIdToObj(logId);
+                ids.add(contractLog.getDataId().toString());
+            }
+            dataIds = ids.stream().filter(Objects::nonNull).collect(Collectors.joining(","));
         } else {
-            theLogJson = this.contractLogClient.queryContractLogByPrimaryKeyIdAndRecordTime(nodePrimaryKeyId, recordTime, contractId);
+            List<ContractLog> contractLogs = this.contractLogClient.queryContractLogByPrimaryKeyIdAndRecordTimeList(nodePrimaryKeyId, recordTime, contractId);
+            dataIds = contractLogs.stream().map(ContractLog::getDataId).filter(Objects::nonNull).map(String::valueOf).collect(Collectors.joining(","));
         }
 
         WbsTreePrivate node = this.wbsTreePrivateService.getOne(Wrappers.<WbsTreePrivate>lambdaQuery().eq(WbsTreePrivate::getPKeyId, nodePrimaryKeyId));
         WbsTreePrivate tableNode2 = this.wbsTreePrivateService.getOne(Wrappers.<WbsTreePrivate>lambdaQuery()
                 .eq(WbsTreePrivate::getParentId, node.getId()).eq(WbsTreePrivate::getProjectId, node.getProjectId()));
 
-        // 匹配关联
-        try {
-//            File file1 = ResourceUtil.getFile(wbsTreeContract.getHtmlUrl());
-            File file1 = ResourceUtil.getFile(tableNode2.getHtmlUrl());
-//            File file1 = ResourceUtil.getFile("C:\\Users\\泓创研发01\\Desktop\\privateUrl\\1633285246067671040.html");
-            if (file1.exists()) {
-
-                String htmlString = IoUtil.readToString(new FileInputStream(file1));
-                Document doc = Jsoup.parse(htmlString);
-
-                // 解析
-                // 模糊匹配
-                Elements dwtitle = doc.select("el-input[placeholder~=.*承包单位]");
-                Elements sgtitle = doc.select("el-input[placeholder~=^施工单位]");
-                Elements sgtitle1 = doc.select("el-input[placeholder=安装单位]");
-                sgtitle.addAll(sgtitle1);
-
-                Elements htdtitle = doc.select("el-input[placeholder~=.*合同号.*]");
-                Elements htdtitle1 = doc.select("el-input[placeholder~=合同段.*]");
-                htdtitle.addAll(htdtitle1);
-
-                Elements jltitle = doc.select("el-input[placeholder~=监理单位.*]");
-
-                Elements bhtitle = doc.select("el-input[placeholder~=^编号]");
-                Elements bhtitle1 = doc.select("el-input[placeholder~=合同编号.*]");
-                bhtitle.addAll(bhtitle1);
-
-
-                Elements xmtitle = doc.select("el-input[placeholder~=^项目名称]");
-
-
-                // Elements title = doc.select("el-input[placeholder~=^编号]");
-
-                /**
-                 * 承包单位 承包单位、施工单位:引用施工单位名称 ,
-                 * 监理单位:引用监理单位名称
-                 * 合同段、所属建设项目(合同段):引用合同段编号
-                 *
-                 * 施工单位:施工单位 和 安装单位
-                 *
-                 */
-                ContractInfo contractInfo = contractInfoService.getById(contractId);
-                // 施工单位名称
-                if (dwtitle.size() >= 1) {
-                    int y = Integer.parseInt(dwtitle.attr("trindex"));
-                    if (y <= 10) {
-                        reData.put(dwtitle.attr("keyName"), contractInfo.getConstructionUnitName());
-                    }
-
-                }
-                if (sgtitle.size() >= 1) {
-                    int y = Integer.parseInt(sgtitle.attr("trindex"));
-                    if (y <= 10) {
-                        reData.put(sgtitle.attr("keyName"), contractInfo.getConstructionUnitName());
-                    }
+        if (StringUtils.isNotEmpty(dataIds)) {
+            for (String dataId : dataIds.split(",")) {
+                //检查实体表是否存在
+                String tabName = tableNode2.getInitTableName();
+                String isExitSql = " select * from information_schema.TABLES where TABLE_NAME='" + tabName + "'";
+                List<Map<String, Object>> tabList = this.jdbcTemplate.queryForList(isExitSql);
+                if (tabList.size() <= 0) {
+                    return R.fail("无实体表对应");
                 }
 
-                // 合同段名称
-                if (htdtitle.size() >= 1) {
-                    for (Element element : htdtitle) {
-                        int trindex = Integer.parseInt(element.attr("trindex"));
-                        if (trindex <= 8) {
-                            reData.put(element.attr("keyName"), contractInfo.getContractNumber());
-                        }
-                    }
-                }
-                // 监理单位名称
-                if (jltitle.size() >= 1) {
+                //查询数据
+                String querySql = "SELECT * FROM " + tabName + " WHERE id = " + dataId + " and group_id = " + tableNode2.getPKeyId();
+                List<Map<String, Object>> businessDataMap = this.jdbcTemplate.queryForList(querySql);
 
-                    for (Element element : jltitle) {
-                        int trindex = Integer.parseInt(element.attr("trindex"));
-                        if (trindex <= 10) {
-                            reData.put(element.attr("keyName"), contractInfo.getSupervisionUnitName());
-                        }
-                    }
-                }
+                //数据结果
+                Map<String, Object> reData = new HashMap<>();
 
-                // 项目名称
-                if (xmtitle.size() >= 1) {
-                    for (Element element : xmtitle) {
-                        int trindex = Integer.parseInt(element.attr("trindex"));
-                        if (trindex <= 6) {
-                            ProjectInfo projectInfo = projectInfoService.getById(tableNode2.getProjectId());
-                            reData.put(element.attr("keyName"), projectInfo.getProjectName());
-                        }
-                    }
-                }
-            }
-        } catch (FileNotFoundException e) {
-            e.printStackTrace();
-        }
+                if (businessDataMap.size() > 0) {
+                    // 匹配关联
+                    try {
+                        //File file1 = ResourceUtil.getFile(wbsTreeContract.getHtmlUrl());
+                        File file1 = ResourceUtil.getFile(tableNode2.getHtmlUrl());
+                        //File file1 = ResourceUtil.getFile("C:\\Users\\泓创研发01\\Desktop\\privateUrl\\1633285246067671040.html");
+                        if (file1.exists()) {
+
+                            String htmlString = IoUtil.readToString(new FileInputStream(file1));
+                            Document doc = Jsoup.parse(htmlString);
+
+                            // 解析
+                            // 模糊匹配
+                            Elements dwtitle = doc.select("el-input[placeholder~=.*承包单位]");
+                            Elements sgtitle = doc.select("el-input[placeholder~=^施工单位]");
+                            Elements sgtitle1 = doc.select("el-input[placeholder=安装单位]");
+                            sgtitle.addAll(sgtitle1);
+
+                            Elements htdtitle = doc.select("el-input[placeholder~=.*合同号.*]");
+                            Elements htdtitle1 = doc.select("el-input[placeholder~=合同段.*]");
+                            htdtitle.addAll(htdtitle1);
+
+                            Elements jltitle = doc.select("el-input[placeholder~=监理单位.*]");
+
+                            Elements bhtitle = doc.select("el-input[placeholder~=^编号]");
+                            Elements bhtitle1 = doc.select("el-input[placeholder~=合同编号.*]");
+                            bhtitle.addAll(bhtitle1);
+
+
+                            Elements xmtitle = doc.select("el-input[placeholder~=^项目名称]");
+
+
+                            // Elements title = doc.select("el-input[placeholder~=^编号]");
+
+                            /**
+                             * 承包单位 承包单位、施工单位:引用施工单位名称 ,
+                             * 监理单位:引用监理单位名称
+                             * 合同段、所属建设项目(合同段):引用合同段编号
+                             *
+                             * 施工单位:施工单位 和 安装单位
+                             *
+                             */
+                            ContractInfo contractInfo = contractInfoService.getById(contractId);
+                            // 施工单位名称
+                            if (dwtitle.size() >= 1) {
+                                int y = Integer.parseInt(dwtitle.attr("trindex"));
+                                if (y <= 10) {
+                                    reData.put(dwtitle.attr("keyName"), contractInfo.getConstructionUnitName());
+                                }
 
-        if (theLogJson != null) {
-            //查询对应的html
-            WbsTreePrivate tableNode = this.wbsTreePrivateService.getOne(Wrappers.<WbsTreePrivate>lambdaQuery().eq(WbsTreePrivate::getPKeyId, theLogJson.getString("tableId")));
+                            }
+                            if (sgtitle.size() >= 1) {
+                                int y = Integer.parseInt(sgtitle.attr("trindex"));
+                                if (y <= 10) {
+                                    reData.put(sgtitle.attr("keyName"), contractInfo.getConstructionUnitName());
+                                }
+                            }
 
-            //检查实体表是否存在
-            String tabName = tableNode.getInitTableName();
-            String isExitSql = " select * from information_schema.TABLES where TABLE_NAME='" + tabName + "'";
-            List<Map<String, Object>> tabList = this.jdbcTemplate.queryForList(isExitSql);
-            if (tabList.size() <= 0) {
-                return R.fail("无实体表对应");
-            }
+                            // 合同段名称
+                            if (htdtitle.size() >= 1) {
+                                for (Element element : htdtitle) {
+                                    int trindex = Integer.parseInt(element.attr("trindex"));
+                                    if (trindex <= 8) {
+                                        reData.put(element.attr("keyName"), contractInfo.getContractNumber());
+                                    }
+                                }
+                            }
+                            // 监理单位名称
+                            if (jltitle.size() >= 1) {
+
+                                for (Element element : jltitle) {
+                                    int trindex = Integer.parseInt(element.attr("trindex"));
+                                    if (trindex <= 10) {
+                                        reData.put(element.attr("keyName"), contractInfo.getSupervisionUnitName());
+                                    }
+                                }
+                            }
 
-            //查询数据
-            String querySql = "SELECT * FROM " + tabName + " WHERE group_id = " + theLogJson.get("dataId");
-            List<Map<String, Object>> businessDataMap = this.jdbcTemplate.queryForList(querySql);
+                            // 项目名称
+                            if (xmtitle.size() >= 1) {
+                                for (Element element : xmtitle) {
+                                    int trindex = Integer.parseInt(element.attr("trindex"));
+                                    if (trindex <= 6) {
+                                        ProjectInfo projectInfo = projectInfoService.getById(tableNode2.getProjectId());
+                                        reData.put(element.attr("keyName"), projectInfo.getProjectName());
+                                    }
+                                }
+                            }
+                        }
+                    } catch (FileNotFoundException e) {
+                        e.printStackTrace();
+                    }
+                    for (Map<String, Object> mysqlData : businessDataMap) {
 
-            if (businessDataMap.size() > 0) {
+                        String querySqlx = "SELECT tree_primary_key_id as primaryKeyId,title as path from u_contract_log_wbs where  business_id ='" + dataId + "' and is_deleted = 0";
+                        List<Map<String, Object>> businessDat = this.jdbcTemplate.queryForList(querySqlx);
+                        reData.put("linkTabIds", businessDat);
 
-                for (Map<String, Object> mysqlData : businessDataMap) {
+                        for (String key : mysqlData.keySet()) {
+                            String tabVal = mysqlData.get(key) + "";
+                            // 时间段处理
+                            if (StringUtils.isNotEmpty(tabVal) && !tabVal.equals("null")) {
+                                if (tabVal.indexOf("T") >= 0 && tabVal.indexOf(".000Z]") >= 0) {
+                                    String[] tabData = tabVal.split("_\\^_");
 
+                                    if (reData.containsKey("pickerKey")) {
+                                        String pickerKey = reData.get("pickerKey") + "," + key + "__" + tabData[1];
+                                        reData.put("pickerKey", pickerKey);
+                                    } else {
+                                        reData.put("pickerKey", key + "__" + tabData[1]);
+                                    }
 
-                    String id = mysqlData.get("id") + "";
-                    String querySqlx = "SELECT tree_primary_key_id as primaryKeyId,title as path from u_contract_log_wbs where  business_id ='" + id + "' and is_deleted=0";
-                    List<Map<String, Object>> businessDat = this.jdbcTemplate.queryForList(querySqlx);
-                    if (businessDat != null) {
-                        reData.put("linkTabIds", businessDat);
-                    }
+                                    String sql = tabData[0];
+                                    sql = sql.replaceAll("\\[", "['");
+                                    sql = sql.replaceAll("]", "']");
+                                    sql = sql.replaceAll("000Z,", "000Z',");
+                                    sql = sql.replaceAll(", 20", ", '20");
+                                    sql = sql.replaceAll("'", "");
+                                    reData.put(key + "__" + tabData[1], sql);
+                                } else if (tabVal.indexOf("T") >= 0 && tabVal.indexOf(".000Z") >= 0) { //时间
 
-                    for (String key : mysqlData.keySet()) {
-                        String tabVal = mysqlData.get(key) + "";
-                        // 时间段处理
-                        if (StringUtils.isNotEmpty(tabVal) && !tabVal.equals("null")) {
-                            if (tabVal.indexOf("T") >= 0 && tabVal.indexOf(".000Z]") >= 0) {
-                                String[] tabData = tabVal.split("_\\^_");
+                                    String[] tabData = tabVal.split("_\\^_");
+                                    reData.put(key + "__" + tabData[1], tabData[0]);
 
-                                if (reData.containsKey("pickerKey")) {
-                                    String pickerKey = reData.get("pickerKey") + "," + key + "__" + tabData[1];
-                                    reData.put("pickerKey", pickerKey);
+                                } else if (tabVal.indexOf("☆") >= 0) {
+                                    String[] mysql = tabVal.split("☆");
+                                    for (String data : mysql) {
+                                        String[] tabData = data.split("_\\^_");
+                                        reData.put(key + "__" + tabData[1], tabData[0]);
+                                    }
+                                } else if (tabVal.indexOf("_^_") >= 0) {
+                                    String[] tabData = tabVal.split("_\\^_");
+                                    reData.put(key + "__" + tabData[1], tabData[0]);
                                 } else {
-                                    reData.put("pickerKey", key + "__" + tabData[1]);
+                                    reData.put(key, tabVal);
                                 }
+                            }
+                        }
 
-                                String sql = tabData[0];
-                                sql = sql.replaceAll("\\[", "['");
-                                sql = sql.replaceAll("]", "']");
-                                sql = sql.replaceAll("000Z,", "000Z',");
-                                sql = sql.replaceAll(", 20", ", '20");
-                                sql = sql.replaceAll("'", "");
-                                reData.put(key + "__" + tabData[1], sql);
-                            } else if (tabVal.indexOf("T") >= 0 && tabVal.indexOf(".000Z") >= 0) { //时间
-
-                                String[] tabData = tabVal.split("_\\^_");
-                                reData.put(key + "__" + tabData[1], tabData[0]);
-
-                            } else if (tabVal.indexOf("☆") >= 0) {
-                                String[] mysql = tabVal.split("☆");
-                                for (String data : mysql) {
-                                    String[] tabData = data.split("_\\^_");
-                                    reData.put(key + "__" + tabData[1], tabData[0]);
+                        // 获取默认值
+                        QueryWrapper<TextdictInfo> queryWrapper = new QueryWrapper<>();
+                        queryWrapper.eq("type", 4);
+                        queryWrapper.eq("tab_id", node.getPKeyId());
+                        final List<TextdictInfo> textdictInfos = textdictInfoService.getBaseMapper().selectList(queryWrapper);
+                        if (!textdictInfos.isEmpty()) {
+                            for (TextdictInfo textdictInfo : textdictInfos) {
+                                if (reData.containsKey(textdictInfo.getColKey())) {
+                                    String keyVal = reData.get(textdictInfo.getColKey()) + "";
+                                } else {
+                                    reData.put(textdictInfo.getColKey() + "", textdictInfo.getSigRoleName());
                                 }
-                            } else if (tabVal.indexOf("_^_") >= 0) {
-                                String[] tabData = tabVal.split("_\\^_");
-                                reData.put(key + "__" + tabData[1], tabData[0]);
-                            } else {
-                                reData.put(key, tabVal);
                             }
                         }
-                    }
 
+                        // 移除Id 和 p_key_id
+                        reData.remove("p_key_id");
+                        reData.remove("classify");
+                        reData.remove("contractId");
+                        reData.remove("pkeyId");
+                        reData.remove("projectId");
+                        resultMapList.add(reData);
+                    }
+                } else {
+                    resultMapList.add(reData);
+                    Map<String, Object> reData2 = new HashMap<>();
                     // 获取默认值
                     QueryWrapper<TextdictInfo> queryWrapper = new QueryWrapper<>();
                     queryWrapper.eq("type", 4);
-                    queryWrapper.eq("tab_id", tableNode.getPKeyId());
+                    queryWrapper.eq("tab_id", tableNode2.getPKeyId());
                     final List<TextdictInfo> textdictInfos = textdictInfoService.getBaseMapper().selectList(queryWrapper);
                     if (!textdictInfos.isEmpty()) {
                         for (TextdictInfo textdictInfo : textdictInfos) {
-                            if (reData.containsKey(textdictInfo.getColKey())) {
-                                String keyVal = reData.get(textdictInfo.getColKey()) + "";
-                            } else {
-                                reData.put(textdictInfo.getColKey() + "", textdictInfo.getSigRoleName());
-                            }
+                            reData2.put(textdictInfo.getColKey() + "", textdictInfo.getSigRoleName());
                         }
+                        resultMapList.add(reData2);
                     }
-
-                    // 移除Id 和 p_key_id
-                    reData.remove("p_key_id");
-                    reData.remove("classify");
-                    reData.remove("contractId");
-                    reData.remove("pkeyId");
-                    reData.remove("projectId");
-                    resultMapList.add(reData);
                 }
             }
-        } else {
-            resultMapList.add(reData);
-            Map<String, Object> reData2 = new HashMap<>();
-            // 获取默认值
-            QueryWrapper<TextdictInfo> queryWrapper = new QueryWrapper<>();
-            queryWrapper.eq("type", 4);
-            queryWrapper.eq("tab_id", tableNode2.getPKeyId());
-            final List<TextdictInfo> textdictInfos = textdictInfoService.getBaseMapper().selectList(queryWrapper);
-            if (!textdictInfos.isEmpty()) {
-                for (TextdictInfo textdictInfo : textdictInfos) {
-                    reData2.put(textdictInfo.getColKey() + "", textdictInfo.getSigRoleName());
-                }
-                resultMapList.add(reData2);
-            }
         }
 
-
         return R.data(resultMapList);
     }
 
@@ -3588,7 +3607,7 @@ public class ExcelTabController extends BladeController {
         if (maxSort.isPresent()) {
             maxValue = maxSort.get();
         }
-        for (MultipartFile fileDTO : file){
+        for (MultipartFile fileDTO : file) {
             //创建节点,并上传excel文件到节点上
             ExcelTab excelTabNode = new ExcelTab();
             Long aLong = SnowFlakeUtil.getId();
@@ -3606,7 +3625,7 @@ public class ExcelTabController extends BladeController {
             excelTabNode.setUpdateUser(SecureUtil.getUserId());
             excelTabNode.setStatus(1);
             excelTabService.save(excelTabNode);
-            this.putFileAttach(fileDTO,aLong);
+            this.putFileAttach(fileDTO, aLong);
         }
         return R.success("操作成功");
     }
@@ -3639,8 +3658,8 @@ public class ExcelTabController extends BladeController {
             @ApiImplicitParam(name = "pkeyId", value = "WBS私有库的pkeyId", required = true),
             @ApiImplicitParam(name = "tabId", value = "表信息id", required = true)
     })
-    public R<List<WbsFormElement>> getUnMatchField(Long pkeyId,Long tabId) throws Exception {
-        return R.data(excelTabService.getUnMatchField(pkeyId,tabId));
+    public R<List<WbsFormElement>> getUnMatchField(Long pkeyId, Long tabId) throws Exception {
+        return R.data(excelTabService.getUnMatchField(pkeyId, tabId));
     }
 
 }

+ 87 - 76
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/ExcelTabServiceImpl.java

@@ -30,6 +30,7 @@ import org.jsoup.nodes.Document;
 import org.jsoup.nodes.Element;
 import org.jsoup.select.Elements;
 import org.springblade.business.dto.TrialSelfInspectionRecordDTO;
+import org.springblade.business.entity.ContractLog;
 import org.springblade.business.entity.InformationQuery;
 import org.springblade.business.entity.TrialSelfInspectionRecord;
 import org.springblade.business.feign.ContractLogClient;
@@ -432,12 +433,13 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
             e.printStackTrace();
         }
     }
+
     /*当前工序节点上下文信息*/
     public CurrentNode createCurrentNode(WbsTreeContract wtc) {
         if (wtc != null) {
-            WbsTreePrivate wtp=this.formulaService.wtpId(wtc.getPKeyId());
-            WbsTreeContract parent = this.wbsTreeContractService.getOne(Wrappers.<WbsTreeContract>lambdaQuery().eq(WbsTreeContract::getContractId,wtc.getContractId()).eq(WbsTreeContract::getId,wtc.getParentId()));
-            if(wtp!=null&&parent!=null) {
+            WbsTreePrivate wtp = this.formulaService.wtpId(wtc.getPKeyId());
+            WbsTreeContract parent = this.wbsTreeContractService.getOne(Wrappers.<WbsTreeContract>lambdaQuery().eq(WbsTreeContract::getContractId, wtc.getContractId()).eq(WbsTreeContract::getId, wtc.getParentId()));
+            if (wtp != null && parent != null) {
                 /*私有引用项目,需要溯源*/
                 WbsTreePrivate publicWtp = this.formulaService.getOriginWtp(wtp.getPKeyId());
                 CurrentNode currentNode = new CurrentNode();
@@ -457,18 +459,18 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
     }
 
 
-    public CurrentNode  createCurrentNode( WbsTreePrivate wtp) {
-        if (wtp!=null) {
-                /*私有引用项目,需要溯源*/
-                WbsTreePrivate publicWtp = this.formulaService.getOriginWtp(wtp.getPKeyId());
-                CurrentNode currentNode = new CurrentNode();
-                currentNode.setPkId(wtp.getPKeyId());
-                currentNode.setId(wtp.getId());
-                currentNode.setProjectId(Long.parseLong(wtp.getProjectId()));
-                currentNode.setParentId(wtp.getParentId());
-                currentNode.setWbsId(Long.parseLong(publicWtp.getWbsId()));
-                currentNode.setWbsNodeId(wtp.getId());
-                return currentNode;
+    public CurrentNode createCurrentNode(WbsTreePrivate wtp) {
+        if (wtp != null) {
+            /*私有引用项目,需要溯源*/
+            WbsTreePrivate publicWtp = this.formulaService.getOriginWtp(wtp.getPKeyId());
+            CurrentNode currentNode = new CurrentNode();
+            currentNode.setPkId(wtp.getPKeyId());
+            currentNode.setId(wtp.getId());
+            currentNode.setProjectId(Long.parseLong(wtp.getProjectId()));
+            currentNode.setParentId(wtp.getParentId());
+            currentNode.setWbsId(Long.parseLong(publicWtp.getWbsId()));
+            currentNode.setWbsNodeId(wtp.getId());
+            return currentNode;
         }
         return null;
     }
@@ -489,46 +491,46 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
             recordTime = DateUtil.format(new Date(), "yyyy-MM-dd");
         }
         // 为数据集
-        String businessId = tableInfoList.get(0).getTheLogId();
-        if (StringUtils.isEmpty(businessId)) {
-
+        String businessIds = tableInfoList.stream().map(TableInfo::getBusinessId).filter(Objects::nonNull).collect(Collectors.joining(","));
+        String ids = "";
+        if (StringUtils.isEmpty(businessIds)) {
             //检查是否存在原本的数据
-            JSONObject logJson = this.contractLogClient.queryContractLogByPrimaryKeyIdAndRecordTime(parentNode.getPKeyId().toString(), recordTime, tableInfoList.get(0).getContractId());
-
-            if (logJson == null) {
-                businessId = SnowFlakeUtil.getId().toString();
-            } else {
-                businessId = logJson.getString("dataId");
-                if (StringUtils.isEmpty(businessId)) {
-                    businessId = SnowFlakeUtil.getId().toString();
-                }
+            List<ContractLog> contractLogs = this.contractLogClient.queryContractLogByPrimaryKeyIdAndRecordTimeList(parentNode.getPKeyId().toString(), recordTime, tableInfoList.get(0).getContractId());
+            if (contractLogs.size() > 0) {
+                businessIds = contractLogs.stream().map(ContractLog::getDataId).map(String::valueOf).collect(Collectors.joining(","));
+                ids = contractLogs.stream().map(ContractLog::getId).map(String::valueOf).collect(Collectors.joining(","));
             }
+        } else {
+            List<ContractLog> contractLogList = jdbcTemplate.query("select id from u_contract_log where data_id in(" + businessIds + ")", new BeanPropertyRowMapper<>(ContractLog.class));
+            ids = contractLogList.stream().map(ContractLog::getId).map(String::valueOf).collect(Collectors.joining(","));
         }
 
-        if (StringUtils.isNotEmpty(businessId)) {
-            //删除旧数据
-            String delSql = "delete from " + tableNode.getInitTableName() + " where group_id = " + businessId;
+        //删除旧数据
+        if (StringUtils.isNotEmpty(businessIds)) {
+            //删除实体表数据、关联工序信息
+            String delSql = "delete from " + tableNode.getInitTableName() + " where id in(" + businessIds + "); delete from u_contract_log_wbs where business_id in(" + businessIds + ")";
+            this.jdbcTemplate.execute(delSql);
+        }
+        if (StringUtils.isNotEmpty(ids)) {
+            //删除填报记录
+            String delSql = "delete from u_contract_log where id in(" + ids + ")";
             this.jdbcTemplate.execute(delSql);
         }
 
-        List<JSONObject> logWbsList = new ArrayList<>();
-
+        List<String> dataIds = new LinkedList<>();
         for (TableInfo tableInfo : tableInfoList) {
-            WbsTreePrivate wbsTreePrivate = this.wbsTreePrivateService.getOne(Wrappers.<WbsTreePrivate>lambdaQuery().eq(WbsTreePrivate::getPKeyId, tableInfo.getPkeyId()));
-            if (wbsTreePrivate == null) {
-                continue;
+            //获取数据id
+            if (StringUtils.isEmpty(tableInfo.getBusinessId())) {
+                tableInfo.setBusinessId(SnowFlakeUtil.getId().toString());
             }
-            String tabName = wbsTreePrivate.getInitTableName();
 
-            String id = tableInfo.getBusinessId();
-            if (StringUtils.isEmpty(id)) {
-                id = SnowFlakeUtil.getId() + "";
-            }
+            String tabName = tableNode.getInitTableName();
 
             //拼接SQL
             StringBuilder sql = new StringBuilder("INSERT INTO " + tabName),
                     keySql = new StringBuilder("id, group_id"),
-                    valSql = new StringBuilder("" + id + ", " + businessId);
+                    valSql = new StringBuilder("" + tableInfo.getBusinessId() + ", " + tableInfo.getPkeyId());
+
             //参数
             LinkedHashMap<String, String> dataMap2 = tableInfo.getDataMap();
             for (String key : dataMap2.keySet()) {
@@ -546,31 +548,37 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
             }
 
             List<Object> linkTabIds = tableInfo.getLinkTabIds();
-            if (linkTabIds == null || linkTabIds.size() <= 0) {
+            /*if (linkTabIds == null || linkTabIds.size() <= 0) {
                 //这一步主要为了兼容同工序时只想在第一张勾选的情况
                 linkTabIds = tableInfoList.get(0).getLinkTabIds();
-            }
+            }*/
+            List<JSONObject> logWbsList = new ArrayList<>();
             if (linkTabIds != null && linkTabIds.size() > 0) {
                 //处理每个表格的关联情况
                 List<JSONObject> jsonLinkTabIds = JSONArray.parseArray(JSONObject.toJSONString(linkTabIds), JSONObject.class);
                 for (JSONObject json : jsonLinkTabIds) {
-                    json.put("businessId", id);
+                    json.put("businessId", tableInfo.getBusinessId());
                 }
-                logWbsList.addAll(jsonLinkTabIds);
+                List<JSONObject> collect = jsonLinkTabIds.stream().distinct().collect(Collectors.toList()); //去重,每个businessId不一样
+                logWbsList.addAll(collect);
             }
-        }
 
-        //保存日志记录
-        return this.contractLogClient.saveContractLog(new SaveContractLogVO(
-                Long.parseLong(businessId),
-                tableInfoList.get(0).getProjectId(),
-                tableInfoList.get(0).getContractId(),
-                parentNode.getPKeyId(),
-                tableNode.getPKeyId(),
-                parentNode.getMajorDataType(),
-                recordTime,
-                logWbsList
-        ));
+            //保存日志记录
+            String dataId = this.contractLogClient.saveContractLog(new SaveContractLogVO(
+                    Long.parseLong(tableInfo.getBusinessId()),
+                    tableInfoList.get(0).getProjectId(),
+                    tableInfoList.get(0).getContractId(),
+                    parentNode.getPKeyId(),
+                    tableNode.getPKeyId(),
+                    parentNode.getMajorDataType(),
+                    recordTime,
+                    logWbsList
+            ));
+            if (StringUtils.isNotEmpty(dataId)) {
+                dataIds.add(dataId);
+            }
+        }
+        return String.join(",", dataIds);
     }
 
     @Override
@@ -624,10 +632,10 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
                 //上传新文件到文件服务器
                 //excel修改 同步修改html 对象
                 String thmlUrl = file_path + filecode + ".html";
-                ExcelInfoUtils.excelInfo(inputStream,dataUrl,thmlUrl,"2");
+                ExcelInfoUtils.excelInfo(inputStream, dataUrl, thmlUrl, "2");
                 BladeFile bladeFile = newIOSSClient.uploadFile(excelTab.getExtension(), dataUrl);
                 //获取文件大小
-               int size = connection.getContentLength() / 1024 / 1024; //单位M
+                int size = connection.getContentLength() / 1024 / 1024; //单位M
                 excelTab.setAttachSize(Long.parseLong(size + ""));
                 excelTab.setStatus(3);
                 excelTab.setFileUrl(bladeFile.getLink());
@@ -717,7 +725,8 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
             e.printStackTrace();
         }
     }
-    public  Element findParentTd(Element element) {
+
+    public Element findParentTd(Element element) {
         Element parent = element.parent();
         while (parent != null && !parent.tagName().equalsIgnoreCase("td")) {
             parent = parent.parent();
@@ -726,7 +735,8 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
     }
 
     /**
-     *编辑元素,提示未匹配元素
+     * 编辑元素,提示未匹配元素
+     *
      * @param pkeyId
      * @param tabId
      * @return
@@ -735,9 +745,9 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
     public List<WbsFormElement> getUnMatchField(Long pkeyId, Long tabId) throws Exception {
         // 获取 节点信息
         WbsTreePrivate wbsTreePrivate = wbsTreePrivateService.getOne(
-                new LambdaQueryWrapper<WbsTreePrivate>().eq(WbsTreePrivate::getPKeyId,pkeyId));
+                new LambdaQueryWrapper<WbsTreePrivate>().eq(WbsTreePrivate::getPKeyId, pkeyId));
         // 读取html页面信息
-        InputStream  inputStream = FileUtils.getInputStreamByUrl(wbsTreePrivate.getHtmlUrl());
+        InputStream inputStream = FileUtils.getInputStreamByUrl(wbsTreePrivate.getHtmlUrl());
         String htmlString = IoUtil.readToString(inputStream);
         // 样式集合
         Document doc = Jsoup.parse(htmlString);
@@ -1385,7 +1395,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
         //判断是否是水利水电表,水利水电项目名14,表名12 。   其他表都是18
         int isWater = 14;
         ExcelTab tab = baseMapper.getWaterByTableId(wbsTreeContract.getExcelId());
-        if (tab != null){
+        if (tab != null) {
             isWater = 12;
         }
 
@@ -1393,7 +1403,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
         int mergedCellCnt = sheet.getNumMergedRegions();
         for (int i = 0; i < mergedCellCnt - 1; i++) {
             CellRangeAddress mergedCell = sheet.getMergedRegion(i);
-            int xx = mergedCell.getNumberOfCells()+2;
+            int xx = mergedCell.getNumberOfCells() + 2;
             if (xx >= all) {
                 int fisRow = mergedCell.getFirstRow();
                 int firsrCol = mergedCell.getFirstColumn();
@@ -1524,27 +1534,27 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
                                     if (cell != null || ObjectUtils.isNotEmpty(cell)) {
                                         String exceVal = cell.getStringCellValue().replaceAll(" ", "");
                                         //如果有□ 代表 自动生成  如果没有 代表后期添加 需要显示html 中的值
-                                        if(exceVal.indexOf("□")>=0 ){
-                                            if(myData.equals("1")){
+                                        if (exceVal.indexOf("□") >= 0) {
+                                            if (myData.equals("1")) {
                                                 short fontIndex = cell.getCellStyle().getFontIndex();
                                                 Font fontAt = workbook.getFontAt(fontIndex);
                                                 fontAt.setFontName("EUDC");
                                                 cell.setCellValue(exceVal.replace("□", "\u2611"));
                                             }
-                                        }else{
+                                        } else {
                                             String dataJson = data.attr(":objs");
-                                            if(StringUtils.isNotEmpty(dataJson)){
+                                            if (StringUtils.isNotEmpty(dataJson)) {
                                                 JSONArray jsonArray = JSONArray.parseArray(dataJson);
                                                 List<Integer> idList = Func.toIntList(myData);
                                                 int indexx = 0;
-                                                if(idList.get(0)>=1){
-                                                    indexx =idList.get(0)-1;
+                                                if (idList.get(0) >= 1) {
+                                                    indexx = idList.get(0) - 1;
                                                 }
 
                                                 String dataInfo = jsonArray.getJSONObject(indexx).getString("name");
-                                                for(int inx=1 ; inx<idList.size() ; inx++){
-                                                   int valIndex = idList.get(inx)-1;
-                                                    dataInfo = dataInfo+","+jsonArray.getJSONObject(valIndex).getString("name");
+                                                for (int inx = 1; inx < idList.size(); inx++) {
+                                                    int valIndex = idList.get(inx) - 1;
+                                                    dataInfo = dataInfo + "," + jsonArray.getJSONObject(valIndex).getString("name");
                                                 }
                                                 cell.setCellValue(dataInfo);
                                             }
@@ -1558,8 +1568,9 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
                                     if (cell != null || ObjectUtils.isNotEmpty(cell)) {
                                         cell.setCellValue(myData);
                                     }
-                                   boolean wrap = Optional.ofNullable(cell).map(Cell::getCellStyle).map(CellStyle::getWrapText).orElse(true);;
-                                    if(!wrap){
+                                    boolean wrap = Optional.ofNullable(cell).map(Cell::getCellStyle).map(CellStyle::getWrapText).orElse(true);
+                                    ;
+                                    if (!wrap) {
                                         cell.getCellStyle().setShrinkToFit(true);
                                     }
                                 }