diff --git a/detection/src/main/java/com/njcn/gather/report/pojo/DevReportParam.java b/detection/src/main/java/com/njcn/gather/report/pojo/DevReportParam.java index 78517bc0..992244de 100644 --- a/detection/src/main/java/com/njcn/gather/report/pojo/DevReportParam.java +++ b/detection/src/main/java/com/njcn/gather/report/pojo/DevReportParam.java @@ -39,4 +39,9 @@ public class DevReportParam implements Serializable { * 批量下载时传递的被检设备id列表 */ private List devIdList; + + /** + * 检测报告模板 + */ + private String reportTemplateName; } diff --git a/detection/src/main/java/com/njcn/gather/report/service/impl/PqReportServiceImpl.java b/detection/src/main/java/com/njcn/gather/report/service/impl/PqReportServiceImpl.java index acb83abb..28f0da5c 100644 --- a/detection/src/main/java/com/njcn/gather/report/service/impl/PqReportServiceImpl.java +++ b/detection/src/main/java/com/njcn/gather/report/service/impl/PqReportServiceImpl.java @@ -41,6 +41,7 @@ import com.njcn.gather.err.pojo.po.PqErrSys; import com.njcn.gather.err.service.IPqErrSysService; import com.njcn.gather.monitor.pojo.po.PqMonitor; import com.njcn.gather.monitor.service.IPqMonitorService; +import com.njcn.gather.plan.mapper.AdPlanMapper; import com.njcn.gather.plan.pojo.enums.DataSourceEnum; import com.njcn.gather.plan.pojo.enums.PlanReportStateEnum; import com.njcn.gather.plan.pojo.po.AdPlan; @@ -175,6 +176,7 @@ public class PqReportServiceImpl extends ServiceImpl i private final IPqDevSubService iPqDevSubService; private final IDictDataService dictDataService; private final IAdPlanService adPlanService; + private final AdPlanMapper pqPlanMapper; private final IPqScriptDtlsService pqScriptDtlsService; private final SimAndDigNonHarmonicService adNonHarmonicService; private final SimAndDigHarmonicService adHarmonicService; @@ -788,6 +790,9 @@ public class PqReportServiceImpl extends ServiceImpl i * @param devReportParam 设备信息 */ private void generateReportByPlanContrast(AdPlan plan, DevReportParam devReportParam) { + String reportTemplateName = devReportParam.getReportTemplateName(); + String[] split = reportTemplateName.split("_"); + String reportTemplateId = pqPlanMapper.getReportIdByNameAndVersion(split[0], split[1]); // 支持批量生成报告 devReportParam.getDevIdList().forEach(devId -> { // 准备被检设备的基础信息 @@ -802,7 +807,7 @@ public class PqReportServiceImpl extends ServiceImpl i if (Objects.isNull(devType)) { throw new BusinessException(ReportResponseEnum.DEVICE_TYPE_NOT_EXIST); } - PqReport report = this.lambdaQuery().eq(PqReport::getId, plan.getReportTemplateId()).eq(PqReport::getState, DataStateEnum.ENABLE.getCode()).one(); + PqReport report = this.lambdaQuery().eq(PqReport::getId, reportTemplateId).eq(PqReport::getState, DataStateEnum.ENABLE.getCode()).one(); if (Objects.isNull(report)) { throw new BusinessException(ReportResponseEnum.REPORT_TEMPLATE_NOT_EXIST); } @@ -866,6 +871,9 @@ public class PqReportServiceImpl extends ServiceImpl i * @param devReportParam 设备信息 */ private void generateReportByPlan(AdPlan plan, DevReportParam devReportParam) { + String reportTemplateName = devReportParam.getReportTemplateName(); + String[] split = reportTemplateName.split("_"); + String reportTemplateId = pqPlanMapper.getReportIdByNameAndVersion(split[0], split[1]); // 支持批量生成报告 devReportParam.getDevIdList().forEach(devId -> { // 准备被检设备的基础信息 @@ -879,7 +887,7 @@ public class PqReportServiceImpl extends ServiceImpl i if (Objects.isNull(devType)) { throw new BusinessException(ReportResponseEnum.DEVICE_TYPE_NOT_EXIST); } - PqReport report = this.lambdaQuery().eq(PqReport::getId, plan.getReportTemplateId()).eq(PqReport::getState, DataStateEnum.ENABLE.getCode()).one(); + PqReport report = this.lambdaQuery().eq(PqReport::getId, reportTemplateId).eq(PqReport::getState, DataStateEnum.ENABLE.getCode()).one(); if (Objects.isNull(report)) { throw new BusinessException(ReportResponseEnum.REPORT_TEMPLATE_NOT_EXIST); } diff --git a/detection/src/main/java/com/njcn/gather/result/pojo/vo/FormContentVO.java b/detection/src/main/java/com/njcn/gather/result/pojo/vo/FormContentVO.java index 25c5f3f5..186bb58c 100644 --- a/detection/src/main/java/com/njcn/gather/result/pojo/vo/FormContentVO.java +++ b/detection/src/main/java/com/njcn/gather/result/pojo/vo/FormContentVO.java @@ -31,4 +31,9 @@ public class FormContentVO { * 有多少次波形录制 */ private Integer waveNumTotal; + + /** + * 报表模板 + */ + private String reportTemplateName; } diff --git a/detection/src/main/java/com/njcn/gather/result/service/impl/ResultServiceImpl.java b/detection/src/main/java/com/njcn/gather/result/service/impl/ResultServiceImpl.java index b47e36de..f7ab1dd3 100644 --- a/detection/src/main/java/com/njcn/gather/result/service/impl/ResultServiceImpl.java +++ b/detection/src/main/java/com/njcn/gather/result/service/impl/ResultServiceImpl.java @@ -41,6 +41,7 @@ import com.njcn.gather.device.service.IPqStandardDevService; import com.njcn.gather.err.service.IPqErrSysService; import com.njcn.gather.monitor.pojo.po.PqMonitor; import com.njcn.gather.monitor.service.IPqMonitorService; +import com.njcn.gather.plan.mapper.AdPlanMapper; import com.njcn.gather.plan.pojo.enums.DataSourceEnum; import com.njcn.gather.plan.pojo.po.AdPlan; import com.njcn.gather.plan.pojo.po.AdPlanTestConfig; @@ -52,6 +53,7 @@ import com.njcn.gather.report.pojo.constant.PowerConstant; import com.njcn.gather.report.pojo.enums.AffectEnum; import com.njcn.gather.report.pojo.enums.ItemReportKeyEnum; import com.njcn.gather.report.pojo.enums.PowerIndexEnum; +import com.njcn.gather.report.pojo.po.PqReport; import com.njcn.gather.report.pojo.result.ContrastTestResult; import com.njcn.gather.report.pojo.result.SingleTestResult; import com.njcn.gather.result.pojo.enums.ResultUnitEnum; @@ -112,6 +114,7 @@ import static com.njcn.gather.plan.pojo.enums.DataSourceEnum.*; public class ResultServiceImpl implements IResultService { private final IAdPlanService adPlanService; + private final AdPlanMapper adPlanMapper; private final IAdPlanTestConfigService adPlanTestConfigService; private final IPqDevService pqDevService; private final IPqStandardDevService pqStandardDevService; @@ -144,6 +147,8 @@ public class ResultServiceImpl implements IResultService { FormContentVO formContentVO = new FormContentVO(); AdPlan plan = adPlanService.getById(queryParam.getPlanId()); formContentVO.setErrorSysId(plan.getErrorSysId()); + PqReport report = adPlanMapper.getPqReportById(plan.getReportTemplateId()); + formContentVO.setReportTemplateName(report.getName() + "_" + report.getVersion()); String scriptId = null; if (ObjectUtil.isNotNull(plan)) { formContentVO.setDataRule(plan.getDataRule());