| | |
| | | import com.panzhihua.common.model.vos.LoginUserInfoVO; |
| | | import com.panzhihua.common.model.vos.R; |
| | | import com.panzhihua.common.model.vos.community.ComMngVillageServeExcelVO; |
| | | import com.panzhihua.common.model.vos.user.CommunityUserInfoVO; |
| | | import com.panzhihua.common.service.community.CommunityService; |
| | | import com.panzhihua.common.service.user.UserService; |
| | | import com.panzhihua.common.utlis.Snowflake; |
| | | |
| | | import lombok.extern.slf4j.Slf4j; |
| | |
| | | private static final int BATCH_COUNT = 100; |
| | | private CommunityService communityService; |
| | | private LoginUserInfoVO loginUserInfo; |
| | | private UserService userService; |
| | | private List<ComMngVillageServeExcelVO> list = new ArrayList<>(); |
| | | public ComMngVillageServeExcelListen(CommunityService communityService, LoginUserInfoVO loginUserInfo) { |
| | | public ComMngVillageServeExcelListen(CommunityService communityService, LoginUserInfoVO loginUserInfo, UserService userService) { |
| | | this.communityService = communityService; |
| | | this.loginUserInfo = loginUserInfo; |
| | | this.userService=userService; |
| | | } |
| | | |
| | | @Override |
| | |
| | | catch (Exception e){ |
| | | throw new ServiceException("门牌号只能为纯数字"); |
| | | } |
| | | comMngVillageServeExcelVO.setAddress("四川省-攀枝花市-"+loginUserInfo.getAreaName()+comMngVillageServeExcelVO.getAlley()+"+"+comMngVillageServeExcelVO.getHouseNum()); |
| | | R r1=userService.detailUser(loginUserInfo.getUserId()); |
| | | if(R.isOk(r1)){ |
| | | LoginUserInfoVO loginUserInfoVO=JSONObject.parseObject(JSONObject.toJSONString(r1.getData()), LoginUserInfoVO.class); |
| | | comMngVillageServeExcelVO.setAddress("四川省-攀枝花市-"+loginUserInfoVO.getAreaName()+comMngVillageServeExcelVO.getAlley()+"+"+comMngVillageServeExcelVO.getHouseNum()); |
| | | } |
| | | list.add(comMngVillageServeExcelVO); |
| | | // 达到BATCH_COUNT了,需要去存储一次数据库,防止数据几万条数据在内存,容易OOM |
| | | if (list.size() >= BATCH_COUNT) { |