zhuwei 2 місяців тому
батько
коміт
e889435588
24 змінених файлів з 672 додано та 135 видалено
  1. 2 3
      blade-common/src/main/java/org/springblade/common/utils/AsyncConfigurer.java
  2. 0 9
      blade-common/src/main/java/org/springblade/common/utils/BaseUtils.java
  3. 6 5
      blade-common/src/main/java/org/springblade/common/utils/CommonUtil.java
  4. 1 0
      blade-ops/blade-develop/src/main/java/org/springblade/develop/mapper/CodeMapper.java
  5. 0 1
      blade-ops/blade-resource/src/main/java/org/springblade/resource/builder/oss/MinioOssBuilder.java
  6. 2 54
      blade-ops/blade-resource/src/main/java/org/springblade/resource/builder/oss/OssBuilder.java
  7. 501 31
      blade-ops/blade-resource/src/main/java/org/springblade/resource/builder/ossre/MinioTemplateRe.java
  8. 1 1
      blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/vo/FB02.java
  9. 2 0
      blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TrialSelfInspectionRecordServiceImpl.java
  10. 8 5
      blade-service/blade-e-visa/src/main/java/org/springblade/evisa/controller/EVisaController.java
  11. 8 2
      blade-service/blade-e-visa/src/main/java/org/springblade/evisa/service/impl/EVisaServiceImpl.java
  12. 4 0
      blade-service/blade-manager/src/main/java/org/springblade/manager/bean/TableInfo.java
  13. 6 4
      blade-service/blade-manager/src/main/java/org/springblade/manager/controller/APIController.java
  14. 67 8
      blade-service/blade-manager/src/main/java/org/springblade/manager/controller/ExcelTabController.java
  15. 0 2
      blade-service/blade-manager/src/main/java/org/springblade/manager/controller/WbsTreePrivateController.java
  16. 25 2
      blade-service/blade-manager/src/main/java/org/springblade/manager/feign/ExcelTabClientImpl.java
  17. 1 1
      blade-service/blade-manager/src/main/java/org/springblade/manager/mapper/WbsTreeContractMapper.java
  18. 3 0
      blade-service/blade-manager/src/main/java/org/springblade/manager/mapper/WbsTreeContractMapper.xml
  19. 1 0
      blade-service/blade-manager/src/main/java/org/springblade/manager/service/IExcelTabService.java
  20. 1 1
      blade-service/blade-manager/src/main/java/org/springblade/manager/service/IWbsTreeContractService.java
  21. 15 1
      blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/ExcelTabServiceImpl.java
  22. 13 1
      blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/FormulaServiceImpl.java
  23. 2 2
      blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/WbsTreeContractServiceImpl.java
  24. 3 2
      blade-service/blade-meter/src/main/java/org/springblade/meter/controller/TaskController.java

+ 2 - 3
blade-common/src/main/java/org/springblade/common/utils/AsyncConfigurer.java

@@ -15,17 +15,16 @@ public class AsyncConfigurer {
     /**
      * cpu 核心数量
      */
-    public static final int cpuNum =10 ;//Runtime.getRuntime().availableProcessors();
+    public static final int cpuNum =6 ;//Runtime.getRuntime().availableProcessors();
 
     /**
      * 线程池配置
-     *
      * @return
      */
     @Bean("taskExecutor1")
     public ThreadPoolExecutor getAsyncExecutor() {
         return new ThreadPoolMonitor(cpuNum
-                , 12
+                , 10
                 , 30
                 , TimeUnit.SECONDS
                 , new LinkedBlockingQueue<>(2000)

+ 0 - 9
blade-common/src/main/java/org/springblade/common/utils/BaseUtils.java

@@ -597,13 +597,4 @@ public static List<Object> obj2List(Object obj) {
                 .collect(Collectors.toList());
     }
 
-
-/*
-    public static void main(String[] args) {
-        getTickUnit(202401,202410).forEach(System.out::println);
-    }
-*/
-
-
-
 }

+ 6 - 5
blade-common/src/main/java/org/springblade/common/utils/CommonUtil.java

@@ -115,10 +115,8 @@ public class CommonUtil {
      * 根据OSS文件路径获取文件输入流
      */
     public static synchronized InputStream getOSSInputStream(String urlStr) throws Exception {
+        urlStr = replaceOssUrl(urlStr);
         //获取OSS文件流
-        if(urlStr!=null && urlStr.indexOf("183.247.216.148:9000")>=0){// nimio 甬台温 本地部署修改
-            urlStr = urlStr.replace("https://","http://").replace("183.247.216.148","152.168.2.15").replace(":9000//",":9000/");
-        }
         URL url =new URL(urlStr);
         final URLConnection conn = url.openConnection();
         conn.setRequestProperty("User-Agent", "Mozilla/4.0 (compatible; MSIE 5.0; Windows NT; DigExt)");
@@ -633,7 +631,6 @@ public class CommonUtil {
     }
 
     public static String replaceOssUrl(String url) {
-
         String osName = System.getProperty("os.name");
         if (osName != null && osName.toLowerCase().contains("Cloud Linux")) {
             // 如果当前操作系统是Linux系统
@@ -646,7 +643,11 @@ public class CommonUtil {
         //本地部署- 甬台温
         if (url.indexOf("183.247.216.148")>=0) {
             // 如果当前环境变量不包含linuxtesttest,则替换URL中的oss路径
-            url = url.replace("https://","http://").replace("183.247.216.148","152.168.2.15").replace(":9000//",":9000/");
+            if(SystemUtils.isMacOs() || SystemUtils.isWindows()){
+                url = url.replace("https://","http://").replace(":9000//",":9000/");
+            }else{
+                url = url.replace("https://","http://").replace("183.247.216.148","152.168.2.15").replace(":9000//",":9000/");
+            }
         }
         return url;
     }

+ 1 - 0
blade-ops/blade-develop/src/main/java/org/springblade/develop/mapper/CodeMapper.java

@@ -16,6 +16,7 @@
  */
 package org.springblade.develop.mapper;
 
+import cn.hutool.db.Db;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import org.springblade.develop.entity.Code;
 

+ 0 - 1
blade-ops/blade-resource/src/main/java/org/springblade/resource/builder/oss/MinioOssBuilder.java

@@ -41,7 +41,6 @@ public class MinioOssBuilder {
                 .build();
         OssProperties ossProperties = new OssProperties();
         ossProperties.setEndpoint(oss.getEndpoint());
-        ossProperties.setEndpoint("http://183.247.216.148:9000/");
         ossProperties.setAccessKey(oss.getAccessKey());
         ossProperties.setSecretKey(oss.getSecretKey());
         ossProperties.setBucketName(oss.getBucketName());

+ 2 - 54
blade-ops/blade-resource/src/main/java/org/springblade/resource/builder/oss/OssBuilder.java

@@ -59,65 +59,11 @@ public class OssBuilder {
         this.ossService = ossService;
     }
 
-
-
     /**
      * oss配置缓存池
      */
     private final Map<String, Oss> ossPool = new ConcurrentHashMap<>();
 
-/*
-    *//**
-     * 获取template
-     *
-     * @return OssTemplate
-     *//*
-    public OssTemplate template() {
-        return template(StringPool.EMPTY);
-    }
-     private final Map<String, OssTemplate> templatePool = new ConcurrentHashMap<>();
-    *//**
-     * 获取template
-     *
-     * @param code 资源编号--minio
-     * @return OssTemplate
-     *//*
-    public OssTemplate template(String code) {
-        String tenantId = AuthUtil.getTenantId();
-        Oss oss = getOss(tenantId, code);
-        Oss ossCached = ossPool.get(tenantId);
-        OssTemplate template = templatePool.get(tenantId);
-        // 若为空或者不一致,则重新加载
-        if (Func.hasEmpty(template, ossCached) || !oss.getEndpoint().equals(ossCached.getEndpoint()) || !oss.getAccessKey().equals(ossCached.getAccessKey())) {
-            synchronized (OssBuilder.class) {
-                template = templatePool.get(tenantId);
-                if (Func.hasEmpty(template, ossCached) || !oss.getEndpoint().equals(ossCached.getEndpoint()) || !oss.getAccessKey().equals(ossCached.getAccessKey())) {
-                    OssRule ossRule;
-                    // 若采用默认设置则开启多租户模式, 若是用户自定义oss则不开启
-                    if (oss.getEndpoint().equals(ossProperties.getEndpoint()) && oss.getAccessKey().equals(ossProperties.getAccessKey()) && ossProperties.getTenantMode()) {
-                        ossRule = new BladeOssRule(Boolean.TRUE);
-                    } else {
-                        ossRule = new BladeOssRule(Boolean.FALSE);
-                    }
-                    //获取对象
-                    if (oss.getCategory() == OssEnum.MINIO.getCategory()) {
-                        template = MinioOssBuilder.template(oss, ossRule);
-                    } else if (oss.getCategory() == OssEnum.QINIU.getCategory()) {
-                        template = QiniuOssBuilder.template(oss, ossRule);
-                    } else if (oss.getCategory() == OssEnum.ALI.getCategory()) {
-                        template = AliOssBuilder.template(oss, ossRule);
-                    } else if (oss.getCategory() == OssEnum.TENCENT.getCategory()) {
-                        template = TencentOssBuilder.template(oss, ossRule);
-                    }
-                    templatePool.put(tenantId, template);
-                    ossPool.put(tenantId, oss);
-                }
-            }
-        }
-        return template;
-    }*/
-
-
     /**
      * OssTemplate配置缓存池
      */
@@ -139,6 +85,7 @@ public class OssBuilder {
     public OssTemplateRe template(String code) {
         String tenantId = AuthUtil.getTenantId();
         Oss oss = getOss(tenantId, code);
+       // oss.setEndpoint("http://183.247.216.148:9000/");
         Oss ossCached = ossPool.get(tenantId);
         OssTemplateRe template = templatePool.get(tenantId);
         // 若为空或者不一致,则重新加载
@@ -153,6 +100,7 @@ public class OssBuilder {
                     } else {
                         ossRule = new BladeOssRule(Boolean.FALSE);
                     }
+
                     //获取对象
                    if (oss.getCategory() == OssEnum.MINIO.getCategory()) {
                         template = MinioOssBuilder.template(oss, ossRule);

+ 501 - 31
blade-ops/blade-resource/src/main/java/org/springblade/resource/builder/ossre/MinioTemplateRe.java

@@ -1,49 +1,519 @@
-//
-// Source code recreated from a .class file by IntelliJ IDEA
-// (powered by FernFlower decompiler)
-//
-
+/**
+ * BladeX Commercial License Agreement
+ * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
+ * <p>
+ * Use of this software is governed by the Commercial License Agreement
+ * obtained after purchasing a license from BladeX.
+ * <p>
+ * 1. This software is for development use only under a valid license
+ * from BladeX.
+ * <p>
+ * 2. Redistribution of this software's source code to any third party
+ * without a commercial license is strictly prohibited.
+ * <p>
+ * 3. Licensees may copyright their own code but cannot use segments
+ * from this software for such purposes. Copyright of this software
+ * remains with BladeX.
+ * <p>
+ * Using this software signifies agreement to this License, and the software
+ * must not be used for illegal purposes.
+ * <p>
+ * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
+ * not liable for any claims arising from secondary or illegal development.
+ * <p>
+ * Author: Chill Zhuang (bladejava@qq.com)
+ */
 package org.springblade.resource.builder.ossre;
 
+import com.aliyun.oss.OSSClient;
 import com.aliyun.oss.model.*;
-import io.minio.MinioClient;
-import org.springblade.core.oss.MinioTemplate;
+import io.minio.*;
+import io.minio.http.Method;
+import io.minio.messages.Bucket;
+import io.minio.messages.DeleteObject;
+import lombok.AllArgsConstructor;
+import lombok.SneakyThrows;
+import org.springblade.common.utils.CommonUtil;
+import org.springblade.core.oss.OssTemplate;
+import org.springblade.core.oss.enums.PolicyType;
 import org.springblade.core.oss.model.BladeFile;
+import org.springblade.core.oss.model.OssFile;
 import org.springblade.core.oss.props.OssProperties;
 import org.springblade.core.oss.rule.OssRule;
+import org.springblade.core.tool.utils.DateUtil;
+import org.springblade.core.tool.utils.Func;
+import org.springblade.core.tool.utils.StringPool;
+import org.springblade.core.tool.utils.StringUtil;
+import org.springframework.web.multipart.MultipartFile;
 
 import java.io.InputStream;
+import java.util.List;
+import java.util.Optional;
+import java.util.stream.Stream;
+
+/**
+ * MinIOTemplate
+ *
+ * @author Chill
+ */
+@AllArgsConstructor
+public class MinioTemplateRe implements OssTemplateRe {
+
+	/**
+	 * MinIO客户端
+	 */
+	private final MinioClient client;
+
+	/**
+	 * 存储桶命名规则
+	 */
+	private final OssRule ossRule;
+
+	/**
+	 * 配置类
+	 */
+	private final OssProperties ossProperties;
+
+
+	@Override
+	@SneakyThrows
+	public void makeBucket(String bucketName) {
+		if (
+			!client.bucketExists(
+				BucketExistsArgs.builder().bucket(getBucketName(bucketName)).build()
+			)
+		) {
+			client.makeBucket(
+				MakeBucketArgs.builder().bucket(getBucketName(bucketName)).build()
+			);
+			client.setBucketPolicy(
+				SetBucketPolicyArgs.builder().bucket(getBucketName(bucketName)).config(getPolicyType(getBucketName(bucketName), PolicyType.READ)).build()
+			);
+		}
+	}
+
+	@SneakyThrows
+	public Bucket getBucket() {
+		return getBucket(getBucketName());
+	}
+
+	@SneakyThrows
+	public Bucket getBucket(String bucketName) {
+		Optional<Bucket> bucketOptional = client.listBuckets().stream().filter(bucket -> bucket.name().equals(getBucketName(bucketName))).findFirst();
+		return bucketOptional.orElse(null);
+	}
+
+	@SneakyThrows
+	public List<Bucket> listBuckets() {
+		return client.listBuckets();
+	}
+
+	@Override
+	@SneakyThrows
+	public void removeBucket(String bucketName) {
+		client.removeBucket(
+			RemoveBucketArgs.builder().bucket(getBucketName(bucketName)).build()
+		);
+	}
+
+	@Override
+	@SneakyThrows
+	public boolean bucketExists(String bucketName) {
+		return client.bucketExists(
+			BucketExistsArgs.builder().bucket(getBucketName(bucketName)).build()
+		);
+	}
+
+	@Override
+	@SneakyThrows
+	public void copyFile(String bucketName, String fileName, String destBucketName) {
+		copyFile(bucketName, fileName, destBucketName, fileName);
+	}
+
+	@Override
+	@SneakyThrows
+	public void copyFile(String bucketName, String fileName, String destBucketName, String destFileName) {
+		client.copyObject(
+			CopyObjectArgs.builder()
+				.source(CopySource.builder().bucket(getBucketName(bucketName)).object(fileName).build())
+				.bucket(getBucketName(destBucketName))
+				.object(destFileName)
+				.build()
+		);
+	}
+
+	@Override
+	@SneakyThrows
+	public OssFile statFile(String fileName) {
+		return statFile(ossProperties.getBucketName(), fileName);
+	}
+
+	@Override
+	@SneakyThrows
+	public OssFile statFile(String bucketName, String fileName) {
+		StatObjectResponse stat = client.statObject(
+			StatObjectArgs.builder().bucket(getBucketName(bucketName)).object(fileName).build()
+		);
+		OssFile ossFile = new OssFile();
+		ossFile.setName(Func.isEmpty(stat.object()) ? fileName : stat.object());
+		ossFile.setLink(fileLink(ossFile.getName()));
+		ossFile.setHash(String.valueOf(stat.hashCode()));
+		ossFile.setLength(stat.size());
+		ossFile.setPutTime(DateUtil.toDate(stat.lastModified().toLocalDateTime()));
+		ossFile.setContentType(stat.contentType());
+		return ossFile;
+	}
+
+	@Override
+	public String filePath(String fileName) {
+		return getBucketName().concat(StringPool.SLASH).concat(fileName);
+	}
+
+	@Override
+	public String filePath(String bucketName, String fileName) {
+		return getBucketName(bucketName).concat(StringPool.SLASH).concat(fileName);
+	}
+
+	@Override
+	@SneakyThrows
+	public String fileLink(String fileName) {
+		return getEndpoint().concat(StringPool.SLASH).concat(getBucketName()).concat(StringPool.SLASH).concat(fileName);
+
+	}
+
+	@Override
+	@SneakyThrows
+	public String fileLink(String bucketName, String fileName) {
+		return getEndpoint().concat(StringPool.SLASH).concat(getBucketName(bucketName)).concat(StringPool.SLASH).concat(fileName);
+	}
+
+
+	@Override
+	@SneakyThrows
+	public BladeFile putFile(MultipartFile file) {
+		return putFile(ossProperties.getBucketName(), file.getOriginalFilename(), file);
+	}
+
+	@Override
+	@SneakyThrows
+	public BladeFile putFile(String fileName, MultipartFile file) {
+		return putFile(ossProperties.getBucketName(), fileName, file);
+	}
+
+	@Override
+	@SneakyThrows
+	public BladeFile putFile(String bucketName, String fileName, MultipartFile file) {
+		return putFile(bucketName, file.getOriginalFilename(), file.getInputStream());
+	}
+
+	@Override
+	@SneakyThrows
+	public BladeFile putFile(String fileName, InputStream stream) {
+		return putFile(ossProperties.getBucketName(), fileName, stream);
+	}
+
+	@Override
+	@SneakyThrows
+	public BladeFile putFile(String bucketName, String fileName, InputStream stream) {
+		return putFile(bucketName, fileName, stream, "application/octet-stream");
+	}
+
+	@SneakyThrows
+	public BladeFile putFile(String bucketName, String fileName, InputStream stream, String contentType) {
+		makeBucket(bucketName);
+		String originalName = fileName;
+		fileName = getFileName(fileName);
+		try {
+			client.putObject(
+				PutObjectArgs.builder()
+					.bucket(getBucketName(bucketName))
+					.object(fileName)
+					.stream(stream, stream.available(), -1)
+					.contentType(contentType)
+					.build()
+			);
+		} catch (Exception e) {
+			e.printStackTrace();
+		} finally {
+			try {
+				if (stream != null) {
+					stream.close();
+				}
+			} catch (Exception e) {
+				e.printStackTrace();
+			}
+		}
+		BladeFile file = new BladeFile();
+		file.setOriginalName(originalName);
+		file.setName(fileName);
+		file.setDomain(getOssHost(bucketName));
+		file.setLink(fileLink(bucketName, fileName));
+		return file;
+	}
+
+	@Override
+	@SneakyThrows
+	public void removeFile(String fileName) {
+		removeFile(ossProperties.getBucketName(), fileName);
+	}
+
+	@Override
+	@SneakyThrows
+	public void removeFile(String bucketName, String fileName) {
+		client.removeObject(
+			RemoveObjectArgs.builder().bucket(getBucketName(bucketName)).object(fileName).build()
+		);
+	}
+
+	@Override
+	@SneakyThrows
+	public void removeFiles(List<String> fileNames) {
+		removeFiles(ossProperties.getBucketName(), fileNames);
+	}
+
+	@Override
+	@SneakyThrows
+	public void removeFiles(String bucketName, List<String> fileNames) {
+		Stream<DeleteObject> stream = fileNames.stream().map(DeleteObject::new);
+		client.removeObjects(RemoveObjectsArgs.builder().bucket(getBucketName(bucketName)).objects(stream::iterator).build());
+	}
+
+	/**
+	 * 获取私有存储文件输入流
+	 *
+	 * @param fileName 存储桶文件名称
+	 * @return InputStream
+	 */
+
+	public InputStream statFileStream(String fileName) {
+		return statFileStream(ossProperties.getBucketName(), fileName);
+	}
+
+	/**
+	 * 获取私有存储文件输入流
+	 *
+	 * @param bucketName 存储桶名称
+	 * @param fileName   存储桶文件名称
+	 * @return InputStream
+	 */
+
+	@SneakyThrows
+	public InputStream statFileStream(String bucketName, String fileName) {
+		return client.getObject(
+			GetObjectArgs.builder().bucket(getBucketName(bucketName)).object(fileName).build()
+		);
+	}
+
+	/**
+	 * 根据规则生成存储桶名称规则
+	 *
+	 * @return String
+	 */
+	private String getBucketName() {
+		return getBucketName(ossProperties.getBucketName());
+	}
+
+	/**
+	 * 根据规则生成存储桶名称规则
+	 *
+	 * @param bucketName 存储桶名称
+	 * @return String
+	 */
+	private String getBucketName(String bucketName) {
+		return ossRule.bucketName(bucketName);
+	}
+
+	/**
+	 * 根据规则生成文件名称规则
+	 *
+	 * @param originalFilename 原始文件名
+	 * @return string
+	 */
+	private String getFileName(String originalFilename) {
+		return ossRule.fileName(originalFilename);
+	}
+
+	/**
+	 * 获取文件外链
+	 *
+	 * @param bucketName bucket名称
+	 * @param fileName   文件名称
+	 * @param expires    过期时间 <=7 秒级
+	 * @return url
+	 */
+	@SneakyThrows
+	public String getPresignedObjectUrl(String bucketName, String fileName, Integer expires) {
+		return client.getPresignedObjectUrl(
+			GetPresignedObjectUrlArgs.builder()
+				.method(Method.GET)
+				.bucket(getBucketName(bucketName))
+				.object(fileName)
+				.expiry(expires)
+				.build()
+		);
+	}
+
+	/**
+	 * 获取存储桶策略
+	 *
+	 * @param policyType 策略枚举
+	 * @return String
+	 */
+	public String getPolicyType(PolicyType policyType) {
+		return getPolicyType(getBucketName(), policyType);
+	}
+
+	/**
+	 * 获取存储桶策略
+	 *
+	 * @param bucketName 存储桶名称
+	 * @param policyType 策略枚举
+	 * @return String
+	 */
+	public static String getPolicyType(String bucketName, PolicyType policyType) {
+		StringBuilder builder = new StringBuilder();
+		builder.append("{\n");
+		builder.append("    \"Statement\": [\n");
+		builder.append("        {\n");
+		builder.append("            \"Action\": [\n");
+
+		switch (policyType) {
+			case WRITE:
+				builder.append("                \"s3:GetBucketLocation\",\n");
+				builder.append("                \"s3:ListBucketMultipartUploads\"\n");
+				break;
+			case READ_WRITE:
+				builder.append("                \"s3:GetBucketLocation\",\n");
+				builder.append("                \"s3:ListBucket\",\n");
+				builder.append("                \"s3:ListBucketMultipartUploads\"\n");
+				break;
+			default:
+				builder.append("                \"s3:GetBucketLocation\"\n");
+				break;
+		}
+
+		builder.append("            ],\n");
+		builder.append("            \"Effect\": \"Allow\",\n");
+		builder.append("            \"Principal\": \"*\",\n");
+		builder.append("            \"Resource\": \"arn:aws:s3:::");
+		builder.append(bucketName);
+		builder.append("\"\n");
+		builder.append("        },\n");
+		if (PolicyType.READ.equals(policyType)) {
+			builder.append("        {\n");
+			builder.append("            \"Action\": [\n");
+			builder.append("                \"s3:ListBucket\"\n");
+			builder.append("            ],\n");
+			builder.append("            \"Effect\": \"Deny\",\n");
+			builder.append("            \"Principal\": \"*\",\n");
+			builder.append("            \"Resource\": \"arn:aws:s3:::");
+			builder.append(bucketName);
+			builder.append("\"\n");
+			builder.append("        },\n");
+
+		}
+		builder.append("        {\n");
+		builder.append("            \"Action\": ");
+
+		switch (policyType) {
+			case WRITE:
+				builder.append("[\n");
+				builder.append("                \"s3:AbortMultipartUpload\",\n");
+				builder.append("                \"s3:DeleteObject\",\n");
+				builder.append("                \"s3:ListMultipartUploadParts\",\n");
+				builder.append("                \"s3:PutObject\"\n");
+				builder.append("            ],\n");
+				break;
+			case READ_WRITE:
+				builder.append("[\n");
+				builder.append("                \"s3:AbortMultipartUpload\",\n");
+				builder.append("                \"s3:DeleteObject\",\n");
+				builder.append("                \"s3:GetObject\",\n");
+				builder.append("                \"s3:ListMultipartUploadParts\",\n");
+				builder.append("                \"s3:PutObject\"\n");
+				builder.append("            ],\n");
+				break;
+			default:
+				builder.append("\"s3:GetObject\",\n");
+				break;
+		}
+
+		builder.append("            \"Effect\": \"Allow\",\n");
+		builder.append("            \"Principal\": \"*\",\n");
+		builder.append("            \"Resource\": \"arn:aws:s3:::");
+		builder.append(bucketName);
+		builder.append("/*\"\n");
+		builder.append("        }\n");
+		builder.append("    ],\n");
+		builder.append("    \"Version\": \"2012-10-17\"\n");
+		builder.append("}\n");
+		return builder.toString();
+	}
+
+	/**
+	 * 获取域名
+	 *
+	 * @param bucketName 存储桶名称
+	 * @return String
+	 */
+	public String getOssHost(String bucketName) {
+		return getEndpoint() + StringPool.SLASH + getBucketName(bucketName);
+	}
 
+	/**
+	 * 获取域名
+	 *
+	 * @return String
+	 */
+	public String getOssHost() {
+		return getOssHost(ossProperties.getBucketName());
+	}
 
-public class MinioTemplateRe extends MinioTemplate implements OssTemplateRe{
+	/**
+	 * 获取服务地址
+	 *
+	 * @return String
+	 */
+	public String getEndpoint() {
+	//	if (StringUtil.isBlank(ossProperties.getTransformEndpoint())) {
+			//return ossProperties.getEndpoint();
+	//	}
+	//	return ossProperties.getTransformEndpoint();
+		// 将内网转化外网使用
+	//	ossProperties.setEndpoint("http://183.247.216.148:9000");
+		//return ossProperties.getEndpoint();
+		return "http://183.247.216.148:9000";
+	}
 
-    public MinioTemplateRe(MinioClient client, OssRule ossRule, OssProperties ossProperties) {
-        super(client, ossRule, ossProperties);
-    }
 
+	@Override
+	public UploadPartResult uploadPart(UploadPartRequest request) {
+		return null;
+	}
 
-    @Override
-    public UploadPartResult uploadPart(UploadPartRequest request) {
-        return null;
-    }
+	@Override
+	public CompleteMultipartUploadResult completeMultipartUpload(CompleteMultipartUploadRequest request) {
+		return null;
+	}
 
-    @Override
-    public CompleteMultipartUploadResult completeMultipartUpload(CompleteMultipartUploadRequest request) {
-        return null;
-    }
+	@Override
+	public InitiateMultipartUploadResult initiateMultipartUpload(InitiateMultipartUploadRequest request) {
+		return null;
+	}
 
-    @Override
-    public InitiateMultipartUploadResult initiateMultipartUpload(InitiateMultipartUploadRequest request) {
-        return null;
-    }
+	@Override
+	public Long getAllFileSizeByFileUrl(String fileUrl) {
+		return 0L;
+	}
 
-    @Override
-    public Long getAllFileSizeByFileUrl(String fileUrl) {
-        return 0L;
-    }
+	@Override
+	public BladeFile putFileWithPath(String fileName, String filePath, Long projectId, InputStream stream) {
+		return null;
+	}
 
-    @Override
-    public BladeFile putFileWithPath(String fileName, String filePath, Long projectId, InputStream stream) {
-        return null;
-    }
+	public MinioTemplateRe(final MinioClient ossClient, final OssProperties ossProperties, final OssRule ossRule) {
+		this.client = ossClient;
+		this.ossProperties = ossProperties;
+		this.ossRule = ossRule;
+	}
 }

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

@@ -56,7 +56,7 @@ public class FB02 extends EvaSummary<Item02>{
                   this.fm.put(fd.getCode(),(List<Item02> l,Integer pn)->l.stream().map(Item02::getSubItem).collect(Collectors.toList()));
               }else if(fd.getEName().contains("序号")){
                   this.sn=fd;
-                  this.fm.put(fd.getCode(),(List<Item02> l,Integer pn)->IntStream.range(0, l.size()).boxed().map(i->i+pn*l.size()).collect(Collectors.toList()));
+                  this.fm.put(fd.getCode(),(List<Item02> l,Integer pn)->IntStream.range(0, l.size()).boxed().map(i->i+pn*l.size()+1).collect(Collectors.toList()));
               }else if(fd.getEName().contains("实测项目")){
                   this.name=fd;
                   this.fm.put(fd.getCode(),(List<Item02> l,Integer pn)->l.stream().map(Item02::getName).collect(Collectors.toList()));

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

@@ -1017,11 +1017,13 @@ public class TrialSelfInspectionRecordServiceImpl extends BaseServiceImpl<TrialS
 
     public void initTrialTabIds(TrialSelfInspectionRecordDTO dto) {
         JSONArray dataArray = dto.getDataInfo().getJSONArray("orderList");
+
         List<String> tableIds = new ArrayList<>();
         for (int i = 0; i < dataArray.size(); i++) {
             String pkeyId = dataArray.getJSONObject(i).getString("pkeyId");
             tableIds.add(pkeyId);
         }
+        // 获取
         List<String> ids = tableIds.stream().distinct().collect(Collectors.toList());
         String join = org.apache.commons.lang.StringUtils.join(ids, ",");
         dto.setTableIds(join);

+ 8 - 5
blade-service/blade-e-visa/src/main/java/org/springblade/evisa/controller/EVisaController.java

@@ -122,13 +122,16 @@ public class EVisaController {
                 //获取状态为1(待审批)的分支流程
                 List<Task> tasks = taskClient.queryTaskListByFormDataId(taskApprovalVO.getFormDataId());
                 Task masterTask = tasks.get(0);
-                if(masterTask !=null && (masterTask.getApprovalType()==5 || masterTask.getApprovalType()==6 || masterTask.getApprovalType()==7 ) && masterTask.getFixedFlowId()!=null && masterTask.getFixedFlowId()!=0L ){
-                   String upsql = "update u_task_parallel set status=2 ,e_visa_status=1,e_visa_content='电签成功' ,update_time=SYSDATE()  where sort in(SELECT fixed_flow_branch_sort from u_fixed_flow_link where fixed_flow_id ="+masterTask.getFixedFlowId()+" and  fixed_flow_link like'%审计%') and process_instance_id="+masterTask.getProcessInstanceId()+"";
-                    jdbcTemplate.execute(upsql);
-                 }
-                String  sql = "SELECT a.* from u_task_parallel a where a.process_instance_id=(SELECT process_instance_id from u_task_parallel b where  b.parallel_process_instance_id='"+taskApprovalVO.getParallelProcessInstanceId()+"') and is_deleted=0 and `status`=1 ";
+
+                String  sql = "SELECT a.* from u_task_parallel a where a.process_instance_id=(SELECT process_instance_id from u_task_parallel b where  b.parallel_process_instance_id='"+taskApprovalVO.getParallelProcessInstanceId()+"') and is_deleted=0 and `status`=1 and sort not in(SELECT fixed_flow_branch_sort from u_fixed_flow_link where fixed_flow_id ="+masterTask.getFixedFlowId()+" and  flow_task_type=2 ) ";
                 List<Map<String, Object>> maps = jdbcTemplate.queryForList(sql);
                 if (maps == null || maps.size() == 0) {
+                    // 最后修改计量数据
+                    /*if(masterTask !=null && (masterTask.getApprovalType()==5 || masterTask.getApprovalType()==6 || masterTask.getApprovalType()==7 ) && masterTask.getFixedFlowId()!=null && masterTask.getFixedFlowId()!=0L ){
+                        String upsql = "update u_task_parallel set status=2 ,e_visa_status=1,e_visa_content='电签成功' ,update_time=SYSDATE()  where sort in(SELECT fixed_flow_branch_sort from u_fixed_flow_link where fixed_flow_id ="+masterTask.getFixedFlowId()+" and  flow_task_type=2 ) and process_instance_id="+masterTask.getProcessInstanceId()+"";
+                        jdbcTemplate.execute(upsql);
+                    }*/
+
                     //说明都审批完成,将主表状态更改为已完成
                     String finalPdfUrl = null;
                     if (eVisaStatus.contains("@@@@")) {

+ 8 - 2
blade-service/blade-e-visa/src/main/java/org/springblade/evisa/service/impl/EVisaServiceImpl.java

@@ -90,8 +90,8 @@ import java.util.stream.Collectors;
 @AllArgsConstructor
 public class EVisaServiceImpl implements EVisaService {
 
-    private static final String SIGN_HOST = "172.30.224.79";
-   // private static final String SIGN_HOST = "47.115.117.246";
+    //private static final String SIGN_HOST = "172.30.224.79";
+    private static final String SIGN_HOST = "47.115.117.246";
 
     private static final String SIGN_PORT = "8183";
 
@@ -540,16 +540,22 @@ public class EVisaServiceImpl implements EVisaService {
                             .collect(Collectors.groupingBy( hada ->(Func.toStr(hada.get("id")))));
 
                     for(String keyId :peopleByAge.keySet()){
+                        int exId = 0 ;
                         List<Map<String, Object>> keyList = peopleByAge.get(keyId);
                         if(keyList!=null && keyList.size()==1){
                             maps.addAll(keyList);
+                            exId =1;
                         }else if(keyList!=null && keyList.size()>=2){
                             for(Map<String, Object> datax : keyList){
                                 if((datax.get("project_id")+"").equals(projectId)){
                                     maps.add(datax);
+                                    exId =1;
                                 }
                             }
                         }
+                        if(exId == 0){
+                            maps.add(keyList.get(0));
+                        }
                     }
 
                     System.out.println("安心签-个人-user-id" + task.getUserId() + "--SQL=" + sqlinfo);

+ 4 - 0
blade-service/blade-manager/src/main/java/org/springblade/manager/bean/TableInfo.java

@@ -24,6 +24,10 @@ public class TableInfo {
     private String classify;
     private String projectId;
     private String groupId = "0";
+    // 用于实验
+    private String testGroupId = "0";
+
+
     /**
      * 待更新状态
      */

+ 6 - 4
blade-service/blade-manager/src/main/java/org/springblade/manager/controller/APIController.java

@@ -9,6 +9,7 @@ import lombok.AllArgsConstructor;
 import org.springblade.core.boot.ctrl.BladeController;
 import org.springblade.core.secure.BladeUser;
 import org.springblade.core.tool.api.R;
+import org.springblade.core.tool.utils.Func;
 import org.springblade.manager.service.IWbsTreeContractService;
 import org.springblade.manager.vo.APIWbsContractNodeHzrcVo;
 import org.springblade.manager.vo.APIWbsContractNodeVo;
@@ -54,18 +55,19 @@ public class APIController extends BladeController {
     @ApiImplicitParams(value = {
             @ApiImplicitParam(name = "contractId", value = "合同段Id", required = true)
     })
-    public R<List<APIWbsContractNodeVo>> tree(String contractId) {
-        List<APIWbsContractNodeVo> tree = iWbsTreeContractService.apiTreeNode(contractId);
+    public R<List<APIWbsContractNodeVo>> tree(String contractId,String nodeName) {
+        List<APIWbsContractNodeVo> tree = iWbsTreeContractService.apiTreeNode(contractId,nodeName);
         List<APIWbsContractNodeVo> retu = new ArrayList<>();
-        if (tree != null && tree.size() > 0) {
+        if (tree != null && tree.size() > 0 && Func.isEmpty(nodeName)) {
             for(APIWbsContractNodeVo va:tree){
                 if(va.getChildren().size()>=0 && va.getParentId()==0L){
                     retu.add(va);
                 }
             }
             return R.data(retu);
+        }else{
+            return R.data(tree);
         }
-        return R.fail(200, "未查询到信息");
     }
 
     /**

+ 67 - 8
blade-service/blade-manager/src/main/java/org/springblade/manager/controller/ExcelTabController.java

@@ -22,6 +22,7 @@ import org.apache.commons.codec.Charsets;
 import org.apache.commons.lang.StringUtils;
 import org.apache.commons.lang3.ObjectUtils;
 import org.apache.poi.ss.usermodel.WorkbookFactory;
+import org.jetbrains.annotations.TestOnly;
 import org.jsoup.Jsoup;
 import org.jsoup.nodes.Document;
 import org.jsoup.nodes.Element;
@@ -162,8 +163,8 @@ public class ExcelTabController extends BladeController {
 
 
     // 线程池
- //   @Resource(name = "taskExecutor1")
-   // private ThreadPoolExecutor executor;
+    @Resource(name = "taskExecutor1")
+    private ThreadPoolExecutor executor;
 
 
     @Autowired
@@ -1606,6 +1607,7 @@ public class ExcelTabController extends BladeController {
     @GetMapping("/cope-buss-tab")
     @ApiOperationSupport(order = 19)
     @ApiOperation(value = "表单复制", notes = "表单复制")
+    @Transactional
     @ApiImplicitParams(value = {
             @ApiImplicitParam(name = "pkeyId", value = "pkeyId", required = true)
     })
@@ -1653,7 +1655,6 @@ public class ExcelTabController extends BladeController {
         jdbcTemplate.execute(querySql);
         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);
@@ -4094,7 +4095,62 @@ public class ExcelTabController extends BladeController {
 
 
   //  @Scheduled(cron = "0/20 * * * * ?")
- /*   public void SignInfo() {
+    public void SignInfo() {
+        //执行代码
+        String sql = "SELECT * from m_wbs_tree_contract where id in(SELECT parent_id from m_wbs_tree_contract where contract_id=1750757576810766337 and is_cope_tab=2  ) and type =1 and contract_id=1750757576810766337 and is_deleted<>4 " ;
+        List<Map<String, Object>> maps = jdbcTemplate.queryForList(sql);
+        if (maps != null && maps.size() >= 1) {
+            for (Map<String, Object> dataInfo : maps) {
+                if (executor.getQueue().size() <= 40) {
+                    String idkey = dataInfo.get("p_key_id") + "";
+                    Boolean aBoolean = RedisTemplate.hasKey("sign-" + idkey);
+                    if (!aBoolean) {
+                        RedisTemplate.opsForValue().set("sign-" + idkey, "1", 30, TimeUnit.SECONDS);
+                        CompletableFuture<Void> runAsync = CompletableFuture.runAsync(() -> {
+                            try {
+                                this.checkIsExsitTaskBatch(dataInfo);
+                            } catch (Exception e) {
+                                e.printStackTrace();
+                            }
+                        }, executor);
+                    }
+
+                }
+            }
+        }
+        System.out.println("队列数量" + executor.getQueue().size());
+        System.out.println("活跃数量" + executor.getActiveCount());
+        System.out.println("总共数量" + executor.getTaskCount());
+        System.out.println("完成数量" + executor.getCompletedTaskCount());
+    }
+        public void checkIsExsitTaskBatch (Map < String, Object > dataInfo){
+            String sql = "SELECT * from m_wbs_tree_contract where parent_id =(select id from m_wbs_tree_contract where p_key_id='"+dataInfo.get("p_key_id")+"' and is_deleted=0 ) and type =2  and is_cope_tab=2 and contract_id=1750757576810766337 ORDER BY sort,create_time,node_name ASC" ;
+            List<Map<String, Object>> maps = jdbcTemplate.queryForList(sql);
+            String node_name = "";
+            System.out.println(sql);
+            int index = 0;
+            if(maps!=null && maps.size()>=1){
+                for(int i =0;i<maps.size();i++){
+                    Map<String, Object> dataIn = maps.get(i);
+                    String nodeName =dataIn.get("node_name")+"";
+                    if(node_name.equals(nodeName)){
+                        index = index+1;
+                    }else{
+                        index =1;
+                    }
+                    node_name = nodeName;
+                    if(nodeName.indexOf("__")>=0){
+                        nodeName = nodeName.split("__")[0];
+                    }
+                  String  newNmae = nodeName+"__"+index;
+                    System.out.println(newNmae);
+                   // jdbcTemplate.update("update m_wbs_tree_contract set node_name='"+node_name+"' set is_deleted=4 where p_key_id='"+dataIn.get("p_key_id")+"' ");
+
+                 }
+            }
+        }
+   /* @Scheduled(cron = "0/20 * * * * ?")
+    public void SignInfo() {
         //执行代码
         String sql = "SELECT a.* from u_information_query a,m_wbs_tree_contract b  where a.wbs_id=b.p_key_id and  a.project_id='1681859557657550850' and  a.create_dept=100 LIMIT 5";
         List<Map<String, Object>> maps = jdbcTemplate.queryForList(sql);
@@ -4122,9 +4178,12 @@ public class ExcelTabController extends BladeController {
         System.out.println("活跃数量" + executor.getActiveCount());
         System.out.println("总共数量" + executor.getTaskCount());
         System.out.println("完成数量" + executor.getCompletedTaskCount());
-    }
+    }*/
 
-    public void checkIsExsitTaskBatch(Map<String, Object> dataInfo) {
+
+
+
+ /*   public void checkIsExsitTaskBatch(Map<String, Object> dataInfo) {
         // 数据
         String file_path = "/Users/hongchuangyanfa/Desktop/";
         String nodeId = dataInfo.get("wbs_id")+"";
@@ -4177,11 +4236,11 @@ public class ExcelTabController extends BladeController {
             String dateInfo = "";
             for (String iId : list) {
                 //获取
-               *//* if(StringUtils.isNotBlank(dataInfo.get("file_user_id_and_name")+"")){
+                if(StringUtils.isNotBlank(dataInfo.get("file_user_id_and_name")+"")){
                     String userIdAndName = dataInfo.get("file_user_id_and_name")+"";
                     String[] split = userIdAndName.split("-");
                     userId = Long.parseLong(split[0]);
-                }*//*
+                }
 
                 List<AppWbsTreeContractVO> WbsTreeContract = wbsTreeContractService.searchNodeAllTable(nodeId+":"+userId, classify, contractId, projectId ,null);
 

+ 0 - 2
blade-service/blade-manager/src/main/java/org/springblade/manager/controller/WbsTreePrivateController.java

@@ -423,7 +423,6 @@ public class WbsTreePrivateController extends BladeController {
         return R.fail(200, "未查询到信息");
     }
 
-
     @PostMapping("/self/trial/getMixRatioTestTree")
     @ApiOperationSupport(order = 5)
     @ApiOperation(value = "获取当前节点的试验配合比树", notes = "传入当前节点的pKeyId")
@@ -435,7 +434,6 @@ public class WbsTreePrivateController extends BladeController {
         return R.fail(200, "未查询到信息");
     }
 
-
     /**
      * 获取当前节点详情
      */

+ 25 - 2
blade-service/blade-manager/src/main/java/org/springblade/manager/feign/ExcelTabClientImpl.java

@@ -1,5 +1,6 @@
 package org.springblade.manager.feign;
 
+import com.alibaba.druid.util.DaemonThreadFactory;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
@@ -29,6 +30,7 @@ import org.springblade.manager.enums.ExecuteType;
 import org.springblade.manager.service.IExcelTabService;
 import org.springblade.manager.service.IWbsTreePrivateService;
 import org.springblade.manager.utils.FileUtils;
+import org.springblade.manager.vo.WbsTreePrivateVO4;
 import org.springblade.resource.feign.NewIOSSClient;
 import org.springblade.system.cache.ParamCache;
 import org.springframework.jdbc.core.BeanPropertyRowMapper;
@@ -42,6 +44,7 @@ import java.io.File;
 import java.io.FileInputStream;
 import java.io.InputStream;
 import java.util.List;
+import java.util.Map;
 import java.util.stream.Collectors;
 
 @RestController
@@ -53,6 +56,7 @@ public class ExcelTabClientImpl implements ExcelTabClient {
     private final NewIOSSClient newIOSSClient;
     private final InformationQueryClient informationQueryClient;
     private final ExcelTabController excelTabController;
+    private final IWbsTreePrivateService wbsTreePrivateService;
     private static final Logger logger = LoggerFactory.getLogger(ExcelTabClientImpl.class);
 
     @Override
@@ -69,6 +73,23 @@ public class ExcelTabClientImpl implements ExcelTabClient {
         String projectId = table.getString("projectId");
         String contractId = table.getString("contractId");
 
+    //    List<WbsTreePrivateVO4> wbsTreePrivateVO4s = wbsTreePrivateService.searchNodeAllTable(nodeId, type + "", "1", contractId, projectId, 0, id);
+/*        for (WbsTreePrivateVO4 treePrivate : wbsTreePrivateVO4s) {
+            if (tabIds.indexOf(treePrivate.getPKeyId() + "") < 0) {
+                List<Map<String, Object>> bussDataInfoTrial = excelTabService.getBussDataInfoTrial(id, treePrivate.getPKeyId(), Long.parseLong(contractId));
+                Map<String, Object> dataInfo = bussDataInfoTrial.get(0);
+                dataInfo.put("pkeyId", treePrivate.getPKeyId());
+                dataInfo.put("projectId", treePrivate.getProjectId());
+                dataInfo.put("type", 1);
+                dataInfo.put("isBussShow", 1);
+                dataInfo.put("nodeId", nodeId);
+                dataInfo.put("contractId", contractId);
+                dataInfo.put("oper", true);
+                dataInfo.put("isCollapseLoad", true);
+                dataArray.add(dataInfo);
+            }
+        }*/
+
         //应用抽取的数据
         dataArray = excelTabService.addLoadDataInfo(dataArray);
 
@@ -76,6 +97,7 @@ public class ExcelTabClientImpl implements ExcelTabClient {
         try {
             //------公式填充------
             this.excelTabService.formulaFillData(tableInfoList, Long.parseLong(nodeId), ExecuteType.TESTING);
+
         } catch (Exception e) {
             e.printStackTrace();
             throw new RuntimeException("试验公式执行异常,操作失败");
@@ -144,8 +166,9 @@ public class ExcelTabClientImpl implements ExcelTabClient {
     public R synPDFInfo(String contractId, String nodeIds, String classify, String projectId, String authorization) throws Exception {
         return excelTabController.synPDFInfo(contractId, nodeIds, classify, projectId);
     }
+
     @Override
-    public List<ExcelTab> getArchiveTabList(){
+    public List<ExcelTab> getArchiveTabList() {
         return excelTabService.getListByParentName("档案");
     }
 
@@ -172,7 +195,7 @@ public class ExcelTabClientImpl implements ExcelTabClient {
             //------试验填报数据保存,当前记录id作为groupId------
             this.excelTabService.saveOrUpdateInfoTrial(tableInfoList, Func.toLong(groupId));
 
-            pdfUrl = this.excelTabService.getEntrustPDFTrial(Func.toLong(pkeyId),contractId,Func.toLong(groupId));
+            pdfUrl = this.excelTabService.getEntrustPDFTrial(Func.toLong(pkeyId), contractId, Func.toLong(groupId));
 
         } catch (Exception e) {
             e.printStackTrace();

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

@@ -109,7 +109,7 @@ public interface WbsTreeContractMapper extends EasyBaseMapper<WbsTreeContract> {
 
     void tableSort(@Param("map") Map<Long, Integer> map);
 
-    List<APIWbsContractNodeVo> apiTreeNode(@Param("contractId") String contractId);
+    List<APIWbsContractNodeVo> apiTreeNode(@Param("contractId") String contractId,@Param("nodeName") String nodeName);
 
     List<APIWbsContractNodeHzrcVo> apiTreeNodeHzrc(@Param("contractId") String contractId,@Param("classType") Integer classType);
 }

+ 3 - 0
blade-service/blade-manager/src/main/java/org/springblade/manager/mapper/WbsTreeContractMapper.xml

@@ -841,6 +841,9 @@
         and wbs_type = 1
         and type=1
         and contract_id = #{contractId}
+        <if test="nodeName != null and nodeName != ''">
+            AND node_name like CONCAT(CONCAT('%', #{nodeName}), '%')
+        </if>
         ORDER BY type,sort
     </select>
 

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

@@ -98,6 +98,7 @@ public interface IExcelTabService extends BaseService<ExcelTab> {
      * 公式填充
      */
     void formulaFillData(List<TableInfo> tableInfoList, Long nodeId, ExecuteType type);
+
     void formulaFillData2(JSONArray dataArray, ExecuteType type);
 
 

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

@@ -70,7 +70,7 @@ public interface IWbsTreeContractService extends BaseService<WbsTreeContract> {
     List<WbsTreeContractLazyVO> getConcealedWorksNodeTree(String contractId, String parentId);
 
     //获取质检 wbs -甬台温
-    List<APIWbsContractNodeVo> apiTreeNode(String contractId);
+    List<APIWbsContractNodeVo> apiTreeNode(String contractId,String nodeName);
 
     //获取质检 wbs -湖州绕城
     List<APIWbsContractNodeHzrcVo> apiTreeNodeHzrc(String contractId,Integer classType);

+ 15 - 1
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/ExcelTabServiceImpl.java

@@ -345,17 +345,27 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
                 List<NodeTable> tableAll = createNodeTables(nodeId, tableInfoList.get(0).getContractId(), tableInfoList.get(0).getProjectId(), type,tableInfoList.get(0).getClassify());
                 if (tableAll.size() > tableInfoList.size()) {
                     TableInfo example = tableInfoList.get(0);
+
                     /*补充缺失的数据*/
                     List<Long> cp = tableInfoList.stream().map(TableInfo::getPkeyId).map(Long::parseLong).collect(Collectors.toList());
                     List<Long> load = tableAll.stream().map(NodeTable::getPKeyId).filter(pk -> !cp.contains(pk)).collect(Collectors.toList());
+
                     Map<Long, String> keyMap = tableAll.stream().collect(toMap(NodeTable::getPKeyId, NodeTable::getInitTableName));
                     Map<String, List<Long>> loadMap = load.stream().collect(Collectors.groupingBy(keyMap::get, Collectors.toList()));
+
                     loadMap.entrySet().parallelStream().forEach(entry -> {
                         /*init_table_name*/
                         String k = entry.getKey();
                         /*pkeyId集合*/
                         List<Long> v = entry.getValue();
-                        List<Map<String, Object>> dataMap = this.jdbcTemplate.queryForList("select * from " + k + " where p_key_id in (" + v.stream().map(Objects::toString).collect(Collectors.joining(",")) + ")");
+                        String selSql = "";
+                        if(type.equals(ExecuteType.TESTING)) {
+                            selSql = "select * from " + k + " where p_key_id in (" + v.stream().map(Objects::toString).collect(Collectors.joining(",")) + ") and group_id="+example.getTestGroupId()+"";
+                        }else{
+                            selSql = "select * from " + k + " where p_key_id in (" + v.stream().map(Objects::toString).collect(Collectors.joining(",")) + ")";
+                        }
+
+                        List<Map<String, Object>> dataMap = this.jdbcTemplate.queryForList(selSql);
                         if (dataMap.size() > 0) {
                             dataMap.forEach(map -> {
                                 TableInfo e = new TableInfo();
@@ -2193,6 +2203,9 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
         FileUtils.excelToPdf(excelPath, pdfPath);
 
         BladeFile bladeFile = newIOSSClient.uploadFile(pkeyId + ".pdf", pdfPath);
+        if(pkeyId == 1806174262705258575L){
+            System.out.println();
+        }
 
         //附件
         TableFile tableFile1 = tableFileService.getBaseMapper().selectList(Wrappers.<TableFile>query().lambda().eq(TableFile::getTabId, pkeyId + "").eq(TableFile::getType, 1)).stream().findAny().orElse(null);
@@ -2310,6 +2323,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
                 TableInfo tableInfo = new TableInfo();
                 JSONObject dataInfo2 = dataArray.getJSONObject(m);
                 tableInfo.setPkeyId(dataInfo2.getString("pkeyId"));
+                tableInfo.setTestGroupId(dataInfo2.getString("group_id"));
                 tableInfo.setToBeUpdated(true);
 
                 // entrustInfo = 为 委托单信息

+ 13 - 1
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/FormulaServiceImpl.java

@@ -178,9 +178,11 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
             tec.constantMap.put(CHAIN,nodes.stream().map(e->StringUtils.isNotEmpty(e.getFullName())?e.getFullName():e.getNodeName()).collect(Collectors.toList()));
             /*节点参数*/
             tec.constantMap.put(WP,getWpMap(one,tec));
+
             /*表格名称*/
             List<AppWbsTreeContractVO> tableList =wbsTreeContractService.searchNodeAllTable(one.getPkId().toString(), "1", tec.getContractId().toString(),tec.getProjectId().toString(),null);
             tec.constantMap.put(TABLE_LIST,tableList);
+
             /*监表质量附件,过滤掉隐藏表格*/
             tec.constantMap.put("tableNames",tableList.stream().filter(e->StringUtils.isEquals(e.getIsBussShow(),1)&&StringUtils.isNotEquals(e.getTableType(),4)).map(WbsTreeContract::getNodeName).collect(Collectors.toList()));
 
@@ -1118,6 +1120,9 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
         for(FormData fd:tec.formDataList){
             if(fd.verify()){
                 Formula formula =fd.getFormula();
+                if(formula.getId()==1575013024912113671l){
+                    System.out.println("");
+                }
                 String f=formula.getFormula();
                 if(Func.isNotBlank(f)){
                     try{
@@ -2808,7 +2813,9 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
                             /*swId是分项评定的父节点Id*/
                             List<FormulaDataBlock> formulaDataBlocks = this.getSqlList("select a.id,a.type,a.sw_id swId,a.contract_id contractId,a.val from m_formula_data_block a join (select parent_id from m_wbs_tree_contract where tree_code like '" + treeCode.getLast() + "%' and contract_id =" + wtcEva.getContractId() + " and major_data_type=2 and is_deleted=0 ORDER BY tree_code)b on a.sw_id=b.parent_id ", FormulaDataBlock.class);
                             if (formulaDataBlocks != null && formulaDataBlocks.size() > 0) {
+
                                 /*就是分项工程节点的父节点名称*/
+
                                 String swIds = formulaDataBlocks.stream().map(FormulaDataBlock::getSwId).map(Objects::toString).collect(Collectors.joining(","));
                                 List<Map<String, Object>> listMaps = this.jdbcTemplate.queryForList("select id ,node_name nodeName,full_name fullName  from m_wbs_tree_contract where is_deleted =0 and contract_id=" + wtcEva.getContractId() + " and id in(" + swIds + ")");
                                 Map<String, String> swNameMap = new HashMap<>();
@@ -3004,7 +3011,8 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
         MeterType meterType = MeterType.getByIndex(type,contractInfo.getContractType());
         /*元素创建*/
         Map<String,String> parent=  getWtpParent(meterType.getName(),contractInfo.getPId());
-        List<NodeTable> tableList=getTableListMeter(parent);
+        List<NodeTable> tableList = getTableListMeter(parent);
+        // 表-html 间的关系
         Map<String,Document> documentMap=  tableList.parallelStream().collect(Collectors.toMap(NodeTable::getInitTableName,m->{
             String htmlUrl = m.getHtmlUrl();
             InputStream inputStreamByUrl = null;
@@ -3029,11 +3037,14 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
         executionTime.info("坐标信息获取");
         /*额外单元格坐标配置*/
         settingCoordsExtend(coordinateMap);
+        // 获取表对应的所有元素字段信息
         List<FormData> processFds = this.createFormDataByTableName(tableList.stream().map(NodeTable::getInitTableName).collect(Collectors.joining("','")));
         listForMeter(processFds,contractInfo.getPId(),parent.get("id"));
         executionTime.info("元素信息");
+
         /*转换器上下文声明*/
         TableElementConverter tec = new TableElementConverter(processFds,coordinateMap,tableList);
+
         tec.setNewIOSSClient(this.newIOSSClient);
         tec.setProjectId(Long.parseLong(contractInfo.getPId()));
         tec.setESignMaps(eSignMaps);
@@ -3047,6 +3058,7 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
         List<FormulaHandleChain> formulaHandleChains = new ArrayList<>();
         /*初始化*/
         ExecutorInit init= new ExecutorInit(tec);
+
         BeanUtils.copyProperties(this.formulaDao,init);
         formulaHandleChains.add(init);
         formulaHandleChains.add(new ExecutorSort(tec));

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

@@ -1081,8 +1081,8 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
      * @return
      */
     @Override
-    public List<APIWbsContractNodeVo> apiTreeNode(String contractId) {
-        return ForestNodeMerger.merge(baseMapper.apiTreeNode(contractId));
+    public List<APIWbsContractNodeVo> apiTreeNode(String contractId,String nodeName) {
+        return ForestNodeMerger.merge(baseMapper.apiTreeNode(contractId,nodeName));
     }
 
     /**

+ 3 - 2
blade-service/blade-meter/src/main/java/org/springblade/meter/controller/TaskController.java

@@ -4034,16 +4034,17 @@ public class TaskController extends BladeController {
 
 
     // 添加电签任务列表
+    @Transactional
     public void addSignTaskBatch(Report report) {
         try {
             // 修改个人电签状态
             String UPSql = "update u_task_parallel a set a.e_visa_status=null,e_visa_content=null where a.process_instance_id = (select b.process_instance_id from u_task b where  b.`status` in(1,2) and b.form_data_id=" + report.getPeriodId() +  ") ";
             String DeSql = "delete from u_task_batch where task_parallel_id = (select b.process_instance_id from u_task b where b.`status` in(1,2) and b.form_data_id=" + report.getPeriodId()  + ")";
             //删除以前存在的电签
-            String sql = " insert INTO u_task_batch(id,task_parallel_id,json_data,create_user,create_dept,create_time,update_user,update_time,status,is_deleted,nick_name) " + " SELECT a.id,a.process_instance_id,json_object('approvalFileList',json_array(),'approvalType',b.meter_task_type,'comment','','flag','OK','formDataId',b.form_data_id,'parallelProcessInstanceId',a.parallel_process_instance_id,'pass',true,'taskId',b.id) as  json_data,a.task_user,a.create_dept,a.create_time,a.update_user,a.update_time,1 as status,0 as is_deleted,a.task_user_name as nick_name " + " from u_task_parallel a,u_task b where b.`status` in(1,2) and a.status=2 and  a.process_instance_id=b.process_instance_id and b.form_data_id= '" + report.getPeriodId()+"'";
-            jdbcTemplate.execute(sql);
+            String sql = " insert INTO u_task_batch(id,task_parallel_id,json_data,create_user,create_dept,create_time,update_user,update_time,status,is_deleted,nick_name) " + " SELECT a.id,a.process_instance_id,json_object('approvalFileList',json_array(),'approvalType',b.approval_type,'comment','','flag','OK','formDataId',b.form_data_id,'parallelProcessInstanceId',a.parallel_process_instance_id,'pass',true,'taskId',b.id) as  json_data,a.task_user,a.create_dept,a.create_time,a.update_user,a.update_time,1 as status,0 as is_deleted,a.task_user_name as nick_name " + " from u_task_parallel a,u_task b where b.`status` in(1,2) and  a.process_instance_id=b.process_instance_id and b.form_data_id= '" + report.getPeriodId()+"'";
             jdbcTemplate.execute(DeSql);
             jdbcTemplate.execute(UPSql);
+            jdbcTemplate.execute(sql);
         } catch (Exception e) {
             StaticLog.error(e.getMessage());
         }