From 68d8b72a646b4022e8a842f153ba9475e74803bc Mon Sep 17 00:00:00 2001 From: DESKTOP-71BH0QO\L、ming <172680469@qq.com> Date: 星期一, 29 三月 2021 16:23:41 +0800 Subject: [PATCH] ADD:实有房屋相关接口 --- springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/listen/ComCvtServeExcelListen.java | 12 +++++++----- 1 files changed, 7 insertions(+), 5 deletions(-) diff --git a/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/listen/ComCvtServeExcelListen.java b/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/listen/ComCvtServeExcelListen.java index 37fadc6..376a991 100644 --- a/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/listen/ComCvtServeExcelListen.java +++ b/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/listen/ComCvtServeExcelListen.java @@ -24,7 +24,7 @@ private Long communityId; - public ComCvtServeExcelListen(CommunityService communityService,Long communityId){ + public ComCvtServeExcelListen(CommunityService communityService, Long communityId) { this.communityService = communityService; this.communityId = communityId; } @@ -32,17 +32,19 @@ private static final int BATCH_COUNT = 100; private List<ComCvtServeExcelVO> list = new ArrayList<>(); + @Override public void invoke(ComCvtServeExcelVO comCvtServeExcelVO, AnalysisContext analysisContext) { list.add(comCvtServeExcelVO); // 达到BATCH_COUNT了,需要去存储一次数据库,防止数据几万条数据在内存,容易OOM - if(list.size() >= BATCH_COUNT){ + if (list.size() >= BATCH_COUNT) { log.info("excel导入数据【{}】", JSONObject.toJSONString(list)); - R r = this.communityService.listSaveConvenientServeExcelVO(list,this.communityId); + R r = this.communityService.listSaveConvenientServeExcelVO(list, this.communityId); if (!R.isOk(r)) { throw new ServiceException(r.getMsg()); } - list.clear(); //清空list + //清空list + list.clear(); } } @@ -50,7 +52,7 @@ @Override public void doAfterAllAnalysed(AnalysisContext analysisContext) { log.info("excel导入数据【{}】", JSONObject.toJSONString(list)); - R r = this.communityService.listSaveConvenientServeExcelVO(list,this.communityId);//确保最后遗留的数据保存在数据库中 + R r = this.communityService.listSaveConvenientServeExcelVO(list, this.communityId);//确保最后遗留的数据保存在数据库中 if (!R.isOk(r)) { throw new ServiceException(r.getMsg()); } -- Gitblit v1.7.1