|
|
@ -68,18 +68,12 @@ public class YtTopicServiceImpl extends BaseServiceImpl<YtTopicDao, YtTopicEntit |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void createTopic(TokenDto tokenDto, CreateYtTopicFormDTO formDTO) { |
|
|
|
public void createTopic(CreateYtTopicFormDTO formDTO) { |
|
|
|
if(StringUtils.isBlank(formDTO.getTopicContent()) && CollectionUtils.isEmpty(formDTO.getVoiceList())) { |
|
|
|
//话题内容和语音不能同时为空
|
|
|
|
log.error(ModuleConstant.TOPIC_CONTENT_AND_VOICE_IS_NULL); |
|
|
|
throw new EpmetException(ModuleConstant.TOPIC_CONTENT_AND_VOICE_IS_NULL); |
|
|
|
} |
|
|
|
|
|
|
|
if(formDTO.getTopicContent().length() > TopicConstant.MAX_NUMBER_OF_CONTENT){ |
|
|
|
//内容超过最大限制
|
|
|
|
log.error(ModuleConstant.TOPIC_CONTENT_NUMBER_OF_WORDS_EXCEEDED); |
|
|
|
throw new EpmetException(ModuleConstant.TOPIC_CONTENT_NUMBER_OF_WORDS_EXCEEDED); |
|
|
|
} |
|
|
|
//1.保存话题
|
|
|
|
YtTopicEntity topic = ConvertUtils.sourceToTarget(formDTO, YtTopicEntity.class); |
|
|
|
//如果只有语音,则话题内容为语音话题
|
|
|
@ -91,12 +85,12 @@ public class YtTopicServiceImpl extends BaseServiceImpl<YtTopicDao, YtTopicEntit |
|
|
|
String msg = "获取网格信息失败"; |
|
|
|
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), msg, msg); |
|
|
|
} |
|
|
|
ResiUserInfoCache userInfo = CustomerResiUserRedis.getUserBaseInfo(tokenDto.getUserId()); |
|
|
|
ResiUserInfoCache userInfo = CustomerResiUserRedis.getUserBaseInfo(formDTO.getUserId()); |
|
|
|
if (null == userInfo) { |
|
|
|
String msg = "获取用户信息失败"; |
|
|
|
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), msg, msg); |
|
|
|
} |
|
|
|
topic.setCustomerId(tokenDto.getCustomerId()); |
|
|
|
topic.setCustomerId(formDTO.getCustomerId()); |
|
|
|
topic.setStatus(TopicConstant.PUBLISHMENT); |
|
|
|
topic.setPids(gridInfo.getPids()); |
|
|
|
topic.setUserName(userInfo.getRealName()); |
|
|
@ -125,7 +119,7 @@ public class YtTopicServiceImpl extends BaseServiceImpl<YtTopicDao, YtTopicEntit |
|
|
|
attachment.setCustomerId(formDTO.getCustomerId()); |
|
|
|
attachment.setAttachmentUrl(file.getUrl()); |
|
|
|
attachment.setTopicId(topic.getId()); |
|
|
|
attachment.setCreatedBy(tokenDto.getUserId()); |
|
|
|
attachment.setCreatedBy(formDTO.getUserId()); |
|
|
|
attachment.setAttachmentFormat(file.getUrl().substring(file.getUrl().lastIndexOf(".") + NumConstant.ONE).toLowerCase()); |
|
|
|
attachment.setSort(sort++); |
|
|
|
attachment.setAttachmentType(TopicConstant.VOICE); |
|
|
@ -147,7 +141,7 @@ public class YtTopicServiceImpl extends BaseServiceImpl<YtTopicDao, YtTopicEntit |
|
|
|
* @Date 2023/1/30 16:39 |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public YtTopicDetailResultDTO getTopicDetail(TokenDto tokenDto, YtTopicDetailFormDTO formDTO) { |
|
|
|
public YtTopicDetailResultDTO getTopicDetail(YtTopicDetailFormDTO formDTO) { |
|
|
|
//1.查询话题信息
|
|
|
|
YtTopicEntity entity = baseDao.selectById(formDTO.getTopicId()); |
|
|
|
if(null == entity){ |
|
|
@ -211,7 +205,7 @@ public class YtTopicServiceImpl extends BaseServiceImpl<YtTopicDao, YtTopicEntit |
|
|
|
result.setSupportCount(String.valueOf(voteMap.get(TopicConstant.SUPPORT))); |
|
|
|
} |
|
|
|
} |
|
|
|
voteWrapper.eq(YtTopicVoteDetailEntity::getCreatedBy, tokenDto.getUserId()); |
|
|
|
voteWrapper.eq(YtTopicVoteDetailEntity::getCreatedBy, formDTO.getUserId()); |
|
|
|
voteList = ytTopicVoteDetailDao.selectList(voteWrapper); |
|
|
|
if (CollectionUtils.isNotEmpty(voteList)) { |
|
|
|
result.setVoteStatus(voteList.get(NumConstant.ZERO).getAttitude()); |
|
|
|