Browse Source

查看话题详情发布人信息

dev_shibei_match
wangchao 5 years ago
parent
commit
fbf1689c35
  1. 9
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisUtils.java
  2. 6
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/ResiTopicServiceImpl.java

9
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisUtils.java

@ -9,6 +9,7 @@
package com.epmet.commons.tools.redis;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory;
import org.springframework.data.redis.core.HashOperations;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;
@ -62,6 +63,14 @@ public class RedisUtils {
*/
public final static long NOT_EXPIRE = -1L;
public void selectDb(int index){
LettuceConnectionFactory jedisConnectionFactory = (LettuceConnectionFactory) redisTemplate.getConnectionFactory();
jedisConnectionFactory.setShareNativeConnection(false);
jedisConnectionFactory.setDatabase(index);
redisTemplate.setConnectionFactory(jedisConnectionFactory);
jedisConnectionFactory.resetConnection();
}
public void set(String key, Object value, long expire) {
redisTemplate.opsForValue().set(key, value);
if (expire != NOT_EXPIRE) {

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

@ -57,7 +57,6 @@ import com.epmet.resi.group.dto.topic.result.ResiTopicDetailResultDTO;
import com.epmet.resi.group.dto.topic.result.ResiTopicInfoResultDTO;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -100,8 +99,6 @@ public class ResiTopicServiceImpl extends BaseServiceImpl<ResiTopicDao, ResiTopi
@Autowired
RedisUtils redisUtil;
@Autowired
private RedisTemplate<String, Object> redisTemplate;
@Override
public PageData<ResiTopicDTO> page(Map<String, Object> params) {
@ -253,7 +250,6 @@ public class ResiTopicServiceImpl extends BaseServiceImpl<ResiTopicDao, ResiTopi
**/
@Override
public Result<List<ResiTopicInfoResultDTO>> getLatestTopics(TokenDto tokenDto, String groupId) {
if (null == tokenDto) {
return new Result().error(ModuleConstant.USER_NOT_NULL);
}
@ -463,7 +459,7 @@ public class ResiTopicServiceImpl extends BaseServiceImpl<ResiTopicDao, ResiTopi
ResiTopicDTO topic = get(topicId);
ResiGroupEntity group = resiGroupDao.selectById(topic.getGroupId());
UserResiInfoFormDTO userParam = new UserResiInfoFormDTO();
userParam.setUserId(tokenDto.getUserId());
userParam.setUserId(topic.getCreatedBy());
userParam.setCustomerId(group.getCustomerId());
Result<UserResiInfoResultDTO> userInfo = epmetUserFeignClient.getUserResiInfoDTO(userParam);
if(userInfo.success()){

Loading…
Cancel
Save