浏览代码

Merge branch 'test-merge-02' of http://219.151.181.73:3000/zhuwei/bladex into test-merge-02

lvy 3 月之前
父节点
当前提交
7045e5f7a4
共有 14 个文件被更改,包括 1715 次插入122 次删除
  1. 35 0
      blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/dto/ServicePlanDTO.java
  2. 13 0
      blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/dto/ServiceUserDto.java
  3. 86 0
      blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/entity/ServicePlan.java
  4. 46 0
      blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/vo/ServicePlanVO.java
  5. 13 0
      blade-service/blade-business/src/main/java/org/springblade/business/controller/PrivateStandardController.java
  6. 2 0
      blade-service/blade-business/src/main/java/org/springblade/business/service/PrivateStandardService.java
  7. 132 6
      blade-service/blade-business/src/main/java/org/springblade/business/service/impl/PrivateStandardServiceImpl.java
  8. 6 0
      blade-service/blade-manager/pom.xml
  9. 397 0
      blade-service/blade-manager/src/main/java/org/springblade/manager/controller/ServicePlanController.java
  10. 61 0
      blade-service/blade-manager/src/main/java/org/springblade/manager/service/IServicePlanService.java
  11. 21 106
      blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/ExcelTabServiceImpl.java
  12. 842 0
      blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/ServicePlanServiceImpl.java
  13. 46 4
      blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/WbsSynchronousEViSaServiceImpl.java
  14. 15 6
      blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/WbsSynchronousServiceImpl.java

+ 35 - 0
blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/dto/ServicePlanDTO.java

@@ -0,0 +1,35 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.manager.dto;
+
+import org.springblade.manager.entity.ServicePlan;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * 数据传输对象实体类
+ *
+ * @author BladeX
+ * @since 2025-06-25
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class ServicePlanDTO extends ServicePlan {
+	private static final long serialVersionUID = 1L;
+
+    private String userId;
+}

+ 13 - 0
blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/dto/ServiceUserDto.java

@@ -0,0 +1,13 @@
+package org.springblade.manager.dto;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+public class ServiceUserDto {
+    private String userId;
+    private String userName;
+}

+ 86 - 0
blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/entity/ServicePlan.java

@@ -0,0 +1,86 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.manager.entity;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import java.io.Serializable;
+import java.time.LocalDate;
+
+import io.swagger.annotations.ApiModelProperty;
+import org.springblade.core.mp.base.BaseEntity;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * 实体类
+ *
+ * @author BladeX
+ * @since 2025-06-25
+ */
+@Data
+@TableName("m_service_plan")
+@EqualsAndHashCode(callSuper = true)
+public class ServicePlan extends BaseEntity {
+
+	private static final long serialVersionUID = 1L;
+
+	/**
+	* 填写类型 1月度服务计划 2服务完成确认单
+	*/
+    @ApiModelProperty(value = "填写类型 1月度服务计划 2服务完成确认单")
+		private Integer fileInType;
+    /**
+     * 项目Id
+     */
+    @ApiModelProperty(value = "项目Id")
+        private Long projectId;
+    /**
+     * 合同段Id
+     */
+    @ApiModelProperty(value = "合同段Id")
+        private Long contractId;
+	/**
+	* 计划开始时间
+	*/
+    @ApiModelProperty(value = "计划开始时间")
+		private LocalDate planStartTime;
+	/**
+	* 计划结束时间
+	*/
+    @ApiModelProperty(value = "计划结束时间")
+		private LocalDate planEndTime;
+    /**
+     * 编写人
+     */
+    @ApiModelProperty(value = "编写人ID 逗号拼接")
+        private String writeUser;
+	/**
+	* 发送人员
+	*/
+    @ApiModelProperty(value = "发送人员ID 逗号拼接")
+		private String sendUser;
+    /**
+     * pdf路径
+      */
+    @ApiModelProperty(value = "pdf路径")
+        private String pdfUrl;
+
+
+
+
+
+}

+ 46 - 0
blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/vo/ServicePlanVO.java

@@ -0,0 +1,46 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.manager.vo;
+
+import org.springblade.manager.entity.ServicePlan;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * 视图实体类
+ *
+ * @author BladeX
+ * @since 2025-06-25
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class ServicePlanVO extends ServicePlan {
+	private static final long serialVersionUID = 1L;
+   //1计划中  2协同中-甲方  3协同中-系统  4已计划
+    private String statusValue;
+    //是否可编辑
+   private Boolean isEdit;
+    //计划开始时间
+   private String startTime;
+   //计划结束时间
+   private String endTime;
+   //发送人
+   private String sendUserName;
+
+   private String planTime;
+
+}

+ 13 - 0
blade-service/blade-business/src/main/java/org/springblade/business/controller/PrivateStandardController.java

@@ -195,5 +195,18 @@ public class PrivateStandardController {
         boolean b = this.privateStandardService.deleteFile(id);
         return R.data(b);
     }
+
+    /**
+     * 规范更新
+     * @param id 规范文件id
+     */
+    @ApiOperation(value = "规范更新")
+    @GetMapping("/standardUpdate")
+    @ApiImplicitParam(name = "id", value = "规范文件id", required = true)
+    public R<Boolean> standardUpdate(Long id) {
+        boolean b = this.privateStandardService.standardUpdate(id);
+        return R.data(b);
+    }
+
 }
 

+ 2 - 0
blade-service/blade-business/src/main/java/org/springblade/business/service/PrivateStandardService.java

@@ -23,4 +23,6 @@ public interface PrivateStandardService extends IService<PrivateStandard> {
     boolean deleteFile(Long id);
 
     boolean updateTypeByTwo(List<PrivateStandardDTO> data, List<Long> delIds, List<Long> delFileIds, MultipartFile[] files);
+
+    boolean standardUpdate(Long id);
 }

+ 132 - 6
blade-service/blade-business/src/main/java/org/springblade/business/service/impl/PrivateStandardServiceImpl.java

@@ -1,14 +1,14 @@
 package org.springblade.business.service.impl;
 
+import cn.hutool.core.date.DateTime;
 import cn.hutool.core.util.ReflectUtil;
 import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
+import com.baomidou.mybatisplus.core.toolkit.StringUtils;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import org.springblade.business.entity.StandardFile;
+import org.springblade.business.entity.*;
 import org.springblade.business.service.StandardFileService;
 import org.springblade.business.dto.PrivateStandardDTO;
-import org.springblade.business.entity.PrivateStandard;
-import org.springblade.business.entity.StandardInfo;
 import org.springblade.business.mapper.StandardInfoJoinMapper;
 import org.springblade.business.mapper.StandardInfoMapper;
 import org.springblade.business.mapper.StandardInfoPrivateJoinMapper;
@@ -27,10 +27,17 @@ import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.multipart.MultipartFile;
 
 import javax.annotation.Resource;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.io.InputStream;
+import java.net.URL;
+import java.time.LocalDateTime;
 import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
 
 /**
  * @author LHB
@@ -192,7 +199,7 @@ public class PrivateStandardServiceImpl extends ServiceImpl<PrivateStandardMappe
     }
 
     @Override
-    @Transactional
+    @Transactional(rollbackFor = Exception.class)
     public boolean updateTypeByTwo(List<PrivateStandardDTO> data,
                                    List<Long> delIds,
                                    List<Long> delFileIds,
@@ -235,13 +242,16 @@ public class PrivateStandardServiceImpl extends ServiceImpl<PrivateStandardMappe
                     if(dto.getFile() != null){
                         //再去查询当前规范文件是否在数据库中存在未删除的文件
                         List<StandardFile> list = standardFileService.list(Wrappers.<StandardFile>lambdaQuery()
-                                .eq(StandardFile::getStandardId, dto.getId()));
+                                .eq(StandardFile::getStandardId, dto.getId())
+                                .eq(StandardFile::getIsDeleted, 0));
                         if(CollectionUtils.isNotEmpty(list)){
                             //删除文件
-                            for (StandardFile standardFile : standardFiles) {
+                            for (StandardFile standardFile : list) {
                                 String pdfName = standardFile.getStandardFileUrl().split("upload")[1];
                                 this.newIOSSClient.removeFile("upload" + pdfName);
+                                standardFile.setIsDeleted(1);
                             }
+                            standardFileService.saveOrUpdateBatch(list);
                         }
                         MultipartFile file = dto.getFile();
                         StandardFile standardFile = new StandardFile();
@@ -285,6 +295,122 @@ public class PrivateStandardServiceImpl extends ServiceImpl<PrivateStandardMappe
             throw new ServiceException("更新失败");
         }
     }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public boolean standardUpdate(Long id) {
+        BladeUser user = SecureUtil.getUser();
+        //获取当前规范文件信息
+        PrivateStandard privateStandard = baseMapper.selectById(id);
+
+
+        //获取信息
+        List<StandardInfo> standardInfos = standardInfoMapper.selectList(Wrappers.<StandardInfo>lambdaQuery()
+                .eq(StandardInfo::getStandardId, id)
+                .eq(StandardInfo::getIsDeleted, 0));
+        List<Long> infoIds = standardInfos.stream().filter(f -> f.getType() == 2).map(StandardInfo::getId).collect(Collectors.toList());
+
+        //获取绑定信息
+        List<StandardInfoJoin> standardInfoJoins = standardInfoJoinMapper.selectList(Wrappers.<StandardInfoJoin>lambdaQuery()
+                .in(StandardInfoJoin::getStandardInfoLeftId, infoIds));
+
+        //获取绑定表单信息
+        List<StandardInfoPrivateJoin> standardInfoPrivateJoins = standardInfoPrivateJoinMapper.selectList(Wrappers.<StandardInfoPrivateJoin>lambdaQuery()
+                .in(StandardInfoPrivateJoin::getStandardInfoId, infoIds));
+
+        //获取文件信息
+        List<StandardFile> standardFiles = standardFileService.list(Wrappers.<StandardFile>lambdaQuery()
+                .eq(StandardFile::getStandardId, id)
+                .eq(StandardFile::getIsDeleted, 0));
+
+
+        //复制数据
+
+        //新规范文件id
+        Long newId = SnowFlakeUtil.getId();
+
+        privateStandard.setId(newId);
+        if (privateStandard.getStatus() == 2) {
+            privateStandard.setName(privateStandard.getName().replace("-已过期",""));
+            privateStandard.setStatus(1);
+        }
+        privateStandard.setCreateTime(LocalDateTime.now());
+        privateStandard.setCreateUser(user.getUserId());
+
+        //修改之前的规则为过期
+        baseMapper.updateStatus(privateStandard.getParentId());
+
+        baseMapper.insert(privateStandard);
+
+        //旧id与新id的映射关系
+        Map<Long, Long> map = new HashMap<>();
+        standardInfos.forEach(f -> {
+            Long newInfoId = SnowFlakeUtil.getId();
+            map.put(f.getId(),newInfoId);
+        });
+        standardInfos.forEach(f -> {
+            f.setId(map.get(f.getId()));
+            f.setParentId(map.get(f.getParentId())==null?0:map.get(f.getParentId()));
+            f.setStandardId(newId);
+            f.setCreateTime(DateTime.now());
+            f.setCreateUser(user.getUserId());
+            standardInfoMapper.insert(f);
+        });
+
+
+        standardInfoJoins.forEach(f -> {
+            f.setId(SnowFlakeUtil.getId());
+            f.setStandardInfoLeftId(map.get(f.getStandardInfoLeftId()));
+            f.setStandardInfoRightId(map.get(f.getStandardInfoRightId()));
+            f.setCreateTime(DateTime.now());
+            f.setCreateUser(user.getUserId());
+            standardInfoJoinMapper.insert(f);
+        });
+
+        standardInfoPrivateJoins.forEach(f -> {
+            f.setId(SnowFlakeUtil.getId());
+            f.setStandardInfoId(map.get(f.getStandardInfoId()));
+            f.setCreateTime(DateTime.now());
+            f.setCreateUser(user.getUserId());
+            standardInfoPrivateJoinMapper.insert(f);
+        });
+
+
+
+        //文件集合
+        List<String> urls = new ArrayList<>();
+        try {
+            for (StandardFile f : standardFiles) {
+                f.setId(SnowFlakeUtil.getId());
+                f.setStandardId(newId);
+                f.setCreateTime(DateTime.now());
+                f.setCreateUser(user.getUserId());
+                if(StringUtils.isNotEmpty(f.getStandardFileUrl())){
+                    URL urlFile = new URL(f.getStandardFileUrl());
+                    InputStream inputStream = urlFile.openStream();
+                    String originalFilename = "standard/" + f.getId() + "|" + f.getFileName();
+                    MockMultipartFile multipartFile = new MockMultipartFile("file", originalFilename, "application/pdf", inputStream);
+                    //Oss上传 传特殊文件名 在oss中做特殊路径处理
+                    BladeFile bladeFile = newIOSSClient.uploadFileByInputStream(multipartFile);
+                    if (bladeFile == null) {
+                        throw new ServiceException("Oss异常");
+                    }
+                    f.setStandardFileUrl(bladeFile.getLink());
+                    urls.add(bladeFile.getLink());
+                }
+            }
+        } catch (Exception e) {
+            for (String url : urls) {
+                String pdfName = url.split("upload")[1];
+                this.newIOSSClient.removeFile("upload" + pdfName);
+            }
+            e.printStackTrace();
+            throw new ServiceException("Oss异常");
+        }
+
+        standardFileService.saveBatch(standardFiles);
+        return true;
+    }
 }
 
 

+ 6 - 0
blade-service/blade-manager/pom.xml

@@ -208,6 +208,12 @@
             <version>7.2.4</version>
             <scope>compile</scope>
         </dependency>
+        <dependency>
+            <groupId>joda-time</groupId>
+            <artifactId>joda-time</artifactId>
+            <version>2.10.3</version>
+            <scope>compile</scope>
+        </dependency>
     </dependencies>
     <build>
         <plugins>

+ 397 - 0
blade-service/blade-manager/src/main/java/org/springblade/manager/controller/ServicePlanController.java

@@ -0,0 +1,397 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.manager.controller;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import io.swagger.annotations.*;
+import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
+import io.swagger.models.auth.In;
+import lombok.AllArgsConstructor;
+import javax.validation.Valid;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang3.ObjectUtils;
+import org.apache.poi.ss.usermodel.*;
+import org.apache.poi.ss.util.CellRangeAddress;
+import org.apache.poi.util.IOUtils;
+import org.jsoup.Jsoup;
+import org.jsoup.nodes.Document;
+import org.jsoup.nodes.Element;
+import org.jsoup.select.Elements;
+import org.springblade.business.entity.InformationQuery;
+import org.springblade.common.constant.CommonConstant;
+import org.springblade.common.utils.CommonUtil;
+import org.springblade.common.vo.DataVO;
+import org.springblade.core.log.exception.ServiceException;
+import org.springblade.core.mp.support.Condition;
+import org.springblade.core.mp.support.Query;
+import org.springblade.core.oss.model.BladeFile;
+import org.springblade.core.secure.utils.SecureUtil;
+import org.springblade.core.tool.api.R;
+import org.springblade.core.tool.utils.*;
+import org.springblade.manager.bean.TableInfo;
+import org.springblade.manager.dto.ServicePlanDTO;
+import org.springblade.manager.dto.ServiceUserDto;
+import org.springblade.manager.entity.*;
+import org.springblade.manager.utils.FileUtils;
+import org.springblade.system.cache.ParamCache;
+import org.springframework.jdbc.core.BeanPropertyRowMapper;
+import org.springframework.jdbc.core.JdbcTemplate;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.bind.annotation.RequestParam;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import org.springblade.manager.vo.ServicePlanVO;
+import org.springblade.manager.wrapper.ServicePlanWrapper;
+import org.springblade.manager.service.IServicePlanService;
+import org.springblade.core.boot.ctrl.BladeController;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.InputStream;
+import java.text.SimpleDateFormat;
+import java.util.*;
+import java.util.stream.Collectors;
+
+/**
+ *  控制器
+ *
+ * @author BladeX
+ * @since 2025-06-25
+ */
+@RestController
+@AllArgsConstructor
+@RequestMapping("/serviceplan")
+@Api(value = "服务计划", tags = "服务计划接口")
+public class ServicePlanController extends BladeController {
+
+	private final IServicePlanService servicePlanService;
+
+    private final JdbcTemplate jdbcTemplate;
+
+	/**
+	 * 详情
+	 */
+	@GetMapping("/detail")
+	@ApiOperationSupport(order = 1)
+	@ApiOperation(value = "详情", notes = "传入servicePlan")
+    @ApiImplicitParams(value = {
+        @ApiImplicitParam(name = "id", value = "id", required = true)
+    })
+	public R<ServicePlanVO> detail(ServicePlan servicePlan) {
+		ServicePlan detail = servicePlanService.getOne(Condition.getQueryWrapper(servicePlan));
+		return R.data(ServicePlanWrapper.build().entityVO(detail));
+	}
+
+	/**
+	 * 分页
+	 */
+//	@GetMapping("/list")
+//	@ApiOperationSupport(order = 2)
+//	@ApiOperation(value = "分页", notes = "传入servicePlan")
+//	public R<IPage<ServicePlanVO>> list(ServicePlan servicePlan, Query query) {
+//		IPage<ServicePlan> pages = servicePlanService.page(Condition.getPage(query), Condition.getQueryWrapper(servicePlan));
+//		return R.data(ServicePlanWrapper.build().pageVO(pages));
+//	}
+
+
+	/**
+	 * 自定义分页
+	 */
+	@GetMapping("/page")
+	@ApiOperationSupport(order = 3)
+	@ApiOperation(value = "分页", notes = "传入servicePlan")
+    @ApiImplicitParams(value = {
+        @ApiImplicitParam(name = "projectId", value = "项目Id", required = true),
+        @ApiImplicitParam(name = "contractId", value = "合同Id", required = true)
+    })
+	public R<IPage<ServicePlanVO>> page(ServicePlanDTO servicePlan, Query query) {
+		IPage<ServicePlanVO> pages = servicePlanService.selectServicePlanPage(Condition.getPage(query), servicePlan);
+		return R.data(pages);
+	}
+    @GetMapping("/getSendUserAndWriteUser")
+    @ApiOperationSupport(order = 35)
+    @ApiOperation(value = "获取发送人及填写人", notes = "获取发送人及填写人")
+    @ApiImplicitParams(value = {
+        @ApiImplicitParam(name = "projectId", value = "项目Id", required = true),
+        @ApiImplicitParam(name = "contractId", value = "合同Id", required = true)
+    })
+    public R<Map<String,List<ServiceUserDto>>> getSendUserAndWriteUser(Long projectId, Long contractId){
+        return R.data(servicePlanService.getSendUserAndWriteUser(projectId,contractId));
+    }
+
+	/**
+	 * 新增
+	 */
+//	@PostMapping("/save")
+//	@ApiOperationSupport(order = 4)
+//	@ApiOperation(value = "新增", notes = "传入servicePlan")
+//    @ApiImplicitParams(value = {
+//        @ApiImplicitParam(name = "projectId", value = "项目Id", required = true),
+//        @ApiImplicitParam(name = "contractId", value = "合同Id", required = true),
+//        @ApiImplicitParam(name = "type", value = "1月度服务计划 2服务完成确认单", required = true),
+//        @ApiImplicitParam(name = "planStartTime", value = "计划开始时间", required = true),
+//        @ApiImplicitParam(name = "planEndTime", value = "计划结束时间", required = true),
+//    })
+//	public R save(@Valid @RequestBody ServicePlan servicePlan) {
+//        servicePlan.setWriteUser(SecureUtil.getUserId()+"");
+//        return R.status(servicePlanService.save(servicePlan));
+//	}
+
+	/**
+	 * 修改
+	 */
+//	@PostMapping("/update")
+//	@ApiOperationSupport(order = 5)
+//	@ApiOperation(value = "修改", notes = "传入servicePlan")
+//	public R update(@Valid @RequestBody ServicePlan servicePlan) {
+//        if(servicePlan.getWriteUser()!=null){
+//            if(!servicePlan.getWriteUser().contains(SecureUtil.getUserId()+"")){
+//                servicePlan.setWriteUser(servicePlan.getWriteUser()+","+SecureUtil.getUserId()+"");
+//            }
+//        }
+//		return R.status(servicePlanService.updateById(servicePlan));
+//	}
+    @GetMapping("/sendServicePlan")
+    @ApiOperationSupport(order = 34)
+    @ApiOperation(value = "修改服务计划流程", notes = "修改服务计划流程")
+    @ApiImplicitParams(value = {
+        @ApiImplicitParam(name = "id", value = "计划id", required = true),
+        @ApiImplicitParam(name = "sendUser", value = "发送人ID 逗号拼接", required = false),
+        @ApiImplicitParam(name = "status", value = "2发送,3回退,4完成", required = true),
+    })
+    public R changeServicePlanStatus(Long id,String sendUser,Integer status){
+        ServicePlan plan = servicePlanService.getById(id);
+        if(plan!=null){
+            if(StringUtils.isNotEmpty(sendUser)&&status==2){
+                plan.setSendUser(sendUser);
+                plan.setStatus(2);
+            } else if (status==3) {
+                plan.setStatus(3);
+            }else {
+                plan.setStatus(4);
+            }
+        }
+       return R.status(servicePlanService.updateById(plan));
+    }
+
+	/**
+	 * 新增或修改
+	 */
+//	@PostMapping("/submit")
+//	@ApiOperationSupport(order = 6)
+//	@ApiOperation(value = "新增或修改", notes = "传入servicePlan")
+//	public R submit(@Valid @RequestBody ServicePlan servicePlan) {
+//		return R.status(servicePlanService.saveOrUpdate(servicePlan));
+//	}
+
+
+	/**
+	 * 删除
+	 */
+	@PostMapping("/remove")
+	@ApiOperationSupport(order = 7)
+	@ApiOperation(value = "逻辑删除", notes = "传入ids")
+	public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
+		return R.status(servicePlanService.deleteLogic(Func.toLongList(ids)));
+	}
+
+    @GetMapping("/getServiceHtml")
+    @ApiOperationSupport(order = 8)
+    @ApiOperation(value = "获取服务计划html", notes = "projectId,contractId,type 1月度服务计划 2服务完成确认单")
+    @ApiImplicitParams(value = {
+        @ApiImplicitParam(name = "projectId", value = "项目ID", required = true),
+        @ApiImplicitParam(name = "contractId", value = "合同段ID", required = false),
+        @ApiImplicitParam(name = "pkeyId", value = "1月度服务计划 2服务完成确认单", required = true),
+    })
+    public R<String> getServiceHtml(Long projectId, Long contractId,Long pkeyId){
+        return R.data(servicePlanService.getServiceHtml(projectId,contractId,pkeyId));
+    }
+
+    @GetMapping("/get-html-buss-cols")
+    @ApiOperationSupport(order = 36)
+    @ApiOperation(value = "获取坐标位置", notes = "获取坐标位置")
+    @ApiImplicitParams(value = {
+        @ApiImplicitParam(name = "pkeyId", value = "1月度服务计划 2服务完成确认单", required = true)
+    })
+    public R getHtmlBussCols(Long pkeyId) {
+        String sql="select * from m_wbs_tree_contract where p_key_id="+pkeyId;
+        WbsTreeContract wbsTreeContract = jdbcTemplate.queryForObject( sql, new BeanPropertyRowMapper<>(WbsTreeContract.class));
+        if (wbsTreeContract == null) {
+            throw new ServiceException("暂无表单");
+        }
+        if (wbsTreeContract.getHtmlUrl() == null) {
+            throw new ServiceException("暂无表单");
+        }
+        String file_path = ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
+        String sys_file_net_url = ParamCache.getValue(CommonConstant.SYS_FILE_NET_URL);
+        try {
+            String fileUrl = wbsTreeContract.getHtmlUrl();
+            File file1 = ResourceUtil.getFile(fileUrl);
+            InputStream fileInputStream = null;
+            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);
+            // 解析 style
+            Document doc = Jsoup.parse(htmlString);
+            Element table = doc.select("table").first();
+            Elements trs = table.select("tr");
+
+            List<List<String>> redata = new ArrayList<>();
+            for (int i = 0; i < trs.size(); i++) {
+                Element tr = trs.get(i);
+                Elements tds = tr.select("td");
+                List<String> tdList = new ArrayList<>();
+                for (int j = 0; j < tds.size(); j++) {
+                    Element element = tds.get(j);
+                    if (element.html().indexOf("el-tooltip") >= 0) {
+                        element = element.children().get(0);
+                    }
+                    if (element.children().size() >= 1) {
+                        String keyname = element.children().get(0).attr("keyname");
+                        if (StringUtils.isNotEmpty(keyname)) {
+                            tdList.add(keyname);
+                        }
+                    }
+                }
+                if (tdList != null && tdList.size() >= 1) {
+                    redata.add(tdList);
+                }
+            }
+
+            String[][] res = new String[redata.size()][]; // 存放转换结果的 二维数组
+            for (int i = 0; i < res.length; i++) { // 转换方法
+                res[i] = redata.get(i).toArray(new String[redata.get(i).size()]);
+            }
+            return R.data(res);
+        } catch (Exception e) {
+            return R.fail("暂无表单!");
+        }
+    }
+
+    @PostMapping("/saveServiceData")
+    @ApiOperationSupport(order = 9)
+    @ApiOperation(value = "保存服务计划数据", notes = "传入dataInfo")
+    @Transactional
+    public R saveServiceData(@Valid @RequestBody JSONObject dataInfo) throws Exception {
+        JSONArray dataArray = new JSONArray();
+        Long pkeyId = Long.valueOf(dataInfo.getString("pkeyId"));
+        Long projectId=Long.valueOf(dataInfo.getString("projectId"));
+        Long contractId=Long.valueOf(dataInfo.getString("contractId"));
+        dataArray.add(dataInfo);
+        List<TableInfo> tableInfoList=getServiceData(dataArray);
+        Long groupId = servicePlanService.saveServicePlan(pkeyId,projectId,contractId,dataInfo);
+        servicePlanService.saveServiceData(tableInfoList,groupId,pkeyId);
+        servicePlanService.saveServicePlanPdf(projectId,pkeyId,Func.toLong(groupId));
+        return R.status( true);
+    }
+
+
+    private List<TableInfo> getServiceData(JSONArray dataInfo) {
+        if (dataInfo != null && !dataInfo.isEmpty()) {
+            List<TableInfo> result = new ArrayList<>();
+            for (int m = 0; m < dataInfo.size(); m++) {
+                TableInfo tableInfo = new TableInfo();
+                JSONObject dataInfo2 = dataInfo.getJSONObject(m);
+                tableInfo.setToBeUpdated(true);
+                tableInfo.setContractId(dataInfo2.getString("contractId"));
+                dataInfo2.fluentRemove("contractId")
+                    .fluentRemove("pkeyId")
+                    .fluentRemove("p_key_id")
+                    .fluentRemove("projectId")
+                    .fluentRemove("classify")
+                    .fluentRemove("pickerKey")
+                    .fluentRemove("id")
+                    .fluentRemove("isFirst")
+                    .fluentRemove("firstNodeId")
+                    .fluentRemove("isTheLog")
+                    .fluentRemove("theLogId")
+                    .fluentRemove("linkTabIds")
+                    .fluentRemove("recordTime")
+                    .fluentRemove("businessId")
+                    .fluentRemove("sourceUrl")
+                    .fluentRemove("pdfUrl")
+                    .fluentRemove("firstFileName")
+                    .fluentRemove("");
+                //计算数据
+                LinkedHashMap<String, List<String>> dataMap = dataInfo2.keySet().stream().filter(e -> e.contains("__")).collect(Collectors.groupingBy(e -> e.split("__")[0], LinkedHashMap<String, List<String>>::new, Collectors.toList()));
+                LinkedHashMap<String, String> dataMap2 = new LinkedHashMap<>();
+
+                //字段组合
+                for (String k : dataMap.keySet()) {
+                    if (dataMap.get(k).size() > 1 && !dataMap.get(k).contains("000Z")) {
+                        String[] ziduan = dataMap.get(k).toArray(new String[]{});
+                        String temp = "";
+                        for (int i = 0; i < ziduan.length - 1; i++) {
+                            for (int j = 0; j < ziduan.length - i - 1; j++) {
+                                int tr = Integer.parseInt((ziduan[j].split("__")[1]).split("_")[0]);
+                                int td = Integer.parseInt(ziduan[j].split("__")[1].split("_")[1]);
+                                int tr_1 = Integer.parseInt(ziduan[j + 1].split("__")[1].split("_")[0]);
+                                int td_1 = Integer.parseInt(ziduan[j + 1].split("__")[1].split("_")[1]);
+                                if (tr > tr_1 && td == td_1) { //纵向排序
+                                    temp = ziduan[j];
+                                    ziduan[j] = ziduan[j + 1];
+                                    ziduan[j + 1] = temp;
+                                }
+                            }
+                        }
+                        StringBuilder lastStr = new StringBuilder(dataInfo2.getString(ziduan[0]) + "_^_" + ziduan[0].split("__")[1]);
+                        for (int i = 1; i < ziduan.length; i++) {
+                            String keyData = dataInfo2.getString(ziduan[i]);
+                            if (keyData!=null && Func.isNotEmpty(keyData)) {
+                                lastStr.append("☆").append(dataInfo2.getString(ziduan[i])).append("_^_").append(ziduan[i].split("__")[1]);
+                            }
+
+                        }
+                        dataMap2.put(k, lastStr.toString());
+                    } else {
+                        String dataVal = dataInfo2.getString(dataMap.get(k).get(0));
+                        if(StringUtils.isNotEmpty(dataVal)){
+                            dataMap2.put(k, dataVal + "_^_" + dataMap.get(k).get(0).split("__")[1]);
+                        }
+                    }
+                }
+                tableInfo.setDataMap(dataMap2);
+                result.add(tableInfo);
+            }
+            return result;
+        }
+        return null;
+    }
+
+    @GetMapping("/getServiceBussData")
+    @ApiOperationSupport(order = 36)
+    @ApiOperation(value = "获取保存数据", notes = "获取保存数据")
+    @ApiImplicitParams(value = {
+        @ApiImplicitParam(name = "id", value = "id", required = true),
+        @ApiImplicitParam(name = "pkeyId", value = "1月度服务计划 2服务完成确认单", required = true)
+    })
+    public R<List<Map<String, Object>>> getServiceBussData(Long id,Long pkeyId){
+        return R.data(servicePlanService.getServiceBussData(id,pkeyId));
+    }
+
+}

+ 61 - 0
blade-service/blade-manager/src/main/java/org/springblade/manager/service/IServicePlanService.java

@@ -0,0 +1,61 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.manager.service;
+
+import com.alibaba.fastjson.JSONObject;
+import org.springblade.manager.bean.TableInfo;
+import org.springblade.manager.dto.ServicePlanDTO;
+import org.springblade.manager.dto.ServiceUserDto;
+import org.springblade.manager.entity.ServicePlan;
+import org.springblade.manager.vo.ServicePlanVO;
+import org.springblade.core.mp.base.BaseService;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+
+import javax.validation.Valid;
+import java.io.IOException;
+import java.util.List;
+import java.util.Map;
+
+/**
+ *  服务类
+ *
+ * @author BladeX
+ * @since 2025-06-25
+ */
+public interface IServicePlanService extends BaseService<ServicePlan> {
+
+	/**
+	 * 自定义分页
+	 *
+	 * @param page
+	 * @param servicePlan
+	 * @return
+	 */
+	IPage<ServicePlanVO> selectServicePlanPage(IPage<ServicePlanVO> page, ServicePlanDTO servicePlan);
+
+    String getServiceHtml(Long projectId,Long contractId,Long pkeyId);
+
+    boolean saveServiceData(List<TableInfo> tableInfoList,Long groupId,Long pkeyId);
+
+    void saveServicePlanPdf(Long projectId,Long pkeyId, Long id) throws Exception;
+
+    List<Map<String, Object>> getServiceBussData(Long id, Long pkeyId);
+
+    Map<String,List<ServiceUserDto>> getSendUserAndWriteUser(Long projectId, Long contractId);
+
+    Long saveServicePlan(Long pkeyId,Long projectId,Long contractId,@Valid JSONObject dataInfo);
+}

+ 21 - 106
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/ExcelTabServiceImpl.java

@@ -31,7 +31,6 @@ import org.jsoup.nodes.Document;
 import org.jsoup.nodes.Element;
 import org.jsoup.nodes.Node;
 import org.jsoup.select.Elements;
-import org.springblade.business.dto.TrialSeleInspectionRecordBaseInfoDTO;
 import org.springblade.business.dto.TrialSelfInspectionRecordDTO;
 import org.springblade.business.entity.*;
 import org.springblade.business.feign.ContractLogClient;
@@ -79,7 +78,6 @@ import org.springframework.data.redis.core.StringRedisTemplate;
 import org.springframework.jdbc.core.BeanPropertyRowMapper;
 import org.springframework.jdbc.core.JdbcTemplate;
 import org.springframework.jdbc.datasource.DataSourceTransactionManager;
-import org.springframework.scheduling.annotation.Async;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.TransactionDefinition;
 import org.springframework.transaction.TransactionStatus;
@@ -1249,7 +1247,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
                     if (wbsTreeContractByP != null) {
                         //处理文件提名
                         String fileName = this.wbsParamService.createFileTitle(wbsTreeContractByP);
-                        if(wbsTreeContract.getMajorDataType()!=null&&wbsTreeContract.getMajorDataType()==4){
+                        if(wbsTreeContract.getMajorDataType()!=null&&wbsTreeContract.getMajorDataType()==6){
                             String sql1="Select sg_suffix,jl_suffix from m_project_info where id="+wbsTreeContractByP.getProjectId()+" and is_deleted=0";
                             List<ProjectInfo> query = jdbcTemplate.query(sql1, new BeanPropertyRowMapper<>(ProjectInfo.class));
                             if(query.size()>0){
@@ -1296,7 +1294,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
                         .eq(WbsTreeContract::getId, wbsTreeContract.getParentId()).eq(WbsTreeContract::getContractId, wbsTreeContract.getContractId()));
                 //处理文件提名
                 fileName1= this.wbsParamService.createFileTitle(wbsTreeContractByP);
-                if(wbsTreeContract.getMajorDataType()!=null&&wbsTreeContract.getMajorDataType()==6){
+                if(wbsTreeContractByP.getMajorDataType()!=null&&wbsTreeContractByP.getMajorDataType()==4){
                     String sql1="Select sg_suffix,jl_suffix from m_project_info where id="+wbsTreeContractByP.getProjectId()+" and is_deleted=0";
                     List<ProjectInfo> query = jdbcTemplate.query(sql1, new BeanPropertyRowMapper<>(ProjectInfo.class));
                     if(query.size()>0){
@@ -1320,7 +1318,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
                 //保存操作记录
                 this.operationLogClient.saveUserOperationLog(1, "资料填报", "工序填报页面", json);
                 // 更新redis
-//                informationQueryClient.AsyncWbsTree(wbsTreeContractByP.getParentId() + "", wbsTreeContractByP.getParentId() + "", wbsTreeContractByP.getContractId(), "", "1");
+                informationQueryClient.AsyncWbsTree(wbsTreeContractByP.getParentId() + "", wbsTreeContractByP.getParentId() + "", wbsTreeContractByP.getContractId(), "", "1");
             } catch (Exception e) {
                 e.printStackTrace();
                 return R.fail("操作失败");
@@ -2372,11 +2370,10 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
         }
 
         //附件
-//        TableFile tableFile1 = tableFileService.getBaseMapper().selectList(Wrappers.<TableFile>query().lambda().eq(TableFile::getTabId, pkeyId + "").eq(TableFile::getType, 1)).stream().findAny().orElse(null);
-//        if (tableFile1 != null) {
-//            tableFileService.update(Wrappers.<TableFile>lambdaUpdate().set(TableFile::getDomainPdfUrl, bladeFile.getLink()).eq(TableFile::getId, tableFile1.getId()));
-//        } else
-        {
+        TableFile tableFile1 = tableFileService.getBaseMapper().selectList(Wrappers.<TableFile>query().lambda().eq(TableFile::getTabId, pkeyId + "").eq(TableFile::getType, 1)).stream().findAny().orElse(null);
+        if (tableFile1 != null) {
+            tableFileService.update(Wrappers.<TableFile>lambdaUpdate().set(TableFile::getDomainPdfUrl, bladeFile.getLink()).eq(TableFile::getId, tableFile1.getId()));
+        } else {
             TableFile tableFile = new TableFile();
             String fileExtension = FileUtil.getFileExtension(wbsTreeContract.getFullName() + ".pdf");
             tableFile.setTabId(pkeyId + "");
@@ -2386,8 +2383,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
             tableFile.setIsDeleted(0);
             tableFile.setExtension(fileExtension);
             tableFile.setDomainPdfUrl(bladeFile.getLink());
-            tableFileService.remove(Wrappers.<TableFile>query().lambda().eq(TableFile::getTabId, pkeyId + "").eq(TableFile::getType, 1));
-            tableFileService.save(tableFile);
+            tableFileService.saveOrUpdate(tableFile);
         }
 
         List<TableFile> tableFileList = tableFileService.getBaseMapper().selectList(Wrappers.<TableFile>query().lambda().eq(TableFile::getTabId, pkeyId + "").eq(TableFile::getIsDeleted, 0));
@@ -2453,7 +2449,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
             }
         }
 
-        String listPdf = file_path + "/pdf/" + nodeId + "_" + classify + ".pdf";
+        String listPdf = file_path + "/pdf/" + nodeId + ".pdf";
         File tabpdf2 = ResourceUtil.getFile(listPdf);
         if (tabpdf2.exists()) {
             tabpdf2.delete();
@@ -2635,59 +2631,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
             htmlString = htmlString.replaceAll("title", "titlexx");
             Document doc = Jsoup.parse(htmlString);
             keyNames= getKeyNameList(doc);
-            TrialSelfInspectionRecord record = jdbcTemplate.query("select * from u_trial_self_inspection_record where id = " + groupId, new BeanPropertyRowMapper<>(TrialSelfInspectionRecord.class)).stream().findAny().orElse(null);
-            // 优先使用试验记录中的委托单和样品
-            TrialSeleInspectionRecordBaseInfoDTO baseInfoDTO = null;
-            if (record != null) {
-                if (record.getBaseInfo() != null && !record.getBaseInfo().isEmpty()) {
-                    try {
-                        baseInfoDTO = JSON.parseObject(record.getBaseInfo(), TrialSeleInspectionRecordBaseInfoDTO.class);
-                    } catch (Exception e) {
-                        log.warn("JSON反序列化失败:" + record.getBaseInfo());
-                    }
-                }
-                EntrustInfo entrustInfo = null;
-                Long sampleId = null;
-                if (record.getEntrustId() != null) {
-                    String sql = "select * from u_entrust_info where id ="+ record.getEntrustId();
-                    try {
-                        entrustInfo = jdbcTemplate.queryForObject(sql,new BeanPropertyRowMapper<>(EntrustInfo.class));
-                    } catch (Exception e) {
-                        log.warn("委托单查询失败:" + record.getEntrustId());
-                    }
-                }
-                if (entrustInfo == null) {
-                    entrustInfo = new EntrustInfo();
-                }
-                if (baseInfoDTO != null && StringUtil.hasText(baseInfoDTO.getEntrustNo())) {
-                    entrustInfo.setEntrustNo(baseInfoDTO.getEntrustNo());
-                }
-                TrialSampleInfo sampleInfo;
-                if (baseInfoDTO != null && baseInfoDTO.getTrialSampleInfo() != null) {
-                    sampleInfo = baseInfoDTO.getTrialSampleInfo();
-                    sampleId = sampleInfo.getId();
-                } else {
-                    sampleId = entrustInfo.getSampleId();
-                    String querySql1 = "select * from u_trial_sample_info where id=" + sampleId ;
-                    try {
-                        sampleInfo = jdbcTemplate.queryForObject(querySql1, new BeanPropertyRowMapper<>(TrialSampleInfo.class));
-                    } catch (Exception e) {
-                        sampleInfo = null;
-                    }
-                }
-                TrialMaterialMobilization trialMaterialMobilization = null;
-                if (sampleInfo != null) {
-                    //用sampleId查询出关联的材料对象
-                    String querySql2 = "select * from u_trial_material_mobilization where id =(select mobilization_id from u_trial_sampling_record where sample_info_id = "+sampleId+") ";
-                    try {
-                        trialMaterialMobilization = jdbcTemplate.queryForObject(querySql2, new BeanPropertyRowMapper<>(TrialMaterialMobilization.class));
-                    } catch (DataAccessException e) {
-                        e.printStackTrace();
-                    }
-                }
-                //通过html获取页面上的key值 返回key值对应的数据
-                setBasicFormData(doc, reData, sampleInfo, trialMaterialMobilization, entrustInfo, false);
-            } else if(entrustId != null){
+            if(entrustId != null){
                 //有委托单信息是从实验报告关联委托单进来的 通过委托单查询到具体的样品id
                 String sql = "select * from u_entrust_info where id ="+entrustId;
                 EntrustInfo entrustInfo = jdbcTemplate.queryForObject(sql,new BeanPropertyRowMapper<>(EntrustInfo.class));
@@ -2713,7 +2657,6 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
                 trialSelfInspectionRecordDTO.setContractId(contractId);
                 trialSelfInspectionRecordDTO.setNodeId(nodeId);
                 trialSelfInspectionRecordDTO.setType(type);
-                trialSelfInspectionRecordDTO.setId(groupId);
                 HashMap<String, String> stringStringHashMap = trialSelfInspectionRecordClient.previewGeneratedReportOrRecordNum(trialSelfInspectionRecordDTO);
                 String mapType = stringStringHashMap.get("type");
                 if("报告单".equals(mapType)){
@@ -2745,29 +2688,17 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
             ContractInfo contractInfo = jdbcTemplate.query("select construction_unit_name,supervision_unit_name,contract_name,laboratory_name,is_test_record from m_contract_info where id = " + contractId, new BeanPropertyRowMapper<>(ContractInfo.class)).stream().findAny().orElse(null);
             if (contractInfo != null) {
                 //承包单位
-                String constructionUnitName = "";
-                if (baseInfoDTO != null && ObjectUtils.isNotEmpty(baseInfoDTO.getConstructionUnit())) {
-                    constructionUnitName = baseInfoDTO.getConstructionUnit();
-                } else if (ObjectUtils.isNotEmpty(contractInfo.getConstructionUnitName())) {
-                    constructionUnitName = contractInfo.getConstructionUnitName();
-                }
                 if (cbdwBH.size() >= 1) {
                     for (Element element : cbdwBH) {
-                        reData.put(element.attr("keyname"), constructionUnitName);
+                        reData.put(element.attr("keyname"), ObjectUtils.isNotEmpty(contractInfo.getConstructionUnitName()) ? contractInfo.getConstructionUnitName() : "");
                         break;
                     }
                 }
 
                 //监理单位
-                String supervisionUnitName = "";
-                if (baseInfoDTO != null && ObjectUtils.isNotEmpty(baseInfoDTO.getSupervisionUnit())) {
-                    supervisionUnitName = baseInfoDTO.getSupervisionUnit();
-                } else if (ObjectUtils.isNotEmpty(contractInfo.getSupervisionUnitName())) {
-                    supervisionUnitName = contractInfo.getSupervisionUnitName();
-                }
                 if (jldwBH.size() >= 1) {
                     for (Element element : jldwBH) {
-                        reData.put(element.attr("keyname"), supervisionUnitName);
+                        reData.put(element.attr("keyname"), ObjectUtils.isNotEmpty(contractInfo.getSupervisionUnitName()) ? contractInfo.getSupervisionUnitName() : "");
                         break;
                     }
                 }
@@ -2775,7 +2706,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
                 //施工单位
                 if (sgName.size() >= 1) {
                     for (Element element : sgName) {
-                        reData.put(element.attr("keyname"), constructionUnitName);
+                        reData.put(element.attr("keyname"), ObjectUtils.isNotEmpty(contractInfo.getConstructionUnitName()) ? contractInfo.getConstructionUnitName() : "");
                         break;
                     }
                 }
@@ -2783,35 +2714,23 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
                 //委托单位
                 if (wtName.size() >= 1) {
                     for (Element element : wtName) {
-                        reData.put(element.attr("keyname"), supervisionUnitName);
+                        reData.put(element.attr("keyname"), ObjectUtils.isNotEmpty(contractInfo.getSupervisionUnitName()) ? contractInfo.getSupervisionUnitName() : "");
                         break;
                     }
                 }
 
                 //检测单位名称
                 if (jcdwName.size() >= 1) {
-                    String laboratoryName = "";
-                    if (baseInfoDTO != null && ObjectUtils.isNotEmpty(baseInfoDTO.getLabName())) {
-                        laboratoryName = baseInfoDTO.getLabName();
-                    } else if (ObjectUtils.isNotEmpty(contractInfo.getLaboratoryName())) {
-                        laboratoryName = contractInfo.getLaboratoryName();
-                    }
                     for (Element element : jcdwName) {
-                        reData.put(element.attr("keyname"), laboratoryName);
+                        reData.put(element.attr("keyname"), ObjectUtils.isNotEmpty(contractInfo.getLaboratoryName()) ? contractInfo.getLaboratoryName() : "");
                         break;
                     }
                 }
 
                 //合同段/工区
                 if (htdName.size() >= 1) {
-                    String contractName = "";
-                    if (baseInfoDTO != null && ObjectUtils.isNotEmpty(baseInfoDTO.getContractName())) {
-                        contractName = baseInfoDTO.getContractName();
-                    } else if (ObjectUtils.isNotEmpty(contractInfo.getContractName())) {
-                        contractName = contractInfo.getContractName();
-                    }
                     for (Element element : htdName) {
-                        reData.put(element.attr("keyname"), contractName);
+                        reData.put(element.attr("keyname"), ObjectUtils.isNotEmpty(contractInfo.getContractName()) ? contractInfo.getContractName() : "");
                         break;
                     }
                 }
@@ -2820,18 +2739,14 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
                 if (projectInfo != null) {
                     //工程名称
                     if (gcName.size() >= 1) {
-                        String projectName = "";
-                        if (baseInfoDTO != null && ObjectUtils.isNotEmpty(baseInfoDTO.getProjectName())) {
-                            projectName = baseInfoDTO.getProjectName();
-                        } else if (ObjectUtils.isNotEmpty(projectInfo.getProjectName())) {
-                            projectName = projectInfo.getProjectName();
-                        }
                         for (Element element : gcName) {
-                            reData.put(element.attr("keyname"), projectName);
+                            reData.put(element.attr("keyname"), ObjectUtils.isNotEmpty(projectInfo.getProjectName()) ? projectInfo.getProjectName() : "");
                             break;
                         }
                     }
                 }
+
+                TrialSelfInspectionRecord record = jdbcTemplate.query("select record_no,report_no from u_trial_self_inspection_record where id = " + groupId, new BeanPropertyRowMapper<>(TrialSelfInspectionRecord.class)).stream().findAny().orElse(null);
                 if (record != null) {
                     //报告编号
                     if (bgBH.size() >= 1) {
@@ -3340,14 +3255,14 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
             //报告编号
             if (bgHB.size() >= 1 && StringUtils.isNotEmpty(dto.getReportNo())) {
                 for (Element element : bgHB) {
-                   // DataInfo.put(element.attr("keyname"), "NUMBER-" + dto.getReportNo());
+                    DataInfo.put(element.attr("keyname"), "NUMBER-" + dto.getReportNo());
                     break;
                 }
             }
             //记录编号
             if (jlBH.size() >= 1 && StringUtils.isNotEmpty(dto.getRecordNo())) {
                 for (Element element : jlBH) {
-                   // DataInfo.put(element.attr("keyname"), "NUMBER-" + dto.getRecordNo());
+                    DataInfo.put(element.attr("keyname"), "NUMBER-" + dto.getRecordNo());
                     break;
                 }
             }

+ 842 - 0
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/ServicePlanServiceImpl.java

@@ -0,0 +1,842 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.manager.service.impl;
+
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.mixsmart.utils.ListUtils;
+import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang3.ObjectUtils;
+import org.apache.poi.ss.usermodel.*;
+import org.apache.poi.ss.util.CellRangeAddress;
+import org.apache.poi.util.IOUtils;
+import org.jsoup.Jsoup;
+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.EntrustInfo;
+import org.springblade.business.entity.TrialMaterialMobilization;
+import org.springblade.business.entity.TrialSampleInfo;
+import org.springblade.business.entity.TrialSelfInspectionRecord;
+import org.springblade.common.constant.CommonConstant;
+import org.springblade.common.utils.CommonUtil;
+import org.springblade.common.utils.SnowFlakeUtil;
+import org.springblade.common.vo.DataVO;
+import org.springblade.core.log.exception.ServiceException;
+import org.springblade.core.oss.model.BladeFile;
+import org.springblade.core.secure.utils.AuthUtil;
+import org.springblade.core.secure.utils.SecureUtil;
+import org.springblade.core.tool.api.R;
+import org.springblade.core.tool.utils.*;
+import org.springblade.manager.bean.TableInfo;
+import org.springblade.manager.dto.ServicePlanDTO;
+import org.springblade.manager.dto.ServiceUserDto;
+import org.springblade.manager.entity.*;
+import org.springblade.manager.utils.FileUtils;
+import org.springblade.manager.vo.ServicePlanVO;
+import org.springblade.manager.mapper.ServicePlanMapper;
+import org.springblade.manager.service.IServicePlanService;
+import org.springblade.core.mp.base.BaseServiceImpl;
+import org.springblade.resource.feign.NewIOSSClient;
+import org.springblade.system.cache.ParamCache;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.autoconfigure.amqp.RabbitTemplateConfigurer;
+import org.springframework.dao.DataAccessException;
+import org.springframework.jdbc.core.BeanPropertyRowMapper;
+import org.springframework.jdbc.core.JdbcTemplate;
+import org.springframework.jdbc.datasource.DataSourceTransactionManager;
+import org.springframework.stereotype.Service;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import org.springframework.transaction.TransactionDefinition;
+import org.springframework.transaction.TransactionStatus;
+import org.springframework.transaction.support.DefaultTransactionDefinition;
+
+import javax.annotation.Resource;
+import java.io.*;
+import java.text.SimpleDateFormat;
+import java.time.LocalDate;
+import java.time.format.DateTimeFormatter;
+import java.util.*;
+import java.util.stream.Collectors;
+
+/**
+ *  服务实现类
+ *
+ * @author BladeX
+ * @since 2025-06-25
+ */
+@Service
+public class ServicePlanServiceImpl extends BaseServiceImpl<ServicePlanMapper, ServicePlan> implements IServicePlanService {
+    @Resource
+    private  JdbcTemplate jdbcTemplate;
+    @Autowired
+    private DataSourceTransactionManager transactionManager1;
+    @Autowired
+    private  NewIOSSClient newIOSSClient;
+
+	@Override
+	public IPage<ServicePlanVO> selectServicePlanPage(IPage<ServicePlanVO> page, ServicePlanDTO servicePlan) {
+        servicePlan.setUserId(SecureUtil.getUserId()+"");
+        List<ServicePlan> vos = baseMapper.selectServicePlanPage(page, servicePlan);
+        List<ServicePlanVO>voList = new ArrayList<>();
+        for (ServicePlan sp : vos) {
+            ServicePlanVO vo = new ServicePlanVO();
+            BeanUtil.copyProperties(sp, vo);
+           vo.setStatusValue(vo.getStatus()==1?"计划中":vo.getStatus()==2?"协同中-甲方":vo.getStatus()==3?"协同中-系统":"已计划");
+           vo.setIsEdit(checkIsEdit(vo));
+           vo.setStartTime(vo.getPlanStartTime().format(DateTimeFormatter.ofPattern("yyyy年M月d日")));
+           vo.setEndTime(vo.getPlanEndTime().format(DateTimeFormatter.ofPattern("yyyy年M月d日")));
+           vo.setPlanTime(vo.getStartTime()+"至"+vo.getEndTime());
+           vo.setSendUserName(slectUserName(vo.getSendUser()));
+            voList.add( vo);
+        }
+        return page.setRecords(voList);
+	}
+
+
+
+    private String slectUserName(String sendUser) {
+        if(StringUtils.isNotEmpty(sendUser)){
+            String sql="select real_name from blade_user where id in("+sendUser+")";
+            List<String> list = jdbcTemplate.queryForList(sql, String.class);
+            if(!list.isEmpty()){
+                return list.stream().collect(Collectors.joining(","));
+            }
+        }
+        return "";
+    }
+
+    private Boolean checkIsEdit(ServicePlanVO vo) {
+        if(vo.getStatus()==1){
+            return true;
+        }else if(vo.getStatus()==2){
+            if(StringUtils.isNotEmpty(vo.getSendUser())){
+                return vo.getSendUser().contains(SecureUtil.getUserId()+"");
+            }
+        }else if(vo.getStatus()==2){
+            if(StringUtils.isNotEmpty(vo.getSendUser())){
+                return vo.getWriteUser().contains(SecureUtil.getUserId()+"");
+            }
+        }else {
+            return false;
+        }
+        return true;
+    }
+
+    @Override
+    public String getServiceHtml(Long projectId, Long contractId,Long pkeyId) {
+        String sql="select * from m_wbs_tree_contract where p_key_id="+pkeyId;
+        WbsTreeContract wbsTreeContract = jdbcTemplate.queryForObject( sql, new BeanPropertyRowMapper<>(WbsTreeContract.class));
+        if (wbsTreeContract == null) {
+            throw new ServiceException("暂无表单");
+        }
+        if (wbsTreeContract.getHtmlUrl() == null) {
+            throw new ServiceException("暂无表单");
+        }
+        try {
+            String fileUrl = wbsTreeContract.getHtmlUrl();
+            InputStream fileInputStream = FileUtils.getInputStreamByUrl(fileUrl);
+            String htmlString = IoUtil.readToString(fileInputStream);
+            htmlString = htmlString.replaceAll("placeholder", "placeholderxx");
+            htmlString = htmlString.replaceAll("title", "titlexx");
+
+            // 远程搜索配置
+            Document doc = Jsoup.parse(htmlString);
+            Element table = doc.select("table").first();
+            // 标题解决
+            String sql1="select * from m_project_info where id="+projectId;
+            ProjectInfo projectInfo = jdbcTemplate.queryForObject(sql1,new BeanPropertyRowMapper<>(ProjectInfo.class));
+            //判断是否是水利水电表,水利水电项目名14,表名12 。   其他表都是18
+            Boolean isWater = false;
+            // 添加标题显示
+            Elements trs = table.select("tr");
+            for (int i = 1; i < 6; i++) {
+                Element tr = trs.get(i);
+                Elements tds = tr.select("td");
+                for (int j = 0; j < tds.size(); j++) {
+                    Element data = tds.get(j);
+                    String style = data.attr("style");
+                    if (style.indexOf("font-size") >= 0) {
+                        int fontsize = Integer.parseInt(style.substring(style.indexOf("font-size:") + 10, style.indexOf(".0pt")));
+                        Element element = null;
+                        if (isWater) {
+                            if (StringUtils.isNotEmpty(data.text()) && fontsize >= 12) {
+                                element = trs.get(i - 1).select("td").get(0);
+
+                            }
+                        } else {
+                            if (StringUtils.isNotEmpty(data.text()) && fontsize >= 14) {
+                                element = trs.get(i - 1).select("td").get(0);
+                            }
+                        }
+                        if (element != null && Func.isNotEmpty(element)) {
+                            //
+                            Elements allElements = element.children();
+                            if (allElements.size() >= 1) {
+                                String defText = allElements.get(0).attr("deftext");
+                                if (defText != null && Func.isNotEmpty(defText)) {
+                                    element.text(defText);
+                                } else {
+                                    element.text(projectInfo.getProjectName());
+                                }
+                            } else {
+                                element.text(projectInfo.getProjectName());
+                            }
+                        }
+                    }
+                }
+            }
+            fileInputStream.close();
+            return table + "";
+        } catch (Exception e) {
+            throw new ServiceException("暂无表单");
+        }
+    }
+
+    @Override
+    public boolean saveServiceData(List<TableInfo> tableInfoList,Long groupId,Long  pkeyId) {
+        if (ListUtils.isNotEmpty(tableInfoList)) {
+            for (TableInfo tableInfo : tableInfoList) {
+                String sql="select * from m_wbs_tree_contract where p_key_id="+pkeyId;
+                WbsTreeContract wbsTreeContract = jdbcTemplate.queryForObject( sql, new BeanPropertyRowMapper<>(WbsTreeContract.class));
+                if (wbsTreeContract == null || StringUtils.isEmpty(wbsTreeContract.getInitTableName())) {
+                    continue;
+                }
+                //删除SQL
+                String delSql = "delete from " + wbsTreeContract.getInitTableName() + " where p_key_id='" + pkeyId + "' and group_id = '" + groupId + "'";
+
+                //新增SQ
+                String sqlInfo = "";
+                LinkedHashMap<String, String> dataMap2 = tableInfo.getDataMap();
+                sqlInfo = "INSERT INTO " + wbsTreeContract.getInitTableName() + " ( ";
+                String keyStr = "id,p_key_id,group_id,";
+                String valStr = SnowFlakeUtil.getId() + "," + pkeyId + ","+groupId+",";
+                if(dataMap2.containsKey("p_key_id")){
+                    dataMap2.remove("p_key_id");
+                }
+                for (String keys : dataMap2.keySet()) {
+                    keyStr += keys + ",";
+                    valStr += "'" + dataMap2.get(keys) + "',";
+                }
+                keyStr = keyStr.substring(0, keyStr.lastIndexOf(","));
+                valStr = valStr.substring(0, valStr.lastIndexOf(","));
+                sqlInfo = sqlInfo + keyStr + ") VALUES (" + valStr + ")";
+                TransactionStatus transactionStatus = this.beginTransaction(transactionManager1);
+                try {
+                    //删除
+                    jdbcTemplate.execute(delSql);
+                    //新增
+                    jdbcTemplate.execute(sqlInfo);
+                    //提交事务
+                    transactionManager1.commit(transactionStatus);
+                } catch (Exception e) {
+                    //回滚
+                    transactionManager1.rollback(transactionStatus);
+                    throw new RuntimeException("500"+e.getCause().getMessage()+"  字段过长,新增失败");
+                }
+            }
+        }
+        return true;
+    }
+
+    @Override
+    public void saveServicePlanPdf(Long projectId,Long pkeyId, Long id) throws Exception {
+        String file_path = FileUtils.getSysLocalFileUrl();//ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
+        String sys_file_net_url = ParamCache.getValue(CommonConstant.SYS_FILE_NET_URL);
+        String sql="select * from m_wbs_tree_contract where p_key_id="+pkeyId;
+        WbsTreeContract wbsTreeContract = jdbcTemplate.queryForObject( sql, new BeanPropertyRowMapper<>(WbsTreeContract.class));
+        if (wbsTreeContract == null) {
+            throw new ServiceException("该数据下无此节点!");
+        }
+        if (wbsTreeContract.getHtmlUrl() == null) {
+            throw new ServiceException("请关联清表!");
+        }
+        String pdfPath = file_path + "/pdf//" + pkeyId + ".pdf";
+        String excelPath = file_path + "/pdf//" + pkeyId + ".xlsx";
+        File tabPdf = ResourceUtil.getFile(pdfPath);
+        if (tabPdf.exists()) {
+            tabPdf.delete();
+        }
+        String sql1="select * from m_excel_tab where id="+wbsTreeContract.getExcelId();
+        //获取清表信息
+        ExcelTab excelTab =jdbcTemplate.queryForObject( sql1, new BeanPropertyRowMapper<>(ExcelTab.class));
+
+        if (excelTab == null) {
+            throw new ServiceException("操作失败!");
+        }
+
+        //获取数据信息info
+        List<Map<String, Object>> bussDataInfoTrial = this.getBussDataInfoTrial(pkeyId,id);
+        Map<String, Object> DataInfo = new HashMap<>();
+        if (bussDataInfoTrial.size() > 0) {
+            DataInfo.putAll(bussDataInfoTrial.stream().findAny().orElse(null));
+        }
+
+        //获取清表excel文件
+        org.apache.poi.ss.usermodel.Workbook workbook = WorkbookFactory.create(Objects.requireNonNull(CommonUtil.getOSSInputStreamTow(excelTab.getFileUrl())));
+        Sheet sheet = workbook.getSheetAt(0);
+        sheet.setForceFormulaRecalculation(true);
+
+       String sql2="select * from m_project_info where id="+projectId;
+       ProjectInfo projectInfo = jdbcTemplate.queryForObject(sql2, new BeanPropertyRowMapper<>(ProjectInfo.class));
+        int all = sheet.getRow(0).getLastCellNum();
+        int mergedCellCnt = sheet.getNumMergedRegions();
+        for (
+            int i = 0;
+            i < mergedCellCnt - 1; i++) {
+            CellRangeAddress mergedCell = sheet.getMergedRegion(i);
+            int xx = mergedCell.getNumberOfCells();
+            if (xx <= all) {
+                int fisRow = mergedCell.getFirstRow();
+                int firstCol = mergedCell.getFirstColumn();
+                Cell cell = sheet.getRow(fisRow).getCell(firstCol);
+                short fontIndex = cell.getCellStyle().getFontIndex();
+                Font oldFontAt = workbook.getFontAt(fontIndex);
+                Font redFont = workbook.createFont();
+                redFont.setFontHeightInPoints(oldFontAt.getFontHeightInPoints());//设置字体大小
+                redFont.setFontName(oldFontAt.getFontName());//设置字体
+                CellStyle newStyle = workbook.createCellStyle();//创建单元格样式
+                newStyle.cloneStyleFrom(cell.getCellStyle());
+                short fontHeightInPoints = redFont.getFontHeightInPoints();
+                if (fontHeightInPoints >= 14 && StringUtils.isEmpty(cell.getStringCellValue()) && fisRow <= 8) {
+                    String title = projectInfo.getProjectName();
+                    if (title.length() >= 30) {
+                        sheet.getRow(fisRow).setHeight((short) 900);
+                        newStyle.setWrapText(true);
+                    }
+                    redFont.setBold(true);
+                    newStyle.setFont(redFont);
+                    cell.setCellStyle(newStyle);
+                    cell.setCellValue(title);
+                    break;
+                }
+            }
+        }
+
+        //数据不为空,构造数据
+        String fileUrl = wbsTreeContract.getHtmlUrl();
+        InputStream fileInputStream = FileUtils.getInputStreamByUrl(fileUrl);
+
+        String htmlString = IoUtil.readToString(fileInputStream);
+        htmlString = htmlString.replaceAll("placeholder", "placeholderxx");
+        htmlString = htmlString.replaceAll("title", "titlexx");
+
+        Document doc = Jsoup.parse(htmlString);
+        Element table = doc.select("table").first();
+        Elements trs = table.select("tr");
+
+        if (ObjectUtil.isNotEmpty(DataInfo)) {
+            for (String val : Objects.requireNonNull(DataInfo).keySet()) {
+                if (val.contains("__")) {
+                    String[] DataVal = val.split("__");
+                    String[] xy = DataVal[1].split("_");
+                    if (Integer.parseInt(xy[0]) < trs.size()) {
+                        Element ytzData = trs.get(Integer.parseInt(xy[0]));
+                        if (ytzData != null) {
+                            Elements tdsx = ytzData.select("td");
+                            if (Integer.parseInt(xy[1]) < tdsx.size()) {
+                                Element data = ytzData.select("td").get(Integer.parseInt(xy[1]));
+                                if (data != null) {
+                                    if (data.html().contains("x1") && data.html().contains("y1")) {
+                                        int x1 = 0;
+                                        int x2 = 0;
+                                        int y1 = 0;
+                                        int y2 = 0;
+                                        if (data.html().contains("el-tooltip")) {
+                                            x1 = Integer.parseInt(data.children().get(0).children().get(0).attr("x1"));
+                                            x2 = Integer.parseInt(data.children().get(0).children().get(0).attr("x2"));
+                                            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 = DataInfo.get(val) + "";
+                                        if (myData.contains("T") && myData.contains("-") && myData.contains(":")) {
+                                            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
+                                            sdf.setTimeZone(TimeZone.getTimeZone("GTM+8"));
+                                            SimpleDateFormat formatStr = new SimpleDateFormat("yyyy年MM月dd日");
+                                            if (myData.contains(",") && myData.contains("]")) {
+
+                                                myData = myData.replace("[", "").replace("]", "").replaceAll("'", "");
+                                                String[] dataVal = myData.split(",");
+
+                                                Date Start_dataStr = sdf.parse(dataVal[0]);
+                                                Date end_dataStr = sdf.parse(dataVal[1]);
+                                                String StartDate = formatStr.format(Start_dataStr);
+                                                String endDate = formatStr.format(end_dataStr);
+                                                if (StartDate.equals(endDate)) {
+                                                    myData = StartDate;
+                                                } else {
+                                                    myData = StartDate + "-" + endDate;
+                                                }
+                                            } else {
+                                                String[] dataStr = myData.split("T")[0].split("-");
+                                                myData = StringUtil.format("{}年{}月{}日", dataStr[0], dataStr[1], Integer.parseInt(dataStr[2]));
+                                            }
+                                        }
+
+                                        if (myData.contains("lang.String")) {
+                                            Object obj = DataInfo.get(val);
+                                            if (obj instanceof String[]) {
+                                                String[] dataDate = (String[]) obj;
+                                                myData = dataDate[0].trim() + "-" + dataDate[1].trim();
+                                                if (dataDate[0].trim().equals(dataDate[1].trim())) {
+                                                    myData = dataDate[0];
+                                                }
+                                            }
+                                        }
+
+                                        if (myData.contains("http") && myData.contains("aliyuncs")) {
+                                            InputStream imageIn = CommonUtil.getOSSInputStream(myData);
+                                            byte[] byteNew = new byte[0];
+                                            if (imageIn != null) {
+                                                byteNew = IOUtils.toByteArray(imageIn);
+                                            }
+
+                                            byte[] bytes = CommonUtil.compressImage(byteNew);
+
+                                            CreationHelper helper = workbook.getCreationHelper();
+                                            ClientAnchor anchor = helper.createClientAnchor();
+                                            anchor.setCol1(x1); // param1是列号
+                                            anchor.setCol2(x2);
+                                            anchor.setRow1(y1); // param2是行号
+                                            anchor.setRow2(y2); // param2是行号
+
+                                            Drawing<?> drawing = sheet.createDrawingPatriarch();
+                                            anchor.setAnchorType(ClientAnchor.AnchorType.MOVE_AND_RESIZE);
+                                            // 插入图片
+                                            Picture picture = drawing.createPicture(anchor, workbook.addPicture(bytes, Workbook.PICTURE_TYPE_PNG));
+                                            picture.resize(1, 1);
+                                            FileUtils.imageOrientation(sheet, anchor, new DataVO(x1 - 1, y1 - 1));
+
+                                        } else if (myData.equals("1") && data.html().contains("hc-form-checkbox-group")) {
+                                            Row row = sheet.getRow(y1 - 1);
+                                            if (row != null) {
+                                                Cell cell = row.getCell(x1 - 1);
+                                                if (cell != null) {
+                                                    String exceVal = cell.getStringCellValue().replaceAll(" ", "");
+                                                    short fontIndex = cell.getCellStyle().getFontIndex();
+                                                    Font fontAt = workbook.getFontAt(fontIndex);
+                                                    fontAt.setFontName("EUDC");
+                                                    cell.setCellValue(exceVal.replace("□", "\u2611"));
+                                                } else {
+                                                    ObjectUtils.isNotEmpty(cell);
+                                                }
+                                            }
+                                        } else {
+                                            Row row = sheet.getRow(y1 - 1);
+                                            if (row != null) {
+                                                Cell cell = row.getCell(x1 - 1);
+                                                if (cell != null) {
+                                                    cell.setCellValue(myData);
+                                                } else {
+                                                    ObjectUtils.isNotEmpty(cell);
+                                                }
+                                            }
+                                        }
+                                    }
+                                }
+                            }
+                        }
+                    }
+                }
+            }
+        }
+        //输出流
+        FileOutputStream outputStream = new FileOutputStream(excelPath);
+        workbook.write(outputStream);
+        FileUtils.setExcelScaleToPdf(excelPath, pdfPath);
+        BladeFile bladeFile = newIOSSClient.uploadFile(id + ".pdf", pdfPath);
+        if (bladeFile != null) {
+            String sql3="update m_service_plan set pdf_url=' "+bladeFile.getLink()+" ' where id="+id;
+            jdbcTemplate.update(sql3);
+        }
+
+    }
+
+    @Override
+    public List<Map<String, Object>> getServiceBussData(Long id, Long pkeyId) {
+        List<Map<String, Object>> list = new ArrayList<>();
+        Map<String, Object> reData = new HashMap<>();
+        String sqll="select * from m_wbs_tree_contract where p_key_id="+pkeyId;
+        WbsTreeContract wbsTreeContract = jdbcTemplate.queryForObject(sqll, new BeanPropertyRowMapper<>(WbsTreeContract.class));
+        if (wbsTreeContract == null) {
+            throw new ServiceException("该数据下无此节点!");
+        }
+        if (wbsTreeContract.getHtmlUrl() == null) {
+            throw new ServiceException("请关联清表!");
+        }
+        //表单是否存储在
+        String tabName = wbsTreeContract.getInitTableName();
+        String isExitSql = "select * from information_schema.TABLES where TABLE_NAME='" + tabName + "'";
+        List<Map<String, Object>> tabList = jdbcTemplate.queryForList(isExitSql);
+        if (tabList.size() <= 0) {
+            throw new ServiceException("请关联清表!");
+        }
+        //实体数据
+        String querySql = "select * from " + wbsTreeContract.getInitTableName() + " where p_key_id=" + pkeyId + " and group_id = " + id;
+        List<Map<String, Object>> dataIn = jdbcTemplate.queryForList(querySql);
+        //匹配关联
+        try {
+            if (dataIn.size() >= 1) {
+                Map<String, Object> mysqlData = dataIn.get(0);
+                for (String key : mysqlData.keySet()) {
+                    String tabVal = mysqlData.get(key) + "";
+                    // 时间段处理
+                    if (StringUtils.isNotEmpty(tabVal) && !tabVal.equals("null")) {
+                        if (tabVal.contains("T") && tabVal.contains(".000Z]")) {
+                            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 sql = tabData[0];
+                            sql = sql.replaceAll("\\[", "['");
+                            sql = sql.replaceAll("]", "']");
+                            sql = sql.replaceAll("000Z,", "000Z',");
+                            sql = sql.replaceAll(", 20", ", '20");
+                            //   sql = sql.replaceAll("'", "");
+                            if (StringUtils.isNotEmpty(tabData[0])) {
+                                reData.put(key + "__" + tabData[1], sql);
+                            }
+                        } else if (tabVal.indexOf("T") >= 0 && tabVal.indexOf(".000Z") >= 0) {//时间
+                            // 时间和字符串合作
+                            if (tabVal.indexOf("☆") >= 0) {
+                                String[] mysql = tabVal.split("☆");
+                                for (String data : mysql) {
+                                    String[] tabData = data.split("_\\^_");
+                                    if (StringUtils.isNotEmpty(tabData[0])) {
+                                        reData.put(key + "__" + tabData[1], tabData[0]);
+                                    }
+                                }
+                            } else {
+                                String[] tabData = tabVal.split("_\\^_");
+                                if (StringUtils.isNotEmpty(tabData[0])) {
+                                    reData.put(key + "__" + tabData[1], tabData[0]);
+                                }
+                            }
+                        } else if (tabVal.indexOf("☆") >= 0) {
+                            String[] mysql = tabVal.split("☆");
+                            for (String data : mysql) {
+                                String[] tabData = data.split("_\\^_");
+                                if (StringUtils.isNotEmpty(tabData[0])) {
+                                    reData.put(key + "__" + tabData[1], tabData[0]);
+                                }
+                            }
+                        } else if (tabVal.indexOf("_^_") >= 0) {
+                            String[] tabData = tabVal.split("_\\^_");
+                            if (StringUtils.isNotEmpty(tabData[0])) {
+                                if (tabVal.contains("[") && tabVal.contains("年")) {
+                                    String[] strings = StringUtils.strip(tabData[0], "[]").split(",");
+                                    reData.put(key + "__" + tabData[1], strings);
+                                } else {
+                                    reData.put(key + "__" + tabData[1], tabData[0]);
+                                }
+                            }
+                        } else {
+                            reData.put(key, tabVal);
+                        }
+                    }
+                }
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        list.add(reData);
+        return list;
+    }
+
+    @Override
+    public Map<String,List<ServiceUserDto>> getSendUserAndWriteUser(Long projectId, Long contractId) {
+        HashMap<String, List<ServiceUserDto>> map = new HashMap<>();
+        List<String> sendList=baseMapper.getUserID(projectId, contractId,1);
+        List<String> writeList=baseMapper.getUserID(projectId, contractId,2);
+        List<String> sendResult = sendList.stream()
+            .flatMap(str -> Arrays.stream(str.split(",")))
+            .distinct()
+            .sorted()
+            .collect(Collectors.toList());
+        List<String> writedResult = writeList.stream()
+            .flatMap(str -> Arrays.stream(str.split(",")))
+            .distinct()
+            .sorted()
+            .collect(Collectors.toList());
+           map.put("sendUser",  getUserNamesByIds(sendResult));
+           map.put("writeUser",  getUserNamesByIds(writedResult));
+        return map;
+    }
+
+    @Override
+    public Long saveServicePlan(Long pkeyId,Long projectId,Long contractId,JSONObject dataInfo) {
+        ServicePlan plan = new ServicePlan();
+        if(dataInfo.containsKey("key_15__3_4")){
+            Object o = dataInfo.get("key_15__3_4");
+            String startDate = null;
+            String endDate = null;
+            if (o instanceof List<?>) {
+                List<?> list = (List<?>) o;
+                if (list.size() >= 2 && list.get(0) instanceof String && list.get(1) instanceof String) {
+                    startDate = formatDate((String) list.get(0));
+                    endDate = formatDate((String) list.get(1));
+                }
+            } else if (o != null && o.getClass().isArray()) {
+                Object[] array = (Object[]) o;
+                if (array.length >= 2 && array[0] instanceof String && array[1] instanceof String) {
+                    startDate = formatDate((String) array[0]);
+                    endDate = formatDate((String) array[1]);
+                }
+            }
+            if (startDate != null) {
+                plan.setPlanStartTime(LocalDate.parse(startDate));
+            }
+            if (endDate != null) {
+                plan.setPlanEndTime(LocalDate.parse(endDate));
+            }
+        }
+        if(dataInfo.containsKey("group_id")&&dataInfo.get("group_id")!=null&&StringUtils.isNotEmpty(dataInfo.get("group_id").toString())){
+            plan.setId(dataInfo.getLongValue("group_id"));
+            ServicePlan plan1 = this.getById(plan.getId());
+            if(plan1.getWriteUser()!=null){
+                if(!plan1.getWriteUser().contains(SecureUtil.getUserId()+"")){
+                    plan.setWriteUser(plan1.getWriteUser()+","+SecureUtil.getUserId());
+                }
+            }
+            if(plan1.getStatus()!=null){
+                plan.setStatus(plan1.getStatus());
+            }
+        }else {
+            plan.setProjectId(projectId);
+            plan.setContractId(contractId);
+            plan.setStatus(1);
+            plan.setWriteUser(SecureUtil.getUserId()+"");
+            if(pkeyId==1937773223861026820L){
+                plan.setFileInType(1);
+            }else {
+                plan.setFileInType(2);
+            }
+        }
+        this.saveOrUpdate(plan);
+        return plan.getId();
+    }
+    private static String formatDate(String dateStr) {
+        if (dateStr == null || dateStr.trim().isEmpty()) return null;
+        try {
+            // 替换掉“年”、“月”、“日”字符,然后解析为LocalDate
+            return dateStr.replaceAll("年", "-")
+                .replaceAll("月", "-")
+                .replaceAll("日", "")
+                .trim();
+        } catch (Exception e) {
+            e.printStackTrace();
+            return null;
+        }
+    }
+
+    public List<ServiceUserDto> getUserNamesByIds(List<String> sendResult) {
+        if (sendResult == null || sendResult.isEmpty()) {
+            return Collections.emptyList();
+        }
+
+        // 构建 SQL 查询语句
+        String inSql = sendResult.stream()
+            .map(id -> "?")
+            .collect(Collectors.joining(", "));
+
+        String sql = "SELECT id, real_name FROM blade_user WHERE id IN (" + inSql + ")";
+
+        try {
+            List<Map<String, Object>> rows = jdbcTemplate.queryForList(sql, sendResult.toArray());
+
+            return rows.stream()
+                .map(row -> new ServiceUserDto(
+                    row.get("id").toString(),
+                    row.get("real_name").toString()))
+                .collect(Collectors.toList());
+        } catch (DataAccessException e) {
+            // 日志记录异常信息
+            log.error("查询用户信息失败", e);
+            return Collections.emptyList();
+        }
+    }
+
+    private List<Map<String, Object>> getBussDataInfoTrial(Long pkeyId ,Long id) {
+        String file_path = ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
+        String sys_file_net_url = ParamCache.getValue(CommonConstant.SYS_FILE_NET_URL);
+        List<Map<String, Object>> list = new ArrayList<>();
+        Map<String, Object> reData = new HashMap<>();
+        String sqll="select * from m_wbs_tree_contract where p_key_id="+pkeyId;
+        WbsTreeContract wbsTreeContract = jdbcTemplate.queryForObject(sqll, new BeanPropertyRowMapper<>(WbsTreeContract.class));
+        if (wbsTreeContract == null) {
+            return list;
+        }
+        if (wbsTreeContract.getHtmlUrl() == null) {
+            return list;
+        }
+        //表单是否存储在
+        String tabName = wbsTreeContract.getInitTableName();
+        String isExitSql = "select * from information_schema.TABLES where TABLE_NAME='" + tabName + "'";
+        List<Map<String, Object>> tabList = jdbcTemplate.queryForList(isExitSql);
+        if (tabList.size() <= 0) {
+            return list;
+        }
+
+        //实体数据
+        String querySql = "select * from " + wbsTreeContract.getInitTableName() + " where p_key_id=" + pkeyId + " and group_id = " + id;
+        List<Map<String, Object>> dataIn = jdbcTemplate.queryForList(querySql);
+        String keyNames="";
+        //匹配关联
+        try {
+            String fileUrl = wbsTreeContract.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");
+            htmlString = htmlString.replaceAll("title", "titlexx");
+            Document doc = Jsoup.parse(htmlString);
+            keyNames= getKeyNameList(doc);
+                if (dataIn.size() >= 1) {
+                    Map<String, Object> mysqlData = dataIn.get(0);
+                    for (String key : mysqlData.keySet()) {
+                        String tabVal = mysqlData.get(key) + "";
+                        // 时间段处理
+                        if (StringUtils.isNotEmpty(tabVal) && !tabVal.equals("null")) {
+                            if (tabVal.contains("T") && tabVal.contains(".000Z]")) {
+                                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 sql = tabData[0];
+                                sql = sql.replaceAll("\\[", "['");
+                                sql = sql.replaceAll("]", "']");
+                                sql = sql.replaceAll("000Z,", "000Z',");
+                                sql = sql.replaceAll(", 20", ", '20");
+                                //   sql = sql.replaceAll("'", "");
+                                if (StringUtils.isNotEmpty(tabData[0])) {
+                                    reData.put(key + "__" + tabData[1], sql);
+                                }
+                            } else if (tabVal.indexOf("T") >= 0 && tabVal.indexOf(".000Z") >= 0) {//时间
+                                // 时间和字符串合作
+                                if (tabVal.indexOf("☆") >= 0) {
+                                    String[] mysql = tabVal.split("☆");
+                                    for (String data : mysql) {
+                                        String[] tabData = data.split("_\\^_");
+                                        if (StringUtils.isNotEmpty(tabData[0])) {
+                                            reData.put(key + "__" + tabData[1], tabData[0]);
+                                        }
+                                    }
+                                } else {
+                                    String[] tabData = tabVal.split("_\\^_");
+                                    if (StringUtils.isNotEmpty(tabData[0])) {
+                                        reData.put(key + "__" + tabData[1], tabData[0]);
+                                    }
+                                }
+                            } else if (tabVal.indexOf("☆") >= 0) {
+                                String[] mysql = tabVal.split("☆");
+                                for (String data : mysql) {
+                                    String[] tabData = data.split("_\\^_");
+                                    if (StringUtils.isNotEmpty(tabData[0])) {
+                                        reData.put(key + "__" + tabData[1], tabData[0]);
+                                    }
+                                }
+                            } else if (tabVal.indexOf("_^_") >= 0) {
+                                String[] tabData = tabVal.split("_\\^_");
+                                if (StringUtils.isNotEmpty(tabData[0])) {
+                                    if (tabVal.contains("[") && tabVal.contains("年")) {
+                                        String[] strings = StringUtils.strip(tabData[0], "[]").split(",");
+                                        reData.put(key + "__" + tabData[1], strings);
+                                    }else if (tabVal.contains("[") && tabVal.contains("]") ) {
+                                        String[] strings = StringUtils.strip(tabData[0], "[]").split(",");
+                                        reData.put(key + "__" + tabData[1], strings);
+                                    } else {
+                                        reData.put(key + "__" + tabData[1], tabData[0]);
+                                    }
+                                }
+                            } else {
+                                reData.put(key, tabVal);
+                            }
+                        }
+                    }
+                }
+
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        // 移除Id 和 p_key_id
+        reData.remove("id");
+        reData.remove("p_key_id");
+        reData.remove("classify");
+        reData.remove("contractId");
+        reData.remove("pkeyId");
+        reData.remove("projectId");
+        if(reData.size()>0){
+            //处理key重复导致pdf数据错位
+            for (Iterator<Map.Entry<String, Object>> iterator = reData.entrySet().iterator(); iterator.hasNext(); ) {
+                Map.Entry<String, Object> entry = iterator.next();
+                if (!keyNames.equals("") && keyNames.indexOf(entry.getKey()) <0) {
+                    iterator.remove();
+                }
+            }
+        }
+        list.add(reData);
+        return list;
+    }
+    public String getKeyNameList(Document doc){
+        StringBuilder allKeyName=new StringBuilder();
+        Elements select = doc.getElementsByAttributeValueContaining("keyname","key_");
+        if(!select.isEmpty()){
+            for (Element element : select) {
+                String keyName = element.attr("keyname");
+                allKeyName.append(keyName+",");
+            }
+        }
+        String allKeyNames = allKeyName.toString();
+        if(allKeyNames.endsWith(",")){
+            allKeyNames = allKeyNames.substring(0, allKeyNames.length() - 1);
+        }
+        return allKeyNames;
+    }
+
+    public TransactionStatus beginTransaction(DataSourceTransactionManager transactionManager) {
+        DefaultTransactionDefinition def = new DefaultTransactionDefinition();//事务定义类
+        def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED);
+        return transactionManager.getTransaction(def);
+    }
+
+
+
+}

+ 46 - 4
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/WbsSynchronousEViSaServiceImpl.java

@@ -51,14 +51,24 @@ public class WbsSynchronousEViSaServiceImpl {
     }
 
     @Transactional(rollbackFor = Exception.class)
-    public void updateSyncPrivateForm(String htmlUrl, List<Long> collect, Long id) {
+    public void updateSyncPrivateForm(WbsTreePrivate wbsTreePrivate, List<WbsTreePrivate> collect, Long id,String errorMsg) {
+        List<Long> ids = collect.stream().map(WbsTreePrivate::getPKeyId).collect(Collectors.toList());
+        List<Long> parentIds = collect.stream().map(WbsTreePrivate::getParentId).collect(Collectors.toList());
+        //节点公式同步
+        for (Long parentId : parentIds) {
+            saveFormula(Long.valueOf(wbsTreePrivate.getProjectId()), wbsTreePrivate.getParentId(), parentId);
+        }
+
         wbsTreePrivateMapper.update(null, Wrappers.<WbsTreePrivate>lambdaUpdate()
-                .set(WbsTreePrivate::getHtmlUrl, htmlUrl)
-                .in(WbsTreePrivate::getPKeyId, collect)
+                .set(WbsTreePrivate::getHtmlUrl, wbsTreePrivate.getHtmlUrl())
+                .set(wbsTreePrivate.getExcelId()!=null,WbsTreePrivate::getIsLinkTable, 2)
+                .set(WbsTreePrivate::getExcelId, wbsTreePrivate.getExcelId())
+                .set(WbsTreePrivate::getInitTableId, wbsTreePrivate.getInitTableId())
+                .in(WbsTreePrivate::getPKeyId, ids)
         );
         synchronousRecordMapper.update(null, Wrappers.<WbsTreeSynchronousRecord>lambdaUpdate()
                 .set(WbsTreeSynchronousRecord::getStatus, 2)
-                .set(WbsTreeSynchronousRecord::getErrorMsg, null)
+                .set(WbsTreeSynchronousRecord::getErrorMsg, errorMsg)
                 .set(WbsTreeSynchronousRecord::getNodeNumEnd, 1)
                 .set(WbsTreeSynchronousRecord::getUpdateTime, DateTime.now())
                 .eq(WbsTreeSynchronousRecord::getId, id));
@@ -213,4 +223,36 @@ public class WbsSynchronousEViSaServiceImpl {
         elementFormulaMappingService.saveBatch(elementFormulaMappings);
 
     }
+
+    /**
+     * 同项目下不同节点 不同的节点公式
+     * @param projectId 项目id
+     * @param tempParentId 源节点父级id
+     * @param parentId 节点父级id
+     */
+    public void saveFormula(Long projectId, Long tempParentId, Long parentId) {
+
+        List<ElementFormulaMapping> tempElementFormulaMappings = elementFormulaMappingService.list(Wrappers.<ElementFormulaMapping>lambdaQuery()
+                .eq(ElementFormulaMapping::getProjectId, projectId)
+                .in(ElementFormulaMapping::getNodeId, tempParentId));
+        List<ElementFormulaMapping> elementFormulaMappings = elementFormulaMappingService.list(Wrappers.<ElementFormulaMapping>lambdaQuery()
+                .eq(ElementFormulaMapping::getProjectId, projectId)
+                .in(ElementFormulaMapping::getNodeId, parentId));
+        List<Long> collect = elementFormulaMappings.stream().map(ElementFormulaMapping::getElementId).collect(Collectors.toList());
+
+        //当前节点不存在的元素公式
+        List<ElementFormulaMapping> collect1 = tempElementFormulaMappings.stream().filter(f -> !collect.contains(f.getElementId())).collect(Collectors.toList());
+
+
+        collect1.forEach(f -> {
+            f.setId(SnowFlakeUtil.getId());
+            f.setProjectId(projectId);
+            f.setNodeId(parentId);
+            f.setCreateTime(DateTime.now());
+        });
+
+        //复制新增模板节点的公式
+        elementFormulaMappingService.saveBatch(collect1);
+
+    }
 }

+ 15 - 6
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/WbsSynchronousServiceImpl.java

@@ -138,25 +138,34 @@ public class WbsSynchronousServiceImpl {
         if (CollectionUtil.isEmpty(wbsTreePrivates)) {
             throw new ServiceException("当前项目没有相同实体表的其他表单");
         }
+
+        //筛选出有excelid的数据和无excelid的数据
+        List<WbsTreePrivate> collect1 = wbsTreePrivates.stream().filter(f -> f.getExcelId() == null).collect(Collectors.toList());
+        List<WbsTreePrivate> collect2 = wbsTreePrivates.stream().filter(f -> f.getExcelId() != null).collect(Collectors.toList());
+
         //清表也相同的数据
-        List<WbsTreePrivate> collect = wbsTreePrivates.stream().filter(f ->
+        List<WbsTreePrivate> collect = collect2.stream().filter(f ->
                 Objects.equals(f.getExcelId(), wbsTreePrivate.getExcelId())
         ).collect(Collectors.toList());
+
+        if(CollectionUtil.isNotEmpty(collect1)){
+            collect.addAll(collect1);
+        }
         //清表不同的数据
-        List<WbsTreePrivate> noExcelIdEq = wbsTreePrivates.stream().filter(f -> !Objects.equals(f.getExcelId(), wbsTreePrivate.getExcelId())).collect(Collectors.toList());
+        List<WbsTreePrivate> noExcelIdEq = wbsTreePrivates.stream().filter(f -> f.getExcelId()!=null && !Objects.equals(f.getExcelId(), wbsTreePrivate.getExcelId())).collect(Collectors.toList());
+        StringBuilder sb = new StringBuilder();
         if (CollectionUtil.isNotEmpty(noExcelIdEq)) {
-            StringBuilder sb = new StringBuilder();
             for (WbsTreePrivate treePrivate : noExcelIdEq) {
                 List<WbsTreePrivate> list = wbsTreePrivateMapper.selectList(Wrappers.<WbsTreePrivate>lambdaQuery().in(WbsTreePrivate::getPKeyId, Func.toLongList(treePrivate.getAncestorsPId())));
                 List<String> nodeNames = list.stream().map(WbsTreePrivate::getNodeName).collect(Collectors.toList());
 
                 sb.append(StringUtil.join(nodeNames, "/")).append(";");
             }
-            throw new ServiceException("清表绑定错误:" + sb);
+//            throw new ServiceException("清表绑定错误:" + sb);
         }
-        List<Long> ids = collect.stream().map(WbsTreePrivate::getPKeyId).collect(Collectors.toList());
+
         //修改数据
-        wbsSynchronousEViSaService.updateSyncPrivateForm(wbsTreePrivate.getHtmlUrl(), ids, wbsTreeSynchronousRecord.getId());
+        wbsSynchronousEViSaService.updateSyncPrivateForm(wbsTreePrivate, collect, wbsTreeSynchronousRecord.getId(),sb.toString());
     }
 
     /**