From ed410773d8671bf8d37ce02bfad0f3b0a121e5c7 Mon Sep 17 00:00:00 2001
From: 潘志宝 <979469083@qq.com>
Date: 星期二, 31 十二月 2024 13:59:34 +0800
Subject: [PATCH] 调度模型触发方式

---
 iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/service/impl/StScheduleSchemeServiceImpl.java |    4 ++--
 iailab-module-model/iailab-module-model-api/src/main/java/com/iailab/module/model/api/mcs/McsApi.java                                    |    2 +-
 iailab-module-model/iailab-module-model-api/src/main/java/com/iailab/module/model/enums/ScheduleTriggerMethodEnum.java                   |   35 +++++++++++++++++++++++++++++++++++
 iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/api/McsApiImpl.java                                    |    5 ++++-
 4 files changed, 42 insertions(+), 4 deletions(-)

diff --git a/iailab-module-model/iailab-module-model-api/src/main/java/com/iailab/module/model/api/mcs/McsApi.java b/iailab-module-model/iailab-module-model-api/src/main/java/com/iailab/module/model/api/mcs/McsApi.java
index 9e5bd0a..360ddf7 100644
--- a/iailab-module-model/iailab-module-model-api/src/main/java/com/iailab/module/model/api/mcs/McsApi.java
+++ b/iailab-module-model/iailab-module-model-api/src/main/java/com/iailab/module/model/api/mcs/McsApi.java
@@ -87,5 +87,5 @@
 
     @GetMapping(PREFIX + "/schedule-scheme/list")
     @Operation(summary = "获取调度方案列表")
-    List<StScheduleSchemeDTO> listScheduleScheme(@RequestParam Map<String, Object> params);
+    List<StScheduleSchemeDTO> listScheduleScheme(@RequestParam("triggerMethod") String triggerMethod, @RequestParam("triggerCondition") String triggerCondition);
 }
\ No newline at end of file
diff --git a/iailab-module-model/iailab-module-model-api/src/main/java/com/iailab/module/model/enums/ScheduleTriggerMethodEnum.java b/iailab-module-model/iailab-module-model-api/src/main/java/com/iailab/module/model/enums/ScheduleTriggerMethodEnum.java
new file mode 100644
index 0000000..637f592
--- /dev/null
+++ b/iailab-module-model/iailab-module-model-api/src/main/java/com/iailab/module/model/enums/ScheduleTriggerMethodEnum.java
@@ -0,0 +1,35 @@
+package com.iailab.module.model.enums;
+
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
+/**
+ * 调度模型触发方式
+ *
+ * @author PanZhibao
+ * @Description
+ * @createTime 2024年12月31日
+ */
+@Getter
+@AllArgsConstructor
+public enum ScheduleTriggerMethodEnum {
+
+    EVENT("1", "事件触发"),
+    JOB("2", "定时触发");
+
+    private String code;
+    private String desc;
+
+    public static ScheduleTriggerMethodEnum getEumByCode(String code) {
+        if (code == null) {
+            return null;
+        }
+
+        for (ScheduleTriggerMethodEnum statusEnum : ScheduleTriggerMethodEnum.values()) {
+            if (statusEnum.getCode().equals(code)) {
+                return statusEnum;
+            }
+        }
+        return null;
+    }
+}
\ No newline at end of file
diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/api/McsApiImpl.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/api/McsApiImpl.java
index 9a6275c..2234502 100644
--- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/api/McsApiImpl.java
+++ b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/api/McsApiImpl.java
@@ -550,7 +550,10 @@
     }
 
     @Override
-    public List<StScheduleSchemeDTO> listScheduleScheme(Map<String, Object> params) {
+    public List<StScheduleSchemeDTO> listScheduleScheme(String triggerMethod, String triggerCondition) {
+        Map<String, Object> params = new HashMap<>();
+        params.put("triggerMethod", triggerMethod);
+        params.put("triggerCondition", triggerCondition);
         return stScheduleSchemeService.list(params);
     }
 
diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/service/impl/StScheduleSchemeServiceImpl.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/service/impl/StScheduleSchemeServiceImpl.java
index 623334c..59316ec 100644
--- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/service/impl/StScheduleSchemeServiceImpl.java
+++ b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/service/impl/StScheduleSchemeServiceImpl.java
@@ -63,8 +63,8 @@
     @Override
     public List<StScheduleSchemeDTO> list(Map<String, Object> params) {
         QueryWrapper<StScheduleSchemeEntity> queryWrapper = new QueryWrapper<>();
-        queryWrapper.eq("trigger_method", params.get("trigger_method"));
-        queryWrapper.eq("trigger_condition", params.get("trigger_condition"));
+        queryWrapper.eq("trigger_method", params.get("triggerMethod"));
+        queryWrapper.eq("trigger_condition", params.get("triggerCondition"));
         List<StScheduleSchemeEntity> list = baseDao.selectList(queryWrapper);
         return ConvertUtils.sourceToTarget(list, StScheduleSchemeDTO.class);
     }

--
Gitblit v1.9.3