| | |
| | | @Override |
| | | public void invoke(ComSwRotaExcelVO comSwRotaExcelVO, AnalysisContext analysisContext) { |
| | | list.add(comSwRotaExcelVO); |
| | | if (list.size() == 0) { |
| | | throw new ServiceException("500", "导入数据为空!"); |
| | | } |
| | | // 达到BATCH_COUNT了,需要去存储一次数据库,防止数据几万条数据在内存,容易OOM |
| | | if(list.size() >= BATCH_COUNT){ |
| | | log.info("excel导入数据【{}】", JSONObject.toJSONString(list)); |
| | |
| | | @Override |
| | | public void doAfterAllAnalysed(AnalysisContext analysisContext) { |
| | | log.info("excel导入数据【{}】", JSONObject.toJSONString(list)); |
| | | if (list.size() == 0) { |
| | | throw new ServiceException("500", "导入数据为空!"); |
| | | } |
| | | R r = this.communityService.listSaveSwRotaExcelVO(list,this.communityId);//确保最后遗留的数据保存在数据库中 |
| | | if (!R.isOk(r)) { |
| | | throw new ServiceException(r.getMsg()); |