feat: 项目初始化

This commit is contained in:
2025-08-28 15:28:10 +08:00
commit 6f8726000d
222 changed files with 12454 additions and 0 deletions
+87
View File
@@ -0,0 +1,87 @@
<?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.byhah</groupId>
<artifactId>cloud-basic</artifactId>
<version>1.0.2-SNAPSHOT</version>
</parent>
<artifactId>cloud-core</artifactId>
<dependencies>
<!--deploy-->
<dependency>
<groupId>com.byhah.deploy</groupId>
<artifactId>byhah-deploy-basic-core</artifactId>
</dependency>
<dependency>
<groupId>com.byhah.deploy</groupId>
<artifactId>byhah-deploy-basic-validation</artifactId>
</dependency>
<dependency>
<groupId>com.byhah.deploy</groupId>
<artifactId>byhah-deploy-basic-jackson</artifactId>
</dependency>
<dependency>
<groupId>com.byhah.deploy</groupId>
<artifactId>byhah-deploy-basic-util-web</artifactId>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-annotation</artifactId>
</dependency>
<!-- aop -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-aop</artifactId>
</dependency>
<!-- processor -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
</dependency>
<!-- lombok -->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
<!-- jackson-core -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
</dependency>
<!-- ip2region -->
<dependency>
<groupId>org.lionsoul</groupId>
<artifactId>ip2region</artifactId>
</dependency>
<!-- fastexcel -->
<dependency>
<groupId>cn.idev.excel</groupId>
<artifactId>fastexcel</artifactId>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcpkix-jdk18on</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
@@ -0,0 +1,52 @@
package com.byhah.cloud.basic.core.converter;
import cn.idev.excel.converters.Converter;
import cn.idev.excel.enums.CellDataTypeEnum;
import cn.idev.excel.metadata.GlobalConfiguration;
import cn.idev.excel.metadata.data.ReadCellData;
import cn.idev.excel.metadata.data.WriteCellData;
import cn.idev.excel.metadata.property.ExcelContentProperty;
import java.util.Objects;
import static java.lang.Boolean.TRUE;
/**
* FastExcel转换Boolean类型
*
* @author ZYJ
*/
public class BooleanConverter implements Converter<Boolean> {
@Override
public Class<Boolean> supportJavaTypeKey() {
return Boolean.class;
}
@Override
public CellDataTypeEnum supportExcelTypeKey() {
return CellDataTypeEnum.STRING;
}
@Override
public Boolean convertToJavaData(ReadCellData<?> cellData, ExcelContentProperty contentProperty,
GlobalConfiguration globalConfiguration) {
Object data = cellData.getData();
if ("".equals(data.toString())) {
return TRUE;
}
if ("".equals(data.toString())) {
return Boolean.FALSE;
}
return null;
}
@Override
public WriteCellData<?> convertToExcelData(Boolean value, ExcelContentProperty contentProperty,
GlobalConfiguration globalConfiguration) {
if (Objects.isNull(value)) {
return new WriteCellData<>("");
}
return new WriteCellData<>(TRUE.equals(value) ? "" : "");
}
}
@@ -0,0 +1,33 @@
package com.byhah.cloud.basic.core.converter;
import cn.idev.excel.converters.Converter;
import cn.idev.excel.enums.CellDataTypeEnum;
import cn.idev.excel.metadata.GlobalConfiguration;
import cn.idev.excel.metadata.data.WriteCellData;
import cn.idev.excel.metadata.property.ExcelContentProperty;
import java.lang.reflect.InvocationTargetException;
import java.util.Objects;
public class EnumConverter implements Converter<Enum<?>> {
@Override
public Class<Integer> supportJavaTypeKey() {
return Integer.class;
}
@Override
public CellDataTypeEnum supportExcelTypeKey() {
return CellDataTypeEnum.STRING;
}
@Override
public WriteCellData<?> convertToExcelData(Enum<?> value, ExcelContentProperty contentProperty,
GlobalConfiguration globalConfiguration) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
if (Objects.isNull(value)) {
return new WriteCellData<>("");
}
Object nodeValue = value.getClass().getDeclaredMethod("getNode").invoke(value);
return new WriteCellData<>(nodeValue.toString());
}
}
@@ -0,0 +1,53 @@
package com.byhah.cloud.basic.core.converter;
import cn.idev.excel.converters.Converter;
import cn.idev.excel.enums.CellDataTypeEnum;
import cn.idev.excel.metadata.GlobalConfiguration;
import cn.idev.excel.metadata.data.ReadCellData;
import cn.idev.excel.metadata.data.WriteCellData;
import cn.idev.excel.metadata.property.ExcelContentProperty;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Objects;
/**
* FastExcel转换LocalDate类型
*
* @author ZYJ
*/
public class LocalDateConverter implements Converter<LocalDate> {
@Override
public Class<LocalDate> supportJavaTypeKey() {
return LocalDate.class;
}
@Override
public CellDataTypeEnum supportExcelTypeKey() {
return CellDataTypeEnum.STRING;
}
/**
* 读取excel时调用
*/
@Override
public LocalDate convertToJavaData(ReadCellData<?> cellData, ExcelContentProperty contentProperty,
GlobalConfiguration globalConfiguration) {
return LocalDate.parse(cellData.getStringValue(), DateTimeFormatter.ofPattern("yyyy-MM-dd"));
}
/**
* 写入excel时调用
*/
@Override
public WriteCellData<?> convertToExcelData(LocalDate value, ExcelContentProperty contentProperty,
GlobalConfiguration globalConfiguration) {
if (Objects.isNull(value)) {
return new WriteCellData<>("");
}
return new WriteCellData<>(value.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
}
}
@@ -0,0 +1,52 @@
package com.byhah.cloud.basic.core.converter;
import cn.idev.excel.converters.Converter;
import cn.idev.excel.enums.CellDataTypeEnum;
import cn.idev.excel.metadata.GlobalConfiguration;
import cn.idev.excel.metadata.data.ReadCellData;
import cn.idev.excel.metadata.data.WriteCellData;
import cn.idev.excel.metadata.property.ExcelContentProperty;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Objects;
/**
* FastExcel转换LocalDateTime类型
*
* @author ZYJ
*/
public class LocalDateTimeConverter implements Converter<LocalDateTime> {
@Override
public Class<LocalDateTime> supportJavaTypeKey() {
return LocalDateTime.class;
}
@Override
public CellDataTypeEnum supportExcelTypeKey() {
return CellDataTypeEnum.STRING;
}
/**
* 读取excel时调用
*/
@Override
public LocalDateTime convertToJavaData(ReadCellData<?> cellData, ExcelContentProperty contentProperty,
GlobalConfiguration globalConfiguration) {
return LocalDateTime.parse(cellData.getStringValue(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
}
/**
* 写入excel时调用
*/
@Override
public WriteCellData<?> convertToExcelData(LocalDateTime value, ExcelContentProperty contentProperty,
GlobalConfiguration globalConfiguration) {
if (Objects.isNull(value)) {
return new WriteCellData<>("");
}
return new WriteCellData<>(value.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
}
}
@@ -0,0 +1,48 @@
package com.byhah.cloud.basic.core.converter;
import cn.idev.excel.converters.Converter;
import cn.idev.excel.enums.CellDataTypeEnum;
import cn.idev.excel.metadata.GlobalConfiguration;
import cn.idev.excel.metadata.data.ReadCellData;
import cn.idev.excel.metadata.data.WriteCellData;
import cn.idev.excel.metadata.property.ExcelContentProperty;
import java.time.LocalTime;
import java.time.LocalTime;
import java.time.format.DateTimeFormatter;
import java.util.Objects;
public class LocalTimeConverter implements Converter<LocalTime> {
@Override
public Class<LocalTime> supportJavaTypeKey() {
return LocalTime.class;
}
@Override
public CellDataTypeEnum supportExcelTypeKey() {
return CellDataTypeEnum.STRING;
}
/**
* 读取excel时调用
*/
@Override
public LocalTime convertToJavaData(ReadCellData<?> cellData, ExcelContentProperty contentProperty,
GlobalConfiguration globalConfiguration) {
return LocalTime.parse(cellData.getStringValue(), DateTimeFormatter.ofPattern("HH:mm:ss"));
}
/**
* 写入excel时调用
*/
@Override
public WriteCellData<?> convertToExcelData(LocalTime value, ExcelContentProperty contentProperty,
GlobalConfiguration globalConfiguration) {
if (Objects.isNull(value)) {
return new WriteCellData<>("");
}
return new WriteCellData<>(value.format(DateTimeFormatter.ofPattern("HH:mm:ss")));
}
}
@@ -0,0 +1,31 @@
package com.byhah.cloud.basic.core.converter;
import cn.idev.excel.converters.Converter;
import cn.idev.excel.enums.CellDataTypeEnum;
import cn.idev.excel.metadata.GlobalConfiguration;
import cn.idev.excel.metadata.data.WriteCellData;
import cn.idev.excel.metadata.property.ExcelContentProperty;
import java.util.Objects;
public class MoneyConverter implements Converter<Integer> {
@Override
public Class<Integer> supportJavaTypeKey() {
return Integer.class;
}
@Override
public CellDataTypeEnum supportExcelTypeKey() {
return CellDataTypeEnum.STRING;
}
@Override
public WriteCellData<?> convertToExcelData(Integer value, ExcelContentProperty contentProperty,
GlobalConfiguration globalConfiguration) {
if (Objects.isNull(value)) {
return new WriteCellData<>("");
}
return new WriteCellData<>(value / 100d + "");
}
}
@@ -0,0 +1,51 @@
package com.byhah.cloud.basic.core.converter;
import cn.idev.excel.converters.Converter;
import cn.idev.excel.enums.CellDataTypeEnum;
import cn.idev.excel.metadata.GlobalConfiguration;
import cn.idev.excel.metadata.data.ReadCellData;
import cn.idev.excel.metadata.data.WriteCellData;
import cn.idev.excel.metadata.property.ExcelContentProperty;
import java.time.LocalDate;
import java.time.YearMonth;
import java.time.format.DateTimeFormatter;
import java.util.Objects;
/**
* FastExcel转换YearMonth类型
*/
public class YearMonthConverter implements Converter<YearMonth> {
@Override
public Class<YearMonth> supportJavaTypeKey() {
return YearMonth.class;
}
@Override
public CellDataTypeEnum supportExcelTypeKey() {
return CellDataTypeEnum.STRING;
}
/**
* 读取excel时调用
*/
@Override
public YearMonth convertToJavaData(ReadCellData<?> cellData, ExcelContentProperty contentProperty,
GlobalConfiguration globalConfiguration) {
return YearMonth.parse(cellData.getStringValue(), DateTimeFormatter.ofPattern("yyyy-MM"));
}
/**
* 写入excel时调用
*/
@Override
public WriteCellData<?> convertToExcelData(YearMonth value, ExcelContentProperty contentProperty,
GlobalConfiguration globalConfiguration) {
if (Objects.isNull(value)) {
return new WriteCellData<>("");
}
return new WriteCellData<>(value.format(DateTimeFormatter.ofPattern("yyyy-MM")));
}
}
@@ -0,0 +1,27 @@
package com.byhah.cloud.basic.core.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
@Data
public class TimeLocalDate {
@NotNull
@Schema(requiredMode = Schema.RequiredMode.REQUIRED)
private LocalDate date;
@Schema(hidden = true)
public LocalDateTime getFrom() {
return date.atStartOfDay();
}
@Schema(hidden = true)
public LocalDateTime getTo() {
return date.atTime(LocalTime.MAX);
}
}
@@ -0,0 +1,29 @@
package com.byhah.cloud.basic.core.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import jakarta.validation.constraints.NotNull;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
@Data
public class TimeRangeDate {
@Schema(description = "起始日期")
@NotNull
private LocalDate from;
@Schema(description = "截止日期")
@NotNull
private LocalDate to;
@Schema(hidden = true)
public LocalDateTime getFromTime() {
return from.atStartOfDay();
}
@Schema(hidden = true)
public LocalDateTime getToTime() {
return to.atTime(LocalTime.MAX);
}
}
@@ -0,0 +1,58 @@
package com.byhah.cloud.basic.core.entity;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableLogic;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* <p>
* 通用基础字段实体:创建时间、创建人、修改时间、修改人,需要此通用字段的实体可继承此类,
* 继承此类要求数据表有对应的字段
* </p>
*/
@Data
@Accessors(chain = true)
public class BaseEntity implements Serializable {
private static final long serialVersionUID = 8149542387642733271L;
/**
* 删除标志
*/
@TableLogic
@Schema(description = "删除标志")
private Boolean deleted;
/**
* 创建时间
*/
@Schema(description = "创建时间")
@TableField(fill = FieldFill.INSERT)
private LocalDateTime createdAt;
/**
* 创建人
*/
@Schema(description = "创建人")
@TableField(fill = FieldFill.INSERT)
private Long createdBy;
/**
* 更新时间
*/
@Schema(description = "更新时间")
@TableField(fill = FieldFill.UPDATE)
private LocalDateTime updatedAt;
/**
* 更新人
*/
@Schema(description = "更新人")
@TableField(fill = FieldFill.UPDATE)
private Long updatedBy;
}
@@ -0,0 +1,54 @@
package com.byhah.cloud.basic.core.entity.dev;
import com.byhah.cloud.basic.core.entity.BaseEntity;
import com.byhah.deploy.basic.core.annotation.PgText;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.EqualsAndHashCode;
import lombok.Data;
/**
* 配置实体
*
**/
@Data
@EqualsAndHashCode(callSuper = true)
public class DevConfig extends BaseEntity {
/**
* id
*/
@Schema(description = "id")
private Long id;
/**
* 配置键
*/
@Schema(description = "配置键")
private String configKey;
/**
* 配置值
*/
@Schema(description = "配置值")
@PgText
private String configValue;
/**
* 分类
*/
@Schema(description = "分类")
private String category;
/**
* 备注
*/
@Schema(description = "备注")
private String remark;
/**
* 排序码
*/
@Schema(description = "排序码")
private Integer sortCode;
}
@@ -0,0 +1,38 @@
package com.byhah.cloud.basic.core.entity.dev;
import com.byhah.cloud.basic.core.entity.BaseEntity;
import com.byhah.deploy.basic.core.annotation.AutoTable;
import com.byhah.deploy.basic.core.annotation.PgBoolean;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 字典实体
**/
@Data
@AutoTable
@EqualsAndHashCode(callSuper = true)
public class DevDict extends BaseEntity {
@Schema(description = "id")
private Long id;
@Schema(description = "父id")
private Long parentId;
@Schema(description = "字典标签")
private String label;
@Schema(description = "字典值")
private String value;
@Schema(description = "排序码")
private Integer sortCode;
private String remark;
@Schema(description = "系统内置")
@PgBoolean
private Boolean system;
}
@@ -0,0 +1,61 @@
package com.byhah.cloud.basic.core.entity.dev;
import com.byhah.cloud.basic.core.entity.BaseEntity;
import com.byhah.cloud.basic.core.enums.dev.DevEmailEngine;
import com.byhah.deploy.basic.core.annotation.PgInteger;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.EqualsAndHashCode;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 邮件实体
**/
@Data
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
public class DevEmail extends BaseEntity {
@Schema(description = "id")
private Long id;
@Schema(description = "邮件引擎")
@PgInteger
private DevEmailEngine engine;
@Schema(description = "发件人邮箱")
private String sendAccount;
@Schema(description = "发件人昵称")
private String sendUser;
@Schema(description = "接收人")
private String receiveAccounts;
@Schema(description = "邮件主题")
private String subject;
@Schema(description = "邮件正文")
private String content;
@Schema(description = "标签名")
private String tagName;
@Schema(description = "模板名")
private String templateName;
@Schema(description = "发送参数")
private String templateParam;
@Schema(description = "回执信息")
private String receipt;
public DevEmail(DevEmailEngine engine, String sendUser, String receiveAccounts, String subject, String content) {
this.sendUser = sendUser;
this.receiveAccounts = receiveAccounts;
this.engine = engine;
this.subject = subject;
this.content = content;
}
}
@@ -0,0 +1,89 @@
package com.byhah.cloud.basic.core.entity.dev;
import com.byhah.deploy.basic.core.annotation.NotNull;
import com.byhah.deploy.basic.core.annotation.PgInteger;
import com.byhah.cloud.basic.core.entity.BaseEntity;
import com.byhah.cloud.basic.core.enums.dev.DevFileEngine;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.EqualsAndHashCode;
import lombok.Data;
/**
* 文件实体
**/
@Data
@EqualsAndHashCode(callSuper = true)
public class DevFile extends BaseEntity {
/**
* id
*/
@Schema(description = "id")
private Long id;
/**
* 存储引擎
*/
@Schema(description = "存储引擎")
@PgInteger
private DevFileEngine engine;
/**
* 存储桶
*/
@Schema(description = "存储桶")
private String bucket;
/**
* 文件名称
*/
@Schema(description = "文件名称")
private String name;
/**
* 文件后缀
*/
@Schema(description = "文件后缀")
private String suffix;
/**
* 文件大小kb
*/
@Schema(description = "文件大小kb")
private Long sizeKb;
/**
* 文件大小(格式化后)
*/
@Schema(description = "文件大小(格式化后)")
private String sizeInfo;
/**
* 文件的对象名(唯一名称)
*/
@Schema(description = "文件的对象名(唯一名称)")
private String objName;
/**
* 文件存储路径
*/
@Schema(description = "文件存储路径")
private String storagePath;
/**
* 文件下载路径
*/
@Schema(description = "文件下载路径")
private String downloadPath;
/**
* 图片缩略图
*/
@Schema(description = "图片缩略图")
private String thumbnail;
@Schema(description = "文件md5值")
@NotNull
private String md5;
}
@@ -0,0 +1,150 @@
package com.byhah.cloud.basic.core.entity.dev;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.byhah.cloud.basic.core.enums.dev.DevLogType;
import com.byhah.deploy.basic.core.annotation.PgBoolean;
import com.byhah.deploy.basic.core.annotation.PgInteger;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.time.LocalDateTime;
/**
* 日志实体
*/
@Data
public class DevLog {
/**
* id
*/
@Schema(description = "id")
private Long id;
/**
* 日志分类
*/
@Schema(description = "日志分类")
@PgInteger
private DevLogType category;
/**
* 日志名称
*/
@Schema(description = "日志名称")
private String name;
/**
* 执行状态
*/
@Schema(description = "执行状态")
private Boolean exeStatus;
/**
* 具体消息
*/
@Schema(description = "具体消息")
private String exeMessage;
/**
* 操作ip
*/
@Schema(description = "操作ip")
private String opIp;
/**
* 操作地址
*/
@Schema(description = "操作地址")
private String opAddress;
/**
* 操作浏览器
*/
@Schema(description = "操作浏览器")
private String opBrowser;
/**
* 操作系统
*/
@Schema(description = "操作系统")
private String opOs;
/**
* 类名称
*/
@Schema(description = "类名称")
private String className;
/**
* 方法名称
*/
@Schema(description = "方法名称")
private String methodName;
/**
* 请求方式
*/
@Schema(description = "请求方式")
private String reqMethod;
/**
* 请求地址
*/
@Schema(description = "请求地址")
private String reqUrl;
/**
* 请求参数
*/
@Schema(description = "请求参数")
private String paramJson;
/**
* 返回结果
*/
@Schema(description = "返回结果")
private String resultJson;
/**
* 操作时间
*/
@Schema(description = "操作时间")
private LocalDateTime opTime;
/**
* 操作人姓名
*/
@Schema(description = "操作人姓名")
private String opUser;
/**
* 创建时间
*/
@Schema(description = "创建时间")
@TableField(fill = FieldFill.INSERT)
private LocalDateTime createdAt;
/**
* 创建人
*/
@Schema(description = "创建人")
@TableField(fill = FieldFill.INSERT)
private Long createdBy;
/**
* 更新时间
*/
@Schema(description = "更新时间")
@TableField(fill = FieldFill.UPDATE)
private LocalDateTime updatedAt;
/**
* 更新人
*/
@Schema(description = "更新人")
@TableField(fill = FieldFill.UPDATE)
private Long updatedBy;
}
@@ -0,0 +1,42 @@
package com.byhah.cloud.basic.core.entity.dev;
import com.byhah.cloud.basic.core.entity.BaseEntity;
import com.byhah.cloud.basic.core.enums.dev.DevMessageType;
import com.byhah.deploy.basic.core.annotation.PgInteger;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 站内信实体
**/
@Data
@EqualsAndHashCode(callSuper = true)
public class DevMessage extends BaseEntity {
/**
* id
*/
@Schema(description = "id")
private Long id;
/**
* 分类
*/
@Schema(description = "分类")
@PgInteger
private DevMessageType category;
/**
* 主题
*/
@Schema(description = "主题")
private String subject;
/**
* 正文
*/
@Schema(description = "正文")
private String content;
}
@@ -0,0 +1,24 @@
package com.byhah.cloud.basic.core.entity.dev;
import com.baomidou.mybatisplus.annotation.TableLogic;
import lombok.Data;
import java.time.LocalDateTime;
@Data
public class DevMessageUser {
private Long id;
private Long userId;
private Long messageId;
/**
* 已读
*/
private Boolean read;
/**
* 已读时间
*/
private LocalDateTime readAt;
@TableLogic
private Boolean deleted;
}
@@ -0,0 +1,40 @@
package com.byhah.cloud.basic.core.entity.dev;
import com.byhah.cloud.basic.core.entity.BaseEntity;
import com.byhah.cloud.basic.core.enums.dev.DevSmsEngine;
import com.byhah.deploy.basic.core.annotation.PgInteger;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 短信实体
*
**/
@Data
@EqualsAndHashCode(callSuper = true)
public class DevSms extends BaseEntity {
@Schema(description = "id")
private Long id;
@Schema(description = "短信引擎")
@PgInteger
private DevSmsEngine engine;
@Schema(description = "手机号")
private String phoneNumbers;
@Schema(description = "短信签名")
private String signName;
@Schema(description = "模板编码")
private String templateCode;
@Schema(description = "发送参数")
private String templateParam;
@Schema(description = "回执信息")
private String receiptInfo;
}
@@ -0,0 +1,112 @@
package com.byhah.cloud.basic.core.entity.gen;
import com.byhah.cloud.basic.core.entity.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 代码生成基础
*
**/
@Data
@EqualsAndHashCode(callSuper = true)
public class GenBasic extends BaseEntity {
/**
* id
*/
@Schema(description = "id")
private Long id;
/**
* 主表名称
*/
@Schema(description = "主表名称")
private String dbTable;
/**
* 主表主键
*/
@Schema(description = "主表主键")
private String dbTableKey;
/**
* 模块名
*/
@Schema(description = "模块名")
private String moduleName;
/**
* 表前缀移除
*/
@Schema(description = "表前缀移除")
private Boolean tablePrefix;
/**
* 生成方式
*/
@Schema(description = "生成方式")
private String generateType;
/**
* 所属模块
*/
@Schema(description = "所属模块")
private Long module;
/**
* 上级目录
*/
@Schema(description = "上级目录")
private Long menuPid;
/**
* 功能名
*/
@Schema(description = "功能名")
private String functionName;
/**
* 业务名
*/
@Schema(description = "业务名")
private String busName;
/**
* 类名
*/
@Schema(description = "类名")
private String className;
/**
* 表单布局
*/
@Schema(description = "表单布局")
private String formLayout;
/**
* 使用栅格
*/
@Schema(description = "使用栅格")
private Boolean gridWhether;
/**
* 排序
*/
@Schema(description = "排序")
private Integer sortCode;
/**
* 包名
*/
@Schema(description = "包名")
private String packageName;
/**
* 作者
*/
@Schema(description = "作者")
private String authorName;
}
@@ -0,0 +1,110 @@
package com.byhah.cloud.basic.core.entity.gen;
import com.byhah.cloud.basic.core.entity.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 代码生成详细配置
**/
@Data
@EqualsAndHashCode(callSuper = true)
public class GenConfig extends BaseEntity {
/**
* id
*/
@Schema(description = "id")
private Long id;
/**
* 基础ID
*/
@Schema(description = "基础ID")
private Long basicId;
/**
* 是否主键
*/
@Schema(description = "是否主键")
private Boolean isTableKey;
/**
* 字段
*/
@Schema(description = "字段")
private String fieldName;
/**
* 注释
*/
@Schema(description = "注释")
private String fieldRemark;
/**
* 类型
*/
@Schema(description = "类型")
private String fieldType;
/**
* 实体类型
*/
@Schema(description = "实体类型")
private String fieldJavaType;
/**
* 作用类型
*/
@Schema(description = "作用类型")
private String effectType;
@Schema(description = "一级数据分类")
private String firstDataType;
@Schema(description = "二级数据分类")
private String secondDataType;
/**
* 列表显示
*/
@Schema(description = "列表显示")
private Boolean whetherTable;
/**
* 列省略
*/
@Schema(description = "列省略")
private Boolean whetherRetract;
/**
* 增改
*/
@Schema(description = "增改")
private Boolean whetherAddUpdate;
/**
* 必填
*/
@Schema(description = "必填")
private Boolean whetherRequired;
/**
* 查询
*/
@Schema(description = "查询")
private Boolean queryWhether;
/**
* 查询方式
*/
@Schema(description = "查询方式")
private String queryType;
/**
* 排序
*/
@Schema(description = "排序")
private Integer sortCode;
}
@@ -0,0 +1,50 @@
package com.byhah.cloud.basic.core.entity.system;
import com.baomidou.mybatisplus.annotation.FieldStrategy;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import com.byhah.cloud.basic.core.entity.BaseEntity;
/**
* 组织实体
**/
@Data
@EqualsAndHashCode(callSuper = true)
public class SysOrg extends BaseEntity {
private static final long serialVersionUID = 7639441873140119503L;
/**
* id
*/
@Schema(description = "id")
private Long id;
/**
* 父id
*/
@Schema(description = "父id")
private Long parentId;
/**
* 主管id
*/
@Schema(description = "主管id")
@TableField(insertStrategy = FieldStrategy.IGNORED, updateStrategy = FieldStrategy.IGNORED)
private Long directorId;
/**
* 名称
*/
@Schema(description = "名称")
private String name;
private Integer sortCode;
/**
* 编码
*/
@Schema(description = "编码")
private String code;
}
@@ -0,0 +1,39 @@
package com.byhah.cloud.basic.core.entity.system;
import com.byhah.cloud.basic.core.enums.sys.SysRelationType;
import com.byhah.deploy.basic.core.annotation.PgInteger;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
/**
* 关系实体
**/
@Data
public class SysRelation {
/**
* id
*/
@Schema(description = "id")
private Long id;
/**
* 对象id
*/
@Schema(description = "对象id")
private Long objectId;
/**
* 目标id
*/
@Schema(description = "目标id")
private Long targetId;
/**
* 分类
*/
@Schema(description = "分类")
@PgInteger
private SysRelationType category;
}
@@ -0,0 +1,66 @@
package com.byhah.cloud.basic.core.entity.system;
import com.byhah.cloud.basic.core.enums.sys.SysMenuType;
import com.byhah.cloud.basic.core.enums.sys.SysResourceType;
import com.byhah.deploy.basic.core.annotation.PgInteger;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import com.byhah.cloud.basic.core.entity.BaseEntity;
/**
* 按钮实体
**/
@Data
@EqualsAndHashCode(callSuper = true)
public class SysResource extends BaseEntity {
private static final long serialVersionUID = -6594295960114668527L;
/**
* id
*/
@Schema(description = "id")
private Long id;
/**
* 父id
*/
@Schema(description = "父id")
private Long parentId;
/**
* 标题
*/
@Schema(description = "标题")
private String title;
@Schema(description = "别名")
private String name;
@Schema(description = "编码")
private String code;
@PgInteger
@Schema(description = "分类")
private SysResourceType category;
private Long module;
@PgInteger
private SysMenuType menuType;
private String path;
private String component;
private String icon;
private String color;
/**
* 排序码
*/
@Schema(description = "排序码")
private Integer sortCode;
}
@@ -0,0 +1,40 @@
package com.byhah.cloud.basic.core.entity.system;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import com.byhah.cloud.basic.core.entity.BaseEntity;
/**
* 角色实体
**/
@Data
@EqualsAndHashCode(callSuper = true)
public class SysRole extends BaseEntity {
private static final long serialVersionUID = -8436607186466927211L;
/**
* id
*/
@Schema(description = "id")
private Long id;
/**
* 名称
*/
@Schema(description = "名称")
private String name;
/**
* 编码
*/
@Schema(description = "编码")
private String code;
/**
* 排序码
*/
@Schema(description = "排序码")
private Integer sortCode;
}
@@ -0,0 +1,32 @@
package com.byhah.cloud.basic.core.entity.system;
import com.byhah.cloud.basic.core.entity.BaseEntity;
import com.byhah.deploy.basic.core.annotation.PgJsonb;
import com.byhah.deploy.basic.core.model.LongList;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 租户/教育局/代理商
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class SysTenant extends BaseEntity {
private Long id;
/**
* 名称
*/
private String name;
/**
* 父级
*/
private Long parentId;
private String phone;
/**
* 管理员账号
*/
private String account;
@PgJsonb
private LongList schoolIds;
}
@@ -0,0 +1,95 @@
package com.byhah.cloud.basic.core.entity.system;
import com.baomidou.mybatisplus.annotation.FieldStrategy;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.byhah.cloud.basic.core.enums.Gender;
import com.byhah.deploy.basic.core.annotation.PgInteger;
import com.byhah.deploy.basic.core.annotation.PgJsonb;
import com.byhah.deploy.basic.core.annotation.PgText;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import com.byhah.cloud.basic.core.entity.BaseEntity;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.List;
/**
* 用户实体
**/
@Data
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = true)
public class SysUser extends BaseEntity {
private static final long serialVersionUID = 8548005793837476397L;
@TableId
private Long id;
@PgText
@TableField(insertStrategy = FieldStrategy.IGNORED, updateStrategy = FieldStrategy.IGNORED)
private String avatar;
@TableField(insertStrategy = FieldStrategy.IGNORED, updateStrategy = FieldStrategy.IGNORED)
private String signature;
private String account;
private String password;
private String name;
@PgInteger
@TableField(insertStrategy = FieldStrategy.IGNORED, updateStrategy = FieldStrategy.IGNORED)
private Gender gender;
@TableField(insertStrategy = FieldStrategy.IGNORED, updateStrategy = FieldStrategy.IGNORED)
private String phone;
@TableField(insertStrategy = FieldStrategy.IGNORED, updateStrategy = FieldStrategy.IGNORED)
private Long orgId;
private String wxUnionId;
/**
* 小程序openId
*/
private String wxOpenId;
/**
* 小程序sessionKey
*/
private String wxSessionKey;
@PgJsonb
private UserLoginInfo lastLoginInfo;
@PgJsonb
private UserLoginInfo latestLoginInfo;
@PgJsonb
private WorkBenchData workBenchData;
private Boolean status;
private Integer sortCode;
@Schema(description = "组织名称")
@TableField(exist = false)
private String orgName;
@Data
@NoArgsConstructor
@AllArgsConstructor
public static class UserLoginInfo implements Serializable {
private static final long serialVersionUID = -301805984405117624L;
private String loginDevice;
private String loginIp;
private String loginAddress;
private LocalDateTime loginAt;
}
@Data
public static class WorkBenchData implements Serializable {
private static final long serialVersionUID = -1657928114667078484L;
private List<WorkBenchDataItem> shortcut;
}
@Data
public static class WorkBenchDataItem {
private Long id;
private String title;
private String icon;
private String path;
}
}
@@ -0,0 +1,23 @@
package com.byhah.cloud.basic.core.entity.system;
import com.byhah.deploy.basic.core.annotation.NotNull;
import com.byhah.deploy.basic.core.annotation.PgJsonb;
import com.byhah.deploy.basic.core.model.LongList;
import lombok.Data;
import java.io.Serializable;
@Data
public class ThirdPlatform implements Serializable {
private static final long serialVersionUID = -3635864628010884811L;
private Long id;
@NotNull
private String name;
@NotNull
private String appId;
@NotNull
private String secret;
@PgJsonb
private LongList schoolIds;
private String remark;
}
@@ -0,0 +1,33 @@
package com.byhah.cloud.basic.core.enums;
import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Getter;
@Getter
@AllArgsConstructor
@JsonFormat(shape = JsonFormat.Shape.OBJECT)
public enum DesensitizationType {
MY_RULE(0, "自定义"),
CHINESE_NAME(1, "中文姓名"),
ID_CARD(2, "身份证号"),
PHONE(3, "手机号"),
;
@EnumValue
private final int type;
private final String node;
@JsonCreator
public static DesensitizationType forValue(Integer value) {
if (value != null) {
for (DesensitizationType status : DesensitizationType.values()) {
if (value.equals(status.getType())) {
return status;
}
}
}
return null;
}
}
@@ -0,0 +1,32 @@
package com.byhah.cloud.basic.core.enums;
import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Getter;
@Getter
@AllArgsConstructor
@JsonFormat(shape = JsonFormat.Shape.OBJECT)
public enum Gender {
MALE(1, ""),
FEMALE(2, ""),
UNKNOWN(3, "未知");
@EnumValue
private final int type;
private final String node;
@JsonCreator
public static Gender forValue(Integer value) {
if (value != null) {
for (Gender status : Gender.values()) {
if (value.equals(status.getType())) {
return status;
}
}
}
return null;
}
}
@@ -0,0 +1,37 @@
package com.byhah.cloud.basic.core.enums;
import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* 登录设备类型枚举
**/
@Getter
@AllArgsConstructor
@JsonFormat(shape = JsonFormat.Shape.OBJECT)
public enum PlatformType {
ADMIN(1, "后台"),
MINI_APP(2, "小程序"),
MP(3, "微信公众号"),
APP(4, "APP");
@EnumValue
private final int type;
private final String node;
@JsonCreator
public static PlatformType forValue(Integer value) {
if (value != null) {
for (PlatformType status : PlatformType.values()) {
if (value.equals(status.getType())) {
return status;
}
}
}
return null;
}
}
@@ -0,0 +1,38 @@
package com.byhah.cloud.basic.core.enums;
import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* 第三方登录平台
**/
@Getter
@AllArgsConstructor
@JsonFormat(shape = JsonFormat.Shape.OBJECT)
public enum ThirdPlatform {
/**
* 后台
*/
WX(1, "微信"),
;
@EnumValue
private final int type;
private final String node;
@JsonCreator
public static ThirdPlatform forValue(Integer value) {
if (value != null) {
for (ThirdPlatform status : ThirdPlatform.values()) {
if (value.equals(status.getType())) {
return status;
}
}
}
return null;
}
}
@@ -0,0 +1,62 @@
package com.byhah.cloud.basic.core.enums.auth;
import lombok.Getter;
/**
* 登录异常提示语枚举
**/
@Getter
public enum AuthExceptionEnum {
/**
* 验证码不能为空
*/
VALID_CODE_EMPTY("验证码不能为空"),
/**
* 验证码请求号不能为空
*/
VALID_CODE_REQ_NO_EMPTY("验证码请求号不能为空"),
/**
* 验证码错误
*/
VALID_CODE_ERROR("验证码错误"),
/**
* 账号错误
*/
ACCOUNT_ERROR("账号错误"),
/**
* 账号已停用
*/
ACCOUNT_DISABLED("账号已停用"),
/**
* 密码错误
*/
PWD_ERROR("密码错误"),
/**
* 手机号格式错误
*/
PHONE_FORMAT_ERROR("手机号格式错误"),
/**
* 手机号不存在
*/
PHONE_ERROR("手机号不存在"),
/**
* 密码解密失败,请检查前端公钥
*/
PWD_DECRYPT_ERROR("密码解密失败,请检查前端公钥");
private final String value;
AuthExceptionEnum(String value) {
this.value = value;
}
}
@@ -0,0 +1,39 @@
package com.byhah.cloud.basic.core.enums.dev;
import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* 邮件发送引擎
**/
@Getter
@AllArgsConstructor
@JsonFormat(shape = JsonFormat.Shape.OBJECT)
public enum DevEmailEngine {
LOCAL(1, "本地"),
ALIYUN(2, "阿里云"),
TENCENT(3, "腾讯云");
@EnumValue
private final int type;
private final String node;
@JsonCreator
public static DevEmailEngine forValue(Integer value) {
if (value != null) {
for (DevEmailEngine status : DevEmailEngine.values()) {
if (value.equals(status.getType())) {
return status;
}
}
}
return null;
}
}
@@ -0,0 +1,37 @@
package com.byhah.cloud.basic.core.enums.dev;
import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* 文件存储引擎
**/
@Getter
@AllArgsConstructor
@JsonFormat(shape = JsonFormat.Shape.OBJECT)
public enum DevFileEngine {
LOCAL(1, "本地"),
ALIYUN(2, "阿里"),
TENCENT(3, "腾讯"),
MINIO(4, "MINIO");
@EnumValue
private final int type;
private final String node;
@JsonCreator
public static DevFileEngine forValue(Integer value) {
if (value != null) {
for (DevFileEngine status : DevFileEngine.values()) {
if (value.equals(status.getType())) {
return status;
}
}
}
return null;
}
}
@@ -0,0 +1,38 @@
package com.byhah.cloud.basic.core.enums.dev;
import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* 日志分类枚举
**/
@Getter
@AllArgsConstructor
@JsonFormat(shape = JsonFormat.Shape.OBJECT)
public enum DevLogType {
OPERATE(1, "操作日志"),
EXCEPTION(2, "异常日志"),
LOGIN(3, "登录日志"),
LOGOUT(4, "登出日志");
@EnumValue
private final int type;
private final String node;
@JsonCreator
public static DevLogType forValue(Integer value) {
if (value != null) {
for (DevLogType status : DevLogType.values()) {
if (value.equals(status.getType())) {
return status;
}
}
}
return null;
}
}
@@ -0,0 +1,37 @@
package com.byhah.cloud.basic.core.enums.dev;
import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* 消息分类
**/
@Getter
@AllArgsConstructor
@JsonFormat(shape = JsonFormat.Shape.OBJECT)
public enum DevMessageType {
SYS(1, "系统"),
BIZ(2, "业务");
@EnumValue
private final int type;
private final String node;
@JsonCreator
public static DevMessageType forValue(Integer value) {
if (value != null) {
for (DevMessageType status : DevMessageType.values()) {
if (value.equals(status.getType())) {
return status;
}
}
}
return null;
}
}
@@ -0,0 +1,36 @@
package com.byhah.cloud.basic.core.enums.dev;
import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* 短信发送引擎
**/
@Getter
@AllArgsConstructor
@JsonFormat(shape = JsonFormat.Shape.OBJECT)
public enum DevSmsEngine {
ALIYUN(1, "阿里"),
TENCENT(2, "腾讯");
@EnumValue
private final int type;
private final String node;
@JsonCreator
public static DevSmsEngine forValue(Integer value) {
if (value != null) {
for (DevSmsEngine status : DevSmsEngine.values()) {
if (value.equals(status.getType())) {
return status;
}
}
}
return null;
}
}
@@ -0,0 +1,44 @@
package com.byhah.cloud.basic.core.enums.gen;
import lombok.Getter;
/**
* 作用类型枚举
**/
@Getter
public enum GenEffectType {
/** 输入框 */
INPUT("INPUT"),
/** 文本框 */
TEXTAREA("TEXTAREA"),
/** 下拉框 */
SELECT("SELECT"),
/** 单选框 */
RADIO("RADIO"),
/** 复选框 */
CHECKBOX("CHECKBOX"),
/** 日期选择器 */
DATEPICKER("DATEPICKER"),
/** 时间选择器 */
TIMEPICKER("TIMEPICKER"),
/** 数字输入框 */
INPUTNUMBER("INPUTNUMBER"),
/** 滑动数字条 */
SLIDER("SLIDER");
private final String value;
GenEffectType(String value) {
this.value = value;
}
}
@@ -0,0 +1,44 @@
package com.byhah.cloud.basic.core.enums.gen;
import lombok.Getter;
/**
* Java类型枚举
*
**/
@Getter
public enum GenJavaType {
/** Integer */
Integer("Integer"),
/** Long */
Long("Long"),
/** String */
String("String"),
/** Boolean */
Boolean("Boolean"),
/** Float */
Float("Float"),
/** Double */
Double("Double"),
/** Date */
LocalDate("LocalDate"),
LocalTime("LocalTime"),
LocalDateTime("LocalDateTime"),
/** BigDecimal */
BigDecimal("BigDecimal");
private final String value;
GenJavaType(String value) {
this.value = value;
}
}
@@ -0,0 +1,24 @@
package com.byhah.cloud.basic.core.enums.gen;
import lombok.Getter;
/**
* 生成方式枚举
*
**/
@Getter
public enum GenTypeEnum {
/** 压缩包 */
ZIP("ZIP"),
/** 项目内 */
PRO("PRO");
private final String value;
GenTypeEnum(String value) {
this.value = value;
}
}
@@ -0,0 +1,24 @@
package com.byhah.cloud.basic.core.enums.gen;
import lombok.Getter;
/**
* 是与否枚举
*
**/
@Getter
public enum GenYesNoEnum {
/** 是 */
Y("Y"),
/** 否 */
N("N");
private final String value;
GenYesNoEnum(String value) {
this.value = value;
}
}
@@ -0,0 +1,36 @@
package com.byhah.cloud.basic.core.enums.sys;
import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* 文件存储引擎
*/
@Getter
@AllArgsConstructor
@JsonFormat(shape = JsonFormat.Shape.OBJECT)
public enum FileConfig {
LOCAL(1, "本地"),
ALI(2, "阿里"),
TENCENT(3, "腾讯"),
MINIO(4, "MINIO"),
;
@EnumValue
private final int type;
private final String node;
@JsonCreator
public static FileConfig forValue(Integer value) {
if (value != null) {
for (FileConfig status : FileConfig.values()) {
if (value.equals(status.getType())) {
return status;
}
}
}
return null;
}
}
@@ -0,0 +1,34 @@
package com.byhah.cloud.basic.core.enums.sys;
import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Getter;
@Getter
@AllArgsConstructor
@JsonFormat(shape = JsonFormat.Shape.OBJECT)
public enum SysMenuType {
CATALOG(1, "目录"),
MENU(2, "组件"),
IFRAME(3, "内链"),
LINK(4, "外链"),
;
@EnumValue
private final int type;
private final String node;
@JsonCreator
public static SysMenuType forValue(Integer value) {
if (value != null) {
for (SysMenuType status : SysMenuType.values()) {
if (value.equals(status.getType())) {
return status;
}
}
}
return null;
}
}
@@ -0,0 +1,35 @@
package com.byhah.cloud.basic.core.enums.sys;
import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* 关系分类枚举
**/
@Getter
@AllArgsConstructor
@JsonFormat(shape = JsonFormat.Shape.OBJECT)
public enum SysRelationType {
USER_HAS_ROLE(1, "用户拥有角色"),
ROLE_HAS_RESOURCE(2, "角色拥有资源")
;
@EnumValue
private final int type;
private final String node;
@JsonCreator
public static SysMenuType forValue(Integer value) {
if (value != null) {
for (SysMenuType status : SysMenuType.values()) {
if (value.equals(status.getType())) {
return status;
}
}
}
return null;
}
}
@@ -0,0 +1,34 @@
package com.byhah.cloud.basic.core.enums.sys;
import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Getter;
@Getter
@AllArgsConstructor
@JsonFormat(shape = JsonFormat.Shape.OBJECT)
public enum SysResourceType {
MODULE(1, "模块"),
MENU(2, "菜单"),
BUTTON(3, "按钮"),
SPA(4, "单页面"),
;
@EnumValue
private final int type;
private final String node;
@JsonCreator
public static SysResourceType forValue(Integer value) {
if (value != null) {
for (SysResourceType status : SysResourceType.values()) {
if (value.equals(status.getType())) {
return status;
}
}
}
return null;
}
}
@@ -0,0 +1,8 @@
package com.byhah.cloud.basic.core.model;
import lombok.Data;
@Data
public class CommonSearch {
private String searchKey;
}
@@ -0,0 +1,42 @@
package com.byhah.cloud.basic.core.model;
import lombok.Data;
import java.io.Serializable;
/**
* 分片下载请求类
*
* @author ZYJ
* @date 2023-06-12
*/
@Data
public class DownloadFileChunk implements Serializable {
private static final long serialVersionUID = -6250036738314992891L;
/**
* 本次操作标识
*/
private String num;
/**
* 文件名称
*/
private String fileName;
/**
* 分片下标(下载的第几块)
*/
private Integer index;
/**
* 总分片数
*/
private Integer chunkTotal;
/**
* 分片大小
*/
private Integer chunkSize;
}
@@ -0,0 +1,93 @@
package com.byhah.cloud.basic.core.model;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.List;
/**
* 导出结果类
*
* @author ZYJ
* @date 2024/9/12 15:40
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class ExportResult<T> implements Serializable {
private static final long serialVersionUID = -5285791961803665580L;
/**
* 状态 0-进行中 1-成功 2-失败
*/
private Integer status;
/**
* 总条数
*/
private Integer totalCount = 0;
/**
* 成功条数
*/
private Integer successCount = 0;
/**
* 错误条数
*/
private Integer errorCount = 0;
/**
* 错误数据
*/
private List<T> errorDetail;
private List<Long> tempUserIds;
private String message;
/**
* 导出的文件大小
*/
private long fileSize;
/**
* 文件名称
*/
private String fileName;
public ExportResult(Integer total, Integer success, Integer error, List<T> list) {
this.totalCount = total;
this.successCount = success;
this.errorCount = error;
this.errorDetail = list;
}
public void init(Integer total) {
this.status = 0;
this.totalCount = total;
}
public void update(Integer success, Integer error) {
this.successCount = success;
this.errorCount = error;
}
public void success(Integer successCount, Integer errorCount, List<T> errorDetail, List<Long> userIds) {
this.successCount = successCount;
this.errorCount = errorCount;
this.errorDetail = errorDetail;
this.tempUserIds = userIds;
this.status = 1;
}
public void fail(String msg) {
this.status = 2;
this.message = msg;
}
public void fileInfo(long fileSize, String fileName) {
this.fileSize = fileSize;
this.fileName = fileName;
}
}
@@ -0,0 +1,87 @@
package com.byhah.cloud.basic.core.model;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.List;
@Data
@NoArgsConstructor
@AllArgsConstructor
public class ImportResult<T> implements Serializable {
private static final long serialVersionUID = -2548704852951276098L;
/**
* 状态 0-进行中 1-成功 2-失败
*/
private Integer status;
/**
* 总条数
*/
private Integer totalCount = 0;
/**
* 成功条数
*/
private Integer successCount = 0;
/**
* 错误条数
*/
private Integer errorCount = 0;
/**
* 正确数据
*/
private List<T> successDetail;
/**
* 错误数据
*/
private List<T> errorDetail;
private List<Long> tempUserIds;
private String message;
public ImportResult(Integer total, Integer success, Integer error, List<T> list) {
this.totalCount = total;
this.successCount = success;
this.errorCount = error;
this.errorDetail = list;
}
public ImportResult<T> init(Integer total) {
this.status = 0;
this.totalCount = total;
return this;
}
public ImportResult<T> update(Integer success, Integer error) {
this.successCount = success;
this.errorCount = error;
return this;
}
public ImportResult<T> success(Integer successCount, Integer errorCount, List<T> successDetail, List<T> errorDetail, List<Long> userIds) {
this.successCount = successCount;
this.errorCount = errorCount;
this.successDetail = successDetail;
this.errorDetail = errorDetail;
this.tempUserIds = userIds;
this.status = 1;
return this;
}
public ImportResult<T> success(Integer successCount, Integer errorCount, List<T> errorDetail, List<Long> userIds) {
this.successCount = successCount;
this.errorCount = errorCount;
this.errorDetail = errorDetail;
this.tempUserIds = userIds;
this.status = 1;
return this;
}
public ImportResult<T> fail(String msg) {
this.status = 2;
this.message = msg;
return this;
}
}
@@ -0,0 +1,22 @@
package com.byhah.cloud.basic.core.model;
import lombok.Getter;
import java.util.ArrayList;
import java.util.List;
public class RunnableResult implements Runnable {
@Getter
private final List<Runnable> runnableList = new ArrayList<>();
public void add(Runnable runnable) {
if (runnable != null) {
runnableList.add(runnable);
}
}
@Override
public void run() {
runnableList.forEach(Runnable::run);
}
}
@@ -0,0 +1,52 @@
package com.byhah.cloud.basic.core.util;
import cn.hutool.core.map.MapUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.Signature;
import org.aspectj.lang.reflect.MethodSignature;
import org.springframework.web.multipart.MultipartFile;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import java.util.Map;
/**
* Spring切面工具类
*/
public class CommonJoinPointUtil {
/**
* 获取切面的参数JSON
*/
public static String getArgsJsonString(JoinPoint joinPoint) {
Signature signature = joinPoint.getSignature();
// 参数名数组
String[] parameterNames = ((MethodSignature) signature).getParameterNames();
// 构造参数组集合
Map<String, Object> map = MapUtil.newHashMap();
Object[] args = joinPoint.getArgs();
for (int i = 0; i < args.length; i++) {
if(ObjectUtil.isNotEmpty(args[i]) && isUsefulParam(args[i])) {
if(JSONUtil.isTypeJSON(StrUtil.toString(args[i]))) {
map.put(parameterNames[i], JSONUtil.parseObj(args[i]));
} else {
map.put(parameterNames[i], JSONUtil.toJsonStr(args[i]));
}
}
}
return JSONUtil.toJsonStr(map);
}
/**
* 判断是否需要拼接的参数,过滤掉HttpServletRequest,MultipartFile,HttpServletResponse等类型参数
*/
private static boolean isUsefulParam(Object arg) {
return !(arg instanceof MultipartFile) &&
!(arg instanceof HttpServletRequest) &&
!(arg instanceof HttpServletResponse);
}
}
@@ -0,0 +1,16 @@
package com.byhah.cloud.basic.core.util;
import cn.hutool.crypto.SmUtil;
import lombok.extern.slf4j.Slf4j;
@Slf4j
public class CryptogramUtil {
/**
* 通过杂凑算法取得hash值,用于做数据完整性保护
*/
public static String doHashValue(String str) {
return SmUtil.sm3(str);
}
}
@@ -0,0 +1,74 @@
package com.byhah.cloud.basic.core.util;
import cn.hutool.core.util.StrUtil;
import cn.hutool.core.util.URLUtil;
import cn.idev.excel.FastExcel;
import jakarta.servlet.http.HttpServletResponse;
import lombok.extern.slf4j.Slf4j;
import org.apache.poi.ss.util.CellReference;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.List;
@Slf4j
public class ExcelUtil {
public static void exportExcel(String fileName, Class<?> clazz, List<?> data, HttpServletResponse response) {
setHeader(fileName, response);
try {
FastExcel.write(response.getOutputStream(), clazz).sheet("sheet1").doWrite(data);
} catch (Exception e) {
log.error(">>> excel导出异常:", e);
}
}
public static void exportExcel(String fileName, List<List<String>> head, List<?> data, HttpServletResponse response) {
setHeader(fileName, response);
try {
FastExcel.write(response.getOutputStream())
// 这里放入动态头
.head(head).sheet("sheet1")
// 当然这里数据也可以用 List<List<String>> 去传入
.doWrite(data);
} catch (Exception e) {
log.error(">>> 动态表头excel导出异常:", e);
}
}
public static void setHeader(String fileName, HttpServletResponse response) {
response.setCharacterEncoding("utf-8");
response.setHeader("Content-Disposition", "attachment;filename=" + URLUtil.encode(fileName));
response.setHeader("Access-Control-Allow-Origin", "*");
response.setHeader("Access-Control-Expose-Headers", "Content-Disposition");
response.setContentType("application/octet-stream;charset=UTF-8");
try {
fileName = URLEncoder.encode(fileName, StandardCharsets.UTF_8).replaceAll("\\+", "%20");
} catch (Exception ignored) {
}
response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx");
}
public static String getRangeByCel(int offset, int rowId, int rowCount) {
String columnLetter1 = CellReference.convertNumToColString(offset);
return String.format("$%s$%s:$%s$%s", columnLetter1, rowId, columnLetter1, rowId + rowCount - 1);
}
/**
* 把非(中文、英文、下划线、点)替换为 ascii码,因为excel不支持其他字符设置名称管理器
* 如:”审核订单(一级)(1)“ 替换为 ”审核订单.40.一级.41..40.1.41.“
*/
public static String replaceAscii(String str) {
if (StrUtil.isBlank(str)) {
return str;
}
StringBuilder sb = new StringBuilder();
for (String s : str.split("")) {
if (s.matches("[^\\d\\u4e00-\\u9fa5.a-zA-Z_]")) {
s = "." + (int) s.charAt(0) + ".";
}
sb.append(s);
}
return sb.toString();
}
}
@@ -0,0 +1,79 @@
package com.byhah.cloud.basic.core.util;
import cn.hutool.core.img.ImgUtil;
import cn.hutool.core.util.StrUtil;
import com.byhah.deploy.basic.core.exception.CommonException;
import com.byhah.deploy.basic.core.utils.Asserts;
import lombok.extern.slf4j.Slf4j;
import java.io.InputStream;
import java.io.RandomAccessFile;
import java.net.HttpURLConnection;
import java.net.URL;
import java.time.LocalDate;
@Slf4j
public class FileUtil {
private static final String TEMP_DIR = System.getProperty("user.dir") + "/upload/";
/**
* 根据文件后缀判断是否图片
*/
public static boolean isPic(String fileSuffix) {
fileSuffix = fileSuffix.toLowerCase();
return ImgUtil.IMAGE_TYPE_GIF.equals(fileSuffix)
|| ImgUtil.IMAGE_TYPE_JPG.equals(fileSuffix)
|| ImgUtil.IMAGE_TYPE_JPEG.equals(fileSuffix)
|| ImgUtil.IMAGE_TYPE_BMP.equals(fileSuffix)
|| ImgUtil.IMAGE_TYPE_PNG.equals(fileSuffix)
|| ImgUtil.IMAGE_TYPE_PSD.equals(fileSuffix);
}
/**
* 获取本地文件上传路径
*/
public static String getLocalUploadAddress() {
LocalDate now = LocalDate.now();
// 根据时间生成对应的文件夹
String path = TEMP_DIR + now.getYear() + "/" + now.getMonthValue() + "/" + now.getDayOfMonth() + "/";
if (!cn.hutool.core.io.FileUtil.exist(path)) {
cn.hutool.core.io.FileUtil.mkdir(path);
}
return path;
}
/**
* 获取分片字节信息
*/
public static byte[] getChunk(Integer index, Integer chunkSize, String resultFileName, long offset) {
try (RandomAccessFile randomAccessFile = new RandomAccessFile(resultFileName, "r")) {
// 定位到该分片的偏移量
randomAccessFile.seek(offset);
//读取
byte[] buffer = new byte[chunkSize];
randomAccessFile.read(buffer);
return buffer;
} catch (Exception e) {
log.error("获取分片信息失败", e);
throw new CommonException("获取分片信息失败");
}
}
/**
* 获取网络文件输入流
*/
public static InputStream getUrlInputStream(String fileUrl) {
try {
URL url = new URL(fileUrl);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
String message = connection.getHeaderField(0);
Asserts.isTrue(StrUtil.isNotEmpty(message), "文件信息错误");
Asserts.isFalse(message.startsWith("HTTP/1.1 404"), "文件下载失败");
return connection.getInputStream();
} catch (Exception e) {
log.error("获取文件失败, fileUrl: {}", fileUrl, e);
throw new CommonException("获取文件失败");
}
}
}
@@ -0,0 +1,139 @@
package com.byhah.cloud.basic.core.util;
import cn.hutool.core.util.StrUtil;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.format.DateTimeFormatter;
import java.util.Objects;
public class TimeUtil {
public static final DateTimeFormatter DF1 = DateTimeFormatter.ofPattern("yyyy-MM-dd");
public static final DateTimeFormatter DF2 = DateTimeFormatter.ofPattern("yyyy/MM/dd");
public static final DateTimeFormatter DF3 = DateTimeFormatter.ofPattern("yyyy年MM月dd日");
public static final DateTimeFormatter DT_DF1 = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
public static final DateTimeFormatter DT_DF2 = DateTimeFormatter.ofPattern("yyyy/MM/dd HH/mm/ss");
public static final DateTimeFormatter DT_DF3 = DateTimeFormatter.ofPattern("yyyy年MM月dd日HH时mm分ss秒");
public static final DateTimeFormatter DT_DF4 = DateTimeFormatter.ofPattern("yyyyMMddHHmmss");
public static final DateTimeFormatter T_DF1 = DateTimeFormatter.ofPattern("HH:mm:ss");
public static boolean betweenDateRange(LocalDate from, LocalDate to, LocalDate date) {
return !(date.isBefore(from) || date.isAfter(to));
}
public static boolean betweenTimeRange(LocalTime from, LocalTime to, LocalTime time) {
return !(time.isBefore(from) || time.isAfter(to));
}
/**
* 判断两组时间是否相交
*
* @return 是否
*/
public static boolean isCross(LocalDate begin1, LocalDate end1, LocalDate begin2, LocalDate end2) {
return isBetween(begin1, begin2, end2) || isBetween(end1, begin2, end2) || isBetween(begin2, begin1, end1) || isBetween(end2, begin1, end1);
}
public static boolean isCross(LocalDateTime begin1, LocalDateTime end1, LocalDateTime begin2, LocalDateTime end2) {
return isBetween(begin1, begin2, end2) || isBetween(end1, begin2, end2) || isBetween(begin2, begin1, end1) || isBetween(end2, begin1, end1);
}
public static boolean isCross(LocalTime begin1, LocalTime end1, LocalTime begin2, LocalTime end2) {
return isBetween(begin1, begin2, end2) || isBetween(end1, begin2, end2) || isBetween(begin2, begin1, end1) || isBetween(end2, begin1, end1);
}
public static boolean isBetween(LocalDate date, LocalDate begin, LocalDate end) {
return notAfter(begin, date) && notBefore(end, date);
}
public static boolean isBetween(LocalTime date, LocalTime begin, LocalTime end) {
return notAfter(begin, date) && notBefore(end, date);
}
public static boolean isBetween(LocalDateTime date, LocalDateTime begin, LocalDateTime end) {
return notAfter(begin, date) && notBefore(end, date);
}
public static boolean notAfter(LocalDate one, LocalDate two) {
return !one.isAfter(two);
}
public static boolean notBefore(LocalDate one, LocalDate two) {
return !one.isBefore(two);
}
public static boolean notAfter(LocalTime one, LocalTime two) {
return !one.isAfter(two);
}
public static boolean notBefore(LocalTime one, LocalTime two) {
return !one.isBefore(two);
}
public static boolean notAfter(LocalDateTime one, LocalDateTime two) {
return !one.isAfter(two);
}
public static boolean notBefore(LocalDateTime one, LocalDateTime two) {
return !one.isBefore(two);
}
public static LocalDate parseDate(String date) {
if (StrUtil.isNotBlank(date)) {
try {
if (date.contains("")) {
return LocalDate.parse(date, DF3);
} else if (date.contains("/")) {
return LocalDate.parse(date, DF2);
} else {
return LocalDate.parse(date, DF1);
}
} catch (Exception e) {
}
}
return null;
}
public static LocalDateTime parseDateTime(String date) {
if (StrUtil.isNotBlank(date)) {
try {
if (date.contains("")) {
return LocalDateTime.parse(date, DT_DF3);
} else if (date.contains("/")) {
return LocalDateTime.parse(date, DT_DF2);
} else {
return LocalDateTime.parse(date, DT_DF1);
}
} catch (Exception e) {
}
}
return null;
}
public static String formatDateTime(LocalDateTime time) {
if (Objects.nonNull(time)) {
return time.format(DT_DF1);
}
return null;
}
public static String formatDateTimeNoSymbol(LocalDateTime time) {
if (Objects.nonNull(time)) {
return time.format(DT_DF4);
}
return null;
}
public static String formatTime(LocalTime time) {
if (Objects.nonNull(time)) {
return time.format(T_DF1);
}
return null;
}
}