From 75cf6d5a2484cc13ad78898e26e452ffa664f2cb Mon Sep 17 00:00:00 2001
From: xiangpei <xiangpei@timesnew.cn>
Date: 星期一, 15 四月 2024 14:59:23 +0800
Subject: [PATCH] 阈值修改、阈值计算方法定义
---
ycl-pojo/src/main/java/com/ycl/platform/domain/dto/VideoDTO.java | 14 ++++
ycl-server/src/main/java/com/ycl/platform/service/impl/YwThresholdServiceImpl.java | 47 +++++++++++++++
ycl-common/src/main/java/enumeration/general/BusinessTypeEnum.java | 4
ycl-pojo/src/main/java/com/ycl/platform/domain/dto/CarDTO.java | 13 ++++
ycl-pojo/src/main/java/com/ycl/platform/domain/dto/FaceDTO.java | 14 ++++
ycl-pojo/src/main/java/com/ycl/platform/domain/entity/YwThreshold.java | 8 +-
ycl-server/src/main/java/com/ycl/platform/service/IYwThresholdService.java | 27 +++++++++
7 files changed, 118 insertions(+), 9 deletions(-)
diff --git a/ycl-common/src/main/java/enumeration/general/BusinessTypeEnum.java b/ycl-common/src/main/java/enumeration/general/BusinessTypeEnum.java
index bf44c24..0ab8ebf 100644
--- a/ycl-common/src/main/java/enumeration/general/BusinessTypeEnum.java
+++ b/ycl-common/src/main/java/enumeration/general/BusinessTypeEnum.java
@@ -11,13 +11,13 @@
*/
public enum BusinessTypeEnum {
VIDEO("video", "瑙嗛"),
- CAR("CAR", "杞﹁締"),
+ CAR("car", "杞﹁締"),
FACE("face", "浜鸿劯");
@EnumValue // 鏍囨槑璇ュ瓧娈靛瓨鍏ユ暟鎹簱
private final String code;
- @JsonValue // 鏍囨槑鍦ㄨ浆JSON鏃朵娇鐢ㄨ瀛楁锛屽嵆鍝嶅簲鏃�
+ @JsonValue // 鏍囨槑鍦ㄨ浆JSON鏃朵娇鐢ㄨ瀛楁
private final String desc;
BusinessTypeEnum(String code, String desc) {
diff --git a/ycl-pojo/src/main/java/com/ycl/platform/domain/dto/CarDTO.java b/ycl-pojo/src/main/java/com/ycl/platform/domain/dto/CarDTO.java
new file mode 100644
index 0000000..1a9222d
--- /dev/null
+++ b/ycl-pojo/src/main/java/com/ycl/platform/domain/dto/CarDTO.java
@@ -0,0 +1,13 @@
+package com.ycl.platform.domain.dto;
+
+import lombok.Data;
+
+/**
+ * 璇锋眰鍒板緱杞﹁締鏁版嵁锛岀敤浜庡垽鏂弧瓒冲伐鍗曢槇鍊�
+ *
+ * @author锛歺p
+ * @date锛�2024/4/15 11:05
+ */
+@Data
+public class CarDTO {
+}
diff --git a/ycl-pojo/src/main/java/com/ycl/platform/domain/dto/FaceDTO.java b/ycl-pojo/src/main/java/com/ycl/platform/domain/dto/FaceDTO.java
new file mode 100644
index 0000000..1c3d800
--- /dev/null
+++ b/ycl-pojo/src/main/java/com/ycl/platform/domain/dto/FaceDTO.java
@@ -0,0 +1,14 @@
+package com.ycl.platform.domain.dto;
+
+import lombok.Data;
+
+/**
+ * 璇锋眰鍒板緱浜鸿劯鏁版嵁锛岀敤浜庡垽鏂弧瓒冲伐鍗曢槇鍊�
+ *
+ * @author锛歺p
+ * @date锛�2024/4/15 11:05
+ */
+@Data
+public class FaceDTO {
+
+}
diff --git a/ycl-pojo/src/main/java/com/ycl/platform/domain/dto/VideoDTO.java b/ycl-pojo/src/main/java/com/ycl/platform/domain/dto/VideoDTO.java
new file mode 100644
index 0000000..e4bbdaf
--- /dev/null
+++ b/ycl-pojo/src/main/java/com/ycl/platform/domain/dto/VideoDTO.java
@@ -0,0 +1,14 @@
+package com.ycl.platform.domain.dto;
+
+import lombok.Data;
+
+/**
+ * 璇锋眰鍒板緱瑙嗛鏁版嵁锛岀敤浜庡垽鏂弧瓒冲伐鍗曢槇鍊�
+ *
+ * @author锛歺p
+ * @date锛�2024/4/15 11:05
+ */
+@Data
+public class VideoDTO {
+
+}
diff --git a/ycl-pojo/src/main/java/com/ycl/platform/domain/entity/YwThreshold.java b/ycl-pojo/src/main/java/com/ycl/platform/domain/entity/YwThreshold.java
index b006a85..5ee3794 100644
--- a/ycl-pojo/src/main/java/com/ycl/platform/domain/entity/YwThreshold.java
+++ b/ycl-pojo/src/main/java/com/ycl/platform/domain/entity/YwThreshold.java
@@ -7,9 +7,8 @@
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.ycl.system.entity.BaseEntity;
+import enumeration.general.BusinessTypeEnum;
import lombok.Data;
-import org.apache.commons.lang3.builder.ToStringBuilder;
-import org.apache.commons.lang3.builder.ToStringStyle;
/**
* 杩愮淮闃堝�煎璞� t_yw_threshold
@@ -32,9 +31,9 @@
/**
* 璁惧绫诲瀷锛�1浜鸿劯 2杞﹁締 3瑙嗛
*/
- @Excel(name = "璁惧绫诲瀷锛�1浜鸿劯 2杞﹁締 3瑙嗛")
+ @Excel(name = "璁惧绫诲瀷")
@TableField("monitor_type")
- private String monitorType;
+ private BusinessTypeEnum monitorType;
/**
* 瓒呮椂澶╂暟
@@ -53,7 +52,6 @@
/**
* 閫昏緫鍒犻櫎锛�0鏈垹闄� 1鍒犻櫎
*/
-
@TableField("deleted")
private String deleted;
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 efa5b47..e1197ff 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
@@ -2,6 +2,9 @@
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ycl.platform.domain.dto.CarDTO;
+import com.ycl.platform.domain.dto.FaceDTO;
+import com.ycl.platform.domain.dto.VideoDTO;
import com.ycl.platform.domain.entity.YwThreshold;
import com.ycl.platform.domain.form.CarThresholdForm;
import com.ycl.platform.domain.form.FaceThresholdForm;
@@ -88,4 +91,28 @@
* @return
*/
int editVideo(VideoThresholdForm form);
+
+ /**
+ * 妫�鏌ヤ汉鑴告暟鎹槸鍚﹁鐢熸垚宸ュ崟
+ *
+ * @param faceList 浜鸿劯鏁版嵁
+ * @return 鏄惁鐢熸垚宸ュ崟
+ */
+ Boolean checkFace(List<FaceDTO> faceList);
+
+ /**
+ * 妫�鏌ヨ溅杈嗘暟鎹槸鍚﹁鐢熸垚宸ュ崟
+ *
+ * @param carList 杞﹁締鏁版嵁
+ * @return 鏄惁鐢熸垚宸ュ崟
+ */
+ Boolean checkCar(List<CarDTO> carList);
+
+ /**
+ * 妫�鏌ヨ棰戞暟鎹槸鍚﹁鐢熸垚宸ュ崟
+ *
+ * @param videoList
+ * @return 鏄惁鐢熸垚宸ュ崟
+ */
+ Boolean checkVideo(List<VideoDTO> videoList);
}
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 c3b29f3..469f165 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,7 +1,11 @@
package com.ycl.platform.service.impl;
import com.alibaba.fastjson2.JSON;
+import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ycl.platform.domain.dto.CarDTO;
+import com.ycl.platform.domain.dto.FaceDTO;
+import com.ycl.platform.domain.dto.VideoDTO;
import com.ycl.platform.domain.entity.YwThreshold;
import com.ycl.platform.domain.form.CarThresholdForm;
import com.ycl.platform.domain.form.FaceThresholdForm;
@@ -9,6 +13,8 @@
import com.ycl.platform.mapper.YwThresholdMapper;
import com.ycl.platform.service.IYwThresholdService;
import com.ycl.utils.DateUtils;
+import enumeration.general.BusinessTypeEnum;
+import lombok.RequiredArgsConstructor;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -23,9 +29,10 @@
* @date 2024-03-25
*/
@Service
+@RequiredArgsConstructor
public class YwThresholdServiceImpl extends ServiceImpl<YwThresholdMapper, YwThreshold> implements IYwThresholdService {
- @Autowired
- private YwThresholdMapper ywThresholdMapper;
+
+ private final YwThresholdMapper ywThresholdMapper;
/**
* 鏌ヨ杩愮淮闃堝��
@@ -127,4 +134,40 @@
ywThreshold.setIndicator(JSON.toJSONString(form));
return baseMapper.updateById(ywThreshold);
}
+
+ @Override
+ public Boolean checkFace(List<FaceDTO> faceList) {
+ YwThreshold faceEntity = new LambdaQueryChainWrapper<>(baseMapper)
+ .eq(YwThreshold::getMonitorType, BusinessTypeEnum.FACE)
+ .one();
+ if (Objects.isNull(faceEntity)) {
+ throw new RuntimeException("璇烽厤缃汉鑴哥殑宸ュ崟闃堝��");
+ }
+ // todo 閬嶅巻鏉′欢锛岀敓鎴愬伐鍗�
+ return Boolean.FALSE;
+ }
+
+ @Override
+ public Boolean checkCar(List<CarDTO> faceList) {
+ YwThreshold carEntity = new LambdaQueryChainWrapper<>(baseMapper)
+ .eq(YwThreshold::getMonitorType, BusinessTypeEnum.CAR)
+ .one();
+ if (Objects.isNull(carEntity)) {
+ throw new RuntimeException("璇烽厤缃溅杈嗙殑宸ュ崟闃堝��");
+ }
+ // todo 閬嶅巻鏉′欢锛岀敓鎴愬伐鍗�
+ return Boolean.FALSE;
+ }
+
+ @Override
+ public Boolean checkVideo(List<VideoDTO> faceList) {
+ YwThreshold videoEntity = new LambdaQueryChainWrapper<>(baseMapper)
+ .eq(YwThreshold::getMonitorType, BusinessTypeEnum.VIDEO)
+ .one();
+ if (Objects.isNull(videoEntity)) {
+ throw new RuntimeException("璇烽厤缃棰戠殑宸ュ崟闃堝��");
+ }
+ // todo 閬嶅巻鏉′欢锛岀敓鎴愬伐鍗�
+ return Boolean.FALSE;
+ }
}
--
Gitblit v1.8.0