|
|
|
@ -28,14 +28,16 @@ import java.util.List;
@@ -28,14 +28,16 @@ import java.util.List;
|
|
|
|
|
@Configuration |
|
|
|
|
@EnableScheduling |
|
|
|
|
public class RegisterServer { |
|
|
|
|
private static String sercer_ip = ""; |
|
|
|
|
private static String localip = ""; |
|
|
|
|
private static String accessmode = ""; |
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
private Environment env; |
|
|
|
|
|
|
|
|
|
@PostConstruct |
|
|
|
|
public void config() { |
|
|
|
|
sercer_ip = env.getProperty("localip"); |
|
|
|
|
localip = env.getProperty("localip"); |
|
|
|
|
accessmode = env.getProperty("accessmode"); |
|
|
|
|
} |
|
|
|
|
@Autowired |
|
|
|
|
private ICameraService cameraService; |
|
|
|
@ -48,8 +50,8 @@ public class RegisterServer {
@@ -48,8 +50,8 @@ public class RegisterServer {
|
|
|
|
|
private void start(){ |
|
|
|
|
String ip = IPUtils.getLocalIpAddress(); |
|
|
|
|
System.out.println(ip); |
|
|
|
|
if(sercer_ip.equals(ip)){ |
|
|
|
|
R result = cameraService.register(sercer_ip); |
|
|
|
|
if(localip.equals(ip) && "0".equals(accessmode)){ |
|
|
|
|
R result = cameraService.register(localip); |
|
|
|
|
if("0".equals(result.get("code").toString())){ |
|
|
|
|
System.out.println("主动注册服务已启动"); |
|
|
|
|
}else{ |
|
|
|
|