fix():修改saas结构
parent
1468206f1d
commit
5c4e0cde3e
|
@ -34,7 +34,7 @@ public class TokenController {
|
|||
@PostMapping("login")
|
||||
public Result<?> login (@RequestBody LoginBody form) {
|
||||
// 用户登录
|
||||
LoginUser userInfo = sysLoginService.login(form.getUsername(), form.getPassword());
|
||||
LoginUser userInfo = sysLoginService.login(form.getUsername(), form.getPassword(), form.getFirmId());
|
||||
// 获取登录token
|
||||
return Result.success(tokenService.createToken(userInfo));
|
||||
}
|
||||
|
|
|
@ -1,10 +1,20 @@
|
|||
package com.muyu.auth.form;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
/**
|
||||
* 用户登录对象
|
||||
*
|
||||
* @author muyu
|
||||
*/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class LoginBody {
|
||||
/**
|
||||
* 用户名
|
||||
|
@ -15,24 +25,10 @@ public class LoginBody {
|
|||
* 用户密码
|
||||
*/
|
||||
private String password;
|
||||
|
||||
/**
|
||||
* 公司数据信息id
|
||||
*/
|
||||
private Long firmId;
|
||||
|
||||
public String getUsername () {
|
||||
return username;
|
||||
}
|
||||
|
||||
public void setUsername (String username) {
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
public String getPassword () {
|
||||
return password;
|
||||
}
|
||||
|
||||
public void setPassword (String password) {
|
||||
this.password = password;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,9 +40,9 @@ public class SysLoginService {
|
|||
/**
|
||||
* 登录
|
||||
*/
|
||||
public LoginUser login (String username, String password) {
|
||||
public LoginUser login(String username, String password, Long firmId) {
|
||||
// 用户名或密码为空 错误
|
||||
if (StringUtils.isAnyBlank(username, password)) {
|
||||
if (StringUtils.isAnyBlank(username, password, String.valueOf(firmId))) {
|
||||
recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "用户/密码必须填写");
|
||||
throw new ServiceException("用户/密码必须填写");
|
||||
}
|
||||
|
@ -65,7 +65,9 @@ public class SysLoginService {
|
|||
throw new ServiceException("很遗憾,访问IP已被列入系统黑名单");
|
||||
}
|
||||
// 查询用户信息
|
||||
Result<LoginUser> userResult = remoteUserService.getUserInfo(username, SecurityConstants.INNER);
|
||||
Result<LoginUser> userResult = null;
|
||||
// 查询用户信息
|
||||
userResult = remoteUserService.getUserInfo(username, firmId, SecurityConstants.INNER);
|
||||
|
||||
if (StringUtils.isNull(userResult) || StringUtils.isNull(userResult.getData())) {
|
||||
recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "登录用户不存在");
|
||||
|
@ -91,14 +93,14 @@ public class SysLoginService {
|
|||
return userInfo;
|
||||
}
|
||||
|
||||
public void logout (String loginName) {
|
||||
public void logout(String loginName) {
|
||||
recordLogService.recordLogininfor(loginName, Constants.LOGOUT, "退出成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 注册
|
||||
*/
|
||||
public void register (String username, String password) {
|
||||
public void register(String username, String password) {
|
||||
// 用户名或密码为空 错误
|
||||
if (StringUtils.isAnyBlank(username, password)) {
|
||||
throw new ServiceException("用户/密码必须填写");
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Tomcat
|
||||
server:
|
||||
port: 9500
|
||||
port: 19500
|
||||
|
||||
# nacos线上地址
|
||||
nacos:
|
||||
|
|
|
@ -9,29 +9,32 @@ package com.muyu.common.cache;
|
|||
* * @Version: 1.0
|
||||
* * @description:
|
||||
*/
|
||||
public interface PrimaryKeyBasic <K>{
|
||||
public interface PrimaryKeyBasic<K> {
|
||||
|
||||
/**
|
||||
* 主键前缀
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String keyPre();
|
||||
|
||||
/**
|
||||
* 主键编码
|
||||
*
|
||||
* @param key 缓存建
|
||||
* @return 装修建
|
||||
*/
|
||||
public default String encode(K key){
|
||||
return keyPre() + key.toString();
|
||||
public default String encode(K key) {
|
||||
return key.toString() + keyPre();
|
||||
}
|
||||
|
||||
/**
|
||||
* 主键解码
|
||||
*
|
||||
* @param key 缓存建
|
||||
* @return 装修建
|
||||
*/
|
||||
public default K decode(String key) {
|
||||
return (K) key.substring(keyPre().length());
|
||||
return (K) key.substring(0, key.lastIndexOf(keyPre()));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,12 +9,12 @@ public class CacheConstants {
|
|||
/**
|
||||
* 缓存有效期,默认720(分钟)
|
||||
*/
|
||||
public final static long EXPIRATION = 720;
|
||||
public final static Long EXPIRATION = 720L;
|
||||
|
||||
/**
|
||||
* 缓存刷新时间,默认120(分钟)
|
||||
*/
|
||||
public final static long REFRESH_TIME = 120;
|
||||
public final static Long REFRESH_TIME = 120L;
|
||||
|
||||
/**
|
||||
* 密码最大错误次数
|
||||
|
@ -24,7 +24,7 @@ public class CacheConstants {
|
|||
/**
|
||||
* 密码锁定时间,默认10(分钟)
|
||||
*/
|
||||
public final static long PASSWORD_LOCK_TIME = 10;
|
||||
public final static Long PASSWORD_LOCK_TIME = 10L;
|
||||
|
||||
/**
|
||||
* 权限缓存前缀
|
||||
|
|
|
@ -109,7 +109,7 @@ public class Constants {
|
|||
/**
|
||||
* 验证码有效期(分钟)
|
||||
*/
|
||||
public static final long CAPTCHA_EXPIRATION = 2;
|
||||
public static final Long CAPTCHA_EXPIRATION = 2L;
|
||||
|
||||
/**
|
||||
* 资源映射路径 前缀
|
||||
|
|
|
@ -54,7 +54,7 @@ public class GenConstants {
|
|||
/**
|
||||
* 数据库文本类型
|
||||
*/
|
||||
public static final String[] COLUMNTYPE_TEXT = {"tinytext", "text", "mediumtext", "longtext"};
|
||||
public static final String[] COLUMNTYPE_TEXT = {"tinytext", "text", "mediumtext", "Longtext"};
|
||||
|
||||
/**
|
||||
* 数据库时间类型
|
||||
|
|
|
@ -45,4 +45,13 @@ public class SecurityConstants {
|
|||
* 角色权限
|
||||
*/
|
||||
public static final String ROLE_PERMISSION = "role_permission";
|
||||
|
||||
/**
|
||||
* 公司key
|
||||
*/
|
||||
public static final String FIRM_KEY = "firm_key";
|
||||
/**
|
||||
* 公司Id
|
||||
*/
|
||||
public static final String FIRM_ID = "firm_id";
|
||||
}
|
||||
|
|
|
@ -24,6 +24,6 @@ public class ServiceNameConstants {
|
|||
/**
|
||||
* 车辆服务的serviceid
|
||||
*/
|
||||
public static final String ENTERPRISE_SERVICE = "cloud-saas";
|
||||
public static final String ENTERPRISE_SERVICE = "cloud-enterprise";
|
||||
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ public class Result<T> implements Serializable {
|
|||
*/
|
||||
public static final int WARN = HttpStatus.WARN;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final Long serialVersionUID = 1L;
|
||||
|
||||
private int code;
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ package com.muyu.common.core.exception;
|
|||
* @author muyu
|
||||
*/
|
||||
public class CaptchaException extends RuntimeException {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final Long serialVersionUID = 1L;
|
||||
|
||||
public CaptchaException (String msg) {
|
||||
super(msg);
|
||||
|
|
|
@ -6,7 +6,7 @@ package com.muyu.common.core.exception;
|
|||
* @author muyu
|
||||
*/
|
||||
public class CheckedException extends RuntimeException {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final Long serialVersionUID = 1L;
|
||||
|
||||
public CheckedException (String message) {
|
||||
super(message);
|
||||
|
|
|
@ -6,7 +6,7 @@ package com.muyu.common.core.exception;
|
|||
* @author muyu
|
||||
*/
|
||||
public class DemoModeException extends RuntimeException {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final Long serialVersionUID = 1L;
|
||||
|
||||
public DemoModeException () {
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ package com.muyu.common.core.exception;
|
|||
* @author muyu
|
||||
*/
|
||||
public class GlobalException extends RuntimeException {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final Long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 错误提示
|
||||
|
|
|
@ -6,7 +6,7 @@ package com.muyu.common.core.exception;
|
|||
* @author muyu
|
||||
*/
|
||||
public class InnerAuthException extends RuntimeException {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final Long serialVersionUID = 1L;
|
||||
|
||||
public InnerAuthException (String message) {
|
||||
super(message);
|
||||
|
|
|
@ -6,7 +6,7 @@ package com.muyu.common.core.exception;
|
|||
* @author muyu
|
||||
*/
|
||||
public class PreAuthorizeException extends RuntimeException {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final Long serialVersionUID = 1L;
|
||||
|
||||
public PreAuthorizeException () {
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ package com.muyu.common.core.exception;
|
|||
* @author muyu
|
||||
*/
|
||||
public class ServiceException extends RuntimeException {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final Long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 错误码
|
||||
|
|
|
@ -6,7 +6,7 @@ package com.muyu.common.core.exception;
|
|||
* @author muyu
|
||||
*/
|
||||
public class UtilException extends RuntimeException {
|
||||
private static final long serialVersionUID = 8247610319171014183L;
|
||||
private static final Long serialVersionUID = 8247610319171014183L;
|
||||
|
||||
public UtilException (Throwable e) {
|
||||
super(e.getMessage(), e);
|
||||
|
|
|
@ -6,7 +6,7 @@ package com.muyu.common.core.exception.auth;
|
|||
* @author muyu
|
||||
*/
|
||||
public class NotLoginException extends RuntimeException {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final Long serialVersionUID = 1L;
|
||||
|
||||
public NotLoginException (String message) {
|
||||
super(message);
|
||||
|
|
|
@ -8,7 +8,7 @@ import org.apache.commons.lang3.StringUtils;
|
|||
* @author muyu
|
||||
*/
|
||||
public class NotPermissionException extends RuntimeException {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final Long serialVersionUID = 1L;
|
||||
|
||||
public NotPermissionException (String permission) {
|
||||
super(permission);
|
||||
|
|
|
@ -8,7 +8,7 @@ import org.apache.commons.lang3.StringUtils;
|
|||
* @author muyu
|
||||
*/
|
||||
public class NotRoleException extends RuntimeException {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final Long serialVersionUID = 1L;
|
||||
|
||||
public NotRoleException (String role) {
|
||||
super(role);
|
||||
|
|
|
@ -6,7 +6,7 @@ package com.muyu.common.core.exception.base;
|
|||
* @author muyu
|
||||
*/
|
||||
public class BaseException extends RuntimeException {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final Long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 所属模块
|
||||
|
|
|
@ -8,7 +8,7 @@ import com.muyu.common.core.exception.base.BaseException;
|
|||
* @author muyu
|
||||
*/
|
||||
public class FileException extends BaseException {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final Long serialVersionUID = 1L;
|
||||
|
||||
public FileException (String code, Object[] args, String msg) {
|
||||
super("file", code, args, msg);
|
||||
|
|
|
@ -6,9 +6,9 @@ package com.muyu.common.core.exception.file;
|
|||
* @author muyu
|
||||
*/
|
||||
public class FileNameLengthLimitExceededException extends FileException {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final Long serialVersionUID = 1L;
|
||||
|
||||
public FileNameLengthLimitExceededException (int defaultFileNameLength) {
|
||||
super("upload.filename.exceed.length", new Object[]{defaultFileNameLength}, "the filename is too long");
|
||||
super("upload.filename.exceed.length", new Object[]{defaultFileNameLength}, "the filename is too Long");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,9 +6,9 @@ package com.muyu.common.core.exception.file;
|
|||
* @author muyu
|
||||
*/
|
||||
public class FileSizeLimitExceededException extends FileException {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final Long serialVersionUID = 1L;
|
||||
|
||||
public FileSizeLimitExceededException (long defaultMaxSize) {
|
||||
public FileSizeLimitExceededException (Long defaultMaxSize) {
|
||||
super("upload.exceed.maxSize", new Object[]{defaultMaxSize}, "the filesize is too large");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ import java.io.PrintWriter;
|
|||
*/
|
||||
public class FileUploadException extends Exception {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final Long serialVersionUID = 1L;
|
||||
|
||||
private final Throwable cause;
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ import java.util.Arrays;
|
|||
* @author muyu
|
||||
*/
|
||||
public class InvalidExtensionException extends FileUploadException {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final Long serialVersionUID = 1L;
|
||||
|
||||
private String[] allowedExtension;
|
||||
private String extension;
|
||||
|
@ -34,7 +34,7 @@ public class InvalidExtensionException extends FileUploadException {
|
|||
}
|
||||
|
||||
public static class InvalidImageExtensionException extends InvalidExtensionException {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final Long serialVersionUID = 1L;
|
||||
|
||||
public InvalidImageExtensionException (String[] allowedExtension, String extension, String filename) {
|
||||
super(allowedExtension, extension, filename);
|
||||
|
@ -42,7 +42,7 @@ public class InvalidExtensionException extends FileUploadException {
|
|||
}
|
||||
|
||||
public static class InvalidFlashExtensionException extends InvalidExtensionException {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final Long serialVersionUID = 1L;
|
||||
|
||||
public InvalidFlashExtensionException (String[] allowedExtension, String extension, String filename) {
|
||||
super(allowedExtension, extension, filename);
|
||||
|
@ -50,7 +50,7 @@ public class InvalidExtensionException extends FileUploadException {
|
|||
}
|
||||
|
||||
public static class InvalidMediaExtensionException extends InvalidExtensionException {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final Long serialVersionUID = 1L;
|
||||
|
||||
public InvalidMediaExtensionException (String[] allowedExtension, String extension, String filename) {
|
||||
super(allowedExtension, extension, filename);
|
||||
|
@ -58,7 +58,7 @@ public class InvalidExtensionException extends FileUploadException {
|
|||
}
|
||||
|
||||
public static class InvalidVideoExtensionException extends InvalidExtensionException {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final Long serialVersionUID = 1L;
|
||||
|
||||
public InvalidVideoExtensionException (String[] allowedExtension, String extension, String filename) {
|
||||
super(allowedExtension, extension, filename);
|
||||
|
|
|
@ -6,7 +6,7 @@ package com.muyu.common.core.exception.job;
|
|||
* @author muyu
|
||||
*/
|
||||
public class TaskException extends Exception {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final Long serialVersionUID = 1L;
|
||||
|
||||
private Code code;
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ package com.muyu.common.core.exception.user;
|
|||
* @author muyu
|
||||
*/
|
||||
public class CaptchaExpireException extends UserException {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final Long serialVersionUID = 1L;
|
||||
|
||||
public CaptchaExpireException () {
|
||||
super("user.jcaptcha.expire", null);
|
||||
|
|
|
@ -8,7 +8,7 @@ import com.muyu.common.core.exception.base.BaseException;
|
|||
* @author muyu
|
||||
*/
|
||||
public class UserException extends BaseException {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final Long serialVersionUID = 1L;
|
||||
|
||||
public UserException (String code, Object[] args) {
|
||||
super("user", code, args, null);
|
||||
|
|
|
@ -6,7 +6,7 @@ package com.muyu.common.core.exception.user;
|
|||
* @author muyu
|
||||
*/
|
||||
public class UserPasswordNotMatchException extends UserException {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final Long serialVersionUID = 1L;
|
||||
|
||||
public UserPasswordNotMatchException () {
|
||||
super("user.password.not.match", null);
|
||||
|
|
|
@ -313,12 +313,12 @@ public class Convert {
|
|||
return new Long[]{};
|
||||
}
|
||||
String[] arr = str.split(split);
|
||||
final Long[] longs = new Long[arr.length];
|
||||
final Long[] Longs = new Long[arr.length];
|
||||
for (int i = 0 ; i < arr.length ; i++) {
|
||||
final Long v = toLong(arr[i], null);
|
||||
longs[i] = v;
|
||||
Longs[i] = v;
|
||||
}
|
||||
return longs;
|
||||
return Longs;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -345,7 +345,7 @@ public class Convert {
|
|||
}
|
||||
|
||||
/**
|
||||
* 转换为long<br>
|
||||
* 转换为Long<br>
|
||||
* 如果给定的值为空,或者转换失败,返回默认值<br>
|
||||
* 转换失败不会报错
|
||||
*
|
||||
|
@ -377,7 +377,7 @@ public class Convert {
|
|||
}
|
||||
|
||||
/**
|
||||
* 转换为long<br>
|
||||
* 转换为Long<br>
|
||||
* 如果给定的值为<code>null</code>,或者转换失败,返回默认值<code>null</code><br>
|
||||
* 转换失败不会报错
|
||||
*
|
||||
|
|
|
@ -109,7 +109,7 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
|
|||
* 获取服务器启动时间
|
||||
*/
|
||||
public static Date getServerStartDate () {
|
||||
long time = ManagementFactory.getRuntimeMXBean().getStartTime();
|
||||
Long time = ManagementFactory.getRuntimeMXBean().getStartTime();
|
||||
return new Date(time);
|
||||
}
|
||||
|
||||
|
@ -122,20 +122,20 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
|
|||
* @return 时间差(天/小时/分钟)
|
||||
*/
|
||||
public static String timeDistance (Date endDate, Date startTime) {
|
||||
long nd = 1000 * 24 * 60 * 60;
|
||||
long nh = 1000 * 60 * 60;
|
||||
long nm = 1000 * 60;
|
||||
// long ns = 1000;
|
||||
Long nd = 1000 * 24 * 60 * 60L;
|
||||
Long nh = 1000 * 60 * 60L;
|
||||
Long nm = 1000 * 60L;
|
||||
// Long ns = 1000;
|
||||
// 获得两个时间的毫秒时间差异
|
||||
long diff = endDate.getTime() - startTime.getTime();
|
||||
Long diff = endDate.getTime() - startTime.getTime();
|
||||
// 计算差多少天
|
||||
long day = diff / nd;
|
||||
Long day = diff / nd;
|
||||
// 计算差多少小时
|
||||
long hour = diff % nd / nh;
|
||||
Long hour = diff % nd / nh;
|
||||
// 计算差多少分钟
|
||||
long min = diff % nd % nh / nm;
|
||||
Long min = diff % nd % nh / nm;
|
||||
// 计算差多少秒//输出结果
|
||||
// long sec = diff % nd % nh % nm / ns;
|
||||
// Long sec = diff % nd % nh % nm / ns;
|
||||
return day + "天" + hour + "小时" + min + "分钟";
|
||||
}
|
||||
|
||||
|
|
|
@ -162,4 +162,21 @@ public class JwtUtils {
|
|||
public static String getValue (Claims claims, String key) {
|
||||
return Convert.toStr(claims.get(key), "");
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据
|
||||
* @param claims
|
||||
* @return
|
||||
*/
|
||||
public static String getFirmKey(Claims claims) {
|
||||
return getValue(claims, SecurityConstants.FIRM_KEY);
|
||||
}
|
||||
/**
|
||||
* 根据
|
||||
* @param claims
|
||||
* @return
|
||||
*/
|
||||
public static String getFirmId(Claims claims) {
|
||||
return getValue(claims, SecurityConstants.FIRM_ID);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ public final class HTMLFilter {
|
|||
private static final ConcurrentMap<String, Pattern> P_REMOVE_SELF_BLANKS = new ConcurrentHashMap<>();
|
||||
|
||||
/**
|
||||
* set of allowed html elements, along with allowed attributes for each element
|
||||
* set of allowed html elements, aLong with allowed attributes for each element
|
||||
**/
|
||||
private final Map<String, List<String>> vAllowed;
|
||||
/**
|
||||
|
|
|
@ -127,7 +127,7 @@ public class IpUtils {
|
|||
byte[] bytes = new byte[4];
|
||||
String[] elements = text.split("\\.", -1);
|
||||
try {
|
||||
long l;
|
||||
Long l;
|
||||
int i;
|
||||
switch (elements.length) {
|
||||
case 1:
|
||||
|
@ -141,12 +141,12 @@ public class IpUtils {
|
|||
bytes[3] = (byte) (int) (l & 0xFF);
|
||||
break;
|
||||
case 2:
|
||||
l = Integer.parseInt(elements[0]);
|
||||
l = (long) Integer.parseInt(elements[0]);
|
||||
if ((l < 0L) || (l > 255L)) {
|
||||
return null;
|
||||
}
|
||||
bytes[0] = (byte) (int) (l & 0xFF);
|
||||
l = Integer.parseInt(elements[1]);
|
||||
l = (long) Integer.parseInt(elements[1]);
|
||||
if ((l < 0L) || (l > 16777215L)) {
|
||||
return null;
|
||||
}
|
||||
|
@ -156,13 +156,13 @@ public class IpUtils {
|
|||
break;
|
||||
case 3:
|
||||
for (i = 0; i < 2 ; ++i) {
|
||||
l = Integer.parseInt(elements[i]);
|
||||
l = (long) Integer.parseInt(elements[i]);
|
||||
if ((l < 0L) || (l > 255L)) {
|
||||
return null;
|
||||
}
|
||||
bytes[i] = (byte) (int) (l & 0xFF);
|
||||
}
|
||||
l = Integer.parseInt(elements[2]);
|
||||
l = (long) Integer.parseInt(elements[2]);
|
||||
if ((l < 0L) || (l > 65535L)) {
|
||||
return null;
|
||||
}
|
||||
|
@ -171,7 +171,7 @@ public class IpUtils {
|
|||
break;
|
||||
case 4:
|
||||
for (i = 0; i < 4 ; ++i) {
|
||||
l = Integer.parseInt(elements[i]);
|
||||
l = (long) Integer.parseInt(elements[i]);
|
||||
if ((l < 0L) || (l > 255L)) {
|
||||
return null;
|
||||
}
|
||||
|
@ -290,14 +290,14 @@ public class IpUtils {
|
|||
String[] sips = iparea.substring(0, idx).split("\\.");
|
||||
String[] sipe = iparea.substring(idx + 1).split("\\.");
|
||||
String[] sipt = ip.split("\\.");
|
||||
long ips = 0L, ipe = 0L, ipt = 0L;
|
||||
Long ips = 0L, ipe = 0L, ipt = 0L;
|
||||
for (int i = 0 ; i < 4 ; ++i) {
|
||||
ips = ips << 8 | Integer.parseInt(sips[i]);
|
||||
ipe = ipe << 8 | Integer.parseInt(sipe[i]);
|
||||
ipt = ipt << 8 | Integer.parseInt(sipt[i]);
|
||||
}
|
||||
if (ips > ipe) {
|
||||
long t = ips;
|
||||
Long t = ips;
|
||||
ips = ipe;
|
||||
ipe = t;
|
||||
}
|
||||
|
|
|
@ -30,8 +30,8 @@ public final class UUID implements java.io.Serializable, Comparable<UUID> {
|
|||
* @param data 数据
|
||||
*/
|
||||
private UUID (byte[] data) {
|
||||
long msb = 0;
|
||||
long lsb = 0;
|
||||
long msb = 0L;
|
||||
long lsb = 0L;
|
||||
assert data.length == 16 : "data must be 16 bytes in length";
|
||||
for (int i = 0 ; i < 8 ; i++) {
|
||||
msb = (msb << 8) | (data[i] & 0xff);
|
||||
|
@ -131,15 +131,15 @@ public final class UUID implements java.io.Serializable, Comparable<UUID> {
|
|||
components[i] = "0x" + components[i];
|
||||
}
|
||||
|
||||
long mostSigBits = Long.decode(components[0]).longValue();
|
||||
long mostSigBits = Long.decode(components[0]);
|
||||
mostSigBits <<= 16;
|
||||
mostSigBits |= Long.decode(components[1]).longValue();
|
||||
mostSigBits |= Long.decode(components[1]);
|
||||
mostSigBits <<= 16;
|
||||
mostSigBits |= Long.decode(components[2]).longValue();
|
||||
mostSigBits |= Long.decode(components[2]);
|
||||
|
||||
long leastSigBits = Long.decode(components[3]).longValue();
|
||||
long leastSigBits = Long.decode(components[3]);
|
||||
leastSigBits <<= 48;
|
||||
leastSigBits |= Long.decode(components[4]).longValue();
|
||||
leastSigBits |= Long.decode(components[4]);
|
||||
|
||||
return new UUID(mostSigBits, leastSigBits);
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ import java.util.Map;
|
|||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class BaseEntity implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final Long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 搜索值
|
||||
|
|
|
@ -17,7 +17,7 @@ import java.util.List;
|
|||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class TreeEntity extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final Long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 父菜单名称
|
||||
|
|
|
@ -20,12 +20,12 @@ import java.util.List;
|
|||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class TableDataInfo<T> implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final Long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 总记录数
|
||||
*/
|
||||
private long total;
|
||||
private Long total;
|
||||
|
||||
/**
|
||||
* 列表数据
|
||||
|
|
|
@ -71,7 +71,7 @@ public class IotDBSessionConfig {
|
|||
* @param value
|
||||
*/
|
||||
public void insertRecord(SessionPool sessionPool,String deviceId,
|
||||
long time, List<String> measurements,List<TSDataType> dataTypeList, JSONObject value) {
|
||||
Long time, List<String> measurements,List<TSDataType> dataTypeList, JSONObject value) {
|
||||
try {
|
||||
log.info("iotdb数据入库:device_id:[{}], measurements:[{}], values:[{}]", deviceId, measurements, value);
|
||||
sessionPool.insertRecord(deviceId, time, measurements,dataTypeList,new Object[]{value.toJSONString()});
|
||||
|
@ -153,26 +153,26 @@ public class IotDBSessionConfig {
|
|||
|
||||
SessionDataSet sessionDataSet = iotDBSessionConfig.selectRecord(sessionPool,SELECT_ROOT_DATA_DATAJSON_DATASOURCE);
|
||||
|
||||
HashMap<Long, Map<String, String>> longMapHashMap = new HashMap<>();
|
||||
HashMap<Long, Map<String, String>> LongMapHashMap = new HashMap<>();
|
||||
|
||||
try {
|
||||
while (sessionDataSet.hasNext()){
|
||||
RowRecord next = sessionDataSet.next();
|
||||
long timestamp = next.getTimestamp();
|
||||
Long timestamp = next.getTimestamp();
|
||||
Map<String, String> fieldMap = new HashMap<>();
|
||||
for (Field field : next.getFields()) {
|
||||
TSDataType dataType = field.getDataType();
|
||||
String stringValue = field.getStringValue();
|
||||
fieldMap.put(dataType.name(), stringValue);
|
||||
}
|
||||
longMapHashMap.put(timestamp, fieldMap);
|
||||
LongMapHashMap.put(timestamp, fieldMap);
|
||||
}
|
||||
} catch (StatementExecutionException e) {
|
||||
throw new RuntimeException(e);
|
||||
} catch (IoTDBConnectionException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
log.info("数据为:{}", JSONObject.toJSONString(longMapHashMap));
|
||||
log.info("数据为:{}", JSONObject.toJSONString(LongMapHashMap));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -23,9 +23,9 @@ public interface IotDBService {
|
|||
|
||||
void insertTablets(Map<String, Tablet> tablets);
|
||||
|
||||
void insertStringRecord(String deviceId, long time, List<String> measurements, List<String> values);
|
||||
void insertStringRecord(String deviceId, Long time, List<String> measurements, List<String> values);
|
||||
|
||||
void insertRecord(String deviceId, long time, List<String> measurements, List<TSDataType> types, List<Object> values);
|
||||
void insertRecord(String deviceId, Long time, List<String> measurements, List<TSDataType> types, List<Object> values);
|
||||
|
||||
void insertStringRecords(List<String> deviceIds, List<Long> times, List<List<String>> measurementsList, List<List<String>> valuesList);
|
||||
|
||||
|
@ -35,17 +35,17 @@ public interface IotDBService {
|
|||
|
||||
void insertRecordsOfOneDevice(String deviceId, List<Long> times, List<List<String>> measurementsList, List<List<TSDataType>> typesList, List<List<Object>> valuesList);
|
||||
|
||||
void deleteData(String path, long endTime);
|
||||
void deleteData(String path, Long endTime);
|
||||
|
||||
void deleteData(List<String> paths, long endTime);
|
||||
void deleteData(List<String> paths, Long endTime);
|
||||
|
||||
SessionDataSet executeRawDataQuery(List<String> paths, long startTime, long endTime, long timeOut);
|
||||
SessionDataSet executeRawDataQuery(List<String> paths, Long startTime, Long endTime, Long timeOut);
|
||||
|
||||
<T> List<T> executeRawDataQuery(List<String> paths, long startTime, long endTime, long timeOut, Class<? extends IotDbRecordAble> clazz);
|
||||
<T> List<T> executeRawDataQuery(List<String> paths, Long startTime, Long endTime, Long timeOut, Class<? extends IotDbRecordAble> clazz);
|
||||
|
||||
SessionDataSet executeLastDataQuery(List<String> paths, long lastTime);
|
||||
SessionDataSet executeLastDataQuery(List<String> paths, Long lastTime);
|
||||
|
||||
<T> List<T> executeLastDataQuery(List<String> paths, long lastTime, Class<? extends IotDbRecordAble> clazz);
|
||||
<T> List<T> executeLastDataQuery(List<String> paths, Long lastTime, Class<? extends IotDbRecordAble> clazz);
|
||||
|
||||
SessionDataSet executeLastDataQueryForOneDevice(String db, String device, List<String> sensors, boolean isLegalPathNodes);
|
||||
|
||||
|
@ -53,11 +53,11 @@ public interface IotDBService {
|
|||
|
||||
SessionDataSet executeAggregationQuery(List<String> paths, List<TAggregationType> aggregations);
|
||||
|
||||
SessionDataSet executeAggregationQuery(List<String> paths, List<TAggregationType> aggregations, long startTime, long endTime);
|
||||
SessionDataSet executeAggregationQuery(List<String> paths, List<TAggregationType> aggregations, Long startTime, Long endTime);
|
||||
|
||||
SessionDataSet executeAggregationQuery(List<String> paths, List<TAggregationType> aggregations, long startTime, long endTime, long interval);
|
||||
SessionDataSet executeAggregationQuery(List<String> paths, List<TAggregationType> aggregations, Long startTime, Long endTime, Long interval);
|
||||
|
||||
SessionDataSet executeAggregationQuery(List<String> paths, List<TAggregationType> aggregations, long startTime, long endTime, long interval, long slidingStep);
|
||||
SessionDataSet executeAggregationQuery(List<String> paths, List<TAggregationType> aggregations, Long startTime, Long endTime, Long interval, Long slidingStep);
|
||||
|
||||
SessionDataSet executeQueryStatement(String sql);
|
||||
|
||||
|
|
|
@ -77,7 +77,7 @@ public class IotDBServiceImpl implements IotDBService {
|
|||
* @param values 数据项对应值列表
|
||||
*/
|
||||
@Override
|
||||
public void insertStringRecord(String deviceId, long time, List<String> measurements, List<String> values) {
|
||||
public void insertStringRecord(String deviceId, Long time, List<String> measurements, List<String> values) {
|
||||
SessionPool sessionPool = iotDBSessionConfig.getSessionPool();
|
||||
try {
|
||||
log.info("iotdb数据入库:device_id:[{}], measurements:[{}], values:[{}]", deviceId, measurements, values);
|
||||
|
@ -98,7 +98,7 @@ public class IotDBServiceImpl implements IotDBService {
|
|||
* @param values 数据项对应值列表
|
||||
*/
|
||||
@Override
|
||||
public void insertRecord(String deviceId, long time, List<String> measurements, List<TSDataType> types, List<Object> values) {
|
||||
public void insertRecord(String deviceId, Long time, List<String> measurements, List<TSDataType> types, List<Object> values) {
|
||||
SessionPool sessionPool = iotDBSessionConfig.getSessionPool();
|
||||
try {
|
||||
log.info("iotdb数据入库:device_id:[{}], measurements:[{}], types:[{}], values:[{}]", deviceId, measurements, types, values);
|
||||
|
@ -198,7 +198,7 @@ public class IotDBServiceImpl implements IotDBService {
|
|||
* @param endTime 删除时间点
|
||||
*/
|
||||
@Override
|
||||
public void deleteData(String path, long endTime) {
|
||||
public void deleteData(String path, Long endTime) {
|
||||
SessionPool sessionPool = iotDBSessionConfig.getSessionPool();
|
||||
try {
|
||||
log.info("iotdb数据删除:path:[{}], endTime:[{}]", path, endTime);
|
||||
|
@ -215,7 +215,7 @@ public class IotDBServiceImpl implements IotDBService {
|
|||
* @param endTime 删除时间点
|
||||
*/
|
||||
@Override
|
||||
public void deleteData(List<String> paths, long endTime) {
|
||||
public void deleteData(List<String> paths, Long endTime) {
|
||||
SessionPool sessionPool = iotDBSessionConfig.getSessionPool();
|
||||
try {
|
||||
log.info("iotdb数据删除:paths:[{}], endTime:[{}]", paths, endTime);
|
||||
|
@ -235,7 +235,7 @@ public class IotDBServiceImpl implements IotDBService {
|
|||
* @return SessionDataSet (Time,paths)
|
||||
*/
|
||||
@Override
|
||||
public SessionDataSet executeRawDataQuery(List<String> paths, long startTime, long endTime, long outTime) {
|
||||
public SessionDataSet executeRawDataQuery(List<String> paths, Long startTime, Long endTime, Long outTime) {
|
||||
SessionPool sessionPool = iotDBSessionConfig.getSessionPool();
|
||||
SessionDataSetWrapper sessionDataSetWrapper = null;
|
||||
try {
|
||||
|
@ -262,7 +262,7 @@ public class IotDBServiceImpl implements IotDBService {
|
|||
* @return
|
||||
*/
|
||||
@Override
|
||||
public <T> List<T> executeRawDataQuery(List<String> paths, long startTime, long endTime, long outTime, Class<? extends IotDbRecordAble> clazz) {
|
||||
public <T> List<T> executeRawDataQuery(List<String> paths, Long startTime, Long endTime, Long outTime, Class<? extends IotDbRecordAble> clazz) {
|
||||
SessionDataSet sessionDataSet = executeRawDataQuery(paths, startTime, endTime, outTime);
|
||||
List<String> columnNames = sessionDataSet.getColumnNames();
|
||||
List<T> resultEntities = null;
|
||||
|
@ -282,7 +282,7 @@ public class IotDBServiceImpl implements IotDBService {
|
|||
* @return SessionDataSet
|
||||
*/
|
||||
@Override
|
||||
public SessionDataSet executeLastDataQuery(List<String> paths, long lastTime) {
|
||||
public SessionDataSet executeLastDataQuery(List<String> paths, Long lastTime) {
|
||||
SessionPool sessionPool = iotDBSessionConfig.getSessionPool();
|
||||
SessionDataSetWrapper sessionDataSetWrapper = null;
|
||||
try {
|
||||
|
@ -307,7 +307,7 @@ public class IotDBServiceImpl implements IotDBService {
|
|||
* @return
|
||||
*/
|
||||
@Override
|
||||
public <T> List<T> executeLastDataQuery(List<String> paths, long lastTime, Class<? extends IotDbRecordAble> clazz) {
|
||||
public <T> List<T> executeLastDataQuery(List<String> paths, Long lastTime, Class<? extends IotDbRecordAble> clazz) {
|
||||
SessionDataSet sessionDataSet = executeLastDataQuery(paths, lastTime);
|
||||
List<String> columnNames = sessionDataSet.getColumnNames();
|
||||
List<T> resultEntities = null;
|
||||
|
@ -399,7 +399,7 @@ public class IotDBServiceImpl implements IotDBService {
|
|||
* @return SessionDataSet
|
||||
*/
|
||||
@Override
|
||||
public SessionDataSet executeAggregationQuery(List<String> paths, List<TAggregationType> aggregations, long startTime, long endTime) {
|
||||
public SessionDataSet executeAggregationQuery(List<String> paths, List<TAggregationType> aggregations, Long startTime, Long endTime) {
|
||||
SessionPool sessionPool = iotDBSessionConfig.getSessionPool();
|
||||
SessionDataSetWrapper sessionDataSetWrapper = null;
|
||||
try {
|
||||
|
@ -425,7 +425,7 @@ public class IotDBServiceImpl implements IotDBService {
|
|||
* @return SessionDataSet
|
||||
*/
|
||||
@Override
|
||||
public SessionDataSet executeAggregationQuery(List<String> paths, List<TAggregationType> aggregations, long startTime, long endTime, long interval) {
|
||||
public SessionDataSet executeAggregationQuery(List<String> paths, List<TAggregationType> aggregations, Long startTime, Long endTime, Long interval) {
|
||||
SessionPool sessionPool = iotDBSessionConfig.getSessionPool();
|
||||
SessionDataSetWrapper sessionDataSetWrapper = null;
|
||||
try {
|
||||
|
@ -452,7 +452,7 @@ public class IotDBServiceImpl implements IotDBService {
|
|||
* @return SessionDataSet
|
||||
*/
|
||||
@Override
|
||||
public SessionDataSet executeAggregationQuery(List<String> paths, List<TAggregationType> aggregations, long startTime, long endTime, long interval, long slidingStep) {
|
||||
public SessionDataSet executeAggregationQuery(List<String> paths, List<TAggregationType> aggregations, Long startTime, Long endTime, Long interval, Long slidingStep) {
|
||||
SessionPool sessionPool = iotDBSessionConfig.getSessionPool();
|
||||
SessionDataSetWrapper sessionDataSetWrapper = null;
|
||||
|
||||
|
@ -648,7 +648,7 @@ public class IotDBServiceImpl implements IotDBService {
|
|||
return TSDataType.DOUBLE;
|
||||
} else if ("int".equals(typeName) || "integer".equals(typeName)) {
|
||||
return TSDataType.INT32;
|
||||
} else if ("long".equals(typeName)) {
|
||||
} else if ("Long".equals(typeName)) {
|
||||
return TSDataType.INT64;
|
||||
} else if ("float".equals(typeName)) {
|
||||
return TSDataType.FLOAT;
|
||||
|
|
|
@ -53,7 +53,7 @@ public class RedisService {
|
|||
*
|
||||
* @return true=设置成功;false=设置失败
|
||||
*/
|
||||
public boolean expire (final String key, final long timeout) {
|
||||
public boolean expire (final String key, final Long timeout) {
|
||||
return expire(key, timeout, TimeUnit.SECONDS);
|
||||
}
|
||||
|
||||
|
@ -66,7 +66,7 @@ public class RedisService {
|
|||
*
|
||||
* @return true=设置成功;false=设置失败
|
||||
*/
|
||||
public boolean expire (final String key, final long timeout, final TimeUnit unit) {
|
||||
public boolean expire (final String key, final Long timeout, final TimeUnit unit) {
|
||||
return redisTemplate.expire(key, timeout, unit);
|
||||
}
|
||||
|
||||
|
@ -77,7 +77,7 @@ public class RedisService {
|
|||
*
|
||||
* @return 有效时间
|
||||
*/
|
||||
public long getExpire (final String key) {
|
||||
public Long getExpire (final String key) {
|
||||
return redisTemplate.getExpire(key);
|
||||
}
|
||||
|
||||
|
@ -132,7 +132,7 @@ public class RedisService {
|
|||
*
|
||||
* @return 缓存的对象
|
||||
*/
|
||||
public <T> long setCacheList (final String key, final List<T> dataList) {
|
||||
public <T> Long setCacheList (final String key, final List<T> dataList) {
|
||||
Long count = redisTemplate.opsForList().rightPushAll(key, dataList);
|
||||
return count == null ? 0 : count;
|
||||
}
|
||||
|
|
|
@ -3,19 +3,15 @@ package com.muyu.cloud.common.many.datasource;
|
|||
import com.alibaba.druid.pool.DruidDataSource;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.baomidou.mybatisplus.autoconfigure.MybatisPlusAutoConfiguration;
|
||||
import com.muyu.cloud.common.many.datasource.constents.DatasourceContent;
|
||||
import com.muyu.cloud.common.saas.domain.model.EntInfo;
|
||||
import com.muyu.cloud.common.many.datasource.factory.DruidDataSourceFactory;
|
||||
import com.muyu.cloud.common.many.datasource.domain.model.DataSourceInfo;
|
||||
import com.muyu.cloud.common.many.datasource.factory.DruidDataSourceFactory;
|
||||
import com.muyu.cloud.common.many.datasource.role.DynamicDataSource;
|
||||
import com.muyu.cloud.common.saas.domain.model.EntInfo;
|
||||
import com.muyu.cloud.common.saas.exception.SaaSException;
|
||||
import com.muyu.common.core.constant.SecurityConstants;
|
||||
import com.muyu.common.core.constant.UserConstants;
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.core.utils.SpringUtils;
|
||||
import com.muyu.common.system.domain.SysDept;
|
||||
import com.muyu.common.system.domain.SysFirmDatasource;
|
||||
import com.muyu.common.system.domain.SysUser;
|
||||
import com.muyu.common.system.remote.RemoteUserService;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.boot.ApplicationArguments;
|
||||
|
@ -64,20 +60,9 @@ public class ManyDataSource implements ApplicationRunner {
|
|||
throw new RuntimeException("远调数据源错误,远调--》 firmList ");
|
||||
}
|
||||
}
|
||||
// private List<EntInfo> dataPrimarySourceInfoList(){
|
||||
// List<EntInfo> list = new ArrayList<>();
|
||||
// list.add(
|
||||
// EntInfo.builder()
|
||||
// .entCode()
|
||||
// .ip(DatasourceContent.IP)
|
||||
// .port(DatasourceContent.PORT)
|
||||
// .build()
|
||||
// );
|
||||
// return list;
|
||||
// }
|
||||
|
||||
@Bean
|
||||
public DynamicDataSource dynamicDataSource(DruidDataSourceFactory druidDataSourceFactory) {
|
||||
public DynamicDataSource dynamicDataSource() {
|
||||
// 企业列表 企业CODE,端口,IP
|
||||
Map<Object, Object> dataSourceMap = new HashMap<>();
|
||||
dataSourceInfoList()
|
||||
|
@ -104,15 +89,19 @@ public class ManyDataSource implements ApplicationRunner {
|
|||
|
||||
@Override
|
||||
public void run(ApplicationArguments args) throws Exception {
|
||||
DruidDataSourceFactory druidDataSourceFactory = SpringUtils.getBean(DruidDataSourceFactory.class);
|
||||
DynamicDataSource dynamicDataSource = SpringUtils.getBean(DynamicDataSource.class);
|
||||
for (EntInfo entInfo : dataSourceInfoList()) {
|
||||
DataSourceInfo dataSourceInfo = DataSourceInfo.hostAndPortBuild(
|
||||
entInfo.getEntCode(), entInfo.getIp(), entInfo.getPort(),entInfo.getUserName(), entInfo.getPassword()
|
||||
);
|
||||
DruidDataSource druidDataSource = druidDataSourceFactory.create(dataSourceInfo);
|
||||
dynamicDataSource.put(dataSourceInfo.getKey(), druidDataSource);
|
||||
log.info("存储数据连接池为:key:{}",dataSourceInfo.getKey());
|
||||
}
|
||||
dataSourceInfoList()
|
||||
.stream()
|
||||
.map(entInfo -> DataSourceInfo.hostAndPortBuild(
|
||||
entInfo.getEntCode(),
|
||||
entInfo.getIp(),
|
||||
entInfo.getPort(),
|
||||
entInfo.getUserName(),
|
||||
entInfo.getPassword()))
|
||||
.map(DruidDataSourceFactory::create)
|
||||
.filter(Objects::nonNull)
|
||||
.forEach(druidDataSource -> {
|
||||
dynamicDataSource.put(druidDataSource.getName(), druidDataSource);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,8 +43,8 @@ public class DataSourceInfo {
|
|||
return DataSourceInfo.builder()
|
||||
.key(key)
|
||||
.url(StringUtils.format(DatasourceContent.DATASOURCE_URL, host, port, key))
|
||||
.password(userName)
|
||||
.userName(password)
|
||||
.password(password)
|
||||
.userName(userName)
|
||||
.build();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ import com.muyu.cloud.common.saas.contents.SaaSConstant;
|
|||
import com.muyu.cloud.common.many.datasource.holder.DynamicDataSourceHolder;
|
||||
import com.muyu.cloud.common.saas.exception.SaaSException;
|
||||
import com.muyu.cloud.common.many.datasource.role.DynamicDataSource;
|
||||
import com.muyu.common.core.constant.SecurityConstants;
|
||||
import com.muyu.common.core.utils.ServletUtils;
|
||||
import com.muyu.common.core.utils.SpringUtils;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
|
@ -33,11 +34,11 @@ public class SaaSInterceptor implements AsyncHandlerInterceptor {
|
|||
if (!(handler instanceof HandlerMethod)) {
|
||||
return true;
|
||||
}
|
||||
String SaaSKey = ServletUtils.getHeader(request, SaaSConstant.SAAS_KEY);
|
||||
String SaaSKey = ServletUtils.getHeader(request, SecurityConstants.FIRM_KEY);
|
||||
if (SaaSKey == null) {
|
||||
throw new SaaSException("SaaS非法访问");
|
||||
}
|
||||
if (SaaSKey.equals("-")){
|
||||
if (SaaSKey.equals("1")){
|
||||
log.info("使用 [ nacos ] 配置数据库 ");
|
||||
flag = true;
|
||||
return true;
|
||||
|
|
|
@ -27,11 +27,11 @@ import java.util.concurrent.TimeUnit;
|
|||
*/
|
||||
@Component
|
||||
public class TokenService {
|
||||
protected static final long MILLIS_SECOND = 1000;
|
||||
protected static final long MILLIS_MINUTE = 60 * MILLIS_SECOND;
|
||||
protected static final Long MILLIS_SECOND = 1000L;
|
||||
protected static final Long MILLIS_MINUTE = 60 * MILLIS_SECOND;
|
||||
private final static Long MILLIS_MINUTE_TEN = CacheConstants.REFRESH_TIME * MILLIS_MINUTE;
|
||||
private static final Logger log = LoggerFactory.getLogger(TokenService.class);
|
||||
private final static long expireTime = CacheConstants.EXPIRATION;
|
||||
private final static Long expireTime = CacheConstants.EXPIRATION;
|
||||
|
||||
private final static String ACCESS_TOKEN = CacheConstants.LOGIN_TOKEN_KEY;
|
||||
@Autowired
|
||||
|
@ -43,6 +43,7 @@ public class TokenService {
|
|||
public Map<String, Object> createToken (LoginUser loginUser) {
|
||||
String token = IdUtils.fastUUID();
|
||||
Long userId = loginUser.getSysUser().getUserId();
|
||||
Long firmId = loginUser.getSysUser().getFirmId();
|
||||
String userName = loginUser.getSysUser().getUserName();
|
||||
loginUser.setToken(token);
|
||||
loginUser.setUserid(userId);
|
||||
|
@ -55,7 +56,8 @@ public class TokenService {
|
|||
claimsMap.put(SecurityConstants.USER_KEY, token);
|
||||
claimsMap.put(SecurityConstants.DETAILS_USER_ID, userId);
|
||||
claimsMap.put(SecurityConstants.DETAILS_USERNAME, userName);
|
||||
|
||||
claimsMap.put(SecurityConstants.FIRM_KEY, loginUser.getSysUser().getDatabaseName());
|
||||
claimsMap.put(SecurityConstants.FIRM_ID, loginUser.getSysUser().getFirmId());
|
||||
// 接口返回信息
|
||||
Map<String, Object> rspMap = new HashMap<String, Object>();
|
||||
rspMap.put("access_token", JwtUtils.createToken(claimsMap));
|
||||
|
@ -127,8 +129,8 @@ public class TokenService {
|
|||
* @param loginUser
|
||||
*/
|
||||
public void verifyToken (LoginUser loginUser) {
|
||||
long expireTime = loginUser.getExpireTime();
|
||||
long currentTime = System.currentTimeMillis();
|
||||
Long expireTime = loginUser.getExpireTime();
|
||||
Long currentTime = System.currentTimeMillis();
|
||||
if (expireTime - currentTime <= MILLIS_MINUTE_TEN) {
|
||||
refreshToken(loginUser);
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ import java.util.Set;
|
|||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class LoginUser implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final Long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 用户唯一标识
|
||||
|
|
|
@ -22,7 +22,7 @@ import java.util.List;
|
|||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class SysDept extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final Long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 部门ID
|
||||
|
|
|
@ -21,7 +21,7 @@ import jakarta.validation.constraints.Size;
|
|||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class SysDictData extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final Long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 字典编码
|
||||
|
|
|
@ -21,7 +21,7 @@ import jakarta.validation.constraints.Size;
|
|||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class SysDictType extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final Long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 字典主键
|
||||
|
|
|
@ -0,0 +1,60 @@
|
|||
package com.muyu.common.system.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
/**
|
||||
* 公司信息
|
||||
*
|
||||
* @Author WangXin
|
||||
* @Data 2024/10/9
|
||||
* @Version 1.0.0
|
||||
*/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Tag(name = "公司信息")
|
||||
@TableName("sys_firm")
|
||||
public class SysFirm {
|
||||
|
||||
/**
|
||||
* 公司Id
|
||||
*/
|
||||
@TableId(type = IdType.AUTO)
|
||||
@Schema(name = "公司Id")
|
||||
private Long id;
|
||||
/**
|
||||
* 公司名称
|
||||
*/
|
||||
@Schema(name = "公司名称")
|
||||
private String name;
|
||||
/**
|
||||
* 公司数据源
|
||||
*/
|
||||
@Schema(name = "公司数据源")
|
||||
private Long did;
|
||||
/**
|
||||
* 公司logo
|
||||
*/
|
||||
@Schema(name = "公司logo")
|
||||
private String logo;
|
||||
/**
|
||||
* 唯一标识
|
||||
*/
|
||||
@Schema(name = "唯一标识")
|
||||
private String sole;
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
@Schema(name = "车辆状态")
|
||||
private String status;
|
||||
|
||||
}
|
|
@ -1,25 +0,0 @@
|
|||
package com.muyu.common.system.domain;
|
||||
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 公司下拉响应对象
|
||||
* @Author WangXin
|
||||
* @Data 2024/10/8
|
||||
* @Version 1.0.0
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Tag(name = "公司下拉响应对象",description = "登录公司下拉框数据")
|
||||
public class SysFirmResp {
|
||||
|
||||
private String name;
|
||||
|
||||
private String firmId;
|
||||
}
|
|
@ -23,7 +23,7 @@ import java.util.Date;
|
|||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class SysLogininfor extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final Long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* ID
|
||||
|
|
|
@ -23,7 +23,7 @@ import java.util.Date;
|
|||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class SysOperLog extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final Long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 日志主键
|
||||
|
|
|
@ -22,7 +22,7 @@ import java.util.Set;
|
|||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class SysRole extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final Long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 角色ID
|
||||
|
|
|
@ -29,7 +29,7 @@ import java.util.List;
|
|||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class SysUser extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final Long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 用户ID
|
||||
|
@ -134,6 +134,15 @@ public class SysUser extends BaseEntity {
|
|||
* 角色ID
|
||||
*/
|
||||
private Long roleId;
|
||||
/**
|
||||
* 公司Id
|
||||
*/
|
||||
private Long firmId;
|
||||
|
||||
/**
|
||||
* 公司数据库
|
||||
*/
|
||||
private String databaseName;
|
||||
|
||||
public SysUser (Long userId) {
|
||||
this.userId = userId;
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
package com.muyu.common.system.domain.resp;
|
||||
|
||||
import com.muyu.common.system.domain.SysFirm;
|
||||
import com.muyu.common.system.domain.SysFirmDatasource;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
/**
|
||||
* 公司信息响应对象
|
||||
*
|
||||
* @Author WangXin
|
||||
* @Data 2024/10/9
|
||||
* @Version 1.0.0
|
||||
*/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Tag(name = "公司信息响应对象")
|
||||
public class SysFirmResp {
|
||||
/**
|
||||
* 公司信息
|
||||
*/
|
||||
@Schema(name = "公司信息")
|
||||
private SysFirm firm;
|
||||
/**
|
||||
* 公司数据源信息
|
||||
*/
|
||||
@Schema(name = "公司数据源信息")
|
||||
private SysFirmDatasource firmDatasource;
|
||||
|
||||
}
|
|
@ -23,12 +23,12 @@ public interface RemoteUserService {
|
|||
* 通过用户名查询用户信息
|
||||
*
|
||||
* @param username 用户名
|
||||
* @param firmId
|
||||
* @param source 请求来源
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
@GetMapping("/user/info/{username}")
|
||||
public Result<LoginUser> getUserInfo (@PathVariable("username") String username, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||
@GetMapping("/user/info/{username}/{firmId}")
|
||||
public Result<LoginUser> getUserInfo (@PathVariable("username") String username,@PathVariable("firmId") Long firmId, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||
|
||||
/**
|
||||
* 注册用户信息
|
||||
|
@ -48,4 +48,5 @@ public interface RemoteUserService {
|
|||
*/
|
||||
@GetMapping("/firmDatasource/firmDatasourceList")
|
||||
Result<List<SysFirmDatasource>> selectFirmDatabaseList(@RequestHeader(SecurityConstants.FROM_SOURCE) String inner);
|
||||
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ public class RemoteUserFallbackFactory implements FallbackFactory<RemoteUserServ
|
|||
log.error("用户服务调用失败:{}", throwable.getMessage());
|
||||
return new RemoteUserService() {
|
||||
@Override
|
||||
public Result<LoginUser> getUserInfo (String username, String source) {
|
||||
public Result<LoginUser> getUserInfo (String username, Long firmId, String source) {
|
||||
return Result.error("获取用户失败:" + throwable.getMessage());
|
||||
}
|
||||
|
||||
|
|
|
@ -192,7 +192,7 @@ public class AccessLogFilter implements GlobalFilter, Ordered {
|
|||
|
||||
@Override
|
||||
public HttpHeaders getHeaders() {
|
||||
long contentLength = headers.getContentLength();
|
||||
Long contentLength = headers.getContentLength();
|
||||
HttpHeaders httpHeaders = new HttpHeaders();
|
||||
httpHeaders.putAll(super.getHeaders());
|
||||
if (contentLength > 0) {
|
||||
|
|
|
@ -10,6 +10,7 @@ import com.muyu.common.core.utils.StringUtils;
|
|||
import com.muyu.common.redis.service.RedisService;
|
||||
import com.muyu.gateway.config.properties.IgnoreWhiteProperties;
|
||||
import io.jsonwebtoken.Claims;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@ -37,7 +38,6 @@ public class AuthFilter implements GlobalFilter, Ordered {
|
|||
@Autowired
|
||||
private RedisService redisService;
|
||||
|
||||
|
||||
@Override
|
||||
public Mono<Void> filter (ServerWebExchange exchange, GatewayFilterChain chain) {
|
||||
ServerHttpRequest request = exchange.getRequest();
|
||||
|
@ -63,6 +63,8 @@ public class AuthFilter implements GlobalFilter, Ordered {
|
|||
}
|
||||
String userid = JwtUtils.getUserId(claims);
|
||||
String username = JwtUtils.getUserName(claims);
|
||||
String firmKey = JwtUtils.getFirmKey(claims);
|
||||
String firmId = JwtUtils.getFirmId(claims);
|
||||
if (StringUtils.isEmpty(userid) || StringUtils.isEmpty(username)) {
|
||||
return unauthorizedResponse(exchange, "令牌验证失败");
|
||||
}
|
||||
|
@ -71,6 +73,8 @@ public class AuthFilter implements GlobalFilter, Ordered {
|
|||
addHeader(mutate, SecurityConstants.USER_KEY, userkey);
|
||||
addHeader(mutate, SecurityConstants.DETAILS_USER_ID, userid);
|
||||
addHeader(mutate, SecurityConstants.DETAILS_USERNAME, username);
|
||||
addHeader(mutate, SecurityConstants.FIRM_KEY, firmKey);
|
||||
addHeader(mutate, SecurityConstants.FIRM_ID, firmId);
|
||||
// 内部请求来源参数清除
|
||||
removeHeader(mutate, SecurityConstants.FROM_SOURCE);
|
||||
return chain.filter(exchange.mutate().request(mutate.build()).build());
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Tomcat
|
||||
server:
|
||||
port: 8080
|
||||
port: 18080
|
||||
|
||||
# nacos线上地址
|
||||
nacos:
|
||||
|
|
|
@ -27,6 +27,7 @@ public class IotdbStrategy
|
|||
|
||||
private static ConcurrentHashMap<EventEnum,EventStrategyRouter<Information,Information>> map = new ConcurrentHashMap<>();
|
||||
|
||||
private static ExecutorService executor = Executors.newFixedThreadPool(3);
|
||||
@Override
|
||||
public Information apply(Information param) {
|
||||
return applyStrategy(param);
|
||||
|
@ -39,23 +40,12 @@ public class IotdbStrategy
|
|||
if (isEventMapSize()){
|
||||
log.info("[没有事件执行]");
|
||||
}else {
|
||||
ExecutorService executor = Executors.newFixedThreadPool(map.size());
|
||||
for (EventEnum eventEnum : map.keySet()) {
|
||||
executor.submit(() -> {
|
||||
log.info("开始执行 [{}] ",eventEnum.getEventName());
|
||||
return map.get(eventEnum);
|
||||
});
|
||||
}
|
||||
// 关闭线程池
|
||||
executor.shutdown();
|
||||
try {
|
||||
// 等待所有任务完成
|
||||
if (!executor.awaitTermination(60, TimeUnit.SECONDS)) {
|
||||
executor.shutdownNow();
|
||||
}
|
||||
} catch (InterruptedException e) {
|
||||
executor.shutdownNow();
|
||||
}
|
||||
}
|
||||
return new EndStrategy();
|
||||
};
|
||||
|
|
|
@ -8,7 +8,7 @@ import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
|||
|
||||
@EnableCustomConfig
|
||||
@EnableMyFeignClients
|
||||
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})
|
||||
@SpringBootApplication
|
||||
public class DataProcessApplication {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(DataProcessApplication.class, args);
|
||||
|
|
|
@ -77,7 +77,7 @@ public class TestController {
|
|||
}
|
||||
|
||||
@GetMapping("/insertData")
|
||||
public void insertData(@RequestParam("deviceId") String deviceId, @RequestParam("time") long time, @RequestParam("value") double value) throws Exception {
|
||||
public void insertData(@RequestParam("deviceId") String deviceId, @RequestParam("time") Long time, @RequestParam("value") double value) throws Exception {
|
||||
String sql = String.format("insert into root.one.%s(timestamp, temperature) values (%d, %f)", deviceId, time, value);
|
||||
iotDBConfig.getSessionPool().executeNonQueryStatement(sql);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Tomcat
|
||||
server:
|
||||
port: 9701
|
||||
port: 29701
|
||||
|
||||
# nacos线上地址
|
||||
nacos:
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>enterpise-common</artifactId>
|
||||
<version>${muyu.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 缓存公共模块 -->
|
||||
|
|
|
@ -22,7 +22,7 @@ public class MessageValueCacheService extends CacheAbsBasic<String, List<Message
|
|||
*/
|
||||
@Override
|
||||
public String keyPre() {
|
||||
return"messageValue:info:";
|
||||
return "messageValue:info:";
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ public class SysCarCacheService extends CacheAbsBasic<String, SysCar> {
|
|||
|
||||
@Override
|
||||
public String keyPre() {
|
||||
return "sysCar:info:";
|
||||
return ":sysCar";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -18,7 +18,7 @@ public class WarnStrategyCacjeService extends CacheAbsBasic<String, WarnStrateg
|
|||
|
||||
@Override
|
||||
public String keyPre() {
|
||||
return "sysCarType:info:";
|
||||
return ":sysCarType";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -37,12 +37,12 @@ public class CarFaultRule {
|
|||
* 时间戳时间戳时间戳
|
||||
*/
|
||||
@Schema(name = "车辆类型Id")
|
||||
private long timestamp;
|
||||
private Long timestamp;
|
||||
/**
|
||||
* 经度经度经度
|
||||
*/
|
||||
@Schema(name = "车速")
|
||||
private double longitude;
|
||||
private double Longitude;
|
||||
/**
|
||||
* 纬度纬度纬度
|
||||
*/
|
||||
|
@ -57,7 +57,7 @@ public class CarFaultRule {
|
|||
* 总里程总里程总里程
|
||||
*/
|
||||
@Schema(name = "加速踏板行程值")
|
||||
private long TM;
|
||||
private Long TM;
|
||||
/**
|
||||
* 总电压总电压总电压
|
||||
*/
|
||||
|
|
|
@ -30,7 +30,7 @@ public class CarType {
|
|||
*/
|
||||
@TableId(value = "car_type_id",type = IdType.AUTO)
|
||||
@Schema(name = "车辆类型ID")
|
||||
private long carTypeId;
|
||||
private Long carTypeId;
|
||||
/**
|
||||
* 车辆类型名
|
||||
*/
|
||||
|
@ -40,5 +40,5 @@ public class CarType {
|
|||
* 车辆规则外键ID
|
||||
*/
|
||||
@Schema(name = "车辆规则外键ID")
|
||||
private long carTypeRules;
|
||||
private Long carTypeRules;
|
||||
}
|
||||
|
|
|
@ -35,12 +35,12 @@ public class FaultCode {
|
|||
*/
|
||||
@TableId(value = "faultcode_id", type = IdType.AUTO)
|
||||
@Schema(name = "故障码Id")
|
||||
private long faultcodeId;
|
||||
private Long faultcodeId;
|
||||
/**
|
||||
* 故障名称Id
|
||||
*/
|
||||
@Schema(name = "故障名称Id")
|
||||
private long messageTypeId;
|
||||
private Long messageTypeId;
|
||||
/**
|
||||
* 故障码
|
||||
*/
|
||||
|
@ -86,11 +86,11 @@ public class FaultCode {
|
|||
* 故障类型所属
|
||||
*/
|
||||
@Schema(name = "故障类型所属")
|
||||
private String messageTypeBelongs;
|
||||
private String messageTypeBeLongs;
|
||||
|
||||
public static FaultCode addfaultcode(FaultCodeAddReq faultCodeAddReq) {
|
||||
return FaultCode.builder()
|
||||
.faultcodeId(0)
|
||||
.faultcodeId(0L)
|
||||
.messageTypeId(faultCodeAddReq.getMessageTypeId())
|
||||
.faultcodeNumber(faultCodeAddReq.getFaultcodeNumber())
|
||||
.faultGroup(faultCodeAddReq.getFaultGroup())
|
||||
|
|
|
@ -35,17 +35,17 @@ public class FaultCondition {
|
|||
*/
|
||||
@TableId(value = "carcondition_id",type = IdType.AUTO)
|
||||
@Schema(name = "故障规则表Id")
|
||||
private long carconditionId;
|
||||
private Long carconditionId;
|
||||
/**
|
||||
* 车辆类型Id
|
||||
*/
|
||||
@Schema(name = "车辆类型Id")
|
||||
private long carTypeId;
|
||||
private Long carTypeId;
|
||||
/**
|
||||
*故障名称Id
|
||||
*/
|
||||
@Schema(name = "故障名称Id")
|
||||
private long messageTypeId;
|
||||
private Long messageTypeId;
|
||||
/**
|
||||
* 故障条件
|
||||
*/
|
||||
|
|
|
@ -46,6 +46,6 @@ public class FaultLabel {
|
|||
*报文所属类别
|
||||
*/
|
||||
@Schema(name = "报文所属类别")
|
||||
private String messageTypeBelongs;
|
||||
private String messageTypeBeLongs;
|
||||
|
||||
}
|
||||
|
|
|
@ -34,17 +34,17 @@ public class FaultLog {
|
|||
*/
|
||||
@TableId(value = "log_id",type = IdType.AUTO)
|
||||
@Schema(name = "故障日志Id")
|
||||
private long logId;
|
||||
private Long logId;
|
||||
/**
|
||||
* 故障码Id
|
||||
*/
|
||||
@Schema(name = "故障码Id")
|
||||
private long faultcodeId;
|
||||
private Long faultcodeId;
|
||||
/**
|
||||
* 车辆Id
|
||||
*/
|
||||
@Schema(name = "车辆Id")
|
||||
private long carInformationId;
|
||||
private Long carInformationId;
|
||||
/**
|
||||
* 车辆VIN
|
||||
*/
|
||||
|
|
|
@ -32,13 +32,13 @@ public class FaultRule {
|
|||
*/
|
||||
@TableId(value = "condition_id",type = IdType.AUTO)
|
||||
@Schema(name = "触发条件Id")
|
||||
private long conditionId;
|
||||
private Long conditionId;
|
||||
|
||||
/**
|
||||
* 故障码Id
|
||||
*/
|
||||
@Schema(name = "故障码Id")
|
||||
private long faultcodeId;
|
||||
private Long faultcodeId;
|
||||
|
||||
/**
|
||||
* 触发条件描述
|
||||
|
|
|
@ -30,7 +30,7 @@ public class FaultType {
|
|||
*/
|
||||
@TableId(value = "faulttype_id",type = IdType.AUTO)
|
||||
@Schema(name = "故障类型Id")
|
||||
private long faulttypeId;
|
||||
private Long faulttypeId;
|
||||
/**
|
||||
*故障类型名称
|
||||
*/
|
||||
|
|
|
@ -27,7 +27,7 @@ import org.apache.commons.lang3.builder.ToStringStyle;
|
|||
@TableName(value = "sys_car_fault", autoResultMap = true)
|
||||
@Tag(name = "车辆故障对象")
|
||||
public class SysCarFault extends BaseEntity{
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final Long serialVersionUID = 1L;
|
||||
|
||||
/** 自增主键 */
|
||||
@TableId( type = IdType.AUTO,value = "id")
|
||||
|
|
|
@ -32,7 +32,7 @@ import java.util.Date;
|
|||
@TableName("warn_logs")
|
||||
@Tag(name = "预警日志管理")
|
||||
public class WarnLogs extends BaseEntity{
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final Long serialVersionUID = 1L;
|
||||
|
||||
/** 预警日志id */
|
||||
@TableId( type = IdType.AUTO)
|
||||
|
|
|
@ -28,7 +28,7 @@ import org.apache.commons.lang3.builder.ToStringStyle;
|
|||
@TableName("warn_rule")
|
||||
@Tag(name = "预警规则管理")
|
||||
public class WarnRule extends BaseEntity{
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final Long serialVersionUID = 1L;
|
||||
|
||||
/** 规则id */
|
||||
@TableId( type = IdType.AUTO)
|
||||
|
|
|
@ -29,7 +29,7 @@ import org.apache.commons.lang3.builder.ToStringStyle;
|
|||
@TableName("warn_strategy")
|
||||
@Tag(name = "预警策略管理")
|
||||
public class WarnStrategy extends BaseEntity{
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final Long serialVersionUID = 1L;
|
||||
|
||||
/** 策略id */
|
||||
@TableId( type = IdType.AUTO)
|
||||
|
|
|
@ -36,7 +36,7 @@ public class Message {
|
|||
* id
|
||||
*/
|
||||
@TableId(value = "id",type = IdType.AUTO)
|
||||
private long id;
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 发送者
|
||||
|
@ -72,7 +72,7 @@ public class Message {
|
|||
* 登录人Id
|
||||
*/
|
||||
@Schema(description = "登录人Id",defaultValue = "1",type = "Long")
|
||||
private long userId;
|
||||
private Long userId;
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -39,5 +39,5 @@ public class MessageReq {
|
|||
* 登录人Id
|
||||
*/
|
||||
@Schema(name = "登录人Id")
|
||||
private long userId;
|
||||
private Long userId;
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ public class MessageSendReq {
|
|||
* 登录人Id
|
||||
*/
|
||||
@Schema(name = "登录人Id")
|
||||
private long userId;
|
||||
private Long userId;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
|
|
|
@ -35,5 +35,5 @@ public class MessageReq {
|
|||
* 登录人Id
|
||||
*/
|
||||
@Schema(name = "登录人Id")
|
||||
private long userId;
|
||||
private Long userId;
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@ public class MessageSendReq {
|
|||
* 登录人Id
|
||||
*/
|
||||
@Schema(name = "登录人Id")
|
||||
private long userId;
|
||||
private Long userId;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
|
|
|
@ -33,7 +33,7 @@ public class FaultCodeAddReq {
|
|||
*/
|
||||
@Schema(description = "故障名称Id")
|
||||
@TableId(value = "message_type_id", type = IdType.AUTO)
|
||||
private long messageTypeId;
|
||||
private Long messageTypeId;
|
||||
/**
|
||||
* 故障名称
|
||||
*/
|
||||
|
@ -54,7 +54,7 @@ public class FaultCodeAddReq {
|
|||
* 故障分类Id
|
||||
*/
|
||||
@Schema(description = "故障分类Id")
|
||||
private long faulttypeId;
|
||||
private Long faulttypeId;
|
||||
/**
|
||||
* 是否产生报警
|
||||
*/
|
||||
|
@ -84,7 +84,7 @@ public class FaultCodeAddReq {
|
|||
*报文所属类别
|
||||
*/
|
||||
@Schema(name = "报文所属类别")
|
||||
private String messageTypeBelongs;
|
||||
private String messageTypeBeLongs;
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -34,12 +34,12 @@ public class FaultCodeUpdReq {
|
|||
*/
|
||||
@TableId(value = "faultcode_id", type = IdType.AUTO)
|
||||
@Schema(title = "故障码Id")
|
||||
private long faultcodeId;
|
||||
private Long faultcodeId;
|
||||
/**
|
||||
*故障名称Id
|
||||
*/
|
||||
@Schema(name = "故障名称Id")
|
||||
private long messageTypeId;
|
||||
private Long messageTypeId;
|
||||
/**
|
||||
* 故障名称
|
||||
*/
|
||||
|
@ -59,7 +59,7 @@ public class FaultCodeUpdReq {
|
|||
* 故障分类Id
|
||||
*/
|
||||
@Schema(name = "故障分类Id")
|
||||
private long faulttypeId;
|
||||
private Long faulttypeId;
|
||||
/**
|
||||
* 是否产生报警
|
||||
*/
|
||||
|
@ -94,7 +94,7 @@ public class FaultCodeUpdReq {
|
|||
*报文所属类别
|
||||
*/
|
||||
@Schema(name = "报文所属类别")
|
||||
private String messageTypeBelongs;
|
||||
private String messageTypeBeLongs;
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -35,17 +35,17 @@ public class FaultConditionAddReq {
|
|||
*/
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
@Schema(title = "故障规则表Id")
|
||||
private long carconditionId;
|
||||
private Long carconditionId;
|
||||
/**
|
||||
* 车辆类型Id
|
||||
*/
|
||||
@Schema(name = "车辆类型Id")
|
||||
private long carTypeId;
|
||||
private Long carTypeId;
|
||||
/**
|
||||
*故障名称Id
|
||||
*/
|
||||
@Schema(name = "故障名称Id")
|
||||
private long messageTypeId;
|
||||
private Long messageTypeId;
|
||||
/**
|
||||
* 故障条件
|
||||
*/
|
||||
|
|
|
@ -35,12 +35,12 @@ public class FaultConditionListReq {
|
|||
*/
|
||||
@TableId(value = "car_type_id", type = IdType.INPUT)
|
||||
@Schema (description = "车辆类型Id")
|
||||
private long carTypeId;
|
||||
private Long carTypeId;
|
||||
/**
|
||||
*故障名称Id
|
||||
*/
|
||||
@Schema(name = "故障名称Id")
|
||||
private long messageTypeId;
|
||||
private Long messageTypeId;
|
||||
/**
|
||||
* 页码,从1开始
|
||||
*/
|
||||
|
|
|
@ -35,17 +35,17 @@ public class FaultConditionUpdReq {
|
|||
*/
|
||||
@TableId(value = "carcondition_id", type = IdType.ASSIGN_ID)
|
||||
@Schema(name = "故障规则表Id")
|
||||
private long carconditionId;
|
||||
private Long carconditionId;
|
||||
/**
|
||||
* 车辆类型Id
|
||||
*/
|
||||
@Schema(name = "车辆类型Id")
|
||||
private long carTypeId;
|
||||
private Long carTypeId;
|
||||
/**
|
||||
*故障名称Id
|
||||
*/
|
||||
@Schema(name = "故障名称Id")
|
||||
private long messageTypeId;
|
||||
private Long messageTypeId;
|
||||
/**
|
||||
* 故障条件
|
||||
*/
|
||||
|
|
|
@ -37,7 +37,7 @@ public class FaultLogListReq {
|
|||
*/
|
||||
@TableId(value = "type", type = IdType.AUTO)
|
||||
@Schema(description = "故障码Id",example = "1")
|
||||
private long faultcodeId;
|
||||
private Long faultcodeId;
|
||||
/**
|
||||
* 车辆VIN
|
||||
*/
|
||||
|
|
|
@ -33,12 +33,12 @@ public class FaultCodeListResp {
|
|||
*/
|
||||
@TableId(value = "faultcode_id", type = IdType.AUTO)
|
||||
@Schema(description = "故障码Id",example = "1")
|
||||
private long faultcodeId;
|
||||
private Long faultcodeId;
|
||||
/**
|
||||
*故障名称Id
|
||||
*/
|
||||
@Schema(description = "故障名称Id",example = "1")
|
||||
private long messageTypeId;
|
||||
private Long messageTypeId;
|
||||
/**
|
||||
*故障码
|
||||
*/
|
||||
|
@ -83,7 +83,7 @@ public class FaultCodeListResp {
|
|||
*报文所属类别
|
||||
*/
|
||||
@Schema(description = "报文所属类别",example = "1")
|
||||
private String messageTypeBelongs;
|
||||
private String messageTypeBeLongs;
|
||||
|
||||
/**
|
||||
* 数据库对象构建为返回结果对象
|
||||
|
@ -102,7 +102,7 @@ public class FaultCodeListResp {
|
|||
.faulttypeName(faultCodeVO.getFaulttypeName())
|
||||
.messageTypeName(faultCodeVO.getMessageTypeName())
|
||||
.messageTypeCode(faultCodeVO.getMessageTypeCode())
|
||||
.messageTypeBelongs(faultCodeVO.getMessageTypeBelongs())
|
||||
.messageTypeBeLongs(faultCodeVO.getMessageTypeBeLongs())
|
||||
.build();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,9 +35,9 @@ public class FaultCodeTotalListResp {
|
|||
* 总数
|
||||
*/
|
||||
@Schema(name = "总数")
|
||||
private long total;
|
||||
private Long total;
|
||||
|
||||
public static FaultCodeTotalListResp faultCodeTotalListResp(List<FaultCodeListResp> faultCodeListRespList,long total){
|
||||
public static FaultCodeTotalListResp faultCodeTotalListResp(List<FaultCodeListResp> faultCodeListRespList,Long total){
|
||||
FaultCodeTotalListResp faultCodeTotalListResp = new FaultCodeTotalListResp();
|
||||
faultCodeTotalListResp.setFaultCodeListRespList(faultCodeListRespList);
|
||||
faultCodeTotalListResp.setTotal(total);
|
||||
|
|
|
@ -37,17 +37,17 @@ public class FaultConditionListResp {
|
|||
*/
|
||||
@TableId(value = "carcondition_id",type = IdType.AUTO)
|
||||
@Schema(description = "故障规则表Id")
|
||||
private long carconditionId;
|
||||
private Long carconditionId;
|
||||
/**
|
||||
* 车辆类型Id
|
||||
*/
|
||||
@Schema(description = "车辆类型Id")
|
||||
private long carTypeId;
|
||||
private Long carTypeId;
|
||||
/**
|
||||
*故障名称Id
|
||||
*/
|
||||
@Schema(description = "故障名称Id")
|
||||
private long messageTypeId;
|
||||
private Long messageTypeId;
|
||||
/**
|
||||
* 故障条件
|
||||
*/
|
||||
|
|
|
@ -33,9 +33,9 @@ public class FaultConditionTotalListResp {
|
|||
private List<FaultConditionListResp> faultConditionListRespList;
|
||||
|
||||
@Schema(description = "故障规则数据总数")
|
||||
private long total;
|
||||
private Long total;
|
||||
|
||||
public static FaultConditionTotalListResp faultConditionTotalListResp(List<FaultConditionListResp> faultConditionListRespList,long total){
|
||||
public static FaultConditionTotalListResp faultConditionTotalListResp(List<FaultConditionListResp> faultConditionListRespList,Long total){
|
||||
FaultConditionTotalListResp faultConditionTotalListResp = new FaultConditionTotalListResp();
|
||||
faultConditionTotalListResp.setFaultConditionListRespList(faultConditionListRespList);
|
||||
faultConditionTotalListResp.setTotal(total);
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue