|
@ -3,10 +3,14 @@ package com.epmet.modules.topic.service.impl; |
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; |
|
|
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; |
|
|
import com.epmet.commons.tools.constant.NumConstant; |
|
|
import com.epmet.commons.tools.constant.NumConstant; |
|
|
|
|
|
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; |
|
|
import com.epmet.commons.tools.exception.EpmetErrorCode; |
|
|
import com.epmet.commons.tools.exception.EpmetErrorCode; |
|
|
import com.epmet.commons.tools.exception.EpmetException; |
|
|
import com.epmet.commons.tools.exception.EpmetException; |
|
|
import com.epmet.commons.tools.page.PageData; |
|
|
import com.epmet.commons.tools.page.PageData; |
|
|
|
|
|
import com.epmet.commons.tools.redis.common.CustomerOrgRedis; |
|
|
import com.epmet.commons.tools.redis.common.CustomerResiUserRedis; |
|
|
import com.epmet.commons.tools.redis.common.CustomerResiUserRedis; |
|
|
|
|
|
import com.epmet.commons.tools.redis.common.CustomerStaffRedis; |
|
|
|
|
|
import com.epmet.commons.tools.redis.common.bean.GridInfoCache; |
|
|
import com.epmet.commons.tools.redis.common.bean.ResiUserInfoCache; |
|
|
import com.epmet.commons.tools.redis.common.bean.ResiUserInfoCache; |
|
|
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; |
|
@ -71,20 +75,31 @@ public class YtTopicServiceImpl extends BaseServiceImpl<YtTopicDao, YtTopicEntit |
|
|
throw new EpmetException(ModuleConstant.TOPIC_CONTENT_AND_VOICE_IS_NULL); |
|
|
throw new EpmetException(ModuleConstant.TOPIC_CONTENT_AND_VOICE_IS_NULL); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
//1.保存话题草稿
|
|
|
|
|
|
if(formDTO.getTopicContent().length() > TopicConstant.MAX_NUMBER_OF_CONTENT){ |
|
|
if(formDTO.getTopicContent().length() > TopicConstant.MAX_NUMBER_OF_CONTENT){ |
|
|
//内容超过最大限制
|
|
|
//内容超过最大限制
|
|
|
log.error(ModuleConstant.TOPIC_CONTENT_NUMBER_OF_WORDS_EXCEEDED); |
|
|
log.error(ModuleConstant.TOPIC_CONTENT_NUMBER_OF_WORDS_EXCEEDED); |
|
|
throw new EpmetException(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); |
|
|
YtTopicEntity topic = ConvertUtils.sourceToTarget(formDTO, YtTopicEntity.class); |
|
|
//如果只有语音,则话题内容为语音话题
|
|
|
//如果只有语音,则话题内容为语音话题
|
|
|
if (CollectionUtils.isNotEmpty(formDTO.getVoiceList()) && StringUtils.isBlank(formDTO.getTopicContent())) { |
|
|
if (CollectionUtils.isNotEmpty(formDTO.getVoiceList()) && StringUtils.isBlank(formDTO.getTopicContent())) { |
|
|
topic.setTopicContent("语音话题"); |
|
|
topic.setTopicContent("语音话题"); |
|
|
} |
|
|
} |
|
|
|
|
|
GridInfoCache gridInfo = CustomerOrgRedis.getGridInfo(formDTO.getGridId()); |
|
|
|
|
|
if (null == gridInfo) { |
|
|
|
|
|
String msg = "获取网格信息失败"; |
|
|
|
|
|
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), msg, msg); |
|
|
|
|
|
} |
|
|
|
|
|
ResiUserInfoCache userInfo = CustomerResiUserRedis.getUserBaseInfo(tokenDto.getUserId()); |
|
|
|
|
|
if (null == userInfo) { |
|
|
|
|
|
String msg = "获取用户信息失败"; |
|
|
|
|
|
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), msg, msg); |
|
|
|
|
|
} |
|
|
topic.setCustomerId(tokenDto.getCustomerId()); |
|
|
topic.setCustomerId(tokenDto.getCustomerId()); |
|
|
topic.setStatus(TopicConstant.PUBLISHMENT); |
|
|
topic.setStatus(TopicConstant.PUBLISHMENT); |
|
|
|
|
|
topic.setPids(gridInfo.getPids()); |
|
|
|
|
|
topic.setUserName(userInfo.getRealName()); |
|
|
baseDao.insert(topic); |
|
|
baseDao.insert(topic); |
|
|
|
|
|
|
|
|
//保存图片附件
|
|
|
//保存图片附件
|
|
@ -217,6 +232,16 @@ public class YtTopicServiceImpl extends BaseServiceImpl<YtTopicDao, YtTopicEntit |
|
|
*/ |
|
|
*/ |
|
|
@Override |
|
|
@Override |
|
|
public PageData<YtTopicInfoResultDTO> getTopicList(TokenDto tokenDto, YtTopicPageFormDTO topicPageFormDTO) { |
|
|
public PageData<YtTopicInfoResultDTO> getTopicList(TokenDto tokenDto, YtTopicPageFormDTO topicPageFormDTO) { |
|
|
|
|
|
if (NumConstant.ONE_STR.equals(topicPageFormDTO.getSource())) { |
|
|
|
|
|
if (StringUtils.isBlank(topicPageFormDTO.getGridId())) { |
|
|
|
|
|
CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(tokenDto.getCustomerId(), tokenDto.getUserId()); |
|
|
|
|
|
if (null == staffInfo) { |
|
|
|
|
|
String msg = "获取工作人员信息失败"; |
|
|
|
|
|
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), msg, msg); |
|
|
|
|
|
} |
|
|
|
|
|
topicPageFormDTO.setAgencyId(staffInfo.getAgencyId()); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
PageMethod.startPage(topicPageFormDTO.getPageNo(), topicPageFormDTO.getPageSize()); |
|
|
PageMethod.startPage(topicPageFormDTO.getPageNo(), topicPageFormDTO.getPageSize()); |
|
|
List<YtTopicInfoResultDTO> list = baseDao.selectTopicList(topicPageFormDTO); |
|
|
List<YtTopicInfoResultDTO> list = baseDao.selectTopicList(topicPageFormDTO); |
|
|
PageInfo<YtTopicInfoResultDTO> pageInfo = new PageInfo<>(list); |
|
|
PageInfo<YtTopicInfoResultDTO> pageInfo = new PageInfo<>(list); |
|
|