设备心跳调整 app新增增设备时绑定联网设备

This commit is contained in:
yuhaiming
2026-06-13 10:51:45 +08:00
parent c7f9df980a
commit c74363afa4
65 changed files with 1622 additions and 592 deletions

View File

@@ -5,6 +5,7 @@ import cn.hutool.http.HttpStatus;
import com.baomidou.mybatisplus.core.metadata.IPage;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.dromara.common.core.utils.MessageUtils;
import java.io.Serial;
import java.io.Serializable;
@@ -52,7 +53,7 @@ public class TableDataInfo<T> implements Serializable {
this.rows = list;
this.total = total;
this.code = HttpStatus.HTTP_OK;
this.msg = "查询成功";
this.msg = message("query.success", "查询成功");
}
/**
@@ -61,7 +62,7 @@ public class TableDataInfo<T> implements Serializable {
public static <T> TableDataInfo<T> build(IPage<T> page) {
TableDataInfo<T> rspData = new TableDataInfo<>();
rspData.setCode(HttpStatus.HTTP_OK);
rspData.setMsg("查询成功");
rspData.setMsg(message("query.success", "查询成功"));
rspData.setRows(page.getRecords());
rspData.setTotal(page.getTotal());
return rspData;
@@ -73,7 +74,7 @@ public class TableDataInfo<T> implements Serializable {
public static <T> TableDataInfo<T> build(List<T> list) {
TableDataInfo<T> rspData = new TableDataInfo<>();
rspData.setCode(HttpStatus.HTTP_OK);
rspData.setMsg("查询成功");
rspData.setMsg(message("query.success", "查询成功"));
rspData.setRows(list);
rspData.setTotal(list.size());
return rspData;
@@ -85,7 +86,7 @@ public class TableDataInfo<T> implements Serializable {
public static <T> TableDataInfo<T> build() {
TableDataInfo<T> rspData = new TableDataInfo<>();
rspData.setCode(HttpStatus.HTTP_OK);
rspData.setMsg("查询成功");
rspData.setMsg(message("query.success", "查询成功"));
return rspData;
}
@@ -104,4 +105,13 @@ public class TableDataInfo<T> implements Serializable {
return new TableDataInfo<>(pageList, list.size());
}
private static String message(String code, String defaultMessage) {
try {
String message = MessageUtils.message(code);
return code.equals(message) ? defaultMessage : message;
} catch (Exception e) {
return defaultMessage;
}
}
}

View File

@@ -45,7 +45,7 @@ public class MybatisExceptionHandler {
log.error("请求地址'{}', 未找到数据源", requestURI);
return R.fail(HttpStatus.HTTP_INTERNAL_ERROR, "未找到数据源,请联系管理员确认");
}
log.error("请求地址'{}', Mybatis系统异常", requestURI, e);
log.error("请求地址'{}', MyBatis系统异常", requestURI, e);
return R.fail(HttpStatus.HTTP_INTERNAL_ERROR, e.getMessage());
}