Sfoglia il codice sorgente

FIX 任务,算法,温度

tjf 2 giorni fa
parent
commit
3322552b1d

+ 369 - 0
ruoyi-framework/src/main/java/com/ruoyi/framework/web/domain/AdvancedSystemMonitor.java

@@ -0,0 +1,369 @@
+package com.ruoyi.framework.web.domain;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+import java.io.InputStreamReader;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.TimeUnit;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+public class AdvancedSystemMonitor {
+
+    /**
+     * CPU插槽 0 温度: 48.5°C
+     * CPU插槽 1 温度: 47.2°C
+     * CPU核心 Socket0-Core0 频率: 3.20 GHz
+     * CPU核心 Socket0-Core1 频率: 3.18 GHz
+     * CPU核心 Socket1-Core24 频率: 2.95 GHz
+     * CPU核心 Socket1-Core25 频率: 2.97 GHz
+     * <p>
+     * GPU #0 信息:
+     * 索引: 0
+     * 名称: NVIDIA GeForce RTX 3090
+     * 温度: 62°C
+     * 使用率: 24%
+     * 显存使用: 3456 MB
+     * 总显存: 24564 MB
+     * 功耗: 350.0 W
+     * 功耗限制: 400.0 W
+     * 图形时钟: 1860 MHz
+     * 显存时钟: 1219 MHz
+     * <p>
+     * GPU #1 信息:
+     * 索引: 1
+     * 名称: NVIDIA Tesla V100
+     * 温度: 58°C
+     * 使用率: 45%
+     * 显存使用: 16384 MB
+     * 总显存: 32768 MB
+     * 功耗: 250.0 W
+     * 功耗限制: 300.0 W
+     * 图形时钟: 1380 MHz
+     * 显存时钟: 877 MHz
+     * <p>
+     * 网络速率 (eth0):
+     * 下行: 1.23 Gbps
+     * 上行: 345.67 Mbps
+     */
+    public static String advancedSystem() {
+        try {
+            // 1. 获取所有CPU插槽的温度
+            Map<Integer, Double> cpuTemps = getCpuTemperatures();
+            cpuTemps.forEach((socket, temp) ->
+                    System.out.printf("CPU插槽 %d 温度: %.1f°C\n", socket, temp)
+            );
+
+            // 2. 获取所有CPU核心的实时频率
+            Map<String, Double> cpuFrequencies = getCpuFrequencies();
+            cpuFrequencies.forEach((core, freq) ->
+                    System.out.printf("CPU核心 %s 频率: %.2f GHz\n", core, freq)
+            );
+
+            // 3. 获取所有GPU信息
+            List<Map<String, String>> gpuInfoList = getMultiGpuInfo();
+            for (int i = 0; i < gpuInfoList.size(); i++) {
+                System.out.println("\nGPU #" + i + " 信息:");
+                gpuInfoList.get(i).forEach((key, value) ->
+                        System.out.println("  " + key + ": " + value)
+                );
+            }
+
+            // 4. 获取网络速率
+            String interfaceName = "eth0"; // 替换为你的网卡名称
+            NetworkStats stats1 = getNetworkStats(interfaceName);
+            TimeUnit.SECONDS.sleep(1);
+            NetworkStats stats2 = getNetworkStats(interfaceName);
+
+            long rxRate = (stats2.rxBytes - stats1.rxBytes) * 8; // 比特/秒
+            long txRate = (stats2.txBytes - stats1.txBytes) * 8; // 比特/秒
+
+            System.out.printf("\n网络速率 (%s):\n  下行: %s\n  上行: %s\n",
+                    interfaceName,
+                    formatRate(rxRate),
+                    formatRate(txRate)
+            );
+
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return null;
+    }
+
+    // 获取多CPU插槽的温度
+    private static Map<Integer, Double> getCpuTemperatures() throws Exception {
+        Map<Integer, Double> temps = new HashMap<>();
+
+        // 方法1: 通过hwmon获取物理CPU温度
+        File hwmonDir = new File("/sys/class/hwmon/");
+        for (File hwmon : hwmonDir.listFiles()) {
+            try {
+                // 检测是否为CPU温度传感器
+                File nameFile = new File(hwmon, "name");
+                if (!nameFile.exists()) continue;
+
+                try (BufferedReader nameReader = new BufferedReader(new FileReader(nameFile))) {
+                    String name = nameReader.readLine();
+                    if (name == null || !(name.contains("coretemp") || name.contains("k10temp"))) continue;
+
+                    // 查找所有物理CPU的温度
+                    for (int i = 1; i <= 16; i++) {
+                        File tempFile = new File(hwmon, "temp" + i + "_input");
+                        File labelFile = new File(hwmon, "temp" + i + "_label");
+
+                        if (tempFile.exists()) {
+                            // 读取温度标签确定是物理CPU
+                            String label = "Unknown";
+                            if (labelFile.exists()) {
+                                try (BufferedReader labelReader = new BufferedReader(new FileReader(labelFile))) {
+                                    label = labelReader.readLine();
+                                }
+                            }
+
+                            // 只获取物理CPU温度(Package或Tdie)
+                            if (label.contains("Package") || label.contains("Tdie")) {
+                                try (BufferedReader tempReader = new BufferedReader(new FileReader(tempFile))) {
+                                    double temp = Double.parseDouble(tempReader.readLine().trim()) / 1000.0;
+                                    // 提取CPU插槽ID
+                                    int socketId = 0;
+                                    Pattern p = Pattern.compile("(\\d+)");
+                                    Matcher m = p.matcher(label);
+                                    if (m.find()) socketId = Integer.parseInt(m.group());
+
+                                    temps.put(socketId, temp);
+                                }
+                            }
+                        }
+                    }
+                }
+            } catch (Exception e) {
+                // 继续下一个hwmon
+            }
+        }
+
+        // 方法2: 回退到thermal_zone方法
+        if (temps.isEmpty()) {
+            File thermalDir = new File("/sys/class/thermal/");
+            for (File zone : thermalDir.listFiles()) {
+                if (zone.getName().startsWith("thermal_zone")) {
+                    try {
+                        // 检查类型
+                        File typeFile = new File(zone, "type");
+                        if (!typeFile.exists()) continue;
+
+                        try (BufferedReader typeReader = new BufferedReader(new FileReader(typeFile))) {
+                            String type = typeReader.readLine();
+                            if (type == null || !type.contains("x86_pkg_temp")) continue;
+
+                            // 读取温度
+                            File tempFile = new File(zone, "temp");
+                            if (tempFile.exists()) {
+                                try (BufferedReader tempReader = new BufferedReader(new FileReader(tempFile))) {
+                                    double temp = Double.parseDouble(tempReader.readLine().trim()) / 1000.0;
+                                    // 尝试从目录名获取zone ID
+                                    String zoneId = zone.getName().replace("thermal_zone", "");
+                                    temps.put(Integer.parseInt(zoneId), temp);
+                                }
+                            }
+                        }
+                    } catch (Exception e) {
+                        // 忽略错误
+                    }
+                }
+            }
+        }
+
+        if (temps.isEmpty()) throw new Exception("无法检测到CPU温度传感器");
+        return temps;
+    }
+
+    // 获取所有CPU核心频率
+    private static Map<String, Double> getCpuFrequencies() throws Exception {
+        Map<String, Double> frequencies = new HashMap<>();
+        int socketCount = 0;
+        int coreCount = 0;
+
+        // 检测CPU核心
+        File cpuDir = new File("/sys/devices/system/cpu/");
+        for (File file : cpuDir.listFiles()) {
+            if (file.getName().matches("cpu\\d+")) {
+                String coreId = file.getName().replace("cpu", "");
+
+                // 读取实时频率
+                String freqPath = "/sys/devices/system/cpu/cpu" + coreId + "/cpufreq/scaling_cur_freq";
+                File freqFile = new File(freqPath);
+
+                if (freqFile.exists()) {
+                    try (BufferedReader br = new BufferedReader(new FileReader(freqFile))) {
+                        String line = br.readLine();
+                        if (line != null) {
+                            double freq = Double.parseDouble(line.trim()) / 1_000_000.0;
+                            frequencies.put("Socket0-Core" + coreId, freq);
+                        }
+                    }
+                }
+                coreCount++;
+            }
+        }
+
+        // 如果通过sysfs获取失败,尝试从/proc/cpuinfo获取
+        if (frequencies.isEmpty()) {
+            try (BufferedReader br = new BufferedReader(new FileReader("/proc/cpuinfo"))) {
+                String line;
+                int processor = -1;
+                while ((line = br.readLine()) != null) {
+                    if (line.startsWith("processor")) {
+                        String[] parts = line.split(":");
+                        processor = Integer.parseInt(parts[1].trim());
+                    } else if (line.startsWith("cpu MHz")) {
+                        String[] parts = line.split(":");
+                        double freq = Double.parseDouble(parts[1].trim()) / 1000.0;
+                        frequencies.put("Core" + processor, freq);
+                    }
+                }
+            }
+        }
+
+        return frequencies;
+    }
+
+    // 获取多GPU信息
+    private static List<Map<String, String>> getMultiGpuInfo() {
+        List<Map<String, String>> gpuList = new ArrayList<>();
+
+        // 使用nvidia-smi获取多GPU信息
+        try {
+            Process process = Runtime.getRuntime().exec(
+                    "nvidia-smi --query-gpu=index,name,temperature.gpu,utilization.gpu,memory.used,memory.total,power.draw,power.limit,clocks.current.graphics,clocks.current.memory --format=csv,noheader,nounits"
+            );
+
+            BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()));
+            String line;
+            int gpuIndex = 0;
+
+            while ((line = reader.readLine()) != null) {
+                String[] parts = line.split(", ");
+                if (parts.length >= 10) {
+                    Map<String, String> gpuInfo = new HashMap<>();
+                    gpuInfo.put("索引", parts[0].trim());
+                    gpuInfo.put("名称", parts[1].trim());
+                    gpuInfo.put("温度", parts[2].trim() + "°C");
+                    gpuInfo.put("使用率", parts[3].trim() + "%");
+                    gpuInfo.put("显存使用", parts[4].trim() + " MB");
+                    gpuInfo.put("总显存", parts[5].trim() + " MB");
+                    gpuInfo.put("功耗", parts[6].trim() + " W");
+                    gpuInfo.put("功耗限制", parts[7].trim() + " W");
+                    gpuInfo.put("图形时钟", parts[8].trim() + " MHz");
+                    gpuInfo.put("显存时钟", parts[9].trim() + " MHz");
+
+                    gpuList.add(gpuInfo);
+                    gpuIndex++;
+                }
+            }
+
+            // 检查是否有GPU被检测到
+            if (gpuIndex > 0) return gpuList;
+        } catch (Exception e) {
+            System.err.println("nvidia-smi执行错误: " + e.getMessage());
+        }
+
+        // 备用方法:尝试从sysfs读取AMD/集成GPU信息
+        try {
+            File hwmonDir = new File("/sys/class/hwmon/");
+            for (File hwmon : hwmonDir.listFiles()) {
+                try {
+                    // 检测是否为GPU
+                    File nameFile = new File(hwmon, "name");
+                    if (!nameFile.exists()) continue;
+
+                    try (BufferedReader nameReader = new BufferedReader(new FileReader(nameFile))) {
+                        String name = nameReader.readLine();
+                        if (name == null || !(name.contains("amdgpu") || name.contains("radeon"))) continue;
+
+                        Map<String, String> gpuInfo = new HashMap<>();
+                        gpuInfo.put("类型", name);
+
+                        // 读取温度
+                        for (int i = 1; i <= 5; i++) {
+                            File tempFile = new File(hwmon, "temp" + i + "_input");
+                            if (tempFile.exists()) {
+                                try (BufferedReader tempReader = new BufferedReader(new FileReader(tempFile))) {
+                                    double temp = Double.parseDouble(tempReader.readLine().trim()) / 1000.0;
+                                    gpuInfo.put("温度", String.format("%.1f°C", temp));
+                                    break;
+                                }
+                            }
+                        }
+
+                        // 读取功耗(如果可用)
+                        File powerFile = new File(hwmon, "power1_average");
+                        if (powerFile.exists()) {
+                            try (BufferedReader powerReader = new BufferedReader(new FileReader(powerFile))) {
+                                double power = Double.parseDouble(powerReader.readLine().trim()) / 1_000_000.0;
+                                gpuInfo.put("功耗", String.format("%.1f W", power));
+                            }
+                        }
+
+                        gpuList.add(gpuInfo);
+                    }
+                } catch (Exception e) {
+                    // 继续下一个hwmon
+                }
+            }
+        } catch (Exception e) {
+            System.err.println("sysfs读取错误: " + e.getMessage());
+        }
+
+        // 如果没有检测到GPU,添加一个错误信息
+        if (gpuList.isEmpty()) {
+            Map<String, String> errorInfo = new HashMap<>();
+            errorInfo.put("错误", "未检测到GPU或需要安装驱动");
+            gpuList.add(errorInfo);
+        }
+
+        return gpuList;
+    }
+
+    // 网络统计数据结构
+    private static class NetworkStats {
+        long rxBytes;
+        long txBytes;
+    }
+
+    // 获取网络统计信息
+    private static NetworkStats getNetworkStats(String interfaceName) throws Exception {
+        NetworkStats stats = new NetworkStats();
+        File file = new File("/proc/net/dev");
+
+        try (BufferedReader br = new BufferedReader(new FileReader(file))) {
+            String line;
+            while ((line = br.readLine()) != null) {
+                line = line.trim();
+                if (line.startsWith(interfaceName + ":")) {
+                    String[] parts = line.split("\\s+");
+                    stats.rxBytes = Long.parseLong(parts[1]);
+                    stats.txBytes = Long.parseLong(parts[9]);
+                    break;
+                }
+            }
+        }
+        return stats;
+    }
+
+    // 格式化网络速率
+    private static String formatRate(long rateBitsPerSec) {
+        if (rateBitsPerSec < 1000) {
+            return rateBitsPerSec + " bps";
+        } else if (rateBitsPerSec < 1_000_000) {
+            return String.format("%.2f Kbps", rateBitsPerSec / 1000.0);
+        } else if (rateBitsPerSec < 1_000_000_000) {
+            return String.format("%.2f Mbps", rateBitsPerSec / 1_000_000.0);
+        } else {
+            return String.format("%.2f Gbps", rateBitsPerSec / 1_000_000_000.0);
+        }
+    }
+}

+ 10 - 9
ruoyi-framework/src/main/java/com/ruoyi/framework/web/domain/Server.java

@@ -1,16 +1,8 @@
 package com.ruoyi.framework.web.domain;
 
-import java.net.UnknownHostException;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Properties;
 import com.ruoyi.common.utils.Arith;
 import com.ruoyi.common.utils.ip.IpUtils;
-import com.ruoyi.framework.web.domain.server.Cpu;
-import com.ruoyi.framework.web.domain.server.Jvm;
-import com.ruoyi.framework.web.domain.server.Mem;
-import com.ruoyi.framework.web.domain.server.Sys;
-import com.ruoyi.framework.web.domain.server.SysFile;
+import com.ruoyi.framework.web.domain.server.*;
 import oshi.SystemInfo;
 import oshi.hardware.CentralProcessor;
 import oshi.hardware.CentralProcessor.TickType;
@@ -21,6 +13,13 @@ import oshi.software.os.OSFileStore;
 import oshi.software.os.OperatingSystem;
 import oshi.util.Util;
 
+import java.net.UnknownHostException;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Properties;
+
+import static com.ruoyi.framework.web.domain.AdvancedSystemMonitor.advancedSystem;
+
 /**
  * 服务器相关信息
  * 
@@ -119,6 +118,8 @@ public class Server
         setJvmInfo();
 
         setSysFiles(si.getOperatingSystem());
+
+        advancedSystem();
     }
 
     /**

+ 12 - 0
ruoyi-system/src/main/java/com/ruoyi/manage/domain/ClockSet.java

@@ -18,6 +18,11 @@ public class ClockSet extends BaseEntity
     /** 打卡时间设置id */
     private Long clockSetId;
 
+    /**
+     * 名称
+     */
+    private String clockName;
+
     /** 上午上班时间 */
     //@JsonFormat(pattern = "yyyy-MM-dd")
     @Excel(name = "上午上班时间", width = 30, dateFormat = "yyyy-MM-dd")
@@ -37,7 +42,13 @@ public class ClockSet extends BaseEntity
     //@JsonFormat(pattern = "yyyy-MM-dd")
     @Excel(name = "下午下班时间", width = 30, dateFormat = "yyyy-MM-dd")
     private String clockEndPm;
+    public String getClockName() {
+        return clockName;
+    }
 
+    public void setClockName(String clockName) {
+        this.clockName = clockName;
+    }
     public void setClockSetId(Long clockSetId) 
     {
         this.clockSetId = clockSetId;
@@ -83,6 +94,7 @@ public class ClockSet extends BaseEntity
     @Override
     public String toString() {
         return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+                .append("clockName", getClockName())
             .append("clockSetId", getClockSetId())
             .append("clockBeginAm", getClockBeginAm())
             .append("clockEndAm", getClockEndAm())

+ 13 - 0
ruoyi-system/src/main/java/com/ruoyi/manage/domain/TaskManage.java

@@ -55,6 +55,10 @@ public class TaskManage extends BaseEntity
 
     /** 删除标志(0代表存在 1代表删除) */
     private String delFlag;
+    /**
+     * 是否开启严格模式(0代表开启 1代表关闭)
+     */
+    private String isStrict;
 
     /**
      * 算法集合
@@ -65,6 +69,14 @@ public class TaskManage extends BaseEntity
      */
     private Long[] algorithmSetIds;
 
+    public String getIsStrict() {
+        return isStrict;
+    }
+
+    public void setIsStrict(String isStrict) {
+        this.isStrict = isStrict;
+    }
+
     public Long[] getAlgorithmSetIds() {
         return algorithmSetIds;
     }
@@ -193,6 +205,7 @@ public class TaskManage extends BaseEntity
                 ", videoAddress='" + videoAddress + '\'' +
                 ", reportAddress='" + reportAddress + '\'' +
                 ", delFlag='" + delFlag + '\'' +
+                ", isStrict='" + isStrict + '\'' +
                 ", algorithmSetList=" + algorithmSetList +
                 ", algorithmSetIds=" + Arrays.toString(algorithmSetIds) +
                 '}';

+ 2 - 0
ruoyi-system/src/main/java/com/ruoyi/manage/mapper/AlgorithmSetMapper.java

@@ -59,4 +59,6 @@ public interface AlgorithmSetMapper
      * @return 结果
      */
     public int deleteAlgorithmSetByAlgorithmIds(Long[] algorithmIds);
+
+    List<AlgorithmSet> selectAlgorithmSetByChannelId(Long channelId);
 }

+ 11 - 4
ruoyi-system/src/main/java/com/ruoyi/manage/service/impl/ChannelNumberServiceImpl.java

@@ -1,6 +1,7 @@
 package com.ruoyi.manage.service.impl;
 
 import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.core.domain.entity.AlgorithmSet;
 import com.ruoyi.common.core.domain.entity.ChannelNumber;
 import com.ruoyi.common.core.domain.entity.ParameterSet;
 import com.ruoyi.common.utils.DateUtils;
@@ -8,10 +9,7 @@ import com.ruoyi.common.utils.StringUtils;
 import com.ruoyi.manage.domain.AlgorithmChannel;
 import com.ruoyi.manage.domain.ChannelNumberVo;
 import com.ruoyi.manage.domain.EquipmentManage;
-import com.ruoyi.manage.mapper.AlgorithmChannelMapper;
-import com.ruoyi.manage.mapper.ChannelNumberMapper;
-import com.ruoyi.manage.mapper.EquipmentManageMapper;
-import com.ruoyi.manage.mapper.ParameterSetMapper;
+import com.ruoyi.manage.mapper.*;
 import com.ruoyi.manage.service.IChannelNumberService;
 import com.ruoyi.mqtt.service.MqttService;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -47,6 +45,8 @@ public class ChannelNumberServiceImpl implements IChannelNumberService {
     private MqttService mqttService;
     @Autowired
     private AlgorithmChannelMapper algorithmChannelMapper;
+    @Autowired
+    private AlgorithmSetMapper algorithmSetMapper;
 
     /**
      * 查询通道管理
@@ -91,6 +91,13 @@ public class ChannelNumberServiceImpl implements IChannelNumberService {
                 channelNumberOne.setIsChannel(Y);
                 channelNumberOne.setParameterSet(parameterSet);
             }
+            for (ChannelNumber number : channelNumbers) {
+                //查询通道的算法集合
+                List<AlgorithmSet> algorithmSets = algorithmSetMapper.selectAlgorithmSetByChannelId(number.getChannelId());
+                if (algorithmSets != null && !algorithmSets.isEmpty()) {
+                    number.setAlgorithmSetList(algorithmSets);
+                }
+            }
         }
         return channelNumbers;
     }

+ 15 - 1
ruoyi-system/src/main/java/com/ruoyi/manage/service/impl/TaskManageServiceImpl.java

@@ -1,11 +1,13 @@
 package com.ruoyi.manage.service.impl;
 
 import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.core.domain.entity.AlgorithmSet;
 import com.ruoyi.common.utils.DateUtils;
 import com.ruoyi.common.utils.StringUtils;
 import com.ruoyi.manage.domain.AlgorithmChannel;
 import com.ruoyi.manage.domain.TaskManage;
 import com.ruoyi.manage.mapper.AlgorithmChannelMapper;
+import com.ruoyi.manage.mapper.AlgorithmSetMapper;
 import com.ruoyi.manage.mapper.TaskManageMapper;
 import com.ruoyi.manage.service.ITaskManageService;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -27,6 +29,8 @@ public class TaskManageServiceImpl implements ITaskManageService {
     private TaskManageMapper taskManageMapper;
     @Autowired
     private AlgorithmChannelMapper algorithmChannelMapper;
+    @Autowired
+    private AlgorithmSetMapper algorithmSetMapper;
 
     /**
      * 查询任务管理
@@ -47,7 +51,17 @@ public class TaskManageServiceImpl implements ITaskManageService {
      */
     @Override
     public List<TaskManage> selectTaskManageList(TaskManage taskManage) {
-        return taskManageMapper.selectTaskManageList(taskManage);
+        List<TaskManage> taskManages = taskManageMapper.selectTaskManageList(taskManage);
+        if (taskManages != null && !taskManages.isEmpty()) {
+            for (TaskManage manage : taskManages) {
+                Long channelId = manage.getChannelId();
+                List<AlgorithmSet> algorithmSets = algorithmSetMapper.selectAlgorithmSetByChannelId(channelId);
+                if (algorithmSets != null && !algorithmSets.isEmpty()) {
+                    manage.setAlgorithmSetList(algorithmSets);
+                }
+            }
+        }
+        return taskManages;
     }
 
     /**

+ 1 - 1
ruoyi-system/src/main/resources/mapper/manage/AlgorithmChannelMapper.xml

@@ -37,7 +37,7 @@
         </trim>
     </insert>
     <insert id="batchAlgorithmChannel">
-        insert into algorithm_channel(algorithm_id,channel_id) values
+        insert IGNORE into algorithm_channel(algorithm_id,channel_id) values
         <foreach item="item" index="index" collection="list" separator=",">
             (#{item.algorithmId},#{item.channelId})
         </foreach>

+ 12 - 0
ruoyi-system/src/main/resources/mapper/manage/AlgorithmSetMapper.xml

@@ -58,6 +58,18 @@
         <include refid="selectAlgorithmSetVo"/>
         where algorithm_id = #{algorithmId}
     </select>
+    <select id="selectAlgorithmSetByChannelId" parameterType="Long" resultMap="AlgorithmSetResult">
+        SELECT
+            algorithm_id,
+            algorithm_num,
+            algorithm_name
+        FROM
+            algorithm_set
+        where
+            algorithm_id in
+            (select algorithm_id FROM algorithm_channel where channel_id = #{channelId})
+
+    </select>
 
     <insert id="insertAlgorithmSet" parameterType="AlgorithmSet" useGeneratedKeys="true" keyProperty="algorithmId">
         insert into algorithm_set

+ 2 - 4
ruoyi-system/src/main/resources/mapper/manage/ChannelNumberMapper.xml

@@ -36,10 +36,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <select id="selectChannelNumberList" parameterType="ChannelNumber" resultMap="ChannelNumberResult">
         select c.channel_id, c.channel_num,c.equipment_id, c.equipment_num, c.equipment_name, c.video_address,c.photo_address,c.port, c.account,c.password,c.protocol_type,
-        c.channel_details, c.del_flag, c.create_by, c.create_time, c.update_by, c.update_time, c.remark,als.algorithm_name,als.algorithm_id
+        c.channel_details, c.del_flag, c.create_by, c.create_time, c.update_by, c.update_time, c.remark
         from channel_number c
-            left join algorithm_channel a on a.channel_id = c.channel_id
-            left join algorithm_set als on als.algorithm_id = a.algorithm_id
         <where>
             <if test="equipmentNum != null  and equipmentNum != ''"> and c.equipment_num  like concat('%', #{equipmentNum}, '%')</if>
             <if test="equipmentName != null  and equipmentName != ''"> and c.equipment_name like concat('%', #{equipmentName}, '%')</if>
@@ -48,7 +46,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="protocolType != null  and protocolType != ''"> and c.protocol_type = #{protocolType}</if>
             <if test="channelDetails != null  and channelDetails != ''"> and c.channel_details = #{channelDetails}</if>
         </where>
-        order by create_time DESC
+        order by c.create_time DESC
     </select>
     
     <select id="selectChannelNumberByChannelId" parameterType="ChannelNumber" resultMap="ChannelNumberResult">

+ 42 - 24
ruoyi-system/src/main/resources/mapper/manage/ClockSetMapper.xml

@@ -1,36 +1,49 @@
 <?xml version="1.0" encoding="UTF-8" ?>
 <!DOCTYPE mapper
-PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
-"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.ruoyi.manage.mapper.ClockSetMapper">
-    
+
     <resultMap type="ClockSet" id="ClockSetResult">
-        <result property="clockSetId"    column="clock_set_id"    />
-        <result property="clockBeginAm"    column="clock_begin_am"    />
-        <result property="clockEndAm"    column="clock_end_am"    />
-        <result property="clockBeginPm"    column="clock_begin_pm"    />
-        <result property="clockEndPm"    column="clock_end_pm"    />
-        <result property="createBy"    column="create_by"    />
-        <result property="createTime"    column="create_time"    />
-        <result property="updateBy"    column="update_by"    />
-        <result property="updateTime"    column="update_time"    />
-        <result property="remark"    column="remark"    />
+        <result property="clockSetId" column="clock_set_id"/>
+        <result property="clockName" column="clock_name"/>
+        <result property="clockBeginAm" column="clock_begin_am"/>
+        <result property="clockEndAm" column="clock_end_am"/>
+        <result property="clockBeginPm" column="clock_begin_pm"/>
+        <result property="clockEndPm" column="clock_end_pm"/>
+        <result property="createBy" column="create_by"/>
+        <result property="createTime" column="create_time"/>
+        <result property="updateBy" column="update_by"/>
+        <result property="updateTime" column="update_time"/>
+        <result property="remark" column="remark"/>
     </resultMap>
 
     <sql id="selectClockSetVo">
-        select clock_set_id, clock_begin_am, clock_end_am, clock_begin_pm, clock_end_pm, create_by, create_time, update_by, update_time, remark from clock_set
+        select clock_set_id,
+               clock_name,
+               clock_begin_am,
+               clock_end_am,
+               clock_begin_pm,
+               clock_end_pm,
+               create_by,
+               create_time,
+               update_by,
+               update_time,
+               remark
+        from clock_set
     </sql>
 
     <select id="selectClockSetList" parameterType="ClockSet" resultMap="ClockSetResult">
         <include refid="selectClockSetVo"/>
-        <where>  
-            <if test="clockBeginAm != null "> and clock_begin_am = #{clockBeginAm}</if>
-            <if test="clockEndAm != null "> and clock_end_am = #{clockEndAm}</if>
-            <if test="clockBeginPm != null "> and clock_begin_pm = #{clockBeginPm}</if>
-            <if test="clockEndPm != null "> and clock_end_pm = #{clockEndPm}</if>
+        <where>
+            <if test="clockName != null ">and clock_name = #{clockName}</if>
+            <if test="clockBeginAm != null ">and clock_begin_am = #{clockBeginAm}</if>
+            <if test="clockEndAm != null ">and clock_end_am = #{clockEndAm}</if>
+            <if test="clockBeginPm != null ">and clock_begin_pm = #{clockBeginPm}</if>
+            <if test="clockEndPm != null ">and clock_end_pm = #{clockEndPm}</if>
         </where>
     </select>
-    
+
     <select id="selectClockSetByClockSetId" parameterType="Long" resultMap="ClockSetResult">
         <include refid="selectClockSetVo"/>
         where clock_set_id = #{clockSetId}
@@ -39,6 +52,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     <insert id="insertClockSet" parameterType="ClockSet" useGeneratedKeys="true" keyProperty="clockSetId">
         insert into clock_set
         <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="clockName != null">clock_name,</if>
             <if test="clockBeginAm != null">clock_begin_am,</if>
             <if test="clockEndAm != null">clock_end_am,</if>
             <if test="clockBeginPm != null">clock_begin_pm,</if>
@@ -48,8 +62,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="updateBy != null">update_by,</if>
             <if test="updateTime != null">update_time,</if>
             <if test="remark != null">remark,</if>
-         </trim>
+        </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="clockName != null">#{clockName},</if>
             <if test="clockBeginAm != null">#{clockBeginAm},</if>
             <if test="clockEndAm != null">#{clockEndAm},</if>
             <if test="clockBeginPm != null">#{clockBeginPm},</if>
@@ -59,12 +74,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="updateBy != null">#{updateBy},</if>
             <if test="updateTime != null">#{updateTime},</if>
             <if test="remark != null">#{remark},</if>
-         </trim>
+        </trim>
     </insert>
 
     <update id="updateClockSet" parameterType="ClockSet">
         update clock_set
         <trim prefix="SET" suffixOverrides=",">
+            <if test="clockName != null">clock_name = #{clockName},</if>
             <if test="clockBeginAm != null">clock_begin_am = #{clockBeginAm},</if>
             <if test="clockEndAm != null">clock_end_am = #{clockEndAm},</if>
             <if test="clockBeginPm != null">clock_begin_pm = #{clockBeginPm},</if>
@@ -79,11 +95,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </update>
 
     <delete id="deleteClockSetByClockSetId" parameterType="Long">
-        delete from clock_set where clock_set_id = #{clockSetId}
+        delete
+        from clock_set
+        where clock_set_id = #{clockSetId}
     </delete>
 
     <delete id="deleteClockSetByClockSetIds" parameterType="String">
-        delete from clock_set where clock_set_id in 
+        delete from clock_set where clock_set_id in
         <foreach item="clockSetId" collection="array" open="(" separator="," close=")">
             #{clockSetId}
         </foreach>

+ 18 - 15
ruoyi-system/src/main/resources/mapper/manage/TaskManageMapper.xml

@@ -14,6 +14,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="channelId"    column="channel_id"    />
         <result property="videoAddress"    column="video_address"    />
         <result property="reportAddress"    column="report_address"    />
+        <result property="isStrict"    column="is_strict"    />
         <result property="delFlag"    column="del_flag"    />
         <result property="createBy"    column="create_by"    />
         <result property="createTime"    column="create_time"    />
@@ -26,32 +27,31 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="algorithmId" column="algorithm_id"/>
         <result property="algorithmNum" column="algorithm_num"/>
         <result property="algorithmName" column="algorithm_name"/>
+        <result property="algorithmThresholdStrict" column="algorithm_threshold_strict"/>
     </resultMap>
     <sql id="selectTaskManageVo">
-        select task_id, clock_set_id, clock_name, task_num, task_details, io_output, channel_id, video_address, report_address, del_flag, create_by, create_time, update_by, update_time, remark from task_manage
+        select task_id, clock_set_id, clock_name, task_num, task_details, io_output, channel_id, is_strict,video_address, report_address, del_flag, create_by, create_time, update_by, update_time, remark from task_manage
     </sql>
 
     <select id="selectTaskManageList" parameterType="TaskManage" resultMap="TaskManageResult">
-        select t.task_id, t.clock_set_id, t.clock_name, t.task_num, t.task_details, t.io_output, t.channel_id, t.video_address, t.report_address, t.del_flag,
-        t.create_by, t.create_time, t.update_by, t.update_time, t.remark,als.algorithm_name,als.algorithm_id
+        select t.task_id, t.clock_set_id, t.clock_name, t.task_num, t.task_details, t.io_output, t.channel_id, t.video_address, t.report_address, t.del_flag,t.is_strict,
+        t.create_by, t.create_time, t.update_by, t.update_time, t.remark
         from task_manage t
-        left join algorithm_channel a on a.channel_id = t.channel_id
-        left join algorithm_set als on als.algorithm_id = a.algorithm_id
         <where>  
-            <if test="clockSetId != null "> and clock_set_id = #{clockSetId}</if>
-            <if test="clockName != null  and clockName != ''"> and clock_name like concat('%', #{clockName}, '%')</if>
-            <if test="taskNum != null  and taskNum != ''"> and task_num = #{taskNum}</if>
-            <if test="taskDetails != null  and taskDetails != ''"> and task_details = #{taskDetails}</if>
-            <if test="ioOutput != null  and ioOutput != ''"> and io_output = #{ioOutput}</if>
-            <if test="channelId != null "> and channel_id = #{channelId}</if>
-            <if test="videoAddress != null  and videoAddress != ''"> and video_address = #{videoAddress}</if>
-            <if test="reportAddress != null  and reportAddress != ''"> and report_address = #{reportAddress}</if>
+            <if test="clockSetId != null "> and t.clock_set_id = #{clockSetId}</if>
+            <if test="clockName != null  and clockName != ''"> and t.clock_name like concat('%', #{clockName}, '%')</if>
+            <if test="taskNum != null  and taskNum != ''"> and t.task_num like concat('%', #{taskNum}, '%')</if>
+            <if test="taskDetails != null  and taskDetails != ''"> and t.task_details = #{taskDetails}</if>
+            <if test="ioOutput != null  and ioOutput != ''"> and t.io_output = #{ioOutput}</if>
+            <if test="channelId != null "> and t.channel_id = #{channelId}</if>
+            <if test="videoAddress != null  and videoAddress != ''"> and t.video_address = #{videoAddress}</if>
+            <if test="reportAddress != null  and reportAddress != ''"> and t.report_address = #{reportAddress}</if>
         </where>
     </select>
     
     <select id="selectTaskManageByTaskId" parameterType="Long" resultMap="TaskManageResult">
-        select t.task_id, t.clock_set_id, t.clock_name, t.task_num, t.task_details, t.io_output, t.channel_id, t.video_address, t.report_address, t.del_flag,
-               t.create_by, t.create_time, t.update_by, t.update_time, t.remark,als.algorithm_name,als.algorithm_id
+        select t.task_id, t.clock_set_id, t.clock_name, t.task_num, t.task_details, t.io_output, t.channel_id, t.video_address, t.report_address, t.del_flag,t.is_strict,
+               t.create_by, t.create_time, t.update_by, t.update_time, t.remark,als.algorithm_name,als.algorithm_id,als.algorithm_threshold_strict
         from task_manage t
                  left join algorithm_channel a on a.channel_id = t.channel_id
                  left join algorithm_set als on als.algorithm_id = a.algorithm_id
@@ -73,6 +73,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="channelId != null">channel_id,</if>
             <if test="videoAddress != null">video_address,</if>
             <if test="reportAddress != null">report_address,</if>
+            <if test="isStrict != null">is_strict,</if>
             <if test="delFlag != null">del_flag,</if>
             <if test="createBy != null">create_by,</if>
             <if test="createTime != null">create_time,</if>
@@ -89,6 +90,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="channelId != null">#{channelId},</if>
             <if test="videoAddress != null">#{videoAddress},</if>
             <if test="reportAddress != null">#{reportAddress},</if>
+            <if test="isStrict != null">#{isStrict},</if>
             <if test="delFlag != null">#{delFlag},</if>
             <if test="createBy != null">#{createBy},</if>
             <if test="createTime != null">#{createTime},</if>
@@ -109,6 +111,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="channelId != null">channel_id = #{channelId},</if>
             <if test="videoAddress != null">video_address = #{videoAddress},</if>
             <if test="reportAddress != null">report_address = #{reportAddress},</if>
+            <if test="isStrict != null">is_strict = #{isStrict},</if>
             <if test="delFlag != null">del_flag = #{delFlag},</if>
             <if test="createBy != null">create_by = #{createBy},</if>
             <if test="createTime != null">create_time = #{createTime},</if>