|
|
|
|
@ -28,6 +28,7 @@ import org.springblade.modules.system.service.IDeptService; |
|
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
|
|
import java.io.IOException; |
|
|
|
|
import java.io.InputStream; |
|
|
|
|
import java.util.*; |
|
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
|
|
@ -46,7 +47,8 @@ public class MaintenancePlanDetailServiceImpl extends BaseServiceImpl<Maintenanc |
|
|
|
|
@Override |
|
|
|
|
public void maintenancePlanReport(MaintenancePlan maintenancePlan, HttpServletResponse response) throws IOException { |
|
|
|
|
//数据获取
|
|
|
|
|
String templateFile = "./src/main/resources/excel/MaintenancePlanReport.xlsx"; |
|
|
|
|
String filename = "MaintenancePlanReport.xlsx"; |
|
|
|
|
InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream("excel" + "/" + filename); |
|
|
|
|
FillConfig fillConfig = FillConfig.builder().forceNewRow(Boolean.TRUE).build(); |
|
|
|
|
List<MaintenancePlanDetail> maintenancePlanDetailsList = baseMapper.selectList(Wrappers.lambdaQuery(MaintenancePlanDetail.class).eq(MaintenancePlanDetail::getPlanId, maintenancePlan.getId())); |
|
|
|
|
List<DeviceVO> deviceVOList = new ArrayList<>(); |
|
|
|
|
@ -108,7 +110,7 @@ public class MaintenancePlanDetailServiceImpl extends BaseServiceImpl<Maintenanc |
|
|
|
|
int tableNo = 0; |
|
|
|
|
//导出到Excel中
|
|
|
|
|
ServletOutputStream outputStream = response.getOutputStream(); |
|
|
|
|
try (ExcelWriter excelWriter = EasyExcel.write(outputStream).withTemplate(templateFile).build()) { |
|
|
|
|
try (ExcelWriter excelWriter = EasyExcel.write(outputStream).withTemplate(inputStream).build()) { |
|
|
|
|
WriteSheet firstSheet = EasyExcel.writerSheet(0).build(); |
|
|
|
|
WriteSheet secondSheet = EasyExcel |
|
|
|
|
.writerSheet(1) |
|
|
|
|
|