Commit f6039f3f authored by 赵啸非's avatar 赵啸非

修改查询时间段

parent 3817c432
......@@ -4,6 +4,7 @@ import cn.hutool.core.util.IdUtil;
import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.mortals.xhx.common.key.Constant;
import com.mortals.xhx.common.key.QueueKey;
import com.mortals.xhx.common.pdu.access.AccessLogPdu;
import com.mortals.xhx.module.access.model.AccessLogEntity;
......@@ -23,6 +24,7 @@ import org.springframework.boot.autoconfigure.amqp.RabbitProperties;
import org.springframework.messaging.handler.annotation.Headers;
import org.springframework.messaging.handler.annotation.Payload;
import org.springframework.stereotype.Component;
import org.springframework.util.ObjectUtils;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
......@@ -74,10 +76,14 @@ public class AccessMessageConsumerListener {
try {
// AccessLogEntity entity =null;
//entity = JSON.parseObject(message, AccessLogEntity.class);
entity.setLogTime(entity.getLogTime()==null?new Date():entity.getLogTime());
entity.setLogTime(entity.getLogTime() == null ? new Date() : entity.getLogTime());
entity.setId(IdUtil.getSnowflake(0, 1).nextId());
entity.setCreateUserId(1L);
entity.setCreateTime(new Date());
//判断 超过一定时间的请求 才记录
if (!ObjectUtils.isEmpty(entity.getDuration()) && entity.getDuration() < Constant.ACCESS_EXPIRE_TIME) {
return null;
}
return entity;
} catch (Exception e) {
log.info("反序列化异常", e);
......
......@@ -114,4 +114,9 @@ public final class Constant {
public static final String DISTRIBUTE_PATH = "distribute_path";
/**
* 访问超时时间,默认2秒
*/
public static final Long ACCESS_EXPIRE_TIME = 2000L;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment