|
|
@ -36,6 +36,7 @@ import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.apache.poi.ss.usermodel.Workbook; |
|
|
|
import org.jetbrains.annotations.NotNull; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.core.io.ClassPathResource; |
|
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
@ -246,11 +247,11 @@ public class ScreenProjectController { |
|
|
|
* @date 2021/11/4 3:38 下午 |
|
|
|
*/ |
|
|
|
@PostMapping("selectcategoryprojectlist/export") |
|
|
|
public void selectProjectCategoryExport(@RequestBody CategoryProjectListFormDTO formDTO, @LoginUser TokenDto tokenDto, HttpServletResponse response) throws Exception { |
|
|
|
public void selectProjectCategoryExport(@RequestBody CategoryProjectListFormDTO formDTO, /*@LoginUser*/ TokenDto tokenDto, HttpServletResponse response) throws Exception { |
|
|
|
ExcelWriter excelWriter = null; |
|
|
|
try { |
|
|
|
//tokenDto.setUserId("36bc0fb38565ecdebf8ab9b476b44548");
|
|
|
|
//tokenDto.setCustomerId("45687aa479955f9d06204d415238f7cc");
|
|
|
|
tokenDto.setUserId("36bc0fb38565ecdebf8ab9b476b44548"); |
|
|
|
tokenDto.setCustomerId("45687aa479955f9d06204d415238f7cc"); |
|
|
|
|
|
|
|
formDTO.setIsPage(false); |
|
|
|
ValidatorUtils.validateEntity(formDTO, ProjectCategoryFormDTO.CategoryProjectExportForm.class); |
|
|
@ -264,8 +265,11 @@ public class ScreenProjectController { |
|
|
|
mapData.put("categoryName", formDTO.getParentCategoryName().concat(StrConstant.HYPHEN).concat(formDTO.getCategoryName())); |
|
|
|
} |
|
|
|
|
|
|
|
String templatePath = "/excel/project_temp_easy_excel.xlsx"; |
|
|
|
String template = this.getClass().getResource(templatePath).getPath(); |
|
|
|
String templatePath = "excel/project_temp_easy_excel.xlsx"; |
|
|
|
ClassPathResource classPathResource = new ClassPathResource(templatePath); |
|
|
|
String template = classPathResource.getPath(); |
|
|
|
|
|
|
|
//String template = this.getClass().getResource(templatePath).getPath();
|
|
|
|
String fileName = "项目统计.xlsx"; |
|
|
|
excelWriter = EasyExcel.write(ExcelUtils.getOutputStream(fileName, response)).withTemplate(template).build(); |
|
|
|
WriteSheet writeSheet = EasyExcel.writerSheet().build(); |
|
|
|