| 
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -20,6 +20,7 @@ package com.epmet.modules.group.service.impl; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.baomidou.mybatisplus.core.metadata.IPage; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.commons.tools.constant.EpmetRoleKeyConstant; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.commons.tools.constant.FieldConstant; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.commons.tools.constant.NumConstant; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.commons.tools.exception.EpmetErrorCode; | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -29,6 +30,8 @@ import com.epmet.commons.tools.utils.ConvertUtils; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.commons.tools.utils.Result; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.dto.UserResiInfoDTO; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.dto.form.UserResiInfoFormDTO; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.dto.form.UserRoleFormDTO; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.dto.result.UserRoleResultDTO; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.modules.feign.EpmetUserFeignClient; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.modules.group.dao.ResiGroupDao; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.modules.group.entity.ResiGroupEntity; | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -51,6 +54,8 @@ import com.epmet.resi.group.dto.group.result.RecommendGroupResultDTO; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.resi.group.dto.member.GroupMemeberOperationDTO; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.resi.group.dto.member.ResiGroupMemberDTO; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import org.apache.commons.lang3.StringUtils; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import org.slf4j.Logger; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import org.slf4j.LoggerFactory; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import org.springframework.beans.factory.annotation.Autowired; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import org.springframework.stereotype.Service; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import org.springframework.transaction.annotation.Transactional; | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -67,7 +72,7 @@ import java.util.Map; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					 */ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					@Service | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					public class ResiGroupServiceImpl extends BaseServiceImpl<ResiGroupDao, ResiGroupEntity> implements ResiGroupService { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						private Logger logger = LoggerFactory.getLogger(getClass()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						@Autowired | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						private ResiGroupRedis resiGroupRedis; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -221,9 +226,11 @@ public class ResiGroupServiceImpl extends BaseServiceImpl<ResiGroupDao, ResiGrou | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								return new Result<GroupSummarizeResultDTO>().error(ModuleConstant.GETGROUPSUMMARIZE_FAILED); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							//获取组长信息
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							Result<UserResiInfoDTO> groupLeaderUserInfo=this.getGroupLeaderUserInfo(groupSummarizeFormDTO.getGroupId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							Result<UserResiInfoDTO> groupLeaderUserInfo = this.getGroupLeaderUserInfo(groupSummarizeFormDTO.getGroupId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							if (groupLeaderUserInfo.success() && null != groupLeaderUserInfo.getData()) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								groupSummarizeResultDTO.setLeaderName(groupLeaderUserInfo.getData().getShowName()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							} else { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								logger.info("组长注册信息查询失败" + groupLeaderUserInfo.getMsg()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							return new Result<GroupSummarizeResultDTO>().ok(groupSummarizeResultDTO); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						} | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -261,12 +268,12 @@ public class ResiGroupServiceImpl extends BaseServiceImpl<ResiGroupDao, ResiGrou | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						@Override | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						public Result applyCreateGroup(ApplyCreateGroupFormDTO applyCreateGroupFormDTO) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							//1、校验是否同名
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							List<ResiGroupEntity> resiGroupEntityList=this.getResiGroupEntityList(applyCreateGroupFormDTO); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							if(null!=resiGroupEntityList&&resiGroupEntityList.size()>0){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								Result result=new Result(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								result.setCode(EpmetErrorCode.GROUP_ALREADY_EXISTED.getValue()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								result.setMsg(EpmetErrorCode.GROUP_ALREADY_EXISTED.getName()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								return result; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							List<ResiGroupEntity> resiGroupEntityList = this.getResiGroupEntityList(applyCreateGroupFormDTO); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							if (null != resiGroupEntityList && resiGroupEntityList.size() > 0) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								Result errorResult = new Result(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								errorResult.setCode(EpmetErrorCode.GROUP_ALREADY_EXISTED.getValue()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								errorResult.setMsg(EpmetErrorCode.GROUP_ALREADY_EXISTED.getName()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								return errorResult; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							//2、插入一条待审核的组信息
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							ResiGroupEntity resiGroupEntity = this.structureResiGroupEntity(applyCreateGroupFormDTO); | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -331,9 +338,10 @@ public class ResiGroupServiceImpl extends BaseServiceImpl<ResiGroupDao, ResiGrou | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							Result<UserResiInfoDTO> result = epmetUserFeignClient.getUserResiInfoDTO(resiUserInfoFormDTO); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							if (!result.success() || null == result.getData() || StringUtils.isBlank(result.getData().getRegMobile())) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								Result errorResult=new Result(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								result.setCode(EpmetErrorCode.CANNOT_JOIN_GROUP.getValue()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								result.setMsg(EpmetErrorCode.CANNOT_JOIN_GROUP.getName()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								logger.info("居民注册信息查询失败"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								Result errorResult = new Result(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								errorResult.setCode(EpmetErrorCode.CANNOT_JOIN_GROUP.getValue()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								errorResult.setMsg(EpmetErrorCode.CANNOT_JOIN_GROUP.getName()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								return errorResult; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							return new Result(); | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -367,7 +375,47 @@ public class ResiGroupServiceImpl extends BaseServiceImpl<ResiGroupDao, ResiGrou | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							if (null == tokenDto || StringUtils.isBlank(tokenDto.getUserId())) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								return new Result().error(ModuleConstant.USER_NOT_NULL); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							boolean flag = this.checkPartyMemberOrWarmHeated(tokenDto.getApp(), tokenDto.getUserId(), customerId); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							if (!flag) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								Result errorResult = new Result(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								errorResult.setCode(EpmetErrorCode.CANNOT_CREATE_GROUP.getValue()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								errorResult.setMsg(EpmetErrorCode.CANNOT_CREATE_GROUP.getName()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								return errorResult; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							return new Result(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							return null; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						/** | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						 * @param app | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						 * @param userId | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						 * @param customerId | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						 * @return boolean | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						 * @Author yinzuomei | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						 * @Description 用户拥有党员或者热心居民标签返回true, 没有权限返回false | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						 * @Date 2020/3/30 16:33 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						 **/ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						private boolean checkPartyMemberOrWarmHeated(String app, String userId, String customerId) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							boolean flag = false; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							UserRoleFormDTO userRoleFormDTO = new UserRoleFormDTO(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							userRoleFormDTO.setApp(app); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							userRoleFormDTO.setCustomerId(customerId); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							userRoleFormDTO.setUserId(userId); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							Result<List<UserRoleResultDTO>> userRoleListResult = epmetUserFeignClient.getUserRoleInfo(userRoleFormDTO); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							if (!userRoleListResult.success()) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								logger.info("获取用户角色feign调用失败" + userRoleListResult.getMsg()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								return flag; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							List<UserRoleResultDTO> userRoleList = userRoleListResult.getData(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							if (null == userRoleList || userRoleList.size() == 0) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								return flag; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							for (UserRoleResultDTO userRoleResultDTO : userRoleList) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								if (EpmetRoleKeyConstant.PARTYMEMBER.equals(userRoleResultDTO.getRoleKey()) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
										|| EpmetRoleKeyConstant.WARMHEARTED.equals(userRoleResultDTO.getRoleKey())) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
									flag = true; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
									break; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							return flag; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					} | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
					 | 
				
				 | 
				
					
  |