From 102aa504e6fe366280658a8e8348414d98af1fb6 Mon Sep 17 00:00:00 2001 From: caozehui <2427765068@qq.com> Date: Thu, 17 Apr 2025 10:36:05 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BE=AE=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/njcn/gather/plan/pojo/po/AdPlan.java | 4 ++- .../plan/service/impl/AdPlanServiceImpl.java | 34 +++++++++++-------- .../service/impl/PqScriptDtlsServiceImpl.java | 6 ++-- 3 files changed, 25 insertions(+), 19 deletions(-) diff --git a/detection/src/main/java/com/njcn/gather/plan/pojo/po/AdPlan.java b/detection/src/main/java/com/njcn/gather/plan/pojo/po/AdPlan.java index 3bca9ff8..fcf1a388 100644 --- a/detection/src/main/java/com/njcn/gather/plan/pojo/po/AdPlan.java +++ b/detection/src/main/java/com/njcn/gather/plan/pojo/po/AdPlan.java @@ -1,8 +1,9 @@ package com.njcn.gather.plan.pojo.po; +import com.baomidou.mybatisplus.annotation.FieldStrategy; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import com.njcn.db.mybatisplus.bo.BaseEntity; -import io.swagger.models.auth.In; import lombok.Data; import lombok.EqualsAndHashCode; @@ -86,6 +87,7 @@ public class AdPlan extends BaseEntity implements Serializable { /** * 报告模板ID,关联PQ_Report表 */ + @TableField(updateStrategy = FieldStrategy.IGNORED) private String reportTemplateId; /** diff --git a/detection/src/main/java/com/njcn/gather/plan/service/impl/AdPlanServiceImpl.java b/detection/src/main/java/com/njcn/gather/plan/service/impl/AdPlanServiceImpl.java index 9e7c18c2..b7081628 100644 --- a/detection/src/main/java/com/njcn/gather/plan/service/impl/AdPlanServiceImpl.java +++ b/detection/src/main/java/com/njcn/gather/plan/service/impl/AdPlanServiceImpl.java @@ -188,17 +188,21 @@ public class AdPlanServiceImpl extends ServiceImpl impleme AdPlan plan1 = this.getById(param.getId()); AdPlan plan2 = new AdPlan(); - if (param.getAssociateReport() != null && param.getAssociateReport() == 1) { - String reportTemplateName = param.getReportTemplateName(); - String[] split = reportTemplateName.split("_"); - String reportId = this.baseMapper.getReportIdByNameAndVersion(split[0], split[1]); - if (plan1.getTestState() != CheckStateEnum.UNCHECKED.getValue()) { - if (!reportId.equals(plan1.getReportTemplateId())) { - throw new BusinessException(DetectionResponseEnum.CANNOT_CHANGE_REPORT_WHEN_CHECKING); + if (param.getAssociateReport() != null) { + if (param.getAssociateReport() == 1) { + String reportTemplateName = param.getReportTemplateName(); + String[] split = reportTemplateName.split("_"); + String reportId = this.baseMapper.getReportIdByNameAndVersion(split[0], split[1]); +// if (plan1.getTestState() != CheckStateEnum.UNCHECKED.getValue()) { +// if (!reportId.equals(plan1.getReportTemplateId())) { +// throw new BusinessException(DetectionResponseEnum.CANNOT_CHANGE_REPORT_WHEN_CHECKING); +// } +// } + if (StrUtil.isNotBlank(reportId)) { + plan2.setReportTemplateId(reportId); } - } - if (StrUtil.isNotBlank(reportId)) { - plan2.setReportTemplateId(reportId); + } else { + plan2.setReportTemplateId(null); } } @@ -209,9 +213,9 @@ public class AdPlanServiceImpl extends ServiceImpl impleme if (!plan1.getErrorSysId().equals(param.getErrorSysId())) { throw new BusinessException(DetectionResponseEnum.CANNOT_CHANGE_ERROR_SYS_WHEN_CHECKING); } - if (param.getAssociateReport() != null && param.getAssociateReport() != plan1.getAssociateReport()) { - throw new BusinessException(DetectionResponseEnum.CANNOT_CHANGE_REPORT_WHEN_CHECKING); - } +// if (param.getAssociateReport() != null && param.getAssociateReport() != plan1.getAssociateReport()) { +// throw new BusinessException(DetectionResponseEnum.CANNOT_CHANGE_REPORT_WHEN_CHECKING); +// } } BeanUtil.copyProperties(param, plan2); @@ -531,7 +535,7 @@ public class AdPlanServiceImpl extends ServiceImpl impleme List deviceExportData = BeanUtil.copyToList(pqDevs, ProvinceDevExcel.class); planExcelList.get(i).setDevices(deviceExportData); } - ExcelUtil.exportExcelPullDown(new ExportParams(), "检测计划导出数据.xlsx", 2, this.getPullDownList(SceneEnum.PROVINCE_PLATFORM,queryParam.getPatternId()), ProvincePlanExcel.class, planExcelList); + ExcelUtil.exportExcelPullDown(new ExportParams(), "检测计划导出数据.xlsx", 2, this.getPullDownList(SceneEnum.PROVINCE_PLATFORM, queryParam.getPatternId()), ProvincePlanExcel.class, planExcelList); } /** @@ -554,7 +558,7 @@ public class AdPlanServiceImpl extends ServiceImpl impleme List deviceExportData = BeanUtil.copyToList(pqDevs, CNDevExcel.class); planExcelList.get(i).setDevices(deviceExportData); } - ExcelUtil.exportExcelPullDown(new ExportParams(), "检测计划导出数据.xlsx", 2, this.getPullDownList(SceneEnum.LEAVE_FACTORY_TEST,queryParam.getPatternId()), CNPlanExcel.class, planExcelList); + ExcelUtil.exportExcelPullDown(new ExportParams(), "检测计划导出数据.xlsx", 2, this.getPullDownList(SceneEnum.LEAVE_FACTORY_TEST, queryParam.getPatternId()), CNPlanExcel.class, planExcelList); } @Transactional diff --git a/detection/src/main/java/com/njcn/gather/script/service/impl/PqScriptDtlsServiceImpl.java b/detection/src/main/java/com/njcn/gather/script/service/impl/PqScriptDtlsServiceImpl.java index f6e23853..313e341f 100644 --- a/detection/src/main/java/com/njcn/gather/script/service/impl/PqScriptDtlsServiceImpl.java +++ b/detection/src/main/java/com/njcn/gather/script/service/impl/PqScriptDtlsServiceImpl.java @@ -701,12 +701,12 @@ public class PqScriptDtlsServiceImpl extends ServiceImpl sourceIssues = this.listSourceIssue(issueParam); - List dataTypeList = new ArrayList<>(); + Set dataTypeSet = new HashSet<>(); sourceIssues.forEach(x -> { - dataTypeList.addAll(x.getDevValueTypeList()); + dataTypeSet.addAll(x.getDevValueTypeList()); }); - return dataTypeList; + return dataTypeSet.stream().collect(Collectors.toList()); } @Override