|
@@ -4,18 +4,27 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
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.core.excel.utils.EasyPoiUtil;
|
|
|
import com.jeeplus.sys.constant.enums.LogTypeEnum;
|
|
|
+import com.jeeplus.sys.utils.DictUtils;
|
|
|
+import com.jeeplus.test.cw.projectReport.domain.CwProjectReportData;
|
|
|
import com.jeeplus.test.cw.reportCancellApplyArchived.service.ReportCancellApplyArchivedService;
|
|
|
import com.jeeplus.test.cw.reportCancellApplyArchived.service.dto.ApplyArchiveReportDTO;
|
|
|
import com.jeeplus.test.cw.reportCancellApplyArchived.service.dto.ArchivedReportInfoDto;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.http.ResponseEntity;
|
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
import javax.validation.Valid;
|
|
|
+import java.util.List;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* @author: 王强
|
|
@@ -90,4 +99,31 @@ public class ReportCancellApplyArchivedController {
|
|
|
public ApplyArchiveReportDTO findByContractInfoId(@RequestParam String id) {
|
|
|
return applyService.findByContractInfoId(id);
|
|
|
}
|
|
|
+ /**
|
|
|
+ * 导出分所报销数据
|
|
|
+ * @param cwProjectReportData
|
|
|
+ * @param page
|
|
|
+ * @param response
|
|
|
+ * @throws Exception
|
|
|
+ */
|
|
|
+ @ApiLog("导出报告作废归档数据信息")
|
|
|
+ @GetMapping("export")
|
|
|
+ @ApiOperation(value = "导出报告作废归档数据信息excel")
|
|
|
+ public void exportFile(ArchivedReportInfoDto cwProjectReportData, Page <ArchivedReportInfoDto> page, ExcelOptions options, HttpServletResponse response) throws Exception {
|
|
|
+ String fileName = options.getFilename ( );
|
|
|
+
|
|
|
+ List<ArchivedReportInfoDto> result;
|
|
|
+ if ( ExportMode.current.equals ( options.getMode ( ) ) ) {
|
|
|
+ result = applyService.getList ( page, cwProjectReportData ).getRecords();
|
|
|
+ } else if ( ExportMode.selected.equals ( options.getMode ( ) ) ) {
|
|
|
+ result = applyService.getList ( page, cwProjectReportData ).getRecords().stream ( ).filter ( info ->
|
|
|
+ options.getSelectIds ( ).contains ( info.getId ( ) )
|
|
|
+ ).collect ( Collectors.toList ( ) );
|
|
|
+ } else {
|
|
|
+ page.setSize ( -1 );
|
|
|
+ page.setCurrent ( 0 );
|
|
|
+ result = applyService.getList ( page, cwProjectReportData ).getRecords();
|
|
|
+ }
|
|
|
+ EasyPoiUtil.exportExcel ( result, "报告作废归档信息", options.getSheetName ( ), ArchivedReportInfoDto.class, fileName, response );
|
|
|
+ }
|
|
|
}
|