Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

当单元格换行的时候只能取到最后一行数据 #521

Closed
linavaos opened this issue Sep 2, 2019 · 1 comment
Closed

当单元格换行的时候只能取到最后一行数据 #521

linavaos opened this issue Sep 2, 2019 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@linavaos
Copy link

linavaos commented Sep 2, 2019

触发场景描述
单元格换行,测试数据如下
1.依次输入表头信息客户、业务员、仓库、付款方式(现结)、送货员、交易日期、备注
2.依次输入小包商品、大中小包商品、大小包商品
3.输入优惠金额、预收款金额
4.保存->审核
触发Bug的代码

    public int importCaseDoc(MultipartFile file) throws IOException {

        ExcelReader excelReader = EasyExcel.read(file.getInputStream(), Case.class, new AnalysisEventListener<Case>() {

            private final int BATCH_COUNT =1000;
            //用来存储excel中的用例
            List<Case> castList =  new ArrayList<Case>();
            //创建时间任务调用时就是创建时间,这样同一批次导入的时间一致方便处理
            Date nowTime=new Date();
            @Override
            public void invoke(Case caseobj, AnalysisContext analysisContext) {
                System.out.println(caseobj);
                caseobj.setCreateTime(nowTime);
                castList.add(caseobj);
                if(castList.size()>=BATCH_COUNT) {
                    saveData();
                    castList.clear();
                }
            }
            @Override
            public void doAfterAllAnalysed(AnalysisContext analysisContext) {
                System.out.println("最后几行");
                saveData();
            }


            private  int saveData(){
                return  caseDesignMapper.insertCase(castList);
            }

        }).build();

        ReadSheet readSheet = EasyExcel.readSheet(0).build();
        excelReader.read(readSheet);

        return 0;
    }

提示的异常或者没有达到的效果

image

@linavaos linavaos added the bug Something isn't working label Sep 2, 2019
@zhuangjiaju
Copy link
Collaborator

非常感谢您的意见。该问题已经在最新版本修复。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants