From a5a5da73dec49c5cd23761edad8be98cde8a3b74 Mon Sep 17 00:00:00 2001
From: xiangpei <xiangpei@timesnew.cn>
Date: 星期六, 31 八月 2024 17:24:23 +0800
Subject: [PATCH] 平台调整

---
 ycl-pojo/src/main/java/com/ycl/platform/domain/entity/PlatformOnline.java       |   10 +---
 ycl-server/src/main/java/com/ycl/platform/service/impl/PlatformServiceImpl.java |   25 ++++++------
 ycl-pojo/src/main/java/com/ycl/platform/domain/form/PlatformForm.java           |    6 +-
 ycl-server/src/main/java/com/ycl/task/PlatformTask.java                         |    8 +--
 ycl-server/src/main/resources/mapper/zgyw/PlatformOnlineMapper.xml              |   12 ++++--
 ycl-pojo/src/main/java/com/ycl/platform/domain/vo/PlatformOnlineVO.java         |    3 +
 6 files changed, 33 insertions(+), 31 deletions(-)

diff --git a/ycl-pojo/src/main/java/com/ycl/platform/domain/entity/PlatformOnline.java b/ycl-pojo/src/main/java/com/ycl/platform/domain/entity/PlatformOnline.java
index 712abdc..aaed5f4 100644
--- a/ycl-pojo/src/main/java/com/ycl/platform/domain/entity/PlatformOnline.java
+++ b/ycl-pojo/src/main/java/com/ycl/platform/domain/entity/PlatformOnline.java
@@ -20,13 +20,9 @@
 
     private static final long serialVersionUID = 1L;
 
-    @TableField("platform_name")
-    /** 骞冲彴鍚嶇О */
-    private String platformName;
-
-    @TableField("platform_ip")
-    /** 骞冲彴ip/鍩熷悕 */
-    private String platformIp;
+    @TableField("platform_id")
+    /** 骞冲彴id */
+    private Integer platformId;
 
     @TableField("create_date")
     /** 缁熻鐨勬棩鏈� */
diff --git a/ycl-pojo/src/main/java/com/ycl/platform/domain/form/PlatformForm.java b/ycl-pojo/src/main/java/com/ycl/platform/domain/form/PlatformForm.java
index c820bad..5bbd016 100644
--- a/ycl-pojo/src/main/java/com/ycl/platform/domain/form/PlatformForm.java
+++ b/ycl-pojo/src/main/java/com/ycl/platform/domain/form/PlatformForm.java
@@ -36,7 +36,7 @@
     private String platformIP;
 
     @ApiModelProperty("琛屾斂鍖哄煙")
-    private String area;
+    private List<String> areaList;
 
 //    @NotBlank(message = "骞冲彴鑱旂郴浜轰笉鑳戒负绌�", groups = {Add.class, Update.class})
 //    @ApiModelProperty("骞冲彴鑱旂郴浜�")
@@ -49,8 +49,8 @@
     @ApiModelProperty("澶囨敞")
     private String remark;
 
-    @ApiModelProperty("閮ㄧ讲骞冲彴鍒楄〃锛屼竴涓钩鍙板彲閮ㄧ讲鍒板涓尯鍘�")
-    private List<Platform> deployList;
+//    @ApiModelProperty("閮ㄧ讲骞冲彴鍒楄〃锛屼竴涓钩鍙板彲閮ㄧ讲鍒板涓尯鍘�")
+//    private List<Platform> deployList;
 
     public static Platform getEntityByForm(@NonNull PlatformForm form, Platform entity) {
         if(entity == null) {
diff --git a/ycl-pojo/src/main/java/com/ycl/platform/domain/vo/PlatformOnlineVO.java b/ycl-pojo/src/main/java/com/ycl/platform/domain/vo/PlatformOnlineVO.java
index 381b8a0..22846cd 100644
--- a/ycl-pojo/src/main/java/com/ycl/platform/domain/vo/PlatformOnlineVO.java
+++ b/ycl-pojo/src/main/java/com/ycl/platform/domain/vo/PlatformOnlineVO.java
@@ -22,6 +22,9 @@
     /** 骞冲彴ip/鍩熷悕 */
     private String platformIp;
 
+    /** 鍖哄煙 */
+    private String area;
+
     /** 缁熻鐨勬棩鏈� */
     private Date createDate;
 
diff --git a/ycl-server/src/main/java/com/ycl/platform/service/impl/PlatformServiceImpl.java b/ycl-server/src/main/java/com/ycl/platform/service/impl/PlatformServiceImpl.java
index aa4c25c..3f33e78 100644
--- a/ycl-server/src/main/java/com/ycl/platform/service/impl/PlatformServiceImpl.java
+++ b/ycl-server/src/main/java/com/ycl/platform/service/impl/PlatformServiceImpl.java
@@ -49,19 +49,20 @@
         Date now = new Date();
         entity.setCreateTime(now);
         entity.setUpdateTime(now);
+        entity.setArea(form.getAreaList().stream().collect(Collectors.joining(",")));
         baseMapper.insert(entity);
-        if (! CollectionUtils.isEmpty(form.getDeployList())) {
-            List<Platform> childList = form.getDeployList().stream().map(deploy -> {
-                Platform child = new Platform();
-                BeanUtils.copyProperties(deploy, child);
-                child.setPlatformName(entity.getPlatformName());
-                child.setParentId(entity.getId());
-                child.setCreateTime(now);
-                child.setUpdateTime(now);
-                return child;
-            }).collect(Collectors.toList());
-            this.saveBatch(childList);
-        }
+//        if (! CollectionUtils.isEmpty(form.getDeployList())) {
+//            List<Platform> childList = form.getDeployList().stream().map(deploy -> {
+//                Platform child = new Platform();
+//                BeanUtils.copyProperties(deploy, child);
+//                child.setPlatformName(entity.getPlatformName());
+//                child.setParentId(entity.getId());
+//                child.setCreateTime(now);
+//                child.setUpdateTime(now);
+//                return child;
+//            }).collect(Collectors.toList());
+//            this.saveBatch(childList);
+//        }
         return Result.ok("娣诲姞鎴愬姛");
     }
 
diff --git a/ycl-server/src/main/java/com/ycl/task/PlatformTask.java b/ycl-server/src/main/java/com/ycl/task/PlatformTask.java
index 6c8fbd4..31643e7 100644
--- a/ycl-server/src/main/java/com/ycl/task/PlatformTask.java
+++ b/ycl-server/src/main/java/com/ycl/task/PlatformTask.java
@@ -100,20 +100,18 @@
             Object outLineTime = redisTemplate.opsForValue().get(REDIS_KEY_PREFIX + platform.getPlatformIP());
             Integer outlineTimeSed = Objects.isNull(outLineTime) ? 0 : (Integer) outLineTime;
             PlatformOnline one = new LambdaQueryChainWrapper<>(platformOnlineService.getBaseMapper())
-                    .eq(PlatformOnline::getPlatformIp, platform.getPlatformIP())
+                    .eq(PlatformOnline::getPlatformId, platform.getId())
                     .eq(PlatformOnline::getCreateDate, sqlDate)
                     .one();
             if (Objects.isNull(one)) {
                 one = new PlatformOnline();
-                one.setPlatformIp(platform.getPlatformIP());
-                one.setPlatformName(platform.getPlatformName());
+                one.setPlatformId(platform.getId());
                 one.setCreateDate(sqlDate);
                 one.setTodayOutlineSed(outlineTimeSed);
             } else {
                 one.setTodayOutlineSed(one.getTodayOutlineSed() + outlineTimeSed);
             }
-            one.setPlatformIp(platform.getPlatformIP());
-            one.setPlatformName(platform.getPlatformName());
+            one.setPlatformId(platform.getId());
             one.setCreateDate(sqlDate);
 
             platformOnlineService.saveOrUpdate(one);
diff --git a/ycl-server/src/main/resources/mapper/zgyw/PlatformOnlineMapper.xml b/ycl-server/src/main/resources/mapper/zgyw/PlatformOnlineMapper.xml
index ef4cec1..78a7fab 100644
--- a/ycl-server/src/main/resources/mapper/zgyw/PlatformOnlineMapper.xml
+++ b/ycl-server/src/main/resources/mapper/zgyw/PlatformOnlineMapper.xml
@@ -14,8 +14,9 @@
 
     <select id="getById" resultMap="BaseResultMap">
         SELECT
-            TPO.platform_name,
-            TPO.platform_ip,
+            TP.platform_name,
+            TP.platform_ip,
+            TP.area,
             TPO.create_date,
             TPO.today_outline_sed,
             TPO.update_time,
@@ -23,6 +24,7 @@
             TPO.id
         FROM
             t_platform_online TPO
+                INNER JOIN t_platform TP ON TP.id = TPO.platform_id
         WHERE
             TPO.id = #{id} AND TPO.deleted = 0
     </select>
@@ -30,8 +32,9 @@
 
     <select id="getPage" resultMap="BaseResultMap">
         SELECT
-            TPO.platform_name,
-            TPO.platform_ip,
+            TP.platform_name,
+            TP.platform_ip,
+            TP.area,
             TPO.create_date,
             TPO.today_outline_sed,
             TPO.update_time,
@@ -39,6 +42,7 @@
             TPO.id
         FROM
             t_platform_online TPO
+                INNER JOIN t_platform TP ON TP.id = TPO.platform_id
         WHERE
             TPO.deleted = 0
             <if test="query.startTime != null and query.endTime != null">

--
Gitblit v1.8.0