springcloud_k8s_panzhihuazhihuishequ/applets_backstage/src/main/java/com/panzhihua/applets_backstage/api/CommunityConvenientApi.java
@@ -186,7 +186,7 @@ InputStream inputStream = null; try { inputStream = file.getInputStream(); EasyExcel.read(inputStream, ComCvtServeExcelVO.class, new ComCvtServeExcelListen(communityService)).sheet().doRead(); EasyExcel.read(inputStream, ComCvtServeExcelVO.class, new ComCvtServeExcelListen(communityService,null)).sheet().doRead(); } catch (IOException e) { e.printStackTrace(); log.error("导入模板失败【{}】", e.getMessage()); springcloud_k8s_panzhihuazhihuishequ/common/.gitignore
New file @@ -0,0 +1,34 @@ HELP.md target/ !.mvn/wrapper/maven-wrapper.jar !**/src/main/**/target/ !**/src/test/**/target/ ### STS ### .apt_generated .classpath .factorypath .project .settings .springBeans .sts4-cache ### IntelliJ IDEA ### .idea *.iws *.iml *.ipr ### NetBeans ### /nbproject/private/ /nbbuild/ /dist/ /nbdist/ /.nb-gradle/ build/ !**/src/main/**/build/ !**/src/test/**/build/ ### VS Code ### .vscode/ /.gitignore springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/listen/ComCvtServeExcelListen.java
@@ -22,9 +22,11 @@ private CommunityService communityService; private Long communityId; public ComCvtServeExcelListen(CommunityService communityService){ public ComCvtServeExcelListen(CommunityService communityService,Long communityId){ this.communityService = communityService; this.communityId = communityId; } @@ -36,7 +38,7 @@ // 达到BATCH_COUNT了,需要去存储一次数据库,防止数据几万条数据在内存,容易OOM if(list.size() >= BATCH_COUNT){ log.info("excel导入数据【{}】", JSONObject.toJSONString(list)); R r = this.communityService.listSaveConvenientServeExcelVO(list); R r = this.communityService.listSaveConvenientServeExcelVO(list,this.communityId); if (!R.isOk(r)) { throw new ServiceException(r.getMsg()); } @@ -48,7 +50,7 @@ @Override public void doAfterAllAnalysed(AnalysisContext analysisContext) { log.info("excel导入数据【{}】", JSONObject.toJSONString(list)); R r = this.communityService.listSaveConvenientServeExcelVO(list);//确保最后遗留的数据保存在数据库中 R r = this.communityService.listSaveConvenientServeExcelVO(list,this.communityId);//确保最后遗留的数据保存在数据库中 if (!R.isOk(r)) { throw new ServiceException(r.getMsg()); } springcloud_k8s_panzhihuazhihuishequ/community_backstage/src/main/java/com/panzhihua/community_backstage/api/CommunityConvenientApi.java
@@ -153,7 +153,7 @@ InputStream inputStream = null; try { inputStream = file.getInputStream(); EasyExcel.read(inputStream, ComCvtServeExcelVO.class, new ComCvtServeExcelListen(communityService)).sheet().doRead(); EasyExcel.read(inputStream, ComCvtServeExcelVO.class, new ComCvtServeExcelListen(communityService,this.getCommunityId())).sheet().doRead(); } catch (IOException e) { e.printStackTrace(); log.error("导入模板失败【{}】", e.getMessage());