2021-07-14 16:06:31 +08:00
|
|
|
package com.genersoft.iot.vmp.conf;
|
|
|
|
|
2022-11-05 20:49:56 +08:00
|
|
|
import com.alibaba.fastjson2.JSONObject;
|
2021-07-14 16:06:31 +08:00
|
|
|
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
2021-11-23 14:51:37 +08:00
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
2021-07-14 16:06:31 +08:00
|
|
|
import org.springframework.scheduling.annotation.Scheduled;
|
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
|
|
@Component
|
|
|
|
public class WVPTimerTask {
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
private IRedisCatchStorage redisCatchStorage;
|
|
|
|
|
2021-11-23 14:51:37 +08:00
|
|
|
@Value("${server.port}")
|
|
|
|
private int serverPort;
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
private SipConfig sipConfig;
|
2021-07-14 16:06:31 +08:00
|
|
|
|
2021-11-23 14:51:37 +08:00
|
|
|
@Scheduled(fixedRate = 2 * 1000) //每3秒执行一次
|
|
|
|
public void execute(){
|
|
|
|
JSONObject jsonObject = new JSONObject();
|
2024-06-13 18:10:01 +08:00
|
|
|
jsonObject.put("ip", sipConfig.getShowIp());
|
2021-11-23 14:51:37 +08:00
|
|
|
jsonObject.put("port", serverPort);
|
2021-12-03 16:13:46 +08:00
|
|
|
redisCatchStorage.updateWVPInfo(jsonObject, 3);
|
2021-11-23 14:51:37 +08:00
|
|
|
}
|
2021-07-14 16:06:31 +08:00
|
|
|
}
|