| 
						
						
							
								
							
						
						
					 | 
					@ -27,6 +27,7 @@ import com.epmet.commons.tools.constant.StrConstant; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; | 
					 | 
					 | 
					import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.commons.tools.enums.DictTypeEnum; | 
					 | 
					 | 
					import com.epmet.commons.tools.enums.DictTypeEnum; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.commons.tools.enums.PartyUnitTypeEnum; | 
					 | 
					 | 
					import com.epmet.commons.tools.enums.PartyUnitTypeEnum; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					import com.epmet.commons.tools.exception.EpmetErrorCode; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.commons.tools.exception.EpmetException; | 
					 | 
					 | 
					import com.epmet.commons.tools.exception.EpmetException; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.commons.tools.page.PageData; | 
					 | 
					 | 
					import com.epmet.commons.tools.page.PageData; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.commons.tools.redis.common.CustomerStaffRedis; | 
					 | 
					 | 
					import com.epmet.commons.tools.redis.common.CustomerStaffRedis; | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					@ -36,7 +37,6 @@ import com.epmet.commons.tools.utils.ExcelPoiUtils; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.commons.tools.utils.Result; | 
					 | 
					 | 
					import com.epmet.commons.tools.utils.Result; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.dao.IcPartyUnitDao; | 
					 | 
					 | 
					import com.epmet.dao.IcPartyUnitDao; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.dto.IcPartyUnitDTO; | 
					 | 
					 | 
					import com.epmet.dto.IcPartyUnitDTO; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.dto.form.GridOptionFormDTO; | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.dto.form.PartyUnitFormDTO; | 
					 | 
					 | 
					import com.epmet.dto.form.PartyUnitFormDTO; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.dto.form.demand.ServiceQueryFormDTO; | 
					 | 
					 | 
					import com.epmet.dto.form.demand.ServiceQueryFormDTO; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.dto.form.demand.SubCodeFormDTO; | 
					 | 
					 | 
					import com.epmet.dto.form.demand.SubCodeFormDTO; | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					@ -169,9 +169,19 @@ public class IcPartyUnitServiceImpl extends BaseServiceImpl<IcPartyUnitDao, IcPa | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        if (CollectionUtils.isNotEmpty(dto.getServiceMatterList())) { | 
					 | 
					 | 
					        if (CollectionUtils.isNotEmpty(dto.getServiceMatterList())) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            entity.setServiceMatter(StringUtils.join(dto.getServiceMatterList(), StrConstant.COMMA)); | 
					 | 
					 | 
					            entity.setServiceMatter(StringUtils.join(dto.getServiceMatterList(), StrConstant.COMMA)); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        } | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        LambdaQueryWrapper<IcPartyUnitEntity> wrapper = new LambdaQueryWrapper<>(); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        wrapper.eq(IcPartyUnitEntity::getAgencyId, entity.getAgencyId()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        wrapper.eq(IcPartyUnitEntity::getUnitName, entity.getUnitName()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        List<IcPartyUnitEntity> list = baseDao.selectList(wrapper); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        if(StringUtils.isBlank(entity.getId())) { | 
					 | 
					 | 
					        if(StringUtils.isBlank(entity.getId())) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            if (CollectionUtils.isNotEmpty(list)) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                throw new EpmetException(EpmetErrorCode.PARTY_UNIT_NAME_EXITED.getCode(), EpmetErrorCode.PARTY_UNIT_NAME_EXITED.getMsg(), EpmetErrorCode.PARTY_UNIT_NAME_EXITED.getMsg()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            insert(entity); | 
					 | 
					 | 
					            insert(entity); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        } else { | 
					 | 
					 | 
					        } else { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            if (CollectionUtils.isNotEmpty(list) && list.get(0).getId().equals(entity.getId())) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                throw new EpmetException(EpmetErrorCode.PARTY_UNIT_NAME_EXITED.getCode(), EpmetErrorCode.PARTY_UNIT_NAME_EXITED.getMsg(), EpmetErrorCode.PARTY_UNIT_NAME_EXITED.getMsg()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            updateById(entity); | 
					 | 
					 | 
					            updateById(entity); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        } | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    } | 
					 | 
					 | 
					    } | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					@ -266,19 +276,59 @@ public class IcPartyUnitServiceImpl extends BaseServiceImpl<IcPartyUnitDao, IcPa | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        List<IcPartyUnitImportExcel> result = importResult.getList(); | 
					 | 
					 | 
					        List<IcPartyUnitImportExcel> result = importResult.getList(); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        CustomerStaffInfoCacheResult staffInfoCache = CustomerStaffRedis.getStaffInfo(tokenDto.getCustomerId(), tokenDto.getUserId()); | 
					 | 
					 | 
					        CustomerStaffInfoCacheResult staffInfoCache = CustomerStaffRedis.getStaffInfo(tokenDto.getCustomerId(), tokenDto.getUserId()); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					        //获取组织下网格信息
 | 
					 | 
					 | 
					        if (null == staffInfoCache) { | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					        GridOptionFormDTO formDTO = new GridOptionFormDTO(); | 
					 | 
					 | 
					            throw new EpmetException(8000, "获取用户缓存失败"); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					        formDTO.setAgencyId(staffInfoCache.getAgencyId()); | 
					 | 
					 | 
					        } | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					        //1.数据校验 只允许导入当前组织下的网格的数据
 | 
					 | 
					 | 
					        SubCodeFormDTO codeFormDTO = new SubCodeFormDTO(); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					        //网格名称不一样的数据舍弃
 | 
					 | 
					 | 
					        codeFormDTO.setCustomerId(tokenDto.getCustomerId()); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        codeFormDTO.setParentCategoryCode("1010"); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        Map<String, String> categoryMap = icResiDemandDictService.querySubCodeList(codeFormDTO).stream().collect(Collectors.toMap(OptionDTO::getLabel, OptionDTO::getValue)); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        //1.数据校验
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        Iterator<IcPartyUnitImportExcel> iterator = result.iterator(); | 
					 | 
					 | 
					        Iterator<IcPartyUnitImportExcel> iterator = result.iterator(); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        while (iterator.hasNext()) { | 
					 | 
					 | 
					        while (iterator.hasNext()) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            IcPartyUnitImportExcel obj = iterator.next(); | 
					 | 
					 | 
					            IcPartyUnitImportExcel obj = iterator.next(); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            //单位名称不能为空,不可重复
 | 
					 | 
					 | 
					            //单位名称不能为空,不可重复
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					            if (StringUtils.isBlank(obj.getUnitName().trim())) { | 
					 | 
					 | 
					            if (StringUtils.isBlank(obj.getUnitName())) { | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					                numList.add(obj.getRowNum()); | 
					 | 
					 | 
					                numList.add(obj.getRowNum()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                log.warn(String.format("单位名称为空,行号->%s", obj.getRowNum())); | 
					 | 
					 | 
					                log.warn(String.format("单位名称为空,行号->%s", obj.getRowNum())); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                iterator.remove(); | 
					 | 
					 | 
					                iterator.remove(); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            } else { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                LambdaQueryWrapper<IcPartyUnitEntity> wrapper = new LambdaQueryWrapper<>(); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                wrapper.eq(IcPartyUnitEntity::getAgencyId, staffInfoCache.getAgencyId()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                wrapper.eq(IcPartyUnitEntity::getUnitName, obj.getUnitName()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                List<IcPartyUnitEntity> list = baseDao.selectList(wrapper); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                if (CollectionUtils.isNotEmpty(list)) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                    numList.add(obj.getRowNum()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                    log.warn(String.format("单位名称已存在,行号->%s", obj.getRowNum())); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                    iterator.remove(); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            //分类校验
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            if (StringUtils.isBlank(obj.getType()) || null == PartyUnitTypeEnum.getCode(obj.getType())) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                numList.add(obj.getRowNum()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                log.warn(String.format("分类名不存在,行号->%s", obj.getRowNum())); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                iterator.remove(); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            //服务事项校验
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            if (StringUtils.isNotBlank(obj.getServiceMatter())) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                List<String> matters = Arrays.asList(obj.getServiceMatter().split(StrConstant.COLON)); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                matters.forEach(item -> { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                    if (null == categoryMap.get(item)) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                        numList.add(obj.getRowNum()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                        log.warn(String.format("服务事项不存在,行号->%s", obj.getRowNum())); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                        iterator.remove(); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                    } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                }); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            //联系人	联系电话	在职党员	地址	中心位置经度	中心位置纬度 校验
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            if (StringUtils.isBlank(obj.getContact()) || StringUtils.isBlank(obj.getContactMobile()) || | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                    StringUtils.isBlank(obj.getContact()) || | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                    null == obj.getMemberCount() || | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                    StringUtils.isBlank(obj.getLatitude()) || | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                    StringUtils.isBlank(obj.getLongitude())) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                numList.add(obj.getRowNum()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                log.warn(String.format("联系人、联系电话、在职党员、地址、中心位置经度、中心位置纬度为空,行号->%s", obj.getRowNum())); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                iterator.remove(); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            } | 
					 | 
					 | 
					            } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        } | 
					 | 
					 | 
					        } | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					@ -287,10 +337,7 @@ public class IcPartyUnitServiceImpl extends BaseServiceImpl<IcPartyUnitDao, IcPa | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            String subList = numList.stream().map(String::valueOf).collect(Collectors.joining("、")); | 
					 | 
					 | 
					            String subList = numList.stream().map(String::valueOf).collect(Collectors.joining("、")); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            return new Result().error(9999, "第" + subList + "行未成功!"); | 
					 | 
					 | 
					            return new Result().error(9999, "第" + subList + "行未成功!"); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        } | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					        SubCodeFormDTO codeFormDTO = new SubCodeFormDTO(); | 
					 | 
					 | 
					
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					 | 
					 | 
					        codeFormDTO.setCustomerId(tokenDto.getCustomerId()); | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        codeFormDTO.setParentCategoryCode("1010"); | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        Map<String, String> categoryMap = icResiDemandDictService.querySubCodeList(codeFormDTO).stream().collect(Collectors.toMap(OptionDTO::getLabel, OptionDTO::getValue)); | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					        List<IcPartyUnitEntity> list = result.stream().map(item -> { | 
					 | 
					 | 
					        List<IcPartyUnitEntity> list = result.stream().map(item -> { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            IcPartyUnitEntity entity = new IcPartyUnitEntity(); | 
					 | 
					 | 
					            IcPartyUnitEntity entity = new IcPartyUnitEntity(); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            entity.setCustomerId(tokenDto.getCustomerId()); | 
					 | 
					 | 
					            entity.setCustomerId(tokenDto.getCustomerId()); | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
					
  |