diff --git a/.flattened-pom.xml b/.flattened-pom.xml index 1e7cd9b..ffd8b46 100644 --- a/.flattened-pom.xml +++ b/.flattened-pom.xml @@ -51,11 +51,6 @@ wms-plugin-schedule 3.6.0-SNAPSHOT - - top.wms - wms-plugin-open - 3.6.0-SNAPSHOT - top.wms wms-plugin-generator diff --git a/pom.xml b/pom.xml index 08e5b86..84151b5 100644 --- a/pom.xml +++ b/pom.xml @@ -67,13 +67,6 @@ ${revision} - - - top.wms - wms-plugin-open - ${revision} - - top.wms diff --git a/wms-plugin/.flattened-pom.xml b/wms-plugin/.flattened-pom.xml index 0fe3e21..0a79a48 100644 --- a/wms-plugin/.flattened-pom.xml +++ b/wms-plugin/.flattened-pom.xml @@ -17,11 +17,6 @@ http://www.gnu.org/licenses/lgpl.html - - wms-plugin-schedule - wms-plugin-open - wms-plugin-generator - top.wms diff --git a/wms-plugin/pom.xml b/wms-plugin/pom.xml index fff380a..71bd423 100644 --- a/wms-plugin/pom.xml +++ b/wms-plugin/pom.xml @@ -13,12 +13,6 @@ pom 插件模块(存放代码生成、任务调度等扩展模块) - - wms-plugin-schedule - wms-plugin-open - wms-plugin-generator - - diff --git a/wms-plugin/wms-plugin-open/.flattened-pom.xml b/wms-plugin/wms-plugin-open/.flattened-pom.xml deleted file mode 100644 index b076a55..0000000 --- a/wms-plugin/wms-plugin-open/.flattened-pom.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - 4.0.0 - - top.wms - wms-plugin - 3.6.0-SNAPSHOT - - wms-plugin-open - 3.6.0-SNAPSHOT - 能力开放插件(包括应用管理、API开放授权、API开发等) - - - GNU LESSER GENERAL PUBLIC LICENSE - http://www.gnu.org/licenses/lgpl.html - - - diff --git a/wms-plugin/wms-plugin-open/pom.xml b/wms-plugin/wms-plugin-open/pom.xml deleted file mode 100644 index 9a238d6..0000000 --- a/wms-plugin/wms-plugin-open/pom.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - 4.0.0 - - top.wms - wms-plugin - ${revision} - - - wms-plugin-open - 能力开放插件(包括应用管理、API开放授权、API开发等) - \ No newline at end of file diff --git a/wms-plugin/wms-plugin-open/src/main/java/top/wms/admin/open/handler/SaCheckPermissionHandler.java b/wms-plugin/wms-plugin-open/src/main/java/top/wms/admin/open/handler/SaCheckPermissionHandler.java deleted file mode 100644 index d356166..0000000 --- a/wms-plugin/wms-plugin-open/src/main/java/top/wms/admin/open/handler/SaCheckPermissionHandler.java +++ /dev/null @@ -1,32 +0,0 @@ -package top.wms.admin.open.handler; - -import cn.dev33.satoken.annotation.SaCheckPermission; -import cn.dev33.satoken.annotation.handler.SaAnnotationHandlerInterface; -import org.springframework.stereotype.Component; -import top.wms.admin.open.util.OpenApiUtils; - -import java.lang.reflect.Method; - -import static cn.dev33.satoken.annotation.handler.SaCheckPermissionHandler._checkMethod; - -/** - * 重定义注解 SaCheckPermission 的处理器 - * - * @author chengzi - * @since 2024/10/25 12:03 - */ -@Component -public class SaCheckPermissionHandler implements SaAnnotationHandlerInterface { - - @Override - public Class getHandlerAnnotationClass() { - return SaCheckPermission.class; - } - - @Override - public void checkMethod(SaCheckPermission at, Method method) { - if (!OpenApiUtils.isSignParamExists()) { - _checkMethod(at.type(), at.value(), at.mode(), at.orRole()); - } - } -} diff --git a/wms-plugin/wms-plugin-open/src/main/java/top/wms/admin/open/mapper/AppMapper.java b/wms-plugin/wms-plugin-open/src/main/java/top/wms/admin/open/mapper/AppMapper.java deleted file mode 100644 index 461d715..0000000 --- a/wms-plugin/wms-plugin-open/src/main/java/top/wms/admin/open/mapper/AppMapper.java +++ /dev/null @@ -1,25 +0,0 @@ -package top.wms.admin.open.mapper; - -import org.apache.ibatis.annotations.Param; -import org.apache.ibatis.annotations.Select; -import top.wms.admin.open.model.entity.AppDO; -import top.continew.starter.data.mp.base.BaseMapper; -import top.continew.starter.security.crypto.annotation.FieldEncrypt; - -/** - * 应用 Mapper - * - * @author chengzi - * @since 2024/10/17 16:03 - */ -public interface AppMapper extends BaseMapper { - - /** - * 根据 Access Key 查询 - * - * @param accessKey Access Key - * @return 应用信息 - */ - @Select("select * from sys_app where access_key = #{accessKey}") - AppDO selectByAccessKey(@FieldEncrypt @Param("accessKey") String accessKey); -} \ No newline at end of file diff --git a/wms-plugin/wms-plugin-open/src/main/java/top/wms/admin/open/model/entity/AppDO.java b/wms-plugin/wms-plugin-open/src/main/java/top/wms/admin/open/model/entity/AppDO.java deleted file mode 100644 index a55b9a3..0000000 --- a/wms-plugin/wms-plugin-open/src/main/java/top/wms/admin/open/model/entity/AppDO.java +++ /dev/null @@ -1,69 +0,0 @@ -package top.wms.admin.open.model.entity; - -import com.baomidou.mybatisplus.annotation.TableName; -import lombok.Data; -import top.wms.admin.common.enums.DisEnableStatusEnum; -import top.wms.admin.common.model.entity.BaseDO; -import top.continew.starter.security.crypto.annotation.FieldEncrypt; - -import java.io.Serial; -import java.time.LocalDateTime; - -/** - * 应用实体 - * - * @author chengzi - * @author Charles7c - * @since 2024/10/17 16:03 - */ -@Data -@TableName("sys_app") -public class AppDO extends BaseDO { - - @Serial - private static final long serialVersionUID = 1L; - - /** - * 名称 - */ - private String name; - - /** - * Access Key(访问密钥) - */ - @FieldEncrypt - private String accessKey; - - /** - * Secret Key(私有密钥) - */ - @FieldEncrypt - private String secretKey; - - /** - * 失效时间 - */ - private LocalDateTime expireTime; - - /** - * 描述 - */ - private String description; - - /** - * 状态 - */ - private DisEnableStatusEnum status; - - /** - * 是否已过期 - * - * @return true:已过期;false:未过期 - */ - public boolean isExpired() { - if (expireTime == null) { - return false; - } - return LocalDateTime.now().isAfter(expireTime); - } -} \ No newline at end of file diff --git a/wms-plugin/wms-plugin-open/src/main/java/top/wms/admin/open/model/query/AppQuery.java b/wms-plugin/wms-plugin-open/src/main/java/top/wms/admin/open/model/query/AppQuery.java deleted file mode 100644 index bc766c5..0000000 --- a/wms-plugin/wms-plugin-open/src/main/java/top/wms/admin/open/model/query/AppQuery.java +++ /dev/null @@ -1,31 +0,0 @@ -package top.wms.admin.open.model.query; - -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import top.continew.starter.data.core.annotation.Query; -import top.continew.starter.data.core.enums.QueryType; - -import java.io.Serial; -import java.io.Serializable; - -/** - * 应用查询条件 - * - * @author chengzi - * @author Charles7c - * @since 2024/10/17 16:03 - */ -@Data -@Schema(description = "应用查询条件") -public class AppQuery implements Serializable { - - @Serial - private static final long serialVersionUID = 1L; - - /** - * 关键词 - */ - @Schema(description = "关键词", example = "应用1") - @Query(columns = {"name", "description"}, type = QueryType.LIKE) - private String description; -} \ No newline at end of file diff --git a/wms-plugin/wms-plugin-open/src/main/java/top/wms/admin/open/model/req/AppReq.java b/wms-plugin/wms-plugin-open/src/main/java/top/wms/admin/open/model/req/AppReq.java deleted file mode 100644 index 2dcac6e..0000000 --- a/wms-plugin/wms-plugin-open/src/main/java/top/wms/admin/open/model/req/AppReq.java +++ /dev/null @@ -1,67 +0,0 @@ -package top.wms.admin.open.model.req; - -import io.swagger.v3.oas.annotations.media.Schema; -import jakarta.validation.constraints.Future; -import jakarta.validation.constraints.NotBlank; -import lombok.Data; -import org.hibernate.validator.constraints.Length; -import top.wms.admin.common.enums.DisEnableStatusEnum; - -import java.io.Serial; -import java.io.Serializable; -import java.time.LocalDateTime; - -/** - * 创建或修改应用参数 - * - * @author chengzi - * @author Charles7c - * @since 2024/10/17 16:03 - */ -@Data -@Schema(description = "创建或修改应用参数") -public class AppReq implements Serializable { - - @Serial - private static final long serialVersionUID = 1L; - - /** - * 名称 - */ - @Schema(description = "名称", example = "应用1") - @NotBlank(message = "名称不能为空") - @Length(max = 100, message = "名称长度不能超过 {max} 个字符") - private String name; - - /** - * 失效时间 - */ - @Schema(description = "失效时间", example = "2023-08-08 23:59:59", type = "string") - @Future(message = "失效时间必须是未来时间") - private LocalDateTime expireTime; - - /** - * 描述 - */ - @Schema(description = "描述", example = "应用1描述信息") - @Length(max = 200, message = "描述长度不能超过 {max} 个字符") - private String description; - - /** - * 状态 - */ - @Schema(description = "状态", example = "1") - private DisEnableStatusEnum status; - - /** - * Access Key(访问密钥) - */ - @Schema(hidden = true) - private String accessKey; - - /** - * Secret Key(密钥) - */ - @Schema(hidden = true) - private String secretKey; -} \ No newline at end of file diff --git a/wms-plugin/wms-plugin-open/src/main/java/top/wms/admin/open/model/resp/AppDetailResp.java b/wms-plugin/wms-plugin-open/src/main/java/top/wms/admin/open/model/resp/AppDetailResp.java deleted file mode 100644 index 19b8f0a..0000000 --- a/wms-plugin/wms-plugin-open/src/main/java/top/wms/admin/open/model/resp/AppDetailResp.java +++ /dev/null @@ -1,63 +0,0 @@ -package top.wms.admin.open.model.resp; - -import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; -import com.alibaba.excel.annotation.ExcelProperty; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import top.wms.admin.common.model.resp.BaseDetailResp; -import top.wms.admin.common.enums.DisEnableStatusEnum; -import top.continew.starter.file.excel.converter.ExcelBaseEnumConverter; - -import java.io.Serial; -import java.time.LocalDateTime; - -/** - * 应用详情信息 - * - * @author chengzi - * @author Charles7c - * @since 2024/10/17 16:03 - */ -@Data -@ExcelIgnoreUnannotated -@Schema(description = "应用详情信息") -public class AppDetailResp extends BaseDetailResp { - - @Serial - private static final long serialVersionUID = 1L; - - /** - * 名称 - */ - @Schema(description = "名称", example = "应用1") - @ExcelProperty(value = "名称", order = 2) - private String name; - - /** - * Access Key(访问密钥) - */ - @Schema(description = "Access Key(访问密钥)", example = "YjUyMGJjYjIxNTE0NDAxMWE1NmRiY2") - @ExcelProperty(value = "Access Key", order = 3) - private String accessKey; - - /** - * 失效时间 - */ - @Schema(description = "失效时间", example = "2023-08-08 08:08:08", type = "string") - @ExcelProperty(value = "失效时间", order = 4) - private LocalDateTime expireTime; - - /** - * 状态 - */ - @Schema(description = "状态", example = "1") - @ExcelProperty(value = "状态", converter = ExcelBaseEnumConverter.class, order = 5) - private DisEnableStatusEnum status; - - /** - * 描述 - */ - @Schema(description = "描述", example = "应用1描述信息") - @ExcelProperty(value = "描述", order = 6) - private String description; -} \ No newline at end of file diff --git a/wms-plugin/wms-plugin-open/src/main/java/top/wms/admin/open/model/resp/AppResp.java b/wms-plugin/wms-plugin-open/src/main/java/top/wms/admin/open/model/resp/AppResp.java deleted file mode 100644 index d1cfe4c..0000000 --- a/wms-plugin/wms-plugin-open/src/main/java/top/wms/admin/open/model/resp/AppResp.java +++ /dev/null @@ -1,54 +0,0 @@ -package top.wms.admin.open.model.resp; - -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import top.wms.admin.common.model.resp.BaseDetailResp; -import top.wms.admin.common.enums.DisEnableStatusEnum; - -import java.io.Serial; -import java.time.LocalDateTime; - -/** - * 应用信息 - * - * @author chengzi - * @author Charles7c - * @since 2024/10/17 16:03 - */ -@Data -@Schema(description = "应用信息") -public class AppResp extends BaseDetailResp { - - @Serial - private static final long serialVersionUID = 1L; - - /** - * 名称 - */ - @Schema(description = "名称", example = "应用1") - private String name; - - /** - * Access Key(访问密钥) - */ - @Schema(description = "Access Key(访问密钥)", example = "YjUyMGJjYjIxNTE0NDAxMWE1NmRiY2") - private String accessKey; - - /** - * 失效时间 - */ - @Schema(description = "失效时间", example = "2023-08-08 08:08:08", type = "string") - private LocalDateTime expireTime; - - /** - * 状态 - */ - @Schema(description = "状态", example = "1") - private DisEnableStatusEnum status; - - /** - * 描述 - */ - @Schema(description = "描述", example = "应用1描述信息") - private String description; -} \ No newline at end of file diff --git a/wms-plugin/wms-plugin-open/src/main/java/top/wms/admin/open/model/resp/AppSecretResp.java b/wms-plugin/wms-plugin-open/src/main/java/top/wms/admin/open/model/resp/AppSecretResp.java deleted file mode 100644 index 2a81fa7..0000000 --- a/wms-plugin/wms-plugin-open/src/main/java/top/wms/admin/open/model/resp/AppSecretResp.java +++ /dev/null @@ -1,34 +0,0 @@ -package top.wms.admin.open.model.resp; - -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; - -import java.io.Serial; -import java.io.Serializable; - -/** - * 应用密钥信息 - * - * @author chengzi - * @author Charles7c - * @since 2024/10/17 16:03 - */ -@Data -@Schema(description = "应用密钥信息") -public class AppSecretResp implements Serializable { - - @Serial - private static final long serialVersionUID = 1L; - - /** - * Access Key(访问密钥) - */ - @Schema(description = "Access Key(访问密钥)", example = "YjUyMGJjYjIxNTE0NDAxMWE1NmRiY2") - private String accessKey; - - /** - * Secret Key(私有密钥) - */ - @Schema(description = "Secret Key(私有密钥)", example = "MDI2YzQ3YTU1NGEyNDM1ZWIwNTU5NmNjNmZjM2M2Nzg=") - private String secretKey; -} diff --git a/wms-plugin/wms-plugin-open/src/main/java/top/wms/admin/open/service/AppService.java b/wms-plugin/wms-plugin-open/src/main/java/top/wms/admin/open/service/AppService.java deleted file mode 100644 index bb8cf75..0000000 --- a/wms-plugin/wms-plugin-open/src/main/java/top/wms/admin/open/service/AppService.java +++ /dev/null @@ -1,42 +0,0 @@ -package top.wms.admin.open.service; - -import top.wms.admin.open.model.entity.AppDO; -import top.wms.admin.open.model.query.AppQuery; -import top.wms.admin.open.model.req.AppReq; -import top.wms.admin.open.model.resp.AppDetailResp; -import top.wms.admin.open.model.resp.AppResp; -import top.wms.admin.open.model.resp.AppSecretResp; -import top.continew.starter.extension.crud.service.BaseService; - -/** - * 应用业务接口 - * - * @author chengzi - * @author Charles7c - * @since 2024/10/17 16:03 - */ -public interface AppService extends BaseService { - - /** - * 获取密钥 - * - * @param id ID - * @return 密钥信息 - */ - AppSecretResp getSecret(Long id); - - /** - * 重置密钥 - * - * @param id ID - */ - void resetSecret(Long id); - - /** - * 根据 Access Key 查询 - * - * @param accessKey Access Key - * @return 应用信息 - */ - AppDO getByAccessKey(String accessKey); -} \ No newline at end of file diff --git a/wms-plugin/wms-plugin-open/src/main/java/top/wms/admin/open/service/impl/AppServiceImpl.java b/wms-plugin/wms-plugin-open/src/main/java/top/wms/admin/open/service/impl/AppServiceImpl.java deleted file mode 100644 index 6b17748..0000000 --- a/wms-plugin/wms-plugin-open/src/main/java/top/wms/admin/open/service/impl/AppServiceImpl.java +++ /dev/null @@ -1,71 +0,0 @@ -package top.wms.admin.open.service.impl; - -import cn.hutool.core.codec.Base64; -import cn.hutool.core.util.IdUtil; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import lombok.RequiredArgsConstructor; -import org.springframework.stereotype.Service; -import top.wms.admin.open.mapper.AppMapper; -import top.wms.admin.open.model.entity.AppDO; -import top.wms.admin.open.model.query.AppQuery; -import top.wms.admin.open.model.req.AppReq; -import top.wms.admin.open.model.resp.AppDetailResp; -import top.wms.admin.open.model.resp.AppResp; -import top.wms.admin.open.model.resp.AppSecretResp; -import top.wms.admin.open.service.AppService; -import top.continew.starter.core.constant.StringConstants; -import top.continew.starter.extension.crud.service.BaseServiceImpl; - -/** - * 应用业务实现 - * - * @author chengzi - * @author Charles7c - * @since 2024/10/17 16:03 - */ -@Service -@RequiredArgsConstructor -public class AppServiceImpl extends BaseServiceImpl implements AppService { - - @Override - public void beforeAdd(AppReq req) { - req.setAccessKey(Base64.encode(IdUtil.fastSimpleUUID()) - .replace(StringConstants.SLASH, StringConstants.EMPTY) - .replace(StringConstants.PLUS, StringConstants.EMPTY) - .substring(0, 30)); - req.setSecretKey(this.generateSecret()); - } - - @Override - public AppSecretResp getSecret(Long id) { - AppDO app = super.getById(id); - AppSecretResp appSecretResp = new AppSecretResp(); - appSecretResp.setAccessKey(app.getAccessKey()); - appSecretResp.setSecretKey(app.getSecretKey()); - return appSecretResp; - } - - @Override - public void resetSecret(Long id) { - super.getById(id); - AppDO app = new AppDO(); - app.setSecretKey(this.generateSecret()); - baseMapper.update(app, Wrappers.lambdaQuery(AppDO.class).eq(AppDO::getId, id)); - } - - @Override - public AppDO getByAccessKey(String accessKey) { - return baseMapper.selectByAccessKey(accessKey); - } - - /** - * 生成密钥 - * - * @return 密钥 - */ - private String generateSecret() { - return Base64.encode(IdUtil.fastSimpleUUID()) - .replace(StringConstants.SLASH, StringConstants.EMPTY) - .replace(StringConstants.PLUS, StringConstants.EMPTY); - } -} \ No newline at end of file diff --git a/wms-plugin/wms-plugin-open/src/main/java/top/wms/admin/open/sign/OpenApiSignTemplate.java b/wms-plugin/wms-plugin-open/src/main/java/top/wms/admin/open/sign/OpenApiSignTemplate.java deleted file mode 100644 index 112a206..0000000 --- a/wms-plugin/wms-plugin-open/src/main/java/top/wms/admin/open/sign/OpenApiSignTemplate.java +++ /dev/null @@ -1,60 +0,0 @@ -package top.wms.admin.open.sign; - -import cn.dev33.satoken.sign.SaSignTemplate; -import lombok.RequiredArgsConstructor; -import org.springframework.stereotype.Component; -import top.wms.admin.common.enums.DisEnableStatusEnum; -import top.wms.admin.open.model.entity.AppDO; -import top.wms.admin.open.service.AppService; -import top.continew.starter.core.validation.ValidationUtils; - -import java.util.Map; - -/** - * API 参数签名算法 - * - * @author chengzi - * @author Charles7c - * @since 2024/10/17 16:03 - */ -@Component -@RequiredArgsConstructor -public class OpenApiSignTemplate extends SaSignTemplate { - - private final AppService appService; - public static final String ACCESS_KEY = "accessKey"; - - @Override - public void checkParamMap(Map paramMap) { - // 获取必须的参数 - String timestampValue = paramMap.get(timestamp); - String nonceValue = paramMap.get(nonce); - String signValue = paramMap.get(sign); - String accessKeyValue = paramMap.get(ACCESS_KEY); - - // 校验 - ValidationUtils.throwIfBlank(timestampValue, "timestamp不能为空"); - ValidationUtils.throwIfBlank(nonceValue, "nonce不能为空"); - ValidationUtils.throwIfBlank(signValue, "sign不能为空"); - ValidationUtils.throwIfBlank(accessKeyValue, "accessKey不能为空"); - AppDO app = appService.getByAccessKey(accessKeyValue); - ValidationUtils.throwIfNull(app, "accessKey非法"); - ValidationUtils.throwIfEqual(DisEnableStatusEnum.DISABLE, app.getStatus(), "应用已被禁用, 请联系管理员"); - ValidationUtils.throwIf(app.isExpired(), "应用已过期, 请联系管理员"); - - // 依次校验三个参数 - super.checkTimestamp(Long.parseLong(timestampValue)); - super.checkNonce(nonceValue); - paramMap.put(key, app.getSecretKey()); - super.checkSign(paramMap, signValue); - } - - @Override - public String createSign(Map paramMap) { - ValidationUtils.throwIfEmpty(paramMap.get(key), "秘钥缺失, 请检查应用配置"); - // 移除 sign 参数 - paramMap.remove(sign); - // 计算签名 - return super.abstractStr(super.joinParamsDictSort(paramMap)); - } -} diff --git a/wms-plugin/wms-plugin-open/src/main/java/top/wms/admin/open/util/OpenApiUtils.java b/wms-plugin/wms-plugin-open/src/main/java/top/wms/admin/open/util/OpenApiUtils.java deleted file mode 100644 index 48020f4..0000000 --- a/wms-plugin/wms-plugin-open/src/main/java/top/wms/admin/open/util/OpenApiUtils.java +++ /dev/null @@ -1,31 +0,0 @@ -package top.wms.admin.open.util; - -import cn.dev33.satoken.context.SaHolder; -import cn.dev33.satoken.context.model.SaRequest; -import cn.dev33.satoken.sign.SaSignTemplate; - -import java.util.List; - -/** - * Open Api 工具类 - * - * @author chengzi - * @author Charles7c - * @since 2024/10/25 15:31 - */ -public class OpenApiUtils { - - private OpenApiUtils() { - } - - /** - * 判断请求是否包含sign参数 - * - * @return 是否包含sign参数(true:包含;false:不包含) - */ - public static boolean isSignParamExists() { - SaRequest saRequest = SaHolder.getRequest(); - List paramNames = saRequest.getParamNames(); - return paramNames.stream().anyMatch(SaSignTemplate.sign::equals); - } -} diff --git a/wms-webapi/.flattened-pom.xml b/wms-webapi/.flattened-pom.xml index 2b384a5..efc6982 100644 --- a/wms-webapi/.flattened-pom.xml +++ b/wms-webapi/.flattened-pom.xml @@ -35,10 +35,6 @@ top.wms wms-plugin-schedule - - top.wms - wms-plugin-open - top.wms wms-plugin-generator diff --git a/wms-webapi/pom.xml b/wms-webapi/pom.xml index 175d873..68ce21f 100644 --- a/wms-webapi/pom.xml +++ b/wms-webapi/pom.xml @@ -43,12 +43,6 @@ wms-plugin-schedule - - - top.wms - wms-plugin-open - - top.wms diff --git a/wms-webapi/src/main/java/top/wms/admin/config/satoken/SaTokenConfiguration.java b/wms-webapi/src/main/java/top/wms/admin/config/satoken/SaTokenConfiguration.java index e7eed65..c2b1268 100644 --- a/wms-webapi/src/main/java/top/wms/admin/config/satoken/SaTokenConfiguration.java +++ b/wms-webapi/src/main/java/top/wms/admin/config/satoken/SaTokenConfiguration.java @@ -14,7 +14,6 @@ import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import top.wms.admin.common.context.UserContext; import top.wms.admin.common.context.UserContextHolder; -import top.wms.admin.open.sign.OpenApiSignTemplate; import top.continew.starter.auth.satoken.autoconfigure.SaTokenExtensionProperties; import top.continew.starter.core.constant.StringConstants; import top.continew.starter.core.exception.BusinessException; @@ -35,7 +34,6 @@ public class SaTokenConfiguration { private final SaTokenExtensionProperties properties; private final LoginPasswordProperties loginPasswordProperties; - private final OpenApiSignTemplate signTemplate; /** * Sa-Token 权限认证配置 @@ -50,7 +48,6 @@ public class SaTokenConfiguration { */ @Bean public SaInterceptor saInterceptor() { - SaManager.setSaSignTemplate(signTemplate); return new SaExtensionInterceptor(handle -> SaRouter.match(StringConstants.PATH_PATTERN) .notMatch(properties.getSecurity().getExcludes()) .check(r -> { diff --git a/wms-webapi/src/main/java/top/wms/admin/controller/open/AppController.java b/wms-webapi/src/main/java/top/wms/admin/controller/open/AppController.java deleted file mode 100644 index 100b8e5..0000000 --- a/wms-webapi/src/main/java/top/wms/admin/controller/open/AppController.java +++ /dev/null @@ -1,51 +0,0 @@ -package top.wms.admin.controller.open; - -import cn.dev33.satoken.annotation.SaCheckPermission; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.Parameter; -import io.swagger.v3.oas.annotations.enums.ParameterIn; -import io.swagger.v3.oas.annotations.tags.Tag; -import lombok.RequiredArgsConstructor; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PatchMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RestController; -import top.wms.admin.common.controller.BaseController; -import top.wms.admin.open.model.query.AppQuery; -import top.wms.admin.open.model.req.AppReq; -import top.wms.admin.open.model.resp.AppDetailResp; -import top.wms.admin.open.model.resp.AppResp; -import top.wms.admin.open.model.resp.AppSecretResp; -import top.wms.admin.open.service.AppService; -import top.continew.starter.extension.crud.annotation.CrudRequestMapping; -import top.continew.starter.extension.crud.enums.Api; - -/** - * 应用管理 API - * - * @author chengzi - * @author Charles7c - * @since 2024/10/17 16:03 - */ -@Tag(name = "应用管理 API") -@RestController -@RequiredArgsConstructor -@CrudRequestMapping(value = "/open/app", api = {Api.PAGE, Api.DETAIL, Api.ADD, Api.UPDATE, Api.DELETE, Api.EXPORT}) -public class AppController extends BaseController { - - @Operation(summary = "获取密钥", description = "获取应用密钥") - @Parameter(name = "id", description = "ID", example = "1", in = ParameterIn.PATH) - @SaCheckPermission("open:app:secret") - @GetMapping("/{id}/secret") - public AppSecretResp getSecret(@PathVariable Long id) { - return baseService.getSecret(id); - } - - @Operation(summary = "重置密钥", description = "重置应用密钥") - @Parameter(name = "id", description = "ID", example = "1", in = ParameterIn.PATH) - @SaCheckPermission("open:app:resetSecret") - @PatchMapping("/{id}/secret") - public void resetSecret(@PathVariable Long id) { - baseService.resetSecret(id); - } -} \ No newline at end of file diff --git a/wms-webapi/src/main/java/top/wms/admin/controller/schedule/DemoEnvironmentJob.java b/wms-webapi/src/main/java/top/wms/admin/controller/schedule/DemoEnvironmentJob.java index f46172a..ffdcea2 100644 --- a/wms-webapi/src/main/java/top/wms/admin/controller/schedule/DemoEnvironmentJob.java +++ b/wms-webapi/src/main/java/top/wms/admin/controller/schedule/DemoEnvironmentJob.java @@ -9,8 +9,6 @@ import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; import top.wms.admin.common.constant.CacheConstants; -import top.wms.admin.open.mapper.AppMapper; -import top.wms.admin.open.model.entity.AppDO; import top.wms.admin.system.mapper.*; import top.wms.admin.system.model.entity.*; import top.continew.starter.cache.redisson.util.RedisUtils; @@ -44,7 +42,6 @@ public class DemoEnvironmentJob { private final MenuMapper menuMapper; private final DeptMapper deptMapper; - private final AppMapper appMapper; private final ClientMapper clientsMapper; private static final Long DELETE_FLAG = 10000L; @@ -82,8 +79,6 @@ public class DemoEnvironmentJob { this.log(menuCount, "菜单"); Long deptCount = deptMapper.lambdaQuery().gt(DeptDO::getId, DEPT_FLAG).count(); this.log(deptCount, "部门"); - Long appCount = appMapper.lambdaQuery().gt(AppDO::getId, DELETE_FLAG).count(); - this.log(appCount, "应用"); Long clientCount = clientsMapper.lambdaQuery().gt(ClientDO::getId, DELETE_FLAG).count(); this.log(clientCount, "终端"); InterceptorIgnoreHelper.handle(IgnoreStrategy.builder().blockAttack(true).build()); @@ -117,7 +112,6 @@ public class DemoEnvironmentJob { .gt(MenuDO::getId, DELETE_FLAG) .remove()); this.clean(deptCount, "部门", null, () -> deptMapper.lambdaUpdate().gt(DeptDO::getId, DEPT_FLAG).remove()); - this.clean(appCount, "应用", null, () -> appMapper.lambdaUpdate().gt(AppDO::getId, DEPT_FLAG).remove()); this.clean(clientCount, "终端", null, () -> clientsMapper.lambdaUpdate() .gt(ClientDO::getId, DEPT_FLAG) .remove()); diff --git a/wms-webapi/src/main/resources/config/application-dev.yml b/wms-webapi/src/main/resources/config/application-dev.yml index 0fbb168..0b769ec 100644 --- a/wms-webapi/src/main/resources/config/application-dev.yml +++ b/wms-webapi/src/main/resources/config/application-dev.yml @@ -12,7 +12,7 @@ server: spring.datasource: type: com.zaxxer.hikari.HikariDataSource # 请务必提前创建好名为 wms_admin 的数据库,如果使用其他数据库名请注意同步修改 DB_NAME 配置 - url: jdbc:p6spy:mysql://127.0.0.1:3306/continew?serverTimezone=Asia/Shanghai&useSSL=true&useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&autoReconnect=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true + url: jdbc:p6spy:mysql://127.0.0.1:3306/wms?serverTimezone=Asia/Shanghai&useSSL=true&useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&autoReconnect=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true username: root password: root # PostgreSQL 配置