excel 模板导出

        <dependency>
            <groupId>com.alibaba</groupId>
            <artifactId>easyexcel</artifactId>
        </dependency>
/**
     * 导出年检费用模板
     */
    @SneakyThrows
    @GetMapping("/exportInputAnnualSurvey")
    @Operation(summary = "导出年检费用模板")
    public void exportInputAnnualSurvey(HttpServletResponse response) {
        List<InputAnnualSurveyVo> list = new ArrayList<>();
        response.setContentType("application/vnd.ms-excel");
        response.setCharacterEncoding(Charsets.UTF_8.name());
        String fileName = URLEncoder.encode("年检费用", Charsets.UTF_8.name());
        response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xls");
        EasyExcel.write(response.getOutputStream(), InputAnnualSurveyVo.class).sheet("年检费用表").doWrite(list);
    }
import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.afterturn.easypoi.handler.inter.IExcelDataModel;
import cn.afterturn.easypoi.handler.inter.IExcelModel;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.alibaba.excel.annotation.write.style.ContentRowHeight;
import com.alibaba.excel.annotation.write.style.HeadRowHeight;
import com.gitee.sunchenbin.mybatis.actable.annotation.Column;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.time.LocalDateTime;

/**
 * Author:  shx
 * Date: 2022/12/2 11:10
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@ColumnWidth(25)
@HeadRowHeight(20)
@ContentRowHeight(18)
@ExcelIgnoreUnannotated
public class InputAnnualSurveyVo implements IExcelDataModel, IExcelModel {
    @Excel(name = "车牌号码", width = 10)
    @ColumnWidth(15)
    @ExcelProperty("车牌号码")
    private String hostNo;

    @Excel(name = "供应商名称", width = 10)
    @ColumnWidth(15)
    @ExcelProperty("供应商名称")
    private String providerName;

    @Excel(name = "本次年检日期", format = "yyyy-MM-dd HH:mm:ss", width = 10)
    @ColumnWidth(15)
    @ExcelProperty("本次年检日期")
    private LocalDateTime surveyDate;

    @Excel(name = "下次年检时间", format = "yyyy-MM-dd HH:mm:ss", width = 10)
    @ColumnWidth(15)
    @ExcelProperty("下次年检时间")
    private LocalDateTime nextInspectionDate;

    @Excel(name = "检验有效期截止", format = "yyyy-MM-dd HH:mm:ss", width = 10)
    @ColumnWidth(15)
    @ExcelProperty("检验有效期截止")
    private LocalDateTime efficaciousDate;

    @Excel(name = "年检费用", width = 10)
    @ColumnWidth(15)
    @ExcelProperty("年检费用")
    private Double surveyCost;

    @Excel(name = "合计", width = 10)
    @ColumnWidth(15)
    @ExcelProperty("合计")
    private Double costSum;

    @Excel(name = "经办人", width = 10)
    @ColumnWidth(15)
    @ExcelProperty("经办人")
    private String operate;

    @Column(comment = "备注")
    @ColumnWidth(15)
    @ExcelProperty("备注")
    private String remark;

    /**
     * 行号
     */
    private Integer rowNum;

    /**
     * 错误消息
     */
    private String errorMsg;
}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

司小白

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值