第一次提交
This commit is contained in:
@ -0,0 +1,20 @@
|
||||
package com.fastbee.common.enums;
|
||||
|
||||
/**
|
||||
* 操作状态
|
||||
*
|
||||
* @author ruoyi
|
||||
*
|
||||
*/
|
||||
public enum BusinessStatus
|
||||
{
|
||||
/**
|
||||
* 成功
|
||||
*/
|
||||
SUCCESS,
|
||||
|
||||
/**
|
||||
* 失败
|
||||
*/
|
||||
FAIL,
|
||||
}
|
@ -0,0 +1,59 @@
|
||||
package com.fastbee.common.enums;
|
||||
|
||||
/**
|
||||
* 业务操作类型
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public enum BusinessType
|
||||
{
|
||||
/**
|
||||
* 其它
|
||||
*/
|
||||
OTHER,
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
INSERT,
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*/
|
||||
UPDATE,
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
DELETE,
|
||||
|
||||
/**
|
||||
* 授权
|
||||
*/
|
||||
GRANT,
|
||||
|
||||
/**
|
||||
* 导出
|
||||
*/
|
||||
EXPORT,
|
||||
|
||||
/**
|
||||
* 导入
|
||||
*/
|
||||
IMPORT,
|
||||
|
||||
/**
|
||||
* 强退
|
||||
*/
|
||||
FORCE,
|
||||
|
||||
/**
|
||||
* 生成代码
|
||||
*/
|
||||
GENCODE,
|
||||
|
||||
/**
|
||||
* 清空数据
|
||||
*/
|
||||
CLEAN,
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
package com.fastbee.common.enums;
|
||||
|
||||
import com.fastbee.common.core.text.IntArrayValuable;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* 通用状态枚举
|
||||
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum CommonStatusEnum implements IntArrayValuable {
|
||||
|
||||
ENABLE(0, "开启"),
|
||||
DISABLE(1, "关闭");
|
||||
|
||||
public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(CommonStatusEnum::getStatus).toArray();
|
||||
|
||||
/**
|
||||
* 状态值
|
||||
*/
|
||||
private final Integer status;
|
||||
/**
|
||||
* 状态名
|
||||
*/
|
||||
private final String name;
|
||||
|
||||
@Override
|
||||
public int[] array() {
|
||||
return ARRAYS;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
package com.fastbee.common.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @author gsb
|
||||
* @date 2023/6/3 14:09
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum DataEnum {
|
||||
|
||||
DECIMAL("decimal", "十进制"),
|
||||
DOUBLE("double", "双精度"),
|
||||
ENUM("enum","枚举"),
|
||||
BOOLEAN("bool","布尔类型"),
|
||||
INTEGER("integer","整形"),
|
||||
OBJECT("object", "对象"),
|
||||
STRING("string","字符串"),
|
||||
ARRAY("array","数组");
|
||||
|
||||
String type;
|
||||
String msg;
|
||||
|
||||
public static DataEnum convert(String type){
|
||||
for (DataEnum value : DataEnum.values()) {
|
||||
if (Objects.equals(value.type, type)){
|
||||
return value;
|
||||
}
|
||||
}
|
||||
return DataEnum.STRING;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
package com.fastbee.common.enums;
|
||||
|
||||
/**
|
||||
* 数据源
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public enum DataSourceType
|
||||
{
|
||||
/**
|
||||
* 主库
|
||||
*/
|
||||
MASTER,
|
||||
|
||||
/**
|
||||
* 从库
|
||||
*/
|
||||
SLAVE
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
package com.fastbee.common.enums;
|
||||
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @description:
|
||||
* @author admin
|
||||
* @date 2024-07-18 14:52
|
||||
* @version 1.0
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum DeviceDistributeTypeEnum {
|
||||
|
||||
/**
|
||||
* 确保唯一,不能重复
|
||||
*/
|
||||
SELECT(1, "选择分配"),
|
||||
IMPORT(2,"导入分配");
|
||||
|
||||
/**
|
||||
* 渠道类型
|
||||
*/
|
||||
private Integer type;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private String desc;
|
||||
|
||||
public static String getDesc(Integer type) {
|
||||
for (DeviceDistributeTypeEnum item : DeviceDistributeTypeEnum.values()) {
|
||||
if (item.getType().equals(type)) {
|
||||
return item.getDesc();
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
package com.fastbee.common.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 场景管理物模型、变量类型枚举
|
||||
* 注意:以下4张表下的variable_type相关字段统一用该枚举,保持一致
|
||||
* scene_model_tag表、scene_tag_points表、scene_model_device表、scene_model_data表
|
||||
* @author fastb
|
||||
* @date 2024-05-22 10:01
|
||||
* @version 1.0
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum DeviceLogTypeEnum {
|
||||
|
||||
ATTRIBUTE_REPORT(1, "属性上报"),
|
||||
INVOKE_FUNCTION(2, "调用功能"),
|
||||
EVENT_REPORT(3, "事件上报"),
|
||||
DEVICE_UPDATE(4, "设备升级"),
|
||||
DEVICE_ONLINE(5, "设备上线"),
|
||||
DEVICE_OFFLINE(6, "设备离线"),
|
||||
SCENE_VARIABLE_REPORT(7, "场景录入、运算变量上报下发");
|
||||
|
||||
private final Integer type;
|
||||
|
||||
private final String desc;
|
||||
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
package com.fastbee.common.enums;
|
||||
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @description:
|
||||
* @author admin
|
||||
* @date 2024-07-18 14:52
|
||||
* @version 1.0
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum DeviceRecordTypeEnum {
|
||||
|
||||
/**
|
||||
* 确保唯一,不能重复
|
||||
*/
|
||||
IMPORT(1, "导入记录"),
|
||||
RECOVERY(2,"回收记录"),
|
||||
ASSIGNMENT(3,"分配记录"),
|
||||
ASSIGNMENT_DETAIL(4,"分配详细记录");
|
||||
|
||||
|
||||
/**
|
||||
* 渠道类型
|
||||
*/
|
||||
private Integer type;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private String desc;
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
package com.fastbee.common.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum DeviceStatus {
|
||||
|
||||
UNACTIVATED(1,"NOTACTIVE","未激活"),
|
||||
FORBIDDEN(2,"DISABLE","禁用"),
|
||||
ONLINE(3,"ONLINE","在线"),
|
||||
OFFLINE(4,"OFFLINE","离线");
|
||||
|
||||
private int type;
|
||||
private String code;
|
||||
private String description;
|
||||
|
||||
public static DeviceStatus convert(int type){
|
||||
for (DeviceStatus value : DeviceStatus.values()) {
|
||||
if (value.type == type){
|
||||
return value;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static DeviceStatus convert(String code){
|
||||
for (DeviceStatus value : DeviceStatus.values()) {
|
||||
if (value.code.equals(code)){
|
||||
return value;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package com.fastbee.common.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @author gsb
|
||||
* @date 2022/11/3 11:05
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum ExceptionCode {
|
||||
|
||||
SUCCESS(200,"成功"),
|
||||
TIMEOUT(400,"超时"),
|
||||
OFFLINE(404,"设备断线"),
|
||||
FAIL(500,"失败");
|
||||
;
|
||||
|
||||
public int code;
|
||||
public String desc;
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
package com.fastbee.common.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 设备回调状态
|
||||
* @author bill
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum FunctionReplyStatus {
|
||||
SUCCESS(200,"设备执行成功"),
|
||||
FAIl(201,"指令执行失败"),
|
||||
UNKNOWN(204,"设备超时未回复"),
|
||||
NORELY(203, "指令下发成功");
|
||||
|
||||
int code;
|
||||
String message;
|
||||
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
package com.fastbee.common.enums;
|
||||
|
||||
|
||||
import com.fastbee.common.exception.ErrorCode;
|
||||
|
||||
/**
|
||||
* 全局错误码枚举
|
||||
* 0-999 系统异常编码保留
|
||||
*
|
||||
* 一般情况下,使用 HTTP 响应状态码 https://developer.mozilla.org/zh-CN/docs/Web/HTTP/Status
|
||||
* 虽然说,HTTP 响应状态码作为业务使用表达能力偏弱,但是使用在系统层面还是非常不错的
|
||||
* 比较特殊的是,因为之前一直使用 0 作为成功,就不使用 200 啦。
|
||||
*
|
||||
* @author fastbee
|
||||
*/
|
||||
public interface GlobalErrorCodeConstants {
|
||||
|
||||
ErrorCode SUCCESS = new ErrorCode(0, "成功");
|
||||
|
||||
// ========== 客户端错误段 ==========
|
||||
|
||||
ErrorCode BAD_REQUEST = new ErrorCode(400, "请求参数不正确");
|
||||
ErrorCode UNAUTHORIZED = new ErrorCode(401, "账号未登录");
|
||||
ErrorCode FORBIDDEN = new ErrorCode(403, "没有该操作权限");
|
||||
ErrorCode NOT_FOUND = new ErrorCode(404, "请求未找到");
|
||||
ErrorCode METHOD_NOT_ALLOWED = new ErrorCode(405, "请求方法不正确");
|
||||
ErrorCode LOCKED = new ErrorCode(423, "请求失败,请稍后重试"); // 并发请求,不允许
|
||||
ErrorCode TOO_MANY_REQUESTS = new ErrorCode(429, "请求过于频繁,请稍后重试");
|
||||
|
||||
// ========== 服务端错误段 ==========
|
||||
|
||||
ErrorCode INTERNAL_SERVER_ERROR = new ErrorCode(500, "系统异常");
|
||||
ErrorCode NOT_IMPLEMENTED = new ErrorCode(501, "功能未实现/未开启");
|
||||
|
||||
// ========== 自定义错误段 ==========
|
||||
ErrorCode REPEATED_REQUESTS = new ErrorCode(900, "重复请求,请稍后重试"); // 重复请求
|
||||
ErrorCode DEMO_DENY = new ErrorCode(901, "演示模式,禁止写操作");
|
||||
|
||||
ErrorCode UNKNOWN = new ErrorCode(999, "未知错误");
|
||||
|
||||
/**
|
||||
* 是否为服务端错误,参考 HTTP 5XX 错误码段
|
||||
*
|
||||
* @param code 错误码
|
||||
* @return 是否
|
||||
*/
|
||||
static boolean isServerErrorCode(Integer code) {
|
||||
return code != null
|
||||
&& code >= INTERNAL_SERVER_ERROR.getCode() && code <= INTERNAL_SERVER_ERROR.getCode() + 99;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
package com.fastbee.common.enums;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* 请求方式
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public enum HttpMethod
|
||||
{
|
||||
GET, HEAD, POST, PUT, PATCH, DELETE, OPTIONS, TRACE;
|
||||
|
||||
private static final Map<String, HttpMethod> mappings = new HashMap<>(16);
|
||||
|
||||
static
|
||||
{
|
||||
for (HttpMethod httpMethod : values())
|
||||
{
|
||||
mappings.put(httpMethod.name(), httpMethod);
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static HttpMethod resolve(@Nullable String method)
|
||||
{
|
||||
return (method != null ? mappings.get(method) : null);
|
||||
}
|
||||
|
||||
public boolean matches(String method)
|
||||
{
|
||||
return (this == resolve(method));
|
||||
}
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package com.fastbee.common.enums;
|
||||
|
||||
/**
|
||||
* 常用API返回对象接口
|
||||
*/
|
||||
public interface IErrorCode {
|
||||
|
||||
/**返回码*/
|
||||
int getCode();
|
||||
|
||||
/**返回信息*/
|
||||
String getMessage();
|
||||
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
package com.fastbee.common.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum JobType {
|
||||
//1==设备定时,2=设备告警,3=场景联动 4=规则引擎
|
||||
Device(1),
|
||||
DeviceAlert(2),
|
||||
Scene(3),
|
||||
RuleEngine(4);
|
||||
private final Integer value;
|
||||
|
||||
public static JobType fromValue(Integer value) {
|
||||
for (JobType type : JobType.values()) {
|
||||
if (Objects.equals(type.getValue(), value)) {
|
||||
return type;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static String getName(Integer value) {
|
||||
for (JobType type : JobType.values()) {
|
||||
if (Objects.equals(type.getValue(), value)) {
|
||||
return type.name();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
package com.fastbee.common.enums;
|
||||
|
||||
/**
|
||||
* 限流类型
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
|
||||
public enum LimitType
|
||||
{
|
||||
/**
|
||||
* 默认策略全局限流
|
||||
*/
|
||||
DEFAULT,
|
||||
|
||||
/**
|
||||
* 根据请求者IP进行限流
|
||||
*/
|
||||
IP
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
package com.fastbee.common.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @author gsb
|
||||
* @date 2023/9/4 14:46
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum ModbusDataType {
|
||||
|
||||
|
||||
U_SHORT("ushort","16位 无符号"),
|
||||
SHORT("short","16位 有符号"),
|
||||
LONG_ABCD("long-ABCD","32位 有符号(ABCD)"),
|
||||
LONG_CDAB("long-CDAB","32位 有符号(CDAB)"),
|
||||
U_LONG_ABCD("ulong-ABCD","32位 无符号(ABCD)"),
|
||||
U_LONG_CDAB("ulong-CDAB","32位 无符号(CDAB)"),
|
||||
FLOAT_ABCD("float-ABCD","32位 浮点数(ABCD)"),
|
||||
FLOAT_CDAB("float-CDAB","32位 浮点数(CDAB)"),
|
||||
BIT("bit","位");
|
||||
|
||||
String type;
|
||||
String msg;
|
||||
|
||||
public static ModbusDataType convert(String type){
|
||||
for (ModbusDataType value : ModbusDataType.values()) {
|
||||
if (Objects.equals(value.type,type)){
|
||||
return value;
|
||||
}
|
||||
}
|
||||
return ModbusDataType.U_SHORT;
|
||||
}
|
||||
}
|
@ -0,0 +1,46 @@
|
||||
package com.fastbee.common.enums;
|
||||
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @description: 通知渠道枚举
|
||||
* @author fastb
|
||||
* @date 2023-12-16 17:00
|
||||
* @version 1.0
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum NotifyChannelEnum {
|
||||
|
||||
/**
|
||||
* 确保唯一,不能重复
|
||||
*/
|
||||
SMS("sms", "短信"),
|
||||
VOICE("voice","语音"),
|
||||
WECHAT("wechat","微信"),
|
||||
DING_TALK("dingtalk","钉钉"),
|
||||
EMAIL("email", "邮箱");
|
||||
|
||||
|
||||
/**
|
||||
* 渠道类型
|
||||
*/
|
||||
private String type;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private String desc;
|
||||
|
||||
public static NotifyChannelEnum getNotifyChannelEnum(String type) {
|
||||
for (NotifyChannelEnum notifyChannelEnum : NotifyChannelEnum.values()) {
|
||||
if (type.equals(notifyChannelEnum.type)) {
|
||||
return notifyChannelEnum;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,315 @@
|
||||
package com.fastbee.common.enums;
|
||||
|
||||
import com.fastbee.common.core.notify.NotifyConfigVO;
|
||||
import com.fastbee.common.core.notify.config.DingTalkConfigParams;
|
||||
import com.fastbee.common.core.notify.config.EmailConfigParams;
|
||||
import com.fastbee.common.core.notify.config.VoiceConfigParams;
|
||||
import com.fastbee.common.core.notify.config.WeChatConfigParams;
|
||||
import com.fastbee.common.core.notify.msg.*;
|
||||
import com.fastbee.common.utils.StringUtils;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.dromara.sms4j.aliyun.config.AlibabaConfig;
|
||||
import org.dromara.sms4j.cloopen.config.CloopenConfig;
|
||||
import org.dromara.sms4j.ctyun.config.CtyunConfig;
|
||||
import org.dromara.sms4j.emay.config.EmayConfig;
|
||||
import org.dromara.sms4j.huawei.config.HuaweiConfig;
|
||||
import org.dromara.sms4j.jdcloud.config.JdCloudConfig;
|
||||
import org.dromara.sms4j.netease.config.NeteaseConfig;
|
||||
import org.dromara.sms4j.tencent.config.TencentConfig;
|
||||
import org.dromara.sms4j.yunpian.config.YunpianConfig;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author fastb
|
||||
* @version 1.0
|
||||
* @description: 通知渠道枚举
|
||||
* @date 2023-12-18 11:52
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public enum NotifyChannelProviderEnum {
|
||||
|
||||
/**** 短信 ******/
|
||||
SMS_ALIBABA("sms", "alibaba", "阿里云短信", AlibabaConfig.class, AlibabaConfig.class),
|
||||
SMS_TENCENT("sms", "tencent", "腾讯云短信", TencentConfig.class, TencentConfig.class),
|
||||
SMS_CTYUN("sms", "ctyun","天翼云短信", CtyunConfig.class, CtyunConfig.class),
|
||||
SMS_HUAWEI("sms", "huawei", "华为云短信", HuaweiConfig.class, HuaweiConfig.class),
|
||||
SMS_YUNPIAN("sms", "yunpian", "云片短信", YunpianConfig.class, YunpianConfig.class),
|
||||
SMS_EMAY("sms", "emay","亿美软通短信", EmayConfig.class, EmayConfig.class),
|
||||
SMS_CLOOPEN("sms", "cloopen","容连云短信", CloopenConfig.class, CloopenConfig.class),
|
||||
SMS_JDCLOUD("sms", "jdcloud", "京东云短信", JdCloudConfig.class, JdCloudConfig.class),
|
||||
SMS_NETEASE("sms", "netease", "网易云短信", NeteaseConfig.class, NeteaseConfig.class),
|
||||
|
||||
/****** 语音 ******/
|
||||
VOICE_ALIBABA("voice", "alibaba", "阿里云语音", VoiceConfigParams.class, VoiceMsgParams.class),
|
||||
VOICE_TENCENT("voice", "tencent", "腾讯云语音", VoiceMsgParams.class, VoiceMsgParams.class),
|
||||
|
||||
/****** 邮箱 ******/
|
||||
EMAIL_QQ("email", "qq", "QQ邮箱", EmailConfigParams.class, EmailMsgParams.class),
|
||||
EMAIL_163("email", "163", "163邮箱", EmailConfigParams.class, EmailMsgParams.class),
|
||||
|
||||
/****** 微信 *****/
|
||||
WECHAT_MINI_PROGRAM("wechat", "mini_program", "微信小程序(订阅消息)", WeChatConfigParams.class, WechatMsgParams.class),
|
||||
WECHAT_WECOM_APPLY("wechat", "wecom_apply", "企业微信应用消息", WeChatConfigParams.class, WechatMsgParams.class),
|
||||
WECHAT_WECOM_ROBOT("wechat", "wecom_robot", "企业微信群机器人", WeChatConfigParams.class, WechatMsgParams.class),
|
||||
WECHAT_PUBLIC_ACCOUNT("wechat", "public_account", "微信公众号", WeChatConfigParams.class, WechatMsgParams.class),
|
||||
|
||||
/****** 钉钉 *****/
|
||||
DING_TALK_WORK("dingtalk", "work", "钉钉工作消息", DingTalkConfigParams.class, DingTalkMsgParams.class),
|
||||
DING_TALK_GROUP_ROBOT("dingtalk", "group_robot", "钉钉群机器人", DingTalkConfigParams.class, DingTalkMsgParams.class);
|
||||
|
||||
/**
|
||||
* 渠道编码
|
||||
*/
|
||||
private String channelType;
|
||||
|
||||
/**
|
||||
* 渠道编码
|
||||
*/
|
||||
private String provider;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private String desc;
|
||||
|
||||
/**
|
||||
* 渠道配置类
|
||||
*/
|
||||
private Class configContentClass;
|
||||
|
||||
/**
|
||||
* 模板配置类
|
||||
*/
|
||||
private Class msgParamsClass;
|
||||
|
||||
|
||||
public static NotifyChannelProviderEnum getNotifyChannelCodeEnum(String channelCode) {
|
||||
for (NotifyChannelProviderEnum channelCodeEnum : NotifyChannelProviderEnum.values()) {
|
||||
if (channelCode.equals(channelCodeEnum.channelType)) {
|
||||
return channelCodeEnum;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static NotifyChannelProviderEnum getByChannelTypeAndProvider(String channelType, String provider) {
|
||||
for (NotifyChannelProviderEnum channelCodeEnum : NotifyChannelProviderEnum.values()) {
|
||||
if (channelType.equals(channelCodeEnum.channelType) && provider.equals(channelCodeEnum.getProvider())) {
|
||||
return channelCodeEnum;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 获取通知渠道配置信息
|
||||
* @param: type
|
||||
* @return: java.lang.Object
|
||||
*/
|
||||
public static List<NotifyConfigVO> getConfigContent(NotifyChannelProviderEnum type) {
|
||||
List<NotifyConfigVO> configVOList = new ArrayList<>();
|
||||
// 务必保证属性(attribute)参数名和各渠道对应配置类configContentClass里的属性名一致
|
||||
switch (type) {
|
||||
case SMS_ALIBABA:
|
||||
configVOList.add(new NotifyConfigVO("accessKeyId", "accessKeyId", "string", ""));
|
||||
configVOList.add(new NotifyConfigVO("accessKeySecret", "accessKeySecret", "string", ""));
|
||||
break;
|
||||
// return new SmsAliConfigParams();
|
||||
case SMS_TENCENT:
|
||||
configVOList.add(new NotifyConfigVO("accessKeyId", "accessKeyId", "string", ""));
|
||||
configVOList.add(new NotifyConfigVO("accessKeySecret", "accessKeySecret", "string", ""));
|
||||
break;
|
||||
// return new SmsAliConfigParams();
|
||||
// case SMS_CTYUN:
|
||||
// return new SmsAliConfigParams();
|
||||
// case SMS_HUAWEI:
|
||||
// return new SmsAliConfigParams();
|
||||
// case SMS_YUNPIAN:
|
||||
// return new SmsAliConfigParams();
|
||||
// case SMS_EMAY:
|
||||
// return new SmsAliConfigParams();
|
||||
// case SMS_CLOOPEN:
|
||||
// return new SmsAliConfigParams();
|
||||
// case SMS_JDCLOUD:
|
||||
// return new SmsAliConfigParams();
|
||||
// case SMS_NETEASE:
|
||||
// return new SmsAliConfigParams();
|
||||
case VOICE_ALIBABA:
|
||||
case VOICE_TENCENT:
|
||||
configVOList.add(new NotifyConfigVO("accessKeyId", "accessKeyId", "string", ""));
|
||||
configVOList.add(new NotifyConfigVO("accessKeySecret", "accessKeySecret", "string", ""));
|
||||
break;
|
||||
case EMAIL_QQ:
|
||||
case EMAIL_163:
|
||||
if (EMAIL_QQ.equals(type)) {
|
||||
configVOList.add(new NotifyConfigVO("smtpServer", "服务器地址", "string","smtp.qq.com"));
|
||||
}
|
||||
if (EMAIL_163.equals(type)) {
|
||||
configVOList.add(new NotifyConfigVO("smtpServer", "服务器地址", "string","smtp.163.com"));
|
||||
}
|
||||
configVOList.add(new NotifyConfigVO("port", "端口号", "string", "465"));
|
||||
configVOList.add(new NotifyConfigVO("username", "发件人账号", "string", ""));
|
||||
configVOList.add(new NotifyConfigVO("password", "发件秘钥", "string", ""));
|
||||
configVOList.add(new NotifyConfigVO("sslEnable", "是否启动ssl", "boolean", "true"));
|
||||
configVOList.add(new NotifyConfigVO("authEnable", "开启验证", "boolean", "true"));
|
||||
configVOList.add(new NotifyConfigVO("retryInterval", "重试间隔(秒)", "int", "5"));
|
||||
configVOList.add(new NotifyConfigVO("maxRetries", "重试次数", "int","1"));
|
||||
break;
|
||||
case WECHAT_MINI_PROGRAM:
|
||||
case WECHAT_PUBLIC_ACCOUNT:
|
||||
configVOList.add(new NotifyConfigVO("appId", "appId", "string",""));
|
||||
configVOList.add(new NotifyConfigVO("appSecret", "appSecret", "string",""));
|
||||
break;
|
||||
case WECHAT_WECOM_APPLY:
|
||||
configVOList.add(new NotifyConfigVO("corpId", "企业ID", "string",""));
|
||||
configVOList.add(new NotifyConfigVO("corpSecret", "应用Secret", "string",""));
|
||||
configVOList.add(new NotifyConfigVO("agentId", "应用agentId", "string",""));
|
||||
break;
|
||||
case WECHAT_WECOM_ROBOT:
|
||||
configVOList.add(new NotifyConfigVO("webHook", "webHook", "string",""));
|
||||
break;
|
||||
case DING_TALK_WORK:
|
||||
configVOList.add(new NotifyConfigVO("appKey", "appKey", "string",""));
|
||||
configVOList.add(new NotifyConfigVO("appSecret", "appSecret", "string",""));
|
||||
configVOList.add(new NotifyConfigVO("agentId", "agentId", "string",""));
|
||||
break;
|
||||
case DING_TALK_GROUP_ROBOT:
|
||||
configVOList.add(new NotifyConfigVO("webHook", "webHook", "string",""));
|
||||
break;
|
||||
default:
|
||||
return configVOList;
|
||||
}
|
||||
return configVOList;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 获取通知模板配置信息
|
||||
* @param: type
|
||||
* @return: java.lang.Object
|
||||
*/
|
||||
public static List<NotifyConfigVO> getMsgParams(NotifyChannelProviderEnum type, String msgType) {
|
||||
List<NotifyConfigVO> configVOList = new ArrayList<>();
|
||||
switch (type) {
|
||||
// 短信:配置参数来源于sms4j,务必属性字段名和sms4j配置参数字段名一致
|
||||
case SMS_ALIBABA:
|
||||
configVOList.add(new NotifyConfigVO("sendAccount", "发送电话号", "string",""));
|
||||
configVOList.add(new NotifyConfigVO("templateId", "模板CODE", "string",""));
|
||||
configVOList.add(new NotifyConfigVO("signature", "签名", "string",""));
|
||||
configVOList.add(new NotifyConfigVO("content", "模板内容", "string",""));
|
||||
break;
|
||||
case SMS_TENCENT:
|
||||
configVOList.add(new NotifyConfigVO("sendAccount", "发送电话号", "string",""));
|
||||
configVOList.add(new NotifyConfigVO("templateId", "模板ID", "string",""));
|
||||
configVOList.add(new NotifyConfigVO("signature", "签名", "string",""));
|
||||
configVOList.add(new NotifyConfigVO("sdkAppId", "应用SDKAppID", "string",""));
|
||||
configVOList.add(new NotifyConfigVO("content", "模板内容", "string",""));
|
||||
break;
|
||||
// 邮箱
|
||||
case EMAIL_QQ:
|
||||
case EMAIL_163:
|
||||
configVOList.add(new NotifyConfigVO("sendAccount", "发送邮箱号", "string",""));
|
||||
configVOList.add(new NotifyConfigVO("title", "标题", "string",""));
|
||||
configVOList.add(new NotifyConfigVO("attachment", "附件", "file",""));
|
||||
configVOList.add(new NotifyConfigVO("content", "邮箱正文", "text",""));
|
||||
break;
|
||||
case WECHAT_MINI_PROGRAM:
|
||||
configVOList.add(new NotifyConfigVO("sendAccount", "发送用户ID", "string",""));
|
||||
configVOList.add(new NotifyConfigVO("templateId", "模板ID", "string",""));
|
||||
configVOList.add(new NotifyConfigVO("redirectUrl", "跳转链接", "string",""));
|
||||
configVOList.add(new NotifyConfigVO("content", "模板内容", "string",""));
|
||||
break;
|
||||
case WECHAT_PUBLIC_ACCOUNT:
|
||||
configVOList.add(new NotifyConfigVO("templateId", "模板ID", "string",""));
|
||||
configVOList.add(new NotifyConfigVO("redirectUrl", "跳转链接", "string",""));
|
||||
configVOList.add(new NotifyConfigVO("appid", "跳转小程序appid", "string",""));
|
||||
configVOList.add(new NotifyConfigVO("pagePath", "跳转小程序路径", "string",""));
|
||||
configVOList.add(new NotifyConfigVO("content", "模板内容", "string",""));
|
||||
case WECHAT_WECOM_APPLY:
|
||||
case WECHAT_WECOM_ROBOT:
|
||||
if (StringUtils.isEmpty(msgType)) {
|
||||
return configVOList;
|
||||
}
|
||||
if (type.equals(WECHAT_WECOM_APPLY)) {
|
||||
configVOList.add(new NotifyConfigVO("sendAccount", "发送成员账号", "string",""));
|
||||
}
|
||||
switch (msgType) {
|
||||
case "text":
|
||||
case "markdown":
|
||||
configVOList.add(new NotifyConfigVO("content", "消息内容", "string",""));
|
||||
break;
|
||||
case "news":
|
||||
configVOList.add(new NotifyConfigVO("title", "消息标题", "string",""));
|
||||
configVOList.add(new NotifyConfigVO("content", "消息内容", "string",""));
|
||||
configVOList.add(new NotifyConfigVO("url", "跳转链接", "string",""));
|
||||
configVOList.add(new NotifyConfigVO("picUrl", "图片链接", "file",""));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
// 语音
|
||||
case VOICE_ALIBABA:
|
||||
configVOList.add(new NotifyConfigVO("sendAccount", "发送电话号", "string",""));
|
||||
configVOList.add(new NotifyConfigVO("templateId", "模板ID", "string",""));
|
||||
configVOList.add(new NotifyConfigVO("content", "模板内容", "string",""));
|
||||
configVOList.add(new NotifyConfigVO("playTimes", "播放次数 (1~3)", "int","2"));
|
||||
configVOList.add(new NotifyConfigVO("volume", "播放音量 (0-100)", "string","50"));
|
||||
configVOList.add(new NotifyConfigVO("speed", "语速控制 (-500-500)", "string","0"));
|
||||
break;
|
||||
case VOICE_TENCENT:
|
||||
configVOList.add(new NotifyConfigVO("sendAccount", "发送电话号", "string",""));
|
||||
configVOList.add(new NotifyConfigVO("sdkAppId", "应用SDKAppID", "string",""));
|
||||
configVOList.add(new NotifyConfigVO("templateId", "模板ID", "string",""));
|
||||
configVOList.add(new NotifyConfigVO("content", "模板内容", "string",""));
|
||||
break;
|
||||
// 钉钉
|
||||
case DING_TALK_WORK:
|
||||
case DING_TALK_GROUP_ROBOT:
|
||||
if (StringUtils.isEmpty(msgType)) {
|
||||
return configVOList;
|
||||
}
|
||||
switch (msgType) {
|
||||
case "text":
|
||||
if (NotifyChannelProviderEnum.DING_TALK_WORK.equals(type)) {
|
||||
configVOList.add(new NotifyConfigVO("deptId", "部门id", "string",""));
|
||||
configVOList.add(new NotifyConfigVO("sendAllEnable", "发送所有人", "boolean","false"));
|
||||
configVOList.add(new NotifyConfigVO("sendAccount", "员工UserID", "string",""));
|
||||
}
|
||||
configVOList.add(new NotifyConfigVO("content", "消息内容", "string",""));
|
||||
break;
|
||||
case "link":
|
||||
if (NotifyChannelProviderEnum.DING_TALK_WORK.equals(type)) {
|
||||
configVOList.add(new NotifyConfigVO("deptId", "部门id", "string",""));
|
||||
configVOList.add(new NotifyConfigVO("sendAllEnable", "发送所有人", "boolean","false"));
|
||||
configVOList.add(new NotifyConfigVO("sendAccount", "员工UserID", "string",""));
|
||||
}
|
||||
configVOList.add(new NotifyConfigVO("title", "消息标题", "string",""));
|
||||
configVOList.add(new NotifyConfigVO("content", "消息内容", "string",""));
|
||||
configVOList.add(new NotifyConfigVO("messageUrl", "消息链接", "string",""));
|
||||
configVOList.add(new NotifyConfigVO("picUrl", "图片链接", "file",""));
|
||||
break;
|
||||
case "markdown":
|
||||
if (NotifyChannelProviderEnum.DING_TALK_WORK.equals(type)) {
|
||||
configVOList.add(new NotifyConfigVO("deptId", "部门id", "string",""));
|
||||
configVOList.add(new NotifyConfigVO("sendAllEnable", "发送所有人", "boolean","false"));
|
||||
configVOList.add(new NotifyConfigVO("sendAccount", "员工UserID", "string",""));
|
||||
}
|
||||
configVOList.add(new NotifyConfigVO("title", "消息标题", "string",""));
|
||||
configVOList.add(new NotifyConfigVO("content", "消息内容", "string",""));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return configVOList;
|
||||
}
|
||||
return configVOList;
|
||||
}
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
package com.fastbee.common.enums;
|
||||
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @description: 通知业务编码枚举
|
||||
* @author fastb
|
||||
* @date 2023-12-16 17:00
|
||||
* @version 1.0
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum NotifyServiceCodeEnum {
|
||||
|
||||
/**
|
||||
* 确保唯一,不能重复
|
||||
*/
|
||||
ALERT("alert", "设备告警"),
|
||||
CAPTCHA("captcha","验证码"),
|
||||
MARKETING("marketing", "营销通知");
|
||||
|
||||
|
||||
/**
|
||||
* 业务编码
|
||||
*/
|
||||
private String serviceCode;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private String desc;
|
||||
|
||||
public static NotifyServiceCodeEnum getNotifyServiceCodeEnum(String serviceCode) {
|
||||
for (NotifyServiceCodeEnum notifyServiceCodeEnum : NotifyServiceCodeEnum.values()) {
|
||||
if (serviceCode.equals(notifyServiceCodeEnum.serviceCode)) {
|
||||
return notifyServiceCodeEnum;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
package com.fastbee.common.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* OTA升级状态
|
||||
* @author gsb
|
||||
* @date 2022/10/24 17:29
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
public enum OTAUpgrade {
|
||||
|
||||
|
||||
AWAIT(0, "等待升级","未推送固件到设备"),
|
||||
SEND(1, "已发送","已发送设备"),
|
||||
REPLY(2, "升级中","设备OTA升级中"),
|
||||
SUCCESS(3, "成功","升级成功"),
|
||||
FAILED(4, "失败","升级失败"),
|
||||
STOP(5, "停止","设备离线停止推送"),
|
||||
UNKNOWN(404, "未知","未知错误码");
|
||||
Integer status;
|
||||
String subMsg;
|
||||
String des;
|
||||
|
||||
public static OTAUpgrade parse(Integer code){
|
||||
for (OTAUpgrade item: OTAUpgrade.values()){
|
||||
if(item.status.equals(code)){
|
||||
return item;
|
||||
}
|
||||
}
|
||||
|
||||
return UNKNOWN;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
package com.fastbee.common.enums;
|
||||
|
||||
/**
|
||||
* 操作人类别
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public enum OperatorType
|
||||
{
|
||||
/**
|
||||
* 其它
|
||||
*/
|
||||
OTHER,
|
||||
|
||||
/**
|
||||
* 后台用户
|
||||
*/
|
||||
MANAGE,
|
||||
|
||||
/**
|
||||
* 手机端用户
|
||||
*/
|
||||
MOBILE
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package com.fastbee.common.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 推送类型
|
||||
* @author bill
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum PushType {
|
||||
|
||||
WECHAT_SERVER_PUSH("wechat_server_push","微信小程序服务号推送");
|
||||
|
||||
|
||||
/**
|
||||
* 业务编号
|
||||
*/
|
||||
private String serviceCode;
|
||||
|
||||
private String desc;
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
package com.fastbee.common.enums;
|
||||
|
||||
import com.fastbee.common.constant.HttpStatus;
|
||||
import lombok.AllArgsConstructor;
|
||||
|
||||
/**
|
||||
* API返回对象
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
public enum ResultCode implements IErrorCode {
|
||||
|
||||
SUCCESS(HttpStatus.SUCCESS,"请求成功"),
|
||||
FAILED(HttpStatus.ERROR,"系统内部错误"),
|
||||
ACCEPTED(HttpStatus.ACCEPTED,"请求已接收"),
|
||||
REDIRECT(HttpStatus.SEE_OTHER,"重定向"),
|
||||
UNAUTHORIZED(HttpStatus.UNAUTHORIZED,"暂未登录或token过期"),
|
||||
FORBIDDEN(HttpStatus.FORBIDDEN,"没有相关权限或授权过期"),
|
||||
NOT_FOUND(HttpStatus.NOT_FOUND,"资源未找到"),
|
||||
PARSE_MSG_EXCEPTION(4018, "解析协议异常"),
|
||||
TIMEOUT(502, "响应超时!"),
|
||||
FIRMWARE_VERSION_UNIQUE_ERROR(4022, "产品下已存在该版本固件"),
|
||||
FIRMWARE_SEQ_UNIQUE_ERROR(4023, "产品下已存在该升级序列号"),
|
||||
FIRMWARE_TASK_UNIQUE_ERROR(4024, "任务名已存在"),
|
||||
REPLY_TIMEOUT(4001, "超时未回执"),
|
||||
INVALID_USER_APP(4002, "用户信息不存在"),
|
||||
INVALID_MQTT_USER(1003, "内部mqtt服务用户异常"),
|
||||
DECODE_PROTOCOL_EXCEPTION(1000, "解析协议异常"),
|
||||
MQTT_TOPIC_INVALID(1001, "MQTT订阅topic格式非法");
|
||||
|
||||
private int code;
|
||||
private String message;
|
||||
|
||||
public int getCode(){return code;}
|
||||
|
||||
public String getMessage(){return message;}
|
||||
|
||||
}
|
@ -0,0 +1,45 @@
|
||||
package com.fastbee.common.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @author gsb
|
||||
* @date 2022/9/15 9:10
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum ServerType {
|
||||
|
||||
MQTT(1, "MQTT","MQTT-BROKER"),
|
||||
COAP(2, "COAP","COAP-SERVER"),
|
||||
TCP(3, "TCP","TCP-SERVER"),
|
||||
UDP(4, "UDP","UDP-SERVER"),
|
||||
WEBSOCKET(5,"WEBSOCKET","WEBSOCKET-SERVER"),
|
||||
GB28181(6,"GB28181","SIP-SERVER"),
|
||||
HTTP(6,"HTTP","HTTP-SERVER"),
|
||||
OTHER(999,"WEBSOCKET","MQTT-BROKER");
|
||||
|
||||
private int type;
|
||||
private String code;
|
||||
private String des;
|
||||
|
||||
|
||||
|
||||
public static ServerType explain(String code) {
|
||||
for (ServerType value : ServerType.values()) {
|
||||
if (value.code.equals(code)) {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
return ServerType.MQTT;
|
||||
}
|
||||
public static ServerType explainByType(int type) {
|
||||
for (ServerType value : ServerType.values()) {
|
||||
if (value.type == type) {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
return ServerType.MQTT;
|
||||
}
|
||||
}
|
@ -0,0 +1,69 @@
|
||||
package com.fastbee.common.enums;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 第三方登录平台枚举
|
||||
*
|
||||
* @author json
|
||||
*/
|
||||
public enum SocialPlatformType {
|
||||
WECHAT_OPEN_WEB("wechat_open_web", "微信开放平台网站应用"),
|
||||
WECHAT_OPEN_WEB_BIND("wechat_open_web_bind", "微信开放平台网站应用个人中心绑定"),
|
||||
WECHAT_OPEN_MOBILE("wechat_open_mobile", "微信开放平台移动应用"),
|
||||
WECHAT_OPEN_MINI_PROGRAM("wechat_open_mini_program", "微信开放平台小程序"),
|
||||
WECHAT_OPEN_PUBLIC_ACCOUNT("wechat_open_public_account", "微信开放平台公众号"),
|
||||
QQ_OPEN_WEB("qq_open_web", "QQ互联网站应用"),
|
||||
QQ_OPEN_APP("qq_open_app", "QQ互联移动应用"),
|
||||
QQ_OPEN_MINI_PROGRAM("qq_open_mini_program", "QQ互联小程序");
|
||||
// ALIPAY_OPEN_WEB("alipay_open_web", ""),
|
||||
// ALIPAY_OPEN_APP("alipay_open_app", ""),
|
||||
// ALIPAY_OPEN_MINI_PROGRAM("alipay_open_mini_program", "");
|
||||
|
||||
public String sourceClient;
|
||||
|
||||
public String desc;
|
||||
|
||||
SocialPlatformType(String sourceClient, String desc) {
|
||||
this.sourceClient = sourceClient;
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
// 查询微信绑定来源集合
|
||||
public static final List<String> listWechatPlatform = Arrays.asList(WECHAT_OPEN_WEB.sourceClient, WECHAT_OPEN_MOBILE.sourceClient, WECHAT_OPEN_MINI_PROGRAM.sourceClient);
|
||||
|
||||
public static String getDesc(String sourceClient) {
|
||||
for (SocialPlatformType socialPlatformType : SocialPlatformType.values()) {
|
||||
if (socialPlatformType.getSourceClient().equals(sourceClient)) {
|
||||
return socialPlatformType.getDesc();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static SocialPlatformType getSocialPlatformType(String sourceClient) {
|
||||
for (SocialPlatformType socialPlatformType : SocialPlatformType.values()) {
|
||||
if (socialPlatformType.getSourceClient().equals(sourceClient)) {
|
||||
return socialPlatformType;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getSourceClient() {
|
||||
return sourceClient;
|
||||
}
|
||||
|
||||
public void setSourceClient(String sourceClient) {
|
||||
this.sourceClient = sourceClient;
|
||||
}
|
||||
|
||||
public String getDesc() {
|
||||
return desc;
|
||||
}
|
||||
|
||||
public void setDesc(String desc) {
|
||||
this.desc = desc;
|
||||
}
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
package com.fastbee.common.enums;
|
||||
|
||||
import com.fastbee.common.core.text.IntArrayValuable;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* 通用状态枚举
|
||||
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum StatusEnum {
|
||||
|
||||
SUCCESS(1, "成功"),
|
||||
FAIL(0, "失败");
|
||||
|
||||
|
||||
/**
|
||||
* 状态值
|
||||
*/
|
||||
private final Integer status;
|
||||
/**
|
||||
* 状态名
|
||||
*/
|
||||
private final String name;
|
||||
|
||||
}
|
@ -0,0 +1,50 @@
|
||||
package com.fastbee.common.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 物模型类型
|
||||
*
|
||||
* @author bill
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum ThingsModelType {
|
||||
|
||||
PROP(1, "PROPERTY", "属性","properties"),
|
||||
SERVICE(2, "FUNCTION", "服务","functions"),
|
||||
EVENT(3, "EVENT", "事件","events"),;
|
||||
|
||||
int code;
|
||||
String type;
|
||||
String name;
|
||||
String list;
|
||||
|
||||
public static ThingsModelType getType(int code) {
|
||||
for (ThingsModelType value : ThingsModelType.values()) {
|
||||
if (value.code == code) {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
return ThingsModelType.PROP;
|
||||
}
|
||||
|
||||
public static ThingsModelType getType(String type) {
|
||||
for (ThingsModelType value : ThingsModelType.values()) {
|
||||
if (value.type.equals(type)) {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
return ThingsModelType.PROP;
|
||||
}
|
||||
|
||||
public static String getName(int code) {
|
||||
for (ThingsModelType value : ThingsModelType.values()) {
|
||||
if (value.code == code) {
|
||||
return value.list;
|
||||
}
|
||||
}
|
||||
return ThingsModelType.PROP.list;
|
||||
}
|
||||
}
|
@ -0,0 +1,72 @@
|
||||
package com.fastbee.common.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* topic类型
|
||||
* @author gsb
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum TopicType {
|
||||
|
||||
/**
|
||||
* @param type 0:标记是订阅主题 1:标记是发布属性
|
||||
* @param order 排序
|
||||
* @param topicSuffix topic后缀
|
||||
* @param msg 描述信息
|
||||
*/
|
||||
|
||||
/*** 通用设备上报主题(平台订阅) ***/
|
||||
PROPERTY_POST(0,1,"/property/post", "订阅属性"),
|
||||
EVENT_POST(0,2,"/event/post", "订阅事件"),
|
||||
FUNCTION_POST(0,3,"/function/post", "订阅功能"),
|
||||
INFO_POST(0,4,"/info/post","订阅设备信息"),
|
||||
NTP_POST(0,5,"/ntp/post","订阅时钟同步"),
|
||||
SERVICE_INVOKE_REPLY(0,8,"/service/reply", "订阅功能调用返回结果"),
|
||||
FIRMWARE_UPGRADE_REPLY(0,9,"/upgrade/reply", "订阅设备OTA升级结果"),
|
||||
MESSAGE_POST(0,26,"/message/post","订阅设备上报消息"),
|
||||
|
||||
/*** 通用设备订阅主题(平台下发)***/
|
||||
FUNCTION_GET(1,17,"/function/get", "发布功能"),
|
||||
PROPERTY_GET(1,12,"/property/get" ,"发布设备属性读取"),
|
||||
PROPERTY_SET(1,15,"/property/set" ,"设置设备属性读取"),
|
||||
FIRMWARE_SET(1,14, "/upgrade/set","发布OTA升级"),
|
||||
STATUS_POST(1,11,"/status/post","发布状态"),
|
||||
NTP_GET(1,15,"/ntp/get","发布时钟同步"),
|
||||
INFO_GET(1,18,"/info/get","发布设备信息"),
|
||||
|
||||
|
||||
/*** 视频监控设备转协议发布 ***/
|
||||
DEV_INFO_POST(3,19,"/info/post","设备端发布设备信息"),
|
||||
DEV_EVENT_POST(3,20,"/event/post","设备端发布事件"),
|
||||
DEV_FUNCTION_POST(3,21,"/function/post", "设备端发布功能"),
|
||||
DEV_PROPERTY_POST(3,22,"/property/post", "设备端发布属性"),
|
||||
|
||||
|
||||
/*** webSocket转发前端使用 ***/
|
||||
WS_SERVICE_INVOKE(2,16,"/ws/service", "WS服务调用"),
|
||||
WS_LOG_INVOKE(2,17,"/ws/log","ws下发指令日志"),
|
||||
|
||||
|
||||
/*** 模拟设备使用 ***/
|
||||
WS_TEST_POST(2,24,"/ws/test/post", "数据调试设备下发"),
|
||||
WS_TEST_POLL(2,25,"/ws/test/poll", "数据调试轮询指令下发"),
|
||||
WS_TEST_GET(2,25,"/ws/test/get", "数据调试指令下发");
|
||||
|
||||
Integer type;
|
||||
Integer order;
|
||||
String topicSuffix;
|
||||
String msg;
|
||||
|
||||
public static TopicType getType(String topicSuffix) {
|
||||
for (TopicType value : TopicType.values()) {
|
||||
if (value.topicSuffix.equals(topicSuffix)) {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
return TopicType.PROPERTY_POST;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
package com.fastbee.common.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
import static com.fastbee.common.constant.Constants.*;
|
||||
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum TranslateType {
|
||||
|
||||
MENU_TYPE(MENU, "sys_menu_translate", "sys_menu", "menu_id", "menu_name"),
|
||||
DICT_DATA_TYPE(DICT_DATA, "sys_dict_data_translate", "sys_dict_data", "dict_code", "dict_label"),
|
||||
DICT_TYPE_TYPE(DICT_TYPE, "sys_dict_type_translate", "sys_dict_type", "dict_id", "dict_name"),
|
||||
THINGS_MODEL_TYPE(THINGS_MODEL, "iot_things_model_translate", "iot_things_model", "model_id", "model_name"),
|
||||
THINGS_MODEL_TEMPLATE_TYPE(THINGS_MODEL_TEMPLATE, "iot_things_model_template_translate", "iot_things_model_template", "template_id", "template_name");
|
||||
|
||||
String value;
|
||||
String translateTable;
|
||||
String sourceTable;
|
||||
String idColumn;
|
||||
String nameColumn;
|
||||
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
package com.fastbee.common.enums;
|
||||
|
||||
/**
|
||||
* 用户状态
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public enum UserStatus
|
||||
{
|
||||
OK("0", "正常"), DISABLE("1", "停用"), DELETED("2", "删除");
|
||||
|
||||
private final String code;
|
||||
private final String info;
|
||||
|
||||
UserStatus(String code, String info)
|
||||
{
|
||||
this.code = code;
|
||||
this.info = info;
|
||||
}
|
||||
|
||||
public String getCode()
|
||||
{
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getInfo()
|
||||
{
|
||||
return info;
|
||||
}
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package com.fastbee.common.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 验证类型枚举
|
||||
* @author fastb
|
||||
* @date 2023-08-30 15:04
|
||||
*/
|
||||
@Getter
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public enum VerifyTypeEnum {
|
||||
|
||||
PASSWORD(1, "账号密码验证"),
|
||||
SMS(2, "短信验证");
|
||||
|
||||
private Integer verifyType;
|
||||
|
||||
private String desc;
|
||||
}
|
@ -0,0 +1,47 @@
|
||||
package com.fastbee.common.enums.scenemodel;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 场景变量统计方式
|
||||
* @author fastb
|
||||
* @date 2024-06-05 10:42
|
||||
* @version 1.0
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
public enum SceneModelTagOpreationEnum {
|
||||
/**
|
||||
* 原值
|
||||
*/
|
||||
ORIGINAL_VALUE(1, "原值"),
|
||||
/**
|
||||
* 累计值
|
||||
*/
|
||||
CUMULATIVE(2, "累计值"),
|
||||
/**
|
||||
* 平均值
|
||||
*/
|
||||
AVERAGE_VALUE(3, "平均值"),
|
||||
/**
|
||||
* 最大值
|
||||
*/
|
||||
MAX_VALUE(4, "最大值"),
|
||||
/**
|
||||
* 最小值
|
||||
*/
|
||||
MIN_VALUE(5,"最小值");
|
||||
|
||||
private final Integer code;
|
||||
private final String desc;
|
||||
|
||||
public static SceneModelTagOpreationEnum getByCode(Integer code) {
|
||||
for (SceneModelTagOpreationEnum opreationEnum : SceneModelTagOpreationEnum.values()) {
|
||||
if (opreationEnum.getCode().equals(code)) {
|
||||
return opreationEnum;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
package com.fastbee.common.enums.scenemodel;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 场景管理物模型、变量类型枚举
|
||||
* 注意:以下4张表下的variable_type相关字段统一用该枚举,保持一致
|
||||
* scene_model_tag表、scene_tag_points表、scene_model_device表、scene_model_data表
|
||||
* @author fastb
|
||||
* @date 2024-05-22 10:01
|
||||
* @version 1.0
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum SceneModelVariableTypeEnum {
|
||||
//1==设备物模型(直采变量),2=录入型变量,3=运算型变量
|
||||
THINGS_MODEL(1, "设备配置"),
|
||||
INPUT_VARIABLE(2, "录入型变量"),
|
||||
OPERATION_VARIABLE(3, "运算型变量");
|
||||
|
||||
public final static List<SceneModelVariableTypeEnum> ADD_LIST = Arrays.asList(INPUT_VARIABLE, OPERATION_VARIABLE);
|
||||
|
||||
|
||||
private final Integer type;
|
||||
|
||||
private final String name;
|
||||
|
||||
}
|
Reference in New Issue
Block a user