|
|
@ -8,7 +8,6 @@ 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; |
|
|
@ -24,7 +23,6 @@ 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; |
|
|
@ -123,7 +121,8 @@ public class HouseServiceImpl implements HouseService { |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public Result importExcel(String customerId, List<IcHouseExcel> list, String staffId) { |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public List<Integer> importExcel(String customerId, List<IcHouseExcel> list, String staffId, List<Integer> numList) { |
|
|
|
//2021.11.10 需求变更 当前工作人员只能导致自己所属组织下数据,对应不上的数据舍弃【注:需求就这样】 sun
|
|
|
|
CustomerStaffInfoCacheResult staffInfoCache = CustomerStaffRedis.getStaffInfo(customerId, staffId); |
|
|
|
//组织名称不一样的数据舍弃
|
|
|
@ -131,15 +130,16 @@ public class HouseServiceImpl implements HouseService { |
|
|
|
while (iterator.hasNext()) { |
|
|
|
IcHouseExcel obj = iterator.next(); |
|
|
|
if (!obj.getAgencyName().trim().equals(staffInfoCache.getAgencyName())) { |
|
|
|
numList.add(obj.getRowNum()); |
|
|
|
iterator.remove(); |
|
|
|
} |
|
|
|
} |
|
|
|
//用于存储匹配不上的数据给前端的提示 如南宁社区不存在
|
|
|
|
StringBuffer str = new StringBuffer(""); |
|
|
|
//StringBuffer str = new StringBuffer("");
|
|
|
|
//end sun
|
|
|
|
//导入
|
|
|
|
if(CollectionUtils.isEmpty(list)){ |
|
|
|
return new Result(); |
|
|
|
return numList; |
|
|
|
} |
|
|
|
//获取所有小区 list
|
|
|
|
// List<String> neighborNameList = list.stream().map(item -> item.getNeighborHoodName()).collect(Collectors.toList());
|
|
|
@ -173,7 +173,8 @@ public class HouseServiceImpl implements HouseService { |
|
|
|
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())); |
|
|
|
//str.append("".equals(str) ? icHouseExcel.getBuildingName() + icHouseExcel.getBuildingUnit() : str.append("、").append(icHouseExcel.getBuildingName() + icHouseExcel.getBuildingUnit()));
|
|
|
|
numList.add(icHouseExcel.getRowNum()); |
|
|
|
continue; |
|
|
|
} |
|
|
|
entity.setDoorName(icHouseExcel.getDoorName()); |
|
|
@ -193,10 +194,10 @@ public class HouseServiceImpl implements HouseService { |
|
|
|
//3.保存
|
|
|
|
icHouseService.insertBatch(houseEntityList); |
|
|
|
|
|
|
|
if(!"".equals(str)){ |
|
|
|
/*if(!"".equals(str)){ |
|
|
|
return new Result().error(9999, str.append("不存在").toString()); |
|
|
|
} |
|
|
|
return new Result(); |
|
|
|
}*/ |
|
|
|
return numList; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|