diff --git a/lib/contingencyplan-1.1.0.jar b/lib/contingencyplan-1.1.0.jar new file mode 100644 index 00000000..382f1d02 Binary files /dev/null and b/lib/contingencyplan-1.1.0.jar differ diff --git a/renren-admin/lib/contingencyplan-1.1.0.jar b/renren-admin/lib/contingencyplan-1.1.0.jar new file mode 100644 index 00000000..382f1d02 Binary files /dev/null and b/renren-admin/lib/contingencyplan-1.1.0.jar differ diff --git a/renren-admin/pom.xml b/renren-admin/pom.xml index 86222ec7..71e443cf 100644 --- a/renren-admin/pom.xml +++ b/renren-admin/pom.xml @@ -229,6 +229,20 @@ ${project.basedir}/lib/yawei-pso-2.0.2.jar ${yawei-pso.version} + + + sw.vc3term + contingencyplan + 1.1.0 + system + ${project.basedir}/lib/contingencyplan-1.1.0.jar + + + + org.json + json + 20180130 + com.belerweb pinyin4j diff --git a/renren-admin/src/main/java/io/renren/modules/enke/EnkeController.java b/renren-admin/src/main/java/io/renren/modules/enke/EnkeController.java new file mode 100644 index 00000000..b629bda5 --- /dev/null +++ b/renren-admin/src/main/java/io/renren/modules/enke/EnkeController.java @@ -0,0 +1,96 @@ +package io.renren.modules.enke; + +import io.renren.modules.activiti.service.ActHistoryService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.apache.commons.lang3.StringUtils; +import org.json.JSONObject; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.util.CollectionUtils; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import sw.vc3term.contingencyplan.ContingencyPlanUtil; + +import java.net.Inet4Address; +import java.net.InetAddress; +import java.net.NetworkInterface; +import java.net.SocketException; +import java.util.ArrayList; +import java.util.Enumeration; +import java.util.List; + +/** + * @Auther:lizhicheng2@hisense.com + * @date:2022/10/22 + * @des + */ +@RestController +@RequestMapping("/enke") +@Api(tags = "enke视频会议") +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 final Logger logger = LoggerFactory.getLogger(ActHistoryService.class); + + 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); + } + + @ApiOperation(value = "正式启动会议") + @PostMapping("/initiateMeet") + public boolean initiateMeet(@RequestBody String attender) { + logger.info("视频会议的请求内容为:" + attender); + if (attender != null) { + String confName = "MCU"; + logger.info("发起会议的会议名称为:" + confName + ";" + "参会人员:" + attender); + cp.startContingencyPlan(confName, attender); + return true; + } else { + return false; + } + } + + /** + * 获取本机IP + * + * @author wanglu 2017年10月18日 下午3:33:49 + */ + @SuppressWarnings("rawtypes") + public static List getLocalIP() { + List ips = new ArrayList<>(); + Enumeration allNetInterfaces; + try { + allNetInterfaces = NetworkInterface.getNetworkInterfaces(); + } catch (SocketException e) { + logger.error("获取本机ip异常", e); + return ips; + } + InetAddress ip; + while (allNetInterfaces.hasMoreElements()) { + NetworkInterface netInterface = (NetworkInterface) allNetInterfaces.nextElement(); + Enumeration addresses = netInterface.getInetAddresses(); + while (addresses.hasMoreElements()) { + ip = (InetAddress) addresses.nextElement(); + if (ip instanceof Inet4Address) { + String ipAddress = ip.getHostAddress(); + if (StringUtils.equals(ipAddress, "127.0.0.1") || ipAddress.startsWith("0")) { + continue; + } + ips.add(ipAddress); + } + } + } + return ips; + } +}