Browse Source

根据分享链接返回当前用户与链接中组、网格的关系

master
wangchao 5 years ago
parent
commit
cf5d42c347
  1. 6
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/result/MemberRelationBetweenGroupAndGridResultDTO.java
  2. 49
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/TopicShareLinkRecordServiceImpl.java

6
epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/result/MemberRelationBetweenGroupAndGridResultDTO.java

@ -17,15 +17,15 @@ public class MemberRelationBetweenGroupAndGridResultDTO implements Serializable
/**
* 是否存在入组待审核记录true存在false不存在
*/
private Boolean awaitAudit;
private Boolean awaitAudit = false;
/**
* 是否在群内标志已经在群内:true, 不在群内:false
*/
private Boolean inGroup;
private Boolean inGroup = false;
/**
* 此人有没有加入所在小组所属网格下的任何一个小组true加入false未加入
*/
private Boolean inAnyGroup;
private Boolean inAnyGroup = false;
}

49
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/TopicShareLinkRecordServiceImpl.java

@ -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;
}
}
Loading…
Cancel
Save