|
|
@ -4,13 +4,23 @@ 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.FieldConstant; |
|
|
|
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.constant.IssueShareConstant; |
|
|
|
import com.epmet.dao.IssueShareLinkRecordDao; |
|
|
|
import com.epmet.dto.IssueShareLinkRecordDTO; |
|
|
|
import com.epmet.dto.form.IssueCreateUrlFormDTO; |
|
|
|
import com.epmet.dto.result.IssueCreateUrlResultDTO; |
|
|
|
import com.epmet.entity.IssueShareLinkRecordEntity; |
|
|
|
import com.epmet.resi.group.dto.topic.form.TopicBelongGroupFormDTO; |
|
|
|
import com.epmet.resi.group.dto.topic.result.TopicBelongGroupResultDTO; |
|
|
|
import com.epmet.resi.group.feign.ResiGroupOpenFeignClient; |
|
|
|
import com.epmet.service.IssueShareLinkRecordService; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
@ -27,6 +37,9 @@ import java.util.Map; |
|
|
|
@Service |
|
|
|
public class IssueShareLinkRecordServiceImpl extends BaseServiceImpl<IssueShareLinkRecordDao, IssueShareLinkRecordEntity> implements IssueShareLinkRecordService { |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private ResiGroupOpenFeignClient resiGroupOpenFeignClient; |
|
|
|
|
|
|
|
@Override |
|
|
|
public PageData<IssueShareLinkRecordDTO> page(Map<String, Object> params) { |
|
|
|
IPage<IssueShareLinkRecordEntity> page = baseDao.selectPage( |
|
|
@ -79,4 +92,41 @@ public class IssueShareLinkRecordServiceImpl extends BaseServiceImpl<IssueShareL |
|
|
|
baseDao.deleteBatchIds(Arrays.asList(ids)); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @Description 议题分享链接ID |
|
|
|
* @Param formDTO |
|
|
|
* @Param tokenDto |
|
|
|
* @author zxc |
|
|
|
* @date 2020/12/18 下午1:36 |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public IssueCreateUrlResultDTO getIssueShareLinkId(IssueCreateUrlFormDTO formDTO, TokenDto tokenDto) { |
|
|
|
// 校验此人此议题是否存在分享记录
|
|
|
|
String shareLinkId = baseDao.checkIssueRecord(formDTO.getIssueId(), tokenDto.getUserId()); |
|
|
|
if (StringUtils.isNotBlank(shareLinkId)){ |
|
|
|
return new IssueCreateUrlResultDTO(shareLinkId); |
|
|
|
} |
|
|
|
IssueShareLinkRecordEntity issueInfo = baseDao.selectIssueInfoById(formDTO.getIssueId()); |
|
|
|
if (null == issueInfo){ |
|
|
|
throw new RenException(IssueShareConstant.NOT_EXIST_ISSUE_INFO); |
|
|
|
} |
|
|
|
TopicBelongGroupFormDTO topicBelongGroupFormDTO = new TopicBelongGroupFormDTO(); |
|
|
|
topicBelongGroupFormDTO.setTopicId(issueInfo.getTopicId()); |
|
|
|
Result<TopicBelongGroupResultDTO> topicInfo = resiGroupOpenFeignClient.selectTopicBelongGroup(topicBelongGroupFormDTO); |
|
|
|
if (!topicInfo.success()){ |
|
|
|
throw new RenException(IssueShareConstant.TOPIC_BELONG_GROUP_FAILURE); |
|
|
|
} |
|
|
|
IssueShareLinkRecordEntity entity = new IssueShareLinkRecordEntity(); |
|
|
|
entity.setCustomerId(issueInfo.getCustomerId()); |
|
|
|
if (StringUtils.isBlank(topicInfo.getData().getGroupId())){ |
|
|
|
throw new RenException(IssueShareConstant.TOPIC_BELONG_GROUP_NULL); |
|
|
|
} |
|
|
|
entity.setGridId(topicInfo.getData().getGroupId()); |
|
|
|
entity.setIssueId(formDTO.getIssueId()); |
|
|
|
entity.setShareUserId(tokenDto.getUserId()); |
|
|
|
entity.setInviteContent(null); |
|
|
|
baseDao.insert(entity); |
|
|
|
return new IssueCreateUrlResultDTO(entity.getId()); |
|
|
|
} |
|
|
|
|
|
|
|
} |