|
@@ -3,6 +3,7 @@ package com.bz.zoneiot.water.web.controller;
|
|
|
import cn.hutool.core.collection.CollectionUtil;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
+import com.bz.zoneiot.core.oauth2.util.UserUtil;
|
|
|
import com.bz.zoneiot.water.api.dto.ReportDto;
|
|
|
import com.bz.zoneiot.water.api.dto.ReportQueryDto;
|
|
|
import com.bz.zoneiot.water.api.dto.ReportStatisticalDimensionDto;
|
|
@@ -22,6 +23,7 @@ import io.swagger.annotations.ApiParam;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
+import org.springframework.util.CollectionUtils;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
@@ -174,7 +176,12 @@ public class DayMonthYearReportController {
|
|
|
iPage = reportService.getPipeDevicePressReportByDeviceIds(new Page<>(1, 1000000), queryDto);
|
|
|
}
|
|
|
List<ReportVo> list = iPage.getRecords();
|
|
|
- List<List<String>> reportTitle = ReportExcelUtil.toExcelTitleList(list.get(0).getReportTitle(), queryDto.getSceneType(),0);
|
|
|
+ List<List<String>> reportTitle;
|
|
|
+ if (CollectionUtils.isEmpty(list)){
|
|
|
+ reportTitle = ReportExcelUtil.toExcelTitleList(new ArrayList<>(), queryDto.getSceneType(),0);
|
|
|
+ } else {
|
|
|
+ reportTitle = ReportExcelUtil.toExcelTitleList(list.get(0).getReportTitle(), queryDto.getSceneType(),0);
|
|
|
+ }
|
|
|
EasyExcelUtil.excelWriteWithHeader(response, SceneEnum.getMsg(queryDto.getSceneType()) +"报表", reportTitle, ReportExcelUtil.toReportExcelDto(list, queryDto.getSceneType()));
|
|
|
}
|
|
|
|
|
@@ -192,7 +199,12 @@ public class DayMonthYearReportController {
|
|
|
iPage = reportService.getPipeHistoryDataDevicePressReportByDeviceIds(new Page<>(1, 1000000), queryDto);
|
|
|
}
|
|
|
List<ReportVo> list = iPage.getRecords();
|
|
|
- List<List<String>> reportTitle = ReportExcelUtil.toHistoryDataExcelTitleList(list.get(0).getReportTitle(), queryDto.getSceneType(),1);
|
|
|
+ List<List<String>> reportTitle;
|
|
|
+ if (CollectionUtils.isEmpty(list)){
|
|
|
+ reportTitle = ReportExcelUtil.toHistoryDataExcelTitleList(new ArrayList<>(), queryDto.getSceneType(),1);
|
|
|
+ } else {
|
|
|
+ reportTitle = ReportExcelUtil.toHistoryDataExcelTitleList(list.get(0).getReportTitle(), queryDto.getSceneType(),1);
|
|
|
+ }
|
|
|
EasyExcelUtil.excelWriteWithHeader(response, SceneEnum.getMsg(queryDto.getSceneType()) +"报表", reportTitle, ReportExcelUtil.toHisoryDataReportExcelDto(list, queryDto.getSceneType()));
|
|
|
}
|
|
|
|