|
@ -4,9 +4,11 @@ import cn.afterturn.easypoi.excel.entity.TemplateExportParams; |
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
|
|
|
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; |
|
|
import com.epmet.commons.tools.enums.OrgTypeEnum; |
|
|
import com.epmet.commons.tools.enums.OrgTypeEnum; |
|
|
import com.epmet.commons.tools.exception.EpmetErrorCode; |
|
|
import com.epmet.commons.tools.exception.EpmetErrorCode; |
|
|
import com.epmet.commons.tools.exception.RenException; |
|
|
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.ConvertUtils; |
|
|
import com.epmet.commons.tools.utils.Result; |
|
|
import com.epmet.commons.tools.utils.Result; |
|
|
import com.epmet.constant.NeighborhoodConstant; |
|
|
import com.epmet.constant.NeighborhoodConstant; |
|
@ -238,7 +240,19 @@ public class NeighborHoodServiceImpl implements NeighborHoodService { |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
public void importExcel(String customerId,List<IcNeighborHoodExcel> list) { |
|
|
public void importExcel(String customerId,List<IcNeighborHoodExcel> list,String staffId) { |
|
|
|
|
|
//2021.11.9 需求变更 当前工作人员只能导致自己所属组织下数据,网格名对应不上的数据舍弃【注:需求就这样】 sun
|
|
|
|
|
|
CustomerStaffInfoCacheResult staffInfoCache = CustomerStaffRedis.getStaffInfo(customerId, staffId); |
|
|
|
|
|
//组织名称不一样的数据舍弃
|
|
|
|
|
|
Iterator<IcNeighborHoodExcel> iterator = list.iterator(); |
|
|
|
|
|
while (iterator.hasNext()) { |
|
|
|
|
|
IcNeighborHoodExcel obj = iterator.next(); |
|
|
|
|
|
if (!obj.getAgencyName().trim().equals(staffInfoCache.getAgencyName())) { |
|
|
|
|
|
iterator.remove(); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
//end sun
|
|
|
|
|
|
|
|
|
//导入
|
|
|
//导入
|
|
|
if(CollectionUtils.isEmpty(list)){ |
|
|
if(CollectionUtils.isEmpty(list)){ |
|
|
return ; |
|
|
return ; |
|
@ -274,10 +288,14 @@ public class NeighborHoodServiceImpl implements NeighborHoodService { |
|
|
entity.setCustomerId(customerId); |
|
|
entity.setCustomerId(customerId); |
|
|
entity.setNeighborHoodName(icNeighborHoodExcel.getNeighborHoodName()); |
|
|
entity.setNeighborHoodName(icNeighborHoodExcel.getNeighborHoodName()); |
|
|
|
|
|
|
|
|
entity.setAgencyId(Optional.ofNullable(agencyMap.get(icNeighborHoodExcel.getAgencyName())).map(u->u.getId()).orElse("")); // agencyMap.get(icNeighborHoodExcel.getAgencyName()).getId());
|
|
|
entity.setAgencyId(Optional.ofNullable(agencyMap.get(icNeighborHoodExcel.getAgencyName().trim())).map(u->u.getId()).orElse("")); // agencyMap.get(icNeighborHoodExcel.getAgencyName()).getId());
|
|
|
entity.setParentAgencyId(Optional.ofNullable(agencyMap.get(icNeighborHoodExcel.getAgencyName())).map(u->u.getPid()).orElse(""));//agencyMap.get(icNeighborHoodExcel.getAgencyName()).getPid()
|
|
|
entity.setParentAgencyId(Optional.ofNullable(agencyMap.get(icNeighborHoodExcel.getAgencyName().trim())).map(u->u.getPid()).orElse(""));//agencyMap.get(icNeighborHoodExcel.getAgencyName()).getPid()
|
|
|
entity.setAgencyPids(Optional.ofNullable(agencyMap.get(icNeighborHoodExcel.getAgencyName())).map(u->u.getPids()).orElse(""));//agencyMap.get(icNeighborHoodExcel.getAgencyName()).getPids()
|
|
|
entity.setAgencyPids(Optional.ofNullable(agencyMap.get(icNeighborHoodExcel.getAgencyName().trim())).map(u->u.getPids()).orElse(""));//agencyMap.get(icNeighborHoodExcel.getAgencyName()).getPids()
|
|
|
entity.setGridId(Optional.ofNullable(gridMap.get(icNeighborHoodExcel.getGridName())).map(u->u.getId()).orElse(""));//gridMap.get(icNeighborHoodExcel.getGridName()).getId()
|
|
|
entity.setGridId(Optional.ofNullable(gridMap.get(icNeighborHoodExcel.getGridName().trim())).map(u->u.getId()).orElse(""));//gridMap.get(icNeighborHoodExcel.getGridName()).getId()
|
|
|
|
|
|
//网格名对应不上的数据舍弃
|
|
|
|
|
|
if ("".equals(entity.getGridId())) { |
|
|
|
|
|
continue; |
|
|
|
|
|
} |
|
|
entity.setAddress(icNeighborHoodExcel.getAddress()); |
|
|
entity.setAddress(icNeighborHoodExcel.getAddress()); |
|
|
entity.setRemark(icNeighborHoodExcel.getRemark()); |
|
|
entity.setRemark(icNeighborHoodExcel.getRemark()); |
|
|
neighborHoodEntityList.add(entity); |
|
|
neighborHoodEntityList.add(entity); |
|
|