Przeglądaj źródła

新增部件类型等接口

Huangzf 1 rok temu
rodzic
commit
86a257787d

+ 18 - 0
expands-components/jetlinks-media/src/main/java/org/jetlinks/pro/media/XmlUtils.java

@@ -1,5 +1,10 @@
 package org.jetlinks.pro.media;
 
+import io.netty.buffer.ByteBuf;
+
+import static io.netty.buffer.ByteBufUtil.appendPrettyHexDump;
+import static io.netty.util.internal.StringUtil.NEWLINE;
+
 public class XmlUtils {
 
     public static String safeString(Object val) {
@@ -9,4 +14,17 @@ public class XmlUtils {
 
         return val.toString();
     }
+
+    public static Object showPayLoad(ByteBuf buffer) {
+        int length = buffer.readableBytes();
+        int rows = length / 16 + (length % 15 == 0 ? 0 : 1) + 4;
+        StringBuilder buf = new StringBuilder(rows * 80 * 2)
+            .append("read Index: ").append(buffer.readerIndex())
+            .append("write index: ").append(buffer.capacity())
+            .append("capacity: ").append(buffer.capacity())
+            .append(NEWLINE);
+
+        appendPrettyHexDump(buf, buffer);
+        return buf.toString();
+    }
 }

+ 4 - 0
expands-components/jetlinks-media/src/main/java/org/jetlinks/pro/media/gb28181/message/AlarmType.java

@@ -61,6 +61,10 @@ public enum AlarmType {
     density("9", "密度检测报警", AlarmMethod.videoAlarm),
     error("10", "视频异常检测报警", AlarmMethod.videoAlarm),
     fastMoving("11", "快速移动报警", AlarmMethod.videoAlarm),
+    departurePersonnel("1001", "人员离岗报警", AlarmMethod.videoAlarm),
+    abnormalPersonnelOnDuty("1002", "人员在岗异常报警", AlarmMethod.videoAlarm),
+    vehicleOccupyingPassage("2001", "消防通道车辆占用报警", AlarmMethod.videoAlarm),
+    itemOccupyingPassage("2002", "消防通道物品占用报警", AlarmMethod.videoAlarm),
 
     //存储设备
     storageDiskError("1", "存储设备磁盘故障报警", AlarmMethod.devErrorAlarm),

+ 5 - 0
jetlinks-manager/authentication-manager/src/main/java/org/jetlinks/pro/auth/captcha/CaptchaController.java

@@ -89,6 +89,11 @@ public class CaptchaController {
         if (!properties.isEnabled()) {
             return;
         }
+        //自定义参数,是否跳过验证码
+        String skip = event.getParameter("skip").map(String::valueOf).orElseThrow(() -> new ValidationException("缺少skip参数"));
+        if ("true".equals(skip)){
+            return;
+        }
         String key = event.getParameter("verifyKey").map(String::valueOf).orElseThrow(() -> new ValidationException("error.verification_code"));
         String code = event.getParameter("verifyCode").map(String::valueOf).orElseThrow(() -> new ValidationException("error.verification_code"));
         String redisKey = "captcha:" + key;

+ 135 - 0
jetlinks-manager/device-manager/src/main/java/org/jetlinks/pro/device/entity/DeviceAnalogQuantityTypeEntity.java

@@ -0,0 +1,135 @@
+package org.jetlinks.pro.device.entity;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Getter;
+import lombok.Setter;
+import org.hswebframework.ezorm.rdb.mapping.annotation.ColumnType;
+import org.hswebframework.ezorm.rdb.mapping.annotation.Comment;
+import org.hswebframework.ezorm.rdb.mapping.annotation.DefaultValue;
+import org.hswebframework.web.api.crud.entity.GenericEntity;
+import org.hswebframework.web.api.crud.entity.RecordCreationEntity;
+import org.hswebframework.web.api.crud.entity.RecordModifierEntity;
+import org.hswebframework.web.crud.annotation.EnableEntityEvent;
+import org.hswebframework.web.crud.generator.Generators;
+import org.hswebframework.web.validator.CreateGroup;
+
+import javax.persistence.Column;
+import javax.persistence.Table;
+import javax.validation.constraints.NotBlank;
+import java.sql.JDBCType;
+
+@Getter
+@Setter
+@Table(name = "dev_device_analog_quantity_type")
+@Comment("98号协议模拟量类型表")
+@EnableEntityEvent
+public class DeviceAnalogQuantityTypeEntity extends GenericEntity<String> implements
+    RecordCreationEntity, RecordModifierEntity {
+
+    @Column(length = 64,nullable = false)
+    @NotBlank(message = "模拟量类型值不能为空", groups = CreateGroup.class)
+    @Schema(description = "模拟量类型值")
+    private String value;
+
+    @Column(length = 64,nullable = false)
+    @NotBlank(message = "模拟量类型值说明不能为空", groups = CreateGroup.class)
+    @Schema(description = "模拟量类型值说明")
+    private String name;
+
+    @Column(length = 64)
+    @Schema(description = "单位")
+    @ColumnType(jdbcType = JDBCType.CLOB, javaType = String.class)
+    private String unit;
+
+    @Column(length = 64)
+    @Schema(description = "有效范围值")
+    private String validValue;
+
+    @Column(length = 64)
+    @Schema(description = "最小计量单元")
+    private String minMeteringUnit;
+
+    @Column(name = "creator_id", updatable = false)
+    @Schema(
+        description = "创建者ID(只读)"
+        , accessMode = Schema.AccessMode.READ_ONLY
+    )
+    private String creatorId;
+
+    @Column(name = "creator_name", updatable = false)
+    @Schema(
+        description = "创建者名称(只读)"
+        , accessMode = Schema.AccessMode.READ_ONLY
+    )
+    private String creatorName;
+
+    @Column(name = "create_time", updatable = false)
+    @DefaultValue(generator = Generators.CURRENT_TIME)
+    @Schema(
+        description = "创建时间(只读)"
+        , accessMode = Schema.AccessMode.READ_ONLY
+    )
+    private Long createTime;
+
+    @Column
+    @DefaultValue(generator = Generators.CURRENT_TIME)
+    @Schema(
+        description = "修改时间"
+        , accessMode = Schema.AccessMode.READ_ONLY
+    )
+    private Long modifyTime;
+
+    @Column(length = 64)
+    @Schema(
+        description = "修改人ID"
+        , accessMode = Schema.AccessMode.READ_ONLY
+    )
+    private String modifierId;
+
+    @Column(length = 64)
+    @Schema(
+        description = "修改人名称"
+        , accessMode = Schema.AccessMode.READ_ONLY
+    )
+    private String modifierName;
+
+    @Override
+    public String getCreatorId() {
+        return null;
+    }
+
+    @Override
+    public void setCreatorId(String s) {
+
+    }
+
+    @Override
+    public Long getCreateTime() {
+        return null;
+    }
+
+    @Override
+    public void setCreateTime(Long aLong) {
+
+    }
+
+    @Override
+    public String getModifierId() {
+        return null;
+    }
+
+    @Override
+    public void setModifierId(String s) {
+
+    }
+
+    @Override
+    public Long getModifyTime() {
+        return null;
+    }
+
+    @Override
+    public void setModifyTime(Long aLong) {
+
+    }
+}

+ 120 - 0
jetlinks-manager/device-manager/src/main/java/org/jetlinks/pro/device/entity/DeviceComponentTypeEntity.java

@@ -0,0 +1,120 @@
+package org.jetlinks.pro.device.entity;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Getter;
+import lombok.Setter;
+import org.hswebframework.ezorm.rdb.mapping.annotation.Comment;
+import org.hswebframework.ezorm.rdb.mapping.annotation.DefaultValue;
+import org.hswebframework.web.api.crud.entity.GenericEntity;
+import org.hswebframework.web.api.crud.entity.RecordCreationEntity;
+import org.hswebframework.web.api.crud.entity.RecordModifierEntity;
+import org.hswebframework.web.crud.annotation.EnableEntityEvent;
+import org.hswebframework.web.crud.generator.Generators;
+import org.hswebframework.web.validator.CreateGroup;
+
+import javax.persistence.Column;
+import javax.persistence.Table;
+import javax.validation.constraints.NotBlank;
+
+@Getter
+@Setter
+@Table(name = "dev_device_component_type")
+@Comment("98号协议设备部件类型表")
+@EnableEntityEvent
+public class DeviceComponentTypeEntity extends GenericEntity<String> implements
+    RecordCreationEntity, RecordModifierEntity {
+
+    @Column(length = 64, nullable = false, updatable = false)
+    @NotBlank(message = "部件状态值不能为空", groups = CreateGroup.class)
+    @Schema(description = "部件状态值")
+    private String componentStatusValue;
+
+    @Column(length = 64, nullable = false, updatable = false)
+    @NotBlank(message = "部件状态值名称不能为空", groups = CreateGroup.class)
+    @Schema(description = "部件状态值说明")
+    private String name;
+
+    @Column(name = "creator_id", updatable = false)
+    @Schema(
+        description = "创建者ID(只读)"
+        , accessMode = Schema.AccessMode.READ_ONLY
+    )
+    private String creatorId;
+
+    @Column(name = "creator_name", updatable = false)
+    @Schema(
+        description = "创建者名称(只读)"
+        , accessMode = Schema.AccessMode.READ_ONLY
+    )
+    private String creatorName;
+
+    @Column(name = "create_time", updatable = false)
+    @DefaultValue(generator = Generators.CURRENT_TIME)
+    @Schema(
+        description = "创建时间(只读)"
+        , accessMode = Schema.AccessMode.READ_ONLY
+    )
+    private Long createTime;
+
+    @Column
+    @DefaultValue(generator = Generators.CURRENT_TIME)
+    @Schema(
+        description = "修改时间"
+        , accessMode = Schema.AccessMode.READ_ONLY
+    )
+    private Long modifyTime;
+
+    @Column(length = 64)
+    @Schema(
+        description = "修改人ID"
+        , accessMode = Schema.AccessMode.READ_ONLY
+    )
+    private String modifierId;
+
+    @Column(length = 64)
+    @Schema(
+        description = "修改人名称"
+        , accessMode = Schema.AccessMode.READ_ONLY
+    )
+    private String modifierName;
+
+    @Override
+    public String getCreatorId() {
+        return null;
+    }
+
+    @Override
+    public void setCreatorId(String s) {
+
+    }
+
+    @Override
+    public Long getCreateTime() {
+        return null;
+    }
+
+    @Override
+    public void setCreateTime(Long aLong) {
+
+    }
+
+    @Override
+    public String getModifierId() {
+        return null;
+    }
+
+    @Override
+    public void setModifierId(String s) {
+
+    }
+
+    @Override
+    public Long getModifyTime() {
+        return null;
+    }
+
+    @Override
+    public void setModifyTime(Long aLong) {
+
+    }
+}

+ 120 - 0
jetlinks-manager/device-manager/src/main/java/org/jetlinks/pro/device/entity/DeviceSystemTypeEntity.java

@@ -0,0 +1,120 @@
+package org.jetlinks.pro.device.entity;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Getter;
+import lombok.Setter;
+import org.hswebframework.ezorm.rdb.mapping.annotation.Comment;
+import org.hswebframework.ezorm.rdb.mapping.annotation.DefaultValue;
+import org.hswebframework.web.api.crud.entity.GenericEntity;
+import org.hswebframework.web.api.crud.entity.RecordCreationEntity;
+import org.hswebframework.web.api.crud.entity.RecordModifierEntity;
+import org.hswebframework.web.crud.annotation.EnableEntityEvent;
+import org.hswebframework.web.crud.generator.Generators;
+import org.hswebframework.web.validator.CreateGroup;
+
+import javax.persistence.Column;
+import javax.persistence.Table;
+import javax.validation.constraints.NotBlank;
+
+@Getter
+@Setter
+@Table(name = "dev_device_system_type")
+@Comment("98号协议设备系统状态类型表")
+@EnableEntityEvent
+public class DeviceSystemTypeEntity extends GenericEntity<String> implements
+    RecordCreationEntity, RecordModifierEntity {
+
+    @Column(length = 64, nullable = false, updatable = false)
+    @NotBlank(message = "系统状态值不能为空", groups = CreateGroup.class)
+    @Schema(description = "系统状态类型值")
+    private String systemStatusValue;
+
+    @Column(length = 64, nullable = false, updatable = false)
+    @NotBlank(message = "系统状态值名称不能为空", groups = CreateGroup.class)
+    @Schema(description = "系统状态值说明")
+    private String name;
+
+    @Column(name = "creator_id", updatable = false)
+    @Schema(
+        description = "创建者ID(只读)"
+        , accessMode = Schema.AccessMode.READ_ONLY
+    )
+    private String creatorId;
+
+    @Column(name = "creator_name", updatable = false)
+    @Schema(
+        description = "创建者名称(只读)"
+        , accessMode = Schema.AccessMode.READ_ONLY
+    )
+    private String creatorName;
+
+    @Column(name = "create_time", updatable = false)
+    @DefaultValue(generator = Generators.CURRENT_TIME)
+    @Schema(
+        description = "创建时间(只读)"
+        , accessMode = Schema.AccessMode.READ_ONLY
+    )
+    private Long createTime;
+
+    @Column
+    @DefaultValue(generator = Generators.CURRENT_TIME)
+    @Schema(
+        description = "修改时间"
+        , accessMode = Schema.AccessMode.READ_ONLY
+    )
+    private Long modifyTime;
+
+    @Column(length = 64)
+    @Schema(
+        description = "修改人ID"
+        , accessMode = Schema.AccessMode.READ_ONLY
+    )
+    private String modifierId;
+
+    @Column(length = 64)
+    @Schema(
+        description = "修改人名称"
+        , accessMode = Schema.AccessMode.READ_ONLY
+    )
+    private String modifierName;
+
+    @Override
+    public String getCreatorId() {
+        return null;
+    }
+
+    @Override
+    public void setCreatorId(String s) {
+
+    }
+
+    @Override
+    public Long getCreateTime() {
+        return null;
+    }
+
+    @Override
+    public void setCreateTime(Long aLong) {
+
+    }
+
+    @Override
+    public String getModifierId() {
+        return null;
+    }
+
+    @Override
+    public void setModifierId(String s) {
+
+    }
+
+    @Override
+    public Long getModifyTime() {
+        return null;
+    }
+
+    @Override
+    public void setModifyTime(Long aLong) {
+
+    }
+}

+ 9 - 0
jetlinks-manager/device-manager/src/main/java/org/jetlinks/pro/device/service/DeviceAnalogQuantityTypeService.java

@@ -0,0 +1,9 @@
+package org.jetlinks.pro.device.service;
+
+import org.hswebframework.web.crud.service.GenericReactiveCacheSupportCrudService;
+import org.jetlinks.pro.device.entity.DeviceAnalogQuantityTypeEntity;
+import org.springframework.stereotype.Service;
+
+@Service
+public class DeviceAnalogQuantityTypeService extends GenericReactiveCacheSupportCrudService<DeviceAnalogQuantityTypeEntity,String> {
+}

+ 11 - 0
jetlinks-manager/device-manager/src/main/java/org/jetlinks/pro/device/service/DeviceComponentTypeService.java

@@ -0,0 +1,11 @@
+package org.jetlinks.pro.device.service;
+
+import org.hswebframework.web.crud.service.GenericReactiveCacheSupportCrudService;
+import org.jetlinks.pro.device.entity.DeviceComponentTypeEntity;
+import org.springframework.stereotype.Service;
+
+@Service
+public class DeviceComponentTypeService extends GenericReactiveCacheSupportCrudService<DeviceComponentTypeEntity,String> {
+
+
+}

+ 11 - 0
jetlinks-manager/device-manager/src/main/java/org/jetlinks/pro/device/service/DeviceSystemTypeService.java

@@ -0,0 +1,11 @@
+package org.jetlinks.pro.device.service;
+
+import org.hswebframework.web.crud.service.GenericReactiveCacheSupportCrudService;
+import org.jetlinks.pro.device.entity.DeviceSystemTypeEntity;
+import org.springframework.stereotype.Service;
+
+@Service
+public class DeviceSystemTypeService extends GenericReactiveCacheSupportCrudService<DeviceSystemTypeEntity,String> {
+
+
+}

+ 38 - 0
jetlinks-manager/device-manager/src/main/java/org/jetlinks/pro/device/web/DeviceAnalogQuantityTypeController.java

@@ -0,0 +1,38 @@
+package org.jetlinks.pro.device.web;
+
+import io.swagger.v3.oas.annotations.tags.Tag;
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+import lombok.Setter;
+import lombok.extern.slf4j.Slf4j;
+import org.hswebframework.web.authorization.annotation.Authorize;
+import org.hswebframework.web.authorization.annotation.Resource;
+import org.hswebframework.web.crud.service.ReactiveCrudService;
+import org.hswebframework.web.crud.web.reactive.ReactiveServiceCrudController;
+import org.jetlinks.pro.device.entity.DeviceAnalogQuantityTypeEntity;
+import org.jetlinks.pro.device.entity.DeviceComponentTypeEntity;
+import org.jetlinks.pro.device.service.DeviceAnalogQuantityTypeService;
+import org.jetlinks.pro.device.service.DeviceComponentTypeService;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+@Getter
+@Setter
+@Slf4j
+@RestController
+@AllArgsConstructor
+//加上不用验证权限
+@Authorize(ignore = true)
+@Tag(name = "98号协议设备模拟量接口")
+@RequestMapping("/device/analog/quantity/type")
+@Resource(id = "device-analog-quantity-type", name = "98号协议设备模拟量接口")
+public class DeviceAnalogQuantityTypeController implements ReactiveServiceCrudController<DeviceAnalogQuantityTypeEntity,String> {
+    private DeviceAnalogQuantityTypeService deviceSystemStatusService;
+
+    @Override
+    public ReactiveCrudService<DeviceAnalogQuantityTypeEntity, String> getService() {
+        return deviceSystemStatusService;
+    }
+
+
+}

+ 35 - 0
jetlinks-manager/device-manager/src/main/java/org/jetlinks/pro/device/web/DeviceComponentTypeController.java

@@ -0,0 +1,35 @@
+package org.jetlinks.pro.device.web;
+
+import io.swagger.v3.oas.annotations.tags.Tag;
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+import lombok.Setter;
+import lombok.extern.slf4j.Slf4j;
+import org.hswebframework.web.authorization.annotation.Authorize;
+import org.hswebframework.web.authorization.annotation.Resource;
+import org.hswebframework.web.crud.service.ReactiveCrudService;
+import org.hswebframework.web.crud.web.reactive.ReactiveServiceCrudController;
+import org.jetlinks.pro.device.entity.DeviceComponentTypeEntity;
+import org.jetlinks.pro.device.service.DeviceComponentTypeService;
+import org.springframework.web.bind.annotation.*;
+
+@Getter
+@Setter
+@Slf4j
+@RestController
+@AllArgsConstructor
+//加上不用验证权限
+@Authorize(ignore = true)
+@Tag(name = "98号协议设备部件类型接口")
+@RequestMapping("/device/component/type")
+@Resource(id = "device-component-type", name = "98号协议设备部件类型接口")
+public class DeviceComponentTypeController implements ReactiveServiceCrudController<DeviceComponentTypeEntity,String> {
+    private DeviceComponentTypeService deviceSystemStatusService;
+
+    @Override
+    public ReactiveCrudService<DeviceComponentTypeEntity, String> getService() {
+        return deviceSystemStatusService;
+    }
+
+
+}

+ 34 - 0
jetlinks-manager/device-manager/src/main/java/org/jetlinks/pro/device/web/DeviceSystemTypeController.java

@@ -0,0 +1,34 @@
+package org.jetlinks.pro.device.web;
+
+import io.swagger.v3.oas.annotations.tags.Tag;
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+import lombok.Setter;
+import lombok.extern.slf4j.Slf4j;
+import org.hswebframework.web.authorization.annotation.Authorize;
+import org.hswebframework.web.authorization.annotation.Resource;
+import org.hswebframework.web.crud.service.ReactiveCrudService;
+import org.hswebframework.web.crud.web.reactive.ReactiveServiceCrudController;
+import org.jetlinks.pro.device.entity.DeviceSystemTypeEntity;
+import org.jetlinks.pro.device.service.DeviceSystemTypeService;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+@Getter
+@Setter
+@Slf4j
+@RestController
+@AllArgsConstructor
+@Authorize(ignore = true)
+@Tag(name = "98号协议设备系统状态接口")
+@RequestMapping("/device/system/type")
+@Resource(id = "device-system-type", name = "98号协议设备系统状态接口")
+public class DeviceSystemTypeController implements ReactiveServiceCrudController<DeviceSystemTypeEntity,String> {
+    private DeviceSystemTypeService deviceSystemStatusService;
+
+    @Override
+    public ReactiveCrudService<DeviceSystemTypeEntity, String> getService() {
+        return deviceSystemStatusService;
+    }
+
+}