|
@@ -6,6 +6,10 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.jeeplus.aop.demo.annotation.DemoMode;
|
|
|
import com.jeeplus.aop.logging.annotation.ApiLog;
|
|
|
import com.jeeplus.common.utils.ResponseUtil;
|
|
|
+import com.jeeplus.core.excel.ExcelOptions;
|
|
|
+import com.jeeplus.core.excel.ExportMode;
|
|
|
+import com.jeeplus.sys.constant.enums.LogTypeEnum;
|
|
|
+import com.jeeplus.test.finance.invoice.service.dto.FinanceInvoiceDTO;
|
|
|
import com.jeeplus.test.utils.FreemarkerUtil;
|
|
|
import freemarker.template.Configuration;
|
|
|
import freemarker.template.Template;
|
|
@@ -33,9 +37,11 @@ import javax.servlet.http.HttpServletResponse;
|
|
|
import java.io.File;
|
|
|
import java.io.IOException;
|
|
|
import java.io.InputStream;
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
@Api(tags ="项目列表管理")
|
|
|
@RestController
|
|
@@ -244,27 +250,33 @@ public class ProjectListController {
|
|
|
return ResponseEntity.ok (list);
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 导出
|
|
|
- *
|
|
|
- * @param response
|
|
|
- * @throws Exception
|
|
|
- */
|
|
|
- @GetMapping("/exportFile")
|
|
|
- @ApiOperation(value = "导出")
|
|
|
- public void exportFileUploadList(ProgramProjectListInfo info,String tabType, HttpServletResponse response) throws Exception{
|
|
|
- List<ExportFileDto> infos = projectListService.exportList(info,tabType);
|
|
|
- String title = "项目登记列表信息";
|
|
|
- String sheetName = "项目登记列表信息";
|
|
|
- if("2022".equals(tabType)){
|
|
|
- title = "2022年" + title;
|
|
|
- sheetName = "2022年" + sheetName;
|
|
|
+
|
|
|
+ @ApiLog(value = "导出项目信息", type = LogTypeEnum.EXPORT)
|
|
|
+ @GetMapping("exportFile")
|
|
|
+ @ApiOperation(value = "导出项目信息")
|
|
|
+ public void exportFile(ProgramProjectListInfo info, Page <ProgramProjectListInfo> page, ExcelOptions options, HttpServletResponse response) throws Exception {
|
|
|
+ String fileName = options.getFilename();
|
|
|
+ String sheetName = options.getSheetName();
|
|
|
+ List<ProgramProjectListInfo> result = new ArrayList<>();
|
|
|
+ if ( ExportMode.current.equals ( options.getMode() ) ) {
|
|
|
+ result = projectListService.list (page,info,"1").getRecords();
|
|
|
+ } else if (ExportMode.selected.equals ( options.getMode() )) {
|
|
|
+ result = projectListService.list (page,info,"1").getRecords().stream ( ).filter ( item ->
|
|
|
+ options.getSelectIds ( ).contains ( item.getId ( ) )
|
|
|
+ ).collect ( Collectors.toList ( ) );
|
|
|
+ } else {
|
|
|
+ page.setSize (-1);
|
|
|
+ page.setCurrent (0);
|
|
|
+ result = projectListService.list (page,info,"1").getRecords();
|
|
|
}
|
|
|
- EasyPoiUtil.exportExcel(infos, title, sheetName, ExportFileDto.class, "", response );
|
|
|
+ List<ExportFileDto> exportFileDtos = projectListService.exportList(result);
|
|
|
+ EasyPoiUtil.exportExcel ( exportFileDtos, sheetName, sheetName, ExportFileDto.class, fileName, response );
|
|
|
+
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
+
|
|
|
/**
|
|
|
* 根据项目id生成报告号
|
|
|
* @param id
|