Skip to content

Commit

Permalink
✨ 全局:简化 file 组件,融合到 infra 模块
Browse files Browse the repository at this point in the history
  • Loading branch information
YunaiV committed Feb 28, 2024
1 parent 5edcfb9 commit 6a53dc9
Show file tree
Hide file tree
Showing 12 changed files with 32 additions and 16 deletions.
2 changes: 1 addition & 1 deletion yudao-module-crm/yudao-module-crm-biz/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## AdoptOpenJDK 停止发布 OpenJDK 二进制,而 Eclipse Temurin 是它的延伸,提供更好的稳定性
## 感谢复旦核博士的建议!灰子哥,牛皮!
FROM eclipse-temurin:21-jre
FROM eclipse-temurin:8-jre

## 创建目录,并使用它作为工作目录
RUN mkdir -p /yudao-module-crm-biz
Expand Down
2 changes: 1 addition & 1 deletion yudao-module-erp/yudao-module-erp-biz/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## AdoptOpenJDK 停止发布 OpenJDK 二进制,而 Eclipse Temurin 是它的延伸,提供更好的稳定性
## 感谢复旦核博士的建议!灰子哥,牛皮!
FROM eclipse-temurin:21-jre
FROM eclipse-temurin:8-jre

## 创建目录,并使用它作为工作目录
RUN mkdir -p /yudao-module-erp-biz
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public static class FileClientConfigTypeHandler extends AbstractJsonTypeHandler<

@Override
protected Object parse(String json) {
FileClientConfig config = JsonUtils.parseObjectQuietly(json, new TypeReference<>() {});
FileClientConfig config = JsonUtils.parseObjectQuietly(json, new TypeReference<FileClientConfig>() {});
if (config != null) {
return config;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
package cn.iocoder.yudao.module.infra.framework.file.core.client.db;

import cn.iocoder.yudao.module.infra.framework.file.core.client.FileClientConfig;
import jakarta.validation.constraints.NotEmpty;
import lombok.Data;
import org.hibernate.validator.constraints.URL;

import javax.validation.constraints.NotEmpty;

/**
* 基于 DB 存储的文件客户端的配置类
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package cn.iocoder.yudao.module.infra.framework.file.core.client.ftp;

import cn.iocoder.yudao.module.infra.framework.file.core.client.FileClientConfig;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import org.hibernate.validator.constraints.URL;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;

/**
* Ftp 文件客户端的配置类
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
package cn.iocoder.yudao.module.infra.framework.file.core.client.local;

import cn.iocoder.yudao.module.infra.framework.file.core.client.FileClientConfig;
import jakarta.validation.constraints.NotEmpty;
import lombok.Data;
import org.hibernate.validator.constraints.URL;

import javax.validation.constraints.NotEmpty;

/**
* 本地文件客户端的配置类
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
import cn.hutool.core.util.StrUtil;
import cn.iocoder.yudao.module.infra.framework.file.core.client.FileClientConfig;
import com.fasterxml.jackson.annotation.JsonIgnore;
import jakarta.validation.constraints.AssertTrue;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import org.hibernate.validator.constraints.URL;

import javax.validation.constraints.AssertTrue;
import javax.validation.constraints.NotNull;

/**
* S3 文件客户端的配置类
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package cn.iocoder.yudao.module.infra.framework.file.core.client.sftp;

import cn.iocoder.yudao.module.infra.framework.file.core.client.FileClientConfig;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import org.hibernate.validator.constraints.URL;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;

/**
* Sftp 文件客户端的配置类
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
import cn.iocoder.yudao.module.infra.dal.dataobject.file.FileConfigDO;

import cn.iocoder.yudao.module.infra.framework.file.core.client.FileClient;
import jakarta.validation.Valid;

import javax.validation.Valid;

/**
* 文件配置 Service 接口
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@
import cn.iocoder.yudao.module.infra.framework.file.core.client.FileClient;
import cn.iocoder.yudao.module.infra.framework.file.core.client.s3.FilePresignedUrlRespDTO;
import cn.iocoder.yudao.module.infra.framework.file.core.utils.FileTypeUtils;
import jakarta.annotation.Resource;
import lombok.SneakyThrows;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants.FILE_NOT_EXISTS;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@
import cn.iocoder.yudao.framework.common.util.validation.ValidationUtils;
import cn.iocoder.yudao.module.infra.framework.file.core.client.s3.S3FileClient;
import cn.iocoder.yudao.module.infra.framework.file.core.client.s3.S3FileClientConfig;
import jakarta.validation.Validation;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;

import javax.validation.Validation;

public class S3FileClientTest {

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import javax.validation.Validator;

import static cn.hutool.core.util.RandomUtil.randomEle;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals;
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertServiceException;
import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomPojo;
Expand Down Expand Up @@ -208,8 +209,15 @@ public void testSendSmsCode() {
public void testSmsLogin_success() {
// 准备参数
String mobile = randomString();
String scene = randomString();
AuthSmsLoginReqVO reqVO = new AuthSmsLoginReqVO(mobile, scene);
String code = randomString();
AuthSmsLoginReqVO reqVO = new AuthSmsLoginReqVO(mobile, code);
// mock 方法(校验验证码)
when(smsCodeApi.useSmsCode(argThat(reqDTO -> {
assertEquals(mobile, reqDTO.getMobile());
assertEquals(code, reqDTO.getCode());
assertEquals(SmsSceneEnum.ADMIN_MEMBER_LOGIN.getScene(), reqDTO.getScene());
return true;
}))).thenReturn(success(true));
// mock 方法(用户信息)
AdminUserDO user = randomPojo(AdminUserDO.class, o -> o.setId(1L));
when(userService.getUserByMobile(eq(mobile))).thenReturn(user);
Expand Down

0 comments on commit 6a53dc9

Please sign in to comment.