2 changed files with 0 additions and 88 deletions
@ -1,41 +0,0 @@ |
|||||
package com.elink.esua.epdc.config; |
|
||||
|
|
||||
import com.elink.esua.epdc.commons.tools.redis.RedisChannels; |
|
||||
import com.elink.esua.epdc.listener.SentryPostUserInfoRedisListener; |
|
||||
import org.springframework.beans.factory.annotation.Autowired; |
|
||||
import org.springframework.context.annotation.Bean; |
|
||||
import org.springframework.data.redis.connection.RedisConnectionFactory; |
|
||||
import org.springframework.data.redis.listener.PatternTopic; |
|
||||
import org.springframework.data.redis.listener.RedisMessageListenerContainer; |
|
||||
import org.springframework.data.redis.listener.adapter.MessageListenerAdapter; |
|
||||
import org.springframework.stereotype.Component; |
|
||||
|
|
||||
/** |
|
||||
* @author work@yujt.net.cn |
|
||||
* @date 1 1 |
|
||||
*/ |
|
||||
@Component |
|
||||
public class RedisMessageConfig { |
|
||||
|
|
||||
@Autowired |
|
||||
private RedisConnectionFactory factory; |
|
||||
|
|
||||
@Autowired |
|
||||
private SentryPostUserInfoRedisListener sentryPostUserInfoRedisListener; |
|
||||
|
|
||||
@Bean |
|
||||
MessageListenerAdapter sentryPostUserInfoAdapter() { |
|
||||
return new MessageListenerAdapter(sentryPostUserInfoRedisListener); |
|
||||
} |
|
||||
|
|
||||
|
|
||||
@Bean |
|
||||
RedisMessageListenerContainer container() { |
|
||||
RedisMessageListenerContainer container = new RedisMessageListenerContainer(); |
|
||||
container.setConnectionFactory(factory); |
|
||||
container.addMessageListener(sentryPostUserInfoAdapter(), new PatternTopic(RedisChannels.COMPLETE_INFO_BY_SENTRY_POST)); |
|
||||
return container; |
|
||||
} |
|
||||
|
|
||||
|
|
||||
} |
|
@ -1,47 +0,0 @@ |
|||||
package com.elink.esua.epdc.listener; |
|
||||
|
|
||||
import com.alibaba.fastjson.JSONObject; |
|
||||
import com.elink.esua.epdc.commons.tools.utils.Result; |
|
||||
import com.elink.esua.epdc.dto.EpidemicSentryPostDTO; |
|
||||
import com.elink.esua.epdc.dto.epdc.form.EpdcAppPidemicCompleteInfoFromDTO; |
|
||||
import com.elink.esua.epdc.feign.CustomFeignClient; |
|
||||
import com.elink.esua.epdc.feign.UserFeignClient; |
|
||||
import com.elink.esua.epdc.service.CustomService; |
|
||||
import lombok.extern.slf4j.Slf4j; |
|
||||
import org.apache.commons.lang3.StringUtils; |
|
||||
import org.springframework.beans.factory.annotation.Autowired; |
|
||||
import org.springframework.data.redis.connection.Message; |
|
||||
import org.springframework.data.redis.connection.MessageListener; |
|
||||
import org.springframework.stereotype.Service; |
|
||||
|
|
||||
/** |
|
||||
* 处理防疫哨卡提交的用户信息 |
|
||||
* |
|
||||
* @author work@yujt.net.cn |
|
||||
* @date 2020/2/16 16:49 |
|
||||
*/ |
|
||||
@Slf4j |
|
||||
@Service |
|
||||
public class SentryPostUserInfoRedisListener implements MessageListener { |
|
||||
|
|
||||
@Autowired |
|
||||
private CustomService customService; |
|
||||
|
|
||||
@Override |
|
||||
public void onMessage(Message message, byte[] pattern) { |
|
||||
|
|
||||
if (StringUtils.isBlank(message.toString())) { |
|
||||
return; |
|
||||
} |
|
||||
try { |
|
||||
EpdcAppPidemicCompleteInfoFromDTO completeInfoDto = JSONObject.parseObject(message.toString(), EpdcAppPidemicCompleteInfoFromDTO.class); |
|
||||
|
|
||||
customService.completeSentryPostUserInfo(completeInfoDto); |
|
||||
|
|
||||
} catch (Exception e) { |
|
||||
log.error("处理哨卡登记信息失败"); |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
|
|
||||
} |
|
Loading…
Reference in new issue