From 666a4ef3cf5d9838795487918621a4232859506d Mon Sep 17 00:00:00 2001
From: renkang <94314517@qq.com>
Date: 星期四, 02 四月 2026 18:25:14 +0800
Subject: [PATCH] 网关管理功能
---
server/system_timer/src/main/resources/bootstrap-dev.yml | 4
server/visits/dmvisit_admin/src/main/resources/bootstrap-dev.yml | 4
server/db/business.yw_gateway.permissions.sql | 5
server/system_timer/src/main/resources/bootstrap-test.yml | 4
server/visits/admin_timer/src/main/resources/bootstrap-dev.yml | 4
server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwGatewayServiceImpl.java | 142 +++++++++++++++++
server/visits/dmvisit_admin/src/main/resources/bootstrap-test.yml | 4
server/visits/admin_timer/src/main/resources/bootstrap-test.yml | 4
server/system_gateway/src/main/resources/bootstrap-dev.yml | 4
server/visits/dmvisit_service/src/main/java/com/doumee/dao/business/YwGatewayMapper.java | 13 +
server/visits/dmvisit_admin/src/main/java/com/doumee/cloud/admin/YwGatewayCloudController.java | 105 +++++++++++++
server/visits/dmvisit_service/src/main/java/com/doumee/dao/business/model/YwGateway.java | 87 ++++++++++
server/db/yw_gateway.sql | 19 ++
server/system_gateway/src/main/resources/bootstrap-test.yml | 4
server/visits/dmvisit_service/src/main/java/com/doumee/service/business/YwGatewayService.java | 70 ++++++++
15 files changed, 457 insertions(+), 16 deletions(-)
diff --git a/server/db/business.yw_gateway.permissions.sql b/server/db/business.yw_gateway.permissions.sql
new file mode 100644
index 0000000..cccf310
--- /dev/null
+++ b/server/db/business.yw_gateway.permissions.sql
@@ -0,0 +1,5 @@
+INSERT INTO `SYSTEM_PERMISSION`(`CODE`, `NAME`, `REMARK`, `FIXED`, `CREATE_USER`, `CREATE_TIME`, `UPDATE_USER`, `UPDATE_TIME`, `DELETED`) VALUES ('business:ywgateway:create', '鏂板缓缃戝叧绠$悊', '', 0, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
+INSERT INTO `SYSTEM_PERMISSION`(`CODE`, `NAME`, `REMARK`, `FIXED`, `CREATE_USER`, `CREATE_TIME`, `UPDATE_USER`, `UPDATE_TIME`, `DELETED`) VALUES ('business:ywgateway:delete', '鍒犻櫎缃戝叧绠$悊', '', 0, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
+INSERT INTO `SYSTEM_PERMISSION`(`CODE`, `NAME`, `REMARK`, `FIXED`, `CREATE_USER`, `CREATE_TIME`, `UPDATE_USER`, `UPDATE_TIME`, `DELETED`) VALUES ('business:ywgateway:update', '淇敼缃戝叧绠$悊', '', 0, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
+INSERT INTO `SYSTEM_PERMISSION`(`CODE`, `NAME`, `REMARK`, `FIXED`, `CREATE_USER`, `CREATE_TIME`, `UPDATE_USER`, `UPDATE_TIME`, `DELETED`) VALUES ('business:ywgateway:query', '鏌ヨ缃戝叧绠$悊', '', 0, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
+INSERT INTO `SYSTEM_PERMISSION`(`CODE`, `NAME`, `REMARK`, `FIXED`, `CREATE_USER`, `CREATE_TIME`, `UPDATE_USER`, `UPDATE_TIME`, `DELETED`) VALUES ('business:ywgateway:exportExcel', '瀵煎嚭缃戝叧绠$悊(Excel)', '', 0, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
diff --git a/server/db/yw_gateway.sql b/server/db/yw_gateway.sql
new file mode 100644
index 0000000..6f40915
--- /dev/null
+++ b/server/db/yw_gateway.sql
@@ -0,0 +1,19 @@
+CREATE TABLE `yw_gateway` (
+ `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '涓婚敭',
+ `creator` int(11) DEFAULT NULL COMMENT '鍒涘缓浜虹紪鐮�',
+ `create_date` datetime DEFAULT NULL COMMENT '鍒涘缓鏃堕棿',
+ `editor` int(11) DEFAULT NULL COMMENT '鏇存柊浜虹紪鐮�',
+ `edit_date` datetime DEFAULT NULL COMMENT '鏇存柊鏃堕棿',
+ `isdeleted` int(1) DEFAULT '0' COMMENT '鏄惁鍒犻櫎 0鍚� 1鏄�',
+ `name` varchar(100) DEFAULT NULL COMMENT '缃戝叧鍚嶇О',
+ `remark` varchar(500) DEFAULT NULL COMMENT '澶囨敞',
+ `status` int(1) DEFAULT '0' COMMENT '鐘舵�� 0鍚敤 1绂佺敤',
+ `sortnum` int(11) DEFAULT NULL COMMENT '鎺掑簭鐮�',
+ `gateway_model` varchar(100) DEFAULT NULL COMMENT '缃戝叧鍨嬪彿',
+ `gateway_code` varchar(100) DEFAULT NULL COMMENT '缃戝叧璁惧鍙�',
+ `last_heartbeat_time` datetime DEFAULT NULL COMMENT '鏈�鍚庡績璺虫椂闂�',
+ `project_id` int(11) DEFAULT NULL COMMENT '鎵�灞為」鐩紪鐮侊紙鍏宠仈yw_project锛�',
+ PRIMARY KEY (`id`),
+ KEY `idx_gateway_code` (`gateway_code`),
+ KEY `idx_project_id` (`project_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='缃戝叧绠$悊';
diff --git a/server/system_gateway/src/main/resources/bootstrap-dev.yml b/server/system_gateway/src/main/resources/bootstrap-dev.yml
index a4c7cd6..ab83658 100644
--- a/server/system_gateway/src/main/resources/bootstrap-dev.yml
+++ b/server/system_gateway/src/main/resources/bootstrap-dev.yml
@@ -1,11 +1,11 @@
spring:
cloud:
nacos:
- server-addr: http://192.168.0.7:8848 #閰嶇疆Nacos鍦板潃
+ server-addr: http://192.168.0.3:8848 #閰嶇疆Nacos鍦板潃
username: nacos
password: nacos
discovery:
- server-addr: http://192.168.0.7:8848 #閰嶇疆Nacos鍦板潃
+ server-addr: http://192.168.0.3:8848 #閰嶇疆Nacos鍦板潃
# namespace: dmvisit
namespace: funingyunwei_dev
username: nacos
diff --git a/server/system_gateway/src/main/resources/bootstrap-test.yml b/server/system_gateway/src/main/resources/bootstrap-test.yml
index 4ccd298..d50a4c1 100644
--- a/server/system_gateway/src/main/resources/bootstrap-test.yml
+++ b/server/system_gateway/src/main/resources/bootstrap-test.yml
@@ -1,11 +1,11 @@
spring:
cloud:
nacos:
- server-addr: http://192.168.0.7:8848 #閰嶇疆Nacos鍦板潃
+ server-addr: http://192.168.0.3:8848 #閰嶇疆Nacos鍦板潃
username: nacos
password: nacos
discovery:
- server-addr: http://192.168.0.7:8848 #閰嶇疆Nacos鍦板潃
+ server-addr: http://192.168.0.3:8848 #閰嶇疆Nacos鍦板潃
namespace: funingyunwei_test
# namespace: dev_renkang
username: nacos
diff --git a/server/system_timer/src/main/resources/bootstrap-dev.yml b/server/system_timer/src/main/resources/bootstrap-dev.yml
index 21ef2c5..28c3014 100644
--- a/server/system_timer/src/main/resources/bootstrap-dev.yml
+++ b/server/system_timer/src/main/resources/bootstrap-dev.yml
@@ -10,7 +10,7 @@
# 鏆傛椂鍏抽棴缂撳瓨
enabled: false
nacos:
- server-addr: http://192.168.0.7:8848 #閰嶇疆Nacos鍦板潃
+ server-addr: http://192.168.0.3:8848 #閰嶇疆Nacos鍦板潃
username: nacos
password: nacos
# config:
@@ -22,7 +22,7 @@
# group: dev
# data-id: com.doumee.meeting.admin
discovery:
- server-addr: http://192.168.0.7:8848 #閰嶇疆Nacos鍦板潃
+ server-addr: http://192.168.0.3:8848 #閰嶇疆Nacos鍦板潃
namespace: funingyunwei_dev
username: nacos
password: nacos
\ No newline at end of file
diff --git a/server/system_timer/src/main/resources/bootstrap-test.yml b/server/system_timer/src/main/resources/bootstrap-test.yml
index 4e04742..7a2cccd 100644
--- a/server/system_timer/src/main/resources/bootstrap-test.yml
+++ b/server/system_timer/src/main/resources/bootstrap-test.yml
@@ -10,7 +10,7 @@
# 鏆傛椂鍏抽棴缂撳瓨
enabled: false
nacos:
- server-addr: http://192.168.0.7:8848 #閰嶇疆Nacos鍦板潃
+ server-addr: http://192.168.0.3:8848 #閰嶇疆Nacos鍦板潃
username: nacos
password: nacos
# config:
@@ -22,7 +22,7 @@
# group: dev
# data-id: com.doumee.meeting.admin
discovery:
- server-addr: http://192.168.0.7:8848 #閰嶇疆Nacos鍦板潃
+ server-addr: http://192.168.0.3:8848 #閰嶇疆Nacos鍦板潃
namespace: funingyunwei_test
username: nacos
password: nacos
\ No newline at end of file
diff --git a/server/visits/admin_timer/src/main/resources/bootstrap-dev.yml b/server/visits/admin_timer/src/main/resources/bootstrap-dev.yml
index 0c21840..6f52afe 100644
--- a/server/visits/admin_timer/src/main/resources/bootstrap-dev.yml
+++ b/server/visits/admin_timer/src/main/resources/bootstrap-dev.yml
@@ -10,7 +10,7 @@
# 鏆傛椂鍏抽棴缂撳瓨
enabled: false
nacos:
- server-addr: http://192.168.0.7:8848 #閰嶇疆Nacos鍦板潃
+ server-addr: http://192.168.0.3:8848 #閰嶇疆Nacos鍦板潃
username: nacos
password: nacos
# config:
@@ -22,7 +22,7 @@
# group: dev
# data-id: com.doumee.meeting.admin
discovery:
- server-addr: http://192.168.0.7:8848 #閰嶇疆Nacos鍦板潃
+ server-addr: http://192.168.0.3:8848 #閰嶇疆Nacos鍦板潃
namespace: funingyunwei_dev
username: nacos
password: nacos
diff --git a/server/visits/admin_timer/src/main/resources/bootstrap-test.yml b/server/visits/admin_timer/src/main/resources/bootstrap-test.yml
index d5944e2..569e3cb 100644
--- a/server/visits/admin_timer/src/main/resources/bootstrap-test.yml
+++ b/server/visits/admin_timer/src/main/resources/bootstrap-test.yml
@@ -10,7 +10,7 @@
# 鏆傛椂鍏抽棴缂撳瓨
enabled: false
nacos:
- server-addr: http://192.168.0.7:8848 #閰嶇疆Nacos鍦板潃
+ server-addr: http://192.168.0.3:8848 #閰嶇疆Nacos鍦板潃
username: nacos
password: nacos
# config:
@@ -22,7 +22,7 @@
# group: dev
# data-id: com.doumee.meeting.admin
discovery:
- server-addr: http://192.168.0.7:8848 #閰嶇疆Nacos鍦板潃
+ server-addr: http://192.168.0.3:8848 #閰嶇疆Nacos鍦板潃
namespace: funingyunwei_test
username: nacos
password: nacos
diff --git a/server/visits/dmvisit_admin/src/main/java/com/doumee/cloud/admin/YwGatewayCloudController.java b/server/visits/dmvisit_admin/src/main/java/com/doumee/cloud/admin/YwGatewayCloudController.java
new file mode 100644
index 0000000..a430616
--- /dev/null
+++ b/server/visits/dmvisit_admin/src/main/java/com/doumee/cloud/admin/YwGatewayCloudController.java
@@ -0,0 +1,105 @@
+package com.doumee.cloud.admin;
+
+import com.doumee.api.BaseController;
+import com.doumee.core.annotation.excel.ExcelExporter;
+import com.doumee.core.annotation.pr.PreventRepeat;
+import com.doumee.core.model.ApiResponse;
+import com.doumee.core.model.PageData;
+import com.doumee.core.model.PageWrap;
+import com.doumee.core.utils.Constants;
+import com.doumee.dao.business.model.YwGateway;
+import com.doumee.service.business.YwGatewayService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import com.doumee.config.annotation.CloudRequiredPermission;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletResponse;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * 缃戝叧绠$悊
+ * @author renkang
+ * @date 2026/04/02
+ */
+@Api(tags = "缃戝叧绠$悊")
+@RestController
+@RequestMapping(Constants.CLOUD_SERVICE_URL_INDEX + "/business/ywGateway")
+public class YwGatewayCloudController extends BaseController {
+
+ @Autowired
+ private YwGatewayService ywGatewayService;
+
+ @PreventRepeat
+ @ApiOperation("鏂板缓")
+ @PostMapping("/create")
+ @CloudRequiredPermission("business:ywgateway:create")
+ public ApiResponse create(@RequestBody YwGateway ywGateway, @RequestHeader(Constants.HEADER_USER_TOKEN) String token) {
+ ywGateway.setLoginUserInfo(this.getLoginUser(token));
+ return ApiResponse.success(ywGatewayService.create(ywGateway));
+ }
+
+ @ApiOperation("鏍规嵁ID鍒犻櫎")
+ @GetMapping("/delete/{id}")
+ @CloudRequiredPermission("business:ywgateway:delete")
+ public ApiResponse deleteById(@PathVariable Integer id, @RequestHeader(Constants.HEADER_USER_TOKEN) String token) {
+ ywGatewayService.deleteById(id, this.getLoginUser(token));
+ return ApiResponse.success(null);
+ }
+
+ @ApiOperation("鎵归噺鍒犻櫎")
+ @GetMapping("/delete/batch")
+ @CloudRequiredPermission("business:ywgateway:delete")
+ public ApiResponse deleteByIdInBatch(@RequestParam String ids, @RequestHeader(Constants.HEADER_USER_TOKEN) String token) {
+ String[] idArray = ids.split(",");
+ List<Integer> idList = new ArrayList<>();
+ for (String id : idArray) {
+ idList.add(Integer.valueOf(id));
+ }
+ ywGatewayService.deleteByIdInBatch(idList, this.getLoginUser(token));
+ return ApiResponse.success(null);
+ }
+
+ @ApiOperation("鏍规嵁ID淇敼")
+ @PostMapping("/updateById")
+ @CloudRequiredPermission("business:ywgateway:update")
+ public ApiResponse updateById(@RequestBody YwGateway ywGateway, @RequestHeader(Constants.HEADER_USER_TOKEN) String token) {
+ ywGateway.setLoginUserInfo(this.getLoginUser(token));
+ ywGatewayService.updateById(ywGateway);
+ return ApiResponse.success(null);
+ }
+
+ @ApiOperation("绂佸惎鐢�")
+ @PostMapping("/updateStatusById")
+ @CloudRequiredPermission("business:ywgateway:update")
+ public ApiResponse updateStatusById(@RequestBody YwGateway ywGateway, @RequestHeader(Constants.HEADER_USER_TOKEN) String token) {
+ ywGateway.setLoginUserInfo(this.getLoginUser(token));
+ ywGatewayService.updateStatusById(ywGateway);
+ return ApiResponse.success(null);
+ }
+
+ @ApiOperation("鍒嗛〉鏌ヨ")
+ @PostMapping("/page")
+ @CloudRequiredPermission("business:ywgateway:query")
+ public ApiResponse<PageData<YwGateway>> findPage(@RequestBody PageWrap<YwGateway> pageWrap, @RequestHeader(Constants.HEADER_USER_TOKEN) String token) {
+ pageWrap.getModel().setLoginUserInfo(this.getLoginUser(token));
+ return ApiResponse.success(ywGatewayService.findPage(pageWrap));
+ }
+
+ @ApiOperation("鏍规嵁ID鏌ヨ")
+ @GetMapping("/{id}")
+ @CloudRequiredPermission("business:ywgateway:query")
+ public ApiResponse findById(@PathVariable Integer id, @RequestHeader(Constants.HEADER_USER_TOKEN) String token) {
+ return ApiResponse.success(ywGatewayService.findById(id));
+ }
+
+ @ApiOperation("瀵煎嚭Excel")
+ @PostMapping("/exportExcel")
+ @CloudRequiredPermission("business:ywgateway:exportExcel")
+ public void exportExcel(@RequestBody PageWrap<YwGateway> pageWrap, HttpServletResponse response, @RequestHeader(Constants.HEADER_USER_TOKEN) String token) {
+ pageWrap.getModel().setLoginUserInfo(this.getLoginUser(token));
+ ExcelExporter.build(YwGateway.class).export(ywGatewayService.findPage(pageWrap).getRecords(), "缃戝叧绠$悊", response);
+ }
+}
diff --git a/server/visits/dmvisit_admin/src/main/resources/bootstrap-dev.yml b/server/visits/dmvisit_admin/src/main/resources/bootstrap-dev.yml
index 96054ed..bff4a23 100644
--- a/server/visits/dmvisit_admin/src/main/resources/bootstrap-dev.yml
+++ b/server/visits/dmvisit_admin/src/main/resources/bootstrap-dev.yml
@@ -10,7 +10,7 @@
# 鏆傛椂鍏抽棴缂撳瓨
enabled: false
nacos:
- server-addr: http://192.168.0.7:8848 #閰嶇疆Nacos鍦板潃
+ server-addr: http://192.168.0.3:8848 #閰嶇疆Nacos鍦板潃
username: nacos
password: nacos
# config:
@@ -22,7 +22,7 @@
# group: dev
# data-id: com.doumee.meeting.admin
discovery:
- server-addr: http://192.168.0.7:8848 #閰嶇疆Nacos鍦板潃
+ server-addr: http://192.168.0.3:8848 #閰嶇疆Nacos鍦板潃
# namespace: dmvisit
namespace: funingyunwei_dev
username: nacos
diff --git a/server/visits/dmvisit_admin/src/main/resources/bootstrap-test.yml b/server/visits/dmvisit_admin/src/main/resources/bootstrap-test.yml
index 385cbc6..5ed4f91 100644
--- a/server/visits/dmvisit_admin/src/main/resources/bootstrap-test.yml
+++ b/server/visits/dmvisit_admin/src/main/resources/bootstrap-test.yml
@@ -10,7 +10,7 @@
# 鏆傛椂鍏抽棴缂撳瓨
enabled: false
nacos:
- server-addr: http://192.168.0.7:8848 #閰嶇疆Nacos鍦板潃
+ server-addr: http://192.168.0.3:8848 #閰嶇疆Nacos鍦板潃
username: nacos
password: nacos
# config:
@@ -22,7 +22,7 @@
# group: dev
# data-id: com.doumee.meeting.admin
discovery:
- server-addr: http://192.168.0.7:8848 #閰嶇疆Nacos鍦板潃
+ server-addr: http://192.168.0.3:8848 #閰嶇疆Nacos鍦板潃
namespace: funingyunwei_test
username: nacos
password: nacos
\ No newline at end of file
diff --git a/server/visits/dmvisit_service/src/main/java/com/doumee/dao/business/YwGatewayMapper.java b/server/visits/dmvisit_service/src/main/java/com/doumee/dao/business/YwGatewayMapper.java
new file mode 100644
index 0000000..a27c973
--- /dev/null
+++ b/server/visits/dmvisit_service/src/main/java/com/doumee/dao/business/YwGatewayMapper.java
@@ -0,0 +1,13 @@
+package com.doumee.dao.business;
+
+import com.github.yulichang.base.MPJBaseMapper;
+import com.doumee.dao.business.model.YwGateway;
+
+/**
+ * 缃戝叧绠$悊Mapper
+ * @author renkang
+ * @date 2026/04/02
+ */
+public interface YwGatewayMapper extends MPJBaseMapper<YwGateway> {
+
+}
diff --git a/server/visits/dmvisit_service/src/main/java/com/doumee/dao/business/model/YwGateway.java b/server/visits/dmvisit_service/src/main/java/com/doumee/dao/business/model/YwGateway.java
new file mode 100644
index 0000000..f30c540
--- /dev/null
+++ b/server/visits/dmvisit_service/src/main/java/com/doumee/dao/business/model/YwGateway.java
@@ -0,0 +1,87 @@
+package com.doumee.dao.business.model;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.doumee.core.annotation.excel.ExcelColumn;
+import com.doumee.core.model.LoginUserModel;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import java.util.Date;
+
+/**
+ * 缃戝叧绠$悊
+ * @author renkang
+ * @date 2026/04/02
+ */
+@Data
+@ApiModel("缃戝叧绠$悊")
+@TableName("`yw_gateway`")
+public class YwGateway extends LoginUserModel {
+
+ @TableId(type = IdType.AUTO)
+ @ApiModelProperty(value = "涓婚敭", example = "1")
+ @ExcelColumn(name = "涓婚敭")
+ private Integer id;
+
+ @ApiModelProperty(value = "鍒涘缓浜虹紪鐮�", example = "1")
+ @ExcelColumn(name = "鍒涘缓浜虹紪鐮�")
+ private Integer creator;
+
+ @ApiModelProperty(value = "鍒涘缓鏃堕棿")
+ @ExcelColumn(name = "鍒涘缓鏃堕棿")
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ private Date createDate;
+
+ @ApiModelProperty(value = "鏇存柊浜虹紪鐮�", example = "1")
+ @ExcelColumn(name = "鏇存柊浜虹紪鐮�")
+ private Integer editor;
+
+ @ApiModelProperty(value = "鏇存柊鏃堕棿")
+ @ExcelColumn(name = "鏇存柊鏃堕棿")
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ private Date editDate;
+
+ @ApiModelProperty(value = "鏄惁鍒犻櫎0鍚� 1鏄�", example = "0")
+ @ExcelColumn(name = "鏄惁鍒犻櫎0鍚� 1鏄�")
+ private Integer isdeleted;
+
+ @ApiModelProperty(value = "缃戝叧鍚嶇О")
+ @ExcelColumn(name = "缃戝叧鍚嶇О")
+ private String name;
+
+ @ApiModelProperty(value = "澶囨敞")
+ @ExcelColumn(name = "澶囨敞")
+ private String remark;
+
+ @ApiModelProperty(value = "鐘舵�� 0鍚敤 1绂佺敤", example = "0")
+ @ExcelColumn(name = "鐘舵�� 0鍚敤 1绂佺敤")
+ private Integer status;
+
+ @ApiModelProperty(value = "鎺掑簭鐮�", example = "1")
+ @ExcelColumn(name = "鎺掑簭鐮�")
+ private Integer sortnum;
+
+ @ApiModelProperty(value = "缃戝叧鍨嬪彿")
+ @ExcelColumn(name = "缃戝叧鍨嬪彿")
+ private String gatewayModel;
+
+ @ApiModelProperty(value = "缃戝叧璁惧鍙�")
+ @ExcelColumn(name = "缃戝叧璁惧鍙�")
+ private String gatewayCode;
+
+ @ApiModelProperty(value = "鏈�鍚庡績璺虫椂闂�")
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ @ExcelColumn(name = "鏈�鍚庡績璺虫椂闂�")
+ private Date lastHeartbeatTime;
+
+ @ApiModelProperty(value = "鎵�灞為」鐩紪鐮侊紙鍏宠仈yw_project)", example = "1")
+ private Integer projectId;
+
+ @ApiModelProperty(value = "椤圭洰鍚嶇О")
+ @TableField(exist = false)
+ private String projectName;
+}
diff --git a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/YwGatewayService.java b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/YwGatewayService.java
new file mode 100644
index 0000000..b76f0e7
--- /dev/null
+++ b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/YwGatewayService.java
@@ -0,0 +1,70 @@
+package com.doumee.service.business;
+
+import com.doumee.core.model.LoginUserInfo;
+import com.doumee.core.model.PageData;
+import com.doumee.core.model.PageWrap;
+import com.doumee.dao.business.model.YwGateway;
+
+import java.util.List;
+
+/**
+ * 缃戝叧绠$悊Service瀹氫箟
+ * @author renkang
+ * @date 2026/04/02
+ */
+public interface YwGatewayService {
+
+ /**
+ * 鍒涘缓
+ *
+ * @param ywGateway 瀹炰綋瀵硅薄
+ * @return Integer
+ */
+ Integer create(YwGateway ywGateway);
+
+ /**
+ * 涓婚敭鍒犻櫎
+ *
+ * @param id 涓婚敭
+ * @param user 鐧诲綍鐢ㄦ埛
+ */
+ void deleteById(Integer id, LoginUserInfo user);
+
+ /**
+ * 鎵归噺涓婚敭鍒犻櫎
+ *
+ * @param ids 涓婚敭闆�
+ * @param user 鐧诲綍鐢ㄦ埛
+ */
+ void deleteByIdInBatch(List<Integer> ids, LoginUserInfo user);
+
+ /**
+ * 涓婚敭鏇存柊
+ *
+ * @param ywGateway 瀹炰綋瀵硅薄
+ */
+ void updateById(YwGateway ywGateway);
+
+ /**
+ * 鏇存柊鐘舵��
+ *
+ * @param ywGateway 瀹炰綋瀵硅薄锛坕d + status锛�
+ */
+ void updateStatusById(YwGateway ywGateway);
+
+ /**
+ * 涓婚敭鏌ヨ璇︽儏
+ *
+ * @param id 涓婚敭
+ * @return YwGateway
+ */
+ YwGateway findById(Integer id);
+
+ /**
+ * 鍒嗛〉鏌ヨ
+ *
+ * @param pageWrap 鍒嗛〉瀵硅薄
+ * @return PageData<YwGateway>
+ */
+ PageData<YwGateway> findPage(PageWrap<YwGateway> pageWrap);
+}
diff --git a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwGatewayServiceImpl.java b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwGatewayServiceImpl.java
new file mode 100644
index 0000000..d9b5653
--- /dev/null
+++ b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwGatewayServiceImpl.java
@@ -0,0 +1,142 @@
+package com.doumee.service.business.impl;
+
+import com.doumee.core.constants.ResponseStatus;
+import com.doumee.core.exception.BusinessException;
+import com.doumee.core.model.LoginUserInfo;
+import com.doumee.core.model.PageData;
+import com.doumee.core.model.PageWrap;
+import com.doumee.core.utils.Constants;
+import com.doumee.core.utils.DateUtil;
+import com.doumee.core.utils.Utils;
+import com.doumee.dao.business.YwGatewayMapper;
+import com.doumee.dao.business.model.YwGateway;
+import com.doumee.service.business.YwGatewayService;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.github.yulichang.wrapper.MPJLambdaWrapper;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.util.CollectionUtils;
+
+import java.util.Date;
+import java.util.List;
+import java.util.Objects;
+
+/**
+ * 缃戝叧绠$悊Service瀹炵幇
+ * @author renkang
+ * @date 2026/04/02
+ */
+@Service
+public class YwGatewayServiceImpl implements YwGatewayService {
+
+ @Autowired
+ private YwGatewayMapper ywGatewayMapper;
+
+ @Override
+ public Integer create(YwGateway ywGateway) {
+ if (Objects.isNull(ywGateway)
+ || StringUtils.isBlank(ywGateway.getName())
+ || StringUtils.isBlank(ywGateway.getGatewayCode())) {
+ throw new BusinessException(ResponseStatus.BAD_REQUEST);
+ }
+ LoginUserInfo loginUserInfo = ywGateway.getLoginUserInfo();
+ // 鏍¢獙缃戝叧璁惧鍙峰敮涓�
+ if (ywGatewayMapper.selectCount(new QueryWrapper<YwGateway>().lambda()
+ .eq(YwGateway::getIsdeleted, Constants.ZERO)
+ .eq(YwGateway::getGatewayCode, ywGateway.getGatewayCode())) > Constants.ZERO) {
+ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(), "缃戝叧璁惧鍙烽噸澶�!");
+ }
+ ywGateway.setCreateDate(new Date());
+ ywGateway.setCreator(loginUserInfo.getId());
+ ywGateway.setEditDate(new Date());
+ ywGateway.setEditor(loginUserInfo.getId());
+ ywGateway.setIsdeleted(Constants.ZERO);
+ ywGatewayMapper.insert(ywGateway);
+ return ywGateway.getId();
+ }
+
+ @Override
+ public void deleteById(Integer id, LoginUserInfo user) {
+ ywGatewayMapper.update(new UpdateWrapper<YwGateway>()
+ .lambda()
+ .set(YwGateway::getIsdeleted, Constants.ONE)
+ .set(YwGateway::getEditDate, DateUtil.getCurrDateTime())
+ .set(YwGateway::getEditor, user.getId())
+ .eq(YwGateway::getId, id)
+ );
+ }
+
+ @Override
+ public void deleteByIdInBatch(List<Integer> ids, LoginUserInfo user) {
+ if (CollectionUtils.isEmpty(ids)) {
+ return;
+ }
+ for (Integer id : ids) {
+ this.deleteById(id, user);
+ }
+ }
+
+ @Override
+ public void updateById(YwGateway ywGateway) {
+ if (Objects.isNull(ywGateway)
+ || Objects.isNull(ywGateway.getId())
+ || StringUtils.isBlank(ywGateway.getName())
+ || StringUtils.isBlank(ywGateway.getGatewayCode())) {
+ throw new BusinessException(ResponseStatus.BAD_REQUEST);
+ }
+ LoginUserInfo loginUserInfo = ywGateway.getLoginUserInfo();
+ // 鏍¢獙缃戝叧璁惧鍙峰敮涓�锛堟帓闄よ嚜韬級
+ if (ywGatewayMapper.selectCount(new QueryWrapper<YwGateway>().lambda()
+ .eq(YwGateway::getIsdeleted, Constants.ZERO)
+ .eq(YwGateway::getGatewayCode, ywGateway.getGatewayCode())
+ .ne(YwGateway::getId, ywGateway.getId())) > Constants.ZERO) {
+ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(), "缃戝叧璁惧鍙烽噸澶�!");
+ }
+ ywGateway.setEditDate(new Date());
+ ywGateway.setEditor(loginUserInfo.getId());
+ ywGatewayMapper.updateById(ywGateway);
+ }
+
+ @Override
+ public void updateStatusById(YwGateway ywGateway) {
+ YwGateway model = new YwGateway();
+ model.setId(ywGateway.getId());
+ model.setStatus(ywGateway.getStatus());
+ ywGatewayMapper.updateById(model);
+ }
+
+ @Override
+ public YwGateway findById(Integer id) {
+ return ywGatewayMapper.selectJoinOne(YwGateway.class,
+ new MPJLambdaWrapper<YwGateway>()
+ .selectAll(YwGateway.class)
+ .selectAs(com.doumee.dao.business.model.YwProject::getName, YwGateway::getProjectName)
+ .leftJoin(com.doumee.dao.business.model.YwProject.class, com.doumee.dao.business.model.YwProject::getId, YwGateway::getProjectId)
+ .eq(YwGateway::getId, id)
+ .last(" limit 1 ")
+ );
+ }
+
+ @Override
+ public PageData<YwGateway> findPage(PageWrap<YwGateway> pageWrap) {
+ IPage<YwGateway> page = new Page<>(pageWrap.getPage(), pageWrap.getCapacity());
+ MPJLambdaWrapper<YwGateway> queryWrapper = new MPJLambdaWrapper<>();
+ Utils.MP.blankToNull(pageWrap.getModel());
+ YwGateway model = pageWrap.getModel();
+ queryWrapper.selectAll(YwGateway.class)
+ .selectAs(com.doumee.dao.business.model.YwProject::getName, YwGateway::getProjectName)
+ .leftJoin(com.doumee.dao.business.model.YwProject.class, com.doumee.dao.business.model.YwProject::getId, YwGateway::getProjectId)
+ .and(Objects.nonNull(model) && StringUtils.isNotBlank(model.getName()),
+ i -> i.like(YwGateway::getName, model.getName()).or().like(YwGateway::getGatewayCode, model.getName()))
+ .eq(Objects.nonNull(model) && Objects.nonNull(model.getStatus()), YwGateway::getStatus, model.getStatus())
+ .eq(Objects.nonNull(model) && Objects.nonNull(model.getProjectId()), YwGateway::getProjectId, model.getProjectId())
+ .eq(YwGateway::getIsdeleted, Constants.ZERO)
+ .orderByDesc(YwGateway::getCreateDate);
+ IPage<YwGateway> iPage = ywGatewayMapper.selectJoinPage(page, YwGateway.class, queryWrapper);
+ return PageData.from(iPage);
+ }
+}
--
Gitblit v1.9.3