预警excel导出 数据与表格对应

This commit is contained in:
zhaokaiyao@91isoft.com
2021-12-10 15:38:41 +08:00
parent 13b5444e24
commit c783f40d41
7 changed files with 80 additions and 23 deletions
@@ -9,6 +9,7 @@ import com.adc.da.slrs.sarStandIssueControlProduct.entity.StandIssueControlProdu
import com.adc.da.slrs.sarStandWarning.entity.EarlyWarningEO;
import com.adc.da.slrs.sarStandWarning.entity.StandWarningEO;
import com.adc.da.slrs.sarStandWarning.entity.WarningExcelVO;
import com.adc.da.slrs.sarStandWarning.entity.WarningExportVO;
import com.adc.da.slrs.sarStandWarning.service.Impl.EarlyWarningEOServiceImpl;
import com.alibaba.excel.EasyExcel;
@@ -148,11 +149,11 @@ public class EarlyWarningEOController extends BaseController<EarlyWarningEO> {
response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + fileName + ".xlsx");
// List<StandWarningEO> exportExcel = earlyWarningEOService.getExportExcel(excelVO);
List<StandWarningEO> exportExcel = earlyWarningEOService.getExportExcel(excelVO);
List<WarningExportVO> exportExcel = earlyWarningEOService.getExportExcel(excelVO);
// 这里需要设置不关闭流
EasyExcel.write(response.getOutputStream(), StandWarningEO.class).autoCloseStream(Boolean.FALSE).sheet("sheet1")
EasyExcel.write(response.getOutputStream(), WarningExportVO.class).autoCloseStream(Boolean.FALSE).sheet("sheet1")
.doWrite(exportExcel);
} catch (Exception e) {
System.out.println(e);
@@ -3,6 +3,7 @@ package com.adc.da.slrs.sarStandWarning.dao;
import com.adc.da.slrs.sarStandWarning.entity.EarlyWarningEO;
import com.adc.da.slrs.sarStandWarning.entity.StandWarningEO;
import com.adc.da.slrs.sarStandWarning.entity.WarningExportVO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.apache.ibatis.annotations.Param;
@@ -14,6 +15,6 @@ public interface EarlyWarningEODao extends BaseMapper<EarlyWarningEO> {
IPage<StandWarningEO> selectWarningPage(IPage<StandWarningEO> page, @Param("waringEO") StandWarningEO warningEO);
List<StandWarningEO> exportWarning(@Param("idList") List<String> ids);
List<WarningExportVO> exportWarning(@Param("idList") List<String> ids);
}
@@ -47,17 +47,17 @@ public class EarlyWarningEO extends BaseEntity {
@TableField(exist = false)
private String standType;
@ExcelProperty("标准号")
@ExcelProperty(value = "标准号",index = 1)
@ApiModelProperty("标准号")
@TableField(exist = false)
private String standCode;
@ExcelProperty("标准名称")
@ExcelProperty(value = "标准名称",index = 2)
@ApiModelProperty("标准名称")
@TableField(exist = false)
private String standName;
@ExcelProperty("发布日期")
@ExcelProperty(value = "发布日期",index = 5)
@ApiModelProperty("发布日期")
@TableField(exist = false)
@DateTimeFormat(pattern="yyyy-MM-dd")
@@ -67,12 +67,12 @@ public class EarlyWarningEO extends BaseEntity {
@TableField(exist = false)
private Date lastTime;
@ExcelProperty("适用车型")
@ExcelIgnore
@ApiModelProperty("适用车型")
@TableField(exist = false)
private String applyType;
@ExcelProperty("责任工程师")
@ExcelIgnore
@ApiModelProperty("责任工程师")
@TableField(exist = false)
private String dutyEngineer;
@@ -82,12 +82,12 @@ public class EarlyWarningEO extends BaseEntity {
@TableField(exist = false)
private String itemsId;
@ExcelProperty("条款(分解单)编号")
@ExcelProperty(value = "条款(分解单)编号",index = 3)
@ApiModelProperty("条款(分解单)编号")
@TableField(exist = false)
private String itemsNum;
@ExcelProperty("条款(分解单)名称")
@ExcelProperty(value = "条款(分解单)名称",index = 4)
@ApiModelProperty("条款(分解单)名称")
@TableField(exist = false)
private String itemsName;
@@ -0,0 +1,35 @@
package com.adc.da.slrs.sarStandWarning.entity;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class WarningExportVO extends EarlyWarningEO {
@ExcelProperty(value = "实施日期",index = 6)
@ApiModelProperty("标准号")
private String SSRQ;
@ExcelProperty(value = "新车型实施日期",index = 7)
@ApiModelProperty("新车型实施日期")
private String XCXSSRQ;
@ExcelProperty(value = "在产车实施日期",index = 8)
@ApiModelProperty("在产车实施日期")
private String ZCCSSRQ;
@ExcelProperty(value = "标准类别",index = 0)
@ApiModelProperty("标准类别显示")
private String standTypeShow;
@ExcelProperty(value = "适用车型",index = 9)
@ApiModelProperty("适用车型展示")
private String applyTypeShow;
}
@@ -4,6 +4,7 @@ package com.adc.da.slrs.sarStandWarning.service;
import com.adc.da.slrs.sarStandWarning.entity.EarlyWarningEO;
import com.adc.da.slrs.sarStandWarning.entity.StandWarningEO;
import com.adc.da.slrs.sarStandWarning.entity.WarningExcelVO;
import com.adc.da.slrs.sarStandWarning.entity.WarningExportVO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
@@ -22,5 +23,5 @@ public interface EarlyWarningEOService extends IService<EarlyWarningEO> {
IPage<StandWarningEO> getStandWarning(StandWarningEO queryPage);
List<StandWarningEO> getExportExcel(WarningExcelVO excelVO);
List<WarningExportVO> getExportExcel(WarningExcelVO excelVO);
}
@@ -5,6 +5,7 @@ import com.adc.da.slrs.sarStandWarning.dao.EarlyWarningEODao;
import com.adc.da.slrs.sarStandWarning.entity.EarlyWarningEO;
import com.adc.da.slrs.sarStandWarning.entity.StandWarningEO;
import com.adc.da.slrs.sarStandWarning.entity.WarningExcelVO;
import com.adc.da.slrs.sarStandWarning.entity.WarningExportVO;
import com.adc.da.slrs.sarStandWarning.service.EarlyWarningEOService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -120,8 +121,8 @@ public class EarlyWarningEOServiceImpl extends ServiceImpl<EarlyWarningEODao, Ea
* @return
*/
@Override
public List<StandWarningEO> getExportExcel(WarningExcelVO excelVO){
List<StandWarningEO> standWarningEOList = earlyWarningEODao.exportWarning( excelVO.getIds());
public List<WarningExportVO> getExportExcel(WarningExcelVO excelVO){
List<WarningExportVO> standWarningEOList = earlyWarningEODao.exportWarning( excelVO.getIds());
// IPage<StandWarningEO> standWarningEOIPage = earlyWarningEODao.selectWarningPage(null, null, null);
return standWarningEOList;