|
|
@ -9,15 +9,22 @@ import com.epmet.commons.tools.exception.RenException; |
|
|
|
import com.epmet.commons.tools.page.PageData; |
|
|
|
import com.epmet.commons.tools.security.dto.TokenDto; |
|
|
|
import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
|
import com.epmet.commons.tools.utils.Result; |
|
|
|
import com.epmet.dto.IssueShareLinkRecordDTO; |
|
|
|
import com.epmet.feign.GovIssueOpenFeignClient; |
|
|
|
import com.epmet.modules.group.dao.ResiGroupDao; |
|
|
|
import com.epmet.modules.group.entity.ResiGroupEntity; |
|
|
|
import com.epmet.modules.member.dao.GroupMemeberOperationDao; |
|
|
|
import com.epmet.modules.member.dao.ResiGroupMemberDao; |
|
|
|
import com.epmet.modules.topic.dao.ResiTopicDao; |
|
|
|
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.TopicShareLinkVisitRecordEntity; |
|
|
|
import com.epmet.modules.topic.service.TopicShareLinkRecordService; |
|
|
|
import com.epmet.modules.utils.ModuleConstant; |
|
|
|
import com.epmet.resi.group.constant.TopicShareConstant; |
|
|
|
import com.epmet.resi.group.dto.member.GroupMemeberOperationDTO; |
|
|
|
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.ShareLinkTypeFormDTO; |
|
|
@ -27,10 +34,12 @@ import com.epmet.resi.group.dto.topic.result.CreateUrlResultDTO; |
|
|
|
import com.epmet.resi.group.dto.topic.result.MemberRelationBetweenGroupAndGridResultDTO; |
|
|
|
import com.epmet.resi.group.dto.topic.result.TopicBelongGroupResultDTO; |
|
|
|
import com.epmet.resi.group.dto.topic.result.TopicVisitResultDTO; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
import org.springframework.util.CollectionUtils; |
|
|
|
|
|
|
|
import java.util.Arrays; |
|
|
|
import java.util.List; |
|
|
@ -43,6 +52,7 @@ import java.util.Map; |
|
|
|
* @since v1.0.0 2020-12-18 |
|
|
|
*/ |
|
|
|
@Service |
|
|
|
@Slf4j |
|
|
|
public class TopicShareLinkRecordServiceImpl extends BaseServiceImpl<TopicShareLinkRecordDao, TopicShareLinkRecordEntity> implements TopicShareLinkRecordService { |
|
|
|
|
|
|
|
@Autowired |
|
|
@ -53,7 +63,10 @@ public class TopicShareLinkRecordServiceImpl extends BaseServiceImpl<TopicShareL |
|
|
|
private GroupMemeberOperationDao groupMemeberOperationDao; |
|
|
|
@Autowired |
|
|
|
private GovIssueOpenFeignClient issueClient; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private ResiTopicDao topicDao; |
|
|
|
@Autowired |
|
|
|
private ResiGroupDao groupDao; |
|
|
|
@Override |
|
|
|
public PageData<TopicShareLinkRecordDTO> page(Map<String, Object> params) { |
|
|
|
IPage<TopicShareLinkRecordEntity> page = baseDao.selectPage( |
|
|
@ -212,10 +225,42 @@ public class TopicShareLinkRecordServiceImpl extends BaseServiceImpl<TopicShareL |
|
|
|
if(null != shareLinkInfo && StringUtils.isNotBlank(shareLinkInfo.getGroupId())) group = shareLinkInfo.getGroupId(); |
|
|
|
} |
|
|
|
if(StringUtils.isBlank(group)){ |
|
|
|
Result<IssueShareLinkRecordDTO> issueShareLinkInfo = issueClient.shareLinkInfo(param.getId()); |
|
|
|
if(issueShareLinkInfo.success() && null != issueShareLinkInfo.getData()){ |
|
|
|
String issueId = issueShareLinkInfo.getData().getIssueId(); |
|
|
|
if(StringUtils.isNotBlank(issueId)){ |
|
|
|
group = topicDao.selectGroupIdByIssueId(issueId); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if(StringUtils.isBlank(group)) throw new RenException("根据分享链接Id没有找到对应的组Id"); |
|
|
|
String userId = param.getUserId(); |
|
|
|
|
|
|
|
GroupMemeberOperationDTO applyRecord = groupMemeberOperationDao.selectLatestRecord(group, userId); |
|
|
|
if(null != applyRecord && StringUtils.equals(ModuleConstant.GROUP_STATUS_UNDER_AUDITTING,applyRecord.getOperateStatus())){ |
|
|
|
//under_auditing
|
|
|
|
relation.setAwaitAudit(true); |
|
|
|
} |
|
|
|
if(null != applyRecord && StringUtils.equals(ModuleConstant.AUDITING_OPERATION_APPROVAL,applyRecord.getOperateStatus())){ |
|
|
|
//approved
|
|
|
|
relation.setInGroup(true); |
|
|
|
relation.setInAnyGroup(true); |
|
|
|
} |
|
|
|
if(!relation.getInAnyGroup()) { |
|
|
|
ResiGroupEntity groupEntity = groupDao.selectById(group); |
|
|
|
if(null == groupEntity || StringUtils.isBlank(groupEntity.getGridId())) |
|
|
|
throw new RenException("没有找到相应的组记录"); |
|
|
|
List<String> groups = resiGroupMemberDao.getGroupIdByUserIdAndGridId(groupEntity.getGridId(), userId, NumConstant.ONE_STR); |
|
|
|
if(!CollectionUtils.isEmpty(groups)){ |
|
|
|
relation.setInAnyGroup(true); |
|
|
|
if(groups.contains(group)){ |
|
|
|
relation.setInGroup(true); |
|
|
|
log.error("查出用户{}是组{}中成员,但是没有对应的入群记录",param.getUserId(),group); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return null; |
|
|
|
return relation; |
|
|
|
} |
|
|
|
|
|
|
|
} |