| 
						
						
							
								
							
						
						
					 | 
					@ -4,20 +4,28 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.baomidou.mybatisplus.core.metadata.IPage; | 
					 | 
					 | 
					import com.baomidou.mybatisplus.core.metadata.IPage; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; | 
					 | 
					 | 
					import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.commons.tools.constant.FieldConstant; | 
					 | 
					 | 
					import com.epmet.commons.tools.constant.FieldConstant; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					import com.epmet.commons.tools.constant.NumConstant; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.commons.tools.exception.RenException; | 
					 | 
					 | 
					import com.epmet.commons.tools.exception.RenException; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.commons.tools.page.PageData; | 
					 | 
					 | 
					import com.epmet.commons.tools.page.PageData; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.commons.tools.security.dto.TokenDto; | 
					 | 
					 | 
					import com.epmet.commons.tools.security.dto.TokenDto; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.commons.tools.utils.ConvertUtils; | 
					 | 
					 | 
					import com.epmet.commons.tools.utils.ConvertUtils; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					import com.epmet.modules.member.dao.GroupMemeberOperationDao; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					import com.epmet.modules.member.dao.ResiGroupMemberDao; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.modules.topic.dao.TopicShareLinkRecordDao; | 
					 | 
					 | 
					import com.epmet.modules.topic.dao.TopicShareLinkRecordDao; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					import com.epmet.modules.topic.dao.TopicShareLinkVisitRecordDao; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.modules.topic.entity.TopicShareLinkRecordEntity; | 
					 | 
					 | 
					import com.epmet.modules.topic.entity.TopicShareLinkRecordEntity; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					import com.epmet.modules.topic.entity.TopicShareLinkVisitRecordEntity; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.modules.topic.service.TopicShareLinkRecordService; | 
					 | 
					 | 
					import com.epmet.modules.topic.service.TopicShareLinkRecordService; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.resi.group.constant.TopicShareConstant; | 
					 | 
					 | 
					import com.epmet.resi.group.constant.TopicShareConstant; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.resi.group.dto.topic.TopicShareLinkRecordDTO; | 
					 | 
					 | 
					import com.epmet.resi.group.dto.topic.TopicShareLinkRecordDTO; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.resi.group.dto.topic.form.CreateUrlFormDTO; | 
					 | 
					 | 
					import com.epmet.resi.group.dto.topic.form.CreateUrlFormDTO; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.resi.group.dto.topic.form.TopicBelongGroupFormDTO; | 
					 | 
					 | 
					import com.epmet.resi.group.dto.topic.form.TopicBelongGroupFormDTO; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					import com.epmet.resi.group.dto.topic.form.TopicVisitFormDTO; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.resi.group.dto.topic.result.CreateUrlResultDTO; | 
					 | 
					 | 
					import com.epmet.resi.group.dto.topic.result.CreateUrlResultDTO; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.resi.group.dto.topic.result.TopicBelongGroupResultDTO; | 
					 | 
					 | 
					import com.epmet.resi.group.dto.topic.result.TopicBelongGroupResultDTO; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					import com.epmet.resi.group.dto.topic.result.TopicVisitResultDTO; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import org.apache.commons.lang3.StringUtils; | 
					 | 
					 | 
					import org.apache.commons.lang3.StringUtils; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					import org.springframework.beans.factory.annotation.Autowired; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import org.springframework.stereotype.Service; | 
					 | 
					 | 
					import org.springframework.stereotype.Service; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import org.springframework.transaction.annotation.Transactional; | 
					 | 
					 | 
					import org.springframework.transaction.annotation.Transactional; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					@ -34,6 +42,13 @@ import java.util.Map; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					@Service | 
					 | 
					 | 
					@Service | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					public class TopicShareLinkRecordServiceImpl extends BaseServiceImpl<TopicShareLinkRecordDao, TopicShareLinkRecordEntity> implements TopicShareLinkRecordService { | 
					 | 
					 | 
					public class TopicShareLinkRecordServiceImpl extends BaseServiceImpl<TopicShareLinkRecordDao, TopicShareLinkRecordEntity> implements TopicShareLinkRecordService { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					    @Autowired | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					    private TopicShareLinkVisitRecordDao visitRecordDao; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					    @Autowired | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					    private ResiGroupMemberDao resiGroupMemberDao; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					    @Autowired | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					    private GroupMemeberOperationDao groupMemeberOperationDao; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    @Override | 
					 | 
					 | 
					    @Override | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    public PageData<TopicShareLinkRecordDTO> page(Map<String, Object> params) { | 
					 | 
					 | 
					    public PageData<TopicShareLinkRecordDTO> page(Map<String, Object> params) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        IPage<TopicShareLinkRecordEntity> page = baseDao.selectPage( | 
					 | 
					 | 
					        IPage<TopicShareLinkRecordEntity> page = baseDao.selectPage( | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					@ -100,7 +115,7 @@ public class TopicShareLinkRecordServiceImpl extends BaseServiceImpl<TopicShareL | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        if (StringUtils.isNotBlank(shareLinkId)){ | 
					 | 
					 | 
					        if (StringUtils.isNotBlank(shareLinkId)){ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            return new CreateUrlResultDTO(shareLinkId); | 
					 | 
					 | 
					            return new CreateUrlResultDTO(shareLinkId); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        } | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					        TopicShareLinkRecordEntity topicInfo = baseDao.selectTopicInfoById(form.getTopicId()); | 
					 | 
					 | 
					        TopicVisitResultDTO topicInfo = baseDao.selectTopicInfoById(form.getTopicId()); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					        if (null == topicInfo){ | 
					 | 
					 | 
					        if (null == topicInfo){ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            throw new RenException(TopicShareConstant.NOT_EXIST_TOPIC_INFO); | 
					 | 
					 | 
					            throw new RenException(TopicShareConstant.NOT_EXIST_TOPIC_INFO); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        } | 
					 | 
					 | 
					        } | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					@ -123,11 +138,53 @@ public class TopicShareLinkRecordServiceImpl extends BaseServiceImpl<TopicShareL | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					     */ | 
					 | 
					 | 
					     */ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    @Override | 
					 | 
					 | 
					    @Override | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    public TopicBelongGroupResultDTO selectTopicBelongGroup(TopicBelongGroupFormDTO formDTO) { | 
					 | 
					 | 
					    public TopicBelongGroupResultDTO selectTopicBelongGroup(TopicBelongGroupFormDTO formDTO) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					        TopicShareLinkRecordEntity entity = baseDao.selectTopicInfoById(formDTO.getTopicId()); | 
					 | 
					 | 
					        TopicVisitResultDTO topicInfo = baseDao.selectTopicInfoById(formDTO.getTopicId()); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					        if (null == entity){ | 
					 | 
					 | 
					        if (null == topicInfo){ | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					            throw new RenException(TopicShareConstant.NOT_EXIST_TOPIC_BELONG_GROUP); | 
					 | 
					 | 
					            throw new RenException(TopicShareConstant.NOT_EXIST_TOPIC_BELONG_GROUP); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        } | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					        return new TopicBelongGroupResultDTO(entity.getGroupId()); | 
					 | 
					 | 
					        return new TopicBelongGroupResultDTO(topicInfo.getGroupId()); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					    } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					    /** | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					     * @Description  分享话题id获取信息 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					     * @Param formDTO | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					     * @Param tokenDto | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					     * @author zxc | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					     * @date 2020/12/18 下午3:34 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					     */ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					    @Override | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					    @Transactional(rollbackFor = Exception.class) | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					    public TopicVisitResultDTO topicVisit(TopicVisitFormDTO formDTO, TokenDto tokenDto) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        String topicId = null; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        if (StringUtils.isNotBlank(formDTO.getShareLinkId())){ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            // 点击页面上的分享时
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            TopicShareLinkRecordEntity linkRecord = baseDao.selectById(formDTO.getShareLinkId()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            if (null == linkRecord){ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                throw new RenException(TopicShareConstant.NOT_EXIST_INVITE_RECORD); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            TopicShareLinkVisitRecordEntity entity = new TopicShareLinkVisitRecordEntity(); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            entity.setCustomerId(linkRecord.getCustomerId()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            entity.setShareUserId(linkRecord.getShareUserId()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            entity.setInviteeUserId(tokenDto.getUserId()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            entity.setShareLinkRecId(formDTO.getShareLinkId()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            entity.setIsInviteRegister(NumConstant.ONE); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            visitRecordDao.insert(entity); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            topicId = linkRecord.getTopicId(); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        }else topicId = formDTO.getTopicId(); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        TopicVisitResultDTO result = baseDao.selectTopicInfoById(topicId); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        if (null == result){ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            throw new RenException(TopicShareConstant.NOT_EXIST_TOPIC_INFO); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        Integer userInGroup = resiGroupMemberDao.checkUserInGroup(tokenDto.getUserId(), result.getGroupId()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        if (userInGroup > NumConstant.ZERO){ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            result.setAwaitAudit(false); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            result.setInGroup(true); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        }else { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            result.setInGroup(false); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            Integer awaitAudit = groupMemeberOperationDao.checkAwaitAudit(tokenDto.getUserId(), result.getGroupId()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            result.setAwaitAudit(awaitAudit > NumConstant.ZERO ? true : false); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        return result; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    } | 
					 | 
					 | 
					    } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					} | 
					 | 
					 | 
					} |