| | |
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import com.yeshi.fanli.util.RedisManager;
|
| | | import org.aspectj.lang.JoinPoint;
|
| | | import org.aspectj.lang.Signature;
|
| | | import org.aspectj.lang.annotation.Aspect;
|
| | |
| | | import com.aliyun.openservices.ons.api.Producer;
|
| | | import com.yeshi.fanli.dto.mq.user.UserTopicTagEnum;
|
| | | import com.yeshi.fanli.dto.mq.user.body.UserActiveMQMsg;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfoExtra;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoExtraService;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoModifyRecordService;
|
| | | import com.yeshi.fanli.service.inter.user.integral.IntegralGetService;
|
| | |
| | | @Aspect
|
| | | public class ActiveUserAspect {
|
| | | @Resource
|
| | | private JedisPool jedisPool;
|
| | |
|
| | | @Resource
|
| | | private UserInfoModifyRecordService userInfoModifyRecordService;
|
| | |
|
| | | @Resource
|
| | | private UserInfoExtraService userInfoExtraService;
|
| | |
|
| | | @Resource
|
| | | private IntegralGetService integralGetService;
|
| | | |
| | | @Resource(name = "producer")
|
| | | private Producer producer;
|
| | | |
| | | private RedisManager redisManager;
|
| | |
|
| | | private ExpressionParser parser = new SpelExpressionParser();
|
| | |
|
| | |
| | | @Override
|
| | | public void run() {
|
| | | String key = "useractive-" + uidStr;
|
| | | Jedis jedis = jedisPool.getResource();
|
| | | Jedis jedis =redisManager.getJedis();
|
| | | try {
|
| | | if (!StringUtil.isNullOrEmpty(jedis.set(key, "1", new SetParams().nx().ex(300)))) {
|
| | | if (!StringUtil.isNullOrEmpty(jedis.set(key, "1", new SetParams().nx().ex(Constant.IS_TEST?10:300)))) {
|
| | | try {
|
| | | Long uid = Long.parseLong(uidStr);
|
| | | if (!Constant.IS_TEST) { // 活跃通知
|
| | | UserActiveMQMsg msg = new UserActiveMQMsg(uid, new Date());
|
| | | Message message = MQMsgBodyFactory.create(MQTopicName.TOPIC_USER, UserTopicTagEnum.userActve, msg);
|
| | | producer.send(message);
|
| | | }
|
| | | // Long uid = Long.parseLong(uidStr);
|
| | | // if (!Constant.IS_TEST) { // 活跃通知
|
| | | // UserActiveMQMsg msg = new UserActiveMQMsg(uid, new Date());
|
| | | // Message message = MQMsgBodyFactory.create(MQTopicName.TOPIC_USER, UserTopicTagEnum.userActve, msg);
|
| | | // message.setStartDeliverTime(System.currentTimeMillis()+1000*10L);//10s后发送活跃消息
|
| | | // producer.send(message);
|
| | | // }
|
| | | } catch (Exception e) {
|
| | | |
| | | }
|
| | | }
|
| | | } finally {
|