代码提交
This commit is contained in:
@@ -0,0 +1,58 @@
|
||||
package com.njcn.access.enums;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 类的介绍:
|
||||
*
|
||||
* @author xuyang
|
||||
* @version 1.0.0
|
||||
* @createTime 2023/4/18 9:35
|
||||
*/
|
||||
@Getter
|
||||
public enum AccessEnum {
|
||||
|
||||
/**
|
||||
* 装置出厂状态
|
||||
* 0:删除 1:未注册(默认状态) 2:注册 3:接入
|
||||
*/
|
||||
DELETE(0, "删除"),
|
||||
UNREGISTERED(1, "未注册"),
|
||||
REGISTERED(2, "注册"),
|
||||
ACCESS(3, "接入"),
|
||||
|
||||
/**
|
||||
* 报文处理优先级
|
||||
*/
|
||||
FIRST_CHANNEL(1,"I类紧急请求/响应"),
|
||||
SECOND_CHANNEL(2,"Ⅱ类紧急请求/响应"),
|
||||
THIRD_CHANNEL(3,"普通请求/响应"),
|
||||
FOURTH_CHANNEL(4,"广播报文"),
|
||||
|
||||
/**
|
||||
* 应答code
|
||||
*/
|
||||
SUCCESS(200,"请求成功 "),
|
||||
START_CHANNEL(201,"请求被接受,开始处理"),
|
||||
WAIT_CHANNEL(202,"请求被接受,但是未处理完"),
|
||||
FAIL(400,"请求失败"),
|
||||
ERROR(401,"请求未认证/认证错误(不支持的请求)"),
|
||||
REFUSE_WAIT(402,"请求被拒绝,在处理同类命令。(待处理完可响应)"),
|
||||
REFUSE_UNKNOWN(403,"请求被拒绝(未知原因)"),
|
||||
NOT_FIND(404,"请求的资源不存在 "),
|
||||
BUSY(405,"当前忙,无法响应。(等一段时间可尝试重新下发)"),
|
||||
TIME_OUT(406,"请求超出了等待时间"),
|
||||
OTHER_ERROR(500,"其他错误"),
|
||||
|
||||
;
|
||||
|
||||
private final int code;
|
||||
|
||||
private final String message;
|
||||
|
||||
AccessEnum(int code, String message) {
|
||||
this.code=code;
|
||||
this.message=message;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -14,10 +14,18 @@ public enum AccessResponseEnum {
|
||||
* A0301 ~ A0399 用于用户模块的枚举
|
||||
* <p>
|
||||
*/
|
||||
DEV_NO_FIND("A0301", "通过nDid未找到相关装置信息!"),
|
||||
DEV_NO_FIND("A0301", "nDid未匹配!"),
|
||||
|
||||
MODEL_REPEAT("A0302", "模板重复,请勿重复录入!"),
|
||||
MODEL_NO_FIND("A0302", "模板不存在,请先录入模板数据!"),
|
||||
|
||||
MESSAGE_TYPE_ERROR("A0303","报文消息类型Type错误!"),
|
||||
|
||||
RESPONSE_ERROR("A0304","装置请求响应错误!"),
|
||||
|
||||
DEV_TYPE_NOT_FIND("A0305","装置类型未找到,需要录入!"),
|
||||
|
||||
|
||||
;
|
||||
|
||||
private final String code;
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
package com.njcn.access.enums;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 类的介绍:
|
||||
*
|
||||
* @author xuyang
|
||||
* @version 1.0.0
|
||||
* @createTime 2023/4/18 9:35
|
||||
*/
|
||||
@Getter
|
||||
public enum AccessStatusEnum {
|
||||
|
||||
/**
|
||||
* 装置出厂状态
|
||||
* 0:删除 1:未注册(默认状态) 2:注册 3:接入
|
||||
*/
|
||||
DELETE(0, "删除"),
|
||||
UNREGISTERED(1, "未注册"),
|
||||
REGISTERED(2, "注册"),
|
||||
ACCESS(3, "接入"),
|
||||
;
|
||||
|
||||
private final int code;
|
||||
|
||||
private final String message;
|
||||
|
||||
AccessStatusEnum(int code, String message) {
|
||||
this.code=code;
|
||||
this.message=message;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
package com.njcn.access.enums;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 类的介绍:
|
||||
*
|
||||
* @author xuyang
|
||||
* @version 1.0.0
|
||||
* @createTime 2023/5/12 14:07
|
||||
*/
|
||||
@Getter
|
||||
public enum TypeEnum {
|
||||
/**
|
||||
* 报文消息类型
|
||||
*/
|
||||
TYPE_1("0x2101","平台询问装置支持主题"),
|
||||
TYPE_2("0x2102","平台向装置发送设备注册请求"),
|
||||
TYPE_3("0x2103","平台询问设备模板信息"),
|
||||
TYPE_4("0x2104","设备配置信息下发"),
|
||||
TYPE_5("0x2105","设备接入命令"),
|
||||
TYPE_6("0x2106","平台向设备发送数据命令"),
|
||||
TYPE_7("0x2107","平台向设备发送控制命令"),
|
||||
TYPE_8("0x2131","设备文件/目录信息询问"),
|
||||
TYPE_9("0x2132","设备文件下载"),
|
||||
TYPE_10("0x2133","设备文件上传"),
|
||||
TYPE_11("0x2134","设备文件删除"),
|
||||
TYPE_12("0x2135","设备目录创建"),
|
||||
TYPE_13("0x2136","设备根目录查询"),
|
||||
TYPE_14("0x2201","设备心跳应答 "),
|
||||
TYPE_15("0x2401","设备数据主动上送应答"),
|
||||
TYPE_16("0x1201","设备支持主题应答"),
|
||||
TYPE_17("0x1202","联网装置应答注册请求"),
|
||||
TYPE_18("0x1203","设备模板信息应答 "),
|
||||
TYPE_19("0x1204","下发设备配置信息应答 "),
|
||||
TYPE_20("0x1205","设备接入平台应答"),
|
||||
TYPE_21("0x1206","平台向设备发送数据命令"),
|
||||
TYPE_22("0x1207","设备控制命令应答"),
|
||||
TYPE_23("0x1231","设备文件信息应答 "),
|
||||
TYPE_24("0x1232","设备文件下载应答 "),
|
||||
TYPE_25("0x1233","设备文件上传"),
|
||||
TYPE_26("0x1234","设备文件删除"),
|
||||
TYPE_27("0x1235","设备文件删除"),
|
||||
TYPE_28("0x1236","设备根目录查询应答"),
|
||||
TYPE_29("0x1101","设备心跳请求"),
|
||||
TYPE_30("0x1301","设备数据主动上送"),
|
||||
|
||||
/**
|
||||
* 数据类型
|
||||
*/
|
||||
DATA_1("0x01","软件信息SoftInfo"),
|
||||
DATA_2("0x02","设备信息LdevInfo"),
|
||||
DATA_3("0x03","电能数据Epd"),
|
||||
DATA_4("0x04","电能质量数据Pqd"),
|
||||
DATA_5("0x05","基础测量数据Bmd"),
|
||||
DATA_6("0x06","事件Evt"),
|
||||
DATA_7("0x07","告警Alm"),
|
||||
DATA_8("0x08","状态Sts"),
|
||||
DATA_9("0x08","开入Di"),
|
||||
DATA_10("0x0A","开出Do"),
|
||||
DATA_11("0x0B","参数Param"),
|
||||
DATA_12("0x0C","定值Set"),
|
||||
DATA_13("0x0D","内部定值InSet"),
|
||||
DATA_14("0x0E","控制Ctrl"),
|
||||
|
||||
;
|
||||
|
||||
private final String code;
|
||||
|
||||
private final String message;
|
||||
|
||||
TypeEnum(String code, String message) {
|
||||
this.code=code;
|
||||
this.message=message;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.njcn.access.pojo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 类的介绍:
|
||||
*
|
||||
* @author xuyang
|
||||
* @version 1.0.0
|
||||
* @createTime 2023/4/18 13:57
|
||||
*/
|
||||
@Data
|
||||
public class MessageParam {
|
||||
|
||||
String topic;
|
||||
|
||||
String message;
|
||||
|
||||
}
|
||||
@@ -15,9 +15,9 @@ import java.io.Serializable;
|
||||
@Data
|
||||
public class AccessDto implements Serializable {
|
||||
|
||||
@ParamName("NDID")
|
||||
@ParamName("Ndid")
|
||||
private String nDid;
|
||||
|
||||
@ParamName("dev_type")
|
||||
@ParamName("DevType")
|
||||
private String devType;
|
||||
}
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
package com.njcn.access.pojo.dto;
|
||||
|
||||
import com.alibaba.nacos.shaded.com.google.gson.annotations.SerializedName;
|
||||
import com.njcn.access.param.ParamName;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
@@ -15,10 +18,24 @@ import java.io.Serializable;
|
||||
@Data
|
||||
public class DevCfgDto implements Serializable {
|
||||
|
||||
@SerializedName("DID")
|
||||
@SerializedName("Did")
|
||||
@ParamName("Did")
|
||||
@NotNull(message = "设备Id,不为空")
|
||||
private String did;
|
||||
|
||||
@SerializedName("DevName")
|
||||
@ParamName("DevName")
|
||||
@NotNull(message = "设备名称,不为空")
|
||||
private String devName;
|
||||
|
||||
@SerializedName("DevType")
|
||||
@ParamName("DevType")
|
||||
@NotNull(message = "设备型号,不为空")
|
||||
private String devType;
|
||||
|
||||
@SerializedName("DevCategory")
|
||||
@ParamName("DevCategory")
|
||||
@NotNull(message = "设备类别,不为空")
|
||||
private String devCategory;
|
||||
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.njcn.access.pojo.dto;
|
||||
import com.alibaba.nacos.shaded.com.google.gson.annotations.SerializedName;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
@@ -13,18 +14,22 @@ import java.io.Serializable;
|
||||
* @createTime 2023/4/10 10:14
|
||||
*/
|
||||
@Data
|
||||
public class DevModelDto implements Serializable {
|
||||
public class DevModInfoDto implements Serializable {
|
||||
|
||||
@SerializedName("DevType")
|
||||
@NotNull(message = "设备型号,不为空")
|
||||
private String devType;
|
||||
|
||||
@SerializedName("Version")
|
||||
@NotNull(message = "数据模板版本号,不为空")
|
||||
private String versionNo;
|
||||
|
||||
@SerializedName("Time")
|
||||
@NotNull(message = "创建或最后修改时间,不为空")
|
||||
private String versionDate;
|
||||
|
||||
@SerializedName("Crc")
|
||||
@NotNull(message = "模板CRC校验码,不为空")
|
||||
private String crc;
|
||||
|
||||
}
|
||||
@@ -3,6 +3,7 @@ package com.njcn.access.pojo.dto;
|
||||
import com.alibaba.nacos.shaded.com.google.gson.annotations.SerializedName;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@@ -17,8 +18,10 @@ import java.util.List;
|
||||
public class ModelDto implements Serializable {
|
||||
|
||||
@SerializedName("DevCfg")
|
||||
@NotNull(message = "设备配置序列,不为空")
|
||||
private List<DevCfgDto> devCfg;
|
||||
|
||||
@SerializedName("DevMod")
|
||||
private List<DevModelDto> devMod;
|
||||
@SerializedName("DevModInfo")
|
||||
@NotNull(message = "设备模板信息序列,不为空")
|
||||
private List<DevModInfoDto> devMod;
|
||||
}
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
package com.njcn.access.pojo.dto;
|
||||
|
||||
import com.njcn.access.param.ParamName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 类的介绍:
|
||||
*
|
||||
* @author xuyang
|
||||
* @version 1.0.0
|
||||
* @createTime 2023/3/31 14:04
|
||||
*/
|
||||
@Data
|
||||
public class PublicDto implements Serializable {
|
||||
|
||||
private String mid;
|
||||
|
||||
@ParamName("NDID")
|
||||
private String nDid;
|
||||
|
||||
private Long timestamp;
|
||||
|
||||
private String type;
|
||||
|
||||
private AccessDto param;
|
||||
}
|
||||
@@ -1,44 +0,0 @@
|
||||
package com.njcn.access.pojo.dto;
|
||||
|
||||
import com.alibaba.nacos.shaded.com.google.gson.annotations.SerializedName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
;
|
||||
|
||||
/**
|
||||
* 类的介绍:
|
||||
*
|
||||
* @author xuyang
|
||||
* @version 1.0.0
|
||||
* @createTime 2022/3/12 19:18
|
||||
*/
|
||||
@Data
|
||||
public class PublicParamDTO implements Serializable {
|
||||
|
||||
/**
|
||||
* 在请求报文中该值为请求 ID,在设备主动上报数据的报文中该字段可不填写
|
||||
*/
|
||||
@SerializedName("mid")
|
||||
private Integer mid;
|
||||
|
||||
@SerializedName("userId")
|
||||
private String userId;
|
||||
|
||||
@SerializedName("deviceId")
|
||||
private String deviceId;
|
||||
|
||||
@SerializedName("timestamp")
|
||||
private String timestamp;
|
||||
|
||||
/**
|
||||
* 报文处理的优先级
|
||||
*/
|
||||
@SerializedName("level")
|
||||
private Integer level;
|
||||
|
||||
@SerializedName("type")
|
||||
private String type;
|
||||
|
||||
}
|
||||
@@ -1,53 +0,0 @@
|
||||
package com.njcn.access.pojo.dto;
|
||||
|
||||
import com.alibaba.nacos.shaded.com.google.gson.annotations.SerializedName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
;
|
||||
|
||||
/**
|
||||
* 类的介绍:
|
||||
*
|
||||
* @author xuyang
|
||||
* @version 1.0.0
|
||||
* @createTime 2022/3/11 14:36
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class RegisterDTO extends PublicParamDTO implements Serializable {
|
||||
|
||||
/**
|
||||
* 请求参数
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public static class RegisterRequest extends RegisterDTO implements Serializable{
|
||||
|
||||
@SerializedName("expire")
|
||||
private Integer expire;
|
||||
|
||||
@SerializedName("param")
|
||||
private RegisterParamDTO.RegisterParamRequest param;
|
||||
}
|
||||
|
||||
/**
|
||||
* 应答参数
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public static class RegisterResponse extends RegisterDTO implements Serializable{
|
||||
|
||||
@SerializedName("code")
|
||||
private Integer code;
|
||||
|
||||
@SerializedName("msg")
|
||||
private String msg;
|
||||
|
||||
@SerializedName("param")
|
||||
private RegisterParamDTO.RegisterParamResponse param;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,57 +0,0 @@
|
||||
package com.njcn.access.pojo.dto;
|
||||
|
||||
|
||||
import com.alibaba.nacos.shaded.com.google.gson.annotations.SerializedName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 类的介绍:
|
||||
*
|
||||
* @author xuyang
|
||||
* @version 1.0.0
|
||||
* @createTime 2022/3/11 14:58
|
||||
*/
|
||||
@Data
|
||||
public class RegisterParamDTO implements Serializable {
|
||||
|
||||
@SerializedName("NDID")
|
||||
private String nDid;
|
||||
|
||||
@SerializedName("DID")
|
||||
private List<String> did;
|
||||
|
||||
/**
|
||||
* 请求参数
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public static class RegisterParamRequest extends RegisterParamDTO implements Serializable{
|
||||
@SerializedName("type")
|
||||
private Integer type;
|
||||
}
|
||||
|
||||
/**
|
||||
* 应答参数
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public static class RegisterParamResponse extends RegisterParamDTO implements Serializable{
|
||||
@SerializedName("res")
|
||||
private Integer res;
|
||||
|
||||
@SerializedName("type")
|
||||
private Integer resType;
|
||||
|
||||
@SerializedName("NDID")
|
||||
private String nDid;
|
||||
|
||||
@SerializedName("DEV_TYPE")
|
||||
private String dev_type;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.njcn.access.pojo.dto;
|
||||
|
||||
import com.alibaba.nacos.shaded.com.google.gson.annotations.SerializedName;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 类的介绍:
|
||||
*
|
||||
* @author xuyang
|
||||
* @version 1.0.0
|
||||
* @createTime 2023/5/12 14:35
|
||||
*/
|
||||
@Data
|
||||
public class TopicDto implements Serializable {
|
||||
|
||||
@SerializedName("Topic")
|
||||
@NotNull(message = "设备支持主题及版本,不为空")
|
||||
private List<String> topicList;
|
||||
|
||||
}
|
||||
@@ -3,6 +3,7 @@ package com.njcn.access.pojo.dto.data;
|
||||
import com.alibaba.nacos.shaded.com.google.gson.annotations.SerializedName;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
@@ -15,14 +16,20 @@ import java.io.Serializable;
|
||||
@Data
|
||||
public class AlmDto implements Serializable {
|
||||
|
||||
@SerializedName("OpAttr")
|
||||
@NotNull(message = "读写操作属性,不为空")
|
||||
private String opAttr;
|
||||
|
||||
@SerializedName("Name")
|
||||
@NotNull(message = "告警事件名称,不为空")
|
||||
private String name;
|
||||
|
||||
@SerializedName("IDX")
|
||||
@SerializedName("Idx")
|
||||
@NotNull(message = "告警事件编号,不为空")
|
||||
private Integer idx;
|
||||
|
||||
@SerializedName("Type")
|
||||
@NotNull(message = "告警事件类别,不为空")
|
||||
private String type;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
package com.njcn.access.pojo.dto.data;
|
||||
|
||||
import com.alibaba.nacos.shaded.com.google.gson.annotations.SerializedName;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 类的介绍:
|
||||
*
|
||||
* @author xuyang
|
||||
* @version 1.0.0
|
||||
* @createTime 2023/5/4 10:43
|
||||
*/
|
||||
@Data
|
||||
public class BmdDto implements Serializable {
|
||||
|
||||
@SerializedName("OpAttr")
|
||||
@NotNull(message = "读写操作属性,不为空")
|
||||
private String opAttr;
|
||||
|
||||
@SerializedName("Name")
|
||||
@NotNull(message = "数据名称,不为空")
|
||||
private String name;
|
||||
|
||||
@SerializedName("Idx")
|
||||
@NotNull(message = "数据编号,不为空")
|
||||
private Integer idx;
|
||||
|
||||
@SerializedName("Type")
|
||||
@NotNull(message = "数据类型,不为空")
|
||||
private String type;
|
||||
|
||||
@SerializedName("Unit")
|
||||
@ApiModelProperty("单位")
|
||||
private String unit;
|
||||
|
||||
@SerializedName("StatMethod")
|
||||
@ApiModelProperty("数据统计方法(max,min,avg,cp95)")
|
||||
private List<String> statMethod;
|
||||
|
||||
@SerializedName("TranRule")
|
||||
@NotNull(message = "上送规则,不为空")
|
||||
@ApiModelProperty("变化:change 周期:period 周期读取变位上送:perchg")
|
||||
private String tranRule;
|
||||
|
||||
}
|
||||
@@ -1,8 +1,10 @@
|
||||
package com.njcn.access.pojo.dto.data;
|
||||
|
||||
import com.alibaba.nacos.shaded.com.google.gson.annotations.SerializedName;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@@ -16,33 +18,47 @@ import java.util.List;
|
||||
@Data
|
||||
public class CtrlDto implements Serializable {
|
||||
|
||||
@SerializedName("OpAttr")
|
||||
@NotNull(message = "读写操作属性,不为空")
|
||||
private String opAttr;
|
||||
|
||||
@SerializedName("Name")
|
||||
@NotNull(message = "控制名称,不为空")
|
||||
private String name;
|
||||
|
||||
@SerializedName("IDX")
|
||||
@SerializedName("Idx")
|
||||
@NotNull(message = "控制编号,不为空")
|
||||
private Integer idx;
|
||||
|
||||
@SerializedName("Type")
|
||||
@NotNull(message = "下发数据类型,不为空")
|
||||
private String type;
|
||||
|
||||
@SerializedName("Check")
|
||||
private Integer remoteCheck;
|
||||
@NotNull(message = "是否需遥控校验,不为空")
|
||||
private Integer check;
|
||||
|
||||
@SerializedName("Auto")
|
||||
@SerializedName("auto")
|
||||
@NotNull(message = "是否支持自动控制,不为空")
|
||||
private Integer auto;
|
||||
|
||||
@SerializedName("MaxNum")
|
||||
@ApiModelProperty("设置最大值")
|
||||
private Integer maxNum;
|
||||
|
||||
@SerializedName("MinNum")
|
||||
@ApiModelProperty("设置最小值")
|
||||
private Integer minNum;
|
||||
|
||||
@SerializedName("Ctlvalue")
|
||||
private List<String> ctlValue;
|
||||
@ApiModelProperty("参数为enum时可设置的所有值序列")
|
||||
private Integer ctlValue;
|
||||
|
||||
@SerializedName("Strlen")
|
||||
@ApiModelProperty("参数string可设置字符串的长度上限")
|
||||
private Integer strLen;
|
||||
|
||||
@SerializedName("Encode")
|
||||
@NotNull(message = "是否加密,不为空")
|
||||
private Integer encode;
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.alibaba.nacos.shaded.com.google.gson.annotations.SerializedName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
@@ -18,6 +19,7 @@ import java.io.Serializable;
|
||||
public class DiDto extends StsDto implements Serializable {
|
||||
|
||||
@SerializedName("TranFlag")
|
||||
@NotNull(message = "数据是否上送,不为空")
|
||||
private Integer tranFlag;
|
||||
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.njcn.access.pojo.dto.data;
|
||||
import com.alibaba.nacos.shaded.com.google.gson.annotations.SerializedName;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
@@ -15,15 +16,23 @@ import java.io.Serializable;
|
||||
@Data
|
||||
public class DoDto implements Serializable {
|
||||
|
||||
@SerializedName("OpAttr")
|
||||
@NotNull(message = "读写操作属性,不为空")
|
||||
private String opAttr;
|
||||
|
||||
@SerializedName("Name")
|
||||
@NotNull(message = "开出信号名称,不为空")
|
||||
private String name;
|
||||
|
||||
@SerializedName("IDX")
|
||||
@SerializedName("Idx")
|
||||
@NotNull(message = "DO编号,不为空")
|
||||
private Integer idx;
|
||||
|
||||
@SerializedName("CurSts")
|
||||
@NotNull(message = "当前值/设定值,不为空")
|
||||
private Integer curSts;
|
||||
|
||||
@SerializedName("CtlSts")
|
||||
@NotNull(message = "是否可远程控制,不为空")
|
||||
private Integer ctlSts;
|
||||
}
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
package com.njcn.access.pojo.dto.data;
|
||||
|
||||
import com.alibaba.nacos.shaded.com.google.gson.annotations.SerializedName;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@@ -16,31 +18,40 @@ import java.util.List;
|
||||
@Data
|
||||
public class EpdPqdDto implements Serializable {
|
||||
|
||||
@SerializedName("OpAttr")
|
||||
@NotNull(message = "读写操作属性,不为空")
|
||||
private String opAttr;
|
||||
|
||||
@SerializedName("Name")
|
||||
@NotNull(message = "数据名称,不为空")
|
||||
private String name;
|
||||
|
||||
@SerializedName("IDX")
|
||||
@SerializedName("Idx")
|
||||
@NotNull(message = "数据编号,不为空")
|
||||
private Integer idx;
|
||||
|
||||
@SerializedName("Type")
|
||||
@NotNull(message = "数据类型,不为空")
|
||||
private String type;
|
||||
|
||||
@SerializedName("Phase")
|
||||
@ApiModelProperty("相别")
|
||||
private String phase;
|
||||
|
||||
@SerializedName("Unit")
|
||||
@ApiModelProperty("单位")
|
||||
private String unit;
|
||||
|
||||
@SerializedName("HarmStart")
|
||||
private String harmStart;
|
||||
@ApiModelProperty("数据开始谐波次数")
|
||||
private Integer harmStart;
|
||||
|
||||
@SerializedName("HarmEnd")
|
||||
private String harmEnd;
|
||||
|
||||
@SerializedName("ClassID")
|
||||
private String classId;
|
||||
@ApiModelProperty("数据结束谐波次数")
|
||||
private Integer harmEnd;
|
||||
|
||||
@SerializedName("StatMethod")
|
||||
@ApiModelProperty("数据统计方法(max,min,avg,cp95)")
|
||||
private List<String> statMethod;
|
||||
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.njcn.access.pojo.dto.data;
|
||||
import com.alibaba.nacos.shaded.com.google.gson.annotations.SerializedName;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@@ -16,13 +17,20 @@ import java.util.List;
|
||||
@Data
|
||||
public class EvtDto implements Serializable {
|
||||
|
||||
@SerializedName("OpAttr")
|
||||
@NotNull(message = "读写操作属性,不为空")
|
||||
private String opAttr;
|
||||
|
||||
@SerializedName("Name")
|
||||
@NotNull(message = "事件信息名称,不为空")
|
||||
private String name;
|
||||
|
||||
@SerializedName("IDX")
|
||||
@SerializedName("Idx")
|
||||
@NotNull(message = "事件编号,不为空")
|
||||
private Integer idx;
|
||||
|
||||
@SerializedName("Type")
|
||||
@NotNull(message = "事件类别,不为空")
|
||||
private String type;
|
||||
|
||||
@SerializedName("Parm")
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
package com.njcn.access.pojo.dto.data;
|
||||
|
||||
import com.alibaba.nacos.shaded.com.google.gson.annotations.SerializedName;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
@@ -16,15 +18,19 @@ import java.io.Serializable;
|
||||
public class EvtParamDto implements Serializable {
|
||||
|
||||
@SerializedName("Name")
|
||||
@NotNull(message = "参数名称,不为空")
|
||||
private String name;
|
||||
|
||||
@SerializedName("Type")
|
||||
@NotNull(message = "参数类型,不为空")
|
||||
private String type;
|
||||
|
||||
@SerializedName("Unit")
|
||||
@ApiModelProperty("参数单位")
|
||||
private String unit;
|
||||
|
||||
@SerializedName("Data")
|
||||
@NotNull(message = "参数值,不为空")
|
||||
private String data;
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.njcn.access.pojo.dto.data;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 类的介绍:
|
||||
*
|
||||
* @author xuyang
|
||||
* @version 1.0.0
|
||||
* @createTime 2023/5/4 11:41
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
public class InSetDto extends SetDto implements Serializable{
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
package com.njcn.access.pojo.dto.data;
|
||||
|
||||
import com.alibaba.nacos.shaded.com.google.gson.annotations.SerializedName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 类的介绍:
|
||||
*
|
||||
* @author xuyang
|
||||
* @version 1.0.0
|
||||
* @createTime 2022/3/13 14:48
|
||||
*/
|
||||
@Data
|
||||
public class MdDto implements Serializable {
|
||||
|
||||
@SerializedName("Name")
|
||||
private String name;
|
||||
|
||||
@SerializedName("IDX")
|
||||
private Integer idx;
|
||||
|
||||
@SerializedName("Type")
|
||||
private String type;
|
||||
|
||||
@SerializedName("Unit")
|
||||
private String unit;
|
||||
|
||||
@SerializedName("Phase")
|
||||
private String phase;
|
||||
|
||||
@SerializedName("ClassID")
|
||||
private String classId;
|
||||
|
||||
@SerializedName("StatMethod")
|
||||
private List<String> statMethod;
|
||||
|
||||
@SerializedName("TranRule")
|
||||
private String tranRule;
|
||||
|
||||
}
|
||||
@@ -1,8 +1,10 @@
|
||||
package com.njcn.access.pojo.dto.data;
|
||||
|
||||
import com.alibaba.nacos.shaded.com.google.gson.annotations.SerializedName;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@@ -14,36 +16,51 @@ import java.util.List;
|
||||
* @createTime 2022/3/13 15:02
|
||||
*/
|
||||
@Data
|
||||
public class ParDto implements Serializable {
|
||||
public class ParmDto implements Serializable {
|
||||
|
||||
@SerializedName("OpAttr")
|
||||
@NotNull(message = "读写操作属性,不为空")
|
||||
private String opAttr;
|
||||
|
||||
@SerializedName("Name")
|
||||
@NotNull(message = "参数名称,不为空")
|
||||
private String name;
|
||||
|
||||
@SerializedName("IDX")
|
||||
@SerializedName("Idx")
|
||||
@NotNull(message = "参数编号,不为空")
|
||||
private Integer idx;
|
||||
|
||||
@SerializedName("Type")
|
||||
@NotNull(message = "参数类型,不为空")
|
||||
@ApiModelProperty("系统参数:sys 运行参数:run 功能参数:fun")
|
||||
private String type;
|
||||
|
||||
@SerializedName("DataType")
|
||||
@NotNull(message = "参数数据类型,不为空")
|
||||
private String dataType;
|
||||
|
||||
@SerializedName("ModifyFlag")
|
||||
@NotNull(message = "是否可修改,不为空")
|
||||
private Integer modifyFlag;
|
||||
|
||||
@SerializedName("MaxNum")
|
||||
@ApiModelProperty("设置最大值")
|
||||
private Integer maxNum;
|
||||
|
||||
@SerializedName("MinNum")
|
||||
@ApiModelProperty("设置最小值")
|
||||
private Integer minNum;
|
||||
|
||||
@SerializedName("SetValue")
|
||||
@ApiModelProperty("参数为enum可设置的所有值序列")
|
||||
private List<String> setValue;
|
||||
|
||||
@SerializedName("Strlen")
|
||||
@ApiModelProperty("参数string可设置字符串的长度上限")
|
||||
private Integer strLen;
|
||||
|
||||
@SerializedName("DefaultValue")
|
||||
@NotNull(message = "参数缺省值")
|
||||
private String defaultValue;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package com.njcn.access.pojo.dto.data;
|
||||
|
||||
import com.alibaba.nacos.shaded.com.google.gson.annotations.SerializedName;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 类的介绍:
|
||||
*
|
||||
* @author xuyang
|
||||
* @version 1.0.0
|
||||
* @createTime 2023/5/4 11:37
|
||||
*/
|
||||
@Data
|
||||
public class SetDto implements Serializable {
|
||||
|
||||
@SerializedName("OpAttr")
|
||||
@NotNull(message = "读写操作属性,不为空")
|
||||
private String opAttr;
|
||||
|
||||
@SerializedName("Name")
|
||||
@NotNull(message = "参数名称,不为空")
|
||||
private String name;
|
||||
|
||||
@SerializedName("Idx")
|
||||
@NotNull(message = "参数编号,不为空")
|
||||
private Integer idx;
|
||||
|
||||
@SerializedName("DataType")
|
||||
@NotNull(message = "参数数据类型,不为空")
|
||||
private String dataType;
|
||||
|
||||
@SerializedName("MaxNum")
|
||||
@ApiModelProperty("设置最大值")
|
||||
private Integer maxNum;
|
||||
|
||||
@SerializedName("MinNum")
|
||||
@ApiModelProperty("设置最小值")
|
||||
private Integer minNum;
|
||||
|
||||
@SerializedName("DefaultValue")
|
||||
@NotNull(message = "参数缺省值")
|
||||
private String defaultValue;
|
||||
|
||||
}
|
||||
@@ -1,9 +1,12 @@
|
||||
package com.njcn.access.pojo.dto.data;
|
||||
|
||||
import com.alibaba.nacos.shaded.com.google.gson.annotations.SerializedName;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 类的介绍:
|
||||
@@ -15,22 +18,37 @@ import java.io.Serializable;
|
||||
@Data
|
||||
public class StsDto implements Serializable {
|
||||
|
||||
@SerializedName("OpAttr")
|
||||
@NotNull(message = "读写操作属性,不为空")
|
||||
private String opAttr;
|
||||
|
||||
@SerializedName("Name")
|
||||
@NotNull(message = "状态名称,不为空")
|
||||
private String name;
|
||||
|
||||
@SerializedName("IDX")
|
||||
@NotNull(message = "状态编号,不为空")
|
||||
private Integer idx;
|
||||
|
||||
@SerializedName("StoreFlag")
|
||||
@NotNull(message = "是否存储,不为空")
|
||||
private Integer storeFlag;
|
||||
|
||||
@SerializedName("CurSts")
|
||||
@NotNull(message = "当前值,不为空")
|
||||
private Integer curSts;
|
||||
|
||||
@SerializedName("ClassID")
|
||||
@NotNull(message = "数据分类,不为空")
|
||||
private String classId;
|
||||
|
||||
@SerializedName("TranRule")
|
||||
@NotNull(message = "上送规则,不为空")
|
||||
@ApiModelProperty("变化:change 周期:period")
|
||||
private String tranRule;
|
||||
|
||||
//todo 不确定是否还有这个字段先保留
|
||||
@SerializedName("GroupId")
|
||||
@NotNull(message = "数据分组组号,不为空")
|
||||
private List<Object> groupId;
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ public class CfgDto implements Serializable {
|
||||
private String devApp;
|
||||
|
||||
@SerializedName("DevInfo")
|
||||
private DevInfoDTO devInfo;
|
||||
private DevInfoDto devInfo;
|
||||
|
||||
@SerializedName("Province")
|
||||
private String province;
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.njcn.access.pojo.dto.devModel;
|
||||
|
||||
import com.alibaba.nacos.shaded.com.google.gson.annotations.SerializedName;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 类的介绍:
|
||||
*
|
||||
* @author xuyang
|
||||
* @version 1.0.0
|
||||
* @createTime 2023/5/4 10:11
|
||||
*/
|
||||
@Data
|
||||
public class ClDevDto implements Serializable {
|
||||
|
||||
@SerializedName("Cldid")
|
||||
@NotEmpty(message = "逻辑子设备ID,不可为空")
|
||||
private String clDid;
|
||||
|
||||
@SerializedName("DevType")
|
||||
@ApiModelProperty(value = "逻辑子设备型号")
|
||||
private String devType;
|
||||
|
||||
@SerializedName("DataList")
|
||||
@NotEmpty(message = "数据模型列表,不可为空")
|
||||
private List<DataArrayDto> dataList;
|
||||
|
||||
@SerializedName("DataSet")
|
||||
@NotEmpty(message = "数据集序列,不可为空")
|
||||
private List<DataSetDto> dataSet;
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.njcn.access.pojo.dto.devModel;
|
||||
|
||||
import com.alibaba.nacos.shaded.com.google.gson.annotations.SerializedName;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
@@ -15,17 +16,25 @@ import java.io.Serializable;
|
||||
* @createTime 2022/3/13 12:09
|
||||
*/
|
||||
@Data
|
||||
public class CpuInfoDTO implements Serializable {
|
||||
public class CpuInfoDto implements Serializable {
|
||||
|
||||
@SerializedName("OpAttr")
|
||||
@ApiModelProperty("读写操作属性")
|
||||
private String opAttr;
|
||||
|
||||
@SerializedName("CpuCore")
|
||||
@ApiModelProperty("CPU核心数")
|
||||
private Integer cpuCore;
|
||||
|
||||
@SerializedName("CpuFreq")
|
||||
@ApiModelProperty("CPU主频(单位MHz)")
|
||||
private Float cpuFreq;
|
||||
|
||||
@SerializedName("Arch")
|
||||
@ApiModelProperty("CPU架构")
|
||||
private String arch;
|
||||
|
||||
@SerializedName("CpuLmt")
|
||||
@ApiModelProperty("CPU监控阈值(单位%)")
|
||||
private Float cpuLmt;
|
||||
}
|
||||
@@ -3,6 +3,7 @@ package com.njcn.access.pojo.dto.devModel;
|
||||
import com.alibaba.nacos.shaded.com.google.gson.annotations.SerializedName;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
@@ -10,15 +11,16 @@ import java.io.Serializable;
|
||||
*
|
||||
* @author xuyang
|
||||
* @version 1.0.0
|
||||
* @createTime 2022/3/13 15:18
|
||||
* @createTime 2023/5/4 10:13
|
||||
*/
|
||||
@Data
|
||||
public class DataArrayDto implements Serializable {
|
||||
|
||||
@SerializedName("Type")
|
||||
@NotEmpty(message = "数据类别,不可为空")
|
||||
private String type;
|
||||
|
||||
@SerializedName("IDX")
|
||||
@SerializedName("Idx")
|
||||
@NotEmpty(message = "数据编号,不可为空")
|
||||
private Integer idx;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
package com.njcn.access.pojo.dto.devModel;
|
||||
|
||||
import com.alibaba.nacos.shaded.com.google.gson.annotations.SerializedName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 类的介绍:
|
||||
*
|
||||
* @author xuyang
|
||||
* @version 1.0.0
|
||||
* @createTime 2023/4/10 16:20
|
||||
*/
|
||||
@Data
|
||||
public class DataDto implements Serializable {
|
||||
@SerializedName("TEMPLATE")
|
||||
private TemplateDetailDto template;
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
package com.njcn.access.pojo.dto.devModel;
|
||||
|
||||
import com.alibaba.nacos.shaded.com.google.gson.annotations.SerializedName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
;
|
||||
|
||||
/**
|
||||
* 类的介绍:
|
||||
*
|
||||
* @author xuyang
|
||||
* @version 1.0.0
|
||||
* @createTime 2022/3/13 14:21
|
||||
*/
|
||||
@Data
|
||||
public class DataSetDTO implements Serializable {
|
||||
|
||||
@SerializedName("Name")
|
||||
private String name;
|
||||
|
||||
@SerializedName("IDX")
|
||||
private Integer idx;
|
||||
|
||||
@SerializedName("DataType")
|
||||
private String dataType;
|
||||
|
||||
@SerializedName("StartTime")
|
||||
private String startTime;
|
||||
|
||||
@SerializedName("Period")
|
||||
private Integer period;
|
||||
|
||||
@SerializedName("StoreFlag")
|
||||
private Integer storeFlag;
|
||||
|
||||
@SerializedName("DataArray")
|
||||
private List<DataArrayDto> dataArray;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package com.njcn.access.pojo.dto.devModel;
|
||||
|
||||
import com.alibaba.nacos.shaded.com.google.gson.annotations.SerializedName;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 类的介绍:
|
||||
*
|
||||
* @author xuyang
|
||||
* @version 1.0.0
|
||||
* @createTime 2023/5/4 10:13
|
||||
*/
|
||||
@Data
|
||||
public class DataSetDto implements Serializable {
|
||||
|
||||
@SerializedName("Name")
|
||||
@NotEmpty(message = "数据集名称,不可为空")
|
||||
private String name;
|
||||
|
||||
@SerializedName("Idx")
|
||||
@NotNull(message = "数据集编号,不可为空")
|
||||
private Integer idx;
|
||||
|
||||
@SerializedName("Period")
|
||||
@NotNull(message = "数据上送周期(单位s),不可为空")
|
||||
private Integer period;
|
||||
|
||||
@SerializedName("StoreFlag")
|
||||
@NotNull(message = "存储标识,不可为空")
|
||||
@ApiModelProperty("0-不存储;1-存储")
|
||||
private Integer storeFlag;
|
||||
|
||||
@SerializedName("DataArray")
|
||||
@NotEmpty(message = "数据集合描述,不可为空")
|
||||
private List<DataArrayDto> dataArrayDtoList;
|
||||
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
package com.njcn.access.pojo.dto.devModel;
|
||||
|
||||
import com.alibaba.nacos.shaded.com.google.gson.annotations.SerializedName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 类的介绍:
|
||||
*
|
||||
* @author xuyang
|
||||
* @version 1.0.0
|
||||
* @createTime 2023/4/10 16:26
|
||||
*/
|
||||
@Data
|
||||
public class DevCfgDetailDto implements Serializable {
|
||||
|
||||
@SerializedName("Name")
|
||||
private String name;
|
||||
|
||||
@SerializedName("Version")
|
||||
private String version;
|
||||
|
||||
@SerializedName("Time")
|
||||
private String time;
|
||||
|
||||
@SerializedName("Cfg")
|
||||
private List<CfgDto> cfg;
|
||||
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.njcn.access.pojo.dto.devModel;
|
||||
|
||||
import com.alibaba.nacos.shaded.com.google.gson.annotations.SerializedName;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
@@ -15,20 +16,21 @@ import java.io.Serializable;
|
||||
* @createTime 2022/3/13 12:08
|
||||
*/
|
||||
@Data
|
||||
public class DevInfoDTO implements Serializable {
|
||||
public class DevInfoDto implements Serializable {
|
||||
|
||||
@SerializedName("OpAttr")
|
||||
@ApiModelProperty("读写操作属性")
|
||||
private String opAttr;
|
||||
|
||||
@SerializedName("DevType")
|
||||
@ApiModelProperty("设备型号")
|
||||
private String devType;
|
||||
|
||||
@SerializedName("DevName ")
|
||||
@ApiModelProperty("设备名称")
|
||||
private String devName;
|
||||
|
||||
@SerializedName("MsgInfo")
|
||||
@ApiModelProperty("设备厂商信息")
|
||||
private String msgInfo;
|
||||
|
||||
@SerializedName("DevStatus")
|
||||
private String devStatus;
|
||||
|
||||
@SerializedName("HardVer")
|
||||
private String hardVer;
|
||||
}
|
||||
@@ -1,82 +0,0 @@
|
||||
package com.njcn.access.pojo.dto.devModel;
|
||||
|
||||
import com.alibaba.nacos.shaded.com.google.gson.annotations.SerializedName;
|
||||
import com.njcn.access.pojo.dto.data.*;
|
||||
import com.njcn.access.pojo.dto.data.ParDto;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 类的介绍:
|
||||
*
|
||||
* @author xuyang
|
||||
* @version 1.0.0
|
||||
* @createTime 2023/4/10 16:26
|
||||
*/
|
||||
@Data
|
||||
public class DevModDetailDto implements Serializable {
|
||||
|
||||
@SerializedName("Name")
|
||||
private String name;
|
||||
|
||||
@SerializedName("Version")
|
||||
private String version;
|
||||
|
||||
@SerializedName("Time")
|
||||
private String time;
|
||||
|
||||
@SerializedName("IDX")
|
||||
private Integer idx;
|
||||
|
||||
@SerializedName("DevType")
|
||||
private String devType;
|
||||
|
||||
@SerializedName("DataList")
|
||||
private List<String> dataList;
|
||||
|
||||
@SerializedName("DataSet")
|
||||
private List<DataSetDTO> dataSet;
|
||||
|
||||
@SerializedName("IClk")
|
||||
private String iclk;
|
||||
|
||||
@SerializedName("EClk")
|
||||
private String eclk;
|
||||
|
||||
@SerializedName("LineNum")
|
||||
private Integer lineNum;
|
||||
|
||||
@SerializedName("EPD")
|
||||
private List<EpdPqdDto> epd;
|
||||
|
||||
@SerializedName("PQD")
|
||||
private List<EpdPqdDto> pqd;
|
||||
|
||||
@SerializedName("EVT")
|
||||
private List<EvtDto> evt;
|
||||
|
||||
@SerializedName("ALM")
|
||||
private List<AlmDto> alm;
|
||||
|
||||
@SerializedName("MD")
|
||||
private List<MdDto> md;
|
||||
|
||||
@SerializedName("STS")
|
||||
private List<StsDto> sts;
|
||||
|
||||
@SerializedName("DI")
|
||||
private List<DiDto> di;
|
||||
|
||||
@SerializedName("DO")
|
||||
private List<DoDto> doDTO;
|
||||
|
||||
@SerializedName("Param")
|
||||
private List<ParDto> param;
|
||||
|
||||
@SerializedName("CTRL")
|
||||
private List<CtrlDto> ctrl;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.njcn.access.pojo.dto.devModel;
|
||||
|
||||
import com.alibaba.nacos.shaded.com.google.gson.annotations.SerializedName;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 类的介绍:
|
||||
*
|
||||
* @author xuyang
|
||||
* @version 1.0.0
|
||||
* @createTime 2023/5/4 10:00
|
||||
*/
|
||||
@Data
|
||||
public class DevModDto implements Serializable {
|
||||
|
||||
@SerializedName("Version")
|
||||
@NotEmpty(message = "直连装置/网关版本号,不可为空")
|
||||
private String version;
|
||||
|
||||
@SerializedName("Time")
|
||||
@NotEmpty(message = "创建或最后修改时间,不可为空")
|
||||
private String time;
|
||||
|
||||
@SerializedName("DevType")
|
||||
@NotEmpty(message = "设备型号,不可为空")
|
||||
private String devType;
|
||||
|
||||
@SerializedName("DataList")
|
||||
@NotEmpty(message = "数据模型列表,不可为空")
|
||||
private List<Object> dataList;
|
||||
|
||||
@SerializedName("DataSet")
|
||||
@NotEmpty(message = "数据集,不可为空")
|
||||
private List<DataSetDto> dataSetDtoList;
|
||||
|
||||
@SerializedName("Cldev")
|
||||
@ApiModelProperty(value = "逻辑子设备序列")
|
||||
private List<ClDevDto> clDevDtoList;
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.njcn.access.pojo.dto.devModel;
|
||||
|
||||
import com.alibaba.nacos.shaded.com.google.gson.annotations.SerializedName;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import java.io.Serializable;
|
||||
|
||||
@@ -12,15 +13,18 @@ import java.io.Serializable;
|
||||
* @createTime 2022/3/13 12:09
|
||||
*/
|
||||
@Data
|
||||
public class DiskInfoDTO implements Serializable {
|
||||
public class DiskInfoDto implements Serializable {
|
||||
|
||||
@SerializedName("OpAttr")
|
||||
@ApiModelProperty("读写操作属性")
|
||||
private String opAttr;
|
||||
|
||||
@SerializedName("DiskPhy")
|
||||
@ApiModelProperty("磁盘空间(单位MB)")
|
||||
private Float diskPhy;
|
||||
|
||||
@SerializedName("DiskUsePhy")
|
||||
private Float diskUsePhy;
|
||||
|
||||
@SerializedName("DiskLmt")
|
||||
@ApiModelProperty("内存监控阈值(单位%)")
|
||||
private Float diskLmt;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.njcn.access.pojo.dto.devModel;
|
||||
|
||||
import com.alibaba.nacos.shaded.com.google.gson.annotations.SerializedName;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 类的介绍:
|
||||
*
|
||||
* @author xuyang
|
||||
* @version 1.0.0
|
||||
* @createTime 2023/5/4 10:04
|
||||
*/
|
||||
@Data
|
||||
public class LdevInfoDto implements Serializable {
|
||||
|
||||
@SerializedName("OpAttr")
|
||||
@NotEmpty(message = "读写操作属性,不可为空")
|
||||
private String opAttr;
|
||||
|
||||
@SerializedName("VolGrade")
|
||||
@ApiModelProperty(value = "电压等级")
|
||||
private String volGrade;
|
||||
|
||||
@SerializedName("ConType")
|
||||
@ApiModelProperty(value = "接线方式")
|
||||
private String conType;
|
||||
|
||||
@SerializedName("PtRatio")
|
||||
@ApiModelProperty(value = "PT变比")
|
||||
private String ptRatio;
|
||||
|
||||
@SerializedName("CtRatio")
|
||||
@ApiModelProperty(value = "CT变比")
|
||||
private String ctRatio;
|
||||
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.njcn.access.pojo.dto.devModel;
|
||||
|
||||
import com.alibaba.nacos.shaded.com.google.gson.annotations.SerializedName;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import java.io.Serializable;
|
||||
|
||||
@@ -12,14 +13,17 @@ import java.io.Serializable;
|
||||
* @createTime 2022/3/13 12:09
|
||||
*/
|
||||
@Data
|
||||
public class MemInfoDTO implements Serializable {
|
||||
public class MemInfoDto implements Serializable {
|
||||
|
||||
@SerializedName("OpAttr")
|
||||
@ApiModelProperty("读写操作属性")
|
||||
private String opAttr;
|
||||
|
||||
@SerializedName("MemPhy")
|
||||
@ApiModelProperty("物理内存(单位MB)")
|
||||
private Float memPhy;
|
||||
|
||||
@SerializedName("MemVirt")
|
||||
private Float memVirt;
|
||||
|
||||
@SerializedName("MemLmt")
|
||||
@ApiModelProperty("内存监控阈值(单位%)")
|
||||
private Float memLmt;
|
||||
}
|
||||
@@ -3,6 +3,7 @@ package com.njcn.access.pojo.dto.devModel;
|
||||
import com.alibaba.nacos.shaded.com.google.gson.annotations.SerializedName;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@@ -16,49 +17,19 @@ import java.util.List;
|
||||
@Data
|
||||
public class NetDevModDto implements Serializable {
|
||||
|
||||
@SerializedName("Name")
|
||||
private String name;
|
||||
|
||||
@SerializedName("Version")
|
||||
@NotEmpty(message = "直连装置/网关版本号,不可为空")
|
||||
private String version;
|
||||
|
||||
@SerializedName("Time")
|
||||
@NotEmpty(message = "创建或最后修改时间,不可为空")
|
||||
private String time;
|
||||
|
||||
@SerializedName("DevName")
|
||||
private String devName;
|
||||
|
||||
@SerializedName("DevType")
|
||||
@NotEmpty(message = "设备型号,不可为空")
|
||||
private String devType;
|
||||
|
||||
@SerializedName("NetType")
|
||||
private String netType;
|
||||
|
||||
@SerializedName("NDID")
|
||||
private String nDid;
|
||||
|
||||
@SerializedName("DevTopicVer")
|
||||
private String devTopicVer;
|
||||
|
||||
@SerializedName("Uid")
|
||||
private String uid;
|
||||
|
||||
@SerializedName("CUid")
|
||||
private List<String> cUid;
|
||||
|
||||
@SerializedName("DevInfo")
|
||||
private DevInfoDTO devInfoDTO;
|
||||
|
||||
@SerializedName("CpuInfo")
|
||||
private CpuInfoDTO cpuInfoDTO;
|
||||
|
||||
@SerializedName("MemInfo")
|
||||
private MemInfoDTO memInfoDTO;
|
||||
|
||||
@SerializedName("DiskInfo")
|
||||
private DiskInfoDTO diskInfoDTO;
|
||||
|
||||
@SerializedName("SoftInfo")
|
||||
private SoftInfoDTO softInfoDTO;
|
||||
|
||||
@SerializedName("DataList")
|
||||
@NotEmpty(message = "数据模型列表,不可为空")
|
||||
private List<Object> dataList;
|
||||
}
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
package com.njcn.access.pojo.dto.devModel;
|
||||
|
||||
|
||||
import com.alibaba.nacos.shaded.com.google.gson.annotations.SerializedName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 类的介绍:
|
||||
*
|
||||
* @author xuyang
|
||||
* @version 1.0.0
|
||||
* @createTime 2023/4/10 16:18
|
||||
*/
|
||||
@Data
|
||||
public class ParamDto implements Serializable {
|
||||
|
||||
@SerializedName("Data_Type")
|
||||
private String dataType;
|
||||
|
||||
@SerializedName("Data_Array")
|
||||
private List<DataDto> dataArray;
|
||||
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
package com.njcn.access.pojo.dto.devModel;
|
||||
|
||||
import com.alibaba.nacos.shaded.com.google.gson.annotations.SerializedName;
|
||||
import lombok.Data;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 类的介绍:
|
||||
*
|
||||
* @author xuyang
|
||||
* @version 1.0.0
|
||||
* @createTime 2022/3/13 12:09
|
||||
*/
|
||||
@Data
|
||||
public class SoftInfoDTO implements Serializable {
|
||||
|
||||
@SerializedName("OsName")
|
||||
private String osName;
|
||||
|
||||
@SerializedName("OsVersion")
|
||||
private String osVersion;
|
||||
|
||||
@SerializedName("AppVersion")
|
||||
private String appVersion;
|
||||
|
||||
@SerializedName("AppDate")
|
||||
private String appDate;
|
||||
|
||||
@SerializedName("AppCheck")
|
||||
private String appCheck;
|
||||
|
||||
@SerializedName("Softupdate")
|
||||
private String softUpdate;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.njcn.access.pojo.dto.devModel;
|
||||
|
||||
import com.alibaba.nacos.shaded.com.google.gson.annotations.SerializedName;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.Null;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 类的介绍:
|
||||
*
|
||||
* @author xuyang
|
||||
* @version 1.0.0
|
||||
* @createTime 2022/3/13 12:09
|
||||
*/
|
||||
@Data
|
||||
public class SoftInfoDto implements Serializable {
|
||||
|
||||
@SerializedName("OpAttr")
|
||||
@NotEmpty(message = "读写操作属性不可为空")
|
||||
private String opAttr;
|
||||
|
||||
@SerializedName("OsName")
|
||||
@NotEmpty(message = "操作系统名称,裸机系统填Null,不可为空")
|
||||
private String osName;
|
||||
|
||||
@SerializedName("OsVersion")
|
||||
@NotEmpty(message = "操作系统版本,裸机系统填Null,不可为空")
|
||||
private String osVersion;
|
||||
|
||||
@SerializedName("AppVersion")
|
||||
@NotEmpty(message = "应用程序版本号,不可为空")
|
||||
private String appVersion;
|
||||
|
||||
@SerializedName("AppDate")
|
||||
@NotEmpty(message = "应用程序发布日期,不可为空")
|
||||
private String appDate;
|
||||
|
||||
@SerializedName("AppCheck")
|
||||
@NotEmpty(message = "应用程序校验码,不可为空")
|
||||
private String appCheck;
|
||||
|
||||
@SerializedName("Softupdate")
|
||||
@NotEmpty(message = "是否支持远程升级程序,不可为空")
|
||||
private String softUpdate;
|
||||
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
package com.njcn.access.pojo.dto.devModel;
|
||||
|
||||
import com.alibaba.nacos.shaded.com.google.gson.annotations.SerializedName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 类的介绍:
|
||||
*
|
||||
* @author xuyang
|
||||
* @version 1.0.0
|
||||
* @createTime 2023/4/10 16:22
|
||||
*/
|
||||
@Data
|
||||
public class TemplateDetailDto implements Serializable {
|
||||
|
||||
@SerializedName("NetDevMod")
|
||||
private NetDevModDto netDevModDto;
|
||||
|
||||
@SerializedName("DevCfg")
|
||||
private DevCfgDetailDto devCfgDetailDto;
|
||||
|
||||
@SerializedName("DevMod")
|
||||
private List<DevModDetailDto> devModDetailDto;
|
||||
}
|
||||
@@ -3,6 +3,7 @@ package com.njcn.access.pojo.dto.devModel;
|
||||
import com.alibaba.nacos.shaded.com.google.gson.annotations.SerializedName;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
@@ -15,23 +16,12 @@ import java.io.Serializable;
|
||||
@Data
|
||||
public class TemplateDto implements Serializable {
|
||||
|
||||
@SerializedName("mid")
|
||||
private Integer mid;
|
||||
|
||||
@SerializedName("deviceId")
|
||||
private String deviceId;
|
||||
|
||||
@SerializedName("timestamp")
|
||||
private String timestamp;
|
||||
|
||||
@SerializedName("type")
|
||||
private String type;
|
||||
|
||||
@SerializedName("param")
|
||||
private ParamDto param;
|
||||
|
||||
@SerializedName("code")
|
||||
private Integer code;
|
||||
@SerializedName("NetDevMod")
|
||||
@NotEmpty(message = "直连装置/网关信息描述表,不为空")
|
||||
private NetDevModDto netDevModDto;
|
||||
|
||||
@SerializedName("DevMod")
|
||||
@NotEmpty(message = "逻辑设备数据模板说明,不为空")
|
||||
private DevModDto devModDto;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.njcn.access.pojo.dto.heart;
|
||||
|
||||
import com.njcn.access.param.ParamName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 类的介绍:
|
||||
*
|
||||
* @author xuyang
|
||||
* @version 1.0.0
|
||||
* @createTime 2023/4/28 10:42
|
||||
*/
|
||||
@Data
|
||||
public class HeartBeatDto implements Serializable {
|
||||
|
||||
@ParamName("Time")
|
||||
private Long time;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
package com.njcn.access.pojo.param;
|
||||
|
||||
import com.alibaba.nacos.shaded.com.google.gson.annotations.SerializedName;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 类的介绍:
|
||||
*
|
||||
* @author xuyang
|
||||
* @version 1.0.0
|
||||
* @createTime 2023/4/20 14:05
|
||||
*/
|
||||
@Data
|
||||
public class ReqAndResParam implements Serializable {
|
||||
|
||||
@SerializedName("Mid")
|
||||
@ApiModelProperty("报文ID,在请求报文中该值为请求ID")
|
||||
@NotNull(message = "报文ID不能为空")
|
||||
private Integer mid;
|
||||
|
||||
@SerializedName("Did")
|
||||
@ApiModelProperty("设备唯一标识lDid,填入0代表nDid")
|
||||
@NotBlank(message = "设备唯一标识lDid不能为空")
|
||||
private String did;
|
||||
|
||||
@SerializedName("Pri")
|
||||
@ApiModelProperty("报文处理的优先级")
|
||||
@NotNull(message = "报文处理的优先级不能为空")
|
||||
private Integer pri;
|
||||
|
||||
@SerializedName("Type")
|
||||
@ApiModelProperty("消息类型")
|
||||
@NotNull(message = "消息类型不能为空")
|
||||
private String type;
|
||||
|
||||
@SerializedName("Msg")
|
||||
@ApiModelProperty("报文内容")
|
||||
private Object msg;
|
||||
|
||||
/**
|
||||
* 请求报文
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public static class Req extends ReqAndResParam {
|
||||
@SerializedName("Expire")
|
||||
@ApiModelProperty("此报文过期的相对时间,单位秒,该字段为-1时表示永不过期.控制类报文接收者超时处理按此时间")
|
||||
@NotNull(message = "报文过期的相对时间不能为空")
|
||||
private Integer expire;
|
||||
}
|
||||
|
||||
/**
|
||||
* 应答报文
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public static class Res extends ReqAndResParam {
|
||||
@SerializedName("Code")
|
||||
@ApiModelProperty("标识应答的返回码")
|
||||
@NotNull(message = "状态码不能为空")
|
||||
private Integer code;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.njcn.access.pojo.po;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
* </p>
|
||||
*
|
||||
* @author xuyang
|
||||
* @since 2023-05-11
|
||||
*/
|
||||
@Data
|
||||
@TableName("cs_bmd")
|
||||
public class CsBmdPO {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private String id;
|
||||
|
||||
private String name;
|
||||
|
||||
private String anotherName;
|
||||
|
||||
private Integer idx;
|
||||
|
||||
private String type;
|
||||
|
||||
private String unit;
|
||||
|
||||
private String phase;
|
||||
|
||||
private String classId;
|
||||
|
||||
private String statMethod;
|
||||
|
||||
private String tranRule;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.njcn.access.pojo.po;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
* </p>
|
||||
*
|
||||
* @author xuyang
|
||||
* @since 2023-05-11
|
||||
*/
|
||||
@Data
|
||||
@TableName("cs_epd_pqd")
|
||||
public class CsEpdPqdPO {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private String id;
|
||||
|
||||
private String name;
|
||||
|
||||
private String anotherName;
|
||||
|
||||
private Integer idx;
|
||||
|
||||
private String type;
|
||||
|
||||
private String phase;
|
||||
|
||||
private String unit;
|
||||
|
||||
private Integer harmStart;
|
||||
|
||||
private Integer harmEnd;
|
||||
|
||||
private String classId;
|
||||
|
||||
private String statMethod;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.njcn.access.pojo.po;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.sun.javafx.beans.IDProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
* </p>
|
||||
*
|
||||
* @author xuyang
|
||||
* @since 2023-05-12
|
||||
*/
|
||||
@Data
|
||||
@TableName("cs_topic")
|
||||
public class CsTopicPO {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private String id;
|
||||
|
||||
private String ndid;
|
||||
|
||||
private String topic;
|
||||
|
||||
private Integer type;
|
||||
|
||||
|
||||
}
|
||||
@@ -43,7 +43,4 @@ public class AccessController extends BaseController {
|
||||
accessService.add(nDid);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
package com.njcn.access.controller;
|
||||
|
||||
import com.njcn.access.pojo.MessageParam;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.kafka.clients.consumer.ConsumerRecord;
|
||||
import org.springframework.kafka.annotation.KafkaListener;
|
||||
import org.springframework.kafka.core.KafkaTemplate;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
|
||||
/**
|
||||
* 类的介绍:
|
||||
*
|
||||
* @author xuyang
|
||||
* @version 1.0.0
|
||||
* @createTime 2023/4/18 13:53
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/test")
|
||||
@Api(value = "TestController", tags = {"测试 API"})
|
||||
public class KafkaController extends BaseController {
|
||||
|
||||
@Resource
|
||||
private KafkaTemplate<String, String> kafkaTemplate;
|
||||
|
||||
@PostMapping("/kafka/sendMessage")
|
||||
@ApiOperation(value = "发送kafka告警消息")
|
||||
public void sendKafkaMessage(@Valid @ApiParam("参数") @RequestBody MessageParam param) {
|
||||
kafkaTemplate.send(param.getTopic(), param.getMessage());
|
||||
}
|
||||
|
||||
@Component
|
||||
public class KafkaConsumer {
|
||||
// 消费监听
|
||||
@KafkaListener(topics = {"topic2"})
|
||||
public void onMessage1(ConsumerRecord<?, ?> record){
|
||||
// 消费的哪个topic、partition的消息,打印出消息内容
|
||||
System.out.println("简单消费:"+record.topic()+"-"+record.partition()+"-"+record.value());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package com.njcn.access.controller;
|
||||
|
||||
import com.njcn.access.service.ICsTopicService;
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
import com.njcn.common.pojo.enums.common.LogEnum;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.common.utils.LogUtil;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 类的介绍:
|
||||
*
|
||||
* @author xuyang
|
||||
* @version 1.0.0
|
||||
* @createTime 2023/5/12 10:28
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/topic")
|
||||
@RequiredArgsConstructor
|
||||
@Api(tags = "装置主题")
|
||||
public class TopicController extends BaseController {
|
||||
|
||||
private final ICsTopicService csTopicService;
|
||||
|
||||
@PostMapping("/ask")
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@ApiOperation("平台询问装置支持主题")
|
||||
@ApiImplicitParam(name = "nDid", value = "网关识别码", required = true)
|
||||
public HttpResult<Object> ask(@RequestParam String nDid){
|
||||
String methodDescribe = getMethodDescribe("ask");
|
||||
LogUtil.njcnDebug(log, "{},平台询问装置支持主题,请求的nDid为:{}", methodDescribe, nDid);
|
||||
csTopicService.askDevTopic(nDid);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -5,26 +5,39 @@ import com.github.tocrhz.mqtt.annotation.MqttSubscribe;
|
||||
import com.github.tocrhz.mqtt.annotation.NamedValue;
|
||||
import com.github.tocrhz.mqtt.annotation.Payload;
|
||||
import com.github.tocrhz.mqtt.publisher.MqttPublisher;
|
||||
import com.njcn.access.enums.AccessStatusEnum;
|
||||
import com.njcn.access.pojo.dto.*;
|
||||
import com.njcn.access.enums.AccessEnum;
|
||||
import com.njcn.access.enums.AccessResponseEnum;
|
||||
import com.njcn.access.enums.TypeEnum;
|
||||
import com.njcn.access.pojo.dto.DevModInfoDto;
|
||||
import com.njcn.access.pojo.dto.ModelDto;
|
||||
import com.njcn.access.pojo.dto.TopicDto;
|
||||
import com.njcn.access.pojo.dto.heart.HeartBeatDto;
|
||||
import com.njcn.access.pojo.param.ReqAndResParam;
|
||||
import com.njcn.access.pojo.po.CsTopicPO;
|
||||
import com.njcn.access.service.ICsTopicService;
|
||||
import com.njcn.algorithm.api.DevModelFeignClient;
|
||||
import com.njcn.algorithm.api.EquipmentFeignClient;
|
||||
import com.njcn.algorithm.pojo.param.CsDevModelQueryListParm;
|
||||
import com.njcn.algorithm.pojo.vo.CsDevModelPageVO;
|
||||
import com.njcn.algorithm.pojo.vo.CsEquipmentDeliveryVO;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.PubUtils;
|
||||
import com.njcn.redis.utils.RedisUtil;
|
||||
import com.njcn.system.api.DicDataFeignClient;
|
||||
import com.njcn.system.enums.DicDataEnum;
|
||||
import com.njcn.system.pojo.po.DictData;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.eclipse.paho.client.mqttv3.MqttMessage;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.validation.ConstraintViolation;
|
||||
import javax.validation.Validator;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.time.Instant;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author hongawen
|
||||
@@ -46,35 +59,82 @@ public class MqttMessageHandler {
|
||||
|
||||
private final RedisUtil redisUtil;
|
||||
|
||||
private final ICsTopicService csTopicService;
|
||||
|
||||
@Autowired
|
||||
Validator validator;
|
||||
|
||||
@MqttSubscribe(value = "/Dev/Topic/{edgeId}",qos = 1)
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void devTopic(String topic, MqttMessage message, @NamedValue("edgeId") String nDid, @Payload String payload){
|
||||
Gson gson = new Gson();
|
||||
ReqAndResParam.Res res = gson.fromJson(new String(message.getPayload(), StandardCharsets.UTF_8), ReqAndResParam.Res.class);
|
||||
//检验传递的参数是否准确
|
||||
Set<ConstraintViolation<ReqAndResParam.Res>> validate = validator.validate(res);
|
||||
validate.forEach(constraintViolation -> {
|
||||
System.out.println(constraintViolation.getMessage());
|
||||
});
|
||||
if (Objects.equals(res.getCode(),AccessEnum.SUCCESS.getCode())){
|
||||
if (Objects.equals(res.getType(), TypeEnum.TYPE_1.getCode())){
|
||||
List<CsTopicPO> list = new ArrayList<>();
|
||||
//fixme 这边获取数据需要调整
|
||||
Map<String,List<String>> map = (Map<String,List<String>>)res.getMsg();
|
||||
List<String> topicList = map.get("Topic");
|
||||
topicList.forEach(item->{
|
||||
CsTopicPO csTopicPo = new CsTopicPO();
|
||||
csTopicPo.setNdid(nDid);
|
||||
csTopicPo.setTopic(item);
|
||||
csTopicPo.setType(0);
|
||||
list.add(csTopicPo);
|
||||
});
|
||||
csTopicService.addList(list);
|
||||
} else {
|
||||
log.info(AccessResponseEnum.MESSAGE_TYPE_ERROR.getMessage());
|
||||
}
|
||||
} else {
|
||||
log.info(AccessResponseEnum.RESPONSE_ERROR.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 接收装置接入响应
|
||||
* 装置注册应答
|
||||
* 1.收到注册信息,修改装置出厂表,装置的状态,调整为注册;然后开始接入流程
|
||||
* 2.询问当前装置类型的模板。有则完成接入;没有则告警出来,需要人工手动上传模板信息
|
||||
* @param topic
|
||||
* @param message
|
||||
* @param payload
|
||||
*/
|
||||
@MqttSubscribe(value = "/device/register/{nDid}",qos = 1)
|
||||
public void devOperation(String topic, MqttMessage message, @NamedValue("nDid") String nDid, @Payload String payload){
|
||||
@MqttSubscribe(value = "/Dev/Reg/{edgeId}",qos = 1)
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void devOperation(String topic, MqttMessage message, @NamedValue("edgeId") String nDid, @Payload String payload){
|
||||
Gson gson = new Gson();
|
||||
RegisterDTO.RegisterResponse registerDTO = gson.fromJson(new String(message.getPayload(), StandardCharsets.UTF_8), RegisterDTO.RegisterResponse.class);
|
||||
if (registerDTO.getCode() == 200){
|
||||
equipmentFeignClient.updateStatusBynDid(nDid, AccessStatusEnum.REGISTERED.getCode());
|
||||
PublicDto publicDto = new PublicDto();
|
||||
publicDto.setMid(Long.toString(Instant.now().toEpochMilli()));
|
||||
publicDto.setNDid(nDid);
|
||||
publicDto.setTimestamp(Instant.now().toEpochMilli());
|
||||
publicDto.setType("CMD_DEV_DATA");
|
||||
AccessDto accessDto = new AccessDto();
|
||||
accessDto.setNDid(nDid);
|
||||
accessDto.setDevType(registerDTO.getParam().getDev_type());
|
||||
publicDto.setParam(accessDto);
|
||||
publisher.send("/platform/devcmd/"+nDid,new Gson().toJson(publicDto),1,false);
|
||||
ReqAndResParam.Res res = gson.fromJson(new String(message.getPayload(), StandardCharsets.UTF_8), ReqAndResParam.Res.class);
|
||||
//检验传递的参数是否准确
|
||||
Set<ConstraintViolation<ReqAndResParam.Res>> validate = validator.validate(res);
|
||||
validate.forEach(constraintViolation -> {
|
||||
System.out.println(constraintViolation.getMessage());
|
||||
});
|
||||
if (Objects.equals(res.getCode(),AccessEnum.SUCCESS.getCode())){
|
||||
if (Objects.equals(res.getType(),TypeEnum.TYPE_17.getCode())){
|
||||
equipmentFeignClient.updateStatusBynDid(nDid, AccessEnum.REGISTERED.getCode());
|
||||
//询问模板数据
|
||||
ReqAndResParam.Req reqAndResParam = new ReqAndResParam.Req();
|
||||
reqAndResParam.setMid(1);
|
||||
reqAndResParam.setDid("0");
|
||||
reqAndResParam.setPri(AccessEnum.FIRST_CHANNEL.getCode());
|
||||
reqAndResParam.setType(TypeEnum.TYPE_3.getCode());
|
||||
reqAndResParam.setExpire(-1);
|
||||
publisher.send("/Pfm/DevCmd/V1/"+nDid,new Gson().toJson(reqAndResParam),1,false);
|
||||
} else {
|
||||
log.info(AccessResponseEnum.MESSAGE_TYPE_ERROR.getMessage());
|
||||
}
|
||||
} else {
|
||||
log.info(AccessResponseEnum.RESPONSE_ERROR.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 装置类型模板相应
|
||||
* 装置类型模板应答
|
||||
* 1.判断网关的类型
|
||||
* 2.直联设备的DevCfg和DevMod是以直联设备为准,上送平台端,平台端保存。通过校验DevMod模板信息来从平台端模板池中选取对应的模板,如果找不到匹配模板需告警提示人工干预处理。
|
||||
* 3.平台端需读取装置的DevMod来判断网关支持的设备模板(包含设备型号和模板版本),根据app提交的接入子设备DID匹配数据模板(型号及版本),生成DevCfg下发给网关,网关根据下发信息生成就地设备点表。
|
||||
@@ -83,20 +143,23 @@ public class MqttMessageHandler {
|
||||
* @param nDid
|
||||
* @param payload
|
||||
*/
|
||||
@MqttSubscribe(value = "/device/devack/{nDid}",qos = 1)
|
||||
public void devModelOperation(String topic, MqttMessage message, @NamedValue("nDid") String nDid, @Payload String payload){
|
||||
@MqttSubscribe(value = "/Pfm/DevRsp/{version}/{edgeId}",qos = 1)
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void devModelOperation(String topic, MqttMessage message, @NamedValue("version") String version, @NamedValue("edgeId") String nDid, @Payload String payload){
|
||||
Gson gson = new Gson();
|
||||
ModelDto modelDto = gson.fromJson(new String(message.getPayload(), StandardCharsets.UTF_8), ModelDto.class);
|
||||
HttpResult<CsEquipmentDeliveryVO> pojo = equipmentFeignClient.queryEquipmentByndid(nDid);
|
||||
if (!Objects.isNull(pojo)){
|
||||
String devType = pojo.getData().getDevType();
|
||||
if (Objects.equals(devType,"直连设备")){
|
||||
List<DevModelDto> list = modelDto.getDevMod();
|
||||
String dictCode = dicDataFeignClient.getDicDataById(devType).getData().getCode();
|
||||
//直连设备处理
|
||||
if (Objects.equals(dictCode, DicDataEnum.CONNECT_DEV.getCode())){
|
||||
List<DevModInfoDto> list = modelDto.getDevMod();
|
||||
list.forEach(item->{
|
||||
DictData dicData = dicDataFeignClient.getDicDataByCode(item.getDevType()).getData();
|
||||
CsDevModelQueryListParm csDevModelQueryListParm = new CsDevModelQueryListParm();
|
||||
if (Objects.isNull(dicData)) {
|
||||
log.info("新增模板失败,获取装置类型字典数据为空,请先录入装置类型!");
|
||||
log.info(AccessResponseEnum.DEV_TYPE_NOT_FIND.getMessage());
|
||||
return;
|
||||
} else {
|
||||
csDevModelQueryListParm.setDevType(dicData.getId());
|
||||
@@ -105,20 +168,67 @@ public class MqttMessageHandler {
|
||||
csDevModelQueryListParm.setVersionDate(item.getVersionDate());
|
||||
CsDevModelPageVO csDevModelPageVO = devModelFeignClient.queryDevModelOne(csDevModelQueryListParm).getData();
|
||||
if (Objects.isNull(csDevModelPageVO)){
|
||||
log.info("模板不存在,请先录入模板数据!");
|
||||
log.info(AccessResponseEnum.MODEL_NO_FIND.getMessage());
|
||||
} else {
|
||||
equipmentFeignClient.updateStatusBynDid(nDid, AccessStatusEnum.ACCESS.getCode());
|
||||
//todo 录入装置和模板的关系表
|
||||
|
||||
|
||||
ReqAndResParam.Req reqAndResParam = new ReqAndResParam.Req();
|
||||
reqAndResParam.setMid(1);
|
||||
reqAndResParam.setDid("0");
|
||||
reqAndResParam.setPri(AccessEnum.FIRST_CHANNEL.getCode());
|
||||
reqAndResParam.setType(TypeEnum.TYPE_5.getCode());
|
||||
reqAndResParam.setExpire(-1);
|
||||
publisher.send("/Pfm/DevCmd/"+version+"/"+nDid,new Gson().toJson(reqAndResParam),1,false);
|
||||
//将装置状态改为接入
|
||||
equipmentFeignClient.updateStatusBynDid(nDid, AccessEnum.ACCESS.getCode());
|
||||
//设置心跳时间,超时改为掉线
|
||||
redisUtil.saveByKeyWithExpire("MQTT:" + nDid,Instant.now().toEpochMilli(),180L);
|
||||
}
|
||||
});
|
||||
} else if (Objects.equals(devType,"网关")){
|
||||
}
|
||||
//网关处理 生成报文下发给装置,装置响应版本
|
||||
else if (Objects.equals(dictCode, DicDataEnum.GATEWAY_DEV.getCode())){
|
||||
//todo 处理待定
|
||||
System.out.println("网关设备判断");
|
||||
}
|
||||
} else {
|
||||
log.info("通过nDid未找到相关装置信息!");
|
||||
log.info(AccessResponseEnum.DEV_NO_FIND.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 装置心跳
|
||||
* @param topic
|
||||
* @param message
|
||||
* @param version
|
||||
* @param nDid
|
||||
* @param payload
|
||||
*/
|
||||
@MqttSubscribe(value = "/Dev/PfmCmd/{version}/{edgeId}",qos = 1)
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void devHeartBeat(String topic, MqttMessage message, @NamedValue("version") String version, @NamedValue("edgeId") String nDid, @Payload String payload) {
|
||||
//响应请求
|
||||
ReqAndResParam.Req reqAndResParam = new ReqAndResParam.Req();
|
||||
HeartBeatDto heartBeatDto = new HeartBeatDto();
|
||||
heartBeatDto.setTime(System.currentTimeMillis()/1000);
|
||||
reqAndResParam.setMid(1);
|
||||
reqAndResParam.setDid("0");
|
||||
reqAndResParam.setPri(AccessEnum.FIRST_CHANNEL.getCode());
|
||||
reqAndResParam.setType(TypeEnum.TYPE_14.getCode());
|
||||
reqAndResParam.setExpire(-1);
|
||||
reqAndResParam.setMsg(heartBeatDto);
|
||||
publisher.send("/Dev/PfmRsp/"+version+"/"+nDid,PubUtils.obj2json(reqAndResParam),1,false);
|
||||
//处理业务逻辑
|
||||
ReqAndResParam.Res res = PubUtils.json2obj(new String(message.getPayload(), StandardCharsets.UTF_8), ReqAndResParam.Res.class);
|
||||
Object object = res.getMsg();
|
||||
if (!Objects.isNull(object)){
|
||||
List<String> abnormalList = new ArrayList<>();
|
||||
if (object instanceof ArrayList<?>){
|
||||
abnormalList.addAll((List<String>) object);
|
||||
}
|
||||
//todo 需要处理异常异常设备
|
||||
abnormalList.forEach(item->{
|
||||
System.out.println("异常设备ID:"+item);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
package com.njcn.access.listener;
|
||||
|
||||
import com.alibaba.nacos.shaded.com.google.gson.Gson;
|
||||
import com.github.tocrhz.mqtt.publisher.MqttPublisher;
|
||||
import com.njcn.redis.utils.RedisUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.data.redis.connection.Message;
|
||||
import org.springframework.data.redis.listener.KeyExpirationEventMessageListener;
|
||||
import org.springframework.data.redis.listener.RedisMessageListenerContainer;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* @author hongawen
|
||||
* @version 1.0.0
|
||||
* @date 2022年04月02日 14:31
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class RedisKeyExpirationListener extends KeyExpirationEventMessageListener {
|
||||
|
||||
@Resource
|
||||
private RedisUtil redisUtil;
|
||||
|
||||
@Resource
|
||||
private MqttPublisher publisher;
|
||||
|
||||
public RedisKeyExpirationListener(RedisMessageListenerContainer listenerContainer) {
|
||||
super(listenerContainer);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 针对redis数据失效事件,进行数据处理
|
||||
* 注意message.toString()可以获取失效的key
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
public void onMessage(Message message, byte[] pattern) {
|
||||
if (StringUtils.isBlank(message.toString())) {
|
||||
return;
|
||||
}
|
||||
//判断失效的key是否为MQTT消费端存入的
|
||||
String expiredKey = message.toString();
|
||||
if(expiredKey.startsWith("MQTT:")){
|
||||
Gson gson = new Gson();
|
||||
String ndid = expiredKey.split(":")[1];
|
||||
//网关下线
|
||||
// netDevService.offlineNetDev(ndid);
|
||||
String result = (String) redisUtil.getObjectByKey(ndid);
|
||||
//装置下线
|
||||
// List<String> list = modelService.monitorHeartbeat(ndid,result);
|
||||
//生成通知报文
|
||||
// DeviceOperateDTO deviceOperateDTO = new DeviceOperateDTO();
|
||||
// deviceOperateDTO.setNdid(ndid);
|
||||
// deviceOperateDTO.setDid(list);
|
||||
// deviceOperateDTO.setTime(Long.toString(System.currentTimeMillis()/1000));
|
||||
// deviceOperateDTO.setMessage("装置下线");
|
||||
// deviceOperateDTO.setType("005");
|
||||
// publisher.send("/device/platform",gson.toJson(deviceOperateDTO),1,false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.njcn.access.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.njcn.access.pojo.po.CsBmdPO;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author xuyang
|
||||
* @since 2023-05-11
|
||||
*/
|
||||
public interface CsBmdMapper extends BaseMapper<CsBmdPO> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.njcn.access.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.njcn.access.pojo.po.CsEpdPqdPO;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author xuyang
|
||||
* @since 2023-05-11
|
||||
*/
|
||||
public interface CsEpdPqdMapper extends BaseMapper<CsEpdPqdPO> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.njcn.access.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.njcn.access.pojo.po.CsTopicPO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author xuyang
|
||||
* @since 2023-05-12
|
||||
*/
|
||||
@Mapper
|
||||
public interface CsTopicMapper extends BaseMapper<CsTopicPO> {
|
||||
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
<?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.njcn.quality.mapper.DataGroupMapper">
|
||||
|
||||
|
||||
<select id="getGroupDataList" resultType="DataGroupTemplateVO">
|
||||
select id,pid,name,sort,1 as level from ele_data_group
|
||||
where pid = #{id}
|
||||
order by sort
|
||||
</select>
|
||||
|
||||
<select id="getGroupList" resultType="DataGroupTemplateVO">
|
||||
select id,pid,name,sort from ele_data_group
|
||||
where pid = #{id}
|
||||
order by sort
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.njcn.access.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.access.pojo.po.CsBmdPO;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author xuyang
|
||||
* @since 2023-05-11
|
||||
*/
|
||||
public interface ICsBmdService extends IService<CsBmdPO> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.njcn.access.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.access.pojo.po.CsEpdPqdPO;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author xuyang
|
||||
* @since 2023-05-11
|
||||
*/
|
||||
public interface ICsEpdPqdService extends IService<CsEpdPqdPO> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.njcn.access.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.access.pojo.po.CsTopicPO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author xuyang
|
||||
* @since 2023-05-12
|
||||
*/
|
||||
public interface ICsTopicService {
|
||||
|
||||
void askDevTopic(String nDid);
|
||||
|
||||
boolean addList(List<CsTopicPO> list);
|
||||
|
||||
}
|
||||
@@ -1,19 +1,19 @@
|
||||
package com.njcn.access.service.serviceImpl;
|
||||
|
||||
import com.alibaba.nacos.shaded.com.google.gson.Gson;
|
||||
import com.github.tocrhz.mqtt.publisher.MqttPublisher;
|
||||
import com.njcn.access.enums.AccessEnum;
|
||||
import com.njcn.access.enums.TypeEnum;
|
||||
import com.njcn.access.pojo.dto.AccessDto;
|
||||
import com.njcn.access.pojo.dto.PublicDto;
|
||||
import com.njcn.access.pojo.param.ReqAndResParam;
|
||||
import com.njcn.access.service.IAccessService;
|
||||
import com.njcn.algorithm.api.EquipmentFeignClient;
|
||||
import com.njcn.algorithm.pojo.vo.CsEquipmentDeliveryVO;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.PubUtils;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
@@ -40,15 +40,16 @@ public class AccessServiceImpl implements IAccessService {
|
||||
logger.error("平台侧无此网关信息,请先录入!");
|
||||
return;
|
||||
}
|
||||
PublicDto publicDto = new PublicDto();
|
||||
publicDto.setMid(Long.toString(Instant.now().toEpochMilli()));
|
||||
publicDto.setNDid(nDid);
|
||||
publicDto.setTimestamp(Instant.now().toEpochMilli());
|
||||
publicDto.setType("CMD_DEV_REGISTER");
|
||||
ReqAndResParam.Req reqAndResParam = new ReqAndResParam.Req();
|
||||
reqAndResParam.setMid(1);
|
||||
reqAndResParam.setDid("0");
|
||||
reqAndResParam.setPri(AccessEnum.FIRST_CHANNEL.getCode());
|
||||
reqAndResParam.setType(TypeEnum.TYPE_2.getCode());
|
||||
reqAndResParam.setExpire(-1);
|
||||
AccessDto accessDto = new AccessDto();
|
||||
accessDto.setNDid(nDid);
|
||||
accessDto.setDevType(vo.getDevModel());
|
||||
publicDto.setParam(accessDto);
|
||||
publisher.send("/platform/register/"+nDid,new Gson().toJson(publicDto),1,false);
|
||||
reqAndResParam.setMsg(accessDto);
|
||||
publisher.send("/platform/register/"+nDid, PubUtils.obj2json(reqAndResParam),1,false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.njcn.access.service.serviceImpl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.access.mapper.CsBmdMapper;
|
||||
import com.njcn.access.pojo.po.CsBmdPO;
|
||||
import com.njcn.access.service.ICsBmdService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author xuyang
|
||||
* @since 2023-05-11
|
||||
*/
|
||||
@Service
|
||||
public class CsBmdServiceImpl extends ServiceImpl<CsBmdMapper, CsBmdPO> implements ICsBmdService {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.njcn.access.service.serviceImpl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.access.mapper.CsEpdPqdMapper;
|
||||
import com.njcn.access.pojo.po.CsEpdPqdPO;
|
||||
import com.njcn.access.service.ICsEpdPqdService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author xuyang
|
||||
* @since 2023-05-11
|
||||
*/
|
||||
@Service
|
||||
public class CsEpdPqdServiceImpl extends ServiceImpl<CsEpdPqdMapper, CsEpdPqdPO> implements ICsEpdPqdService {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.njcn.access.service.serviceImpl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.github.tocrhz.mqtt.publisher.MqttPublisher;
|
||||
import com.njcn.access.enums.AccessEnum;
|
||||
import com.njcn.access.enums.TypeEnum;
|
||||
import com.njcn.access.mapper.CsTopicMapper;
|
||||
import com.njcn.access.pojo.param.ReqAndResParam;
|
||||
import com.njcn.access.pojo.po.CsTopicPO;
|
||||
import com.njcn.access.service.ICsTopicService;
|
||||
import com.njcn.algorithm.api.EquipmentFeignClient;
|
||||
import com.njcn.algorithm.pojo.vo.CsEquipmentDeliveryVO;
|
||||
import com.njcn.common.utils.PubUtils;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author xuyang
|
||||
* @since 2023-05-12
|
||||
*/
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class CsTopicServiceImpl extends ServiceImpl<CsTopicMapper, CsTopicPO> implements ICsTopicService {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(CsTopicServiceImpl.class);
|
||||
|
||||
private final MqttPublisher publisher;
|
||||
|
||||
private final EquipmentFeignClient equipmentFeignClient;
|
||||
|
||||
@Override
|
||||
public void askDevTopic(String nDid) {
|
||||
CsEquipmentDeliveryVO vo = equipmentFeignClient.queryEquipmentByndid(nDid).getData();
|
||||
if (Objects.isNull(vo)){
|
||||
logger.error("平台侧无此网关信息,请先录入!");
|
||||
return;
|
||||
}
|
||||
ReqAndResParam.Req reqAndResParam = new ReqAndResParam.Req();
|
||||
reqAndResParam.setMid(1);
|
||||
reqAndResParam.setDid("0");
|
||||
reqAndResParam.setPri(AccessEnum.FIRST_CHANNEL.getCode());
|
||||
reqAndResParam.setType(TypeEnum.TYPE_1.getCode());
|
||||
reqAndResParam.setExpire(-1);
|
||||
reqAndResParam.setMsg(null);
|
||||
publisher.send("/Pfm/Topic/"+nDid, PubUtils.obj2json(reqAndResParam),1,false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addList(List<CsTopicPO> list) {
|
||||
return this.saveOrUpdateBatch(list,100);
|
||||
}
|
||||
}
|
||||
@@ -53,75 +53,77 @@ public class DevModelServiceImpl implements IDevModelService {
|
||||
String json = null;
|
||||
try {
|
||||
json = JsonUtil.convertStreamToString(devModelParam.getFile().getInputStream());
|
||||
|
||||
Gson gson = new Gson();
|
||||
TemplateDto templateDto = gson.fromJson(json, TemplateDto.class);
|
||||
ParamDto pojo = templateDto.getParam();
|
||||
//网关模板
|
||||
NetDevModDto po1 = pojo.getDataArray().get(0).getTemplate().getNetDevModDto();
|
||||
//装置信息模板
|
||||
DevCfgDetailDto po2 = pojo.getDataArray().get(0).getTemplate().getDevCfgDetailDto();
|
||||
//装置数据模板
|
||||
List<DevModDetailDto> po3 = pojo.getDataArray().get(0).getTemplate().getDevModDetailDto();
|
||||
|
||||
String name = po3.get(0).getName();
|
||||
String version = po3.get(0).getVersion();
|
||||
String time = po3.get(0).getTime();
|
||||
String devType = po3.get(0).getDevType();
|
||||
String devTypeId = "";
|
||||
|
||||
DictData dicData = dicDataFeignClient.getDicDataByCode(devType).getData();
|
||||
if (Objects.isNull(dicData)) {
|
||||
log.info("新增模板失败,获取装置类型字典数据为空,请先录入装置类型!");
|
||||
return HttpResultUtil.assembleResult(CommonResponseEnum.NO_DATA.getCode(), null, "获取装置类型字典数据为空!");
|
||||
} else {
|
||||
devTypeId = dicData.getId();
|
||||
}
|
||||
CsDevModelQueryListParm csDevModelQueryListParm = new CsDevModelQueryListParm();
|
||||
csDevModelQueryListParm.setDevType(devTypeId);
|
||||
csDevModelQueryListParm.setVersionNo(version);
|
||||
csDevModelQueryListParm.setVersionDate(time);
|
||||
csDevModelQueryListParm.setName(name);
|
||||
CsDevModelPageVO vo = devModelFeignClient.queryDevModelOne(csDevModelQueryListParm).getData();
|
||||
if (!Objects.isNull(vo)){
|
||||
log.info("新增模板失败,新增的模板在库中存在!");
|
||||
return HttpResultUtil.assembleResult(AccessResponseEnum.MODEL_REPEAT.getCode(), null, AccessResponseEnum.MODEL_REPEAT.getMessage());
|
||||
} else {
|
||||
CsDevModelAddParm csDevModelAddParm = new CsDevModelAddParm();
|
||||
csDevModelAddParm.setName(name);
|
||||
csDevModelAddParm.setDevType(devTypeId);
|
||||
csDevModelAddParm.setVersionNo(version);
|
||||
csDevModelAddParm.setVersionDate(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(time));
|
||||
String filePath = fileStorageUtil.uploadMultipart(devModelParam.getFile(), OssPath.DEV_MODEL + devModelParam.getDevType() + "_");
|
||||
log.info("文件路径为:" + filePath);
|
||||
csDevModelAddParm.setFilePath(filePath);
|
||||
//新增cs_dev_model表数据
|
||||
CsDevModelPO csDevModelPO = devModelFeignClient.addDevModel(csDevModelAddParm).getData();
|
||||
//新增cs_data_set
|
||||
|
||||
//新增cs_data_array
|
||||
|
||||
}
|
||||
// ParamDto pojo = templateDto.getParam();
|
||||
// //网关模板
|
||||
// NetDevModDto po1 = pojo.getDataArray().get(0).getTemplate().getNetDevModDto();
|
||||
// //装置信息模板
|
||||
// DevCfgDetailDto po2 = pojo.getDataArray().get(0).getTemplate().getDevCfgDetailDto();
|
||||
// //装置数据模板
|
||||
// List<DevModDetailDto> po3 = pojo.getDataArray().get(0).getTemplate().getDevModDetailDto();
|
||||
//
|
||||
// String name = po3.get(0).getName();
|
||||
// String version = po3.get(0).getVersion();
|
||||
// String time = po3.get(0).getTime();
|
||||
// String devType = po3.get(0).getDevType();
|
||||
// String devTypeId = "";
|
||||
//
|
||||
// DictData dicData = dicDataFeignClient.getDicDataByCode(devType).getData();
|
||||
// if (Objects.isNull(dicData)) {
|
||||
// log.info("新增模板失败,获取装置类型字典数据为空,请先录入装置类型!");
|
||||
// return HttpResultUtil.assembleResult(CommonResponseEnum.NO_DATA.getCode(), null, "获取装置类型字典数据为空!");
|
||||
// } else {
|
||||
// devTypeId = dicData.getId();
|
||||
// }
|
||||
// CsDevModelQueryListParm csDevModelQueryListParm = new CsDevModelQueryListParm();
|
||||
// csDevModelQueryListParm.setDevType(devTypeId);
|
||||
// csDevModelQueryListParm.setVersionNo(version);
|
||||
// csDevModelQueryListParm.setVersionDate(time);
|
||||
// csDevModelQueryListParm.setName(name);
|
||||
// CsDevModelPageVO vo = devModelFeignClient.queryDevModelOne(csDevModelQueryListParm).getData();
|
||||
// if (!Objects.isNull(vo)){
|
||||
// log.info("新增模板失败,新增的模板在库中存在!");
|
||||
// return HttpResultUtil.assembleResult(AccessResponseEnum.MODEL_REPEAT.getCode(), null, AccessResponseEnum.MODEL_REPEAT.getMessage());
|
||||
// } else {
|
||||
// CsDevModelAddParm csDevModelAddParm = new CsDevModelAddParm();
|
||||
// csDevModelAddParm.setName(name);
|
||||
// csDevModelAddParm.setDevType(devTypeId);
|
||||
// csDevModelAddParm.setVersionNo(version);
|
||||
// csDevModelAddParm.setVersionDate(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(time));
|
||||
// String filePath = fileStorageUtil.uploadMultipart(devModelParam.getFile(), OssPath.DEV_MODEL + devModelParam.getDevType() + "_");
|
||||
// log.info("文件路径为:" + filePath);
|
||||
// csDevModelAddParm.setFilePath(filePath);
|
||||
// //新增cs_dev_model表数据
|
||||
// CsDevModelPO csDevModelPO = devModelFeignClient.addDevModel(csDevModelAddParm).getData();
|
||||
// //新增cs_data_set
|
||||
//
|
||||
// //新增cs_data_array
|
||||
//
|
||||
// }
|
||||
} catch (IOException e) {
|
||||
log.error("文件转成json出现异常");
|
||||
e.getMessage();
|
||||
} catch (ParseException e) {
|
||||
log.error("时间转换出现异常");
|
||||
e.getMessage();
|
||||
}
|
||||
// catch (ParseException e) {
|
||||
// log.error("时间转换出现异常");
|
||||
// e.getMessage();
|
||||
// }
|
||||
return HttpResultUtil.assembleResult(CommonResponseEnum.SUCCESS.getCode(), null, CommonResponseEnum.SUCCESS.getMessage());
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增cs_data_set
|
||||
*/
|
||||
public void insertDataSet(List<DataSetDTO> dataSet,String id){
|
||||
dataSet.forEach(item->{
|
||||
DataSetDTO dataSetDTO = new DataSetDTO();
|
||||
|
||||
|
||||
|
||||
});
|
||||
}
|
||||
// public void insertDataSet(List<DataSetDTO> dataSet,String id){
|
||||
// dataSet.forEach(item->{
|
||||
// DataSetDTO dataSetDTO = new DataSetDTO();
|
||||
//
|
||||
//
|
||||
//
|
||||
// });
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
@@ -33,6 +33,8 @@ spring:
|
||||
refresh: true
|
||||
- data-Id: share-config-datasource-db.yaml
|
||||
refresh: true
|
||||
- data-Id: kafka-config.yaml
|
||||
refresh: true
|
||||
main:
|
||||
allow-bean-definition-overriding: true
|
||||
|
||||
|
||||
@@ -33,6 +33,27 @@
|
||||
<version>4.11</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<!-- mybatis-plus -->
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-boot-starter</artifactId>
|
||||
<version>${mybatis-plus.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-generator</artifactId>
|
||||
<version>${mybatis-plus-generator.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.jeffreyning</groupId>
|
||||
<artifactId>mybatisplus-plus</artifactId>
|
||||
<version>${mybatis-plus.jeffreyning.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.velocity</groupId>
|
||||
<artifactId>velocity-engine-core</artifactId>
|
||||
<version>${velocity.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
||||
@@ -2,20 +2,21 @@
|
||||
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>iot-analysis</artifactId>
|
||||
<groupId>com.njcn</groupId>
|
||||
<version>1.0.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>com.njcn</groupId>
|
||||
<artifactId>analysis-api</artifactId>
|
||||
<version>1.0.0</version>
|
||||
|
||||
<name>analysis-api</name>
|
||||
<!-- FIXME change it to the project's website -->
|
||||
<url>http://www.example.com</url>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<maven.compiler.source>1.7</maven.compiler.source>
|
||||
<maven.compiler.target>1.7</maven.compiler.target>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
<maven.compiler.target>8</maven.compiler.target>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
@@ -26,50 +27,4 @@
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) -->
|
||||
<plugins>
|
||||
<!-- clean lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#clean_Lifecycle -->
|
||||
<plugin>
|
||||
<artifactId>maven-clean-plugin</artifactId>
|
||||
<version>3.1.0</version>
|
||||
</plugin>
|
||||
<!-- default lifecycle, jar packaging: see https://maven.apache.org/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_jar_packaging -->
|
||||
<plugin>
|
||||
<artifactId>maven-resources-plugin</artifactId>
|
||||
<version>3.0.2</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.8.0</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>2.22.1</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>3.0.2</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-install-plugin</artifactId>
|
||||
<version>2.5.2</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-deploy-plugin</artifactId>
|
||||
<version>2.8.2</version>
|
||||
</plugin>
|
||||
<!-- site lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#site_Lifecycle -->
|
||||
<plugin>
|
||||
<artifactId>maven-site-plugin</artifactId>
|
||||
<version>3.7.1</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-project-info-reports-plugin</artifactId>
|
||||
<version>3.0.0</version>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</pluginManagement>
|
||||
</build>
|
||||
</project>
|
||||
|
||||
Reference in New Issue
Block a user