From 4ab4265e19c5f7aaf07fac997941cd202e2763d2 Mon Sep 17 00:00:00 2001 From: lizhicheng Date: Mon, 24 Oct 2022 18:30:44 +0800 Subject: [PATCH] =?UTF-8?q?enke:=E6=9F=A5=E8=AF=A2=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/db/V7.0__enke_hostinfo_add_table.sql | 44 ++++++++++++++++++ .../enke/{ => controller}/EnkeController.java | 33 +++++++++++--- .../renren/modules/enke/dao/HostInfoDao.java | 21 +++++++++ .../renren/modules/enke/dto/HostInfoDTO.java | 32 +++++++++++++ .../modules/enke/entity/HostInfoEntity.java | 44 ++++++++++++++++++ .../modules/enke/service/EnkeService.java | 17 +++++++ .../enke/service/impl/EnkeServiceImpl.java | 45 +++++++++++++++++++ .../db/V7.0__enke_hostinfo_add_table.sql | 44 ++++++++++++++++++ .../resources/mapper/enke/HostInfoDao.xml | 10 +++++ 9 files changed, 284 insertions(+), 6 deletions(-) create mode 100644 config/db/V7.0__enke_hostinfo_add_table.sql rename renren-admin/src/main/java/io/renren/modules/enke/{ => controller}/EnkeController.java (74%) create mode 100644 renren-admin/src/main/java/io/renren/modules/enke/dao/HostInfoDao.java create mode 100644 renren-admin/src/main/java/io/renren/modules/enke/dto/HostInfoDTO.java create mode 100644 renren-admin/src/main/java/io/renren/modules/enke/entity/HostInfoEntity.java create mode 100644 renren-admin/src/main/java/io/renren/modules/enke/service/EnkeService.java create mode 100644 renren-admin/src/main/java/io/renren/modules/enke/service/impl/EnkeServiceImpl.java create mode 100644 renren-admin/src/main/resources/db/V7.0__enke_hostinfo_add_table.sql create mode 100644 renren-admin/src/main/resources/mapper/enke/HostInfoDao.xml diff --git a/config/db/V7.0__enke_hostinfo_add_table.sql b/config/db/V7.0__enke_hostinfo_add_table.sql new file mode 100644 index 00000000..9a4b6e86 --- /dev/null +++ b/config/db/V7.0__enke_hostinfo_add_table.sql @@ -0,0 +1,44 @@ +DROP TABLE IF EXISTS `enke_hostinfo`; +CREATE TABLE `enke_hostinfo` +( + `id` bigint NOT NULL AUTO_INCREMENT, + `hostName` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'hostName', + `owner` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'owner', + `ipAddress` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'ipAddress', + `multicastAddress` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'multicastAddress', + `create_date` datetime DEFAULT NULL COMMENT '创建时间', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB + AUTO_INCREMENT = 100 + DEFAULT CHARSET = utf8mb4 + COLLATE = utf8mb4_general_ci + ROW_FORMAT = DYNAMIC COMMENT ='enke_hostinfo'; + +INSERT INTO `enke_hostinfo` +VALUES (1, '市预警信息发布中心', '市预警信息发布中心', '127.0.0.1', '127.0.0.1', '2022-09-22 09:20:07'); +INSERT INTO `enke_hostinfo` +VALUES (2, '市园林和林业局', '市园林和林业局', '127.0.0.1', '127.0.0.1', '2022-09-21 09:20:07'); +INSERT INTO `enke_hostinfo` +VALUES (3, '城阳区应急指挥中心', '城阳区应急指挥中心', '127.0.0.1', '127.0.0.1', '2022-09-20 09:20:07'); +INSERT INTO `enke_hostinfo` +VALUES (4, '地铁集团', '地铁集团', '127.0.0.1', '127.0.0.1', '2022-09-19 09:20:07'); +INSERT INTO `enke_hostinfo` +VALUES (5, '市市场监管局', '市市场监管局', '127.0.0.1', '127.0.0.1', '2022-09-18 09:20:07'); +INSERT INTO `enke_hostinfo` +VALUES (6, '市教育局(值班室)', '市教育局(值班室)', '127.0.0.1', '127.0.0.1', '2022-09-17 09:20:07'); +INSERT INTO `enke_hostinfo` +VALUES (7, '青岛市政府总值班室', '青岛市政府总值班室', '127.0.0.1', '127.0.0.1', '2022-09-16 09:20:07'); +INSERT INTO `enke_hostinfo` +VALUES (8, '市教育局', '市教育局', '127.0.0.1', '127.0.0.1', '2022-09-15 09:20:07'); +INSERT INTO `enke_hostinfo` +VALUES (9, '高新区管委(值班室)', '高新区管委(值班室)', '127.0.0.1', '127.0.0.1', '2022-09-14 09:20:07'); +INSERT INTO `enke_hostinfo` +VALUES (10, '市人防办', '市人防办', '127.0.0.1', '127.0.0.1', '2022-09-13 09:20:07'); +INSERT INTO `enke_hostinfo` +VALUES (11, '市公安局', '市公安局', '127.0.0.1', '127.0.0.1', '2022-09-12 09:20:07'); +INSERT INTO `enke_hostinfo` +VALUES (12, '市交通运输局', '市交通运输局', '127.0.0.1', '127.0.0.1', '2022-09-11 09:20:07'); +INSERT INTO `enke_hostinfo` +VALUES (13, '一网统揽平台组', '一网统揽平台组', '127.0.0.1', '127.0.0.1', '2022-09-10 09:20:07'); +INSERT INTO `enke_hostinfo` +VALUES (14, '青岛市一网统揽项目组', '青岛市一网统揽项目组', '127.0.0.1', '127.0.0.1', '2022-09-09 09:20:07'); diff --git a/renren-admin/src/main/java/io/renren/modules/enke/EnkeController.java b/renren-admin/src/main/java/io/renren/modules/enke/controller/EnkeController.java similarity index 74% rename from renren-admin/src/main/java/io/renren/modules/enke/EnkeController.java rename to renren-admin/src/main/java/io/renren/modules/enke/controller/EnkeController.java index b629bda5..f568d775 100644 --- a/renren-admin/src/main/java/io/renren/modules/enke/EnkeController.java +++ b/renren-admin/src/main/java/io/renren/modules/enke/controller/EnkeController.java @@ -1,19 +1,22 @@ -package io.renren.modules.enke; +package io.renren.modules.enke.controller; +import io.renren.common.page.PageData; +import io.renren.common.utils.Result; import io.renren.modules.activiti.service.ActHistoryService; +import io.renren.modules.enke.dto.HostInfoDTO; +import io.renren.modules.enke.service.EnkeService; 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.beans.factory.annotation.Autowired; 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 org.springframework.web.bind.annotation.*; +import springfox.documentation.annotations.ApiIgnore; import sw.vc3term.contingencyplan.ContingencyPlanUtil; +import java.io.UnsupportedEncodingException; import java.net.Inet4Address; import java.net.InetAddress; import java.net.NetworkInterface; @@ -21,6 +24,7 @@ import java.net.SocketException; import java.util.ArrayList; import java.util.Enumeration; import java.util.List; +import java.util.Map; /** * @Auther:lizhicheng2@hisense.com @@ -39,6 +43,9 @@ public class EnkeController { private static final Logger logger = LoggerFactory.getLogger(ActHistoryService.class); + @Autowired + private EnkeService enkeService; + static { cp = ContingencyPlanUtil.getInstance(); // 初始化会议 @@ -47,6 +54,20 @@ public class EnkeController { cp.setLocalAddress(CollectionUtils.isEmpty(ips) ? "0.0.0.0" : ips.get(0), ContingencyPlanUtil.LOCAL_PORT); } + /** + * 第二步:发起会议前将同步过来的用户返回给前端选择 + * + * @return 是否成功同步 + * @throws UnsupportedEncodingException + * @author libin + */ + @ApiOperation(value = "getEnkeUsers") + @RequestMapping(value = "/getEnkeUsers", method = RequestMethod.GET) + public Result> getEnkeUsers(@ApiIgnore @RequestParam Map params) { + PageData page = enkeService.page(params); + return new Result>().ok(page); + } + @ApiOperation(value = "正式启动会议") @PostMapping("/initiateMeet") public boolean initiateMeet(@RequestBody String attender) { diff --git a/renren-admin/src/main/java/io/renren/modules/enke/dao/HostInfoDao.java b/renren-admin/src/main/java/io/renren/modules/enke/dao/HostInfoDao.java new file mode 100644 index 00000000..fccc913f --- /dev/null +++ b/renren-admin/src/main/java/io/renren/modules/enke/dao/HostInfoDao.java @@ -0,0 +1,21 @@ +package io.renren.modules.enke.dao; + +import io.renren.common.dao.BaseDao; +import io.renren.modules.enke.dto.HostInfoDTO; +import io.renren.modules.enke.entity.HostInfoEntity; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; +import java.util.Map; + +/** + * @Auther:lizhicheng2@hisense.com + * @date:2022/10/24 + * @des + */ +@Mapper +public interface HostInfoDao extends BaseDao { + + List getHostInfoDTOList(Map params); + +} diff --git a/renren-admin/src/main/java/io/renren/modules/enke/dto/HostInfoDTO.java b/renren-admin/src/main/java/io/renren/modules/enke/dto/HostInfoDTO.java new file mode 100644 index 00000000..466a578a --- /dev/null +++ b/renren-admin/src/main/java/io/renren/modules/enke/dto/HostInfoDTO.java @@ -0,0 +1,32 @@ +package io.renren.modules.enke.dto; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.Date; + +/** + * @Auther:lizhicheng2@hisense.com + * @date:2022/10/24 + * @des + */ +@Data +@ApiModel(value = "hostInfo") +public class HostInfoDTO { + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "主键ID") + private Long id; + @ApiModelProperty(value = "hostName") + private String hostName; + @ApiModelProperty(value = "owner") + private String owner; + @ApiModelProperty(value = "ipAddress") + private String ipAddress; + @ApiModelProperty(value = "multicastAddress") + private String multicastAddress; + @ApiModelProperty(value = "创建时间") + private Date createDate; + +} diff --git a/renren-admin/src/main/java/io/renren/modules/enke/entity/HostInfoEntity.java b/renren-admin/src/main/java/io/renren/modules/enke/entity/HostInfoEntity.java new file mode 100644 index 00000000..e49b951e --- /dev/null +++ b/renren-admin/src/main/java/io/renren/modules/enke/entity/HostInfoEntity.java @@ -0,0 +1,44 @@ +package io.renren.modules.enke.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import io.renren.common.entity.BaseEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * @Auther:lizhicheng2@hisense.com + * @date:2022/10/24 + * @des + */ +@Data +@EqualsAndHashCode(callSuper = false) +@TableName("enke_hostinfo") +public class HostInfoEntity extends BaseEntity { + + /** + * 融合服务名称 + */ + private String hostName; + /** + * 融合服务名称 + */ + private String owner; + /** + * 融合服务名称 + */ + private String ipAddress; + /** + * 融合服务名称 + */ + private String multicastAddress; + /** + * 创建时间 + */ + @TableField(fill = FieldFill.INSERT) + private Date createDate; + +} diff --git a/renren-admin/src/main/java/io/renren/modules/enke/service/EnkeService.java b/renren-admin/src/main/java/io/renren/modules/enke/service/EnkeService.java new file mode 100644 index 00000000..4e6d967e --- /dev/null +++ b/renren-admin/src/main/java/io/renren/modules/enke/service/EnkeService.java @@ -0,0 +1,17 @@ +package io.renren.modules.enke.service; + +import io.renren.common.service.CrudService; +import io.renren.modules.enke.dto.HostInfoDTO; +import io.renren.modules.enke.entity.HostInfoEntity; +import io.renren.modules.fuse.dto.TbFuseDTO; +import io.renren.modules.fuse.entity.TbFuseEntity; + +/** + * @Auther:lizhicheng2@hisense.com + * @date:2022/10/24 + * @des + */ +public interface EnkeService extends CrudService { + + +} diff --git a/renren-admin/src/main/java/io/renren/modules/enke/service/impl/EnkeServiceImpl.java b/renren-admin/src/main/java/io/renren/modules/enke/service/impl/EnkeServiceImpl.java new file mode 100644 index 00000000..ba7d3443 --- /dev/null +++ b/renren-admin/src/main/java/io/renren/modules/enke/service/impl/EnkeServiceImpl.java @@ -0,0 +1,45 @@ +package io.renren.modules.enke.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import io.renren.common.constant.Constant; +import io.renren.common.page.PageData; +import io.renren.common.service.impl.CrudServiceImpl; +import io.renren.modules.enke.dao.HostInfoDao; +import io.renren.modules.enke.dto.HostInfoDTO; +import io.renren.modules.enke.entity.HostInfoEntity; +import io.renren.modules.enke.service.EnkeService; +import io.renren.modules.fuse.dto.TbFuseDTO; +import org.springframework.stereotype.Service; + +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +/** + * @Auther:lizhicheng2@hisense.com + * @date:2022/10/24 + * @des + */ +@Service +public class EnkeServiceImpl extends CrudServiceImpl implements EnkeService { + + @Override + public QueryWrapper getWrapper(Map params) { + return null; + } + + @Override + public PageData page(Map params) { + long curPage = 1; + long limit = 10; + if (params.get(Constant.PAGE) != null) { + curPage = Long.parseLong((String) params.get(Constant.PAGE)); + } + if (params.get(Constant.LIMIT) != null) { + limit = Long.parseLong((String) params.get(Constant.LIMIT)); + } + List dtoList = baseDao.getHostInfoDTOList(params); + List result = dtoList.stream().skip((curPage - 1) * limit).limit(limit).collect(Collectors.toList()); + return new PageData(result, dtoList.size()); + } +} diff --git a/renren-admin/src/main/resources/db/V7.0__enke_hostinfo_add_table.sql b/renren-admin/src/main/resources/db/V7.0__enke_hostinfo_add_table.sql new file mode 100644 index 00000000..9a4b6e86 --- /dev/null +++ b/renren-admin/src/main/resources/db/V7.0__enke_hostinfo_add_table.sql @@ -0,0 +1,44 @@ +DROP TABLE IF EXISTS `enke_hostinfo`; +CREATE TABLE `enke_hostinfo` +( + `id` bigint NOT NULL AUTO_INCREMENT, + `hostName` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'hostName', + `owner` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'owner', + `ipAddress` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'ipAddress', + `multicastAddress` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'multicastAddress', + `create_date` datetime DEFAULT NULL COMMENT '创建时间', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB + AUTO_INCREMENT = 100 + DEFAULT CHARSET = utf8mb4 + COLLATE = utf8mb4_general_ci + ROW_FORMAT = DYNAMIC COMMENT ='enke_hostinfo'; + +INSERT INTO `enke_hostinfo` +VALUES (1, '市预警信息发布中心', '市预警信息发布中心', '127.0.0.1', '127.0.0.1', '2022-09-22 09:20:07'); +INSERT INTO `enke_hostinfo` +VALUES (2, '市园林和林业局', '市园林和林业局', '127.0.0.1', '127.0.0.1', '2022-09-21 09:20:07'); +INSERT INTO `enke_hostinfo` +VALUES (3, '城阳区应急指挥中心', '城阳区应急指挥中心', '127.0.0.1', '127.0.0.1', '2022-09-20 09:20:07'); +INSERT INTO `enke_hostinfo` +VALUES (4, '地铁集团', '地铁集团', '127.0.0.1', '127.0.0.1', '2022-09-19 09:20:07'); +INSERT INTO `enke_hostinfo` +VALUES (5, '市市场监管局', '市市场监管局', '127.0.0.1', '127.0.0.1', '2022-09-18 09:20:07'); +INSERT INTO `enke_hostinfo` +VALUES (6, '市教育局(值班室)', '市教育局(值班室)', '127.0.0.1', '127.0.0.1', '2022-09-17 09:20:07'); +INSERT INTO `enke_hostinfo` +VALUES (7, '青岛市政府总值班室', '青岛市政府总值班室', '127.0.0.1', '127.0.0.1', '2022-09-16 09:20:07'); +INSERT INTO `enke_hostinfo` +VALUES (8, '市教育局', '市教育局', '127.0.0.1', '127.0.0.1', '2022-09-15 09:20:07'); +INSERT INTO `enke_hostinfo` +VALUES (9, '高新区管委(值班室)', '高新区管委(值班室)', '127.0.0.1', '127.0.0.1', '2022-09-14 09:20:07'); +INSERT INTO `enke_hostinfo` +VALUES (10, '市人防办', '市人防办', '127.0.0.1', '127.0.0.1', '2022-09-13 09:20:07'); +INSERT INTO `enke_hostinfo` +VALUES (11, '市公安局', '市公安局', '127.0.0.1', '127.0.0.1', '2022-09-12 09:20:07'); +INSERT INTO `enke_hostinfo` +VALUES (12, '市交通运输局', '市交通运输局', '127.0.0.1', '127.0.0.1', '2022-09-11 09:20:07'); +INSERT INTO `enke_hostinfo` +VALUES (13, '一网统揽平台组', '一网统揽平台组', '127.0.0.1', '127.0.0.1', '2022-09-10 09:20:07'); +INSERT INTO `enke_hostinfo` +VALUES (14, '青岛市一网统揽项目组', '青岛市一网统揽项目组', '127.0.0.1', '127.0.0.1', '2022-09-09 09:20:07'); diff --git a/renren-admin/src/main/resources/mapper/enke/HostInfoDao.xml b/renren-admin/src/main/resources/mapper/enke/HostInfoDao.xml new file mode 100644 index 00000000..b691a0a0 --- /dev/null +++ b/renren-admin/src/main/resources/mapper/enke/HostInfoDao.xml @@ -0,0 +1,10 @@ + + + + + + + + \ No newline at end of file