|
@@ -1,5 +1,6 @@
|
|
|
package com.tofly.survey.controller;
|
|
|
|
|
|
+import cn.hutool.core.collection.CollUtil;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
@@ -95,24 +96,29 @@ public class DeviceCheckDataController {
|
|
|
if(dto.getIsOther()==null){
|
|
|
dto.setIsOther(false);
|
|
|
}
|
|
|
- Page<DeviceCheckListVo> pg= deviceCheckDataService.getDeviceCheckList(page, dto);
|
|
|
- if(pg.getRecords()==null){
|
|
|
- for (DeviceCheckListVo vo:pg.getRecords() ) {
|
|
|
- vo.setSid(String.valueOf(vo.getId()));
|
|
|
- }
|
|
|
- }
|
|
|
- if(dto.getExport()!=null&&dto.getExport().equals(1)&&pg.getRecords()!=null){
|
|
|
- ExcelExportFileTypeEnum excelExportFileTypeEnum = ExcelExportFileTypeEnum.getExcelExportFileTypeEnum(Constant.EXPORT_SERVICE, String.valueOf(dto.getExport()));
|
|
|
- if (null == excelExportFileTypeEnum) {
|
|
|
- return null;
|
|
|
+ if(dto.getExport()!=null&&dto.getExport().equals(1)){
|
|
|
+ List<DeviceCheckListVo> list= deviceCheckDataService.getDeviceCheckList(dto);
|
|
|
+ if(CollUtil.isNotEmpty(list)) {
|
|
|
+ for (DeviceCheckListVo vo:list ) {
|
|
|
+ vo.setSid(String.valueOf(vo.getId()));
|
|
|
+ }
|
|
|
+ ExcelExportFileTypeEnum excelExportFileTypeEnum = ExcelExportFileTypeEnum.getExcelExportFileTypeEnum(Constant.EXPORT_SERVICE, String.valueOf(dto.getExport()));
|
|
|
+ if (null == excelExportFileTypeEnum) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ String resultListToString = JSONArray.toJSONStringWithDateFormat(list, "yyyy-MM-dd HH:mm:ss");
|
|
|
+
|
|
|
+ List<Map<String, Object>> dataList = excelStrategyContext.getExportData(Constant.EXPORT_SERVICE, String.valueOf(dto.getExport()), resultListToString);
|
|
|
+ ExcelUtil.export(dataList.get(0), excelExportFileTypeEnum, Constant.FILE_PATH_TEST_EXPORT_EXCEL, response);
|
|
|
}
|
|
|
-
|
|
|
- String resultListToString = JSONArray.toJSONStringWithDateFormat(pg.getRecords(),"yyyy-MM-dd HH:mm:ss");
|
|
|
-
|
|
|
- List<Map<String, Object>> dataList = excelStrategyContext.getExportData(Constant.EXPORT_SERVICE, String.valueOf(dto.getExport()), resultListToString);
|
|
|
- ExcelUtil.export(dataList.get(0), excelExportFileTypeEnum, Constant.FILE_PATH_TEST_EXPORT_EXCEL, response);
|
|
|
-
|
|
|
}else {
|
|
|
+ Page<DeviceCheckListVo> pg= deviceCheckDataService.getDeviceCheckList(page, dto);
|
|
|
+ if(pg.getRecords()==null){
|
|
|
+ for (DeviceCheckListVo vo:pg.getRecords() ) {
|
|
|
+ vo.setSid(String.valueOf(vo.getId()));
|
|
|
+ }
|
|
|
+ }
|
|
|
return ResultRespone.success(pg);
|
|
|
}
|
|
|
return ResultRespone.success("");
|