Compare commits
28 Commits
Author | SHA1 | Date |
---|---|---|
|
85cca29ca5 | |
|
b063dfca72 | |
|
8733328cb1 | |
|
9fec99677e | |
|
cb700cf596 | |
|
9d9e457d7a | |
|
007aa4c276 | |
|
ababc20a27 | |
|
df01c0a5ee | |
|
cbfe72810e | |
|
0d68b51739 | |
|
a640ca19d2 | |
|
7597af50aa | |
|
a7adac6613 | |
|
bdbfc8ed3a | |
|
7b0ea31558 | |
|
d3c9aeee59 | |
|
8cee0c4e43 | |
|
fd28a8fbc8 | |
|
bf7239464e | |
|
b7748c9606 | |
|
a51d27fb72 | |
|
d6c0538b01 | |
|
9100c76db4 | |
|
a5f16646d4 | |
|
11871c4b02 | |
|
cd8a13e2d9 | |
|
9c612b837c |
|
@ -52,6 +52,7 @@
|
|||
<artifactId>muyu-common-security</artifactId>
|
||||
</dependency>
|
||||
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
|
|
@ -21,9 +21,9 @@ public class SysPasswordService {
|
|||
@Autowired
|
||||
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
|
||||
private SysRecordLogService recordLogService;
|
||||
|
|
|
@ -14,10 +14,10 @@ spring:
|
|||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 127.0.0.1:8848
|
||||
server-addr: 43.142.100.73:8848
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 127.0.0.1:8848
|
||||
server-addr: 43.142.100.73:8848
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
|
|
@ -21,134 +21,134 @@ public @interface Excel {
|
|||
/**
|
||||
* 导出时在excel中排序
|
||||
*/
|
||||
public int sort () default Integer.MAX_VALUE;
|
||||
int sort() default Integer.MAX_VALUE;
|
||||
|
||||
/**
|
||||
* 导出到Excel中的名字.
|
||||
*/
|
||||
public String name () default "";
|
||||
String name() default "";
|
||||
|
||||
/**
|
||||
* 日期格式, 如: yyyy-MM-dd
|
||||
*/
|
||||
public String dateFormat () default "";
|
||||
String dateFormat() default "";
|
||||
|
||||
/**
|
||||
* 读取内容转表达式 (如: 0=男,1=女,2=未知)
|
||||
*/
|
||||
public String readConverterExp () default "";
|
||||
String readConverterExp() default "";
|
||||
|
||||
/**
|
||||
* 分隔符,读取字符串组内容
|
||||
*/
|
||||
public String separator () default ",";
|
||||
String separator() default ",";
|
||||
|
||||
/**
|
||||
* BigDecimal 精度 默认:-1(默认不开启BigDecimal格式化)
|
||||
*/
|
||||
public int scale () default -1;
|
||||
int scale() default -1;
|
||||
|
||||
/**
|
||||
* BigDecimal 舍入规则 默认:BigDecimal.ROUND_HALF_EVEN
|
||||
*/
|
||||
public int roundingMode () default BigDecimal.ROUND_HALF_EVEN;
|
||||
int roundingMode() default BigDecimal.ROUND_HALF_EVEN;
|
||||
|
||||
/**
|
||||
* 导出时在excel中每个列的高度
|
||||
*/
|
||||
public double height () default 14;
|
||||
double height() default 14;
|
||||
|
||||
/**
|
||||
* 导出时在excel中每个列的宽度
|
||||
*/
|
||||
public double width () default 16;
|
||||
double width() default 16;
|
||||
|
||||
/**
|
||||
* 文字后缀,如% 90 变成90%
|
||||
*/
|
||||
public String suffix () default "";
|
||||
String suffix() default "";
|
||||
|
||||
/**
|
||||
* 当值为空时,字段的默认值
|
||||
*/
|
||||
public String defaultValue () default "";
|
||||
String defaultValue() default "";
|
||||
|
||||
/**
|
||||
* 提示信息
|
||||
*/
|
||||
public String prompt () default "";
|
||||
String prompt() default "";
|
||||
|
||||
/**
|
||||
* 设置只能选择不能输入的列内容.
|
||||
*/
|
||||
public String[] combo () default {};
|
||||
String[] combo() default {};
|
||||
|
||||
/**
|
||||
* 是否需要纵向合并单元格,应对需求:含有list集合单元格)
|
||||
*/
|
||||
public boolean needMerge () default false;
|
||||
boolean needMerge() default false;
|
||||
|
||||
/**
|
||||
* 是否导出数据,应对需求:有时我们需要导出一份模板,这是标题需要但内容需要用户手工填写.
|
||||
*/
|
||||
public boolean isExport () default true;
|
||||
boolean isExport() default true;
|
||||
|
||||
/**
|
||||
* 另一个类中的属性名称,支持多级获取,以小数点隔开
|
||||
*/
|
||||
public String targetAttr () default "";
|
||||
String targetAttr() default "";
|
||||
|
||||
/**
|
||||
* 是否自动统计数据,在最后追加一行统计数据总和
|
||||
*/
|
||||
public boolean isStatistics () default false;
|
||||
boolean isStatistics() default false;
|
||||
|
||||
/**
|
||||
* 导出类型(0数字 1字符串)
|
||||
*/
|
||||
public ColumnType cellType () default ColumnType.STRING;
|
||||
ColumnType cellType() default ColumnType.STRING;
|
||||
|
||||
/**
|
||||
* 导出列头背景颜色
|
||||
*/
|
||||
public IndexedColors headerBackgroundColor () default IndexedColors.GREY_50_PERCENT;
|
||||
IndexedColors headerBackgroundColor() default IndexedColors.GREY_50_PERCENT;
|
||||
|
||||
/**
|
||||
* 导出列头字体颜色
|
||||
*/
|
||||
public IndexedColors headerColor () default IndexedColors.WHITE;
|
||||
IndexedColors headerColor() default IndexedColors.WHITE;
|
||||
|
||||
/**
|
||||
* 导出单元格背景颜色
|
||||
*/
|
||||
public IndexedColors backgroundColor () default IndexedColors.WHITE;
|
||||
IndexedColors backgroundColor() default IndexedColors.WHITE;
|
||||
|
||||
/**
|
||||
* 导出单元格字体颜色
|
||||
*/
|
||||
public IndexedColors color () default IndexedColors.BLACK;
|
||||
IndexedColors color() default IndexedColors.BLACK;
|
||||
|
||||
/**
|
||||
* 导出字段对齐方式
|
||||
*/
|
||||
public HorizontalAlignment align () default HorizontalAlignment.CENTER;
|
||||
HorizontalAlignment align() default HorizontalAlignment.CENTER;
|
||||
|
||||
/**
|
||||
* 自定义数据处理器
|
||||
*/
|
||||
public Class<?> handler () default ExcelHandlerAdapter.class;
|
||||
Class<?> handler() default ExcelHandlerAdapter.class;
|
||||
|
||||
/**
|
||||
* 自定义数据处理器参数
|
||||
*/
|
||||
public String[] args () default {};
|
||||
String[] args() default {};
|
||||
|
||||
/**
|
||||
* 字段类型(0:导出导入;1:仅导出;2:仅导入)
|
||||
*/
|
||||
Type type () default Type.ALL;
|
||||
|
||||
public enum Type {
|
||||
enum Type {
|
||||
ALL(0), EXPORT(1), IMPORT(2);
|
||||
private final int value;
|
||||
|
||||
|
@ -161,7 +161,7 @@ public @interface Excel {
|
|||
}
|
||||
}
|
||||
|
||||
public enum ColumnType {
|
||||
enum ColumnType {
|
||||
NUMERIC(0), STRING(1), IMAGE(2);
|
||||
private final int value;
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ public class CacheConstants {
|
|||
/**
|
||||
* 密码锁定时间,默认10(分钟)
|
||||
*/
|
||||
public final static long PASSWORD_LOCK_TIME = 10;
|
||||
public final static long PASSWORD_LOCK_TIME = 3;
|
||||
|
||||
/**
|
||||
* 权限缓存前缀
|
||||
|
|
|
@ -43,9 +43,9 @@ public class ScheduleConstants {
|
|||
*/
|
||||
PAUSE("1");
|
||||
|
||||
private String value;
|
||||
private final String value;
|
||||
|
||||
private Status (String value) {
|
||||
Status(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
|
|
|
@ -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) {
|
||||
this.module = module;
|
||||
|
|
|
@ -10,9 +10,9 @@ import java.util.Arrays;
|
|||
public class InvalidExtensionException extends FileUploadException {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private String[] allowedExtension;
|
||||
private String extension;
|
||||
private String filename;
|
||||
private final String[] allowedExtension;
|
||||
private final String extension;
|
||||
private final String filename;
|
||||
|
||||
public InvalidExtensionException (String[] allowedExtension, String extension, String filename) {
|
||||
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 {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Code code;
|
||||
private final Code code;
|
||||
|
||||
public TaskException (String msg, Code code) {
|
||||
this(msg, code, null);
|
||||
|
|
|
@ -27,11 +27,11 @@ public class CharsetKit {
|
|||
/**
|
||||
* 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
|
||||
*/
|
||||
public static final Charset CHARSET_UTF_8 = Charset.forName(UTF_8);
|
||||
public static final Charset CHARSET_UTF_8 = StandardCharsets.UTF_8;
|
||||
/**
|
||||
* 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";
|
||||
|
||||
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"};
|
||||
|
|
|
@ -23,6 +23,7 @@ import java.io.IOException;
|
|||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLDecoder;
|
||||
import java.net.URLEncoder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Collections;
|
||||
import java.util.Enumeration;
|
||||
import java.util.HashMap;
|
||||
|
@ -212,11 +213,7 @@ public class ServletUtils {
|
|||
* @return 编码后的内容
|
||||
*/
|
||||
public static String urlEncode (String str) {
|
||||
try {
|
||||
return URLEncoder.encode(str, Constants.UTF8);
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
return StringUtils.EMPTY;
|
||||
}
|
||||
return URLEncoder.encode(str, StandardCharsets.UTF_8);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -227,11 +224,7 @@ public class ServletUtils {
|
|||
* @return 解码后的内容
|
||||
*/
|
||||
public static String urlDecode (String str) {
|
||||
try {
|
||||
return URLDecoder.decode(str, Constants.UTF8);
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
return StringUtils.EMPTY;
|
||||
}
|
||||
return URLDecoder.decode(str, StandardCharsets.UTF_8);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -43,7 +43,7 @@ public final class SpringUtils implements BeanFactoryPostProcessor {
|
|||
* @throws org.springframework.beans.BeansException
|
||||
*/
|
||||
public static <T> T getBean (Class<T> clz) throws BeansException {
|
||||
T result = (T) beanFactory.getBean(clz);
|
||||
T result = beanFactory.getBean(clz);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
@ -125,17 +125,17 @@ public class FileUtils {
|
|||
String filename = fileName;
|
||||
if (agent.contains("MSIE")) {
|
||||
// IE浏览器
|
||||
filename = URLEncoder.encode(filename, "utf-8");
|
||||
filename = URLEncoder.encode(filename, StandardCharsets.UTF_8);
|
||||
filename = filename.replace("+", " ");
|
||||
} else if (agent.contains("Firefox")) {
|
||||
// 火狐浏览器
|
||||
filename = new String(fileName.getBytes(), "ISO8859-1");
|
||||
} else if (agent.contains("Chrome")) {
|
||||
// google浏览器
|
||||
filename = URLEncoder.encode(filename, "utf-8");
|
||||
filename = URLEncoder.encode(filename, StandardCharsets.UTF_8);
|
||||
} else {
|
||||
// 其它浏览器
|
||||
filename = URLEncoder.encode(filename, "utf-8");
|
||||
filename = URLEncoder.encode(filename, StandardCharsets.UTF_8);
|
||||
}
|
||||
return filename;
|
||||
}
|
||||
|
@ -197,15 +197,14 @@ public class FileUtils {
|
|||
public static void setAttachmentResponseHeader (HttpServletResponse response, String realFileName) throws UnsupportedEncodingException {
|
||||
String percentEncodedFileName = percentEncode(realFileName);
|
||||
|
||||
StringBuilder contentDispositionValue = new StringBuilder();
|
||||
contentDispositionValue.append("attachment; filename=")
|
||||
.append(percentEncodedFileName)
|
||||
.append(";")
|
||||
.append("filename*=")
|
||||
.append("utf-8''")
|
||||
.append(percentEncodedFileName);
|
||||
String contentDispositionValue = "attachment; filename=" +
|
||||
percentEncodedFileName +
|
||||
";" +
|
||||
"filename*=" +
|
||||
"utf-8''" +
|
||||
percentEncodedFileName;
|
||||
|
||||
response.setHeader("Content-disposition", contentDispositionValue.toString());
|
||||
response.setHeader("Content-disposition", contentDispositionValue);
|
||||
response.setHeader("download-filename", percentEncodedFileName);
|
||||
}
|
||||
|
||||
|
@ -217,7 +216,7 @@ public class FileUtils {
|
|||
* @return 百分号编码后的字符串
|
||||
*/
|
||||
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");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -124,7 +124,7 @@ public class EscapeUtil {
|
|||
tmp.append(content.substring(lastPos));
|
||||
lastPos = content.length();
|
||||
} else {
|
||||
tmp.append(content.substring(lastPos, pos));
|
||||
tmp.append(content, lastPos, pos);
|
||||
lastPos = pos;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -225,7 +225,7 @@ public class IpUtils {
|
|||
if (ip != null && ip.indexOf(",") > 0) {
|
||||
final String[] ips = ip.trim().split(",");
|
||||
for (String subIp : ips) {
|
||||
if (false == isUnknown(subIp)) {
|
||||
if (!isUnknown(subIp)) {
|
||||
ip = subIp;
|
||||
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) {
|
||||
this.clazz = clazz;
|
||||
|
@ -531,7 +531,7 @@ public class ExcelUtil<T> {
|
|||
rowNo = isSubList() ? (i > 1 ? rowNo + 1 : rowNo + i) : i + 1 + rownum - startNo;
|
||||
row = sheet.createRow(rowNo);
|
||||
// 得到导出对象.
|
||||
T vo = (T) list.get(i);
|
||||
T vo = list.get(i);
|
||||
Collection<?> subList = null;
|
||||
if (isSubList()) {
|
||||
if (isSubListValue(vo)) {
|
||||
|
@ -913,7 +913,7 @@ public class ExcelUtil<T> {
|
|||
public String dataFormatHandlerAdapter (Object value, Excel excel, Cell cell) {
|
||||
try {
|
||||
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);
|
||||
} catch (Exception e) {
|
||||
log.error("不能格式化数据 " + excel.handler(), e.getMessage());
|
||||
|
@ -1200,7 +1200,7 @@ public class ExcelUtil<T> {
|
|||
public Collection<?> getListCellValue (Object obj) {
|
||||
Object value;
|
||||
try {
|
||||
value = subMethod.invoke(obj, new Object[]{});
|
||||
value = subMethod.invoke(obj);
|
||||
} catch (Exception e) {
|
||||
return new ArrayList<Object>();
|
||||
}
|
||||
|
@ -1221,7 +1221,7 @@ public class ExcelUtil<T> {
|
|||
getMethodName.append(name.substring(1));
|
||||
Method method = null;
|
||||
try {
|
||||
method = pojoClass.getMethod(getMethodName.toString(), new Class[]{});
|
||||
method = pojoClass.getMethod(getMethodName.toString());
|
||||
} catch (Exception e) {
|
||||
log.error("获取对象异常{}", e.getMessage());
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ public class ReflectUtils {
|
|||
|
||||
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方法.
|
||||
|
@ -113,7 +113,7 @@ public class ReflectUtils {
|
|||
try {
|
||||
return (E) method.invoke(obj, args);
|
||||
} catch (Exception e) {
|
||||
String msg = "method: " + method + ", obj: " + obj + ", args: " + args + "";
|
||||
String msg = "method: " + method + ", obj: " + obj + ", args: " + args;
|
||||
throw convertReflectionExceptionToUnchecked(msg, e);
|
||||
}
|
||||
}
|
||||
|
@ -162,7 +162,7 @@ public class ReflectUtils {
|
|||
}
|
||||
return (E) method.invoke(obj, args);
|
||||
} catch (Exception e) {
|
||||
String msg = "method: " + method + ", obj: " + obj + ", args: " + args + "";
|
||||
String msg = "method: " + method + ", obj: " + obj + ", args: " + args;
|
||||
throw convertReflectionExceptionToUnchecked(msg, e);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -46,8 +46,8 @@ public final class Base64 {
|
|||
for (int i = 52, j = 0 ; i <= 61 ; i++, j++) {
|
||||
lookUpBase64Alphabet[i] = (char) ('0' + j);
|
||||
}
|
||||
lookUpBase64Alphabet[62] = (char) '+';
|
||||
lookUpBase64Alphabet[63] = (char) '/';
|
||||
lookUpBase64Alphabet[62] = '+';
|
||||
lookUpBase64Alphabet[63] = '/';
|
||||
}
|
||||
|
||||
private static boolean isWhiteSpace (char octect) {
|
||||
|
@ -82,7 +82,7 @@ public final class Base64 {
|
|||
int fewerThan24bits = lengthDataBits % TWENTYFOURBITGROUP;
|
||||
int numberTriplets = lengthDataBits / TWENTYFOURBITGROUP;
|
||||
int numberQuartet = fewerThan24bits != 0 ? numberTriplets + 1 : numberTriplets;
|
||||
char encodedData[] = null;
|
||||
char[] encodedData = null;
|
||||
|
||||
encodedData = new char[numberQuartet * 4];
|
||||
|
||||
|
@ -161,7 +161,7 @@ public final class Base64 {
|
|||
return new byte[0];
|
||||
}
|
||||
|
||||
byte decodedData[] = null;
|
||||
byte[] decodedData = null;
|
||||
byte b1 = 0, b2 = 0, b3 = 0, b4 = 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 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);
|
||||
// time_low
|
||||
builder.append(digits(mostSigBits >> 32, 8));
|
||||
if (false == isSimple) {
|
||||
if (!isSimple) {
|
||||
builder.append('-');
|
||||
}
|
||||
// time_mid
|
||||
builder.append(digits(mostSigBits >> 16, 4));
|
||||
if (false == isSimple) {
|
||||
if (!isSimple) {
|
||||
builder.append('-');
|
||||
}
|
||||
// time_high_and_version
|
||||
builder.append(digits(mostSigBits, 4));
|
||||
if (false == isSimple) {
|
||||
if (!isSimple) {
|
||||
builder.append('-');
|
||||
}
|
||||
// variant_and_sequence
|
||||
builder.append(digits(leastSigBits >> 48, 4));
|
||||
if (false == isSimple) {
|
||||
if (!isSimple) {
|
||||
builder.append('-');
|
||||
}
|
||||
// node
|
||||
|
|
|
@ -14,15 +14,15 @@ public @interface DataScope {
|
|||
/**
|
||||
* 部门表的别名
|
||||
*/
|
||||
public String deptAlias () default "";
|
||||
String deptAlias() default "";
|
||||
|
||||
/**
|
||||
* 用户表的别名
|
||||
*/
|
||||
public String userAlias () default "";
|
||||
String userAlias() default "";
|
||||
|
||||
/**
|
||||
* 权限字符(用于多个角色匹配符合要求的权限)默认根据权限注解@RequiresPermissions获取,多个权限用逗号分隔开来
|
||||
*/
|
||||
public String permission () default "";
|
||||
String permission() default "";
|
||||
}
|
||||
|
|
|
@ -109,8 +109,7 @@ public class DataScopeAspect {
|
|||
|
||||
if (StringUtils.isNotBlank(sqlString.toString())) {
|
||||
Object params = joinPoint.getArgs()[0];
|
||||
if (StringUtils.isNotNull(params) && params instanceof BaseEntity) {
|
||||
BaseEntity baseEntity = (BaseEntity) params;
|
||||
if (StringUtils.isNotNull(params) && params instanceof BaseEntity baseEntity) {
|
||||
baseEntity.getParams().put(DATA_SCOPE, " AND (" + sqlString.substring(4) + ")");
|
||||
}
|
||||
}
|
||||
|
@ -141,8 +140,7 @@ public class DataScopeAspect {
|
|||
*/
|
||||
private void clearDataScope (final JoinPoint joinPoint) {
|
||||
Object params = joinPoint.getArgs()[0];
|
||||
if (StringUtils.isNotNull(params) && params instanceof BaseEntity) {
|
||||
BaseEntity baseEntity = (BaseEntity) params;
|
||||
if (StringUtils.isNotNull(params) && params instanceof BaseEntity baseEntity) {
|
||||
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) {
|
||||
String params = "";
|
||||
if (paramsArray != null && paramsArray.length > 0) {
|
||||
if (paramsArray != null) {
|
||||
for (Object o : paramsArray) {
|
||||
if (StringUtils.isNotNull(o) && !isFilterObject(o)) {
|
||||
try {
|
||||
String jsonObj = JSON.toJSONString(o, excludePropertyPreFilter(excludeParamNames));
|
||||
params += jsonObj.toString() + " ";
|
||||
params += jsonObj + " ";
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@ import org.springframework.data.redis.serializer.RedisSerializer;
|
|||
import org.springframework.data.redis.serializer.SerializationException;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
/**
|
||||
* Redis使用FastJson序列化
|
||||
|
@ -16,11 +17,11 @@ import java.nio.charset.Charset;
|
|||
* @author muyu
|
||||
*/
|
||||
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);
|
||||
|
||||
private Class<T> clazz;
|
||||
private final Class<T> clazz;
|
||||
|
||||
public FastJson2JsonRedisSerializer (Class<T> clazz) {
|
||||
super();
|
||||
|
|
|
@ -25,5 +25,5 @@ public interface RemoteFileService {
|
|||
* @return 结果
|
||||
*/
|
||||
@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 结果
|
||||
*/
|
||||
@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 结果
|
||||
*/
|
||||
@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);
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ public interface RemoteUserService {
|
|||
* @return 结果
|
||||
*/
|
||||
@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 结果
|
||||
*/
|
||||
@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);
|
||||
}
|
||||
|
|
|
@ -88,6 +88,17 @@
|
|||
<version>${swagger.fox.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>com.alibaba.csp</groupId>-->
|
||||
<!-- <artifactId>sentinel-core</artifactId>-->
|
||||
<!-- <version>1.8.7</version>-->
|
||||
<!-- </dependency>-->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.csp</groupId>
|
||||
<artifactId>sentinel-transport-simple-http</artifactId>
|
||||
<version>1.8.7</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
|
|
@ -36,7 +36,7 @@ public class BlackListUrlFilter extends AbstractGatewayFilterFactory<BlackListUr
|
|||
public static class Config {
|
||||
private List<String> blacklistUrl;
|
||||
|
||||
private List<Pattern> blacklistUrlPattern = new ArrayList<>();
|
||||
private final List<Pattern> blacklistUrlPattern = new ArrayList<>();
|
||||
|
||||
public boolean matchBlacklist (String url) {
|
||||
return !blacklistUrlPattern.isEmpty() && blacklistUrlPattern.stream().anyMatch(p -> p.matcher(url).find());
|
||||
|
|
|
@ -34,8 +34,7 @@ public class GatewayExceptionHandler implements ErrorWebExceptionHandler {
|
|||
|
||||
if (ex instanceof NotFoundException) {
|
||||
msg = "服务未找到";
|
||||
} else if (ex instanceof ResponseStatusException) {
|
||||
ResponseStatusException responseStatusException = (ResponseStatusException) ex;
|
||||
} else if (ex instanceof ResponseStatusException responseStatusException) {
|
||||
msg = responseStatusException.getMessage();
|
||||
} else {
|
||||
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;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Tomcat
|
||||
server:
|
||||
port: 8080
|
||||
port: 18080
|
||||
|
||||
# Spring
|
||||
spring:
|
||||
|
@ -14,10 +14,10 @@ spring:
|
|||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 127.0.0.1:8848
|
||||
server-addr: 43.142.100.73:8848
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 127.0.0.1:8848
|
||||
server-addr: 43.142.100.73:8848
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
@ -28,12 +28,12 @@ spring:
|
|||
eager: true
|
||||
transport:
|
||||
# 控制台地址
|
||||
dashboard: 127.0.0.1:8718
|
||||
dashboard: 127.0.0.1:8858
|
||||
# nacos配置持久化
|
||||
datasource:
|
||||
ds1:
|
||||
nacos:
|
||||
server-addr: 127.0.0.1:8848
|
||||
server-addr: 43.142.100.73:8848
|
||||
dataId: sentinel-muyu-gateway
|
||||
groupId: DEFAULT_GROUP
|
||||
data-type: json
|
||||
|
|
|
@ -67,6 +67,18 @@
|
|||
<artifactId>muyu-common-system</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!--aliyun oos文件上传封装-->
|
||||
<!-- 阿里云oss依赖 -->
|
||||
<dependency>
|
||||
<groupId>com.aliyun.oss</groupId>
|
||||
<artifactId>aliyun-sdk-oss</artifactId>
|
||||
<version>3.12.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-common-security</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
package com.muyu.file.config;
|
||||
|
||||
public class OSSCloudConfig {
|
||||
static final String ENDPOINT_INTER = "oss-cn-guangzhou-internal.aliyuncs.com"; //ECS 的经典网络访问(内网)
|
||||
public static final String ENDPOINT = "oss-cn-guangzhou.aliyuncs.com"; //外网访问
|
||||
public static final String ACCESSKEYID = "your accesskeyId";
|
||||
public static final String ACCESSKEYSECRET = "your accesskeysecret";
|
||||
public static final String BUCKETNAME = "your bucket name";
|
||||
public String objectPrefixName = "static/images/"; //基础文件夹
|
||||
public String filePathPrefix = "https://" + BUCKETNAME + "." + ENDPOINT + "/" + objectPrefixName; //带https的完整访问前缀
|
||||
public String getObjectPrefixName() {
|
||||
return objectPrefixName;
|
||||
}
|
||||
public void setObjectPrefixName(String objectPrefixName) {
|
||||
this.objectPrefixName = objectPrefixName;
|
||||
}
|
||||
public String getFilePathPrefix() {
|
||||
return filePathPrefix;
|
||||
}
|
||||
public void setFilePathPrefix(String filePathPrefix) {
|
||||
this.filePathPrefix = filePathPrefix;
|
||||
}
|
||||
}
|
|
@ -2,8 +2,10 @@ package com.muyu.file.controller;
|
|||
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.core.utils.file.FileUtils;
|
||||
import com.muyu.common.security.utils.SecurityUtils;
|
||||
import com.muyu.file.service.ISysFileService;
|
||||
import com.muyu.common.system.domain.SysFile;
|
||||
import com.muyu.file.utils.OSSCloudClient;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@ -11,6 +13,10 @@ import org.springframework.web.bind.annotation.PostMapping;
|
|||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 文件请求处理
|
||||
*
|
||||
|
@ -40,4 +46,28 @@ public class SysFileController {
|
|||
return Result.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping("imagesUpload")
|
||||
public Result<SysFile> imagesUpload(MultipartFile file) {
|
||||
OSSCloudClient client = OSSCloudClient.getInstance();
|
||||
SysFile sysFile = new SysFile();
|
||||
try {
|
||||
String filePath = client.uploadFile(file.getName(), SecurityUtils.getUsername(), "D:\\muyu\\images");
|
||||
System.out.println(filePath);
|
||||
System.out.println(client.fileExist(filePath));
|
||||
String format = new SimpleDateFormat("/yyyyMMdd/").format(new Date());
|
||||
List<String> list = client.listFiles(format);
|
||||
sysFile.setName(file.getName());
|
||||
sysFile.setUrl(filePath);
|
||||
for(String s : list) {
|
||||
System.out.println(s);
|
||||
client.deleteFile(s);
|
||||
}
|
||||
client.deleteFile("https://zhaohy-bucket.oss-cn-guangzhou.aliyuncs.com/static/images/1/"+format);
|
||||
}catch (Exception e){
|
||||
log.warn("文件上传异常{【】}",e.getMessage());
|
||||
return Result.error(e.getMessage());
|
||||
}
|
||||
return Result.success(sysFile);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,5 +17,5 @@ public interface ISysFileService {
|
|||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
public String uploadFile (MultipartFile file) throws Exception;
|
||||
String uploadFile(MultipartFile file) throws Exception;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,43 @@
|
|||
package com.muyu.file.utils;
|
||||
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 获取阿里云信息的工具类
|
||||
* 该类的执行流程:
|
||||
* 类加载后,先加载四个变量,再分别赋值
|
||||
* 接着执行重写的方法
|
||||
*
|
||||
* @author Eric
|
||||
* @create 2022-04-24 23:30
|
||||
*/
|
||||
@Component
|
||||
public class ConstantPropertiesUtil implements InitializingBean { //当项目一启动,就会执行该接口的重写方法
|
||||
@Value("${aliyun.oss.file.endpoint}")
|
||||
private String endpoint;//地域节点
|
||||
|
||||
@Value("${aliyun.oss.file.keyid}")
|
||||
private String keyId;//id
|
||||
|
||||
@Value("${aliyun.oss.file.keysecret}")
|
||||
private String keySecret;//秘钥
|
||||
|
||||
@Value("${aliyun.oss.file.bucketname}")
|
||||
private String bucketName;//项目名称
|
||||
|
||||
public static String END_POINT;
|
||||
public static String ACCESS_KEY_ID;
|
||||
public static String ACCESS_KEY_SECRET;
|
||||
public static String BUCKET_NAME;
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
END_POINT = endpoint;
|
||||
ACCESS_KEY_ID = keyId;
|
||||
ACCESS_KEY_SECRET = keySecret;
|
||||
BUCKET_NAME = bucketName;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,193 @@
|
|||
package com.muyu.file.utils;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.InputStream;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
|
||||
import com.aliyun.oss.ClientBuilderConfiguration;
|
||||
import com.aliyun.oss.OSS;
|
||||
import com.aliyun.oss.OSSClientBuilder;
|
||||
import com.aliyun.oss.common.comm.Protocol;
|
||||
import com.aliyun.oss.model.OSSObjectSummary;
|
||||
import com.aliyun.oss.model.ObjectListing;
|
||||
|
||||
import com.muyu.file.config.OSSCloudConfig;
|
||||
|
||||
|
||||
public class OSSCloudClient {
|
||||
|
||||
private OSSCloudClient() {
|
||||
super();
|
||||
}
|
||||
|
||||
private static class SingletonContainer{
|
||||
private static final OSSCloudClient instance = new OSSCloudClient();
|
||||
}
|
||||
|
||||
public static OSSCloudClient getInstance() {
|
||||
return SingletonContainer.instance;
|
||||
}
|
||||
|
||||
private OSS createOSS() {
|
||||
ClientBuilderConfiguration conf = new ClientBuilderConfiguration();
|
||||
// 设置连接OSS所使用的协议(HTTP或HTTPS),默认为HTTP。
|
||||
conf.setProtocol(Protocol.HTTPS);
|
||||
|
||||
// 创建OSSClient实例。
|
||||
return new OSSClientBuilder().build(OSSCloudConfig.ENDPOINT, OSSCloudConfig.ACCESSKEYID, OSSCloudConfig.ACCESSKEYSECRET);
|
||||
}
|
||||
|
||||
private Map<String, String> getObjectName(String fileName, String userId) {
|
||||
Map<String, String> nameMap = new HashMap<>();
|
||||
OSSCloudConfig config = new OSSCloudConfig();
|
||||
String format = new SimpleDateFormat("yyyy/MM/dd").format(new Date());
|
||||
String name = userId + "/" + format + "/" + UUID.randomUUID().toString().replace("-", "") + "_" + fileName;
|
||||
nameMap.put("objectName", config.getObjectPrefixName() + name);
|
||||
nameMap.put("filePath", config.getFilePathPrefix() + name);
|
||||
return nameMap;
|
||||
}
|
||||
|
||||
private String getObjectName(String filePath) {
|
||||
OSSCloudConfig config = new OSSCloudConfig();
|
||||
return config.getObjectPrefixName() + filePath.replace(config.getFilePathPrefix(), "");
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传文件
|
||||
* @param fileName 文件名称
|
||||
* @param userId 用户id
|
||||
* @param bytes byte数组
|
||||
* @throws Exception
|
||||
*/
|
||||
public String uploadFile(String fileName, String userId, byte[] bytes) throws Exception {
|
||||
Map<String, String> nameMap = this.getObjectName(fileName, userId);
|
||||
String objectName = nameMap.get("objectName");
|
||||
OSS ossClient = createOSS();
|
||||
try {
|
||||
ossClient.putObject(OSSCloudConfig.BUCKETNAME, objectName, new ByteArrayInputStream(bytes));
|
||||
} finally {
|
||||
if (ossClient != null) {
|
||||
ossClient.shutdown();
|
||||
}
|
||||
}
|
||||
return nameMap.get("filePath");
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传文件
|
||||
* @param fileName 文件名称
|
||||
* @param userId 用户id
|
||||
* @param localPath 本地文件路径
|
||||
* @throws Exception
|
||||
*/
|
||||
public String uploadFile(String fileName, String userId, String localPath) throws Exception {
|
||||
Map<String, String> nameMap = this.getObjectName(fileName, userId);
|
||||
String objectName = nameMap.get("objectName");
|
||||
OSS ossClient = createOSS();
|
||||
try {
|
||||
ossClient.putObject(OSSCloudConfig.BUCKETNAME, objectName, new FileInputStream(new File(localPath)));
|
||||
} finally {
|
||||
if (ossClient != null) {
|
||||
ossClient.shutdown();
|
||||
}
|
||||
}
|
||||
return nameMap.get("filePath");
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传文件
|
||||
* @param fileName 文件名称
|
||||
* @param userId 用户id
|
||||
* @throws Exception
|
||||
*/
|
||||
public String uploadFile(String fileName, String userId, InputStream is) throws Exception {
|
||||
Map<String, String> nameMap = this.getObjectName(fileName, userId);
|
||||
String objectName = nameMap.get("objectName");
|
||||
OSS ossClient = createOSS();
|
||||
try {
|
||||
ossClient.putObject(OSSCloudConfig.BUCKETNAME, objectName, is);
|
||||
} finally {
|
||||
if (ossClient != null) {
|
||||
ossClient.shutdown();
|
||||
}
|
||||
}
|
||||
return nameMap.get("filePath");
|
||||
}
|
||||
|
||||
/**
|
||||
* 文件是否存在
|
||||
* @param filePath 文件完整访问路径(带https)
|
||||
* @return
|
||||
*/
|
||||
public Boolean fileExist(String filePath) {
|
||||
String objectName = this.getObjectName(filePath);
|
||||
OSS ossClient = createOSS();
|
||||
try {
|
||||
return ossClient.doesObjectExist(OSSCloudConfig.BUCKETNAME, objectName);
|
||||
} finally {
|
||||
if (ossClient != null) {
|
||||
ossClient.shutdown();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 列举文件
|
||||
* @param dirPath 想要列举的文件夹 比如1/20220415
|
||||
* @return
|
||||
*/
|
||||
public List<String> listFiles(String dirPath) {
|
||||
OSSCloudConfig config = new OSSCloudConfig();
|
||||
String objectDir = config.getObjectPrefixName() + dirPath;
|
||||
// String objectName = this.getObjectName(filePath);
|
||||
OSS ossClient = createOSS();
|
||||
try {
|
||||
ObjectListing objectListing = ossClient.listObjects(OSSCloudConfig.BUCKETNAME, objectDir);
|
||||
List<OSSObjectSummary> sums = objectListing.getObjectSummaries();
|
||||
List<String> list = new ArrayList<>();
|
||||
for (OSSObjectSummary s : sums) {
|
||||
list.add(config.getFilePathPrefix() + (s.getKey().replace(config.getObjectPrefixName(), "")));
|
||||
}
|
||||
return list;
|
||||
} finally {
|
||||
if (ossClient != null) {
|
||||
ossClient.shutdown();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param filePath 删除文件或目录。如果要删除目录,目录必须为空。 (带域名访问路径的)
|
||||
* @throws Exception
|
||||
*/
|
||||
public void deleteFile(String filePath) throws Exception {
|
||||
String objectName = this.getObjectName(filePath);
|
||||
OSS ossClient = createOSS();
|
||||
try {
|
||||
ossClient.deleteObject(OSSCloudConfig.BUCKETNAME, objectName);
|
||||
} finally {
|
||||
if (ossClient != null) {
|
||||
ossClient.shutdown();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// public static void main(String[] args) throws Exception {
|
||||
// OSSCloudClient client = OSSCloudClient.getInstance();
|
||||
// String filePath = client.uploadFile("读书记录封面.png", "1", "C:\\Users\\墨白\\Desktop\\img\\nvpu.png");
|
||||
// System.out.println(filePath);
|
||||
// System.out.println(client.fileExist(filePath));
|
||||
// List<String> list = client.listFiles("1/20220416/");
|
||||
// for(String s : list) {
|
||||
// System.out.println(s);
|
||||
// client.deleteFile(s);
|
||||
// }
|
||||
// client.deleteFile("https://zhaohy-bucket.oss-cn-guangzhou.aliyuncs.com/static/images/1/20220415");
|
||||
// }
|
||||
|
||||
|
||||
}
|
|
@ -14,12 +14,21 @@ spring:
|
|||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 127.0.0.1:8848
|
||||
server-addr: 43.142.100.73:8848
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 127.0.0.1:8848
|
||||
server-addr: 43.142.100.73:8848
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
shared-configs:
|
||||
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||
|
||||
#阿里云 OSS(配置bucket信息)
|
||||
aliyun:
|
||||
oss:
|
||||
file:
|
||||
endpoint: oss-cn-beijing.aliyuncs.com #地域节点
|
||||
keyid: LTAI5tXLU13zKh4VHzXyz #ID
|
||||
keysecret: ZgmX5vSqlMF4H5nliXErLxhDQ703HF #秘钥
|
||||
bucketname: aly-item-eric #项目名称
|
||||
|
|
|
@ -72,6 +72,10 @@
|
|||
<artifactId>muyu-common-swagger</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-configuration-processor</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
|
|
@ -50,7 +50,7 @@ public class VelocityUtils {
|
|||
VelocityContext velocityContext = new VelocityContext();
|
||||
velocityContext.put("tplCategory", genTable.getTplCategory());
|
||||
velocityContext.put("tableName", genTable.getTableName());
|
||||
velocityContext.put("functionName", StringUtils.isNotEmpty(functionName) ? functionName : "【请填写功能名称】");
|
||||
velocityContext.put("functionName", StringUtils.isNotEmpty(functionName) ? functionName : "");
|
||||
velocityContext.put("ClassName", genTable.getClassName());
|
||||
velocityContext.put("className", StringUtils.uncapitalize(genTable.getClassName()));
|
||||
velocityContext.put("moduleName", genTable.getModuleName());
|
||||
|
|
|
@ -14,10 +14,10 @@ spring:
|
|||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 127.0.0.1:8848
|
||||
server-addr: 43.142.100.73:8848
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 127.0.0.1:8848
|
||||
server-addr: 43.142.100.73:8848
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
|
|
@ -117,7 +117,9 @@
|
|||
|
||||
<select id="selectDbTableListByNames" resultMap="GenTableResult">
|
||||
select table_name, table_comment, create_time, update_time from information_schema.tables
|
||||
where table_name NOT LIKE 'qrtz_%' and table_name NOT LIKE 'gen_%' and table_schema = (select database())
|
||||
where table_name NOT LIKE 'qrtz_%'
|
||||
and table_name NOT LIKE 'gen_%'
|
||||
and table_schema = (select database())
|
||||
and table_name in
|
||||
<foreach collection="array" item="name" open="(" separator="," close=")">
|
||||
#{name}
|
||||
|
|
|
@ -44,7 +44,7 @@ public class ${ClassName}Controller extends BaseController
|
|||
@RequiresPermissions("${permissionPrefix}:list")
|
||||
@GetMapping("/list")
|
||||
#if($table.crud || $table.sub)
|
||||
public Result<TableDataInfo> list(${ClassName} ${className})
|
||||
public Result<TableDataInfo<${ClassName}>> list(${ClassName} ${className})
|
||||
{
|
||||
startPage();
|
||||
List<${ClassName}> list = ${className}Service.select${ClassName}List(${className});
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package ${packageName}.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import ${packageName}.domain.${ClassName};
|
||||
#if($table.sub)
|
||||
import ${packageName}.domain.${subClassName};
|
||||
|
@ -12,7 +13,7 @@ import ${packageName}.domain.${subClassName};
|
|||
* @author ${author}
|
||||
* @date ${datetime}
|
||||
*/
|
||||
public interface ${ClassName}Mapper
|
||||
public interface ${ClassName}Mapper extends BaseMapper<${ClassName}>
|
||||
{
|
||||
/**
|
||||
* 查询${functionName}
|
||||
|
@ -20,7 +21,7 @@ public interface ${ClassName}Mapper
|
|||
* @param ${pkColumn.javaField} ${functionName}主键
|
||||
* @return ${functionName}
|
||||
*/
|
||||
public ${ClassName} select${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaType} ${pkColumn.javaField});
|
||||
${ClassName} select${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaType} ${pkColumn.javaField});
|
||||
|
||||
/**
|
||||
* 查询${functionName}列表
|
||||
|
@ -28,7 +29,7 @@ public interface ${ClassName}Mapper
|
|||
* @param ${className} ${functionName}
|
||||
* @return ${functionName}集合
|
||||
*/
|
||||
public List<${ClassName}> select${ClassName}List(${ClassName} ${className});
|
||||
List<${ClassName}> select${ClassName}List(${ClassName} ${className});
|
||||
|
||||
/**
|
||||
* 新增${functionName}
|
||||
|
@ -36,7 +37,7 @@ public interface ${ClassName}Mapper
|
|||
* @param ${className} ${functionName}
|
||||
* @return 结果
|
||||
*/
|
||||
public int insert${ClassName}(${ClassName} ${className});
|
||||
int insert${ClassName}(${ClassName} ${className});
|
||||
|
||||
/**
|
||||
* 修改${functionName}
|
||||
|
@ -44,7 +45,7 @@ public interface ${ClassName}Mapper
|
|||
* @param ${className} ${functionName}
|
||||
* @return 结果
|
||||
*/
|
||||
public int update${ClassName}(${ClassName} ${className});
|
||||
int update${ClassName}(${ClassName} ${className});
|
||||
|
||||
/**
|
||||
* 删除${functionName}
|
||||
|
@ -52,7 +53,7 @@ public interface ${ClassName}Mapper
|
|||
* @param ${pkColumn.javaField} ${functionName}主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int delete${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaType} ${pkColumn.javaField});
|
||||
int delete${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaType} ${pkColumn.javaField});
|
||||
|
||||
/**
|
||||
* 批量删除${functionName}
|
||||
|
@ -60,7 +61,7 @@ public interface ${ClassName}Mapper
|
|||
* @param ${pkColumn.javaField}s 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int delete${ClassName}By${pkColumn.capJavaField}s(${pkColumn.javaType}[] ${pkColumn.javaField}s);
|
||||
int delete${ClassName}By${pkColumn.capJavaField}s(${pkColumn.javaType}[] ${pkColumn.javaField}s);
|
||||
#if($table.sub)
|
||||
|
||||
/**
|
||||
|
@ -69,7 +70,7 @@ public interface ${ClassName}Mapper
|
|||
* @param ${pkColumn.javaField}s 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int delete${subClassName}By${subTableFkClassName}s(${pkColumn.javaType}[] ${pkColumn.javaField}s);
|
||||
int delete${subClassName}By${subTableFkClassName}s(${pkColumn.javaType}[] ${pkColumn.javaField}s);
|
||||
|
||||
/**
|
||||
* 批量新增${subTable.functionName}
|
||||
|
@ -77,7 +78,7 @@ public interface ${ClassName}Mapper
|
|||
* @param ${subclassName}List ${subTable.functionName}列表
|
||||
* @return 结果
|
||||
*/
|
||||
public int batch${subClassName}(List<${subClassName}> ${subclassName}List);
|
||||
int batch${subClassName}(List<${subClassName}> ${subclassName}List);
|
||||
|
||||
|
||||
/**
|
||||
|
@ -86,6 +87,6 @@ public interface ${ClassName}Mapper
|
|||
* @param ${pkColumn.javaField} ${functionName}ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int delete${subClassName}By${subTableFkClassName}(${pkColumn.javaType} ${pkColumn.javaField});
|
||||
int delete${subClassName}By${subTableFkClassName}(${pkColumn.javaType} ${pkColumn.javaField});
|
||||
#end
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package ${packageName}.service;
|
|||
|
||||
import java.util.List;
|
||||
import ${packageName}.domain.${ClassName};
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* ${functionName}Service接口
|
||||
|
@ -9,7 +10,7 @@ import ${packageName}.domain.${ClassName};
|
|||
* @author ${author}
|
||||
* @date ${datetime}
|
||||
*/
|
||||
public interface I${ClassName}Service
|
||||
public interface ${ClassName}Service extends IService<${ClassName}>
|
||||
{
|
||||
/**
|
||||
* 查询${functionName}
|
||||
|
@ -17,7 +18,7 @@ public interface I${ClassName}Service
|
|||
* @param ${pkColumn.javaField} ${functionName}主键
|
||||
* @return ${functionName}
|
||||
*/
|
||||
public ${ClassName} select${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaType} ${pkColumn.javaField});
|
||||
${ClassName} select${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaType} ${pkColumn.javaField});
|
||||
|
||||
/**
|
||||
* 查询${functionName}列表
|
||||
|
@ -25,7 +26,7 @@ public interface I${ClassName}Service
|
|||
* @param ${className} ${functionName}
|
||||
* @return ${functionName}集合
|
||||
*/
|
||||
public List<${ClassName}> select${ClassName}List(${ClassName} ${className});
|
||||
List<${ClassName}> select${ClassName}List(${ClassName} ${className});
|
||||
|
||||
/**
|
||||
* 新增${functionName}
|
||||
|
@ -33,7 +34,7 @@ public interface I${ClassName}Service
|
|||
* @param ${className} ${functionName}
|
||||
* @return 结果
|
||||
*/
|
||||
public int insert${ClassName}(${ClassName} ${className});
|
||||
int insert${ClassName}(${ClassName} ${className});
|
||||
|
||||
/**
|
||||
* 修改${functionName}
|
||||
|
@ -41,7 +42,7 @@ public interface I${ClassName}Service
|
|||
* @param ${className} ${functionName}
|
||||
* @return 结果
|
||||
*/
|
||||
public int update${ClassName}(${ClassName} ${className});
|
||||
int update${ClassName}(${ClassName} ${className});
|
||||
|
||||
/**
|
||||
* 批量删除${functionName}
|
||||
|
@ -49,7 +50,7 @@ public interface I${ClassName}Service
|
|||
* @param ${pkColumn.javaField}s 需要删除的${functionName}主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int delete${ClassName}By${pkColumn.capJavaField}s(${pkColumn.javaType}[] ${pkColumn.javaField}s);
|
||||
int delete${ClassName}By${pkColumn.capJavaField}s(${pkColumn.javaType}[] ${pkColumn.javaField}s);
|
||||
|
||||
/**
|
||||
* 删除${functionName}信息
|
||||
|
@ -57,5 +58,5 @@ public interface I${ClassName}Service
|
|||
* @param ${pkColumn.javaField} ${functionName}主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int delete${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaType} ${pkColumn.javaField});
|
||||
int delete${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaType} ${pkColumn.javaField});
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@ import org.springframework.stereotype.Service;
|
|||
import java.util.ArrayList;
|
||||
import com.muyu.common.core.utils.StringUtils;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import ${packageName}.domain.${subClassName};
|
||||
#end
|
||||
import ${packageName}.mapper.${ClassName}Mapper;
|
||||
|
@ -26,7 +27,7 @@ import ${packageName}.service.I${ClassName}Service;
|
|||
* @date ${datetime}
|
||||
*/
|
||||
@Service
|
||||
public class ${ClassName}ServiceImpl implements I${ClassName}Service
|
||||
public class ${ClassName}ServiceImpl extends ServiceImpl<${ClassName}Mapper,${ClassName}> implements ${ClassName}Service
|
||||
{
|
||||
@Autowired
|
||||
private ${ClassName}Mapper ${className}Mapper;
|
||||
|
|
|
@ -494,7 +494,7 @@ export default {
|
|||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
this.#[[$modal]]#.confirm('是否确认删除${functionName}编号为"' + row.${pkColumn.javaField} + '"的数据项?').then(function() {
|
||||
return del${BusinessName}(row.${pkColumn.javaField});
|
||||
return del${BusinessName}(row.${pkColumn.javaField})
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.#[[$modal]]#.msgSuccess("删除成功");
|
||||
|
|
|
@ -580,7 +580,7 @@ export default {
|
|||
this.#[[$modal]]#.msgError("请先选择要删除的${subTable.functionName}数据");
|
||||
} else {
|
||||
const ${subclassName}List = this.${subclassName}List;
|
||||
const checked${subClassName} = this.checked${subClassName};
|
||||
const checked${subClassName} = this.checked${subClassName}
|
||||
this.${subclassName}List = ${subclassName}List.filter(function(item) {
|
||||
return checked${subClassName}.indexOf(item.index) == -1
|
||||
});
|
||||
|
@ -598,5 +598,5 @@ export default {
|
|||
}, `${businessName}_#[[${new Date().getTime()}]]#.xlsx`)
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -463,7 +463,7 @@ function submitForm() {
|
|||
/** 删除按钮操作 */
|
||||
function handleDelete(row) {
|
||||
proxy.#[[$modal]]#.confirm('是否确认删除${functionName}编号为"' + row.${pkColumn.javaField} + '"的数据项?').then(function() {
|
||||
return del${BusinessName}(row.${pkColumn.javaField});
|
||||
return del${BusinessName}(row.${pkColumn.javaField})
|
||||
}).then(() => {
|
||||
getList();
|
||||
proxy.#[[$modal]]#.msgSuccess("删除成功");
|
||||
|
|
|
@ -535,7 +535,7 @@ function submitForm() {
|
|||
function handleDelete(row) {
|
||||
const _${pkColumn.javaField}s = row.${pkColumn.javaField} || ids.value;
|
||||
proxy.#[[$modal]]#.confirm('是否确认删除${functionName}编号为"' + _${pkColumn.javaField}s + '"的数据项?').then(function() {
|
||||
return del${BusinessName}(_${pkColumn.javaField}s);
|
||||
return del${BusinessName}(_${pkColumn.javaField}s)
|
||||
}).then(() => {
|
||||
getList();
|
||||
proxy.#[[$modal]]#.msgSuccess("删除成功");
|
||||
|
|
|
@ -4,7 +4,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="${packageName}.mapper.${ClassName}Mapper">
|
||||
|
||||
<resultMap type="${ClassName}" id="${ClassName}Result">
|
||||
<resultMap type="${packageName}.${ClassName}" id="${ClassName}Result">
|
||||
#foreach ($column in $columns)
|
||||
<result property="${column.javaField}" column="${column.columnName}" />
|
||||
#end
|
||||
|
@ -26,7 +26,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
select#foreach($column in $columns) $column.columnName#if($foreach.count != $columns.size()),#end#end from ${tableName}
|
||||
</sql>
|
||||
|
||||
<select id="select${ClassName}List" parameterType="${ClassName}" resultMap="${ClassName}Result">
|
||||
<select id="select${ClassName}List" parameterType="${packageName}.${ClassName}" resultMap="${ClassName}Result">
|
||||
<include refid="select${ClassName}Vo"/>
|
||||
<where>
|
||||
#foreach($column in $columns)
|
||||
|
@ -72,7 +72,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
#end
|
||||
</select>
|
||||
|
||||
<insert id="insert${ClassName}" parameterType="${ClassName}"#if($pkColumn.increment) useGeneratedKeys="true" keyProperty="$pkColumn.javaField"#end>
|
||||
<insert id="insert${ClassName}" parameterType="${packageName}.${ClassName}"#if($pkColumn.increment) useGeneratedKeys="true" keyProperty="$pkColumn.javaField"#end>
|
||||
insert into ${tableName}
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
#foreach($column in $columns)
|
||||
|
@ -90,7 +90,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="update${ClassName}" parameterType="${ClassName}">
|
||||
<update id="update${ClassName}" parameterType="${packageName}.${ClassName}">
|
||||
update ${tableName}
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
#foreach($column in $columns)
|
||||
|
|
|
@ -18,14 +18,14 @@ public interface SysJobLogMapper extends BaseMapper<SysJobLog> {
|
|||
*
|
||||
* @return 调度任务日志集合
|
||||
*/
|
||||
public List<SysJobLog> selectJobLogList (SysJobLog jobLog);
|
||||
List<SysJobLog> selectJobLogList(SysJobLog jobLog);
|
||||
|
||||
/**
|
||||
* 查询所有调度任务日志
|
||||
*
|
||||
* @return 调度任务日志列表
|
||||
*/
|
||||
public List<SysJobLog> selectJobLogAll ();
|
||||
List<SysJobLog> selectJobLogAll();
|
||||
|
||||
/**
|
||||
* 通过调度任务日志ID查询调度信息
|
||||
|
@ -34,7 +34,7 @@ public interface SysJobLogMapper extends BaseMapper<SysJobLog> {
|
|||
*
|
||||
* @return 调度任务日志对象信息
|
||||
*/
|
||||
public SysJobLog selectJobLogById (Long jobLogId);
|
||||
SysJobLog selectJobLogById(Long jobLogId);
|
||||
|
||||
/**
|
||||
* 新增任务日志
|
||||
|
@ -43,7 +43,7 @@ public interface SysJobLogMapper extends BaseMapper<SysJobLog> {
|
|||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertJobLog (SysJobLog jobLog);
|
||||
int insertJobLog(SysJobLog jobLog);
|
||||
|
||||
/**
|
||||
* 批量删除调度日志信息
|
||||
|
@ -52,7 +52,7 @@ public interface SysJobLogMapper extends BaseMapper<SysJobLog> {
|
|||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteJobLogByIds (Long[] logIds);
|
||||
int deleteJobLogByIds(Long[] logIds);
|
||||
|
||||
/**
|
||||
* 删除任务日志
|
||||
|
@ -61,10 +61,10 @@ public interface SysJobLogMapper extends BaseMapper<SysJobLog> {
|
|||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteJobLogById (Long jobId);
|
||||
int deleteJobLogById(Long jobId);
|
||||
|
||||
/**
|
||||
* 清空任务日志
|
||||
*/
|
||||
public void cleanJobLog ();
|
||||
void cleanJobLog();
|
||||
}
|
||||
|
|
|
@ -18,14 +18,14 @@ public interface SysJobMapper extends BaseMapper<SysJob> {
|
|||
*
|
||||
* @return 操作日志集合
|
||||
*/
|
||||
public List<SysJob> selectJobList (SysJob job);
|
||||
List<SysJob> selectJobList(SysJob job);
|
||||
|
||||
/**
|
||||
* 查询所有调度任务
|
||||
*
|
||||
* @return 调度任务列表
|
||||
*/
|
||||
public List<SysJob> selectJobAll ();
|
||||
List<SysJob> selectJobAll();
|
||||
|
||||
/**
|
||||
* 通过调度ID查询调度任务信息
|
||||
|
@ -34,7 +34,7 @@ public interface SysJobMapper extends BaseMapper<SysJob> {
|
|||
*
|
||||
* @return 角色对象信息
|
||||
*/
|
||||
public SysJob selectJobById (Long jobId);
|
||||
SysJob selectJobById(Long jobId);
|
||||
|
||||
/**
|
||||
* 通过调度ID删除调度任务信息
|
||||
|
@ -43,7 +43,7 @@ public interface SysJobMapper extends BaseMapper<SysJob> {
|
|||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteJobById (Long jobId);
|
||||
int deleteJobById(Long jobId);
|
||||
|
||||
/**
|
||||
* 批量删除调度任务信息
|
||||
|
@ -52,7 +52,7 @@ public interface SysJobMapper extends BaseMapper<SysJob> {
|
|||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteJobByIds (Long[] ids);
|
||||
int deleteJobByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 修改调度任务信息
|
||||
|
@ -61,7 +61,7 @@ public interface SysJobMapper extends BaseMapper<SysJob> {
|
|||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateJob (SysJob job);
|
||||
int updateJob(SysJob job);
|
||||
|
||||
/**
|
||||
* 新增调度任务信息
|
||||
|
@ -70,5 +70,5 @@ public interface SysJobMapper extends BaseMapper<SysJob> {
|
|||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertJob (SysJob job);
|
||||
int insertJob(SysJob job);
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ public interface ISysJobLogService {
|
|||
*
|
||||
* @return 调度任务日志集合
|
||||
*/
|
||||
public List<SysJobLog> selectJobLogList (SysJobLog jobLog);
|
||||
List<SysJobLog> selectJobLogList(SysJobLog jobLog);
|
||||
|
||||
/**
|
||||
* 通过调度任务日志ID查询调度信息
|
||||
|
@ -26,14 +26,14 @@ public interface ISysJobLogService {
|
|||
*
|
||||
* @return 调度任务日志对象信息
|
||||
*/
|
||||
public SysJobLog selectJobLogById (Long jobLogId);
|
||||
SysJobLog selectJobLogById(Long jobLogId);
|
||||
|
||||
/**
|
||||
* 新增任务日志
|
||||
*
|
||||
* @param jobLog 调度日志信息
|
||||
*/
|
||||
public void addJobLog (SysJobLog jobLog);
|
||||
void addJobLog(SysJobLog jobLog);
|
||||
|
||||
/**
|
||||
* 批量删除调度日志信息
|
||||
|
@ -42,7 +42,7 @@ public interface ISysJobLogService {
|
|||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteJobLogByIds (Long[] logIds);
|
||||
int deleteJobLogByIds(Long[] logIds);
|
||||
|
||||
/**
|
||||
* 删除任务日志
|
||||
|
@ -51,10 +51,10 @@ public interface ISysJobLogService {
|
|||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteJobLogById (Long jobId);
|
||||
int deleteJobLogById(Long jobId);
|
||||
|
||||
/**
|
||||
* 清空任务日志
|
||||
*/
|
||||
public void cleanJobLog ();
|
||||
void cleanJobLog();
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ public interface ISysJobService {
|
|||
*
|
||||
* @return 调度任务集合
|
||||
*/
|
||||
public List<SysJob> selectJobList (SysJob job);
|
||||
List<SysJob> selectJobList(SysJob job);
|
||||
|
||||
/**
|
||||
* 通过调度任务ID查询调度信息
|
||||
|
@ -28,7 +28,7 @@ public interface ISysJobService {
|
|||
*
|
||||
* @return 调度任务对象信息
|
||||
*/
|
||||
public SysJob selectJobById (Long jobId);
|
||||
SysJob selectJobById(Long jobId);
|
||||
|
||||
/**
|
||||
* 暂停任务
|
||||
|
@ -37,7 +37,7 @@ public interface ISysJobService {
|
|||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public int pauseJob (SysJob job) throws SchedulerException;
|
||||
int pauseJob(SysJob job) throws SchedulerException;
|
||||
|
||||
/**
|
||||
* 恢复任务
|
||||
|
@ -46,7 +46,7 @@ public interface ISysJobService {
|
|||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public int resumeJob (SysJob job) throws SchedulerException;
|
||||
int resumeJob(SysJob job) throws SchedulerException;
|
||||
|
||||
/**
|
||||
* 删除任务后,所对应的trigger也将被删除
|
||||
|
@ -55,7 +55,7 @@ public interface ISysJobService {
|
|||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteJob (SysJob job) throws SchedulerException;
|
||||
int deleteJob(SysJob job) throws SchedulerException;
|
||||
|
||||
/**
|
||||
* 批量删除调度信息
|
||||
|
@ -64,7 +64,7 @@ public interface ISysJobService {
|
|||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public void deleteJobByIds (Long[] jobIds) throws SchedulerException;
|
||||
void deleteJobByIds(Long[] jobIds) throws SchedulerException;
|
||||
|
||||
/**
|
||||
* 任务调度状态修改
|
||||
|
@ -73,7 +73,7 @@ public interface ISysJobService {
|
|||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public int changeStatus (SysJob job) throws SchedulerException;
|
||||
int changeStatus(SysJob job) throws SchedulerException;
|
||||
|
||||
/**
|
||||
* 立即运行任务
|
||||
|
@ -82,7 +82,7 @@ public interface ISysJobService {
|
|||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public boolean run (SysJob job) throws SchedulerException;
|
||||
boolean run(SysJob job) throws SchedulerException;
|
||||
|
||||
/**
|
||||
* 新增任务
|
||||
|
@ -91,7 +91,7 @@ public interface ISysJobService {
|
|||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertJob (SysJob job) throws SchedulerException, TaskException;
|
||||
int insertJob(SysJob job) throws SchedulerException, TaskException;
|
||||
|
||||
/**
|
||||
* 更新任务
|
||||
|
@ -100,7 +100,7 @@ public interface ISysJobService {
|
|||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateJob (SysJob job) throws SchedulerException, TaskException;
|
||||
int updateJob(SysJob job) throws SchedulerException, TaskException;
|
||||
|
||||
/**
|
||||
* 校验cron表达式是否有效
|
||||
|
@ -109,5 +109,5 @@ public interface ISysJobService {
|
|||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public boolean checkCronExpressionIsValid (String cronExpression);
|
||||
boolean checkCronExpressionIsValid(String cronExpression);
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ public abstract class AbstractQuartzJob implements Job {
|
|||
/**
|
||||
* 线程本地变量
|
||||
*/
|
||||
private static ThreadLocal<Date> threadLocal = new ThreadLocal<>();
|
||||
private static final ThreadLocal<Date> threadLocal = new ThreadLocal<>();
|
||||
|
||||
@Override
|
||||
public void execute (JobExecutionContext context) throws JobExecutionException {
|
||||
|
|
|
@ -157,7 +157,7 @@ public class JobInvokeUtil {
|
|||
Object[] classs = new Object[methodParams.size()];
|
||||
int index = 0;
|
||||
for (Object[] os : methodParams) {
|
||||
classs[index] = (Object) os[0];
|
||||
classs[index] = os[0];
|
||||
index++;
|
||||
}
|
||||
return classs;
|
||||
|
|
|
@ -14,10 +14,10 @@ spring:
|
|||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 127.0.0.1:8848
|
||||
server-addr: 43.142.100.73:8848
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 127.0.0.1:8848
|
||||
server-addr: 43.142.100.73:8848
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-product</artifactId>
|
||||
<version>3.6.3</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>muyu-product-common</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
<maven.compiler.target>17</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<!--系统核心包-->
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-common-core</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-common-security</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
|
@ -0,0 +1,81 @@
|
|||
package com.muyu.product.domain;
|
||||
|
||||
import com.muyu.common.security.utils.SecurityUtils;
|
||||
import com.muyu.common.core.annotation.Excel;
|
||||
import com.muyu.common.core.web.domain.TreeEntity;
|
||||
import com.muyu.common.security.utils.SecurityUtils;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
/**
|
||||
* 地区对象 address
|
||||
*
|
||||
* @author Saisai
|
||||
* @date 2024-02-29
|
||||
*/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class Address extends TreeEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键 */
|
||||
private Long id;
|
||||
|
||||
/** 地区名 */
|
||||
@Excel(name = "地区名")
|
||||
private String addressName;
|
||||
|
||||
/** 子级地区 */
|
||||
@Excel(name = "子级地区")
|
||||
private Long sonId;
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
public void setAddressName(String addressName)
|
||||
{
|
||||
this.addressName = addressName;
|
||||
}
|
||||
|
||||
public String getAddressName()
|
||||
{
|
||||
return addressName;
|
||||
}
|
||||
public void setSonId(Long sonId)
|
||||
{
|
||||
this.sonId = sonId;
|
||||
}
|
||||
|
||||
public Long getSonId()
|
||||
{
|
||||
return sonId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("addressName", getAddressName())
|
||||
.append("sonId", getSonId())
|
||||
.append("createBy", SecurityUtils.getUsername())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateBy", SecurityUtils.getUsername())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.toString();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,49 @@
|
|||
package com.muyu.product.domain;
|
||||
|
||||
import com.muyu.common.security.utils.SecurityUtils;
|
||||
import com.muyu.common.core.annotation.Excel;
|
||||
import com.muyu.common.core.web.domain.BaseEntity;
|
||||
import com.muyu.common.security.utils.SecurityUtils;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 属性组中间对象 as_attribute_group
|
||||
*
|
||||
* @author Saisai
|
||||
* @date 2024-02-29
|
||||
*/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class AsAttributeGroup extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键 */
|
||||
private Long id;
|
||||
|
||||
/** 属性编号 */
|
||||
@Excel(name = "属性编号")
|
||||
private Long attributeId;
|
||||
|
||||
/** 分组编号 */
|
||||
@Excel(name = "分组编号")
|
||||
private Long groupId;
|
||||
|
||||
public static AsAttributeGroup saveBuilder(Long id, Long attributeId) {
|
||||
return AsAttributeGroup.builder()
|
||||
.groupId(id)
|
||||
.attributeId(attributeId)
|
||||
.build();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,72 @@
|
|||
package com.muyu.product.domain;
|
||||
|
||||
import com.muyu.common.security.utils.SecurityUtils;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.muyu.common.security.utils.SecurityUtils;
|
||||
import com.muyu.common.core.annotation.Excel;
|
||||
import com.muyu.common.core.web.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 属性对象 attribute
|
||||
*
|
||||
* @author saisai
|
||||
* @date 2024-02-29
|
||||
*/
|
||||
public class Attribute extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键 */
|
||||
private Long id;
|
||||
|
||||
/** 属性编码 */
|
||||
@Excel(name = "属性编码")
|
||||
private String code;
|
||||
|
||||
/** 属性名 */
|
||||
@Excel(name = "属性名")
|
||||
private String name;
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
public void setCode(String code)
|
||||
{
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getCode()
|
||||
{
|
||||
return code;
|
||||
}
|
||||
public void setName(String name)
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("code", getCode())
|
||||
.append("name", getName())
|
||||
.append("remark", getRemark())
|
||||
.append("createBy", SecurityUtils.getUsername())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateBy", SecurityUtils.getUsername())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.toString();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,76 @@
|
|||
package com.muyu.product.domain;
|
||||
|
||||
import com.muyu.common.core.annotation.Excel;
|
||||
import com.muyu.common.core.web.domain.BaseEntity;
|
||||
import com.muyu.common.security.utils.SecurityUtils;
|
||||
import com.muyu.product.domain.req.AttributeGroupReq;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 属性组对象 attribute_group
|
||||
*
|
||||
* @author muyu
|
||||
* @date 2024-02-29
|
||||
*/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class AttributeGroup extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键 */
|
||||
private Long id;
|
||||
|
||||
/** 组名 */
|
||||
@Excel(name = "组名")
|
||||
private String name;
|
||||
|
||||
|
||||
/** 状态 */
|
||||
@Excel(name = "状态")
|
||||
private String states;
|
||||
|
||||
//创建添加属性组构建体
|
||||
public static AttributeGroup saveBuilder(AttributeGroupReq attributeGroupReq) {
|
||||
return AttributeGroup.builder()
|
||||
.name(attributeGroupReq.getName())
|
||||
.states(attributeGroupReq.getStates())
|
||||
.createBy(SecurityUtils.getUsername())
|
||||
.createTime(new Date())
|
||||
.build();
|
||||
}
|
||||
|
||||
|
||||
//创建修改属性组构建体
|
||||
public static AttributeGroup editBuilder(AttributeGroupReq attributeGroupReq) {
|
||||
return AttributeGroup.builder()
|
||||
.id(attributeGroupReq.getId())
|
||||
.name(attributeGroupReq.getName())
|
||||
.states(attributeGroupReq.getStates())
|
||||
.updateBy(SecurityUtils.getUsername())
|
||||
.updateTime(new Date())
|
||||
.build();
|
||||
}
|
||||
|
||||
public static AttributeGroup createBuilder(AttributeGroupReq attributeGroupReq) {
|
||||
return AttributeGroup.builder()
|
||||
.name(attributeGroupReq.getName())
|
||||
.states(attributeGroupReq.getStates())
|
||||
.createTime(new Date())
|
||||
.createBy(SecurityUtils.getUsername())
|
||||
.build();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,55 @@
|
|||
package com.muyu.product.domain;
|
||||
|
||||
import com.muyu.common.core.annotation.Excel;
|
||||
import com.muyu.common.core.web.domain.BaseEntity;
|
||||
import com.muyu.common.security.utils.SecurityUtils;
|
||||
import com.muyu.product.domain.model.AttrValueModel;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
/**
|
||||
* 商品属性中间表对象 attribute_product
|
||||
*
|
||||
* @author Saisai
|
||||
* @date 2024-02-29
|
||||
*/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class AttributeProduct extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键 */
|
||||
private Long id;
|
||||
|
||||
/** 商品编号 */
|
||||
@Excel(name = "商品编号")
|
||||
private Long productId;
|
||||
|
||||
/** 属性编号 */
|
||||
@Excel(name = "属性编号")
|
||||
private Long attributeId;
|
||||
|
||||
/** 属性值 */
|
||||
@Excel(name = "属性值")
|
||||
private String value;
|
||||
|
||||
public static AttributeProduct attrValueModelBuild(AttrValueModel attrValueModel, Supplier<Long> productId) {
|
||||
return AttributeProduct.builder()
|
||||
.attributeId(attrValueModel.getId())
|
||||
.productId(productId.get())
|
||||
.value(attrValueModel.getValue())
|
||||
.build();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,94 @@
|
|||
package com.muyu.product.domain;
|
||||
|
||||
import com.muyu.common.core.annotation.Excel;
|
||||
import com.muyu.common.core.web.domain.BaseEntity;
|
||||
import com.muyu.common.security.utils.SecurityUtils;
|
||||
import com.muyu.product.domain.req.BrandReq;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 品牌对象 brand
|
||||
*
|
||||
* @author Saisai
|
||||
* @date 2024-02-29
|
||||
*/
|
||||
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class Brand extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 品牌名称
|
||||
*/
|
||||
@Excel(name = "品牌名称")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 图像标识
|
||||
*/
|
||||
@Excel(name = "图像标识")
|
||||
private String logo;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
@Excel(name = "描述")
|
||||
private String introduction;
|
||||
|
||||
/**
|
||||
* 品牌启用
|
||||
*/
|
||||
@Excel(name = "品牌启用")
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 公司地址
|
||||
*/
|
||||
@Excel(name = "公司地址")
|
||||
private String addressName;
|
||||
|
||||
|
||||
//添加数据构造体
|
||||
public static Brand saveBuilder(BrandReq brandReq) {
|
||||
return Brand.builder()
|
||||
.name(brandReq.getName())
|
||||
.logo(brandReq.getLogo())
|
||||
.introduction(brandReq.getIntroduction())
|
||||
.status(brandReq.getStatus())
|
||||
.createBy(SecurityUtils.getUsername())
|
||||
.createTime(new Date())
|
||||
.build();
|
||||
}
|
||||
|
||||
|
||||
//修改构建体
|
||||
public static Brand updateBuilder(BrandReq brandReq) {
|
||||
return Brand.builder()
|
||||
.id(brandReq.getId())
|
||||
.name(brandReq.getName())
|
||||
.logo(brandReq.getLogo())
|
||||
.introduction(brandReq.getIntroduction())
|
||||
.status(brandReq.getStatus())
|
||||
.updateBy(SecurityUtils.getUsername())
|
||||
.updateTime(new Date())
|
||||
.build();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,66 @@
|
|||
package com.muyu.product.domain;
|
||||
|
||||
import com.muyu.common.core.annotation.Excel;
|
||||
import com.muyu.common.core.web.domain.BaseEntity;
|
||||
import com.muyu.product.domain.req.CategoryReq;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
/**
|
||||
* 品牌品类中间对象 brand_category
|
||||
*
|
||||
* @author Saisai
|
||||
* @date 2024-02-29
|
||||
*/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class BrandCategory extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键 */
|
||||
private Long id;
|
||||
|
||||
/** 品类编号 */
|
||||
@Excel(name = "品类编号")
|
||||
private Long categoryId;
|
||||
|
||||
/** 品牌编号 */
|
||||
@Excel(name = "品牌编号")
|
||||
private Long brandId;
|
||||
|
||||
|
||||
public static List<BrandCategory> saveBuilderList(CategoryReq categoryReq, Supplier<String> getUsername) {
|
||||
return categoryReq.getCheckedBrandIds().stream().map(
|
||||
brandId -> BrandCategory.saveBuilder(categoryReq.getId(),brandId,getUsername)
|
||||
).toList();
|
||||
}
|
||||
|
||||
public static BrandCategory saveBuilder(Long categoryId, Long brandId, Supplier<String> getUsername) {
|
||||
return BrandCategory.builder()
|
||||
.brandId(brandId)
|
||||
.categoryId(categoryId)
|
||||
.createBy(getUsername.get())
|
||||
.createTime(new Date())
|
||||
.build();
|
||||
}
|
||||
|
||||
public static BrandCategory saveBrandBuilder(Long id, Long brandId, Supplier<String> username) {
|
||||
return BrandCategory.builder()
|
||||
.categoryId(id)
|
||||
.brandId(brandId)
|
||||
.createBy(username.get())
|
||||
.createTime(new Date())
|
||||
.build();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,56 @@
|
|||
package com.muyu.product.domain;
|
||||
|
||||
import com.muyu.common.core.annotation.Excel;
|
||||
import com.muyu.common.core.web.domain.BaseEntity;
|
||||
import com.muyu.product.domain.req.CategoryReq;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
/**
|
||||
* 品类属性中间对象 category_attribute
|
||||
*
|
||||
* @author Saisai
|
||||
* @date 2024-02-29
|
||||
*/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class CategoryAttribute extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键 */
|
||||
private Long id;
|
||||
|
||||
/** 属性编号 */
|
||||
@Excel(name = "属性编号")
|
||||
private Long attributeId;
|
||||
|
||||
/** 品类编号 */
|
||||
@Excel(name = "品类编号")
|
||||
private Long categoryId;
|
||||
|
||||
public static CategoryAttribute categoryBuilder(Long categoryId, Long attributeId, Supplier<String> username) {
|
||||
return CategoryAttribute.builder()
|
||||
.categoryId(categoryId)
|
||||
.attributeId(attributeId)
|
||||
.createBy(username.get())
|
||||
.createTime(new Date())
|
||||
.build();
|
||||
}
|
||||
|
||||
public static List<CategoryAttribute> saveBuilder(CategoryReq categoryReq, Supplier<String> username) {
|
||||
return categoryReq.getCheckedAttributeIds().stream().map(
|
||||
attributeId -> categoryBuilder(categoryReq.getId(),attributeId,username)
|
||||
).toList();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,69 @@
|
|||
package com.muyu.product.domain;
|
||||
|
||||
import com.muyu.common.core.annotation.Excel;
|
||||
import com.muyu.common.core.web.domain.BaseEntity;
|
||||
import com.muyu.product.domain.req.CategoryReq;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
/**
|
||||
* 品类属性组中间对象 category_attribute_group
|
||||
*
|
||||
* @author saisai
|
||||
* @date 2024-02-29
|
||||
*/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class CategoryAttributeGroup extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 属性组编号
|
||||
*/
|
||||
@Excel(name = "属性组编号")
|
||||
private Long attributeGroupId;
|
||||
|
||||
/**
|
||||
* 品类编号
|
||||
*/
|
||||
@Excel(name = "品类编号")
|
||||
private Long categoryId;
|
||||
|
||||
/**
|
||||
* 品类属性组中间表构建体
|
||||
* 作用:提供数组对象
|
||||
*
|
||||
* @param id
|
||||
* @param groupId
|
||||
* @return
|
||||
*/
|
||||
public static CategoryAttributeGroup saveBuilder(Long id, Long groupId, Supplier<String> username) {
|
||||
return CategoryAttributeGroup.builder()
|
||||
.attributeGroupId(groupId)
|
||||
.categoryId(id)
|
||||
.createBy(username.get())
|
||||
.createTime(new Date())
|
||||
.build();
|
||||
}
|
||||
|
||||
public static List<CategoryAttributeGroup> saveBuilderList(CategoryReq categoryReq, Supplier<String> username) {
|
||||
return categoryReq.getCheckedAttributeGroupIds().stream().map(
|
||||
groupId -> saveBuilder(categoryReq.getId(), groupId, username)
|
||||
).toList();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,84 @@
|
|||
package com.muyu.product.domain;
|
||||
|
||||
import com.muyu.common.core.annotation.Excel;
|
||||
import com.muyu.common.core.web.domain.TreeEntity;
|
||||
import com.muyu.product.domain.req.CategoryReq;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
/**
|
||||
* 品类信息对象 category_info
|
||||
*
|
||||
* @author Saisai
|
||||
* @date 2024-02-29
|
||||
*/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class CategoryInfo extends TreeEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键 */
|
||||
private Long id;
|
||||
|
||||
/** 品类名称 */
|
||||
@Excel(name = "品类名称")
|
||||
private String name;
|
||||
|
||||
/** 图片 */
|
||||
@Excel(name = "图片")
|
||||
private String image;
|
||||
|
||||
/** 是否启用 */
|
||||
@Excel(name = "是否启用")
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 查询构造器
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
public static CategoryInfo queryBuilder(CategoryReq req){
|
||||
return CategoryInfo.builder()
|
||||
.name(req.getName())
|
||||
.image(req.getImage())
|
||||
.status(req.getStatus())
|
||||
.remark(req.getRemark())
|
||||
.parentId(req.getParentId())
|
||||
.build();
|
||||
}
|
||||
|
||||
|
||||
/** 响应值对象 */
|
||||
public static CategoryInfo saveCategoryBuilder(CategoryReq req){
|
||||
return CategoryInfo.builder()
|
||||
.name(req.getName())
|
||||
.status(req.getStatus())
|
||||
.image(req.getImage())
|
||||
.parentId(req.getParentId())
|
||||
.remark(req.getRemark())
|
||||
.createBy(req.getCreateBy())
|
||||
.createTime(req.getCreateTime())
|
||||
.build();
|
||||
}
|
||||
|
||||
public static CategoryInfo saveBuilder(CategoryReq categoryReq) {
|
||||
return CategoryInfo.builder()
|
||||
.id(categoryReq.getId())
|
||||
.name(categoryReq.getName())
|
||||
.status(categoryReq.getStatus())
|
||||
.image(categoryReq.getImage())
|
||||
.parentId(categoryReq.getParentId())
|
||||
.status(categoryReq.getStatus())
|
||||
.remark(categoryReq.getRemark())
|
||||
.createBy(categoryReq.getCreateBy())
|
||||
.createTime(categoryReq.getCreateTime())
|
||||
.build();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,81 @@
|
|||
package com.muyu.product.domain;
|
||||
|
||||
import com.muyu.common.core.annotation.Excel;
|
||||
import com.muyu.common.core.web.domain.BaseEntity;
|
||||
import com.muyu.common.security.utils.SecurityUtils;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
/**
|
||||
* 品类商品中间对象 product_category
|
||||
*
|
||||
* @author Saisai
|
||||
* @date 2024-02-29
|
||||
*/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class ProductCategory extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键 */
|
||||
private Long id;
|
||||
|
||||
/** 品类id */
|
||||
@Excel(name = "品类id")
|
||||
private Long categoryId;
|
||||
|
||||
/** 商品id */
|
||||
@Excel(name = "商品id")
|
||||
private Long productId;
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
public void setCategoryId(Long categoryId)
|
||||
{
|
||||
this.categoryId = categoryId;
|
||||
}
|
||||
|
||||
public Long getCategoryId()
|
||||
{
|
||||
return categoryId;
|
||||
}
|
||||
public void setProductId(Long productId)
|
||||
{
|
||||
this.productId = productId;
|
||||
}
|
||||
|
||||
public Long getProductId()
|
||||
{
|
||||
return productId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("categoryId", getCategoryId())
|
||||
.append("productId", getProductId())
|
||||
.append("remark", getRemark())
|
||||
.append("createBy", SecurityUtils.getUsername())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateBy", SecurityUtils.getUsername())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.toString();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,111 @@
|
|||
package com.muyu.product.domain;
|
||||
|
||||
import com.muyu.common.core.annotation.Excel;
|
||||
import com.muyu.common.core.web.domain.BaseEntity;
|
||||
import com.muyu.product.domain.model.ProductAddModel;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
/**
|
||||
* 商品;对象 product_info
|
||||
*
|
||||
* @author Saisai
|
||||
* @date 2024-02-29
|
||||
*/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class ProductInfo extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 商品名
|
||||
*/
|
||||
@Excel(name = "商品名")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 商品信息
|
||||
*/
|
||||
@Excel(name = "商品信息")
|
||||
private String introduction;
|
||||
|
||||
/**
|
||||
* 品牌编号
|
||||
*/
|
||||
@Excel(name = "品牌编号")
|
||||
private Long brandId;
|
||||
|
||||
/**
|
||||
* 图片
|
||||
*/
|
||||
@Excel(name = "图片")
|
||||
private String images;
|
||||
|
||||
/**
|
||||
* 发货地
|
||||
*/
|
||||
@Excel(name = "轮播图")
|
||||
private String slideshow;
|
||||
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
private String createdBy;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createdTime;
|
||||
private Date updatedTime;
|
||||
|
||||
/**
|
||||
* 更新人
|
||||
*/
|
||||
private String updatedBy;
|
||||
|
||||
|
||||
public static ProductInfo saveModelBuild(ProductAddModel productAddModel, Supplier<String> createBy) {
|
||||
return ProductInfo.builder()
|
||||
.id(productAddModel.getId())
|
||||
.name(productAddModel.getName())
|
||||
.status(productAddModel.getStatus())
|
||||
.images(productAddModel.getImages())
|
||||
.brandId(productAddModel.getBrandId())
|
||||
.slideshow(productAddModel.getSlideshow())
|
||||
.introduction(productAddModel.getIntroduction())
|
||||
.createdBy(createBy.get())
|
||||
.createdTime(new Date())
|
||||
.build();
|
||||
}
|
||||
|
||||
public static ProductInfo updateBuilder(ProductAddModel model, Supplier<String> username) {
|
||||
return ProductInfo.builder()
|
||||
.id(model.getId())
|
||||
.name(model.getName())
|
||||
.status(model.getStatus())
|
||||
.images(model.getImages())
|
||||
.brandId(model.getBrandId())
|
||||
.slideshow(model.getSlideshow())
|
||||
.introduction(model.getIntroduction())
|
||||
.updatedBy(username.get())
|
||||
.updatedTime(new Date())
|
||||
.build();
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,59 @@
|
|||
package com.muyu.product.domain;
|
||||
|
||||
import com.muyu.common.core.annotation.Excel;
|
||||
import com.muyu.common.core.web.domain.BaseEntity;
|
||||
import com.muyu.common.security.utils.SecurityUtils;
|
||||
import com.muyu.product.domain.req.RuleAttrReq;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
/**
|
||||
* 规格对象 rule
|
||||
*
|
||||
* @author saisai
|
||||
* @date 2024-02-29
|
||||
*/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class Rule extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键 */
|
||||
private Long id;
|
||||
|
||||
/** 规格名称 */
|
||||
@Excel(name = "规格名称")
|
||||
private String name;
|
||||
|
||||
private String states;
|
||||
|
||||
public static Rule saveBuilder(RuleAttrReq req, Supplier<String> username){
|
||||
return Rule.builder()
|
||||
.name(req.getName())
|
||||
.states(req.getStates()==null? null: req.getStates())
|
||||
.createBy(username.get())
|
||||
.createTime(new Date())
|
||||
.build();
|
||||
}
|
||||
|
||||
|
||||
public static Rule updateBuilder(RuleAttrReq ruleAttrReq) {
|
||||
return Rule.builder()
|
||||
.id(ruleAttrReq.getId())
|
||||
.states(ruleAttrReq.getStates())
|
||||
.name(ruleAttrReq.getName())
|
||||
.build();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,76 @@
|
|||
package com.muyu.product.domain;
|
||||
|
||||
import com.muyu.common.core.annotation.Excel;
|
||||
import com.muyu.common.core.web.domain.BaseEntity;
|
||||
import com.muyu.product.domain.model.RuleAttrAddModel;
|
||||
import com.muyu.product.domain.req.RuleAttrReq;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
/**
|
||||
* 规格对象 rule
|
||||
*
|
||||
* @author saisai
|
||||
* @date 2024-02-29
|
||||
*/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class RuleAttr extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
private Long id;
|
||||
/**
|
||||
* 规格主键
|
||||
*/
|
||||
private Long ruleId;
|
||||
/**
|
||||
* 规格属性名称
|
||||
*/
|
||||
@Excel(name = "规格属性")
|
||||
private String attrName;
|
||||
|
||||
|
||||
private String attrValue;
|
||||
|
||||
|
||||
/**
|
||||
* 规格属性构建体
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static List<RuleAttr> saveBuilder(RuleAttrReq req,Supplier<String> username) {
|
||||
ArrayList<RuleAttr> ruleAttrs = new ArrayList<>();
|
||||
List<RuleAttrAddModel> ruleAttrAddModels = req.getRuleAttrList();
|
||||
ruleAttrAddModels.stream().map(
|
||||
ruleAttrAddModel -> ruleAttrs.addAll(RuleAttr.constructBuilder(ruleAttrAddModel,username,req.getId())
|
||||
)).toList();
|
||||
return ruleAttrs;
|
||||
}
|
||||
|
||||
public static List<RuleAttr> constructBuilder(RuleAttrAddModel ruleAttrAddModel, Supplier<String> username, Long ruleId) {
|
||||
return (List<RuleAttr>) ruleAttrAddModel.getValueList().stream().map(
|
||||
value -> RuleAttr.builder().attrName(ruleAttrAddModel.getAttrName())
|
||||
.id(null)
|
||||
.ruleId(ruleId)
|
||||
.createBy(username.get())
|
||||
.createTime(new Date())
|
||||
.attrValue(value)
|
||||
.build()
|
||||
).toList();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,55 @@
|
|||
package com.muyu.product.domain;
|
||||
|
||||
import com.muyu.common.core.annotation.Excel;
|
||||
import com.muyu.common.core.web.domain.BaseEntity;
|
||||
import com.muyu.common.security.utils.SecurityUtils;
|
||||
import com.muyu.product.domain.model.ProductSkuModel;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
/**
|
||||
* 规格商品中间对象 rule_product
|
||||
*
|
||||
* @author saisai
|
||||
* @date 2024-02-29
|
||||
*/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class RuleProduct extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键 */
|
||||
private Long id;
|
||||
|
||||
/** 商品编号 */
|
||||
@Excel(name = "商品编号")
|
||||
private Long productId;
|
||||
|
||||
/** 规格编号 */
|
||||
@Excel(name = "规格编号")
|
||||
private String sku;
|
||||
|
||||
private Long stock;
|
||||
private BigDecimal price;
|
||||
|
||||
public static RuleProduct productSkuModelBuild(ProductSkuModel productSkuModel, Supplier<Long> productId) {
|
||||
return RuleProduct.builder()
|
||||
.productId(productId.get())
|
||||
.sku(productSkuModel.getSku())
|
||||
.stock(productSkuModel.getStock())
|
||||
.price(productSkuModel.getPrice())
|
||||
.build();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
package com.muyu.product.domain.demo;
|
||||
|
||||
import com.muyu.product.domain.Attribute;
|
||||
import com.muyu.product.domain.AttributeGroup;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName Product
|
||||
* @Description 描述
|
||||
* @Author SaiSai.Liu
|
||||
* @Date 2024/3/6/0006 14:12
|
||||
*/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class Product {
|
||||
/**
|
||||
* 属性组
|
||||
*/
|
||||
private List<AttributeGroup> attributeGroupList;
|
||||
/**
|
||||
* 属性
|
||||
*/
|
||||
private List<Attribute> attributeList;
|
||||
/**
|
||||
* 自有属性
|
||||
*/
|
||||
private List<Attribute> selfAttributeList;
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
package com.muyu.product.domain.model;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @ClassName AttrValueModel
|
||||
* @Description 描述
|
||||
* @Author SaiSai.Liu
|
||||
* @Date 2024/3/22/0022 20:11
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class AttrValueModel {
|
||||
private Long id;
|
||||
private String value;
|
||||
}
|
|
@ -0,0 +1,76 @@
|
|||
package com.muyu.product.domain.model;
|
||||
|
||||
import com.muyu.common.core.web.domain.TreeEntity;
|
||||
import com.muyu.product.domain.req.CategoryReq;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
/**
|
||||
* @ClassName CategoryInfoSaveModel
|
||||
* @Description 描述
|
||||
* @Author SaiSai.Liu
|
||||
* @Date 2024/3/5/0005 17:17
|
||||
*/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class CategoryInfoSaveModel extends TreeEntity {
|
||||
/** 主键 */
|
||||
private Long id;
|
||||
|
||||
/** 品类名称 */
|
||||
private String name;
|
||||
|
||||
/** 图片 */
|
||||
private String image;
|
||||
|
||||
/** 父级品类 */
|
||||
private Long parentId;
|
||||
|
||||
/** 是否启用 */
|
||||
private String status;
|
||||
|
||||
/** 说明 */
|
||||
private String remark;
|
||||
private String createBy;
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 已选属性组集合
|
||||
*/
|
||||
private List<Long> checkedAttributeGroupIds;
|
||||
/**
|
||||
* 已选属性集合
|
||||
*/
|
||||
private List<Long> checkedAttributeIds;
|
||||
/**
|
||||
* 已选品牌集合
|
||||
*/
|
||||
private List<Long> checkedBrandIds;
|
||||
|
||||
|
||||
/**
|
||||
* 保存构建体
|
||||
*/
|
||||
public static CategoryInfoSaveModel saveBuilder(CategoryReq req, Supplier<String> username){
|
||||
return CategoryInfoSaveModel.builder()
|
||||
.checkedAttributeIds(req.getCheckedAttributeIds())
|
||||
.checkedAttributeGroupIds(req.getCheckedAttributeGroupIds())
|
||||
.checkedBrandIds(req.getCheckedBrandIds())
|
||||
.image(req.getImage())
|
||||
.name(req.getName())
|
||||
.parentId(req.getParentId())
|
||||
.createBy(username.get())
|
||||
.createTime(new Date())
|
||||
.status(req.getStatus())
|
||||
.remark(req.getRemark())
|
||||
.build();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,62 @@
|
|||
package com.muyu.product.domain.model;
|
||||
|
||||
import com.muyu.common.core.annotation.Excel;
|
||||
import com.muyu.common.core.web.domain.BaseEntity;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @ClassName ProductAddModel
|
||||
* @Description 描述
|
||||
* @Author SaiSai.Liu
|
||||
* @Date 2024/3/22/0022 20:22
|
||||
*/
|
||||
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@ApiModel(value = "ProjectInfoSaveReq", description = "商品信息")
|
||||
public class ProductAddModel extends BaseEntity {
|
||||
/** 主键 */
|
||||
private Long id;
|
||||
|
||||
/** 商品名 */
|
||||
@Excel(name = "商品名")
|
||||
private String name;
|
||||
|
||||
/** 商品信息 */
|
||||
@Excel(name = "商品信息")
|
||||
private String introduction;
|
||||
|
||||
/** 品牌编号 */
|
||||
@Excel(name = "品牌编号")
|
||||
private Long brandId;
|
||||
|
||||
/** 图片 */
|
||||
@Excel(name = "图片")
|
||||
private String images;
|
||||
|
||||
/** 发货地 */
|
||||
@Excel(name = "轮播图")
|
||||
private String slideshow;
|
||||
|
||||
/** 商品状态 */
|
||||
@Excel(name = "商品状态")
|
||||
private String status;
|
||||
|
||||
/** 创建人 */
|
||||
private String createdBy;
|
||||
|
||||
/** 创建时间 */
|
||||
private Date createdTime;
|
||||
|
||||
/** 更新人 */
|
||||
private String updatedBy;
|
||||
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
package com.muyu.product.domain.model;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @ClassName ProductSkuModel
|
||||
* @Description 描述
|
||||
* @Author SaiSai.Liu
|
||||
* @Date 2024/3/22/0022 20:12
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ProductSkuModel {
|
||||
private String sku;
|
||||
private Long stock;
|
||||
private BigDecimal price;
|
||||
private String image;
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
package com.muyu.product.domain.model;
|
||||
|
||||
import com.muyu.common.core.web.domain.BaseEntity;
|
||||
import com.muyu.product.domain.Rule;
|
||||
import com.muyu.product.domain.RuleAttr;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @ClassName RuleAttrAddModel
|
||||
* @Description 描述
|
||||
* @Author SaiSai.Liu
|
||||
* @Date 2024/3/7/0007 11:53
|
||||
*/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class RuleAttrAddModel extends BaseEntity {
|
||||
private String attrName;
|
||||
private List<String> valueList;
|
||||
|
||||
public static List<RuleAttrAddModel> saveBuilder(List<RuleAttr> rules) {
|
||||
HashMap<String, List<String>> stringListHashMap = new HashMap<>();
|
||||
for (RuleAttr rule : rules) {
|
||||
if (stringListHashMap.containsKey(rule.getAttrName())){
|
||||
stringListHashMap.get(rule.getAttrName()).add(rule.getAttrValue());
|
||||
}else {
|
||||
ArrayList<String> strings = new ArrayList<>();
|
||||
strings.add(rule.getAttrValue());
|
||||
stringListHashMap.put(rule.getAttrName(),strings);
|
||||
}
|
||||
}
|
||||
return stringListHashMap.keySet().stream()
|
||||
.map(key -> new RuleAttrAddModel
|
||||
(key, stringListHashMap.get(key)))
|
||||
.toList();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
package com.muyu.product.domain.model;
|
||||
|
||||
import com.muyu.common.core.web.domain.BaseEntity;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
/**
|
||||
* @ClassName RuleAttrFindId
|
||||
* @Description 描述
|
||||
* @Author SaiSai.Liu
|
||||
* @Date 2024/3/9/0009 16:46
|
||||
*/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class RuleAttrFindId extends BaseEntity {
|
||||
private Long id;
|
||||
private String ruleName;
|
||||
private String ruleValue;
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,70 @@
|
|||
package com.muyu.product.domain.req;
|
||||
|
||||
import com.muyu.common.security.utils.SecurityUtils;
|
||||
import com.muyu.common.core.annotation.Excel;
|
||||
import com.muyu.common.core.web.domain.BaseEntity;
|
||||
import com.muyu.common.security.utils.SecurityUtils;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 属性组中间对象 as_attribute_group
|
||||
*
|
||||
* @author Saisai
|
||||
* @date 2024-02-29
|
||||
*/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class AsAttributeGroupReq extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键 */
|
||||
private Long id;
|
||||
|
||||
/** 属性编号 */
|
||||
@Excel(name = "属性编号")
|
||||
private Long attributeId;
|
||||
|
||||
/**
|
||||
* 属性id集合
|
||||
*/
|
||||
private List<Long> attributeIds;
|
||||
|
||||
/** 分组编号 */
|
||||
@Excel(name = "分组编号")
|
||||
private Long groupId;
|
||||
|
||||
//添加组内属性构造体
|
||||
public static AsAttributeGroupReq saveBuilder(AttributeGroupReq attributeGroupReq){
|
||||
return AsAttributeGroupReq.builder()
|
||||
.attributeIds(attributeGroupReq.getCheckedAttributeIds())
|
||||
.groupId(attributeGroupReq.getId())
|
||||
.createBy(SecurityUtils.getUsername())
|
||||
.createTime(new Date())
|
||||
.build();
|
||||
}
|
||||
|
||||
//修改组内属性构造体
|
||||
public static AsAttributeGroupReq updateBuilder(AttributeGroupReq attributeGroupReq){
|
||||
return AsAttributeGroupReq.builder()
|
||||
.attributeIds(attributeGroupReq.getCheckedAttributeIds())
|
||||
.groupId(attributeGroupReq.getId())
|
||||
.createBy(SecurityUtils.getUsername())
|
||||
.createTime(new Date())
|
||||
.build();
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,67 @@
|
|||
package com.muyu.product.domain.req;
|
||||
|
||||
import com.muyu.common.core.annotation.Excel;
|
||||
import com.muyu.common.core.web.domain.BaseEntity;
|
||||
import com.muyu.common.security.utils.SecurityUtils;
|
||||
import com.muyu.product.domain.AttributeGroup;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 属性组对象 attribute_group
|
||||
*
|
||||
* @author muyu
|
||||
* @date 2024-02-29
|
||||
*/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class AttributeGroupReq extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键 */
|
||||
private Long id;
|
||||
|
||||
/** 组名 */
|
||||
@Excel(name = "组名")
|
||||
private String name;
|
||||
|
||||
private List<Long> checkedAttributeIds;
|
||||
|
||||
/** 状态 */
|
||||
@Excel(name = "状态")
|
||||
private String states;
|
||||
|
||||
|
||||
//添加构建体
|
||||
public static AttributeGroup saveBuilder(AttributeGroupReq attributeGroupReq) {
|
||||
return AttributeGroup.builder()
|
||||
.name(attributeGroupReq.getName())
|
||||
.states(attributeGroupReq.getStates())
|
||||
.createBy(SecurityUtils.getUsername())
|
||||
.createTime(new Date())
|
||||
.build();
|
||||
}
|
||||
|
||||
//修改构建体
|
||||
public static AttributeGroup updateBuilder(AttributeGroupReq attributeGroupReq) {
|
||||
return AttributeGroup.builder()
|
||||
.id(attributeGroupReq.getId())
|
||||
.name(attributeGroupReq.getName())
|
||||
.states(attributeGroupReq.getStates())
|
||||
.updateBy(SecurityUtils.getUsername())
|
||||
.updateTime(new Date())
|
||||
.build();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,70 @@
|
|||
package com.muyu.product.domain.req;
|
||||
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Builder;
|
||||
import com.muyu.common.core.annotation.Excel;
|
||||
import com.muyu.common.core.web.domain.BaseEntity;
|
||||
import com.muyu.common.security.utils.SecurityUtils;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
import java.lang.annotation.Annotation;
|
||||
|
||||
/**
|
||||
* @ClassName BrandReq
|
||||
* @Description 描述
|
||||
* @Author SaiSai.Liu
|
||||
* @Date 2024/3/1/0001 9:59
|
||||
*/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class BrandReq extends BaseEntity{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 品牌名称
|
||||
*/
|
||||
@Excel(name = "品牌名称")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 图像标识
|
||||
*/
|
||||
@Excel(name = "图像标识")
|
||||
private String logo;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
@Excel(name = "描述")
|
||||
private String introduction;
|
||||
|
||||
/**
|
||||
* 品牌启用
|
||||
*/
|
||||
@Excel(name = "品牌启用")
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 公司地址
|
||||
*/
|
||||
@Excel(name = "公司地址")
|
||||
private String addressName;
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,74 @@
|
|||
package com.muyu.product.domain.req;
|
||||
|
||||
import com.muyu.common.core.web.domain.BaseEntity;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName CategoryReq
|
||||
* @Description 描述
|
||||
* @Author SaiSai.Liu
|
||||
* @Date 2024/3/5/0005 12:35
|
||||
*/
|
||||
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class CategoryReq extends BaseEntity {
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 品类名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 图片
|
||||
*/
|
||||
private String image;
|
||||
|
||||
/**
|
||||
* 父级品类
|
||||
*/
|
||||
private Long parentId;
|
||||
|
||||
/**
|
||||
* 是否启用
|
||||
*/
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 说明
|
||||
*/
|
||||
private String remark;
|
||||
/**
|
||||
* 已选属性组集合
|
||||
*/
|
||||
private List<Long> checkedAttributeGroupIds;
|
||||
/**
|
||||
* 已选属性集合
|
||||
*/
|
||||
private List<Long> checkedAttributeIds;
|
||||
/**
|
||||
* 已选品牌集合
|
||||
*/
|
||||
private List<Long> checkedBrandIds;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
package com.muyu.product.domain.req;
|
||||
|
||||
import com.muyu.common.core.web.domain.BaseEntity;
|
||||
import com.muyu.product.domain.model.AttrValueModel;
|
||||
import com.muyu.product.domain.model.ProductAddModel;
|
||||
import com.muyu.product.domain.model.ProductSkuModel;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName ProductInfoSaveReq
|
||||
* @Description 描述
|
||||
* @Author SaiSai.Liu
|
||||
* @Date 2024/3/22/0022 20:17
|
||||
*/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@ApiModel(value = "ProjectInfoSaveReq", description = "商品信息")
|
||||
public class ProductInfoSaveReq extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private ProductAddModel productAddModel;
|
||||
|
||||
private List<AttrValueModel> attrValueList;
|
||||
|
||||
private List<ProductSkuModel> productSkuModelList;
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
package com.muyu.product.domain.req;
|
||||
|
||||
import com.muyu.common.core.web.domain.BaseEntity;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @ClassName ProductSkuInfoEditReq
|
||||
* @Description 描述
|
||||
* @Author SaiSai.Liu
|
||||
* @Date 2024/3/22/0022 19:52
|
||||
*/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@ApiModel(value = "ProjectSkuInfoEditReq", description = "商品SKU")
|
||||
public class ProductSkuInfoEditReq extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private Long projectId;
|
||||
private String sku;
|
||||
private Long stock;
|
||||
private BigDecimal price;
|
||||
private String image;
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
package com.muyu.product.domain.req;
|
||||
|
||||
import com.muyu.common.core.web.domain.BaseEntity;
|
||||
import com.muyu.product.domain.model.RuleAttrAddModel;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName RuleAttrReq
|
||||
* @Description 描述
|
||||
* @Author SaiSai.Liu
|
||||
* @Date 2024/3/7/0007 9:02
|
||||
*/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class RuleAttrReq extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键 */
|
||||
private Long id;
|
||||
/**规格名称*/
|
||||
private String name;
|
||||
/** 属性组 */
|
||||
private List<RuleAttrAddModel> ruleAttrList;
|
||||
/** 是否启用 */
|
||||
private String states;
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,85 @@
|
|||
package com.muyu.product.domain.resp;
|
||||
|
||||
import com.muyu.common.core.annotation.Excel;
|
||||
import com.muyu.common.core.web.domain.BaseEntity;
|
||||
import com.muyu.product.domain.Attribute;
|
||||
import com.muyu.product.domain.AttributeGroup;
|
||||
import com.muyu.product.domain.req.AttributeGroupReq;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName AttributeGroupResp
|
||||
* @Description 描述
|
||||
* @Author SaiSai.Liu
|
||||
* @Date 2024/3/14/0014 20:46
|
||||
*/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class AttributeGroupResp extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 组名
|
||||
*/
|
||||
@Excel(name = "组名")
|
||||
private String name;
|
||||
|
||||
private List<Attribute> attributeList;
|
||||
|
||||
private List<Long> getAsAttributeIds;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
@Excel(name = "状态")
|
||||
private String states;
|
||||
|
||||
//创建添加属性组构建体
|
||||
public static AttributeGroupResp saveBuilder(AttributeGroupReq attributeGroupReq) {
|
||||
return AttributeGroupResp.builder()
|
||||
.name(attributeGroupReq.getName())
|
||||
.states(attributeGroupReq.getStates())
|
||||
.build();
|
||||
}
|
||||
|
||||
|
||||
//创建修改属性组构建体
|
||||
public static AttributeGroupResp editBuilder(AttributeGroupReq attributeGroupReq) {
|
||||
return AttributeGroupResp.builder()
|
||||
.id(attributeGroupReq.getId())
|
||||
.name(attributeGroupReq.getName())
|
||||
.states(attributeGroupReq.getStates())
|
||||
.build();
|
||||
}
|
||||
|
||||
public static AttributeGroupResp createBuilder(AttributeGroupReq attributeGroupReq) {
|
||||
return AttributeGroupResp.builder()
|
||||
.name(attributeGroupReq.getName())
|
||||
.states(attributeGroupReq.getStates())
|
||||
.build();
|
||||
}
|
||||
|
||||
public static AttributeGroupResp saveBuilder(AttributeGroup attributeGroup1, List<Attribute> attributes) {
|
||||
return AttributeGroupResp.builder()
|
||||
.name(attributeGroup1.getName())
|
||||
.states(attributeGroup1.getStates())
|
||||
.id(attributeGroup1.getId())
|
||||
.attributeList(attributes)
|
||||
.build();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,80 @@
|
|||
package com.muyu.product.domain.resp;
|
||||
|
||||
import com.muyu.common.core.web.domain.TreeEntity;
|
||||
import com.muyu.common.security.utils.SecurityUtils;
|
||||
import com.muyu.product.domain.Attribute;
|
||||
import com.muyu.product.domain.AttributeGroup;
|
||||
import com.muyu.product.domain.Brand;
|
||||
import com.muyu.product.domain.CategoryInfo;
|
||||
import com.muyu.product.domain.req.CategoryReq;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
/**
|
||||
* @ClassName CategoryResp
|
||||
* @Description 描述
|
||||
* @Author SaiSai.Liu
|
||||
* @Date 2024/3/5/0005 12:35
|
||||
*/
|
||||
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class CategoryResp extends TreeEntity {
|
||||
/** 主键 */
|
||||
private Long id;
|
||||
|
||||
/** 品类名称 */
|
||||
private String name;
|
||||
|
||||
/** 图片 */
|
||||
private String image;
|
||||
|
||||
/** 是否启用 */
|
||||
private String status;
|
||||
private List<Attribute> checkAttributeList;
|
||||
private List<AttributeGroup> checkedAttributeGroupList;
|
||||
private List<Brand> brandList;
|
||||
|
||||
|
||||
/**
|
||||
* 保存构建体
|
||||
* @param categoryReq
|
||||
* @return
|
||||
*/
|
||||
public static CategoryResp saveBuilder(CategoryReq categoryReq, Supplier<String> username){
|
||||
return CategoryResp.builder()
|
||||
.name(categoryReq.getName())
|
||||
.image(categoryReq.getImage())
|
||||
.status(categoryReq.getStatus())
|
||||
.createBy(username.get())
|
||||
.createTime(new Date())
|
||||
.build();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 修改构建体
|
||||
* @param categoryReq
|
||||
* @return
|
||||
*/
|
||||
public static CategoryResp updateBuilder(CategoryReq categoryReq,Supplier<String> username){
|
||||
return CategoryResp.builder()
|
||||
.name(categoryReq.getName())
|
||||
.image(categoryReq.getImage())
|
||||
.status(categoryReq.getStatus())
|
||||
.updateBy(username.get())
|
||||
.updateTime(new Date())
|
||||
.build();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
package com.muyu.product.domain.resp;
|
||||
|
||||
import com.muyu.common.core.web.domain.BaseEntity;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName ProductInfoResp
|
||||
* @Description 描述
|
||||
* @Author SaiSai.Liu
|
||||
* @Date 2024/3/23/0023 9:47
|
||||
*/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ProductInfoResp extends BaseEntity {
|
||||
private Long id;
|
||||
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
package com.muyu.product.domain.resp;
|
||||
|
||||
import com.muyu.common.core.web.domain.BaseEntity;
|
||||
import com.muyu.product.domain.Rule;
|
||||
import com.muyu.product.domain.RuleAttr;
|
||||
import com.muyu.product.domain.model.RuleAttrAddModel;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.function.Function;
|
||||
|
||||
/**
|
||||
* @ClassName RuleAttrResp
|
||||
* @Description 描述
|
||||
* @Author SaiSai.Liu
|
||||
* @Date 2024/3/7/0007 15:56
|
||||
*/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class RuleAttrResp extends BaseEntity {
|
||||
private Long id;
|
||||
private String name;
|
||||
private String states;
|
||||
private List<RuleAttrAddModel> ruleAttrList;
|
||||
|
||||
|
||||
|
||||
public static RuleAttrResp saveBuilder(Rule rule, Function<Long,List<RuleAttrAddModel>> ruleAttrs){
|
||||
return RuleAttrResp.builder()
|
||||
.id(rule.getId())
|
||||
.name(rule.getName())
|
||||
.ruleAttrList(ruleAttrs==null? null : ruleAttrs.apply(rule.getId()))
|
||||
.states(rule.getStates())
|
||||
.build();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,152 @@
|
|||
{
|
||||
"categoryInfoId": 1,
|
||||
"states": "y",
|
||||
"categoryName": "节点",
|
||||
"remark": null,
|
||||
"images": null,
|
||||
"req": {
|
||||
"asAttributeCategoryList": [
|
||||
|
||||
],
|
||||
"asAttributeGroupList": [
|
||||
属性组
|
||||
],
|
||||
"asBrandCategoryList":[
|
||||
品类品牌
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
{
|
||||
"categoryInfoId": 1,
|
||||
"categoryName": "节点",
|
||||
"remark": null,
|
||||
"req": {
|
||||
"asAttributeCategoryList": [
|
||||
"attributeInfo": {
|
||||
"id": 1
|
||||
"attributeName": null
|
||||
}
|
||||
],
|
||||
"attributeGroupList": [
|
||||
"attributeInfoGroup": {
|
||||
"id": 1,
|
||||
"attributeInfoList": []
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
{
|
||||
"product": {
|
||||
"name": null,
|
||||
"brandId": 1,
|
||||
"remark": null,
|
||||
"image": null,
|
||||
"images": [],
|
||||
"description": null
|
||||
},
|
||||
"attribute": {
|
||||
"attributeGroup": {
|
||||
"attributeGroupId": 1,
|
||||
},
|
||||
"attributeList": [
|
||||
{
|
||||
"id": 1,
|
||||
"attributeValue": null
|
||||
}
|
||||
]
|
||||
},
|
||||
"rule": {
|
||||
"ruleId": 1,
|
||||
"ruleValueList": [
|
||||
{
|
||||
"ruleName1": null,
|
||||
"ruleName2":null,
|
||||
...
|
||||
"image": null,
|
||||
"stork": 1,
|
||||
"price": 1
|
||||
}
|
||||
],
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
{createBy: null, createTime: "2024-02-29 21:37:52", updateBy: null, updateTime: "2024-03-10 16:06:52",…}
|
||||
ancestors:null
|
||||
checkedAttributeGroupIds:[2]
|
||||
checkedAttributeIds:[5, 3]
|
||||
checkedBrandIds:[2]
|
||||
children:[]
|
||||
createBy:null
|
||||
createTime:"2024-02-29 21:37:52"
|
||||
id:1
|
||||
image:"http://127.0.0.1:9300/statics/2024/02/29/8000030_20240229213748A003.jpg"
|
||||
name:"电子产品"
|
||||
orderNum:null
|
||||
parentId:0
|
||||
parentName:null
|
||||
remark: null
|
||||
status: "Y"
|
||||
updateBy: null
|
||||
updateTime: "2024-03-10 16:06:52"
|
||||
|
||||
|
||||
|
||||
|
||||
{
|
||||
"product": {
|
||||
"id":null,
|
||||
"name":null,
|
||||
"states":null,
|
||||
"brandId":null,
|
||||
"remark":null,
|
||||
"image":null,
|
||||
"imgs":null,
|
||||
},
|
||||
"attributeGroupList":[
|
||||
{
|
||||
"id":null
|
||||
}
|
||||
],
|
||||
"attributeList":[
|
||||
{
|
||||
"attributeId":null,
|
||||
"attributeValue":bull
|
||||
}
|
||||
],
|
||||
"rule":[
|
||||
{
|
||||
"sku":null, ("1,2,3")
|
||||
"image":null,
|
||||
"inventoryValue":null,
|
||||
"priceValue":null
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-product</artifactId>
|
||||
<version>3.6.3</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>muyu-product-remote</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
<maven.compiler.target>17</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-product-common</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
|
@ -0,0 +1,7 @@
|
|||
package com.muyu;
|
||||
|
||||
public class Main {
|
||||
public static void main(String[] args) {
|
||||
System.out.println("Hello world!");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,98 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-product</artifactId>
|
||||
<version>3.6.3</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>muyu-product-server</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
<maven.compiler.target>17</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-product-common</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- SpringCloud Alibaba Nacos -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- SpringCloud Alibaba Nacos Config -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- SpringCloud Alibaba Sentinel -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- SpringBoot Actuator -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-actuator</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Swagger UI -->
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-swagger-ui</artifactId>
|
||||
<version>${swagger.fox.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Mysql Connector -->
|
||||
<dependency>
|
||||
<groupId>com.mysql</groupId>
|
||||
<artifactId>mysql-connector-j</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- MuYu Common DataSource -->
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-common-datasource</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- MuYu Common DataScope -->
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-common-datascope</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- MuYu Common Log -->
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-common-log</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- MuYu Common Swagger -->
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-common-swagger</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- sentinel流量监控-->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.csp</groupId>
|
||||
<artifactId>sentinel-core</artifactId>
|
||||
<version>1.8.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba.csp</groupId>
|
||||
<artifactId>sentinel-annotation-aspectj</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
|
@ -0,0 +1,22 @@
|
|||
package com.muyu;
|
||||
|
||||
import com.muyu.common.security.annotation.EnableCustomConfig;
|
||||
import com.muyu.common.security.annotation.EnableMyFeignClients;
|
||||
import com.muyu.common.swagger.annotation.EnableCustomSwagger2;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
/**
|
||||
* 系统模块
|
||||
*
|
||||
* @author muyu
|
||||
*/
|
||||
@EnableCustomConfig
|
||||
@EnableCustomSwagger2
|
||||
@EnableMyFeignClients
|
||||
@SpringBootApplication
|
||||
public class MuYuProductApplication {
|
||||
public static void main (String[] args) {
|
||||
SpringApplication.run(MuYuProductApplication.class, args);
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue