Ver código fonte

add 新增设备信息发布事件
add 新增设备报警发布事件

18339543638 3 anos atrás
pai
commit
b2cd3f42f1

+ 2 - 0
coffee-system/src/main/java/com/coffee/bus/entity/BusAnalgesicScoreEntity.java

@@ -11,6 +11,7 @@ import java.util.Date;
 
 import com.coffee.common.config.mybatis.DateToBigIntHandler;
 import com.coffee.common.entity.TenantGenericEntity;
+import com.fasterxml.jackson.annotation.JsonFormat;
 import com.fasterxml.jackson.annotation.JsonProperty;
 import com.fasterxml.jackson.annotation.JsonSetter;
 import io.swagger.annotations.ApiModel;
@@ -105,6 +106,7 @@ public class BusAnalgesicScoreEntity extends TenantGenericEntity<String,String>
 
     @ApiModelProperty(value = "评价时间",hidden = true)
     @TableField(typeHandler = DateToBigIntHandler.class)
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
     private Date evaluateTime;
 
     @ApiModelProperty(value = "评价人")

+ 5 - 1
coffee-system/src/main/java/com/coffee/bus/entity/BusHospitalEntity.java

@@ -9,6 +9,7 @@ import com.coffee.common.config.mybatis.DateToBigIntHandler;
 import com.coffee.common.entity.GenericEntity;
 import com.coffee.common.entity.RecordCreationEntity;
 import com.coffee.common.entity.RecordModifierEntity;
+import com.fasterxml.jackson.annotation.JsonFormat;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
@@ -66,6 +67,8 @@ public class BusHospitalEntity extends GenericEntity<String> implements RecordMo
     @Length(max = 255,message = "邮箱联系地址长度不得超过255个字节")
     private String email;
 
+    private String remark;
+
     /**
      * 经纬度坐标
      */
@@ -79,15 +82,16 @@ public class BusHospitalEntity extends GenericEntity<String> implements RecordMo
     private String updateBy;
 
     @TableField(typeHandler = DateToBigIntHandler.class,fill = FieldFill.INSERT)
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
     private Date createTime;
 
     @TableField(typeHandler = DateToBigIntHandler.class,fill = FieldFill.UPDATE)
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
     private Date updateTime;
 
     @TableField(fill = FieldFill.INSERT)
     @TableLogic(value = "0",delval = "1")
     private Integer isDelete;
-
     @Data
     public static class  GeoPoint{
         private String lon;

+ 2 - 0
coffee-system/src/main/java/com/coffee/bus/entity/BusHospitalLogEntity.java

@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.annotation.TableName;
 import com.coffee.bus.enums.HospitalLogEnum;
 import com.coffee.common.config.mybatis.DateToBigIntHandler;
 import com.coffee.common.entity.TenantGenericEntity;
+import com.fasterxml.jackson.annotation.JsonFormat;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
@@ -28,6 +29,7 @@ import java.util.Date;
 public class BusHospitalLogEntity extends TenantGenericEntity<String,String> {
 
     @TableField(typeHandler = DateToBigIntHandler.class)
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
     @ApiModelProperty(value = "医院数据接收时间")
     private Date receiveTime;
 

+ 3 - 0
coffee-system/src/main/java/com/coffee/bus/entity/BusTemplateAnalgesicEntity.java

@@ -9,6 +9,7 @@ import com.coffee.common.config.mybatis.DateToBigIntHandler;
 import com.coffee.common.entity.RecordCreationEntity;
 import com.coffee.common.entity.RecordModifierEntity;
 import com.coffee.common.entity.TenantGenericEntity;
+import com.fasterxml.jackson.annotation.JsonFormat;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
@@ -43,9 +44,11 @@ public class BusTemplateAnalgesicEntity  extends TenantGenericEntity<Long,Long>
     private String updateBy;
 
     @TableField(typeHandler = DateToBigIntHandler.class,fill = FieldFill.INSERT)
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
     private Date createTime;
 
     @TableField(typeHandler = DateToBigIntHandler.class,fill = FieldFill.UPDATE)
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
     private Date updateTime;
 
     @TableField(fill = FieldFill.INSERT)

+ 19 - 0
coffee-system/src/main/java/com/coffee/bus/listener/enums/ReportType.java

@@ -0,0 +1,19 @@
+package com.coffee.bus.listener.enums;
+
+/**
+ * @author lifang
+ * @version 1.0.0
+ * @ClassName ReportType.java
+ * @Description TODO
+ * @createTime 2022年03月21日 16:46:00
+ */
+public enum  ReportType {
+    /**
+     * 上报数据为行式存储,即每一次上报属性包括设备所有属性
+     */
+    LINE,
+    /**
+     * 上报数据为列式存储,即每一次上报属性仅上报发生变化的属性
+     */
+    COLUMN
+}

+ 22 - 0
coffee-system/src/main/java/com/coffee/bus/listener/event/bean/DeviceAlarmEvent.java

@@ -0,0 +1,22 @@
+package com.coffee.bus.listener.event.bean;
+
+import org.springframework.context.ApplicationEvent;
+
+import java.time.Clock;
+
+/**
+ * @author lifang
+ * @version 1.0.0
+ * @ClassName DeviceAlarmEvent.java
+ * @Description TODO
+ * @createTime 2022年03月21日 16:44:00
+ */
+public class DeviceAlarmEvent extends ApplicationEvent {
+    public DeviceAlarmEvent(Object source) {
+        super(source);
+    }
+
+    public DeviceAlarmEvent(Object source, Clock clock) {
+        super(source, clock);
+    }
+}

+ 48 - 0
coffee-system/src/main/java/com/coffee/bus/listener/event/bean/DeviceInfoEvent.java

@@ -0,0 +1,48 @@
+package com.coffee.bus.listener.event.bean;
+
+import cn.hutool.extra.spring.SpringUtil;
+import com.alibaba.fastjson.JSONObject;
+import com.coffee.bus.listener.enums.ReportType;
+import org.springframework.context.ApplicationEvent;
+import java.time.Clock;
+
+/**
+ * @author lifang
+ * @version 1.0.0
+ * @ClassName DeviceInfoEvent.java
+ * @Description TODO
+ * @createTime 2022年03月21日 16:21:00
+ */
+public class DeviceInfoEvent extends ApplicationEvent {
+
+    private final ReportType type;
+
+    /**
+     * 设备属性值
+     */
+    private final JSONObject content;
+
+    /**
+     * 设备id,即泵设备号
+     */
+    private final String deviceId;
+
+    public DeviceInfoEvent(Object source,ReportType type,JSONObject content,String deviceId) {
+        super(source);
+        this.type=type;
+        this.content=content;
+        this.deviceId=deviceId;
+    }
+
+    public DeviceInfoEvent(Object source, Clock clock,ReportType type,JSONObject content,String deviceId) {
+        super(source, clock);
+        this.type=type;
+        this.content=content;
+        this.deviceId=deviceId;
+    }
+
+
+//    public static void main(String[] args) {
+//        SpringUtil.publishEvent(new DeviceInfoEvent(this,ReportType.LINE,new JSONObject(),"123556"));
+//    }
+}

+ 21 - 0
coffee-system/src/main/java/com/coffee/bus/listener/event/bean/HistoryInfoEvent.java

@@ -0,0 +1,21 @@
+package com.coffee.bus.listener.event.bean;
+
+import org.springframework.context.ApplicationEvent;
+import java.time.Clock;
+
+/**
+ * @author lifang
+ * @version 1.0.0
+ * @ClassName HistoryInfoEvent.java
+ * @Description TODO
+ * @createTime 2022年03月21日 16:30:00
+ */
+public class HistoryInfoEvent extends ApplicationEvent {
+    public HistoryInfoEvent(Object source) {
+        super(source);
+    }
+
+    public HistoryInfoEvent(Object source, Clock clock) {
+        super(source, clock);
+    }
+}