huanghongfa
2021-09-02 177249c76aeea0b4bf8d8816d4994e3b445b45ce
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/listen/ComMngBuildingExcelListen.java
@@ -1,5 +1,10 @@
package com.panzhihua.common.listen;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener;
import com.alibaba.fastjson.JSON;
@@ -12,12 +17,8 @@
import com.panzhihua.common.service.grid.GridService;
import com.panzhihua.common.utlis.Snowflake;
import com.panzhihua.common.utlis.StringUtils;
import lombok.extern.slf4j.Slf4j;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import lombok.extern.slf4j.Slf4j;
/**
 * @description: 社区楼栋导入监听
@@ -25,24 +26,17 @@
 */
@Slf4j
public class ComMngBuildingExcelListen extends AnalysisEventListener<Map<Integer, String>> {
    private CommunityService communityService;
    private GridService gridService;
    private Long communityId;
    private static final int BATCH_COUNT = 5000;
    private static int headSize = 0;
    List<Map<Integer, String>> list = new ArrayList<Map<Integer, String>>();
    private CommunityService communityService;
    private GridService gridService;
    private Long communityId;
    private Map<Integer, String> headData;
    public ComMngBuildingExcelListen(CommunityService communityService, Long communityId) {
        this.communityService = communityService;
        this.communityId = communityId;
    }
    private static final int BATCH_COUNT = 5000;
    List<Map<Integer, String>> list = new ArrayList<Map<Integer, String>>();
    @Override
    public void invoke(Map<Integer, String> data, AnalysisContext context) {
@@ -124,7 +118,6 @@
                        vo.setBuildFloorSum(0);
                    }
                    try {
                        vo.setEveryFloorSum(oneData.get(9) == null ? 0 : Integer.valueOf(oneData.get(9)));
                    } catch (Exception e1) {
@@ -159,7 +152,8 @@
                R r = communityService.listSaveBuildingExcelVO(voList, communityId);
                if (!R.isOk(r)) {
                    String errMsg = r.getMsg();
                    List<ComMngPopulationImportErrorVO> errorList = JSON.parseArray(errMsg, ComMngPopulationImportErrorVO.class);
                    List<ComMngPopulationImportErrorVO> errorList =
                        JSON.parseArray(errMsg, ComMngPopulationImportErrorVO.class);
                    if (!errorList.isEmpty()) {
                        populationImportErrorVOList.addAll(errorList);
                    }
@@ -172,7 +166,7 @@
            }
        }catch (NumberFormatException e){
        } catch (NumberFormatException e) {
            e.printStackTrace();
        }
    }