Browse Source

Merge remote-tracking branch 'origin/master20230901'

zhongwei
tyty 1 year ago
parent
commit
12eaea0c34
  1. 24
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/service/impl/OperPersonalMonthReportServiceImpl.java
  2. BIN
      hzims-service/operational/src/main/resources/files/运维月度报表-个人报表.xlsx

24
hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/service/impl/OperPersonalMonthReportServiceImpl.java

@ -7,15 +7,14 @@ import com.hnac.hzims.operational.access.service.IOperAccessTaskService;
import com.hnac.hzims.operational.defect.entity.OperPhenomenonEntity; import com.hnac.hzims.operational.defect.entity.OperPhenomenonEntity;
import com.hnac.hzims.operational.defect.service.IOperPhenomenonService; import com.hnac.hzims.operational.defect.service.IOperPhenomenonService;
import com.hnac.hzims.operational.duty.service.IImsDutyMainService; import com.hnac.hzims.operational.duty.service.IImsDutyMainService;
import com.hnac.hzims.operational.main.common.ExcelData;
import com.hnac.hzims.operational.main.vo.DutyPersonalReportVO; import com.hnac.hzims.operational.main.vo.DutyPersonalReportVO;
import com.hnac.hzims.operational.report.vo.PersonalMonthReportVO;
import com.hnac.hzims.operational.report.vo.PersonalMonthsReportVO;
import com.hnac.hzims.operational.maintenance.constants.MaintenanceConstant; import com.hnac.hzims.operational.maintenance.constants.MaintenanceConstant;
import com.hnac.hzims.operational.maintenance.entity.OperMaintenanceTaskEntity; import com.hnac.hzims.operational.maintenance.entity.OperMaintenanceTaskEntity;
import com.hnac.hzims.operational.maintenance.service.IOperMaintenanceTaskService; import com.hnac.hzims.operational.maintenance.service.IOperMaintenanceTaskService;
import com.hnac.hzims.operational.report.constants.ReportConstant; import com.hnac.hzims.operational.report.constants.ReportConstant;
import com.hnac.hzims.operational.report.service.IOperPersonalMonthReportService; import com.hnac.hzims.operational.report.service.IOperPersonalMonthReportService;
import com.hnac.hzims.operational.report.vo.PersonalMonthReportVO;
import com.hnac.hzims.operational.report.vo.PersonalMonthsReportVO;
import com.hnac.hzinfo.inspect.gather.entity.TaskGatherEntity; import com.hnac.hzinfo.inspect.gather.entity.TaskGatherEntity;
import com.hnac.hzinfo.inspect.gather.feign.IInspectGatherClient; import com.hnac.hzinfo.inspect.gather.feign.IInspectGatherClient;
import com.hnac.hzinfo.inspect.task.TaskContants; import com.hnac.hzinfo.inspect.task.TaskContants;
@ -28,6 +27,7 @@ import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.utils.CollectionUtil; import org.springblade.core.tool.utils.CollectionUtil;
import org.springblade.core.tool.utils.ObjectUtil; import org.springblade.core.tool.utils.ObjectUtil;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.core.io.ClassPathResource;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.web.context.request.RequestAttributes; import org.springframework.web.context.request.RequestAttributes;
import org.springframework.web.context.request.RequestContextHolder; import org.springframework.web.context.request.RequestContextHolder;
@ -36,10 +36,14 @@ import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.ServletOutputStream; import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.text.DateFormat; import java.text.DateFormat;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.time.*; import java.time.Duration;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.time.temporal.TemporalAdjusters; import java.time.temporal.TemporalAdjusters;
import java.util.*; import java.util.*;
@ -119,8 +123,14 @@ public class OperPersonalMonthReportServiceImpl implements IOperPersonalMonthRep
PersonalMonthReportVO personalMonthReportVO = this.getPersonalMonthReport(month, AuthUtil.getUserId()); PersonalMonthReportVO personalMonthReportVO = this.getPersonalMonthReport(month, AuthUtil.getUserId());
if(ObjectUtil.isNotEmpty(personalMonthReportVO)){ if(ObjectUtil.isNotEmpty(personalMonthReportVO)){
int currentRowNum = 0; int currentRowNum = 0;
ExcelData ed = new ExcelData(); XSSFWorkbook readWb = new XSSFWorkbook();
XSSFWorkbook readWb = ed.getWb(); try {
ClassPathResource classPathResource = new ClassPathResource("files/运维月度报表-个人报表.xlsx");
InputStream inputStream =classPathResource.getInputStream();
readWb = new XSSFWorkbook(inputStream);
} catch (Exception e) {
e.printStackTrace();
}
XSSFSheet readSheet = readWb.getSheet("个人月度报告"); XSSFSheet readSheet = readWb.getSheet("个人月度报告");
String title = Optional.ofNullable(personalMonthReportVO).map(PersonalMonthReportVO :: getStationName).orElse("")+month+"月个人月总结报告"; String title = Optional.ofNullable(personalMonthReportVO).map(PersonalMonthReportVO :: getStationName).orElse("")+month+"月个人月总结报告";
readSheet.getRow(currentRowNum).getCell(0).setCellValue(title); readSheet.getRow(currentRowNum).getCell(0).setCellValue(title);
@ -178,7 +188,7 @@ public class OperPersonalMonthReportServiceImpl implements IOperPersonalMonthRep
RequestAttributes requestAttributes = RequestContextHolder.currentRequestAttributes(); RequestAttributes requestAttributes = RequestContextHolder.currentRequestAttributes();
HttpServletResponse response = ((ServletRequestAttributes)requestAttributes).getResponse(); HttpServletResponse response = ((ServletRequestAttributes)requestAttributes).getResponse();
readWb.setSheetHidden(0,true); readWb.setSheetHidden(0,true);
readWb.setSheetHidden(1,true); // readWb.setSheetHidden(1,true);
String filename = "("+month+")个人月度报告"; String filename = "("+month+")个人月度报告";
// 设置头信息 // 设置头信息
response.setCharacterEncoding("UTF-8"); response.setCharacterEncoding("UTF-8");

BIN
hzims-service/operational/src/main/resources/files/运维月度报表-个人报表.xlsx

Binary file not shown.
Loading…
Cancel
Save