From 14bbde1103fc851fd6f4c8ee0ce36db61ce6a65b Mon Sep 17 00:00:00 2001 From: wangliwen Date: Sat, 10 Dec 2022 16:09:53 +0800 Subject: [PATCH] =?UTF-8?q?=E9=85=8D=E7=BD=AE=E6=98=AF=E5=90=A6=E5=BC=80?= =?UTF-8?q?=E5=90=AF=E6=81=A9=E7=A7=91=E7=BB=84=E4=BC=9A=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../enke/controller/EnkeController.java | 25 +++++++++++++------ .../src/main/resources/application.yml | 3 +++ 2 files changed, 21 insertions(+), 7 deletions(-) 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