| | |
| | | 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; |
| | |
| | | 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: 社区楼栋导入监听 |
| | |
| | | */ |
| | | @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) { |
| | |
| | | vo.setBuildFloorSum(0); |
| | | } |
| | | |
| | | |
| | | try { |
| | | vo.setEveryFloorSum(oneData.get(9) == null ? 0 : Integer.valueOf(oneData.get(9))); |
| | | } catch (Exception e1) { |
| | |
| | | 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); |
| | | } |
| | |
| | | |
| | | } |
| | | |
| | | }catch (NumberFormatException e){ |
| | | } catch (NumberFormatException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |