瀏覽代碼

Merge remote-tracking branch 'origin/master'

15044148858 1 月之前
父節點
當前提交
e1a0441dfd

+ 19 - 0
monitor_ui/src/api/centerMonitor/rail/rail.js

@@ -0,0 +1,19 @@
+import request from '@/utils/request'
+
+// 查询
+export function getRail(query) {
+  return request({
+    url: '/center-monitor/channelRail/get',
+    method: 'get',
+    params: query
+  })
+}
+
+// 新增
+export function addRail(query) {
+  return request({
+    url: '/center-monitor/channelRail/save',
+    method: 'post',
+    data: query
+  })
+}

+ 52 - 31
monitor_ui/src/views/centerMonitor/camera/PolygonDrawer.vue

@@ -55,7 +55,7 @@
 
     <div>
         <!-- 中间内容部分 -->
-        <div class="container" style="z-index: 1;">
+        <div class="container" style="z-index: 1;display: none">
           <div class="real-container">
             <div class="has-success">
               <label class="form-label mt-4" for="real-rtsp">请输入实时预览 rtsp 地址: </label>
@@ -97,20 +97,36 @@
 
 
 <script>
-
 import PlayerManager from '@@/icc/PlayerManager.js'
+import { addRail } from '@/api/centerMonitor/rail/rail'
 
 export default {
   name: 'PolygonDrawer',
   props: {
-    url: {
+    channelId: {
       type: String,
       default: null,
     },
-    channelId: {
+    taskId: {
+      type: Number,
+      default: null,
+    },
+    pointId: {
+      type: Number,
+      default: null,
+    },
+    pointName: {
+      type: String,
+      default: null,
+    },
+    type: {
       type: String,
       default: null,
     },
+    tasks: {
+      type: Array,
+      default: [],
+    }
   },
   data() {
     return {
@@ -221,11 +237,10 @@ export default {
     getDom(selector) {
         return document.querySelector(selector)
     },
-    playReal() {
+    playReal(url) {
       let that = this
-      let wsURL = 'ws://192.168.100.3:9100'
-      let rtspURL = that.getDom('#real-rtsp').value
-      // let rtspURL = that.url
+      let wsURL = 'ws://39.153.161.212:40004'
+      let rtspURL = url
       let streamType = 1
       let channelId = that.channelId
       that.realPlayer.realByUrl({
@@ -411,12 +426,10 @@ export default {
     // 清空画布
     clearCanvas() {
       if (this.polygons.length > 0 || this.currentPolygon.length > 0) {
-        if (confirm('确定要清空所有多边形吗?')) {
-          this.polygons = []
-          this.currentPolygon = []
-          this.redrawAllPolygons()
-          this.updateCanvasInfo('画布已清空,点击开始绘制多边形')
-        }
+        this.polygons = []
+        this.currentPolygon = []
+        this.redrawAllPolygons()
+        this.updateCanvasInfo('画布已清空,点击开始绘制多边形')
       }
     },
     // 保存多边形数据
@@ -438,22 +451,26 @@ export default {
       // 转换为JSON字符串
       const jsonData = JSON.stringify(data, null, 2)
 
-      // 创建Blob并下载
-      const blob = new Blob([jsonData], { type: 'application/json' })
-      const url = URL.createObjectURL(blob)
-
-      const a = document.createElement('a')
-      a.href = url
-      a.download = `polygons_${new Date().getTime()}.json`
-      document.body.appendChild(a)
-      a.click()
-
-      // 清理
-      setTimeout(() => {
-        document.body.removeChild(a)
-        URL.revokeObjectURL(url)
-      }, 0)
-      this.updateCanvasInfo(`已保存 ${this.polygons.length} 个多边形`)
+      let param = {channelId: this.channelId, taskId: this.taskId, pointId: this.pointId, pointName: this.pointName, type: this.type, jsonData: jsonData, info: JSON.stringify(this.tasks.find(task => task.id == this.taskId))};
+      addRail(param).then(response => {
+        alert("成功")
+      })
+      // // 创建Blob并下载
+      // const blob = new Blob([jsonData], { type: 'application/json' })
+      // const url = URL.createObjectURL(blob)
+      //
+      // const a = document.createElement('a')
+      // a.href = url
+      // a.download = `polygons_${new Date().getTime()}.json`
+      // document.body.appendChild(a)
+      // a.click()
+      //
+      // // 清理
+      // setTimeout(() => {
+      //   document.body.removeChild(a)
+      //   URL.revokeObjectURL(url)
+      // }, 0)
+      // this.updateCanvasInfo(`已保存 ${this.polygons.length} 个多边形`)
     },
     // 更新画布信息
     updateCanvasInfo(text) {
@@ -466,7 +483,11 @@ export default {
       }, 1000)
     },
     // 重绘所有多边形
-    redrawAllPolygons() {
+    redrawAllPolygons(data) {
+      if (data) {
+        this.polygons = JSON.parse(data).polygons
+      }
+
       const canvas = this.$refs.polygonCanvas
       if (!canvas) return
 

+ 18 - 7
monitor_ui/src/views/centerMonitor/camera/index.vue

@@ -627,11 +627,11 @@
           <div style="margin-left: 60px;margin-bottom: 15px">
             规则框类型:
             <el-radio-group v-model="infoDraw.type">
-              <el-radio :label="1">识别框</el-radio>
-              <el-radio :label="2">屏蔽框</el-radio>
+              <el-radio :label="'0'">识别框</el-radio>
+              <el-radio :label="'1'">屏蔽框</el-radio>
             </el-radio-group>
           </div>
-          <PolygonDrawer ref="PolygonDrawer" :url="infoDraw.url" :channelId="infoDraw.channelId" />
+          <PolygonDrawer ref="PolygonDrawer" :channelId="infoDraw.channelId" :pointId="infoDraw.pointId" :pointName="infoDraw.pointName" :taskId="infoDraw.taskId" :type="infoDraw.type" :tasks="infoDraw.tasks" />
         </el-col>
       </el-row>
       <div slot="footer" class="dialog-footer">
@@ -678,6 +678,7 @@ import {
 import PolygonDrawer from './PolygonDrawer.vue'
 import { getPresetPoints } from '@/api/centerMonitor/LabelManagement/setLabel'
 import { getTasks, getRtsp } from '@/api/centerMonitor/camera/camerachannel'
+import { getRail } from '@/api/centerMonitor/rail/rail'
 
 
 /** ----------------------------------摄像头预览结束------------------------------------- */
@@ -1241,7 +1242,7 @@ export default {
     drawFence(row) {
       // window.open('http://' + row.cameraIp + ':1036?username=sooka&password=Sooka6688!!')
       listCamerachannel({cameraId: row.id}).then(response => {
-        this.infoDraw = {cameraName: row.cameraName, channels: response.rows, tasks: [], presetPoints: [], type: 1};
+        this.infoDraw = {cameraName: row.cameraName, channels: response.rows, tasks: [], presetPoints: [], pointId: "", pointName: "", type: "0"};
         this.openDraw = true
         this.title = "绘制围栏"
       });
@@ -2042,15 +2043,25 @@ export default {
           }
         })
         getRtsp(channel.channelNum).then(response => {
-          this.infoDraw.url = response.data.data.url.split("|")[1] + "?token=" + response.data.data.token
-          this.$refs.PolygonDrawer.playReal;
+          this.$refs.PolygonDrawer.playReal(response.data.data.url.split("|")[1] + "?token=" + response.data.data.token);
         })
       } else {
         this.$modal.msgSuccess('请先维护通道编号')
       }
     },
     getDraws(point) {
-      console.log(point)
+      this.infoDraw.pointId = point.presetPointCode
+      this.infoDraw.pointName = point.presetPointName
+      if (this.infoDraw.channelId && this.infoDraw.taskId && this.infoDraw.pointId && this.infoDraw.pointName && this.infoDraw.type) {
+        let param = {channelId: this.infoDraw.channelId, taskId: this.infoDraw.taskId, pointId: this.infoDraw.pointId, pointName: this.infoDraw.pointName, type: this.infoDraw.type}
+        getRail(param).then(response => {
+          if (response.data && response.data.jsonData) {
+            this.$refs.PolygonDrawer.redrawAllPolygons(response.data.jsonData)
+          } else {
+            this.$refs.PolygonDrawer.clearCanvas()
+          }
+        })
+      }
     }
   }
 }

+ 36 - 0
src/main/java/com/sooka/sponest/monitor/channelrail/controller/ChannelRailController.java

@@ -0,0 +1,36 @@
+package com.sooka.sponest.monitor.channelrail.controller;
+
+import com.ruoyi.common.core.web.controller.BaseController;
+import com.ruoyi.common.core.web.domain.AjaxResult;
+import com.sooka.sponest.monitor.channelrail.domain.ChannelRail;
+import com.sooka.sponest.monitor.channelrail.service.IChannelRailService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+/**
+ * 摄像头Controller
+ *
+ * @author ruoyi
+ * @date 2022-06-08
+ */
+@RestController
+@RequestMapping("/channelRail")
+public class ChannelRailController extends BaseController {
+
+    @Autowired
+    private IChannelRailService channelRailService;
+
+    @GetMapping("/get")
+    public AjaxResult get(String channelId, Long taskId, Long pointId, String type) {
+        return success(channelRailService.get(channelId, taskId, pointId, type));
+    }
+
+    @PostMapping("/save")
+    public AjaxResult save(@RequestBody ChannelRail channelRail) {
+        channelRailService.delete(channelRail.getChannelId(), channelRail.getTaskId(), channelRail.getPointId(), channelRail.getType());
+        return channelRailService.save(channelRail) > 0 ? success() : error();
+    }
+}
+
+
+

+ 21 - 0
src/main/java/com/sooka/sponest/monitor/channelrail/domain/ChannelRail.java

@@ -0,0 +1,21 @@
+package com.sooka.sponest.monitor.channelrail.domain;
+
+import lombok.Data;
+
+@Data
+public class ChannelRail {
+
+    private String channelId;
+
+    private Long taskId;
+
+    private Long pointId;
+
+    private String pointName;
+
+    private String type;
+
+    private String jsonData;
+
+    private String info;
+}

+ 22 - 0
src/main/java/com/sooka/sponest/monitor/channelrail/mapper/ChannelRailMapper.java

@@ -0,0 +1,22 @@
+package com.sooka.sponest.monitor.channelrail.mapper;
+
+import com.sooka.sponest.monitor.channelrail.domain.ChannelRail;
+import org.apache.ibatis.annotations.Param;
+import org.springframework.stereotype.Repository;
+
+/**
+ * 摄像头Mapper接口
+ *
+ * @author ruoyi
+ * @date 2022-06-08
+ */
+@Repository
+public interface ChannelRailMapper {
+
+    ChannelRail get(@Param("channelId") String channelId, @Param("taskId") Long taskId, @Param("pointId") Long pointId, @Param("type") String type);
+
+    int save(ChannelRail channelRail);
+
+    int delete(@Param("channelId") String channelId, @Param("taskId") Long taskId, @Param("pointId") Long pointId, @Param("type") String type);
+}
+

+ 24 - 0
src/main/java/com/sooka/sponest/monitor/channelrail/service/IChannelRailService.java

@@ -0,0 +1,24 @@
+package com.sooka.sponest.monitor.channelrail.service;
+
+import com.sooka.sponest.monitor.channelrail.domain.ChannelRail;
+
+/**
+ * 摄像头Service接口
+ *
+ * @author ruoyi
+ * @date 2022-06-08
+ */
+public interface IChannelRailService {
+
+    ChannelRail get(String channelId, Long taskId, Long pointId, String type);
+
+    int save(ChannelRail channelRail);
+
+    int delete(String channelId, Long taskId, Long pointId, String type);
+}
+
+
+
+
+
+

+ 85 - 0
src/main/java/com/sooka/sponest/monitor/channelrail/service/impl/ChannelRailServiceImpl.java

@@ -0,0 +1,85 @@
+package com.sooka.sponest.monitor.channelrail.service.impl;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import com.sooka.sponest.monitor.channelrail.domain.ChannelRail;
+import com.sooka.sponest.monitor.channelrail.mapper.ChannelRailMapper;
+import com.sooka.sponest.monitor.channelrail.service.IChannelRailService;
+import com.sooka.sponest.monitor.dahua.service.DahuaService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+/**
+ * 摄像头通道Service业务层处理
+ *
+ * @author ruoyi
+ * @date 2022-06-10
+ */
+@Service
+public class ChannelRailServiceImpl implements IChannelRailService {
+
+    @Autowired
+    private ChannelRailMapper channelRailMapper;
+
+    @Autowired
+    private DahuaService dahuaService;
+
+    @Override
+    public ChannelRail get(String channelId, Long taskId, Long pointId, String type) {
+        return channelRailMapper.get(channelId, taskId, pointId, type);
+    }
+
+    @Override
+    public int save(ChannelRail channelRail) {
+        try {
+            JSONObject jsonObject = JSONObject.parseObject(channelRail.getInfo());
+            List<JSONObject> channels = JSONObject.parseArray(jsonObject.getString("channelInfos"), JSONObject.class);
+            channels = channels.stream().map(channel -> {
+                if (channel.getString("channelCode").equals(channelRail.getChannelId())) {
+                    List<JSONObject> channelPresetPointVOS = JSONObject.parseArray(channel.getString("channelPresetPointVOS"), JSONObject.class);
+                    channelPresetPointVOS = channelPresetPointVOS.stream().map(channelPresetPointVO -> {
+                        if (channelPresetPointVO.getLong("presetPointId").equals(channelRail.getPointId())) {
+                            List<Map<String, Object>> channelCutInfos = new ArrayList<>();
+                            List<JSONObject> polygons = JSONObject.parseArray(JSONObject.parseObject(channelRail.getJsonData()).getString("polygons"), JSONObject.class);
+                            polygons.forEach(item -> {
+                                Map<String, Object> map = new HashMap<>();
+                                map.put("taskId", jsonObject.getLong("id"));
+                                map.put("pointId", channelRail.getPointId());
+                                map.put("pointName", channelRail.getPointName());
+                                map.put("type", channelRail.getType());
+                                item.remove("lineColor");
+                                item.remove("fillColor");
+                                item.remove("lineWidth");
+                                map.put("areaPoints", item.toJSONString());
+                                map.put("channelCode", channel.getString("channelCode"));
+                                map.put("channelName", channel.getString("channelName"));
+                                channelCutInfos.add(map);
+                            });
+                            channelPresetPointVO.put("channelCutInfos", channelCutInfos);
+                        }
+                        return channelPresetPointVO;
+                    }).collect(Collectors.toList());
+                    channel.put("channelPresetPointVOS", channelPresetPointVOS);
+                }
+                return channel;
+            }).collect(Collectors.toList());
+            jsonObject.put("channelInfos", channels);
+            System.out.println(JSON.toJSONString(jsonObject));
+            dahuaService.updateTask(jsonObject);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return channelRailMapper.save(channelRail);
+    }
+
+    @Override
+    public int delete(String channelId, Long taskId, Long pointId, String type) {
+        return channelRailMapper.delete(channelId, taskId, pointId, type);
+    }
+}

+ 2 - 0
src/main/java/com/sooka/sponest/monitor/dahua/service/DahuaService.java

@@ -135,4 +135,6 @@ public interface DahuaService {
      * @return
      */
     AjaxResult SitPosition(JSONObject json);
+
+    void updateTask(com.alibaba.fastjson.JSONObject jsonObject);
 }

+ 14 - 0
src/main/java/com/sooka/sponest/monitor/dahua/service/impl/DahuaServiceImpl.java

@@ -973,5 +973,19 @@ public class DahuaServiceImpl extends BaseService implements DahuaService {
         }
     }
 
+    @Override
+    public void updateTask(com.alibaba.fastjson.JSONObject jsonObject) {
+        String prBody = "";
+        try {
+            IccHttpHttpRequest pr = new IccHttpHttpRequest(host + "/evo-apigw/evo-gmai/1.4.0/api/algorithmTask/update", Method.POST, jsonObject);
+            pr.getHttpRequest().header("Authorization", "bearer " + getTokenByPassword());
+            prBody = pr.execute();
+            AjaxResult.success("操作成功", JSON.parseObject(prBody));
+        } catch (Exception ex) {
+            log.error("操作失败", ex);
+            AjaxResult.error("操作失败", JSON.parseObject(prBody));
+        }
+    }
+
 
 }

+ 114 - 58
src/main/java/com/sooka/sponest/monitor/device/controller/CentermonitorTTemperatureControlDeviceController.java

@@ -1,8 +1,11 @@
 package com.sooka.sponest.monitor.device.controller;
 
 import com.dahuatech.hutool.core.bean.BeanUtil;
+import com.dahuatech.hutool.json.JSONArray;
 import com.dahuatech.hutool.json.JSONObject;
+import com.dahuatech.hutool.json.JSONUtil;
 import com.ruoyi.common.core.domain.R;
+import com.ruoyi.common.core.utils.DateUtils;
 import com.ruoyi.common.core.utils.StringUtils;
 import com.ruoyi.common.core.utils.poi.ExcelUtil;
 import com.ruoyi.common.core.web.controller.BaseController;
@@ -52,12 +55,8 @@ public class CentermonitorTTemperatureControlDeviceController extends BaseContro
             // 转换为实体类
             CentermonitorTMonitoringDeviceData deviceData = com.dahuatech.hutool.json.JSONUtil.toBean(
                     jsonStr, CentermonitorTMonitoringDeviceData.class);
-            String deviceId = UUID.randomUUID().toString().replaceAll("-", "");
-            deviceData.setDeviceId(deviceId);
             // 设置时间
-            LocalDateTime now = LocalDateTime.now();
-            deviceData.setCreateTime(java.util.Date.from(now.atZone(java.time.ZoneId.systemDefault()).toInstant()));
-            deviceData.setUploadTime(java.util.Date.from(now.atZone(java.time.ZoneId.systemDefault()).toInstant()));
+            deviceData.setUploadTime(DateUtils.getTime());
 
             // 保存数据
             int result = centermonitorTMonitoringDeviceService.insertTemperatureControlData(deviceData);
@@ -93,66 +92,123 @@ public class CentermonitorTTemperatureControlDeviceController extends BaseContro
     @Log(title = "传感器", businessType = BusinessType.OTHER)
     @ApiOperation(value = "获取温控设备温度图表数据", notes = "获取温控设备的温度折线图数据")
     @GetMapping("/getTemperatureChartData")
-    public AjaxResult getTemperatureChartData(String deviceId) {
+    public AjaxResult getTemperatureChartData(String uploadTime) {
         try {
             // 创建查询参数
             CentermonitorTMonitoringDeviceData query = new CentermonitorTMonitoringDeviceData();
-            query.setDeviceId(StringUtils.isNotBlank(deviceId) ? deviceId: null);
+            query.setUploadTime(StringUtils.isNotBlank(uploadTime) ? uploadTime: null);
             // 查询数据
             List<CentermonitorTMonitoringDeviceData> dataList = centermonitorTMonitoringDeviceService.selectTemperatureControlMonitoringData(query);
-            // 构建返回结果
-            Map<String, Object> result = new HashMap<>();
-            // 准备categories(时间轴)
-            List<String> categories = new ArrayList<>();
-            // 准备series(温度数据系列)
-            List<Map<String, Object>> series = new ArrayList<>();
-            Map<String, List<Double>> tempDataMap = new HashMap<>();
-            // 初始化5个温度层级的数据列表
-            for (int i = 1; i <= 5; i++) {
-                String seriesName = "温度层级" + i;
-                tempDataMap.put(seriesName, new ArrayList<>());
-            }
-            // 填充数据
-            if (dataList != null && !dataList.isEmpty()) {
-                for (CentermonitorTMonitoringDeviceData data : dataList) {
-                    // 添加时间到categories
-                    categories.add(String.valueOf(data.getUploadTime() != null ? data.getUploadTime() : data.getCreateTime()));
-
-                    // 处理电缆1的5个温度层级
-                    if (data.getT1_01() != null) tempDataMap.get("温度层级1").add(Double.parseDouble(data.getT1_01()));
-                    if (data.getT1_02() != null) tempDataMap.get("温度层级2").add(Double.parseDouble(data.getT1_02()));
-                    if (data.getT1_03() != null) tempDataMap.get("温度层级3").add(Double.parseDouble(data.getT1_03()));
-                    if (data.getT1_04() != null) tempDataMap.get("温度层级4").add(Double.parseDouble(data.getT1_04()));
-                    if (data.getT1_05() != null) tempDataMap.get("温度层级5").add(Double.parseDouble(data.getT1_05()));
-
-                    // 处理电缆1的5个温度层级
-                    if (data.getT2_01() != null) tempDataMap.get("温度层级1").add(Double.parseDouble(data.getT2_01()));
-                    if (data.getT2_02() != null) tempDataMap.get("温度层级2").add(Double.parseDouble(data.getT2_02()));
-                    if (data.getT2_03() != null) tempDataMap.get("温度层级3").add(Double.parseDouble(data.getT2_03()));
-                    if (data.getT2_04() != null) tempDataMap.get("温度层级4").add(Double.parseDouble(data.getT2_04()));
-                    if (data.getT2_05() != null) tempDataMap.get("温度层级5").add(Double.parseDouble(data.getT2_05()));
-
-                    // 处理电缆1的5个温度层级
-                    if (data.getT3_01() != null) tempDataMap.get("温度层级1").add(Double.parseDouble(data.getT3_01()));
-                    if (data.getT3_02() != null) tempDataMap.get("温度层级2").add(Double.parseDouble(data.getT3_02()));
-                    if (data.getT3_03() != null) tempDataMap.get("温度层级3").add(Double.parseDouble(data.getT3_03()));
-                    if (data.getT3_04() != null) tempDataMap.get("温度层级4").add(Double.parseDouble(data.getT3_04()));
-                    if (data.getT3_05() != null) tempDataMap.get("温度层级5").add(Double.parseDouble(data.getT3_05()));
-                }
-            }
+            Map <String, Map <String, List<String>>> map0 = new HashMap<>();
+            Map <String, List<String>> map1 = new HashMap<>();
+            Map <String, List<String>> map2 = new HashMap<>();
+            Map <String, List<String>> map3 = new HashMap<>();
+            //T1_01 data
+            List<String> dataArray11 = new ArrayList<>();
+            //T1_02 data
+            List<String> dataArray12 = new ArrayList<>();
+            //T1_03 data
+            List<String> dataArray13 = new ArrayList<>();
+            //T1_04 data
+            List<String> dataArray14 = new ArrayList<>();
+            //T1_05 data
+            List<String> dataArray15 = new ArrayList<>();
+            //Name1
+            List<String> nameArray1 = new ArrayList<>();
+
+            //T2_01 data
+            List<String> dataArray21 = new ArrayList<>();
+            //T2_02 data
+            List<String> dataArray22 = new ArrayList<>();
+            //T2_03 data
+            List<String> dataArray23 = new ArrayList<>();
+            //T2_04 data
+            List<String> dataArray24 = new ArrayList<>();
+            //T2_05 data
+            List<String> dataArray25 = new ArrayList<>();
+            //Name2
+            List<String> nameArray2 = new ArrayList<>();
+
+            //T3_01 data
+            List<String> dataArray31 = new ArrayList<>();
+            //T3_02 data
+            List<String> dataArray32 = new ArrayList<>();
+            //T3_03 data
+            List<String> dataArray33 = new ArrayList<>();
+            //T3_04 data
+            List<String> dataArray34 = new ArrayList<>();
+            //T3_05 data
+            List<String> dataArray35 = new ArrayList<>();
+            //Name3
+            List<String> nameArray3 = new ArrayList<>();
+
+            for (int i = 0; i < dataList.size(); i++) {
+                // T1系列数据除以10
+                dataArray11.add(i, dataList.get(i).getT1_01() != null ?
+                        String.valueOf(Double.parseDouble(dataList.get(i).getT1_01()) / 10) : null);
+                dataArray12.add(i, dataList.get(i).getT1_02() != null ?
+                        String.valueOf(Double.parseDouble(dataList.get(i).getT1_02()) / 10) : null);
+                dataArray13.add(i, dataList.get(i).getT1_03() != null ?
+                        String.valueOf(Double.parseDouble(dataList.get(i).getT1_03()) / 10) : null);
+                dataArray14.add(i, dataList.get(i).getT1_04() != null ?
+                        String.valueOf(Double.parseDouble(dataList.get(i).getT1_04()) / 10) : null);
+                dataArray15.add(i, dataList.get(i).getT1_05() != null ?
+                        String.valueOf(Double.parseDouble(dataList.get(i).getT1_05()) / 10) : null);
+                nameArray1.add(i, dataList.get(i).getUploadTime());
+
+                // T2系列数据除以10
+                dataArray21.add(i, dataList.get(i).getT2_01() != null ?
+                        String.valueOf(Double.parseDouble(dataList.get(i).getT2_01()) / 10) : null);
+                dataArray22.add(i, dataList.get(i).getT2_02() != null ?
+                        String.valueOf(Double.parseDouble(dataList.get(i).getT2_02()) / 10) : null);
+                dataArray23.add(i, dataList.get(i).getT2_03() != null ?
+                        String.valueOf(Double.parseDouble(dataList.get(i).getT2_03()) / 10) : null);
+                dataArray24.add(i, dataList.get(i).getT2_04() != null ?
+                        String.valueOf(Double.parseDouble(dataList.get(i).getT2_04()) / 10) : null);
+                dataArray25.add(i, dataList.get(i).getT2_05() != null ?
+                        String.valueOf(Double.parseDouble(dataList.get(i).getT2_05()) / 10) : null);
+                nameArray2.add(i, dataList.get(i).getUploadTime());
+
+                // T3系列数据除以10
+                dataArray31.add(i, dataList.get(i).getT3_01() != null ?
+                        String.valueOf(Double.parseDouble(dataList.get(i).getT3_01()) / 10) : null);
+                dataArray32.add(i, dataList.get(i).getT3_02() != null ?
+                        String.valueOf(Double.parseDouble(dataList.get(i).getT3_02()) / 10) : null);
+                dataArray33.add(i, dataList.get(i).getT3_03() != null ?
+                        String.valueOf(Double.parseDouble(dataList.get(i).getT3_03()) / 10) : null);
+                dataArray34.add(i, dataList.get(i).getT3_04() != null ?
+                        String.valueOf(Double.parseDouble(dataList.get(i).getT3_04()) / 10) : null);
+                dataArray35.add(i, dataList.get(i).getT3_05() != null ?
+                        String.valueOf(Double.parseDouble(dataList.get(i).getT3_05()) / 10) : null);
+                nameArray3.add(i, dataList.get(i).getUploadTime());
 
-            // 构建series对象
-            for (Map.Entry<String, List<Double>> entry : tempDataMap.entrySet()) {
-                Map<String, Object> seriesItem = new HashMap<>();
-                seriesItem.put("name", entry.getKey());
-                seriesItem.put("data", entry.getValue());
-                series.add(seriesItem);
-            }
 
-            result.put("categories", categories);
-            result.put("series", series);
-
-            return AjaxResult.success(result);
+            }
+            map1.put("t1_01", dataArray11);
+            map1.put("t1_02", dataArray12);
+            map1.put("t1_03", dataArray13);
+            map1.put("t1_04", dataArray14);
+            map1.put("t1_05", dataArray15);
+            map1.put("t1_time", nameArray1);
+
+            map2.put("t2_01", dataArray21);
+            map2.put("t2_02", dataArray22);
+            map2.put("t2_03", dataArray23);
+            map2.put("t2_04", dataArray24);
+            map2.put("t2_05", dataArray25);
+            map2.put("t2_time", nameArray2);
+
+            map3.put("t3_01", dataArray31);
+            map3.put("t3_02", dataArray32);
+            map3.put("t3_03", dataArray33);
+            map3.put("t3_04", dataArray34);
+            map3.put("t3_05", dataArray35);
+            map3.put("t3_time", nameArray3);
+
+            map0.put("t1",map1);
+            map0.put("t2",map2);
+            map0.put("t3",map3);
+            return AjaxResult.success(map0);
         } catch (Exception e) {
             log.error("获取温控设备温度图表数据异常: {}", e.getMessage());
             return AjaxResult.error("获取数据异常,请稍后重试");

+ 1 - 6
src/main/java/com/sooka/sponest/monitor/device/domain/CentermonitorTMonitoringDeviceData.java

@@ -109,11 +109,6 @@ public class CentermonitorTMonitoringDeviceData extends BaseBusinessEntity {
     /**
      * 数据上传时间
      */
-    private Date uploadTime;
-
-    /**
-     * 创建时间
-     */
-    private Date createTime;
+    private String uploadTime;
 
 }

+ 33 - 0
src/main/resources/mapper/monitor/channelrail/ChannelRailMapper.xml

@@ -0,0 +1,33 @@
+<?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">
+<mapper namespace="com.sooka.sponest.monitor.channelrail.mapper.ChannelRailMapper">
+
+    <select id="get" resultType="ChannelRail">
+        select channel_id channelId, task_id taskId, point_id pointId, type, json_data jsonData from centermonitor_t_channel_rail
+        where channel_id = #{channelId} and task_id = #{taskId} and point_id = #{pointId} and type = #{type}
+    </select>
+
+    <insert id="save" parameterType="ChannelRail">
+        insert into centermonitor_t_channel_rail
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="channelId != null">channel_id,</if>
+            <if test="taskId != null">task_id,</if>
+            <if test="pointId != null">point_id,</if>
+            <if test="type != null">type,</if>
+            <if test="jsonData != null">json_data,</if>
+        </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="channelId != null">#{channelId},</if>
+            <if test="taskId != null">#{taskId},</if>
+            <if test="pointId != null">#{pointId},</if>
+            <if test="type != null">#{type},</if>
+            <if test="jsonData != null">#{jsonData},</if>
+        </trim>
+    </insert>
+
+    <delete id="delete">
+        delete from centermonitor_t_channel_rail where channel_id = #{channelId} and task_id = #{taskId} and point_id = #{pointId} and type = #{type}
+    </delete>
+</mapper>

+ 33 - 13
src/main/resources/mapper/monitor/device/CentermonitorTMonitoringDeviceMapper.xml

@@ -120,7 +120,6 @@
         <result property="T3_04" column="T3_04"/>
         <result property="T3_05" column="T3_05"/>
         <result property="uploadTime" column="upload_time"/>
-        <result property="createTime" column="create_time"/>
     </resultMap>
 
     <resultMap type="CentermonitorTMonitoringDataWaterPressure" id="CentermonitorTMonitoringDataWaterPressureResult">
@@ -185,7 +184,6 @@
     <sql id="selectCentermonitorTMonitoringDeviceDataVo">
         SELECT
             id,
-            device_id,
             T1_01,
             T1_02,
             T1_03,
@@ -201,16 +199,15 @@
             T3_03,
             T3_04,
             T3_05,
-            upload_time,
-            create_time
+            upload_time
         FROM
             centermonitor_t_monitoring_device_data
+        WHERE DATE(upload_time) = CURDATE()
     </sql>
 
     <insert id="insertTemperatureControlData" parameterType="CentermonitorTMonitoringDeviceData">
         INSERT INTO centermonitor_t_monitoring_device_data
         (
-            device_id,
             T1_01,
             T1_02,
             T1_03,
@@ -226,12 +223,10 @@
             T3_03,
             T3_04,
             T3_05,
-            upload_time,
-            create_time
+            upload_time
         )
         VALUES
         (
-            #{deviceId},
             #{T1_01},
             #{T1_02},
             #{T1_03},
@@ -247,8 +242,7 @@
             #{T3_03},
             #{T3_04},
             #{T3_05},
-            #{uploadTime},
-            #{createTime}
+            #{uploadTime}
         )
     </insert>
 
@@ -588,11 +582,37 @@
     </select>
 
     <select id="selectTemperatureControlMonitoringData" parameterType="CentermonitorTMonitoringDeviceData" resultMap="CentermonitorTMonitoringDeviceDataResult">
-        <include refid="selectCentermonitorTMonitoringDeviceDataVo"/>
+              SELECT
+              id,
+              T1_01,
+              T1_02,
+              T1_03,
+              T1_04,
+              T1_05,
+              T2_01,
+              T2_02,
+              T2_03,
+              T2_04,
+              T2_05,
+              T3_01,
+              T3_02,
+              T3_03,
+              T3_04,
+              T3_05,
+              upload_time
+              FROM
+        centermonitor_t_monitoring_device_data
         <where>
-            <if test="deviceId != null">and device_id = #{deviceId}</if>
+            <choose>
+                <when test="uploadTime != null">
+                    DATE(upload_time) = #{uploadTime} ORDER BY upload_time ASC
+                </when>
+                <otherwise>
+                    DATE(upload_time) = CURDATE() ORDER BY upload_time desc LIMIT 10
+                </otherwise>
+            </choose>
         </where>
-        ORDER BY upload_time DESC
+
     </select>
 
     <select id="selectInsectPestsCentermonitorByDeviceCode" parameterType="string"