소스 검색

试验bug

liuyc 2 년 전
부모
커밋
fb71a23618

+ 301 - 287
blade-ops/blade-resource/src/main/java/org/springblade/resource/endpoint/OssEndpoint.java

@@ -20,6 +20,7 @@ import io.swagger.annotations.Api;
 import lombok.AllArgsConstructor;
 import lombok.SneakyThrows;
 import org.apache.pdfbox.pdmodel.PDDocument;
+import org.springblade.common.utils.SnowFlakeUtil;
 import org.springblade.core.oss.model.BladeFile;
 import org.springblade.core.oss.model.OssFile;
 import org.springblade.core.secure.annotation.PreAuth;
@@ -36,6 +37,7 @@ import org.springblade.resource.vo.NewBladeFile;
 import org.springframework.beans.BeanUtils;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
+
 import javax.imageio.ImageIO;
 import java.awt.*;
 import java.awt.image.BufferedImage;
@@ -55,292 +57,304 @@ import java.util.Objects;
 @Api(value = "对象存储端点", tags = "对象存储端点")
 public class OssEndpoint {
 
-	/**
-	 * 对象存储构建类
-	 */
-	private final OssBuilder ossBuilder;
-
-	/**
-	 * 附件表服务
-	 */
-	private final IAttachService attachService;
-
-	private final CommonFileClient commonFileClient;
-
-	/**
-	 * 创建存储桶
-	 *
-	 * @param bucketName 存储桶名称
-	 * @return Bucket
-	 */
-	@SneakyThrows
-	@PostMapping("/make-bucket")
-	@PreAuth(RoleConstant.HAS_ROLE_ADMIN)
-	public R makeBucket(@RequestParam String bucketName) {
-		ossBuilder.template().makeBucket(bucketName);
-		return R.success("创建成功");
-	}
-
-	/**
-	 * 创建存储桶
-	 *
-	 * @param bucketName 存储桶名称
-	 * @return R
-	 */
-	@SneakyThrows
-	@PostMapping("/remove-bucket")
-	@PreAuth(RoleConstant.HAS_ROLE_ADMIN)
-	public R removeBucket(@RequestParam String bucketName) {
-		ossBuilder.template().removeBucket(bucketName);
-		return R.success("删除成功");
-	}
-
-	/**
-	 * 拷贝文件
-	 *
-	 * @param fileName       存储桶对象名称
-	 * @param destBucketName 目标存储桶名称
-	 * @param destFileName   目标存储桶对象名称
-	 * @return R
-	 */
-	@SneakyThrows
-	@PostMapping("/copy-file")
-	public R copyFile(@RequestParam String fileName, @RequestParam String destBucketName, String destFileName) {
-		ossBuilder.template().copyFile(fileName, destBucketName, destFileName);
-		return R.success("操作成功");
-	}
-
-	/**
-	 * 获取文件信息
-	 *
-	 * @param fileName 存储桶对象名称
-	 * @return InputStream
-	 */
-	@SneakyThrows
-	@GetMapping("/stat-file")
-	public R<OssFile> statFile(@RequestParam String fileName) {
-		return R.data(ossBuilder.template().statFile(fileName));
-	}
-
-	/**
-	 * 获取文件相对路径
-	 *
-	 * @param fileName 存储桶对象名称
-	 * @return String
-	 */
-	@SneakyThrows
-	@GetMapping("/file-path")
-	public R<String> filePath(@RequestParam String fileName) {
-		return R.data(ossBuilder.template().filePath(fileName));
-	}
-
-
-	/**
-	 * 获取文件外链
-	 *
-	 * @param fileName 存储桶对象名称
-	 * @return String
-	 */
-	@SneakyThrows
-	@GetMapping("/file-link")
-	public R<String> fileLink(@RequestParam String fileName) {
-		return R.data(ossBuilder.template().fileLink(fileName));
-	}
-
-	/**
-	 * 上传文件
-	 *
-	 * @param file 文件
-	 * @return ObjectStat
-	 */
-	@SneakyThrows
-	@PostMapping("/put-file")
-	public R<BladeFile> putFile(@RequestParam MultipartFile file) {
-		BladeFile bladeFile = ossBuilder.template().putFile(file.getOriginalFilename(), file.getInputStream());
-		return R.data(bladeFile);
-	}
-
-	/**
-	 * 上传文件
-	 *
-	 * @param file 文件
-	 * @return ObjectStat
-	 */
-	@SneakyThrows
-	@PostMapping("/put-file2")
-	public R<String> putFile2(@RequestParam MultipartFile file) {
-		BladeFile bladeFile = ossBuilder.template().putFile(file.getOriginalFilename(), file.getInputStream());
-		return R.data(bladeFile.getLink());
-	}
-
-	/**
-	 * 上传文件(兼容工程文件需求)
-	 */
-	@SneakyThrows
-	@PostMapping("/upload-file")
-	public synchronized R<NewBladeFile> uploadFile(@RequestParam MultipartFile file){
-		//上传原图
-		ByteArrayInputStream inputStream = new ByteArrayInputStream(file.getBytes());
-		BladeFile bladeFile = ossBuilder.template().putFile(file.getOriginalFilename(),inputStream);
-
-		//处理PDF文件
-		NewBladeFile newBladeFile = new NewBladeFile();
-		if(Objects.requireNonNull(file.getOriginalFilename()).contains("xlsx")){
-			newBladeFile = this.commonFileClient.excelToPdf(file);
-
-		} else if(file.getOriginalFilename().contains("xls")){
-			newBladeFile = this.commonFileClient.excelToPdf(file);
-
-		} else if(file.getOriginalFilename().contains("docx")){
-			newBladeFile = this.commonFileClient.wordToPdf(file);
-
-		} else if(file.getOriginalFilename().contains("png") || file.getOriginalFilename().contains("jpg")){
-			newBladeFile = this.commonFileClient.pngOrJpgToPdf(file);
-
-		} else if(file.getOriginalFilename().contains("pdf")){
-			//获取PDF文件
-			PDDocument document = PDDocument.load(file.getInputStream());
-			//获取文件页数
-			newBladeFile.setPage(document.getPages().getCount());
-			//pdf的路径就是文件上传的路径
-			newBladeFile.setPdfUrl(bladeFile.getLink());
-		}
-
-		BeanUtils.copyProperties(bladeFile, newBladeFile);
-		newBladeFile.setFileSize(file.getSize()/1024);
-		return R.data(newBladeFile);
-	}
-
-	/**
-	 * 上传文件(兼容工程文件需求)
-	 */
-	@SneakyThrows
-	@PostMapping("/upload-file2")
-	public R<String> uploadFile2(@RequestParam MultipartFile file){
-		//上传原文件
-		BladeFile bladeFile = ossBuilder.template().putFile(file.getOriginalFilename(), file.getInputStream());
-
-		//处理PDF文件
-		NewBladeFile newBladeFile = new NewBladeFile();
-		if(Objects.requireNonNull(file.getOriginalFilename()).contains("xlsx")){
-			newBladeFile = this.commonFileClient.excelToPdf(file);
-
-		} else if(file.getOriginalFilename().contains("xls")){
-			newBladeFile = this.commonFileClient.excelToPdf(file);
-
-		} else if(file.getOriginalFilename().contains("docx")){
-			newBladeFile = this.commonFileClient.wordToPdf(file);
-
-		} else if(file.getOriginalFilename().contains("png") || file.getOriginalFilename().contains("jpg")){
-			newBladeFile = this.commonFileClient.pngOrJpgToPdf(file);
-
-		} else if(file.getOriginalFilename().contains("pdf")){
-			//获取PDF文件
-			PDDocument document = PDDocument.load(file.getInputStream());
-			//获取文件页数
-			newBladeFile.setPage(document.getPages().getCount());
-			//pdf的路径就是文件上传的路径
-			newBladeFile.setPdfUrl(bladeFile.getLink());
-		}
-
-		BeanUtils.copyProperties(bladeFile, newBladeFile);
-		newBladeFile.setFileSize(file.getSize()/1024);
-		return R.data(newBladeFile.getPdfUrl());
-	}
-
-	/**
-	 * 上传文件
-	 *
-	 * @param fileName 存储桶对象名称
-	 * @param file     文件
-	 * @return ObjectStat
-	 */
-	@SneakyThrows
-	@PostMapping("/put-file-by-name")
-	public R<BladeFile> putFile(@RequestParam String fileName, @RequestParam MultipartFile file) {
-		BladeFile bladeFile = ossBuilder.template().putFile(fileName, file.getInputStream());
-		return R.data(bladeFile);
-	}
-
-	/**
-	 * 上传文件并保存至附件表
-	 *
-	 * @param file 文件
-	 * @return ObjectStat
-	 */
-	@SneakyThrows
-	@PostMapping("/put-file-attach")
-	public R<BladeFile> putFileAttach(@RequestParam MultipartFile file) {
-		String fileName = file.getOriginalFilename();
-		BladeFile bladeFile = ossBuilder.template().putFile(fileName, file.getInputStream());
-		Long attachId = buildAttach(fileName, file.getSize(), bladeFile);
-		bladeFile.setAttachId(attachId);
-		return R.data(bladeFile);
-	}
-
-	/**
-	 * 上传文件并保存至附件表
-	 *
-	 * @param fileName 存储桶对象名称
-	 * @param file     文件
-	 * @return ObjectStat
-	 */
-	@SneakyThrows
-	@PostMapping("/put-file-attach-by-name")
-	public R<BladeFile> putFileAttach(@RequestParam String fileName, @RequestParam MultipartFile file) {
-		BladeFile bladeFile = ossBuilder.template().putFile(fileName, file.getInputStream());
-		Long attachId = buildAttach(fileName, file.getSize(), bladeFile);
-		bladeFile.setAttachId(attachId);
-		return R.data(bladeFile);
-	}
-
-	/**
-	 * 构建附件表
-	 *
-	 * @param fileName  文件名
-	 * @param fileSize  文件大小
-	 * @param bladeFile 对象存储文件
-	 * @return attachId
-	 */
-	private Long buildAttach(String fileName, Long fileSize, BladeFile bladeFile) {
-		String fileExtension = FileUtil.getFileExtension(fileName);
-		Attach attach = new Attach();
-		attach.setDomainUrl(bladeFile.getDomain());
-		attach.setLink(bladeFile.getLink());
-		attach.setName(bladeFile.getName());
-		attach.setOriginalName(bladeFile.getOriginalName());
-		attach.setAttachSize(fileSize);
-		attach.setExtension(fileExtension);
-		attachService.save(attach);
-		return attach.getId();
-	}
-
-	/**
-	 * 删除文件
-	 *
-	 * @param fileName 存储桶对象名称
-	 * @return R
-	 */
-	@SneakyThrows
-	@PostMapping("/remove-file")
-	@PreAuth(RoleConstant.HAS_ROLE_ADMIN)
-	public R removeFile(@RequestParam String fileName) {
-		ossBuilder.template().removeFile(fileName);
-		return R.success("操作成功");
-	}
-
-	/**
-	 * 批量删除文件
-	 *
-	 * @param fileNames 存储桶对象名称集合
-	 * @return R
-	 */
-	@SneakyThrows
-	@PostMapping("/remove-files")
-	@PreAuth(RoleConstant.HAS_ROLE_ADMIN)
-	public R removeFiles(@RequestParam String fileNames) {
-		ossBuilder.template().removeFiles(Func.toStrList(fileNames));
-		return R.success("操作成功");
-	}
+    /**
+     * 对象存储构建类
+     */
+    private final OssBuilder ossBuilder;
+
+    /**
+     * 附件表服务
+     */
+    private final IAttachService attachService;
+
+    private final CommonFileClient commonFileClient;
+
+    /**
+     * 创建存储桶
+     *
+     * @param bucketName 存储桶名称
+     * @return Bucket
+     */
+    @SneakyThrows
+    @PostMapping("/make-bucket")
+    @PreAuth(RoleConstant.HAS_ROLE_ADMIN)
+    public R makeBucket(@RequestParam String bucketName) {
+        ossBuilder.template().makeBucket(bucketName);
+        return R.success("创建成功");
+    }
+
+    /**
+     * 创建存储桶
+     *
+     * @param bucketName 存储桶名称
+     * @return R
+     */
+    @SneakyThrows
+    @PostMapping("/remove-bucket")
+    @PreAuth(RoleConstant.HAS_ROLE_ADMIN)
+    public R removeBucket(@RequestParam String bucketName) {
+        ossBuilder.template().removeBucket(bucketName);
+        return R.success("删除成功");
+    }
+
+    /**
+     * 拷贝文件
+     *
+     * @param fileName       存储桶对象名称
+     * @param destBucketName 目标存储桶名称
+     * @param destFileName   目标存储桶对象名称
+     * @return R
+     */
+    @SneakyThrows
+    @PostMapping("/copy-file")
+    public R copyFile(@RequestParam String fileName, @RequestParam String destBucketName, String destFileName) {
+        ossBuilder.template().copyFile(fileName, destBucketName, destFileName);
+        return R.success("操作成功");
+    }
+
+    /**
+     * 获取文件信息
+     *
+     * @param fileName 存储桶对象名称
+     * @return InputStream
+     */
+    @SneakyThrows
+    @GetMapping("/stat-file")
+    public R<OssFile> statFile(@RequestParam String fileName) {
+        return R.data(ossBuilder.template().statFile(fileName));
+    }
+
+    /**
+     * 获取文件相对路径
+     *
+     * @param fileName 存储桶对象名称
+     * @return String
+     */
+    @SneakyThrows
+    @GetMapping("/file-path")
+    public R<String> filePath(@RequestParam String fileName) {
+        return R.data(ossBuilder.template().filePath(fileName));
+    }
+
+
+    /**
+     * 获取文件外链
+     *
+     * @param fileName 存储桶对象名称
+     * @return String
+     */
+    @SneakyThrows
+    @GetMapping("/file-link")
+    public R<String> fileLink(@RequestParam String fileName) {
+        return R.data(ossBuilder.template().fileLink(fileName));
+    }
+
+    /**
+     * 上传文件
+     *
+     * @param file 文件
+     * @return ObjectStat
+     */
+    @SneakyThrows
+    @PostMapping("/put-file")
+    public R<BladeFile> putFile(@RequestParam MultipartFile file) {
+        BladeFile bladeFile = ossBuilder.template().putFile(file.getOriginalFilename(), file.getInputStream());
+        return R.data(bladeFile);
+    }
+
+    /**
+     * 上传文件
+     *
+     * @param file 文件
+     * @return ObjectStat
+     */
+    @SneakyThrows
+    @PostMapping("/put-file2")
+    public R<String> putFile2(@RequestParam MultipartFile file) {
+        BladeFile bladeFile = ossBuilder.template().putFile(file.getOriginalFilename(), file.getInputStream());
+        return R.data(bladeFile.getLink());
+    }
+
+    /**
+     * 上传文件(兼容工程文件需求)
+     */
+    @SneakyThrows
+    @PostMapping("/upload-file")
+    public synchronized R<NewBladeFile> uploadFile(@RequestParam MultipartFile file) {
+        //上传原图
+        ByteArrayInputStream inputStream = new ByteArrayInputStream(file.getBytes());
+        BladeFile bladeFile = ossBuilder.template().putFile(file.getOriginalFilename(), inputStream);
+
+        //处理PDF文件
+        NewBladeFile newBladeFile = new NewBladeFile();
+        if (Objects.requireNonNull(file.getOriginalFilename()).contains("xlsx")) {
+            newBladeFile = this.commonFileClient.excelToPdf(file);
+
+        } else if (file.getOriginalFilename().contains("xls")) {
+            newBladeFile = this.commonFileClient.excelToPdf(file);
+
+        } else if (file.getOriginalFilename().contains("docx")) {
+            newBladeFile = this.commonFileClient.wordToPdf(file);
+
+        } else if (file.getOriginalFilename().contains("png") || file.getOriginalFilename().contains("jpg")) {
+            newBladeFile = this.commonFileClient.pngOrJpgToPdf(file);
+
+        } else if (file.getOriginalFilename().contains("pdf")) {
+            //获取PDF文件
+            PDDocument document = PDDocument.load(file.getInputStream());
+            //获取文件页数
+            newBladeFile.setPage(document.getPages().getCount());
+            //pdf的路径就是文件上传的路径
+            newBladeFile.setPdfUrl(bladeFile.getLink());
+        }
+
+        BeanUtils.copyProperties(bladeFile, newBladeFile);
+        newBladeFile.setFileSize(file.getSize() / 1024);
+
+        //入库
+        String fileExtension = FileUtil.getFileExtension(bladeFile.getOriginalName());
+        Attach attach = new Attach();
+        attach.setDomainUrl(bladeFile.getDomain());
+        attach.setLink(newBladeFile.getPdfUrl());
+        attach.setName(bladeFile.getName());
+        attach.setOriginalName(bladeFile.getOriginalName());
+        attach.setAttachSize(newBladeFile.getFileSize());
+        attach.setExtension(fileExtension);
+        attachService.save(attach);
+
+        return R.data(newBladeFile);
+    }
+
+    /**
+     * 上传文件(兼容工程文件需求)
+     */
+    @SneakyThrows
+    @PostMapping("/upload-file2")
+    public R<String> uploadFile2(@RequestParam MultipartFile file) {
+        //上传原文件
+        BladeFile bladeFile = ossBuilder.template().putFile(file.getOriginalFilename(), file.getInputStream());
+
+        //处理PDF文件
+        NewBladeFile newBladeFile = new NewBladeFile();
+        if (Objects.requireNonNull(file.getOriginalFilename()).contains("xlsx")) {
+            newBladeFile = this.commonFileClient.excelToPdf(file);
+
+        } else if (file.getOriginalFilename().contains("xls")) {
+            newBladeFile = this.commonFileClient.excelToPdf(file);
+
+        } else if (file.getOriginalFilename().contains("docx")) {
+            newBladeFile = this.commonFileClient.wordToPdf(file);
+
+        } else if (file.getOriginalFilename().contains("png") || file.getOriginalFilename().contains("jpg")) {
+            newBladeFile = this.commonFileClient.pngOrJpgToPdf(file);
+
+        } else if (file.getOriginalFilename().contains("pdf")) {
+            //获取PDF文件
+            PDDocument document = PDDocument.load(file.getInputStream());
+            //获取文件页数
+            newBladeFile.setPage(document.getPages().getCount());
+            //pdf的路径就是文件上传的路径
+            newBladeFile.setPdfUrl(bladeFile.getLink());
+        }
+
+        BeanUtils.copyProperties(bladeFile, newBladeFile);
+        newBladeFile.setFileSize(file.getSize() / 1024);
+        return R.data(newBladeFile.getPdfUrl());
+    }
+
+    /**
+     * 上传文件
+     *
+     * @param fileName 存储桶对象名称
+     * @param file     文件
+     * @return ObjectStat
+     */
+    @SneakyThrows
+    @PostMapping("/put-file-by-name")
+    public R<BladeFile> putFile(@RequestParam String fileName, @RequestParam MultipartFile file) {
+        BladeFile bladeFile = ossBuilder.template().putFile(fileName, file.getInputStream());
+        return R.data(bladeFile);
+    }
+
+    /**
+     * 上传文件并保存至附件表
+     *
+     * @param file 文件
+     * @return ObjectStat
+     */
+    @SneakyThrows
+    @PostMapping("/put-file-attach")
+    public R<BladeFile> putFileAttach(@RequestParam MultipartFile file) {
+        String fileName = file.getOriginalFilename();
+        BladeFile bladeFile = ossBuilder.template().putFile(fileName, file.getInputStream());
+        Long attachId = buildAttach(fileName, file.getSize(), bladeFile);
+        bladeFile.setAttachId(attachId);
+        return R.data(bladeFile);
+    }
+
+    /**
+     * 上传文件并保存至附件表
+     *
+     * @param fileName 存储桶对象名称
+     * @param file     文件
+     * @return ObjectStat
+     */
+    @SneakyThrows
+    @PostMapping("/put-file-attach-by-name")
+    public R<BladeFile> putFileAttach(@RequestParam String fileName, @RequestParam MultipartFile file) {
+        BladeFile bladeFile = ossBuilder.template().putFile(fileName, file.getInputStream());
+        Long attachId = buildAttach(fileName, file.getSize(), bladeFile);
+        bladeFile.setAttachId(attachId);
+        return R.data(bladeFile);
+    }
+
+    /**
+     * 构建附件表
+     *
+     * @param fileName  文件名
+     * @param fileSize  文件大小
+     * @param bladeFile 对象存储文件
+     * @return attachId
+     */
+    private Long buildAttach(String fileName, Long fileSize, BladeFile bladeFile) {
+        String fileExtension = FileUtil.getFileExtension(fileName);
+        Attach attach = new Attach();
+        attach.setDomainUrl(bladeFile.getDomain());
+        attach.setLink(bladeFile.getLink());
+        attach.setName(bladeFile.getName());
+        attach.setOriginalName(bladeFile.getOriginalName());
+        attach.setAttachSize(fileSize);
+        attach.setExtension(fileExtension);
+        attachService.save(attach);
+        return attach.getId();
+    }
+
+    /**
+     * 删除文件
+     *
+     * @param fileName 存储桶对象名称
+     * @return R
+     */
+    @SneakyThrows
+    @PostMapping("/remove-file")
+    @PreAuth(RoleConstant.HAS_ROLE_ADMIN)
+    public R removeFile(@RequestParam String fileName) {
+        ossBuilder.template().removeFile(fileName);
+        return R.success("操作成功");
+    }
+
+    /**
+     * 批量删除文件
+     *
+     * @param fileNames 存储桶对象名称集合
+     * @return R
+     */
+    @SneakyThrows
+    @PostMapping("/remove-files")
+    @PreAuth(RoleConstant.HAS_ROLE_ADMIN)
+    public R removeFiles(@RequestParam String fileNames) {
+        ossBuilder.template().removeFiles(Func.toStrList(fileNames));
+        return R.success("操作成功");
+    }
 
 }

+ 4 - 0
blade-service-api/blade-business-api/src/main/java/org/springblade/business/vo/TrialMaterialMobilizationVO.java

@@ -44,4 +44,8 @@ public class TrialMaterialMobilizationVO extends TrialMaterialMobilization {
     @ApiModelProperty(value = "材料类型名称")
     private String materialName;
 
+    private String otherAccessoriesName;
+    private String productionCertificateName;
+    private String qualityInspectionReportName;
+
 }

+ 55 - 10
blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TrialDetectionDataServiceImpl.java

@@ -21,6 +21,8 @@ import org.springblade.business.mapper.TrialDetectionDataMapper;
 import org.springblade.business.mapper.TrialSelfInspectionRecordMapper;
 import org.springblade.business.service.ITrialDetectionDataService;
 import org.springblade.business.vo.TrialDetectionDataVO;
+import org.springblade.common.constant.CommonConstant;
+import org.springblade.common.utils.CommonUtil;
 import org.springblade.common.utils.SnowFlakeUtil;
 import org.springblade.core.log.exception.ServiceException;
 import org.springblade.core.mp.base.BaseServiceImpl;
@@ -29,12 +31,14 @@ import org.springblade.core.mp.utils.PageUtil;
 import org.springblade.core.tool.utils.*;
 import org.springblade.manager.entity.WbsTreeContract;
 import org.springblade.manager.entity.WbsTreePrivate;
+import org.springblade.system.cache.ParamCache;
 import org.springframework.jdbc.core.BeanPropertyRowMapper;
 import org.springframework.jdbc.core.JdbcTemplate;
 import org.springframework.stereotype.Service;
 
 import java.io.File;
 import java.io.FileInputStream;
+import java.io.InputStream;
 import java.text.SimpleDateFormat;
 import java.util.*;
 import java.util.stream.Collectors;
@@ -209,8 +213,11 @@ public class TrialDetectionDataServiceImpl extends BaseServiceImpl<TrialDetectio
         if (StringUtils.isEmpty(sampleIds)) {
             return null;
         }
+        String file_path = ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
+        String sys_file_net_url = ParamCache.getValue(CommonConstant.SYS_FILE_NET_URL);
         //获取关联的样品信息
-        List<TrialSampleInfo> trialSampleInfoList = jdbcTemplate.query("select material_name,specification_number,sample_description,material_count,sampling_date from u_trial_sample_info where id in(" + sampleIds + ")", new BeanPropertyRowMapper<>(TrialSampleInfo.class));
+        List<TrialSampleInfo> trialSampleInfoList = jdbcTemplate.query("select proposed_position,material_name,specification_number,sample_description,material_count,sampling_date from u_trial_sample_info where id in(" + sampleIds + ")", new BeanPropertyRowMapper<>(TrialSampleInfo.class));
+        List<String> proposedPositionStr = trialSampleInfoList.stream().map(TrialSampleInfo::getProposedPosition).filter(ObjectUtil::isNotEmpty).collect(Collectors.toList());
         List<String> names = trialSampleInfoList.stream().map(TrialSampleInfo::getMaterialName).filter(ObjectUtil::isNotEmpty).collect(Collectors.toList());
         List<String> numbers = trialSampleInfoList.stream().map(TrialSampleInfo::getSpecificationNumber).filter(ObjectUtil::isNotEmpty).collect(Collectors.toList());
         List<String> descriptions = trialSampleInfoList.stream().map(TrialSampleInfo::getSampleDescription).filter(ObjectUtil::isNotEmpty).collect(Collectors.toList());
@@ -218,7 +225,7 @@ public class TrialDetectionDataServiceImpl extends BaseServiceImpl<TrialDetectio
         List<Date> samplingDate = trialSampleInfoList.stream().map(TrialSampleInfo::getSamplingDate).filter(ObjectUtil::isNotEmpty).collect(Collectors.toList());
         String dateStr = "";
         if (samplingDate.size() > 0) {
-            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+            SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月dd日");
             dateStr = samplingDate.stream().map(sdf::format).collect(Collectors.joining("、"));
         }
 
@@ -232,14 +239,32 @@ public class TrialDetectionDataServiceImpl extends BaseServiceImpl<TrialDetectio
                 try {
                     Map<String, String> map = new HashMap<>();
                     File file1 = ResourceUtil.getFile(trialNodeTab.getHtmlUrl());
-                    String htmlString = IoUtil.readToString(new FileInputStream(file1));
+                    InputStream fileInputStream;
+                    if (file1.exists()) {
+                        fileInputStream = new FileInputStream(file1);
+                    } else {
+                        String path = sys_file_net_url + trialNodeTab.getHtmlUrl().replaceAll("//", "/").replaceAll(file_path, "");
+                        fileInputStream = CommonUtil.getOSSInputStream(path);
+                    }
+                    String htmlString = IoUtil.readToString(fileInputStream);
+                    htmlString = htmlString.replaceAll("placeholder", "placeholderxx");
+                    htmlString = htmlString.replaceAll("title", "titlexx");
+
                     Document doc = Jsoup.parse(htmlString);
-                    Elements ypName = doc.select("el-input[placeholder~=样品名称.*]");
-                    Elements ypNumber = doc.select("el-input[placeholder~=样品编号.*]");
-                    Elements ypCount = doc.select("el-input[placeholder~=样品数量.*]");
-                    Elements ypMs = doc.select("el-input[placeholder~=样品描述.*]");
-                    Elements qyTime = doc.select("el-input[placeholder~=来样.*]");
+                    Elements ypName = doc.select("el-input[placeholderxx~=样品名称.*]");
+                    Elements ypNumber = doc.select("el-input[placeholderxx~=样品编号.*]");
+                    Elements ypCount = doc.select("el-input[placeholderxx~=样品数量.*]");
+                    Elements ypMs = doc.select("el-input[placeholderxx~=样品描述.*]");
+                    Elements gcBW = doc.select("el-input[placeholderxx~=工程部位.*]");
+                    Elements qyTime = doc.select("el-date-picker[placeholderxx~=来样取样时间.*]");
 
+                    //工程部位
+                    if (gcBW.size() >= 1) {
+                        for (Element element : gcBW) {
+                            map.put(element.attr("keyname"), ObjectUtils.isNotEmpty(proposedPositionStr) ? StringUtils.join(proposedPositionStr, "、") : "");
+                            break;
+                        }
+                    }
                     //样品名称
                     if (ypName.size() >= 1) {
                         for (Element element : ypName) {
@@ -293,6 +318,8 @@ public class TrialDetectionDataServiceImpl extends BaseServiceImpl<TrialDetectio
         if (StringUtils.isEmpty(projectPositionIds)) {
             return null;
         }
+        String file_path = ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
+        String sys_file_net_url = ParamCache.getValue(CommonConstant.SYS_FILE_NET_URL);
         //拼接工程部位names 单位、分部、分项
         List<WbsTreeContract> query = jdbcTemplate.query("select node_name,node_type,id,ancestors from m_wbs_tree_contract where node_type is not null and p_key_id in(" + projectPositionIds + ")", new BeanPropertyRowMapper<>(WbsTreeContract.class));
         List<WbsTreeContract> dw = query.stream().filter(f -> f.getNodeType().equals(1)).collect(Collectors.toList());
@@ -339,6 +366,14 @@ public class TrialDetectionDataServiceImpl extends BaseServiceImpl<TrialDetectio
             for (WbsTreeContract dwNode : dw) {
                 set.add(dwNode.getNodeName());
             }
+        } else if (fb.size() > 0) {
+            for (WbsTreeContract dwNode : fb) {
+                set.add(dwNode.getNodeName());
+            }
+        } else if (fx.size() > 0) {
+            for (WbsTreeContract dwNode : fx) {
+                set.add(dwNode.getNodeName());
+            }
         }
 
         if (set.size() > 0) {
@@ -352,9 +387,19 @@ public class TrialDetectionDataServiceImpl extends BaseServiceImpl<TrialDetectio
                     try {
                         Map<String, String> map = new HashMap<>();
                         File file1 = ResourceUtil.getFile(trialNodeTab.getHtmlUrl());
-                        String htmlString = IoUtil.readToString(new FileInputStream(file1));
+                        InputStream fileInputStream;
+                        if (file1.exists()) {
+                            fileInputStream = new FileInputStream(file1);
+                        } else {
+                            String path = sys_file_net_url + trialNodeTab.getHtmlUrl().replaceAll("//", "/").replaceAll(file_path, "");
+                            fileInputStream = CommonUtil.getOSSInputStream(path);
+                        }
+                        String htmlString = IoUtil.readToString(fileInputStream);
+                        htmlString = htmlString.replaceAll("placeholder", "placeholderxx");
+                        htmlString = htmlString.replaceAll("title", "titlexx");
+
                         Document doc = Jsoup.parse(htmlString);
-                        Elements ppName = doc.select("el-input[placeholder~=工程部位.*]");
+                        Elements ppName = doc.select("el-input[placeholderxx~=工程部位.*]");
                         //工程部位
                         if (ppName.size() >= 1) {
                             for (Element element : ppName) {

+ 22 - 5
blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TrialMaterialMobilizationServiceImpl.java

@@ -36,10 +36,11 @@ import org.springblade.core.oss.model.BladeFile;
 import org.springblade.core.secure.utils.SecureUtil;
 import org.springblade.core.tool.api.R;
 import org.springblade.core.tool.utils.*;
-import org.springblade.manager.vo.ImportContractNodeVO;
+import org.springblade.resource.entity.Attach;
 import org.springblade.resource.feign.NewIOSSClient;
 import org.springblade.system.entity.Dict;
 import org.springblade.system.feign.IDictClient;
+import org.springblade.system.feign.ISysClient;
 import org.springblade.system.user.entity.User;
 import org.springblade.system.user.feign.IUserClient;
 import org.springframework.jdbc.core.BeanPropertyRowMapper;
@@ -48,11 +49,8 @@ import org.springframework.stereotype.Service;
 
 import javax.servlet.http.HttpServletResponse;
 import java.io.*;
-import java.math.BigDecimal;
-import java.text.DateFormat;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
 import java.util.*;
+import java.util.function.Function;
 import java.util.stream.Collectors;
 
 @Service
@@ -138,6 +136,7 @@ public class TrialMaterialMobilizationServiceImpl extends BaseServiceImpl<TrialM
 
         IPage<TrialMaterialMobilizationVO> trialMaterialMobilizationVOIPage = TrialMaterialMobilizationWarpper.build().pageVO(pages);
         List<TrialMaterialMobilizationVO> records = trialMaterialMobilizationVOIPage.getRecords();
+        Map<String, Attach> fileMaps = jdbcTemplate.query("select link,original_name from blade_attach", new BeanPropertyRowMapper<>(Attach.class)).stream().collect(Collectors.toMap(Attach::getLink, Function.identity()));
         for (TrialMaterialMobilizationVO record : records) {
             for (User user : userList) {
                 if (user.getId().equals(record.getUserId())) {
@@ -145,6 +144,24 @@ public class TrialMaterialMobilizationServiceImpl extends BaseServiceImpl<TrialM
                     break;
                 }
             }
+            if (StringUtils.isNotEmpty(record.getOtherAccessories())) {
+                Attach attach = fileMaps.get(record.getOtherAccessories());
+                if (attach != null) {
+                    record.setOtherAccessoriesName(StringUtils.isNotEmpty(attach.getOriginalName()) ? attach.getOriginalName() : "");
+                }
+            }
+            if (StringUtils.isNotEmpty(record.getProductionCertificate())) {
+                Attach attach = fileMaps.get(record.getProductionCertificate());
+                if (attach != null) {
+                    record.setProductionCertificateName(StringUtils.isNotEmpty(attach.getOriginalName()) ? attach.getOriginalName() : "");
+                }
+            }
+            if (StringUtils.isNotEmpty(record.getQualityInspectionReport())) {
+                Attach attach = fileMaps.get(record.getQualityInspectionReport());
+                if (attach != null) {
+                    record.setQualityInspectionReportName(StringUtils.isNotEmpty(attach.getOriginalName()) ? attach.getOriginalName() : "");
+                }
+            }
         }
         return trialMaterialMobilizationVOIPage.setRecords(records);
     }

+ 18 - 17
blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TrialSelfInspectionRecordServiceImpl.java

@@ -251,7 +251,7 @@ public class TrialSelfInspectionRecordServiceImpl extends BaseServiceImpl<TrialS
                 //文件名
                 vo.setFileName(ObjectUtil.isNotEmpty(att.getOriginalName()) ? att.getOriginalName() : "没有找到对应的上传文件名称");
             }
-            if (ObjectUtil.isEmpty(vo.getFileName())) {
+            if (ObjectUtil.isEmpty(vo.getFileName()) && ObjectUtils.isNotEmpty(vo.getUrl())) {
                 String name = vo.getUrl().split("//upload/")[1].split("/")[1];
                 vo.setFileName(name);
             }
@@ -284,7 +284,9 @@ public class TrialSelfInspectionRecordServiceImpl extends BaseServiceImpl<TrialS
                         obj.setUrl(trialMaterialMobilization.getOtherAccessories());
                     }
                     obj.setIsDel(0); //关联的取样文件不能删除
-                    result.add(obj);
+                    if (ObjectUtils.isNotEmpty(obj.getUrl())) {
+                        result.add(obj);
+                    }
                 }
             }
         }
@@ -927,9 +929,11 @@ public class TrialSelfInspectionRecordServiceImpl extends BaseServiceImpl<TrialS
 
     public void reBuildNumber(TrialSelfInspectionRecord obj, TrialSelfInspectionRecordDTO dto) {
         if (StringUtils.isEmpty(obj.getRecordNo()) && (dto.getTableType().contains("1") || dto.getTableType().contains("9"))) {
+            BeanUtil.copyProperties(obj, dto);
             this.buildNumber(dto);
             this.saveOrUpdate(dto);
         } else if (StringUtils.isEmpty(obj.getReportNo()) && (dto.getTableType().contains("2") || dto.getTableType().contains("10"))) {
+            BeanUtil.copyProperties(obj, dto);
             this.buildNumber(dto);
             this.saveOrUpdate(dto);
         }
@@ -1100,12 +1104,11 @@ public class TrialSelfInspectionRecordServiceImpl extends BaseServiceImpl<TrialS
                 }
             }
 
-            List<WbsTreePrivate> wbsTreePrivates = wbsTreePrivateClient.queryByPKeyIds(Func.toStrList(String.valueOf(dto.getNodeId())));
-            WbsTreePrivate wbsTreePrivate = wbsTreePrivates.stream().findAny().orElse(null);
+            WbsTreePrivate wbsTreePrivate = wbsTreePrivateClient.queryByPKeyIds(Func.toStrList(String.valueOf(dto.getNodeId()))).stream().findAny().orElse(null);
             ContractInfo contract = contractClient.getContractById(dto.getContractId());
             int year = LocalDateTimeUtil.now().getYear();
-            if (wbsTreePrivate == null) {
-                throw new ServiceException("未找到当前节点信息,操作失败!");
+            if (wbsTreePrivate == null || contract == null) {
+                throw new ServiceException("未找到当前项目合同段的节点信息,操作失败!");
             } else {
                 //记录表
                 if (StringUtils.isNotEmpty(maxRecordNo)) {
@@ -1130,7 +1133,7 @@ public class TrialSelfInspectionRecordServiceImpl extends BaseServiceImpl<TrialS
         }
 
         //记录表
-        if (("1").equals(dto.getTableType()) || ("9").equals(dto.getTableType())) {
+        else if (("1").equals(dto.getTableType()) || ("9").equals(dto.getTableType())) {
             if (StringUtils.isEmpty(dto.getRecordNo())) {
                 //获取记录表最大编号
                 List<String> recordNos = trialSelfInspectionRecords.stream().map(TrialSelfInspectionRecord::getRecordNo).filter(ObjectUtils::isNotEmpty).collect(Collectors.toList());
@@ -1151,13 +1154,12 @@ public class TrialSelfInspectionRecordServiceImpl extends BaseServiceImpl<TrialS
                     }
                 }
 
-                List<WbsTreePrivate> wbsTreePrivates = wbsTreePrivateClient.queryByPKeyIds(Func.toStrList(String.valueOf(dto.getNodeId())));
-                WbsTreePrivate wbsTreePrivate = wbsTreePrivates.stream().findAny().orElse(null);
+                WbsTreePrivate wbsTreePrivate = wbsTreePrivateClient.queryByPKeyIds(Func.toStrList(String.valueOf(dto.getNodeId()))).stream().findAny().orElse(null);
                 ContractInfo contract = contractClient.getContractById(dto.getContractId());
                 int year = LocalDateTimeUtil.now().getYear();
-                if (wbsTreePrivate == null) {
-                    throw new ServiceException("未找到当前节点信息,操作失败!");
-                } else {
+                if (wbsTreePrivate == null || contract == null) {
+                    throw new ServiceException("未找到当前项目合同段的节点信息,操作失败!");
+                }  else {
                     //记录表
                     String str1 = "JL" +
                             "-" + contract.getContractNumber() +
@@ -1170,7 +1172,7 @@ public class TrialSelfInspectionRecordServiceImpl extends BaseServiceImpl<TrialS
         }
 
         //报告单
-        if (("2").equals(dto.getTableType()) || ("10").equals(dto.getTableType())) {
+        else if (("2").equals(dto.getTableType()) || ("10").equals(dto.getTableType())) {
             if (StringUtils.isEmpty(dto.getReportNo())) {
                 //获取报告单最大编号
                 List<String> reportNos = trialSelfInspectionRecords.stream().map(TrialSelfInspectionRecord::getReportNo).filter(ObjectUtils::isNotEmpty).collect(Collectors.toList());
@@ -1191,12 +1193,11 @@ public class TrialSelfInspectionRecordServiceImpl extends BaseServiceImpl<TrialS
                     }
                 }
 
-                List<WbsTreePrivate> wbsTreePrivates = wbsTreePrivateClient.queryByPKeyIds(Func.toStrList(String.valueOf(dto.getNodeId())));
-                WbsTreePrivate wbsTreePrivate = wbsTreePrivates.stream().findAny().orElse(null);
+                WbsTreePrivate wbsTreePrivate = wbsTreePrivateClient.queryByPKeyIds(Func.toStrList(String.valueOf(dto.getNodeId()))).stream().findAny().orElse(null);
                 ContractInfo contract = contractClient.getContractById(dto.getContractId());
                 int year = LocalDateTimeUtil.now().getYear();
-                if (wbsTreePrivate == null) {
-                    throw new ServiceException("未找到当前节点信息,操作失败!");
+                if (wbsTreePrivate == null || contract == null) {
+                    throw new ServiceException("未找到当前项目合同段的节点信息,操作失败!");
                 } else {
                     //报告单
                     String str2 = "BG" +

+ 12 - 8
blade-service/blade-manager/src/main/java/org/springblade/manager/controller/WbsTreeController.java

@@ -214,15 +214,19 @@ public class WbsTreeController extends BladeController {
                     }
 
                     //删除对应到项目合同段的表
-                    List<Long> projectPKeyIds = wbsTreePrivateMapper.selectList(Wrappers.<WbsTreePrivate>query().lambda()
-                            .select(WbsTreePrivate::getPKeyId).eq(WbsTreePrivate::getStatus, 1).eq(WbsTreePrivate::getType, 2).eq(WbsTreePrivate::getId, id)).stream().map(WbsTreePrivate::getPKeyId).collect(Collectors.toList());
-                    List<Long> contractPKeyIds = wbsTreeContractMapper.selectList(Wrappers.<WbsTreeContract>query().lambda()
-                            .select(WbsTreeContract::getPKeyId).eq(WbsTreeContract::getStatus, 1).eq(WbsTreeContract::getType, 2).and(obj -> obj.eq(WbsTreeContract::getId, id).or().eq(WbsTreeContract::getOldId, id))).stream().map(WbsTreeContract::getPKeyId).collect(Collectors.toList());
-                    if (projectPKeyIds.size()>0){
-                        jdbcTemplate.execute("update m_wbs_tree_private set is_deleted = 1 where p_key_id in(" + StringUtils.join(projectPKeyIds, ",") + ")");
+                    List<String> projectPKeyIds = wbsTreePrivateMapper.selectList(Wrappers.<WbsTreePrivate>query().lambda()
+                            .select(WbsTreePrivate::getPKeyId).eq(WbsTreePrivate::getStatus, 1).eq(WbsTreePrivate::getType, 2).eq(WbsTreePrivate::getId, id)).stream().map(WbsTreePrivate::getPKeyId).map(String::valueOf).collect(Collectors.toList());
+                    List<String> contractPKeyIds = wbsTreeContractMapper.selectList(Wrappers.<WbsTreeContract>query().lambda()
+                            .select(WbsTreeContract::getPKeyId).eq(WbsTreeContract::getStatus, 1).eq(WbsTreeContract::getType, 2).and(obj -> obj.eq(WbsTreeContract::getId, id).or().eq(WbsTreeContract::getOldId, id))).stream().map(WbsTreeContract::getPKeyId).map(String::valueOf).collect(Collectors.toList());
+                    if (projectPKeyIds.size() > 0) {
+                        String join = StringUtils.join(projectPKeyIds, ",");
+                        String sql = "update m_wbs_tree_private set is_deleted = 1 where p_key_id in(" + join + ")";
+                        jdbcTemplate.execute(sql);
                     }
-                    if (contractPKeyIds.size()>0){
-                        jdbcTemplate.execute("update m_wbs_tree_contract set is_deleted = 1 where p_key_id in(" + StringUtils.join(contractPKeyIds, ",") + ")");
+                    if (contractPKeyIds.size() > 0) {
+                        String join = StringUtils.join(contractPKeyIds, ",");
+                        String sql = "update m_wbs_tree_contract set is_deleted = 1 where p_key_id in(" + join + ")";
+                        jdbcTemplate.execute(sql);
                     }
 
                     return R.success("删除成功");

+ 4 - 2
blade-service/blade-manager/src/main/java/org/springblade/manager/feign/WbsTreePrivateClientImpl.java

@@ -148,8 +148,10 @@ public class WbsTreePrivateClientImpl implements WbsTreePrivateClient {
                     newFiles.add(obj);
                 }
             }
-            boolean result = tableFileClient.saveBatch(newFiles);
-            if (result) {
+            if (newFiles.size() > 0) {
+                tableFileClient.saveBatch(newFiles);
+            }
+            if (ObjectUtils.isNotEmpty(wbsTreePrivate)) {
                 wbsTreePrivateService.save(wbsTreePrivate);
                 return true;
             }

+ 162 - 147
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/ExcelTabServiceImpl.java

@@ -1556,7 +1556,6 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
         //输出流
 
 
-
         FileOutputStream outputStream = new FileOutputStream(excelPath);
         workbook.write(outputStream);
         FileUtils.setExcelScaleToPdf(excelPath, pdfPath);
@@ -1775,29 +1774,28 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
         String querySql = "select * from " + wbsTreePrivate.getInitTableName() + " where p_key_id=" + pkeyId + " and group_id = " + groupId;
         List<Map<String, Object>> dataIn = jdbcTemplate.queryForList(querySql);
 
-        // 匹配关联
+        //匹配关联
         try {
-            /*File file1 = ResourceUtil.getFile(wbsTreePrivate.getHtmlUrl());*/
             String fileUrl = wbsTreePrivate.getHtmlUrl();
             File file1 = ResourceUtil.getFile(fileUrl);
-            InputStream fileInputStream = null;
+            InputStream fileInputStream;
             if (file1.exists()) {
                 fileInputStream = new FileInputStream(file1);
             } else {
                 String path = sys_file_net_url + fileUrl.replaceAll("//", "/").replaceAll(file_path, "");
                 fileInputStream = CommonUtil.getOSSInputStream(path);
             }
-
             String htmlString = IoUtil.readToString(fileInputStream);
-
+            htmlString = htmlString.replaceAll("placeholder", "placeholderxx");
+            htmlString = htmlString.replaceAll("title", "titlexx");
             Document doc = Jsoup.parse(htmlString);
             //匹配
-            Elements bgHB = doc.select("el-input[placeholder~=报告编号.*]");
-            Elements jlBH = doc.select("el-input[placeholder~=记录编号.*]");
-            Elements gcName = doc.select("el-input[placeholder~=工程名称.*]");
-            Elements sgName = doc.select("el-input[placeholder~=施工单位.*]");
-            Elements wtName = doc.select("el-input[placeholder~=委托单位.*]");
-            Elements htdName = doc.select("el-input[placeholder~=合同段/工区.*]");
+            Elements bgHB = doc.select("el-input[placeholderxx~=报告编号.*]");
+            Elements jlBH = doc.select("el-input[placeholderxx~=记录编号.*]");
+            Elements gcName = doc.select("el-input[placeholderxx~=工程名称.*]");
+            Elements sgName = doc.select("el-input[placeholderxx~=施工单位.*]");
+            Elements wtName = doc.select("el-input[placeholderxx~=委托单位.*]");
+            Elements htdName = doc.select("el-input[placeholderxx~=合同段/工区.*]");
 
             ContractInfo contractInfo = jdbcTemplate.query("select construction_unit_name,supervision_unit_name,contract_name from m_contract_info where id = " + contractId, new BeanPropertyRowMapper<>(ContractInfo.class)).stream().findAny().orElse(null);
             if (contractInfo != null) {
@@ -1879,9 +1877,9 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
                             if (StringUtils.isNotEmpty(tabData[0])) {
                                 reData.put(key + "__" + tabData[1], sql);
                             }
-                        } else if (tabVal.contains("T") && tabVal.contains(".000Z")) { //时间
+                        } else if (tabVal.indexOf("T") >= 0 && tabVal.indexOf(".000Z") >= 0) {//时间
                             // 时间和字符串合作
-                            if (tabVal.contains("☆")) {
+                            if (tabVal.indexOf("☆") >= 0) {
                                 String[] mysql = tabVal.split("☆");
                                 for (String data : mysql) {
                                     String[] tabData = data.split("_\\^_");
@@ -1895,7 +1893,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
                                     reData.put(key + "__" + tabData[1], tabData[0]);
                                 }
                             }
-                        } else if (tabVal.contains("☆")) {
+                        } else if (tabVal.indexOf("☆") >= 0) {
                             String[] mysql = tabVal.split("☆");
                             for (String data : mysql) {
                                 String[] tabData = data.split("_\\^_");
@@ -1903,10 +1901,15 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
                                     reData.put(key + "__" + tabData[1], tabData[0]);
                                 }
                             }
-                        } else if (tabVal.contains("_^_")) {
+                        } else if (tabVal.indexOf("_^_") >= 0) {
                             String[] tabData = tabVal.split("_\\^_");
                             if (StringUtils.isNotEmpty(tabData[0])) {
-                                reData.put(key + "__" + tabData[1], tabData[0]);
+                                if (tabVal.contains("[") && tabVal.contains("年")) {
+                                    String[] strings = StringUtils.strip(tabData[0], "[]").split(",");
+                                    reData.put(key + "__" + tabData[1], strings);
+                                } else {
+                                    reData.put(key + "__" + tabData[1], tabData[0]);
+                                }
                             }
                         } else {
                             reData.put(key, tabVal);
@@ -2106,6 +2109,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
     @Override
     public String getBussPDFTrial(Long pkeyId, String contractId, Long id, int pageNumber, int pageNumberCount, TrialSelfInspectionRecordDTO dto) throws Exception {
         String file_path = ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
+        String sys_file_net_url = ParamCache.getValue(CommonConstant.SYS_FILE_NET_URL);
         WbsTreePrivate wbsTreePrivate = wbsTreePrivateService.getBaseMapper().selectOne(Wrappers.<WbsTreePrivate>query().lambda()
                 .eq(WbsTreePrivate::getPKeyId, pkeyId));
         if (wbsTreePrivate == null) {
@@ -2136,10 +2140,12 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
             DataInfo.putAll(bussDataInfoTrial.stream().findAny().orElse(null));
         }
 
+        //获取清表excel文件
         org.apache.poi.ss.usermodel.Workbook workbook = WorkbookFactory.create(Objects.requireNonNull(CommonUtil.getOSSInputStreamTow(excelTab.getFileUrl())));
         Sheet sheet = workbook.getSheetAt(0);
         sheet.setForceFormulaRecalculation(true);
         Header header = sheet.getHeader();
+
         //页眉
         if (pageNumber != 0 && pageNumberCount != 0) {
             header.setRight("第" + pageNumber + "页,共" + pageNumberCount + "页");
@@ -2179,143 +2185,151 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
             }
         }
 
-        //数据不为空
-        if (StringUtils.isNotEmpty(wbsTreePrivate.getHtmlUrl())) {
-            File htmlFile = ResourceUtil.getFile(wbsTreePrivate.getHtmlUrl());
-            if (htmlFile.exists()) {
-                String htmlString = IoUtil.readToString(new FileInputStream(htmlFile));
-                Document doc = Jsoup.parse(htmlString);
-                Element table = doc.select("table").first();
-                Elements trs = table.select("tr");
+        //数据不为空,构造数据
+        String fileUrl = wbsTreePrivate.getHtmlUrl();
+        File file1 = ResourceUtil.getFile(fileUrl);
+        InputStream fileInputStream;
+        if (file1.exists()) {
+            fileInputStream = new FileInputStream(file1);
+        } else {
+            String path = sys_file_net_url + fileUrl.replaceAll("//", "/").replaceAll(file_path, "");
+            fileInputStream = CommonUtil.getOSSInputStream(path);
+        }
 
-                Elements bgHB = doc.select("el-input[placeholder~=报告编号.*]");
-                Elements jlBH = doc.select("el-input[placeholder~=记录编号.*]");
-                if (dto != null) {
-                    //报告编号
-                    if (bgHB.size() >= 1 && StringUtils.isNotEmpty(dto.getReportNo())) {
-                        for (Element element : bgHB) {
-                            DataInfo.put(element.attr("keyname"), "NUMBER-" + dto.getReportNo());
-                            break;
-                        }
-                    }
-                    //记录编号
-                    if (jlBH.size() >= 1 && StringUtils.isNotEmpty(dto.getRecordNo())) {
-                        for (Element element : jlBH) {
-                            DataInfo.put(element.attr("keyname"), "NUMBER-" + dto.getRecordNo());
-                            break;
-                        }
-                    }
+        String htmlString = IoUtil.readToString(fileInputStream);
+        htmlString = htmlString.replaceAll("placeholder", "placeholderxx");
+        htmlString = htmlString.replaceAll("title", "titlexx");
+
+        Document doc = Jsoup.parse(htmlString);
+        Element table = doc.select("table").first();
+        Elements trs = table.select("tr");
+
+        Elements bgHB = doc.select("el-input[placeholderxx~=报告编号.*]");
+        Elements jlBH = doc.select("el-input[placeholderxx~=记录编号.*]");
+        if (dto != null) {
+            //报告编号
+            if (bgHB.size() >= 1 && StringUtils.isNotEmpty(dto.getReportNo())) {
+                for (Element element : bgHB) {
+                    DataInfo.put(element.attr("keyname"), "NUMBER-" + dto.getReportNo());
+                    break;
+                }
+            }
+            //记录编号
+            if (jlBH.size() >= 1 && StringUtils.isNotEmpty(dto.getRecordNo())) {
+                for (Element element : jlBH) {
+                    DataInfo.put(element.attr("keyname"), "NUMBER-" + dto.getRecordNo());
+                    break;
                 }
+            }
+        }
 
-                if (ObjectUtil.isNotEmpty(DataInfo)) {
-                    for (String val : Objects.requireNonNull(DataInfo).keySet()) {
-                        if (val.contains("__")) {
-                            String[] DataVal = val.split("__");
-                            String[] xy = DataVal[1].split("_");
-                            if (Integer.parseInt(xy[0]) < trs.size()) {
-                                Element ytzData = trs.get(Integer.parseInt(xy[0]));
-                                if (ytzData != null) {
-                                    Elements tdsx = ytzData.select("td");
-                                    if (Integer.parseInt(xy[1]) < tdsx.size()) {
-                                        Element data = ytzData.select("td").get(Integer.parseInt(xy[1]));
-                                        if (data != null) {
-                                            if (data.html().contains("x1") && data.html().contains("y1")) {
-                                                int x1 = 0;
-                                                int x2 = 0;
-                                                int y1 = 0;
-                                                int y2 = 0;
-                                                if (data.html().contains("el-tooltip")) {
-                                                    x1 = Integer.parseInt(data.children().get(0).children().get(0).attr("x1"));
-                                                    x2 = Integer.parseInt(data.children().get(0).children().get(0).attr("x2"));
-                                                    y1 = Integer.parseInt(data.children().get(0).children().get(0).attr("y1"));
+        if (ObjectUtil.isNotEmpty(DataInfo)) {
+            for (String val : Objects.requireNonNull(DataInfo).keySet()) {
+                if (val.contains("__")) {
+                    String[] DataVal = val.split("__");
+                    String[] xy = DataVal[1].split("_");
+                    if (Integer.parseInt(xy[0]) < trs.size()) {
+                        Element ytzData = trs.get(Integer.parseInt(xy[0]));
+                        if (ytzData != null) {
+                            Elements tdsx = ytzData.select("td");
+                            if (Integer.parseInt(xy[1]) < tdsx.size()) {
+                                Element data = ytzData.select("td").get(Integer.parseInt(xy[1]));
+                                if (data != null) {
+                                    if (data.html().contains("x1") && data.html().contains("y1")) {
+                                        int x1 = 0;
+                                        int x2 = 0;
+                                        int y1 = 0;
+                                        int y2 = 0;
+                                        if (data.html().contains("el-tooltip")) {
+                                            x1 = Integer.parseInt(data.children().get(0).children().get(0).attr("x1"));
+                                            x2 = Integer.parseInt(data.children().get(0).children().get(0).attr("x2"));
+                                            y1 = Integer.parseInt(data.children().get(0).children().get(0).attr("y1"));
+                                        } else {
+                                            x1 = Integer.parseInt(data.children().get(0).attr("x1"));
+                                            y1 = Integer.parseInt(data.children().get(0).attr("y1"));
+                                        }
+                                        if (x1 == 0) {
+                                            x1 = 1;
+                                        }
+                                        String myData = DataInfo.get(val) + "";
+                                        if (myData.contains("T") && myData.contains("-") && myData.contains(":")) {
+                                            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
+                                            sdf.setTimeZone(TimeZone.getTimeZone("GTM+8"));
+                                            SimpleDateFormat formatStr = new SimpleDateFormat("yyyy年MM月dd日");
+                                            if (myData.contains(",") && myData.contains("]")) {
+
+                                                myData = myData.replace("[", "").replace("]", "").replaceAll("'", "");
+                                                String[] dataVal = myData.split(",");
+
+                                                Date Start_dataStr = sdf.parse(dataVal[0]);
+                                                Date end_dataStr = sdf.parse(dataVal[1]);
+                                                String StartDate = formatStr.format(Start_dataStr);
+                                                String endDate = formatStr.format(end_dataStr);
+                                                if (StartDate.equals(endDate)) {
+                                                    myData = StartDate;
                                                 } else {
-                                                    x1 = Integer.parseInt(data.children().get(0).attr("x1"));
-                                                    y1 = Integer.parseInt(data.children().get(0).attr("y1"));
+                                                    myData = StartDate + "-" + endDate;
                                                 }
-                                                if (x1 == 0) {
-                                                    x1 = 1;
+                                            } else {
+                                                String[] dataStr = myData.split("T")[0].split("-");
+                                                myData = StringUtil.format("{}年{}月{}日", dataStr[0], dataStr[1], Integer.parseInt(dataStr[2]));
+                                            }
+                                        }
+                                        //https:bladex-test-info.oss-cn-chengdu.aliyuncs.com//upload/20220819/b53cb6700db369381e3b03d7737bcdec.jpg__16_1
+                                        if (myData.contains("https") && myData.contains("aliyuncs")) {
+                                            InputStream imageIn = CommonUtil.getOSSInputStream(myData);
+                                            byte[] bytes = IOUtils.toByteArray(imageIn);
+                                            // 这里根据实际需求选择图片类型
+                                            int pictureIdx = workbook.addPicture(bytes, 6);
+
+                                            CreationHelper helper = workbook.getCreationHelper();
+                                            ClientAnchor anchor = helper.createClientAnchor();
+                                            anchor.setCol1(x1); // param1是列号
+                                            anchor.setCol2(x2);
+                                            anchor.setRow1(y1); // param2是行号
+                                            anchor.setRow2(y2); // param2是行号
+                                            //
+                                            Drawing<?> drawing = sheet.createDrawingPatriarch();
+                                            anchor.setAnchorType(ClientAnchor.AnchorType.MOVE_AND_RESIZE);
+                                            // 插入图片
+                                            Picture pict = drawing.createPicture(anchor, pictureIdx); // 调整图片占单元格百分比的大小,1.0就是100%
+                                            pict.resize(1, 1);
+                                            FileUtils.imageOrientation(sheet, anchor, new DataVO(x1 - 1, y1 - 1));
+
+                                        } else if (myData.equals("1") && data.html().contains("hc-form-checkbox-group")) {
+                                            Row row = sheet.getRow(y1 - 1);
+                                            if (row != null) {
+                                                Cell cell = row.getCell(x1 - 1);
+                                                if (cell != null) {
+                                                    String exceVal = cell.getStringCellValue().replaceAll(" ", "");
+                                                    short fontIndex = cell.getCellStyle().getFontIndex();
+                                                    Font fontAt = workbook.getFontAt(fontIndex);
+                                                    fontAt.setFontName("EUDC");
+                                                    cell.setCellValue(exceVal.replace("□", "\u2611"));
+                                                } else {
+                                                    ObjectUtils.isNotEmpty(cell);
                                                 }
-                                                String myData = DataInfo.get(val) + "";
-                                                if (myData.contains("T") && myData.contains("-") && myData.contains(":")) {
-                                                    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
-                                                    sdf.setTimeZone(TimeZone.getTimeZone("GTM+8"));
-                                                    SimpleDateFormat formatStr = new SimpleDateFormat("yyyy年MM月dd日");
-                                                    if (myData.contains(",") && myData.contains("]")) {
-
-                                                        myData = myData.replace("[", "").replace("]", "").replaceAll("'", "");
-                                                        String[] dataVal = myData.split(",");
-
-                                                        Date Start_dataStr = sdf.parse(dataVal[0]);
-                                                        Date end_dataStr = sdf.parse(dataVal[1]);
-                                                        String StartDate = formatStr.format(Start_dataStr);
-                                                        String endDate = formatStr.format(end_dataStr);
-                                                        if (StartDate.equals(endDate)) {
-                                                            myData = StartDate;
-                                                        } else {
-                                                            myData = StartDate + "-" + endDate;
-                                                        }
-                                                    } else {
-                                                        String[] dataStr = myData.split("T")[0].split("-");
-                                                        myData = StringUtil.format("{}年{}月{}日", dataStr[0], dataStr[1], Integer.parseInt(dataStr[2]));
-                                                    }
+                                            }
+                                        } else if (myData.contains("NUMBER-JL-") || myData.contains("NUMBER-BG-")) {
+                                            //记录表号、报告单号
+                                            Row row = sheet.getRow(y1 - 1);
+                                            if (row != null) {
+                                                Cell cell = row.getCell(x1 - 1);
+                                                if (cell != null) {
+                                                    String replace = myData.replace("NUMBER-", "");
+                                                    cell.setCellValue(replace);
+                                                } else {
+                                                    ObjectUtils.isNotEmpty(cell);
                                                 }
-                                                //https:bladex-test-info.oss-cn-chengdu.aliyuncs.com//upload/20220819/b53cb6700db369381e3b03d7737bcdec.jpg__16_1
-                                                if (myData.contains("https") && myData.contains("aliyuncs")) {
-                                                    InputStream imageIn = CommonUtil.getOSSInputStream(myData);
-                                                    byte[] bytes = IOUtils.toByteArray(imageIn);
-                                                    // 这里根据实际需求选择图片类型
-                                                    int pictureIdx = workbook.addPicture(bytes, 6);
-
-                                                    CreationHelper helper = workbook.getCreationHelper();
-                                                    ClientAnchor anchor = helper.createClientAnchor();
-                                                    anchor.setCol1(x1); // param1是列号
-                                                    anchor.setCol2(x2);
-                                                    anchor.setRow1(y1); // param2是行号
-                                                    anchor.setRow2(y2); // param2是行号
-                                                    //
-                                                    Drawing<?> drawing = sheet.createDrawingPatriarch();
-                                                    anchor.setAnchorType(ClientAnchor.AnchorType.MOVE_AND_RESIZE);
-                                                    // 插入图片
-                                                    Picture pict = drawing.createPicture(anchor, pictureIdx); // 调整图片占单元格百分比的大小,1.0就是100%
-                                                    pict.resize(1, 1);
-                                                    FileUtils.imageOrientation(sheet, anchor, new DataVO(x1 - 1, y1 - 1));
-
-                                                } else if (myData.equals("1") && data.html().contains("hc-form-checkbox-group")) {
-                                                    Row row = sheet.getRow(y1 - 1);
-                                                    if (row != null) {
-                                                        Cell cell = row.getCell(x1 - 1);
-                                                        if (cell != null) {
-                                                            String exceVal = cell.getStringCellValue().replaceAll(" ", "");
-                                                            short fontIndex = cell.getCellStyle().getFontIndex();
-                                                            Font fontAt = workbook.getFontAt(fontIndex);
-                                                            fontAt.setFontName("EUDC");
-                                                            cell.setCellValue(exceVal.replace("□", "\u2611"));
-                                                        } else {
-                                                            ObjectUtils.isNotEmpty(cell);
-                                                        }
-                                                    }
-                                                } else if (myData.contains("NUMBER-JL-") || myData.contains("NUMBER-BG-")) {
-                                                    //记录表号、报告单号
-                                                    Row row = sheet.getRow(y1 - 1);
-                                                    if (row != null) {
-                                                        Cell cell = row.getCell(x1 - 1);
-                                                        if (cell != null) {
-                                                            String replace = myData.replace("NUMBER-", "");
-                                                            cell.setCellValue(replace);
-                                                        } else {
-                                                            ObjectUtils.isNotEmpty(cell);
-                                                        }
-                                                    }
+                                            }
+                                        } else {
+                                            Row row = sheet.getRow(y1 - 1);
+                                            if (row != null) {
+                                                Cell cell = row.getCell(x1 - 1);
+                                                if (cell != null) {
+                                                    cell.setCellValue(myData);
                                                 } else {
-                                                    Row row = sheet.getRow(y1 - 1);
-                                                    if (row != null) {
-                                                        Cell cell = row.getCell(x1 - 1);
-                                                        if (cell != null) {
-                                                            cell.setCellValue(myData);
-                                                        } else {
-                                                            ObjectUtils.isNotEmpty(cell);
-                                                        }
-                                                    }
+                                                    ObjectUtils.isNotEmpty(cell);
                                                 }
                                             }
                                         }
@@ -2326,6 +2340,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
                     }
                 }
 
+
                 // 组装电签设置
                 QueryWrapper<TextdictInfo> queryWrapper = new QueryWrapper<>();
                 queryWrapper.select("col_key", "id");
@@ -2491,7 +2506,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
                     //没有excel表单的不生成pdf
                     if (StringUtils.isNotEmpty(record.getHtmlUrl())) {
                         //生成记录表pdf
-                        String bussPdfInfo = this.getBussPDFTrial(record.getPKeyId(), contractId, id, recordPageNumber++, recordPageNumberCount, null);
+                        String bussPdfInfo = this.getBussPDFTrial(record.getPKeyId(), contractId, id, recordPageNumber++, recordPageNumberCount, dto);
                         if (StringUtils.isNotEmpty(bussPdfInfo)) {
                             dataPdfUrls.add(bussPdfInfo);
                         }

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

@@ -1918,7 +1918,7 @@ public class WbsTreePrivateServiceImpl extends BaseServiceImpl<WbsTreePrivateMap
 
         String fileUrl = wbsTreePrivate.getHtmlUrl();
         File file1 = ResourceUtil.getFile(fileUrl);
-        InputStream fileInputStream = null;
+        InputStream fileInputStream;
         if (file1.exists()) {
             fileInputStream = new FileInputStream(file1);
         } else {
@@ -1990,7 +1990,9 @@ public class WbsTreePrivateServiceImpl extends BaseServiceImpl<WbsTreePrivateMap
             }
         }
         doc.select("Col").remove();
-        fileInputStream.close();
+        if (fileInputStream != null) {
+            fileInputStream.close();
+        }
         return R.data(table + "");
     }