fix():修改saas结构

dev.data.process
王鑫 2024-10-09 16:33:33 +08:00
parent 1468206f1d
commit 5c4e0cde3e
166 changed files with 875 additions and 532 deletions

View File

@ -34,7 +34,7 @@ public class TokenController {
@PostMapping("login") @PostMapping("login")
public Result<?> login (@RequestBody LoginBody form) { 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 // 获取登录token
return Result.success(tokenService.createToken(userInfo)); return Result.success(tokenService.createToken(userInfo));
} }

View File

@ -1,10 +1,20 @@
package com.muyu.auth.form; package com.muyu.auth.form;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
/** /**
* *
* *
* @author muyu * @author muyu
*/ */
@Data
@SuperBuilder
@AllArgsConstructor
@NoArgsConstructor
public class LoginBody { public class LoginBody {
/** /**
* *
@ -15,24 +25,10 @@ public class LoginBody {
* *
*/ */
private String password; private String password;
/** /**
* id * id
*/ */
private Long firmId; 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;
}
} }

View File

@ -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, "用户/密码必须填写"); recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "用户/密码必须填写");
throw new ServiceException("用户/密码必须填写"); throw new ServiceException("用户/密码必须填写");
} }
@ -65,7 +65,9 @@ public class SysLoginService {
throw new ServiceException("很遗憾访问IP已被列入系统黑名单"); 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())) { if (StringUtils.isNull(userResult) || StringUtils.isNull(userResult.getData())) {
recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "登录用户不存在"); recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "登录用户不存在");

View File

@ -1,6 +1,6 @@
# Tomcat # Tomcat
server: server:
port: 9500 port: 19500
# nacos线上地址 # nacos线上地址
nacos: nacos:

View File

@ -13,25 +13,28 @@ public interface PrimaryKeyBasic <K>{
/** /**
* *
*
* @return * @return
*/ */
public String keyPre(); public String keyPre();
/** /**
* *
*
* @param key * @param key
* @return * @return
*/ */
public default String encode(K key) { public default String encode(K key) {
return keyPre() + key.toString(); return key.toString() + keyPre();
} }
/** /**
* *
*
* @param key * @param key
* @return * @return
*/ */
public default K decode(String key) { public default K decode(String key) {
return (K) key.substring(keyPre().length()); return (K) key.substring(0, key.lastIndexOf(keyPre()));
} }
} }

View File

@ -9,12 +9,12 @@ public class CacheConstants {
/** /**
* 720 * 720
*/ */
public final static long EXPIRATION = 720; public final static Long EXPIRATION = 720L;
/** /**
* 120 * 120
*/ */
public final static long REFRESH_TIME = 120; public final static Long REFRESH_TIME = 120L;
/** /**
* *
@ -24,7 +24,7 @@ public class CacheConstants {
/** /**
* 10 * 10
*/ */
public final static long PASSWORD_LOCK_TIME = 10; public final static Long PASSWORD_LOCK_TIME = 10L;
/** /**
* *

View File

@ -109,7 +109,7 @@ public class Constants {
/** /**
* *
*/ */
public static final long CAPTCHA_EXPIRATION = 2; public static final Long CAPTCHA_EXPIRATION = 2L;
/** /**
* *

View File

@ -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"};
/** /**
* *

View File

@ -45,4 +45,13 @@ public class SecurityConstants {
* *
*/ */
public static final String ROLE_PERMISSION = "role_permission"; 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";
} }

View File

@ -24,6 +24,6 @@ public class ServiceNameConstants {
/** /**
* serviceid * serviceid
*/ */
public static final String ENTERPRISE_SERVICE = "cloud-saas"; public static final String ENTERPRISE_SERVICE = "cloud-enterprise";
} }

View File

@ -32,7 +32,7 @@ public class Result<T> implements Serializable {
*/ */
public static final int WARN = HttpStatus.WARN; public static final int WARN = HttpStatus.WARN;
private static final long serialVersionUID = 1L; private static final Long serialVersionUID = 1L;
private int code; private int code;

View File

@ -6,7 +6,7 @@ package com.muyu.common.core.exception;
* @author muyu * @author muyu
*/ */
public class CaptchaException extends RuntimeException { public class CaptchaException extends RuntimeException {
private static final long serialVersionUID = 1L; private static final Long serialVersionUID = 1L;
public CaptchaException (String msg) { public CaptchaException (String msg) {
super(msg); super(msg);

View File

@ -6,7 +6,7 @@ package com.muyu.common.core.exception;
* @author muyu * @author muyu
*/ */
public class CheckedException extends RuntimeException { public class CheckedException extends RuntimeException {
private static final long serialVersionUID = 1L; private static final Long serialVersionUID = 1L;
public CheckedException (String message) { public CheckedException (String message) {
super(message); super(message);

View File

@ -6,7 +6,7 @@ package com.muyu.common.core.exception;
* @author muyu * @author muyu
*/ */
public class DemoModeException extends RuntimeException { public class DemoModeException extends RuntimeException {
private static final long serialVersionUID = 1L; private static final Long serialVersionUID = 1L;
public DemoModeException () { public DemoModeException () {
} }

View File

@ -6,7 +6,7 @@ package com.muyu.common.core.exception;
* @author muyu * @author muyu
*/ */
public class GlobalException extends RuntimeException { public class GlobalException extends RuntimeException {
private static final long serialVersionUID = 1L; private static final Long serialVersionUID = 1L;
/** /**
* *

View File

@ -6,7 +6,7 @@ package com.muyu.common.core.exception;
* @author muyu * @author muyu
*/ */
public class InnerAuthException extends RuntimeException { public class InnerAuthException extends RuntimeException {
private static final long serialVersionUID = 1L; private static final Long serialVersionUID = 1L;
public InnerAuthException (String message) { public InnerAuthException (String message) {
super(message); super(message);

View File

@ -6,7 +6,7 @@ package com.muyu.common.core.exception;
* @author muyu * @author muyu
*/ */
public class PreAuthorizeException extends RuntimeException { public class PreAuthorizeException extends RuntimeException {
private static final long serialVersionUID = 1L; private static final Long serialVersionUID = 1L;
public PreAuthorizeException () { public PreAuthorizeException () {
} }

View File

@ -6,7 +6,7 @@ package com.muyu.common.core.exception;
* @author muyu * @author muyu
*/ */
public class ServiceException extends RuntimeException { public class ServiceException extends RuntimeException {
private static final long serialVersionUID = 1L; private static final Long serialVersionUID = 1L;
/** /**
* *

View File

@ -6,7 +6,7 @@ package com.muyu.common.core.exception;
* @author muyu * @author muyu
*/ */
public class UtilException extends RuntimeException { public class UtilException extends RuntimeException {
private static final long serialVersionUID = 8247610319171014183L; private static final Long serialVersionUID = 8247610319171014183L;
public UtilException (Throwable e) { public UtilException (Throwable e) {
super(e.getMessage(), e); super(e.getMessage(), e);

View File

@ -6,7 +6,7 @@ package com.muyu.common.core.exception.auth;
* @author muyu * @author muyu
*/ */
public class NotLoginException extends RuntimeException { public class NotLoginException extends RuntimeException {
private static final long serialVersionUID = 1L; private static final Long serialVersionUID = 1L;
public NotLoginException (String message) { public NotLoginException (String message) {
super(message); super(message);

View File

@ -8,7 +8,7 @@ import org.apache.commons.lang3.StringUtils;
* @author muyu * @author muyu
*/ */
public class NotPermissionException extends RuntimeException { public class NotPermissionException extends RuntimeException {
private static final long serialVersionUID = 1L; private static final Long serialVersionUID = 1L;
public NotPermissionException (String permission) { public NotPermissionException (String permission) {
super(permission); super(permission);

View File

@ -8,7 +8,7 @@ import org.apache.commons.lang3.StringUtils;
* @author muyu * @author muyu
*/ */
public class NotRoleException extends RuntimeException { public class NotRoleException extends RuntimeException {
private static final long serialVersionUID = 1L; private static final Long serialVersionUID = 1L;
public NotRoleException (String role) { public NotRoleException (String role) {
super(role); super(role);

View File

@ -6,7 +6,7 @@ package com.muyu.common.core.exception.base;
* @author muyu * @author muyu
*/ */
public class BaseException extends RuntimeException { public class BaseException extends RuntimeException {
private static final long serialVersionUID = 1L; private static final Long serialVersionUID = 1L;
/** /**
* *

View File

@ -8,7 +8,7 @@ import com.muyu.common.core.exception.base.BaseException;
* @author muyu * @author muyu
*/ */
public class FileException extends BaseException { 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) { public FileException (String code, Object[] args, String msg) {
super("file", code, args, msg); super("file", code, args, msg);

View File

@ -6,9 +6,9 @@ package com.muyu.common.core.exception.file;
* @author muyu * @author muyu
*/ */
public class FileNameLengthLimitExceededException extends FileException { public class FileNameLengthLimitExceededException extends FileException {
private static final long serialVersionUID = 1L; private static final Long serialVersionUID = 1L;
public FileNameLengthLimitExceededException (int defaultFileNameLength) { 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");
} }
} }

View File

@ -6,9 +6,9 @@ package com.muyu.common.core.exception.file;
* @author muyu * @author muyu
*/ */
public class FileSizeLimitExceededException extends FileException { 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"); super("upload.exceed.maxSize", new Object[]{defaultMaxSize}, "the filesize is too large");
} }
} }

View File

@ -10,7 +10,7 @@ import java.io.PrintWriter;
*/ */
public class FileUploadException extends Exception { public class FileUploadException extends Exception {
private static final long serialVersionUID = 1L; private static final Long serialVersionUID = 1L;
private final Throwable cause; private final Throwable cause;

View File

@ -8,7 +8,7 @@ import java.util.Arrays;
* @author muyu * @author muyu
*/ */
public class InvalidExtensionException extends FileUploadException { public class InvalidExtensionException extends FileUploadException {
private static final long serialVersionUID = 1L; private static final Long serialVersionUID = 1L;
private String[] allowedExtension; private String[] allowedExtension;
private String extension; private String extension;
@ -34,7 +34,7 @@ public class InvalidExtensionException extends FileUploadException {
} }
public static class InvalidImageExtensionException extends InvalidExtensionException { 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) { public InvalidImageExtensionException (String[] allowedExtension, String extension, String filename) {
super(allowedExtension, extension, filename); super(allowedExtension, extension, filename);
@ -42,7 +42,7 @@ public class InvalidExtensionException extends FileUploadException {
} }
public static class InvalidFlashExtensionException extends InvalidExtensionException { 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) { public InvalidFlashExtensionException (String[] allowedExtension, String extension, String filename) {
super(allowedExtension, extension, filename); super(allowedExtension, extension, filename);
@ -50,7 +50,7 @@ public class InvalidExtensionException extends FileUploadException {
} }
public static class InvalidMediaExtensionException extends InvalidExtensionException { 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) { public InvalidMediaExtensionException (String[] allowedExtension, String extension, String filename) {
super(allowedExtension, extension, filename); super(allowedExtension, extension, filename);
@ -58,7 +58,7 @@ public class InvalidExtensionException extends FileUploadException {
} }
public static class InvalidVideoExtensionException extends InvalidExtensionException { 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) { public InvalidVideoExtensionException (String[] allowedExtension, String extension, String filename) {
super(allowedExtension, extension, filename); super(allowedExtension, extension, filename);

View File

@ -6,7 +6,7 @@ package com.muyu.common.core.exception.job;
* @author muyu * @author muyu
*/ */
public class TaskException extends Exception { public class TaskException extends Exception {
private static final long serialVersionUID = 1L; private static final Long serialVersionUID = 1L;
private Code code; private Code code;

View File

@ -6,7 +6,7 @@ package com.muyu.common.core.exception.user;
* @author muyu * @author muyu
*/ */
public class CaptchaExpireException extends UserException { public class CaptchaExpireException extends UserException {
private static final long serialVersionUID = 1L; private static final Long serialVersionUID = 1L;
public CaptchaExpireException () { public CaptchaExpireException () {
super("user.jcaptcha.expire", null); super("user.jcaptcha.expire", null);

View File

@ -8,7 +8,7 @@ import com.muyu.common.core.exception.base.BaseException;
* @author muyu * @author muyu
*/ */
public class UserException extends BaseException { public class UserException extends BaseException {
private static final long serialVersionUID = 1L; private static final Long serialVersionUID = 1L;
public UserException (String code, Object[] args) { public UserException (String code, Object[] args) {
super("user", code, args, null); super("user", code, args, null);

View File

@ -6,7 +6,7 @@ package com.muyu.common.core.exception.user;
* @author muyu * @author muyu
*/ */
public class UserPasswordNotMatchException extends UserException { public class UserPasswordNotMatchException extends UserException {
private static final long serialVersionUID = 1L; private static final Long serialVersionUID = 1L;
public UserPasswordNotMatchException () { public UserPasswordNotMatchException () {
super("user.password.not.match", null); super("user.password.not.match", null);

View File

@ -313,12 +313,12 @@ public class Convert {
return new Long[]{}; return new Long[]{};
} }
String[] arr = str.split(split); 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++) { for (int i = 0 ; i < arr.length ; i++) {
final Long v = toLong(arr[i], null); 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> * <br>
* *
* *
@ -377,7 +377,7 @@ public class Convert {
} }
/** /**
* long<br> * Long<br>
* <code>null</code><code>null</code><br> * <code>null</code><code>null</code><br>
* *
* *

View File

@ -109,7 +109,7 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
* *
*/ */
public static Date getServerStartDate () { public static Date getServerStartDate () {
long time = ManagementFactory.getRuntimeMXBean().getStartTime(); Long time = ManagementFactory.getRuntimeMXBean().getStartTime();
return new Date(time); return new Date(time);
} }
@ -122,20 +122,20 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
* @return // * @return //
*/ */
public static String timeDistance (Date endDate, Date startTime) { public static String timeDistance (Date endDate, Date startTime) {
long nd = 1000 * 24 * 60 * 60; Long nd = 1000 * 24 * 60 * 60L;
long nh = 1000 * 60 * 60; Long nh = 1000 * 60 * 60L;
long nm = 1000 * 60; Long nm = 1000 * 60L;
// long ns = 1000; // 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 + "分钟"; return day + "天" + hour + "小时" + min + "分钟";
} }

View File

@ -162,4 +162,21 @@ public class JwtUtils {
public static String getValue (Claims claims, String key) { public static String getValue (Claims claims, String key) {
return Convert.toStr(claims.get(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);
}
} }

View File

@ -45,7 +45,7 @@ public final class HTMLFilter {
private static final ConcurrentMap<String, Pattern> P_REMOVE_SELF_BLANKS = new ConcurrentHashMap<>(); 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; private final Map<String, List<String>> vAllowed;
/** /**

View File

@ -127,7 +127,7 @@ public class IpUtils {
byte[] bytes = new byte[4]; byte[] bytes = new byte[4];
String[] elements = text.split("\\.", -1); String[] elements = text.split("\\.", -1);
try { try {
long l; Long l;
int i; int i;
switch (elements.length) { switch (elements.length) {
case 1: case 1:
@ -141,12 +141,12 @@ public class IpUtils {
bytes[3] = (byte) (int) (l & 0xFF); bytes[3] = (byte) (int) (l & 0xFF);
break; break;
case 2: case 2:
l = Integer.parseInt(elements[0]); l = (long) Integer.parseInt(elements[0]);
if ((l < 0L) || (l > 255L)) { if ((l < 0L) || (l > 255L)) {
return null; return null;
} }
bytes[0] = (byte) (int) (l & 0xFF); bytes[0] = (byte) (int) (l & 0xFF);
l = Integer.parseInt(elements[1]); l = (long) Integer.parseInt(elements[1]);
if ((l < 0L) || (l > 16777215L)) { if ((l < 0L) || (l > 16777215L)) {
return null; return null;
} }
@ -156,13 +156,13 @@ public class IpUtils {
break; break;
case 3: case 3:
for (i = 0; i < 2 ; ++i) { for (i = 0; i < 2 ; ++i) {
l = Integer.parseInt(elements[i]); l = (long) Integer.parseInt(elements[i]);
if ((l < 0L) || (l > 255L)) { if ((l < 0L) || (l > 255L)) {
return null; return null;
} }
bytes[i] = (byte) (int) (l & 0xFF); bytes[i] = (byte) (int) (l & 0xFF);
} }
l = Integer.parseInt(elements[2]); l = (long) Integer.parseInt(elements[2]);
if ((l < 0L) || (l > 65535L)) { if ((l < 0L) || (l > 65535L)) {
return null; return null;
} }
@ -171,7 +171,7 @@ public class IpUtils {
break; break;
case 4: case 4:
for (i = 0; i < 4 ; ++i) { for (i = 0; i < 4 ; ++i) {
l = Integer.parseInt(elements[i]); l = (long) Integer.parseInt(elements[i]);
if ((l < 0L) || (l > 255L)) { if ((l < 0L) || (l > 255L)) {
return null; return null;
} }
@ -290,14 +290,14 @@ public class IpUtils {
String[] sips = iparea.substring(0, idx).split("\\."); String[] sips = iparea.substring(0, idx).split("\\.");
String[] sipe = iparea.substring(idx + 1).split("\\."); String[] sipe = iparea.substring(idx + 1).split("\\.");
String[] sipt = ip.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) { for (int i = 0 ; i < 4 ; ++i) {
ips = ips << 8 | Integer.parseInt(sips[i]); ips = ips << 8 | Integer.parseInt(sips[i]);
ipe = ipe << 8 | Integer.parseInt(sipe[i]); ipe = ipe << 8 | Integer.parseInt(sipe[i]);
ipt = ipt << 8 | Integer.parseInt(sipt[i]); ipt = ipt << 8 | Integer.parseInt(sipt[i]);
} }
if (ips > ipe) { if (ips > ipe) {
long t = ips; Long t = ips;
ips = ipe; ips = ipe;
ipe = t; ipe = t;
} }

View File

@ -30,8 +30,8 @@ public final class UUID implements java.io.Serializable, Comparable<UUID> {
* @param data * @param data
*/ */
private UUID (byte[] data) { private UUID (byte[] data) {
long msb = 0; long msb = 0L;
long lsb = 0; long lsb = 0L;
assert data.length == 16 : "data must be 16 bytes in length"; assert data.length == 16 : "data must be 16 bytes in length";
for (int i = 0 ; i < 8 ; i++) { for (int i = 0 ; i < 8 ; i++) {
msb = (msb << 8) | (data[i] & 0xff); 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]; components[i] = "0x" + components[i];
} }
long mostSigBits = Long.decode(components[0]).longValue(); long mostSigBits = Long.decode(components[0]);
mostSigBits <<= 16; mostSigBits <<= 16;
mostSigBits |= Long.decode(components[1]).longValue(); mostSigBits |= Long.decode(components[1]);
mostSigBits <<= 16; 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 <<= 48;
leastSigBits |= Long.decode(components[4]).longValue(); leastSigBits |= Long.decode(components[4]);
return new UUID(mostSigBits, leastSigBits); return new UUID(mostSigBits, leastSigBits);
} }

View File

@ -24,7 +24,7 @@ import java.util.Map;
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
public class BaseEntity implements Serializable { public class BaseEntity implements Serializable {
private static final long serialVersionUID = 1L; private static final Long serialVersionUID = 1L;
/** /**
* *

View File

@ -17,7 +17,7 @@ import java.util.List;
@AllArgsConstructor @AllArgsConstructor
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
public class TreeEntity extends BaseEntity { public class TreeEntity extends BaseEntity {
private static final long serialVersionUID = 1L; private static final Long serialVersionUID = 1L;
/** /**
* *

View File

@ -20,12 +20,12 @@ import java.util.List;
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
public class TableDataInfo<T> implements Serializable { public class TableDataInfo<T> implements Serializable {
private static final long serialVersionUID = 1L; private static final Long serialVersionUID = 1L;
/** /**
* *
*/ */
private long total; private Long total;
/** /**
* *

View File

@ -71,7 +71,7 @@ public class IotDBSessionConfig {
* @param value * @param value
*/ */
public void insertRecord(SessionPool sessionPool,String deviceId, 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 { try {
log.info("iotdb数据入库device_id:[{}], measurements:[{}], values:[{}]", deviceId, measurements, value); log.info("iotdb数据入库device_id:[{}], measurements:[{}], values:[{}]", deviceId, measurements, value);
sessionPool.insertRecord(deviceId, time, measurements,dataTypeList,new Object[]{value.toJSONString()}); 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); 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 { try {
while (sessionDataSet.hasNext()){ while (sessionDataSet.hasNext()){
RowRecord next = sessionDataSet.next(); RowRecord next = sessionDataSet.next();
long timestamp = next.getTimestamp(); Long timestamp = next.getTimestamp();
Map<String, String> fieldMap = new HashMap<>(); Map<String, String> fieldMap = new HashMap<>();
for (Field field : next.getFields()) { for (Field field : next.getFields()) {
TSDataType dataType = field.getDataType(); TSDataType dataType = field.getDataType();
String stringValue = field.getStringValue(); String stringValue = field.getStringValue();
fieldMap.put(dataType.name(), stringValue); fieldMap.put(dataType.name(), stringValue);
} }
longMapHashMap.put(timestamp, fieldMap); LongMapHashMap.put(timestamp, fieldMap);
} }
} catch (StatementExecutionException e) { } catch (StatementExecutionException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} catch (IoTDBConnectionException e) { } catch (IoTDBConnectionException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
log.info("数据为:{}", JSONObject.toJSONString(longMapHashMap)); log.info("数据为:{}", JSONObject.toJSONString(LongMapHashMap));
} }
} }

View File

@ -23,9 +23,9 @@ public interface IotDBService {
void insertTablets(Map<String, Tablet> tablets); 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); 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 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); 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);
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); SessionDataSet executeQueryStatement(String sql);

View File

@ -77,7 +77,7 @@ public class IotDBServiceImpl implements IotDBService {
* @param values * @param values
*/ */
@Override @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(); SessionPool sessionPool = iotDBSessionConfig.getSessionPool();
try { try {
log.info("iotdb数据入库device_id:[{}], measurements:[{}], values:[{}]", deviceId, measurements, values); log.info("iotdb数据入库device_id:[{}], measurements:[{}], values:[{}]", deviceId, measurements, values);
@ -98,7 +98,7 @@ public class IotDBServiceImpl implements IotDBService {
* @param values * @param values
*/ */
@Override @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(); SessionPool sessionPool = iotDBSessionConfig.getSessionPool();
try { try {
log.info("iotdb数据入库device_id:[{}], measurements:[{}], types:[{}], values:[{}]", deviceId, measurements, types, values); log.info("iotdb数据入库device_id:[{}], measurements:[{}], types:[{}], values:[{}]", deviceId, measurements, types, values);
@ -198,7 +198,7 @@ public class IotDBServiceImpl implements IotDBService {
* @param endTime * @param endTime
*/ */
@Override @Override
public void deleteData(String path, long endTime) { public void deleteData(String path, Long endTime) {
SessionPool sessionPool = iotDBSessionConfig.getSessionPool(); SessionPool sessionPool = iotDBSessionConfig.getSessionPool();
try { try {
log.info("iotdb数据删除path:[{}], endTime:[{}]", path, endTime); log.info("iotdb数据删除path:[{}], endTime:[{}]", path, endTime);
@ -215,7 +215,7 @@ public class IotDBServiceImpl implements IotDBService {
* @param endTime * @param endTime
*/ */
@Override @Override
public void deleteData(List<String> paths, long endTime) { public void deleteData(List<String> paths, Long endTime) {
SessionPool sessionPool = iotDBSessionConfig.getSessionPool(); SessionPool sessionPool = iotDBSessionConfig.getSessionPool();
try { try {
log.info("iotdb数据删除paths:[{}], endTime:[{}]", paths, endTime); log.info("iotdb数据删除paths:[{}], endTime:[{}]", paths, endTime);
@ -235,7 +235,7 @@ public class IotDBServiceImpl implements IotDBService {
* @return SessionDataSet (Time,paths) * @return SessionDataSet (Time,paths)
*/ */
@Override @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(); SessionPool sessionPool = iotDBSessionConfig.getSessionPool();
SessionDataSetWrapper sessionDataSetWrapper = null; SessionDataSetWrapper sessionDataSetWrapper = null;
try { try {
@ -262,7 +262,7 @@ public class IotDBServiceImpl implements IotDBService {
* @return * @return
*/ */
@Override @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); SessionDataSet sessionDataSet = executeRawDataQuery(paths, startTime, endTime, outTime);
List<String> columnNames = sessionDataSet.getColumnNames(); List<String> columnNames = sessionDataSet.getColumnNames();
List<T> resultEntities = null; List<T> resultEntities = null;
@ -282,7 +282,7 @@ public class IotDBServiceImpl implements IotDBService {
* @return SessionDataSet * @return SessionDataSet
*/ */
@Override @Override
public SessionDataSet executeLastDataQuery(List<String> paths, long lastTime) { public SessionDataSet executeLastDataQuery(List<String> paths, Long lastTime) {
SessionPool sessionPool = iotDBSessionConfig.getSessionPool(); SessionPool sessionPool = iotDBSessionConfig.getSessionPool();
SessionDataSetWrapper sessionDataSetWrapper = null; SessionDataSetWrapper sessionDataSetWrapper = null;
try { try {
@ -307,7 +307,7 @@ public class IotDBServiceImpl implements IotDBService {
* @return * @return
*/ */
@Override @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); SessionDataSet sessionDataSet = executeLastDataQuery(paths, lastTime);
List<String> columnNames = sessionDataSet.getColumnNames(); List<String> columnNames = sessionDataSet.getColumnNames();
List<T> resultEntities = null; List<T> resultEntities = null;
@ -399,7 +399,7 @@ public class IotDBServiceImpl implements IotDBService {
* @return SessionDataSet * @return SessionDataSet
*/ */
@Override @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(); SessionPool sessionPool = iotDBSessionConfig.getSessionPool();
SessionDataSetWrapper sessionDataSetWrapper = null; SessionDataSetWrapper sessionDataSetWrapper = null;
try { try {
@ -425,7 +425,7 @@ public class IotDBServiceImpl implements IotDBService {
* @return SessionDataSet * @return SessionDataSet
*/ */
@Override @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(); SessionPool sessionPool = iotDBSessionConfig.getSessionPool();
SessionDataSetWrapper sessionDataSetWrapper = null; SessionDataSetWrapper sessionDataSetWrapper = null;
try { try {
@ -452,7 +452,7 @@ public class IotDBServiceImpl implements IotDBService {
* @return SessionDataSet * @return SessionDataSet
*/ */
@Override @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(); SessionPool sessionPool = iotDBSessionConfig.getSessionPool();
SessionDataSetWrapper sessionDataSetWrapper = null; SessionDataSetWrapper sessionDataSetWrapper = null;
@ -648,7 +648,7 @@ public class IotDBServiceImpl implements IotDBService {
return TSDataType.DOUBLE; return TSDataType.DOUBLE;
} else if ("int".equals(typeName) || "integer".equals(typeName)) { } else if ("int".equals(typeName) || "integer".equals(typeName)) {
return TSDataType.INT32; return TSDataType.INT32;
} else if ("long".equals(typeName)) { } else if ("Long".equals(typeName)) {
return TSDataType.INT64; return TSDataType.INT64;
} else if ("float".equals(typeName)) { } else if ("float".equals(typeName)) {
return TSDataType.FLOAT; return TSDataType.FLOAT;

View File

@ -53,7 +53,7 @@ public class RedisService {
* *
* @return true=false= * @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); return expire(key, timeout, TimeUnit.SECONDS);
} }
@ -66,7 +66,7 @@ public class RedisService {
* *
* @return true=false= * @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); return redisTemplate.expire(key, timeout, unit);
} }
@ -77,7 +77,7 @@ public class RedisService {
* *
* @return * @return
*/ */
public long getExpire (final String key) { public Long getExpire (final String key) {
return redisTemplate.getExpire(key); return redisTemplate.getExpire(key);
} }
@ -132,7 +132,7 @@ public class RedisService {
* *
* @return * @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); Long count = redisTemplate.opsForList().rightPushAll(key, dataList);
return count == null ? 0 : count; return count == null ? 0 : count;
} }

View File

@ -3,19 +3,15 @@ package com.muyu.cloud.common.many.datasource;
import com.alibaba.druid.pool.DruidDataSource; import com.alibaba.druid.pool.DruidDataSource;
import com.alibaba.fastjson2.JSON; import com.alibaba.fastjson2.JSON;
import com.baomidou.mybatisplus.autoconfigure.MybatisPlusAutoConfiguration; 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.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.many.datasource.role.DynamicDataSource;
import com.muyu.cloud.common.saas.domain.model.EntInfo;
import com.muyu.cloud.common.saas.exception.SaaSException; import com.muyu.cloud.common.saas.exception.SaaSException;
import com.muyu.common.core.constant.SecurityConstants; 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.domain.Result;
import com.muyu.common.core.utils.SpringUtils; 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.SysFirmDatasource;
import com.muyu.common.system.domain.SysUser;
import com.muyu.common.system.remote.RemoteUserService; import com.muyu.common.system.remote.RemoteUserService;
import lombok.extern.log4j.Log4j2; import lombok.extern.log4j.Log4j2;
import org.springframework.boot.ApplicationArguments; import org.springframework.boot.ApplicationArguments;
@ -64,20 +60,9 @@ public class ManyDataSource implements ApplicationRunner {
throw new RuntimeException("远调数据源错误,远调--》 firmList "); 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 @Bean
public DynamicDataSource dynamicDataSource(DruidDataSourceFactory druidDataSourceFactory) { public DynamicDataSource dynamicDataSource() {
// 企业列表 企业CODE端口IP // 企业列表 企业CODE端口IP
Map<Object, Object> dataSourceMap = new HashMap<>(); Map<Object, Object> dataSourceMap = new HashMap<>();
dataSourceInfoList() dataSourceInfoList()
@ -104,15 +89,19 @@ public class ManyDataSource implements ApplicationRunner {
@Override @Override
public void run(ApplicationArguments args) throws Exception { public void run(ApplicationArguments args) throws Exception {
DruidDataSourceFactory druidDataSourceFactory = SpringUtils.getBean(DruidDataSourceFactory.class);
DynamicDataSource dynamicDataSource = SpringUtils.getBean(DynamicDataSource.class); DynamicDataSource dynamicDataSource = SpringUtils.getBean(DynamicDataSource.class);
for (EntInfo entInfo : dataSourceInfoList()) { dataSourceInfoList()
DataSourceInfo dataSourceInfo = DataSourceInfo.hostAndPortBuild( .stream()
entInfo.getEntCode(), entInfo.getIp(), entInfo.getPort(),entInfo.getUserName(), entInfo.getPassword() .map(entInfo -> DataSourceInfo.hostAndPortBuild(
); entInfo.getEntCode(),
DruidDataSource druidDataSource = druidDataSourceFactory.create(dataSourceInfo); entInfo.getIp(),
dynamicDataSource.put(dataSourceInfo.getKey(), druidDataSource); entInfo.getPort(),
log.info("存储数据连接池为key:{}",dataSourceInfo.getKey()); entInfo.getUserName(),
} entInfo.getPassword()))
.map(DruidDataSourceFactory::create)
.filter(Objects::nonNull)
.forEach(druidDataSource -> {
dynamicDataSource.put(druidDataSource.getName(), druidDataSource);
});
} }
} }

View File

@ -43,8 +43,8 @@ public class DataSourceInfo {
return DataSourceInfo.builder() return DataSourceInfo.builder()
.key(key) .key(key)
.url(StringUtils.format(DatasourceContent.DATASOURCE_URL, host, port, key)) .url(StringUtils.format(DatasourceContent.DATASOURCE_URL, host, port, key))
.password(userName) .password(password)
.userName(password) .userName(userName)
.build(); .build();
} }
} }

View File

@ -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.many.datasource.holder.DynamicDataSourceHolder;
import com.muyu.cloud.common.saas.exception.SaaSException; import com.muyu.cloud.common.saas.exception.SaaSException;
import com.muyu.cloud.common.many.datasource.role.DynamicDataSource; 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.ServletUtils;
import com.muyu.common.core.utils.SpringUtils; import com.muyu.common.core.utils.SpringUtils;
import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletRequest;
@ -33,11 +34,11 @@ public class SaaSInterceptor implements AsyncHandlerInterceptor {
if (!(handler instanceof HandlerMethod)) { if (!(handler instanceof HandlerMethod)) {
return true; return true;
} }
String SaaSKey = ServletUtils.getHeader(request, SaaSConstant.SAAS_KEY); String SaaSKey = ServletUtils.getHeader(request, SecurityConstants.FIRM_KEY);
if (SaaSKey == null) { if (SaaSKey == null) {
throw new SaaSException("SaaS非法访问"); throw new SaaSException("SaaS非法访问");
} }
if (SaaSKey.equals("-")){ if (SaaSKey.equals("1")){
log.info("使用 [ nacos ] 配置数据库 "); log.info("使用 [ nacos ] 配置数据库 ");
flag = true; flag = true;
return true; return true;

View File

@ -27,11 +27,11 @@ import java.util.concurrent.TimeUnit;
*/ */
@Component @Component
public class TokenService { public class TokenService {
protected static final long MILLIS_SECOND = 1000; protected static final Long MILLIS_SECOND = 1000L;
protected static final long MILLIS_MINUTE = 60 * MILLIS_SECOND; protected static final Long MILLIS_MINUTE = 60 * MILLIS_SECOND;
private final static Long MILLIS_MINUTE_TEN = CacheConstants.REFRESH_TIME * MILLIS_MINUTE; private final static Long MILLIS_MINUTE_TEN = CacheConstants.REFRESH_TIME * MILLIS_MINUTE;
private static final Logger log = LoggerFactory.getLogger(TokenService.class); 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; private final static String ACCESS_TOKEN = CacheConstants.LOGIN_TOKEN_KEY;
@Autowired @Autowired
@ -43,6 +43,7 @@ public class TokenService {
public Map<String, Object> createToken (LoginUser loginUser) { public Map<String, Object> createToken (LoginUser loginUser) {
String token = IdUtils.fastUUID(); String token = IdUtils.fastUUID();
Long userId = loginUser.getSysUser().getUserId(); Long userId = loginUser.getSysUser().getUserId();
Long firmId = loginUser.getSysUser().getFirmId();
String userName = loginUser.getSysUser().getUserName(); String userName = loginUser.getSysUser().getUserName();
loginUser.setToken(token); loginUser.setToken(token);
loginUser.setUserid(userId); loginUser.setUserid(userId);
@ -55,7 +56,8 @@ public class TokenService {
claimsMap.put(SecurityConstants.USER_KEY, token); claimsMap.put(SecurityConstants.USER_KEY, token);
claimsMap.put(SecurityConstants.DETAILS_USER_ID, userId); claimsMap.put(SecurityConstants.DETAILS_USER_ID, userId);
claimsMap.put(SecurityConstants.DETAILS_USERNAME, userName); 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>(); Map<String, Object> rspMap = new HashMap<String, Object>();
rspMap.put("access_token", JwtUtils.createToken(claimsMap)); rspMap.put("access_token", JwtUtils.createToken(claimsMap));
@ -127,8 +129,8 @@ public class TokenService {
* @param loginUser * @param loginUser
*/ */
public void verifyToken (LoginUser loginUser) { public void verifyToken (LoginUser loginUser) {
long expireTime = loginUser.getExpireTime(); Long expireTime = loginUser.getExpireTime();
long currentTime = System.currentTimeMillis(); Long currentTime = System.currentTimeMillis();
if (expireTime - currentTime <= MILLIS_MINUTE_TEN) { if (expireTime - currentTime <= MILLIS_MINUTE_TEN) {
refreshToken(loginUser); refreshToken(loginUser);
} }

View File

@ -16,7 +16,7 @@ import java.util.Set;
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
public class LoginUser implements Serializable { public class LoginUser implements Serializable {
private static final long serialVersionUID = 1L; private static final Long serialVersionUID = 1L;
/** /**
* *

View File

@ -22,7 +22,7 @@ import java.util.List;
@AllArgsConstructor @AllArgsConstructor
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
public class SysDept extends BaseEntity { public class SysDept extends BaseEntity {
private static final long serialVersionUID = 1L; private static final Long serialVersionUID = 1L;
/** /**
* ID * ID

View File

@ -21,7 +21,7 @@ import jakarta.validation.constraints.Size;
@AllArgsConstructor @AllArgsConstructor
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
public class SysDictData extends BaseEntity { public class SysDictData extends BaseEntity {
private static final long serialVersionUID = 1L; private static final Long serialVersionUID = 1L;
/** /**
* *

View File

@ -21,7 +21,7 @@ import jakarta.validation.constraints.Size;
@AllArgsConstructor @AllArgsConstructor
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
public class SysDictType extends BaseEntity { public class SysDictType extends BaseEntity {
private static final long serialVersionUID = 1L; private static final Long serialVersionUID = 1L;
/** /**
* *

View File

@ -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;
}

View File

@ -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;
}

View File

@ -23,7 +23,7 @@ import java.util.Date;
@AllArgsConstructor @AllArgsConstructor
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
public class SysLogininfor extends BaseEntity { public class SysLogininfor extends BaseEntity {
private static final long serialVersionUID = 1L; private static final Long serialVersionUID = 1L;
/** /**
* ID * ID

View File

@ -23,7 +23,7 @@ import java.util.Date;
@AllArgsConstructor @AllArgsConstructor
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
public class SysOperLog extends BaseEntity { public class SysOperLog extends BaseEntity {
private static final long serialVersionUID = 1L; private static final Long serialVersionUID = 1L;
/** /**
* *

View File

@ -22,7 +22,7 @@ import java.util.Set;
@AllArgsConstructor @AllArgsConstructor
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
public class SysRole extends BaseEntity { public class SysRole extends BaseEntity {
private static final long serialVersionUID = 1L; private static final Long serialVersionUID = 1L;
/** /**
* ID * ID

View File

@ -29,7 +29,7 @@ import java.util.List;
@AllArgsConstructor @AllArgsConstructor
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
public class SysUser extends BaseEntity { public class SysUser extends BaseEntity {
private static final long serialVersionUID = 1L; private static final Long serialVersionUID = 1L;
/** /**
* ID * ID
@ -134,6 +134,15 @@ public class SysUser extends BaseEntity {
* ID * ID
*/ */
private Long roleId; private Long roleId;
/**
* Id
*/
private Long firmId;
/**
*
*/
private String databaseName;
public SysUser (Long userId) { public SysUser (Long userId) {
this.userId = userId; this.userId = userId;

View File

@ -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;
}

View File

@ -23,12 +23,12 @@ public interface RemoteUserService {
* *
* *
* @param username * @param username
* @param firmId
* @param source * @param source
*
* @return * @return
*/ */
@GetMapping("/user/info/{username}") @GetMapping("/user/info/{username}/{firmId}")
public Result<LoginUser> getUserInfo (@PathVariable("username") String username, @RequestHeader(SecurityConstants.FROM_SOURCE) String source); 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") @GetMapping("/firmDatasource/firmDatasourceList")
Result<List<SysFirmDatasource>> selectFirmDatabaseList(@RequestHeader(SecurityConstants.FROM_SOURCE) String inner); Result<List<SysFirmDatasource>> selectFirmDatabaseList(@RequestHeader(SecurityConstants.FROM_SOURCE) String inner);
} }

View File

@ -26,7 +26,7 @@ public class RemoteUserFallbackFactory implements FallbackFactory<RemoteUserServ
log.error("用户服务调用失败:{}", throwable.getMessage()); log.error("用户服务调用失败:{}", throwable.getMessage());
return new RemoteUserService() { return new RemoteUserService() {
@Override @Override
public Result<LoginUser> getUserInfo (String username, String source) { public Result<LoginUser> getUserInfo (String username, Long firmId, String source) {
return Result.error("获取用户失败:" + throwable.getMessage()); return Result.error("获取用户失败:" + throwable.getMessage());
} }

View File

@ -192,7 +192,7 @@ public class AccessLogFilter implements GlobalFilter, Ordered {
@Override @Override
public HttpHeaders getHeaders() { public HttpHeaders getHeaders() {
long contentLength = headers.getContentLength(); Long contentLength = headers.getContentLength();
HttpHeaders httpHeaders = new HttpHeaders(); HttpHeaders httpHeaders = new HttpHeaders();
httpHeaders.putAll(super.getHeaders()); httpHeaders.putAll(super.getHeaders());
if (contentLength > 0) { if (contentLength > 0) {

View File

@ -10,6 +10,7 @@ import com.muyu.common.core.utils.StringUtils;
import com.muyu.common.redis.service.RedisService; import com.muyu.common.redis.service.RedisService;
import com.muyu.gateway.config.properties.IgnoreWhiteProperties; import com.muyu.gateway.config.properties.IgnoreWhiteProperties;
import io.jsonwebtoken.Claims; import io.jsonwebtoken.Claims;
import jakarta.annotation.Resource;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -37,7 +38,6 @@ public class AuthFilter implements GlobalFilter, Ordered {
@Autowired @Autowired
private RedisService redisService; private RedisService redisService;
@Override @Override
public Mono<Void> filter (ServerWebExchange exchange, GatewayFilterChain chain) { public Mono<Void> filter (ServerWebExchange exchange, GatewayFilterChain chain) {
ServerHttpRequest request = exchange.getRequest(); ServerHttpRequest request = exchange.getRequest();
@ -63,6 +63,8 @@ public class AuthFilter implements GlobalFilter, Ordered {
} }
String userid = JwtUtils.getUserId(claims); String userid = JwtUtils.getUserId(claims);
String username = JwtUtils.getUserName(claims); String username = JwtUtils.getUserName(claims);
String firmKey = JwtUtils.getFirmKey(claims);
String firmId = JwtUtils.getFirmId(claims);
if (StringUtils.isEmpty(userid) || StringUtils.isEmpty(username)) { if (StringUtils.isEmpty(userid) || StringUtils.isEmpty(username)) {
return unauthorizedResponse(exchange, "令牌验证失败"); return unauthorizedResponse(exchange, "令牌验证失败");
} }
@ -71,6 +73,8 @@ public class AuthFilter implements GlobalFilter, Ordered {
addHeader(mutate, SecurityConstants.USER_KEY, userkey); addHeader(mutate, SecurityConstants.USER_KEY, userkey);
addHeader(mutate, SecurityConstants.DETAILS_USER_ID, userid); addHeader(mutate, SecurityConstants.DETAILS_USER_ID, userid);
addHeader(mutate, SecurityConstants.DETAILS_USERNAME, username); addHeader(mutate, SecurityConstants.DETAILS_USERNAME, username);
addHeader(mutate, SecurityConstants.FIRM_KEY, firmKey);
addHeader(mutate, SecurityConstants.FIRM_ID, firmId);
// 内部请求来源参数清除 // 内部请求来源参数清除
removeHeader(mutate, SecurityConstants.FROM_SOURCE); removeHeader(mutate, SecurityConstants.FROM_SOURCE);
return chain.filter(exchange.mutate().request(mutate.build()).build()); return chain.filter(exchange.mutate().request(mutate.build()).build());

View File

@ -1,6 +1,6 @@
# Tomcat # Tomcat
server: server:
port: 8080 port: 18080
# nacos线上地址 # nacos线上地址
nacos: nacos:

View File

@ -27,6 +27,7 @@ public class IotdbStrategy
private static ConcurrentHashMap<EventEnum,EventStrategyRouter<Information,Information>> map = new ConcurrentHashMap<>(); private static ConcurrentHashMap<EventEnum,EventStrategyRouter<Information,Information>> map = new ConcurrentHashMap<>();
private static ExecutorService executor = Executors.newFixedThreadPool(3);
@Override @Override
public Information apply(Information param) { public Information apply(Information param) {
return applyStrategy(param); return applyStrategy(param);
@ -39,23 +40,12 @@ public class IotdbStrategy
if (isEventMapSize()){ if (isEventMapSize()){
log.info("[没有事件执行]"); log.info("[没有事件执行]");
}else { }else {
ExecutorService executor = Executors.newFixedThreadPool(map.size());
for (EventEnum eventEnum : map.keySet()) { for (EventEnum eventEnum : map.keySet()) {
executor.submit(() -> { executor.submit(() -> {
log.info("开始执行 [{}] ",eventEnum.getEventName()); log.info("开始执行 [{}] ",eventEnum.getEventName());
return map.get(eventEnum); return map.get(eventEnum);
}); });
} }
// 关闭线程池
executor.shutdown();
try {
// 等待所有任务完成
if (!executor.awaitTermination(60, TimeUnit.SECONDS)) {
executor.shutdownNow();
}
} catch (InterruptedException e) {
executor.shutdownNow();
}
} }
return new EndStrategy(); return new EndStrategy();
}; };

View File

@ -8,7 +8,7 @@ import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
@EnableCustomConfig @EnableCustomConfig
@EnableMyFeignClients @EnableMyFeignClients
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class}) @SpringBootApplication
public class DataProcessApplication { public class DataProcessApplication {
public static void main(String[] args) { public static void main(String[] args) {
SpringApplication.run(DataProcessApplication.class, args); SpringApplication.run(DataProcessApplication.class, args);

View File

@ -77,7 +77,7 @@ public class TestController {
} }
@GetMapping("/insertData") @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); String sql = String.format("insert into root.one.%s(timestamp, temperature) values (%d, %f)", deviceId, time, value);
iotDBConfig.getSessionPool().executeNonQueryStatement(sql); iotDBConfig.getSessionPool().executeNonQueryStatement(sql);
} }

View File

@ -1,6 +1,6 @@
# Tomcat # Tomcat
server: server:
port: 9701 port: 29701
# nacos线上地址 # nacos线上地址
nacos: nacos:

View File

@ -22,7 +22,6 @@
<dependency> <dependency>
<groupId>com.muyu</groupId> <groupId>com.muyu</groupId>
<artifactId>enterpise-common</artifactId> <artifactId>enterpise-common</artifactId>
<version>${muyu.version}</version>
</dependency> </dependency>
<!-- 缓存公共模块 --> <!-- 缓存公共模块 -->

View File

@ -18,7 +18,7 @@ public class SysCarCacheService extends CacheAbsBasic<String, SysCar> {
@Override @Override
public String keyPre() { public String keyPre() {
return "sysCar:info:"; return ":sysCar";
} }
@Override @Override

View File

@ -18,7 +18,7 @@ public class WarnStrategyCacjeService extends CacheAbsBasic<String, WarnStrateg
@Override @Override
public String keyPre() { public String keyPre() {
return "sysCarType:info:"; return ":sysCarType";
} }
@Override @Override

View File

@ -37,12 +37,12 @@ public class CarFaultRule {
* *
*/ */
@Schema(name = "车辆类型Id") @Schema(name = "车辆类型Id")
private long timestamp; private Long timestamp;
/** /**
* *
*/ */
@Schema(name = "车速") @Schema(name = "车速")
private double longitude; private double Longitude;
/** /**
* *
*/ */
@ -57,7 +57,7 @@ public class CarFaultRule {
* *
*/ */
@Schema(name = "加速踏板行程值") @Schema(name = "加速踏板行程值")
private long TM; private Long TM;
/** /**
* *
*/ */

View File

@ -30,7 +30,7 @@ public class CarType {
*/ */
@TableId(value = "car_type_id",type = IdType.AUTO) @TableId(value = "car_type_id",type = IdType.AUTO)
@Schema(name = "车辆类型ID") @Schema(name = "车辆类型ID")
private long carTypeId; private Long carTypeId;
/** /**
* *
*/ */
@ -40,5 +40,5 @@ public class CarType {
* ID * ID
*/ */
@Schema(name = "车辆规则外键ID") @Schema(name = "车辆规则外键ID")
private long carTypeRules; private Long carTypeRules;
} }

View File

@ -35,12 +35,12 @@ public class FaultCode {
*/ */
@TableId(value = "faultcode_id", type = IdType.AUTO) @TableId(value = "faultcode_id", type = IdType.AUTO)
@Schema(name = "故障码Id") @Schema(name = "故障码Id")
private long faultcodeId; private Long faultcodeId;
/** /**
* Id * Id
*/ */
@Schema(name = "故障名称Id") @Schema(name = "故障名称Id")
private long messageTypeId; private Long messageTypeId;
/** /**
* *
*/ */
@ -86,11 +86,11 @@ public class FaultCode {
* *
*/ */
@Schema(name = "故障类型所属") @Schema(name = "故障类型所属")
private String messageTypeBelongs; private String messageTypeBeLongs;
public static FaultCode addfaultcode(FaultCodeAddReq faultCodeAddReq) { public static FaultCode addfaultcode(FaultCodeAddReq faultCodeAddReq) {
return FaultCode.builder() return FaultCode.builder()
.faultcodeId(0) .faultcodeId(0L)
.messageTypeId(faultCodeAddReq.getMessageTypeId()) .messageTypeId(faultCodeAddReq.getMessageTypeId())
.faultcodeNumber(faultCodeAddReq.getFaultcodeNumber()) .faultcodeNumber(faultCodeAddReq.getFaultcodeNumber())
.faultGroup(faultCodeAddReq.getFaultGroup()) .faultGroup(faultCodeAddReq.getFaultGroup())

View File

@ -35,17 +35,17 @@ public class FaultCondition {
*/ */
@TableId(value = "carcondition_id",type = IdType.AUTO) @TableId(value = "carcondition_id",type = IdType.AUTO)
@Schema(name = "故障规则表Id") @Schema(name = "故障规则表Id")
private long carconditionId; private Long carconditionId;
/** /**
* Id * Id
*/ */
@Schema(name = "车辆类型Id") @Schema(name = "车辆类型Id")
private long carTypeId; private Long carTypeId;
/** /**
*Id *Id
*/ */
@Schema(name = "故障名称Id") @Schema(name = "故障名称Id")
private long messageTypeId; private Long messageTypeId;
/** /**
* *
*/ */

View File

@ -46,6 +46,6 @@ public class FaultLabel {
* *
*/ */
@Schema(name = "报文所属类别") @Schema(name = "报文所属类别")
private String messageTypeBelongs; private String messageTypeBeLongs;
} }

View File

@ -34,17 +34,17 @@ public class FaultLog {
*/ */
@TableId(value = "log_id",type = IdType.AUTO) @TableId(value = "log_id",type = IdType.AUTO)
@Schema(name = "故障日志Id") @Schema(name = "故障日志Id")
private long logId; private Long logId;
/** /**
* Id * Id
*/ */
@Schema(name = "故障码Id") @Schema(name = "故障码Id")
private long faultcodeId; private Long faultcodeId;
/** /**
* Id * Id
*/ */
@Schema(name = "车辆Id") @Schema(name = "车辆Id")
private long carInformationId; private Long carInformationId;
/** /**
* VIN * VIN
*/ */

View File

@ -32,13 +32,13 @@ public class FaultRule {
*/ */
@TableId(value = "condition_id",type = IdType.AUTO) @TableId(value = "condition_id",type = IdType.AUTO)
@Schema(name = "触发条件Id") @Schema(name = "触发条件Id")
private long conditionId; private Long conditionId;
/** /**
* Id * Id
*/ */
@Schema(name = "故障码Id") @Schema(name = "故障码Id")
private long faultcodeId; private Long faultcodeId;
/** /**
* *

View File

@ -30,7 +30,7 @@ public class FaultType {
*/ */
@TableId(value = "faulttype_id",type = IdType.AUTO) @TableId(value = "faulttype_id",type = IdType.AUTO)
@Schema(name = "故障类型Id") @Schema(name = "故障类型Id")
private long faulttypeId; private Long faulttypeId;
/** /**
* *
*/ */

View File

@ -27,7 +27,7 @@ import org.apache.commons.lang3.builder.ToStringStyle;
@TableName(value = "sys_car_fault", autoResultMap = true) @TableName(value = "sys_car_fault", autoResultMap = true)
@Tag(name = "车辆故障对象") @Tag(name = "车辆故障对象")
public class SysCarFault extends BaseEntity{ public class SysCarFault extends BaseEntity{
private static final long serialVersionUID = 1L; private static final Long serialVersionUID = 1L;
/** 自增主键 */ /** 自增主键 */
@TableId( type = IdType.AUTO,value = "id") @TableId( type = IdType.AUTO,value = "id")

View File

@ -32,7 +32,7 @@ import java.util.Date;
@TableName("warn_logs") @TableName("warn_logs")
@Tag(name = "预警日志管理") @Tag(name = "预警日志管理")
public class WarnLogs extends BaseEntity{ public class WarnLogs extends BaseEntity{
private static final long serialVersionUID = 1L; private static final Long serialVersionUID = 1L;
/** 预警日志id */ /** 预警日志id */
@TableId( type = IdType.AUTO) @TableId( type = IdType.AUTO)

View File

@ -28,7 +28,7 @@ import org.apache.commons.lang3.builder.ToStringStyle;
@TableName("warn_rule") @TableName("warn_rule")
@Tag(name = "预警规则管理") @Tag(name = "预警规则管理")
public class WarnRule extends BaseEntity{ public class WarnRule extends BaseEntity{
private static final long serialVersionUID = 1L; private static final Long serialVersionUID = 1L;
/** 规则id */ /** 规则id */
@TableId( type = IdType.AUTO) @TableId( type = IdType.AUTO)

View File

@ -29,7 +29,7 @@ import org.apache.commons.lang3.builder.ToStringStyle;
@TableName("warn_strategy") @TableName("warn_strategy")
@Tag(name = "预警策略管理") @Tag(name = "预警策略管理")
public class WarnStrategy extends BaseEntity{ public class WarnStrategy extends BaseEntity{
private static final long serialVersionUID = 1L; private static final Long serialVersionUID = 1L;
/** 策略id */ /** 策略id */
@TableId( type = IdType.AUTO) @TableId( type = IdType.AUTO)

View File

@ -36,7 +36,7 @@ public class Message {
* id * id
*/ */
@TableId(value = "id",type = IdType.AUTO) @TableId(value = "id",type = IdType.AUTO)
private long id; private Long id;
/** /**
* *
@ -72,7 +72,7 @@ public class Message {
* Id * Id
*/ */
@Schema(description = "登录人Id",defaultValue = "1",type = "Long") @Schema(description = "登录人Id",defaultValue = "1",type = "Long")
private long userId; private Long userId;
} }

View File

@ -39,5 +39,5 @@ public class MessageReq {
* Id * Id
*/ */
@Schema(name = "登录人Id") @Schema(name = "登录人Id")
private long userId; private Long userId;
} }

View File

@ -49,7 +49,7 @@ public class MessageSendReq {
* Id * Id
*/ */
@Schema(name = "登录人Id") @Schema(name = "登录人Id")
private long userId; private Long userId;
/** /**
* *
*/ */

View File

@ -35,5 +35,5 @@ public class MessageReq {
* Id * Id
*/ */
@Schema(name = "登录人Id") @Schema(name = "登录人Id")
private long userId; private Long userId;
} }

View File

@ -46,7 +46,7 @@ public class MessageSendReq {
* Id * Id
*/ */
@Schema(name = "登录人Id") @Schema(name = "登录人Id")
private long userId; private Long userId;
/** /**
* *
*/ */

View File

@ -33,7 +33,7 @@ public class FaultCodeAddReq {
*/ */
@Schema(description = "故障名称Id") @Schema(description = "故障名称Id")
@TableId(value = "message_type_id", type = IdType.AUTO) @TableId(value = "message_type_id", type = IdType.AUTO)
private long messageTypeId; private Long messageTypeId;
/** /**
* *
*/ */
@ -54,7 +54,7 @@ public class FaultCodeAddReq {
* Id * Id
*/ */
@Schema(description = "故障分类Id") @Schema(description = "故障分类Id")
private long faulttypeId; private Long faulttypeId;
/** /**
* *
*/ */
@ -84,7 +84,7 @@ public class FaultCodeAddReq {
* *
*/ */
@Schema(name = "报文所属类别") @Schema(name = "报文所属类别")
private String messageTypeBelongs; private String messageTypeBeLongs;
} }

View File

@ -34,12 +34,12 @@ public class FaultCodeUpdReq {
*/ */
@TableId(value = "faultcode_id", type = IdType.AUTO) @TableId(value = "faultcode_id", type = IdType.AUTO)
@Schema(title = "故障码Id") @Schema(title = "故障码Id")
private long faultcodeId; private Long faultcodeId;
/** /**
*Id *Id
*/ */
@Schema(name = "故障名称Id") @Schema(name = "故障名称Id")
private long messageTypeId; private Long messageTypeId;
/** /**
* *
*/ */
@ -59,7 +59,7 @@ public class FaultCodeUpdReq {
* Id * Id
*/ */
@Schema(name = "故障分类Id") @Schema(name = "故障分类Id")
private long faulttypeId; private Long faulttypeId;
/** /**
* *
*/ */
@ -94,7 +94,7 @@ public class FaultCodeUpdReq {
* *
*/ */
@Schema(name = "报文所属类别") @Schema(name = "报文所属类别")
private String messageTypeBelongs; private String messageTypeBeLongs;

View File

@ -35,17 +35,17 @@ public class FaultConditionAddReq {
*/ */
@TableId(value = "id", type = IdType.AUTO) @TableId(value = "id", type = IdType.AUTO)
@Schema(title = "故障规则表Id") @Schema(title = "故障规则表Id")
private long carconditionId; private Long carconditionId;
/** /**
* Id * Id
*/ */
@Schema(name = "车辆类型Id") @Schema(name = "车辆类型Id")
private long carTypeId; private Long carTypeId;
/** /**
*Id *Id
*/ */
@Schema(name = "故障名称Id") @Schema(name = "故障名称Id")
private long messageTypeId; private Long messageTypeId;
/** /**
* *
*/ */

View File

@ -35,12 +35,12 @@ public class FaultConditionListReq {
*/ */
@TableId(value = "car_type_id", type = IdType.INPUT) @TableId(value = "car_type_id", type = IdType.INPUT)
@Schema (description = "车辆类型Id") @Schema (description = "车辆类型Id")
private long carTypeId; private Long carTypeId;
/** /**
*Id *Id
*/ */
@Schema(name = "故障名称Id") @Schema(name = "故障名称Id")
private long messageTypeId; private Long messageTypeId;
/** /**
* 1 * 1
*/ */

View File

@ -35,17 +35,17 @@ public class FaultConditionUpdReq {
*/ */
@TableId(value = "carcondition_id", type = IdType.ASSIGN_ID) @TableId(value = "carcondition_id", type = IdType.ASSIGN_ID)
@Schema(name = "故障规则表Id") @Schema(name = "故障规则表Id")
private long carconditionId; private Long carconditionId;
/** /**
* Id * Id
*/ */
@Schema(name = "车辆类型Id") @Schema(name = "车辆类型Id")
private long carTypeId; private Long carTypeId;
/** /**
*Id *Id
*/ */
@Schema(name = "故障名称Id") @Schema(name = "故障名称Id")
private long messageTypeId; private Long messageTypeId;
/** /**
* *
*/ */

View File

@ -37,7 +37,7 @@ public class FaultLogListReq {
*/ */
@TableId(value = "type", type = IdType.AUTO) @TableId(value = "type", type = IdType.AUTO)
@Schema(description = "故障码Id",example = "1") @Schema(description = "故障码Id",example = "1")
private long faultcodeId; private Long faultcodeId;
/** /**
* VIN * VIN
*/ */

View File

@ -33,12 +33,12 @@ public class FaultCodeListResp {
*/ */
@TableId(value = "faultcode_id", type = IdType.AUTO) @TableId(value = "faultcode_id", type = IdType.AUTO)
@Schema(description = "故障码Id",example = "1") @Schema(description = "故障码Id",example = "1")
private long faultcodeId; private Long faultcodeId;
/** /**
*Id *Id
*/ */
@Schema(description = "故障名称Id",example = "1") @Schema(description = "故障名称Id",example = "1")
private long messageTypeId; private Long messageTypeId;
/** /**
* *
*/ */
@ -83,7 +83,7 @@ public class FaultCodeListResp {
* *
*/ */
@Schema(description = "报文所属类别",example = "1") @Schema(description = "报文所属类别",example = "1")
private String messageTypeBelongs; private String messageTypeBeLongs;
/** /**
* *
@ -102,7 +102,7 @@ public class FaultCodeListResp {
.faulttypeName(faultCodeVO.getFaulttypeName()) .faulttypeName(faultCodeVO.getFaulttypeName())
.messageTypeName(faultCodeVO.getMessageTypeName()) .messageTypeName(faultCodeVO.getMessageTypeName())
.messageTypeCode(faultCodeVO.getMessageTypeCode()) .messageTypeCode(faultCodeVO.getMessageTypeCode())
.messageTypeBelongs(faultCodeVO.getMessageTypeBelongs()) .messageTypeBeLongs(faultCodeVO.getMessageTypeBeLongs())
.build(); .build();
} }
} }

View File

@ -35,9 +35,9 @@ public class FaultCodeTotalListResp {
* *
*/ */
@Schema(name = "总数") @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 faultCodeTotalListResp = new FaultCodeTotalListResp();
faultCodeTotalListResp.setFaultCodeListRespList(faultCodeListRespList); faultCodeTotalListResp.setFaultCodeListRespList(faultCodeListRespList);
faultCodeTotalListResp.setTotal(total); faultCodeTotalListResp.setTotal(total);

View File

@ -37,17 +37,17 @@ public class FaultConditionListResp {
*/ */
@TableId(value = "carcondition_id",type = IdType.AUTO) @TableId(value = "carcondition_id",type = IdType.AUTO)
@Schema(description = "故障规则表Id") @Schema(description = "故障规则表Id")
private long carconditionId; private Long carconditionId;
/** /**
* Id * Id
*/ */
@Schema(description = "车辆类型Id") @Schema(description = "车辆类型Id")
private long carTypeId; private Long carTypeId;
/** /**
*Id *Id
*/ */
@Schema(description = "故障名称Id") @Schema(description = "故障名称Id")
private long messageTypeId; private Long messageTypeId;
/** /**
* *
*/ */

View File

@ -33,9 +33,9 @@ public class FaultConditionTotalListResp {
private List<FaultConditionListResp> faultConditionListRespList; private List<FaultConditionListResp> faultConditionListRespList;
@Schema(description = "故障规则数据总数") @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 faultConditionTotalListResp = new FaultConditionTotalListResp();
faultConditionTotalListResp.setFaultConditionListRespList(faultConditionListRespList); faultConditionTotalListResp.setFaultConditionListRespList(faultConditionListRespList);
faultConditionTotalListResp.setTotal(total); faultConditionTotalListResp.setTotal(total);

View File

@ -39,17 +39,17 @@ public class FaultLogListResp {
*/ */
@TableId(value = "log_id",type = IdType.AUTO) @TableId(value = "log_id",type = IdType.AUTO)
@Schema(description = "故障日志Id",example = "1") @Schema(description = "故障日志Id",example = "1")
private long logId; private Long logId;
/** /**
* Id * Id
*/ */
@Schema(name = "故障码Id") @Schema(name = "故障码Id")
private long faultcodeId; private Long faultcodeId;
/** /**
* Id * Id
*/ */
@Schema(name = "车辆Id") @Schema(name = "车辆Id")
private long carInformationId; private Long carInformationId;
/** /**
* VIN * VIN
*/ */

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