From 4bc39717f80af51e3d670a9d0ae5110a2a113578 Mon Sep 17 00:00:00 2001
From: xiangpei <xiangpei@timesnew.cn>
Date: 星期五, 12 四月 2024 16:16:22 +0800
Subject: [PATCH] 运维阈值修改接口。删除新增、删除接口

---
 ycl-server/src/main/java/com/ycl/platform/service/impl/YwThresholdServiceImpl.java |   42 ++++++
 ycl-common/src/main/java/enumeration/general/BusinessTypeEnum.java                 |   27 ++++
 ycl-server/src/main/java/com/ycl/platform/controller/YwThresholdController.java    |   48 ++++---
 ycl-server/src/main/java/com/ycl/platform/mapper/YwThresholdMapper.java            |    3 
 ycl-pojo/src/main/java/com/ycl/platform/domain/form/CarThresholdForm.java          |   61 ++++++++++
 ycl-server/src/main/java/com/ycl/platform/service/IYwThresholdService.java         |   29 ++++
 ycl-pojo/src/main/java/com/ycl/platform/domain/form/VideoThresholdForm.java        |   42 +++++++
 ycl-pojo/src/main/java/com/ycl/platform/domain/form/FaceThresholdForm.java         |   61 ++++++++++
 8 files changed, 290 insertions(+), 23 deletions(-)

diff --git a/ycl-common/src/main/java/enumeration/general/BusinessTypeEnum.java b/ycl-common/src/main/java/enumeration/general/BusinessTypeEnum.java
new file mode 100644
index 0000000..bf44c24
--- /dev/null
+++ b/ycl-common/src/main/java/enumeration/general/BusinessTypeEnum.java
@@ -0,0 +1,27 @@
+package enumeration.general;
+
+import com.baomidou.mybatisplus.annotation.EnumValue;
+import com.fasterxml.jackson.annotation.JsonValue;
+
+/**
+ * 涓夊ぇ鏉垮潡
+ *
+ * @author锛歺p
+ * @date锛�2024/4/12 10:21
+ */
+public enum BusinessTypeEnum {
+    VIDEO("video", "瑙嗛"),
+    CAR("CAR", "杞﹁締"),
+    FACE("face", "浜鸿劯");
+
+    @EnumValue // 鏍囨槑璇ュ瓧娈靛瓨鍏ユ暟鎹簱
+    private final String code;
+
+    @JsonValue // 鏍囨槑鍦ㄨ浆JSON鏃朵娇鐢ㄨ瀛楁锛屽嵆鍝嶅簲鏃�
+    private final String desc;
+
+    BusinessTypeEnum(String code, String desc) {
+        this.code = code;
+        this.desc = desc;
+    }
+}
diff --git a/ycl-pojo/src/main/java/com/ycl/platform/domain/form/CarThresholdForm.java b/ycl-pojo/src/main/java/com/ycl/platform/domain/form/CarThresholdForm.java
new file mode 100644
index 0000000..6a4226a
--- /dev/null
+++ b/ycl-pojo/src/main/java/com/ycl/platform/domain/form/CarThresholdForm.java
@@ -0,0 +1,61 @@
+package com.ycl.platform.domain.form;
+
+import com.ycl.platform.base.AbsForm;
+import enumeration.general.BusinessTypeEnum;
+import io.swagger.annotations.ApiModelProperty;
+import jakarta.validation.constraints.NotBlank;
+import jakarta.validation.constraints.NotNull;
+import lombok.Data;
+
+/**
+ * 杞﹁締宸ュ崟闃堝��
+ *
+ * @author锛歺p
+ * @date锛�2024/4/12 10:30
+ */
+@Data
+public class CarThresholdForm {
+
+    @ApiModelProperty(value = "id,淇敼蹇呬紶", required = false)
+    @NotBlank(message = "璇烽�夋嫨淇敼鏁版嵁")
+    private String id;
+
+    @NotBlank(message = "璇烽�夋嫨璁惧绫诲瀷")
+    private BusinessTypeEnum monitorType;
+
+    @NotNull(message = "璇疯緭鍏ヨ秴鏃跺ぉ鏁�")
+    private Integer timeout;
+
+    /** 杩囪溅杈� */
+    @NotBlank(message = "璇峰~鍐欒繃杞︽暟鎹噺")
+    private String passCarNum;
+
+    /** 杩囪溅缂哄け鐜� */
+    @NotBlank(message = "璇峰~鍐欒繃杞︾己澶辩巼")
+    private String passCarMissRate;
+
+    /** 鏈夋晥杩囪溅鏁版嵁閲� */
+    @NotBlank(message = "璇峰~鍐欐湁鏁堣繃杞︽暟鎹噺")
+    private String passCarEffectiveNum;
+
+    /** 鎶芥閲� */
+    @NotBlank(message = "璇峰~鍐欐娊妫�閲�")
+    private String samplingInspectionNum;
+
+    /** 璁惧娲昏穬鐜� */
+    @NotBlank(message = "璇峰~鍐欒澶囨椿璺冪巼")
+    private String deviceActiveRate;
+
+    /** 鎶撴媿鍙婃椂鐜� */
+    @NotBlank(message = "璇峰~鍐欐姄鎷嶅強鏃剁巼")
+    private String timelyCapture;
+
+    /** 鏃堕挓涓嶅噯纭巼 */
+    @NotBlank(message = "璇峰~鍐欐椂閽熶笉鍑嗙‘鐜�")
+    private String timeNotAccuracy;
+
+    /** 鏃堕挓鍑嗙‘鐜� */
+    @NotBlank(message = "璇峰~鍐欐椂閽熷噯纭巼")
+    private String timeAccuracy;
+
+}
diff --git a/ycl-pojo/src/main/java/com/ycl/platform/domain/form/FaceThresholdForm.java b/ycl-pojo/src/main/java/com/ycl/platform/domain/form/FaceThresholdForm.java
new file mode 100644
index 0000000..6cb51a0
--- /dev/null
+++ b/ycl-pojo/src/main/java/com/ycl/platform/domain/form/FaceThresholdForm.java
@@ -0,0 +1,61 @@
+package com.ycl.platform.domain.form;
+
+import com.ycl.platform.base.AbsForm;
+import enumeration.general.BusinessTypeEnum;
+import io.swagger.annotations.ApiModelProperty;
+import jakarta.validation.constraints.NotBlank;
+import jakarta.validation.constraints.NotNull;
+import lombok.Data;
+
+/**
+ * 浜鸿劯宸ュ崟闃堝��
+ *
+ * @author锛歺p
+ * @date锛�2024/4/12 10:30
+ */
+@Data
+public class FaceThresholdForm {
+
+    @ApiModelProperty(value = "id,淇敼蹇呬紶", required = false)
+    @NotBlank(message = "璇烽�夋嫨淇敼鏁版嵁")
+    private String id;
+
+    @NotBlank(message = "璇烽�夋嫨璁惧绫诲瀷")
+    private BusinessTypeEnum monitorType;
+
+    @NotNull(message = "璇疯緭鍏ヨ秴鏃跺ぉ鏁�")
+    private Integer timeout;
+
+    /** 鎶撴媿閲� */
+    @NotBlank(message = "璇峰~鍐欐姄鎷嶉噺")
+    private String captureNum;
+
+    /** 鍙婃椂鐜� */
+    @NotBlank(message = "璇峰~鍐欏強鏃剁巼")
+    private String timelyRate;
+
+    /** 寤惰繜閲� */
+    @NotBlank(message = "璇峰~鍐欏欢杩熼噺")
+    private String delayAmount;
+
+    /** 鎶芥閲� */
+    @NotBlank(message = "璇峰~鍐欐娊妫�閲�")
+    private String samplingInspectionNum;
+
+    /** 璁惧娲昏穬鐜� */
+    @NotBlank(message = "璇峰~鍐欒澶囨椿璺冪巼")
+    private String deviceActiveRate;
+
+    /** 鎶撴媿鍙婃椂鐜� */
+    @NotBlank(message = "璇峰~鍐欐姄鎷嶅強鏃剁巼")
+    private String timelyCapture;
+
+    /** 鏃堕挓涓嶅噯纭巼 */
+    @NotBlank(message = "璇峰~鍐欐椂閽熶笉鍑嗙‘鐜�")
+    private String timeNotAccuracy;
+
+    /** 鏃堕挓鍑嗙‘鐜� */
+    @NotBlank(message = "璇峰~鍐欐椂閽熷噯纭巼")
+    private String timeAccuracy;
+
+}
diff --git a/ycl-pojo/src/main/java/com/ycl/platform/domain/form/VideoThresholdForm.java b/ycl-pojo/src/main/java/com/ycl/platform/domain/form/VideoThresholdForm.java
new file mode 100644
index 0000000..fbd89d1
--- /dev/null
+++ b/ycl-pojo/src/main/java/com/ycl/platform/domain/form/VideoThresholdForm.java
@@ -0,0 +1,42 @@
+package com.ycl.platform.domain.form;
+
+import com.ycl.platform.base.AbsForm;
+import com.ycl.system.domain.group.Update;
+import enumeration.general.BusinessTypeEnum;
+import io.swagger.annotations.ApiModelProperty;
+import jakarta.validation.constraints.NotBlank;
+import jakarta.validation.constraints.NotNull;
+import lombok.Data;
+
+/**
+ * 瑙嗛宸ュ崟闃堝��
+ *
+ * @author锛歺p
+ * @date锛�2024/4/12 10:30
+ */
+@Data
+public class VideoThresholdForm{
+
+    @ApiModelProperty(value = "id,淇敼蹇呬紶", required = false)
+    @NotBlank(message = "璇烽�夋嫨淇敼鏁版嵁")
+    private String id;
+
+    @NotBlank(message = "璇烽�夋嫨璁惧绫诲瀷")
+    private BusinessTypeEnum monitorType;
+
+    @NotNull(message = "璇疯緭鍏ヨ秴鏃跺ぉ鏁�")
+    private Integer timeout;
+
+    /** 閲囬泦璁惧鎬绘暟 */
+    @NotBlank(message = "璇峰~鍐欓噰闆嗚澶囨�绘暟")
+    private String collectionEquipmentTotalNum;
+
+    /** 妫�娴嬫甯歌澶囨暟 */
+    @NotBlank(message = "璇峰~鍐欐娴嬫甯歌澶囨暟")
+    private String monitoringNormalEquipmentNum;
+
+    /** 缁忕含搴﹀紓甯歌澶囨暟 */
+    @NotBlank(message = "璇峰~鍐欑粡绾害寮傚父璁惧鏁�")
+    private String longitudeLatitudeExceptionNum;
+
+}
diff --git a/ycl-server/src/main/java/com/ycl/platform/controller/YwThresholdController.java b/ycl-server/src/main/java/com/ycl/platform/controller/YwThresholdController.java
index 526fa72..f314698 100644
--- a/ycl-server/src/main/java/com/ycl/platform/controller/YwThresholdController.java
+++ b/ycl-server/src/main/java/com/ycl/platform/controller/YwThresholdController.java
@@ -2,14 +2,19 @@
 
 import annotation.Log;
 import com.ycl.platform.domain.entity.YwThreshold;
+import com.ycl.platform.domain.form.CarThresholdForm;
+import com.ycl.platform.domain.form.FaceThresholdForm;
+import com.ycl.platform.domain.form.VideoThresholdForm;
 import com.ycl.platform.service.IYwThresholdService;
 import com.ycl.system.AjaxResult;
 import com.ycl.system.controller.BaseController;
+import com.ycl.system.domain.group.Update;
 import com.ycl.system.page.TableDataInfo;
 import com.ycl.utils.poi.ExcelUtil;
 import enumeration.BusinessType;
 import jakarta.servlet.http.HttpServletResponse;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
 
 import java.util.List;
@@ -59,32 +64,33 @@
     }
 
     /**
-     * 鏂板杩愮淮闃堝��
-     */
-    // @PreAuthorize("@ss.hasPermi('ycl:threshold:add')")
-    @Log(title = "杩愮淮闃堝��", businessType = BusinessType.INSERT)
-    @PostMapping
-    public AjaxResult add(@RequestBody YwThreshold ywThreshold) {
-        return toAjax(ywThresholdService.insertYwThreshold(ywThreshold));
-    }
-
-    /**
-     * 淇敼杩愮淮闃堝��
+     * 淇敼浜鸿劯闃堝��
      */
     // @PreAuthorize("@ss.hasPermi('ycl:threshold:edit')")
-    @Log(title = "杩愮淮闃堝��", businessType = BusinessType.UPDATE)
-    @PutMapping
-    public AjaxResult edit(@RequestBody YwThreshold ywThreshold) {
-        return toAjax(ywThresholdService.updateYwThreshold(ywThreshold));
+    @Log(title = "淇敼浜鸿劯杩愮淮闃堝��", businessType = BusinessType.UPDATE)
+    @PutMapping("/face")
+    public AjaxResult editFace(@RequestBody @Validated FaceThresholdForm form) {
+        return toAjax(ywThresholdService.editFace(form));
     }
 
     /**
-     * 鍒犻櫎杩愮淮闃堝��
+     * 淇敼杞﹁締闃堝��
      */
-    // @PreAuthorize("@ss.hasPermi('ycl:threshold:remove')")
-    @Log(title = "杩愮淮闃堝��", businessType = BusinessType.DELETE)
-    @DeleteMapping("/{ids}")
-    public AjaxResult remove(@PathVariable Integer[] ids) {
-        return toAjax(ywThresholdService.deleteYwThresholdByIds(ids));
+    // @PreAuthorize("@ss.hasPermi('ycl:threshold:edit')")
+    @Log(title = "淇敼杞﹁締闃堝��", businessType = BusinessType.UPDATE)
+    @PutMapping("/car")
+    public AjaxResult editCar(@RequestBody @Validated CarThresholdForm form) {
+        return toAjax(ywThresholdService.editCar(form));
     }
+
+    /**
+     * 淇敼瑙嗛闃堝��
+     */
+    // @PreAuthorize("@ss.hasPermi('ycl:threshold:edit')")
+    @Log(title = "淇敼瑙嗛闃堝��", businessType = BusinessType.UPDATE)
+    @PutMapping("video")
+    public AjaxResult editVideo(@RequestBody @Validated VideoThresholdForm form) {
+        return toAjax(ywThresholdService.editVideo(form));
+    }
+
 }
diff --git a/ycl-server/src/main/java/com/ycl/platform/mapper/YwThresholdMapper.java b/ycl-server/src/main/java/com/ycl/platform/mapper/YwThresholdMapper.java
index b4dd57f..5180abe 100644
--- a/ycl-server/src/main/java/com/ycl/platform/mapper/YwThresholdMapper.java
+++ b/ycl-server/src/main/java/com/ycl/platform/mapper/YwThresholdMapper.java
@@ -1,5 +1,6 @@
 package com.ycl.platform.mapper;
 
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.ycl.platform.domain.entity.YwThreshold;
 
 import java.util.List;
@@ -10,7 +11,7 @@
  * @author gonghl
  * @date 2024-03-25
  */
-public interface YwThresholdMapper {
+public interface YwThresholdMapper extends BaseMapper<YwThreshold> {
     /**
      * 鏌ヨ杩愮淮闃堝��
      *
diff --git a/ycl-server/src/main/java/com/ycl/platform/service/IYwThresholdService.java b/ycl-server/src/main/java/com/ycl/platform/service/IYwThresholdService.java
index db7356a..efa5b47 100644
--- a/ycl-server/src/main/java/com/ycl/platform/service/IYwThresholdService.java
+++ b/ycl-server/src/main/java/com/ycl/platform/service/IYwThresholdService.java
@@ -1,7 +1,12 @@
 package com.ycl.platform.service;
 
 
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.ycl.platform.domain.entity.YwThreshold;
+import com.ycl.platform.domain.form.CarThresholdForm;
+import com.ycl.platform.domain.form.FaceThresholdForm;
+import com.ycl.platform.domain.form.VideoThresholdForm;
+import com.ycl.platform.mapper.YwThresholdMapper;
 
 import java.util.List;
 
@@ -59,4 +64,28 @@
      * @return 缁撴灉
      */
     public int deleteYwThresholdById(Integer id);
+
+    /**
+     * 淇敼浜鸿劯闃堝��
+     *
+     * @param form
+     * @return
+     */
+    int editFace(FaceThresholdForm form);
+
+    /**
+     * 淇敼杞﹁締闃堝��
+     *
+     * @param form
+     * @return
+     */
+    int editCar(CarThresholdForm form);
+
+    /**
+     * 淇敼瑙嗛闃堝��
+     *
+     * @param form
+     * @return
+     */
+    int editVideo(VideoThresholdForm form);
 }
diff --git a/ycl-server/src/main/java/com/ycl/platform/service/impl/YwThresholdServiceImpl.java b/ycl-server/src/main/java/com/ycl/platform/service/impl/YwThresholdServiceImpl.java
index 0cbf737..c3b29f3 100644
--- a/ycl-server/src/main/java/com/ycl/platform/service/impl/YwThresholdServiceImpl.java
+++ b/ycl-server/src/main/java/com/ycl/platform/service/impl/YwThresholdServiceImpl.java
@@ -1,13 +1,20 @@
 package com.ycl.platform.service.impl;
 
+import com.alibaba.fastjson2.JSON;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.ycl.platform.domain.entity.YwThreshold;
+import com.ycl.platform.domain.form.CarThresholdForm;
+import com.ycl.platform.domain.form.FaceThresholdForm;
+import com.ycl.platform.domain.form.VideoThresholdForm;
 import com.ycl.platform.mapper.YwThresholdMapper;
 import com.ycl.platform.service.IYwThresholdService;
 import com.ycl.utils.DateUtils;
+import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import java.util.List;
+import java.util.Objects;
 
 /**
  * 杩愮淮闃堝�糞ervice涓氬姟灞傚鐞�
@@ -16,7 +23,7 @@
  * @date 2024-03-25
  */
 @Service
-public class YwThresholdServiceImpl implements IYwThresholdService {
+public class YwThresholdServiceImpl extends ServiceImpl<YwThresholdMapper, YwThreshold> implements IYwThresholdService {
     @Autowired
     private YwThresholdMapper ywThresholdMapper;
 
@@ -87,4 +94,37 @@
     public int deleteYwThresholdById(Integer id) {
         return ywThresholdMapper.deleteYwThresholdById(id);
     }
+
+    @Override
+    public int editFace(FaceThresholdForm form) {
+        YwThreshold ywThreshold = baseMapper.selectById(form.getId());
+        if (Objects.isNull(ywThreshold)) {
+            throw new RuntimeException("鏁版嵁涓嶅瓨鍦�");
+        }
+        BeanUtils.copyProperties(form, ywThreshold);
+        ywThreshold.setIndicator(JSON.toJSONString(form));
+        return baseMapper.updateById(ywThreshold);
+    }
+
+    @Override
+    public int editCar(CarThresholdForm form) {
+        YwThreshold ywThreshold = baseMapper.selectById(form.getId());
+        if (Objects.isNull(ywThreshold)) {
+            throw new RuntimeException("鏁版嵁涓嶅瓨鍦�");
+        }
+        BeanUtils.copyProperties(form, ywThreshold);
+        ywThreshold.setIndicator(JSON.toJSONString(form));
+        return baseMapper.updateById(ywThreshold);
+    }
+
+    @Override
+    public int editVideo(VideoThresholdForm form) {
+        YwThreshold ywThreshold = baseMapper.selectById(form.getId());
+        if (Objects.isNull(ywThreshold)) {
+            throw new RuntimeException("鏁版嵁涓嶅瓨鍦�");
+        }
+        BeanUtils.copyProperties(form, ywThreshold);
+        ywThreshold.setIndicator(JSON.toJSONString(form));
+        return baseMapper.updateById(ywThreshold);
+    }
 }

--
Gitblit v1.8.0