20251224:格式化代码

This commit is contained in:
George 2025-12-24 20:45:17 +08:00
parent d89e3b63dc
commit 97da219ff1
589 changed files with 11305 additions and 11149 deletions

View File

@ -40,12 +40,10 @@ import java.util.List;
@RequestMapping("/common")
public class CommonController {
private static final Logger log = LoggerFactory.getLogger(CommonController.class);
private static final String FILE_DELIMETER = ",";
@Autowired
private ServerConfig serverConfig;
private static final String FILE_DELIMETER = ",";
/**
* 通用下载请求
*

View File

@ -23,11 +23,10 @@ import java.util.*;
@RestController
@RequestMapping("/monitor/cache")
public class CacheController {
private final static List<SysCache> caches = new ArrayList<SysCache>();
@Autowired
private RedisTemplate<String, String> redisTemplate;
private final static List<SysCache> caches = new ArrayList<SysCache>();
{
caches.add(new SysCache(CacheConstants.LOGIN_TOKEN_KEY, "用户信息"));
caches.add(new SysCache(CacheConstants.SYS_CONFIG_KEY, "配置信息"));

View File

@ -4,12 +4,11 @@ import java.lang.annotation.*;
/**
* 匿名访问不鉴权注解
*
*
* @author ruoyi
*/
@Target({ ElementType.METHOD, ElementType.TYPE })
@Target({ElementType.METHOD, ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface Anonymous
{
public @interface Anonymous {
}

View File

@ -1,10 +1,6 @@
package com.fastbee.common.annotation;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import java.lang.annotation.*;
/**
* 数据权限过滤注解
@ -18,15 +14,15 @@ public @interface DataScope {
/**
* 部门表的别名
*/
public String deptAlias() default "";
String deptAlias() default "";
/**
* 用户表的别名
*/
public String userAlias() default "";
String userAlias() default "";
/**
* 权限字符(用于多个角色匹配符合要求的权限)默认根据权限注解@ss获取,多个权限用逗号分隔开来
*/
public String permission() default "";
String permission() default "";
}

View File

@ -1,28 +1,23 @@
package com.fastbee.common.annotation;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Inherited;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import com.fastbee.common.enums.DataSourceType;
import java.lang.annotation.*;
/**
* 自定义多数据源切换注解
*
* <p>
* 优先级:先方法,后类,如果方法覆盖了类上的数据源类型,以方法的为准,否则以类上的为准
*
* @author ruoyi
*/
@Target({ ElementType.METHOD, ElementType.TYPE })
@Target({ElementType.METHOD, ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Inherited
public @interface DataSource
{
public @interface DataSource {
/**
* 切换数据源名称
*/
public DataSourceType value() default DataSourceType.master;
DataSourceType value() default DataSourceType.master;
}

View File

@ -4,7 +4,7 @@ import java.lang.annotation.*;
/**
* 字典格式化
*
* <p>
* 实现将字典数据的值,格式化成字典数据的标签
*/
@Target({ElementType.FIELD})

View File

@ -12,176 +12,169 @@ import java.math.BigDecimal;
/**
* 自定义导出Excel数据注解
*
*
* @author ruoyi
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.FIELD)
public @interface Excel
{
public @interface Excel {
/**
* 导出时在excel中排序
*/
public int sort() default Integer.MAX_VALUE;
int sort() default Integer.MAX_VALUE;
/**
* 导出到Excel中的名字.
*/
public String name() default "";
String name() default "";
/**
* 日期格式, 如: yyyy-MM-dd
*/
public String dateFormat() default "";
String dateFormat() default "";
/**
* 如果是字典类型,请设置字典的type值 (如: sys_user_sex)
*/
public String dictType() default "";
String dictType() default "";
/**
* 读取内容转表达式 (如: 0=男,1=女,2=未知)
*/
public String readConverterExp() default "";
String readConverterExp() default "";
/**
* 分隔符,读取字符串组内容
*/
public String separator() default ",";
String separator() default ",";
/**
* BigDecimal 精度 默认:-1(默认不开启BigDecimal格式化)
*/
public int scale() default -1;
int scale() default -1;
/**
* BigDecimal 舍入规则 默认:BigDecimal.ROUND_HALF_EVEN
*/
public int roundingMode() default BigDecimal.ROUND_HALF_EVEN;
int roundingMode() default BigDecimal.ROUND_HALF_EVEN;
/**
* 导出时在excel中每个列的高度 单位为字符
*/
public double height() default 14;
double height() default 14;
/**
* 导出时在excel中每个列的宽 单位为字符
*/
public double width() default 16;
double width() default 16;
/**
* 文字后缀,如% 90 变成90%
*/
public String suffix() default "";
String suffix() default "";
/**
* 当值为空时,字段的默认值
*/
public String defaultValue() default "";
String defaultValue() default "";
/**
* 提示信息
*/
public String prompt() default "";
String prompt() default "";
/**
* 设置只能选择不能输入的列内容.
*/
public String[] combo() default {};
String[] combo() default {};
/**
* 是否需要纵向合并单元格,应对需求:含有list集合单元格)
*/
public boolean needMerge() default false;
boolean needMerge() default false;
/**
* 是否导出数据,应对需求:有时我们需要导出一份模板,这是标题需要但内容需要用户手工填写.
*/
public boolean isExport() default true;
boolean isExport() default true;
/**
* 另一个类中的属性名称,支持多级获取,以小数点隔开
*/
public String targetAttr() default "";
String targetAttr() default "";
/**
* 是否自动统计数据,在最后追加一行统计数据总和
*/
public boolean isStatistics() default false;
boolean isStatistics() default false;
/**
* 导出类型(0数字 1字符串 2图片)
*/
public ColumnType cellType() default ColumnType.STRING;
ColumnType cellType() default ColumnType.STRING;
/**
* 导出列头背景色
*/
public IndexedColors headerBackgroundColor() default IndexedColors.GREY_50_PERCENT;
IndexedColors headerBackgroundColor() default IndexedColors.GREY_50_PERCENT;
/**
* 导出列头字体颜色
*/
public IndexedColors headerColor() default IndexedColors.WHITE;
IndexedColors headerColor() default IndexedColors.WHITE;
/**
* 导出单元格背景色
*/
public IndexedColors backgroundColor() default IndexedColors.WHITE;
IndexedColors backgroundColor() default IndexedColors.WHITE;
/**
* 导出单元格字体颜色
*/
public IndexedColors color() default IndexedColors.BLACK;
IndexedColors color() default IndexedColors.BLACK;
/**
* 导出字段对齐方式
*/
public HorizontalAlignment align() default HorizontalAlignment.CENTER;
HorizontalAlignment align() default HorizontalAlignment.CENTER;
/**
* 自定义数据处理器
*/
public Class<?> handler() default ExcelHandlerAdapter.class;
Class<?> handler() default ExcelHandlerAdapter.class;
/**
* 自定义数据处理器参数
*/
public String[] args() default {};
String[] args() default {};
/**
* 字段类型(0:导出导入;1:仅导出;2:仅导入)
*/
Type type() default Type.ALL;
public enum Type
{
enum Type {
ALL(0), EXPORT(1), IMPORT(2);
private final int value;
Type(int value)
{
Type(int value) {
this.value = value;
}
public int value()
{
public int value() {
return this.value;
}
}
public enum ColumnType
{
enum ColumnType {
NUMERIC(0), STRING(1), IMAGE(2);
private final int value;
ColumnType(int value)
{
ColumnType(int value) {
this.value = value;
}
public int value()
{
public int value() {
return this.value;
}
}

View File

@ -7,12 +7,11 @@ import java.lang.annotation.Target;
/**
* Excel注解集
*
*
* @author ruoyi
*/
@Target(ElementType.FIELD)
@Retention(RetentionPolicy.RUNTIME)
public @interface Excels
{
public Excel[] value();
public @interface Excels {
Excel[] value();
}

View File

@ -7,37 +7,35 @@ import java.lang.annotation.*;
/**
* 自定义操作日志记录注解
*
* @author ruoyi
*
* @author ruoyi
*/
@Target({ ElementType.PARAMETER, ElementType.METHOD })
@Target({ElementType.PARAMETER, ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface Log
{
public @interface Log {
/**
* 模块
* 模块
*/
public String title() default "";
String title() default "";
/**
* 功能
*/
public BusinessType businessType() default BusinessType.OTHER;
BusinessType businessType() default BusinessType.OTHER;
/**
* 操作人类别
*/
public OperatorType operatorType() default OperatorType.MANAGE;
OperatorType operatorType() default OperatorType.MANAGE;
/**
* 是否保存请求的参数
*/
public boolean isSaveRequestData() default true;
boolean isSaveRequestData() default true;
/**
* 是否保存响应的参数
*/
public boolean isSaveResponseData() default true;
boolean isSaveResponseData() default true;
}

View File

@ -1,40 +1,36 @@
package com.fastbee.common.annotation;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import com.fastbee.common.constant.CacheConstants;
import com.fastbee.common.enums.LimitType;
import java.lang.annotation.*;
/**
* 限流注解
*
*
* @author ruoyi
*/
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface RateLimiter
{
public @interface RateLimiter {
/**
* 限流key
*/
public String key() default CacheConstants.RATE_LIMIT_KEY;
String key() default CacheConstants.RATE_LIMIT_KEY;
/**
* 限流时间,单位秒
*/
public int time() default 60;
int time() default 60;
/**
* 限流次数
*/
public int count() default 100;
int count() default 100;
/**
* 限流类型
*/
public LimitType limitType() default LimitType.DEFAULT;
LimitType limitType() default LimitType.DEFAULT;
}

View File

@ -1,31 +1,24 @@
package com.fastbee.common.annotation;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Inherited;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import java.lang.annotation.*;
/**
* 自定义注解防止表单重复提交
*
* @author ruoyi
*
* @author ruoyi
*/
@Inherited
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface RepeatSubmit
{
public @interface RepeatSubmit {
/**
* 间隔时间(ms),小于此时间视为重复提交
*/
public int interval() default 5000;
int interval() default 5000;
/**
* 提示消息
*/
public String message() default "不允许重复提交,请稍候再试";
String message() default "不允许重复提交,请稍候再试";
}

View File

@ -4,6 +4,7 @@ import java.lang.annotation.*;
/**
* 表示系统内部协议解析器
*
* @author gsb
* @date 2022/10/24 10:33
*/
@ -14,8 +15,10 @@ public @interface SysProtocol {
/*协议名*/
String name() default "";
/*协议编码*/
String protocolCode() default "";
//协议描述
String description() default "";
}

View File

@ -13,6 +13,7 @@ import java.util.concurrent.ThreadPoolExecutor;
/**
* 设备报文处理线程池
*
* @author bill
*/
@Configuration
@ -27,12 +28,12 @@ public class DeviceTask {
private int queueCapacity;
private int keepAlive;
private int keepAlive;
/*设备状态池*/
@Bean(FastBeeConstant.TASK.DEVICE_STATUS_TASK)
public Executor deviceStatusTaskExecutor() {
return builder(FastBeeConstant.TASK.DEVICE_STATUS_TASK);
return builder(FastBeeConstant.TASK.DEVICE_STATUS_TASK);
}
/*平台自动获取线程池(例如定时获取设备信息)*/
@ -66,33 +67,33 @@ public class DeviceTask {
}
@Bean(FastBeeConstant.TASK.MESSAGE_CONSUME_TASK_PUB)
public Executor messageConsumePubTaskExecutor(){
public Executor messageConsumePubTaskExecutor() {
return builder(FastBeeConstant.TASK.MESSAGE_CONSUME_TASK_PUB);
}
@Bean(FastBeeConstant.TASK.MESSAGE_CONSUME_TASK_FETCH)
public Executor messageConsumeFetchTaskExecutor(){
public Executor messageConsumeFetchTaskExecutor() {
return builder(FastBeeConstant.TASK.MESSAGE_CONSUME_TASK_FETCH);
}
@Bean(FastBeeConstant.TASK.DELAY_UPGRADE_TASK)
public Executor delayedTaskExecutor(){
public Executor delayedTaskExecutor() {
return builder(FastBeeConstant.TASK.DELAY_UPGRADE_TASK);
}
/*设备其他消息处理*/
@Bean(FastBeeConstant.TASK.DEVICE_OTHER_TASK)
public Executor deviceOtherTaskExecutor(){
public Executor deviceOtherTaskExecutor() {
return builder(FastBeeConstant.TASK.DEVICE_OTHER_TASK);
}
@Bean(FastBeeConstant.TASK.DEVICE_TEST_TASK)
public Executor deviceTestTaskExecutor(){
public Executor deviceTestTaskExecutor() {
return builder(FastBeeConstant.TASK.DEVICE_TEST_TASK);
}
/*组装线程池*/
private ThreadPoolTaskExecutor builder(String threadNamePrefix){
private ThreadPoolTaskExecutor builder(String threadNamePrefix) {
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
executor.setCorePoolSize(coreSize);
executor.setMaxPoolSize(maxSize);

View File

@ -5,91 +5,54 @@ import org.springframework.stereotype.Component;
/**
* 读取项目相关配置
*
*
* @author ruoyi
*/
@Component
@ConfigurationProperties(prefix = "fastbee")
public class RuoYiConfig
{
/** 项目名称 */
public class RuoYiConfig {
/**
* 上传路径
*/
private static String profile;
/**
* 获取地址开关
*/
private static boolean addressEnabled;
/**
* 验证码类型
*/
private static String captchaType;
/**
* 项目名称
*/
private String name;
/** 版本 */
/**
* 版本
*/
private String version;
/** 版权年份 */
/**
* 版权年份
*/
private String copyrightYear;
/** 实例演示开关 */
/**
* 实例演示开关
*/
private boolean demoEnabled;
/** 上传路径 */
private static String profile;
/** 获取地址开关 */
private static boolean addressEnabled;
/** 验证码类型 */
private static String captchaType;
public String getName()
{
return name;
}
public void setName(String name)
{
this.name = name;
}
public String getVersion()
{
return version;
}
public void setVersion(String version)
{
this.version = version;
}
public String getCopyrightYear()
{
return copyrightYear;
}
public void setCopyrightYear(String copyrightYear)
{
this.copyrightYear = copyrightYear;
}
public boolean isDemoEnabled()
{
return demoEnabled;
}
public void setDemoEnabled(boolean demoEnabled)
{
this.demoEnabled = demoEnabled;
}
public static String getProfile()
{
public static String getProfile() {
return profile;
}
public void setProfile(String profile)
{
public void setProfile(String profile) {
RuoYiConfig.profile = profile;
}
public static boolean isAddressEnabled()
{
public static boolean isAddressEnabled() {
return addressEnabled;
}
public void setAddressEnabled(boolean addressEnabled)
{
public void setAddressEnabled(boolean addressEnabled) {
RuoYiConfig.addressEnabled = addressEnabled;
}
@ -104,32 +67,60 @@ public class RuoYiConfig
/**
* 获取导入上传路径
*/
public static String getImportPath()
{
public static String getImportPath() {
return getProfile() + "/import";
}
/**
* 获取头像上传路径
*/
public static String getAvatarPath()
{
public static String getAvatarPath() {
return getProfile() + "/avatar";
}
/**
* 获取下载路径
*/
public static String getDownloadPath()
{
public static String getDownloadPath() {
return getProfile() + "/download/";
}
/**
* 获取上传路径
*/
public static String getUploadPath()
{
public static String getUploadPath() {
return getProfile() + "/upload";
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getVersion() {
return version;
}
public void setVersion(String version) {
this.version = version;
}
public String getCopyrightYear() {
return copyrightYear;
}
public void setCopyrightYear(String copyrightYear) {
this.copyrightYear = copyrightYear;
}
public boolean isDemoEnabled() {
return demoEnabled;
}
public void setDemoEnabled(boolean demoEnabled) {
this.demoEnabled = demoEnabled;
}
}

View File

@ -5,8 +5,7 @@ package com.fastbee.common.constant;
*
* @author ruoyi
*/
public class CacheConstants
{
public class CacheConstants {
/**
* 登录用户 redis key
*/
@ -67,6 +66,8 @@ public class CacheConstants
*/
public static final String REGISTER_SMS_CAPTCHA_PHONE = "register_sms_captcha_phone:";
/**设备OTA升级实时数据*/
/**
* 设备OTA升级实时数据
*/
public static final String DEVICE_OTA_DATA = "device:ota:";
}

View File

@ -7,8 +7,7 @@ import io.jsonwebtoken.Claims;
*
* @author ruoyi
*/
public class Constants
{
public class Constants {
/**
* UTF-8 字符集
*/
@ -132,13 +131,13 @@ public class Constants
/**
* 定时任务白名单配置(仅允许访问的包名,如其他需要可以自行添加)
*/
public static final String[] JOB_WHITELIST_STR = { "com.fastbee" };
public static final String[] JOB_WHITELIST_STR = {"com.fastbee"};
/**
* 定时任务违规的字符
*/
public static final String[] JOB_ERROR_STR = { "java.net.URL", "javax.naming.InitialContext", "org.yaml.snakeyaml",
"org.springframework", "org.apache", "com.fastbee.common.utils.file", "com.fastbee.common.config" };
public static final String[] JOB_ERROR_STR = {"java.net.URL", "javax.naming.InitialContext", "org.yaml.snakeyaml",
"org.springframework", "org.apache", "com.fastbee.common.utils.file", "com.fastbee.common.config"};
/**
* 语言类型

View File

@ -2,116 +2,185 @@ package com.fastbee.common.constant;
/**
* 代码生成通用常量
*
*
* @author ruoyi
*/
public class GenConstants
{
/** 单表(增删改查) */
public class GenConstants {
/**
* 单表(增删改查)
*/
public static final String TPL_CRUD = "crud";
/** 树表(增删改查) */
/**
* 树表(增删改查)
*/
public static final String TPL_TREE = "tree";
/** 主子表(增删改查) */
/**
* 主子表(增删改查)
*/
public static final String TPL_SUB = "sub";
/** 树编码字段 */
/**
* 树编码字段
*/
public static final String TREE_CODE = "treeCode";
/** 树父编码字段 */
/**
* 树父编码字段
*/
public static final String TREE_PARENT_CODE = "treeParentCode";
/** 树名称字段 */
/**
* 树名称字段
*/
public static final String TREE_NAME = "treeName";
/** 上级菜单ID字段 */
/**
* 上级菜单ID字段
*/
public static final String PARENT_MENU_ID = "parentMenuId";
/** 上级菜单名称字段 */
/**
* 上级菜单名称字段
*/
public static final String PARENT_MENU_NAME = "parentMenuName";
/** 数据库字符串类型 */
public static final String[] COLUMNTYPE_STR = { "char", "varchar", "nvarchar", "varchar2" };
/**
* 数据库字符串类型
*/
public static final String[] COLUMNTYPE_STR = {"char", "varchar", "nvarchar", "varchar2"};
/** 数据库文本类型 */
public static final String[] COLUMNTYPE_TEXT = { "tinytext", "text", "mediumtext", "longtext" };
/**
* 数据库文本类型
*/
public static final String[] COLUMNTYPE_TEXT = {"tinytext", "text", "mediumtext", "longtext"};
/** 数据库时间类型 */
public static final String[] COLUMNTYPE_TIME = { "datetime", "time", "date", "timestamp" };
/**
* 数据库时间类型
*/
public static final String[] COLUMNTYPE_TIME = {"datetime", "time", "date", "timestamp"};
/** 数据库数字类型 */
public static final String[] COLUMNTYPE_NUMBER = { "tinyint", "smallint", "mediumint", "int", "number", "integer",
"bit", "bigint", "float", "double", "decimal" };
/**
* 数据库数字类型
*/
public static final String[] COLUMNTYPE_NUMBER = {"tinyint", "smallint", "mediumint", "int", "number", "integer",
"bit", "bigint", "float", "double", "decimal"};
/** 页面不需要编辑字段 */
public static final String[] COLUMNNAME_NOT_EDIT = { "id", "create_by", "create_time", "del_flag" };
/**
* 页面不需要编辑字段
*/
public static final String[] COLUMNNAME_NOT_EDIT = {"id", "create_by", "create_time", "del_flag"};
/** 页面不需要显示的列表字段 */
public static final String[] COLUMNNAME_NOT_LIST = { "id", "create_by", "create_time", "del_flag", "update_by",
"update_time" };
/**
* 页面不需要显示的列表字段
*/
public static final String[] COLUMNNAME_NOT_LIST = {"id", "create_by", "create_time", "del_flag", "update_by",
"update_time"};
/** 页面不需要查询字段 */
public static final String[] COLUMNNAME_NOT_QUERY = { "id", "create_by", "create_time", "del_flag", "update_by",
"update_time", "remark" };
/**
* 页面不需要查询字段
*/
public static final String[] COLUMNNAME_NOT_QUERY = {"id", "create_by", "create_time", "del_flag", "update_by",
"update_time", "remark"};
/** Entity基类字段 */
public static final String[] BASE_ENTITY = { "createBy", "createTime", "updateBy", "updateTime", "remark" };
/**
* Entity基类字段
*/
public static final String[] BASE_ENTITY = {"createBy", "createTime", "updateBy", "updateTime", "remark"};
/** Tree基类字段 */
public static final String[] TREE_ENTITY = { "parentName", "parentId", "orderNum", "ancestors", "children" };
/**
* Tree基类字段
*/
public static final String[] TREE_ENTITY = {"parentName", "parentId", "orderNum", "ancestors", "children"};
/** 文本框 */
/**
* 文本框
*/
public static final String HTML_INPUT = "input";
/** 文本域 */
/**
* 文本域
*/
public static final String HTML_TEXTAREA = "textarea";
/** 下拉框 */
/**
* 下拉框
*/
public static final String HTML_SELECT = "select";
/** 单选框 */
/**
* 单选框
*/
public static final String HTML_RADIO = "radio";
/** 复选框 */
/**
* 复选框
*/
public static final String HTML_CHECKBOX = "checkbox";
/** 日期控件 */
/**
* 日期控件
*/
public static final String HTML_DATETIME = "datetime";
/** 图片上传控件 */
/**
* 图片上传控件
*/
public static final String HTML_IMAGE_UPLOAD = "imageUpload";
/** 文件上传控件 */
/**
* 文件上传控件
*/
public static final String HTML_FILE_UPLOAD = "fileUpload";
/** 富文本控件 */
/**
* 富文本控件
*/
public static final String HTML_EDITOR = "editor";
/** 字符串类型 */
/**
* 字符串类型
*/
public static final String TYPE_STRING = "String";
/** 整型 */
/**
* 整型
*/
public static final String TYPE_INTEGER = "Integer";
/** 长整型 */
/**
* 长整型
*/
public static final String TYPE_LONG = "Long";
/** 浮点型 */
/**
* 浮点型
*/
public static final String TYPE_DOUBLE = "Double";
/** 高精度计算类型 */
/**
* 高精度计算类型
*/
public static final String TYPE_BIGDECIMAL = "BigDecimal";
/** 时间类型 */
/**
* 时间类型
*/
public static final String TYPE_DATE = "Date";
/** 模糊查询 */
/**
* 模糊查询
*/
public static final String QUERY_LIKE = "LIKE";
/** 相等查询 */
/**
* 相等查询
*/
public static final String QUERY_EQ = "EQ";
/** 需要 */
/**
* 需要
*/
public static final String REQUIRE = "1";
}

View File

@ -5,8 +5,7 @@ package com.fastbee.common.constant;
*
* @author ruoyi
*/
public class HttpStatus
{
public class HttpStatus {
/**
* 操作成功
*/

View File

@ -5,8 +5,7 @@ package com.fastbee.common.constant;
*
* @author ruoyi
*/
public class MagicValueConstants
{
public class MagicValueConstants {
/**
* 3600
*/

View File

@ -1,7 +1,6 @@
package com.fastbee.common.constant;
/**
*
* @author fastb
* @date 2023-08-03 10:20
*/

View File

@ -2,30 +2,38 @@ package com.fastbee.common.constant;
/**
* 任务调度通用常量
*
*
* @author ruoyi
*/
public class ScheduleConstants
{
public class ScheduleConstants {
public static final String TASK_CLASS_NAME = "TASK_CLASS_NAME";
/** 执行目标key */
/**
* 执行目标key
*/
public static final String TASK_PROPERTIES = "TASK_PROPERTIES";
/** 默认 */
/**
* 默认
*/
public static final String MISFIRE_DEFAULT = "0";
/** 立即触发执行 */
/**
* 立即触发执行
*/
public static final String MISFIRE_IGNORE_MISFIRES = "1";
/** 触发一次执行 */
/**
* 触发一次执行
*/
public static final String MISFIRE_FIRE_AND_PROCEED = "2";
/** 不触发立即执行 */
/**
* 不触发立即执行
*/
public static final String MISFIRE_DO_NOTHING = "3";
public enum Status
{
public enum Status {
/**
* 正常
*/
@ -35,15 +43,13 @@ public class ScheduleConstants
*/
PAUSE("1");
private String value;
private final String value;
private Status(String value)
{
Status(String value) {
this.value = value;
}
public String getValue()
{
public String getValue() {
return value;
}
}

View File

@ -2,65 +2,98 @@ package com.fastbee.common.constant;
/**
* 用户常量信息
*
*
* @author ruoyi
*/
public class UserConstants
{
public class UserConstants {
/**
* 平台内系统用户的唯一标志
*/
public static final String SYS_USER = "SYS_USER";
/** 正常状态 */
/**
* 正常状态
*/
public static final String NORMAL = "0";
/** 异常状态 */
/**
* 异常状态
*/
public static final String EXCEPTION = "1";
/** 用户封禁状态 */
/**
* 用户封禁状态
*/
public static final String USER_DISABLE = "1";
/** 角色封禁状态 */
/**
* 角色封禁状态
*/
public static final String ROLE_DISABLE = "1";
/** 部门正常状态 */
/**
* 部门正常状态
*/
public static final String DEPT_NORMAL = "0";
/** 部门停用状态 */
/**
* 部门停用状态
*/
public static final String DEPT_DISABLE = "1";
/** 字典正常状态 */
/**
* 字典正常状态
*/
public static final String DICT_NORMAL = "0";
/** 是否为系统默认(是) */
/**
* 是否为系统默认(是)
*/
public static final String YES = "Y";
/** 是否菜单外链(是) */
/**
* 是否菜单外链(是)
*/
public static final String YES_FRAME = "0";
/** 是否菜单外链(否) */
/**
* 是否菜单外链(否)
*/
public static final String NO_FRAME = "1";
/** 菜单类型(目录) */
/**
* 菜单类型(目录)
*/
public static final String TYPE_DIR = "M";
/** 菜单类型(菜单) */
/**
* 菜单类型(菜单)
*/
public static final String TYPE_MENU = "C";
/** 菜单类型(按钮) */
/**
* 菜单类型(按钮)
*/
public static final String TYPE_BUTTON = "F";
/** Layout组件标识 */
/**
* Layout组件标识
*/
public final static String LAYOUT = "Layout";
/** ParentView组件标识 */
/**
* ParentView组件标识
*/
public final static String PARENT_VIEW = "ParentView";
/** InnerLink组件标识 */
/**
* InnerLink组件标识
*/
public final static String INNER_LINK = "InnerLink";
/** 校验返回结果码 */
/**
* 校验返回结果码
*/
public final static String UNIQUE = "0";
public final static String NOT_UNIQUE = "1";

View File

@ -85,8 +85,7 @@ public class BaseController {
return rspData;
}
protected TableDataInfo getDataTable(List<?> list, Long total)
{
protected TableDataInfo getDataTable(List<?> list, Long total) {
TableDataInfo rspData = new TableDataInfo();
rspData.setCode(HttpStatus.SUCCESS);
rspData.setMsg("查询成功");

View File

@ -7,54 +7,52 @@ import java.util.HashMap;
/**
* 操作消息提醒
*
*
* @author ruoyi
*/
public class AjaxResult extends HashMap<String, Object>
{
private static final long serialVersionUID = 1L;
/** 状态码 */
public class AjaxResult extends HashMap<String, Object> {
/**
* 状态码
*/
public static final String CODE_TAG = "code";
/** 返回内容 */
/**
* 返回内容
*/
public static final String MSG_TAG = "msg";
/** 数据对象 */
/**
* 数据对象
*/
public static final String DATA_TAG = "data";
private static final long serialVersionUID = 1L;
/**
* 初始化一个新创建的 AjaxResult 对象,使其表示一个空消息。
*/
public AjaxResult()
{
public AjaxResult() {
}
/**
* 初始化一个新创建的 AjaxResult 对象
*
*
* @param code 状态码
* @param msg 返回内容
* @param msg 返回内容
*/
public AjaxResult(int code, String msg)
{
public AjaxResult(int code, String msg) {
super.put(CODE_TAG, code);
super.put(MSG_TAG, msg);
}
/**
* 初始化一个新创建的 AjaxResult 对象
*
*
* @param code 状态码
* @param msg 返回内容
* @param msg 返回内容
* @param data 数据对象
*/
public AjaxResult(int code, String msg, Object data)
{
public AjaxResult(int code, String msg, Object data) {
super.put(CODE_TAG, code);
super.put(MSG_TAG, msg);
if (StringUtils.isNotNull(data))
{
if (StringUtils.isNotNull(data)) {
super.put(DATA_TAG, data);
}
}
@ -64,37 +62,33 @@ public class AjaxResult extends HashMap<String, Object>
* 初始化一个新创建的 AjaxResult 对象
*
* @param code 状态码
* @param msg 返回内容
* @param msg 返回内容
* @param data 数据对象
*/
public AjaxResult(int code, String msg, Object data,int total)
{
public AjaxResult(int code, String msg, Object data, int total) {
super.put(CODE_TAG, code);
super.put(MSG_TAG, msg);
if (StringUtils.isNotNull(data))
{
if (StringUtils.isNotNull(data)) {
super.put(DATA_TAG, data);
}
super.put("total",total);
super.put("total", total);
}
/**
* 返回成功消息
*
*
* @return 成功消息
*/
public static AjaxResult success()
{
public static AjaxResult success() {
return AjaxResult.success("操作成功");
}
/**
* 返回成功数据
*
*
* @return 成功消息
*/
public static AjaxResult success(Object data)
{
public static AjaxResult success(Object data) {
return AjaxResult.success("操作成功", data);
}
@ -103,31 +97,28 @@ public class AjaxResult extends HashMap<String, Object>
*
* @return 成功消息
*/
public static AjaxResult success(Object data,int total)
{
return new AjaxResult(HttpStatus.SUCCESS, "操作成功", data,total);
public static AjaxResult success(Object data, int total) {
return new AjaxResult(HttpStatus.SUCCESS, "操作成功", data, total);
}
/**
* 返回成功消息
*
*
* @param msg 返回内容
* @return 成功消息
*/
public static AjaxResult success(String msg)
{
public static AjaxResult success(String msg) {
return AjaxResult.success(msg, null);
}
/**
* 返回成功消息
*
* @param msg 返回内容
*
* @param msg 返回内容
* @param data 数据对象
* @return 成功消息
*/
public static AjaxResult success(String msg, Object data)
{
public static AjaxResult success(String msg, Object data) {
return new AjaxResult(HttpStatus.SUCCESS, msg, data);
}
@ -137,78 +128,71 @@ public class AjaxResult extends HashMap<String, Object>
* @param msg 返回内容
* @return 警告消息
*/
public static AjaxResult warn(String msg)
{
public static AjaxResult warn(String msg) {
return AjaxResult.warn(msg, null);
}
/**
* 返回警告消息
*
* @param msg 返回内容
* @param msg 返回内容
* @param data 数据对象
* @return 警告消息
*/
public static AjaxResult warn(String msg, Object data)
{
public static AjaxResult warn(String msg, Object data) {
return new AjaxResult(HttpStatus.WARN, msg, data);
}
/**
* 返回错误消息
*
*
* @return 错误消息
*/
public static AjaxResult error()
{
public static AjaxResult error() {
return AjaxResult.error("操作失败");
}
/**
* 返回错误消息
*
*
* @param msg 返回内容
* @return 错误消息
*/
public static AjaxResult error(String msg)
{
public static AjaxResult error(String msg) {
return AjaxResult.error(msg, null);
}
/**
* 返回错误消息
*
* @param msg 返回内容
*
* @param msg 返回内容
* @param data 数据对象
* @return 错误消息
*/
public static AjaxResult error(String msg, Object data)
{
public static AjaxResult error(String msg, Object data) {
return new AjaxResult(HttpStatus.ERROR, msg, data);
}
/**
* 返回错误消息
*
*
* @param code 状态码
* @param msg 返回内容
* @param msg 返回内容
* @return 错误消息
*/
public static AjaxResult error(int code, String msg)
{
public static AjaxResult error(int code, String msg) {
return new AjaxResult(code, msg, null);
}
/**
* 方便链式调用
*
* @param key 键
* @param key 键
* @param value 值
* @return 数据对象
*/
@Override
public AjaxResult put(String key, Object value)
{
public AjaxResult put(String key, Object value) {
super.put(key, value);
return this;
}

View File

@ -10,6 +10,7 @@ import java.time.LocalDateTime;
/**
* 基类,时间类型改为LocalDateTime
*
* @author fastb
* @date 2023-08-22 9:11
*/
@ -17,25 +18,35 @@ import java.time.LocalDateTime;
public class BaseDO implements Serializable {
private static final long serialVersionUID = 1L;
/** 创建者 */
/**
* 创建者
*/
@ApiModelProperty("创建者")
private String createBy;
/** 创建时间 */
/**
* 创建时间
*/
@ApiModelProperty("创建时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime createTime;
/** 更新者 */
/**
* 更新者
*/
@ApiModelProperty("更新者")
private String updateBy;
/** 更新时间 */
/**
* 更新时间
*/
@ApiModelProperty("更新时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime updateTime;
/** 逻辑删除 */
/**
* 逻辑删除
*/
@ApiModelProperty("逻辑删除")
@TableLogic
private Boolean delFlag;

View File

@ -16,38 +16,60 @@ import java.util.Map;
*
* @author ruoyi
*/
public class BaseEntity implements Serializable
{
public class BaseEntity implements Serializable {
private static final long serialVersionUID = 1L;
/** 搜索值 */
/**
* 搜索值
*/
@TableField(exist = false)
@ApiModelProperty("搜索值")
@JsonIgnore
private String searchValue;
/** 创建者 */
/**
* 创建者
*/
@ApiModelProperty("创建者")
private String createBy;
/** 创建时间 */
/**
* 创建时间
*/
@ApiModelProperty("创建时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
/** 更新者 */
/**
* 更新者
*/
@ApiModelProperty("更新者")
private String updateBy;
/** 更新时间 */
/**
* 更新时间
*/
@ApiModelProperty("更新时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date updateTime;
/** 备注 */
/**
* 备注
*/
@ApiModelProperty("备注")
@TableField(exist = false)
private String remark;
@TableField(exist = false)
private Integer pageNum;
@TableField(exist = false)
private Integer pageSize;
/**
* 请求参数
*/
@TableField(exist = false)
@ApiModelProperty("请求参数")
@JsonInclude(JsonInclude.Include.NON_EMPTY)
private Map<String, Object> params;
public Integer getPageNum() {
return pageNum;
@ -65,89 +87,62 @@ public class BaseEntity implements Serializable
this.pageSize = pageSize;
}
@TableField(exist = false)
private Integer pageNum;
@TableField(exist = false)
private Integer pageSize;
/** 请求参数 */
@TableField(exist = false)
@ApiModelProperty("请求参数")
@JsonInclude(JsonInclude.Include.NON_EMPTY)
private Map<String, Object> params;
public String getSearchValue()
{
public String getSearchValue() {
return searchValue;
}
public void setSearchValue(String searchValue)
{
public void setSearchValue(String searchValue) {
this.searchValue = searchValue;
}
public String getCreateBy()
{
public String getCreateBy() {
return createBy;
}
public void setCreateBy(String createBy)
{
public void setCreateBy(String createBy) {
this.createBy = createBy;
}
public Date getCreateTime()
{
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime)
{
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public String getUpdateBy()
{
public String getUpdateBy() {
return updateBy;
}
public void setUpdateBy(String updateBy)
{
public void setUpdateBy(String updateBy) {
this.updateBy = updateBy;
}
public Date getUpdateTime()
{
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime)
{
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public String getRemark()
{
public String getRemark() {
return remark;
}
public void setRemark(String remark)
{
public void setRemark(String remark) {
this.remark = remark;
}
public Map<String, Object> getParams()
{
if (params == null)
{
public Map<String, Object> getParams() {
if (params == null) {
params = new HashMap<>();
}
return params;
}
public void setParams(Map<String, Object> params)
{
public void setParams(Map<String, Object> params) {
this.params = params;
}
}

View File

@ -37,11 +37,11 @@ public class CommonResult<T> implements Serializable {
/**
* 将传入的 result 对象,转换成另外一个泛型结果的对象
*
* <p>
* 因为 A 方法返回的 CommonResult 对象,不满足调用其的 B 方法的返回,所以需要进行转换。
*
* @param result 传入的 result 对象
* @param <T> 返回的泛型
* @param <T> 返回的泛型
* @return 新的 CommonResult 对象
*/
public static <T> CommonResult<T> error(CommonResult<?> result) {
@ -72,18 +72,22 @@ public class CommonResult<T> implements Serializable {
return Objects.equals(code, GlobalErrorCodeConstants.SUCCESS.getCode());
}
public static <T> CommonResult<T> error(ServiceException serviceException) {
return error(serviceException.getCode(), serviceException.getMessage());
}
@JsonIgnore // 避免 jackson 序列化
public boolean isSuccess() {
return isSuccess(code);
}
// ========= 和 Exception 异常体系集成 =========
@JsonIgnore // 避免 jackson 序列化
public boolean isError() {
return !isSuccess();
}
// ========= 和 Exception 异常体系集成 =========
/**
* 判断是否有异常。如果有,则抛出 {@link ServiceException} 异常
*/
@ -105,8 +109,4 @@ public class CommonResult<T> implements Serializable {
return data;
}
public static <T> CommonResult<T> error(ServiceException serviceException) {
return error(serviceException.getCode(), serviceException.getMessage());
}
}

View File

@ -9,64 +9,55 @@ import java.io.Serializable;
*
* @author ruoyi
*/
public class R<T> implements Serializable
{
private static final long serialVersionUID = 1L;
/** 成功 */
public class R<T> implements Serializable {
/**
* 成功
*/
public static final int SUCCESS = HttpStatus.SUCCESS;
/** 失败 */
/**
* 失败
*/
public static final int FAIL = HttpStatus.ERROR;
private static final long serialVersionUID = 1L;
private int code;
private String msg;
private T data;
public static <T> R<T> ok()
{
public static <T> R<T> ok() {
return restResult(null, SUCCESS, "操作成功");
}
public static <T> R<T> ok(T data)
{
public static <T> R<T> ok(T data) {
return restResult(data, SUCCESS, "操作成功");
}
public static <T> R<T> ok(T data, String msg)
{
public static <T> R<T> ok(T data, String msg) {
return restResult(data, SUCCESS, msg);
}
public static <T> R<T> fail()
{
public static <T> R<T> fail() {
return restResult(null, FAIL, "操作失败");
}
public static <T> R<T> fail(String msg)
{
public static <T> R<T> fail(String msg) {
return restResult(null, FAIL, msg);
}
public static <T> R<T> fail(T data)
{
public static <T> R<T> fail(T data) {
return restResult(data, FAIL, "操作失败");
}
public static <T> R<T> fail(T data, String msg)
{
public static <T> R<T> fail(T data, String msg) {
return restResult(data, FAIL, msg);
}
public static <T> R<T> fail(int code, String msg)
{
public static <T> R<T> fail(int code, String msg) {
return restResult(null, code, msg);
}
private static <T> R<T> restResult(T data, int code, String msg)
{
private static <T> R<T> restResult(T data, int code, String msg) {
R<T> apiResult = new R<>();
apiResult.setCode(code);
apiResult.setData(data);
@ -74,43 +65,35 @@ public class R<T> implements Serializable
return apiResult;
}
public int getCode()
{
return code;
}
public void setCode(int code)
{
this.code = code;
}
public String getMsg()
{
return msg;
}
public void setMsg(String msg)
{
this.msg = msg;
}
public T getData()
{
return data;
}
public void setData(T data)
{
this.data = data;
}
public static <T> Boolean isError(R<T> ret)
{
public static <T> Boolean isError(R<T> ret) {
return !isSuccess(ret);
}
public static <T> Boolean isSuccess(R<T> ret)
{
public static <T> Boolean isSuccess(R<T> ret) {
return R.SUCCESS == ret.getCode();
}
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public T getData() {
return data;
}
public void setData(T data) {
this.data = data;
}
}

View File

@ -4,7 +4,7 @@ import java.io.Serializable;
/**
* 排序字段 DTO
*
* <p>
* 类名加了 ing 的原因是,避免和 ES SortField 重名。
*/
public class SortingField implements Serializable {

View File

@ -5,75 +5,74 @@ import java.util.List;
/**
* Tree基类
*
*
* @author ruoyi
*/
public class TreeEntity extends BaseEntity
{
public class TreeEntity extends BaseEntity {
private static final long serialVersionUID = 1L;
/** 父菜单名称 */
/**
* 父菜单名称
*/
private String parentName;
/** 父菜单ID */
/**
* 父菜单ID
*/
private Long parentId;
/** 显示顺序 */
/**
* 显示顺序
*/
private Integer orderNum;
/** 祖级列表 */
/**
* 祖级列表
*/
private String ancestors;
/** 子部门 */
/**
* 子部门
*/
private List<?> children = new ArrayList<>();
public String getParentName()
{
public String getParentName() {
return parentName;
}
public void setParentName(String parentName)
{
public void setParentName(String parentName) {
this.parentName = parentName;
}
public Long getParentId()
{
public Long getParentId() {
return parentId;
}
public void setParentId(Long parentId)
{
public void setParentId(Long parentId) {
this.parentId = parentId;
}
public Integer getOrderNum()
{
public Integer getOrderNum() {
return orderNum;
}
public void setOrderNum(Integer orderNum)
{
public void setOrderNum(Integer orderNum) {
this.orderNum = orderNum;
}
public String getAncestors()
{
public String getAncestors() {
return ancestors;
}
public void setAncestors(String ancestors)
{
public void setAncestors(String ancestors) {
this.ancestors = ancestors;
}
public List<?> getChildren()
{
public List<?> getChildren() {
return children;
}
public void setChildren(List<?> children)
{
public void setChildren(List<?> children) {
this.children = children;
}
}

View File

@ -10,69 +10,65 @@ import java.util.stream.Collectors;
/**
* Treeselect树结构实体类
*
*
* @author ruoyi
*/
public class TreeSelect implements Serializable
{
public class TreeSelect implements Serializable {
private static final long serialVersionUID = 1L;
/** 节点ID */
/**
* 节点ID
*/
private Long id;
/** 节点名称 */
/**
* 节点名称
*/
private String label;
/** 子节点 */
/**
* 子节点
*/
@JsonInclude(JsonInclude.Include.NON_EMPTY)
private List<TreeSelect> children;
public TreeSelect()
{
public TreeSelect() {
}
public TreeSelect(SysDept dept)
{
public TreeSelect(SysDept dept) {
this.id = dept.getDeptId();
this.label = dept.getDeptName();
this.children = dept.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList());
}
public TreeSelect(SysMenu menu)
{
public TreeSelect(SysMenu menu) {
this.id = menu.getMenuId();
this.label = menu.getMenuName();
this.children = menu.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList());
}
public Long getId()
{
public Long getId() {
return id;
}
public void setId(Long id)
{
public void setId(Long id) {
this.id = id;
}
public String getLabel()
{
public String getLabel() {
return label;
}
public void setLabel(String label)
{
public void setLabel(String label) {
this.label = label;
}
public List<TreeSelect> getChildren()
{
public List<TreeSelect> getChildren() {
return children;
}
public void setChildren(List<TreeSelect> children)
{
public void setChildren(List<TreeSelect> children) {
this.children = children;
}
}

View File

@ -19,11 +19,12 @@ import java.util.List;
* @author ruoyi
*/
@ApiModel(value = "SysDept", description = "部门表 sys_dept")
public class SysDept extends BaseEntity
{
public class SysDept extends BaseEntity {
private static final long serialVersionUID = 1L;
/** 部门ID */
/**
* 部门ID
*/
@ApiModelProperty("部门ID")
private Long deptId;
@ -32,47 +33,69 @@ public class SysDept extends BaseEntity
*/
private Long deptUserId;
/** 父部门ID */
/**
* 父部门ID
*/
@ApiModelProperty("父部门ID")
private Long parentId;
/** 祖级列表 */
/**
* 祖级列表
*/
@ApiModelProperty("祖级列表")
private String ancestors;
/** 部门名称 */
/**
* 部门名称
*/
@ApiModelProperty("部门名称")
private String deptName;
/** 显示顺序 */
/**
* 显示顺序
*/
@ApiModelProperty("显示顺序")
private Integer orderNum;
/** 负责人 */
/**
* 负责人
*/
@ApiModelProperty("负责人")
private String leader;
/** 联系电话 */
/**
* 联系电话
*/
@ApiModelProperty("联系电话")
private String phone;
/** 邮箱 */
/**
* 邮箱
*/
@ApiModelProperty("邮箱")
private String email;
/** 部门状态:0正常,1停用 */
/**
* 部门状态:0正常,1停用
*/
@ApiModelProperty("部门状态:0正常,1停用")
private String status;
/** 删除标志(0代表存在 2代表删除) */
/**
* 删除标志(0代表存在 2代表删除)
*/
@ApiModelProperty("删除标志(0代表存在 2代表删除)")
private String delFlag;
/** 父部门名称 */
/**
* 父部门名称
*/
@ApiModelProperty("父部门名称")
private String parentName;
/** 子部门 */
/**
* 子部门
*/
@ApiModelProperty("子部门")
private List<SysDept> children = new ArrayList<SysDept>();
@ -95,6 +118,14 @@ public class SysDept extends BaseEntity
* 机构类型
*/
private Integer deptType;
/**
* 是否显示自己
*/
private Boolean showOwner;
/**
* 管理员姓名
*/
private String deptUserName;
public Boolean getShowOwner() {
return showOwner;
@ -104,16 +135,6 @@ public class SysDept extends BaseEntity
this.showOwner = showOwner;
}
/**
* 是否显示自己
*/
private Boolean showOwner;
/**
* 管理员姓名
*/
private String deptUserName;
public String getDeptUserName() {
return deptUserName;
}
@ -162,150 +183,126 @@ public class SysDept extends BaseEntity
this.deptUserId = deptUserId;
}
public Long getDeptId()
{
public Long getDeptId() {
return deptId;
}
public void setDeptId(Long deptId)
{
public void setDeptId(Long deptId) {
this.deptId = deptId;
}
public Long getParentId()
{
public Long getParentId() {
return parentId;
}
public void setParentId(Long parentId)
{
public void setParentId(Long parentId) {
this.parentId = parentId;
}
public String getAncestors()
{
public String getAncestors() {
return ancestors;
}
public void setAncestors(String ancestors)
{
public void setAncestors(String ancestors) {
this.ancestors = ancestors;
}
@NotBlank(message = "部门名称不能为空")
@Size(min = 0, max = 30, message = "部门名称长度不能超过30个字符")
public String getDeptName()
{
public String getDeptName() {
return deptName;
}
public void setDeptName(String deptName)
{
public void setDeptName(String deptName) {
this.deptName = deptName;
}
@NotNull(message = "显示顺序不能为空")
public Integer getOrderNum()
{
public Integer getOrderNum() {
return orderNum;
}
public void setOrderNum(Integer orderNum)
{
public void setOrderNum(Integer orderNum) {
this.orderNum = orderNum;
}
public String getLeader()
{
public String getLeader() {
return leader;
}
public void setLeader(String leader)
{
public void setLeader(String leader) {
this.leader = leader;
}
@Size(min = 0, max = 11, message = "联系电话长度不能超过11个字符")
public String getPhone()
{
public String getPhone() {
return phone;
}
public void setPhone(String phone)
{
public void setPhone(String phone) {
this.phone = phone;
}
@Email(message = "邮箱格式不正确")
@Size(min = 0, max = 50, message = "邮箱长度不能超过50个字符")
public String getEmail()
{
public String getEmail() {
return email;
}
public void setEmail(String email)
{
public void setEmail(String email) {
this.email = email;
}
public String getStatus()
{
public String getStatus() {
return status;
}
public void setStatus(String status)
{
public void setStatus(String status) {
this.status = status;
}
public String getDelFlag()
{
public String getDelFlag() {
return delFlag;
}
public void setDelFlag(String delFlag)
{
public void setDelFlag(String delFlag) {
this.delFlag = delFlag;
}
public String getParentName()
{
public String getParentName() {
return parentName;
}
public void setParentName(String parentName)
{
public void setParentName(String parentName) {
this.parentName = parentName;
}
public List<SysDept> getChildren()
{
public List<SysDept> getChildren() {
return children;
}
public void setChildren(List<SysDept> children)
{
public void setChildren(List<SysDept> children) {
this.children = children;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("deptId", getDeptId())
.append("deptUserId", getDeptUserId())
.append("parentId", getParentId())
.append("ancestors", getAncestors())
.append("deptName", getDeptName())
.append("orderNum", getOrderNum())
.append("leader", getLeader())
.append("phone", getPhone())
.append("email", getEmail())
.append("status", getStatus())
.append("delFlag", getDelFlag())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.toString();
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("deptId", getDeptId())
.append("deptUserId", getDeptUserId())
.append("parentId", getParentId())
.append("ancestors", getAncestors())
.append("deptName", getDeptName())
.append("orderNum", getOrderNum())
.append("leader", getLeader())
.append("phone", getPhone())
.append("email", getEmail())
.append("status", getStatus())
.append("delFlag", getDelFlag())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.toString();
}
}

View File

@ -20,57 +20,78 @@ import javax.validation.constraints.Size;
*/
@Data
@ApiModel(value = "SysDictData", description = "字典数据表 sys_dict_data")
public class SysDictData extends BaseEntity
{
public class SysDictData extends BaseEntity {
private static final long serialVersionUID = 1L;
/** 字典编码 */
/**
* 字典编码
*/
@ApiModelProperty("字典编码")
@Excel(name = "字典编码", cellType = ColumnType.NUMERIC)
private Long dictCode;
/** 字典排序 */
/**
* 字典排序
*/
@ApiModelProperty("字典排序")
@Excel(name = "字典排序", cellType = ColumnType.NUMERIC)
private Long dictSort;
/** 字典标签 */
/**
* 字典标签
*/
@ApiModelProperty("字典标签")
@Excel(name = "字典标签")
private String dictLabel;
/** 字典标签 */
/**
* 字典标签
*/
@ApiModelProperty("中文字典标签")
private String dictLabel_zh_CN;
/** 字典标签 */
/**
* 字典标签
*/
@ApiModelProperty("英文字典标签")
private String dictLabel_en_US;
/** 字典键值 */
/**
* 字典键值
*/
@ApiModelProperty("字典键值")
@Excel(name = "字典键值")
private String dictValue;
/** 字典类型 */
/**
* 字典类型
*/
@ApiModelProperty("字典类型")
@Excel(name = "字典类型")
private String dictType;
/** 样式属性(其他样式扩展) */
/**
* 样式属性(其他样式扩展)
*/
@ApiModelProperty("样式属性(其他样式扩展)")
private String cssClass;
/** 表格字典样式 */
/**
* 表格字典样式
*/
@ApiModelProperty("表格字典样式")
private String listClass;
/** 是否默认(Y是 N否) */
/**
* 是否默认(Y是 N否)
*/
@ApiModelProperty("是否默认(Y是 N否)")
@Excel(name = "是否默认", readConverterExp = "Y=是,N=否")
private String isDefault;
/** 状态(0正常 1停用) */
/**
* 状态(0正常 1停用)
*/
@ApiModelProperty("状态(0正常 1停用)")
@Excel(name = "状态", readConverterExp = "0=正常,1=停用")
private String status;
@ -78,105 +99,86 @@ public class SysDictData extends BaseEntity
@Deprecated
private String language;
public Long getDictCode()
{
public Long getDictCode() {
return dictCode;
}
public void setDictCode(Long dictCode)
{
public void setDictCode(Long dictCode) {
this.dictCode = dictCode;
}
public Long getDictSort()
{
public Long getDictSort() {
return dictSort;
}
public void setDictSort(Long dictSort)
{
public void setDictSort(Long dictSort) {
this.dictSort = dictSort;
}
@NotBlank(message = "字典标签不能为空")
@Size(min = 0, max = 100, message = "字典标签长度不能超过100个字符")
public String getDictLabel()
{
public String getDictLabel() {
return dictLabel;
}
public void setDictLabel(String dictLabel)
{
public void setDictLabel(String dictLabel) {
this.dictLabel = dictLabel;
}
@NotBlank(message = "字典键值不能为空")
@Size(min = 0, max = 100, message = "字典键值长度不能超过100个字符")
public String getDictValue()
{
public String getDictValue() {
return dictValue;
}
public void setDictValue(String dictValue)
{
public void setDictValue(String dictValue) {
this.dictValue = dictValue;
}
@NotBlank(message = "字典类型不能为空")
@Size(min = 0, max = 100, message = "字典类型长度不能超过100个字符")
public String getDictType()
{
public String getDictType() {
return dictType;
}
public void setDictType(String dictType)
{
public void setDictType(String dictType) {
this.dictType = dictType;
}
@Size(min = 0, max = 100, message = "样式属性长度不能超过100个字符")
public String getCssClass()
{
public String getCssClass() {
return cssClass;
}
public void setCssClass(String cssClass)
{
public void setCssClass(String cssClass) {
this.cssClass = cssClass;
}
public String getListClass()
{
public String getListClass() {
return listClass;
}
public void setListClass(String listClass)
{
public void setListClass(String listClass) {
this.listClass = listClass;
}
public boolean getDefault()
{
public boolean getDefault() {
return UserConstants.YES.equals(this.isDefault);
}
public String getIsDefault()
{
public String getIsDefault() {
return isDefault;
}
public void setIsDefault(String isDefault)
{
public void setIsDefault(String isDefault) {
this.isDefault = isDefault;
}
public String getStatus()
{
public String getStatus() {
return status;
}
public void setStatus(String status)
{
public void setStatus(String status) {
this.status = status;
}
@ -190,7 +192,7 @@ public class SysDictData extends BaseEntity
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("dictCode", getDictCode())
.append("dictSort", getDictSort())
.append("dictLabel", getDictLabel())

View File

@ -18,26 +18,33 @@ import javax.validation.constraints.Size;
* @author ruoyi
*/
@ApiModel(value = "SysDictType", description = "字典类型表 sys_dict_type")
public class SysDictType extends BaseEntity
{
public class SysDictType extends BaseEntity {
private static final long serialVersionUID = 1L;
/** 字典主键 */
/**
* 字典主键
*/
@ApiModelProperty("字典主键")
@Excel(name = "字典主键", cellType = ColumnType.NUMERIC)
private Long dictId;
/** 字典名称 */
/**
* 字典名称
*/
@ApiModelProperty("字典名称")
@Excel(name = "字典名称")
private String dictName;
/** 字典类型 */
/**
* 字典类型
*/
@ApiModelProperty("字典类型")
@Excel(name = "字典类型")
private String dictType;
/** 状态(0正常 1停用) */
/**
* 状态(0正常 1停用)
*/
@ApiModelProperty("状态(0正常 1停用)")
@Excel(name = "状态", readConverterExp = "0=正常,1=停用")
private String status;
@ -46,48 +53,40 @@ public class SysDictType extends BaseEntity
private String language;
public Long getDictId()
{
public Long getDictId() {
return dictId;
}
public void setDictId(Long dictId)
{
public void setDictId(Long dictId) {
this.dictId = dictId;
}
@NotBlank(message = "字典名称不能为空")
@Size(min = 0, max = 100, message = "字典类型名称长度不能超过100个字符")
public String getDictName()
{
public String getDictName() {
return dictName;
}
public void setDictName(String dictName)
{
public void setDictName(String dictName) {
this.dictName = dictName;
}
@NotBlank(message = "字典类型不能为空")
@Size(min = 0, max = 100, message = "字典类型类型长度不能超过100个字符")
@Pattern(regexp = "^[a-z][a-z0-9_]*$", message = "字典类型必须以字母开头,且只能为(小写字母,数字,下滑线)")
public String getDictType()
{
public String getDictType() {
return dictType;
}
public void setDictType(String dictType)
{
public void setDictType(String dictType) {
this.dictType = dictType;
}
public String getStatus()
{
public String getStatus() {
return status;
}
public void setStatus(String status)
{
public void setStatus(String status) {
this.status = status;
}
@ -103,16 +102,16 @@ public class SysDictType extends BaseEntity
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("dictId", getDictId())
.append("dictName", getDictName())
.append("dictType", getDictType())
.append("status", getStatus())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.toString();
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("dictId", getDictId())
.append("dictName", getDictName())
.append("dictType", getDictType())
.append("status", getStatus())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.toString();
}
}

View File

@ -14,75 +14,106 @@ import java.util.List;
/**
* 菜单权限表 sys_menu
*
*
* @author ruoyi
*/
@ApiModel(value = "SysMenu", description = "菜单权限表 sys_menu")
public class SysMenu extends BaseEntity
{
public class SysMenu extends BaseEntity {
private static final long serialVersionUID = 1L;
/** 菜单ID */
/**
* 菜单ID
*/
@ApiModelProperty("菜单ID")
private Long menuId;
/** 菜单名称 */
/**
* 菜单名称
*/
@ApiModelProperty("菜单名称")
private String menuName;
/** 父菜单名称 */
/**
* 父菜单名称
*/
@ApiModelProperty("父菜单名称")
private String parentName;
/** 父菜单ID */
/**
* 父菜单ID
*/
@ApiModelProperty("父菜单ID")
private Long parentId;
/** 显示顺序 */
/**
* 显示顺序
*/
@ApiModelProperty("显示顺序")
private Integer orderNum;
/** 路由地址 */
/**
* 路由地址
*/
@ApiModelProperty("路由地址")
private String path;
/** 组件路径 */
/**
* 组件路径
*/
@ApiModelProperty("组件路径")
private String component;
/** 路由参数 */
/**
* 路由参数
*/
@ApiModelProperty("路由参数")
private String query;
/** 是否为外链(0是 1否) */
/**
* 是否为外链(0是 1否)
*/
@ApiModelProperty("是否为外链(0是 1否)")
private String isFrame;
/** 是否缓存(0缓存 1不缓存) */
/**
* 是否缓存(0缓存 1不缓存)
*/
@ApiModelProperty("是否缓存(0缓存 1不缓存)")
private String isCache;
/** 类型(M目录 C菜单 F按钮) */
/**
* 类型(M目录 C菜单 F按钮)
*/
@ApiModelProperty("类型(M目录 C菜单 F按钮)")
private String menuType;
/** 显示状态(0显示 1隐藏) */
/**
* 显示状态(0显示 1隐藏)
*/
@ApiModelProperty("显示状态(0显示 1隐藏)")
private String visible;
/** 菜单状态(0正常 1停用) */
/**
* 菜单状态(0正常 1停用)
*/
@ApiModelProperty("菜单状态(0正常 1停用)")
private String status;
/** 权限字符串 */
/**
* 权限字符串
*/
@ApiModelProperty("权限字符串")
private String perms;
/** 菜单图标 */
/**
* 菜单图标
*/
@ApiModelProperty("菜单图标")
private String icon;
/** 子菜单 */
/**
* 子菜单
*/
@ApiModelProperty("子菜单")
private List<SysMenu> children = new ArrayList<SysMenu>();
@ -91,18 +122,19 @@ public class SysMenu extends BaseEntity
*/
private Long deptId;
/** 菜单语言 */
/**
* 菜单语言
*/
@Deprecated
private String language;
public void setLanguage(String language) {
this.language = language;
}
public String getLanguage() {
return language;
}
public void setLanguage(String language) {
this.language = language;
}
public Long getDeptId() {
return deptId;
@ -112,194 +144,162 @@ public class SysMenu extends BaseEntity
this.deptId = deptId;
}
public Long getMenuId()
{
public Long getMenuId() {
return menuId;
}
public void setMenuId(Long menuId)
{
public void setMenuId(Long menuId) {
this.menuId = menuId;
}
@NotBlank(message = "菜单名称不能为空")
@Size(min = 0, max = 50, message = "菜单名称长度不能超过50个字符")
public String getMenuName()
{
public String getMenuName() {
return menuName;
}
public void setMenuName(String menuName)
{
public void setMenuName(String menuName) {
this.menuName = menuName;
}
public String getParentName()
{
public String getParentName() {
return parentName;
}
public void setParentName(String parentName)
{
public void setParentName(String parentName) {
this.parentName = parentName;
}
public Long getParentId()
{
public Long getParentId() {
return parentId;
}
public void setParentId(Long parentId)
{
public void setParentId(Long parentId) {
this.parentId = parentId;
}
@NotNull(message = "显示顺序不能为空")
public Integer getOrderNum()
{
public Integer getOrderNum() {
return orderNum;
}
public void setOrderNum(Integer orderNum)
{
public void setOrderNum(Integer orderNum) {
this.orderNum = orderNum;
}
@Size(min = 0, max = 200, message = "路由地址不能超过200个字符")
public String getPath()
{
public String getPath() {
return path;
}
public void setPath(String path)
{
public void setPath(String path) {
this.path = path;
}
@Size(min = 0, max = 200, message = "组件路径不能超过255个字符")
public String getComponent()
{
public String getComponent() {
return component;
}
public void setComponent(String component)
{
public void setComponent(String component) {
this.component = component;
}
public String getQuery()
{
public String getQuery() {
return query;
}
public void setQuery(String query)
{
public void setQuery(String query) {
this.query = query;
}
public String getIsFrame()
{
public String getIsFrame() {
return isFrame;
}
public void setIsFrame(String isFrame)
{
public void setIsFrame(String isFrame) {
this.isFrame = isFrame;
}
public String getIsCache()
{
public String getIsCache() {
return isCache;
}
public void setIsCache(String isCache)
{
public void setIsCache(String isCache) {
this.isCache = isCache;
}
@NotBlank(message = "菜单类型不能为空")
public String getMenuType()
{
public String getMenuType() {
return menuType;
}
public void setMenuType(String menuType)
{
public void setMenuType(String menuType) {
this.menuType = menuType;
}
public String getVisible()
{
public String getVisible() {
return visible;
}
public void setVisible(String visible)
{
public void setVisible(String visible) {
this.visible = visible;
}
public String getStatus()
{
public String getStatus() {
return status;
}
public void setStatus(String status)
{
public void setStatus(String status) {
this.status = status;
}
@Size(min = 0, max = 100, message = "权限标识长度不能超过100个字符")
public String getPerms()
{
public String getPerms() {
return perms;
}
public void setPerms(String perms)
{
public void setPerms(String perms) {
this.perms = perms;
}
public String getIcon()
{
public String getIcon() {
return icon;
}
public void setIcon(String icon)
{
public void setIcon(String icon) {
this.icon = icon;
}
public List<SysMenu> getChildren()
{
public List<SysMenu> getChildren() {
return children;
}
public void setChildren(List<SysMenu> children)
{
public void setChildren(List<SysMenu> children) {
this.children = children;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("menuId", getMenuId())
.append("menuName", getMenuName())
.append("parentId", getParentId())
.append("orderNum", getOrderNum())
.append("path", getPath())
.append("component", getComponent())
.append("isFrame", getIsFrame())
.append("IsCache", getIsCache())
.append("menuType", getMenuType())
.append("visible", getVisible())
.append("status ", getStatus())
.append("perms", getPerms())
.append("icon", getIcon())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.toString();
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("menuId", getMenuId())
.append("menuName", getMenuName())
.append("parentId", getParentId())
.append("orderNum", getOrderNum())
.append("path", getPath())
.append("component", getComponent())
.append("isFrame", getIsFrame())
.append("IsCache", getIsCache())
.append("menuType", getMenuType())
.append("visible", getVisible())
.append("status ", getStatus())
.append("perms", getPerms())
.append("icon", getIcon())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.toString();
}
}

View File

@ -19,64 +19,89 @@ import java.util.Set;
* @author ruoyi
*/
@ApiModel(value = "SysRole", description = "角色表 sys_role")
public class SysRole extends BaseEntity
{
public class SysRole extends BaseEntity {
private static final long serialVersionUID = 1L;
/** 角色ID */
/**
* 角色ID
*/
@ApiModelProperty("角色ID")
@Excel(name = "角色序号", cellType = ColumnType.NUMERIC)
private Long roleId;
/** 角色名称 */
/**
* 角色名称
*/
@ApiModelProperty("角色名称")
@Excel(name = "角色名称")
private String roleName;
/** 角色权限 */
/**
* 角色权限
*/
@ApiModelProperty("角色权限")
@Excel(name = "角色权限")
private String roleKey;
/** 角色排序 */
/**
* 角色排序
*/
@ApiModelProperty("角色排序")
@Excel(name = "角色排序")
private Integer roleSort;
/** 数据范围(1:所有数据权限;2:自定义数据权限;3:本部门数据权限;4:本部门及以下数据权限;5:仅本人数据权限) */
/**
* 数据范围(1:所有数据权限;2:自定义数据权限;3:本部门数据权限;4:本部门及以下数据权限;5:仅本人数据权限)
*/
@ApiModelProperty(value = "数据范围", notes = "(1:所有数据权限;2:自定义数据权限;3:本部门数据权限;4:本部门及以下数据权限;5:仅本人数据权限)")
@Excel(name = "数据范围", readConverterExp = "1=所有数据权限,2=自定义数据权限,3=本部门数据权限,4=本部门及以下数据权限,5=仅本人数据权限")
private String dataScope;
/** 菜单树选择项是否关联显示( 0:父子不互相关联显示 1:父子互相关联显示) */
/**
* 菜单树选择项是否关联显示( 0:父子不互相关联显示 1:父子互相关联显示)
*/
@ApiModelProperty(value = "菜单树选择项是否关联显示", notes = "( 0:父子不互相关联显示 1:父子互相关联显示)")
private boolean menuCheckStrictly;
/** 部门树选择项是否关联显示(0:父子不互相关联显示 1:父子互相关联显示 ) */
/**
* 部门树选择项是否关联显示(0:父子不互相关联显示 1:父子互相关联显示 )
*/
@ApiModelProperty(value = "部门树选择项是否关联显示", notes = "(0:父子不互相关联显示 1:父子互相关联显示 )")
private boolean deptCheckStrictly;
/** 角色状态(0正常 1停用) */
/**
* 角色状态(0正常 1停用)
*/
@ApiModelProperty("角色状态(0正常 1停用)")
@Excel(name = "角色状态", readConverterExp = "0=正常,1=停用")
private String status;
/** 删除标志(0代表存在 2代表删除) */
/**
* 删除标志(0代表存在 2代表删除)
*/
@ApiModelProperty("删除标志")
private String delFlag;
/** 用户是否存在此角色标识 默认不存在 */
/**
* 用户是否存在此角色标识 默认不存在
*/
private boolean flag = false;
/** 菜单组 */
/**
* 菜单组
*/
@ApiModelProperty("菜单组")
private Long[] menuIds;
/** 部门组(数据权限) */
/**
* 部门组(数据权限)
*/
@ApiModelProperty("部门组")
private Long[] deptIds;
/** 角色菜单权限 */
/**
* 角色菜单权限
*/
@ApiModelProperty("角色菜单权限")
private Set<String> permissions;
@ -105,6 +130,18 @@ public class SysRole extends BaseEntity
*/
private Boolean manager;
public SysRole() {
}
public SysRole(Long roleId) {
this.roleId = roleId;
}
public static boolean isAdmin(Long roleId) {
return roleId != null && 1L == roleId;
}
public Boolean getManager() {
return manager;
}
@ -145,178 +182,136 @@ public class SysRole extends BaseEntity
this.deptName = deptName;
}
public SysRole()
{
}
public SysRole(Long roleId)
{
this.roleId = roleId;
}
public Long getRoleId()
{
public Long getRoleId() {
return roleId;
}
public void setRoleId(Long roleId)
{
public void setRoleId(Long roleId) {
this.roleId = roleId;
}
public boolean isAdmin()
{
public boolean isAdmin() {
return isAdmin(this.roleId);
}
public static boolean isAdmin(Long roleId)
{
return roleId != null && 1L == roleId;
}
@NotBlank(message = "角色名称不能为空")
@Size(min = 0, max = 30, message = "角色名称长度不能超过30个字符")
public String getRoleName()
{
public String getRoleName() {
return roleName;
}
public void setRoleName(String roleName)
{
public void setRoleName(String roleName) {
this.roleName = roleName;
}
@NotBlank(message = "权限字符不能为空")
@Size(min = 0, max = 100, message = "权限字符长度不能超过100个字符")
public String getRoleKey()
{
public String getRoleKey() {
return roleKey;
}
public void setRoleKey(String roleKey)
{
public void setRoleKey(String roleKey) {
this.roleKey = roleKey;
}
@NotNull(message = "显示顺序不能为空")
public Integer getRoleSort()
{
public Integer getRoleSort() {
return roleSort;
}
public void setRoleSort(Integer roleSort)
{
public void setRoleSort(Integer roleSort) {
this.roleSort = roleSort;
}
public String getDataScope()
{
public String getDataScope() {
return dataScope;
}
public void setDataScope(String dataScope)
{
public void setDataScope(String dataScope) {
this.dataScope = dataScope;
}
public boolean isMenuCheckStrictly()
{
public boolean isMenuCheckStrictly() {
return menuCheckStrictly;
}
public void setMenuCheckStrictly(boolean menuCheckStrictly)
{
public void setMenuCheckStrictly(boolean menuCheckStrictly) {
this.menuCheckStrictly = menuCheckStrictly;
}
public boolean isDeptCheckStrictly()
{
public boolean isDeptCheckStrictly() {
return deptCheckStrictly;
}
public void setDeptCheckStrictly(boolean deptCheckStrictly)
{
public void setDeptCheckStrictly(boolean deptCheckStrictly) {
this.deptCheckStrictly = deptCheckStrictly;
}
public String getStatus()
{
public String getStatus() {
return status;
}
public void setStatus(String status)
{
public void setStatus(String status) {
this.status = status;
}
public String getDelFlag()
{
public String getDelFlag() {
return delFlag;
}
public void setDelFlag(String delFlag)
{
public void setDelFlag(String delFlag) {
this.delFlag = delFlag;
}
public boolean isFlag()
{
public boolean isFlag() {
return flag;
}
public void setFlag(boolean flag)
{
public void setFlag(boolean flag) {
this.flag = flag;
}
public Long[] getMenuIds()
{
public Long[] getMenuIds() {
return menuIds;
}
public void setMenuIds(Long[] menuIds)
{
public void setMenuIds(Long[] menuIds) {
this.menuIds = menuIds;
}
public Long[] getDeptIds()
{
public Long[] getDeptIds() {
return deptIds;
}
public void setDeptIds(Long[] deptIds)
{
public void setDeptIds(Long[] deptIds) {
this.deptIds = deptIds;
}
public Set<String> getPermissions()
{
public Set<String> getPermissions() {
return permissions;
}
public void setPermissions(Set<String> permissions)
{
public void setPermissions(Set<String> permissions) {
this.permissions = permissions;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("roleId", getRoleId())
.append("roleName", getRoleName())
.append("roleKey", getRoleKey())
.append("roleSort", getRoleSort())
.append("dataScope", getDataScope())
.append("menuCheckStrictly", isMenuCheckStrictly())
.append("deptCheckStrictly", isDeptCheckStrictly())
.append("status", getStatus())
.append("delFlag", getDelFlag())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.toString();
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("roleId", getRoleId())
.append("roleName", getRoleName())
.append("roleKey", getRoleKey())
.append("roleSort", getRoleSort())
.append("dataScope", getDataScope())
.append("menuCheckStrictly", isMenuCheckStrictly())
.append("deptCheckStrictly", isDeptCheckStrictly())
.append("status", getStatus())
.append("delFlag", getDelFlag())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.toString();
}
}

View File

@ -10,23 +10,30 @@ import lombok.Data;
* @author ruoyi
*/
@Data
public class SysTranslate extends BaseEntity
{
public class SysTranslate extends BaseEntity {
private static final long serialVersionUID = 1L;
/** ID */
/**
* ID
*/
@Excel(name = "ID")
private Long id;
/** zh_CN */
/**
* zh_CN
*/
@Excel(name = "zh-CN")
private String zh_CN;
/** en_US */
/**
* en_US
*/
@Excel(name = "en-US")
private String en_US;
/** 物模型翻译表使用 */
/**
* 物模型翻译表使用
*/
private Long productId;
private String tableName;

View File

@ -23,93 +23,128 @@ import java.util.List;
* @author ruoyi
*/
@ApiModel(value = "SysUser", description = "用户对象 sys_user")
public class SysUser extends BaseEntity
{
public class SysUser extends BaseEntity {
private static final long serialVersionUID = 1L;
/** 用户ID */
/**
* 用户ID
*/
@ApiModelProperty("用户ID")
@Excel(name = "用户序号", cellType = ColumnType.NUMERIC, prompt = "用户编号")
private Long userId;
/** 部门ID */
/**
* 部门ID
*/
@ApiModelProperty("部门ID")
@Excel(name = "部门编号", type = Type.IMPORT)
private Long deptId;
/** 用户账号 */
/**
* 用户账号
*/
@ApiModelProperty("用户账号")
@Excel(name = "登录名称")
private String userName;
/** 用户昵称 */
/**
* 用户昵称
*/
@ApiModelProperty("用户昵称")
@Excel(name = "用户名称")
private String nickName;
/** 用户邮箱 */
/**
* 用户邮箱
*/
@ApiModelProperty("用户邮箱")
@Excel(name = "用户邮箱")
private String email;
/** 手机号码 */
/**
* 手机号码
*/
@ApiModelProperty("手机号码")
@Excel(name = "手机号码")
private String phonenumber;
/** 用户性别 */
/**
* 用户性别
*/
@ApiModelProperty("用户性别")
@Excel(name = "用户性别", readConverterExp = "0=男,1=女,2=未知")
private String sex;
/** 用户头像 */
/**
* 用户头像
*/
@ApiModelProperty("用户头像")
private String avatar;
/** 密码 */
/**
* 密码
*/
@ApiModelProperty("密码")
private String password;
/** 帐号状态(0正常 1停用) */
/**
* 帐号状态(0正常 1停用)
*/
@ApiModelProperty("帐号状态(0正常 1停用)")
@Excel(name = "帐号状态", readConverterExp = "0=正常,1=停用")
private String status;
/** 删除标志(0代表存在 2代表删除) */
/**
* 删除标志(0代表存在 2代表删除)
*/
@ApiModelProperty("删除标志")
private String delFlag;
/** 最后登录IP */
/**
* 最后登录IP
*/
@ApiModelProperty("最后登录IP")
@Excel(name = "最后登录IP", type = Type.EXPORT)
private String loginIp;
/** 最后登录时间 */
/**
* 最后登录时间
*/
@ApiModelProperty("最后登录时间")
@Excel(name = "最后登录时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss", type = Type.EXPORT)
private Date loginDate;
/** 部门对象 */
/**
* 部门对象
*/
@ApiModelProperty("部门对象")
@Excels({
@Excel(name = "部门名称", targetAttr = "deptName", type = Type.EXPORT),
@Excel(name = "部门负责人", targetAttr = "leader", type = Type.EXPORT)
@Excel(name = "部门名称", targetAttr = "deptName", type = Type.EXPORT),
@Excel(name = "部门负责人", targetAttr = "leader", type = Type.EXPORT)
})
private SysDept dept;
/** 角色对象 */
/**
* 角色对象
*/
@ApiModelProperty("角色对象")
private List<SysRole> roles;
/** 角色组 */
/**
* 角色组
*/
@ApiModelProperty("角色组")
private Long[] roleIds;
/** 岗位组 */
/**
* 岗位组
*/
@ApiModelProperty("岗位组")
private Long[] postIds;
/** 角色ID */
/**
* 角色ID
*/
@ApiModelProperty("角色ID")
private Long roleId;
@ -131,6 +166,18 @@ public class SysUser extends BaseEntity
*/
private String timeZone;
public SysUser() {
}
public SysUser(Long userId) {
this.userId = userId;
}
public static boolean isAdmin(Long userId) {
return userId != null && 1L == userId;
}
public String getLanguage() {
return language;
}
@ -163,236 +210,184 @@ public class SysUser extends BaseEntity
this.showChild = showChild;
}
public SysUser()
{
}
public SysUser(Long userId)
{
this.userId = userId;
}
public Long getUserId()
{
public Long getUserId() {
return userId;
}
public void setUserId(Long userId)
{
public void setUserId(Long userId) {
this.userId = userId;
}
public boolean isAdmin()
{
public boolean isAdmin() {
return isAdmin(this.userId);
}
public static boolean isAdmin(Long userId)
{
return userId != null && 1L == userId;
}
public Long getDeptId()
{
public Long getDeptId() {
return deptId;
}
public void setDeptId(Long deptId)
{
public void setDeptId(Long deptId) {
this.deptId = deptId;
}
@Xss(message = "用户昵称不能包含脚本字符")
@Size(min = 0, max = 30, message = "用户昵称长度不能超过30个字符")
public String getNickName()
{
public String getNickName() {
return nickName;
}
public void setNickName(String nickName)
{
public void setNickName(String nickName) {
this.nickName = nickName;
}
@Xss(message = "用户账号不能包含脚本字符")
@NotBlank(message = "用户账号不能为空")
@Size(min = 0, max = 30, message = "用户账号长度不能超过30个字符")
public String getUserName()
{
public String getUserName() {
return userName;
}
public void setUserName(String userName)
{
public void setUserName(String userName) {
this.userName = userName;
}
@Email(message = "邮箱格式不正确")
@Size(min = 0, max = 50, message = "邮箱长度不能超过50个字符")
public String getEmail()
{
public String getEmail() {
return email;
}
public void setEmail(String email)
{
public void setEmail(String email) {
this.email = email;
}
@Size(min = 0, max = 11, message = "手机号码长度不能超过11个字符")
public String getPhonenumber()
{
public String getPhonenumber() {
return phonenumber;
}
public void setPhonenumber(String phonenumber)
{
public void setPhonenumber(String phonenumber) {
this.phonenumber = phonenumber;
}
public String getSex()
{
public String getSex() {
return sex;
}
public void setSex(String sex)
{
public void setSex(String sex) {
this.sex = sex;
}
public String getAvatar()
{
public String getAvatar() {
return avatar;
}
public void setAvatar(String avatar)
{
public void setAvatar(String avatar) {
this.avatar = avatar;
}
public String getPassword()
{
public String getPassword() {
return password;
}
public void setPassword(String password)
{
public void setPassword(String password) {
this.password = password;
}
public String getStatus()
{
public String getStatus() {
return status;
}
public void setStatus(String status)
{
public void setStatus(String status) {
this.status = status;
}
public String getDelFlag()
{
public String getDelFlag() {
return delFlag;
}
public void setDelFlag(String delFlag)
{
public void setDelFlag(String delFlag) {
this.delFlag = delFlag;
}
public String getLoginIp()
{
public String getLoginIp() {
return loginIp;
}
public void setLoginIp(String loginIp)
{
public void setLoginIp(String loginIp) {
this.loginIp = loginIp;
}
public Date getLoginDate()
{
public Date getLoginDate() {
return loginDate;
}
public void setLoginDate(Date loginDate)
{
public void setLoginDate(Date loginDate) {
this.loginDate = loginDate;
}
public SysDept getDept()
{
public SysDept getDept() {
return dept;
}
public void setDept(SysDept dept)
{
public void setDept(SysDept dept) {
this.dept = dept;
}
public List<SysRole> getRoles()
{
public List<SysRole> getRoles() {
return roles;
}
public void setRoles(List<SysRole> roles)
{
public void setRoles(List<SysRole> roles) {
this.roles = roles;
}
public Long[] getRoleIds()
{
public Long[] getRoleIds() {
return roleIds;
}
public void setRoleIds(Long[] roleIds)
{
public void setRoleIds(Long[] roleIds) {
this.roleIds = roleIds;
}
public Long[] getPostIds()
{
public Long[] getPostIds() {
return postIds;
}
public void setPostIds(Long[] postIds)
{
public void setPostIds(Long[] postIds) {
this.postIds = postIds;
}
public Long getRoleId()
{
public Long getRoleId() {
return roleId;
}
public void setRoleId(Long roleId)
{
public void setRoleId(Long roleId) {
this.roleId = roleId;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("userId", getUserId())
.append("deptId", getDeptId())
.append("userName", getUserName())
.append("nickName", getNickName())
.append("email", getEmail())
.append("phonenumber", getPhonenumber())
.append("sex", getSex())
.append("avatar", getAvatar())
.append("password", getPassword())
.append("status", getStatus())
.append("delFlag", getDelFlag())
.append("loginIp", getLoginIp())
.append("loginDate", getLoginDate())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.append("dept", getDept())
.toString();
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("userId", getUserId())
.append("deptId", getDeptId())
.append("userName", getUserName())
.append("nickName", getNickName())
.append("email", getEmail())
.append("phonenumber", getPhonenumber())
.append("sex", getSex())
.append("avatar", getAvatar())
.append("password", getPassword())
.append("status", getStatus())
.append("delFlag", getDelFlag())
.append("loginIp", getLoginIp())
.append("loginDate", getLoginDate())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.append("dept", getDept())
.toString();
}
}

View File

@ -2,15 +2,14 @@ package com.fastbee.common.core.domain.model;
/**
* 用户登录对象
*
*
* @author ruoyi
*/
public class BindLoginBody extends LoginBody
{
public class BindLoginBody extends LoginBody {
/**
* 绑定id
*/
private String bindId;
private String bindId;
public String getBindId() {
return bindId;

View File

@ -5,8 +5,7 @@ package com.fastbee.common.core.domain.model;
*
* @author ruoyi
*/
public class LoginBody
{
public class LoginBody {
/**
* 用户名
*/
@ -67,43 +66,35 @@ public class LoginBody
this.phonenumber = phonenumber;
}
public String getUsername()
{
public String getUsername() {
return username;
}
public void setUsername(String username)
{
public void setUsername(String username) {
this.username = username;
}
public String getPassword()
{
public String getPassword() {
return password;
}
public void setPassword(String password)
{
public void setPassword(String password) {
this.password = password;
}
public String getCode()
{
public String getCode() {
return code;
}
public void setCode(String code)
{
public void setCode(String code) {
this.code = code;
}
public String getUuid()
{
public String getUuid() {
return uuid;
}
public void setUuid(String uuid)
{
public void setUuid(String uuid) {
this.uuid = uuid;
}
}

View File

@ -13,8 +13,7 @@ import java.util.Set;
*
* @author ruoyi
*/
public class LoginUser implements UserDetails
{
public class LoginUser implements UserDetails {
private static final long serialVersionUID = 1L;
/**
@ -78,6 +77,22 @@ public class LoginUser implements UserDetails
private Boolean neverExpire = Boolean.FALSE;
public LoginUser() {
}
public LoginUser(SysUser user, Set<String> permissions) {
this.user = user;
this.permissions = permissions;
}
public LoginUser(Long userId, Long deptId, String language, SysUser user, Set<String> permissions) {
this.userId = userId;
this.deptId = deptId;
this.user = user;
this.language = language;
this.permissions = permissions;
}
public Boolean getNeverExpire() {
return neverExpire;
}
@ -90,6 +105,10 @@ public class LoginUser implements UserDetails
return language;
}
public void setLanguage(String language) {
this.language = language;
}
public Long getDeptUserId() {
return deptUserId;
}
@ -98,69 +117,38 @@ public class LoginUser implements UserDetails
this.deptUserId = deptUserId;
}
public void setLanguage(String language) {
this.language = language;
}
public Long getUserId()
{
public Long getUserId() {
return userId;
}
public void setUserId(Long userId)
{
public void setUserId(Long userId) {
this.userId = userId;
}
public Long getDeptId()
{
public Long getDeptId() {
return deptId;
}
public void setDeptId(Long deptId)
{
public void setDeptId(Long deptId) {
this.deptId = deptId;
}
public String getToken()
{
public String getToken() {
return token;
}
public void setToken(String token)
{
public void setToken(String token) {
this.token = token;
}
public LoginUser()
{
}
public LoginUser(SysUser user, Set<String> permissions)
{
this.user = user;
this.permissions = permissions;
}
public LoginUser(Long userId, Long deptId,String language, SysUser user, Set<String> permissions)
{
this.userId = userId;
this.deptId = deptId;
this.user = user;
this.language = language;
this.permissions = permissions;
}
@JSONField(serialize = false)
@Override
public String getPassword()
{
public String getPassword() {
return user.getPassword();
}
@Override
public String getUsername()
{
public String getUsername() {
return user.getUserName();
}
@ -169,8 +157,7 @@ public class LoginUser implements UserDetails
*/
@JSONField(serialize = false)
@Override
public boolean isAccountNonExpired()
{
public boolean isAccountNonExpired() {
return true;
}
@ -181,8 +168,7 @@ public class LoginUser implements UserDetails
*/
@JSONField(serialize = false)
@Override
public boolean isAccountNonLocked()
{
public boolean isAccountNonLocked() {
return true;
}
@ -193,8 +179,7 @@ public class LoginUser implements UserDetails
*/
@JSONField(serialize = false)
@Override
public boolean isCredentialsNonExpired()
{
public boolean isCredentialsNonExpired() {
return true;
}
@ -205,94 +190,76 @@ public class LoginUser implements UserDetails
*/
@JSONField(serialize = false)
@Override
public boolean isEnabled()
{
public boolean isEnabled() {
return true;
}
public Long getLoginTime()
{
public Long getLoginTime() {
return loginTime;
}
public void setLoginTime(Long loginTime)
{
public void setLoginTime(Long loginTime) {
this.loginTime = loginTime;
}
public String getIpaddr()
{
public String getIpaddr() {
return ipaddr;
}
public void setIpaddr(String ipaddr)
{
public void setIpaddr(String ipaddr) {
this.ipaddr = ipaddr;
}
public String getLoginLocation()
{
public String getLoginLocation() {
return loginLocation;
}
public void setLoginLocation(String loginLocation)
{
public void setLoginLocation(String loginLocation) {
this.loginLocation = loginLocation;
}
public String getBrowser()
{
public String getBrowser() {
return browser;
}
public void setBrowser(String browser)
{
public void setBrowser(String browser) {
this.browser = browser;
}
public String getOs()
{
public String getOs() {
return os;
}
public void setOs(String os)
{
public void setOs(String os) {
this.os = os;
}
public Long getExpireTime()
{
public Long getExpireTime() {
return expireTime;
}
public void setExpireTime(Long expireTime)
{
public void setExpireTime(Long expireTime) {
this.expireTime = expireTime;
}
public Set<String> getPermissions()
{
public Set<String> getPermissions() {
return permissions;
}
public void setPermissions(Set<String> permissions)
{
public void setPermissions(Set<String> permissions) {
this.permissions = permissions;
}
public SysUser getUser()
{
public SysUser getUser() {
return user;
}
public void setUser(SysUser user)
{
public void setUser(SysUser user) {
this.user = user;
}
@Override
public Collection<? extends GrantedAuthority> getAuthorities()
{
public Collection<? extends GrantedAuthority> getAuthorities() {
return null;
}
}

View File

@ -2,10 +2,9 @@ package com.fastbee.common.core.domain.model;
/**
* 用户注册对象
*
*
* @author ruoyi
*/
public class RegisterBody extends LoginBody
{
public class RegisterBody extends LoginBody {
}

View File

@ -4,6 +4,7 @@ import lombok.Data;
/**
* 大屏设备总览数据
*
* @author bill
*/
@Data

View File

@ -9,18 +9,32 @@ import lombok.Data;
@Data
public class DeCodeBo {
/**原始报文*/
/**
* 原始报文
*/
private String payload;
/**从机编号*/
/**
* 从机编号
*/
private Integer slaveId;
/**寄存器地址*/
/**
* 寄存器地址
*/
private Integer address;
/**功能码*/
/**
* 功能码
*/
private Integer code;
/**读取个数*/
/**
* 读取个数
*/
private Integer count;
/**写入值*/
/**
* 写入值
*/
private Integer writeData;
/**读写类型 1-解析 2-读指令 3-写指令 */
/**
* 读写类型 1-解析 2-读指令 3-写指令
*/
private Integer type;
}

View File

@ -13,41 +13,28 @@ import lombok.NoArgsConstructor;
@NoArgsConstructor
@AllArgsConstructor
@Data
public class IdentityAndName
{
public class IdentityAndName {
public IdentityAndName(String id,String value){
this.id=id;
this.value=value;
}
public IdentityAndName(String id,Integer isHistory){
this.id=id;
this.isHistory=isHistory;
}
public IdentityAndName(String id, Integer isHistory, String specs, String name, Integer type){
this.id = id;
this.isHistory = isHistory;
this.dataType = specs;
this.name = name;
this.type = type;
}
/** 物模型唯一标识符 */
/**
* 物模型唯一标识符
*/
private String id;
/** 物模型值 */
/**
* 物模型值
*/
private Object value;
private Integer isChart;
/**是否监控*/
/**
* 是否监控
*/
private Integer isHistory;
/**
* 数据定义
*/
private String dataType;
/**物模型名称*/
/**
* 物模型名称
*/
private String name;
/**
* 物模型类型
@ -57,14 +44,27 @@ public class IdentityAndName
* 是否是参数
*/
private Integer isParams;
private String formula;
private Integer slaveId;
private Integer tempSlaveId;
private Integer quantity;
private String code;
public IdentityAndName(String id, String value) {
this.id = id;
this.value = value;
}
public IdentityAndName(String id, Integer isHistory) {
this.id = id;
this.isHistory = isHistory;
}
public IdentityAndName(String id, Integer isHistory, String specs, String name, Integer type) {
this.id = id;
this.isHistory = isHistory;
this.dataType = specs;
this.name = name;
this.type = type;
}
}

View File

@ -12,6 +12,8 @@ public class DeviceReplyBo {
private String messageId;
/*标识符*/
private String id;
/**下发值*/
/**
* 下发值
*/
private String value;
}

View File

@ -37,7 +37,9 @@ public class DeviceReport extends Message {
*/
private String messageId;
/** 设备物模型值的集合 **/
/**
* 设备物模型值的集合
**/
private List<ThingsModelSimpleItem> thingsModelSimpleItem;
/**

View File

@ -15,6 +15,7 @@ import java.util.List;
/**
* 设备上报
*
* @author bill
*/
@Data
@ -46,7 +47,9 @@ public class DeviceReportBo {
/* modbus协议消息回调,记录数据*/
private PropRead prop;
/** 设备物模型值的集合 **/
/**
* 设备物模型值的集合
**/
private List<ThingsModelSimpleItem> thingsModelSimpleItem;
/*处理的消息服务类型*/
private ServerType serverType;

View File

@ -10,6 +10,7 @@ import java.util.Date;
/**
* 设备状态
*
* @author bill
*/
@AllArgsConstructor
@ -21,9 +22,13 @@ public class DeviceStatusBo {
* 设备客户端id
*/
private String serialNumber;
/**是否活跃*/
/**
* 是否活跃
*/
private DeviceStatus status;
/**消息时间*/
/**
* 消息时间
*/
private Date timestamp;
/*host*/
private String hostName;

View File

@ -23,13 +23,19 @@ public class InvokeReqDto {
@NotNull(message = "标识符不能为空")
@ApiModelProperty(value = "标识符")
private String identifier;
/**消息体*/
/**
* 消息体
*/
@ApiModelProperty(value = "消息体")
private JSONObject params;
/**远程消息体*/
/**
* 远程消息体
*/
@ApiModelProperty(value = "远程调用消息体")
private Map<String,Object> remoteCommand;
/**设备超时时间*/
private Map<String, Object> remoteCommand;
/**
* 设备超时时间
*/
@ApiModelProperty(value = "设备超时响应时间,默认10s")
private Integer timeOut = 10;
@ -37,7 +43,7 @@ public class InvokeReqDto {
private Integer type = ThingsModelType.SERVICE.getCode();
@ApiModelProperty(value = "是否是影子模式")
private String isShadow ;
private String isShadow;
@ApiModelProperty(value = "产品id")
private Long productId;

View File

@ -14,6 +14,9 @@ import lombok.NoArgsConstructor;
@NoArgsConstructor
public class MQSendMessageBo {
public Boolean isShadow;
public Long userId;
public Long delay;
/**
* 设备编号
*/
@ -26,7 +29,6 @@ public class MQSendMessageBo {
* 下发参数
*/
private JSONObject params;
/**
* 下发的值
*/
@ -39,7 +41,6 @@ public class MQSendMessageBo {
* 协议产品相关信息
*/
private DeviceAndProtocol dp;
/**
* 物模型
*/
@ -48,14 +49,6 @@ public class MQSendMessageBo {
* 主题
*/
private String topicName;
public Boolean isShadow;
public Long userId;
public Long delay;
private String parentSerialNumber;
}

View File

@ -10,6 +10,7 @@ import lombok.EqualsAndHashCode;
/**
* 消息解析model
*
* @author gsb
* @date 2022/10/10 15:53
*/
@ -34,7 +35,9 @@ public class DeviceData extends Message {
private int type;
/*Modbus*/
private ModbusCode code;
/**产品id*/
/**
* 产品id
*/
private Long productId;
private OtaPackageCode netModbusCode;

View File

@ -50,7 +50,7 @@ public class DeviceDownMessage {
private String subCode;
private ServerType serverType;
public DeviceDownMessage(List<PropRead> values, String topic, String subCode,String transport) {
public DeviceDownMessage(List<PropRead> values, String topic, String subCode, String transport) {
this.values = values;
this.topic = topic;
this.subCode = subCode;

View File

@ -4,6 +4,7 @@ import lombok.Data;
/**
* 平台下发指令数据model
*
* @author bill
*/
@Data

View File

@ -8,24 +8,33 @@ import java.util.Date;
/**
* 设备消息
*
* @author bill
*/
@Data
@JsonInclude(JsonInclude.Include.NON_NULL)
public class DeviceMessage {
/** 下发的数据*/
/**
* 下发的数据
*/
private Object message;
/** 下发的topic*/
/**
* 下发的topic
*/
private String topicName;
/** 设备编号*/
/**
* 设备编号
*/
private String serialNumber;
private String dataType;
/** 时间 */
@JsonFormat(pattern ="yyyy-MM-dd HH:mm:ss:SSS")
/**
* 时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss:SSS")
private Date time;
}

View File

@ -4,6 +4,7 @@ import lombok.Data;
/**
* 指令下发组将的model
*
* @author bill
*/
@Data

View File

@ -4,6 +4,7 @@ import lombok.Data;
/**
* 指令下发组将的model
*
* @author bill
*/
@Data

View File

@ -10,15 +10,21 @@ import lombok.Data;
@Data
public class PropRead {
/**设备编号*/
/**
* 设备编号
*/
private String serialNumber;
/**寄存器起始地址*/
/**
* 寄存器起始地址
*/
private int address;
/**
* 读取寄存器个数
*/
private int count;
/**数据结果长度计算值*/
/**
* 数据结果长度计算值
*/
private int length;
/**
* 从机地址

View File

@ -4,18 +4,23 @@ import lombok.Data;
/**
* 协议bean
*
* @author gsb
* @date 2022/10/25 14:54
*/
@Data
public class ProtocolDto {
/**协议编号*/
/**
* 协议编号
*/
private String code;
private String name;
/*外部协议url*/
private String protocolUrl;
private String description;
/**协议类型 协议类型 0:系统协议 1:jar,2.js,3.c*/
/**
* 协议类型 协议类型 0:系统协议 1:jar,2.js,3.c
*/
private Integer protocolType;
}

View File

@ -9,40 +9,55 @@ import java.util.List;
/**
* 上报数据模型bo
*
* @author bill
*/
@Data
@Accessors(chain = true)
public class ReportDataBo {
/**产品id*/
private Long productId;
/**设备编号*/
private String serialNumber;
/**上报消息*/
private String message;
/**上报的数据*/
private List<ThingsModelSimpleItem> dataList;
/**设备影子*/
private boolean isShadow;
/**
* 物模型类型
* 1=属性,2=功能,3=事件,4=设备升级,5=设备上线,6=设备下线
*/
private int type;
/**是否执行规则引擎*/
private boolean isRuleEngine;
/**从机编号*/
private Integer slaveId;
/**
* 上报原数据包
*/
private Object sources;
/**
* 产品id
*/
private Long productId;
/**
* 设备编号
*/
private String serialNumber;
/**
* 上报消息
*/
private String message;
/**
* 上报的数据
*/
private List<ThingsModelSimpleItem> dataList;
/**
* 设备影子
*/
private boolean isShadow;
/**
* 物模型类型
* 1=属性,2=功能,3=事件,4=设备升级,5=设备上线,6=设备下线
*/
private int type;
/**
* 是否执行规则引擎
*/
private boolean isRuleEngine;
/**
* 从机编号
*/
private Integer slaveId;
/**
* 上报原数据包
*/
private Object sources;
private GwDeviceBo gwDeviceBo;
private GwDeviceBo gwDeviceBo;
private Long userId;
private String userName;
private String deviceName;
private Long userId;
private String userName;
private String deviceName;
}

View File

@ -4,6 +4,7 @@ import lombok.Data;
/**
* 网关子设备model
*
* @author gsb
* @date 2022/10/10 10:18
*/

View File

@ -7,6 +7,7 @@ import java.math.BigDecimal;
/**
* OTA升级回复model
*
* @author gsb
* @date 2022/10/24 17:20
*/

View File

@ -8,6 +8,7 @@ import java.math.BigDecimal;
/**
* OTA远程升级
*
* @author gsb
* @date 2022/10/10 10:22
*/

View File

@ -7,6 +7,7 @@ import org.dromara.sms4j.provider.config.BaseConfig;
/**
* 个推参数配置
*
* @author gsb
* @date 2023/12/11 17:14
*/

View File

@ -7,6 +7,7 @@ import org.dromara.sms4j.provider.config.BaseConfig;
/**
* 企业微信(应用消息)
*
* @author gsb
* @date 2023/12/11 17:25
*/

View File

@ -6,6 +6,7 @@ import lombok.experimental.Accessors;
/**
* 微信服务号推送参数
*
* @author gsb
* @date 2023/12/11 17:11
*/

View File

@ -4,6 +4,7 @@ import lombok.Data;
/**
* 推送项item
*
* @author bill
*/
@Data

View File

@ -6,6 +6,7 @@ import java.util.List;
/**
* 推送配置信息
*
* @author bill
*/
@Data

View File

@ -5,6 +5,7 @@ import lombok.Data;
/**
* 邮箱配置参数
*
* @author gsb
* @date 2023/12/11 17:17
*/

View File

@ -4,6 +4,7 @@ import lombok.Data;
/**
* 语音配置
*
* @author fastb
* @date 2023-12-09 17:32
*/

View File

@ -4,6 +4,7 @@ import lombok.Data;
/**
* 微信推送配置参数
*
* @author gsb
* @date 2023/12/11 17:11
*/

View File

@ -8,16 +8,15 @@ import lombok.Getter;
@AllArgsConstructor
public enum OtaPackageCode {
OTA_01("查询产品工装号",(byte) 0x01),
OTA_0A("OTA升级启动",(byte) 0x0A),
OTA_0B("OTA升级包传输",(byte) 0x0B)
;
OTA_01("查询产品工装号", (byte) 0x01),
OTA_0A("OTA升级启动", (byte) 0x0A),
OTA_0B("OTA升级包传输", (byte) 0x0B);
private String desc;
private byte code;
public static OtaPackageCode getInstance(int code) {
switch ((byte)code) {
switch ((byte) code) {
case 0x01:
return OTA_01;
case 0x0A:
@ -29,8 +28,8 @@ public enum OtaPackageCode {
}
}
public static String getDes(int code){
switch ((byte)code) {
public static String getDes(int code) {
switch ((byte) code) {
case 0x01:
return OTA_01.desc;
case 0x0A:

View File

@ -4,98 +4,90 @@ import com.fastbee.common.utils.StringUtils;
/**
* 分页数据
*
*
* @author ruoyi
*/
public class PageDomain
{
/** 当前记录起始索引 */
public class PageDomain {
/**
* 当前记录起始索引
*/
private Integer pageNum;
/** 每页显示记录数 */
/**
* 每页显示记录数
*/
private Integer pageSize;
/** 排序列 */
/**
* 排序列
*/
private String orderByColumn;
/** 排序的方向desc或者asc */
/**
* 排序的方向desc或者asc
*/
private String isAsc = "asc";
/** 分页参数合理化 */
/**
* 分页参数合理化
*/
private Boolean reasonable = true;
public String getOrderBy()
{
if (StringUtils.isEmpty(orderByColumn))
{
public String getOrderBy() {
if (StringUtils.isEmpty(orderByColumn)) {
return "";
}
return StringUtils.toUnderScoreCase(orderByColumn) + " " + isAsc;
}
public Integer getPageNum()
{
public Integer getPageNum() {
return pageNum;
}
public void setPageNum(Integer pageNum)
{
public void setPageNum(Integer pageNum) {
this.pageNum = pageNum;
}
public Integer getPageSize()
{
public Integer getPageSize() {
return pageSize;
}
public void setPageSize(Integer pageSize)
{
public void setPageSize(Integer pageSize) {
this.pageSize = pageSize;
}
public String getOrderByColumn()
{
public String getOrderByColumn() {
return orderByColumn;
}
public void setOrderByColumn(String orderByColumn)
{
public void setOrderByColumn(String orderByColumn) {
this.orderByColumn = orderByColumn;
}
public String getIsAsc()
{
public String getIsAsc() {
return isAsc;
}
public void setIsAsc(String isAsc)
{
if (StringUtils.isNotEmpty(isAsc))
{
public void setIsAsc(String isAsc) {
if (StringUtils.isNotEmpty(isAsc)) {
// 兼容前端排序类型
if ("ascending".equals(isAsc))
{
if ("ascending".equals(isAsc)) {
isAsc = "asc";
}
else if ("descending".equals(isAsc))
{
} else if ("descending".equals(isAsc)) {
isAsc = "desc";
}
this.isAsc = isAsc;
}
}
public Boolean getReasonable()
{
if (StringUtils.isNull(reasonable))
{
public Boolean getReasonable() {
if (StringUtils.isNull(reasonable)) {
return Boolean.TRUE;
}
return reasonable;
}
public void setReasonable(Boolean reasonable)
{
public void setReasonable(Boolean reasonable) {
this.reasonable = reasonable;
}
}

View File

@ -9,20 +9,27 @@ import java.util.List;
*
* @author ruoyi
*/
public class TableDataExtendInfo implements Serializable
{
public class TableDataExtendInfo implements Serializable {
private static final long serialVersionUID = 1L;
/** 总记录数 */
/**
* 总记录数
*/
private long total;
/** 列表数据 */
/**
* 列表数据
*/
private List<?> rows;
/** 消息状态码 */
/**
* 消息状态码
*/
private int code;
/** 消息内容 */
/**
* 消息内容
*/
private String msg;
/**
@ -30,6 +37,23 @@ public class TableDataExtendInfo implements Serializable
*/
private Integer allEnable;
/**
* 表格数据对象
*/
public TableDataExtendInfo() {
}
/**
* 分页
*
* @param list 列表数据
* @param total 总记录数
*/
public TableDataExtendInfo(List<?> list, int total) {
this.rows = list;
this.total = total;
}
public Integer getAllEnable() {
return allEnable;
}
@ -38,62 +62,35 @@ public class TableDataExtendInfo implements Serializable
this.allEnable = allEnable;
}
/**
* 表格数据对象
*/
public TableDataExtendInfo()
{
}
/**
* 分页
*
* @param list 列表数据
* @param total 总记录数
*/
public TableDataExtendInfo(List<?> list, int total)
{
this.rows = list;
this.total = total;
}
public long getTotal()
{
public long getTotal() {
return total;
}
public void setTotal(long total)
{
public void setTotal(long total) {
this.total = total;
}
public List<?> getRows()
{
public List<?> getRows() {
return rows;
}
public void setRows(List<?> rows)
{
public void setRows(List<?> rows) {
this.rows = rows;
}
public int getCode()
{
public int getCode() {
return code;
}
public void setCode(int code)
{
public void setCode(int code) {
this.code = code;
}
public String getMsg()
{
public String getMsg() {
return msg;
}
public void setMsg(String msg)
{
public void setMsg(String msg) {
this.msg = msg;
}
}

View File

@ -5,81 +5,78 @@ import java.util.List;
/**
* 表格分页数据对象
*
*
* @author ruoyi
*/
public class TableDataInfo implements Serializable
{
public class TableDataInfo implements Serializable {
private static final long serialVersionUID = 1L;
/** 总记录数 */
/**
* 总记录数
*/
private long total;
/** 列表数据 */
/**
* 列表数据
*/
private List<?> rows;
/** 消息状态码 */
/**
* 消息状态码
*/
private int code;
/** 消息内容 */
/**
* 消息内容
*/
private String msg;
/**
* 表格数据对象
*/
public TableDataInfo()
{
public TableDataInfo() {
}
/**
* 分页
*
* @param list 列表数据
*
* @param list 列表数据
* @param total 总记录数
*/
public TableDataInfo(List<?> list, int total)
{
public TableDataInfo(List<?> list, int total) {
this.rows = list;
this.total = total;
}
public long getTotal()
{
public long getTotal() {
return total;
}
public void setTotal(long total)
{
public void setTotal(long total) {
this.total = total;
}
public List<?> getRows()
{
public List<?> getRows() {
return rows;
}
public void setRows(List<?> rows)
{
public void setRows(List<?> rows) {
this.rows = rows;
}
public int getCode()
{
public int getCode() {
return code;
}
public void setCode(int code)
{
public void setCode(int code) {
this.code = code;
}
public String getMsg()
{
public String getMsg() {
return msg;
}
public void setMsg(String msg)
{
public void setMsg(String msg) {
this.msg = msg;
}
}

View File

@ -5,11 +5,10 @@ import com.fastbee.common.utils.ServletUtils;
/**
* 表格数据处理
*
*
* @author ruoyi
*/
public class TableSupport
{
public class TableSupport {
/**
* 当前记录起始索引
*/
@ -38,8 +37,7 @@ public class TableSupport
/**
* 封装分页对象
*/
public static PageDomain getPageDomain()
{
public static PageDomain getPageDomain() {
PageDomain pageDomain = new PageDomain();
pageDomain.setPageNum(Convert.toInt(ServletUtils.getParameter(PAGE_NUM), 1));
pageDomain.setPageSize(Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10));
@ -49,8 +47,7 @@ public class TableSupport
return pageDomain;
}
public static PageDomain buildPageRequest()
{
public static PageDomain buildPageRequest() {
return getPageDomain();
}
}

View File

@ -14,12 +14,14 @@ import java.io.Serializable;
public class Message implements Serializable {
/*获取客户端id*/
public String clientId;
public String clientId;
/*消息类型*/
public String messageId;
/*消息流水号*/
public String serNo;
/**消息通道id*/
/**
* 消息通道id
*/
public String channelId;
public ByteBuf payload;

View File

@ -6,38 +6,38 @@ import lombok.Getter;
/**
* Modbus功能码
* @author bill
*
* @author bill
* <p>
* {bit 位操作}
* 线圈寄存器: bit对应一个信号的开关状态。功能码里面又分为写单个线圈寄存器和写多个线圈寄存器。对应上面的功能码也就是:0x01 0x05 0x0f
* 离散输入寄存器:离散输入寄存器就 是 只读线圈寄存器,每个bit表示一个开关量,是不能够写的。 功能码: 0x02
*
* <p>
* {byte 字节操作}
* 保持寄存器: 两个byte,可读写的 写也分为单个写和多个写对应的三个:0x03 0x06 0x10
* 输入寄存器: 和保持寄存器类似,只支持读而不能写,一般是读取各种实时数据。一个寄存器也是占据两个byte的空间。对应的功能码: 0x04
*
*/
@Getter
@AllArgsConstructor
public enum ModbusCode {
Read01("读线圈",(byte) 0x01,"1"), // 读线圈(读写位模式)
Read02("读离散量输入",(byte) 0x02,"2"), // 读离散量输入(位只读模式)
Read03("读保持寄存器",(byte) 0x03,"3"), // 读保持寄存器(字节读写模式)
Read04("读输入寄存器",(byte) 0x04,"4"), // 读输入寄存器(字节只读模式)
Read01("读线圈", (byte) 0x01, "1"), // 读线圈(读写位模式)
Read02("读离散量输入", (byte) 0x02, "2"), // 读离散量输入(位只读模式)
Read03("读保持寄存器", (byte) 0x03, "3"), // 读保持寄存器(字节读写模式)
Read04("读输入寄存器", (byte) 0x04, "4"), // 读输入寄存器(字节只读模式)
Write05("写单个线圈(读写位模式)",(byte) 0x05,"5"), // 写单个线圈(读写位模式)
Write06("写多个线圈",(byte) 0x06,"6"), // 写单个保持寄存器
Write0F("写多个线圈",(byte) 0x0F,"15"), // 写多个线圈
Write10("写多个保持寄存器",(byte) 0x10,"16"), // 写多个保持寄存器
UnKnow("未知功能码",(byte)0x0000,"100");
Write05("写单个线圈(读写位模式)", (byte) 0x05, "5"), // 写单个线圈(读写位模式)
Write06("写多个线圈", (byte) 0x06, "6"), // 写单个保持寄存器
Write0F("写多个线圈", (byte) 0x0F, "15"), // 写多个线圈
Write10("写多个保持寄存器", (byte) 0x10, "16"), // 写多个保持寄存器
UnKnow("未知功能码", (byte) 0x0000, "100");
private String desc;
private byte code;
private String hex;
public static ModbusCode getInstance(int code) {
switch ((byte)code) {
switch ((byte) code) {
case 0x01:
return Read01;
case 0x02:
@ -61,8 +61,8 @@ public enum ModbusCode {
}
}
public static String getDes(int code){
switch ((byte)code) {
public static String getDes(int code) {
switch ((byte) code) {
case 0x01:
return Read01.desc;
case 0x02:

View File

@ -385,7 +385,7 @@ public class RedisCache {
public boolean zRem(String key, Object... values) {
try {
Long aLong = stringRedisTemplate.opsForZSet().remove(key, values);
return aLong != null ? true : false;
return aLong != null;
} catch (Exception e) {
e.printStackTrace();
return false;
@ -469,7 +469,7 @@ public class RedisCache {
public Set<String> zRange(String key, long start, long end) {
try {
return stringRedisTemplate.opsForZSet().range(key, start, end);
}catch (Exception e) {
} catch (Exception e) {
e.printStackTrace();
return null;
}
@ -630,7 +630,7 @@ public class RedisCache {
/**
* 批量获取匹配触发器的物模型值
*
* @param productId productId
* @param productId productId
* @param operator 操作符
* @param triggerValue 触发的值
* @return
@ -642,9 +642,9 @@ public class RedisCache {
Map<String, String> mapList = new HashMap<>();
while (it.hasNext()) {
String key = it.next();
String value = CheckMatchByCacheKey(key,operator,id,triggerValue);
if(!Objects.equals(value, "")) {
mapList.put(key,value);
String value = CheckMatchByCacheKey(key, operator, id, triggerValue);
if (!Objects.equals(value, "")) {
mapList.put(key, value);
}
}
return mapList;
@ -694,7 +694,7 @@ public class RedisCache {
if (result == null) {
return new HashMap<>(0);
}
String ans = new String((byte[]) result);
String ans = new String(result);
mapList.put(key, ans);
}
return mapList;
@ -778,10 +778,7 @@ public class RedisCache {
private boolean isNumeric(String str) {
Pattern pattern = compile("[0-9]*\\.?[0-9]+");
Matcher isNum = pattern.matcher(str);
if (!isNum.matches()) {
return false;
}
return true;
return isNum.matches();
}
public void publish(Object message, String channel) {

View File

@ -10,30 +10,38 @@ import com.fastbee.common.constant.FastBeeConstant;
*/
public class RedisKeyBuilder {
/**设备在线列表缓存key*/
public static String buildDeviceOnlineListKey(){
return FastBeeConstant.REDIS.DEVICE_ONLINE_LIST;
/**
* 设备在线列表缓存key
*/
public static String buildDeviceOnlineListKey() {
return FastBeeConstant.REDIS.DEVICE_ONLINE_LIST;
}
/**设备实时数据key*/
public static String buildDeviceRtCacheKey(String serialNumber){
/**
* 设备实时数据key
*/
public static String buildDeviceRtCacheKey(String serialNumber) {
return FastBeeConstant.REDIS.DEVICE_RUNTIME_DATA + serialNumber;
}
/**
* 设备通讯协议参数
*/
public static String buildDeviceRtParamsKey(String serialNumber){
public static String buildDeviceRtParamsKey(String serialNumber) {
return FastBeeConstant.REDIS.DEVICE_PROTOCOL_PARAM + serialNumber;
}
/**固件版本缓存key*/
public static String buildFirmwareCachedKey(Long firmwareId){
return FastBeeConstant.REDIS.FIRMWARE_VERSION + firmwareId;
/**
* 固件版本缓存key
*/
public static String buildFirmwareCachedKey(Long firmwareId) {
return FastBeeConstant.REDIS.FIRMWARE_VERSION + firmwareId;
}
/**属性读取回调缓存key*/
public static String buildPropReadCacheKey(String serialNumber){
/**
* 属性读取回调缓存key
*/
public static String buildPropReadCacheKey(String serialNumber) {
return FastBeeConstant.REDIS.PROP_READ_STORE + serialNumber;
}
@ -41,7 +49,7 @@ public class RedisKeyBuilder {
* 物模型值命名缓存key
* Key:TSLV:{productId}_{deviceNumber} HKey:{identity#V/identity#S/identity#M/identity#N}
*/
public static String buildTSLVCacheKey(Long productId,String serialNumber){
public static String buildTSLVCacheKey(Long productId, String serialNumber) {
return FastBeeConstant.REDIS.DEVICE_PRE_KEY + productId + "_" + serialNumber.toUpperCase();
}
@ -49,88 +57,104 @@ public class RedisKeyBuilder {
* 物模型缓存key
* 物模型命名空间:Key:TSL:{productId} hkey: identity value: thingsModel
*/
public static String buildTSLCacheKey(Long productId){
public static String buildTSLCacheKey(Long productId) {
return FastBeeConstant.REDIS.TSL_PRE_KEY + productId;
}
public static String buildModbusKey(Long productId){
public static String buildModbusKey(Long productId) {
return FastBeeConstant.REDIS.MODBUS_PRE_KEY + productId;
}
/**录像缓存key*/
public static String buildSipRecordinfoCacheKey(String recordKey){
/**
* 录像缓存key
*/
public static String buildSipRecordinfoCacheKey(String recordKey) {
return FastBeeConstant.REDIS.RECORDINFO_KEY + recordKey;
}
/**设备id缓存key*/
public static String buildSipDeviceidCacheKey(String id){
/**
* 设备id缓存key
*/
public static String buildSipDeviceidCacheKey(String id) {
return FastBeeConstant.REDIS.DEVICEID_KEY + id;
}
/**ipCSEQ缓存key*/
public static String buildStreamCacheKey(String steamId){
/**
* ipCSEQ缓存key
*/
public static String buildStreamCacheKey(String steamId) {
return FastBeeConstant.REDIS.STREAM_KEY + steamId;
}
public static String buildStreamCacheKey(String deviceId, String channelId, String stream, String ssrc){
public static String buildStreamCacheKey(String deviceId, String channelId, String stream, String ssrc) {
return FastBeeConstant.REDIS.STREAM_KEY + deviceId + ":" + channelId + ":" + stream + ":" + ssrc;
}
public static String buildInviteCacheKey(String type, String deviceId, String channelId, String stream, String ssrc){
return FastBeeConstant.REDIS.INVITE_KEY + type + ":"+ deviceId + ":" + channelId + ":" + stream + ":" + ssrc;
public static String buildInviteCacheKey(String type, String deviceId, String channelId, String stream, String ssrc) {
return FastBeeConstant.REDIS.INVITE_KEY + type + ":" + deviceId + ":" + channelId + ":" + stream + ":" + ssrc;
}
/**ipCSEQ缓存key*/
public static String buildSipCSEQCacheKey(String CSEQ){
/**
* ipCSEQ缓存key
*/
public static String buildSipCSEQCacheKey(String CSEQ) {
return FastBeeConstant.REDIS.SIP_CSEQ_PREFIX + CSEQ;
}
/**rule静默时间缓存key*/
public static String buildSilentTimeacheKey(String key){
/**
* rule静默时间缓存key
*/
public static String buildSilentTimeacheKey(String key) {
return FastBeeConstant.REDIS.RULE_SILENT_TIME + key;
}
/**modbus指令缓存key*/
public static String buildModbusPollCacheKey(String serialNumebr){
/**
* modbus指令缓存key
*/
public static String buildModbusPollCacheKey(String serialNumebr) {
return FastBeeConstant.REDIS.POLL_MODBUS_KEY + serialNumebr;
}
/*缓存设备下发指令消息ID*/
public static String buildDownMessageIdCacheKey(String serialNumber){
public static String buildDownMessageIdCacheKey(String serialNumber) {
return FastBeeConstant.REDIS.DEVICE_MESSAGE_ID + serialNumber;
}
/**
* 缓存产品id,设备编号,协议编号
*/
public static String buildDeviceMsgCacheKey(String serialNumber){
public static String buildDeviceMsgCacheKey(String serialNumber) {
return FastBeeConstant.REDIS.DEVICE_MSG + serialNumber;
}
/**
* 缓存产品id,设备编号,协议编号
*/
public static String buildSceneModelTagCacheKey(Long sceneModelId){
public static String buildSceneModelTagCacheKey(Long sceneModelId) {
return FastBeeConstant.REDIS.SCENE_MODEL_TAG_ID + sceneModelId;
}
public static String buildModbusRuntimeCacheKey(String serialNumber){
public static String buildModbusRuntimeCacheKey(String serialNumber) {
return FastBeeConstant.REDIS.MODBUS_RUNTIME + serialNumber;
}
public static String buildModbusLockCacheKey(String serialNumber){
public static String buildModbusLockCacheKey(String serialNumber) {
return FastBeeConstant.REDIS.MODBUS_LOCK + serialNumber;
}
public static String buildModbusTcpCacheKey(String serialNumber){
public static String buildModbusTcpCacheKey(String serialNumber) {
return FastBeeConstant.REDIS.MODBUS_TCP + serialNumber;
}
public static String buildModbusTcpRuntimeCacheKey(String serialNumber){
public static String buildModbusTcpRuntimeCacheKey(String serialNumber) {
return FastBeeConstant.REDIS.MODBUS_TCP_RUNTIME + serialNumber;
}
/**设备OTA升级实时数据*/
public static String buildDeviceOtaKey(String serialNumber){
/**
* 设备OTA升级实时数据
*/
public static String buildDeviceOtaKey(String serialNumber) {
return CacheConstants.DEVICE_OTA_DATA + serialNumber;
}
@ -138,7 +162,7 @@ public class RedisKeyBuilder {
* 设备上电触发指令缓存key
* 用于存储设备上电触发任务下发的指令片段(索引2到11位)
*/
public static String buildPowerOnTriggerCommandKey(String serialNumber){
public static String buildPowerOnTriggerCommandKey(String serialNumber) {
return FastBeeConstant.REDIS.POWER_ON_TRIGGER_COMMAND + serialNumber.toUpperCase();
}

View File

@ -15,6 +15,63 @@ import java.time.Duration;
@Data
public class RedisKeyDefine {
/**
* Key 模板
*/
private final String keyTemplate;
/**
* Key 类型的枚举
*/
private final KeyTypeEnum keyType;
/**
* Value 类型
* <p>
* 如果是使用分布式锁,设置为 {@link java.util.concurrent.locks.Lock} 类型
*/
private final Class<?> valueType;
/**
* 超时类型
*/
private final TimeoutTypeEnum timeoutType;
/**
* 过期时间
*/
private final Duration timeout;
/**
* 备注
*/
private final String memo;
private RedisKeyDefine(String memo, String keyTemplate, KeyTypeEnum keyType, Class<?> valueType,
TimeoutTypeEnum timeoutType, Duration timeout) {
this.memo = memo;
this.keyTemplate = keyTemplate;
this.keyType = keyType;
this.valueType = valueType;
this.timeout = timeout;
this.timeoutType = timeoutType;
// 添加注册表
RedisKeyRegistry.add(this);
}
public RedisKeyDefine(String memo, String keyTemplate, KeyTypeEnum keyType, Class<?> valueType, Duration timeout) {
this(memo, keyTemplate, keyType, valueType, TimeoutTypeEnum.FIXED, timeout);
}
public RedisKeyDefine(String memo, String keyTemplate, KeyTypeEnum keyType, Class<?> valueType, TimeoutTypeEnum timeoutType) {
this(memo, keyTemplate, keyType, valueType, timeoutType, Duration.ZERO);
}
/**
* 格式化 Key
* <p>
* 注意,内部采用 {@link String#format(String, Object...)} 实现
*
* @param args 格式化的参数
* @return Key
*/
public String formatKey(Object... args) {
return String.format(keyTemplate, args);
}
@Getter
@AllArgsConstructor
public enum KeyTypeEnum {
@ -51,63 +108,4 @@ public class RedisKeyDefine {
}
/**
* Key 模板
*/
private final String keyTemplate;
/**
* Key 类型的枚举
*/
private final KeyTypeEnum keyType;
/**
* Value 类型
*
* 如果是使用分布式锁,设置为 {@link java.util.concurrent.locks.Lock} 类型
*/
private final Class<?> valueType;
/**
* 超时类型
*/
private final TimeoutTypeEnum timeoutType;
/**
* 过期时间
*/
private final Duration timeout;
/**
* 备注
*/
private final String memo;
private RedisKeyDefine(String memo, String keyTemplate, KeyTypeEnum keyType, Class<?> valueType,
TimeoutTypeEnum timeoutType, Duration timeout) {
this.memo = memo;
this.keyTemplate = keyTemplate;
this.keyType = keyType;
this.valueType = valueType;
this.timeout = timeout;
this.timeoutType = timeoutType;
// 添加注册表
RedisKeyRegistry.add(this);
}
public RedisKeyDefine(String memo, String keyTemplate, KeyTypeEnum keyType, Class<?> valueType, Duration timeout) {
this(memo, keyTemplate, keyType, valueType, TimeoutTypeEnum.FIXED, timeout);
}
public RedisKeyDefine(String memo, String keyTemplate, KeyTypeEnum keyType, Class<?> valueType, TimeoutTypeEnum timeoutType) {
this(memo, keyTemplate, keyType, valueType, timeoutType, Duration.ZERO);
}
/**
* 格式化 Key
*
* 注意,内部采用 {@link String#format(String, Object...)} 实现
*
* @param args 格式化的参数
* @return Key
*/
public String formatKey(Object... args) {
return String.format(keyTemplate, args);
}
}

View File

@ -7,71 +7,76 @@ import java.nio.charset.StandardCharsets;
/**
* 字符集工具类
*
*
* @author ruoyi
*/
public class CharsetKit
{
/** ISO-8859-1 */
public class CharsetKit {
/**
* ISO-8859-1
*/
public static final String ISO_8859_1 = "ISO-8859-1";
/** UTF-8 */
/**
* UTF-8
*/
public static final String UTF_8 = "UTF-8";
/** GBK */
/**
* GBK
*/
public static final String GBK = "GBK";
/** ISO-8859-1 */
public static final Charset CHARSET_ISO_8859_1 = Charset.forName(ISO_8859_1);
/** UTF-8 */
public static final Charset CHARSET_UTF_8 = Charset.forName(UTF_8);
/** GBK */
/**
* ISO-8859-1
*/
public static final Charset CHARSET_ISO_8859_1 = StandardCharsets.ISO_8859_1;
/**
* UTF-8
*/
public static final Charset CHARSET_UTF_8 = StandardCharsets.UTF_8;
/**
* GBK
*/
public static final Charset CHARSET_GBK = Charset.forName(GBK);
/**
* 转换为Charset对象
*
*
* @param charset 字符集,为空则返回默认字符集
* @return Charset
*/
public static Charset charset(String charset)
{
public static Charset charset(String charset) {
return StringUtils.isEmpty(charset) ? Charset.defaultCharset() : Charset.forName(charset);
}
/**
* 转换字符串的字符集编码
*
* @param source 字符串
* @param srcCharset 源字符集,默认ISO-8859-1
*
* @param source 字符串
* @param srcCharset 源字符集,默认ISO-8859-1
* @param destCharset 目标字符集,默认UTF-8
* @return 转换后的字符集
*/
public static String convert(String source, String srcCharset, String destCharset)
{
public static String convert(String source, String srcCharset, String destCharset) {
return convert(source, Charset.forName(srcCharset), Charset.forName(destCharset));
}
/**
* 转换字符串的字符集编码
*
* @param source 字符串
* @param srcCharset 源字符集,默认ISO-8859-1
*
* @param source 字符串
* @param srcCharset 源字符集,默认ISO-8859-1
* @param destCharset 目标字符集,默认UTF-8
* @return 转换后的字符集
*/
public static String convert(String source, Charset srcCharset, Charset destCharset)
{
if (null == srcCharset)
{
public static String convert(String source, Charset srcCharset, Charset destCharset) {
if (null == srcCharset) {
srcCharset = StandardCharsets.ISO_8859_1;
}
if (null == destCharset)
{
if (null == destCharset) {
destCharset = StandardCharsets.UTF_8;
}
if (StringUtils.isEmpty(source) || srcCharset.equals(destCharset))
{
if (StringUtils.isEmpty(source) || srcCharset.equals(destCharset)) {
return source;
}
return new String(source.getBytes(srcCharset), destCharset);
@ -80,8 +85,7 @@ public class CharsetKit
/**
* @return 系统字符集编码
*/
public static String systemCharset()
{
public static String systemCharset() {
return Charset.defaultCharset().name();
}
}

View File

@ -15,25 +15,21 @@ import java.util.Set;
*
* @author ruoyi
*/
public class Convert
{
public class Convert {
/**
* 转换为字符串<br>
* 如果给定的值为null,或者转换失败,返回默认值<br>
* 转换失败不会报错
*
* @param value 被转换的值
* @param value 被转换的值
* @param defaultValue 转换错误时的默认值
* @return 结果
*/
public static String toStr(Object value, String defaultValue)
{
if (null == value)
{
public static String toStr(Object value, String defaultValue) {
if (null == value) {
return defaultValue;
}
if (value instanceof String)
{
if (value instanceof String) {
return (String) value;
}
return value.toString();
@ -47,8 +43,7 @@ public class Convert
* @param value 被转换的值
* @return 结果
*/
public static String toStr(Object value)
{
public static String toStr(Object value) {
return toStr(value, null);
}
@ -57,18 +52,15 @@ public class Convert
* 如果给定的值为null,或者转换失败,返回默认值<br>
* 转换失败不会报错
*
* @param value 被转换的值
* @param value 被转换的值
* @param defaultValue 转换错误时的默认值
* @return 结果
*/
public static Character toChar(Object value, Character defaultValue)
{
if (null == value)
{
public static Character toChar(Object value, Character defaultValue) {
if (null == value) {
return defaultValue;
}
if (value instanceof Character)
{
if (value instanceof Character) {
return (Character) value;
}
@ -84,8 +76,7 @@ public class Convert
* @param value 被转换的值
* @return 结果
*/
public static Character toChar(Object value)
{
public static Character toChar(Object value) {
return toChar(value, null);
}
@ -94,35 +85,27 @@ public class Convert
* 如果给定的值为<code>null</code>,或者转换失败,返回默认值<br>
* 转换失败不会报错
*
* @param value 被转换的值
* @param value 被转换的值
* @param defaultValue 转换错误时的默认值
* @return 结果
*/
public static Byte toByte(Object value, Byte defaultValue)
{
if (value == null)
{
public static Byte toByte(Object value, Byte defaultValue) {
if (value == null) {
return defaultValue;
}
if (value instanceof Byte)
{
if (value instanceof Byte) {
return (Byte) value;
}
if (value instanceof Number)
{
if (value instanceof Number) {
return ((Number) value).byteValue();
}
final String valueStr = toStr(value, null);
if (StringUtils.isEmpty(valueStr))
{
if (StringUtils.isEmpty(valueStr)) {
return defaultValue;
}
try
{
try {
return Byte.parseByte(valueStr);
}
catch (Exception e)
{
} catch (Exception e) {
return defaultValue;
}
}
@ -135,8 +118,7 @@ public class Convert
* @param value 被转换的值
* @return 结果
*/
public static Byte toByte(Object value)
{
public static Byte toByte(Object value) {
return toByte(value, null);
}
@ -145,35 +127,27 @@ public class Convert
* 如果给定的值为<code>null</code>,或者转换失败,返回默认值<br>
* 转换失败不会报错
*
* @param value 被转换的值
* @param value 被转换的值
* @param defaultValue 转换错误时的默认值
* @return 结果
*/
public static Short toShort(Object value, Short defaultValue)
{
if (value == null)
{
public static Short toShort(Object value, Short defaultValue) {
if (value == null) {
return defaultValue;
}
if (value instanceof Short)
{
if (value instanceof Short) {
return (Short) value;
}
if (value instanceof Number)
{
if (value instanceof Number) {
return ((Number) value).shortValue();
}
final String valueStr = toStr(value, null);
if (StringUtils.isEmpty(valueStr))
{
if (StringUtils.isEmpty(valueStr)) {
return defaultValue;
}
try
{
try {
return Short.parseShort(valueStr.trim());
}
catch (Exception e)
{
} catch (Exception e) {
return defaultValue;
}
}
@ -186,8 +160,7 @@ public class Convert
* @param value 被转换的值
* @return 结果
*/
public static Short toShort(Object value)
{
public static Short toShort(Object value) {
return toShort(value, null);
}
@ -196,31 +169,24 @@ public class Convert
* 如果给定的值为空,或者转换失败,返回默认值<br>
* 转换失败不会报错
*
* @param value 被转换的值
* @param value 被转换的值
* @param defaultValue 转换错误时的默认值
* @return 结果
*/
public static Number toNumber(Object value, Number defaultValue)
{
if (value == null)
{
public static Number toNumber(Object value, Number defaultValue) {
if (value == null) {
return defaultValue;
}
if (value instanceof Number)
{
if (value instanceof Number) {
return (Number) value;
}
final String valueStr = toStr(value, null);
if (StringUtils.isEmpty(valueStr))
{
if (StringUtils.isEmpty(valueStr)) {
return defaultValue;
}
try
{
try {
return NumberFormat.getInstance().parse(valueStr);
}
catch (Exception e)
{
} catch (Exception e) {
return defaultValue;
}
}
@ -233,8 +199,7 @@ public class Convert
* @param value 被转换的值
* @return 结果
*/
public static Number toNumber(Object value)
{
public static Number toNumber(Object value) {
return toNumber(value, null);
}
@ -243,35 +208,27 @@ public class Convert
* 如果给定的值为空,或者转换失败,返回默认值<br>
* 转换失败不会报错
*
* @param value 被转换的值
* @param value 被转换的值
* @param defaultValue 转换错误时的默认值
* @return 结果
*/
public static Integer toInt(Object value, Integer defaultValue)
{
if (value == null)
{
public static Integer toInt(Object value, Integer defaultValue) {
if (value == null) {
return defaultValue;
}
if (value instanceof Integer)
{
if (value instanceof Integer) {
return (Integer) value;
}
if (value instanceof Number)
{
if (value instanceof Number) {
return ((Number) value).intValue();
}
final String valueStr = toStr(value, null);
if (StringUtils.isEmpty(valueStr))
{
if (StringUtils.isEmpty(valueStr)) {
return defaultValue;
}
try
{
try {
return Integer.parseInt(valueStr.trim());
}
catch (Exception e)
{
} catch (Exception e) {
return defaultValue;
}
}
@ -284,8 +241,7 @@ public class Convert
* @param value 被转换的值
* @return 结果
*/
public static Integer toInt(Object value)
{
public static Integer toInt(Object value) {
return toInt(value, null);
}
@ -295,8 +251,7 @@ public class Convert
* @param str 被转换的值
* @return 结果
*/
public static Integer[] toIntArray(String str)
{
public static Integer[] toIntArray(String str) {
return toIntArray(",", str);
}
@ -306,8 +261,7 @@ public class Convert
* @param str 被转换的值
* @return 结果
*/
public static Long[] toLongArray(String str)
{
public static Long[] toLongArray(String str) {
return toLongArray(",", str);
}
@ -318,16 +272,13 @@ public class Convert
* @param split 被转换的值
* @return 结果
*/
public static Integer[] toIntArray(String split, String str)
{
if (StringUtils.isEmpty(str))
{
return new Integer[] {};
public static Integer[] toIntArray(String split, String str) {
if (StringUtils.isEmpty(str)) {
return new Integer[]{};
}
String[] arr = str.split(split);
final Integer[] ints = new Integer[arr.length];
for (int i = 0; i < arr.length; i++)
{
for (int i = 0; i < arr.length; i++) {
final Integer v = toInt(arr[i], 0);
ints[i] = v;
}
@ -338,19 +289,16 @@ public class Convert
* 转换为Long数组<br>
*
* @param split 分隔符
* @param str 被转换的值
* @param str 被转换的值
* @return 结果
*/
public static Long[] toLongArray(String split, String str)
{
if (StringUtils.isEmpty(str))
{
return new Long[] {};
public static Long[] toLongArray(String split, String str) {
if (StringUtils.isEmpty(str)) {
return new Long[]{};
}
String[] arr = str.split(split);
final Long[] longs = new Long[arr.length];
for (int i = 0; i < arr.length; i++)
{
for (int i = 0; i < arr.length; i++) {
final Long v = toLong(arr[i], null);
longs[i] = v;
}
@ -363,8 +311,7 @@ public class Convert
* @param str 被转换的值
* @return 结果
*/
public static String[] toStrArray(String str)
{
public static String[] toStrArray(String str) {
return toStrArray(",", str);
}
@ -375,8 +322,7 @@ public class Convert
* @param split 被转换的值
* @return 结果
*/
public static String[] toStrArray(String split, String str)
{
public static String[] toStrArray(String split, String str) {
return str.split(split);
}
@ -385,36 +331,28 @@ public class Convert
* 如果给定的值为空,或者转换失败,返回默认值<br>
* 转换失败不会报错
*
* @param value 被转换的值
* @param value 被转换的值
* @param defaultValue 转换错误时的默认值
* @return 结果
*/
public static Long toLong(Object value, Long defaultValue)
{
if (value == null)
{
public static Long toLong(Object value, Long defaultValue) {
if (value == null) {
return defaultValue;
}
if (value instanceof Long)
{
if (value instanceof Long) {
return (Long) value;
}
if (value instanceof Number)
{
if (value instanceof Number) {
return ((Number) value).longValue();
}
final String valueStr = toStr(value, null);
if (StringUtils.isEmpty(valueStr))
{
if (StringUtils.isEmpty(valueStr)) {
return defaultValue;
}
try
{
try {
// 支持科学计数法
return new BigDecimal(valueStr.trim()).longValue();
}
catch (Exception e)
{
} catch (Exception e) {
return defaultValue;
}
}
@ -427,8 +365,7 @@ public class Convert
* @param value 被转换的值
* @return 结果
*/
public static Long toLong(Object value)
{
public static Long toLong(Object value) {
return toLong(value, null);
}
@ -437,36 +374,28 @@ public class Convert
* 如果给定的值为空,或者转换失败,返回默认值<br>
* 转换失败不会报错
*
* @param value 被转换的值
* @param value 被转换的值
* @param defaultValue 转换错误时的默认值
* @return 结果
*/
public static Double toDouble(Object value, Double defaultValue)
{
if (value == null)
{
public static Double toDouble(Object value, Double defaultValue) {
if (value == null) {
return defaultValue;
}
if (value instanceof Double)
{
if (value instanceof Double) {
return (Double) value;
}
if (value instanceof Number)
{
if (value instanceof Number) {
return ((Number) value).doubleValue();
}
final String valueStr = toStr(value, null);
if (StringUtils.isEmpty(valueStr))
{
if (StringUtils.isEmpty(valueStr)) {
return defaultValue;
}
try
{
try {
// 支持科学计数法
return new BigDecimal(valueStr.trim()).doubleValue();
}
catch (Exception e)
{
} catch (Exception e) {
return defaultValue;
}
}
@ -479,8 +408,7 @@ public class Convert
* @param value 被转换的值
* @return 结果
*/
public static Double toDouble(Object value)
{
public static Double toDouble(Object value) {
return toDouble(value, null);
}
@ -489,35 +417,27 @@ public class Convert
* 如果给定的值为空,或者转换失败,返回默认值<br>
* 转换失败不会报错
*
* @param value 被转换的值
* @param value 被转换的值
* @param defaultValue 转换错误时的默认值
* @return 结果
*/
public static Float toFloat(Object value, Float defaultValue)
{
if (value == null)
{
public static Float toFloat(Object value, Float defaultValue) {
if (value == null) {
return defaultValue;
}
if (value instanceof Float)
{
if (value instanceof Float) {
return (Float) value;
}
if (value instanceof Number)
{
if (value instanceof Number) {
return ((Number) value).floatValue();
}
final String valueStr = toStr(value, null);
if (StringUtils.isEmpty(valueStr))
{
if (StringUtils.isEmpty(valueStr)) {
return defaultValue;
}
try
{
try {
return Float.parseFloat(valueStr.trim());
}
catch (Exception e)
{
} catch (Exception e) {
return defaultValue;
}
}
@ -530,8 +450,7 @@ public class Convert
* @param value 被转换的值
* @return 结果
*/
public static Float toFloat(Object value)
{
public static Float toFloat(Object value) {
return toFloat(value, null);
}
@ -540,28 +459,23 @@ public class Convert
* String支持的值为:true、false、yes、ok、no,1,0 如果给定的值为空,或者转换失败,返回默认值<br>
* 转换失败不会报错
*
* @param value 被转换的值
* @param value 被转换的值
* @param defaultValue 转换错误时的默认值
* @return 结果
*/
public static Boolean toBool(Object value, Boolean defaultValue)
{
if (value == null)
{
public static Boolean toBool(Object value, Boolean defaultValue) {
if (value == null) {
return defaultValue;
}
if (value instanceof Boolean)
{
if (value instanceof Boolean) {
return (Boolean) value;
}
String valueStr = toStr(value, null);
if (StringUtils.isEmpty(valueStr))
{
if (StringUtils.isEmpty(valueStr)) {
return defaultValue;
}
valueStr = valueStr.trim().toLowerCase();
switch (valueStr)
{
switch (valueStr) {
case "true":
case "yes":
case "ok":
@ -584,8 +498,7 @@ public class Convert
* @param value 被转换的值
* @return 结果
*/
public static Boolean toBool(Object value)
{
public static Boolean toBool(Object value) {
return toBool(value, null);
}
@ -593,34 +506,27 @@ public class Convert
* 转换为Enum对象<br>
* 如果给定的值为空,或者转换失败,返回默认值<br>
*
* @param clazz Enum的Class
* @param value 值
* @param clazz Enum的Class
* @param value 值
* @param defaultValue 默认值
* @return Enum
*/
public static <E extends Enum<E>> E toEnum(Class<E> clazz, Object value, E defaultValue)
{
if (value == null)
{
public static <E extends Enum<E>> E toEnum(Class<E> clazz, Object value, E defaultValue) {
if (value == null) {
return defaultValue;
}
if (clazz.isAssignableFrom(value.getClass()))
{
if (clazz.isAssignableFrom(value.getClass())) {
@SuppressWarnings("unchecked")
E myE = (E) value;
return myE;
}
final String valueStr = toStr(value, null);
if (StringUtils.isEmpty(valueStr))
{
if (StringUtils.isEmpty(valueStr)) {
return defaultValue;
}
try
{
try {
return Enum.valueOf(clazz, valueStr);
}
catch (Exception e)
{
} catch (Exception e) {
return defaultValue;
}
}
@ -633,8 +539,7 @@ public class Convert
* @param value 值
* @return Enum
*/
public static <E extends Enum<E>> E toEnum(Class<E> clazz, Object value)
{
public static <E extends Enum<E>> E toEnum(Class<E> clazz, Object value) {
return toEnum(clazz, value, null);
}
@ -643,35 +548,27 @@ public class Convert
* 如果给定的值为空,或者转换失败,返回默认值<br>
* 转换失败不会报错
*
* @param value 被转换的值
* @param value 被转换的值
* @param defaultValue 转换错误时的默认值
* @return 结果
*/
public static BigInteger toBigInteger(Object value, BigInteger defaultValue)
{
if (value == null)
{
public static BigInteger toBigInteger(Object value, BigInteger defaultValue) {
if (value == null) {
return defaultValue;
}
if (value instanceof BigInteger)
{
if (value instanceof BigInteger) {
return (BigInteger) value;
}
if (value instanceof Long)
{
if (value instanceof Long) {
return BigInteger.valueOf((Long) value);
}
final String valueStr = toStr(value, null);
if (StringUtils.isEmpty(valueStr))
{
if (StringUtils.isEmpty(valueStr)) {
return defaultValue;
}
try
{
try {
return new BigInteger(valueStr);
}
catch (Exception e)
{
} catch (Exception e) {
return defaultValue;
}
}
@ -684,8 +581,7 @@ public class Convert
* @param value 被转换的值
* @return 结果
*/
public static BigInteger toBigInteger(Object value)
{
public static BigInteger toBigInteger(Object value) {
return toBigInteger(value, null);
}
@ -694,43 +590,33 @@ public class Convert
* 如果给定的值为空,或者转换失败,返回默认值<br>
* 转换失败不会报错
*
* @param value 被转换的值
* @param value 被转换的值
* @param defaultValue 转换错误时的默认值
* @return 结果
*/
public static BigDecimal toBigDecimal(Object value, BigDecimal defaultValue)
{
if (value == null)
{
public static BigDecimal toBigDecimal(Object value, BigDecimal defaultValue) {
if (value == null) {
return defaultValue;
}
if (value instanceof BigDecimal)
{
if (value instanceof BigDecimal) {
return (BigDecimal) value;
}
if (value instanceof Long)
{
if (value instanceof Long) {
return new BigDecimal((Long) value);
}
if (value instanceof Double)
{
if (value instanceof Double) {
return BigDecimal.valueOf((Double) value);
}
if (value instanceof Integer)
{
if (value instanceof Integer) {
return new BigDecimal((Integer) value);
}
final String valueStr = toStr(value, null);
if (StringUtils.isEmpty(valueStr))
{
if (StringUtils.isEmpty(valueStr)) {
return defaultValue;
}
try
{
try {
return new BigDecimal(valueStr);
}
catch (Exception e)
{
} catch (Exception e) {
return defaultValue;
}
}
@ -743,8 +629,7 @@ public class Convert
* @param value 被转换的值
* @return 结果
*/
public static BigDecimal toBigDecimal(Object value)
{
public static BigDecimal toBigDecimal(Object value) {
return toBigDecimal(value, null);
}
@ -755,8 +640,7 @@ public class Convert
* @param obj 对象
* @return 字符串
*/
public static String utf8Str(Object obj)
{
public static String utf8Str(Object obj) {
return str(obj, CharsetKit.CHARSET_UTF_8);
}
@ -764,12 +648,11 @@ public class Convert
* 将对象转为字符串<br>
* 1、Byte数组和ByteBuffer会被转换为对应字符串的数组 2、对象数组会调用Arrays.toString方法
*
* @param obj 对象
* @param obj 对象
* @param charsetName 字符集
* @return 字符串
*/
public static String str(Object obj, String charsetName)
{
public static String str(Object obj, String charsetName) {
return str(obj, Charset.forName(charsetName));
}
@ -777,32 +660,23 @@ public class Convert
* 将对象转为字符串<br>
* 1、Byte数组和ByteBuffer会被转换为对应字符串的数组 2、对象数组会调用Arrays.toString方法
*
* @param obj 对象
* @param obj 对象
* @param charset 字符集
* @return 字符串
*/
public static String str(Object obj, Charset charset)
{
if (null == obj)
{
public static String str(Object obj, Charset charset) {
if (null == obj) {
return null;
}
if (obj instanceof String)
{
if (obj instanceof String) {
return (String) obj;
}
else if (obj instanceof byte[])
{
} else if (obj instanceof byte[]) {
return str((byte[]) obj, charset);
}
else if (obj instanceof Byte[])
{
} else if (obj instanceof Byte[]) {
byte[] bytes = ArrayUtils.toPrimitive((Byte[]) obj);
return str(bytes, charset);
}
else if (obj instanceof ByteBuffer)
{
} else if (obj instanceof ByteBuffer) {
return str((ByteBuffer) obj, charset);
}
return obj.toString();
@ -811,31 +685,27 @@ public class Convert
/**
* 将byte数组转为字符串
*
* @param bytes byte数组
* @param bytes byte数组
* @param charset 字符集
* @return 字符串
*/
public static String str(byte[] bytes, String charset)
{
public static String str(byte[] bytes, String charset) {
return str(bytes, StringUtils.isEmpty(charset) ? Charset.defaultCharset() : Charset.forName(charset));
}
/**
* 解码字节码
*
* @param data 字符串
* @param data 字符串
* @param charset 字符集,如果此字段为空,则解码的结果取决于平台
* @return 解码后的字符串
*/
public static String str(byte[] data, Charset charset)
{
if (data == null)
{
public static String str(byte[] data, Charset charset) {
if (data == null) {
return null;
}
if (null == charset)
{
if (null == charset) {
return new String(data);
}
return new String(data, charset);
@ -844,14 +714,12 @@ public class Convert
/**
* 将编码的byteBuffer数据转换为字符串
*
* @param data 数据
* @param data 数据
* @param charset 字符集,如果为空使用当前系统字符集
* @return 字符串
*/
public static String str(ByteBuffer data, String charset)
{
if (data == null)
{
public static String str(ByteBuffer data, String charset) {
if (data == null) {
return null;
}
@ -861,55 +729,47 @@ public class Convert
/**
* 将编码的byteBuffer数据转换为字符串
*
* @param data 数据
* @param data 数据
* @param charset 字符集,如果为空使用当前系统字符集
* @return 字符串
*/
public static String str(ByteBuffer data, Charset charset)
{
if (null == charset)
{
public static String str(ByteBuffer data, Charset charset) {
if (null == charset) {
charset = Charset.defaultCharset();
}
return charset.decode(data).toString();
}
// ----------------------------------------------------------------------- 全角半角转换
/**
* 半角转全角
*
* @param input String.
* @return 全角字符串.
*/
public static String toSBC(String input)
{
public static String toSBC(String input) {
return toSBC(input, null);
}
/**
* 半角转全角
*
* @param input String
* @param input String
* @param notConvertSet 不替换的字符集合
* @return 全角字符串.
*/
public static String toSBC(String input, Set<Character> notConvertSet)
{
public static String toSBC(String input, Set<Character> notConvertSet) {
char[] c = input.toCharArray();
for (int i = 0; i < c.length; i++)
{
if (null != notConvertSet && notConvertSet.contains(c[i]))
{
for (int i = 0; i < c.length; i++) {
if (null != notConvertSet && notConvertSet.contains(c[i])) {
// 跳过不替换的字符
continue;
}
if (c[i] == ' ')
{
if (c[i] == ' ') {
c[i] = '\u3000';
}
else if (c[i] < '\177')
{
} else if (c[i] < '\177') {
c[i] = (char) (c[i] + 65248);
}
@ -923,35 +783,28 @@ public class Convert
* @param input String.
* @return 半角字符串
*/
public static String toDBC(String input)
{
public static String toDBC(String input) {
return toDBC(input, null);
}
/**
* 替换全角为半角
*
* @param text 文本
* @param text 文本
* @param notConvertSet 不替换的字符集合
* @return 替换后的字符
*/
public static String toDBC(String text, Set<Character> notConvertSet)
{
public static String toDBC(String text, Set<Character> notConvertSet) {
char[] c = text.toCharArray();
for (int i = 0; i < c.length; i++)
{
if (null != notConvertSet && notConvertSet.contains(c[i]))
{
for (int i = 0; i < c.length; i++) {
if (null != notConvertSet && notConvertSet.contains(c[i])) {
// 跳过不替换的字符
continue;
}
if (c[i] == '\u3000')
{
if (c[i] == '\u3000') {
c[i] = ' ';
}
else if (c[i] > '\uFF00' && c[i] < '\uFF5F')
{
} else if (c[i] > '\uFF00' && c[i] < '\uFF5F') {
c[i] = (char) (c[i] - 65248);
}
}
@ -966,31 +819,26 @@ public class Convert
* @param n 数字
* @return 中文大写数字
*/
public static String digitUppercase(double n)
{
String[] fraction = { "角", "分" };
String[] digit = { "零", "壹", "贰", "叁", "肆", "伍", "陆", "柒", "捌", "玖" };
String[][] unit = { { "元", "万", "亿" }, { "", "拾", "佰", "仟" } };
public static String digitUppercase(double n) {
String[] fraction = {"角", "分"};
String[] digit = {"零", "壹", "贰", "叁", "肆", "伍", "陆", "柒", "捌", "玖"};
String[][] unit = {{"元", "万", "亿"}, {"", "拾", "佰", "仟"}};
String head = n < 0 ? "负" : "";
n = Math.abs(n);
String s = "";
for (int i = 0; i < fraction.length; i++)
{
for (int i = 0; i < fraction.length; i++) {
s += (digit[(int) (Math.floor(n * 10 * Math.pow(10, i)) % 10)] + fraction[i]).replaceAll("(零.)+", "");
}
if (s.length() < 1)
{
if (s.length() < 1) {
s = "整";
}
int integerPart = (int) Math.floor(n);
for (int i = 0; i < unit[0].length && integerPart > 0; i++)
{
for (int i = 0; i < unit[0].length && integerPart > 0; i++) {
String p = "";
for (int j = 0; j < unit[1].length && n > 0; j++)
{
for (int j = 0; j < unit[1].length && n > 0; j++) {
p = digit[integerPart % 10] + unit[1][j] + p;
integerPart = integerPart / 10;
}

View File

@ -4,11 +4,10 @@ import com.fastbee.common.utils.StringUtils;
/**
* 字符串格式化
*
*
* @author ruoyi
*/
public class StrFormatter
{
public class StrFormatter {
public static final String EMPTY_JSON = "{}";
public static final char C_BACKSLASH = '\\';
public static final char C_DELIM_START = '{';
@ -22,15 +21,13 @@ public class StrFormatter
* 通常使用:format("this is {} for {}", "a", "b") -> this is a for b<br>
* 转义{}: format("this is \\{} for {}", "a", "b") -> this is \{} for a<br>
* 转义\: format("this is \\\\{} for {}", "a", "b") -> this is \a for b<br>
*
*
* @param strPattern 字符串模板
* @param argArray 参数列表
* @param argArray 参数列表
* @return 结果
*/
public static String format(final String strPattern, final Object... argArray)
{
if (StringUtils.isEmpty(strPattern) || StringUtils.isEmpty(argArray))
{
public static String format(final String strPattern, final Object... argArray) {
if (StringUtils.isEmpty(strPattern) || StringUtils.isEmpty(argArray)) {
return strPattern;
}
final int strPatternLength = strPattern.length();
@ -40,43 +37,30 @@ public class StrFormatter
int handledPosition = 0;
int delimIndex;// 占位符所在位置
for (int argIndex = 0; argIndex < argArray.length; argIndex++)
{
for (int argIndex = 0; argIndex < argArray.length; argIndex++) {
delimIndex = strPattern.indexOf(EMPTY_JSON, handledPosition);
if (delimIndex == -1)
{
if (handledPosition == 0)
{
if (delimIndex == -1) {
if (handledPosition == 0) {
return strPattern;
}
else
{ // 字符串模板剩余部分不再包含占位符,加入剩余部分后返回结果
} else { // 字符串模板剩余部分不再包含占位符,加入剩余部分后返回结果
sbuf.append(strPattern, handledPosition, strPatternLength);
return sbuf.toString();
}
}
else
{
if (delimIndex > 0 && strPattern.charAt(delimIndex - 1) == C_BACKSLASH)
{
if (delimIndex > 1 && strPattern.charAt(delimIndex - 2) == C_BACKSLASH)
{
} else {
if (delimIndex > 0 && strPattern.charAt(delimIndex - 1) == C_BACKSLASH) {
if (delimIndex > 1 && strPattern.charAt(delimIndex - 2) == C_BACKSLASH) {
// 转义符之前还有一个转义符,占位符依旧有效
sbuf.append(strPattern, handledPosition, delimIndex - 1);
sbuf.append(Convert.utf8Str(argArray[argIndex]));
handledPosition = delimIndex + 2;
}
else
{
} else {
// 占位符被转义
argIndex--;
sbuf.append(strPattern, handledPosition, delimIndex - 1);
sbuf.append(C_DELIM_START);
handledPosition = delimIndex + 1;
}
}
else
{
} else {
// 正常占位符
sbuf.append(strPattern, handledPosition, delimIndex);
sbuf.append(Convert.utf8Str(argArray[argIndex]));

View File

@ -8,6 +8,7 @@ import java.util.List;
/**
* Neuron-JSON格式协议
*
* @author gsb
* @date 2023/5/31 16:36
*/

View File

@ -13,27 +13,40 @@ import lombok.Data;
@AllArgsConstructor
@Builder
@Data
public class SceneThingsModelItem
{
/** 物模型唯一标识符 */
public class SceneThingsModelItem {
/**
* 物模型唯一标识符
*/
private String id;
/** 物模型值 */
/**
* 物模型值
*/
private String value;
/** 类型:1=属性, 2=功能,3=事件, 4=设备升级,5=设备上线,6=设备下线 ,*/
/**
* 类型:1=属性, 2=功能,3=事件, 4=设备升级,5=设备上线,6=设备下线 ,
*/
private int type;
/** 脚本ID */
/**
* 脚本ID
*/
private String stripId;
/** 场景ID*/
/**
* 场景ID
*/
private Long sceneId;
/** 产品ID */
/**
* 产品ID
*/
private Long productId;
/** 设备编号 */
/**
* 设备编号
*/
private String DeviceNumber;
/**

View File

@ -5,13 +5,18 @@ import lombok.Builder;
import lombok.Data;
import java.util.Date;
@Data
@Builder
public class ThingsModelRuleItem {
/** 物模型唯一标识符 */
/**
* 物模型唯一标识符
*/
private String id;
/** 物模型值 */
/**
* 物模型值
*/
private String value;
private String operator;
private String triggerValue;
@ -22,7 +27,9 @@ public class ThingsModelRuleItem {
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date ts;
/** 备注 **/
/**
* 备注
**/
private String remark;
private String timestamp;

View File

@ -15,12 +15,15 @@ import java.util.Date;
*/
@AllArgsConstructor
@Builder
public class ThingsModelSimpleItem
{
/** 物模型唯一标识符 */
public class ThingsModelSimpleItem {
/**
* 物模型唯一标识符
*/
private String id;
/** 物模型值 */
/**
* 物模型值
*/
private String value;
private String name;
@ -31,14 +34,19 @@ public class ThingsModelSimpleItem
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date ts;
/** 备注 **/
/**
* 备注
**/
private String remark;
public ThingsModelSimpleItem(String id, String value , String remark){
this.id=id;
this.value=value;
this.remark=remark;
public ThingsModelSimpleItem(String id, String value, String remark) {
this.id = id;
this.value = value;
this.remark = remark;
}
public ThingsModelSimpleItem() {
}
public Date getTs() {
@ -46,11 +54,9 @@ public class ThingsModelSimpleItem
}
public void setTs(Date ts) {
this.ts = ts != null ? ts : DateUtils.getNowDate();
this.ts = ts != null ? ts : DateUtils.getNowDate();
}
public ThingsModelSimpleItem(){}
public String getRemark() {
return remark;
}

View File

@ -8,21 +8,28 @@ import java.util.List;
* @author kerwincui
* @date 2021-12-16
*/
public class ThingsModelValuesInput
{
/** 产品ID **/
public class ThingsModelValuesInput {
/**
* 产品ID
**/
private Long productId;
private Long deviceId;
/** 设备ID **/
/**
* 设备ID
**/
private String deviceNumber;
private Integer deviceType;
/** 设备物模型值的集合 **/
/**
* 设备物模型值的集合
**/
private List<ThingsModelSimpleItem> thingsModelSimpleItem;
/** 原始消息数据包(用于判断设备上电触发回包等) **/
/**
* 原始消息数据包(用于判断设备上电触发回包等)
**/
private Object sources;
public Long getDeviceId() {

View File

@ -2,12 +2,10 @@ package com.fastbee.common.enums;
/**
* 操作状态
*
* @author ruoyi
*
* @author ruoyi
*/
public enum BusinessStatus
{
public enum BusinessStatus {
/**
* 成功
*/

View File

@ -2,11 +2,10 @@ package com.fastbee.common.enums;
/**
* 业务操作类型
*
*
* @author ruoyi
*/
public enum BusinessType
{
public enum BusinessType {
/**
* 其它
*/
@ -51,7 +50,7 @@ public enum BusinessType
* 生成代码
*/
GENCODE,
/**
* 清空数据
*/

View File

@ -8,7 +8,6 @@ import java.util.Arrays;
/**
* 通用状态枚举
*/
@Getter
@AllArgsConstructor

View File

@ -15,19 +15,19 @@ public enum DataEnum {
DECIMAL("decimal", "十进制"),
DOUBLE("double", "双精度"),
ENUM("enum","枚举"),
BOOLEAN("bool","布尔类型"),
INTEGER("integer","整形"),
ENUM("enum", "枚举"),
BOOLEAN("bool", "布尔类型"),
INTEGER("integer", "整形"),
OBJECT("object", "对象"),
STRING("string","字符串"),
ARRAY("array","数组");
STRING("string", "字符串"),
ARRAY("array", "数组");
String type;
String msg;
public static DataEnum convert(String type){
public static DataEnum convert(String type) {
for (DataEnum value : DataEnum.values()) {
if (Objects.equals(value.type, type)){
if (Objects.equals(value.type, type)) {
return value;
}
}

View File

@ -5,8 +5,7 @@ package com.fastbee.common.enums;
*
* @author ruoyi
*/
public enum DataSourceType
{
public enum DataSourceType {
/**
* 主库
*/

View File

@ -5,10 +5,10 @@ import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* @description:
* @author admin
* @date 2024-07-18 14:52
* @version 1.0
* @description:
* @date 2024-07-18 14:52
*/
@Getter
@AllArgsConstructor
@ -18,7 +18,7 @@ public enum DeviceDistributeTypeEnum {
* 确保唯一,不能重复
*/
SELECT(1, "选择分配"),
IMPORT(2,"导入分配");
IMPORT(2, "导入分配");
/**
* 渠道类型

View File

@ -7,9 +7,10 @@ import lombok.Getter;
* 场景管理物模型、变量类型枚举
* 注意:以下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
* @date 2024-05-22 10:01
*/
@Getter
@AllArgsConstructor
@ -23,7 +24,7 @@ public enum DeviceLogTypeEnum {
DEVICE_OFFLINE(6, "设备离线"),
SCENE_VARIABLE_REPORT(7, "场景录入、运算变量上报下发"),
DATA_PARSE_ERROR(8, "数据解析错误"),
COMMAND_SEND_ERROR(9, "指令发送错误");;
COMMAND_SEND_ERROR(9, "指令发送错误");
private final Integer type;

View File

@ -5,10 +5,10 @@ import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* @description:
* @author admin
* @date 2024-07-18 14:52
* @version 1.0
* @description:
* @date 2024-07-18 14:52
*/
@Getter
@AllArgsConstructor
@ -18,9 +18,9 @@ public enum DeviceRecordTypeEnum {
* 确保唯一,不能重复
*/
IMPORT(1, "导入记录"),
RECOVERY(2,"回收记录"),
ASSIGNMENT(3,"分配记录"),
ASSIGNMENT_DETAIL(4,"分配详细记录");
RECOVERY(2, "回收记录"),
ASSIGNMENT(3, "分配记录"),
ASSIGNMENT_DETAIL(4, "分配详细记录");
/**

View File

@ -7,27 +7,27 @@ import lombok.Getter;
@AllArgsConstructor
public enum DeviceStatus {
UNACTIVATED(1,"NOTACTIVE","未激活"),
FORBIDDEN(2,"DISABLE","禁用"),
ONLINE(3,"ONLINE","在线"),
OFFLINE(4,"OFFLINE","离线");
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){
public static DeviceStatus convert(int type) {
for (DeviceStatus value : DeviceStatus.values()) {
if (value.type == type){
if (value.type == type) {
return value;
}
}
return null;
}
public static DeviceStatus convert(String code){
public static DeviceStatus convert(String code) {
for (DeviceStatus value : DeviceStatus.values()) {
if (value.code.equals(code)){
if (value.code.equals(code)) {
return value;
}
}

View File

@ -11,11 +11,10 @@ import lombok.Getter;
@AllArgsConstructor
public enum ExceptionCode {
SUCCESS(200,"成功"),
TIMEOUT(400,"超时"),
OFFLINE(404,"设备断线"),
FAIL(500,"失败");
;
SUCCESS(200, "成功"),
TIMEOUT(400, "超时"),
OFFLINE(404, "设备断线"),
FAIL(500, "失败");
public int code;
public String desc;

View File

@ -5,14 +5,15 @@ import lombok.Getter;
/**
* 设备回调状态
*
* @author bill
*/
@Getter
@AllArgsConstructor
public enum FunctionReplyStatus {
SUCCESS(200,"设备执行成功"),
FAIl(201,"指令执行失败"),
UNKNOWN(204,"设备超时未回复"),
SUCCESS(200, "设备执行成功"),
FAIl(201, "指令执行失败"),
UNKNOWN(204, "设备超时未回复"),
NORELY(203, "指令下发成功");
int code;

Some files were not shown because too many files have changed in this diff Show More