diff --git a/renren-admin/src/main/java/io/renren/modules/enke/controller/EnkeController.java b/renren-admin/src/main/java/io/renren/modules/enke/controller/EnkeController.java index f568d775..42e6b3bb 100644 --- a/renren-admin/src/main/java/io/renren/modules/enke/controller/EnkeController.java +++ b/renren-admin/src/main/java/io/renren/modules/enke/controller/EnkeController.java @@ -11,11 +11,13 @@ import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.util.CollectionUtils; import org.springframework.web.bind.annotation.*; import springfox.documentation.annotations.ApiIgnore; import sw.vc3term.contingencyplan.ContingencyPlanUtil; +import javax.annotation.PostConstruct; import java.io.UnsupportedEncodingException; import java.net.Inet4Address; import java.net.InetAddress; @@ -39,19 +41,27 @@ public class EnkeController { private static final String videoConfernceIp = "35.1.190.62"; private static final int videoConferncePort = 8756; - private static final ContingencyPlanUtil cp; + private static ContingencyPlanUtil cp = null; private static final Logger logger = LoggerFactory.getLogger(ActHistoryService.class); @Autowired private EnkeService enkeService; + @Value("#{new Boolean(${enke.enable})}") + private Boolean enke; // 是否进行恩科会议组会 - static { - cp = ContingencyPlanUtil.getInstance(); - // 初始化会议 - cp.init(videoConfernceIp, videoConferncePort); - List ips = getLocalIP(); - cp.setLocalAddress(CollectionUtils.isEmpty(ips) ? "0.0.0.0" : ips.get(0), ContingencyPlanUtil.LOCAL_PORT); + @PostConstruct + public void init() { + if (enke) { + cp = ContingencyPlanUtil.getInstance(); + // 初始化会议 + cp.init(videoConfernceIp, videoConferncePort); + List ips = getLocalIP(); + cp.setLocalAddress(CollectionUtils.isEmpty(ips) ? "0.0.0.0" : ips.get(0), ContingencyPlanUtil.LOCAL_PORT); + logger.info("开启组会功能成功!"); + } else { + logger.info("不开启组会功能"); + } } /** @@ -112,6 +122,7 @@ public class EnkeController { } } } + logger.info("本机ip:" + ips); return ips; } } diff --git a/renren-admin/src/main/resources/application.yml b/renren-admin/src/main/resources/application.yml index 9c2d76cd..853b9125 100644 --- a/renren-admin/src/main/resources/application.yml +++ b/renren-admin/src/main/resources/application.yml @@ -179,4 +179,7 @@ shangdongtong: reminders: # 催办间隔天数 interval: 7 +# 恩科会议 +enke: + enable: true