diff --git a/README.md b/README.md index 0a98ecf..38a3aa7 100644 --- a/README.md +++ b/README.md @@ -72,4 +72,7 @@ ADD COLUMN `sample_model` varchar(2048) NULL COMMENT '样品型号' ; ```sql ALTER TABLE `physical-boot`.`experiment_report` ADD COLUMN `last_status` varchar(32) NULL COMMENT '上一个状态' AFTER `confirmer`; + +ALTER TABLE `physical-boot`.`experiment_report` + ADD COLUMN `file_url` text NULL COMMENT '生成的文件路径' AFTER `sample_info`; ``` \ No newline at end of file diff --git a/physical-launcher/src/main/resources/application-dev.yml b/physical-launcher/src/main/resources/application-dev.yml index ada68d4..6c658d5 100644 --- a/physical-launcher/src/main/resources/application-dev.yml +++ b/physical-launcher/src/main/resources/application-dev.yml @@ -243,7 +243,7 @@ jeecg: minio_url: http://47.102.126.67:29000 minio_public_url: http://47.102.126.67/oss/ minio_name: root - minio_pass: 12345678 + minio_pass: FeF4qA6uQBHeRd bucketName: physical #分布式锁配置 redisson: diff --git a/physical-module-system/physical-system-biz/src/main/java/org/jeecg/modules/database/controller/ExperimentReportController.java b/physical-module-system/physical-system-biz/src/main/java/org/jeecg/modules/database/controller/ExperimentReportController.java index a26d59f..3e96e24 100644 --- a/physical-module-system/physical-system-biz/src/main/java/org/jeecg/modules/database/controller/ExperimentReportController.java +++ b/physical-module-system/physical-system-biz/src/main/java/org/jeecg/modules/database/controller/ExperimentReportController.java @@ -2,6 +2,7 @@ package org.jeecg.modules.database.controller; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.util.ObjUtil; +import com.alibaba.fastjson.JSON; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; @@ -30,6 +31,7 @@ import org.springframework.web.bind.annotation.*; import org.springframework.web.servlet.ModelAndView; import java.util.*; +import java.util.stream.Collectors; /** * @Description: 试验报告 @@ -81,10 +83,10 @@ public class ExperimentReportController extends JeecgController page = new Page<>(pageNo, pageSize); IPage pageList = experimentReportService.join(page, experimentReport, queryWrapper); - pageList.getRecords().forEach(v -> { - ExperimentDoc experimentDoc = experimentDocService.getByExperimentId(v.getExperimentId(), ExperimentDocType.sybg.getType()); - v.setFileUrl(Optional.ofNullable(experimentDoc).map(ExperimentDoc::getFilePath).orElse(null)); - }); + //pageList.getRecords().forEach(v -> { + // ExperimentDoc experimentDoc = experimentDocService.getByExperimentId(v.getExperimentId(), ExperimentDocType.sybg.getType()); + // v.setFileUrl(Optional.ofNullable(experimentDoc).map(ExperimentDoc::getFilePath).orElse(null)); + //}); return Result.OK(pageList); } @@ -114,7 +116,17 @@ public class ExperimentReportController extends JeecgController sampleList = JSON.parseArray(sampleInfo, Map.class); + String modelBatch = sampleList.stream().map(v -> String.valueOf(v.getOrDefault("modelBatch", ""))).collect( + Collectors.joining("-")); + String sampleName = sampleList.stream().map(v -> String.valueOf(v.getOrDefault("sampleName", ""))).collect( + Collectors.joining("-")); + fileName = sampleName + "-" + modelBatch; + } + experimentReport.setReportName("试验报告-" + fileName); experimentReportService.save(experimentReport); return Result.OK("添加成功!"); } @@ -192,9 +204,9 @@ public class ExperimentReportController extends JeecgController { - ExperimentDoc experimentDoc = experimentDocService.getByExperimentId(experimentId, ExperimentDocType.sybg.getType()); - v.setFileUrl(Optional.ofNullable(experimentDoc).map(ExperimentDoc::getFilePath).orElse(null)); - }); + //experimentReport.forEach(v -> { + // ExperimentDoc experimentDoc = experimentDocService.getByExperimentId(experimentId, ExperimentDocType.sybg.getType()); + // v.setFileUrl(Optional.ofNullable(experimentDoc).map(ExperimentDoc::getFilePath).orElse(null)); + //}); return Result.OK(experimentReport); } @@ -309,10 +321,12 @@ public class ExperimentReportController extends JeecgController proton; + public List assembleDetails() { + List allList = new ArrayList<>(); + if (CollUtil.isNotEmpty(getXgy())) { + allList.addAll(getXgy()); + } + if (CollUtil.isNotEmpty(getDgy())) { + allList.addAll(getDgy()); + } + if (CollUtil.isNotEmpty(getX())) { + allList.addAll(getX()); + } + if (CollUtil.isNotEmpty(getElectronics())) { + allList.addAll(getElectronics()); + } + if (CollUtil.isNotEmpty(getProton())) { + allList.addAll(getProton()); + } + return allList; + } + } diff --git a/physical-module-system/physical-system-biz/src/main/java/org/jeecg/modules/database/entity/ExperimentReport.java b/physical-module-system/physical-system-biz/src/main/java/org/jeecg/modules/database/entity/ExperimentReport.java index 12a7380..31db19c 100644 --- a/physical-module-system/physical-system-biz/src/main/java/org/jeecg/modules/database/entity/ExperimentReport.java +++ b/physical-module-system/physical-system-biz/src/main/java/org/jeecg/modules/database/entity/ExperimentReport.java @@ -3,8 +3,6 @@ package org.jeecg.modules.database.entity; import com.baomidou.mybatisplus.annotation.*; import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.v3.oas.annotations.media.Schema; -import java.io.Serializable; -import java.util.Date; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.experimental.Accessors; @@ -12,6 +10,9 @@ import org.apache.commons.lang3.StringUtils; import org.jeecgframework.poi.excel.annotation.Excel; import org.springframework.format.annotation.DateTimeFormat; +import java.io.Serializable; +import java.util.Date; + /** * @Description: 试验报告 @Author: jeecg-boot @Date: 2024-10-23 @Version: V1.0 */ @@ -21,129 +22,158 @@ import org.springframework.format.annotation.DateTimeFormat; @EqualsAndHashCode(callSuper = false) @Schema(description = "试验报告") public class ExperimentReport implements Serializable { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = 1L; - /** 主键 */ - @TableId(type = IdType.ASSIGN_ID) - @Schema(description = "主键") - private String id; + /** + * 主键 + */ + @TableId(type = IdType.ASSIGN_ID) + @Schema(description = "主键") + private String id; - /** 创建人 */ - @Schema(description = "创建人") - private String createBy; + /** + * 创建人 + */ + @Schema(description = "创建人") + private String createBy; - /** 创建日期 */ - @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm") - @DateTimeFormat(pattern = "yyyy-MM-dd") - @Schema(description = "创建日期") - private Date createTime; + /** + * 创建日期 + */ + @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm") + @DateTimeFormat(pattern = "yyyy-MM-dd") + @Schema(description = "创建日期") + private Date createTime; - /** 更新人 */ - @Schema(description = "更新人") - private String updateBy; + /** + * 更新人 + */ + @Schema(description = "更新人") + private String updateBy; - /** 更新日期 */ - @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm") - @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm") - @Schema(description = "更新日期") - private Date updateTime; + /** + * 更新日期 + */ + @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm") + @Schema(description = "更新日期") + private Date updateTime; - /** 所属部门 */ - @Schema(description = "所属部门") - private String sysOrgCode; + /** + * 所属部门 + */ + @Schema(description = "所属部门") + private String sysOrgCode; - /** 试验ID */ - @Excel(name = "试验ID", width = 15) - @Schema(description = "试验ID") - private String experimentId; + /** + * 试验ID + */ + @Excel(name = "试验ID", width = 15) + @Schema(description = "试验ID") + private String experimentId; - /** 样品信息 */ - @Excel(name = "样品信息", width = 15) - @Schema(description = "样品信息") - private String sampleInfo; + /** + * 样品信息 + */ + @Excel(name = "样品信息", width = 15) + @Schema(description = "样品信息") + private String sampleInfo; - /** 偏置原理图 */ - @Excel(name = "偏置原理图", width = 15) - @Schema(description = "偏置原理图") - private String imgUrls; + /** + * 偏置原理图 + */ + @Excel(name = "偏置原理图", width = 15) + @Schema(description = "偏置原理图") + private String imgUrls; - /** 偏置原理说明 */ - @Excel(name = "偏置原理说明", width = 15) - @Schema(description = "偏置原理说明") - private String description; + /** + * 偏置原理说明 + */ + @Excel(name = "偏置原理说明", width = 15) + @Schema(description = "偏置原理说明") + private String description; - /** 审核员 */ - @Excel(name = "审核员", width = 15) - @Schema(description = "审核员") - private String auditor; + /** + * 审核员 + */ + @Excel(name = "审核员", width = 15) + @Schema(description = "审核员") + private String auditor; - /** 校对员 */ - @Excel(name = "校对员", width = 15) - @Schema(description = "校对员") - private String proofreader; + /** + * 校对员 + */ + @Excel(name = "校对员", width = 15) + @Schema(description = "校对员") + private String proofreader; - /** 确认员 */ - @Excel(name = "确认员", width = 15) - @Schema(description = "确认员") - private String confirmer; + /** + * 确认员 + */ + @Excel(name = "确认员", width = 15) + @Schema(description = "确认员") + private String confirmer; - /** 报告名称 */ - @Excel(name = "报告名称", width = 15) - @Schema(description = "报告名称") - private String reportName; + /** + * 报告名称 + */ + @Excel(name = "报告名称", width = 15) + @Schema(description = "报告名称") + private String reportName; - /** 状态 */ - @Excel(name = "状态", width = 15) - @Schema( - description = - "状态(申请中待校对:INIT,不合格:REJECT ,校对通过待审核:PROOFREAD_PASS,审核通过待批准:AUDIT_PASS,批准通过:PASSED)") - private String status; + /** + * 状态 + */ + @Excel(name = "状态", width = 15) + @Schema( + description = + "状态(申请中待校对:INIT,不合格:REJECT ,校对通过待审核:PROOFREAD_PASS,审核通过待批准:AUDIT_PASS,批准通过:PASSED)") + private String status; - @Excel(name = "上一个状态", width = 15) - @Schema(description ="上一个状态") - private String lastStatus; + @Excel(name = "上一个状态", width = 15) + @Schema(description = "上一个状态") + private String lastStatus; + @Excel(name = "审批意见", width = 15) + @Schema(description = "审批意见") + private String auditorMemo; - @Excel(name = "审批意见", width = 15) - @Schema(description = "审批意见") - private String auditorMemo; + @Excel(name = "校对意见", width = 15) + @Schema(description = "校对意见") + private String proofreaderMemo; - @Excel(name = "校对意见", width = 15) - @Schema(description = "校对意见") - private String proofreaderMemo; + @Excel(name = "批准意见", width = 15) + @Schema(description = "批准意见") + private String confirmerMemo; - @Excel(name = "批准意见", width = 15) - @Schema(description = "批准意见") - private String confirmerMemo; + @Excel(name = "审批时间", width = 15) + @Schema(description = "审批时间") + private String auditorTime; - @Excel(name = "审批时间", width = 15) - @Schema(description = "审批时间") - private String auditorTime; + @Excel(name = "校对时间", width = 15) + @Schema(description = "校对时间") + private String proofreaderTime; - @Excel(name = "校对时间", width = 15) - @Schema(description = "校对时间") - private String proofreaderTime; + @Excel(name = "批准时间", width = 15) + @Schema(description = "批准时间") + private String confirmerTime; - @Excel(name = "批准时间", width = 15) - @Schema(description = "批准时间") - private String confirmerTime; + @Schema(description = "生成的文件路径") + private String fileUrl; - @TableField(exist = false) - private String fileUrl; + @TableField(exist = false) + private String memo; - @TableField(exist = false) - private String memo; - - public String getMemo() { - if (StringUtils.isNotBlank(proofreaderMemo)) { - return proofreaderMemo; + public String getMemo() { + if (StringUtils.isNotBlank(proofreaderMemo)) { + return proofreaderMemo; + } + if (StringUtils.isNotBlank(auditorMemo)) { + return auditorMemo; + } + if (StringUtils.isNotBlank(confirmerMemo)) { + return confirmerMemo; + } + return null; } - if (StringUtils.isNotBlank(auditorMemo)) { - return auditorMemo; - } - if (StringUtils.isNotBlank(confirmerMemo)) { - return confirmerMemo; - } - return null; - } } diff --git a/physical-module-system/physical-system-biz/src/main/java/org/jeecg/modules/database/service/IExperimentReportService.java b/physical-module-system/physical-system-biz/src/main/java/org/jeecg/modules/database/service/IExperimentReportService.java index 19dcd25..45094eb 100644 --- a/physical-module-system/physical-system-biz/src/main/java/org/jeecg/modules/database/service/IExperimentReportService.java +++ b/physical-module-system/physical-system-biz/src/main/java/org/jeecg/modules/database/service/IExperimentReportService.java @@ -16,6 +16,7 @@ import java.util.List; */ public interface IExperimentReportService extends IService { List getByExperimentId(String experimentId); + List getPassedByExperimentId(String experimentId); ExperimentReport getLatestReport(String experimentId); diff --git a/physical-module-system/physical-system-biz/src/main/java/org/jeecg/modules/database/service/impl/ExperimentDocServiceImpl.java b/physical-module-system/physical-system-biz/src/main/java/org/jeecg/modules/database/service/impl/ExperimentDocServiceImpl.java index 6a6d02d..8b5e503 100755 --- a/physical-module-system/physical-system-biz/src/main/java/org/jeecg/modules/database/service/impl/ExperimentDocServiceImpl.java +++ b/physical-module-system/physical-system-biz/src/main/java/org/jeecg/modules/database/service/impl/ExperimentDocServiceImpl.java @@ -5,6 +5,7 @@ import cn.hutool.core.date.DatePattern; import cn.hutool.core.date.DateUtil; import cn.hutool.core.io.FileUtil; import cn.hutool.core.io.file.PathUtil; +import cn.hutool.core.util.ZipUtil; import com.alibaba.fastjson.*; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; @@ -110,10 +111,10 @@ public class ExperimentDocServiceImpl extends ServiceImpl headers = document.getHeaderList(); - - // 遍历所有节,确保每个节的页眉都添加了页码 - for (XWPFHeader h : headers) { - // 添加页码到每个节的页眉 - //addPageNumberToHeader("报告编号:" + experiment.getExperimentNo(), h); - } - - try (FileOutputStream out = new FileOutputStream(outputFile)) { - document.write(out); - } - document.close();*/ - String path = MinioUtil.upload(FileUtil.getInputStream(outputFile), - "experiment_doc/" + experimentId + "/" + version + "/" + experiment.getName() + "-" + fileName + ".docx"); + String path = generateUpload(experimentId, fileName, version, tmpDirPath); return path; } catch (Exception e) { log.error(e.getMessage()); @@ -199,40 +175,81 @@ public class ExperimentDocServiceImpl extends ServiceImpl assembleParams(String experimentId, String type, String outputFile) throws IOException { + private String generateUpload(String experimentId, String type, String version, String tmpDirPath) throws Exception { String absolutePath = templatePath + File.separator + docTempalteMap.get(type); + Experiment experiment = experimentService.getById(experimentId); switch (type) { case "辐照试验计划表": Map jhparams = assembleFzsyjhb(experimentId); XWPFTemplate jhrender = XWPFTemplate.compile(absolutePath).render(jhparams); - jhrender.writeToFile(outputFile); - break; + String outputFile1 = tmpDirPath + File.separator + type + "-" + experimentId + "-" + version + ".docx"; + if (FileUtil.exist(outputFile1)) { + FileUtil.del(outputFile1); + } + jhrender.writeToFile(outputFile1); + return MinioUtil.upload(FileUtil.getInputStream(outputFile1), + "experiment_doc/" + experimentId + "/" + version + "/" + experiment.getName() + "-" + type + ".docx"); case "试验报告评审表": Map psparams = assembleSybgpsb(experimentId); XWPFTemplate psrender = XWPFTemplate.compile(absolutePath).render(psparams); - psrender.writeToFile(outputFile); - break; + String outputFile2 = tmpDirPath + File.separator + type + "-" + experimentId + "-" + version + ".docx"; + if (FileUtil.exist(outputFile2)) { + FileUtil.del(outputFile2); + } + psrender.writeToFile(outputFile2); + return MinioUtil.upload(FileUtil.getInputStream(outputFile2), + "experiment_doc/" + experimentId + "/" + version + "/" + experiment.getName() + "-" + type + ".docx"); case "设备使用记录表": Map sbParams = assembleSbsyjlb(experimentId); LoopRowTableRenderPolicy policy = new LoopRowTableRenderPolicy(); Configure config = Configure.builder().bind("equipment", policy).build(); XWPFTemplate template = XWPFTemplate.compile(absolutePath, config).render(sbParams); - template.writeToFile(outputFile); - break; + String outputFile3 = tmpDirPath + File.separator + type + "-" + experimentId + "-" + version + ".docx"; + if (FileUtil.exist(outputFile3)) { + FileUtil.del(outputFile3); + } + template.writeToFile(outputFile3); + return MinioUtil.upload(FileUtil.getInputStream(outputFile3), + "experiment_doc/" + experimentId + "/" + version + "/" + experiment.getName() + "-" + type + ".docx"); case "试验报告": - Map params = assembleSybg(experimentId); - XWPFTemplate render = XWPFTemplate.compile(absolutePath).render(params); - render.writeToFile(outputFile); - break; + List reportList = experimentReportService.getPassedByExperimentId(experimentId); + List pathList = new ArrayList<>(); + + String outputDir = tmpDirPath + type + File.separator + experimentId + File.separator + version; + if (FileUtil.exist(outputDir)) { + FileUtil.del(outputDir); + } + if (!FileUtil.exist(outputDir)) { + FileUtil.mkdir(outputDir); + } + for (ExperimentReport experimentReport : reportList) { + Map params = assembleSybg(experimentId, experimentReport); + XWPFTemplate render = XWPFTemplate.compile(absolutePath).render(params); + String filePath = outputDir + File.separator + experimentReport.getReportName() + ".docx"; + render.writeToFile(filePath); + String reportPath = MinioUtil.upload(FileUtil.getInputStream(filePath), + "experiment_doc/" + experimentId + "/" + version + "/" + experimentReport.getReportName() + ".docx"); + pathList.add(reportPath); + } + File zip = ZipUtil.zip(outputDir); + String zipPath = MinioUtil.upload(FileUtil.getInputStream(zip), + "experiment_doc/" + experimentId + "/" + version + "/" + type + "-" + experiment.getName() + ".zip"); + + return zipPath; case "辐照试验总结单": Map zjdParams = assembleFzsyzjd(experimentId); LoopRowTableRenderPolicy zjdpolicy = new LoopRowTableRenderPolicy(); Configure zjdconfig = Configure.builder().bind("sample", zjdpolicy).build(); XWPFTemplate zjdtemplate = XWPFTemplate.compile(absolutePath, zjdconfig).render(zjdParams); - zjdtemplate.writeToFile(outputFile); - break; + String outputFile5 = tmpDirPath + File.separator + type + "-" + experimentId + "-" + version + ".docx"; + if (FileUtil.exist(outputFile5)) { + FileUtil.del(outputFile5); + } + zjdtemplate.writeToFile(outputFile5); + return MinioUtil.upload(FileUtil.getInputStream(outputFile5), + "experiment_doc/" + experimentId + "/" + version + "/" + experiment.getName() + "-" + type + ".docx"); } - return new HashMap<>(); + return null; } private Map assembleFzsyzjd(String experimentId) { @@ -259,44 +276,65 @@ public class ExperimentDocServiceImpl extends ServiceImpl> sampleList = new ArrayList<>(); - List sampleInfoList = experiment.getSampleInfoList(); - for (int i = 0; i < sampleInfoList.size(); i++) { - ExperimentSampleInfo sampleInfo = sampleInfoList.get(i); - Map sample = new HashMap<>(); - sample.put("index", i + 1); - sample.put("样品名称", sampleInfo.getSampleName()); - sample.put("样品型号", sampleInfo.getSampleModel()); - sample.put("样品类型", sampleInfo.getSampleType()); - sample.put("样品批次", sampleInfo.getSampleBatch()); - sample.put("样品编号", sampleInfo.getModelBatch()); - sample.put("注量率", ""); - sample.put("总剂量", ""); - sampleList.add(sample); + + for (ExperimentRadiationProcess radiationProcess : radiationProcessList) { + List sampleInfoList = radiationProcess.getSampleInfoList(); + String radiationDetailJson = radiationProcess.getRadiationDetail(); + OptionalDouble maxPoint = OptionalDouble.empty(); + OptionalDouble maxRate = OptionalDouble.empty(); + if (StringUtils.isNotBlank(radiationDetailJson)) { + RadiationMapDTO radiationMap = JSON.parseObject(radiationDetailJson, RadiationMapDTO.class); + List detailDTOList = radiationMap.assembleDetails(); + maxPoint = detailDTOList.stream().map(obj -> obj.getPoint()) // 获取point字段 + .filter(point -> StringUtils.isNotBlank(point)) + .filter(str -> str.matches("-?\\d+(\\.\\d+)?")) // 只保留数字格式的字符串 + .mapToDouble(Double::parseDouble) // 转换为double + .max(); + maxRate = detailDTOList.stream().map(obj -> obj.getActualMeasurementRate()) // 获取point字段 + .filter(point -> StringUtils.isNotBlank(point)) + .filter(str -> str.matches("-?\\d+(\\.\\d+)?")) // 只保留数字格式的字符串 + .mapToDouble(Double::parseDouble) // 转换为double + .max(); + } + for (int i = 0; i < sampleInfoList.size(); i++) { + ExperimentSampleInfo sampleInfo = sampleInfoList.get(i); + Map sample = new HashMap<>(); + sample.put("index", i + 1); + sample.put("样品名称", sampleInfo.getSampleName()); + sample.put("样品型号", sampleInfo.getSampleModel()); + sample.put("样品类型", sampleInfo.getSampleType()); + sample.put("样品批次", sampleInfo.getSampleBatch()); + sample.put("样品编号", sampleInfo.getModelBatch()); + sample.put("注量率", maxRate.orElse(0)); + sample.put("总剂量", maxPoint.orElse(0)); + sampleList.add(sample); + } } root.put("sample", sampleList); return root; } - private Map assembleSybg(String experimentId) { + private Map assembleSybg(String experimentId, ExperimentReport experimentReport) { Experiment experiment = experimentService.getById(experimentId); experimentService.fetchExperimentDetail(experiment); if (Objects.isNull(experiment)) { return new HashMap<>(); } - ExperimentReport latestReport = experimentReportService.getLatestReport(experimentId); Map params = new HashMap<>(); - if (Objects.nonNull(latestReport)) { - params.put("审核人员姓名", Optional.ofNullable(sysUserService.getById(latestReport.getAuditor())).map(SysUser::getRealname) + if (Objects.nonNull(experimentReport)) { + params.put("审核人员姓名", Optional.ofNullable(sysUserService.getById(experimentReport.getAuditor())).map(SysUser::getRealname) .orElse("")); - params.put("校对人员姓名", Optional.ofNullable(sysUserService.getById(latestReport.getProofreader())).map(SysUser::getRealname) + params.put("校对人员姓名", Optional.ofNullable(sysUserService.getById(experimentReport.getProofreader())) + .map(SysUser::getRealname) .orElse("")); - params.put("批准人员姓名", Optional.ofNullable(sysUserService.getById(latestReport.getConfirmer())).map(SysUser::getRealname) + params.put("批准人员姓名", Optional.ofNullable(sysUserService.getById(experimentReport.getConfirmer())) + .map(SysUser::getRealname) .orElse("")); - params.put("报告生成日期", formatDate(latestReport.getCreateTime())); - params.put("批准日期", latestReport.getConfirmerTime()); - params.put("校对日期", latestReport.getProofreaderTime()); - params.put("审核日期", latestReport.getAuditorTime()); + params.put("报告生成日期", formatDate(experimentReport.getCreateTime())); + params.put("批准日期", experimentReport.getConfirmerTime()); + params.put("校对日期", experimentReport.getProofreaderTime()); + params.put("审核日期", experimentReport.getAuditorTime()); } params.put("试验报告名称", experiment.getName()); @@ -325,8 +363,8 @@ public class ExperimentDocServiceImpl extends ServiceImpl sampleInfoList = JSON.parseArray(sampleInfo, JSONObject.class); if (CollUtil.isNotEmpty(sampleInfoList)) { @@ -391,8 +429,8 @@ public class ExperimentDocServiceImpl extends ServiceImpl getByExperimentId(String experimentId) { return list(new LambdaQueryWrapper().eq(ExperimentReport::getExperimentId, experimentId)); + } @Override + public List getPassedByExperimentId(String experimentId) { + return list(new LambdaQueryWrapper().eq(ExperimentReport::getExperimentId, experimentId).eq(ExperimentReport::getStatus,ExperimentReportStatus.PASSED)); } @Override diff --git a/templates/fzsyzjd.docx b/templates/fzsyzjd.docx index 2d86427..48aae5e 100644 Binary files a/templates/fzsyzjd.docx and b/templates/fzsyzjd.docx differ