diff --git a/detection/src/main/java/com/njcn/gather/device/pojo/enums/PlanReportStateEnum.java b/detection/src/main/java/com/njcn/gather/plan/pojo/enums/PlanReportStateEnum.java similarity index 91% rename from detection/src/main/java/com/njcn/gather/device/pojo/enums/PlanReportStateEnum.java rename to detection/src/main/java/com/njcn/gather/plan/pojo/enums/PlanReportStateEnum.java index f1dda692..7308f26c 100644 --- a/detection/src/main/java/com/njcn/gather/device/pojo/enums/PlanReportStateEnum.java +++ b/detection/src/main/java/com/njcn/gather/plan/pojo/enums/PlanReportStateEnum.java @@ -1,4 +1,4 @@ -package com.njcn.gather.device.pojo.enums; +package com.njcn.gather.plan.pojo.enums; import lombok.Getter; 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 7dc3006d..48cca404 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 @@ -18,6 +18,7 @@ import com.njcn.gather.device.pojo.po.PqDev; import com.njcn.gather.device.service.IPqDevService; import com.njcn.gather.err.service.IPqErrSysService; import com.njcn.gather.device.pojo.enums.*; +import com.njcn.gather.plan.pojo.enums.PlanReportStateEnum; import com.njcn.gather.script.pojo.po.PqScriptDtls; import com.njcn.gather.script.service.IPqScriptDtlsService; import com.njcn.gather.script.service.IPqScriptService; diff --git a/detection/src/main/java/com/njcn/gather/report/service/impl/ReportServiceImpl.java b/detection/src/main/java/com/njcn/gather/report/service/impl/ReportServiceImpl.java index 3df7bb1f..53dcca47 100644 --- a/detection/src/main/java/com/njcn/gather/report/service/impl/ReportServiceImpl.java +++ b/detection/src/main/java/com/njcn/gather/report/service/impl/ReportServiceImpl.java @@ -9,26 +9,27 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.njcn.common.pojo.enums.common.DataStateEnum; import com.njcn.common.pojo.exception.BusinessException; import com.njcn.gather.detection.pojo.vo.DetectionData; +import com.njcn.gather.device.pojo.enums.DevReportStateEnum; import com.njcn.gather.device.pojo.vo.PqDevVO; import com.njcn.gather.device.service.IPqDevService; -import com.njcn.gather.device.pojo.enums.DevReportStateEnum; -import com.njcn.gather.script.pojo.po.PqScriptCheckData; -import com.njcn.gather.script.pojo.po.PqScriptDtls; -import com.njcn.gather.script.service.IPqScriptCheckDataService; -import com.njcn.gather.script.service.IPqScriptDtlsService; -import com.njcn.gather.type.entity.DevType; -import com.njcn.gather.type.service.IDevTypeService; +import com.njcn.gather.plan.pojo.enums.PlanReportStateEnum; import com.njcn.gather.plan.pojo.po.AdPlan; import com.njcn.gather.plan.service.IAdPlanService; import com.njcn.gather.report.pojo.DevReportParam; import com.njcn.gather.report.service.IReportService; import com.njcn.gather.report.utils.WordUtil; +import com.njcn.gather.script.pojo.po.PqScriptCheckData; +import com.njcn.gather.script.pojo.po.PqScriptDtls; +import com.njcn.gather.script.service.IPqScriptCheckDataService; +import com.njcn.gather.script.service.IPqScriptDtlsService; import com.njcn.gather.storage.pojo.param.SingleNonHarmParam; import com.njcn.gather.storage.pojo.po.AdHarmonicResult; import com.njcn.gather.storage.pojo.po.AdNonHarmonicResult; import com.njcn.gather.storage.service.AdHarmonicService; import com.njcn.gather.storage.service.AdNonHarmonicService; import com.njcn.gather.system.dictionary.service.IDictDataService; +import com.njcn.gather.type.entity.DevType; +import com.njcn.gather.type.service.IDevTypeService; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.apache.poi.xwpf.usermodel.XWPFDocument; @@ -111,17 +112,18 @@ public class ReportServiceImpl implements IReportService { System.out.println("报告生成成功!"); // 将改设备的报告生成状态调整为已生成 - iPqDevService.updatePqDevReportState(devReportParam.getDevId(), 1); + iPqDevService.updatePqDevReportState(devReportParam.getDevId(), DevReportStateEnum.GENERATED.getValue()); // 判断该计划下是否所有设备报告已生成,如果已生成则将计划的报告状态给为已生成 int count = iPqDevService.countUnReportDev(devReportParam.getPlanId()); + LambdaUpdateWrapper updateWrapper = new LambdaUpdateWrapper<>(); + updateWrapper.eq(AdPlan::getId, devReportParam.getPlanId()); if (count == 0) { - LambdaUpdateWrapper updateWrapper = new LambdaUpdateWrapper<>(); - updateWrapper.eq(AdPlan::getId, devReportParam.getPlanId()) - .set(AdPlan::getReportState, DevReportStateEnum.GENERATED.getValue()); - adPlanService.update(updateWrapper); + updateWrapper.set(AdPlan::getReportState, PlanReportStateEnum.REPORT_STATE_ALL_GENERATED.getValue()); + } else { + updateWrapper.set(AdPlan::getReportState, PlanReportStateEnum.REPORT_STATE_PARTIALLY_GENERATED.getValue()); } - + adPlanService.update(updateWrapper); } catch (Exception e) { log.error("生成报告文件失败", e); throw new RuntimeException(e);