Compare commits
17 Commits
Author | SHA1 | Date |
---|---|---|
|
c0fc641a36 | |
|
be878ef01a | |
|
ea9876fed9 | |
|
f33be9fbcc | |
|
42ede316cb | |
|
7379139e25 | |
|
5a003b84bf | |
|
e445fd5d26 | |
|
e58f2a2cf1 | |
|
b80d833bea | |
|
18914f5b70 | |
|
a5d1d43a03 | |
|
b75b28fce1 | |
|
a2783ec36e | |
|
98e86b9a92 | |
|
b828dc2f61 | |
|
c534086e82 |
|
@ -77,7 +77,7 @@ public class SysLoginService {
|
||||||
}
|
}
|
||||||
|
|
||||||
LoginUser userInfo = userResult.getData();
|
LoginUser userInfo = userResult.getData();
|
||||||
SysUser user = userResult.getData().getSysUser();
|
SysUser user = userInfo.getSysUser();
|
||||||
if (UserStatus.DELETED.getCode().equals(user.getDelFlag())) {
|
if (UserStatus.DELETED.getCode().equals(user.getDelFlag())) {
|
||||||
recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "对不起,您的账号已被删除");
|
recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "对不起,您的账号已被删除");
|
||||||
throw new ServiceException("对不起,您的账号:" + username + " 已被删除");
|
throw new ServiceException("对不起,您的账号:" + username + " 已被删除");
|
||||||
|
|
|
@ -21,9 +21,9 @@ public class SysPasswordService {
|
||||||
@Autowired
|
@Autowired
|
||||||
private RedisService redisService;
|
private RedisService redisService;
|
||||||
|
|
||||||
private int maxRetryCount = CacheConstants.PASSWORD_MAX_RETRY_COUNT;
|
private final int maxRetryCount = CacheConstants.PASSWORD_MAX_RETRY_COUNT;
|
||||||
|
|
||||||
private Long lockTime = CacheConstants.PASSWORD_LOCK_TIME;
|
private final Long lockTime = CacheConstants.PASSWORD_LOCK_TIME;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private SysRecordLogService recordLogService;
|
private SysRecordLogService recordLogService;
|
||||||
|
|
|
@ -21,134 +21,134 @@ public @interface Excel {
|
||||||
/**
|
/**
|
||||||
* 导出时在excel中排序
|
* 导出时在excel中排序
|
||||||
*/
|
*/
|
||||||
public int sort () default Integer.MAX_VALUE;
|
int sort() default Integer.MAX_VALUE;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 导出到Excel中的名字.
|
* 导出到Excel中的名字.
|
||||||
*/
|
*/
|
||||||
public String name () default "";
|
String name() default "";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 日期格式, 如: yyyy-MM-dd
|
* 日期格式, 如: yyyy-MM-dd
|
||||||
*/
|
*/
|
||||||
public String dateFormat () default "";
|
String dateFormat() default "";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 读取内容转表达式 (如: 0=男,1=女,2=未知)
|
* 读取内容转表达式 (如: 0=男,1=女,2=未知)
|
||||||
*/
|
*/
|
||||||
public String readConverterExp () default "";
|
String readConverterExp() default "";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分隔符,读取字符串组内容
|
* 分隔符,读取字符串组内容
|
||||||
*/
|
*/
|
||||||
public String separator () default ",";
|
String separator() default ",";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* BigDecimal 精度 默认:-1(默认不开启BigDecimal格式化)
|
* BigDecimal 精度 默认:-1(默认不开启BigDecimal格式化)
|
||||||
*/
|
*/
|
||||||
public int scale () default -1;
|
int scale() default -1;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* BigDecimal 舍入规则 默认:BigDecimal.ROUND_HALF_EVEN
|
* BigDecimal 舍入规则 默认:BigDecimal.ROUND_HALF_EVEN
|
||||||
*/
|
*/
|
||||||
public int roundingMode () default BigDecimal.ROUND_HALF_EVEN;
|
int roundingMode() default BigDecimal.ROUND_HALF_EVEN;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 导出时在excel中每个列的高度
|
* 导出时在excel中每个列的高度
|
||||||
*/
|
*/
|
||||||
public double height () default 14;
|
double height() default 14;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 导出时在excel中每个列的宽度
|
* 导出时在excel中每个列的宽度
|
||||||
*/
|
*/
|
||||||
public double width () default 16;
|
double width() default 16;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 文字后缀,如% 90 变成90%
|
* 文字后缀,如% 90 变成90%
|
||||||
*/
|
*/
|
||||||
public String suffix () default "";
|
String suffix() default "";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 当值为空时,字段的默认值
|
* 当值为空时,字段的默认值
|
||||||
*/
|
*/
|
||||||
public String defaultValue () default "";
|
String defaultValue() default "";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 提示信息
|
* 提示信息
|
||||||
*/
|
*/
|
||||||
public String prompt () default "";
|
String prompt() default "";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设置只能选择不能输入的列内容.
|
* 设置只能选择不能输入的列内容.
|
||||||
*/
|
*/
|
||||||
public String[] combo () default {};
|
String[] combo() default {};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否需要纵向合并单元格,应对需求:含有list集合单元格)
|
* 是否需要纵向合并单元格,应对需求:含有list集合单元格)
|
||||||
*/
|
*/
|
||||||
public boolean needMerge () default false;
|
boolean needMerge() default false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否导出数据,应对需求:有时我们需要导出一份模板,这是标题需要但内容需要用户手工填写.
|
* 是否导出数据,应对需求:有时我们需要导出一份模板,这是标题需要但内容需要用户手工填写.
|
||||||
*/
|
*/
|
||||||
public boolean isExport () default true;
|
boolean isExport() default true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 另一个类中的属性名称,支持多级获取,以小数点隔开
|
* 另一个类中的属性名称,支持多级获取,以小数点隔开
|
||||||
*/
|
*/
|
||||||
public String targetAttr () default "";
|
String targetAttr() default "";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否自动统计数据,在最后追加一行统计数据总和
|
* 是否自动统计数据,在最后追加一行统计数据总和
|
||||||
*/
|
*/
|
||||||
public boolean isStatistics () default false;
|
boolean isStatistics() default false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 导出类型(0数字 1字符串)
|
* 导出类型(0数字 1字符串)
|
||||||
*/
|
*/
|
||||||
public ColumnType cellType () default ColumnType.STRING;
|
ColumnType cellType() default ColumnType.STRING;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 导出列头背景颜色
|
* 导出列头背景颜色
|
||||||
*/
|
*/
|
||||||
public IndexedColors headerBackgroundColor () default IndexedColors.GREY_50_PERCENT;
|
IndexedColors headerBackgroundColor() default IndexedColors.GREY_50_PERCENT;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 导出列头字体颜色
|
* 导出列头字体颜色
|
||||||
*/
|
*/
|
||||||
public IndexedColors headerColor () default IndexedColors.WHITE;
|
IndexedColors headerColor() default IndexedColors.WHITE;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 导出单元格背景颜色
|
* 导出单元格背景颜色
|
||||||
*/
|
*/
|
||||||
public IndexedColors backgroundColor () default IndexedColors.WHITE;
|
IndexedColors backgroundColor() default IndexedColors.WHITE;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 导出单元格字体颜色
|
* 导出单元格字体颜色
|
||||||
*/
|
*/
|
||||||
public IndexedColors color () default IndexedColors.BLACK;
|
IndexedColors color() default IndexedColors.BLACK;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 导出字段对齐方式
|
* 导出字段对齐方式
|
||||||
*/
|
*/
|
||||||
public HorizontalAlignment align () default HorizontalAlignment.CENTER;
|
HorizontalAlignment align() default HorizontalAlignment.CENTER;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 自定义数据处理器
|
* 自定义数据处理器
|
||||||
*/
|
*/
|
||||||
public Class<?> handler () default ExcelHandlerAdapter.class;
|
Class<?> handler() default ExcelHandlerAdapter.class;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 自定义数据处理器参数
|
* 自定义数据处理器参数
|
||||||
*/
|
*/
|
||||||
public String[] args () default {};
|
String[] args() default {};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 字段类型(0:导出导入;1:仅导出;2:仅导入)
|
* 字段类型(0:导出导入;1:仅导出;2:仅导入)
|
||||||
*/
|
*/
|
||||||
Type type () default Type.ALL;
|
Type type () default Type.ALL;
|
||||||
|
|
||||||
public enum Type {
|
enum Type {
|
||||||
ALL(0), EXPORT(1), IMPORT(2);
|
ALL(0), EXPORT(1), IMPORT(2);
|
||||||
private final int value;
|
private final int value;
|
||||||
|
|
||||||
|
@ -161,7 +161,7 @@ public @interface Excel {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum ColumnType {
|
enum ColumnType {
|
||||||
NUMERIC(0), STRING(1), IMAGE(2);
|
NUMERIC(0), STRING(1), IMAGE(2);
|
||||||
private final int value;
|
private final int value;
|
||||||
|
|
||||||
|
|
|
@ -43,9 +43,9 @@ public class ScheduleConstants {
|
||||||
*/
|
*/
|
||||||
PAUSE("1");
|
PAUSE("1");
|
||||||
|
|
||||||
private String value;
|
private final String value;
|
||||||
|
|
||||||
private Status (String value) {
|
Status(String value) {
|
||||||
this.value = value;
|
this.value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -41,6 +41,10 @@ public class SecurityConstants {
|
||||||
*/
|
*/
|
||||||
public static final String LOGIN_USER = "login_user";
|
public static final String LOGIN_USER = "login_user";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户信息
|
||||||
|
*/
|
||||||
|
public static final String SYS_USER = "sys_user";
|
||||||
/**
|
/**
|
||||||
* 角色权限
|
* 角色权限
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -20,4 +20,7 @@ public class ServiceNameConstants {
|
||||||
* 文件服务的serviceid
|
* 文件服务的serviceid
|
||||||
*/
|
*/
|
||||||
public static final String FILE_SERVICE = "muyu-file";
|
public static final String FILE_SERVICE = "muyu-file";
|
||||||
|
|
||||||
|
// public static final String SYSTEM_BUSINESS = "muyu-business";
|
||||||
|
public static final String DATASOURCE_SERVICE = "muyu-net-working";
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,6 +39,10 @@ public class Result<T> implements Serializable {
|
||||||
|
|
||||||
private T data;
|
private T data;
|
||||||
|
|
||||||
|
public static <T> Result<T> buildCode(int code, String msg, T data){
|
||||||
|
return restResult(data, code, msg);
|
||||||
|
}
|
||||||
|
|
||||||
public static <T> Result<T> success () {
|
public static <T> Result<T> success () {
|
||||||
return restResult(null, SUCCESS, null);
|
return restResult(null, SUCCESS, null);
|
||||||
}
|
}
|
||||||
|
@ -50,7 +54,6 @@ public class Result<T> implements Serializable {
|
||||||
public static <T> Result<T> success (T data, String msg) {
|
public static <T> Result<T> success (T data, String msg) {
|
||||||
return restResult(data, SUCCESS, msg);
|
return restResult(data, SUCCESS, msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static <T> Result<T> error () {
|
public static <T> Result<T> error () {
|
||||||
return restResult(null, FAIL, null);
|
return restResult(null, FAIL, null);
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ package com.muyu.common.core.exception;
|
||||||
*
|
*
|
||||||
* @author muyu
|
* @author muyu
|
||||||
*/
|
*/
|
||||||
public final class ServiceException extends RuntimeException {
|
public class ServiceException extends RuntimeException {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -11,22 +11,22 @@ public class BaseException extends RuntimeException {
|
||||||
/**
|
/**
|
||||||
* 所属模块
|
* 所属模块
|
||||||
*/
|
*/
|
||||||
private String module;
|
private final String module;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 错误码
|
* 错误码
|
||||||
*/
|
*/
|
||||||
private String code;
|
private final String code;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 错误码对应的参数
|
* 错误码对应的参数
|
||||||
*/
|
*/
|
||||||
private Object[] args;
|
private final Object[] args;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 错误消息
|
* 错误消息
|
||||||
*/
|
*/
|
||||||
private String defaultMessage;
|
private final String defaultMessage;
|
||||||
|
|
||||||
public BaseException (String module, String code, Object[] args, String defaultMessage) {
|
public BaseException (String module, String code, Object[] args, String defaultMessage) {
|
||||||
this.module = module;
|
this.module = module;
|
||||||
|
|
|
@ -10,9 +10,9 @@ import java.util.Arrays;
|
||||||
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 final String[] allowedExtension;
|
||||||
private String extension;
|
private final String extension;
|
||||||
private String filename;
|
private final String filename;
|
||||||
|
|
||||||
public InvalidExtensionException (String[] allowedExtension, String extension, String filename) {
|
public InvalidExtensionException (String[] allowedExtension, String extension, String filename) {
|
||||||
super("filename : [" + filename + "], extension : [" + extension + "], allowed extension : [" + Arrays.toString(allowedExtension) + "]");
|
super("filename : [" + filename + "], extension : [" + extension + "], allowed extension : [" + Arrays.toString(allowedExtension) + "]");
|
||||||
|
|
|
@ -8,7 +8,7 @@ package com.muyu.common.core.exception.job;
|
||||||
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 final Code code;
|
||||||
|
|
||||||
public TaskException (String msg, Code code) {
|
public TaskException (String msg, Code code) {
|
||||||
this(msg, code, null);
|
this(msg, code, null);
|
||||||
|
|
|
@ -27,11 +27,11 @@ public class CharsetKit {
|
||||||
/**
|
/**
|
||||||
* ISO-8859-1
|
* ISO-8859-1
|
||||||
*/
|
*/
|
||||||
public static final Charset CHARSET_ISO_8859_1 = Charset.forName(ISO_8859_1);
|
public static final Charset CHARSET_ISO_8859_1 = StandardCharsets.ISO_8859_1;
|
||||||
/**
|
/**
|
||||||
* UTF-8
|
* UTF-8
|
||||||
*/
|
*/
|
||||||
public static final Charset CHARSET_UTF_8 = Charset.forName(UTF_8);
|
public static final Charset CHARSET_UTF_8 = StandardCharsets.UTF_8;
|
||||||
/**
|
/**
|
||||||
* GBK
|
* GBK
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -24,7 +24,7 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
|
||||||
|
|
||||||
public static String YYYY_MM_DD_HH_MM_SS = "yyyy-MM-dd HH:mm:ss";
|
public static String YYYY_MM_DD_HH_MM_SS = "yyyy-MM-dd HH:mm:ss";
|
||||||
|
|
||||||
private static String[] parsePatterns = {
|
private static final String[] parsePatterns = {
|
||||||
"yyyy-MM-dd", "yyyy-MM-dd HH:mm:ss", "yyyy-MM-dd HH:mm", "yyyy-MM",
|
"yyyy-MM-dd", "yyyy-MM-dd HH:mm:ss", "yyyy-MM-dd HH:mm", "yyyy-MM",
|
||||||
"yyyy/MM/dd", "yyyy/MM/dd HH:mm:ss", "yyyy/MM/dd HH:mm", "yyyy/MM",
|
"yyyy/MM/dd", "yyyy/MM/dd HH:mm:ss", "yyyy/MM/dd HH:mm", "yyyy/MM",
|
||||||
"yyyy.MM.dd", "yyyy.MM.dd HH:mm:ss", "yyyy.MM.dd HH:mm", "yyyy.MM"};
|
"yyyy.MM.dd", "yyyy.MM.dd HH:mm:ss", "yyyy.MM.dd HH:mm", "yyyy.MM"};
|
||||||
|
|
|
@ -23,6 +23,7 @@ import java.io.IOException;
|
||||||
import java.io.UnsupportedEncodingException;
|
import java.io.UnsupportedEncodingException;
|
||||||
import java.net.URLDecoder;
|
import java.net.URLDecoder;
|
||||||
import java.net.URLEncoder;
|
import java.net.URLEncoder;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Enumeration;
|
import java.util.Enumeration;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
@ -212,11 +213,7 @@ public class ServletUtils {
|
||||||
* @return 编码后的内容
|
* @return 编码后的内容
|
||||||
*/
|
*/
|
||||||
public static String urlEncode (String str) {
|
public static String urlEncode (String str) {
|
||||||
try {
|
return URLEncoder.encode(str, StandardCharsets.UTF_8);
|
||||||
return URLEncoder.encode(str, Constants.UTF8);
|
|
||||||
} catch (UnsupportedEncodingException e) {
|
|
||||||
return StringUtils.EMPTY;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -227,11 +224,7 @@ public class ServletUtils {
|
||||||
* @return 解码后的内容
|
* @return 解码后的内容
|
||||||
*/
|
*/
|
||||||
public static String urlDecode (String str) {
|
public static String urlDecode (String str) {
|
||||||
try {
|
return URLDecoder.decode(str, StandardCharsets.UTF_8);
|
||||||
return URLDecoder.decode(str, Constants.UTF8);
|
|
||||||
} catch (UnsupportedEncodingException e) {
|
|
||||||
return StringUtils.EMPTY;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -43,7 +43,7 @@ public final class SpringUtils implements BeanFactoryPostProcessor {
|
||||||
* @throws org.springframework.beans.BeansException
|
* @throws org.springframework.beans.BeansException
|
||||||
*/
|
*/
|
||||||
public static <T> T getBean (Class<T> clz) throws BeansException {
|
public static <T> T getBean (Class<T> clz) throws BeansException {
|
||||||
T result = (T) beanFactory.getBean(clz);
|
T result = beanFactory.getBean(clz);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -125,17 +125,17 @@ public class FileUtils {
|
||||||
String filename = fileName;
|
String filename = fileName;
|
||||||
if (agent.contains("MSIE")) {
|
if (agent.contains("MSIE")) {
|
||||||
// IE浏览器
|
// IE浏览器
|
||||||
filename = URLEncoder.encode(filename, "utf-8");
|
filename = URLEncoder.encode(filename, StandardCharsets.UTF_8);
|
||||||
filename = filename.replace("+", " ");
|
filename = filename.replace("+", " ");
|
||||||
} else if (agent.contains("Firefox")) {
|
} else if (agent.contains("Firefox")) {
|
||||||
// 火狐浏览器
|
// 火狐浏览器
|
||||||
filename = new String(fileName.getBytes(), "ISO8859-1");
|
filename = new String(fileName.getBytes(), "ISO8859-1");
|
||||||
} else if (agent.contains("Chrome")) {
|
} else if (agent.contains("Chrome")) {
|
||||||
// google浏览器
|
// google浏览器
|
||||||
filename = URLEncoder.encode(filename, "utf-8");
|
filename = URLEncoder.encode(filename, StandardCharsets.UTF_8);
|
||||||
} else {
|
} else {
|
||||||
// 其它浏览器
|
// 其它浏览器
|
||||||
filename = URLEncoder.encode(filename, "utf-8");
|
filename = URLEncoder.encode(filename, StandardCharsets.UTF_8);
|
||||||
}
|
}
|
||||||
return filename;
|
return filename;
|
||||||
}
|
}
|
||||||
|
@ -197,15 +197,14 @@ public class FileUtils {
|
||||||
public static void setAttachmentResponseHeader (HttpServletResponse response, String realFileName) throws UnsupportedEncodingException {
|
public static void setAttachmentResponseHeader (HttpServletResponse response, String realFileName) throws UnsupportedEncodingException {
|
||||||
String percentEncodedFileName = percentEncode(realFileName);
|
String percentEncodedFileName = percentEncode(realFileName);
|
||||||
|
|
||||||
StringBuilder contentDispositionValue = new StringBuilder();
|
String contentDispositionValue = "attachment; filename=" +
|
||||||
contentDispositionValue.append("attachment; filename=")
|
percentEncodedFileName +
|
||||||
.append(percentEncodedFileName)
|
";" +
|
||||||
.append(";")
|
"filename*=" +
|
||||||
.append("filename*=")
|
"utf-8''" +
|
||||||
.append("utf-8''")
|
percentEncodedFileName;
|
||||||
.append(percentEncodedFileName);
|
|
||||||
|
|
||||||
response.setHeader("Content-disposition", contentDispositionValue.toString());
|
response.setHeader("Content-disposition", contentDispositionValue);
|
||||||
response.setHeader("download-filename", percentEncodedFileName);
|
response.setHeader("download-filename", percentEncodedFileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -217,7 +216,7 @@ public class FileUtils {
|
||||||
* @return 百分号编码后的字符串
|
* @return 百分号编码后的字符串
|
||||||
*/
|
*/
|
||||||
public static String percentEncode (String s) throws UnsupportedEncodingException {
|
public static String percentEncode (String s) throws UnsupportedEncodingException {
|
||||||
String encode = URLEncoder.encode(s, StandardCharsets.UTF_8.toString());
|
String encode = URLEncoder.encode(s, StandardCharsets.UTF_8);
|
||||||
return encode.replaceAll("\\+", "%20");
|
return encode.replaceAll("\\+", "%20");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -124,7 +124,7 @@ public class EscapeUtil {
|
||||||
tmp.append(content.substring(lastPos));
|
tmp.append(content.substring(lastPos));
|
||||||
lastPos = content.length();
|
lastPos = content.length();
|
||||||
} else {
|
} else {
|
||||||
tmp.append(content.substring(lastPos, pos));
|
tmp.append(content, lastPos, pos);
|
||||||
lastPos = pos;
|
lastPos = pos;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -225,7 +225,7 @@ public class IpUtils {
|
||||||
if (ip != null && ip.indexOf(",") > 0) {
|
if (ip != null && ip.indexOf(",") > 0) {
|
||||||
final String[] ips = ip.trim().split(",");
|
final String[] ips = ip.trim().split(",");
|
||||||
for (String subIp : ips) {
|
for (String subIp : ips) {
|
||||||
if (false == isUnknown(subIp)) {
|
if (!isUnknown(subIp)) {
|
||||||
ip = subIp;
|
ip = subIp;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -121,7 +121,7 @@ public class ExcelUtil<T> {
|
||||||
/**
|
/**
|
||||||
* 统计列表
|
* 统计列表
|
||||||
*/
|
*/
|
||||||
private Map<Integer, Double> statistics = new HashMap<Integer, Double>();
|
private final Map<Integer, Double> statistics = new HashMap<Integer, Double>();
|
||||||
|
|
||||||
public ExcelUtil (Class<T> clazz) {
|
public ExcelUtil (Class<T> clazz) {
|
||||||
this.clazz = clazz;
|
this.clazz = clazz;
|
||||||
|
@ -531,7 +531,7 @@ public class ExcelUtil<T> {
|
||||||
rowNo = isSubList() ? (i > 1 ? rowNo + 1 : rowNo + i) : i + 1 + rownum - startNo;
|
rowNo = isSubList() ? (i > 1 ? rowNo + 1 : rowNo + i) : i + 1 + rownum - startNo;
|
||||||
row = sheet.createRow(rowNo);
|
row = sheet.createRow(rowNo);
|
||||||
// 得到导出对象.
|
// 得到导出对象.
|
||||||
T vo = (T) list.get(i);
|
T vo = list.get(i);
|
||||||
Collection<?> subList = null;
|
Collection<?> subList = null;
|
||||||
if (isSubList()) {
|
if (isSubList()) {
|
||||||
if (isSubListValue(vo)) {
|
if (isSubListValue(vo)) {
|
||||||
|
@ -913,7 +913,7 @@ public class ExcelUtil<T> {
|
||||||
public String dataFormatHandlerAdapter (Object value, Excel excel, Cell cell) {
|
public String dataFormatHandlerAdapter (Object value, Excel excel, Cell cell) {
|
||||||
try {
|
try {
|
||||||
Object instance = excel.handler().newInstance();
|
Object instance = excel.handler().newInstance();
|
||||||
Method formatMethod = excel.handler().getMethod("format", new Class[]{Object.class, String[].class, Cell.class, Workbook.class});
|
Method formatMethod = excel.handler().getMethod("format", Object.class, String[].class, Cell.class, Workbook.class);
|
||||||
value = formatMethod.invoke(instance, value, excel.args(), cell, this.wb);
|
value = formatMethod.invoke(instance, value, excel.args(), cell, this.wb);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("不能格式化数据 " + excel.handler(), e.getMessage());
|
log.error("不能格式化数据 " + excel.handler(), e.getMessage());
|
||||||
|
@ -1200,7 +1200,7 @@ public class ExcelUtil<T> {
|
||||||
public Collection<?> getListCellValue (Object obj) {
|
public Collection<?> getListCellValue (Object obj) {
|
||||||
Object value;
|
Object value;
|
||||||
try {
|
try {
|
||||||
value = subMethod.invoke(obj, new Object[]{});
|
value = subMethod.invoke(obj);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return new ArrayList<Object>();
|
return new ArrayList<Object>();
|
||||||
}
|
}
|
||||||
|
@ -1221,7 +1221,7 @@ public class ExcelUtil<T> {
|
||||||
getMethodName.append(name.substring(1));
|
getMethodName.append(name.substring(1));
|
||||||
Method method = null;
|
Method method = null;
|
||||||
try {
|
try {
|
||||||
method = pojoClass.getMethod(getMethodName.toString(), new Class[]{});
|
method = pojoClass.getMethod(getMethodName.toString());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("获取对象异常{}", e.getMessage());
|
log.error("获取对象异常{}", e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,7 @@ public class ReflectUtils {
|
||||||
|
|
||||||
private static final String CGLIB_CLASS_SEPARATOR = "$$";
|
private static final String CGLIB_CLASS_SEPARATOR = "$$";
|
||||||
|
|
||||||
private static Logger logger = LoggerFactory.getLogger(ReflectUtils.class);
|
private static final Logger logger = LoggerFactory.getLogger(ReflectUtils.class);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 调用Getter方法.
|
* 调用Getter方法.
|
||||||
|
@ -113,7 +113,7 @@ public class ReflectUtils {
|
||||||
try {
|
try {
|
||||||
return (E) method.invoke(obj, args);
|
return (E) method.invoke(obj, args);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
String msg = "method: " + method + ", obj: " + obj + ", args: " + args + "";
|
String msg = "method: " + method + ", obj: " + obj + ", args: " + args;
|
||||||
throw convertReflectionExceptionToUnchecked(msg, e);
|
throw convertReflectionExceptionToUnchecked(msg, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -162,7 +162,7 @@ public class ReflectUtils {
|
||||||
}
|
}
|
||||||
return (E) method.invoke(obj, args);
|
return (E) method.invoke(obj, args);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
String msg = "method: " + method + ", obj: " + obj + ", args: " + args + "";
|
String msg = "method: " + method + ", obj: " + obj + ", args: " + args;
|
||||||
throw convertReflectionExceptionToUnchecked(msg, e);
|
throw convertReflectionExceptionToUnchecked(msg, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,8 +46,8 @@ public final class Base64 {
|
||||||
for (int i = 52, j = 0 ; i <= 61 ; i++, j++) {
|
for (int i = 52, j = 0 ; i <= 61 ; i++, j++) {
|
||||||
lookUpBase64Alphabet[i] = (char) ('0' + j);
|
lookUpBase64Alphabet[i] = (char) ('0' + j);
|
||||||
}
|
}
|
||||||
lookUpBase64Alphabet[62] = (char) '+';
|
lookUpBase64Alphabet[62] = '+';
|
||||||
lookUpBase64Alphabet[63] = (char) '/';
|
lookUpBase64Alphabet[63] = '/';
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean isWhiteSpace (char octect) {
|
private static boolean isWhiteSpace (char octect) {
|
||||||
|
@ -82,7 +82,7 @@ public final class Base64 {
|
||||||
int fewerThan24bits = lengthDataBits % TWENTYFOURBITGROUP;
|
int fewerThan24bits = lengthDataBits % TWENTYFOURBITGROUP;
|
||||||
int numberTriplets = lengthDataBits / TWENTYFOURBITGROUP;
|
int numberTriplets = lengthDataBits / TWENTYFOURBITGROUP;
|
||||||
int numberQuartet = fewerThan24bits != 0 ? numberTriplets + 1 : numberTriplets;
|
int numberQuartet = fewerThan24bits != 0 ? numberTriplets + 1 : numberTriplets;
|
||||||
char encodedData[] = null;
|
char[] encodedData = null;
|
||||||
|
|
||||||
encodedData = new char[numberQuartet * 4];
|
encodedData = new char[numberQuartet * 4];
|
||||||
|
|
||||||
|
@ -161,7 +161,7 @@ public final class Base64 {
|
||||||
return new byte[0];
|
return new byte[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
byte decodedData[] = null;
|
byte[] decodedData = null;
|
||||||
byte b1 = 0, b2 = 0, b3 = 0, b4 = 0;
|
byte b1 = 0, b2 = 0, b3 = 0, b4 = 0;
|
||||||
char d1 = 0, d2 = 0, d3 = 0, d4 = 0;
|
char d1 = 0, d2 = 0, d3 = 0, d4 = 0;
|
||||||
|
|
||||||
|
|
|
@ -17,9 +17,9 @@ public class Seq {
|
||||||
// 机器标识
|
// 机器标识
|
||||||
private static final String machineCode = "A";
|
private static final String machineCode = "A";
|
||||||
// 通用接口序列数
|
// 通用接口序列数
|
||||||
private static AtomicInteger commSeq = new AtomicInteger(1);
|
private static final AtomicInteger commSeq = new AtomicInteger(1);
|
||||||
// 上传接口序列数
|
// 上传接口序列数
|
||||||
private static AtomicInteger uploadSeq = new AtomicInteger(1);
|
private static final AtomicInteger uploadSeq = new AtomicInteger(1);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取通用序列号
|
* 获取通用序列号
|
||||||
|
|
|
@ -353,22 +353,22 @@ public final class UUID implements java.io.Serializable, Comparable<UUID> {
|
||||||
final StringBuilder builder = new StringBuilder(isSimple ? 32 : 36);
|
final StringBuilder builder = new StringBuilder(isSimple ? 32 : 36);
|
||||||
// time_low
|
// time_low
|
||||||
builder.append(digits(mostSigBits >> 32, 8));
|
builder.append(digits(mostSigBits >> 32, 8));
|
||||||
if (false == isSimple) {
|
if (!isSimple) {
|
||||||
builder.append('-');
|
builder.append('-');
|
||||||
}
|
}
|
||||||
// time_mid
|
// time_mid
|
||||||
builder.append(digits(mostSigBits >> 16, 4));
|
builder.append(digits(mostSigBits >> 16, 4));
|
||||||
if (false == isSimple) {
|
if (!isSimple) {
|
||||||
builder.append('-');
|
builder.append('-');
|
||||||
}
|
}
|
||||||
// time_high_and_version
|
// time_high_and_version
|
||||||
builder.append(digits(mostSigBits, 4));
|
builder.append(digits(mostSigBits, 4));
|
||||||
if (false == isSimple) {
|
if (!isSimple) {
|
||||||
builder.append('-');
|
builder.append('-');
|
||||||
}
|
}
|
||||||
// variant_and_sequence
|
// variant_and_sequence
|
||||||
builder.append(digits(leastSigBits >> 48, 4));
|
builder.append(digits(leastSigBits >> 48, 4));
|
||||||
if (false == isSimple) {
|
if (!isSimple) {
|
||||||
builder.append('-');
|
builder.append('-');
|
||||||
}
|
}
|
||||||
// node
|
// node
|
||||||
|
|
|
@ -14,15 +14,15 @@ public @interface DataScope {
|
||||||
/**
|
/**
|
||||||
* 部门表的别名
|
* 部门表的别名
|
||||||
*/
|
*/
|
||||||
public String deptAlias () default "";
|
String deptAlias() default "";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户表的别名
|
* 用户表的别名
|
||||||
*/
|
*/
|
||||||
public String userAlias () default "";
|
String userAlias() default "";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 权限字符(用于多个角色匹配符合要求的权限)默认根据权限注解@RequiresPermissions获取,多个权限用逗号分隔开来
|
* 权限字符(用于多个角色匹配符合要求的权限)默认根据权限注解@RequiresPermissions获取,多个权限用逗号分隔开来
|
||||||
*/
|
*/
|
||||||
public String permission () default "";
|
String permission() default "";
|
||||||
}
|
}
|
||||||
|
|
|
@ -109,8 +109,7 @@ public class DataScopeAspect {
|
||||||
|
|
||||||
if (StringUtils.isNotBlank(sqlString.toString())) {
|
if (StringUtils.isNotBlank(sqlString.toString())) {
|
||||||
Object params = joinPoint.getArgs()[0];
|
Object params = joinPoint.getArgs()[0];
|
||||||
if (StringUtils.isNotNull(params) && params instanceof BaseEntity) {
|
if (StringUtils.isNotNull(params) && params instanceof BaseEntity baseEntity) {
|
||||||
BaseEntity baseEntity = (BaseEntity) params;
|
|
||||||
baseEntity.getParams().put(DATA_SCOPE, " AND (" + sqlString.substring(4) + ")");
|
baseEntity.getParams().put(DATA_SCOPE, " AND (" + sqlString.substring(4) + ")");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -141,8 +140,7 @@ public class DataScopeAspect {
|
||||||
*/
|
*/
|
||||||
private void clearDataScope (final JoinPoint joinPoint) {
|
private void clearDataScope (final JoinPoint joinPoint) {
|
||||||
Object params = joinPoint.getArgs()[0];
|
Object params = joinPoint.getArgs()[0];
|
||||||
if (StringUtils.isNotNull(params) && params instanceof BaseEntity) {
|
if (StringUtils.isNotNull(params) && params instanceof BaseEntity baseEntity) {
|
||||||
BaseEntity baseEntity = (BaseEntity) params;
|
|
||||||
baseEntity.getParams().put(DATA_SCOPE, "");
|
baseEntity.getParams().put(DATA_SCOPE, "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,30 +17,30 @@ public @interface Log {
|
||||||
/**
|
/**
|
||||||
* 模块
|
* 模块
|
||||||
*/
|
*/
|
||||||
public String title () default "";
|
String title() default "";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 功能
|
* 功能
|
||||||
*/
|
*/
|
||||||
public BusinessType businessType () default BusinessType.OTHER;
|
BusinessType businessType() default BusinessType.OTHER;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 操作人类别
|
* 操作人类别
|
||||||
*/
|
*/
|
||||||
public OperatorType operatorType () default OperatorType.MANAGE;
|
OperatorType operatorType() default OperatorType.MANAGE;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否保存请求的参数
|
* 是否保存请求的参数
|
||||||
*/
|
*/
|
||||||
public boolean isSaveRequestData () default true;
|
boolean isSaveRequestData() default true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否保存响应的参数
|
* 是否保存响应的参数
|
||||||
*/
|
*/
|
||||||
public boolean isSaveResponseData () default true;
|
boolean isSaveResponseData() default true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 排除指定的请求参数
|
* 排除指定的请求参数
|
||||||
*/
|
*/
|
||||||
public String[] excludeParamNames () default {};
|
String[] excludeParamNames() default {};
|
||||||
}
|
}
|
||||||
|
|
|
@ -169,12 +169,12 @@ public class LogAspect {
|
||||||
*/
|
*/
|
||||||
private String argsArrayToString (Object[] paramsArray, String[] excludeParamNames) {
|
private String argsArrayToString (Object[] paramsArray, String[] excludeParamNames) {
|
||||||
String params = "";
|
String params = "";
|
||||||
if (paramsArray != null && paramsArray.length > 0) {
|
if (paramsArray != null) {
|
||||||
for (Object o : paramsArray) {
|
for (Object o : paramsArray) {
|
||||||
if (StringUtils.isNotNull(o) && !isFilterObject(o)) {
|
if (StringUtils.isNotNull(o) && !isFilterObject(o)) {
|
||||||
try {
|
try {
|
||||||
String jsonObj = JSON.toJSONString(o, excludePropertyPreFilter(excludeParamNames));
|
String jsonObj = JSON.toJSONString(o, excludePropertyPreFilter(excludeParamNames));
|
||||||
params += jsonObj.toString() + " ";
|
params += jsonObj + " ";
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@ import org.springframework.data.redis.serializer.RedisSerializer;
|
||||||
import org.springframework.data.redis.serializer.SerializationException;
|
import org.springframework.data.redis.serializer.SerializationException;
|
||||||
|
|
||||||
import java.nio.charset.Charset;
|
import java.nio.charset.Charset;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Redis使用FastJson序列化
|
* Redis使用FastJson序列化
|
||||||
|
@ -16,11 +17,11 @@ import java.nio.charset.Charset;
|
||||||
* @author muyu
|
* @author muyu
|
||||||
*/
|
*/
|
||||||
public class FastJson2JsonRedisSerializer<T> implements RedisSerializer<T> {
|
public class FastJson2JsonRedisSerializer<T> implements RedisSerializer<T> {
|
||||||
public static final Charset DEFAULT_CHARSET = Charset.forName("UTF-8");
|
public static final Charset DEFAULT_CHARSET = StandardCharsets.UTF_8;
|
||||||
|
|
||||||
static final Filter AUTO_TYPE_FILTER = JSONReader.autoTypeFilter(Constants.JSON_WHITELIST_STR);
|
static final Filter AUTO_TYPE_FILTER = JSONReader.autoTypeFilter(Constants.JSON_WHITELIST_STR);
|
||||||
|
|
||||||
private Class<T> clazz;
|
private final Class<T> clazz;
|
||||||
|
|
||||||
public FastJson2JsonRedisSerializer (Class<T> clazz) {
|
public FastJson2JsonRedisSerializer (Class<T> clazz) {
|
||||||
super();
|
super();
|
||||||
|
|
|
@ -10,6 +10,7 @@ import com.muyu.common.core.utils.uuid.IdUtils;
|
||||||
import com.muyu.common.redis.service.RedisService;
|
import com.muyu.common.redis.service.RedisService;
|
||||||
import com.muyu.common.security.utils.SecurityUtils;
|
import com.muyu.common.security.utils.SecurityUtils;
|
||||||
import com.muyu.common.system.domain.LoginUser;
|
import com.muyu.common.system.domain.LoginUser;
|
||||||
|
import com.muyu.common.system.domain.SysUser;
|
||||||
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;
|
||||||
|
@ -48,6 +49,7 @@ public class TokenService {
|
||||||
loginUser.setUserid(userId);
|
loginUser.setUserid(userId);
|
||||||
loginUser.setUsername(userName);
|
loginUser.setUsername(userName);
|
||||||
loginUser.setIpaddr(IpUtils.getIpAddr());
|
loginUser.setIpaddr(IpUtils.getIpAddr());
|
||||||
|
SysUser sysUser = loginUser.getSysUser();
|
||||||
refreshToken(loginUser);
|
refreshToken(loginUser);
|
||||||
|
|
||||||
// Jwt存储信息
|
// Jwt存储信息
|
||||||
|
|
|
@ -6,6 +6,7 @@ import com.muyu.common.core.annotation.Excel.Type;
|
||||||
import com.muyu.common.core.annotation.Excels;
|
import com.muyu.common.core.annotation.Excels;
|
||||||
import com.muyu.common.core.web.domain.BaseEntity;
|
import com.muyu.common.core.web.domain.BaseEntity;
|
||||||
import com.muyu.common.core.xss.Xss;
|
import com.muyu.common.core.xss.Xss;
|
||||||
|
//import com.muyu.net.working.domain.Enterprise;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
@ -138,15 +139,19 @@ public class SysUser extends BaseEntity {
|
||||||
private Long roleId;
|
private Long roleId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 登录类型
|
* 企业id
|
||||||
*/
|
|
||||||
private String type;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 企业ID
|
|
||||||
*/
|
*/
|
||||||
private Integer enterpriseId;
|
private Integer enterpriseId;
|
||||||
|
|
||||||
|
|
||||||
|
public Integer getEnterpriseId() {
|
||||||
|
return enterpriseId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEnterpriseId(Integer enterpriseId) {
|
||||||
|
this.enterpriseId = enterpriseId;
|
||||||
|
}
|
||||||
|
|
||||||
public SysUser (Long userId) {
|
public SysUser (Long userId) {
|
||||||
this.userId = userId;
|
this.userId = userId;
|
||||||
}
|
}
|
||||||
|
@ -333,6 +338,8 @@ public class SysUser extends BaseEntity {
|
||||||
.append("updateTime", getUpdateTime())
|
.append("updateTime", getUpdateTime())
|
||||||
.append("remark", getRemark())
|
.append("remark", getRemark())
|
||||||
.append("dept", getDept())
|
.append("dept", getDept())
|
||||||
|
.append("enterpriseId", getEnterpriseId())
|
||||||
|
|
||||||
.toString();
|
.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,5 +25,5 @@ public interface RemoteFileService {
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@PostMapping(value = "/upload", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
|
@PostMapping(value = "/upload", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
|
||||||
public Result<SysFile> upload (@RequestPart(value = "file") MultipartFile file);
|
Result<SysFile> upload(@RequestPart(value = "file") MultipartFile file);
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,7 @@ public interface RemoteLogService {
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@PostMapping("/operlog")
|
@PostMapping("/operlog")
|
||||||
public Result<Boolean> saveLog (@RequestBody SysOperLog sysOperLog, @RequestHeader(SecurityConstants.FROM_SOURCE) String source) throws Exception;
|
Result<Boolean> saveLog(@RequestBody SysOperLog sysOperLog, @RequestHeader(SecurityConstants.FROM_SOURCE) String source) throws Exception;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 保存访问记录
|
* 保存访问记录
|
||||||
|
@ -38,5 +38,5 @@ public interface RemoteLogService {
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@PostMapping("/logininfor")
|
@PostMapping("/logininfor")
|
||||||
public Result<Boolean> saveLogininfor (@RequestBody SysLogininfor sysLogininfor, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
Result<Boolean> saveLogininfor(@RequestBody SysLogininfor sysLogininfor, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,32 @@
|
||||||
|
package com.muyu.common.system.remote;
|
||||||
|
|
||||||
|
import com.muyu.common.core.constant.ServiceNameConstants;
|
||||||
|
import com.muyu.common.core.domain.Result;
|
||||||
|
import com.muyu.common.system.domain.SysDept;
|
||||||
|
import com.muyu.common.system.remote.factory.RemoteSysDeptFactory;
|
||||||
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 远程调用部门接口 RemoteSysDeptService
|
||||||
|
*
|
||||||
|
* @author DeKangLiu
|
||||||
|
* Date 2024/6/7 09:00
|
||||||
|
*/
|
||||||
|
@FeignClient(
|
||||||
|
contextId = "remoteSysDeptService",
|
||||||
|
value = ServiceNameConstants.SYSTEM_SERVICE,
|
||||||
|
fallbackFactory = RemoteSysDeptFactory.class,
|
||||||
|
path = "/dept"
|
||||||
|
)
|
||||||
|
public interface RemoteSysDeptService {
|
||||||
|
@GetMapping("/selectDeptByName")
|
||||||
|
Result<SysDept> selectDeptByName(@RequestParam("name") String name);
|
||||||
|
|
||||||
|
@PostMapping
|
||||||
|
Result add(@Validated @RequestBody SysDept dept);
|
||||||
|
}
|
|
@ -0,0 +1,32 @@
|
||||||
|
package com.muyu.common.system.remote;
|
||||||
|
|
||||||
|
import com.muyu.common.core.constant.ServiceNameConstants;
|
||||||
|
import com.muyu.common.core.domain.Result;
|
||||||
|
import com.muyu.common.system.domain.SysUser;
|
||||||
|
import com.muyu.common.system.remote.factory.RemoteSysUserFactory;
|
||||||
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 远程调用用户 RemoteSysUserService
|
||||||
|
*
|
||||||
|
* @author DeKangLiu
|
||||||
|
* Date 2024/6/7 08:51
|
||||||
|
*/
|
||||||
|
@FeignClient(
|
||||||
|
contextId = "remoteSysUserService",
|
||||||
|
value = ServiceNameConstants.SYSTEM_SERVICE,
|
||||||
|
fallbackFactory = RemoteSysUserFactory.class,
|
||||||
|
path = "/user"
|
||||||
|
)
|
||||||
|
public interface RemoteSysUserService {
|
||||||
|
/**
|
||||||
|
* 新增用户服务
|
||||||
|
* @param user
|
||||||
|
* @return Result
|
||||||
|
*/
|
||||||
|
@PostMapping
|
||||||
|
Result add(@Validated @RequestBody SysUser user);
|
||||||
|
}
|
|
@ -25,7 +25,7 @@ public interface RemoteUserService {
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@GetMapping("/user/info/{username}")
|
@GetMapping("/user/info/{username}")
|
||||||
public Result<LoginUser> getUserInfo (@PathVariable("username") String username, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
Result<LoginUser> getUserInfo(@PathVariable("username") String username, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 注册用户信息
|
* 注册用户信息
|
||||||
|
@ -36,5 +36,5 @@ public interface RemoteUserService {
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@PostMapping("/user/register")
|
@PostMapping("/user/register")
|
||||||
public Result<Boolean> registerUserInfo (@RequestBody SysUser sysUser, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
Result<Boolean> registerUserInfo(@RequestBody SysUser sysUser, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,42 @@
|
||||||
|
package com.muyu.common.system.remote.factory;
|
||||||
|
|
||||||
|
import com.muyu.common.core.domain.Result;
|
||||||
|
import com.muyu.common.system.domain.SysDept;
|
||||||
|
import com.muyu.common.system.remote.RemoteSysDeptService;
|
||||||
|
import lombok.extern.log4j.Log4j2;
|
||||||
|
import org.springframework.cloud.openfeign.FallbackFactory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 远程调用部门熔断器 RemoteSysDeptFactory
|
||||||
|
*
|
||||||
|
* @author DeKangLiu
|
||||||
|
* Date 2024/6/7 09:00
|
||||||
|
*/
|
||||||
|
@Log4j2
|
||||||
|
public class RemoteSysDeptFactory implements FallbackFactory<RemoteSysDeptService> {
|
||||||
|
@Override
|
||||||
|
public RemoteSysDeptService create(Throwable cause) {
|
||||||
|
|
||||||
|
return new RemoteSysDeptService() {
|
||||||
|
/**
|
||||||
|
* 查找部门列表
|
||||||
|
* @param name
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Result<SysDept> selectDeptByName(String name) {
|
||||||
|
return Result.error(cause.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加部门管理
|
||||||
|
* @param dept
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Result add(SysDept dept) {
|
||||||
|
return Result.error(cause.getMessage());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,31 @@
|
||||||
|
package com.muyu.common.system.remote.factory;
|
||||||
|
|
||||||
|
import com.muyu.common.core.domain.Result;
|
||||||
|
import com.muyu.common.system.domain.SysUser;
|
||||||
|
import com.muyu.common.system.remote.RemoteSysUserService;
|
||||||
|
import org.springframework.cloud.openfeign.FallbackFactory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 远程调用用户熔断器 RemoteSysUserFactory
|
||||||
|
*
|
||||||
|
* @author DeKangLiu
|
||||||
|
* Date 2024/6/7 08:54
|
||||||
|
*/
|
||||||
|
public class RemoteSysUserFactory implements FallbackFactory<RemoteSysUserService> {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public RemoteSysUserService create(Throwable cause) {
|
||||||
|
return new RemoteSysUserService() {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增用户服务
|
||||||
|
* @param user
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Result add(SysUser user) {
|
||||||
|
return Result.error(cause.getMessage());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,3 +1,5 @@
|
||||||
com.muyu.common.system.remote.factory.RemoteUserFallbackFactory
|
com.muyu.common.system.remote.factory.RemoteUserFallbackFactory
|
||||||
com.muyu.common.system.remote.factory.RemoteLogFallbackFactory
|
com.muyu.common.system.remote.factory.RemoteLogFallbackFactory
|
||||||
com.muyu.common.system.remote.factory.RemoteFileFallbackFactory
|
com.muyu.common.system.remote.factory.RemoteFileFallbackFactory
|
||||||
|
com.muyu.common.system.remote.factory.RemoteSysDeptFactory
|
||||||
|
com.muyu.common.system.remote.factory.RemoteSysUserFactory
|
||||||
|
|
|
@ -36,7 +36,7 @@ public class BlackListUrlFilter extends AbstractGatewayFilterFactory<BlackListUr
|
||||||
public static class Config {
|
public static class Config {
|
||||||
private List<String> blacklistUrl;
|
private List<String> blacklistUrl;
|
||||||
|
|
||||||
private List<Pattern> blacklistUrlPattern = new ArrayList<>();
|
private final List<Pattern> blacklistUrlPattern = new ArrayList<>();
|
||||||
|
|
||||||
public boolean matchBlacklist (String url) {
|
public boolean matchBlacklist (String url) {
|
||||||
return !blacklistUrlPattern.isEmpty() && blacklistUrlPattern.stream().anyMatch(p -> p.matcher(url).find());
|
return !blacklistUrlPattern.isEmpty() && blacklistUrlPattern.stream().anyMatch(p -> p.matcher(url).find());
|
||||||
|
|
|
@ -34,8 +34,7 @@ public class GatewayExceptionHandler implements ErrorWebExceptionHandler {
|
||||||
|
|
||||||
if (ex instanceof NotFoundException) {
|
if (ex instanceof NotFoundException) {
|
||||||
msg = "服务未找到";
|
msg = "服务未找到";
|
||||||
} else if (ex instanceof ResponseStatusException) {
|
} else if (ex instanceof ResponseStatusException responseStatusException) {
|
||||||
ResponseStatusException responseStatusException = (ResponseStatusException) ex;
|
|
||||||
msg = responseStatusException.getMessage();
|
msg = responseStatusException.getMessage();
|
||||||
} else {
|
} else {
|
||||||
msg = "内部服务器错误";
|
msg = "内部服务器错误";
|
||||||
|
|
|
@ -14,10 +14,10 @@ public interface ValidateCodeService {
|
||||||
/**
|
/**
|
||||||
* 生成验证码
|
* 生成验证码
|
||||||
*/
|
*/
|
||||||
public Result createCaptcha () throws IOException, CaptchaException;
|
Result createCaptcha() throws IOException, CaptchaException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 校验验证码
|
* 校验验证码
|
||||||
*/
|
*/
|
||||||
public void checkCaptcha (String key, String value) throws CaptchaException;
|
void checkCaptcha(String key, String value) throws CaptchaException;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,28 @@
|
||||||
|
package com.muyu.customer.business.domain;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 地图经纬度管理 Atlas
|
||||||
|
*
|
||||||
|
* @author DeKangLiu
|
||||||
|
* Date 2024/6/2 22:35
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@SuperBuilder
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class Atlas {
|
||||||
|
private String Q;
|
||||||
|
|
||||||
|
private String R;
|
||||||
|
|
||||||
|
private String lat;
|
||||||
|
|
||||||
|
private String lng;
|
||||||
|
}
|
|
@ -0,0 +1,52 @@
|
||||||
|
package com.muyu.customer.business.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.muyu.common.core.annotation.Excel;
|
||||||
|
import com.muyu.common.core.web.domain.BaseEntity;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 多数据源对象 DataSource
|
||||||
|
*
|
||||||
|
* @author DeKangLiu
|
||||||
|
* Date 2024/6/22 22:56
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@SuperBuilder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@TableName("datasource")
|
||||||
|
public class DataSource extends BaseEntity {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/** 主键 */
|
||||||
|
@TableId(value = "id",type = IdType.AUTO)
|
||||||
|
@ApiModelProperty(name = "主键", value = "主键")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/** 数据源key */
|
||||||
|
@Excel(name = "数据源key")
|
||||||
|
@ApiModelProperty(name = "数据源key", value = "数据源key")
|
||||||
|
private String enterpriseCode;
|
||||||
|
|
||||||
|
/** 数据源端口 */
|
||||||
|
@Excel(name = "数据源端口")
|
||||||
|
@ApiModelProperty(name = "数据源端口", value = "数据源端口")
|
||||||
|
private Integer port;
|
||||||
|
|
||||||
|
/** 数据源ip */
|
||||||
|
@Excel(name = "数据源ip")
|
||||||
|
@ApiModelProperty(name = "数据源ip", value = "数据源ip")
|
||||||
|
private String ip;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,94 @@
|
||||||
|
package com.muyu.customer.business.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.muyu.customer.business.domain.req.FaultCodeEditReq;
|
||||||
|
import com.muyu.customer.business.domain.req.FaultCodeQueryReq;
|
||||||
|
import com.muyu.customer.business.domain.req.FaultCodeSaveReq;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
import io.swagger.annotations.*;
|
||||||
|
import com.muyu.common.core.annotation.Excel;
|
||||||
|
import com.muyu.common.core.web.domain.BaseEntity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆故障码对象 fault_code
|
||||||
|
*
|
||||||
|
* @author muyu
|
||||||
|
* @date 2024-06-20
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@SuperBuilder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@TableName("fault_code")
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ApiModel(value = "FaultCode", description = "车辆故障码")
|
||||||
|
public class FaultCode extends BaseEntity {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/** 主键 */
|
||||||
|
@TableId(value = "id",type = IdType.AUTO)
|
||||||
|
@ApiModelProperty(name = "主键", value = "主键")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/** 故障码 */
|
||||||
|
@Excel(name = "故障码")
|
||||||
|
@ApiModelProperty(name = "故障码", value = "故障码")
|
||||||
|
private String faultCode;
|
||||||
|
|
||||||
|
/** 故障标签 */
|
||||||
|
@Excel(name = "故障标签")
|
||||||
|
@ApiModelProperty(name = "故障标签", value = "故障标签")
|
||||||
|
private String faultLabel;
|
||||||
|
|
||||||
|
/** 故障位 */
|
||||||
|
@Excel(name = "故障位")
|
||||||
|
@ApiModelProperty(name = "故障位", value = "故障位")
|
||||||
|
private Long faultBit;
|
||||||
|
|
||||||
|
/** 故障值 */
|
||||||
|
@Excel(name = "故障值")
|
||||||
|
@ApiModelProperty(name = "故障值", value = "故障值")
|
||||||
|
private Long faultValue;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询构造器
|
||||||
|
*/
|
||||||
|
public static FaultCode queryBuild( FaultCodeQueryReq faultCodeQueryReq){
|
||||||
|
return FaultCode.builder()
|
||||||
|
.faultCode(faultCodeQueryReq.getFaultCode())
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加构造器
|
||||||
|
*/
|
||||||
|
public static FaultCode saveBuild(FaultCodeSaveReq faultCodeSaveReq){
|
||||||
|
return FaultCode.builder()
|
||||||
|
.faultCode(faultCodeSaveReq.getFaultCode())
|
||||||
|
.faultLabel(faultCodeSaveReq.getFaultLabel())
|
||||||
|
.faultBit(faultCodeSaveReq.getFaultBit())
|
||||||
|
.faultValue(faultCodeSaveReq.getFaultValue())
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改构造器
|
||||||
|
*/
|
||||||
|
public static FaultCode editBuild(Long id, FaultCodeEditReq faultCodeEditReq){
|
||||||
|
return FaultCode.builder()
|
||||||
|
.id(id)
|
||||||
|
.faultCode(faultCodeEditReq.getFaultCode())
|
||||||
|
.faultLabel(faultCodeEditReq.getFaultLabel())
|
||||||
|
.faultBit(faultCodeEditReq.getFaultBit())
|
||||||
|
.faultValue(faultCodeEditReq.getFaultValue())
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,114 @@
|
||||||
|
package com.muyu.customer.business.domain;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
import com.muyu.customer.business.domain.req.FaultRecordSaveReq;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.muyu.customer.business.domain.req.FaultRecordEditReq;
|
||||||
|
import com.muyu.customer.business.domain.req.FaultRecordQueryReq;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
import io.swagger.annotations.*;
|
||||||
|
import com.muyu.common.core.annotation.Excel;
|
||||||
|
import com.muyu.common.core.web.domain.BaseEntity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 故障记录对象 fault_record
|
||||||
|
*
|
||||||
|
* @author muyu
|
||||||
|
* @date 2024-06-20
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@SuperBuilder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@TableName("fault_record")
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ApiModel(value = "FaultRecord", description = "故障记录")
|
||||||
|
public class FaultRecord extends BaseEntity {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/** 主键 */
|
||||||
|
@TableId(value = "id",type = IdType.AUTO)
|
||||||
|
@ApiModelProperty(name = "主键", value = "主键")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/** 故障码 */
|
||||||
|
@Excel(name = "故障码")
|
||||||
|
@ApiModelProperty(name = "故障码", value = "故障码")
|
||||||
|
private String faultCode;
|
||||||
|
|
||||||
|
/** 车辆vin */
|
||||||
|
@Excel(name = "车辆vin")
|
||||||
|
@ApiModelProperty(name = "车辆vin", value = "车辆vin")
|
||||||
|
private String vin;
|
||||||
|
|
||||||
|
/** 故障开始时间 */
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||||
|
@Excel(name = "故障开始时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||||
|
@ApiModelProperty(name = "故障开始时间", value = "故障开始时间")
|
||||||
|
private Date startTime;
|
||||||
|
|
||||||
|
/** 故障结束时间 */
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||||
|
@Excel(name = "故障结束时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||||
|
@ApiModelProperty(name = "故障结束时间", value = "故障结束时间")
|
||||||
|
private Date endTime;
|
||||||
|
|
||||||
|
/** 故障级别 */
|
||||||
|
@Excel(name = "故障级别")
|
||||||
|
@ApiModelProperty(name = "故障级别", value = "故障级别")
|
||||||
|
private String faultLevel;
|
||||||
|
|
||||||
|
/** 故障是否处理 */
|
||||||
|
@Excel(name = "故障是否处理")
|
||||||
|
@ApiModelProperty(name = "故障是否处理", value = "故障是否处理")
|
||||||
|
private String faultHandle;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询构造器
|
||||||
|
*/
|
||||||
|
public static FaultRecord queryBuild( FaultRecordQueryReq faultRecordQueryReq){
|
||||||
|
return FaultRecord.builder()
|
||||||
|
.faultCode(faultRecordQueryReq.getFaultCode())
|
||||||
|
.vin(faultRecordQueryReq.getVin())
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加构造器
|
||||||
|
*/
|
||||||
|
public static FaultRecord saveBuild(FaultRecordSaveReq faultRecordSaveReq){
|
||||||
|
return FaultRecord.builder()
|
||||||
|
.faultCode(faultRecordSaveReq.getFaultCode())
|
||||||
|
.vin(faultRecordSaveReq.getVin())
|
||||||
|
.startTime(faultRecordSaveReq.getStartTime())
|
||||||
|
.endTime(faultRecordSaveReq.getEndTime())
|
||||||
|
.faultLevel(faultRecordSaveReq.getFaultLevel())
|
||||||
|
.faultHandle(faultRecordSaveReq.getFaultHandle())
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改构造器
|
||||||
|
*/
|
||||||
|
public static FaultRecord editBuild(Long id, FaultRecordEditReq faultRecordEditReq){
|
||||||
|
return FaultRecord.builder()
|
||||||
|
.id(id)
|
||||||
|
.faultCode(faultRecordEditReq.getFaultCode())
|
||||||
|
.vin(faultRecordEditReq.getVin())
|
||||||
|
.startTime(faultRecordEditReq.getStartTime())
|
||||||
|
.endTime(faultRecordEditReq.getEndTime())
|
||||||
|
.faultLevel(faultRecordEditReq.getFaultLevel())
|
||||||
|
.faultHandle(faultRecordEditReq.getFaultHandle())
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,89 @@
|
||||||
|
package com.muyu.customer.business.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.muyu.customer.business.domain.req.FenceEditReq;
|
||||||
|
import com.muyu.customer.business.domain.req.FenceQueryReq;
|
||||||
|
import com.muyu.customer.business.domain.req.FenceSaveReq;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
import io.swagger.annotations.*;
|
||||||
|
import com.muyu.common.core.annotation.Excel;
|
||||||
|
import com.muyu.common.core.web.domain.BaseEntity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电子围栏对象 fence
|
||||||
|
*
|
||||||
|
* @author muyu
|
||||||
|
* @date 2024-05-31
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@SuperBuilder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@TableName("fence")
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ApiModel(value = "Fence", description = "电子围栏")
|
||||||
|
public class Fence extends BaseEntity {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/** id */
|
||||||
|
@TableId(value = "id",type = IdType.AUTO)
|
||||||
|
@ApiModelProperty(name = "id", value = "id")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/** 电子围栏名称 */
|
||||||
|
@Excel(name = "电子围栏名称")
|
||||||
|
@ApiModelProperty(name = "电子围栏名称", value = "电子围栏名称")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/** 围栏类型 */
|
||||||
|
@Excel(name = "围栏类型")
|
||||||
|
@ApiModelProperty(name = "围栏类型", value = "围栏类型")
|
||||||
|
private String fenceType;
|
||||||
|
|
||||||
|
/** 经纬度信息 */
|
||||||
|
@Excel(name = "经纬度信息")
|
||||||
|
@ApiModelProperty(name = "经纬度信息", value = "经纬度信息")
|
||||||
|
private String longitudeAndLatitude;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询构造器
|
||||||
|
*/
|
||||||
|
public static Fence queryBuild( FenceQueryReq fenceQueryReq){
|
||||||
|
return Fence.builder()
|
||||||
|
.name(fenceQueryReq.getName())
|
||||||
|
.fenceType(fenceQueryReq.getFenceType())
|
||||||
|
.longitudeAndLatitude(fenceQueryReq.getLongitudeAndLatitude())
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加构造器
|
||||||
|
*/
|
||||||
|
public static Fence saveBuild(FenceSaveReq fenceSaveReq){
|
||||||
|
return Fence.builder()
|
||||||
|
.name(fenceSaveReq.getName())
|
||||||
|
.fenceType(fenceSaveReq.getFenceType())
|
||||||
|
.longitudeAndLatitude(fenceSaveReq.getLongitudeAndLatitude())
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改构造器
|
||||||
|
*/
|
||||||
|
public static Fence editBuild(Long id, FenceEditReq fenceEditReq){
|
||||||
|
return Fence.builder()
|
||||||
|
.id(id)
|
||||||
|
.name(fenceEditReq.getName())
|
||||||
|
.fenceType(fenceEditReq.getFenceType())
|
||||||
|
.longitudeAndLatitude(fenceEditReq.getLongitudeAndLatitude())
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,108 @@
|
||||||
|
package com.muyu.customer.business.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
|
||||||
|
import com.muyu.common.core.annotation.Excel;
|
||||||
|
import com.muyu.customer.business.domain.req.IndexConfigurationEditReq;
|
||||||
|
import com.muyu.customer.business.domain.req.IndexConfigurationQueryReq;
|
||||||
|
import com.muyu.customer.business.domain.req.IndexConfigurationSaveReq;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
import io.swagger.annotations.*;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆指标预警配置对象 index_configuration
|
||||||
|
*
|
||||||
|
* @author muyu
|
||||||
|
* @date 2024-06-28
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@SuperBuilder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@TableName("index_configuration")
|
||||||
|
@ApiModel(value = "IndexConfiguration", description = "车辆指标预警配置")
|
||||||
|
public class IndexConfiguration {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/** 主键id */
|
||||||
|
@TableId(value = "id",type = IdType.AUTO)
|
||||||
|
@ApiModelProperty(name = "主键id", value = "主键id")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/** 车辆vin */
|
||||||
|
@Excel(name = "车辆vin")
|
||||||
|
@ApiModelProperty(name = "车辆vin", value = "车辆vin")
|
||||||
|
private String vin;
|
||||||
|
|
||||||
|
/** 指标项key */
|
||||||
|
@Excel(name = "指标项key")
|
||||||
|
@ApiModelProperty(name = "指标项key", value = "指标项key")
|
||||||
|
private String keyCode;
|
||||||
|
|
||||||
|
/** 滑窗范围(秒) */
|
||||||
|
@Excel(name = "滑窗范围(秒)")
|
||||||
|
@ApiModelProperty(name = "滑窗范围(秒)", value = "滑窗范围(秒)")
|
||||||
|
private Long intervalRange;
|
||||||
|
|
||||||
|
/** 滑窗时机(秒) */
|
||||||
|
@Excel(name = "滑窗时机(秒)")
|
||||||
|
@ApiModelProperty(name = "滑窗时机(秒)", value = "滑窗时机(秒)")
|
||||||
|
private Long opportunity;
|
||||||
|
|
||||||
|
/** 类型:1 上升 2 波动 3 下降 */
|
||||||
|
@Excel(name = "类型:1 上升 2 波动 3 下降")
|
||||||
|
@ApiModelProperty(name = "类型:1 上升 2 波动 3 下降", value = "类型:1 上升 2 波动 3 下降")
|
||||||
|
private Long attributeType;
|
||||||
|
|
||||||
|
/** 指标值 */
|
||||||
|
@Excel(name = "指标值")
|
||||||
|
@ApiModelProperty(name = "指标值", value = "指标值")
|
||||||
|
private String attributeValue;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询构造器
|
||||||
|
*/
|
||||||
|
public static IndexConfiguration queryBuild( IndexConfigurationQueryReq indexConfigurationQueryReq){
|
||||||
|
return IndexConfiguration.builder()
|
||||||
|
.vin(indexConfigurationQueryReq.getVin())
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加构造器
|
||||||
|
*/
|
||||||
|
public static IndexConfiguration saveBuild(IndexConfigurationSaveReq indexConfigurationSaveReq){
|
||||||
|
return IndexConfiguration.builder()
|
||||||
|
.vin(indexConfigurationSaveReq.getVin())
|
||||||
|
.keyCode(indexConfigurationSaveReq.getKeyCode())
|
||||||
|
.intervalRange(indexConfigurationSaveReq.getIntervalRange())
|
||||||
|
.opportunity(indexConfigurationSaveReq.getOpportunity())
|
||||||
|
.attributeType(indexConfigurationSaveReq.getAttributeType())
|
||||||
|
.attributeValue(indexConfigurationSaveReq.getAttributeValue())
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改构造器
|
||||||
|
*/
|
||||||
|
public static IndexConfiguration editBuild(Long id, IndexConfigurationEditReq indexConfigurationEditReq){
|
||||||
|
return IndexConfiguration.builder()
|
||||||
|
.id(id)
|
||||||
|
.vin(indexConfigurationEditReq.getVin())
|
||||||
|
.keyCode(indexConfigurationEditReq.getKeyCode())
|
||||||
|
.intervalRange(indexConfigurationEditReq.getIntervalRange())
|
||||||
|
.opportunity(indexConfigurationEditReq.getOpportunity())
|
||||||
|
.attributeType(indexConfigurationEditReq.getAttributeType())
|
||||||
|
.attributeValue(indexConfigurationEditReq.getAttributeValue())
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,104 @@
|
||||||
|
package com.muyu.customer.business.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.muyu.common.core.annotation.Excel;
|
||||||
|
import com.muyu.customer.business.domain.req.MessageDetailEditReq;
|
||||||
|
import com.muyu.customer.business.domain.req.MessageDetailQueryReq;
|
||||||
|
import com.muyu.customer.business.domain.req.MessageDetailSaveReq;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 报文详情对象 message_detail
|
||||||
|
*
|
||||||
|
* @author muyu
|
||||||
|
* @date 2024-06-28
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@SuperBuilder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@TableName("message_detail")
|
||||||
|
@ApiModel(value = "MessageDetail", description = "报文详情")
|
||||||
|
public class MessageDetail {
|
||||||
|
|
||||||
|
|
||||||
|
/** 报文id */
|
||||||
|
@TableId(value = "id",type = IdType.AUTO)
|
||||||
|
@ApiModelProperty(name = "报文id", value = "报文id")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/** 数据项key */
|
||||||
|
@Excel(name = "数据项key")
|
||||||
|
@ApiModelProperty(name = "数据项key", value = "数据项key")
|
||||||
|
private String keyCode;
|
||||||
|
|
||||||
|
/** 起始位 */
|
||||||
|
@Excel(name = "起始位")
|
||||||
|
@ApiModelProperty(name = "起始位", value = "起始位")
|
||||||
|
private String startBit;
|
||||||
|
|
||||||
|
/** 结束位 */
|
||||||
|
@Excel(name = "结束位")
|
||||||
|
@ApiModelProperty(name = "结束位", value = "结束位")
|
||||||
|
private String stopBit;
|
||||||
|
|
||||||
|
/** 标签 */
|
||||||
|
@Excel(name = "标签")
|
||||||
|
@ApiModelProperty(name = "标签", value = "标签")
|
||||||
|
private String label;
|
||||||
|
|
||||||
|
/** 类型 */
|
||||||
|
@Excel(name = "类型")
|
||||||
|
@ApiModelProperty(name = "类型", value = "类型")
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
// private String vin;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询构造器
|
||||||
|
*/
|
||||||
|
public static MessageDetail queryBuild( MessageDetailQueryReq messageDetailQueryReq){
|
||||||
|
return MessageDetail.builder()
|
||||||
|
.keyCode(messageDetailQueryReq.getKeyCode())
|
||||||
|
.startBit(messageDetailQueryReq.getStartBit())
|
||||||
|
.stopBit(messageDetailQueryReq.getStopBit())
|
||||||
|
.label(messageDetailQueryReq.getLabel())
|
||||||
|
.type(messageDetailQueryReq.getType())
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加构造器
|
||||||
|
*/
|
||||||
|
public static MessageDetail saveBuild(MessageDetailSaveReq messageDetailSaveReq){
|
||||||
|
return MessageDetail.builder()
|
||||||
|
.keyCode(messageDetailSaveReq.getKeyCode())
|
||||||
|
.startBit(messageDetailSaveReq.getStartBit())
|
||||||
|
.stopBit(messageDetailSaveReq.getStopBit())
|
||||||
|
.label(messageDetailSaveReq.getLabel())
|
||||||
|
.type(messageDetailSaveReq.getType())
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改构造器
|
||||||
|
*/
|
||||||
|
public static MessageDetail editBuild(Long id, MessageDetailEditReq messageDetailEditReq){
|
||||||
|
return MessageDetail.builder()
|
||||||
|
.id(id)
|
||||||
|
.keyCode(messageDetailEditReq.getKeyCode())
|
||||||
|
.startBit(messageDetailEditReq.getStartBit())
|
||||||
|
.stopBit(messageDetailEditReq.getStopBit())
|
||||||
|
.label(messageDetailEditReq.getLabel())
|
||||||
|
.type(messageDetailEditReq.getType())
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -2,11 +2,15 @@ package com.muyu.customer.business.domain;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
|
import com.muyu.customer.business.domain.req.VehicleQueryReq;
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import com.muyu.common.security.utils.SecurityUtils;
|
import com.muyu.common.security.utils.SecurityUtils;
|
||||||
|
import com.muyu.customer.business.domain.req.VehicleEditReq;
|
||||||
|
import com.muyu.customer.business.domain.req.VehicleSaveReq;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
@ -14,9 +18,6 @@ import lombok.AllArgsConstructor;
|
||||||
import lombok.experimental.SuperBuilder;
|
import lombok.experimental.SuperBuilder;
|
||||||
import io.swagger.annotations.*;
|
import io.swagger.annotations.*;
|
||||||
import com.muyu.common.core.annotation.Excel;
|
import com.muyu.common.core.annotation.Excel;
|
||||||
import com.muyu.customer.business.domain.req.VehicleQueryReq;
|
|
||||||
import com.muyu.customer.business.domain.req.VehicleSaveReq;
|
|
||||||
import com.muyu.customer.business.domain.req.VehicleEditReq;
|
|
||||||
import com.muyu.common.core.web.domain.BaseEntity;
|
import com.muyu.common.core.web.domain.BaseEntity;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -118,6 +119,9 @@ public class Vehicle extends BaseEntity {
|
||||||
@ApiModelProperty(name = "车辆类型", value = "车辆类型")
|
@ApiModelProperty(name = "车辆类型", value = "车辆类型")
|
||||||
private String vehicleType;
|
private String vehicleType;
|
||||||
|
|
||||||
|
// /** 报文详情对象 */
|
||||||
|
// private MessageDetail messageDetail;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询构造器
|
* 查询构造器
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
package com.muyu.customer.business.domain.model;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* MessDetaiModel
|
||||||
|
*
|
||||||
|
* @author DeKangLiu
|
||||||
|
* Date 2024/6/28 21:39
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@SuperBuilder
|
||||||
|
public class MessageDetailModel {
|
||||||
|
|
||||||
|
private String vin;
|
||||||
|
|
||||||
|
private List<Integer> ids;
|
||||||
|
}
|
|
@ -0,0 +1,25 @@
|
||||||
|
package com.muyu.customer.business.domain.model;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆中间表 VehicleMiddle
|
||||||
|
*
|
||||||
|
* @author DeKangLiu
|
||||||
|
* Date 2024/6/27 09:53
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@SuperBuilder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class VehicleMiddle {
|
||||||
|
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
private Integer vehicleId;
|
||||||
|
|
||||||
|
private Integer messageId;
|
||||||
|
}
|
|
@ -0,0 +1,80 @@
|
||||||
|
package com.muyu.customer.business.domain.model;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆录入对象 VehicleModel
|
||||||
|
*
|
||||||
|
* @author DeKangLiu
|
||||||
|
* Date 2024/6/27 08:18
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@SuperBuilder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class VehicleModel {
|
||||||
|
|
||||||
|
/** 车辆id */
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/** 车辆vin */
|
||||||
|
private String vin;
|
||||||
|
|
||||||
|
/** 品牌 */
|
||||||
|
private String brand;
|
||||||
|
|
||||||
|
/** 型号 */
|
||||||
|
private String model;
|
||||||
|
|
||||||
|
/** 生产日期 */
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||||
|
private Date productionDate;
|
||||||
|
|
||||||
|
/** 车身类型 */
|
||||||
|
private String bodyType;
|
||||||
|
|
||||||
|
/** 车身颜色 */
|
||||||
|
private String color;
|
||||||
|
|
||||||
|
/** 发动机排量 */
|
||||||
|
private BigDecimal engineCapacity;
|
||||||
|
|
||||||
|
/** 燃油类型 */
|
||||||
|
private String fuelType;
|
||||||
|
|
||||||
|
/** 变速器类型 */
|
||||||
|
private String transmission;
|
||||||
|
|
||||||
|
/** 驱动方式 */
|
||||||
|
private String driveType;
|
||||||
|
|
||||||
|
/** 行驶里程 */
|
||||||
|
private BigDecimal mileage;
|
||||||
|
|
||||||
|
/** 注册日期 */
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||||
|
private Date registrationDate;
|
||||||
|
|
||||||
|
/** 车牌号码 */
|
||||||
|
private String licenseNumber;
|
||||||
|
|
||||||
|
/** 持有者 */
|
||||||
|
private String holder;
|
||||||
|
|
||||||
|
/** 车辆类型 */
|
||||||
|
private String vehicleType;
|
||||||
|
|
||||||
|
/** 报文详情对象 */
|
||||||
|
private List<Integer> messageDetail;
|
||||||
|
}
|
|
@ -0,0 +1,42 @@
|
||||||
|
package com.muyu.customer.business.domain.req;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
import io.swagger.annotations.*;
|
||||||
|
import com.muyu.common.core.web.domain.BaseEntity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆故障码对象 fault_code
|
||||||
|
*
|
||||||
|
* @author muyu
|
||||||
|
* @date 2024-06-20
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@SuperBuilder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@ApiModel(value = "FaultCodeEditReq", description = "车辆故障码")
|
||||||
|
public class FaultCodeEditReq extends BaseEntity {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/** 故障码 */
|
||||||
|
@ApiModelProperty(name = "故障码", value = "故障码")
|
||||||
|
private String faultCode;
|
||||||
|
|
||||||
|
/** 故障标签 */
|
||||||
|
@ApiModelProperty(name = "故障标签", value = "故障标签")
|
||||||
|
private String faultLabel;
|
||||||
|
|
||||||
|
/** 故障位 */
|
||||||
|
@ApiModelProperty(name = "故障位", value = "故障位")
|
||||||
|
private Long faultBit;
|
||||||
|
|
||||||
|
/** 故障值 */
|
||||||
|
@ApiModelProperty(name = "故障值", value = "故障值")
|
||||||
|
private Long faultValue;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,30 @@
|
||||||
|
package com.muyu.customer.business.domain.req;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
import io.swagger.annotations.*;
|
||||||
|
import com.muyu.common.core.web.domain.BaseEntity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆故障码对象 fault_code
|
||||||
|
*
|
||||||
|
* @author muyu
|
||||||
|
* @date 2024-06-20
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@SuperBuilder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@ApiModel(value = "FaultCodeQueryReq", description = "车辆故障码")
|
||||||
|
public class FaultCodeQueryReq extends BaseEntity {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/** 故障码 */
|
||||||
|
@ApiModelProperty(name = "故障码", value = "故障码")
|
||||||
|
private String faultCode;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,51 @@
|
||||||
|
package com.muyu.customer.business.domain.req;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
import io.swagger.annotations.*;
|
||||||
|
import com.muyu.common.core.web.domain.BaseEntity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆故障码对象 fault_code
|
||||||
|
*
|
||||||
|
* @author muyu
|
||||||
|
* @date 2024-06-20
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@SuperBuilder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@ApiModel(value = "FaultCodeSaveReq", description = "车辆故障码")
|
||||||
|
public class FaultCodeSaveReq extends BaseEntity {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/** 主键 */
|
||||||
|
|
||||||
|
@ApiModelProperty(name = "主键", value = "主键")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/** 故障码 */
|
||||||
|
|
||||||
|
@ApiModelProperty(name = "故障码", value = "故障码")
|
||||||
|
private String faultCode;
|
||||||
|
|
||||||
|
/** 故障标签 */
|
||||||
|
|
||||||
|
@ApiModelProperty(name = "故障标签", value = "故障标签")
|
||||||
|
private String faultLabel;
|
||||||
|
|
||||||
|
/** 故障位 */
|
||||||
|
|
||||||
|
@ApiModelProperty(name = "故障位", value = "故障位")
|
||||||
|
private Long faultBit;
|
||||||
|
|
||||||
|
/** 故障值 */
|
||||||
|
|
||||||
|
@ApiModelProperty(name = "故障值", value = "故障值")
|
||||||
|
private Long faultValue;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,54 @@
|
||||||
|
package com.muyu.customer.business.domain.req;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
import io.swagger.annotations.*;
|
||||||
|
import com.muyu.common.core.web.domain.BaseEntity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 故障记录对象 fault_record
|
||||||
|
*
|
||||||
|
* @author muyu
|
||||||
|
* @date 2024-06-20
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@SuperBuilder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@ApiModel(value = "FaultRecordEditReq", description = "故障记录")
|
||||||
|
public class FaultRecordEditReq extends BaseEntity {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/** 故障码 */
|
||||||
|
@ApiModelProperty(name = "故障码", value = "故障码")
|
||||||
|
private String faultCode;
|
||||||
|
|
||||||
|
/** 车辆vin */
|
||||||
|
@ApiModelProperty(name = "车辆vin", value = "车辆vin")
|
||||||
|
private String vin;
|
||||||
|
|
||||||
|
/** 故障开始时间 */
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||||
|
@ApiModelProperty(name = "故障开始时间", value = "故障开始时间")
|
||||||
|
private Date startTime;
|
||||||
|
|
||||||
|
/** 故障结束时间 */
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||||
|
@ApiModelProperty(name = "故障结束时间", value = "故障结束时间")
|
||||||
|
private Date endTime;
|
||||||
|
|
||||||
|
/** 故障级别 */
|
||||||
|
@ApiModelProperty(name = "故障级别", value = "故障级别")
|
||||||
|
private String faultLevel;
|
||||||
|
|
||||||
|
/** 故障是否处理 */
|
||||||
|
@ApiModelProperty(name = "故障是否处理", value = "故障是否处理")
|
||||||
|
private String faultHandle;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,36 @@
|
||||||
|
package com.muyu.customer.business.domain.req;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
import io.swagger.annotations.*;
|
||||||
|
import com.muyu.common.core.web.domain.BaseEntity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 故障记录对象 fault_record
|
||||||
|
*
|
||||||
|
* @author muyu
|
||||||
|
* @date 2024-06-20
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@SuperBuilder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@ApiModel(value = "FaultRecordQueryReq", description = "故障记录")
|
||||||
|
public class FaultRecordQueryReq extends BaseEntity {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/** 故障码 */
|
||||||
|
@ApiModelProperty(name = "故障码", value = "故障码")
|
||||||
|
private String faultCode;
|
||||||
|
|
||||||
|
/** 车辆vin */
|
||||||
|
@ApiModelProperty(name = "车辆vin", value = "车辆vin")
|
||||||
|
private String vin;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,65 @@
|
||||||
|
package com.muyu.customer.business.domain.req;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
import io.swagger.annotations.*;
|
||||||
|
import com.muyu.common.core.web.domain.BaseEntity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 故障记录对象 fault_record
|
||||||
|
*
|
||||||
|
* @author muyu
|
||||||
|
* @date 2024-06-20
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@SuperBuilder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@ApiModel(value = "FaultRecordSaveReq", description = "故障记录")
|
||||||
|
public class FaultRecordSaveReq extends BaseEntity {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/** 主键 */
|
||||||
|
|
||||||
|
@ApiModelProperty(name = "主键", value = "主键")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/** 故障码 */
|
||||||
|
|
||||||
|
@ApiModelProperty(name = "故障码", value = "故障码")
|
||||||
|
private String faultCode;
|
||||||
|
|
||||||
|
/** 车辆vin */
|
||||||
|
|
||||||
|
@ApiModelProperty(name = "车辆vin", value = "车辆vin")
|
||||||
|
private String vin;
|
||||||
|
|
||||||
|
/** 故障开始时间 */
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||||
|
|
||||||
|
@ApiModelProperty(name = "故障开始时间", value = "故障开始时间")
|
||||||
|
private Date startTime;
|
||||||
|
|
||||||
|
/** 故障结束时间 */
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||||
|
|
||||||
|
@ApiModelProperty(name = "故障结束时间", value = "故障结束时间")
|
||||||
|
private Date endTime;
|
||||||
|
|
||||||
|
/** 故障级别 */
|
||||||
|
|
||||||
|
@ApiModelProperty(name = "故障级别", value = "故障级别")
|
||||||
|
private String faultLevel;
|
||||||
|
|
||||||
|
/** 故障是否处理 */
|
||||||
|
|
||||||
|
@ApiModelProperty(name = "故障是否处理", value = "故障是否处理")
|
||||||
|
private String faultHandle;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,38 @@
|
||||||
|
package com.muyu.customer.business.domain.req;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
import io.swagger.annotations.*;
|
||||||
|
import com.muyu.common.core.web.domain.BaseEntity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电子围栏对象 fence
|
||||||
|
*
|
||||||
|
* @author muyu
|
||||||
|
* @date 2024-05-31
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@SuperBuilder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@ApiModel(value = "FenceEditReq", description = "电子围栏")
|
||||||
|
public class FenceEditReq extends BaseEntity {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/** 电子围栏名称 */
|
||||||
|
@ApiModelProperty(name = "电子围栏名称", value = "电子围栏名称")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/** 围栏类型 */
|
||||||
|
@ApiModelProperty(name = "围栏类型", value = "围栏类型")
|
||||||
|
private String fenceType;
|
||||||
|
|
||||||
|
/** 经纬度信息 */
|
||||||
|
@ApiModelProperty(name = "经纬度信息", value = "经纬度信息")
|
||||||
|
private String longitudeAndLatitude;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,38 @@
|
||||||
|
package com.muyu.customer.business.domain.req;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
import io.swagger.annotations.*;
|
||||||
|
import com.muyu.common.core.web.domain.BaseEntity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电子围栏对象 fence
|
||||||
|
*
|
||||||
|
* @author muyu
|
||||||
|
* @date 2024-05-31
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@SuperBuilder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@ApiModel(value = "FenceQueryReq", description = "电子围栏")
|
||||||
|
public class FenceQueryReq extends BaseEntity {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/** 电子围栏名称 */
|
||||||
|
@ApiModelProperty(name = "电子围栏名称", value = "电子围栏名称")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/** 围栏类型 */
|
||||||
|
@ApiModelProperty(name = "围栏类型", value = "围栏类型")
|
||||||
|
private String fenceType;
|
||||||
|
|
||||||
|
/** 经纬度信息 */
|
||||||
|
@ApiModelProperty(name = "经纬度信息", value = "经纬度信息")
|
||||||
|
private String longitudeAndLatitude;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,46 @@
|
||||||
|
package com.muyu.customer.business.domain.req;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
import io.swagger.annotations.*;
|
||||||
|
import com.muyu.common.core.web.domain.BaseEntity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电子围栏对象 fence
|
||||||
|
*
|
||||||
|
* @author muyu
|
||||||
|
* @date 2024-05-31
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@SuperBuilder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@ApiModel(value = "FenceSaveReq", description = "电子围栏")
|
||||||
|
public class FenceSaveReq extends BaseEntity {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/** id */
|
||||||
|
|
||||||
|
@ApiModelProperty(name = "id", value = "id")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/** 电子围栏名称 */
|
||||||
|
|
||||||
|
@ApiModelProperty(name = "电子围栏名称", value = "电子围栏名称")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/** 围栏类型 */
|
||||||
|
|
||||||
|
@ApiModelProperty(name = "围栏类型", value = "围栏类型")
|
||||||
|
private String fenceType;
|
||||||
|
|
||||||
|
/** 经纬度信息 */
|
||||||
|
|
||||||
|
@ApiModelProperty(name = "经纬度信息", value = "经纬度信息")
|
||||||
|
private String longitudeAndLatitude;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,49 @@
|
||||||
|
package com.muyu.customer.business.domain.req;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
import io.swagger.annotations.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆指标预警配置对象 index_configuration
|
||||||
|
*
|
||||||
|
* @author muyu
|
||||||
|
* @date 2024-06-28
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@SuperBuilder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@ApiModel(value = "IndexConfigurationEditReq", description = "车辆指标预警配置")
|
||||||
|
public class IndexConfigurationEditReq {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/** 车辆vin */
|
||||||
|
@ApiModelProperty(name = "车辆vin", value = "车辆vin")
|
||||||
|
private String vin;
|
||||||
|
|
||||||
|
/** 指标项key */
|
||||||
|
@ApiModelProperty(name = "指标项key", value = "指标项key")
|
||||||
|
private String keyCode;
|
||||||
|
|
||||||
|
/** 滑窗范围(秒) */
|
||||||
|
@ApiModelProperty(name = "滑窗范围(秒)", value = "滑窗范围(秒)")
|
||||||
|
private Long intervalRange;
|
||||||
|
|
||||||
|
/** 滑窗时机(秒) */
|
||||||
|
@ApiModelProperty(name = "滑窗时机(秒)", value = "滑窗时机(秒)")
|
||||||
|
private Long opportunity;
|
||||||
|
|
||||||
|
/** 类型:1 上升 2 波动 3 下降 */
|
||||||
|
@ApiModelProperty(name = "类型:1 上升 2 波动 3 下降", value = "类型:1 上升 2 波动 3 下降")
|
||||||
|
private Long attributeType;
|
||||||
|
|
||||||
|
/** 指标值 */
|
||||||
|
@ApiModelProperty(name = "指标值", value = "指标值")
|
||||||
|
private String attributeValue;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,30 @@
|
||||||
|
package com.muyu.customer.business.domain.req;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
import io.swagger.annotations.*;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆指标预警配置对象 index_configuration
|
||||||
|
*
|
||||||
|
* @author muyu
|
||||||
|
* @date 2024-06-28
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@SuperBuilder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@ApiModel(value = "IndexConfigurationQueryReq", description = "车辆指标预警配置")
|
||||||
|
public class IndexConfigurationQueryReq {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/** 车辆vin */
|
||||||
|
@ApiModelProperty(name = "车辆vin", value = "车辆vin")
|
||||||
|
private String vin;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,61 @@
|
||||||
|
package com.muyu.customer.business.domain.req;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
import io.swagger.annotations.*;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆指标预警配置对象 index_configuration
|
||||||
|
*
|
||||||
|
* @author muyu
|
||||||
|
* @date 2024-06-28
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@SuperBuilder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@ApiModel(value = "IndexConfigurationSaveReq", description = "车辆指标预警配置")
|
||||||
|
public class IndexConfigurationSaveReq {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/** 主键id */
|
||||||
|
|
||||||
|
@ApiModelProperty(name = "主键id", value = "主键id")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/** 车辆vin */
|
||||||
|
|
||||||
|
@ApiModelProperty(name = "车辆vin", value = "车辆vin")
|
||||||
|
private String vin;
|
||||||
|
|
||||||
|
/** 指标项key */
|
||||||
|
|
||||||
|
@ApiModelProperty(name = "指标项key", value = "指标项key")
|
||||||
|
private String keyCode;
|
||||||
|
|
||||||
|
/** 滑窗范围(秒) */
|
||||||
|
|
||||||
|
@ApiModelProperty(name = "滑窗范围(秒)", value = "滑窗范围(秒)")
|
||||||
|
private Long intervalRange;
|
||||||
|
|
||||||
|
/** 滑窗时机(秒) */
|
||||||
|
|
||||||
|
@ApiModelProperty(name = "滑窗时机(秒)", value = "滑窗时机(秒)")
|
||||||
|
private Long opportunity;
|
||||||
|
|
||||||
|
/** 类型:1 上升 2 波动 3 下降 */
|
||||||
|
|
||||||
|
@ApiModelProperty(name = "类型:1 上升 2 波动 3 下降", value = "类型:1 上升 2 波动 3 下降")
|
||||||
|
private Long attributeType;
|
||||||
|
|
||||||
|
/** 指标值 */
|
||||||
|
|
||||||
|
@ApiModelProperty(name = "指标值", value = "指标值")
|
||||||
|
private String attributeValue;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,46 @@
|
||||||
|
package com.muyu.customer.business.domain.req;
|
||||||
|
|
||||||
|
import com.muyu.common.core.web.domain.BaseEntity;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 报文详情对象 message_detail
|
||||||
|
*
|
||||||
|
* @author muyu
|
||||||
|
* @date 2024-06-28
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@SuperBuilder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@ApiModel(value = "MessageDetailEditReq", description = "报文详情")
|
||||||
|
public class MessageDetailEditReq extends BaseEntity {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/** 数据项key */
|
||||||
|
@ApiModelProperty(name = "数据项key", value = "数据项key")
|
||||||
|
private String keyCode;
|
||||||
|
|
||||||
|
/** 起始位 */
|
||||||
|
@ApiModelProperty(name = "起始位", value = "起始位")
|
||||||
|
private String startBit;
|
||||||
|
|
||||||
|
/** 结束位 */
|
||||||
|
@ApiModelProperty(name = "结束位", value = "结束位")
|
||||||
|
private String stopBit;
|
||||||
|
|
||||||
|
/** 标签 */
|
||||||
|
@ApiModelProperty(name = "标签", value = "标签")
|
||||||
|
private String label;
|
||||||
|
|
||||||
|
/** 类型 */
|
||||||
|
@ApiModelProperty(name = "类型", value = "类型")
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,46 @@
|
||||||
|
package com.muyu.customer.business.domain.req;
|
||||||
|
|
||||||
|
import com.muyu.common.core.web.domain.BaseEntity;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 报文详情对象 message_detail
|
||||||
|
*
|
||||||
|
* @author muyu
|
||||||
|
* @date 2024-06-28
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@SuperBuilder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@ApiModel(value = "MessageDetailQueryReq", description = "报文详情")
|
||||||
|
public class MessageDetailQueryReq extends BaseEntity {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/** 数据项key */
|
||||||
|
@ApiModelProperty(name = "数据项key", value = "数据项key")
|
||||||
|
private String keyCode;
|
||||||
|
|
||||||
|
/** 起始位 */
|
||||||
|
@ApiModelProperty(name = "起始位", value = "起始位")
|
||||||
|
private String startBit;
|
||||||
|
|
||||||
|
/** 结束位 */
|
||||||
|
@ApiModelProperty(name = "结束位", value = "结束位")
|
||||||
|
private String stopBit;
|
||||||
|
|
||||||
|
/** 标签 */
|
||||||
|
@ApiModelProperty(name = "标签", value = "标签")
|
||||||
|
private String label;
|
||||||
|
|
||||||
|
/** 类型 */
|
||||||
|
@ApiModelProperty(name = "类型", value = "类型")
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,58 @@
|
||||||
|
package com.muyu.customer.business.domain.req;
|
||||||
|
|
||||||
|
import com.muyu.common.core.web.domain.BaseEntity;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 报文详情对象 message_detail
|
||||||
|
*
|
||||||
|
* @author muyu
|
||||||
|
* @date 2024-06-28
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@SuperBuilder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@ApiModel(value = "MessageDetailSaveReq", description = "报文详情")
|
||||||
|
public class MessageDetailSaveReq extends BaseEntity {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/** 报文id */
|
||||||
|
|
||||||
|
@ApiModelProperty(name = "报文id", value = "报文id")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/** 数据项key */
|
||||||
|
|
||||||
|
@ApiModelProperty(name = "数据项key", value = "数据项key")
|
||||||
|
private String keyCode;
|
||||||
|
|
||||||
|
/** 起始位 */
|
||||||
|
|
||||||
|
@ApiModelProperty(name = "起始位", value = "起始位")
|
||||||
|
private String startBit;
|
||||||
|
|
||||||
|
/** 结束位 */
|
||||||
|
|
||||||
|
@ApiModelProperty(name = "结束位", value = "结束位")
|
||||||
|
private String stopBit;
|
||||||
|
|
||||||
|
/** 标签 */
|
||||||
|
|
||||||
|
@ApiModelProperty(name = "标签", value = "标签")
|
||||||
|
private String label;
|
||||||
|
|
||||||
|
/** 类型 */
|
||||||
|
|
||||||
|
@ApiModelProperty(name = "类型", value = "类型")
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
private String vin;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,27 @@
|
||||||
|
package com.muyu.customer.business.domain.vo;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 故障日志条件查询 FaultRecordVo
|
||||||
|
*
|
||||||
|
* @author DeKangLiu
|
||||||
|
* Date 2024/6/24 19:32
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class FaultRecordVo {
|
||||||
|
/**
|
||||||
|
* 故障码
|
||||||
|
*/
|
||||||
|
private String faultCode;
|
||||||
|
/**
|
||||||
|
* 车辆vin
|
||||||
|
*/
|
||||||
|
private String vin;
|
||||||
|
private String count;
|
||||||
|
private String faultLabel;
|
||||||
|
}
|
|
@ -16,5 +16,17 @@
|
||||||
<maven.compiler.target>17</maven.compiler.target>
|
<maven.compiler.target>17</maven.compiler.target>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
</properties>
|
</properties>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.muyu</groupId>
|
||||||
|
<artifactId>muyu-common-core</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.muyu</groupId>
|
||||||
|
<artifactId>muyu-net-working-common</artifactId>
|
||||||
|
<version>3.6.3</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -72,6 +72,11 @@
|
||||||
<groupId>com.muyu</groupId>
|
<groupId>com.muyu</groupId>
|
||||||
<artifactId>muyu-common-datascope</artifactId>
|
<artifactId>muyu-common-datascope</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<!-- rabbitmq -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-amqp</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<!-- MuYu Common Log -->
|
<!-- MuYu Common Log -->
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -84,7 +89,29 @@
|
||||||
<groupId>com.muyu</groupId>
|
<groupId>com.muyu</groupId>
|
||||||
<artifactId>muyu-common-swagger</artifactId>
|
<artifactId>muyu-common-swagger</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<!-- <dependency>-->
|
||||||
|
<!-- <groupId>com.muyu</groupId>-->
|
||||||
|
<!-- <artifactId>muyu-customer-business-remote</artifactId>-->
|
||||||
|
<!-- <version>3.6.3</version>-->
|
||||||
|
<!-- <scope>compile</scope>-->
|
||||||
|
<!-- </dependency>-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.json</groupId>
|
||||||
|
<artifactId>json</artifactId>
|
||||||
|
<version>20140107</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.muyu</groupId>
|
||||||
|
<artifactId>muyu-net-working-common</artifactId>
|
||||||
|
<version>3.6.3</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.muyu</groupId>
|
||||||
|
<artifactId>muyu-net-working-remote</artifactId>
|
||||||
|
<version>3.6.3</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
|
|
@ -1,10 +1,13 @@
|
||||||
package com.muyu.customer.business;
|
package com.muyu.customer.business;
|
||||||
|
|
||||||
|
import com.baomidou.dynamic.datasource.spring.boot.autoconfigure.DynamicDataSourceAutoConfiguration;
|
||||||
import com.muyu.common.security.annotation.EnableCustomConfig;
|
import com.muyu.common.security.annotation.EnableCustomConfig;
|
||||||
import com.muyu.common.security.annotation.EnableMyFeignClients;
|
import com.muyu.common.security.annotation.EnableMyFeignClients;
|
||||||
import com.muyu.common.swagger.annotation.EnableCustomSwagger2;
|
import com.muyu.common.swagger.annotation.EnableCustomSwagger2;
|
||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
||||||
|
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 车联网客户业务系统启动类 MuYuCustomerBusinessApplication
|
* 车联网客户业务系统启动类 MuYuCustomerBusinessApplication
|
||||||
|
@ -15,7 +18,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
@EnableCustomConfig
|
@EnableCustomConfig
|
||||||
@EnableCustomSwagger2
|
@EnableCustomSwagger2
|
||||||
@EnableMyFeignClients
|
@EnableMyFeignClients
|
||||||
@SpringBootApplication
|
@SpringBootApplication(exclude = {DynamicDataSourceAutoConfiguration.class, DataSourceAutoConfiguration.class })
|
||||||
public class MuYuCustomerBusinessApplication {
|
public class MuYuCustomerBusinessApplication {
|
||||||
public static void main (String[] args) {
|
public static void main (String[] args) {
|
||||||
SpringApplication.run(MuYuCustomerBusinessApplication.class, args);
|
SpringApplication.run(MuYuCustomerBusinessApplication.class, args);
|
||||||
|
|
|
@ -0,0 +1,48 @@
|
||||||
|
package com.muyu.customer.business.config;
|
||||||
|
|
||||||
|
import org.springframework.amqp.rabbit.connection.CorrelationData;
|
||||||
|
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import javax.annotation.PostConstruct;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 消息发送确认配置 消息发送到交换机的确认
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
public class ConfirmCallbackConfig implements RabbitTemplate.ConfirmCallback {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private RabbitTemplate rabbitTemplate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @PostContruct是spring框架的注解,在⽅法上加该注解会在项⽬启动的时候执⾏该⽅法,也可以理解为在spring容器初始化的时候执
|
||||||
|
* @PostConstruct bean 被初始化的时候执行的方法的注解
|
||||||
|
* @PreDestory bean 被销毁的时候执行的方法的注解
|
||||||
|
*/
|
||||||
|
@PostConstruct
|
||||||
|
public void init() {
|
||||||
|
rabbitTemplate.setConfirmCallback(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 交换机不管是否收到消息的一个回调方法
|
||||||
|
*
|
||||||
|
* @param correlationData 消息相关数据
|
||||||
|
* @param ack 交换机是否收到消息
|
||||||
|
* @param cause 失败原因
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void confirm(CorrelationData correlationData, boolean ack, String cause) {
|
||||||
|
if (ack) {
|
||||||
|
// 消息投递到 broker 的状态,true表示成功
|
||||||
|
System.out.println("消息发送成功!");
|
||||||
|
} else {
|
||||||
|
// 发送异常
|
||||||
|
System.out.println("发送异常原因 = " + cause);
|
||||||
|
// TODO 可以将消息 内容 以及 失败的原因 记录到 日志表中
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,53 @@
|
||||||
|
package com.muyu.customer.business.config;
|
||||||
|
|
||||||
|
import org.springframework.amqp.rabbit.connection.CachingConnectionFactory;
|
||||||
|
import org.springframework.amqp.rabbit.connection.ConnectionFactory;
|
||||||
|
import org.springframework.amqp.rabbit.core.RabbitAdmin;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* RabbitAdmin是RabbitMQ的一个Java客户端库,它提供了管理RabbitMQ资源的功能。它是通过与RabbitMQ服务器进行交互来执行管理操作的。
|
||||||
|
*/
|
||||||
|
@Configuration
|
||||||
|
public class RabbitAdminConfig {
|
||||||
|
|
||||||
|
@Value("${spring.rabbitmq.host}")
|
||||||
|
private String host;
|
||||||
|
@Value("${spring.rabbitmq.username}")
|
||||||
|
private String username;
|
||||||
|
@Value("${spring.rabbitmq.password}")
|
||||||
|
private String password;
|
||||||
|
@Value("${spring.rabbitmq.virtualhost}")
|
||||||
|
private String virtualhost;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 构建 RabbitMQ的连接工厂
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Bean
|
||||||
|
public ConnectionFactory connectionFactory() {
|
||||||
|
CachingConnectionFactory connectionFactory = new CachingConnectionFactory();
|
||||||
|
connectionFactory.setAddresses(host);
|
||||||
|
connectionFactory.setUsername(username);
|
||||||
|
connectionFactory.setPassword(password);
|
||||||
|
connectionFactory.setVirtualHost(virtualhost);
|
||||||
|
// 配置发送确认回调时,次配置必须配置,否则即使在RabbitTemplate配置了ConfirmCallback也不会生效
|
||||||
|
connectionFactory.setPublisherConfirmType(CachingConnectionFactory.ConfirmType.CORRELATED);
|
||||||
|
connectionFactory.setPublisherReturns(true);
|
||||||
|
return connectionFactory;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 自己初始化 RabbitAdmin
|
||||||
|
* @param connectionFactory
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Bean
|
||||||
|
public RabbitAdmin rabbitAdmin(ConnectionFactory connectionFactory) {
|
||||||
|
RabbitAdmin rabbitAdmin = new RabbitAdmin(connectionFactory);
|
||||||
|
rabbitAdmin.setAutoStartup(true);
|
||||||
|
return rabbitAdmin;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,15 @@
|
||||||
|
package com.muyu.customer.business.config;
|
||||||
|
|
||||||
|
import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter;
|
||||||
|
import org.springframework.amqp.support.converter.MessageConverter;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
public class RabbitmqConfig {
|
||||||
|
// 消息转换配置
|
||||||
|
@Bean
|
||||||
|
public MessageConverter jsonMessageConverter() {
|
||||||
|
return new Jackson2JsonMessageConverter();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
package com.muyu.customer.business.config;
|
||||||
|
|
||||||
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.web.client.RestTemplate;
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
public class RestTemplateConfig {
|
||||||
|
/**
|
||||||
|
* 没有实例化RestTemplate时,初始化RestTemplate
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@ConditionalOnMissingBean(RestTemplate.class)
|
||||||
|
@Bean
|
||||||
|
public RestTemplate restTemplate(){
|
||||||
|
RestTemplate restTemplate = new RestTemplate();
|
||||||
|
return restTemplate;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,34 @@
|
||||||
|
package com.muyu.customer.business.config;
|
||||||
|
|
||||||
|
import org.springframework.amqp.core.ReturnedMessage;
|
||||||
|
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import javax.annotation.PostConstruct;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 消息发送到队列的确认 一旦消息发送到队列失败 则会执行 returnedMessage 方法
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
public class ReturnCallbackConfig implements RabbitTemplate.ReturnsCallback {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private RabbitTemplate rabbitTemplate;
|
||||||
|
|
||||||
|
@PostConstruct // @PostContruct是spring框架的注解,在⽅法上加该注解会在项⽬启动的时候执⾏该⽅法,也可以理解为在spring容器初始化的时候执
|
||||||
|
public void init() {
|
||||||
|
rabbitTemplate.setReturnsCallback(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 消息发送到 队列失败 执行的 方法
|
||||||
|
* @param returnedMessage the returned message and metadata.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void returnedMessage(ReturnedMessage returnedMessage) {
|
||||||
|
System.out.println("消息" + returnedMessage.getMessage().toString() + "被交换机" + returnedMessage.getExchange() + "回退!"
|
||||||
|
+ "退回原因为:" + returnedMessage.getReplyText());
|
||||||
|
// 回退了所有的信息,可做补偿机制 记录到 数据库
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,112 @@
|
||||||
|
package com.muyu.customer.business.consumer;
|
||||||
|
|
||||||
|
import com.muyu.customer.business.domain.FaultRecord;
|
||||||
|
import com.muyu.customer.business.saas.holder.DynamicDataSourceHolder;
|
||||||
|
import com.muyu.customer.business.service.FaultRecordService;
|
||||||
|
import org.springframework.amqp.core.ExchangeTypes;
|
||||||
|
import org.springframework.amqp.rabbit.annotation.Exchange;
|
||||||
|
import org.springframework.amqp.rabbit.annotation.Queue;
|
||||||
|
import org.springframework.amqp.rabbit.annotation.QueueBinding;
|
||||||
|
import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import com.rabbitmq.client.Channel;
|
||||||
|
import lombok.extern.log4j.Log4j2;
|
||||||
|
import org.springframework.amqp.core.Message;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.text.DateFormat;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* rabbitMQ消费者 Task
|
||||||
|
*
|
||||||
|
* @author DeKangLiu
|
||||||
|
* Date 2024/6/20 22:33
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
@Log4j2
|
||||||
|
public class RabbitConsumer {
|
||||||
|
@Autowired
|
||||||
|
private FaultRecordService faultRecordService;
|
||||||
|
@Autowired
|
||||||
|
private StringRedisTemplate redisTemplate;
|
||||||
|
|
||||||
|
@RabbitListener(bindings = {@QueueBinding(value = @Queue(name = "error"),
|
||||||
|
exchange = @Exchange(name = "carnet_fault_event", type = ExchangeTypes.DIRECT))})
|
||||||
|
public void consumptionStartMessage(Message message, Channel channel) {
|
||||||
|
try {
|
||||||
|
// DynamicDataSourceHolder.setDynamicDataSourceKey("liu_"+42);
|
||||||
|
log.info("接收到消息:{}", new String(message.getBody()));
|
||||||
|
String body= new String(message.getBody());
|
||||||
|
String[] split = body.split("_");
|
||||||
|
DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
|
Date date = dateFormat.parse(split[3]);
|
||||||
|
String s = redisTemplate.opsForValue().get(split[0]+"1");
|
||||||
|
System.out.println(s);
|
||||||
|
//选择数据源,切换数据源,
|
||||||
|
DynamicDataSourceHolder.setDynamicDataSourceKey("liu_"+s);
|
||||||
|
FaultRecord build = FaultRecord.builder()
|
||||||
|
.vin(split[0])
|
||||||
|
.faultCode(split[1])
|
||||||
|
.faultLevel(split[2])
|
||||||
|
.startTime(date)
|
||||||
|
.build();
|
||||||
|
log.info("123:{}",build);
|
||||||
|
faultRecordService.save(build);
|
||||||
|
// 移除数据源,
|
||||||
|
DynamicDataSourceHolder.removeDynamicDataSourceKey();
|
||||||
|
channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);
|
||||||
|
log.info("消费成功!数据源为:{}",message);
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.info("消费失败,{}",e.getMessage());
|
||||||
|
try {
|
||||||
|
//回退消息
|
||||||
|
channel.basicReject(message.getMessageProperties().getDeliveryTag(),false);
|
||||||
|
log.info("回退成功");
|
||||||
|
}catch (IOException ex){
|
||||||
|
log.info("回退失败:{}",ex.getMessage());
|
||||||
|
}
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@RabbitListener(bindings = {@QueueBinding(value = @Queue(name = "success"),
|
||||||
|
exchange = @Exchange(name = "carnet_fault_event", type = ExchangeTypes.DIRECT))})
|
||||||
|
public void successMessage(Message message, Channel channel) {
|
||||||
|
try {
|
||||||
|
log.info("恢复正常消息:{}", new String(message.getBody()));
|
||||||
|
String body= new String(message.getBody());
|
||||||
|
String[] split = body.split("_");
|
||||||
|
DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
|
Date date = dateFormat.parse(split[3]);
|
||||||
|
String s = redisTemplate.opsForValue().get(split[0]+"1");
|
||||||
|
System.out.println(s);
|
||||||
|
//选择数据源,切换数据源,
|
||||||
|
DynamicDataSourceHolder.setDynamicDataSourceKey("liu_"+s);
|
||||||
|
FaultRecord build = FaultRecord.builder()
|
||||||
|
.vin(split[0])
|
||||||
|
.faultCode(split[1])
|
||||||
|
.faultLevel(split[2])
|
||||||
|
.endTime(date)
|
||||||
|
.build();
|
||||||
|
FaultRecord faultRecordOne = faultRecordService.selectFault(build);
|
||||||
|
log.info("查询到的故障为:{}",faultRecordOne);
|
||||||
|
faultRecordOne.setEndTime(build.getEndTime());
|
||||||
|
// 进行修改故障表
|
||||||
|
faultRecordService.updateFault(faultRecordOne);
|
||||||
|
// 移除数据源,
|
||||||
|
DynamicDataSourceHolder.removeDynamicDataSourceKey();
|
||||||
|
channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);
|
||||||
|
} catch (Exception e) {
|
||||||
|
try {
|
||||||
|
channel.basicReject(message.getMessageProperties().getDeliveryTag(), true);
|
||||||
|
} catch (IOException ex) {
|
||||||
|
ex.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,111 @@
|
||||||
|
package com.muyu.customer.business.controller;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
import com.muyu.customer.business.domain.FaultCode;
|
||||||
|
import com.muyu.customer.business.domain.req.FaultCodeEditReq;
|
||||||
|
import com.muyu.customer.business.domain.req.FaultCodeQueryReq;
|
||||||
|
import com.muyu.customer.business.domain.req.FaultCodeSaveReq;
|
||||||
|
import com.muyu.customer.business.service.FaultCodeService;
|
||||||
|
import io.swagger.annotations.*;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PutMapping;
|
||||||
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
import com.muyu.common.core.domain.Result;
|
||||||
|
import com.muyu.common.core.utils.poi.ExcelUtil;
|
||||||
|
import com.muyu.common.core.web.controller.BaseController;
|
||||||
|
import com.muyu.common.log.annotation.Log;
|
||||||
|
import com.muyu.common.log.enums.BusinessType;
|
||||||
|
import com.muyu.common.security.annotation.RequiresPermissions;
|
||||||
|
import com.muyu.common.core.web.page.TableDataInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆故障码Controller
|
||||||
|
*
|
||||||
|
* @author muyu
|
||||||
|
* @date 2024-06-20
|
||||||
|
*/
|
||||||
|
@Api(tags = "车辆故障码")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/faultCode")
|
||||||
|
public class FaultCodeController extends BaseController {
|
||||||
|
@Autowired
|
||||||
|
private FaultCodeService faultCodeService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询车辆故障码列表
|
||||||
|
*/
|
||||||
|
@ApiOperation("获取车辆故障码列表")
|
||||||
|
@RequiresPermissions("customerBusiness:faultCode:list")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public Result<TableDataInfo<FaultCode>> list(FaultCodeQueryReq faultCodeQueryReq) {
|
||||||
|
startPage();
|
||||||
|
List<FaultCode> list = faultCodeService.list(FaultCode.queryBuild(faultCodeQueryReq));
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出车辆故障码列表
|
||||||
|
*/
|
||||||
|
@ApiOperation("导出车辆故障码列表")
|
||||||
|
@RequiresPermissions("customerBusiness:faultCode:export")
|
||||||
|
@Log(title = "车辆故障码", businessType = BusinessType.EXPORT)
|
||||||
|
@PostMapping("/export")
|
||||||
|
public void export(HttpServletResponse response, FaultCode faultCode) {
|
||||||
|
List<FaultCode> list = faultCodeService.list(faultCode);
|
||||||
|
ExcelUtil<FaultCode> util = new ExcelUtil<FaultCode>(FaultCode.class);
|
||||||
|
util.exportExcel(response, list, "车辆故障码数据");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取车辆故障码详细信息
|
||||||
|
*/
|
||||||
|
@ApiOperation("获取车辆故障码详细信息")
|
||||||
|
@RequiresPermissions("customerBusiness:faultCode:query")
|
||||||
|
@GetMapping(value = "/{id}")
|
||||||
|
@ApiImplicitParam(name = "id", value = "id", required = true, dataType = "Long", paramType = "path", dataTypeClass = Long.class)
|
||||||
|
public Result<FaultCode> getInfo(@PathVariable("id") Long id) {
|
||||||
|
return Result.success(faultCodeService.getById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增车辆故障码
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("customerBusiness:faultCode:add")
|
||||||
|
@Log(title = "车辆故障码", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping
|
||||||
|
@ApiOperation("新增车辆故障码")
|
||||||
|
public Result<String> add(@RequestBody FaultCodeSaveReq faultCodeSaveReq) {
|
||||||
|
return toAjax(faultCodeService.save(FaultCode.saveBuild(faultCodeSaveReq)));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改车辆故障码
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("customerBusiness:faultCode:edit")
|
||||||
|
@Log(title = "车辆故障码", businessType = BusinessType.UPDATE)
|
||||||
|
@PutMapping("/{id}")
|
||||||
|
@ApiOperation("修改车辆故障码")
|
||||||
|
public Result<String> edit(@PathVariable Long id, @RequestBody FaultCodeEditReq faultCodeEditReq) {
|
||||||
|
return toAjax(faultCodeService.updateById(FaultCode.editBuild(id,faultCodeEditReq)));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除车辆故障码
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("customerBusiness:faultCode:remove")
|
||||||
|
@Log(title = "车辆故障码", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{ids}")
|
||||||
|
@ApiOperation("删除车辆故障码")
|
||||||
|
@ApiImplicitParam(name = "id", value = "id", required = true, dataType = "Long", paramType = "path", dataTypeClass = String.class, example = "1,2,3,4")
|
||||||
|
public Result<String> remove(@PathVariable List<Long> ids) {
|
||||||
|
return toAjax(faultCodeService.removeBatchByIds(ids));
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,119 @@
|
||||||
|
package com.muyu.customer.business.controller;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
import com.muyu.customer.business.domain.FaultRecord;
|
||||||
|
import com.muyu.customer.business.domain.req.FaultRecordEditReq;
|
||||||
|
import com.muyu.customer.business.domain.req.FaultRecordQueryReq;
|
||||||
|
import com.muyu.customer.business.domain.req.FaultRecordSaveReq;
|
||||||
|
import com.muyu.customer.business.domain.vo.FaultRecordVo;
|
||||||
|
import com.muyu.customer.business.service.FaultRecordService;
|
||||||
|
import io.swagger.annotations.*;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PutMapping;
|
||||||
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
import com.muyu.common.core.domain.Result;
|
||||||
|
import com.muyu.common.core.utils.poi.ExcelUtil;
|
||||||
|
import com.muyu.common.core.web.controller.BaseController;
|
||||||
|
import com.muyu.common.log.annotation.Log;
|
||||||
|
import com.muyu.common.log.enums.BusinessType;
|
||||||
|
import com.muyu.common.security.annotation.RequiresPermissions;
|
||||||
|
import com.muyu.common.core.web.page.TableDataInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 故障记录Controller
|
||||||
|
*
|
||||||
|
* @author muyu
|
||||||
|
* @date 2024-06-20
|
||||||
|
*/
|
||||||
|
@Api(tags = "故障记录")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/faultRecord")
|
||||||
|
public class FaultRecordController extends BaseController {
|
||||||
|
@Autowired
|
||||||
|
private FaultRecordService faultRecordService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询故障记录列表
|
||||||
|
*/
|
||||||
|
@ApiOperation("获取故障记录列表")
|
||||||
|
@RequiresPermissions("customerBusiness:faultRecord:list")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public Result<TableDataInfo<FaultRecord>> list(FaultRecordQueryReq faultRecordQueryReq) {
|
||||||
|
startPage();
|
||||||
|
List<FaultRecord> list = faultRecordService.list(FaultRecord.queryBuild(faultRecordQueryReq));
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出故障记录列表
|
||||||
|
*/
|
||||||
|
@ApiOperation("导出故障记录列表")
|
||||||
|
@RequiresPermissions("customerBusiness:faultRecord:export")
|
||||||
|
@Log(title = "故障记录", businessType = BusinessType.EXPORT)
|
||||||
|
@PostMapping("/export")
|
||||||
|
public void export(HttpServletResponse response, FaultRecord faultRecord) {
|
||||||
|
List<FaultRecord> list = faultRecordService.list(faultRecord);
|
||||||
|
ExcelUtil<FaultRecord> util = new ExcelUtil<FaultRecord>(FaultRecord.class);
|
||||||
|
util.exportExcel(response, list, "故障记录数据");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取故障记录详细信息
|
||||||
|
*/
|
||||||
|
@ApiOperation("获取故障记录详细信息")
|
||||||
|
@RequiresPermissions("customerBusiness:faultRecord:query")
|
||||||
|
@GetMapping(value = "/{id}")
|
||||||
|
@ApiImplicitParam(name = "id", value = "id", required = true, dataType = "Long", paramType = "path", dataTypeClass = Long.class)
|
||||||
|
public Result<FaultRecord> getInfo(@PathVariable("id") Long id) {
|
||||||
|
return Result.success(faultRecordService.getById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增故障记录
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("customerBusiness:faultRecord:add")
|
||||||
|
@Log(title = "故障记录", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping
|
||||||
|
@ApiOperation("新增故障记录")
|
||||||
|
public Result<String> add(@RequestBody FaultRecordSaveReq faultRecordSaveReq) {
|
||||||
|
return toAjax(faultRecordService.save(FaultRecord.saveBuild(faultRecordSaveReq)));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改故障记录
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("customerBusiness:faultRecord:edit")
|
||||||
|
@Log(title = "故障记录", businessType = BusinessType.UPDATE)
|
||||||
|
@PutMapping("/{id}")
|
||||||
|
@ApiOperation("修改故障记录")
|
||||||
|
public Result<String> edit(@PathVariable Long id, @RequestBody FaultRecordEditReq faultRecordEditReq) {
|
||||||
|
return toAjax(faultRecordService.updateById(FaultRecord.editBuild(id,faultRecordEditReq)));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除故障记录
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("customerBusiness:faultRecord:remove")
|
||||||
|
@Log(title = "故障记录", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{ids}")
|
||||||
|
@ApiOperation("删除故障记录")
|
||||||
|
@ApiImplicitParam(name = "id", value = "id", required = true, dataType = "Long", paramType = "path", dataTypeClass = String.class, example = "1,2,3,4")
|
||||||
|
public Result<String> remove(@PathVariable List<Long> ids) {
|
||||||
|
return toAjax(faultRecordService.removeBatchByIds(ids));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Log(title = "柱状图",businessType = BusinessType.DELETE)
|
||||||
|
@GetMapping("/countList")
|
||||||
|
@ApiOperation("柱状图展示")
|
||||||
|
public Result<List<FaultRecordVo>> countList( ) {
|
||||||
|
return Result.success(faultRecordService.countList());
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,111 @@
|
||||||
|
package com.muyu.customer.business.controller;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
import com.muyu.customer.business.domain.Vehicle;
|
||||||
|
import io.swagger.annotations.*;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import com.muyu.common.core.domain.Result;
|
||||||
|
import com.muyu.common.core.utils.poi.ExcelUtil;
|
||||||
|
import com.muyu.common.core.web.controller.BaseController;
|
||||||
|
import com.muyu.common.log.annotation.Log;
|
||||||
|
import com.muyu.common.log.enums.BusinessType;
|
||||||
|
import com.muyu.common.security.annotation.RequiresPermissions;
|
||||||
|
import com.muyu.customer.business.domain.Fence;
|
||||||
|
import com.muyu.customer.business.domain.req.FenceQueryReq;
|
||||||
|
import com.muyu.customer.business.domain.req.FenceSaveReq;
|
||||||
|
import com.muyu.customer.business.domain.req.FenceEditReq;
|
||||||
|
import com.muyu.customer.business.service.FenceService;
|
||||||
|
import com.muyu.common.core.web.page.TableDataInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电子围栏Controller
|
||||||
|
*
|
||||||
|
* @author muyu
|
||||||
|
* @date 2024-05-31
|
||||||
|
*/
|
||||||
|
@Api(tags = "电子围栏")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/fence")
|
||||||
|
public class FenceController extends BaseController {
|
||||||
|
@Autowired
|
||||||
|
private FenceService fenceService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询电子围栏列表
|
||||||
|
*/
|
||||||
|
@ApiOperation("获取电子围栏列表")
|
||||||
|
@RequiresPermissions("customerBusiness:fence:list")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public Result<TableDataInfo<Fence>> list(FenceQueryReq fenceQueryReq) {
|
||||||
|
startPage();
|
||||||
|
List<Fence> list = fenceService.list(Fence.queryBuild(fenceQueryReq));
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出电子围栏列表
|
||||||
|
*/
|
||||||
|
@ApiOperation("导出电子围栏列表")
|
||||||
|
@RequiresPermissions("customerBusiness:fence:export")
|
||||||
|
@Log(title = "电子围栏", businessType = BusinessType.EXPORT)
|
||||||
|
@PostMapping("/export")
|
||||||
|
public void export(HttpServletResponse response, Fence fence) {
|
||||||
|
List<Fence> list = fenceService.list(fence);
|
||||||
|
ExcelUtil<Fence> util = new ExcelUtil<Fence>(Fence.class);
|
||||||
|
util.exportExcel(response, list, "电子围栏数据");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取电子围栏详细信息
|
||||||
|
*/
|
||||||
|
@ApiOperation("获取电子围栏详细信息")
|
||||||
|
@RequiresPermissions("customerBusiness:fence:query")
|
||||||
|
@GetMapping(value = "/{id}")
|
||||||
|
@ApiImplicitParam(name = "id", value = "id", required = true, dataType = "Long", paramType = "path", dataTypeClass = Long.class)
|
||||||
|
public Result<Fence> getInfo(@PathVariable("id") Long id) {
|
||||||
|
return Result.success(fenceService.getById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增电子围栏
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("customerBusiness:fence:add")
|
||||||
|
@Log(title = "电子围栏", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping
|
||||||
|
@ApiOperation("新增电子围栏")
|
||||||
|
public Result<String> add(@RequestBody FenceSaveReq fenceSaveReq) {
|
||||||
|
return toAjax(fenceService.save(Fence.saveBuild(fenceSaveReq)));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改电子围栏
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("customerBusiness:fence:edit")
|
||||||
|
@Log(title = "电子围栏", businessType = BusinessType.UPDATE)
|
||||||
|
@PutMapping("/{id}")
|
||||||
|
@ApiOperation("修改电子围栏")
|
||||||
|
public Result<String> edit(@PathVariable Long id, @RequestBody FenceEditReq fenceEditReq) {
|
||||||
|
return toAjax(fenceService.updateById(Fence.editBuild(id,fenceEditReq)));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除电子围栏
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("customerBusiness:fence:remove")
|
||||||
|
@Log(title = "电子围栏", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{ids}")
|
||||||
|
@ApiOperation("删除电子围栏")
|
||||||
|
@ApiImplicitParam(name = "id", value = "id", required = true, dataType = "Long", paramType = "path", dataTypeClass = String.class, example = "1,2,3,4")
|
||||||
|
public Result<String> remove(@PathVariable List<Long> ids) {
|
||||||
|
return toAjax(fenceService.removeBatchByIds(ids));
|
||||||
|
}
|
||||||
|
|
||||||
|
// @Scheduled(cron = "*/1 * * * * ?")
|
||||||
|
@PostMapping("/getConn")
|
||||||
|
public Result getConn(@RequestBody Vehicle vehicle) {
|
||||||
|
return fenceService.getConn(vehicle);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,154 @@
|
||||||
|
package com.muyu.customer.business.controller;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson2.JSON;
|
||||||
|
|
||||||
|
import com.muyu.common.core.domain.Result;
|
||||||
|
import com.muyu.common.core.utils.poi.ExcelUtil;
|
||||||
|
import com.muyu.common.core.web.controller.BaseController;
|
||||||
|
import com.muyu.common.core.web.page.TableDataInfo;
|
||||||
|
import com.muyu.common.log.annotation.Log;
|
||||||
|
import com.muyu.common.log.enums.BusinessType;
|
||||||
|
import com.muyu.common.security.annotation.RequiresPermissions;
|
||||||
|
import com.muyu.common.security.utils.SecurityUtils;
|
||||||
|
import com.muyu.customer.business.domain.IndexConfiguration;
|
||||||
|
import com.muyu.customer.business.domain.MessageDetail;
|
||||||
|
import com.muyu.customer.business.domain.Vehicle;
|
||||||
|
import com.muyu.customer.business.domain.req.IndexConfigurationEditReq;
|
||||||
|
import com.muyu.customer.business.domain.req.IndexConfigurationQueryReq;
|
||||||
|
import com.muyu.customer.business.domain.req.IndexConfigurationSaveReq;
|
||||||
|
import com.muyu.customer.business.mapper.MessageDetailMapper;
|
||||||
|
import com.muyu.customer.business.mapper.VehicleMapper;
|
||||||
|
import com.muyu.customer.business.service.IndexConfigurationService;
|
||||||
|
import com.muyu.customer.business.service.MessageDetailService;
|
||||||
|
import com.muyu.customer.business.service.VehicleService;
|
||||||
|
import io.swagger.annotations.*;
|
||||||
|
import lombok.extern.log4j.Log4j2;
|
||||||
|
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.data.redis.core.RedisTemplate;
|
||||||
|
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PutMapping;
|
||||||
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆指标预警配置Controller
|
||||||
|
*
|
||||||
|
* @author muyu
|
||||||
|
* @date 2024-06-28
|
||||||
|
*/
|
||||||
|
@Api(tags = "车辆指标预警配置")
|
||||||
|
@RestController
|
||||||
|
@Log4j2
|
||||||
|
@RequestMapping("/indexConfiguration")
|
||||||
|
public class IndexConfigurationController extends BaseController {
|
||||||
|
@Autowired
|
||||||
|
private IndexConfigurationService indexConfigurationService;
|
||||||
|
|
||||||
|
// @Autowired
|
||||||
|
// private VehicleMapper vehicleMapper;
|
||||||
|
@Autowired
|
||||||
|
private MessageDetailMapper messageDetailMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private RabbitTemplate rabbitTemplate;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private StringRedisTemplate redisTemplate;
|
||||||
|
/**
|
||||||
|
* 查询车辆指标预警配置列表
|
||||||
|
*/
|
||||||
|
@ApiOperation("获取车辆指标预警配置列表")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public Result<TableDataInfo<IndexConfiguration>> list(IndexConfigurationQueryReq indexConfigurationQueryReq) {
|
||||||
|
startPage();
|
||||||
|
List<IndexConfiguration> list = indexConfigurationService.list(IndexConfiguration.queryBuild(indexConfigurationQueryReq));
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出车辆指标预警配置列表
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("customerBusiness:indexConfiguration:list")
|
||||||
|
@ApiOperation("导出车辆指标预警配置列表")
|
||||||
|
@Log(title = "车辆指标预警配置", businessType = BusinessType.EXPORT)
|
||||||
|
@PostMapping("/export")
|
||||||
|
public void export(HttpServletResponse response, IndexConfiguration indexConfiguration) {
|
||||||
|
List<IndexConfiguration> list = indexConfigurationService.list(indexConfiguration);
|
||||||
|
ExcelUtil<IndexConfiguration> util = new ExcelUtil<IndexConfiguration>(IndexConfiguration.class);
|
||||||
|
util.exportExcel(response, list, "车辆指标预警配置数据");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取车辆指标预警配置详细信息
|
||||||
|
*/
|
||||||
|
@ApiOperation("获取车辆指标预警配置详细信息")
|
||||||
|
@RequiresPermissions("customerBusiness:indexConfiguration:query")
|
||||||
|
@GetMapping(value = "/{id}")
|
||||||
|
@ApiImplicitParam(name = "id", value = "id", required = true, dataType = "Long", paramType = "path", dataTypeClass = Long.class)
|
||||||
|
public Result<IndexConfiguration> getInfo(@PathVariable("id") Long id) {
|
||||||
|
return Result.success(indexConfigurationService.getById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增车辆指标预警配置
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("customerBusiness:indexConfiguration:add")
|
||||||
|
@Log(title = "车辆指标预警配置", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping
|
||||||
|
@ApiOperation("新增车辆指标预警配置")
|
||||||
|
public Result<String> add(@RequestBody IndexConfigurationSaveReq indexConfigurationSaveReq) {
|
||||||
|
|
||||||
|
indexConfigurationSaveReq.setOpportunity(indexConfigurationSaveReq.getIntervalRange()/indexConfigurationSaveReq.getOpportunity());
|
||||||
|
boolean save = indexConfigurationService.save(IndexConfiguration.saveBuild(indexConfigurationSaveReq));
|
||||||
|
redis(indexConfigurationSaveReq);
|
||||||
|
return toAjax(save);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改车辆指标预警配置
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("customerBusiness:indexConfiguration:edit")
|
||||||
|
@Log(title = "车辆指标预警配置", businessType = BusinessType.UPDATE)
|
||||||
|
@PutMapping("/{id}")
|
||||||
|
@ApiOperation("修改车辆指标预警配置")
|
||||||
|
public Result<String> edit(@PathVariable Long id, @RequestBody IndexConfigurationEditReq indexConfigurationEditReq) {
|
||||||
|
indexConfigurationEditReq.setOpportunity(indexConfigurationEditReq.getIntervalRange()/indexConfigurationEditReq.getOpportunity());
|
||||||
|
boolean update = indexConfigurationService.updateById(IndexConfiguration.editBuild(id, indexConfigurationEditReq));
|
||||||
|
// redis(indexConfigurationEditReq);
|
||||||
|
return toAjax(update);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除车辆指标预警配置
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("customerBusiness:indexConfiguration:remove")
|
||||||
|
@Log(title = "车辆指标预警配置", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{ids}")
|
||||||
|
@ApiOperation("删除车辆指标预警配置")
|
||||||
|
@ApiImplicitParam(name = "id", value = "id", required = true, dataType = "Long", paramType = "path", dataTypeClass = String.class, example = "1,2,3,4")
|
||||||
|
public Result<String> remove(@PathVariable List<Long> ids) {
|
||||||
|
return toAjax(indexConfigurationService.removeBatchByIds(ids));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private void redis(IndexConfigurationSaveReq indexConfigurationSaveReq) {
|
||||||
|
List<IndexConfiguration> list = indexConfigurationService.selectByVin(indexConfigurationSaveReq.getVin());
|
||||||
|
// list.add(IndexConfiguration.saveBuild(indexConfigurationSaveReq));
|
||||||
|
// list.stream().distinct();
|
||||||
|
redisTemplate.opsForHash().put("indexConfiguration", indexConfigurationSaveReq.getVin(), JSON.toJSONString(list));
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,122 @@
|
||||||
|
package com.muyu.customer.business.controller;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
import com.muyu.customer.business.domain.model.MessageDetailModel;
|
||||||
|
import com.muyu.customer.business.domain.req.MessageDetailEditReq;
|
||||||
|
import com.muyu.customer.business.domain.req.MessageDetailQueryReq;
|
||||||
|
import com.muyu.customer.business.domain.req.MessageDetailSaveReq;
|
||||||
|
import io.swagger.annotations.*;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PutMapping;
|
||||||
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
import com.muyu.common.core.domain.Result;
|
||||||
|
import com.muyu.common.core.utils.poi.ExcelUtil;
|
||||||
|
import com.muyu.common.core.web.controller.BaseController;
|
||||||
|
import com.muyu.common.log.annotation.Log;
|
||||||
|
import com.muyu.common.log.enums.BusinessType;
|
||||||
|
import com.muyu.common.security.annotation.RequiresPermissions;
|
||||||
|
import com.muyu.customer.business.domain.MessageDetail;
|
||||||
|
import com.muyu.customer.business.service.MessageDetailService;
|
||||||
|
import com.muyu.common.core.web.page.TableDataInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 报文详情Controller
|
||||||
|
*
|
||||||
|
* @author muyu
|
||||||
|
* @date 2024-06-28
|
||||||
|
*/
|
||||||
|
@Api(tags = "报文详情")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/detail")
|
||||||
|
public class MessageDetailController extends BaseController {
|
||||||
|
@Autowired
|
||||||
|
private MessageDetailService messageDetailService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询报文详情列表
|
||||||
|
*/
|
||||||
|
@ApiOperation("获取报文详情列表")
|
||||||
|
@RequiresPermissions("customerBusiness:detail:list")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public Result<TableDataInfo<MessageDetail>> list(MessageDetailQueryReq messageDetailQueryReq) {
|
||||||
|
startPage();
|
||||||
|
List<MessageDetail> list = messageDetailService.list(MessageDetail.queryBuild(messageDetailQueryReq));
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出报文详情列表
|
||||||
|
*/
|
||||||
|
@ApiOperation("导出报文详情列表")
|
||||||
|
@RequiresPermissions("customerBusiness:detail:export")
|
||||||
|
@Log(title = "报文详情", businessType = BusinessType.EXPORT)
|
||||||
|
@PostMapping("/export")
|
||||||
|
public void export(HttpServletResponse response, MessageDetail messageDetail) {
|
||||||
|
List<MessageDetail> list = messageDetailService.list(messageDetail);
|
||||||
|
ExcelUtil<MessageDetail> util = new ExcelUtil<MessageDetail>(MessageDetail.class);
|
||||||
|
util.exportExcel(response, list, "报文详情数据");
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/selectByVin/{vin}")
|
||||||
|
public Result<List<MessageDetail>> selectByVin(@PathVariable String vin) {
|
||||||
|
return Result.success(messageDetailService.selectMessage(vin));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取报文详情详细信息
|
||||||
|
*/
|
||||||
|
@ApiOperation("获取报文详情详细信息")
|
||||||
|
@RequiresPermissions("customerBusiness:detail:query")
|
||||||
|
@GetMapping(value = "/{id}")
|
||||||
|
@ApiImplicitParam(name = "id", value = "id", required = true, dataType = "Long", paramType = "path", dataTypeClass = Long.class)
|
||||||
|
public Result<MessageDetail> getInfo(@PathVariable("id") Long id) {
|
||||||
|
return Result.success(messageDetailService.getById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增报文详情
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("customerBusiness:detail:add")
|
||||||
|
@Log(title = "报文详情", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping
|
||||||
|
@ApiOperation("新增报文详情")
|
||||||
|
public Result<String> add(@RequestBody MessageDetailModel messageDetailModel) {
|
||||||
|
return messageDetailService.add(messageDetailModel);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改报文详情
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("customerBusiness:detail:edit")
|
||||||
|
@Log(title = "报文详情", businessType = BusinessType.UPDATE)
|
||||||
|
@PutMapping("/{id}")
|
||||||
|
@ApiOperation("修改报文详情")
|
||||||
|
public Result<String> edit(@PathVariable Long id, @RequestBody MessageDetailEditReq messageDetailEditReq) {
|
||||||
|
return toAjax(messageDetailService.updateById(MessageDetail.editBuild(id,messageDetailEditReq)));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/updateMessage")
|
||||||
|
public Result<String> updateMessage(@RequestBody MessageDetailModel messageDetailModel) {
|
||||||
|
return messageDetailService.updateVehicle(messageDetailModel);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除报文详情
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("customerBusiness:detail:remove")
|
||||||
|
@Log(title = "报文详情", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{ids}")
|
||||||
|
@ApiOperation("删除报文详情")
|
||||||
|
@ApiImplicitParam(name = "id", value = "id", required = true, dataType = "Long", paramType = "path", dataTypeClass = String.class, example = "1,2,3,4")
|
||||||
|
public Result<String> remove(@PathVariable List<Long> ids) {
|
||||||
|
return toAjax(messageDetailService.removeBatchByIds(ids));
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,18 +1,20 @@
|
||||||
package com.muyu.customer.business.controller;
|
package com.muyu.customer.business.controller;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.concurrent.ExecutorService;
|
||||||
|
import java.util.concurrent.Executors;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
import com.muyu.common.redis.service.RedisService;
|
||||||
|
import com.muyu.common.security.utils.SecurityUtils;
|
||||||
|
import com.muyu.customer.business.domain.MessageDetail;
|
||||||
|
import com.muyu.customer.business.domain.model.VehicleModel;
|
||||||
import io.swagger.annotations.*;
|
import io.swagger.annotations.*;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.PutMapping;
|
|
||||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
import com.muyu.common.core.domain.Result;
|
import com.muyu.common.core.domain.Result;
|
||||||
import com.muyu.common.core.utils.poi.ExcelUtil;
|
import com.muyu.common.core.utils.poi.ExcelUtil;
|
||||||
import com.muyu.common.core.web.controller.BaseController;
|
import com.muyu.common.core.web.controller.BaseController;
|
||||||
|
@ -21,8 +23,6 @@ import com.muyu.common.log.enums.BusinessType;
|
||||||
import com.muyu.common.security.annotation.RequiresPermissions;
|
import com.muyu.common.security.annotation.RequiresPermissions;
|
||||||
import com.muyu.customer.business.domain.Vehicle;
|
import com.muyu.customer.business.domain.Vehicle;
|
||||||
import com.muyu.customer.business.domain.req.VehicleQueryReq;
|
import com.muyu.customer.business.domain.req.VehicleQueryReq;
|
||||||
import com.muyu.customer.business.domain.req.VehicleSaveReq;
|
|
||||||
import com.muyu.customer.business.domain.req.VehicleEditReq;
|
|
||||||
import com.muyu.customer.business.service.VehicleService;
|
import com.muyu.customer.business.service.VehicleService;
|
||||||
import com.muyu.common.core.web.page.TableDataInfo;
|
import com.muyu.common.core.web.page.TableDataInfo;
|
||||||
|
|
||||||
|
@ -38,6 +38,12 @@ import com.muyu.common.core.web.page.TableDataInfo;
|
||||||
public class VehicleController extends BaseController {
|
public class VehicleController extends BaseController {
|
||||||
@Autowired
|
@Autowired
|
||||||
private VehicleService vehicleService;
|
private VehicleService vehicleService;
|
||||||
|
@Autowired
|
||||||
|
private HttpServletRequest request;
|
||||||
|
@Autowired
|
||||||
|
private StringRedisTemplate redisTemplate;
|
||||||
|
@Autowired
|
||||||
|
private RedisService redisService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询车辆录入列表
|
* 查询车辆录入列表
|
||||||
|
@ -47,7 +53,23 @@ public class VehicleController extends BaseController {
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
public Result<TableDataInfo<Vehicle>> list(VehicleQueryReq vehicleQueryReq) {
|
public Result<TableDataInfo<Vehicle>> list(VehicleQueryReq vehicleQueryReq) {
|
||||||
startPage();
|
startPage();
|
||||||
|
|
||||||
List<Vehicle> list = vehicleService.list(Vehicle.queryBuild(vehicleQueryReq));
|
List<Vehicle> list = vehicleService.list(Vehicle.queryBuild(vehicleQueryReq));
|
||||||
|
ExecutorService executor = Executors.newFixedThreadPool(list.size());
|
||||||
|
list.forEach(vehicle -> {
|
||||||
|
executor.submit(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
redisTemplate
|
||||||
|
.opsForValue()
|
||||||
|
.set(vehicle.getVin()+"1",
|
||||||
|
String.valueOf(SecurityUtils.getLoginUser().getSysUser().getEnterpriseId()),
|
||||||
|
24,
|
||||||
|
TimeUnit.HOURS);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -71,8 +93,8 @@ public class VehicleController extends BaseController {
|
||||||
@RequiresPermissions("customerBusiness:vehicle:query")
|
@RequiresPermissions("customerBusiness:vehicle:query")
|
||||||
@GetMapping(value = "/{id}")
|
@GetMapping(value = "/{id}")
|
||||||
@ApiImplicitParam(name = "id", value = "id", required = true, dataType = "Long", paramType = "path", dataTypeClass = Long.class)
|
@ApiImplicitParam(name = "id", value = "id", required = true, dataType = "Long", paramType = "path", dataTypeClass = Long.class)
|
||||||
public Result<Vehicle> getInfo(@PathVariable("id") Long id) {
|
public Result<VehicleModel> getInfo(@PathVariable("id") Long id) {
|
||||||
return Result.success(vehicleService.getById(id));
|
return Result.success(vehicleService.selectById(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -82,8 +104,9 @@ public class VehicleController extends BaseController {
|
||||||
@Log(title = "车辆录入", businessType = BusinessType.INSERT)
|
@Log(title = "车辆录入", businessType = BusinessType.INSERT)
|
||||||
@PostMapping
|
@PostMapping
|
||||||
@ApiOperation("新增车辆录入")
|
@ApiOperation("新增车辆录入")
|
||||||
public Result<String> add(@RequestBody VehicleSaveReq vehicleSaveReq) {
|
public Result add(@RequestBody VehicleModel vehicleModel) {
|
||||||
return toAjax(vehicleService.save(Vehicle.saveBuild(vehicleSaveReq)));
|
|
||||||
|
return Result.success(vehicleService.add(vehicleModel));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -93,8 +116,8 @@ public class VehicleController extends BaseController {
|
||||||
@Log(title = "车辆录入", businessType = BusinessType.UPDATE)
|
@Log(title = "车辆录入", businessType = BusinessType.UPDATE)
|
||||||
@PutMapping("/{id}")
|
@PutMapping("/{id}")
|
||||||
@ApiOperation("修改车辆录入")
|
@ApiOperation("修改车辆录入")
|
||||||
public Result<String> edit(@PathVariable Long id, @RequestBody VehicleEditReq vehicleEditReq) {
|
public Result<String> edit(@PathVariable Long id, @RequestBody VehicleModel vehicleModel) {
|
||||||
return toAjax(vehicleService.updateById(Vehicle.editBuild(id,vehicleEditReq)));
|
return vehicleService.updateVehicle(id, vehicleModel);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -108,4 +131,23 @@ public class VehicleController extends BaseController {
|
||||||
public Result<String> remove(@PathVariable List<Long> ids) {
|
public Result<String> remove(@PathVariable List<Long> ids) {
|
||||||
return toAjax(vehicleService.removeBatchByIds(ids));
|
return toAjax(vehicleService.removeBatchByIds(ids));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询报文详情列表
|
||||||
|
*/
|
||||||
|
@GetMapping("/MessageList")
|
||||||
|
public Result<List<MessageDetail>> MessageList() {
|
||||||
|
return Result.success(vehicleService.MessageList());
|
||||||
|
}
|
||||||
|
|
||||||
|
// @Autowired
|
||||||
|
// private VehicleMapper vehicleMapper;
|
||||||
|
//
|
||||||
|
// @GetMapping("/list/all")
|
||||||
|
// public Result<List<Vehicle>> findAll () {
|
||||||
|
// return Result.success(vehicleMapper.selectList(new QueryWrapper<>()));
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,39 @@
|
||||||
|
package com.muyu.customer.business.controller;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson2.JSON;
|
||||||
|
import com.muyu.common.core.domain.Result;
|
||||||
|
import com.muyu.common.core.web.controller.BaseController;
|
||||||
|
import com.muyu.customer.business.domain.Vehicle;
|
||||||
|
import lombok.extern.log4j.Log4j2;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.data.redis.core.RedisTemplate;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆录入对象 VehicleInfoController
|
||||||
|
*
|
||||||
|
* @author DeKangLiu
|
||||||
|
* Date 2024/6/22 20:31
|
||||||
|
*/
|
||||||
|
@Log4j2
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/vehicleInfo")
|
||||||
|
public class VehicleInfoController extends BaseController {
|
||||||
|
@Autowired
|
||||||
|
private RedisTemplate<String,String> redisTemplate;
|
||||||
|
|
||||||
|
@GetMapping("/list/{vin}")
|
||||||
|
public Result vehicleInfoAllList(@PathVariable String vin){
|
||||||
|
|
||||||
|
if (redisTemplate.hasKey(vin)){
|
||||||
|
String lastElement = redisTemplate.opsForList().index(vin, -1);
|
||||||
|
Vehicle vehicleInfo = JSON.parseObject(lastElement, Vehicle.class);
|
||||||
|
return Result.success(vehicleInfo);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,14 @@
|
||||||
|
package com.muyu.customer.business.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.muyu.customer.business.domain.FaultCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆故障码Mapper接口
|
||||||
|
*
|
||||||
|
* @author muyu
|
||||||
|
* @date 2024-06-20
|
||||||
|
*/
|
||||||
|
public interface FaultCodeMapper extends BaseMapper<FaultCode> {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,22 @@
|
||||||
|
package com.muyu.customer.business.mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.muyu.customer.business.domain.FaultRecord;
|
||||||
|
import com.muyu.customer.business.domain.vo.FaultRecordVo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 故障记录Mapper接口
|
||||||
|
*
|
||||||
|
* @author muyu
|
||||||
|
* @date 2024-06-20
|
||||||
|
*/
|
||||||
|
public interface FaultRecordMapper extends BaseMapper<FaultRecord> {
|
||||||
|
|
||||||
|
|
||||||
|
FaultRecord selectFault(FaultRecord build);
|
||||||
|
|
||||||
|
void updateFault(FaultRecord faultRecordOne);
|
||||||
|
|
||||||
|
List<FaultRecordVo> countList();
|
||||||
|
}
|
|
@ -0,0 +1,14 @@
|
||||||
|
package com.muyu.customer.business.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.muyu.customer.business.domain.Fence;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电子围栏Mapper接口
|
||||||
|
*
|
||||||
|
* @author muyu
|
||||||
|
* @date 2024-05-31
|
||||||
|
*/
|
||||||
|
public interface FenceMapper extends BaseMapper<Fence> {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
package com.muyu.customer.business.mapper;
|
||||||
|
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.muyu.customer.business.domain.IndexConfiguration;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆指标预警配置Mapper接口
|
||||||
|
*
|
||||||
|
* @author chx
|
||||||
|
* @date 2024-06-28
|
||||||
|
*/
|
||||||
|
public interface IndexConfigurationMapper extends BaseMapper<IndexConfiguration> {
|
||||||
|
|
||||||
|
List<IndexConfiguration> selectByVin(@Param("vin") String vin);
|
||||||
|
}
|
|
@ -0,0 +1,24 @@
|
||||||
|
package com.muyu.customer.business.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.muyu.customer.business.domain.MessageDetail;
|
||||||
|
import com.muyu.customer.business.domain.Vehicle;
|
||||||
|
import com.muyu.customer.business.domain.model.VehicleMiddle;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 报文详情Mapper接口
|
||||||
|
*
|
||||||
|
* @author muyu
|
||||||
|
* @date 2024-06-28
|
||||||
|
*/
|
||||||
|
public interface MessageDetailMapper extends BaseMapper<MessageDetail> {
|
||||||
|
|
||||||
|
Vehicle selectByVin(@Param("vin") String vin);
|
||||||
|
|
||||||
|
List<Integer> selectByVehicleId(@Param("id") Long id);
|
||||||
|
|
||||||
|
List<MessageDetail> selectMessage(@Param("list") List<Integer> vehicleMiddleList);
|
||||||
|
}
|
|
@ -2,7 +2,10 @@ package com.muyu.customer.business.mapper;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.muyu.customer.business.domain.MessageDetail;
|
||||||
import com.muyu.customer.business.domain.Vehicle;
|
import com.muyu.customer.business.domain.Vehicle;
|
||||||
|
import com.muyu.customer.business.domain.model.VehicleModel;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 车辆录入Mapper接口
|
* 车辆录入Mapper接口
|
||||||
|
@ -12,4 +15,21 @@ import com.muyu.customer.business.domain.Vehicle;
|
||||||
*/
|
*/
|
||||||
public interface VehicleMapper extends BaseMapper<Vehicle> {
|
public interface VehicleMapper extends BaseMapper<Vehicle> {
|
||||||
|
|
||||||
|
List<MessageDetail> MessageList();
|
||||||
|
|
||||||
|
void add(VehicleModel vehicleModel);
|
||||||
|
|
||||||
|
void addMiddle(@Param("id") Long id, @Param("integer") Integer integer);
|
||||||
|
|
||||||
|
List<Integer> selectMessageList(@Param("id") Long id);
|
||||||
|
|
||||||
|
VehicleModel selectId(@Param("id") Long id);
|
||||||
|
|
||||||
|
List<MessageDetail> selectMessage(@Param("id") Long id);
|
||||||
|
|
||||||
|
int updateVehicle(@Param("id") Long id, @Param("vehicleModel") VehicleModel vehicleModel);
|
||||||
|
|
||||||
|
MessageDetail selectDetail(@Param("s") Integer s);
|
||||||
|
|
||||||
|
void deleteMiddle(@Param("id") Long id);
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
package com.muyu.customer.business.saas.contents;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author DongZl
|
||||||
|
* @description: 数据源常量
|
||||||
|
* @Date 2023-8-1 上午 11:02
|
||||||
|
*/
|
||||||
|
public class DatasourceContent {
|
||||||
|
|
||||||
|
public final static String DATASOURCE_URL = "jdbc:mysql://{}:{}/vehicle_networking?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8";
|
||||||
|
|
||||||
|
public final static String USER_NAME = "root";
|
||||||
|
|
||||||
|
public final static String PASSWORD = "L041120D";
|
||||||
|
}
|
|
@ -0,0 +1,12 @@
|
||||||
|
package com.muyu.customer.business.saas.contents;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SaaS常量 SaaSConstant
|
||||||
|
*
|
||||||
|
* @author DeKangLiu
|
||||||
|
* Date 2024/6/4 18:34
|
||||||
|
*/
|
||||||
|
public class SaaSConstant {
|
||||||
|
|
||||||
|
public final static String SAAS_KEY="enterprise-code";
|
||||||
|
}
|
|
@ -0,0 +1,120 @@
|
||||||
|
package com.muyu.customer.business.saas.datasource;
|
||||||
|
|
||||||
|
import com.alibaba.druid.pool.DruidDataSource;
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.muyu.common.core.utils.SpringUtils;
|
||||||
|
|
||||||
|
import com.muyu.common.redis.service.RedisService;
|
||||||
|
import com.muyu.customer.business.saas.factory.DruidDataSourceFactory;
|
||||||
|
import com.muyu.customer.business.saas.domain.model.DataSourceInfo;
|
||||||
|
import com.muyu.customer.business.saas.role.DynamicDataSource;
|
||||||
|
import com.muyu.net.working.remote.RemoteDatasourceService;
|
||||||
|
import com.rabbitmq.client.Channel;
|
||||||
|
import lombok.extern.log4j.Log4j2;
|
||||||
|
import org.springframework.amqp.core.Message;
|
||||||
|
import org.springframework.amqp.rabbit.annotation.Queue;
|
||||||
|
import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
||||||
|
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Lazy;
|
||||||
|
import org.springframework.context.annotation.Primary;
|
||||||
|
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import com.muyu.net.working.domain.DataSource;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 多数据源 ManyDataSource
|
||||||
|
*
|
||||||
|
* @author DeKangLiu
|
||||||
|
* Date 2024/6/3 20:01
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
@Log4j2
|
||||||
|
@AutoConfigureBefore(RedisService.class)
|
||||||
|
public class ManyDataSource {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private StringRedisTemplate redisTemplate;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private RemoteDatasourceService remoteDatasourceService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private RabbitTemplate rabbitTemplate;
|
||||||
|
@RabbitListener(queuesToDeclare = {@Queue(name = "liu-vehicle-exchange")})
|
||||||
|
public void smsConfig(String msg, Message message, Channel channel){
|
||||||
|
//获取消息的ID
|
||||||
|
String messageId = message.getMessageProperties().getMessageId();
|
||||||
|
try {
|
||||||
|
//添加消息id到redis set集合中 添加成功返回1 表示未消费 添加失败返回0 表示已消费
|
||||||
|
Long count = redisTemplate.opsForSet().add("messageId", messageId);
|
||||||
|
//添加成功 正常消费信息
|
||||||
|
if (count == 1) {
|
||||||
|
log.info("开始消费");
|
||||||
|
druidData(msg);
|
||||||
|
//确认消费
|
||||||
|
channel.basicAck(message.getMessageProperties().getDeliveryTag(),false);
|
||||||
|
log.info("消费成功");
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.info("消费失败,尝试重连");
|
||||||
|
try {
|
||||||
|
//回退消息,尝试重连
|
||||||
|
druidData(msg);
|
||||||
|
channel.basicReject(message.getMessageProperties().getDeliveryTag(),false);
|
||||||
|
log.info("消费失败");
|
||||||
|
} catch (IOException ex) {
|
||||||
|
//回退失败
|
||||||
|
log.info("消费异常");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void druidData(String msg) {
|
||||||
|
DataSource entInfo= JSON.parseObject(msg, DataSource.class);
|
||||||
|
log.info("消息为:{}",entInfo);
|
||||||
|
DruidDataSourceFactory druidDataSourceFactory = SpringUtils.getBean(DruidDataSourceFactory.class);
|
||||||
|
DynamicDataSource dynamicDataSource = SpringUtils.getBean(DynamicDataSource.class);
|
||||||
|
DataSourceInfo dataSourceInfo = DataSourceInfo.hostAndPortBuild(entInfo.getEnterpriseCode(), entInfo.getIp(), entInfo.getPort());
|
||||||
|
DruidDataSource druidDataSource = druidDataSourceFactory.create(dataSourceInfo);
|
||||||
|
dynamicDataSource.put(dataSourceInfo.getKey(), druidDataSource);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Lazy
|
||||||
|
private List<DataSource> dataSourceInfoList(){
|
||||||
|
List<DataSource> databaseNameList = new ArrayList<>(){{
|
||||||
|
add(DataSource.builder()
|
||||||
|
.enterpriseCode("liu_44")
|
||||||
|
.ip("192.168.116.129")
|
||||||
|
.port(3350)
|
||||||
|
.build());
|
||||||
|
}};
|
||||||
|
List<DataSource> list = remoteDatasourceService.listAll();
|
||||||
|
System.out.println(list);
|
||||||
|
databaseNameList.addAll(list);
|
||||||
|
return databaseNameList;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
@Primary
|
||||||
|
public DynamicDataSource dynamicDataSource(DruidDataSourceFactory druidDataSourceFactory) {
|
||||||
|
//查企业
|
||||||
|
Map<Object, Object> dataSourceMap = new HashMap<>();
|
||||||
|
dataSourceInfoList()
|
||||||
|
.stream()
|
||||||
|
.map(entInfo-> DataSourceInfo.hostAndPortBuild(entInfo.getEnterpriseCode(),entInfo.getIp(),entInfo.getPort()))
|
||||||
|
.forEach(dataSourceInfo -> {
|
||||||
|
dataSourceMap.put(dataSourceInfo.getKey(), druidDataSourceFactory.create(dataSourceInfo));
|
||||||
|
});
|
||||||
|
//设置动态数据源
|
||||||
|
DynamicDataSource dynamicDataSource = new DynamicDataSource();
|
||||||
|
// dynamicDataSource.setDefaultTargetDataSource(masterDataSource());
|
||||||
|
dynamicDataSource.setTargetDataSources(dataSourceMap);
|
||||||
|
//将数据源信息备份在defineTargetDataSources中
|
||||||
|
dynamicDataSource.setDefineTargetDataSources(dataSourceMap);
|
||||||
|
return dynamicDataSource;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,52 @@
|
||||||
|
package com.muyu.customer.business.saas.domain.model;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.muyu.common.core.annotation.Excel;
|
||||||
|
import com.muyu.common.core.web.domain.BaseEntity;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 多数据源对象 DataSource
|
||||||
|
*
|
||||||
|
* @author DeKangLiu
|
||||||
|
* Date 2024/6/22 22:56
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@SuperBuilder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@TableName("datasource")
|
||||||
|
public class DataSource extends BaseEntity {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/** 主键 */
|
||||||
|
@TableId(value = "id",type = IdType.AUTO)
|
||||||
|
@ApiModelProperty(name = "主键", value = "主键")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/** 数据源key */
|
||||||
|
@Excel(name = "数据源key")
|
||||||
|
@ApiModelProperty(name = "数据源key", value = "数据源key")
|
||||||
|
private String enterpriseCode;
|
||||||
|
|
||||||
|
/** 数据源端口 */
|
||||||
|
@Excel(name = "数据源端口")
|
||||||
|
@ApiModelProperty(name = "数据源端口", value = "数据源端口")
|
||||||
|
private Integer port;
|
||||||
|
|
||||||
|
/** 数据源ip */
|
||||||
|
@Excel(name = "数据源ip")
|
||||||
|
@ApiModelProperty(name = "数据源ip", value = "数据源ip")
|
||||||
|
private String ip;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,52 @@
|
||||||
|
package com.muyu.customer.business.saas.domain.model;
|
||||||
|
|
||||||
|
|
||||||
|
import com.muyu.common.core.utils.StringUtils;
|
||||||
|
import com.muyu.customer.business.saas.contents.DatasourceContent;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author DongZl
|
||||||
|
* @description: 数据源实体类
|
||||||
|
* @Date 2023-8-1 上午 11:15
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class DataSourceInfo {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 键
|
||||||
|
*/
|
||||||
|
private String key;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 地址
|
||||||
|
*/
|
||||||
|
private String url;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户名
|
||||||
|
*/
|
||||||
|
private String userName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户密码
|
||||||
|
*/
|
||||||
|
private String password;
|
||||||
|
|
||||||
|
|
||||||
|
public static DataSourceInfo hostAndPortBuild(String key,String host, Integer port){
|
||||||
|
return DataSourceInfo.builder()
|
||||||
|
.key(key)
|
||||||
|
.url(StringUtils.format(DatasourceContent.DATASOURCE_URL, host,port))
|
||||||
|
.password(DatasourceContent.PASSWORD)
|
||||||
|
.userName(DatasourceContent.USER_NAME)
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,39 @@
|
||||||
|
package com.muyu.customer.business.saas.factory;
|
||||||
|
|
||||||
|
import com.alibaba.druid.pool.DruidDataSource;
|
||||||
|
import com.muyu.customer.business.saas.domain.model.DataSourceInfo;
|
||||||
|
import lombok.extern.log4j.Log4j2;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.sql.SQLException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Druid工厂 DruidDataSourceFactory
|
||||||
|
*
|
||||||
|
* @author DeKangLiu
|
||||||
|
* Date 2024/6/3 20:12
|
||||||
|
*/
|
||||||
|
@Log4j2
|
||||||
|
@Component
|
||||||
|
public class DruidDataSourceFactory {
|
||||||
|
/**
|
||||||
|
* @Description: 根据传递的数据源信息测试数据库连接
|
||||||
|
* @Author Dongzl
|
||||||
|
*/
|
||||||
|
public DruidDataSource create(DataSourceInfo dataSourceInfo) {
|
||||||
|
DruidDataSource druidDataSource = new DruidDataSource();
|
||||||
|
druidDataSource.setUrl(dataSourceInfo.getUrl());
|
||||||
|
druidDataSource.setUsername(dataSourceInfo.getUserName());
|
||||||
|
druidDataSource.setPassword(dataSourceInfo.getPassword());
|
||||||
|
druidDataSource.setBreakAfterAcquireFailure(true);
|
||||||
|
druidDataSource.setConnectionErrorRetryAttempts(0);
|
||||||
|
try {
|
||||||
|
druidDataSource.getConnection(2000);
|
||||||
|
log.info("{} -> 数据源连接成功", dataSourceInfo.getKey());
|
||||||
|
return druidDataSource;
|
||||||
|
} catch (SQLException throwables) {
|
||||||
|
log.error("数据源 {} 连接失败,用户名:{},密码 {}",dataSourceInfo.getUrl(),dataSourceInfo.getUserName(),dataSourceInfo.getPassword());
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,42 @@
|
||||||
|
package com.muyu.customer.business.saas.holder;
|
||||||
|
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.util.Assert;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据源切换处理
|
||||||
|
*
|
||||||
|
* @author Dongzl
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
public class DynamicDataSourceHolder {
|
||||||
|
/**
|
||||||
|
* 保存动态数据源名称
|
||||||
|
*/
|
||||||
|
private static final ThreadLocal<String> DYNAMIC_DATASOURCE_KEY = new ThreadLocal<>();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置/切换数据源,决定当前线程使用哪个数据源
|
||||||
|
*/
|
||||||
|
public static void setDynamicDataSourceKey(String key){
|
||||||
|
log.info("数据源切换为:{}",key);
|
||||||
|
DYNAMIC_DATASOURCE_KEY.set(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取动态数据源名称,默认使用mater数据源
|
||||||
|
*/
|
||||||
|
public static String getDynamicDataSourceKey(){
|
||||||
|
String key = DYNAMIC_DATASOURCE_KEY.get();
|
||||||
|
Assert.notNull(key, "请携带数据标识");
|
||||||
|
return key;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 移除当前数据源
|
||||||
|
*/
|
||||||
|
public static void removeDynamicDataSourceKey(){
|
||||||
|
log.info("移除数据源:{}",DYNAMIC_DATASOURCE_KEY.get());
|
||||||
|
DYNAMIC_DATASOURCE_KEY.remove();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,51 @@
|
||||||
|
package com.muyu.customer.business.saas.role;
|
||||||
|
|
||||||
|
|
||||||
|
import com.muyu.common.security.utils.SecurityUtils;
|
||||||
|
import com.muyu.common.system.domain.SysUser;
|
||||||
|
import com.muyu.common.system.remote.RemoteUserService;
|
||||||
|
import com.muyu.customer.business.saas.holder.DynamicDataSourceHolder;
|
||||||
|
import org.aspectj.lang.annotation.After;
|
||||||
|
import org.aspectj.lang.annotation.Aspect;
|
||||||
|
import org.aspectj.lang.annotation.Before;
|
||||||
|
import org.aspectj.lang.annotation.Pointcut;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Lazy;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 多数据源切面
|
||||||
|
*
|
||||||
|
* @author DeKangLiu
|
||||||
|
* Date 2024/6/3 20:12
|
||||||
|
*/
|
||||||
|
@Aspect
|
||||||
|
@Component
|
||||||
|
public class DataSourceAsp {
|
||||||
|
@Lazy
|
||||||
|
@Autowired
|
||||||
|
private RemoteUserService remoteUserService;
|
||||||
|
|
||||||
|
@Pointcut("execution(public * com.muyu.customer.business.controller.*Controller.*(..))")
|
||||||
|
public void pointcut () {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 的每一個方法執行之前 執行的處理
|
||||||
|
*/
|
||||||
|
@Before("pointcut()")
|
||||||
|
public void beforeMethod() {
|
||||||
|
Integer enterpriseId = SecurityUtils.getLoginUser().getSysUser().getEnterpriseId();
|
||||||
|
DynamicDataSourceHolder.setDynamicDataSourceKey("liu_"+enterpriseId);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 的每一個方法執行之后 執行的處理
|
||||||
|
* 无论正常还是异常终了
|
||||||
|
* 不能接受到返回值
|
||||||
|
*/
|
||||||
|
@After("pointcut()")
|
||||||
|
public void afterMethod() {
|
||||||
|
DynamicDataSourceHolder.removeDynamicDataSourceKey();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,52 @@
|
||||||
|
package com.muyu.customer.business.saas.role;
|
||||||
|
|
||||||
|
import com.alibaba.druid.pool.DruidDataSource;
|
||||||
|
import com.muyu.customer.business.saas.holder.DynamicDataSourceHolder;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 动态数据源
|
||||||
|
* 调用AddDefineDataSource组件的addDefineDynamicDataSource()方法,获取原来targetdatasources的map,并将新的数据源信息添加到map中,并替换targetdatasources中的map
|
||||||
|
* 切换数据源时可以使用@DataSource(value = "数据源名称"),或者DynamicDataSourceContextHolder.setContextKey("数据源名称")
|
||||||
|
* @author Dongzl
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class DynamicDataSource extends AbstractRoutingDataSource {
|
||||||
|
//备份所有数据源信息,备份的是个 指针!!!
|
||||||
|
private Map<Object, Object> defineTargetDataSources;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判定键是否出站了
|
||||||
|
* @param key 键
|
||||||
|
* @return 存在结束 true 存在 false 不存在
|
||||||
|
*/
|
||||||
|
public boolean hashKye(String key){
|
||||||
|
return defineTargetDataSources.containsKey(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加数据库
|
||||||
|
* @param key 键
|
||||||
|
* @param value 数据值
|
||||||
|
*/
|
||||||
|
public void put(String key, DruidDataSource value){
|
||||||
|
defineTargetDataSources.put(key,value);
|
||||||
|
this.afterPropertiesSet();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 决定当前线程使用哪个数据源
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
protected Object determineCurrentLookupKey() {
|
||||||
|
return DynamicDataSourceHolder.getDynamicDataSourceKey();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,22 @@
|
||||||
|
package com.muyu.customer.business.service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.muyu.customer.business.domain.FaultCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆故障码Service接口
|
||||||
|
*
|
||||||
|
* @author muyu
|
||||||
|
* @date 2024-06-20
|
||||||
|
*/
|
||||||
|
public interface FaultCodeService extends IService<FaultCode> {
|
||||||
|
/**
|
||||||
|
* 查询车辆故障码列表
|
||||||
|
*
|
||||||
|
* @param faultCode 车辆故障码
|
||||||
|
* @return 车辆故障码集合
|
||||||
|
*/
|
||||||
|
public List<FaultCode> list(FaultCode faultCode);
|
||||||
|
|
||||||
|
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue