|
@@ -2,21 +2,30 @@ package com.ufo.project.forecast.fileupload.controller;
|
|
|
|
|
|
|
|
import java.io.File;
|
|
import java.io.File;
|
|
|
import java.io.IOException;
|
|
import java.io.IOException;
|
|
|
|
|
+import java.net.URLEncoder;
|
|
|
import java.nio.charset.StandardCharsets;
|
|
import java.nio.charset.StandardCharsets;
|
|
|
import java.nio.file.Files;
|
|
import java.nio.file.Files;
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
import org.springframework.web.bind.annotation.PathVariable;
|
|
import org.springframework.web.bind.annotation.PathVariable;
|
|
|
|
|
+import org.springframework.web.bind.annotation.PostMapping;
|
|
|
|
|
+import org.springframework.web.bind.annotation.RequestBody;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
+import com.alibaba.excel.EasyExcel;
|
|
|
import com.ufo.base.common.utils.StringUtils;
|
|
import com.ufo.base.common.utils.StringUtils;
|
|
|
|
|
+import com.ufo.base.framework.aspectj.lang.annotation.Log;
|
|
|
|
|
+import com.ufo.base.framework.aspectj.lang.enums.BusinessType;
|
|
|
import com.ufo.base.framework.web.controller.BaseController;
|
|
import com.ufo.base.framework.web.controller.BaseController;
|
|
|
import com.ufo.base.framework.web.domain.AjaxResult;
|
|
import com.ufo.base.framework.web.domain.AjaxResult;
|
|
|
import com.ufo.base.framework.web.page.TableDataInfo;
|
|
import com.ufo.base.framework.web.page.TableDataInfo;
|
|
|
import com.ufo.project.forecast.fileupload.domain.DataReportLog;
|
|
import com.ufo.project.forecast.fileupload.domain.DataReportLog;
|
|
|
|
|
+import com.ufo.project.forecast.fileupload.domain.vo.UploadRateStatQuery;
|
|
|
|
|
+import com.ufo.project.forecast.fileupload.domain.vo.UploadRateStatVO;
|
|
|
import com.ufo.project.forecast.fileupload.service.IDataReportLogService;
|
|
import com.ufo.project.forecast.fileupload.service.IDataReportLogService;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -79,4 +88,36 @@ public class DataReportLogController extends BaseController
|
|
|
return AjaxResult.error("读取上报文件失败: " + path);
|
|
return AjaxResult.error("读取上报文件失败: " + path);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 光伏上传率统计查询(手动分页: total=范围内天数)
|
|
|
|
|
+ */
|
|
|
|
|
+ @PreAuthorize("@ss.hasPermi('fileupload:reportLog:uploadRate')")
|
|
|
|
|
+ @Log(title = "光伏上传率统计", businessType = BusinessType.OTHER)
|
|
|
|
|
+ @PostMapping("/uploadRate/list")
|
|
|
|
|
+ public TableDataInfo uploadRateList(@RequestBody UploadRateStatQuery query)
|
|
|
|
|
+ {
|
|
|
|
|
+ long total = dataReportLogService.uploadRateTotalDays(query);
|
|
|
|
|
+ List<UploadRateStatVO> rows = dataReportLogService.uploadRatePageList(query);
|
|
|
|
|
+ return new TableDataInfo(rows, (int) total);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 光伏上传率统计导出(全量日期范围)
|
|
|
|
|
+ */
|
|
|
|
|
+ @PreAuthorize("@ss.hasPermi('fileupload:reportLog:uploadRateExport')")
|
|
|
|
|
+ @Log(title = "光伏上传率统计", businessType = BusinessType.EXPORT)
|
|
|
|
|
+ @PostMapping("/uploadRate/export")
|
|
|
|
|
+ public void uploadRateExport(@RequestBody UploadRateStatQuery query, HttpServletResponse response) throws IOException
|
|
|
|
|
+ {
|
|
|
|
|
+ List<UploadRateStatVO> data = dataReportLogService.uploadRateExportList(query);
|
|
|
|
|
+ response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
|
|
|
|
+ response.setCharacterEncoding("utf-8");
|
|
|
|
|
+ String fileName = URLEncoder.encode("光伏上传率统计_" + query.getEndTime().replace("-", "") + ".xlsx",
|
|
|
|
|
+ "UTF-8").replaceAll("\\+", "%20");
|
|
|
|
|
+ response.setHeader("Content-Disposition", "attachment;filename*=utf-8''" + fileName);
|
|
|
|
|
+ EasyExcel.write(response.getOutputStream(), UploadRateStatVO.class)
|
|
|
|
|
+ .sheet("光伏上传率统计")
|
|
|
|
|
+ .doWrite(data);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|