Browse Source

报告作废导出

sangwenwei 1 year ago
parent
commit
2ee681dcc8

+ 50 - 0
jeeplus-modules/jeeplus-finance/src/main/java/com/jeeplus/finance/reportCancellApply/controller/ReportCancellApplyController.java

@@ -1,22 +1,31 @@
 package com.jeeplus.finance.reportCancellApply.controller;
 
 import cn.hutool.core.util.ObjectUtil;
+import cn.hutool.extra.spring.SpringUtil;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.jeeplus.common.excel.ExcelOptions;
+import com.jeeplus.common.excel.annotation.ExportMode;
 import com.jeeplus.common.utils.ResponseUtil;
+import com.jeeplus.finance.invoice.util.EasyPoiUtil;
 import com.jeeplus.finance.projectReport.domain.CwProjectReportData;
 import com.jeeplus.finance.reportCancellApply.service.ReportCancellApplyService;
 import com.jeeplus.finance.reportCancellApply.service.dto.ReportInfoDto;
 import com.jeeplus.logging.annotation.ApiLog;
 import com.jeeplus.logging.constant.enums.LogTypeEnum;
+import com.jeeplus.sys.feign.IDictApi;
 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: 王强
@@ -116,4 +125,45 @@ public class ReportCancellApplyController {
         CwProjectReportData projectReportData = applyService.queryByNo ( no );
         return ResponseEntity.ok(projectReportData);
     }
+
+
+    /**
+     * 导出报告报废数据
+     * @param reportInfoDto
+     * @param page
+     * @param response
+     * @throws Exception
+     */
+    @ApiLog("导出报告作废数据信息")
+    @GetMapping("export")
+    @ApiOperation(value = "导出报告作废数据信息excel")
+    public void exportFile(ReportInfoDto reportInfoDto, Page <ReportInfoDto> page, ExcelOptions options, HttpServletResponse response) throws Exception {
+        String fileName = options.getFilename ( );
+
+        List<ReportInfoDto> result;
+        if ( ExportMode.current.equals ( options.getMode ( ) ) ) {
+            result = applyService.getList ( page, reportInfoDto ).getRecords();
+        } else if ( ExportMode.selected.equals ( options.getMode ( ) ) ) {
+            result = applyService.getList ( page, reportInfoDto ).getRecords().stream ( ).filter ( info ->
+                    options.getSelectIds ( ).contains ( info.getId ( ) )
+            ).collect ( Collectors.toList ( ) );
+        } else {
+            page.setSize ( -1 );
+            page.setCurrent ( 0 );
+            result = applyService.getList ( page, reportInfoDto ).getRecords();
+        }
+        if(result.size()>0){
+            for (ReportInfoDto info : result) {
+                if(StringUtils.isNotBlank(info.getStatus())){
+                    info.setLabelStatus(SpringUtil.getBean ( IDictApi.class ).getDictLabel(info.getStatus(), "cw_status", ""));
+                }
+                info.setProjectNo("");
+            }
+        }
+
+        EasyPoiUtil.exportExcel ( result, "报告作废信息",  options.getSheetName ( ), ReportInfoDto.class, fileName, response );
+    }
+
+
+
 }

+ 2 - 2
jeeplus-modules/jeeplus-finance/src/main/java/com/jeeplus/finance/reportCancellApply/mapper/xml/ReportCancellApplyMapper.xml

@@ -55,7 +55,7 @@
         SELECT
         DISTINCT a.id,
         a.create_by_id as createById,
-        a.create_time,
+        a.create_time as "createDateT",
         a.update_by_id,
         a.update_time,
         a.del_flag,
@@ -67,7 +67,7 @@
 				c.document_no,
 				c.office_id,
 				d.project_number as projectNumber,
-				d.project_name,
+				d.project_name ,
 				d.project_master_id,
 				e.name as departmentName,
 				f.name as userName,

+ 30 - 0
jeeplus-modules/jeeplus-finance/src/main/java/com/jeeplus/finance/reportCancellApply/service/dto/ReportInfoDto.java

@@ -1,6 +1,8 @@
 package com.jeeplus.finance.reportCancellApply.service.dto;
 
+import cn.afterturn.easypoi.excel.annotation.Excel;
 import com.baomidou.mybatisplus.annotation.TableField;
+import com.fasterxml.jackson.annotation.JsonFormat;
 import com.jeeplus.core.service.dto.BaseDTO;
 import com.jeeplus.finance.projectReport.domain.CwProjectReportData;
 import lombok.Data;
@@ -22,31 +24,38 @@ public class ReportInfoDto extends BaseDTO {
     /**
      * 项目编号
      */
+    @Excel(name = "项目编号",width = 25,orderNum = "2")
     private String projectNumber;
 
     /**
      * 创建人
      */
+    @Excel(name = "创建人",width = 25,orderNum = "9")
     private String userName;
 
+
     /**
      * 报告所属部门
      */
+    @Excel(name = "报告所属部门",width = 25,orderNum = "5")
     private String departmentName;
 
     /**
      * 报告文号
      */
+    @Excel(name = "报告号",width = 25,orderNum = "1")
     private String reportNo;
 
     /**
      * 项目名称
      */
+    @Excel(name = "项目名称",width = 25,orderNum = "3")
     private String projectName;
 
     /**
      * 报告主办人
      */
+    @Excel(name = "报告主办人",width = 25,orderNum = "8")
     private String reportSponsor;
 
     /**
@@ -57,6 +66,7 @@ public class ReportInfoDto extends BaseDTO {
     /**
      * 报告申请单号
      */
+    @Excel(name = "单据编号",width = 25,orderNum = "0")
     private String documentNo;
 
     /**
@@ -67,6 +77,7 @@ public class ReportInfoDto extends BaseDTO {
     /**
      * 项目经理姓名
      */
+    @Excel(name = "项目经理姓名",width = 25,orderNum = "6")
     private String projectMasterName;
 
     /**
@@ -83,8 +94,18 @@ public class ReportInfoDto extends BaseDTO {
     /**
      * 状态
      */
+
+    @Excel(name = "状态",width = 25,orderNum = "11",dict = "cw_status")
     private String status;
 
+//    @Excel(name = "状态",width = 25,orderNum = "11",dict = "cw_status")
+    private String labelStatus;
+    /**
+     * 创建时间
+     */
+    @Excel(name = "创建时间",exportFormat = "yyyy-MM-dd HH:mm:ss",width = 25,orderNum = "10")
+    private String createDateT;
+
     /**
      * 流程id
      */
@@ -125,6 +146,7 @@ public class ReportInfoDto extends BaseDTO {
      * 项目经理2name
      */
     @TableField(exist = false)
+    @Excel(name = "项目经理2姓名",width = 25,orderNum = "7")
     private String projectMaster2Name;
 
     /**
@@ -141,4 +163,12 @@ public class ReportInfoDto extends BaseDTO {
      * 报告详情
      */
     private CwProjectReportData reportDetail;
+
+    /**
+     * 报告号
+     */
+    @Excel(name = "报告号",width = 25,orderNum = "4")
+    private String projectNo;
+
+
 }