|
|
@@ -1,8 +1,12 @@
|
|
|
package com.xunmei.core.reportForms.resumption.service.impl;
|
|
|
|
|
|
+import cn.hutool.core.util.ObjectUtil;
|
|
|
+import com.alibaba.excel.EasyExcel;
|
|
|
import com.xunmei.common.core.constant.SecurityConstants;
|
|
|
+import com.xunmei.common.core.utils.DateHelper;
|
|
|
import com.xunmei.common.security.utils.SecurityUtils;
|
|
|
import com.xunmei.core.reportForms.monitor.mapper.MonitorAccessReportMapper;
|
|
|
+import com.xunmei.core.reportForms.monitor.vo.MonitoringAccessVO;
|
|
|
import com.xunmei.core.reportForms.resumption.dto.ResumptionDTO;
|
|
|
import com.xunmei.core.reportForms.resumption.mapper.ResumptionReportMapper;
|
|
|
import com.xunmei.core.reportForms.resumption.service.ResumptionReportService;
|
|
|
@@ -14,6 +18,9 @@ import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
+import java.io.IOException;
|
|
|
+import java.net.URLEncoder;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Calendar;
|
|
|
@@ -110,6 +117,58 @@ public class ResumptionReportServiceImpl implements ResumptionReportService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
+ public void export(ResumptionDTO resumptionDTO, HttpServletResponse response) throws IOException {
|
|
|
+ String orgName = null;
|
|
|
+ if (null != resumptionDTO.getOrgId()) {
|
|
|
+ SysOrg sysOrg = orgService.selectSysOrgById(resumptionDTO.getOrgId(), SecurityConstants.INNER);
|
|
|
+ orgName = sysOrg.getName();
|
|
|
+ }
|
|
|
+ List<ResumptionDayVO> report = this.report(resumptionDTO);
|
|
|
+ if (ObjectUtil.isEmpty(report)) {
|
|
|
+ throw new RuntimeException("导出数据为空!");
|
|
|
+ }
|
|
|
+ if (report.size() > 10000) {
|
|
|
+ throw new RuntimeException("导出数据量过大(单次导出限量10000条数据),请填写条件分批导出");
|
|
|
+ }
|
|
|
+ for (int i = 0; i < report.size(); i++) {
|
|
|
+ ResumptionDayVO resumptionDayVO = report.get(i);
|
|
|
+ resumptionDayVO.setOrderNum(i + 1);
|
|
|
+ }
|
|
|
+ response.setContentType("application/vnd.ms-excel");
|
|
|
+ response.setCharacterEncoding("utf-8");
|
|
|
+ String fileName = URLEncoder.encode("【" + orgName + "】-履职报表" + DateHelper.getDateString(new Date()), "UTF-8");
|
|
|
+ response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx");
|
|
|
+ // 调用EasyExcel的导出方法
|
|
|
+ EasyExcel.write(response.getOutputStream(), ResumptionDayVO.class).sheet("Sheet1").doWrite(report);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void intrusionTestExport(ResumptionDTO resumptionDTO, HttpServletResponse response)throws IOException {
|
|
|
+ String orgName = null;
|
|
|
+ if (null != resumptionDTO.getOrgId()) {
|
|
|
+ SysOrg sysOrg = orgService.selectSysOrgById(resumptionDTO.getOrgId(), SecurityConstants.INNER);
|
|
|
+ orgName = sysOrg.getName();
|
|
|
+ }
|
|
|
+ List<IntrusionTestReportVO> report = this.intrusionTest(resumptionDTO);
|
|
|
+ if (ObjectUtil.isEmpty(report)) {
|
|
|
+ throw new RuntimeException("导出数据为空!");
|
|
|
+ }
|
|
|
+ if (report.size() > 10000) {
|
|
|
+ throw new RuntimeException("导出数据量过大(单次导出限量10000条数据),请填写条件分批导出");
|
|
|
+ }
|
|
|
+ for (int i = 0; i < report.size(); i++) {
|
|
|
+ IntrusionTestReportVO intrusionTestReportVO = report.get(i);
|
|
|
+ intrusionTestReportVO.setOrderNum(i + 1);
|
|
|
+ }
|
|
|
+ response.setContentType("application/vnd.ms-excel");
|
|
|
+ response.setCharacterEncoding("utf-8");
|
|
|
+ String fileName = URLEncoder.encode("【" + orgName + "】-报警测试报表" + DateHelper.getDateString(new Date()), "UTF-8");
|
|
|
+ response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx");
|
|
|
+ // 调用EasyExcel的导出方法
|
|
|
+ EasyExcel.write(response.getOutputStream(), ResumptionDayVO.class).sheet("Sheet1").doWrite(report);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
public List<IntrusionTestReportVO> intrusionTest(ResumptionDTO resumptionDTO) {
|
|
|
if (null == resumptionDTO.getOrgId()) {
|
|
|
resumptionDTO.setOrgId(SecurityUtils.getLoginUser().getOrgId());
|
|
|
@@ -148,6 +207,33 @@ public class ResumptionReportServiceImpl implements ResumptionReportService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
+ public void standbyPowerExport(ResumptionDTO resumptionDTO, HttpServletResponse response) throws IOException {
|
|
|
+ String orgName = null;
|
|
|
+ if (null != resumptionDTO.getOrgId()) {
|
|
|
+ SysOrg sysOrg = orgService.selectSysOrgById(resumptionDTO.getOrgId(), SecurityConstants.INNER);
|
|
|
+ orgName = sysOrg.getName();
|
|
|
+ }
|
|
|
+ List<IntrusionTestReportVO> report = this.standbyPower(resumptionDTO);
|
|
|
+ if (ObjectUtil.isEmpty(report)) {
|
|
|
+ throw new RuntimeException("导出数据为空!");
|
|
|
+ }
|
|
|
+ if (report.size() > 10000) {
|
|
|
+ throw new RuntimeException("导出数据量过大(单次导出限量10000条数据),请填写条件分批导出");
|
|
|
+ }
|
|
|
+ for (int i = 0; i < report.size(); i++) {
|
|
|
+ IntrusionTestReportVO intrusionTestReportVO = report.get(i);
|
|
|
+ intrusionTestReportVO.setOrderNum(i + 1);
|
|
|
+ }
|
|
|
+ response.setContentType("application/vnd.ms-excel");
|
|
|
+ response.setCharacterEncoding("utf-8");
|
|
|
+ String fileName = URLEncoder.encode("【" + orgName + "】-备用电源维护报表" + DateHelper.getDateString(new Date()), "UTF-8");
|
|
|
+ response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx");
|
|
|
+ // 调用EasyExcel的导出方法
|
|
|
+ EasyExcel.write(response.getOutputStream(), ResumptionDayVO.class).sheet("Sheet1").doWrite(report);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @Override
|
|
|
public List<IntrusionTestReportVO> serviceBank(ResumptionDTO resumptionDTO) {
|
|
|
if (null == resumptionDTO.getOrgId()) {
|
|
|
resumptionDTO.setOrgId(SecurityUtils.getLoginUser().getOrgId());
|
|
|
@@ -233,6 +319,32 @@ public class ResumptionReportServiceImpl implements ResumptionReportService {
|
|
|
return intrusionTestReportVOList;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public void serviceBankExport(ResumptionDTO resumptionDTO, HttpServletResponse response) throws IOException {
|
|
|
+ String orgName = null;
|
|
|
+ if (null != resumptionDTO.getOrgId()) {
|
|
|
+ SysOrg sysOrg = orgService.selectSysOrgById(resumptionDTO.getOrgId(), SecurityConstants.INNER);
|
|
|
+ orgName = sysOrg.getName();
|
|
|
+ }
|
|
|
+ List<IntrusionTestReportVO> report = this.serviceBank(resumptionDTO);
|
|
|
+ if (ObjectUtil.isEmpty(report)) {
|
|
|
+ throw new RuntimeException("导出数据为空!");
|
|
|
+ }
|
|
|
+ if (report.size() > 10000) {
|
|
|
+ throw new RuntimeException("导出数据量过大(单次导出限量10000条数据),请填写条件分批导出");
|
|
|
+ }
|
|
|
+ for (int i = 0; i < report.size(); i++) {
|
|
|
+ IntrusionTestReportVO intrusionTestReportVO = report.get(i);
|
|
|
+ intrusionTestReportVO.setOrderNum(i + 1);
|
|
|
+ }
|
|
|
+ response.setContentType("application/vnd.ms-excel");
|
|
|
+ response.setCharacterEncoding("utf-8");
|
|
|
+ String fileName = URLEncoder.encode("【" + orgName + "】-离行式自助银行巡检报表" + DateHelper.getDateString(new Date()), "UTF-8");
|
|
|
+ response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx");
|
|
|
+ // 调用EasyExcel的导出方法
|
|
|
+ EasyExcel.write(response.getOutputStream(), ResumptionDayVO.class).sheet("Sheet1").doWrite(report);
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
public String getLastDay(String datadate) throws Exception {
|
|
|
|