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

Merge remote-tracking branch 'origin/master'

# Conflicts:
#	blade-service/blade-manager/src/main/java/com/mixsmart/utils/CustomFunction.java
liuyc 2 жил өмнө
parent
commit
850fa8f8b6
50 өөрчлөгдсөн 1236 нэмэгдсэн , 188 устгасан
  1. 25 4
      blade-common/src/main/java/org/springblade/common/utils/CommonUtil.java
  2. 18 0
      blade-common/src/main/java/org/springblade/common/utils/INodeEx.java
  3. 27 3
      blade-ops/blade-resource/src/main/java/org/springblade/resource/endpoint/OssEndpoint.java
  4. 1 1
      blade-ops/blade-resource/src/main/resources/application.yml
  5. 5 5
      blade-ops/blade-swagger/src/main/resources/application-dev.yml
  6. 2 0
      blade-service-api/blade-archive-api/src/main/java/org/springblade/archive/entity/ArchivesAuto.java
  7. 86 0
      blade-service-api/blade-archive-api/src/main/java/org/springblade/archive/vo/ArchivesAutoVO.java
  8. 9 0
      blade-service-api/blade-business-api/src/main/java/org/springblade/business/feign/ArchiveFileClient.java
  9. 12 0
      blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/entity/ExcelTab.java
  10. 2 1
      blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/vo/ArchiveTreeContractVO2.java
  11. 2 1
      blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/vo/ArchiveTreeVO2.java
  12. 1 0
      blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/vo/WbsTreeContractVO6.java
  13. 1 0
      blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/vo/WbsTreeVO2.java
  14. 129 0
      blade-service/blade-archive/src/main/java/org/springblade/archive/controller/ArchiveFileAutoController.java
  15. 50 0
      blade-service/blade-archive/src/main/java/org/springblade/archive/controller/ArchiveFileController.java
  16. 6 0
      blade-service/blade-archive/src/main/java/org/springblade/archive/mapper/ArchivesAutoMapper.java
  17. 49 0
      blade-service/blade-archive/src/main/java/org/springblade/archive/mapper/ArchivesAutoMapper.xml
  18. 3 0
      blade-service/blade-archive/src/main/java/org/springblade/archive/service/IArchivesAutoService.java
  19. 45 0
      blade-service/blade-archive/src/main/java/org/springblade/archive/service/impl/ArchivesAutoServiceImpl.java
  20. 85 8
      blade-service/blade-business/src/main/java/org/springblade/business/controller/InformationWriteQueryController.java
  21. 13 0
      blade-service/blade-business/src/main/java/org/springblade/business/feignClient/ArchiveFileClientImpl.java
  22. 95 1
      blade-service/blade-business/src/main/java/org/springblade/business/mapper/InformationQueryMapper.xml
  23. 18 0
      blade-service/blade-business/src/main/java/org/springblade/business/utils/FileUtils.java
  24. 26 3
      blade-service/blade-manager/src/main/java/com/jfireel/expression/node/impl/MinusNode.java
  25. 1 1
      blade-service/blade-manager/src/main/java/com/jfireel/expression/util/number/SubtractUtil.java
  26. 8 4
      blade-service/blade-manager/src/main/java/com/mixsmart/utils/CustomFunction.java
  27. 13 4
      blade-service/blade-manager/src/main/java/org/springblade/manager/controller/ArchiveTreeContractController.java
  28. 64 46
      blade-service/blade-manager/src/main/java/org/springblade/manager/controller/ExcelTabController.java
  29. 1 1
      blade-service/blade-manager/src/main/java/org/springblade/manager/controller/FirstController.java
  30. 16 20
      blade-service/blade-manager/src/main/java/org/springblade/manager/controller/FormulaController.java
  31. 11 12
      blade-service/blade-manager/src/main/java/org/springblade/manager/controller/WbsParamController.java
  32. 19 1
      blade-service/blade-manager/src/main/java/org/springblade/manager/formula/ITurnPointCalculator.java
  33. 11 0
      blade-service/blade-manager/src/main/java/org/springblade/manager/formula/TurnPoint.java
  34. 11 10
      blade-service/blade-manager/src/main/java/org/springblade/manager/formula/impl/FormulaMileage.java
  35. 12 8
      blade-service/blade-manager/src/main/java/org/springblade/manager/formula/impl/FormulaTurnPoint.java
  36. 0 1
      blade-service/blade-manager/src/main/java/org/springblade/manager/service/IContractInfoService.java
  37. 1 1
      blade-service/blade-manager/src/main/java/org/springblade/manager/service/IExcelTabService.java
  38. 1 1
      blade-service/blade-manager/src/main/java/org/springblade/manager/service/IFormulaService.java
  39. 1 3
      blade-service/blade-manager/src/main/java/org/springblade/manager/service/ITextdictInfoService.java
  40. 5 0
      blade-service/blade-manager/src/main/java/org/springblade/manager/service/IWbsTreeContractService.java
  41. 15 7
      blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/ArTreeContractInitServiceImpl.java
  42. 34 2
      blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/ArchiveTreeContractServiceImpl.java
  43. 5 4
      blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/ArchiveTreeServiceImpl.java
  44. 26 24
      blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/ExcelTabServiceImpl.java
  45. 45 3
      blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/FormulaServiceImpl.java
  46. 63 3
      blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/WbsTreeContractServiceImpl.java
  47. 9 2
      blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/WbsTreePrivateServiceImpl.java
  48. 75 3
      blade-service/blade-manager/src/main/java/org/springblade/manager/utils/FileUtils.java
  49. 38 0
      blade-service/blade-manager/src/main/java/org/springblade/manager/utils/ForestNodeManagerEx.java
  50. 41 0
      blade-service/blade-manager/src/main/java/org/springblade/manager/utils/ForestNodeMergerEx.java

+ 25 - 4
blade-common/src/main/java/org/springblade/common/utils/CommonUtil.java

@@ -2,18 +2,17 @@ package org.springblade.common.utils;
 
 
 import cn.hutool.core.io.FileUtil;
 import cn.hutool.core.io.FileUtil;
 import org.apache.commons.lang.StringUtils;
 import org.apache.commons.lang.StringUtils;
+import org.springframework.util.CollectionUtils;
 
 
 import java.io.*;
 import java.io.*;
 import java.math.BigDecimal;
 import java.math.BigDecimal;
 import java.net.HttpURLConnection;
 import java.net.HttpURLConnection;
 import java.net.URL;
 import java.net.URL;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Random;
+import java.util.*;
 import java.util.regex.Matcher;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 import java.util.regex.Pattern;
 import java.util.stream.Collectors;
 import java.util.stream.Collectors;
+import java.util.stream.Stream;
 
 
 /**
 /**
  * 通用工具类
  * 通用工具类
@@ -186,4 +185,26 @@ public class CommonUtil {
         return dest;
         return dest;
     }
     }
 
 
+    /**
+     * Description: Java8 Stream分割list集合
+     * @param list 集合数据
+     * @param splitSize 几个分割一组
+     * @return 集合分割后的集合
+     */
+    public static <T> List<List<T>> splitList(List<T> list, int splitSize) {
+        //判断集合是否为空
+        if (CollectionUtils.isEmpty(list))
+            return Collections.emptyList();
+        //计算分割后的大小
+        int maxSize = (list.size() + splitSize - 1) / splitSize;
+        //开始分割
+        return Stream.iterate(0, n -> n + 1)
+                .limit(maxSize)
+                .parallel()
+                .map(a -> list.parallelStream().skip(a * splitSize).limit(splitSize).collect(Collectors.toList()))
+                .filter(b -> !b.isEmpty())
+                .collect(Collectors.toList());
+    }
+
+
 }
 }

+ 18 - 0
blade-common/src/main/java/org/springblade/common/utils/INodeEx.java

@@ -0,0 +1,18 @@
+package org.springblade.common.utils;
+
+import java.io.Serializable;
+import java.util.List;
+
+public interface INodeEx<T> extends Serializable {
+
+
+    Long getId();
+
+    Long getParentId();
+
+    List<T> getChildren();
+
+    default Boolean getHasChildren() {
+        return false;
+    }
+}

+ 27 - 3
blade-ops/blade-resource/src/main/java/org/springblade/resource/endpoint/OssEndpoint.java

@@ -36,7 +36,11 @@ import org.springblade.resource.vo.NewBladeFile;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.BeanUtils;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
 import org.springframework.web.multipart.MultipartFile;
-
+import javax.imageio.ImageIO;
+import java.awt.*;
+import java.awt.image.BufferedImage;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
 import java.util.Objects;
 import java.util.Objects;
 
 
 /**
 /**
@@ -175,8 +179,28 @@ public class OssEndpoint {
 	@SneakyThrows
 	@SneakyThrows
 	@PostMapping("/upload-file")
 	@PostMapping("/upload-file")
 	public synchronized R<NewBladeFile> uploadFile(@RequestParam MultipartFile file){
 	public synchronized R<NewBladeFile> uploadFile(@RequestParam MultipartFile file){
-		//上传原文件
-		BladeFile bladeFile = ossBuilder.template().putFile(file.getOriginalFilename(), file.getInputStream());
+		//设置大于3M的文件压缩
+		double targetSize = 3 * 1024 * 1024;
+		byte[] bytes = file.getBytes();
+		//压缩文件大小
+		while (bytes.length > targetSize) {
+			float reduceMultiple = 0.5f;
+			BufferedImage bi = ImageIO.read(new ByteArrayInputStream(bytes));
+			int width = (int) (bi.getWidth() * reduceMultiple);
+			int height = (int) (bi.getHeight() * reduceMultiple);
+			Image image = bi.getScaledInstance(width, height, Image.SCALE_SMOOTH);
+			BufferedImage tag = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
+			Graphics g = tag.getGraphics();
+			g.setColor(Color.RED);
+			g.drawImage(image, 0, 0, null);
+			g.dispose();
+			ByteArrayOutputStream bOut = new ByteArrayOutputStream();
+			ImageIO.write(tag, "JPEG", bOut);
+			bytes =bOut.toByteArray();
+		}
+		ByteArrayInputStream inputStream = new ByteArrayInputStream(bytes);
+		//上传文件
+		BladeFile bladeFile = ossBuilder.template().putFile(file.getOriginalFilename(),inputStream);
 
 
 		//处理PDF文件
 		//处理PDF文件
 		NewBladeFile newBladeFile = new NewBladeFile();
 		NewBladeFile newBladeFile = new NewBladeFile();

+ 1 - 1
blade-ops/blade-resource/src/main/resources/application.yml

@@ -1,6 +1,6 @@
 #服务器端口
 #服务器端口
 server:
 server:
-  port: 8010
+  port: 8099
 
 
 #默认对象存储配置
 #默认对象存储配置
 oss:
 oss:

+ 5 - 5
blade-ops/blade-swagger/src/main/resources/application-dev.yml

@@ -2,20 +2,20 @@ knife4j:
   cloud:
   cloud:
     routes:
     routes:
       - name: 用户管理
       - name: 用户管理
-        uri: 127.0.0.1
+        uri: 127.0.0.1:8090
         location: /blade-user/v2/api-docs
         location: /blade-user/v2/api-docs
       - name: 授权模块
       - name: 授权模块
-        uri: 127.0.0.1
+        uri: 127.0.0.1:8090
         location: /blade-auth/v2/api-docs
         location: /blade-auth/v2/api-docs
       #      - name: 工作台模块
       #      - name: 工作台模块
       #        uri: 127.0.0.1
       #        uri: 127.0.0.1
       #        location: /blade-desk/v2/api-docs
       #        location: /blade-desk/v2/api-docs
       - name: 系统模块
       - name: 系统模块
-        uri: 127.0.0.1
+        uri: 127.0.0.1:8090
         location: /blade-system/v2/api-docs
         location: /blade-system/v2/api-docs
       - name: 后台接口
       - name: 后台接口
-        uri: 127.0.0.1
+        uri: 127.0.0.1:8090
         location: /blade-manager/v2/api-docs
         location: /blade-manager/v2/api-docs
       - name: 业务接口
       - name: 业务接口
-        uri: 127.0.0.1
+        uri: 127.0.0.1:8090
         location: /blade-business/v2/api-docs
         location: /blade-business/v2/api-docs

+ 2 - 0
blade-service-api/blade-archive-api/src/main/java/org/springblade/archive/entity/ArchivesAuto.java

@@ -144,5 +144,7 @@ public class ArchivesAuto extends BaseEntity {
 	private Integer isOpen;
 	private Integer isOpen;
 	private Integer ischeck;
 	private Integer ischeck;
 
 
+	//是否案卷收集上传的案卷
+	private Integer isAutoFile;
 
 
 }
 }

+ 86 - 0
blade-service-api/blade-archive-api/src/main/java/org/springblade/archive/vo/ArchivesAutoVO.java

@@ -16,10 +16,14 @@
  */
  */
 package org.springblade.archive.vo;
 package org.springblade.archive.vo;
 
 
+import io.swagger.annotations.ApiModelProperty;
 import org.springblade.archive.entity.ArchivesAuto;
 import org.springblade.archive.entity.ArchivesAuto;
 import lombok.Data;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.EqualsAndHashCode;
 
 
+import java.util.ArrayList;
+import java.util.List;
+
 /**
 /**
  * 视图实体类
  * 视图实体类
  *
  *
@@ -31,4 +35,86 @@ import lombok.EqualsAndHashCode;
 public class ArchivesAutoVO extends ArchivesAuto {
 public class ArchivesAutoVO extends ArchivesAuto {
 	private static final long serialVersionUID = 1L;
 	private static final long serialVersionUID = 1L;
 
 
+	/**
+	 * 当前页
+	 */
+	@ApiModelProperty("当前页")
+	private Integer current;
+
+	/**
+	 * 当前页
+	 */
+	@ApiModelProperty("当前页显示条数")
+	private Integer size;
+
+	/**
+	 * 输入框查询条件
+	 */
+	@ApiModelProperty("输入框查询条件")
+	private String queryValue;
+
+	/**
+	 * 节点查询条件
+	 */
+	@ApiModelProperty("节点查询条件")
+	private String nodeIds;
+
+	private List<String> nodeIdArray;
+	/**
+	* 案卷收集附件信息
+	* */
+	@ApiModelProperty("附件信息")
+	private List<ApprovalFile> approvalFileList = new ArrayList<>();
+	@Data
+	public static class ApprovalFile {
+
+		/**
+		 * 文件绑定的节点ID
+		 */
+		private String nodeId;
+
+		/**
+		 * 文件编号
+		 */
+		private String fileNumber;
+
+		/**
+		 * 文件名称
+		 */
+		private String fileName;
+
+		/**
+		 * 文件时间
+		 */
+		private String fileTime;
+
+		/**
+		 * 文件路径
+		 */
+		private String fileUrl;
+
+		/**
+		 * PDF文件路径
+		 */
+		private String pdfFileUrl;
+
+		/**
+		 * 文件页数
+		 */
+		private Integer filePage;
+
+		/**
+		 * 是否需要审批,0不需要,1需要
+		 */
+		private Integer isApproval;
+
+		/**
+		 * 是否需要认证,0不需要,1需要
+		 */
+		private Integer isNeedCertification;
+		/**
+		 * 责任者
+		 */
+		private String dutyUser;
+	}
 }
 }

+ 9 - 0
blade-service-api/blade-business-api/src/main/java/org/springblade/business/feign/ArchiveFileClient.java

@@ -2,7 +2,10 @@ package org.springblade.business.feign;
 
 
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.metadata.IPage;
+import org.springblade.business.entity.ArchiveFile;
 import org.springblade.business.vo.ArchiveFileVO;
 import org.springblade.business.vo.ArchiveFileVO;
 import org.springblade.common.constant.BusinessConstant;
 import org.springblade.common.constant.BusinessConstant;
 import org.springframework.cloud.openfeign.FeignClient;
 import org.springframework.cloud.openfeign.FeignClient;
@@ -46,4 +49,10 @@ public interface ArchiveFileClient {
 
 
     @PostMapping(API_PREFIX + "/updateArchiveFileByNodeId")
     @PostMapping(API_PREFIX + "/updateArchiveFileByNodeId")
     boolean updateArchiveFileByNodeId(@RequestParam String ids,@RequestParam String nodeId);
     boolean updateArchiveFileByNodeId(@RequestParam String ids,@RequestParam String nodeId);
+
+    @PostMapping(API_PREFIX + "/listWrappers")
+    List<ArchiveFile> listWrappers(@RequestBody LambdaQueryWrapper<ArchiveFile> in);
+
+    @PostMapping(API_PREFIX + "/updateWrappers")
+    boolean updateWrappers(LambdaUpdateWrapper<ArchiveFile> eq);
 }
 }

+ 12 - 0
blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/entity/ExcelTab.java

@@ -106,4 +106,16 @@ public class ExcelTab extends BaseEntity {
 	@ApiModelProperty(value = "排序")
 	@ApiModelProperty(value = "排序")
 	private Integer sort;
 	private Integer sort;
 
 
+	/**
+	 * 模板名
+	 */
+	@ApiModelProperty(value = "排序")
+	private String templateExtension;
+
+	/**
+	 * 模板文件路径
+	 */
+	@ApiModelProperty(value = "html路径")
+	private String templateFileUrl;
+
 }
 }

+ 2 - 1
blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/vo/ArchiveTreeContractVO2.java

@@ -22,6 +22,7 @@ import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
 import io.swagger.annotations.ApiModelProperty;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.EqualsAndHashCode;
+import org.springblade.common.utils.INodeEx;
 import org.springblade.core.tool.node.INode;
 import org.springblade.core.tool.node.INode;
 import org.springblade.manager.entity.ArchiveTreeContract;
 import org.springblade.manager.entity.ArchiveTreeContract;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.BeanUtils;
@@ -37,7 +38,7 @@ import java.util.List;
  * @since 2023-02-18
  * @since 2023-02-18
  */
  */
 @Data
 @Data
-public class ArchiveTreeContractVO2 implements INode<ArchiveTreeContractVO2> {
+public class ArchiveTreeContractVO2 implements INodeEx<ArchiveTreeContractVO2> {
 	private static final long serialVersionUID = 1L;
 	private static final long serialVersionUID = 1L;
 
 
 	/**
 	/**

+ 2 - 1
blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/vo/ArchiveTreeVO2.java

@@ -5,6 +5,7 @@ import com.fasterxml.jackson.databind.annotation.JsonSerialize;
 import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
 import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
 import io.swagger.annotations.ApiModelProperty;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 import lombok.Data;
+import org.springblade.common.utils.INodeEx;
 import org.springblade.core.tool.node.INode;
 import org.springblade.core.tool.node.INode;
 import org.springblade.manager.entity.ArchiveTree;
 import org.springblade.manager.entity.ArchiveTree;
 
 
@@ -12,7 +13,7 @@ import java.util.ArrayList;
 import java.util.List;
 import java.util.List;
 
 
 @Data
 @Data
-public class ArchiveTreeVO2 implements INode<ArchiveTreeVO2> {
+public class ArchiveTreeVO2 implements INodeEx<ArchiveTreeVO2> {
     private static final long serialVersionUID = 1L;
     private static final long serialVersionUID = 1L;
 
 
     /**
     /**

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

@@ -69,6 +69,7 @@ public class WbsTreeContractVO6 extends WbsTreeContract implements INode<WbsTree
             if (this.getTitle().contains("中间交工")
             if (this.getTitle().contains("中间交工")
                     || this.getTitle().contains("质量评定")
                     || this.getTitle().contains("质量评定")
                     || this.getTitle().contains("开工报告")
                     || this.getTitle().contains("开工报告")
+                    || this.getTitle().contains("质量检验评定")
                     || this.getTitle().contains("质量验收评定")) {
                     || this.getTitle().contains("质量验收评定")) {
                 return false;
                 return false;
             }
             }

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

@@ -75,6 +75,7 @@ public class WbsTreeVO2 implements INode<WbsTreeVO2> {
             if (this.getTitle().contains("中间交工")
             if (this.getTitle().contains("中间交工")
                     || this.getTitle().contains("质量评定")
                     || this.getTitle().contains("质量评定")
                     || this.getTitle().contains("开工报告")
                     || this.getTitle().contains("开工报告")
+                    || this.getTitle().contains("质量检验评定")
                     || this.getTitle().contains("质量验收评定")) {
                     || this.getTitle().contains("质量验收评定")) {
                 return false;
                 return false;
             }
             }

+ 129 - 0
blade-service/blade-archive/src/main/java/org/springblade/archive/controller/ArchiveFileAutoController.java

@@ -0,0 +1,129 @@
+package org.springblade.archive.controller;
+
+import com.alibaba.excel.util.DateUtils;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
+import io.swagger.annotations.*;
+import lombok.AllArgsConstructor;
+import lombok.SneakyThrows;
+import org.apache.commons.lang.StringUtils;
+import org.springblade.archive.service.IArchivesAutoService;
+import org.springblade.archive.vo.ArchivesAutoVO;
+import org.springblade.business.entity.ArchiveFile;
+import org.springblade.business.feign.ArchiveFileClient;
+import org.springblade.business.vo.ArchiveFileVO;
+import org.springblade.core.boot.ctrl.BladeController;
+import org.springblade.core.oss.model.BladeFile;
+import org.springblade.core.tool.api.R;
+import org.springblade.core.tool.utils.BeanUtil;
+import org.springblade.evisa.feign.EVisaClient;
+import org.springblade.manager.entity.ArchiveTreeContract;
+import org.springblade.manager.feign.ArchiveTreeContractClient;
+import org.springblade.resource.feign.IOSSClient;
+import org.springblade.system.user.entity.UserOauth;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+
+/**
+ *  控制器
+ *
+ * @author BladeX
+ * @since 2022-07-08
+ */
+@RestController
+@AllArgsConstructor
+@RequestMapping("/archiveFileAuto")
+@Api(value = "案卷收集接口", tags = "案卷收集接口")
+public class ArchiveFileAutoController extends BladeController {
+
+    private final ArchiveFileClient archiveFileClient;
+    private final IOSSClient iossClient;
+    private final ArchiveTreeContractClient archiveTreeContractClient;
+    private final EVisaClient eVisaClient;
+    private final IArchivesAutoService archivesAutoService;
+    /**
+     * 批量新增
+     */
+    @PostMapping("/batchSave")
+    @ApiOperationSupport(order = 2)
+    @ApiOperation(value = "批量新增")
+    public R<Boolean> batchSave(@RequestBody List<ArchivesAutoVO> archiveList){
+        try {
+            for(ArchivesAutoVO archive : archiveList) {
+                if(archive.getId() == null){
+                    int l = (int) System.currentTimeMillis();
+                    List<ArchivesAutoVO.ApprovalFile> saveList = archive.getApprovalFileList();
+                    ArchiveFileVO saveVos = new ArchiveFileVO();
+                    if (saveList != null && saveList.size() > 0) {
+                        int i = 1;
+                        for (ArchivesAutoVO.ApprovalFile approvalFile : saveList) {
+                            ArchiveFileVO saveVo = BeanUtil.copy(approvalFile, ArchiveFileVO.class);
+                            saveVo.setSort(l + i);
+                            saveVo.setStatus(new Integer("0").equals(saveVo.getIsApproval()) ? 2 : 0);
+                            saveVo.setIsCertification(new Integer("0").equals(saveVo.getIsNeedCertification()) ? 1 : 0);
+                            saveVos.getList().add(saveVo);
+                            i++;
+                        }
+                    }
+                    this.archiveFileClient.saveArchiveFile(saveVos);
+
+                    String archiveId = "";
+                    //获取方式
+                    archiveId = "FromNode_" + archive.getNodeId();
+                    archive.setId(Long.parseLong(archiveId));
+                    //待修改
+                    archive.setIsDeleted(0);
+                    archive.setIsArchive(0);
+                    archive.setIsAutoFile(1);
+                    archivesAutoService.save(archive);
+                }else{
+                    archivesAutoService.updateById(archive);
+                }
+            }
+        } catch (NumberFormatException e) {
+            e.printStackTrace();
+            return R.data(false);
+        }
+        return R.data(true);
+    }
+    /**
+     * 分页
+     */
+    @PostMapping("/page")
+    @ApiOperationSupport(order = 3)
+    @ApiOperation(value = "分页")
+    public R<Object> page( ArchivesAutoVO queryVo){
+        if(queryVo.getNodeId() == null || queryVo.getNodeId().equals("")){
+            return  R.data(null);
+        }
+        List<ArchiveTreeContract> archiveTreeContracts = this.archiveTreeContractClient.queryAllChildByAncestors(queryVo.getNodeIds());
+        if(archiveTreeContracts != null && archiveTreeContracts.size() > 0){
+            List<String> ids = JSONArray.parseArray(JSONObject.toJSONString(archiveTreeContracts.stream().map(ArchiveTreeContract::getId).distinct().collect(Collectors.toList())), String.class);
+            ids.add(queryVo.getNodeId().toString());
+            queryVo.setNodeIdArray(ids);
+        }
+
+        return R.data(archivesAutoService.selectArchivesAutoFilePage(queryVo));
+    }
+
+
+    /**
+     * 迁移文件
+     */
+    @PostMapping("/migrateFile")
+    @ApiOperationSupport(order = 9)
+    @ApiOperation(value = "迁移文件", notes = "传入ids")
+    public R migrateFile(@RequestParam String ids,@RequestParam String nodeId) {
+        return R.status(archivesAutoService.updateArchivesAutoFileByNodeId(ids,nodeId));
+    }
+}

+ 50 - 0
blade-service/blade-archive/src/main/java/org/springblade/archive/controller/ArchiveFileController.java

@@ -1,12 +1,16 @@
 package org.springblade.archive.controller;
 package org.springblade.archive.controller;
 
 
+import com.alibaba.excel.util.DateUtils;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
 import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
 import io.swagger.annotations.*;
 import io.swagger.annotations.*;
 import lombok.AllArgsConstructor;
 import lombok.AllArgsConstructor;
 import lombok.SneakyThrows;
 import lombok.SneakyThrows;
+import org.apache.commons.lang.StringUtils;
 import org.springblade.business.entity.ArchiveFile;
 import org.springblade.business.entity.ArchiveFile;
 import org.springblade.business.feign.ArchiveFileClient;
 import org.springblade.business.feign.ArchiveFileClient;
 import org.springblade.business.vo.ArchiveFileVO;
 import org.springblade.business.vo.ArchiveFileVO;
@@ -15,6 +19,7 @@ import org.springblade.core.boot.ctrl.BladeController;
 import org.springblade.core.oss.model.BladeFile;
 import org.springblade.core.oss.model.BladeFile;
 import org.springblade.core.tool.api.R;
 import org.springblade.core.tool.api.R;
 import org.springblade.core.tool.utils.Func;
 import org.springblade.core.tool.utils.Func;
+import org.springblade.evisa.feign.EVisaClient;
 import org.springblade.manager.entity.ArchiveTree;
 import org.springblade.manager.entity.ArchiveTree;
 import org.springblade.manager.entity.ArchiveTreeContract;
 import org.springblade.manager.entity.ArchiveTreeContract;
 import org.springblade.manager.feign.ArchiveTreeContractClient;
 import org.springblade.manager.feign.ArchiveTreeContractClient;
@@ -23,6 +28,7 @@ import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
 import org.springframework.web.multipart.MultipartFile;
 
 
 import java.util.ArrayList;
 import java.util.ArrayList;
+import java.util.Date;
 import java.util.List;
 import java.util.List;
 import java.util.Map;
 import java.util.Map;
 import java.util.stream.Collectors;
 import java.util.stream.Collectors;
@@ -43,6 +49,7 @@ public class ArchiveFileController extends BladeController {
     private final ArchiveFileClient archiveFileClient;
     private final ArchiveFileClient archiveFileClient;
     private final IOSSClient iossClient;
     private final IOSSClient iossClient;
     private final ArchiveTreeContractClient archiveTreeContractClient;
     private final ArchiveTreeContractClient archiveTreeContractClient;
+    private final EVisaClient eVisaClient;
     /**
     /**
      * 上传文件
      * 上传文件
      *
      *
@@ -177,4 +184,47 @@ public class ArchiveFileController extends BladeController {
     public R migrateFile(@RequestParam String ids,@RequestParam String nodeId) {
     public R migrateFile(@RequestParam String ids,@RequestParam String nodeId) {
         return R.status(this.archiveFileClient.updateArchiveFileByNodeId(ids,nodeId));
         return R.status(this.archiveFileClient.updateArchiveFileByNodeId(ids,nodeId));
     }
     }
+
+    /**
+     * 批量认证(特殊签章 签个透明空白图片,主要目的是在验签的时候有验签信息 )
+     */
+    @PostMapping("/batchCertification")
+    @ApiOperationSupport(order = 9)
+    @ApiOperation(value = "批量认证")
+    public R<Boolean> batchCertification(@RequestBody ArchiveFileVO vo){
+        List<String> list = new ArrayList<>();
+        if(vo.getIds() != null && vo.getIds().size() > 0){
+            //获取文件
+            List<ArchiveFile> archiveFileList = this.archiveFileClient.listWrappers(Wrappers.<ArchiveFile>lambdaQuery().in(ArchiveFile::getId, vo.getIds()));
+            if(archiveFileList != null && archiveFileList.size() > 0){
+                for(ArchiveFile archiveFile : archiveFileList){
+                    //获取文件地址并调用接口认证
+                    String result = this.eVisaClient.certification(StringUtils.isNotEmpty(archiveFile.getEVisaFile()) ? archiveFile.getEVisaFile() : archiveFile.getPdfFileUrl(), archiveFile.getFileName(), archiveFile.getContractId());
+                    if(StringUtils.isNotEmpty(result) && result.contains("success") && result.startsWith("success")){
+                        //成功,更改状态
+                        //签章成功后的文件路径,如果与原pdf文件路径不匹配则更新
+                        String newPdfUrl = null;
+                        if(result.contains("@@@@")){
+                            newPdfUrl = result.split("@@@@")[1];
+                        }
+                        LambdaUpdateWrapper<ArchiveFile> wrappers = Wrappers.lambdaUpdate();
+                        if(StringUtils.isNotEmpty(newPdfUrl) && !archiveFile.getPdfFileUrl().equals(newPdfUrl)){
+                            //不为空且不匹配时,更新
+                            wrappers.set(ArchiveFile::getEVisaFile, newPdfUrl);
+                        }
+                        //修改认证状态为已认证
+                        wrappers.set(ArchiveFile::getIsCertification, 1);
+                        //添加认证时间
+                        wrappers.set(ArchiveFile::getCertificationTime, DateUtils.format(new Date(), "yyyy-MM-dd HH:mm:ss"));
+
+                        //修改状态
+                        this.archiveFileClient.updateWrappers(wrappers.eq(ArchiveFile::getId, archiveFile.getId()));
+                    } else {
+                        list.add(archiveFile.getId().toString());
+                    }
+                }
+            }
+        }
+        return list.size() == 0 ? R.data(true) : R.data(300, false, "没有找到证书文件或PDF文件");
+    }
 }
 }

+ 6 - 0
blade-service/blade-archive/src/main/java/org/springblade/archive/mapper/ArchivesAutoMapper.java

@@ -16,6 +16,7 @@
  */
  */
 package org.springblade.archive.mapper;
 package org.springblade.archive.mapper;
 
 
+import org.apache.ibatis.annotations.Param;
 import org.springblade.archive.entity.ArchivesAuto;
 import org.springblade.archive.entity.ArchivesAuto;
 import org.springblade.archive.vo.ArchivesAutoVO;
 import org.springblade.archive.vo.ArchivesAutoVO;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
@@ -39,4 +40,9 @@ public interface ArchivesAutoMapper extends BaseMapper<ArchivesAuto> {
 	 */
 	 */
 	List<ArchivesAutoVO> selectArchivesAutoPage(IPage page, ArchivesAutoVO archivesAuto);
 	List<ArchivesAutoVO> selectArchivesAutoPage(IPage page, ArchivesAutoVO archivesAuto);
 
 
+	Integer selectArchivesAutoFileCount(@Param("vo") ArchivesAutoVO vo);
+
+	List<ArchivesAuto> selectArchivesAutoFilePage(@Param("current") Integer current, @Param("size") Integer size, @Param("vo")  ArchivesAutoVO vo);
+
+	Integer updateArchivesAutoFileByNodeId(List<Long> toLongList, String nodeId);
 }
 }

+ 49 - 0
blade-service/blade-archive/src/main/java/org/springblade/archive/mapper/ArchivesAutoMapper.xml

@@ -44,6 +44,7 @@
         <result column="tree_sort" property="nodeSort"/>
         <result column="tree_sort" property="nodeSort"/>
         <result column="isOpen" property="isOpen"/>
         <result column="isOpen" property="isOpen"/>
         <result column="ischeck" property="ischeck"/>
         <result column="ischeck" property="ischeck"/>
+        <result column="is_auto_file" property="isAutoFile"/>
     </resultMap>
     </resultMap>
 
 
 
 
@@ -51,4 +52,52 @@
         select * from u_archives_auto where is_deleted = 0
         select * from u_archives_auto where is_deleted = 0
     </select>
     </select>
 
 
+
+    <select id="selectArchivesAutoFileCount" resultType="java.lang.Integer">
+        select count(id) from u_archives_auto where is_deleted = 0
+        <if test="vo.projectId != null and vo.projectId != ''">
+            and project_id = #{vo.projectId}
+        </if>
+        <if test="vo.contractId != null and vo.contractId != ''">
+            and contract_id = #{vo.contractId}
+        </if>
+        <if test="vo.contractId != null and vo.contractId != ''">
+            and is_auto_file = #{vo.isAutoFile}
+        </if>
+        <if test="vo.nodeIds != null and vo.nodeIds != ''">
+            and node_id in
+            <foreach collection="vo.nodeIdArray" item="nodeId" open="(" separator="," close=")">
+                #{nodeId}
+            </foreach>
+        </if>
+    </select>
+
+    <select id="selectArchivesAutoFilePage" resultMap="archivesAutoResultMap">
+        select * from u_archives_auto where is_deleted = 0
+        <if test="vo.projectId != null and vo.projectId != ''">
+            and project_id = #{vo.projectId}
+        </if>
+        <if test="vo.contractId != null and vo.contractId != ''">
+            and contract_id = #{vo.contractId}
+        </if>
+        <if test="vo.isAutoFile != null and vo.isAutoFile != ''">
+            and is_auto_file = #{vo.isAutoFile}
+        </if>
+        <if test="vo.nodeIds != null and vo.nodeIds != ''">
+            and node_id in
+            <foreach collection="vo.nodeIdArray" item="nodeId" open="(" separator="," close=")">
+                #{nodeId}
+            </foreach>
+        </if>
+        order by sort,create_time DESC
+    </select>
+
+    <update id="updateArchivesAutoFileByNodeId" >
+        update u_archives_auto set node_id = #{nodeId} where
+        id in
+        <foreach collection="ids" item="id" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </update>
+
 </mapper>
 </mapper>

+ 3 - 0
blade-service/blade-archive/src/main/java/org/springblade/archive/service/IArchivesAutoService.java

@@ -38,4 +38,7 @@ public interface IArchivesAutoService extends BaseService<ArchivesAuto> {
 	 */
 	 */
 	IPage<ArchivesAutoVO> selectArchivesAutoPage(IPage<ArchivesAutoVO> page, ArchivesAutoVO archivesAuto);
 	IPage<ArchivesAutoVO> selectArchivesAutoPage(IPage<ArchivesAutoVO> page, ArchivesAutoVO archivesAuto);
 
 
+	IPage<ArchivesAutoVO> selectArchivesAutoFilePage(ArchivesAutoVO queryVo);
+
+	boolean updateArchivesAutoFileByNodeId(String ids, String nodeId);
 }
 }

+ 45 - 0
blade-service/blade-archive/src/main/java/org/springblade/archive/service/impl/ArchivesAutoServiceImpl.java

@@ -16,14 +16,23 @@
  */
  */
 package org.springblade.archive.service.impl;
 package org.springblade.archive.service.impl;
 
 
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import org.apache.commons.lang.StringUtils;
 import org.springblade.archive.entity.ArchivesAuto;
 import org.springblade.archive.entity.ArchivesAuto;
 import org.springblade.archive.vo.ArchivesAutoVO;
 import org.springblade.archive.vo.ArchivesAutoVO;
 import org.springblade.archive.mapper.ArchivesAutoMapper;
 import org.springblade.archive.mapper.ArchivesAutoMapper;
 import org.springblade.archive.service.IArchivesAutoService;
 import org.springblade.archive.service.IArchivesAutoService;
 import org.springblade.core.mp.base.BaseServiceImpl;
 import org.springblade.core.mp.base.BaseServiceImpl;
+import org.springblade.core.mp.support.Condition;
+import org.springblade.core.mp.support.Query;
+import org.springblade.core.tool.utils.Func;
+import org.springblade.system.entity.DictBiz;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 
 
+import java.util.List;
+
 /**
 /**
  *  服务实现类
  *  服务实现类
  *
  *
@@ -38,4 +47,40 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
 		return page.setRecords(baseMapper.selectArchivesAutoPage(page, archivesAuto));
 		return page.setRecords(baseMapper.selectArchivesAutoPage(page, archivesAuto));
 	}
 	}
 
 
+	@Override
+	public IPage<ArchivesAutoVO> selectArchivesAutoFilePage(ArchivesAutoVO vo) {
+		Query query = new Query();
+		query.setCurrent(vo.getCurrent());
+		query.setSize(vo.getSize());
+		//设置分页
+		IPage<ArchivesAutoVO> iPage = Condition.getPage(query);
+
+		//汇总
+		Integer total = this.baseMapper.selectArchivesAutoFileCount(vo);
+		if(total == null){
+			total = 0;
+		}
+		//分页
+		int current = (vo.getCurrent() - 1) * vo.getSize();
+
+		List<ArchivesAuto> pageList = this.baseMapper.selectArchivesAutoFilePage(current, vo.getSize(), vo);
+		//设置分页信息
+		iPage.setTotal(total);
+		List<ArchivesAutoVO> pageVoList = JSONArray.parseArray(JSONObject.toJSONString(pageList), ArchivesAutoVO.class);
+
+		return iPage.setRecords(pageVoList);
+	}
+
+	@Override
+	public boolean updateArchivesAutoFileByNodeId(String ids, String nodeId) {
+		try {
+			baseMapper.updateArchivesAutoFileByNodeId(Func.toLongList(ids),nodeId);
+
+		} catch (Exception e) {
+			e.printStackTrace();
+			return false;
+		}
+		return true;
+	}
+
 }
 }

+ 85 - 8
blade-service/blade-business/src/main/java/org/springblade/business/controller/InformationWriteQueryController.java

@@ -27,8 +27,10 @@ import org.springblade.business.socket.WebSocket;
 import org.springblade.business.utils.FileUtils;
 import org.springblade.business.utils.FileUtils;
 import org.springblade.business.vo.*;
 import org.springblade.business.vo.*;
 import org.springblade.common.constant.CommonConstant;
 import org.springblade.common.constant.CommonConstant;
+import org.springblade.common.constant.LauncherConstant;
 import org.springblade.common.utils.CommonUtil;
 import org.springblade.common.utils.CommonUtil;
 import org.springblade.common.utils.SnowFlakeUtil;
 import org.springblade.common.utils.SnowFlakeUtil;
+import org.springblade.core.cache.utils.CacheUtil;
 import org.springblade.core.log.exception.ServiceException;
 import org.springblade.core.log.exception.ServiceException;
 import org.springblade.core.mp.support.Condition;
 import org.springblade.core.mp.support.Condition;
 import org.springblade.core.mp.support.Query;
 import org.springblade.core.mp.support.Query;
@@ -50,8 +52,14 @@ import org.springblade.system.cache.ParamCache;
 import org.springblade.system.entity.DictBiz;
 import org.springblade.system.entity.DictBiz;
 import org.springblade.system.feign.IDictBizClient;
 import org.springblade.system.feign.IDictBizClient;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.BeanUtils;
+import org.springframework.cache.annotation.CacheEvict;
+import org.springframework.cache.annotation.CachePut;
+import org.springframework.cache.annotation.Cacheable;
+import org.springframework.cache.annotation.Caching;
+import org.springframework.data.redis.core.RedisConnectionUtils;
 import org.springframework.jdbc.core.BeanPropertyRowMapper;
 import org.springframework.jdbc.core.BeanPropertyRowMapper;
 import org.springframework.jdbc.core.JdbcTemplate;
 import org.springframework.jdbc.core.JdbcTemplate;
+import org.springframework.scheduling.annotation.Async;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springblade.core.boot.ctrl.BladeController;
 import org.springblade.core.boot.ctrl.BladeController;
@@ -60,6 +68,8 @@ import java.io.IOException;
 import java.util.*;
 import java.util.*;
 import java.util.stream.Collectors;
 import java.util.stream.Collectors;
 
 
+import static org.springblade.core.cache.constant.CacheConstant.SYS_CACHE;
+
 /**
 /**
  * 资料填报及查询控制器
  * 资料填报及查询控制器
  *
  *
@@ -110,6 +120,8 @@ public class InformationWriteQueryController extends BladeController {
 
 
     private final ITreeContractFirstService treeContractFirstService;
     private final ITreeContractFirstService treeContractFirstService;
 
 
+    private static final String CONTRACT_CACHE_WBSTREE = "contract:wbstree:";
+
     /**
     /**
      * 获取文件题名
      * 获取文件题名
      */
      */
@@ -1857,9 +1869,9 @@ public class InformationWriteQueryController extends BladeController {
 
 
         if (queryProcess != null && queryProcess.size() > 0) {
         if (queryProcess != null && queryProcess.size() > 0) {
             //检查这些填报节点是否存在已经审批或已经上报的节点,如果存在则不允许删除
             //检查这些填报节点是否存在已经审批或已经上报的节点,如果存在则不允许删除
-            List<QueryProcessDataVO> approvalList = queryProcess.stream().filter(vo -> new Integer("2").equals(vo.getStatus())).collect(Collectors.toList());
+            List<QueryProcessDataVO> approvalList = queryProcess.stream().filter(vo -> new Integer("2").equals(vo.getStatus()) && vo.getInformationQueryId()!=null).collect(Collectors.toList());
             //
             //
-            List<QueryProcessDataVO> runTaskList = queryProcess.stream().filter(vo -> new Integer("1").equals(vo.getStatus())).collect(Collectors.toList());
+            List<QueryProcessDataVO> runTaskList = queryProcess.stream().filter(vo -> new Integer("1").equals(vo.getStatus()) && vo.getInformationQueryId()!=null).collect(Collectors.toList());
             if (approvalList.size() > 0 || runTaskList.size() > 0) {
             if (approvalList.size() > 0 || runTaskList.size() > 0) {
                 //说明存在已经审批或已经上报的节点,不允许删除
                 //说明存在已经审批或已经上报的节点,不允许删除
                 return R.data(300, false, "存在已经上报或审批的节点,不允许删除");
                 return R.data(300, false, "存在已经上报或审批的节点,不允许删除");
@@ -2389,7 +2401,25 @@ public class InformationWriteQueryController extends BladeController {
         if (StringUtils.isNotEmpty(primaryKeyId)) {
         if (StringUtils.isNotEmpty(primaryKeyId)) {
             parentId = primaryKeyId;
             parentId = primaryKeyId;
         }
         }
-        return R.data(this.queryContractTree(parentId, contractId, contractIdRelation, classifyType));
+        String dataInfoId = contractId+"_"+parentId+"_"+classifyType;
+        queryContractWbsTreeByContractIdAndType2(primaryKeyId,parentId,contractId,contractIdRelation,classifyType);
+        List<WbsTreeContractTreeVOS> wbsTreeContractTreeVOS = CacheUtil.get(LauncherConstant.APPLICATION_MANAGER_NAME, CONTRACT_CACHE_WBSTREE, dataInfoId, List.class);
+        if (wbsTreeContractTreeVOS == null) {
+            wbsTreeContractTreeVOS = this.queryContractTree(parentId, contractId, contractIdRelation, classifyType);
+            CacheUtil.put(LauncherConstant.APPLICATION_MANAGER_NAME, CONTRACT_CACHE_WBSTREE, dataInfoId, wbsTreeContractTreeVOS);
+        }
+        return R.data(wbsTreeContractTreeVOS);
+    }
+
+    @Async
+    public void queryContractWbsTreeByContractIdAndType2(String primaryKeyId,
+                                                                                   String parentId,
+                                                                                   String contractId,
+                                                                                   String contractIdRelation,
+                                                                                   String classifyType) {
+        String dataInfoId = contractId+"_"+parentId+"_"+classifyType;
+        List<WbsTreeContractTreeVOS> wbsTreeContractTreeVOS = this.queryContractTree(parentId, contractId, contractIdRelation, classifyType);
+            CacheUtil.put(LauncherConstant.APPLICATION_MANAGER_NAME, CONTRACT_CACHE_WBSTREE, dataInfoId, wbsTreeContractTreeVOS);
     }
     }
 
 
     /**
     /**
@@ -2441,6 +2471,7 @@ public class InformationWriteQueryController extends BladeController {
         return R.data(rootTreeNode);
         return R.data(rootTreeNode);
     }
     }
 
 
+
     /**
     /**
      * 查询合同段划分树公共代码
      * 查询合同段划分树公共代码
      */
      */
@@ -2454,17 +2485,64 @@ public class InformationWriteQueryController extends BladeController {
             //监理/业主合同段,需要获取关联的施工方合同段根节点数据
             //监理/业主合同段,需要获取关联的施工方合同段根节点数据
             List<String> contractIds = new ArrayList<>();
             List<String> contractIds = new ArrayList<>();
             if (StringUtils.isEmpty(parentId)) {
             if (StringUtils.isEmpty(parentId)) {
+                // 获取 有几个合同段主键Id
                 contractIds = this.contractClient.getProcessContractByJLContractId(contractId);
                 contractIds = this.contractClient.getProcessContractByJLContractId(contractId);
             } else {
             } else {
                 contractIds.add(contractIdRelation);
                 contractIds.add(contractIdRelation);
             }
             }
             if (contractIds.size() > 0) {
             if (contractIds.size() > 0) {
-
                 //监理复制加载树问题
                 //监理复制加载树问题
                 if (StringUtils.isEmpty(classifyType)) {
                 if (StringUtils.isEmpty(classifyType)) {
                     classifyType = "2";
                     classifyType = "2";
                 }
                 }
+                if (StringUtils.isNotEmpty(parentId)) {
+                    //子节点
+                    rootTreeNode = this.informationQueryService.queryContractTreeSupervision(contractIds, parentId, Integer.parseInt(classifyType));
+                } else {
+                    //根节点
+                    rootTreeNode = this.informationQueryService.queryContractTreeSupervision(contractIds, "0", Integer.parseInt(classifyType));
+                    //设置根节点数量统计
+                    for (WbsTreeContractTreeVOS root : rootTreeNode) {
+                        List<WbsTreeContractTreeVOS> rootZi = this.informationQueryService.queryContractTreeSupervision(Func.toStrList(root.getContractIdRelation()), root.getId().toString(), Integer.parseInt(classifyType));
+                        List<Long> collect = rootZi.stream().map(WbsTreeContractTreeVOS::getSubmitCounts).collect(Collectors.toList());
+                        Long reduce = collect.stream().reduce(0L, Long::sum);
+                        root.setSubmitCounts(reduce);
+                    }
+                }
+            } else {
+                rootTreeNode = new ArrayList<>();
+            }
+        } else {
+            //施工合同段
+            rootTreeNode = this.informationQueryService.queryContractTree(contractId, StringUtils.isNotEmpty(parentId) ? parentId : "0", 1);
+        }
+        return rootTreeNode;
+    }
+ /*
+    *//**
+     * 查询合同段划分树公共代码
+     *//*
+    private List<WbsTreeContractTreeVOS> queryContractTree(String parentId, String contractId, String contractIdRelation, String classifyType) {
+        List<WbsTreeContractTreeVOS> rootTreeNode;
 
 
+        //获取合同段,检查是否是监理合同段
+        ContractInfo contractInfo = this.contractClient.getContractById(Long.parseLong(contractId));
+
+        if (new Integer("2").equals(contractInfo.getContractType()) || new Integer("3").equals(contractInfo.getContractType())) {
+            //监理/业主合同段,需要获取关联的施工方合同段根节点数据
+            List<String> contractIds = new ArrayList<>();
+            if (StringUtils.isEmpty(parentId)) {
+                // 获取 有几个合同段主键Id
+                contractIds = this.contractClient.getProcessContractByJLContractId(contractId);
+            } else {
+                contractIds.add(contractIdRelation);
+            }
+            if (contractIds.size() > 0) {
+
+                //监理复制加载树问题
+                if (StringUtils.isEmpty(classifyType)) {
+                    classifyType = "2";
+                }
                 if (StringUtils.isNotEmpty(parentId)) {
                 if (StringUtils.isNotEmpty(parentId)) {
                     //子节点
                     //子节点
                     rootTreeNode = this.informationQueryService.queryContractTreeSupervision(contractIds, parentId, Integer.parseInt(classifyType));
                     rootTreeNode = this.informationQueryService.queryContractTreeSupervision(contractIds, parentId, Integer.parseInt(classifyType));
@@ -2480,7 +2558,6 @@ public class InformationWriteQueryController extends BladeController {
                         root.setSubmitCounts(reduce);
                         root.setSubmitCounts(reduce);
                     }
                     }
                 }
                 }
-
             } else {
             } else {
                 rootTreeNode = new ArrayList<>();
                 rootTreeNode = new ArrayList<>();
             }
             }
@@ -2488,14 +2565,14 @@ public class InformationWriteQueryController extends BladeController {
         } else {
         } else {
             //施工合同段
             //施工合同段
             rootTreeNode = this.informationQueryService.queryContractTree(contractId, StringUtils.isNotEmpty(parentId) ? parentId : "0", 1);
             rootTreeNode = this.informationQueryService.queryContractTree(contractId, StringUtils.isNotEmpty(parentId) ? parentId : "0", 1);
-            rootTreeNode.stream().forEach(rtn->{
+            *//*rootTreeNode.stream().forEach(rtn->{
                 if (rtn.getSubmitCounts() > 0L && rtn.getColorStatus() <= 1 && rtn.getNotExsitChild() == false){
                 if (rtn.getSubmitCounts() > 0L && rtn.getColorStatus() <= 1 && rtn.getNotExsitChild() == false){
                     rtn.setColorStatus(2);
                     rtn.setColorStatus(2);
                 }
                 }
-            });
+            });*//*
         }
         }
 
 
         return rootTreeNode;
         return rootTreeNode;
     }
     }
-
+*/
 }
 }

+ 13 - 0
blade-service/blade-business/src/main/java/org/springblade/business/feignClient/ArchiveFileClientImpl.java

@@ -2,8 +2,11 @@ package org.springblade.business.feignClient;
 
 
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import lombok.AllArgsConstructor;
 import lombok.AllArgsConstructor;
+import org.springblade.business.entity.ArchiveFile;
 import org.springblade.business.feign.ArchiveFileClient;
 import org.springblade.business.feign.ArchiveFileClient;
 import org.springblade.business.service.IArchiveFileService;
 import org.springblade.business.service.IArchiveFileService;
 import org.springblade.business.vo.ArchiveFileVO;
 import org.springblade.business.vo.ArchiveFileVO;
@@ -61,4 +64,14 @@ public class ArchiveFileClientImpl implements ArchiveFileClient {
     public boolean updateArchiveFileByNodeId(String ids, String nodeId) {
     public boolean updateArchiveFileByNodeId(String ids, String nodeId) {
         return this.iArchiveFileService.updateArchiveFileByNodeId(ids,nodeId);
         return this.iArchiveFileService.updateArchiveFileByNodeId(ids,nodeId);
     }
     }
+
+    @Override
+    public List<ArchiveFile> listWrappers(LambdaQueryWrapper<ArchiveFile> in) {
+        return this.iArchiveFileService.list(in);
+    }
+
+    @Override
+    public boolean updateWrappers(LambdaUpdateWrapper<ArchiveFile> eq) {
+        return this.iArchiveFileService.update(eq);
+    }
 }
 }

+ 95 - 1
blade-service/blade-business/src/main/java/org/springblade/business/mapper/InformationQueryMapper.xml

@@ -86,6 +86,99 @@
             where p_key_id = #{item.pKeyId}
             where p_key_id = #{item.pKeyId}
         </foreach>
         </foreach>
     </update>
     </update>
+<!--
+    <select id="queryContractTreeSupervision" resultMap="queryContractTreeMap">
+        SELECT c.*,
+        CASE
+        WHEN c.allCount = c.savaCont THEN 2
+        WHEN c.allCount = c.submitCounts THEN 3
+        WHEN c.allCount = c.appCount THEN 4
+        WHEN c.savaCont &gt;=1 or c.submitCounts &gt;=1 or c.appCount &gt;=1 THEN 2
+        ELSE 1 END AS colorStatus
+        from (
+        SELECT
+        wtc.is_concealed_works_node AS "isConcealedWorksNode",
+        wtc.p_key_id AS primaryKeyId,
+        wtc.id,
+        CASE wtc.parent_id WHEN 0 THEN (select ci.contract_name from m_contract_info AS ci where wtc.contract_id = ci.id) ELSE IFNULL(if(length(trim(wtc.full_name)) > 0, wtc.full_name, wtc.node_name),wtc.node_name) END AS title,
+        wtc.parent_id AS parentId,
+        wtc.partition_code AS partitionCode,
+        wtc.contract_id AS contractId,
+        wtc.old_id AS oldId,
+        wtc.major_data_type AS majorDataType,
+        wtc.node_type AS `type`,
+        wtc.node_type AS nodeType,
+        CASE wtc.node_type WHEN 6 THEN 'true' ELSE 'false' END AS leaf,
+        CASE (select count(tc.p_key_id) from m_wbs_tree_contract AS tc where tc.parent_id = wtc.id and tc.contract_id = wtc.contract_id and tc.type = 1 and tc.is_deleted = 0 and tc.node_type != 111)
+        WHEN 0 THEN 'true' ELSE 'false' END AS notExsitChild,
+        ctd.file_url AS fileUrl,
+        ctd.id AS drawingsId,
+        CASE (select count(tcf.id) from u_tree_contract_first AS tcf where tcf.is_deleted = 0 and tcf.wbs_node_id = wtc.p_key_id) WHEN 0 THEN 'false' ELSE 'true' END AS isFirst,
+        (SELECT count(1) from m_wbs_tree_contract where id in(SELECT parent_id from m_wbs_tree_contract a where a.contract_id=#{contractId} and a.is_deleted=0 and a.type=2 and table_owner in(1,2,3)
+        ) and contract_id=wtc.contract_id and type =1 and is_deleted=0 and FIND_IN_SET(wtc.id,ancestors)) as allCount,
+        (SELECT count(1) from m_wbs_tree_contract a ,u_information_query b where a.p_key_id=b.wbs_id and FIND_IN_SET(wtc.id,a.ancestors)  and a.contract_id=wtc.contract_id and b.is_deleted=0 and a.is_deleted=0 and a.`status`=0 and b.classify=1) as savaCont,
+        (SELECT count(1) from m_wbs_tree_contract a ,u_information_query b where a.p_key_id=b.wbs_id and FIND_IN_SET(wtc.id,a.ancestors)  and a.contract_id=wtc.contract_id and b.is_deleted=0 and a.is_deleted=0 and a.`status`=1 and b.classify=1) as submitCounts,
+        (SELECT count(1) from m_wbs_tree_contract a ,u_information_query b where a.p_key_id=b.wbs_id and FIND_IN_SET(wtc.id,a.ancestors)  and a.contract_id=wtc.contract_id and b.is_deleted=0 and a.is_deleted=0 and a.`status`=2 and b.classify=1) as appCount
+        FROM
+        m_wbs_tree_contract AS wtc
+        LEFT JOIN u_contract_tree_drawings AS ctd ON ctd.is_deleted = 0 and ctd.process_id = wtc.p_key_id
+        WHERE wtc.type = 1
+        AND wtc.is_deleted= 0
+        AND wtc.node_type != 111
+        AND wtc.parent_id = #{parentId}
+        and wtc.contract_id IN
+        <foreach collection="contractIds" item="contractId" open="(" separator="," close=")">
+            #{contractId}
+        </foreach>
+        ORDER BY wtc.sort,wtc.create_time
+        ) c
+    </select>
+
+
+    <select id="queryContractTree" resultMap="queryContractTreeMap">
+        SELECT c.*,
+               CASE
+                   WHEN c.allCount = c.savaCont THEN 2
+                   WHEN c.allCount = c.submitCount THEN 3
+                   WHEN c.allCount = c.appCount THEN 4
+                   WHEN c.savaCont>=1 or c.submitCount>=1 or c.appCount>=1 THEN 2
+                   ELSE 1 END AS colorStatus
+        from (
+                 SELECT
+                     wtc.is_concealed_works_node AS "isConcealedWorksNode",
+                     wtc.p_key_id AS primaryKeyId,
+                     wtc.id,
+                     CASE wtc.parent_id WHEN 0 THEN (select ci.contract_name from m_contract_info AS ci where wtc.contract_id = ci.id) ELSE IFNULL(if(length(trim(wtc.full_name)) > 0, wtc.full_name, wtc.node_name),wtc.node_name) END AS title,
+                     wtc.parent_id AS parentId,
+                     wtc.partition_code AS partitionCode,
+                     wtc.contract_id AS contractId,
+                     wtc.old_id AS oldId,
+                     wtc.major_data_type AS majorDataType,
+                     wtc.node_type AS `type`,
+                     wtc.node_type AS nodeType,
+                     CASE wtc.node_type WHEN 6 THEN 'true' ELSE 'false' END AS leaf,
+                     CASE (select count(tc.p_key_id) from m_wbs_tree_contract AS tc where tc.parent_id = wtc.id and tc.contract_id =wtc.contract_id and tc.type = 1 and tc.is_deleted = 0 and tc.node_type != 111)
+            WHEN 0 THEN 'true' ELSE 'false' END AS notExsitChild,
+        ctd.file_url AS fileUrl,
+        ctd.id AS drawingsId,
+        CASE (select count(tcf.id) from u_tree_contract_first AS tcf where tcf.is_deleted = 0 and tcf.wbs_node_id = wtc.p_key_id) WHEN 0 THEN 'false' ELSE 'true' END AS isFirst,
+			 (SELECT count(1) from m_wbs_tree_contract where id in(SELECT parent_id from m_wbs_tree_contract a where a.is_deleted=0 and a.type=2 and table_owner in(1,2,3)
+				) and contract_id=wtc.contract_id and type =1 and is_deleted=0 and FIND_IN_SET(wtc.id,ancestors)) as allCount,
+			 (SELECT count(1) from m_wbs_tree_contract a ,u_information_query b where a.p_key_id=b.wbs_id and FIND_IN_SET(wtc.id,a.ancestors)  and a.contract_id=wtc.contract_id and b.is_deleted=0 and a.is_deleted=0 and a.`status`=0 and b.classify=1) as savaCont,
+			 (SELECT count(1) from m_wbs_tree_contract a ,u_information_query b where a.p_key_id=b.wbs_id and FIND_IN_SET(wtc.id,a.ancestors)  and a.contract_id=wtc.contract_id and b.is_deleted=0 and a.is_deleted=0 and a.`status`=1 and b.classify=1) as submitCount,
+			 (SELECT count(1) from m_wbs_tree_contract a ,u_information_query b where a.p_key_id=b.wbs_id and FIND_IN_SET(wtc.id,a.ancestors)  and a.contract_id=wtc.contract_id and b.is_deleted=0 and a.is_deleted=0 and a.`status`=2 and b.classify=1) as appCount
+				FROM
+        m_wbs_tree_contract AS wtc
+        LEFT JOIN u_contract_tree_drawings AS ctd ON ctd.is_deleted = 0 and ctd.process_id = wtc.p_key_id
+        WHERE wtc.type = 1
+        AND wtc.is_deleted= 0
+        AND wtc.node_type != 111
+        AND wtc.parent_id = #{parentId}
+        AND wtc.contract_id = #{contractId}
+        ORDER BY wtc.sort,wtc.create_time
+		) c
+    </select>-->
+
 
 
     <select id="queryContractTreeSupervision" resultMap="queryContractTreeMap">
     <select id="queryContractTreeSupervision" resultMap="queryContractTreeMap">
         SELECT
         SELECT
@@ -177,7 +270,7 @@
         ORDER BY wtc.sort,wtc.create_time
         ORDER BY wtc.sort,wtc.create_time
     </select>
     </select>
 
 
-    <select id="queryContractTree" resultMap="queryContractTreeMap">
+ <select id="queryContractTree" resultMap="queryContractTreeMap">
         SELECT
         SELECT
             wtc.is_concealed_works_node AS "isConcealedWorksNode",
             wtc.is_concealed_works_node AS "isConcealedWorksNode",
             wtc.p_key_id AS primaryKeyId,
             wtc.p_key_id AS primaryKeyId,
@@ -254,6 +347,7 @@
                 group by wtc.p_key_id
                 group by wtc.p_key_id
             ) AS querys
             ) AS querys
         ) AS querys ON wtc.p_key_id = querys.pKeyId
         ) AS querys ON wtc.p_key_id = querys.pKeyId
+
         WHERE wtc.type = 1
         WHERE wtc.type = 1
         AND wtc.is_deleted= 0
         AND wtc.is_deleted= 0
         AND wtc.node_type != 111
         AND wtc.node_type != 111

+ 18 - 0
blade-service/blade-business/src/main/java/org/springblade/business/utils/FileUtils.java

@@ -119,6 +119,24 @@ public class FileUtils {
         return bOut.toByteArray();
         return bOut.toByteArray();
     }
     }
 
 
+    /**
+     * 压缩图片2
+     */
+    public static byte[] resizeImage2(byte[] srcImgData, float reduceMultiple) throws IOException {
+        BufferedImage bi = ImageIO.read(new ByteArrayInputStream(srcImgData));
+        int width = (int) (bi.getWidth() * reduceMultiple);
+        int height = (int) (bi.getHeight() * reduceMultiple);
+        Image image = bi.getScaledInstance(width, height, Image.SCALE_SMOOTH);
+        BufferedImage tag = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
+        Graphics g = tag.getGraphics();
+        g.setColor(Color.RED);
+        g.drawImage(image, 0, 0, null);
+        g.dispose();
+        ByteArrayOutputStream bOut = new ByteArrayOutputStream();
+        ImageIO.write(tag, "JPEG", bOut);
+        return bOut.toByteArray();
+    }
+
     /**
     /**
      * 图片定位
      * 图片定位
      */
      */

+ 26 - 3
blade-service/blade-manager/src/main/java/com/jfireel/expression/node/impl/MinusNode.java

@@ -2,6 +2,7 @@ package com.jfireel.expression.node.impl;
 
 
 import com.jfireel.expression.token.Operator;
 import com.jfireel.expression.token.Operator;
 import com.jfireel.expression.util.number.SubtractUtil;
 import com.jfireel.expression.util.number.SubtractUtil;
+import com.mixsmart.utils.CustomFunction;
 import com.mixsmart.utils.StringUtils;
 import com.mixsmart.utils.StringUtils;
 
 
 import java.math.BigDecimal;
 import java.math.BigDecimal;
@@ -15,20 +16,42 @@ public class MinusNode extends OperatorResultNode {
 	@Override
 	@Override
 	public Object calculate(Map<String, Object> variables) {
 	public Object calculate(Map<String, Object> variables) {
 		Object leftValue = leftOperand.calculate(variables);
 		Object leftValue = leftOperand.calculate(variables);
+		Object rightValue = rightOperand.calculate(variables);
+		String reg="[0-9.]+(\\*[0-9.]+)*";
+        if(StringUtils.handleNull(leftValue).matches(reg)&&StringUtils.handleNull(rightValue).matches(reg)){
+        	return CustomFunction.dXd(rightValue,leftValue);
+		}
 		if(leftValue instanceof String && StringUtils.isNumber(leftValue)) {
 		if(leftValue instanceof String && StringUtils.isNumber(leftValue)) {
 			leftValue = new BigDecimal(leftValue.toString());
 			leftValue = new BigDecimal(leftValue.toString());
 		}
 		}
-		if (leftValue instanceof Number == false) {
+		if (!(leftValue instanceof Number)) {
 			return null;
 			return null;
 		}
 		}
-		Object rightValue = rightOperand.calculate(variables);
 		if(rightValue instanceof String && StringUtils.isNumber(rightValue)) {
 		if(rightValue instanceof String && StringUtils.isNumber(rightValue)) {
 			rightValue = new BigDecimal(rightValue.toString());
 			rightValue = new BigDecimal(rightValue.toString());
 		}
 		}
-		if (rightValue instanceof Number == false) {
+		if (!(rightValue instanceof Number)) {
 			return null;
 			return null;
 		}
 		}
 		return SubtractUtil.calculate((Number) leftValue, (Number) rightValue);
 		return SubtractUtil.calculate((Number) leftValue, (Number) rightValue);
 	}
 	}
 
 
+//	public Object calculateOld(Map<String, Object> variables) {
+//		Object leftValue = leftOperand.calculate(variables);
+//		if(leftValue instanceof String && StringUtils.isNumber(leftValue)) {
+//			leftValue = new BigDecimal(leftValue.toString());
+//		}
+//		if (!(leftValue instanceof Number)) {
+//			return null;
+//		}
+//		Object rightValue = rightOperand.calculate(variables);
+//		if(rightValue instanceof String && StringUtils.isNumber(rightValue)) {
+//			rightValue = new BigDecimal(rightValue.toString());
+//		}
+//		if (!(rightValue instanceof Number)) {
+//			return null;
+//		}
+//		return SubtractUtil.calculate((Number) leftValue, (Number) rightValue);
+//	}
+
 }
 }

+ 1 - 1
blade-service/blade-manager/src/main/java/com/jfireel/expression/util/number/SubtractUtil.java

@@ -63,7 +63,7 @@ public class SubtractUtil {
 	private static Object calculate(BigDecimal a, BigDecimal b) {
 	private static Object calculate(BigDecimal a, BigDecimal b) {
 		int aScale = new BigDecimal(a.toString()).scale();
 		int aScale = new BigDecimal(a.toString()).scale();
 		int bScale = new BigDecimal(b.toString()).scale();
 		int bScale = new BigDecimal(b.toString()).scale();
-		return a.subtract(b).setScale(aScale > bScale ? aScale : bScale, BigDecimal.ROUND_HALF_UP);
+		return a.subtract(b).setScale(Math.max(aScale, bScale), BigDecimal.ROUND_HALF_UP);
 	}
 	}
 	
 	
 	public static Object calculate(Number a, Number b) {
 	public static Object calculate(Number a, Number b) {

+ 8 - 4
blade-service/blade-manager/src/main/java/com/mixsmart/utils/CustomFunction.java

@@ -436,7 +436,7 @@ public class CustomFunction {
 
 
 	public static Object dateMin(Object range){
 	public static Object dateMin(Object range){
 		if(StringUtils.isNotEmpty(range)){
 		if(StringUtils.isNotEmpty(range)){
-			String[] s= Func.toStr(range).replaceAll("[[|]]","").split(",");
+			String[] s= Func.toStr(range).replaceAll("[|]","").split(",");
 			return dateCp(s[0],s[1],true);
 			return dateCp(s[0],s[1],true);
 		}
 		}
 		return StringPool.EMPTY;
 		return StringPool.EMPTY;
@@ -2796,9 +2796,13 @@ public class CustomFunction {
 		return "";
 		return "";
 	}
 	}
 
 
-	/*public static void main(String[] args) {
-		String s="边坡或仰坡坡度_不大于设计_尺量:每洞口检查10处_实测";
-		System.out.println(s.split("[((].+[))]|_")[0]);
+/*	public static void main(String[] args) {
+	     Map<String,Object> map =new HashMap<>();
+	     map.put("A","13.3*13.6");
+		map.put("B","13.5*13.5");
+		Expression.parse("A-B").calculate(map);
+		System.out.println();
+
 	}*/
 	}*/
 
 
 
 

+ 13 - 4
blade-service/blade-manager/src/main/java/org/springblade/manager/controller/ArchiveTreeContractController.java

@@ -239,13 +239,22 @@ public class ArchiveTreeContractController extends BladeController {
 	 */
 	 */
 	@PostMapping("/initTree")
 	@PostMapping("/initTree")
 	@ApiOperationSupport(order = 10)
 	@ApiOperationSupport(order = 10)
-	@ApiOperation(value = "初始化项目级归档树", notes = "传入token")
+	@ApiOperation(value = "初始化客户级归档树", notes = "传入token")
 	@ApiImplicitParams(value = {
 	@ApiImplicitParams(value = {
 			@ApiImplicitParam(name = "projectId", value = "项目id", required = true)
 			@ApiImplicitParam(name = "projectId", value = "项目id", required = true)
 	})
 	})
-	public R<ArchiveTree> initTree(Long projectId) {
-		archiveTreeContractService.initTree2(AuthUtil.getTenantId(), projectId);
-		return R.fail(200, "初始化创建成功");
+	public R<List<ArchiveTreeContractVO2>> initTree(Long projectId) {
+		boolean bRet =archiveTreeContractService.initTree2(AuthUtil.getTenantId(), projectId);
+		if (bRet == false) {
+			return R.fail(200, "初始化归档树失败");
+		}
+
+		List<ArchiveTreeContractVO2> tree = archiveTreeContractService.lazyTree2(AuthUtil.getTenantId(), 0L,projectId,null);
+		if (tree != null && tree.size() > 0) {
+			return R.data(tree);
+		}
+
+		return R.fail(200, "未查询到信息");
 	}
 	}
 
 
 	/**
 	/**

+ 64 - 46
blade-service/blade-manager/src/main/java/org/springblade/manager/controller/ExcelTabController.java

@@ -1,16 +1,18 @@
 package org.springblade.manager.controller;
 package org.springblade.manager.controller;
 
 
-
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
 import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
-
-import com.spire.xls.*;
+import com.spire.xls.CellRange;
+import com.spire.xls.ExcelPicture;
+import com.spire.xls.Workbook;
+import com.spire.xls.Worksheet;
 import com.spire.xls.core.spreadsheet.HTMLOptions;
 import com.spire.xls.core.spreadsheet.HTMLOptions;
 import io.swagger.annotations.*;
 import io.swagger.annotations.*;
 import lombok.AllArgsConstructor;
 import lombok.AllArgsConstructor;
@@ -23,8 +25,6 @@ import org.jsoup.Jsoup;
 import org.jsoup.nodes.Document;
 import org.jsoup.nodes.Document;
 import org.jsoup.nodes.Element;
 import org.jsoup.nodes.Element;
 import org.jsoup.select.Elements;
 import org.jsoup.select.Elements;
-import org.springblade.business.dto.TrialSelfInspectionRecordDTO;
-import org.springblade.business.entity.TrialSelfInspectionRecord;
 import org.springblade.business.feign.ContractLogClient;
 import org.springblade.business.feign.ContractLogClient;
 import org.springblade.business.feign.InformationQueryClient;
 import org.springblade.business.feign.InformationQueryClient;
 import org.springblade.business.vo.SaveContractLogVO;
 import org.springblade.business.vo.SaveContractLogVO;
@@ -33,8 +33,9 @@ import org.springblade.common.utils.CommonUtil;
 import org.springblade.common.utils.MathUtil;
 import org.springblade.common.utils.MathUtil;
 import org.springblade.common.utils.SnowFlakeUtil;
 import org.springblade.common.utils.SnowFlakeUtil;
 import org.springblade.core.boot.ctrl.BladeController;
 import org.springblade.core.boot.ctrl.BladeController;
-import org.springblade.core.excel.util.ExcelUtil;
+import org.springblade.core.log.exception.ServiceException;
 import org.springblade.core.mp.support.Condition;
 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.oss.model.BladeFile;
 import org.springblade.core.secure.BladeUser;
 import org.springblade.core.secure.BladeUser;
 import org.springblade.core.secure.utils.AuthUtil;
 import org.springblade.core.secure.utils.AuthUtil;
@@ -43,7 +44,6 @@ import org.springblade.core.tool.constant.BladeConstant;
 import org.springblade.core.tool.utils.*;
 import org.springblade.core.tool.utils.*;
 import org.springblade.manager.bean.TableInfo;
 import org.springblade.manager.bean.TableInfo;
 import org.springblade.manager.entity.*;
 import org.springblade.manager.entity.*;
-import org.springblade.manager.excel.WbsFormElementBatchExcel;
 import org.springblade.manager.mapper.WbsTreePrivateMapper;
 import org.springblade.manager.mapper.WbsTreePrivateMapper;
 import org.springblade.manager.service.*;
 import org.springblade.manager.service.*;
 import org.springblade.manager.utils.FileUtils;
 import org.springblade.manager.utils.FileUtils;
@@ -56,32 +56,23 @@ import org.springblade.resource.feign.IOSSClient;
 import org.springblade.resource.feign.NewIOSSClient;
 import org.springblade.resource.feign.NewIOSSClient;
 import org.springblade.resource.vo.NewBladeFile;
 import org.springblade.resource.vo.NewBladeFile;
 import org.springblade.system.cache.ParamCache;
 import org.springblade.system.cache.ParamCache;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.jdbc.core.BeanPropertyRowMapper;
 import org.springframework.jdbc.core.JdbcTemplate;
 import org.springframework.jdbc.core.JdbcTemplate;
-import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.bind.annotation.*;
-import org.springblade.core.mp.support.Query;
-import org.springblade.core.log.exception.ServiceException;
 import org.springframework.web.multipart.MultipartFile;
 import org.springframework.web.multipart.MultipartFile;
 
 
 import javax.imageio.ImageIO;
 import javax.imageio.ImageIO;
-import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import javax.servlet.http.HttpServletResponse;
 import javax.validation.Valid;
 import javax.validation.Valid;
 import java.awt.*;
 import java.awt.*;
 import java.awt.image.BufferedImage;
 import java.awt.image.BufferedImage;
 import java.io.*;
 import java.io.*;
 import java.net.URLEncoder;
 import java.net.URLEncoder;
-import java.util.*;
 import java.util.List;
 import java.util.List;
+import java.util.*;
 import java.util.regex.Matcher;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 import java.util.regex.Pattern;
 import java.util.stream.Collectors;
 import java.util.stream.Collectors;
 
 
-import static com.baomidou.mybatisplus.core.toolkit.Wrappers.lambdaQuery;
-import static com.baomidou.mybatisplus.core.toolkit.Wrappers.query;
-
 
 
 /**
 /**
  * 清表基础数据表 控制器
  * 清表基础数据表 控制器
@@ -1357,7 +1348,7 @@ public class ExcelTabController extends BladeController {
             @ApiImplicitParam(name = "pkeyId", value = "pkeyId", required = true)
             @ApiImplicitParam(name = "pkeyId", value = "pkeyId", required = true)
     })
     })
     public R getBussDataInfo(Long pkeyId) throws FileNotFoundException {
     public R getBussDataInfo(Long pkeyId) throws FileNotFoundException {
-        return excelTabService.getBussDataInfo(pkeyId);
+        return excelTabService.getBussDataInfo(pkeyId,0);
     }
     }
 
 
 
 
@@ -1381,20 +1372,19 @@ public class ExcelTabController extends BladeController {
             @ApiImplicitParam(name = "pkeyId", value = "pkeyId", required = true)
             @ApiImplicitParam(name = "pkeyId", value = "pkeyId", required = true)
     })
     })
     public R copeBussTab(Long pkeyId) {
     public R copeBussTab(Long pkeyId) {
-        WbsTreeContract wbsTreeContract = wbsTreeContractService.getBaseMapper().selectOne(Wrappers.<WbsTreeContract>query().lambda()
+        WbsTreeContract wbsInfo = wbsTreeContractService.getBaseMapper().selectOne(Wrappers.<WbsTreeContract>query().lambda()
                 .eq(WbsTreeContract::getPKeyId, pkeyId));
                 .eq(WbsTreeContract::getPKeyId, pkeyId));
 
 
         List<WbsTreeContract> wbsTreeContractList = wbsTreeContractService.getBaseMapper().selectList(Wrappers.<WbsTreeContract>query().lambda()
         List<WbsTreeContract> wbsTreeContractList = wbsTreeContractService.getBaseMapper().selectList(Wrappers.<WbsTreeContract>query().lambda()
-                .eq(WbsTreeContract::getId, wbsTreeContract.getId())
-                .eq(WbsTreeContract::getContractId, wbsTreeContract.getContractId())
-                .eq(WbsTreeContract::getParentId, wbsTreeContract.getParentId()));
+                .eq(WbsTreeContract::getId, wbsInfo.getId())
+                .eq(WbsTreeContract::getContractId, wbsInfo.getContractId())
+                .eq(WbsTreeContract::getParentId, wbsInfo.getParentId()));
         List<WbsTreeContract> wbsTreeContractList2 = wbsTreeContractList.stream().sorted(Comparator.comparing(WbsTreeContract::getCreateTime).reversed()).collect(Collectors.toList());
         List<WbsTreeContract> wbsTreeContractList2 = wbsTreeContractList.stream().sorted(Comparator.comparing(WbsTreeContract::getCreateTime).reversed()).collect(Collectors.toList());
         long tabGroupId = SnowFlakeUtil.getId();
         long tabGroupId = SnowFlakeUtil.getId();
-        // 添加所有
-        wbsTreeContractList2.forEach(WbsTreeContract -> WbsTreeContract.setTabGroupId(tabGroupId));
-
 
 
         long newPkId = SnowFlakeUtil.getId();
         long newPkId = SnowFlakeUtil.getId();
+        WbsTreeContract wbsTreeContract = new WbsTreeContract();
+        BeanUtil.copy(wbsInfo,wbsTreeContract);
         wbsTreeContract.setPKeyId(newPkId);
         wbsTreeContract.setPKeyId(newPkId);
         wbsTreeContract.setCreateTime(new Date());
         wbsTreeContract.setCreateTime(new Date());
         wbsTreeContract.setTabGroupId(tabGroupId);
         wbsTreeContract.setTabGroupId(tabGroupId);
@@ -1423,8 +1413,14 @@ public class ExcelTabController extends BladeController {
 
 
         String querySql = "insert into " + tabName + " (id,p_key_id," + colkeys + ") select '" + newPkId + "','" + newPkId + "'," + colkeys + " from " + tabName + " where p_key_id=" + pkeyId;
         String querySql = "insert into " + tabName + " (id,p_key_id," + colkeys + ") select '" + newPkId + "','" + newPkId + "'," + colkeys + " from " + tabName + " where p_key_id=" + pkeyId;
         jdbcTemplate.execute(querySql);
         jdbcTemplate.execute(querySql);
-        wbsTreeContractService.saveBatch(wbsTreeContractList2);
         wbsTreeContractService.save(wbsTreeContract);
         wbsTreeContractService.save(wbsTreeContract);
+        for(WbsTreeContract wbsTreeCont:wbsTreeContractList2){
+
+            UpdateWrapper<WbsTreeContract> updateWrapper = new UpdateWrapper<>();
+            updateWrapper.in("p_key_id", wbsTreeCont.getPKeyId() + "");
+            updateWrapper.set("tab_group_id", tabGroupId);
+            wbsTreeContractService.update(updateWrapper);
+        }
         return R.data("成功");
         return R.data("成功");
     }
     }
 
 
@@ -1640,7 +1636,7 @@ public class ExcelTabController extends BladeController {
             );
             );
             if (wbsTreeContractList != null && wbsTreeContractList.size() >= 1) {
             if (wbsTreeContractList != null && wbsTreeContractList.size() >= 1) {
                 for (WbsTreeContract data : wbsTreeContractList) {
                 for (WbsTreeContract data : wbsTreeContractList) {
-                    R bussDataInfo = this.getBussDataInfo(data.getPKeyId());
+                    R bussDataInfo = this.excelTabService.getBussDataInfo(data.getPKeyId(),1);
                     Object data1 = bussDataInfo.getData();
                     Object data1 = bussDataInfo.getData();
                     dataArray.add(data1);
                     dataArray.add(data1);
                 }
                 }
@@ -1673,7 +1669,7 @@ public class ExcelTabController extends BladeController {
 
 
 
 
     /***
     /***
-     * 覆盖上传
+     * 覆盖上传-  (修改为上传导入模板)
      */
      */
 
 
     @SneakyThrows
     @SneakyThrows
@@ -1685,32 +1681,54 @@ public class ExcelTabController extends BladeController {
             @ApiImplicitParam(name = "nodeId", value = "节点id", required = true)
             @ApiImplicitParam(name = "nodeId", value = "节点id", required = true)
     })
     })
     public R putCoverFileAttach(@RequestParam("file") MultipartFile file, Long nodeId) {
     public R putCoverFileAttach(@RequestParam("file") MultipartFile file, Long nodeId) {
-
-        String file_path = ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
-
         ExcelTab detail = excelTabService.getById(nodeId);
         ExcelTab detail = excelTabService.getById(nodeId);
         // 上传excel文件
         // 上传excel文件
         R<BladeFile> bladeFile = iossClient.addFileInfo(file);
         R<BladeFile> bladeFile = iossClient.addFileInfo(file);
         BladeFile bladeFile1 = bladeFile.getData();
         BladeFile bladeFile1 = bladeFile.getData();
-        String filecode = SnowFlakeUtil.getId() + "";
-        String thmlUrl = file_path + filecode + ".html";
-        // 解析excel
-        Workbook wb = new Workbook();
-        wb.loadFromMHtml(file.getInputStream());
-        //获取工作表
-        Worksheet sheet = wb.getWorksheets().get(0);
-        sheet.saveToHtml(thmlUrl);
-
-        detail.setExtension(bladeFile1.getOriginalName());
-        detail.setFileUrl(bladeFile1.getLink());
-        detail.setFileType(3); // 表示为清表信息  1 表示祖节点  2 表示为节点信息 3 表示清表
-        detail.setHtmlUrl(thmlUrl);
+        detail.setTemplateExtension(bladeFile1.getOriginalName());
+        detail.setTemplateFileUrl(bladeFile1.getLink());
         excelTabService.saveOrUpdate(detail);
         excelTabService.saveOrUpdate(detail);
-        // 解析html
-        expailHtmlInfo(thmlUrl, detail.getId());
         return R.success("上传成功");
         return R.success("上传成功");
     }
     }
 
 
+    /**
+     *  删除模板
+     */
+    @PostMapping("/delete-template")
+    @ApiOperationSupport(order = 5)
+    @ApiOperation(value = "删除模板", notes = "传入excelTab")
+    public R deleteTemplate(@Valid @RequestBody ExcelTab excelTab) {
+        ExcelTab tab = excelTabService.getById(excelTab.getId());
+        if (tab.getTemplateFileUrl() == null || tab.getTemplateExtension() == null) {
+            return R.fail("请上传清表");
+        }
+        return R.status(excelTabService.update(new LambdaUpdateWrapper<ExcelTab>()
+                .set(ExcelTab::getTemplateExtension,null)
+                .set(ExcelTab::getTemplateFileUrl,null)
+                .eq(ExcelTab::getId,excelTab.getId())));
+    }
+
+    /**
+     *  模版下载
+     */
+    @GetMapping("/down-template-file")
+    @ApiOperationSupport(order = 31)
+    @ApiOperation(value = "下载模板数据")
+    @ApiImplicitParam(name = "fileId", value = "fileId")
+    public void downTemplateFile(HttpServletResponse response, String fileId) throws Exception {
+        ExcelTab excelTab = excelTabService.getById(fileId);
+        String fileName = URLEncoder.encode(excelTab.getName(), Charsets.UTF_8.name());
+        InputStream redio = CommonUtil.getOSSInputStream(excelTab.getTemplateFileUrl());
+        byte[] buffer = IoUtil.readToByteArray(redio);
+        OutputStream toClient = new BufferedOutputStream(response.getOutputStream());
+        response.setContentType("application/vnd.ms-excel");
+        response.setCharacterEncoding(org.apache.commons.codec.Charsets.UTF_8.name());
+        response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx");
+        toClient.write(buffer);
+        toClient.flush();
+        toClient.close();
+    }
+
     /**
     /**
      * 日志预览
      * 日志预览
      */
      */

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

@@ -198,7 +198,7 @@ public class FirstController extends BladeController {
 
 
             //获取配置的路径
             //获取配置的路径
             String file_path = ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
             String file_path = ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
-            //String file_path = "/Users/hongchuangyanfa/Desktop/";//ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
+            //String file_path = "/Users/hongchuangyanfa/Desktop/";
 
 
 
 
             //获取数据
             //获取数据

+ 16 - 20
blade-service/blade-manager/src/main/java/org/springblade/manager/controller/FormulaController.java

@@ -53,6 +53,9 @@ public class FormulaController {
     private final IContractInfoService contractInfoService;
     private final IContractInfoService contractInfoService;
     private final ITextdictInfoService textdictInfoService;
     private final ITextdictInfoService textdictInfoService;
     private final IFormulaOptionService formulaOptionService;
     private final IFormulaOptionService formulaOptionService;
+
+    // 合同段服务-
+    private final IWbsTreeContractService wbsTreeContractService;
     /**
     /**
      * 新增或修改
      * 新增或修改
      */
      */
@@ -162,28 +165,19 @@ public class FormulaController {
     public R<FormulaBean> detail(FormulaBean f) {
     public R<FormulaBean> detail(FormulaBean f) {
         if(f.getElementId()!=null){
         if(f.getElementId()!=null){
             StringBuilder sb = new StringBuilder("select b.* from m_element_formula_mapping a INNER JOIN m_formula b on a.formula_id=b.id where a.element_id="+f.getElementId()+" and b.is_deleted=0 and a.scope ="+f.getScope());
             StringBuilder sb = new StringBuilder("select b.* from m_element_formula_mapping a INNER JOIN m_formula b on a.formula_id=b.id where a.element_id="+f.getElementId()+" and b.is_deleted=0 and a.scope ="+f.getScope());
-            if(Func.isNotEmpty(f.getNodeId())){
-                sb.append(" and a.node_id=").append(f.getNodeId());
-            }
-            if(Func.isNotEmpty(f.getProjectId())){
-                sb.append(" and a.project_id=").append(f.getProjectId());
-            }
+           if(StringUtils.isEquals(0,f.getScale())){
+               if(Func.isNotEmpty(f.getNodeId())){
+                   sb.append(" and a.node_id=").append(f.getNodeId());
+               }
+               if(Func.isNotEmpty(f.getProjectId())){
+                   sb.append(" and a.project_id=").append(f.getProjectId());
+               }
+           }
             List<Map<String,Object>> listMap = this.jdbcTemplate.queryForList(sb.toString());
             List<Map<String,Object>> listMap = this.jdbcTemplate.queryForList(sb.toString());
             if(Func.isNotEmpty(listMap)){
             if(Func.isNotEmpty(listMap)){
                 Map<String,Object> map =listMap.get(0);
                 Map<String,Object> map =listMap.get(0);
                 String rely = StringUtils.handleNull(map.get("rely"));
                 String rely = StringUtils.handleNull(map.get("rely"));
                 FormulaBean fb=BeanUtil.toBean(map,FormulaBean.class);
                 FormulaBean fb=BeanUtil.toBean(map,FormulaBean.class);
-//                if(StringUtils.isNotEmpty(rely)){
-//                    String[] relyArr = rely.split(StringPool.COMMA);
-//                   List<Map<String,Object>> mapList =this.jdbcTemplate.queryForList("select CONCAT(a.tab_en_name,':',b.e_key) ekey,a.tab_ch_name tableName,b.e_name ename  ,b.e_length elength,c.dict_value type f" +
-//                           "rom m_table_info a JOIN m_wbs_form_element b on a.id=b.f_id  " +
-//                           "LEFT JOIN (select dict_key, dict_value from blade_dict where code ='data_type' and parent_id > 0 and is_sealed = 0 and is_deleted = 0 )c on b.e_type=c.dict_key" +
-//                           " where  a.tab_en_name in( "+ Arrays.stream(relyArr).map(e->e.split(StringPool.COLON)[0]).distinct().collect(Collectors.joining(StringPool.COMMA,"'","'"))+")");
-//                   if(ListUtils.isNotEmpty(mapList)){
-//                       fb.setDict(mapList.stream().filter(e-> Arrays.stream(relyArr).anyMatch(c->StringUtils.isEquals(e.get("ekey"),c))).collect(Collectors.toMap(e->StringUtils.handleNull(e.get("ekey")), e->e)));
-//                   }
-//
-//                }
                 fb.setDict(this.service.getElementInfoByCodes(rely));
                 fb.setDict(this.service.getElementInfoByCodes(rely));
                 return R.data(fb);
                 return R.data(fb);
             }
             }
@@ -304,8 +298,10 @@ public class FormulaController {
                         break;
                         break;
                     }
                     }
                 }
                 }
-                if(data.size()>dw.length-start){
-                    result.put("more",data.stream().skip(dw.length-start).map(StringUtils::handleNull).collect(Collectors.joining(StringPool.SEMICOLON)));
+                if(data.size()>dw.length){
+                  //  String moreData = data.stream().skip(dw.length).map(StringUtils::handleNull).collect(Collectors.joining(StringPool.SEMICOLON));
+                    // 频率添加表单
+                    this.wbsTreeContractService.addTabInfoByRan(info,data,dw.length);
                 }
                 }
             }
             }
             /*保存实测值参数*/
             /*保存实测值参数*/
@@ -349,7 +345,7 @@ public class FormulaController {
              Map<String,Object> result = new LinkedHashMap<>();
              Map<String,Object> result = new LinkedHashMap<>();
              String  key=fo.getKey().replaceAll("__[\\d_]+","");
              String  key=fo.getKey().replaceAll("__[\\d_]+","");
               ContractInfo contract = this.contractInfoService.getById(fo.getContractId());
               ContractInfo contract = this.contractInfoService.getById(fo.getContractId());
-              List<KeyMapper> kms =  this.service.getKeyMapperList(Collections.singletonList(fo.getPkeyId()),contract.getPId());
+              List<KeyMapper> kms =  this.service.getKeyMapperList(Collections.singletonList(fo.getPkeyId()),contract.getPId(),"");
               KeyMapper keyMapper=null;
               KeyMapper keyMapper=null;
               if(Func.isNotEmpty(kms)){
               if(Func.isNotEmpty(kms)){
                 Optional<KeyMapper> optionalKeyMapper=  kms.stream().filter(e->StringUtils.isEquals(e.getField(),key)).findFirst();
                 Optional<KeyMapper> optionalKeyMapper=  kms.stream().filter(e->StringUtils.isEquals(e.getField(),key)).findFirst();

+ 11 - 12
blade-service/blade-manager/src/main/java/org/springblade/manager/controller/WbsParamController.java

@@ -20,12 +20,8 @@ import org.springblade.core.tool.utils.RegexUtil;
 import org.springblade.manager.dto.FormulaBean;
 import org.springblade.manager.dto.FormulaBean;
 import org.springblade.manager.dto.ParamElements;
 import org.springblade.manager.dto.ParamElements;
 import org.springblade.manager.dto.WbsParamBean;
 import org.springblade.manager.dto.WbsParamBean;
-import org.springblade.manager.entity.ElementFormulaMapping;
-import org.springblade.manager.entity.Formula;
-import org.springblade.manager.entity.WbsParam;
-import org.springblade.manager.service.IElementFormulaMappingService;
-import org.springblade.manager.service.IFormulaService;
-import org.springblade.manager.service.IWbsParamService;
+import org.springblade.manager.entity.*;
+import org.springblade.manager.service.*;
 import org.springblade.manager.vo.ParamBean;
 import org.springblade.manager.vo.ParamBean;
 import org.springblade.manager.vo.ParamSearch;
 import org.springblade.manager.vo.ParamSearch;
 import org.springblade.manager.wrapper.WbsParamWrapper;
 import org.springblade.manager.wrapper.WbsParamWrapper;
@@ -51,6 +47,7 @@ public class WbsParamController {
     private final JdbcTemplate jdbcTemplate;
     private final JdbcTemplate jdbcTemplate;
     private final IFormulaService formulaService;
     private final IFormulaService formulaService;
     private final IElementFormulaMappingService elementFormulaMappingService;
     private final IElementFormulaMappingService elementFormulaMappingService;
+    private final IWbsTreeService wbsTreeService;
 
 
     /**
     /**
      * 保存或修改
      * 保存或修改
@@ -114,7 +111,7 @@ public class WbsParamController {
                         }else if(pb.isPrivate()){
                         }else if(pb.isPrivate()){
                             elementMap= this.jdbcTemplate.queryForList(
                             elementMap= this.jdbcTemplate.queryForList(
                                     "select c.e_name as name ,c.id from m_wbs_tree_private a " +
                                     "select c.e_name as name ,c.id from m_wbs_tree_private a " +
-                                            "inner join m_wbs_tree_private b on a.id=b.parent_id " +
+                                            "inner join m_wbs_tree_private b on (a.id=b.parent_id and a.wbs_id=b.wbs_id) " +
                                             "inner join m_wbs_form_element c on  b.init_table_id=c.f_id " +
                                             "inner join m_wbs_form_element c on  b.init_table_id=c.f_id " +
                                             "where  b.project_id="+pb.getProjectId()+" and a.p_key_id="+pb.getNodeId()+"  and b.is_deleted=0 and c.is_deleted=0 ");
                                             "where  b.project_id="+pb.getProjectId()+" and a.p_key_id="+pb.getNodeId()+"  and b.is_deleted=0 and c.is_deleted=0 ");
                         }
                         }
@@ -140,7 +137,7 @@ public class WbsParamController {
                                 this.formulaService.save(formula);
                                 this.formulaService.save(formula);
                                 tmpMap.clear();
                                 tmpMap.clear();
                                 finalElementMap.forEach(m->{
                                 finalElementMap.forEach(m->{
-                                    if(m.get("name").toString().contains(e.getName())){
+                                    if(StringUtils.handleNull(m.get("name")).contains(e.getName())){
                                         ElementFormulaMapping efm = new ElementFormulaMapping();
                                         ElementFormulaMapping efm = new ElementFormulaMapping();
                                         efm.setScope(FormulaBean.PARAM);
                                         efm.setScope(FormulaBean.PARAM);
                                         efm.setParamId(e.getId());
                                         efm.setParamId(e.getId());
@@ -262,6 +259,7 @@ public class WbsParamController {
                             "where c.is_deleted=0 and a.is_deleted=0 and a.parent_id="+ps.getNodeId()+" and c.param_id ="+ps.getParamId()+")as BB " +
                             "where c.is_deleted=0 and a.is_deleted=0 and a.parent_id="+ps.getNodeId()+" and c.param_id ="+ps.getParamId()+")as BB " +
                             "on AA.id=BB.id"));
                             "on AA.id=BB.id"));
         }else if(ParamSearch.PRI.equals(ps.getScopeType())){
         }else if(ParamSearch.PRI.equals(ps.getScopeType())){
+            WbsTree wtp = this.wbsTreeService.getById(ps.getNodeId());
             return R.data(this.jdbcTemplate.queryForList(
             return R.data(this.jdbcTemplate.queryForList(
                     "select AA.id,AA.tableName,BB.elementName,BB.mappingId from (" +
                     "select AA.id,AA.tableName,BB.elementName,BB.mappingId from (" +
                     "        select id ,node_name AS tableName,init_table_id" +
                     "        select id ,node_name AS tableName,init_table_id" +
@@ -270,8 +268,9 @@ public class WbsParamController {
                     "          AND is_deleted = 0" +
                     "          AND is_deleted = 0" +
                     "          AND parent_id = " +ps.getNodeId()+
                     "          AND parent_id = " +ps.getNodeId()+
                     "          AND project_id = " +ps.getProjectId()+
                     "          AND project_id = " +ps.getProjectId()+
+                    "          AND wbs_id= "+wtp.getWbsId()+
                     "        ORDER BY wt.sort, wt.node_name, wt.create_time) as AA left join (select a.id as id, b.e_name as elementName ,c.id as mappingId,c.is_deleted from m_wbs_tree_private a inner join m_wbs_form_element b on b.f_id=a.init_table_id inner join  m_element_formula_mapping  c on c.element_id=b.id " +
                     "        ORDER BY wt.sort, wt.node_name, wt.create_time) as AA left join (select a.id as id, b.e_name as elementName ,c.id as mappingId,c.is_deleted from m_wbs_tree_private a inner join m_wbs_form_element b on b.f_id=a.init_table_id inner join  m_element_formula_mapping  c on c.element_id=b.id " +
-                            "where  a.project_id="+ps.getProjectId()+" and c.is_deleted=0 and a.is_deleted=0 and a.parent_id="+ps.getNodeId()+" and c.param_id ="+ps.getParamId()+")as BB on AA.id=BB.id"));
+                            "where  a.project_id="+ps.getProjectId()+" and c.is_deleted=0 and a.is_deleted=0 and a.parent_id="+ps.getNodeId()+" and c.scope=35 and c.param_id ="+ps.getParamId()+" and a.wbs_id="+wtp.getWbsId()+" )as BB on AA.id=BB.id"));
         }
         }
         return R.fail("暂无数据");
         return R.fail("暂无数据");
     }
     }
@@ -340,12 +339,12 @@ public class WbsParamController {
                     /*project*/
                     /*project*/
                     elementMap= this.jdbcTemplate.queryForList(
                     elementMap= this.jdbcTemplate.queryForList(
                             "select c.e_name as name ,c.id from m_wbs_tree_private a " +
                             "select c.e_name as name ,c.id from m_wbs_tree_private a " +
-                                    "inner join m_wbs_tree_private b on a.id=b.parent_id " +
+                                    "inner join m_wbs_tree_private b on (a.id=b.parent_id and a.wbs_id=b.wbs_id) " +
                                     "inner join m_wbs_form_element c on  b.init_table_id=c.f_id " +
                                     "inner join m_wbs_form_element c on  b.init_table_id=c.f_id " +
                                     "where  b.project_id="+projectId+" and a.p_key_id="+nodeId+"  and b.is_deleted=0 and c.is_deleted=0 ");
                                     "where  b.project_id="+projectId+" and a.p_key_id="+nodeId+"  and b.is_deleted=0 and c.is_deleted=0 ");
                 }
                 }
 
 
-                List<Long> longList=this.jdbcTemplate.queryForList("select element_id from m_element_formula_mapping where param_id in("+paramList.stream().map(WbsParam::getId).map(String::valueOf).collect(Collectors.joining(","))+")",Long.class);
+                List<Long> longList=this.jdbcTemplate.queryForList("select element_id from m_element_formula_mapping where is_deleted=0 and scope=35 and param_id in("+paramList.stream().map(WbsParam::getId).map(String::valueOf).collect(Collectors.joining(","))+")",Long.class);
                 if(Func.isNotEmpty(elementMap)){
                 if(Func.isNotEmpty(elementMap)){
                     Map<String,Object> tmpMap=new HashMap<>();
                     Map<String,Object> tmpMap=new HashMap<>();
                     List<Map<String, Object>> finalElementMap = elementMap;
                     List<Map<String, Object>> finalElementMap = elementMap;
@@ -373,7 +372,7 @@ public class WbsParamController {
                         Formula finalFormula = formula;
                         Formula finalFormula = formula;
                         String name=e.getName().replace("【水】","").trim();
                         String name=e.getName().replace("【水】","").trim();
                         finalElementMap.forEach(m->{
                         finalElementMap.forEach(m->{
-                            if(m.get("name").toString().contains(name)){
+                            if(StringUtils.handleNull(m.get("name")).contains(name)){
                                 /*匹配名称,且该元素没有绑定任何节点参数公式*/
                                 /*匹配名称,且该元素没有绑定任何节点参数公式*/
                                 if(longList.stream().noneMatch(k->StringUtils.isEquals(k,m.get("id")))){
                                 if(longList.stream().noneMatch(k->StringUtils.isEquals(k,m.get("id")))){
                                     ElementFormulaMapping efm = new ElementFormulaMapping();
                                     ElementFormulaMapping efm = new ElementFormulaMapping();

+ 19 - 1
blade-service/blade-manager/src/main/java/org/springblade/manager/formula/ITurnPointCalculator.java

@@ -1,8 +1,11 @@
 package org.springblade.manager.formula;
 package org.springblade.manager.formula;
 
 
+import com.mixsmart.utils.CustomFunction;
 import com.mixsmart.utils.ListUtils;
 import com.mixsmart.utils.ListUtils;
 import com.mixsmart.utils.StringUtils;
 import com.mixsmart.utils.StringUtils;
 import org.springblade.core.tool.utils.Func;
 import org.springblade.core.tool.utils.Func;
+import org.springblade.manager.formula.impl.TableElementConverter;
+
 import java.math.BigDecimal;
 import java.math.BigDecimal;
 import java.util.*;
 import java.util.*;
 import java.util.stream.Collectors;
 import java.util.stream.Collectors;
@@ -16,7 +19,7 @@ import static org.springblade.manager.formula.TurnPoint.*;
 public interface ITurnPointCalculator {
 public interface ITurnPointCalculator {
 
 
 
 
-     static List<Object> create( List<Map<String,Object>> data, LinkedHashMap<String,String> configMap){
+     static List<Object> create( List<Map<String,Object>> data, LinkedHashMap<String,String> configMap,Map<String,Object> g8){
         if(Func.isNotEmpty(data)&&configMap!=null){
         if(Func.isNotEmpty(data)&&configMap!=null){
                 LevelInfo levelInfo = new LevelInfo();
                 LevelInfo levelInfo = new LevelInfo();
                 List<TurnPoint> tmp =new ArrayList<>();
                 List<TurnPoint> tmp =new ArrayList<>();
@@ -24,6 +27,8 @@ public interface ITurnPointCalculator {
                     Map<String,Object>dm = data.get(i);
                     Map<String,Object>dm = data.get(i);
                     Map<String,Object> dataMap = new HashMap<>(configMap.size()*2);
                     Map<String,Object> dataMap = new HashMap<>(configMap.size()*2);
                     TurnPoint tp = new TurnPoint(levelInfo,dataMap);
                     TurnPoint tp = new TurnPoint(levelInfo,dataMap);
+                    /*V判断*/
+                    tp.setVertical(StringUtils.isEquals(1,dm.get("vertical")));
                     for(Map.Entry<String,String> kv:configMap.entrySet()){
                     for(Map.Entry<String,String> kv:configMap.entrySet()){
                         String key =kv.getKey();
                         String key =kv.getKey();
                         String field =kv.getValue();
                         String field =kv.getValue();
@@ -86,6 +91,8 @@ public interface ITurnPointCalculator {
                 }
                 }
                 List<TurnPoint> result=fill(tmp);
                 List<TurnPoint> result=fill(tmp);
                 if(ListUtils.isNotEmpty(result)){
                 if(ListUtils.isNotEmpty(result)){
+                    /*V判断*/
+                    forG8(result,g8);
                     return result.stream().map(TurnPoint::getDataMap).flatMap(m->{
                     return result.stream().map(TurnPoint::getDataMap).flatMap(m->{
                         List<String> list =new ArrayList<>();
                         List<String> list =new ArrayList<>();
                         for(String key:configMap.keySet()){
                         for(String key:configMap.keySet()){
@@ -197,5 +204,16 @@ public interface ITurnPointCalculator {
         }
         }
         return Collections.emptyList();
         return Collections.emptyList();
     }
     }
+     static void forG8(List<TurnPoint> data,Map<String,Object> g8){
+             g8.put("dx",data.stream().filter(e->TurnPoint.CE.equals(e.getType())).map(tp-> CustomFunction.xN(tp.getDx(),1000)).collect(Collectors.toList()));
+             g8.put("dxv",data.stream().filter(e->TurnPoint.CE.equals(e.getType())&&e.getVertical()).map(tp-> CustomFunction.xN(tp.getDx(),1000)).collect(Collectors.toList()));
+             g8.put("dxnv",data.stream().filter(e->TurnPoint.CE.equals(e.getType())&&!e.getVertical()).map(tp-> CustomFunction.xN(tp.getDx(),1000)).collect(Collectors.toList()));
+             g8.put("sc",data.stream().filter(e->TurnPoint.CE.equals(e.getType())).map(TurnPoint::getSc).collect(Collectors.toList()));
+             g8.put("scv",data.stream().filter(e->TurnPoint.CE.equals(e.getType())&&e.getVertical()).map(TurnPoint::getSc).collect(Collectors.toList()));
+             g8.put("scnv",data.stream().filter(e->TurnPoint.CE.equals(e.getType())&&!e.getVertical()).map(TurnPoint::getSc).collect(Collectors.toList()));
+             g8.put("sj",data.stream().filter(e->TurnPoint.CE.equals(e.getType())).map(TurnPoint::getSj).collect(Collectors.toList()));
+             g8.put("sjv",data.stream().filter(e->TurnPoint.CE.equals(e.getType())&&e.getVertical()).map(TurnPoint::getSj).collect(Collectors.toList()));
+             g8.put("sjnv",data.stream().filter(e->TurnPoint.CE.equals(e.getType())&&!e.getVertical()).map(TurnPoint::getSj).collect(Collectors.toList()));
+     }
 
 
 }
 }

+ 11 - 0
blade-service/blade-manager/src/main/java/org/springblade/manager/formula/TurnPoint.java

@@ -67,6 +67,9 @@ public class TurnPoint {
 
 
     private Map<String,Object> dataMap;
     private Map<String,Object> dataMap;
 
 
+    /**垂直方向*/
+    private Boolean vertical;
+
 
 
     public TurnPoint(LevelInfo levelInfo, Map<String, Object> dataMap) {
     public TurnPoint(LevelInfo levelInfo, Map<String, Object> dataMap) {
         this.levelInfo = levelInfo;
         this.levelInfo = levelInfo;
@@ -76,6 +79,7 @@ public class TurnPoint {
     public TurnPoint() {
     public TurnPoint() {
     }
     }
 
 
+
     public String getName() {
     public String getName() {
         return name;
         return name;
     }
     }
@@ -334,4 +338,11 @@ public class TurnPoint {
         return StringUtils.isEquals(CE,this.type);
         return StringUtils.isEquals(CE,this.type);
   }
   }
 
 
+    public Boolean getVertical() {
+        return vertical;
+    }
+
+    public void setVertical(Boolean vertical) {
+        this.vertical = vertical;
+    }
 }
 }

+ 11 - 10
blade-service/blade-manager/src/main/java/org/springblade/manager/formula/impl/FormulaMileage.java

@@ -1,26 +1,22 @@
 package org.springblade.manager.formula.impl;
 package org.springblade.manager.formula.impl;
 
 
 import com.jfireel.expression.Expression;
 import com.jfireel.expression.Expression;
-import com.mixsmart.utils.CustomFunction;
 import com.mixsmart.utils.FormulaUtils;
 import com.mixsmart.utils.FormulaUtils;
 import com.mixsmart.utils.ListUtils;
 import com.mixsmart.utils.ListUtils;
 import com.mixsmart.utils.StringUtils;
 import com.mixsmart.utils.StringUtils;
 import lombok.Data;
 import lombok.Data;
 import org.springblade.business.feign.MileageClient;
 import org.springblade.business.feign.MileageClient;
-import org.springblade.common.utils.BaseUtils;
 import org.springblade.core.tool.utils.Func;
 import org.springblade.core.tool.utils.Func;
-import org.springblade.core.tool.utils.StringPool;
-import org.springblade.manager.bean.TableInfo;
 import org.springblade.manager.dto.ElementData;
 import org.springblade.manager.dto.ElementData;
 import org.springblade.manager.dto.FormData;
 import org.springblade.manager.dto.FormData;
 import org.springblade.manager.entity.Formula;
 import org.springblade.manager.entity.Formula;
+import org.springblade.manager.entity.WbsTreeContract;
 import org.springblade.manager.formula.FormulaStrategy;
 import org.springblade.manager.formula.FormulaStrategy;
 import org.springblade.manager.formula.KeyMapper;
 import org.springblade.manager.formula.KeyMapper;
 import org.springblade.manager.formula.Mileage;
 import org.springblade.manager.formula.Mileage;
 import org.springframework.stereotype.Component;
 import org.springframework.stereotype.Component;
 
 
 import java.util.*;
 import java.util.*;
-import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 import java.util.regex.Pattern;
 import java.util.stream.Collectors;
 import java.util.stream.Collectors;
 
 
@@ -75,7 +71,6 @@ public class FormulaMileage implements FormulaStrategy {
                 mileage.setValue(0, ed.stringValue());
                 mileage.setValue(0, ed.stringValue());
                 Long pkeyId=tableInfoIds.get(ed.getIndex());
                 Long pkeyId=tableInfoIds.get(ed.getIndex());
                 String findStr="OP['"+cur.getTableName()+"']['"+pkeyId+"@"+cur.getKey()+"__"+ed.getY()+"_"+ed.getX()+"']['TF']";
                 String findStr="OP['"+cur.getTableName()+"']['"+pkeyId+"@"+cur.getKey()+"__"+ed.getY()+"_"+ed.getX()+"']['TF']";
-                String flag=StringUtils.handleNull(Expression.parse(findStr).calculate(tec.getConstantMap()));
                 mileage.setVertical(StringUtils.isEquals(1,StringUtils.handleNull(Expression.parse(findStr).calculate(tec.getConstantMap()))));
                 mileage.setVertical(StringUtils.isEquals(1,StringUtils.handleNull(Expression.parse(findStr).calculate(tec.getConstantMap()))));
                 row.put(line0.getCode(), ed);
                 row.put(line0.getCode(), ed);
                 for (int j = 1; j < relyList.size(); j++) {
                 for (int j = 1; j < relyList.size(); j++) {
@@ -90,14 +85,13 @@ public class FormulaMileage implements FormulaStrategy {
 
 
                 }
                 }
                 mileageList.add(mileage);
                 mileageList.add(mileage);
-
             }
             }
+
         }
         }
         if(Func.isNotEmpty(mileageList)){
         if(Func.isNotEmpty(mileageList)){
               List<String>  zhpw =mileageList.stream().filter(Mileage::isChecked).map(Mileage::getZhPw).collect(Collectors.toList());
               List<String>  zhpw =mileageList.stream().filter(Mileage::isChecked).map(Mileage::getZhPw).collect(Collectors.toList());
             Map<String,String[]> coordinateMap  =  mileageClient.mileage2Coordinate(zhpw,Func.toLong(tec.getConstantMap().get("contractId")));
             Map<String,String[]> coordinateMap  =  mileageClient.mileage2Coordinate(zhpw,Func.toLong(tec.getConstantMap().get("contractId")));
             /*G10缓存对象*/
             /*G10缓存对象*/
-            tec.getConstantMap().put("G10",new Object());
             if(coordinateMap.size()>0){
             if(coordinateMap.size()>0){
                 mileageList.forEach(m->{
                 mileageList.forEach(m->{
                     String[] coordinate = coordinateMap.get(m.getZhPw());
                     String[] coordinate = coordinateMap.get(m.getZhPw());
@@ -118,7 +112,7 @@ public class FormulaMileage implements FormulaStrategy {
                     }
                     }
                 });
                 });
                 data.forEach(e->{e.setUpdate(1);e.setFinished(Boolean.TRUE);});
                 data.forEach(e->{e.setUpdate(1);e.setFinished(Boolean.TRUE);});
-
+                forG10(mileageList,tec);
             }
             }
 
 
         }
         }
@@ -126,7 +120,14 @@ public class FormulaMileage implements FormulaStrategy {
     }
     }
     public static final Pattern MILE_P = Pattern.compile("(?<=T\\(com.mixsmart.utils.CustomFunction\\).MILE\\()([^,]+),([^,]+)(?=,)");
     public static final Pattern MILE_P = Pattern.compile("(?<=T\\(com.mixsmart.utils.CustomFunction\\).MILE\\()([^,]+),([^,]+)(?=,)");
 
 
-
+    public void forG10(List<Mileage> data,TableElementConverter tec){
+          if(Func.isNotEmpty(data)){
+              Map<String,Object> g10 = (Map<String, Object>) tec.getConstantMap().computeIfAbsent("G10", k->new HashMap<>());
+              g10.put("dx",data.stream().map(Mileage::getDx).collect(Collectors.toList()));
+              g10.put("dxnv",data.stream().filter(e->!e.getVertical()).map(Mileage::getDx).collect(Collectors.toList()));
+              g10.put("dxv",data.stream().filter(Mileage::getVertical).map(Mileage::getDx).collect(Collectors.toList()));
+          }
+    }
 
 
     public void write( LinkedHashMap<String,ElementData> row,List<Object>data,List<String> keys,List<String> scale3){
     public void write( LinkedHashMap<String,ElementData> row,List<Object>data,List<String> keys,List<String> scale3){
               if(ListUtils.isNotEmpty(data)){
               if(ListUtils.isNotEmpty(data)){

+ 12 - 8
blade-service/blade-manager/src/main/java/org/springblade/manager/formula/impl/FormulaTurnPoint.java

@@ -1,6 +1,7 @@
 package org.springblade.manager.formula.impl;
 package org.springblade.manager.formula.impl;
 
 
 import cn.hutool.core.util.ReUtil;
 import cn.hutool.core.util.ReUtil;
+import com.jfireel.expression.Expression;
 import com.mixsmart.utils.FormulaUtils;
 import com.mixsmart.utils.FormulaUtils;
 import com.mixsmart.utils.StringUtils;
 import com.mixsmart.utils.StringUtils;
 import lombok.Data;
 import lombok.Data;
@@ -8,8 +9,7 @@ import org.springblade.core.tool.utils.Func;
 import org.springblade.manager.dto.ElementData;
 import org.springblade.manager.dto.ElementData;
 import org.springblade.manager.dto.FormData;
 import org.springblade.manager.dto.FormData;
 import org.springblade.manager.entity.Formula;
 import org.springblade.manager.entity.Formula;
-import org.springblade.manager.formula.FormulaStrategy;
-import org.springblade.manager.formula.ITurnPointCalculator;
+import org.springblade.manager.formula.*;
 import org.springframework.stereotype.Component;
 import org.springframework.stereotype.Component;
 import java.util.*;
 import java.util.*;
 import java.util.concurrent.atomic.AtomicInteger;
 import java.util.concurrent.atomic.AtomicInteger;
@@ -60,6 +60,7 @@ public class FormulaTurnPoint implements FormulaStrategy {
             for(int i=0;i<KEYS.size();i++){
             for(int i=0;i<KEYS.size();i++){
                 configMap.put(KEYS.get(i),this.args.get(i));
                 configMap.put(KEYS.get(i),this.args.get(i));
             }
             }
+            List<Long> tableInfoIds= tec.getKeyMappers().stream().filter(k->k.getTableName().equals(cur.getTableName())).map(KeyMapper::getPkId).distinct().collect(Collectors.toList());
             while (cda.hasNext()) {
             while (cda.hasNext()) {
                 LinkedHashMap<String, ElementData> map = cda.next();
                 LinkedHashMap<String, ElementData> map = cda.next();
                 if(!map.get(configMap.get(KEYS.get(0))).isEmpty()){
                 if(!map.get(configMap.get(KEYS.get(0))).isEmpty()){
@@ -67,25 +68,28 @@ public class FormulaTurnPoint implements FormulaStrategy {
                     KEYS.forEach(k->{
                     KEYS.forEach(k->{
                         ElementData ed = map.get(c(k));
                         ElementData ed = map.get(c(k));
                         tmp.put(configMap.get(k),ed.stringValue());
                         tmp.put(configMap.get(k),ed.stringValue());
+                        /*V判断*/
+                        if(CD.equals(k)){
+                            Long pkeyId=tableInfoIds.get(ed.getIndex());
+                            String findStr="OP['"+cur.getTableName()+"']['"+pkeyId+"@"+cur.getKey()+"__"+ed.getY()+"_"+ed.getX()+"']['TF']";
+                            tmp.put("vertical",StringUtils.handleNull(Expression.parse(findStr).calculate(tec.getConstantMap())));
+                        }
+
                     });
                     });
                     tableData.add(tmp);
                     tableData.add(tmp);
                 }
                 }
             }
             }
-           List<Object> data= ITurnPointCalculator.create(tableData,configMap);
+            Map<String,Object> g8 = (Map<String, Object>) tec.getConstantMap().computeIfAbsent("G8", k->new HashMap<>());
+           List<Object> data= ITurnPointCalculator.create(tableData,configMap,g8);
             if(Func.isNotEmpty(data)){
             if(Func.isNotEmpty(data)){
                 AtomicInteger ai = new AtomicInteger();
                 AtomicInteger ai = new AtomicInteger();
                 Map<Integer,List<Object>> dataMap = data.stream().collect(Collectors.groupingBy(e->ai.getAndAdd(1)%configMap.size()));
                 Map<Integer,List<Object>> dataMap = data.stream().collect(Collectors.groupingBy(e->ai.getAndAdd(1)%configMap.size()));
                 ai.set(0);
                 ai.set(0);
                 dataSourceMap.forEach((k,v)->{
                 dataSourceMap.forEach((k,v)->{
                     List<Object> dl =dataMap.get(ai.getAndIncrement());
                     List<Object> dl =dataMap.get(ai.getAndIncrement());
-//                    List<ElementData> list = v.getValues();
                     v.setUpdate(1);
                     v.setUpdate(1);
                     v.setFinished(Boolean.TRUE);
                     v.setFinished(Boolean.TRUE);
                     FormulaUtils.write(v,dl);
                     FormulaUtils.write(v,dl);
-//                    for(int n=0;n<dl.size();n++){
-//                        ElementData ed = list.get(n);
-//                        ed.setValue(dl.get(n));
-//                    }
                 });
                 });
             }
             }
 
 

+ 0 - 1
blade-service/blade-manager/src/main/java/org/springblade/manager/service/IContractInfoService.java

@@ -73,5 +73,4 @@ public interface IContractInfoService extends BaseService<ContractInfo> {
     Map<String, Object> trialRelationTree(String wbsId, String projectId, String contractId, String selfId);
     Map<String, Object> trialRelationTree(String wbsId, String projectId, String contractId, String selfId);
 
 
     Map<Long, List<WbsTreeContractTreeAllVO>> treeAllJL(String contractId, Integer type);
     Map<Long, List<WbsTreeContractTreeAllVO>> treeAllJL(String contractId, Integer type);
-
 }
 }

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

@@ -106,7 +106,7 @@ public interface IExcelTabService extends BaseService<ExcelTab> {
     Map<String, String> getTablbCols(String pkeyid, String colkey) throws FileNotFoundException;
     Map<String, String> getTablbCols(String pkeyid, String colkey) throws FileNotFoundException;
 
 
     // 获取用户端 单个表单接口数据
     // 获取用户端 单个表单接口数据
-    R getBussDataInfo(Long pkeyId);
+    R getBussDataInfo(Long pkeyId,int type);
 
 
     // 单个pdf 生成
     // 单个pdf 生成
     R getBussPdfInfo(Long pkeyId) throws Exception;
     R getBussPdfInfo(Long pkeyId) throws Exception;

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

@@ -34,6 +34,6 @@ public interface IFormulaService extends BaseService<Formula> {
     void format();
     void format();
 
 
     List<Formula> getFormulaList(List<KeyMapper> keyMapperList);
     List<Formula> getFormulaList(List<KeyMapper> keyMapperList);
-    List<KeyMapper> getKeyMapperList(List<Long> ids,String projectId);
+    List<KeyMapper> getKeyMapperList(List<Long> ids,String projectId,String nodeId);
     Map<String,Object> getElementInfoByCodes(String codes);
     Map<String,Object> getElementInfoByCodes(String codes);
 }
 }

+ 1 - 3
blade-service/blade-manager/src/main/java/org/springblade/manager/service/ITextdictInfoService.java

@@ -18,6 +18,7 @@ package org.springblade.manager.service;
 
 
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.baomidou.mybatisplus.extension.service.IService;
 import org.springblade.core.tool.api.R;
 import org.springblade.core.tool.api.R;
+import org.springblade.manager.dto.RangeInfo;
 import org.springblade.manager.entity.TextdictInfo;
 import org.springblade.manager.entity.TextdictInfo;
 import org.springblade.manager.vo.TextdictDataInfoVO;
 import org.springblade.manager.vo.TextdictDataInfoVO;
 import org.springblade.manager.vo.TextdictInfoVO;
 import org.springblade.manager.vo.TextdictInfoVO;
@@ -42,7 +43,4 @@ public interface ITextdictInfoService extends IService<TextdictInfo> {
 	IPage<TextdictInfoVO> selectTextdictInfoPage(IPage<TextdictInfoVO> page, TextdictInfoVO textdictInfo);
 	IPage<TextdictInfoVO> selectTextdictInfoPage(IPage<TextdictInfoVO> page, TextdictInfoVO textdictInfo);
 
 
 	void deleDataInfoById(String id);
 	void deleDataInfoById(String id);
-
-
-
 }
 }

+ 5 - 0
blade-service/blade-manager/src/main/java/org/springblade/manager/service/IWbsTreeContractService.java

@@ -1,6 +1,7 @@
 package org.springblade.manager.service;
 package org.springblade.manager.service;
 
 
 import org.springblade.core.mp.base.BaseService;
 import org.springblade.core.mp.base.BaseService;
+import org.springblade.manager.dto.RangeInfo;
 import org.springblade.manager.dto.WbsTreeContractDTO;
 import org.springblade.manager.dto.WbsTreeContractDTO;
 import org.springblade.manager.dto.WbsTreeContractDTO2;
 import org.springblade.manager.dto.WbsTreeContractDTO2;
 import org.springblade.manager.entity.ContractRelationJlyz;
 import org.springblade.manager.entity.ContractRelationJlyz;
@@ -9,6 +10,7 @@ import org.springblade.manager.entity.WbsTreePrivate;
 import org.springblade.manager.vo.*;
 import org.springblade.manager.vo.*;
 import org.springframework.web.multipart.MultipartFile;
 import org.springframework.web.multipart.MultipartFile;
 
 
+import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.io.IOException;
 import java.util.List;
 import java.util.List;
 import java.util.Map;
 import java.util.Map;
@@ -51,4 +53,7 @@ public interface IWbsTreeContractService extends BaseService<WbsTreeContract> {
 
 
     // 查询隐蔽工程节点
     // 查询隐蔽工程节点
     List<WbsContractNodeVo> appSearchConcealedNodes(long primaryKeyId, Long contractId);
     List<WbsContractNodeVo> appSearchConcealedNodes(long primaryKeyId, Long contractId);
+
+    // 频率设计值  添加表单
+    boolean addTabInfoByRan(RangeInfo info,List<Object> moreData,Integer excLenght) throws FileNotFoundException;
 }
 }

+ 15 - 7
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/ArTreeContractInitServiceImpl.java

@@ -1,5 +1,6 @@
 package org.springblade.manager.service.impl;
 package org.springblade.manager.service.impl;
 
 
+import com.alibaba.druid.sql.dialect.blink.parser.BlinkCreateTableParser;
 import com.mixsmart.utils.StringUtils;
 import com.mixsmart.utils.StringUtils;
 import io.swagger.annotations.ApiModelProperty;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.AllArgsConstructor;
 import lombok.AllArgsConstructor;
@@ -16,6 +17,7 @@ import org.springblade.manager.feign.ProjectClient;
 import org.springblade.manager.service.IContractInfoService;
 import org.springblade.manager.service.IContractInfoService;
 import org.springblade.manager.service.IWbsTreeService;
 import org.springblade.manager.service.IWbsTreeService;
 import org.springblade.manager.utils.ForestNodeMerger;
 import org.springblade.manager.utils.ForestNodeMerger;
+import org.springblade.manager.utils.ForestNodeMergerEx;
 import org.springblade.manager.vo.*;
 import org.springblade.manager.vo.*;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 
 
@@ -144,7 +146,7 @@ public class ArTreeContractInitServiceImpl {
         List<ArchiveTreeVO2> childList = new ArrayList<>();
         List<ArchiveTreeVO2> childList = new ArrayList<>();
         for (ArchiveTreeVO2 archiveTreeVO2:child) {
         for (ArchiveTreeVO2 archiveTreeVO2:child) {
             List<ArchiveTreeVO2> tmpList = new ArrayList<>();
             List<ArchiveTreeVO2> tmpList = new ArrayList<>();
-            ForestNodeMerger.getTreeList(archiveTreeVO2,tmpList);
+            ForestNodeMergerEx.getTreeList(archiveTreeVO2,tmpList);
             childList.addAll(tmpList);
             childList.addAll(tmpList);
         }
         }
 
 
@@ -167,7 +169,7 @@ public class ArTreeContractInitServiceImpl {
         List<ArchiveTreeVO2> childList = new ArrayList<>();
         List<ArchiveTreeVO2> childList = new ArrayList<>();
         for (ArchiveTreeVO2 archiveTreeVO2:child) {
         for (ArchiveTreeVO2 archiveTreeVO2:child) {
             List<ArchiveTreeVO2> tmpList = new ArrayList<>();
             List<ArchiveTreeVO2> tmpList = new ArrayList<>();
-            ForestNodeMerger.getTreeList(archiveTreeVO2,tmpList);
+            ForestNodeMergerEx.getTreeList(archiveTreeVO2,tmpList);
             childList.addAll(tmpList);
             childList.addAll(tmpList);
         }
         }
         //newRootId = oldNewMap.get(newRootId);
         //newRootId = oldNewMap.get(newRootId);
@@ -238,7 +240,7 @@ public class ArTreeContractInitServiceImpl {
             vo2Map.put(treeContractVO2.getId(),treeContractVO2);
             vo2Map.put(treeContractVO2.getId(),treeContractVO2);
         }
         }
 
 
-        List<ArchiveTreeContractVO2> trees = ForestNodeMerger.merge(archiveTreeContractVO2List);
+        List<ArchiveTreeContractVO2> trees = ForestNodeMergerEx.merge(archiveTreeContractVO2List);
 
 
         InitAncestors(trees.get(0),"0");
         InitAncestors(trees.get(0),"0");
 
 
@@ -296,7 +298,7 @@ public class ArTreeContractInitServiceImpl {
             archiveTreeContractVO2List.add(treeContractVO2);
             archiveTreeContractVO2List.add(treeContractVO2);
         }
         }
 
 
-        List<ArchiveTreeContractVO2> trees = ForestNodeMerger.merge(archiveTreeContractVO2List);
+        List<ArchiveTreeContractVO2> trees = ForestNodeMergerEx.merge(archiveTreeContractVO2List);
 
 
         if (trees != null && trees.size() > 0) {
         if (trees != null && trees.size() > 0) {
            return trees.get(0);
            return trees.get(0);
@@ -317,7 +319,11 @@ public class ArTreeContractInitServiceImpl {
 
 
         List<ArchiveTreeContract> addNodes = new ArrayList<>();
         List<ArchiveTreeContract> addNodes = new ArrayList<>();
         List<ArchiveTreeContractVO2> archiveTreeContractVO2s = new ArrayList<>();
         List<ArchiveTreeContractVO2> archiveTreeContractVO2s = new ArrayList<>();
-        ForestNodeMerger.getTreeList(tree,archiveTreeContractVO2s);
+        ForestNodeMergerEx.getTreeList(tree,archiveTreeContractVO2s);
+        Map<Long,ArchiveTreeContractVO2> map = new LinkedHashMap<>();
+        for (ArchiveTreeContractVO2 ar : archiveTreeContractVO2s) {
+            map.put(ar.getId(),ar);
+        }
 
 
         for (ArchiveTreeContractVO2 ar : archiveTreeContractVO2s) {
         for (ArchiveTreeContractVO2 ar : archiveTreeContractVO2s) {
             //关联质检资料
             //关联质检资料
@@ -338,11 +344,14 @@ public class ArTreeContractInitServiceImpl {
         List<ArchiveTreeContract> archiveTreeContracts = new ArrayList<>();
         List<ArchiveTreeContract> archiveTreeContracts = new ArrayList<>();
 
 
         Long contractId = subTree.getContractId();
         Long contractId = subTree.getContractId();
+        if (contractId == null ) {
+            return archiveTreeContracts;
+        }
         Long level = Long.parseLong(subTree.getDisplayHierarchy());
         Long level = Long.parseLong(subTree.getDisplayHierarchy());
 
 
         //1. 获取子树链表
         //1. 获取子树链表
         List<ArchiveTreeContractVO2> treeContractVO2s = new ArrayList<>();
         List<ArchiveTreeContractVO2> treeContractVO2s = new ArrayList<>();
-        ForestNodeMerger.getTreeList(subTree,treeContractVO2s);
+        ForestNodeMergerEx.getTreeList(subTree,treeContractVO2s);
 
 
         //2. 获取对应合同的树
         //2. 获取对应合同的树
         //List<WbsTreeContractVO6> wbsTreeContractVO6s =  contractInfoService.tree6List(wbsId.toString(),projectId.toString(),contractId.toString());
         //List<WbsTreeContractVO6> wbsTreeContractVO6s =  contractInfoService.tree6List(wbsId.toString(),projectId.toString(),contractId.toString());
@@ -485,7 +494,6 @@ public class ArTreeContractInitServiceImpl {
     /**
     /**
      * 获取节点对应的单位
      * 获取节点对应的单位
      * @param archiveTreeContract
      * @param archiveTreeContract
-     * @param contractInfo
      * @return
      * @return
      */
      */
     public String getUnit(ArchiveTreeContract archiveTreeContract,Map<Long,ContractInfo> contractMap){
     public String getUnit(ArchiveTreeContract archiveTreeContract,Map<Long,ContractInfo> contractMap){

+ 34 - 2
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/ArchiveTreeContractServiceImpl.java

@@ -41,6 +41,7 @@ import org.springblade.manager.service.IArchiveTreeService;
 import org.springblade.manager.service.IContractInfoService;
 import org.springblade.manager.service.IContractInfoService;
 import org.springblade.manager.service.IProjectInfoService;
 import org.springblade.manager.service.IProjectInfoService;
 import org.springblade.manager.utils.DiffListUtil;
 import org.springblade.manager.utils.DiffListUtil;
+import org.springblade.manager.utils.ForestNodeMergerEx;
 import org.springblade.manager.vo.*;
 import org.springblade.manager.vo.*;
 import org.springblade.manager.mapper.ArchiveTreeContractMapper;
 import org.springblade.manager.mapper.ArchiveTreeContractMapper;
 import org.springblade.manager.service.IArchiveTreeContractService;
 import org.springblade.manager.service.IArchiveTreeContractService;
@@ -63,6 +64,7 @@ import java.util.stream.Collectors;
 public class ArchiveTreeContractServiceImpl extends BaseServiceImpl<ArchiveTreeContractMapper, ArchiveTreeContract> implements IArchiveTreeContractService {
 public class ArchiveTreeContractServiceImpl extends BaseServiceImpl<ArchiveTreeContractMapper, ArchiveTreeContract> implements IArchiveTreeContractService {
 
 
 	private final ArchiveTreeContractMapper archiveTreeContractMapper;
 	private final ArchiveTreeContractMapper archiveTreeContractMapper;
+	private final ArchiveTreeMapper archiveTreeMapper;
 
 
 	private final IArchiveTreeService archiveTreeService;
 	private final IArchiveTreeService archiveTreeService;
 
 
@@ -80,6 +82,35 @@ public class ArchiveTreeContractServiceImpl extends BaseServiceImpl<ArchiveTreeC
 
 
 	@Override
 	@Override
 	public boolean initTree2(String tenantId, Long projectId){
 	public boolean initTree2(String tenantId, Long projectId){
+		if (projectId == null || projectId == 0) {
+			return false;
+		}
+
+		//判断客户级是否存在
+		QueryWrapper<ArchiveTreeContract> queryWrapper = new QueryWrapper<>();
+		queryWrapper.eq("parent_id", 0);
+		queryWrapper.eq("project_id", projectId);
+		queryWrapper.eq("status", 1);
+		queryWrapper.eq("is_deleted", 0);
+		ArchiveTreeContract archiveTreeContract1 = archiveTreeContractMapper.selectOne(queryWrapper);
+		if (archiveTreeContract1 != null) {
+			throw new ServiceException("根节点已存在,请先删除后再进行初始化");
+		}
+
+		//判断项目级是否存在
+		QueryWrapper<ArchiveTree> queryWrapper1 = new QueryWrapper<>();
+		queryWrapper1.eq("parent_id", 0);
+		queryWrapper1.eq("project_id", projectId);
+		queryWrapper1.eq("status", 1);
+		queryWrapper1.eq("is_deleted", 0);
+		ArchiveTree archiveTree = archiveTreeMapper.selectOne(queryWrapper1);
+		if (archiveTree == null ) {
+			boolean bRet = archiveTreeService.initArchiveProjectTree(projectId);
+			if (bRet == false) {
+				return bRet;
+			}
+		}
+
 
 
 		List<ArchiveTreeVO2> tree = archiveTreeService.tree2(AuthUtil.getTenantId(), projectId,null, null,null,false);
 		List<ArchiveTreeVO2> tree = archiveTreeService.tree2(AuthUtil.getTenantId(), projectId,null, null,null,false);
 		if (tree == null || tree.size() == 0) {
 		if (tree == null || tree.size() == 0) {
@@ -107,6 +138,7 @@ public class ArchiveTreeContractServiceImpl extends BaseServiceImpl<ArchiveTreeC
 
 
 		ArchiveTreeContractVO2 newTree = arTreeContractInitService.getTree(archiveTreeContracts);
 		ArchiveTreeContractVO2 newTree = arTreeContractInitService.getTree(archiveTreeContracts);
 
 
+
 		List<ArchiveTreeContract> addNodes = arTreeContractInitService.getContractProcExtNodes(tenantId,projectId,wbsId,newTree);
 		List<ArchiveTreeContract> addNodes = arTreeContractInitService.getContractProcExtNodes(tenantId,projectId,wbsId,newTree);
 		archiveTreeContracts.addAll(addNodes);
 		archiveTreeContracts.addAll(addNodes);
 
 
@@ -142,13 +174,13 @@ public class ArchiveTreeContractServiceImpl extends BaseServiceImpl<ArchiveTreeC
 		if (AuthUtil.isAdministrator()) {
 		if (AuthUtil.isAdministrator()) {
 			tenantId = StringPool.EMPTY;
 			tenantId = StringPool.EMPTY;
 		}
 		}
-		return ForestNodeMerger.merge(baseMapper.lazyTree2(tenantId, parentId,projectId,getAuthCode(contractId),getAuthContractId(contractId)));
+		return ForestNodeMergerEx.merge(baseMapper.lazyTree2(tenantId, parentId,projectId,getAuthCode(contractId),getAuthContractId(contractId)));
 	}
 	}
 
 
 	@Override
 	@Override
 	public List<ArchiveTreeContractVO2> tree2(String tenantId, Integer disPlayTree, Integer nodeType, Long projectId, Long contractId) {
 	public List<ArchiveTreeContractVO2> tree2(String tenantId, Integer disPlayTree, Integer nodeType, Long projectId, Long contractId) {
 
 
-		return ForestNodeMerger.merge(baseMapper.tree2(tenantId, disPlayTree, nodeType,projectId,getAuthCode(contractId),getAuthContractId(contractId)));
+		return ForestNodeMergerEx.merge(baseMapper.tree2(tenantId, disPlayTree, nodeType,projectId,getAuthCode(contractId),getAuthContractId(contractId)));
 	}
 	}
 
 
 
 

+ 5 - 4
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/ArchiveTreeServiceImpl.java

@@ -21,6 +21,7 @@ import org.springblade.manager.service.IWbsTreePrivateService;
 import org.springblade.manager.service.IWbsTreeService;
 import org.springblade.manager.service.IWbsTreeService;
 import org.springblade.manager.utils.DiffListUtil;
 import org.springblade.manager.utils.DiffListUtil;
 import org.springblade.manager.utils.ForestNodeMerger;
 import org.springblade.manager.utils.ForestNodeMerger;
+import org.springblade.manager.utils.ForestNodeMergerEx;
 import org.springblade.manager.vo.*;
 import org.springblade.manager.vo.*;
 import org.springblade.manager.mapper.ArchiveTreeMapper;
 import org.springblade.manager.mapper.ArchiveTreeMapper;
 import org.springblade.manager.service.IArchiveTreeService;
 import org.springblade.manager.service.IArchiveTreeService;
@@ -158,7 +159,7 @@ public class ArchiveTreeServiceImpl extends BaseServiceImpl<ArchiveTreeMapper, A
         }
         }
 
 
         List<ArchiveTreeVO2> trees = new ArrayList<>();
         List<ArchiveTreeVO2> trees = new ArrayList<>();
-        ForestNodeMerger.getTreeList(sysTrees.get(0),trees);
+        ForestNodeMergerEx.getTreeList(sysTrees.get(0),trees);
 
 
         List<ArchiveTree> archiveTrees = new ArrayList<>();
         List<ArchiveTree> archiveTrees = new ArrayList<>();
         Map<Long,Long> oldNewMap = new LinkedHashMap<>();
         Map<Long,Long> oldNewMap = new LinkedHashMap<>();
@@ -224,7 +225,7 @@ public class ArchiveTreeServiceImpl extends BaseServiceImpl<ArchiveTreeMapper, A
             }
             }
         }
         }
 
 
-        return ForestNodeMerger.merge(archiveTreeVO2List);
+        return ForestNodeMergerEx.merge(archiveTreeVO2List);
     }
     }
 
 
 //    @Override
 //    @Override
@@ -237,7 +238,7 @@ public class ArchiveTreeServiceImpl extends BaseServiceImpl<ArchiveTreeMapper, A
     @Override
     @Override
     public List<ArchiveTreeVO2> tree2(String tenantId,Long projectId, Integer disPlayTree, Integer nodeType,String wbsId,boolean bgetExtNodes) {
     public List<ArchiveTreeVO2> tree2(String tenantId,Long projectId, Integer disPlayTree, Integer nodeType,String wbsId,boolean bgetExtNodes) {
         List<ArchiveTreeVO2> archiveTreeVOList = baseMapper.tree2(tenantId, projectId,disPlayTree, nodeType);
         List<ArchiveTreeVO2> archiveTreeVOList = baseMapper.tree2(tenantId, projectId,disPlayTree, nodeType);
-        List<ArchiveTreeVO2> treeVO2s = ForestNodeMerger.merge(archiveTreeVOList);
+        List<ArchiveTreeVO2> treeVO2s = ForestNodeMergerEx.merge(archiveTreeVOList);
         //todo 遍历树,找到质检节点,调用getWbsArchiveTree,根据关联层级,拼接上去
         //todo 遍历树,找到质检节点,调用getWbsArchiveTree,根据关联层级,拼接上去
         //是否获取扩展的wbs节点
         //是否获取扩展的wbs节点
         if (StringUtils.isEmpty(wbsId) && projectId != 0 && bgetExtNodes) {
         if (StringUtils.isEmpty(wbsId) && projectId != 0 && bgetExtNodes) {
@@ -421,7 +422,7 @@ public class ArchiveTreeServiceImpl extends BaseServiceImpl<ArchiveTreeMapper, A
         }
         }
 
 
         //设置pid
         //设置pid
-        List<ArchiveTreeVO2> archiveTreeVO2s = ForestNodeMerger.merge(archiveTreeList);
+        List<ArchiveTreeVO2> archiveTreeVO2s = ForestNodeMergerEx.merge(archiveTreeList);
         if (archiveTreeVO2s != null && archiveTreeVO2s.size() > 0 ) {
         if (archiveTreeVO2s != null && archiveTreeVO2s.size() > 0 ) {
             return archiveTreeVO2s.get(0);
             return archiveTreeVO2s.get(0);
         }
         }

+ 26 - 24
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/ExcelTabServiceImpl.java

@@ -18,7 +18,6 @@ package org.springblade.manager.service.impl;
 
 
 import cn.hutool.core.date.StopWatch;
 import cn.hutool.core.date.StopWatch;
 import cn.hutool.log.StaticLog;
 import cn.hutool.log.StaticLog;
-import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -27,22 +26,21 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.mixsmart.utils.ListUtils;
 import com.mixsmart.utils.ListUtils;
 import com.mixsmart.utils.RegexUtils;
 import com.mixsmart.utils.RegexUtils;
-import com.spire.xls.*;
 import com.spire.xls.CellRange;
 import com.spire.xls.CellRange;
 import com.spire.xls.Workbook;
 import com.spire.xls.Workbook;
+import com.spire.xls.*;
 import lombok.AllArgsConstructor;
 import lombok.AllArgsConstructor;
 import org.apache.commons.lang.StringUtils;
 import org.apache.commons.lang.StringUtils;
 import org.apache.commons.lang3.ObjectUtils;
 import org.apache.commons.lang3.ObjectUtils;
-import org.apache.poi.ss.usermodel.*;
 import org.apache.poi.ss.usermodel.CellStyle;
 import org.apache.poi.ss.usermodel.CellStyle;
 import org.apache.poi.ss.usermodel.Font;
 import org.apache.poi.ss.usermodel.Font;
+import org.apache.poi.ss.usermodel.*;
 import org.apache.poi.ss.util.CellRangeAddress;
 import org.apache.poi.ss.util.CellRangeAddress;
 import org.apache.poi.util.IOUtils;
 import org.apache.poi.util.IOUtils;
 import org.jsoup.Jsoup;
 import org.jsoup.Jsoup;
 import org.jsoup.nodes.Document;
 import org.jsoup.nodes.Document;
 import org.jsoup.nodes.Element;
 import org.jsoup.nodes.Element;
 import org.jsoup.select.Elements;
 import org.jsoup.select.Elements;
-import org.springblade.business.dto.TrialSelfInspectionRecordDTO;
 import org.springblade.business.entity.InformationQuery;
 import org.springblade.business.entity.InformationQuery;
 import org.springblade.business.entity.TrialSelfInspectionRecord;
 import org.springblade.business.entity.TrialSelfInspectionRecord;
 import org.springblade.business.feign.ContractLogClient;
 import org.springblade.business.feign.ContractLogClient;
@@ -60,8 +58,8 @@ import org.springblade.core.oss.model.BladeFile;
 import org.springblade.core.secure.utils.AuthUtil;
 import org.springblade.core.secure.utils.AuthUtil;
 import org.springblade.core.tool.api.R;
 import org.springblade.core.tool.api.R;
 import org.springblade.core.tool.node.ForestNodeMerger;
 import org.springblade.core.tool.node.ForestNodeMerger;
-import org.springblade.core.tool.utils.*;
 import org.springblade.core.tool.utils.DateUtil;
 import org.springblade.core.tool.utils.DateUtil;
+import org.springblade.core.tool.utils.*;
 import org.springblade.manager.bean.TableInfo;
 import org.springblade.manager.bean.TableInfo;
 import org.springblade.manager.entity.*;
 import org.springblade.manager.entity.*;
 import org.springblade.manager.formula.KeyMapper;
 import org.springblade.manager.formula.KeyMapper;
@@ -79,14 +77,9 @@ import org.springframework.jdbc.datasource.DataSourceTransactionManager;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.TransactionDefinition;
 import org.springframework.transaction.TransactionDefinition;
 import org.springframework.transaction.TransactionStatus;
 import org.springframework.transaction.TransactionStatus;
-import org.springframework.transaction.annotation.Transactional;
 import org.springframework.transaction.support.DefaultTransactionDefinition;
 import org.springframework.transaction.support.DefaultTransactionDefinition;
-import org.springframework.web.bind.annotation.RequestParam;
 
 
 import javax.imageio.ImageIO;
 import javax.imageio.ImageIO;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.awt.*;
 import java.awt.Color;
 import java.awt.Color;
 import java.awt.image.BufferedImage;
 import java.awt.image.BufferedImage;
 import java.io.*;
 import java.io.*;
@@ -343,7 +336,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
             /*每次都是部分表单提交,保证跨节点跨表取数正常,其次是反向依赖的被动刷新*/
             /*每次都是部分表单提交,保证跨节点跨表取数正常,其次是反向依赖的被动刷新*/
             List<AppWbsTreeContractVO> tableAll = wbsTreeContractService.searchNodeAllTable(nodeId.toString(), "1", tableInfoList.get(0).getContractId(), tableInfoList.get(0).getProjectId());
             List<AppWbsTreeContractVO> tableAll = wbsTreeContractService.searchNodeAllTable(nodeId.toString(), "1", tableInfoList.get(0).getContractId(), tableInfoList.get(0).getProjectId());
             StopWatch stopWatch = new StopWatch();
             StopWatch stopWatch = new StopWatch();
-            List<KeyMapper> keyMappers = this.formulaService.getKeyMapperList(tableInfoList.stream().map(TableInfo::getPkeyId).filter(Func::isNotEmpty).map(Long::parseLong).collect(Collectors.toList()), tableInfoList.get(0).getProjectId());
+            List<KeyMapper> keyMappers = this.formulaService.getKeyMapperList(tableInfoList.stream().map(TableInfo::getPkeyId).filter(Func::isNotEmpty).map(Long::parseLong).collect(Collectors.toList()), tableInfoList.get(0).getProjectId(),String.valueOf(nodeId));
             if (Func.isNotEmpty(keyMappers)) {
             if (Func.isNotEmpty(keyMappers)) {
                 Map<String, Map<String, String>> coordinateMap = new HashMap<>(keyMappers.size() * 2);
                 Map<String, Map<String, String>> coordinateMap = new HashMap<>(keyMappers.size() * 2);
                 keyMappers.forEach(e -> {
                 keyMappers.forEach(e -> {
@@ -863,7 +856,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
     }
     }
 
 
     @Override
     @Override
-    public R getBussDataInfo(Long pkeyId) {
+    public R getBussDataInfo(Long pkeyId,int type) {
 
 
         Map<String, Object> reData = new HashMap<>();
         Map<String, Object> reData = new HashMap<>();
 
 
@@ -1065,20 +1058,25 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
         }
         }
 
 
         // 移除Id 和 p_key_id
         // 移除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(type==0){
+            reData.remove("id");
+            reData.remove("p_key_id");
+            reData.remove("classify");
+            reData.remove("contractId");
+            reData.remove("pkeyId");
+            reData.remove("projectId");
+        }
+        if(type==1){
+            reData.put("pkeyId",reData.get("p_key_id"));
+        }
         reData.put("tabGroupId", wbsTreeContract.getTabGroupId());
         reData.put("tabGroupId", wbsTreeContract.getTabGroupId());
         return R.data(reData);
         return R.data(reData);
     }
     }
 
 
     @Override
     @Override
     public R getBussPdfInfo(Long pkeyId) throws Exception {
     public R getBussPdfInfo(Long pkeyId) throws Exception {
-        String file_path = ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
-        // String file_path = "/Users/hongchuangyanfa/Desktop/";
+        //String file_path = ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
+        String file_path = "/Users/hongchuangyanfa/Desktop/";
         WbsTreeContract wbsTreeContract = wbsTreeContractService.getBaseMapper().selectOne(Wrappers.<WbsTreeContract>query().lambda()
         WbsTreeContract wbsTreeContract = wbsTreeContractService.getBaseMapper().selectOne(Wrappers.<WbsTreeContract>query().lambda()
                 .eq(WbsTreeContract::getPKeyId, pkeyId));
                 .eq(WbsTreeContract::getPKeyId, pkeyId));
 
 
@@ -1103,7 +1101,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
             return R.fail("失败");
             return R.fail("失败");
         }
         }
 
 
-        Map<String, Object> DataInfo = (Map<String, Object>) getBussDataInfo(pkeyId).getData();
+        Map<String, Object> DataInfo = (Map<String, Object>) getBussDataInfo(pkeyId,0).getData();
 
 
         // 获取excel流 和 html流
         // 获取excel流 和 html流
         InputStream exceInp = CommonUtil.getOSSInputStream(excelTab.getFileUrl());
         InputStream exceInp = CommonUtil.getOSSInputStream(excelTab.getFileUrl());
@@ -1287,6 +1285,10 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
                                 Elements tdsx = ytzData.select("td");
                                 Elements tdsx = ytzData.select("td");
                                 if (Integer.parseInt(trtd[1]) < tdsx.size()) {
                                 if (Integer.parseInt(trtd[1]) < tdsx.size()) {
                                     Element data = ytzData.select("td").get(Integer.parseInt(trtd[1]));
                                     Element data = ytzData.select("td").get(Integer.parseInt(trtd[1]));
+                                    if(data.html().indexOf("el-tooltip") >= 0){
+                                        data = data.children().get(0);
+                                    }
+
                                     int x1 = Integer.parseInt(data.children().get(0).attr("x1"));
                                     int x1 = Integer.parseInt(data.children().get(0).attr("x1"));
                                     if (x1 == 0) {
                                     if (x1 == 0) {
                                         x1 = 1;
                                         x1 = 1;
@@ -1324,7 +1326,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
         //输出流
         //输出流
         FileOutputStream outputStream = new FileOutputStream(excelPath);
         FileOutputStream outputStream = new FileOutputStream(excelPath);
         workbook.write(outputStream);
         workbook.write(outputStream);
-        FileUtils.excelToPdf(excelPath, pdfPath);
+        FileUtils.setExcelScaleToPdf(excelPath, pdfPath);
         BladeFile bladeFile = newIOSSClient.uploadFile(pkeyId + ".pdf", pdfPath);
         BladeFile bladeFile = newIOSSClient.uploadFile(pkeyId + ".pdf", pdfPath);
         //
         //
         TableFile tableFile1 = tableFileService.getBaseMapper().selectOne(Wrappers.<TableFile>query().lambda()
         TableFile tableFile1 = tableFileService.getBaseMapper().selectOne(Wrappers.<TableFile>query().lambda()
@@ -1378,8 +1380,8 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
 
 
     @Override
     @Override
     public void getBussPdfs(String nodeId, String classify, String contractId, String projectId) throws Exception {
     public void getBussPdfs(String nodeId, String classify, String contractId, String projectId) throws Exception {
-        String file_path = ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
-        //String file_path = "/Users/hongchuangyanfa/Desktop/";
+        //String file_path = ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
+        String file_path = "/Users/hongchuangyanfa/Desktop/";
         // 获取有权限的节点信息
         // 获取有权限的节点信息
         List<AppWbsTreeContractVO> wbsTreeContractList = wbsTreeContractService.searchNodeAllTable(nodeId, classify, contractId, projectId);
         List<AppWbsTreeContractVO> wbsTreeContractList = wbsTreeContractService.searchNodeAllTable(nodeId, classify, contractId, projectId);
         List<String> data = new ArrayList<>();
         List<String> data = new ArrayList<>();

+ 45 - 3
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/FormulaServiceImpl.java

@@ -46,6 +46,9 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
     private final IContractInfoService contractInfoService;
     private final IContractInfoService contractInfoService;
     private final IProjectInfoService projectInfoService;
     private final IProjectInfoService projectInfoService;
     private final IWbsTreeContractService wbsTreeContractService;
     private final IWbsTreeContractService wbsTreeContractService;
+    private final IWbsTreePrivateService wbsTreePrivateService;
+    private final IElementFormulaMappingService elementFormulaMappingService;
+    private final IWbsTreeService wbsTreeService;
     private final JdbcTemplate jdbcTemplate;
     private final JdbcTemplate jdbcTemplate;
     private final IFormulaOptionService formulaOptionService;
     private final IFormulaOptionService formulaOptionService;
     /**  private final Container env;*/
     /**  private final Container env;*/
@@ -647,7 +650,7 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
     }
     }
 
 
     @Override
     @Override
-    public List<KeyMapper> getKeyMapperList(List<Long> ids,String projectId) {
+    public List<KeyMapper> getKeyMapperList(List<Long> ids,String projectId,String nodeId) {
         /*表名,pkeyId,元素名,元素id 映射对象*/
         /*表名,pkeyId,元素名,元素id 映射对象*/
         String pkIds=ids.stream().map(String::valueOf).collect(Collectors.joining(","));
         String pkIds=ids.stream().map(String::valueOf).collect(Collectors.joining(","));
         List<Map<String,Object>> listMap = this.jdbcTemplate.queryForList(" select a.init_table_name as tableName,a.p_key_id as pkId ,c.e_key as field,c.e_name as eName,c.id  as fieldId   " +
         List<Map<String,Object>> listMap = this.jdbcTemplate.queryForList(" select a.init_table_name as tableName,a.p_key_id as pkId ,c.e_key as field,c.e_name as eName,c.id  as fieldId   " +
@@ -675,6 +678,40 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
                     }
                     }
                 });
                 });
             }
             }
+            /*节点参数公式*/
+            if(StringUtils.isNotEmpty(nodeId)){
+                /*存在工序节点id则检查节点参数*/
+                WbsTreeContract wtc = this.wbsTreeContractService.getOne(Wrappers.<WbsTreeContract>lambdaQuery().eq(WbsTreeContract::getPKeyId,nodeId));
+                if(wtc!=null){
+                    List<WbsParam> total = new ArrayList<>();
+                    WbsTreePrivate wtp = this.wbsTreePrivateService.getOne(Wrappers.<WbsTreePrivate>lambdaQuery().eq(WbsTreePrivate::getProjectId,wtc.getProjectId()).eq(WbsTreePrivate::getWbsId,wtc.getWbsId()).and(e->e.eq(WbsTreePrivate::getId,wtc.getId()).or().eq(WbsTreePrivate::getId,wtc.getOldId())));
+                    if(wtp!=null){
+                        List<WbsParam> wpsPrivate = this.wpService.list(Wrappers.<WbsParam>lambdaQuery().eq(WbsParam::getNodeId,wtp.getPKeyId()));
+                        if(Func.isEmpty(wpsPrivate)){
+                            WbsTree wt = this.wbsTreeService.getOne(Wrappers.<WbsTree>lambdaQuery().and(e->e.eq(WbsTree::getId,wtc.getId()).or().eq(WbsTree::getId,wtc.getOldId())));
+                            if(wt!=null){
+                                List<WbsParam> wpsPublic = this.wpService.list(Wrappers.<WbsParam>lambdaQuery().eq(WbsParam::getNodeId,wt.getId()));
+                                if(Func.isNotEmpty(wpsPublic)){
+                                    total.addAll(wpsPublic);
+                                }
+                            }
+                        }else{
+                            total.addAll(wpsPrivate);
+                        }
+                    }
+                    if(Func.isNotEmpty(total)){
+                      List<ElementFormulaMapping> mappingList =  this.elementFormulaMappingService.list(Wrappers.<ElementFormulaMapping>lambdaQuery().in(ElementFormulaMapping::getParamId,total.stream().map(WbsParam::getId).collect(Collectors.toList())));
+                      if(Func.isNotEmpty(mappingList)){
+                          list.forEach(e->{
+                              mappingList.stream().filter(m->StringUtils.isEquals(m.getElementId(),e.getFieldId())).findAny().ifPresent(d->{
+                                  e.setFormulaId(d.getFormulaId());
+                              });
+                          });
+
+                      }
+                    }
+                }
+            }
             if(list.size()>0){
             if(list.size()>0){
                 return list;
                 return list;
             }
             }
@@ -867,8 +904,13 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
                              FormData dataFd=this.formDataMap.get(codeList.get(0));
                              FormData dataFd=this.formDataMap.get(codeList.get(0));
                              FormData designFd=this.formDataMap.get(codeList.get(1));
                              FormData designFd=this.formDataMap.get(codeList.get(1));
                              if(dataFd!=null&&designFd!=null){
                              if(dataFd!=null&&designFd!=null){
-                                 List<Object>  result =  CustomFunction.b445check(dataFd.getValues().stream().map(ElementData::getValue).collect(Collectors.toList()),designFd.getValues().stream().map(ElementData::getValue).collect(Collectors.toList()),formula.getDev(),1 );
-                                 data=result.get(1);
+                                 if(designFd.getValues().size()>0){
+                                     /*多少个设计值暂时默认全部合格,满足绝大部分结果*/
+                                     data=dataFd.getValues().size();
+                                 }else{
+                                     List<Object>  result =  CustomFunction.b445check(dataFd.getValues().stream().map(ElementData::getValue).collect(Collectors.toList()),designFd.getValues().stream().map(ElementData::getValue).collect(Collectors.toList()),formula.getDev(),1 );
+                                     data=result.get(1);
+                                 }
                              }
                              }
                          }
                          }
 
 

+ 63 - 3
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/WbsTreeContractServiceImpl.java

@@ -4,9 +4,12 @@ import cn.hutool.core.util.ObjectUtil;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import lombok.AllArgsConstructor;
 import lombok.AllArgsConstructor;
 import org.apache.commons.lang.StringUtils;
 import org.apache.commons.lang.StringUtils;
+import org.jsoup.Jsoup;
+import org.jsoup.nodes.Document;
 import org.springblade.business.entity.ConstructionLedger;
 import org.springblade.business.entity.ConstructionLedger;
 import org.springblade.business.feign.ConstructionLedgerFeignClient;
 import org.springblade.business.feign.ConstructionLedgerFeignClient;
 import org.springblade.common.utils.FileUtils;
 import org.springblade.common.utils.FileUtils;
@@ -15,9 +18,8 @@ import org.springblade.core.log.exception.ServiceException;
 import org.springblade.core.mp.base.BaseServiceImpl;
 import org.springblade.core.mp.base.BaseServiceImpl;
 import org.springblade.core.secure.utils.AuthUtil;
 import org.springblade.core.secure.utils.AuthUtil;
 import org.springblade.core.tool.node.ForestNodeMerger;
 import org.springblade.core.tool.node.ForestNodeMerger;
-import org.springblade.core.tool.utils.BeanUtil;
-import org.springblade.core.tool.utils.Func;
-import org.springblade.core.tool.utils.StringUtil;
+import org.springblade.core.tool.utils.*;
+import org.springblade.manager.dto.RangeInfo;
 import org.springblade.manager.dto.WbsTreeContractDTO;
 import org.springblade.manager.dto.WbsTreeContractDTO;
 import org.springblade.manager.dto.WbsTreeContractDTO2;
 import org.springblade.manager.dto.WbsTreeContractDTO2;
 import org.springblade.manager.entity.*;
 import org.springblade.manager.entity.*;
@@ -34,6 +36,8 @@ import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.multipart.MultipartFile;
 import org.springframework.web.multipart.MultipartFile;
 
 
 import java.io.File;
 import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.io.IOException;
 import java.util.*;
 import java.util.*;
 import java.util.stream.Collectors;
 import java.util.stream.Collectors;
@@ -352,6 +356,62 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
         return ForestNodeMerger.merge(baseMapper.appSearchConcealedNodes(primaryKeyId, contractId));
         return ForestNodeMerger.merge(baseMapper.appSearchConcealedNodes(primaryKeyId, contractId));
     }
     }
 
 
+    // 频率添加表单
+    @Override
+    public boolean addTabInfoByRan(RangeInfo info,List<Object> moreData,Integer excLenght) throws FileNotFoundException {
+        WbsTreeContract wbsInfo = this.baseMapper.selectOne(Wrappers.<WbsTreeContract>query().lambda()
+                .eq(WbsTreeContract::getPKeyId, info.getPkId()));
+
+        //查询复制表有多少张
+        List<WbsTreeContract> wbsTreeContractList = this.baseMapper.selectList(Wrappers.<WbsTreeContract>query().lambda()
+                .eq(WbsTreeContract::getId, wbsInfo.getId())
+                .eq(WbsTreeContract::getContractId, wbsInfo.getContractId())
+                .eq(WbsTreeContract::getParentId, wbsInfo.getParentId()));
+        List<WbsTreeContract> wbsTreeContractList2 = wbsTreeContractList.stream().filter(wbsTreeContract -> wbsTreeContract.getIsCopeTab() ==null || wbsTreeContract.getIsCopeTab()!=2).sorted(Comparator.comparing(WbsTreeContract::getCreateTime).reversed()).collect(Collectors.toList());
+        // 判读需要添加几张表
+        long tabGroupId = SnowFlakeUtil.getId();
+
+        List<WbsTreeContract> addList = new ArrayList<>();
+
+        double tabCount = moreData.size() / excLenght - wbsTreeContractList2.size()+1;
+        double tabsCount  = Math.ceil(tabCount);
+        if(tabsCount>=1){
+            for(int i =0 ;i<tabsCount;i++){
+                long newPkId = SnowFlakeUtil.getId();
+                WbsTreeContract wbsTreeContract = new WbsTreeContract();
+                BeanUtil.copy(wbsInfo,wbsTreeContract);
+                wbsTreeContract.setPKeyId(newPkId);
+                wbsTreeContract.setCreateTime(new Date());
+                wbsTreeContract.setTabGroupId(tabGroupId);
+                String nodeName = wbsTreeContractList2.get(0).getNodeName();
+
+                if (nodeName.indexOf("_PL_") >= 0) {
+                    String[] oldName = nodeName.split("_PL_");
+                    nodeName = oldName[0] + "_PL_" + (Integer.parseInt(oldName[1]) + 1);
+                } else {
+                    nodeName = nodeName + "_PL_" + 1;
+                }
+                wbsTreeContract.setNodeName(nodeName);
+                wbsTreeContract.setIsCopeTab(1);
+                wbsTreeContract.setIsTabPdf(1); // pdf 不能预览
+                wbsTreeContract.setIsBussShow(1); // 是否隐藏表
+                wbsTreeContract.setTabFileType(1);//没有上传附件
+                wbsTreeContract.setPdfUrl("");
+                addList.add(wbsTreeContract);
+            }
+            // 插入数据
+            this.baseMapper.insertBatchSomeColumn(addList);
+        }
+        for(WbsTreeContract wbsTreeCont:wbsTreeContractList2){
+            UpdateWrapper<WbsTreeContract> updateWrapper = new UpdateWrapper<>();
+            updateWrapper.in("p_key_id", wbsTreeCont.getPKeyId() + "");
+            updateWrapper.set("tab_group_id", tabGroupId);
+            wbsTreeCont.setTabGroupId(tabGroupId);
+            this.getBaseMapper().update(wbsTreeCont,updateWrapper);
+        }
+        return false;
+    }
+
     @Override
     @Override
     public List<WbsTreeContract> updateAllNodeTabById(WbsTreePrivate aPrivate) {
     public List<WbsTreeContract> updateAllNodeTabById(WbsTreePrivate aPrivate) {
         return baseMapper.updateAllNodeTabById(aPrivate);
         return baseMapper.updateAllNodeTabById(aPrivate);

+ 9 - 2
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/WbsTreePrivateServiceImpl.java

@@ -15,6 +15,7 @@ import org.jsoup.nodes.Document;
 import org.jsoup.nodes.Element;
 import org.jsoup.nodes.Element;
 import org.jsoup.select.Elements;
 import org.jsoup.select.Elements;
 import org.springblade.common.constant.CommonConstant;
 import org.springblade.common.constant.CommonConstant;
+import org.springblade.common.utils.CommonUtil;
 import org.springblade.common.utils.SnowFlakeUtil;
 import org.springblade.common.utils.SnowFlakeUtil;
 import org.springblade.core.log.exception.ServiceException;
 import org.springblade.core.log.exception.ServiceException;
 import org.springblade.core.mp.base.BaseServiceImpl;
 import org.springblade.core.mp.base.BaseServiceImpl;
@@ -1478,13 +1479,19 @@ public class WbsTreePrivateServiceImpl extends BaseServiceImpl<WbsTreePrivateMap
                 File file_in = ResourceUtil.getFile(tree.getHtmlUrl());
                 File file_in = ResourceUtil.getFile(tree.getHtmlUrl());
                 String fileCode = SnowFlakeUtil.getId() + "";
                 String fileCode = SnowFlakeUtil.getId() + "";
                 String htmlUrl = file_path + "/privateUrlCopy/" + fileCode + ".html";
                 String htmlUrl = file_path + "/privateUrlCopy/" + fileCode + ".html";
-//                String htmlUrl = "C:\\Users\\泓创研发01\\Desktop\\privateUrlCopy\\" + fileCode + ".html";
                 File file_out = ResourceUtil.getFile(htmlUrl);
                 File file_out = ResourceUtil.getFile(htmlUrl);
                 FileUtil.copy(file_in, file_out);
                 FileUtil.copy(file_in, file_out);
                 tree.setHtmlUrl(htmlUrl);
                 tree.setHtmlUrl(htmlUrl);
             }
             }
             //批量修改
             //批量修改
-            baseMapper.updateBatchByPKeyId(wbsTreePrivateList);
+            if (wbsTreePrivateList.size() > 1000){
+                List<List<WbsTreePrivate>> splitList = CommonUtil.splitList(wbsTreePrivateList, 1000);
+                for (List<WbsTreePrivate> list : splitList) {
+                    baseMapper.updateBatchByPKeyId(list);
+                }
+            }else {
+                baseMapper.updateBatchByPKeyId(wbsTreePrivateList);
+            }
         }
         }
     }
     }
 
 

+ 75 - 3
blade-service/blade-manager/src/main/java/org/springblade/manager/utils/FileUtils.java

@@ -9,6 +9,7 @@ import com.spire.xls.*;
 import com.sun.image.codec.jpeg.JPEGCodec;
 import com.sun.image.codec.jpeg.JPEGCodec;
 import com.sun.image.codec.jpeg.JPEGImageEncoder;
 import com.sun.image.codec.jpeg.JPEGImageEncoder;
 import org.apache.commons.lang.StringUtils;
 import org.apache.commons.lang.StringUtils;
+import org.apache.poi.hssf.usermodel.HSSFPrintSetup;
 import org.apache.poi.hssf.usermodel.HSSFSheet;
 import org.apache.poi.hssf.usermodel.HSSFSheet;
 import org.apache.poi.hssf.usermodel.HSSFWorkbook;
 import org.apache.poi.hssf.usermodel.HSSFWorkbook;
 import org.apache.poi.ss.usermodel.*;
 import org.apache.poi.ss.usermodel.*;
@@ -16,12 +17,16 @@ import org.apache.poi.ss.usermodel.CellStyle;
 import org.apache.poi.ss.util.CellRangeAddress;
 import org.apache.poi.ss.util.CellRangeAddress;
 import org.apache.poi.util.IOUtils;
 import org.apache.poi.util.IOUtils;
 import org.apache.poi.util.Units;
 import org.apache.poi.util.Units;
+import org.apache.poi.xssf.usermodel.XSSFPrintSetup;
+import org.apache.poi.xssf.usermodel.XSSFSheet;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 import org.jsoup.Jsoup;
 import org.jsoup.Jsoup;
 import org.jsoup.nodes.Element;
 import org.jsoup.nodes.Element;
 import org.jsoup.select.Elements;
 import org.jsoup.select.Elements;
 import org.springblade.common.utils.CommonUtil;
 import org.springblade.common.utils.CommonUtil;
 import org.springblade.common.utils.SnowFlakeUtil;
 import org.springblade.common.utils.SnowFlakeUtil;
 import org.springblade.common.vo.DataVO;
 import org.springblade.common.vo.DataVO;
+import org.springblade.core.tool.api.ResultCode;
 import org.springblade.core.tool.utils.FileUtil;
 import org.springblade.core.tool.utils.FileUtil;
 import org.springblade.core.tool.utils.IoUtil;
 import org.springblade.core.tool.utils.IoUtil;
 import org.springblade.core.tool.utils.ResourceUtil;
 import org.springblade.core.tool.utils.ResourceUtil;
@@ -231,6 +236,7 @@ public class FileUtils {
                 sheet.setPrintGridlines(false);
                 sheet.setPrintGridlines(false);
                 //设置 整个工作表为一页
                 //设置 整个工作表为一页
                 sheet.setFitToPage(true);
                 sheet.setFitToPage(true);
+
             }
             }
             outReport = new ByteArrayOutputStream();
             outReport = new ByteArrayOutputStream();
             ss.write(outReport);
             ss.write(outReport);
@@ -302,6 +308,71 @@ public class FileUtils {
 
 
 
 
 
 
+    /**
+     * excel设置 打印缩放比例
+     *
+     * @param inputPath
+     * @param outPath
+     */
+    public static void setExcelScaleToPdf(String inputPath, String outPath) {
+        //读取excel文件
+        XSSFWorkbook workbook = null;
+        ByteArrayOutputStream outReport = null, bos = null;
+        ByteArrayInputStream byteArrayInputStream = null;
+        try {
+            workbook = new XSSFWorkbook(new FileInputStream(inputPath));
+        } catch (FileNotFoundException e) {
+            e.printStackTrace();
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+        OutputStream fos = null;
+        try {
+            for (int i = 0; i < workbook.getNumberOfSheets(); i++) {//获取每个Sheet表
+                XSSFSheet sheet = workbook.getSheetAt(i);
+                //打印设置
+                XSSFPrintSetup print = sheet.getPrintSetup();
+               // print.setLandscape(true); // 打印方向,true:横向,false:纵向(默认)
+             //   print.setFitHeight((short)0);//设置高度为自动分页
+                print.setFitWidth((short)1);//设置宽度为一页
+                print.setPaperSize(HSSFPrintSetup.A4_PAPERSIZE); //纸张类型
+//                print.setScale((short)55);//自定义缩放①,此处100为无缩放
+                //启用“适合页面”打印选项的标志
+                sheet.setFitToPage(true);
+            }
+            // Excel文件生成后存储的位置。
+            outReport = new ByteArrayOutputStream();
+            workbook.write(outReport);
+            byteArrayInputStream = new ByteArrayInputStream(outReport.toByteArray());
+            com.aspose.cells.Workbook wb = new com.aspose.cells.Workbook(byteArrayInputStream);
+            File pdfFile = new File(outPath);
+            if(!pdfFile.exists()){
+                pdfFile.mkdir();
+            }
+            wb.save(outPath, SaveFormat.PDF);
+        } catch (Exception e) {
+            e.printStackTrace();
+        } finally {
+            if (fos != null) {
+                try {
+                    fos.close();
+                } catch (IOException e) {
+                    e.printStackTrace();
+                }
+            }
+            if (workbook != null) {
+                try {
+                    workbook.close();
+                } catch (IOException e) {
+                    e.printStackTrace();
+                }
+            }
+        }
+    }
+
+
+
+
 
 
     public static void main123(String[] args) throws Exception {
     public static void main123(String[] args) throws Exception {
 
 
@@ -337,8 +408,9 @@ public class FileUtils {
     }
     }
 
 
 
 
-    public static void main23(String[] args) throws FileNotFoundException {
-        File file1 = ResourceUtil.getFile("/Users/hongchuangyanfa/fsdownload/1633774811681390592.html");
+    public static void main11(String[] args) throws FileNotFoundException {
+
+        /*File file1 = ResourceUtil.getFile("/Users/hongchuangyanfa/fsdownload/1633774811681390592.html");
         FileInputStream fileInputStream = new FileInputStream(file1);
         FileInputStream fileInputStream = new FileInputStream(file1);
         String htmlString = IoUtil.readToString(fileInputStream);
         String htmlString = IoUtil.readToString(fileInputStream);
         // 解析 style
         // 解析 style
@@ -370,7 +442,7 @@ public class FileUtils {
         String[][] res = new String[redata.size()][]; // 存放转换结果的 二维数组
         String[][] res = new String[redata.size()][]; // 存放转换结果的 二维数组
         for(int i=0; i<res.length; i++){ // 转换方法
         for(int i=0; i<res.length; i++){ // 转换方法
             res[i] = redata.get(i).toArray(new String[redata.get(i).size()]);
             res[i] = redata.get(i).toArray(new String[redata.get(i).size()]);
-        }
+        }*/
 
 
     }
     }
 }
 }

+ 38 - 0
blade-service/blade-manager/src/main/java/org/springblade/manager/utils/ForestNodeManagerEx.java

@@ -0,0 +1,38 @@
+package org.springblade.manager.utils;
+
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.Maps;
+import org.springblade.common.utils.INodeEx;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+public class ForestNodeManagerEx<T extends INodeEx<T>> {
+
+    private final ImmutableMap<Long, T> nodeMap ;
+    private final Map<Long, Object> parentIdMap = Maps.newHashMap();
+
+    public ForestNodeManagerEx(List<T> nodes) {
+        this.nodeMap = Maps.uniqueIndex(nodes, INodeEx::getId);
+    }
+
+    public INodeEx<T> getTreeNodeAt(Long id) {
+        return this.nodeMap.containsKey(id) ? (INodeEx)this.nodeMap.get(id) : null;
+    }
+
+    public void addParentId(Long parentId) {
+        this.parentIdMap.put(parentId, "");
+    }
+
+    public List<T> getRoot() {
+        List<T> roots = new ArrayList();
+        this.nodeMap.forEach((key, node) -> {
+            if (node.getParentId() == 0L || this.parentIdMap.containsKey(node.getId())) {
+                roots.add(node);
+            }
+
+        });
+        return roots;
+    }
+}

+ 41 - 0
blade-service/blade-manager/src/main/java/org/springblade/manager/utils/ForestNodeMergerEx.java

@@ -0,0 +1,41 @@
+package org.springblade.manager.utils;
+
+import org.springblade.core.tool.node.INode;
+import org.springblade.common.utils.INodeEx;
+
+import java.util.List;
+
+public class ForestNodeMergerEx {
+    public static <T extends INodeEx<T>> List<T> merge(List<T> items) {
+        ForestNodeManagerEx<T> forestNodeManager = new ForestNodeManagerEx(items);
+        items.forEach((forestNode) -> {
+            if (forestNode.getParentId()!= null && forestNode.getParentId() != 0L) {
+                INodeEx<T> node = forestNodeManager.getTreeNodeAt(forestNode.getParentId());
+                if (node != null) {
+                    node.getChildren().add(forestNode);
+                } else {
+                    forestNodeManager.addParentId(forestNode.getId());
+                }
+            }
+
+        });
+        return forestNodeManager.getRoot();
+    }
+
+    public static <T extends INodeEx<T>> void getTreeList(T tree, List<T> nodes){
+        if (tree == null) {
+            return;
+        }
+
+        nodes.add(tree);
+
+        List<T> childrens = tree.getChildren();
+        if (childrens!= null) {
+            for (T child :childrens) {
+                getTreeList(child,nodes);
+            }
+        }
+    }
+
+
+}