diff --git a/detection/src/main/java/com/njcn/gather/result/pojo/param/ResultParam.java b/detection/src/main/java/com/njcn/gather/result/pojo/param/ResultParam.java index 60e9cb85..83a3897c 100644 --- a/detection/src/main/java/com/njcn/gather/result/pojo/param/ResultParam.java +++ b/detection/src/main/java/com/njcn/gather/result/pojo/param/ResultParam.java @@ -45,11 +45,6 @@ public class ResultParam { */ private Integer index; - /** - * 当前选中的检测项 - */ - private String currentCheckItem; - @Data public static class QueryParam { 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 c1447199..b789aee7 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 @@ -1,5 +1,6 @@ package com.njcn.gather.result.service.impl; +import cn.afterturn.easypoi.excel.entity.ExportParams; import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.util.ObjectUtil; @@ -8,12 +9,6 @@ import com.github.yulichang.wrapper.MPJLambdaWrapper; import com.njcn.common.pojo.enums.common.DataStateEnum; import com.njcn.common.pojo.exception.BusinessException; import com.njcn.gather.device.service.IPqDevService; -import com.njcn.gather.script.mapper.PqScriptMapper; -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.script.util.ScriptDtlsDesc; import com.njcn.gather.plan.pojo.po.AdPlan; import com.njcn.gather.plan.service.IAdPlanService; import com.njcn.gather.result.pojo.enums.ResultResponseEnum; @@ -24,6 +19,12 @@ import com.njcn.gather.result.pojo.vo.RawDataExcel; import com.njcn.gather.result.pojo.vo.ResultVO; import com.njcn.gather.result.pojo.vo.TreeDataVO; import com.njcn.gather.result.service.IResultService; +import com.njcn.gather.script.mapper.PqScriptMapper; +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.script.util.ScriptDtlsDesc; import com.njcn.gather.storage.pojo.param.StorageParam; import com.njcn.gather.storage.pojo.po.AdBaseResult; import com.njcn.gather.storage.pojo.vo.RawDataVO; @@ -816,20 +817,28 @@ public class ResultServiceImpl implements IResultService { storage.setHarmNum(harmNum); rawDataMap = adHarmonicService.listHarmData(storage); } - if (ObjectUtil.isNotNull(rawDataMap)) { - List rawDataVOList = rawDataMap.get(param.getCurrentCheckItem()); - if (CollUtil.isNotEmpty(rawDataVOList)) { - if (isTPhase(rawDataVOList)) { - List rawDataExcelList = BeanUtil.copyToList(rawDataVOList, RawDataExcel.TRawDataExcel.class); - ExcelUtil.exportExcel("原始数据.xlsx", "sheet1", param.getCurrentCheckItem(), RawDataExcel.TRawDataExcel.class, ObjectUtil.isEmpty(rawDataExcelList) ? new ArrayList<>() : rawDataExcelList); + if (ObjectUtil.isNotEmpty(rawDataMap)) { + List> sheetsList = new ArrayList<>(); + rawDataMap.forEach((k, v) -> { + HashMap sheet = new HashMap<>(); + ExportParams exportParams = new ExportParams(); + exportParams.setSheetName(k); + sheet.put("title", exportParams); + if (isTPhase(v)) { + List rawDataExcelList = BeanUtil.copyToList(v, RawDataExcel.TRawDataExcel.class); + sheet.put("data", rawDataExcelList); + sheet.put("entity", RawDataExcel.TRawDataExcel.class); } else { - List rawDataExcelList = BeanUtil.copyToList(rawDataVOList, RawDataExcel.NotTRawDataExcel.class); - ExcelUtil.exportExcel("原始数据.xlsx", "sheet1", param.getCurrentCheckItem(), RawDataExcel.NotTRawDataExcel.class, ObjectUtil.isEmpty(rawDataExcelList) ? new ArrayList<>() : rawDataExcelList); + List rawDataExcelList = BeanUtil.copyToList(v, RawDataExcel.NotTRawDataExcel.class); + sheet.put("data", rawDataExcelList); + sheet.put("entity", RawDataExcel.NotTRawDataExcel.class); } - } else { - throw new BusinessException(ResultResponseEnum.RAW_DATA_NOT_EXIST); - } + sheetsList.add(sheet); + }); + ExcelUtil.exportExcel("原始数据.xlsx", sheetsList); + } else { + throw new BusinessException(ResultResponseEnum.RAW_DATA_NOT_EXIST); } }