| 
						
						
							
								
							
						
						
					 | 
					@ -44,6 +44,7 @@ import org.springframework.transaction.annotation.Transactional; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import java.util.*; | 
					 | 
					 | 
					import java.util.*; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import java.util.concurrent.atomic.AtomicReference; | 
					 | 
					 | 
					import java.util.concurrent.atomic.AtomicReference; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					import java.util.stream.Collectors; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import static com.epmet.commons.tools.utils.DateUtils.DATE_PATTERN; | 
					 | 
					 | 
					import static com.epmet.commons.tools.utils.DateUtils.DATE_PATTERN; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					@ -120,6 +121,7 @@ public class IcCommunitySelfOrganizationServiceImpl extends BaseServiceImpl<IcCo | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					     * @author zxc | 
					 | 
					 | 
					     * @author zxc | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					     * @date 2021/11/19 8:33 上午 | 
					 | 
					 | 
					     * @date 2021/11/19 8:33 上午 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					     */ | 
					 | 
					 | 
					     */ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					    @Transactional(rollbackFor = Exception.class) | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    @Override | 
					 | 
					 | 
					    @Override | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    public void addCommunitySelfOrganization(TokenDto tokenDto, AddCommunitySelfOrganizationFormDTO formDTO) { | 
					 | 
					 | 
					    public void addCommunitySelfOrganization(TokenDto tokenDto, AddCommunitySelfOrganizationFormDTO formDTO) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        String customerId = tokenDto.getCustomerId(); | 
					 | 
					 | 
					        String customerId = tokenDto.getCustomerId(); | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					@ -139,6 +141,7 @@ public class IcCommunitySelfOrganizationServiceImpl extends BaseServiceImpl<IcCo | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        orgEntity.setCustomerId(customerId); | 
					 | 
					 | 
					        orgEntity.setCustomerId(customerId); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        orgEntity.setOrgId(staffInfo.getAgencyId()); | 
					 | 
					 | 
					        orgEntity.setOrgId(staffInfo.getAgencyId()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        orgEntity.setOrgType(IcCommunitySelfOrganizationConstant.ORG_TYPE_AGENCY); | 
					 | 
					 | 
					        orgEntity.setOrgType(IcCommunitySelfOrganizationConstant.ORG_TYPE_AGENCY); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        orgEntity.setOrganizationCreatedTime(DateUtils.parse(formDTO.getOrganizationCreatedTime(), DATE_PATTERN)); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        AgencyInfoCache agencyInfo = CustomerOrgRedis.getAgencyInfo(staffInfo.getAgencyId()); | 
					 | 
					 | 
					        AgencyInfoCache agencyInfo = CustomerOrgRedis.getAgencyInfo(staffInfo.getAgencyId()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        if (null == agencyInfo){ | 
					 | 
					 | 
					        if (null == agencyInfo){ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            throw new RenException(String.format("查询组织信息失败%s",staffInfo.getAgencyId())); | 
					 | 
					 | 
					            throw new RenException(String.format("查询组织信息失败%s",staffInfo.getAgencyId())); | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					@ -155,6 +158,22 @@ public class IcCommunitySelfOrganizationServiceImpl extends BaseServiceImpl<IcCo | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        baseDao.insert(orgEntity); | 
					 | 
					 | 
					        baseDao.insert(orgEntity); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        if(CollectionUtils.isNotEmpty(formDTO.getOrganizationPersonnel())){ | 
					 | 
					 | 
					        if(CollectionUtils.isNotEmpty(formDTO.getOrganizationPersonnel())){ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            List<IcCommunitySelfOrganizationPersonnelEntity> persons = ConvertUtils.sourceToTarget(formDTO.getOrganizationPersonnel(), IcCommunitySelfOrganizationPersonnelEntity.class); | 
					 | 
					 | 
					            List<IcCommunitySelfOrganizationPersonnelEntity> persons = ConvertUtils.sourceToTarget(formDTO.getOrganizationPersonnel(), IcCommunitySelfOrganizationPersonnelEntity.class); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            Map<String, List<IcCommunitySelfOrganizationPersonnelEntity>> groupPhone = persons.stream().collect(Collectors.groupingBy(IcCommunitySelfOrganizationPersonnelEntity::getPersonPhone)); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            List<String> phones = new ArrayList<>(); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            groupPhone.forEach((k,v) -> { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                if (v.size() > NumConstant.ONE){ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                    phones.add(k); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            }); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            if (CollectionUtils.isNotEmpty(phones)){ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                StringBuffer sb = new StringBuffer(); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                phones.forEach(p -> { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                    sb.append(p).append(","); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                }); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                String copywriter = sb.toString().substring(NumConstant.ZERO, sb.length() - NumConstant.ONE); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                EpmetErrorCode.EXISTS_SAME_PHONE_ERROR.setMsg(String.format(EpmetErrorCode.EXISTS_SAME_PHONE_ERROR.getMsg(),copywriter)); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                throw new RenException(EpmetErrorCode.EXISTS_SAME_PHONE_ERROR.getCode()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            persons.forEach(p -> { | 
					 | 
					 | 
					            persons.forEach(p -> { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                p.setCustomerId(customerId); | 
					 | 
					 | 
					                p.setCustomerId(customerId); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                p.setOrgId(orgEntity.getId()); | 
					 | 
					 | 
					                p.setOrgId(orgEntity.getId()); | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					@ -171,6 +190,7 @@ public class IcCommunitySelfOrganizationServiceImpl extends BaseServiceImpl<IcCo | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					     * @author zxc | 
					 | 
					 | 
					     * @author zxc | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					     * @date 2021/11/19 10:12 上午 | 
					 | 
					 | 
					     * @date 2021/11/19 10:12 上午 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					     */ | 
					 | 
					 | 
					     */ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					    @Transactional(rollbackFor = Exception.class) | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    @Override | 
					 | 
					 | 
					    @Override | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    public void editCommunitySelfOrganization(TokenDto tokenDto, EditCommunitySelfOrganizationFormDTO formDTO) { | 
					 | 
					 | 
					    public void editCommunitySelfOrganization(TokenDto tokenDto, EditCommunitySelfOrganizationFormDTO formDTO) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        LambdaQueryWrapper<IcCommunitySelfOrganizationEntity> l = new LambdaQueryWrapper<>(); | 
					 | 
					 | 
					        LambdaQueryWrapper<IcCommunitySelfOrganizationEntity> l = new LambdaQueryWrapper<>(); | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					@ -189,6 +209,22 @@ public class IcCommunitySelfOrganizationServiceImpl extends BaseServiceImpl<IcCo | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        personnelService.deleteByOrgId(formDTO.getOrgId()); | 
					 | 
					 | 
					        personnelService.deleteByOrgId(formDTO.getOrgId()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        if (CollectionUtils.isNotEmpty(formDTO.getOrganizationPersonnel())){ | 
					 | 
					 | 
					        if (CollectionUtils.isNotEmpty(formDTO.getOrganizationPersonnel())){ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            List<IcCommunitySelfOrganizationPersonnelEntity> persons = ConvertUtils.sourceToTarget(formDTO.getOrganizationPersonnel(), IcCommunitySelfOrganizationPersonnelEntity.class); | 
					 | 
					 | 
					            List<IcCommunitySelfOrganizationPersonnelEntity> persons = ConvertUtils.sourceToTarget(formDTO.getOrganizationPersonnel(), IcCommunitySelfOrganizationPersonnelEntity.class); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            Map<String, List<IcCommunitySelfOrganizationPersonnelEntity>> groupPhone = persons.stream().collect(Collectors.groupingBy(IcCommunitySelfOrganizationPersonnelEntity::getPersonPhone)); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            List<String> phones = new ArrayList<>(); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            groupPhone.forEach((k,v) -> { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                if (v.size() > NumConstant.ONE){ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                    phones.add(k); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            }); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            if (CollectionUtils.isNotEmpty(phones)){ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                StringBuffer sb = new StringBuffer(); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                phones.forEach(p -> { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                    sb.append(p).append(","); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                }); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                String copywriter = sb.toString().substring(NumConstant.ZERO, sb.length() - NumConstant.ONE); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                EpmetErrorCode.EXISTS_SAME_PHONE_ERROR.setMsg(String.format(EpmetErrorCode.EXISTS_SAME_PHONE_ERROR.getMsg(),copywriter)); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                throw new RenException(EpmetErrorCode.EXISTS_SAME_PHONE_ERROR.getCode()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            persons.forEach(p -> { | 
					 | 
					 | 
					            persons.forEach(p -> { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                p.setOrgId(formDTO.getOrgId()); | 
					 | 
					 | 
					                p.setOrgId(formDTO.getOrgId()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                p.setCustomerId(tokenDto.getCustomerId()); | 
					 | 
					 | 
					                p.setCustomerId(tokenDto.getCustomerId()); | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					@ -245,6 +281,7 @@ public class IcCommunitySelfOrganizationServiceImpl extends BaseServiceImpl<IcCo | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					     * @author zxc | 
					 | 
					 | 
					     * @author zxc | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					     * @date 2021/11/19 4:22 下午 | 
					 | 
					 | 
					     * @date 2021/11/19 4:22 下午 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					     */ | 
					 | 
					 | 
					     */ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					    @Transactional(rollbackFor = Exception.class) | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    @Override | 
					 | 
					 | 
					    @Override | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    public void delCommunitySelfOrganization(DelCommunitySelfOrganizationFormDTO formDTO) { | 
					 | 
					 | 
					    public void delCommunitySelfOrganization(DelCommunitySelfOrganizationFormDTO formDTO) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        baseDao.deleteById(formDTO.getOrgId()); | 
					 | 
					 | 
					        baseDao.deleteById(formDTO.getOrgId()); | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
					
  |