|  |  | @ -3,9 +3,12 @@ package com.epmet.service.impl; | 
			
		
	
		
			
				
					|  |  |  | import cn.afterturn.easypoi.excel.entity.TemplateExportParams; | 
			
		
	
		
			
				
					|  |  |  | import com.baomidou.mybatisplus.core.metadata.IPage; | 
			
		
	
		
			
				
					|  |  |  | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.commons.tools.exception.EpmetErrorCode; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.commons.tools.exception.RenException; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.commons.tools.redis.common.CustomerStaffRedis; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.commons.tools.utils.ConvertUtils; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.commons.tools.utils.Result; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.dao.IcBuildingDao; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.dao.IcBuildingUnitDao; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.dao.IcHouseDao; | 
			
		
	
	
		
			
				
					|  |  | @ -21,6 +24,7 @@ import com.epmet.entity.IcHouseEntity; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.enums.HousePurposeEnums; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.enums.HouseRentFlagEnums; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.enums.HouseTypeEnums; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.excel.IcBuildingExcel; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.excel.IcHouseExcel; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.service.HouseService; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.service.IcBuildingService; | 
			
		
	
	
		
			
				
					|  |  | @ -119,10 +123,23 @@ public class HouseServiceImpl implements HouseService { | 
			
		
	
		
			
				
					|  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     @Override | 
			
		
	
		
			
				
					|  |  |  |     public void importExcel(String customerId, List<IcHouseExcel> list) { | 
			
		
	
		
			
				
					|  |  |  |     public Result importExcel(String customerId, List<IcHouseExcel> list, String staffId) { | 
			
		
	
		
			
				
					|  |  |  |         //2021.11.10 需求变更 当前工作人员只能导致自己所属组织下数据,对应不上的数据舍弃【注:需求就这样】 sun
 | 
			
		
	
		
			
				
					|  |  |  |         CustomerStaffInfoCacheResult staffInfoCache = CustomerStaffRedis.getStaffInfo(customerId, staffId); | 
			
		
	
		
			
				
					|  |  |  |         //组织名称不一样的数据舍弃
 | 
			
		
	
		
			
				
					|  |  |  |         Iterator<IcHouseExcel> iterator = list.iterator(); | 
			
		
	
		
			
				
					|  |  |  |         while (iterator.hasNext()) { | 
			
		
	
		
			
				
					|  |  |  |             IcHouseExcel obj = iterator.next(); | 
			
		
	
		
			
				
					|  |  |  |             if (!obj.getAgencyName().trim().equals(staffInfoCache.getAgencyName())) { | 
			
		
	
		
			
				
					|  |  |  |                 iterator.remove(); | 
			
		
	
		
			
				
					|  |  |  |             } | 
			
		
	
		
			
				
					|  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |         //用于存储匹配不上的数据给前端的提示 如南宁社区不存在
 | 
			
		
	
		
			
				
					|  |  |  |         StringBuffer str = new StringBuffer(""); | 
			
		
	
		
			
				
					|  |  |  |         //end sun
 | 
			
		
	
		
			
				
					|  |  |  |         //导入
 | 
			
		
	
		
			
				
					|  |  |  |         if(CollectionUtils.isEmpty(list)){ | 
			
		
	
		
			
				
					|  |  |  |             return ; | 
			
		
	
		
			
				
					|  |  |  |             return new Result(); | 
			
		
	
		
			
				
					|  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |         //获取所有小区 list
 | 
			
		
	
		
			
				
					|  |  |  | //        List<String> neighborNameList = list.stream().map(item -> item.getNeighborHoodName()).collect(Collectors.toList());
 | 
			
		
	
	
		
			
				
					|  |  | @ -155,7 +172,10 @@ public class HouseServiceImpl implements HouseService { | 
			
		
	
		
			
				
					|  |  |  |             entity.setBuildingId(String.valueOf(Optional.ofNullable(item).map(u->u.get("buildingId")).orElse(""))); | 
			
		
	
		
			
				
					|  |  |  |             entity.setBuildingUnitId(String.valueOf(Optional.ofNullable(item).map(u->u.get("buildingUnitId")).orElse(""))); | 
			
		
	
		
			
				
					|  |  |  |             entity.setHouseName(icHouseExcel.getBuildingName()+"-"+icHouseExcel.getBuildingUnit()+"-"+icHouseExcel.getDoorName()); | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |             if ("".equals(entity.getNeighborHoodId()) || "".equals(entity.getBuildingId()) || "".equals(entity.getBuildingUnitId())) { | 
			
		
	
		
			
				
					|  |  |  |                 str.append("".equals(str) ? icHouseExcel.getBuildingName() + icHouseExcel.getBuildingUnit() : str.append("、").append(icHouseExcel.getBuildingName() + icHouseExcel.getBuildingUnit())); | 
			
		
	
		
			
				
					|  |  |  |                 continue; | 
			
		
	
		
			
				
					|  |  |  |             } | 
			
		
	
		
			
				
					|  |  |  |             entity.setDoorName(icHouseExcel.getDoorName()); | 
			
		
	
		
			
				
					|  |  |  |             entity.setHouseType(HouseTypeEnums.getKeyByValue(icHouseExcel.getHouseType())); | 
			
		
	
		
			
				
					|  |  |  |             entity.setPurpose(HousePurposeEnums.getKeyByValue(icHouseExcel.getPurpose())); | 
			
		
	
	
		
			
				
					|  |  | @ -173,6 +193,11 @@ public class HouseServiceImpl implements HouseService { | 
			
		
	
		
			
				
					|  |  |  |         //3.保存
 | 
			
		
	
		
			
				
					|  |  |  |         icHouseService.insertBatch(houseEntityList); | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |         if(!"".equals(str)){ | 
			
		
	
		
			
				
					|  |  |  |             return new Result().error(9999, str.append("不存在").toString()); | 
			
		
	
		
			
				
					|  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |         return new Result(); | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     @Override | 
			
		
	
	
		
			
				
					|  |  | 
 |