| | |
| | | public R matExcelImport(MultipartFile file) throws IOException { |
| | | MatExcelListener listener = new MatExcelListener(getUserId()); |
| | | EasyExcel.read(file.getInputStream(), MatExcel.class, listener).sheet().doRead(); |
| | | return R.ok("成功同步"+listener.getTotal()+"条商品数据"); |
| | | return R.ok("成功同步"+listener.getTotal()+"条商品数据,更新" + listener.getCount() + "条商品数据"); |
| | | } |
| | | |
| | | /*************************************** xm-select ***********************************************/ |
| | |
| | | |
| | | private int total = 0; |
| | | private Long userId; |
| | | private int count; |
| | | |
| | | public MatExcelListener() { |
| | | } |
| | |
| | | if (!matService.insert(mat)) { |
| | | throw new CoolException("保存商品档案失败,商品编码:" + excel.getMatnr()); |
| | | } |
| | | count++; |
| | | } |
| | | } |
| | | |
| | |
| | | public int getTotal() { |
| | | return total; |
| | | } |
| | | |
| | | public int getCount() { |
| | | return count; |
| | | } |
| | | } |