浏览代码

Merge branch 'master' of http://git.xt.wenhq.top:8083/wenhongquan/iotc

liwei19941102 2 年之前
父节点
当前提交
dbabb4d6cb

+ 11 - 11
ruoyi-system/src/main/java/com/ruoyi/data/domain/TblUnit.java

@@ -23,40 +23,40 @@ public class TblUnit extends BaseEntity {
     private static final long serialVersionUID=1L;
 
     /**
-     * 
+     *
      */
     @TableId(value = "id")
     private Long id;
     /**
-     * 
+     *
      */
     private String name;
     /**
-     * 
+     *
      */
     private String unitSymbol;
     /**
-     * 
+     *
      */
     private String unitName;
     /**
-     * 
+     *
      */
     private String isStandard;
     /**
-     * 
+     *
      */
     private String unitType;
     /**
-     * 
+     *
      */
-    private Long toStandardRatio;
+    private Float toStandardRatio;
     /**
-     * 
+     *
      */
-    private Long toOffset;
+    private Float toOffset;
     /**
-     * 
+     *
      */
     private String remark;
 

+ 2 - 2
ruoyi-system/src/main/java/com/ruoyi/data/domain/bo/TblUnitBo.java

@@ -68,13 +68,13 @@ public class TblUnitBo extends BaseEntity {
      *
      */
     @NotNull(message = "不能为空", groups = { AddGroup.class, EditGroup.class })
-    private Long toStandardRatio;
+    private Float toStandardRatio;
 
     /**
      *
      */
     @NotNull(message = "不能为空", groups = { AddGroup.class, EditGroup.class })
-    private Long toOffset;
+    private Float toOffset;
 
     private String remark;
 //    private String creator;

+ 11 - 11
ruoyi-system/src/main/java/com/ruoyi/data/domain/vo/TblUnitVo.java

@@ -22,55 +22,55 @@ public class TblUnitVo implements Serializable {
     private static final long serialVersionUID = 1L;
 
     /**
-     * 
+     *
      */
     @ExcelProperty(value = "")
     private Long id;
 
     /**
-     * 
+     *
      */
     @ExcelProperty(value = "")
     private String name;
 
     /**
-     * 
+     *
      */
     @ExcelProperty(value = "")
     private String unitSymbol;
 
     /**
-     * 
+     *
      */
     @ExcelProperty(value = "")
     private String unitName;
 
     /**
-     * 
+     *
      */
     @ExcelProperty(value = "")
     private String isStandard;
 
     /**
-     * 
+     *
      */
     @ExcelProperty(value = "")
     private String unitType;
 
     /**
-     * 
+     *
      */
     @ExcelProperty(value = "")
-    private Long toStandardRatio;
+    private Float toStandardRatio;
 
     /**
-     * 
+     *
      */
     @ExcelProperty(value = "")
-    private Long toOffset;
+    private Float toOffset;
 
     /**
-     * 
+     *
      */
     @ExcelProperty(value = "")
     private String remark;

+ 6 - 2
ruoyi-ui-vue3/src/store/modules/websocket.js

@@ -10,11 +10,15 @@ const useWSStore = defineStore(
     actions: {
       setMessage(message) {
         let data = message;
+        let timdata = moment().format('YYYY-MM-DD HH:mm:ss');
+        if(data.time !=null&&data.time!=undefined){
+          timdata = moment(data.time).format('YYYY-MM-DD HH:mm:ss')
+        }
         data.data.forEach(i=>{
           if(!this.message[`${data.sensorId}`]){
             this.message[`${data.sensorId}`] = {};
           }
-          this.message[`${data.sensorId}`][i.name] = { value:i.value,unit:i.unitType,time:moment().format('YYYY-MM-DD HH:mm:ss') }
+          this.message[`${data.sensorId}`][i.name] = { value:i.value,unit:i.unitType,time:timdata }
         })
       },
       setMessagetype1(sn,message) {
@@ -23,7 +27,7 @@ const useWSStore = defineStore(
           if(!this.message[`${sn}`]){
             this.message[`${sn}`] = {};
           }
-          this.message[`${sn}`][i.name] = { value:i.value,unit:i.unitType,time:moment(i.createdTime).format('YYYY-MM-DD HH:mm:ss') }
+          this.message[`${sn}`][i.name] = { value:i.value,unit:i.unitType,time:moment(i.createTime).format('YYYY-MM-DD HH:mm:ss') }
         })
       },
       getMessage() {

+ 10 - 1
ruoyi-ui-vue3/src/views/device/sensordash/index.vue

@@ -539,7 +539,16 @@ const isloading = ref(false);
 watchEffect(()=>{
   if(currentsensor.value && useWSStore().getMessage()[currentsensor.value.id]  && useWSStore().getMessage()[currentsensor.value.id][currentname.value] ){
     let data = useWSStore().getMessage()[currentsensor.value.id][currentname.value];
-    historytabledata.value.push([moment(data.time).toDate(),data.value]);
+    var isadd = false;
+    historytabledata.value.forEach(i=>{
+      if(moment(data.time).utc()-moment(i[0]).utc()>10){
+        isadd = true;
+      }
+    })
+    if(isadd){
+      historytabledata.value.push([moment(data.time).toDate(),data.value]);
+    }
+
   }
   if(historytabledata.value.length>0){
     const usedmemoryInstance = echarts.init(chartlinediv.value, "macarons");