添加文件服务
This commit is contained in:
@@ -19,6 +19,7 @@
|
||||
<module>tashow-module-pay</module>
|
||||
<module>tashow-module-trade</module>
|
||||
<module>tashow-module-user</module>
|
||||
<module>tashow-module-file</module>
|
||||
</modules>
|
||||
|
||||
</project>
|
||||
|
||||
19
tashow-module/tashow-module-file/Dockerfile
Normal file
19
tashow-module/tashow-module-file/Dockerfile
Normal file
@@ -0,0 +1,19 @@
|
||||
## AdoptOpenJDK 停止发布 OpenJDK 二进制,而 Eclipse Temurin 是它的延伸,提供更好的稳定性
|
||||
## 感谢复旦核博士的建议!灰子哥,牛皮!
|
||||
FROM eclipse-temurin:21-jre
|
||||
|
||||
## 创建目录,并使用它作为工作目录
|
||||
RUN mkdir -p /yudao-module-member-biz
|
||||
WORKDIR /yudao-module-member-biz
|
||||
## 将后端项目的 Jar 文件,复制到镜像中
|
||||
COPY ./target/yudao-module-member-biz.jar app.jar
|
||||
|
||||
## 设置 TZ 时区
|
||||
## 设置 JAVA_OPTS 环境变量,可通过 docker run -e "JAVA_OPTS=" 进行覆盖
|
||||
ENV TZ=Asia/Shanghai JAVA_OPTS="-Xms512m -Xmx512m"
|
||||
|
||||
## 暴露后端项目的 48080 端口
|
||||
EXPOSE 48087
|
||||
|
||||
## 启动后端项目
|
||||
CMD java ${JAVA_OPTS} -Djava.security.egd=file:/dev/./urandom -jar app.jar
|
||||
111
tashow-module/tashow-module-file/pom.xml
Normal file
111
tashow-module/tashow-module-file/pom.xml
Normal file
@@ -0,0 +1,111 @@
|
||||
<?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">
|
||||
<parent>
|
||||
<groupId>com.tashow.cloud</groupId>
|
||||
<artifactId>tashow-module</artifactId>
|
||||
<version>${revision}</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>tashow-module-file</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>${project.artifactId}</name>
|
||||
<description>
|
||||
member 模块,我们放会员业务。
|
||||
例如说:会员中心等等
|
||||
</description>
|
||||
|
||||
<dependencies>
|
||||
<!-- Spring Cloud 基础 -->
|
||||
<dependency>
|
||||
<groupId>com.tashow.cloud</groupId>
|
||||
<artifactId>tashow-framework-env</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.tashow.cloud</groupId>
|
||||
<artifactId>tashow-framework-monitor</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.tashow.cloud</groupId>
|
||||
<artifactId>tashow-framework-web</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-validation</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- DB 相关 -->
|
||||
<dependency>
|
||||
<groupId>com.tashow.cloud</groupId>
|
||||
<artifactId>tashow-data-mybatis</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.tashow.cloud</groupId>
|
||||
<artifactId>tashow-data-redis</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.tashow.cloud</groupId>
|
||||
<artifactId>tashow-file-api</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- RPC 远程调用相关 -->
|
||||
<dependency>
|
||||
<groupId>com.tashow.cloud</groupId>
|
||||
<artifactId>tashow-framework-rpc</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Registry 注册中心相关 -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Config 配置中心相关 -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 三方云服务相关 -->
|
||||
<dependency>
|
||||
<groupId>commons-net</groupId>
|
||||
<artifactId>commons-net</artifactId> <!-- 文件客户端:解决 ftp 连接 -->
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.jcraft</groupId>
|
||||
<artifactId>jsch</artifactId> <!-- 文件客户端:解决 sftp 连接 -->
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.amazonaws</groupId>
|
||||
<artifactId>aws-java-sdk-s3</artifactId><!-- 文件客户端:解决阿里云、腾讯云、minio 等 S3 连接 -->
|
||||
</dependency>
|
||||
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<!-- 设置构建的 jar 包名 -->
|
||||
<finalName>${project.artifactId}</finalName>
|
||||
<plugins>
|
||||
<!-- 打包 -->
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<version>${spring.boot.version}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>repackage</goal> <!-- 将引入的 jar 打入其中 -->
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.tashow.cloud.file;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
/**
|
||||
* 项目的启动类
|
||||
*/
|
||||
@SpringBootApplication
|
||||
public class FileServerApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(FileServerApplication.class, args);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,9 +1,9 @@
|
||||
package com.tashow.cloud.infra.api.config;
|
||||
package com.tashow.cloud.file.api.config;
|
||||
|
||||
import com.tashow.cloud.common.pojo.CommonResult;
|
||||
import com.tashow.cloud.infra.service.config.ConfigService;
|
||||
import com.tashow.cloud.infraapi.api.config.ConfigApi;
|
||||
import com.tashow.cloud.infra.dal.dataobject.config.ConfigDO;
|
||||
import com.tashow.cloud.file.dal.dataobject.config.ConfigDO;
|
||||
import com.tashow.cloud.file.service.config.ConfigService;
|
||||
import com.tashow.cloud.fileapi.api.config.ConfigApi;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
@@ -1,14 +1,13 @@
|
||||
package com.tashow.cloud.infra.api.file;
|
||||
package com.tashow.cloud.file.api.file;
|
||||
|
||||
import com.tashow.cloud.common.pojo.CommonResult;
|
||||
import com.tashow.cloud.infra.service.file.FileService;
|
||||
import com.tashow.cloud.infraapi.api.file.FileApi;
|
||||
import com.tashow.cloud.infraapi.api.file.dto.FileCreateReqDTO;
|
||||
import com.tashow.cloud.file.service.file.FileService;
|
||||
import com.tashow.cloud.fileapi.api.file.FileApi;
|
||||
import com.tashow.cloud.fileapi.api.file.dto.FileCreateReqDTO;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import jakarta.annotation.Resource;
|
||||
|
||||
import static com.tashow.cloud.common.pojo.CommonResult.success;
|
||||
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
package com.tashow.cloud.user.api;
|
||||
@@ -0,0 +1,101 @@
|
||||
package com.tashow.cloud.file.controller.admin.config;
|
||||
|
||||
import com.tashow.cloud.common.pojo.CommonResult;
|
||||
import com.tashow.cloud.common.pojo.PageResult;
|
||||
import com.tashow.cloud.file.controller.admin.config.vo.ConfigPageReqVO;
|
||||
import com.tashow.cloud.file.controller.admin.config.vo.ConfigRespVO;
|
||||
import com.tashow.cloud.file.controller.admin.config.vo.ConfigSaveReqVO;
|
||||
import com.tashow.cloud.file.convert.config.ConfigConvert;
|
||||
import com.tashow.cloud.file.dal.dataobject.config.ConfigDO;
|
||||
import com.tashow.cloud.file.service.config.ConfigService;
|
||||
import com.tashow.cloud.fileapi.enums.ErrorCodeConstants;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.validation.Valid;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import static com.tashow.cloud.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.tashow.cloud.common.pojo.CommonResult.success;
|
||||
|
||||
|
||||
/**
|
||||
* 管理后台 - 参数配置
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/infra/config")
|
||||
@Validated
|
||||
public class ConfigController {
|
||||
|
||||
@Resource
|
||||
private ConfigService configService;
|
||||
|
||||
/**
|
||||
* 创建参数配置
|
||||
* @param createReqVO
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/create")
|
||||
public CommonResult<Long> createConfig(@Valid @RequestBody ConfigSaveReqVO createReqVO) {
|
||||
return success(configService.createConfig(createReqVO));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改参数配置
|
||||
* @param updateReqVO
|
||||
* @return
|
||||
*/
|
||||
@PutMapping("/update")
|
||||
public CommonResult<Boolean> updateConfig(@Valid @RequestBody ConfigSaveReqVO updateReqVO) {
|
||||
configService.updateConfig(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除参数配置
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@DeleteMapping("/delete")
|
||||
public CommonResult<Boolean> deleteConfig(@RequestParam("id") Long id) {
|
||||
configService.deleteConfig(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获得参数配置
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/get")
|
||||
public CommonResult<ConfigRespVO> getConfig(@RequestParam("id") Long id) {
|
||||
return success(ConfigConvert.INSTANCE.convert(configService.getConfig(id)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据参数键名查询参数值
|
||||
* @param key
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/get-value-by-key")
|
||||
public CommonResult<String> getConfigKey(@RequestParam("key") String key) {
|
||||
ConfigDO config = configService.getConfigByKey(key);
|
||||
if (config == null) {
|
||||
return success(null);
|
||||
}
|
||||
if (!config.getVisible()) {
|
||||
throw exception(ErrorCodeConstants.CONFIG_GET_VALUE_ERROR_IF_VISIBLE);
|
||||
}
|
||||
return success(config.getValue());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取参数配置分页
|
||||
* @param pageReqVO
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/page")
|
||||
public CommonResult<PageResult<ConfigRespVO>> getConfigPage(@Valid ConfigPageReqVO pageReqVO) {
|
||||
PageResult<ConfigDO> page = configService.getConfigPage(pageReqVO);
|
||||
return success(ConfigConvert.INSTANCE.convertPage(page));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package com.tashow.cloud.file.controller.admin.config.vo;
|
||||
|
||||
import com.tashow.cloud.common.pojo.PageParam;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static com.tashow.cloud.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
|
||||
/**
|
||||
* 管理后台 - 参数配置分页 Request VO
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class ConfigPageReqVO extends PageParam {
|
||||
|
||||
// 数据源名称,模糊匹配
|
||||
private String name;
|
||||
|
||||
//参数键名,模糊匹配
|
||||
private String key;
|
||||
|
||||
//参数类型,参见 SysConfigTypeEnum 枚举
|
||||
private Integer type;
|
||||
|
||||
//创建时间
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.tashow.cloud.file.controller.admin.config.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 管理后台 - 参数配置信息 Response VO
|
||||
*/
|
||||
@Data
|
||||
public class ConfigRespVO {
|
||||
|
||||
//参数配置序号
|
||||
private Long id;
|
||||
|
||||
//参数分类
|
||||
private String category;
|
||||
|
||||
//参数名称
|
||||
private String name;
|
||||
|
||||
//参数键名
|
||||
private String key;
|
||||
|
||||
//参数键值
|
||||
private String value;
|
||||
|
||||
//参数类型,参见 SysConfigTypeEnum 枚举
|
||||
private Integer type;
|
||||
|
||||
//是否可见
|
||||
private Boolean visible;
|
||||
|
||||
//备注
|
||||
private String remark;
|
||||
|
||||
//创建时间
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package com.tashow.cloud.file.controller.admin.config.vo;
|
||||
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 管理后台 - 参数配置创建/修改 Request VO
|
||||
*/
|
||||
@Data
|
||||
public class ConfigSaveReqVO {
|
||||
|
||||
//参数配置序号
|
||||
private Long id;
|
||||
|
||||
//参数分组
|
||||
@NotEmpty(message = "参数分组不能为空")
|
||||
@Size(max = 50, message = "参数名称不能超过 50 个字符")
|
||||
private String category;
|
||||
|
||||
//参数名称
|
||||
@NotBlank(message = "参数名称不能为空")
|
||||
@Size(max = 100, message = "参数名称不能超过 100 个字符")
|
||||
private String name;
|
||||
|
||||
//参数键名
|
||||
@NotBlank(message = "参数键名长度不能为空")
|
||||
@Size(max = 100, message = "参数键名长度不能超过 100 个字符")
|
||||
private String key;
|
||||
|
||||
//参数键值
|
||||
@NotBlank(message = "参数键值不能为空")
|
||||
@Size(max = 500, message = "参数键值长度不能超过 500 个字符")
|
||||
private String value;
|
||||
|
||||
//是否可见
|
||||
@NotNull(message = "是否可见不能为空")
|
||||
private Boolean visible;
|
||||
|
||||
//备注
|
||||
private String remark;
|
||||
|
||||
}
|
||||
@@ -1,21 +1,20 @@
|
||||
package com.tashow.cloud.infra.controller.admin.file;
|
||||
|
||||
import static com.tashow.cloud.common.pojo.CommonResult.success;
|
||||
package com.tashow.cloud.file.controller.admin.file;
|
||||
|
||||
import com.tashow.cloud.common.pojo.CommonResult;
|
||||
import com.tashow.cloud.common.pojo.PageResult;
|
||||
import com.tashow.cloud.common.util.object.BeanUtils;
|
||||
import com.tashow.cloud.infra.controller.admin.file.vo.config.FileConfigPageReqVO;
|
||||
import com.tashow.cloud.infra.controller.admin.file.vo.config.FileConfigRespVO;
|
||||
import com.tashow.cloud.infra.controller.admin.file.vo.config.FileConfigSaveReqVO;
|
||||
import com.tashow.cloud.infra.dal.dataobject.file.FileConfigDO;
|
||||
import com.tashow.cloud.infra.service.file.FileConfigService;
|
||||
import com.tashow.cloud.file.controller.admin.file.vo.config.FileConfigPageReqVO;
|
||||
import com.tashow.cloud.file.controller.admin.file.vo.config.FileConfigRespVO;
|
||||
import com.tashow.cloud.file.controller.admin.file.vo.config.FileConfigSaveReqVO;
|
||||
import com.tashow.cloud.file.dal.dataobject.file.FileConfigDO;
|
||||
import com.tashow.cloud.file.service.file.FileConfigService;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.validation.Valid;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import static com.tashow.cloud.common.pojo.CommonResult.success;
|
||||
|
||||
/** 管理后台 - 文件配置 */
|
||||
@RestController
|
||||
@RequestMapping("/infra/file-config")
|
||||
@@ -26,14 +25,12 @@ public class FileConfigController {
|
||||
|
||||
/** 创建文件配置 */
|
||||
@PostMapping("/create")
|
||||
@PreAuthorize("@ss.hasPermission('infra:file-config:create')")
|
||||
public CommonResult<Long> createFileConfig(@Valid @RequestBody FileConfigSaveReqVO createReqVO) {
|
||||
return success(fileConfigService.createFileConfig(createReqVO));
|
||||
}
|
||||
|
||||
/** 更新文件配置 */
|
||||
@PutMapping("/update")
|
||||
@PreAuthorize("@ss.hasPermission('infra:file-config:update')")
|
||||
public CommonResult<Boolean> updateFileConfig(
|
||||
@Valid @RequestBody FileConfigSaveReqVO updateReqVO) {
|
||||
fileConfigService.updateFileConfig(updateReqVO);
|
||||
@@ -42,7 +39,6 @@ public class FileConfigController {
|
||||
|
||||
/** 更新文件配置为 Master */
|
||||
@PutMapping("/update-master")
|
||||
@PreAuthorize("@ss.hasPermission('infra:file-config:update')")
|
||||
public CommonResult<Boolean> updateFileConfigMaster(@RequestParam("id") Long id) {
|
||||
fileConfigService.updateFileConfigMaster(id);
|
||||
return success(true);
|
||||
@@ -50,7 +46,6 @@ public class FileConfigController {
|
||||
|
||||
/** 删除文件配置 */
|
||||
@DeleteMapping("/delete")
|
||||
@PreAuthorize("@ss.hasPermission('infra:file-config:delete')")
|
||||
public CommonResult<Boolean> deleteFileConfig(@RequestParam("id") Long id) {
|
||||
fileConfigService.deleteFileConfig(id);
|
||||
return success(true);
|
||||
@@ -58,7 +53,6 @@ public class FileConfigController {
|
||||
|
||||
/** 获得文件配置 */
|
||||
@GetMapping("/get")
|
||||
@PreAuthorize("@ss.hasPermission('infra:file-config:query')")
|
||||
public CommonResult<FileConfigRespVO> getFileConfig(@RequestParam("id") Long id) {
|
||||
FileConfigDO config = fileConfigService.getFileConfig(id);
|
||||
return success(BeanUtils.toBean(config, FileConfigRespVO.class));
|
||||
@@ -66,7 +60,6 @@ public class FileConfigController {
|
||||
|
||||
/** 获得文件配置分页 */
|
||||
@GetMapping("/page")
|
||||
@PreAuthorize("@ss.hasPermission('infra:file-config:query')")
|
||||
public CommonResult<PageResult<FileConfigRespVO>> getFileConfigPage(
|
||||
@Valid FileConfigPageReqVO pageVO) {
|
||||
PageResult<FileConfigDO> pageResult = fileConfigService.getFileConfigPage(pageVO);
|
||||
@@ -75,7 +68,6 @@ public class FileConfigController {
|
||||
|
||||
/** 测试文件配置是否正确 */
|
||||
@GetMapping("/test")
|
||||
@PreAuthorize("@ss.hasPermission('infra:file-config:query')")
|
||||
public CommonResult<String> testFileConfig(@RequestParam("id") Long id) throws Exception {
|
||||
String url = fileConfigService.testFileConfig(id);
|
||||
return success(url);
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.tashow.cloud.infra.controller.admin.file;
|
||||
package com.tashow.cloud.file.controller.admin.file;
|
||||
|
||||
import cn.hutool.core.io.IoUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
@@ -6,23 +6,21 @@ import cn.hutool.core.util.URLUtil;
|
||||
import com.tashow.cloud.common.pojo.CommonResult;
|
||||
import com.tashow.cloud.common.pojo.PageResult;
|
||||
import com.tashow.cloud.common.util.object.BeanUtils;
|
||||
import com.tashow.cloud.infra.controller.admin.file.vo.file.*;
|
||||
import com.tashow.cloud.infra.dal.dataobject.file.FileDO;
|
||||
import com.tashow.cloud.infra.service.file.FileService;
|
||||
import com.tashow.cloud.file.controller.admin.file.vo.file.*;
|
||||
import com.tashow.cloud.file.dal.dataobject.file.FileDO;
|
||||
import com.tashow.cloud.file.service.file.FileService;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.annotation.security.PermitAll;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.validation.Valid;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import static com.tashow.cloud.common.pojo.CommonResult.success;
|
||||
import static com.tashow.cloud.infra.framework.file.core.utils.FileTypeUtils.writeAttachment;
|
||||
import static com.tashow.cloud.file.framework.file.core.utils.FileTypeUtils.writeAttachment;
|
||||
|
||||
/** 管理后台 - 文件存储 */
|
||||
@RestController
|
||||
@@ -58,7 +56,6 @@ public class FileController {
|
||||
|
||||
/** 删除文件 */
|
||||
@DeleteMapping("/delete")
|
||||
@PreAuthorize("@ss.hasPermission('infra:file:delete')")
|
||||
public CommonResult<Boolean> deleteFile(@RequestParam("id") Long id) throws Exception {
|
||||
fileService.deleteFile(id);
|
||||
return success(true);
|
||||
@@ -66,7 +63,6 @@ public class FileController {
|
||||
|
||||
/** 下载文件 */
|
||||
@GetMapping("/{configId}/get/**")
|
||||
@PermitAll
|
||||
public void getFileContent(
|
||||
HttpServletRequest request,
|
||||
HttpServletResponse response,
|
||||
@@ -92,7 +88,6 @@ public class FileController {
|
||||
|
||||
/** 获得文件分页 */
|
||||
@GetMapping("/page")
|
||||
@PreAuthorize("@ss.hasPermission('infra:file:query')")
|
||||
public CommonResult<PageResult<FileRespVO>> getFilePage(@Valid FilePageReqVO pageVO) {
|
||||
PageResult<FileDO> pageResult = fileService.getFilePage(pageVO);
|
||||
return success(BeanUtils.toBean(pageResult, FileRespVO.class));
|
||||
@@ -1,14 +1,15 @@
|
||||
package com.tashow.cloud.infra.controller.admin.file.vo.config;
|
||||
|
||||
import static com.tashow.cloud.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
package com.tashow.cloud.file.controller.admin.file.vo.config;
|
||||
|
||||
import com.tashow.cloud.common.pojo.PageParam;
|
||||
import java.time.LocalDateTime;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static com.tashow.cloud.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
/** 管理后台 - 文件配置分页 Request VO */
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@@ -1,9 +1,10 @@
|
||||
package com.tashow.cloud.infra.controller.admin.file.vo.config;
|
||||
package com.tashow.cloud.file.controller.admin.file.vo.config;
|
||||
|
||||
import com.tashow.cloud.infra.framework.file.core.client.FileClientConfig;
|
||||
import java.time.LocalDateTime;
|
||||
import com.tashow.cloud.file.framework.file.core.client.FileClientConfig;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/** 管理后台 - 文件配置 Response VO */
|
||||
@Data
|
||||
public class FileConfigRespVO {
|
||||
@@ -1,9 +1,10 @@
|
||||
package com.tashow.cloud.infra.controller.admin.file.vo.config;
|
||||
package com.tashow.cloud.file.controller.admin.file.vo.config;
|
||||
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import java.util.Map;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/** 管理后台 - 文件配置创建/修改 Request VO */
|
||||
@Data
|
||||
public class FileConfigSaveReqVO {
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.tashow.cloud.infra.controller.admin.file.vo.file;
|
||||
package com.tashow.cloud.file.controller.admin.file.vo.file;
|
||||
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
@@ -1,14 +1,15 @@
|
||||
package com.tashow.cloud.infra.controller.admin.file.vo.file;
|
||||
|
||||
import static com.tashow.cloud.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
package com.tashow.cloud.file.controller.admin.file.vo.file;
|
||||
|
||||
import com.tashow.cloud.common.pojo.PageParam;
|
||||
import java.time.LocalDateTime;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static com.tashow.cloud.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
/** 管理后台 - 文件分页 Request VO */
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.tashow.cloud.infra.controller.admin.file.vo.file;
|
||||
package com.tashow.cloud.file.controller.admin.file.vo.file;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
@@ -1,7 +1,8 @@
|
||||
package com.tashow.cloud.infra.controller.admin.file.vo.file;
|
||||
package com.tashow.cloud.file.controller.admin.file.vo.file;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import lombok.Data;
|
||||
|
||||
/** 管理后台 - 文件 Response VO,不返回 content 字段,太大 */
|
||||
@Data
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.tashow.cloud.infra.controller.admin.file.vo.file;
|
||||
package com.tashow.cloud.file.controller.admin.file.vo.file;
|
||||
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
@@ -0,0 +1 @@
|
||||
package com.tashow.cloud.user.controller.admin;
|
||||
@@ -1,21 +1,20 @@
|
||||
package com.tashow.cloud.infra.controller.app.file;
|
||||
|
||||
import static com.tashow.cloud.common.pojo.CommonResult.success;
|
||||
package com.tashow.cloud.file.controller.app.file;
|
||||
|
||||
import cn.hutool.core.io.IoUtil;
|
||||
import com.tashow.cloud.common.pojo.CommonResult;
|
||||
import com.tashow.cloud.infra.controller.admin.file.vo.file.FileCreateReqVO;
|
||||
import com.tashow.cloud.infra.controller.admin.file.vo.file.FilePresignedUrlRespVO;
|
||||
import com.tashow.cloud.infra.controller.app.file.vo.AppFileUploadReqVO;
|
||||
import com.tashow.cloud.infra.service.file.FileService;
|
||||
import com.tashow.cloud.file.controller.admin.file.vo.file.FileCreateReqVO;
|
||||
import com.tashow.cloud.file.controller.admin.file.vo.file.FilePresignedUrlRespVO;
|
||||
import com.tashow.cloud.file.controller.app.file.vo.AppFileUploadReqVO;
|
||||
import com.tashow.cloud.file.service.file.FileService;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.annotation.security.PermitAll;
|
||||
import jakarta.validation.Valid;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import static com.tashow.cloud.common.pojo.CommonResult.success;
|
||||
|
||||
/** 用户 App - 文件存储 */
|
||||
@RestController
|
||||
@RequestMapping("/infra/file")
|
||||
@@ -27,7 +26,6 @@ public class AppFileController {
|
||||
|
||||
/** 上传文件 */
|
||||
@PostMapping("/upload")
|
||||
@PermitAll
|
||||
public CommonResult<String> uploadFile(AppFileUploadReqVO uploadReqVO) throws Exception {
|
||||
MultipartFile file = uploadReqVO.getFile();
|
||||
String path = uploadReqVO.getPath();
|
||||
@@ -38,7 +36,6 @@ public class AppFileController {
|
||||
|
||||
/** 获取文件预签名地址", description = "模式二:前端上传文件:用于前端直接上传七牛、阿里云 OSS 等文件存储器 */
|
||||
@GetMapping("/presigned-url")
|
||||
@PermitAll
|
||||
public CommonResult<FilePresignedUrlRespVO> getFilePresignedUrl(@RequestParam("path") String path)
|
||||
throws Exception {
|
||||
return success(fileService.getFilePresignedUrl(path));
|
||||
@@ -46,7 +43,6 @@ public class AppFileController {
|
||||
|
||||
/** 创建文件", description = "模式二:前端上传文件:配合 presigned-url 接口,记录上传了上传的文件 */
|
||||
@PostMapping("/create")
|
||||
@PermitAll
|
||||
public CommonResult<Long> createFile(@Valid @RequestBody FileCreateReqVO createReqVO) {
|
||||
return success(fileService.createFile(createReqVO));
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.tashow.cloud.infra.controller.app.file.vo;
|
||||
package com.tashow.cloud.file.controller.app.file.vo;
|
||||
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
@@ -0,0 +1 @@
|
||||
package com.tashow.cloud.file.controller.app;
|
||||
@@ -0,0 +1,6 @@
|
||||
/**
|
||||
* 提供 RESTful API 给前端:
|
||||
* 1. admin 包:提供给管理后台 yudao-ui-admin 前端项目
|
||||
* 2. app 包:提供给用户 APP yudao-ui-app 前端项目,它的 Controller 和 VO 都要添加 App 前缀,用于和管理后台进行区分
|
||||
*/
|
||||
package com.tashow.cloud.user.controller;
|
||||
@@ -1,9 +1,9 @@
|
||||
package com.tashow.cloud.infra.convert.config;
|
||||
package com.tashow.cloud.file.convert.config;
|
||||
|
||||
import com.tashow.cloud.common.pojo.PageResult;
|
||||
import com.tashow.cloud.infra.controller.admin.config.vo.ConfigRespVO;
|
||||
import com.tashow.cloud.infra.controller.admin.config.vo.ConfigSaveReqVO;
|
||||
import com.tashow.cloud.infra.dal.dataobject.config.ConfigDO;
|
||||
import com.tashow.cloud.file.controller.admin.config.vo.ConfigRespVO;
|
||||
import com.tashow.cloud.file.controller.admin.config.vo.ConfigSaveReqVO;
|
||||
import com.tashow.cloud.file.dal.dataobject.config.ConfigDO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mapping;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.tashow.cloud.infra.convert.file;
|
||||
package com.tashow.cloud.file.convert.file;
|
||||
|
||||
import com.tashow.cloud.infra.controller.admin.file.vo.config.FileConfigSaveReqVO;
|
||||
import com.tashow.cloud.infra.dal.dataobject.file.FileConfigDO;
|
||||
import com.tashow.cloud.file.controller.admin.file.vo.config.FileConfigSaveReqVO;
|
||||
import com.tashow.cloud.file.dal.dataobject.file.FileConfigDO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mapping;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
@@ -0,0 +1,6 @@
|
||||
/**
|
||||
* 提供 POJO 类的实体转换
|
||||
*
|
||||
* 目前使用 MapStruct 框架
|
||||
*/
|
||||
package com.tashow.cloud.user.convert;
|
||||
@@ -1,12 +1,10 @@
|
||||
package com.tashow.cloud.infra.dal.dataobject.config;
|
||||
package com.tashow.cloud.file.dal.dataobject.config;
|
||||
|
||||
import com.tashow.cloud.mybatis.mybatis.core.dataobject.BaseDO;
|
||||
import com.tashow.cloud.infra.enums.config.ConfigTypeEnum;
|
||||
import com.tashow.cloud.infra.enums.config.ConfigTypeEnum;
|
||||
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.tashow.cloud.infra.enums.config.ConfigTypeEnum;
|
||||
import com.tashow.cloud.file.enums.config.ConfigTypeEnum;
|
||||
import com.tashow.cloud.mybatis.mybatis.core.dataobject.BaseDO;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
@@ -1,20 +1,20 @@
|
||||
package com.tashow.cloud.infra.dal.dataobject.file;
|
||||
package com.tashow.cloud.file.dal.dataobject.file;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.tashow.cloud.common.util.json.JsonUtils;
|
||||
import com.tashow.cloud.mybatis.mybatis.core.dataobject.BaseDO;
|
||||
import com.tashow.cloud.infra.framework.file.core.client.FileClientConfig;
|
||||
import com.tashow.cloud.infra.framework.file.core.client.db.DBFileClientConfig;
|
||||
import com.tashow.cloud.infra.framework.file.core.client.ftp.FtpFileClientConfig;
|
||||
import com.tashow.cloud.infra.framework.file.core.client.local.LocalFileClientConfig;
|
||||
import com.tashow.cloud.infra.framework.file.core.client.s3.S3FileClientConfig;
|
||||
import com.tashow.cloud.infra.framework.file.core.client.sftp.SftpFileClientConfig;
|
||||
import com.tashow.cloud.infra.framework.file.core.enums.FileStorageEnum;
|
||||
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.extension.handlers.AbstractJsonTypeHandler;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.tashow.cloud.common.util.json.JsonUtils;
|
||||
import com.tashow.cloud.file.framework.file.core.client.FileClientConfig;
|
||||
import com.tashow.cloud.file.framework.file.core.client.db.DBFileClientConfig;
|
||||
import com.tashow.cloud.file.framework.file.core.client.ftp.FtpFileClientConfig;
|
||||
import com.tashow.cloud.file.framework.file.core.client.local.LocalFileClientConfig;
|
||||
import com.tashow.cloud.file.framework.file.core.client.s3.S3FileClientConfig;
|
||||
import com.tashow.cloud.file.framework.file.core.client.sftp.SftpFileClientConfig;
|
||||
import com.tashow.cloud.file.framework.file.core.enums.FileStorageEnum;
|
||||
import com.tashow.cloud.mybatis.mybatis.core.dataobject.BaseDO;
|
||||
import lombok.*;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
@@ -1,11 +1,10 @@
|
||||
package com.tashow.cloud.infra.dal.dataobject.file;
|
||||
package com.tashow.cloud.file.dal.dataobject.file;
|
||||
|
||||
import com.tashow.cloud.mybatis.mybatis.core.dataobject.BaseDO;
|
||||
import com.tashow.cloud.infra.framework.file.core.client.db.DBFileClient;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.tashow.cloud.file.framework.file.core.client.db.DBFileClient;
|
||||
import com.tashow.cloud.mybatis.mybatis.core.dataobject.BaseDO;
|
||||
import lombok.*;
|
||||
|
||||
/**
|
||||
@@ -1,8 +1,8 @@
|
||||
package com.tashow.cloud.infra.dal.dataobject.file;
|
||||
package com.tashow.cloud.file.dal.dataobject.file;
|
||||
|
||||
import com.tashow.cloud.mybatis.mybatis.core.dataobject.BaseDO;
|
||||
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.tashow.cloud.mybatis.mybatis.core.dataobject.BaseDO;
|
||||
import lombok.*;
|
||||
|
||||
/**
|
||||
@@ -0,0 +1 @@
|
||||
package com.tashow.cloud.user.dal.dataobject;
|
||||
@@ -1,12 +1,10 @@
|
||||
package com.tashow.cloud.infra.dal.mysql.config;
|
||||
package com.tashow.cloud.file.dal.mysql.config;
|
||||
|
||||
import com.tashow.cloud.common.pojo.PageResult;
|
||||
import com.tashow.cloud.file.controller.admin.config.vo.ConfigPageReqVO;
|
||||
import com.tashow.cloud.file.dal.dataobject.config.ConfigDO;
|
||||
import com.tashow.cloud.mybatis.mybatis.core.mapper.BaseMapperX;
|
||||
import com.tashow.cloud.mybatis.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import com.tashow.cloud.infra.dal.dataobject.config.ConfigDO;
|
||||
import com.tashow.cloud.infra.controller.admin.config.vo.ConfigPageReqVO;
|
||||
import com.tashow.cloud.infra.dal.dataobject.config.ConfigDO;
|
||||
import com.tashow.cloud.infra.dal.dataobject.config.ConfigDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
@@ -1,12 +1,10 @@
|
||||
package com.tashow.cloud.infra.dal.mysql.file;
|
||||
package com.tashow.cloud.file.dal.mysql.file;
|
||||
|
||||
import com.tashow.cloud.common.pojo.PageResult;
|
||||
import com.tashow.cloud.file.controller.admin.file.vo.config.FileConfigPageReqVO;
|
||||
import com.tashow.cloud.file.dal.dataobject.file.FileConfigDO;
|
||||
import com.tashow.cloud.mybatis.mybatis.core.mapper.BaseMapperX;
|
||||
import com.tashow.cloud.mybatis.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import com.tashow.cloud.infra.dal.dataobject.file.FileConfigDO;
|
||||
import com.tashow.cloud.infra.controller.admin.file.vo.config.FileConfigPageReqVO;
|
||||
import com.tashow.cloud.infra.dal.dataobject.file.FileConfigDO;
|
||||
import com.tashow.cloud.infra.dal.dataobject.file.FileConfigDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
@@ -1,10 +1,8 @@
|
||||
package com.tashow.cloud.infra.dal.mysql.file;
|
||||
package com.tashow.cloud.file.dal.mysql.file;
|
||||
|
||||
import com.tashow.cloud.infra.dal.dataobject.file.FileContentDO;
|
||||
import com.tashow.cloud.infra.dal.dataobject.file.FileContentDO;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.tashow.cloud.infra.dal.dataobject.file.FileContentDO;
|
||||
import com.tashow.cloud.file.dal.dataobject.file.FileContentDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
@@ -1,12 +1,10 @@
|
||||
package com.tashow.cloud.infra.dal.mysql.file;
|
||||
package com.tashow.cloud.file.dal.mysql.file;
|
||||
|
||||
import com.tashow.cloud.common.pojo.PageResult;
|
||||
import com.tashow.cloud.file.controller.admin.file.vo.file.FilePageReqVO;
|
||||
import com.tashow.cloud.file.dal.dataobject.file.FileDO;
|
||||
import com.tashow.cloud.mybatis.mybatis.core.mapper.BaseMapperX;
|
||||
import com.tashow.cloud.mybatis.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import com.tashow.cloud.infra.dal.dataobject.file.FileDO;
|
||||
import com.tashow.cloud.infra.controller.admin.file.vo.file.FilePageReqVO;
|
||||
import com.tashow.cloud.infra.dal.dataobject.file.FileDO;
|
||||
import com.tashow.cloud.infra.dal.dataobject.file.FileDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
@@ -0,0 +1 @@
|
||||
package com.tashow.cloud.user.dal.mysql;
|
||||
@@ -0,0 +1,9 @@
|
||||
/**
|
||||
* DAL = Data Access Layer 数据访问层
|
||||
* 1. data object:数据对象
|
||||
* 2. redis:Redis 的 CRUD 操作
|
||||
* 3. mysql:MySQL 的 CRUD 操作
|
||||
*
|
||||
* 其中,MySQL 的表以 member_ 作为前缀
|
||||
*/
|
||||
package com.tashow.cloud.user.dal;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.tashow.cloud.infra.enums.config;
|
||||
package com.tashow.cloud.file.enums.config;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
@@ -0,0 +1,4 @@
|
||||
/**
|
||||
* 占位
|
||||
*/
|
||||
package com.tashow.cloud.file.enums;
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.tashow.cloud.file.framework.file.config;
|
||||
|
||||
import com.tashow.cloud.file.framework.file.core.client.FileClientFactory;
|
||||
import com.tashow.cloud.file.framework.file.core.client.FileClientFactoryImpl;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* 文件配置类
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
public class FileAutoConfiguration {
|
||||
|
||||
@Bean
|
||||
public FileClientFactory fileClientFactory() {
|
||||
return new FileClientFactoryImpl();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.tashow.cloud.infra.framework.file.core.client;
|
||||
package com.tashow.cloud.file.framework.file.core.client;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -1,8 +1,7 @@
|
||||
package com.tashow.cloud.infra.framework.file.core.client;
|
||||
package com.tashow.cloud.file.framework.file.core.client;
|
||||
|
||||
import com.tashow.cloud.infra.framework.file.core.client.s3.FilePresignedUrlRespDTO;
|
||||
import com.tashow.cloud.infra.framework.file.core.client.s3.FilePresignedUrlRespDTO;
|
||||
import com.tashow.cloud.infra.framework.file.core.client.s3.FilePresignedUrlRespDTO;
|
||||
|
||||
import com.tashow.cloud.file.framework.file.core.client.s3.FilePresignedUrlRespDTO;
|
||||
|
||||
/**
|
||||
* 文件客户端
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.tashow.cloud.infra.framework.file.core.client;
|
||||
package com.tashow.cloud.file.framework.file.core.client;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonTypeInfo;
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
package com.tashow.cloud.infra.framework.file.core.client;
|
||||
package com.tashow.cloud.file.framework.file.core.client;
|
||||
|
||||
import com.tashow.cloud.infra.framework.file.core.enums.FileStorageEnum;
|
||||
import com.tashow.cloud.infra.framework.file.core.enums.FileStorageEnum;
|
||||
import com.tashow.cloud.infra.framework.file.core.enums.FileStorageEnum;
|
||||
|
||||
import com.tashow.cloud.file.framework.file.core.enums.FileStorageEnum;
|
||||
|
||||
public interface FileClientFactory {
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
package com.tashow.cloud.infra.framework.file.core.client;
|
||||
package com.tashow.cloud.file.framework.file.core.client;
|
||||
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import cn.hutool.core.util.ReflectUtil;
|
||||
import com.tashow.cloud.infra.framework.file.core.enums.FileStorageEnum;
|
||||
import com.tashow.cloud.infra.framework.file.core.enums.FileStorageEnum;
|
||||
import com.tashow.cloud.infra.framework.file.core.enums.FileStorageEnum;
|
||||
import com.tashow.cloud.file.framework.file.core.enums.FileStorageEnum;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
@@ -1,14 +1,10 @@
|
||||
package com.tashow.cloud.infra.framework.file.core.client.db;
|
||||
package com.tashow.cloud.file.framework.file.core.client.db;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.extra.spring.SpringUtil;
|
||||
import com.tashow.cloud.infra.dal.dataobject.file.FileContentDO;
|
||||
import com.tashow.cloud.infra.dal.mysql.file.FileContentMapper;
|
||||
import com.tashow.cloud.infra.dal.dataobject.file.FileContentDO;
|
||||
import com.tashow.cloud.infra.dal.mysql.file.FileContentMapper;
|
||||
import com.tashow.cloud.infra.framework.file.core.client.AbstractFileClient;
|
||||
import com.tashow.cloud.infra.dal.dataobject.file.FileContentDO;
|
||||
import com.tashow.cloud.infra.dal.mysql.file.FileContentMapper;
|
||||
import com.tashow.cloud.file.dal.dataobject.file.FileContentDO;
|
||||
import com.tashow.cloud.file.dal.mysql.file.FileContentMapper;
|
||||
import com.tashow.cloud.file.framework.file.core.client.AbstractFileClient;
|
||||
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.tashow.cloud.infra.framework.file.core.client.db;
|
||||
package com.tashow.cloud.file.framework.file.core.client.db;
|
||||
|
||||
import com.tashow.cloud.infra.framework.file.core.client.FileClientConfig;
|
||||
import com.tashow.cloud.file.framework.file.core.client.FileClientConfig;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import lombok.Data;
|
||||
import org.hibernate.validator.constraints.URL;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.tashow.cloud.infra.framework.file.core.client.ftp;
|
||||
package com.tashow.cloud.file.framework.file.core.client.ftp;
|
||||
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import cn.hutool.core.util.CharsetUtil;
|
||||
@@ -6,7 +6,7 @@ import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.extra.ftp.Ftp;
|
||||
import cn.hutool.extra.ftp.FtpException;
|
||||
import cn.hutool.extra.ftp.FtpMode;
|
||||
import com.tashow.cloud.infra.framework.file.core.client.AbstractFileClient;
|
||||
import com.tashow.cloud.file.framework.file.core.client.AbstractFileClient;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.tashow.cloud.infra.framework.file.core.client.ftp;
|
||||
package com.tashow.cloud.file.framework.file.core.client.ftp;
|
||||
|
||||
import com.tashow.cloud.infra.framework.file.core.client.FileClientConfig;
|
||||
import com.tashow.cloud.file.framework.file.core.client.FileClientConfig;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.tashow.cloud.infra.framework.file.core.client.local;
|
||||
package com.tashow.cloud.file.framework.file.core.client.local;
|
||||
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import com.tashow.cloud.infra.framework.file.core.client.AbstractFileClient;
|
||||
import com.tashow.cloud.file.framework.file.core.client.AbstractFileClient;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.tashow.cloud.infra.framework.file.core.client.local;
|
||||
package com.tashow.cloud.file.framework.file.core.client.local;
|
||||
|
||||
import com.tashow.cloud.infra.framework.file.core.client.FileClientConfig;
|
||||
import com.tashow.cloud.file.framework.file.core.client.FileClientConfig;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import lombok.Data;
|
||||
import org.hibernate.validator.constraints.URL;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.tashow.cloud.infra.framework.file.core.client.s3;
|
||||
package com.tashow.cloud.file.framework.file.core.client.s3;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
@@ -1,9 +1,8 @@
|
||||
package com.tashow.cloud.infra.framework.file.core.client.s3;
|
||||
package com.tashow.cloud.file.framework.file.core.client.s3;
|
||||
|
||||
import cn.hutool.core.io.IoUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.http.HttpUtil;
|
||||
import com.tashow.cloud.infra.framework.file.core.client.AbstractFileClient;
|
||||
import com.amazonaws.HttpMethod;
|
||||
import com.amazonaws.auth.AWSStaticCredentialsProvider;
|
||||
import com.amazonaws.auth.BasicAWSCredentials;
|
||||
@@ -12,6 +11,7 @@ import com.amazonaws.services.s3.AmazonS3Client;
|
||||
import com.amazonaws.services.s3.AmazonS3ClientBuilder;
|
||||
import com.amazonaws.services.s3.model.ObjectMetadata;
|
||||
import com.amazonaws.services.s3.model.S3Object;
|
||||
import com.tashow.cloud.file.framework.file.core.client.AbstractFileClient;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.util.Date;
|
||||
@@ -1,8 +1,8 @@
|
||||
package com.tashow.cloud.infra.framework.file.core.client.s3;
|
||||
package com.tashow.cloud.file.framework.file.core.client.s3;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.tashow.cloud.infra.framework.file.core.client.FileClientConfig;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.tashow.cloud.file.framework.file.core.client.FileClientConfig;
|
||||
import jakarta.validation.constraints.AssertTrue;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
@@ -1,9 +1,9 @@
|
||||
package com.tashow.cloud.infra.framework.file.core.client.sftp;
|
||||
package com.tashow.cloud.file.framework.file.core.client.sftp;
|
||||
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import cn.hutool.extra.ssh.Sftp;
|
||||
import com.tashow.cloud.common.util.io.FileUtils;
|
||||
import com.tashow.cloud.infra.framework.file.core.client.AbstractFileClient;
|
||||
import com.tashow.cloud.file.framework.file.core.client.AbstractFileClient;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.tashow.cloud.infra.framework.file.core.client.sftp;
|
||||
package com.tashow.cloud.file.framework.file.core.client.sftp;
|
||||
|
||||
import com.tashow.cloud.infra.framework.file.core.client.FileClientConfig;
|
||||
import com.tashow.cloud.file.framework.file.core.client.FileClientConfig;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
@@ -0,0 +1,55 @@
|
||||
package com.tashow.cloud.file.framework.file.core.enums;
|
||||
|
||||
import cn.hutool.core.util.ArrayUtil;
|
||||
import com.tashow.cloud.file.framework.file.core.client.FileClient;
|
||||
import com.tashow.cloud.file.framework.file.core.client.FileClientConfig;
|
||||
import com.tashow.cloud.file.framework.file.core.client.db.DBFileClient;
|
||||
import com.tashow.cloud.file.framework.file.core.client.db.DBFileClientConfig;
|
||||
import com.tashow.cloud.file.framework.file.core.client.ftp.FtpFileClient;
|
||||
import com.tashow.cloud.file.framework.file.core.client.ftp.FtpFileClientConfig;
|
||||
import com.tashow.cloud.file.framework.file.core.client.local.LocalFileClient;
|
||||
import com.tashow.cloud.file.framework.file.core.client.local.LocalFileClientConfig;
|
||||
import com.tashow.cloud.file.framework.file.core.client.s3.S3FileClient;
|
||||
import com.tashow.cloud.file.framework.file.core.client.s3.S3FileClientConfig;
|
||||
import com.tashow.cloud.file.framework.file.core.client.sftp.SftpFileClient;
|
||||
import com.tashow.cloud.file.framework.file.core.client.sftp.SftpFileClientConfig;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 文件存储器枚举
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
public enum FileStorageEnum {
|
||||
|
||||
DB(1, DBFileClientConfig.class, DBFileClient.class),
|
||||
|
||||
LOCAL(10, LocalFileClientConfig.class, LocalFileClient.class),
|
||||
FTP(11, FtpFileClientConfig.class, FtpFileClient.class),
|
||||
SFTP(12, SftpFileClientConfig.class, SftpFileClient.class),
|
||||
|
||||
S3(20, S3FileClientConfig.class, S3FileClient.class),
|
||||
;
|
||||
|
||||
/**
|
||||
* 存储器
|
||||
*/
|
||||
private final Integer storage;
|
||||
|
||||
/**
|
||||
* 配置类
|
||||
*/
|
||||
private final Class<? extends FileClientConfig> configClass;
|
||||
/**
|
||||
* 客户端类
|
||||
*/
|
||||
private final Class<? extends FileClient> clientClass;
|
||||
|
||||
public static FileStorageEnum getByStorage(Integer storage) {
|
||||
return ArrayUtil.firstMatch(o -> o.getStorage().equals(storage), values());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.tashow.cloud.infra.framework.file.core.utils;
|
||||
package com.tashow.cloud.file.framework.file.core.utils;
|
||||
|
||||
import cn.hutool.core.io.IoUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
@@ -6,20 +6,8 @@ import com.alibaba.ttl.TransmittableThreadLocal;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import lombok.SneakyThrows;
|
||||
import org.apache.tika.Tika;
|
||||
import org.jaudiotagger.audio.AudioFile;
|
||||
import org.jaudiotagger.audio.AudioFileIO;
|
||||
import org.jaudiotagger.audio.exceptions.CannotReadException;
|
||||
import org.jaudiotagger.audio.exceptions.CannotWriteException;
|
||||
import org.jaudiotagger.audio.exceptions.InvalidAudioFrameException;
|
||||
import org.jaudiotagger.audio.exceptions.ReadOnlyFileException;
|
||||
import org.jaudiotagger.tag.Tag;
|
||||
import org.jaudiotagger.tag.TagException;
|
||||
import org.jaudiotagger.tag.id3.AbstractID3v2Tag;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.net.URISyntaxException;
|
||||
import java.net.URL;
|
||||
import java.net.URLEncoder;
|
||||
|
||||
/**
|
||||
@@ -84,22 +72,4 @@ public class FileTypeUtils {
|
||||
// 输出附件
|
||||
IoUtil.write(response.getOutputStream(), false, content);
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws CannotReadException, TagException, InvalidAudioFrameException, ReadOnlyFileException, IOException, CannotWriteException, URISyntaxException {
|
||||
URL url = new URL("https://petshy.tashowz.com/admin-api/infra/file/29/get/jna2-雪球-难过焦虑.wav");
|
||||
File file = new File(url.getFile());
|
||||
System.out.println(file.exists());
|
||||
AudioFile audioFile = AudioFileIO.read(file);
|
||||
Tag tag = audioFile.getTag();
|
||||
if (tag instanceof AbstractID3v2Tag) {
|
||||
AbstractID3v2Tag id3v2Tag = (AbstractID3v2Tag) tag;
|
||||
// id3v2Tag.delete(); // 删除所有ID3标签
|
||||
} else {
|
||||
System.out.println("The file does not contain ID3v2 tags.");
|
||||
}
|
||||
AudioFileIO.write(audioFile); // 保存更改
|
||||
System.out.println("ID3 tags removed successfully.");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -9,4 +9,4 @@
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
package com.tashow.cloud.infra.framework.file;
|
||||
package com.tashow.cloud.file.framework.file;
|
||||
@@ -0,0 +1,6 @@
|
||||
/**
|
||||
* 属于 member 模块的 framework 封装
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
package com.tashow.cloud.user.framework;
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.tashow.cloud.file.framework.rpc.config;
|
||||
|
||||
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@EnableFeignClients(clients = {})
|
||||
public class RpcConfiguration {
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
/**
|
||||
* 占位
|
||||
*/
|
||||
package com.tashow.cloud.user.framework.rpc;
|
||||
@@ -1,10 +1,9 @@
|
||||
package com.tashow.cloud.infra.service.config;
|
||||
package com.tashow.cloud.file.service.config;
|
||||
|
||||
import com.tashow.cloud.common.pojo.PageResult;
|
||||
import com.tashow.cloud.infra.controller.admin.config.vo.ConfigPageReqVO;
|
||||
import com.tashow.cloud.infra.controller.admin.config.vo.ConfigSaveReqVO;
|
||||
import com.tashow.cloud.infra.dal.dataobject.config.ConfigDO;
|
||||
|
||||
import com.tashow.cloud.file.controller.admin.config.vo.ConfigPageReqVO;
|
||||
import com.tashow.cloud.file.controller.admin.config.vo.ConfigSaveReqVO;
|
||||
import com.tashow.cloud.file.dal.dataobject.config.ConfigDO;
|
||||
import jakarta.validation.Valid;
|
||||
|
||||
/**
|
||||
@@ -1,21 +1,21 @@
|
||||
package com.tashow.cloud.infra.service.config;
|
||||
package com.tashow.cloud.file.service.config;
|
||||
|
||||
import com.alibaba.nacos.shaded.com.google.common.annotations.VisibleForTesting;
|
||||
import com.tashow.cloud.common.pojo.PageResult;
|
||||
import com.tashow.cloud.infra.convert.config.ConfigConvert;
|
||||
import com.tashow.cloud.infra.enums.config.ConfigTypeEnum;
|
||||
import com.tashow.cloud.infra.controller.admin.config.vo.ConfigPageReqVO;
|
||||
import com.tashow.cloud.infra.controller.admin.config.vo.ConfigSaveReqVO;
|
||||
import com.tashow.cloud.infra.dal.dataobject.config.ConfigDO;
|
||||
import com.tashow.cloud.infra.dal.mysql.config.ConfigMapper;
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
import com.tashow.cloud.file.controller.admin.config.vo.ConfigPageReqVO;
|
||||
import com.tashow.cloud.file.controller.admin.config.vo.ConfigSaveReqVO;
|
||||
import com.tashow.cloud.file.convert.config.ConfigConvert;
|
||||
import com.tashow.cloud.file.dal.dataobject.config.ConfigDO;
|
||||
import com.tashow.cloud.file.dal.mysql.config.ConfigMapper;
|
||||
import com.tashow.cloud.file.enums.config.ConfigTypeEnum;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import jakarta.annotation.Resource;
|
||||
|
||||
import static com.tashow.cloud.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.tashow.cloud.infraapi.enums.ErrorCodeConstants.*;
|
||||
import static com.tashow.cloud.fileapi.enums.ErrorCodeConstants.*;
|
||||
|
||||
|
||||
/**
|
||||
* 参数配置 Service 实现类
|
||||
@@ -1,11 +1,10 @@
|
||||
package com.tashow.cloud.infra.service.file;
|
||||
package com.tashow.cloud.file.service.file;
|
||||
|
||||
import com.tashow.cloud.common.pojo.PageResult;
|
||||
import com.tashow.cloud.infra.controller.admin.file.vo.config.FileConfigPageReqVO;
|
||||
import com.tashow.cloud.infra.controller.admin.file.vo.config.FileConfigSaveReqVO;
|
||||
import com.tashow.cloud.infra.dal.dataobject.file.FileConfigDO;
|
||||
|
||||
import com.tashow.cloud.infra.framework.file.core.client.FileClient;
|
||||
import com.tashow.cloud.file.controller.admin.file.vo.config.FileConfigPageReqVO;
|
||||
import com.tashow.cloud.file.controller.admin.file.vo.config.FileConfigSaveReqVO;
|
||||
import com.tashow.cloud.file.dal.dataobject.file.FileConfigDO;
|
||||
import com.tashow.cloud.file.framework.file.core.client.FileClient;
|
||||
import jakarta.validation.Valid;
|
||||
|
||||
/**
|
||||
@@ -1,37 +1,31 @@
|
||||
package com.tashow.cloud.infra.service.file;
|
||||
package com.tashow.cloud.file.service.file;
|
||||
|
||||
import cn.hutool.core.io.resource.ResourceUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import com.tashow.cloud.common.pojo.PageResult;
|
||||
import com.tashow.cloud.common.util.json.JsonUtils;
|
||||
import com.tashow.cloud.common.util.validation.ValidationUtils;
|
||||
import com.tashow.cloud.infra.convert.file.FileConfigConvert;
|
||||
import com.tashow.cloud.infra.controller.admin.file.vo.config.FileConfigPageReqVO;
|
||||
import com.tashow.cloud.infra.controller.admin.file.vo.config.FileConfigSaveReqVO;
|
||||
import com.tashow.cloud.infra.dal.dataobject.file.FileConfigDO;
|
||||
import com.tashow.cloud.infra.dal.mysql.file.FileConfigMapper;
|
||||
import com.tashow.cloud.infra.framework.file.core.client.FileClient;
|
||||
import com.tashow.cloud.infra.framework.file.core.client.FileClientConfig;
|
||||
import com.tashow.cloud.infra.framework.file.core.client.FileClientFactory;
|
||||
import com.tashow.cloud.infra.framework.file.core.enums.FileStorageEnum;
|
||||
import com.google.common.cache.CacheLoader;
|
||||
import com.google.common.cache.LoadingCache;
|
||||
import lombok.Getter;
|
||||
import com.tashow.cloud.file.controller.admin.file.vo.config.FileConfigPageReqVO;
|
||||
import com.tashow.cloud.file.controller.admin.file.vo.config.FileConfigSaveReqVO;
|
||||
import com.tashow.cloud.file.convert.file.FileConfigConvert;
|
||||
import com.tashow.cloud.file.dal.dataobject.file.FileConfigDO;
|
||||
import com.tashow.cloud.file.dal.mysql.file.FileConfigMapper;
|
||||
import com.tashow.cloud.file.framework.file.core.client.FileClient;
|
||||
import com.tashow.cloud.file.framework.file.core.client.FileClientConfig;
|
||||
import com.tashow.cloud.file.framework.file.core.client.FileClientFactory;
|
||||
import com.tashow.cloud.file.framework.file.core.enums.FileStorageEnum;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.validation.Validator;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.validation.Validator;
|
||||
import java.time.Duration;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
import static com.tashow.cloud.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.tashow.cloud.common.util.cache.CacheUtils.buildAsyncReloadingCache;
|
||||
import static com.tashow.cloud.infraapi.enums.ErrorCodeConstants.FILE_CONFIG_DELETE_FAIL_MASTER;
|
||||
import static com.tashow.cloud.infraapi.enums.ErrorCodeConstants.FILE_CONFIG_NOT_EXISTS;
|
||||
import static com.tashow.cloud.fileapi.enums.ErrorCodeConstants.FILE_CONFIG_DELETE_FAIL_MASTER;
|
||||
import static com.tashow.cloud.fileapi.enums.ErrorCodeConstants.FILE_CONFIG_NOT_EXISTS;
|
||||
|
||||
/**
|
||||
* 文件配置 Service 实现类
|
||||
@@ -48,21 +42,21 @@ public class FileConfigServiceImpl implements FileConfigService {
|
||||
/**
|
||||
* {@link FileClient} 缓存,通过它异步刷新 fileClientFactory
|
||||
*/
|
||||
@Getter
|
||||
private final LoadingCache<Long, FileClient> clientCache = buildAsyncReloadingCache(Duration.ofSeconds(10L),
|
||||
new CacheLoader<Long, FileClient>() {
|
||||
|
||||
@Override
|
||||
public FileClient load(Long id) {
|
||||
FileConfigDO config = Objects.equals(CACHE_MASTER_ID, id) ?
|
||||
fileConfigMapper.selectByMaster() : fileConfigMapper.selectById(id);
|
||||
if (config != null) {
|
||||
fileClientFactory.createOrUpdateFileClient(config.getId(), config.getStorage(), config.getConfig());
|
||||
}
|
||||
return fileClientFactory.getFileClient(null == config ? id : config.getId());
|
||||
}
|
||||
|
||||
});
|
||||
// @Getter
|
||||
// private final LoadingCache<Long, FileClient> clientCache = buildAsyncReloadingCache(Duration.ofSeconds(10L),
|
||||
// new CacheLoader<Long, FileClient>() {
|
||||
//
|
||||
// @Override
|
||||
// public FileClient load(Long id) {
|
||||
// FileConfigDO config = Objects.equals(CACHE_MASTER_ID, id) ?
|
||||
// fileConfigMapper.selectByMaster() : fileConfigMapper.selectById(id);
|
||||
// if (config != null) {
|
||||
// fileClientFactory.createOrUpdateFileClient(config.getId(), config.getStorage(), config.getConfig());
|
||||
// }
|
||||
// return fileClientFactory.getFileClient(null == config ? id : config.getId());
|
||||
// }
|
||||
//
|
||||
// });
|
||||
|
||||
@Resource
|
||||
private FileClientFactory fileClientFactory;
|
||||
@@ -141,12 +135,12 @@ public class FileConfigServiceImpl implements FileConfigService {
|
||||
* @param master 是否主配置
|
||||
*/
|
||||
private void clearCache(Long id, Boolean master) {
|
||||
if (id != null) {
|
||||
clientCache.invalidate(id);
|
||||
}
|
||||
if (Boolean.TRUE.equals(master)) {
|
||||
clientCache.invalidate(CACHE_MASTER_ID);
|
||||
}
|
||||
// if (id != null) {
|
||||
// clientCache.invalidate(id);
|
||||
// }
|
||||
// if (Boolean.TRUE.equals(master)) {
|
||||
// clientCache.invalidate(CACHE_MASTER_ID);
|
||||
// }
|
||||
}
|
||||
|
||||
private FileConfigDO validateFileConfigExists(Long id) {
|
||||
@@ -178,12 +172,12 @@ public class FileConfigServiceImpl implements FileConfigService {
|
||||
|
||||
@Override
|
||||
public FileClient getFileClient(Long id) {
|
||||
return clientCache.getUnchecked(id);
|
||||
return null;// clientCache.getUnchecked(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FileClient getMasterFileClient() {
|
||||
return clientCache.getUnchecked(CACHE_MASTER_ID);
|
||||
return null;// clientCache.getUnchecked(CACHE_MASTER_ID);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,10 +1,10 @@
|
||||
package com.tashow.cloud.infra.service.file;
|
||||
package com.tashow.cloud.file.service.file;
|
||||
|
||||
import com.tashow.cloud.common.pojo.PageResult;
|
||||
import com.tashow.cloud.infra.controller.admin.file.vo.file.FileCreateReqVO;
|
||||
import com.tashow.cloud.infra.controller.admin.file.vo.file.FilePageReqVO;
|
||||
import com.tashow.cloud.infra.controller.admin.file.vo.file.FilePresignedUrlRespVO;
|
||||
import com.tashow.cloud.infra.dal.dataobject.file.FileDO;
|
||||
import com.tashow.cloud.file.controller.admin.file.vo.file.FileCreateReqVO;
|
||||
import com.tashow.cloud.file.controller.admin.file.vo.file.FilePageReqVO;
|
||||
import com.tashow.cloud.file.controller.admin.file.vo.file.FilePresignedUrlRespVO;
|
||||
import com.tashow.cloud.file.dal.dataobject.file.FileDO;
|
||||
|
||||
/**
|
||||
* 文件 Service 接口
|
||||
@@ -1,24 +1,25 @@
|
||||
package com.tashow.cloud.infra.service.file;
|
||||
package com.tashow.cloud.file.service.file;
|
||||
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.tashow.cloud.common.pojo.PageResult;
|
||||
import com.tashow.cloud.common.util.io.FileUtils;
|
||||
import com.tashow.cloud.common.util.object.BeanUtils;
|
||||
import com.tashow.cloud.infra.controller.admin.file.vo.file.FileCreateReqVO;
|
||||
import com.tashow.cloud.infra.controller.admin.file.vo.file.FilePageReqVO;
|
||||
import com.tashow.cloud.infra.controller.admin.file.vo.file.FilePresignedUrlRespVO;
|
||||
import com.tashow.cloud.infra.dal.dataobject.file.FileDO;
|
||||
import com.tashow.cloud.infra.dal.mysql.file.FileMapper;
|
||||
import com.tashow.cloud.infra.framework.file.core.client.FileClient;
|
||||
import com.tashow.cloud.infra.framework.file.core.client.s3.FilePresignedUrlRespDTO;
|
||||
import com.tashow.cloud.infra.framework.file.core.utils.FileTypeUtils;
|
||||
import com.tashow.cloud.file.controller.admin.file.vo.file.FileCreateReqVO;
|
||||
import com.tashow.cloud.file.controller.admin.file.vo.file.FilePageReqVO;
|
||||
import com.tashow.cloud.file.controller.admin.file.vo.file.FilePresignedUrlRespVO;
|
||||
import com.tashow.cloud.file.dal.dataobject.file.FileDO;
|
||||
import com.tashow.cloud.file.dal.mysql.file.FileMapper;
|
||||
import com.tashow.cloud.file.framework.file.core.client.FileClient;
|
||||
import com.tashow.cloud.file.framework.file.core.client.s3.FilePresignedUrlRespDTO;
|
||||
import com.tashow.cloud.file.framework.file.core.utils.FileTypeUtils;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.SneakyThrows;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import static com.tashow.cloud.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.tashow.cloud.infraapi.enums.ErrorCodeConstants.FILE_NOT_EXISTS;
|
||||
import static com.tashow.cloud.fileapi.enums.ErrorCodeConstants.FILE_NOT_EXISTS;
|
||||
|
||||
|
||||
/**
|
||||
* 文件 Service 实现类
|
||||
@@ -0,0 +1 @@
|
||||
package com.tashow.cloud.file.service;
|
||||
@@ -0,0 +1,19 @@
|
||||
--- #################### 注册中心 + 配置中心相关配置 ####################
|
||||
|
||||
spring:
|
||||
cloud:
|
||||
nacos:
|
||||
server-addr: 43.139.42.137:8848 # Nacos 服务器地址
|
||||
username: nacos # Nacos 账号
|
||||
password: nacos # Nacos 密码
|
||||
discovery: # 【配置中心】配置项
|
||||
namespace: dev # 命名空间。这里使用 dev 开发环境
|
||||
group: DEFAULT_GROUP # 使用的 Nacos 配置分组,默认为 DEFAULT_GROUP
|
||||
metadata:
|
||||
version: 1.0.0 # 服务实例的版本号,可用于灰度发布
|
||||
config: # 【注册中心】配置项
|
||||
namespace: dev # 命名空间。这里使用 dev 开发环境
|
||||
group: DEFAULT_GROUP # 使用的 Nacos 配置分组,默认为 DEFAULT_GROUP
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
server:
|
||||
port: 48090
|
||||
spring:
|
||||
application:
|
||||
name: file-server
|
||||
|
||||
profiles:
|
||||
active: local
|
||||
|
||||
main:
|
||||
allow-circular-references: true # 允许循环依赖,因为项目是三层架构,无法避免这个情况。
|
||||
allow-bean-definition-overriding: true # 允许 Bean 覆盖,例如说 Feign 等会存在重复定义的服务
|
||||
|
||||
config:
|
||||
import:
|
||||
- optional:classpath:application-${spring.profiles.active}.yaml # 加载【本地】配置
|
||||
- optional:nacos:${spring.application.name}-${spring.profiles.active}.yaml # 加载【Nacos】的配置
|
||||
- optional:nacos:application.yaml # 加载【Nacos】的配置
|
||||
@@ -0,0 +1,76 @@
|
||||
<configuration>
|
||||
<!-- 引用 Spring Boot 的 logback 基础配置 -->
|
||||
<include resource="org/springframework/boot/logging/logback/defaults.xml" />
|
||||
<!-- 变量 tashow.info.base-package,基础业务包 -->
|
||||
<springProperty scope="context" name="tashow.info.base-package" source="tashow.info.base-package"/>
|
||||
<!-- 格式化输出:%d 表示日期,%X{tid} SkWalking 链路追踪编号,%thread 表示线程名,%-5level:级别从左显示 5 个字符宽度,%msg:日志消息,%n是换行符 -->
|
||||
<property name="PATTERN_DEFAULT" value="%d{${LOG_DATEFORMAT_PATTERN:-yyyy-MM-dd HH:mm:ss.SSS}} | %highlight(${LOG_LEVEL_PATTERN:-%5p} ${PID:- }) | %boldYellow(%thread [%tid]) %boldGreen(%-40.40logger{39}) | %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}"/>
|
||||
|
||||
<!-- 控制台 Appender -->
|
||||
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
|
||||
<layout class="org.apache.skywalking.apm.toolkit.log.logback.v1.x.TraceIdPatternLogbackLayout">
|
||||
<pattern>${PATTERN_DEFAULT}</pattern>
|
||||
</layout>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!-- 文件 Appender -->
|
||||
<!-- 参考 Spring Boot 的 file-appender.xml 编写 -->
|
||||
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
|
||||
<layout class="org.apache.skywalking.apm.toolkit.log.logback.v1.x.TraceIdPatternLogbackLayout">
|
||||
<pattern>${PATTERN_DEFAULT}</pattern>
|
||||
</layout>
|
||||
</encoder>
|
||||
<!-- 日志文件名 -->
|
||||
<file>${LOG_FILE}</file>
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||
<!-- 滚动后的日志文件名 -->
|
||||
<fileNamePattern>${LOGBACK_ROLLINGPOLICY_FILE_NAME_PATTERN:-${LOG_FILE}.%d{yyyy-MM-dd}.%i.gz}</fileNamePattern>
|
||||
<!-- 启动服务时,是否清理历史日志,一般不建议清理 -->
|
||||
<cleanHistoryOnStart>${LOGBACK_ROLLINGPOLICY_CLEAN_HISTORY_ON_START:-false}</cleanHistoryOnStart>
|
||||
<!-- 日志文件,到达多少容量,进行滚动 -->
|
||||
<maxFileSize>${LOGBACK_ROLLINGPOLICY_MAX_FILE_SIZE:-10MB}</maxFileSize>
|
||||
<!-- 日志文件的总大小,0 表示不限制 -->
|
||||
<totalSizeCap>${LOGBACK_ROLLINGPOLICY_TOTAL_SIZE_CAP:-0}</totalSizeCap>
|
||||
<!-- 日志文件的保留天数 -->
|
||||
<maxHistory>${LOGBACK_ROLLINGPOLICY_MAX_HISTORY:-30}</maxHistory>
|
||||
</rollingPolicy>
|
||||
</appender>
|
||||
<!-- 异步写入日志,提升性能 -->
|
||||
<appender name="ASYNC" class="ch.qos.logback.classic.AsyncAppender">
|
||||
<!-- 不丢失日志。默认的,如果队列的 80% 已满,则会丢弃 TRACT、DEBUG、INFO 级别的日志 -->
|
||||
<discardingThreshold>0</discardingThreshold>
|
||||
<!-- 更改默认的队列的深度,该值会影响性能。默认值为 256 -->
|
||||
<queueSize>256</queueSize>
|
||||
<appender-ref ref="FILE"/>
|
||||
</appender>
|
||||
|
||||
<!-- SkyWalking GRPC 日志收集,实现日志中心。注意:SkyWalking 8.4.0 版本开始支持 -->
|
||||
<appender name="GRPC" class="org.apache.skywalking.apm.toolkit.log.logback.v1.x.log.GRPCLogClientAppender">
|
||||
<encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
|
||||
<layout class="org.apache.skywalking.apm.toolkit.log.logback.v1.x.TraceIdPatternLogbackLayout">
|
||||
<pattern>${PATTERN_DEFAULT}</pattern>
|
||||
</layout>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!-- 本地环境 -->
|
||||
<springProfile name="local">
|
||||
<root level="INFO">
|
||||
<appender-ref ref="STDOUT"/>
|
||||
<appender-ref ref="GRPC"/> <!-- 本地环境下,如果不想接入 SkyWalking 日志服务,可以注释掉本行 -->
|
||||
<appender-ref ref="ASYNC"/> <!-- 本地环境下,如果不想打印日志,可以注释掉本行 -->
|
||||
</root>
|
||||
</springProfile>
|
||||
<!-- 其它环境 -->
|
||||
<springProfile name="dev,test,stage,prod,default">
|
||||
<root level="INFO">
|
||||
<appender-ref ref="STDOUT"/>
|
||||
<appender-ref ref="ASYNC"/>
|
||||
<appender-ref ref="GRPC"/>
|
||||
</root>
|
||||
</springProfile>
|
||||
|
||||
</configuration>
|
||||
@@ -1,9 +1,5 @@
|
||||
package com.tashow.cloud.infra.controller.admin.codegen;
|
||||
|
||||
import static com.tashow.cloud.common.pojo.CommonResult.success;
|
||||
import static com.tashow.cloud.infra.framework.file.core.utils.FileTypeUtils.writeAttachment;
|
||||
import static com.tashow.cloud.security.security.core.util.SecurityFrameworkUtils.getLoginUserId;
|
||||
|
||||
import cn.hutool.core.io.IoUtil;
|
||||
import cn.hutool.core.util.ZipUtil;
|
||||
import com.tashow.cloud.common.pojo.CommonResult;
|
||||
@@ -23,14 +19,19 @@ import com.tashow.cloud.infra.service.codegen.CodegenService;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.validation.Valid;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import static com.tashow.cloud.common.pojo.CommonResult.success;
|
||||
import static com.tashow.cloud.common.util.io.FileTypeUtils.writeAttachment;
|
||||
import static com.tashow.cloud.security.security.core.util.SecurityFrameworkUtils.getLoginUserId;
|
||||
|
||||
/** 管理后台 - 代码生成器 */
|
||||
@RestController
|
||||
|
||||
@@ -1,99 +0,0 @@
|
||||
package com.tashow.cloud.infra.controller.admin.config;
|
||||
|
||||
import static com.tashow.cloud.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.tashow.cloud.common.pojo.CommonResult.success;
|
||||
import static com.tashow.cloud.web.apilog.core.enums.OperateTypeEnum.EXPORT;
|
||||
|
||||
import com.tashow.cloud.common.pojo.CommonResult;
|
||||
import com.tashow.cloud.common.pojo.PageParam;
|
||||
import com.tashow.cloud.common.pojo.PageResult;
|
||||
import com.tashow.cloud.excel.excel.core.util.ExcelUtils;
|
||||
import com.tashow.cloud.infra.controller.admin.config.vo.ConfigPageReqVO;
|
||||
import com.tashow.cloud.infra.controller.admin.config.vo.ConfigRespVO;
|
||||
import com.tashow.cloud.infra.controller.admin.config.vo.ConfigSaveReqVO;
|
||||
import com.tashow.cloud.infra.convert.config.ConfigConvert;
|
||||
import com.tashow.cloud.infra.dal.dataobject.config.ConfigDO;
|
||||
import com.tashow.cloud.infra.service.config.ConfigService;
|
||||
import com.tashow.cloud.infraapi.enums.ErrorCodeConstants;
|
||||
import com.tashow.cloud.web.apilog.core.annotation.ApiAccessLog;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.validation.Valid;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/** 管理后台 - 参数配置 */
|
||||
@RestController
|
||||
@RequestMapping("/infra/config")
|
||||
@Validated
|
||||
public class ConfigController {
|
||||
|
||||
@Resource private ConfigService configService;
|
||||
|
||||
/** 创建参数配置 */
|
||||
@PostMapping("/create")
|
||||
@PreAuthorize("@ss.hasPermission('infra:config:create')")
|
||||
public CommonResult<Long> createConfig(@Valid @RequestBody ConfigSaveReqVO createReqVO) {
|
||||
return success(configService.createConfig(createReqVO));
|
||||
}
|
||||
|
||||
/** 修改参数配置 */
|
||||
@PutMapping("/update")
|
||||
@PreAuthorize("@ss.hasPermission('infra:config:update')")
|
||||
public CommonResult<Boolean> updateConfig(@Valid @RequestBody ConfigSaveReqVO updateReqVO) {
|
||||
configService.updateConfig(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
/** 删除参数配置 */
|
||||
@DeleteMapping("/delete")
|
||||
@PreAuthorize("@ss.hasPermission('infra:config:delete')")
|
||||
public CommonResult<Boolean> deleteConfig(@RequestParam("id") Long id) {
|
||||
configService.deleteConfig(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
/** 获得参数配置 */
|
||||
@GetMapping(value = "/get")
|
||||
@PreAuthorize("@ss.hasPermission('infra:config:query')")
|
||||
public CommonResult<ConfigRespVO> getConfig(@RequestParam("id") Long id) {
|
||||
return success(ConfigConvert.INSTANCE.convert(configService.getConfig(id)));
|
||||
}
|
||||
|
||||
/** 根据参数键名查询参数值", description = "不可见的配置,不允许返回给前端 */
|
||||
@GetMapping(value = "/get-value-by-key")
|
||||
public CommonResult<String> getConfigKey(@RequestParam("key") String key) {
|
||||
ConfigDO config = configService.getConfigByKey(key);
|
||||
if (config == null) {
|
||||
return success(null);
|
||||
}
|
||||
if (!config.getVisible()) {
|
||||
throw exception(ErrorCodeConstants.CONFIG_GET_VALUE_ERROR_IF_VISIBLE);
|
||||
}
|
||||
return success(config.getValue());
|
||||
}
|
||||
|
||||
/** 获取参数配置分页 */
|
||||
@GetMapping("/page")
|
||||
@PreAuthorize("@ss.hasPermission('infra:config:query')")
|
||||
public CommonResult<PageResult<ConfigRespVO>> getConfigPage(@Valid ConfigPageReqVO pageReqVO) {
|
||||
PageResult<ConfigDO> page = configService.getConfigPage(pageReqVO);
|
||||
return success(ConfigConvert.INSTANCE.convertPage(page));
|
||||
}
|
||||
|
||||
/** 导出参数配置 */
|
||||
@GetMapping("/export")
|
||||
@PreAuthorize("@ss.hasPermission('infra:config:export')")
|
||||
@ApiAccessLog(operateType = EXPORT)
|
||||
public void exportConfig(ConfigPageReqVO exportReqVO, HttpServletResponse response)
|
||||
throws IOException {
|
||||
exportReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<ConfigDO> list = configService.getConfigPage(exportReqVO).getList();
|
||||
// 输出
|
||||
ExcelUtils.write(
|
||||
response, "参数配置.xls", "数据", ConfigRespVO.class, ConfigConvert.INSTANCE.convertList(list));
|
||||
}
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
package com.tashow.cloud.infra.controller.admin.config.vo;
|
||||
|
||||
import static com.tashow.cloud.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
import com.tashow.cloud.common.pojo.PageParam;
|
||||
import java.time.LocalDateTime;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
/** 管理后台 - 参数配置分页 Request VO */
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class ConfigPageReqVO extends PageParam {
|
||||
|
||||
/** 数据源名称,模糊匹配 */
|
||||
private String name;
|
||||
|
||||
/** 参数键名,模糊匹配 */
|
||||
private String key;
|
||||
|
||||
/** 参数类型,参见 SysConfigTypeEnum 枚举 */
|
||||
private Integer type;
|
||||
|
||||
/** 创建时间 */
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
}
|
||||
@@ -1,53 +0,0 @@
|
||||
package com.tashow.cloud.infra.controller.admin.config.vo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.tashow.cloud.excel.excel.core.annotations.DictFormat;
|
||||
import com.tashow.cloud.excel.excel.core.convert.DictConvert;
|
||||
import com.tashow.cloud.infraapi.enums.DictTypeConstants;
|
||||
import java.time.LocalDateTime;
|
||||
import lombok.Data;
|
||||
|
||||
/** 管理后台 - 参数配置信息 Response VO */
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class ConfigRespVO {
|
||||
|
||||
/** 参数配置序号" */
|
||||
@ExcelProperty("参数配置序号")
|
||||
private Long id;
|
||||
|
||||
/** 参数分类" */
|
||||
@ExcelProperty("参数分类")
|
||||
private String category;
|
||||
|
||||
/** 参数名称", example = "数据库名 */
|
||||
@ExcelProperty("参数名称")
|
||||
private String name;
|
||||
|
||||
/** 参数键名" */
|
||||
@ExcelProperty("参数键名")
|
||||
private String key;
|
||||
|
||||
/** 参数键值" */
|
||||
@ExcelProperty("参数键值")
|
||||
private String value;
|
||||
|
||||
/** 参数类型,参见 SysConfigTypeEnum 枚举" */
|
||||
@ExcelProperty(value = "参数类型", converter = DictConvert.class)
|
||||
@DictFormat(DictTypeConstants.CONFIG_TYPE)
|
||||
private Integer type;
|
||||
|
||||
/** 是否可见" */
|
||||
@ExcelProperty(value = "是否可见", converter = DictConvert.class)
|
||||
@DictFormat(DictTypeConstants.BOOLEAN_STRING)
|
||||
private Boolean visible;
|
||||
|
||||
/** 备注 */
|
||||
@ExcelProperty("备注")
|
||||
private String remark;
|
||||
|
||||
/** 创建时间", example = "时间戳格式 */
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
package com.tashow.cloud.infra.controller.admin.config.vo;
|
||||
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import lombok.Data;
|
||||
|
||||
/** 管理后台 - 参数配置创建/修改 Request VO */
|
||||
@Data
|
||||
public class ConfigSaveReqVO {
|
||||
|
||||
/** 参数配置序号 */
|
||||
private Long id;
|
||||
|
||||
/** 参数分组" */
|
||||
@NotEmpty(message = "参数分组不能为空")
|
||||
@Size(max = 50, message = "参数名称不能超过 50 个字符")
|
||||
private String category;
|
||||
|
||||
/** 参数名称", example = "数据库名 */
|
||||
@NotBlank(message = "参数名称不能为空")
|
||||
@Size(max = 100, message = "参数名称不能超过 100 个字符")
|
||||
private String name;
|
||||
|
||||
/** 参数键名" */
|
||||
@NotBlank(message = "参数键名长度不能为空")
|
||||
@Size(max = 100, message = "参数键名长度不能超过 100 个字符")
|
||||
private String key;
|
||||
|
||||
/** 参数键值" */
|
||||
@NotBlank(message = "参数键值不能为空")
|
||||
@Size(max = 500, message = "参数键值长度不能超过 500 个字符")
|
||||
private String value;
|
||||
|
||||
/** 是否可见" */
|
||||
@NotNull(message = "是否可见不能为空")
|
||||
private Boolean visible;
|
||||
|
||||
/** 备注 */
|
||||
private String remark;
|
||||
}
|
||||
@@ -1,45 +0,0 @@
|
||||
### 请求 /infra/file-config/create 接口 => 成功
|
||||
POST {{baseUrl}}/infra/file-config/create
|
||||
Content-Type: application/json
|
||||
tenant-id: {{adminTenantId}}
|
||||
Authorization: Bearer {{token}}
|
||||
|
||||
{
|
||||
"name": "S3 - 七牛云",
|
||||
"remark": "",
|
||||
"storage": 20,
|
||||
"config": {
|
||||
"accessKey": "b7yvuhBSAGjmtPhMFcn9iMOxUOY_I06cA_p0ZUx8",
|
||||
"accessSecret": "kXM1l5ia1RvSX3QaOEcwI3RLz3Y2rmNszWonKZtP",
|
||||
"bucket": "ruoyi-vue-pro",
|
||||
"endpoint": "s3-cn-south-1.qiniucs.com",
|
||||
"domain": "http://test.yudao.iocoder.cn",
|
||||
"region": "oss-cn-beijing"
|
||||
}
|
||||
}
|
||||
|
||||
### 请求 /infra/file-config/update 接口 => 成功
|
||||
PUT {{baseUrl}}/infra/file-config/update
|
||||
Content-Type: application/json
|
||||
tenant-id: {{adminTenantId}}
|
||||
Authorization: Bearer {{token}}
|
||||
|
||||
{
|
||||
"id": 2,
|
||||
"name": "S3 - 七牛云",
|
||||
"remark": "",
|
||||
"config": {
|
||||
"accessKey": "b7yvuhBSAGjmtPhMFcn9iMOxUOY_I06cA_p0ZUx8",
|
||||
"accessSecret": "kXM1l5ia1RvSX3QaOEcwI3RLz3Y2rmNszWonKZtP",
|
||||
"bucket": "ruoyi-vue-pro",
|
||||
"endpoint": "s3-cn-south-1.qiniucs.com",
|
||||
"domain": "http://test.yudao.iocoder.cn",
|
||||
"region": "oss-cn-beijing"
|
||||
}
|
||||
}
|
||||
|
||||
### 请求 /infra/file-config/test 接口 => 成功
|
||||
GET {{baseUrl}}/infra/file-config/test?id=2
|
||||
Content-Type: application/json
|
||||
tenant-id: {{adminTenantId}}
|
||||
Authorization: Bearer {{token}}
|
||||
@@ -1,25 +0,0 @@
|
||||
package com.tashow.cloud.infra.framework.file.config;
|
||||
|
||||
import com.tashow.cloud.infra.framework.file.core.client.FileClientFactory;
|
||||
import com.tashow.cloud.infra.framework.file.core.client.FileClientFactoryImpl;
|
||||
import com.tashow.cloud.infra.framework.file.core.client.FileClientFactory;
|
||||
import com.tashow.cloud.infra.framework.file.core.client.FileClientFactoryImpl;
|
||||
import com.tashow.cloud.infra.framework.file.core.client.FileClientFactory;
|
||||
import com.tashow.cloud.infra.framework.file.core.client.FileClientFactoryImpl;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* 文件配置类
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
public class YudaoFileAutoConfiguration {
|
||||
|
||||
@Bean
|
||||
public FileClientFactory fileClientFactory() {
|
||||
return new FileClientFactoryImpl();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,73 +0,0 @@
|
||||
package com.tashow.cloud.infra.framework.file.core.enums;
|
||||
|
||||
import cn.hutool.core.util.ArrayUtil;
|
||||
import com.tashow.cloud.infra.framework.file.core.client.db.DBFileClient;
|
||||
import com.tashow.cloud.infra.framework.file.core.client.db.DBFileClientConfig;
|
||||
import com.tashow.cloud.infra.framework.file.core.client.ftp.FtpFileClient;
|
||||
import com.tashow.cloud.infra.framework.file.core.client.ftp.FtpFileClientConfig;
|
||||
import com.tashow.cloud.infra.framework.file.core.client.local.LocalFileClient;
|
||||
import com.tashow.cloud.infra.framework.file.core.client.s3.S3FileClient;
|
||||
import com.tashow.cloud.infra.framework.file.core.client.s3.S3FileClientConfig;
|
||||
import com.tashow.cloud.infra.framework.file.core.client.sftp.SftpFileClient;
|
||||
import com.tashow.cloud.infra.framework.file.core.client.sftp.SftpFileClientConfig;
|
||||
import com.tashow.cloud.infra.framework.file.core.client.FileClient;
|
||||
import com.tashow.cloud.infra.framework.file.core.client.FileClientConfig;
|
||||
import com.tashow.cloud.infra.framework.file.core.client.db.DBFileClient;
|
||||
import com.tashow.cloud.infra.framework.file.core.client.db.DBFileClientConfig;
|
||||
import com.tashow.cloud.infra.framework.file.core.client.ftp.FtpFileClient;
|
||||
import com.tashow.cloud.infra.framework.file.core.client.ftp.FtpFileClientConfig;
|
||||
import com.tashow.cloud.infra.framework.file.core.client.local.LocalFileClient;
|
||||
import com.tashow.cloud.infra.framework.file.core.client.local.LocalFileClientConfig;
|
||||
import com.tashow.cloud.infra.framework.file.core.client.s3.S3FileClient;
|
||||
import com.tashow.cloud.infra.framework.file.core.client.s3.S3FileClientConfig;
|
||||
import com.tashow.cloud.infra.framework.file.core.client.sftp.SftpFileClient;
|
||||
import com.tashow.cloud.infra.framework.file.core.client.sftp.SftpFileClientConfig;
|
||||
import com.tashow.cloud.infra.framework.file.core.client.db.DBFileClient;
|
||||
import com.tashow.cloud.infra.framework.file.core.client.db.DBFileClientConfig;
|
||||
import com.tashow.cloud.infra.framework.file.core.client.ftp.FtpFileClient;
|
||||
import com.tashow.cloud.infra.framework.file.core.client.ftp.FtpFileClientConfig;
|
||||
import com.tashow.cloud.infra.framework.file.core.client.local.LocalFileClient;
|
||||
import com.tashow.cloud.infra.framework.file.core.client.s3.S3FileClient;
|
||||
import com.tashow.cloud.infra.framework.file.core.client.s3.S3FileClientConfig;
|
||||
import com.tashow.cloud.infra.framework.file.core.client.sftp.SftpFileClient;
|
||||
import com.tashow.cloud.infra.framework.file.core.client.sftp.SftpFileClientConfig;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 文件存储器枚举
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
public enum FileStorageEnum {
|
||||
|
||||
DB(1, DBFileClientConfig.class, DBFileClient.class),
|
||||
|
||||
LOCAL(10, LocalFileClientConfig.class, LocalFileClient.class),
|
||||
FTP(11, FtpFileClientConfig.class, FtpFileClient.class),
|
||||
SFTP(12, SftpFileClientConfig.class, SftpFileClient.class),
|
||||
|
||||
S3(20, S3FileClientConfig.class, S3FileClient.class),
|
||||
;
|
||||
|
||||
/**
|
||||
* 存储器
|
||||
*/
|
||||
private final Integer storage;
|
||||
|
||||
/**
|
||||
* 配置类
|
||||
*/
|
||||
private final Class<? extends FileClientConfig> configClass;
|
||||
/**
|
||||
* 客户端类
|
||||
*/
|
||||
private final Class<? extends FileClient> clientClass;
|
||||
|
||||
public static FileStorageEnum getByStorage(Integer storage) {
|
||||
return ArrayUtil.firstMatch(o -> o.getStorage().equals(storage), values());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,7 +2,6 @@ package com.tashow.cloud.pay.job.notify;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.tashow.cloud.pay.service.notify.PayNotifyService;
|
||||
import com.tashow.cloud.tenant.core.job.TenantJob;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
@@ -21,7 +20,6 @@ public class PayNotifyJob {
|
||||
private PayNotifyService payNotifyService;
|
||||
|
||||
// @XxlJob("payNotifyJob")
|
||||
@TenantJob // 多租户
|
||||
public String execute() throws Exception {
|
||||
int notifyCount = payNotifyService.executeNotify();
|
||||
log.info("[execute][执行支付通知 ({}) 个]", notifyCount);
|
||||
|
||||
@@ -2,7 +2,6 @@ package com.tashow.cloud.pay.job.order;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.tashow.cloud.pay.service.order.PayOrderService;
|
||||
import com.tashow.cloud.tenant.core.job.TenantJob;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
@@ -22,7 +21,6 @@ public class PayOrderExpireJob {
|
||||
private PayOrderService orderService;
|
||||
|
||||
// @XxlJob("payOrderExpireJob")
|
||||
@TenantJob // 多租户
|
||||
public String execute(String param) {
|
||||
int count = orderService.expireOrder();
|
||||
log.info("[execute][支付过期 ({}) 个]", count);
|
||||
|
||||
@@ -2,7 +2,6 @@ package com.tashow.cloud.pay.job.order;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.tashow.cloud.pay.service.order.PayOrderService;
|
||||
import com.tashow.cloud.tenant.core.job.TenantJob;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
@@ -34,7 +33,6 @@ public class PayOrderSyncJob {
|
||||
private PayOrderService orderService;
|
||||
|
||||
// @XxlJob("payOrderSyncJob")
|
||||
@TenantJob // 多租户
|
||||
public String execute() {
|
||||
LocalDateTime minCreateTime = LocalDateTime.now().minus(CREATE_TIME_DURATION_BEFORE);
|
||||
int count = orderService.syncOrder(minCreateTime);
|
||||
|
||||
@@ -2,7 +2,6 @@ package com.tashow.cloud.pay.job.refund;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.tashow.cloud.pay.service.refund.PayRefundService;
|
||||
import com.tashow.cloud.tenant.core.job.TenantJob;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
@@ -22,7 +21,6 @@ public class PayRefundSyncJob {
|
||||
private PayRefundService refundService;
|
||||
|
||||
// @XxlJob("payRefundSyncJob")
|
||||
@TenantJob // 多租户
|
||||
public String execute() {
|
||||
int count = refundService.syncRefund();
|
||||
log.info("[execute][同步退款订单 ({}) 个]", count);
|
||||
|
||||
@@ -2,7 +2,6 @@ package com.tashow.cloud.pay.job.transfer;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.tashow.cloud.pay.service.transfer.PayTransferService;
|
||||
import com.tashow.cloud.tenant.core.job.TenantJob;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
@@ -22,7 +21,6 @@ public class PayTransferSyncJob {
|
||||
private PayTransferService transferService;
|
||||
|
||||
// @XxlJob("payTransferSyncJob")
|
||||
@TenantJob // 多租户
|
||||
public String execute(String param) {
|
||||
int count = transferService.syncTransfer();
|
||||
log.info("[execute][同步转账订单 ({}) 个]", count);
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.tashow.cloud.system.job.demo;
|
||||
|
||||
import com.tashow.cloud.tenant.core.job.TenantJob;
|
||||
import com.xxl.job.core.handler.annotation.XxlJob;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@@ -8,7 +7,6 @@ import org.springframework.stereotype.Component;
|
||||
public class DemoJob {
|
||||
|
||||
@XxlJob("demoJob")
|
||||
@TenantJob
|
||||
public void execute() {
|
||||
System.out.println("美滋滋");
|
||||
}
|
||||
|
||||
@@ -3,8 +3,6 @@ package com.tashow.cloud.trade.controller.admin.order;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.tashow.cloud.common.pojo.CommonResult;
|
||||
import com.tashow.cloud.common.pojo.PageResult;
|
||||
import com.tashow.cloud.userapi.api.user.UserMemberApi;
|
||||
import com.tashow.cloud.userapi.api.user.dto.UserMemberRespDTO;
|
||||
import com.tashow.cloud.productapi.api.product.ProdApi;
|
||||
import com.tashow.cloud.productapi.api.product.dto.ProdDO;
|
||||
import com.tashow.cloud.trade.controller.admin.order.vo.*;
|
||||
@@ -16,10 +14,12 @@ import com.tashow.cloud.trade.dal.dataobject.order.TradeOrderSubLogDO;
|
||||
import com.tashow.cloud.trade.service.order.TradeOrderLogService;
|
||||
import com.tashow.cloud.trade.service.order.TradeOrderQueryService;
|
||||
import com.tashow.cloud.trade.service.order.TradeOrderUpdateService;
|
||||
import com.tashow.cloud.userapi.api.user.UserMemberApi;
|
||||
import com.tashow.cloud.userapi.api.user.dto.UserMemberRespDTO;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.annotation.security.PermitAll;
|
||||
import jakarta.validation.Valid;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@@ -48,7 +48,7 @@ public class TradeOrderController {
|
||||
private TradeOrderLogService tradeOrderLogService;
|
||||
|
||||
@Resource
|
||||
private UserMemberApi memberUserApi;
|
||||
private UserMemberApi userMemberApi;
|
||||
@Resource
|
||||
private ProdApi prodApi;
|
||||
|
||||
@@ -59,8 +59,7 @@ public class TradeOrderController {
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/page")
|
||||
@PermitAll
|
||||
// @PreAuthorize("@ss.hasPermission('trade:order:query')")
|
||||
@PreAuthorize("@ss.hasPermission('trade:order:query')")
|
||||
public CommonResult<PageResult<TradeOrderPageRespVO>> getOrderPage(@Valid TradeOrderPageReqVO reqVO) {
|
||||
// 查询订单
|
||||
PageResult<TradeOrderDO> pageResult = tradeOrderQueryService.getOrderPage(reqVO);
|
||||
@@ -71,7 +70,7 @@ public class TradeOrderController {
|
||||
List<TradeOrderItemDO> orderItems = tradeOrderQueryService.getOrderItemListByOrderId(
|
||||
convertSet(pageResult.getList(), TradeOrderDO::getId));
|
||||
//查询用户信息
|
||||
Map<Long, UserMemberRespDTO> userMap = memberUserApi.getUserMap(convertList(pageResult.getList(), TradeOrderDO::getUserId));
|
||||
Map<Long, UserMemberRespDTO> userMap = userMemberApi.getUserMap(convertList(pageResult.getList(), TradeOrderDO::getUserId));
|
||||
// 最终组合
|
||||
return success(TradeOrderConvert.INSTANCE.convertPage(pageResult, orderItems,userMap));
|
||||
}
|
||||
@@ -83,8 +82,7 @@ public class TradeOrderController {
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/get-detail")
|
||||
@PermitAll
|
||||
// @PreAuthorize("@ss.hasPermission('trade:order:query')")
|
||||
@PreAuthorize("@ss.hasPermission('trade:order:query')")
|
||||
public CommonResult<TradeOrderDetailRespVO> getOrderDetail(@RequestParam("id") Long id) {
|
||||
// 查询订单
|
||||
TradeOrderDO order = tradeOrderQueryService.getOrder(id);
|
||||
@@ -93,9 +91,11 @@ public class TradeOrderController {
|
||||
}
|
||||
// 查询订单项
|
||||
List<TradeOrderItemDO> orderItems = tradeOrderQueryService.getOrderItemListByOrderId(id);
|
||||
|
||||
//查询订单日志
|
||||
List<TradeOrderLogDO> orderLogs = tradeOrderLogService.getOrderLogListByOrderId(id);
|
||||
return success(TradeOrderConvert.INSTANCE.convert(order, orderItems, orderLogs));
|
||||
//查询用户信息
|
||||
Map<Long, UserMemberRespDTO> userMap = userMemberApi.getUserMap(List.of(order.getId()));
|
||||
return success(TradeOrderConvert.INSTANCE.convert(order, orderItems,userMap, orderLogs));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -104,8 +104,7 @@ public class TradeOrderController {
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/summary")
|
||||
@PermitAll
|
||||
// @PreAuthorize("@ss.hasPermission('trade:order:query')")
|
||||
@PreAuthorize("@ss.hasPermission('trade:order:query')")
|
||||
public CommonResult<TradeOrderSummaryRespVO> getOrderSummary() {
|
||||
return success(tradeOrderQueryService.getOrderSummary());
|
||||
}
|
||||
@@ -116,8 +115,7 @@ public class TradeOrderController {
|
||||
* @return
|
||||
*/
|
||||
@PutMapping("/cancel")
|
||||
@PermitAll
|
||||
// @PreAuthorize("@ss.hasPermission('trade:order:query')")
|
||||
@PreAuthorize("@ss.hasPermission('trade:order:update')")
|
||||
public CommonResult<Boolean> cancel(@RequestBody TradeOrderCancelReqVo reqVO) {
|
||||
return success(tradeOrderUpdateService.cancelOrderByAdmin(reqVO));
|
||||
}
|
||||
@@ -128,8 +126,7 @@ public class TradeOrderController {
|
||||
*/
|
||||
|
||||
@PutMapping("/acceptConfirm")
|
||||
@PermitAll
|
||||
// @PreAuthorize("@ss.hasPermission('trade:order:query')")
|
||||
@PreAuthorize("@ss.hasPermission('trade:order:update')")
|
||||
public CommonResult<Boolean> acceptConfirm(@RequestParam("id") Long id) {
|
||||
tradeOrderUpdateService.acceptConfirmOrderByAdmin(id);
|
||||
return success(true);
|
||||
@@ -141,8 +138,7 @@ public class TradeOrderController {
|
||||
* @return
|
||||
*/
|
||||
@PutMapping("/reportServe")
|
||||
@PermitAll
|
||||
// @PreAuthorize("@ss.hasPermission('trade:order:query')")
|
||||
@PreAuthorize("@ss.hasPermission('trade:order:update')")
|
||||
public CommonResult<Boolean> reportServe(@RequestParam("id") Long id) {
|
||||
tradeOrderUpdateService.reportServeOrderByAdmin(id);
|
||||
return success(true);
|
||||
@@ -150,8 +146,7 @@ public class TradeOrderController {
|
||||
|
||||
// 订单备注
|
||||
@PutMapping("/update-remark")
|
||||
@PermitAll
|
||||
// @PreAuthorize("@ss.hasPermission('trade:order:update')")
|
||||
@PreAuthorize("@ss.hasPermission('trade:order:update')")
|
||||
public CommonResult<Boolean> updateOrderRemark(@Valid @RequestBody TradeOrderRemarkReqVO reqVO) {
|
||||
tradeOrderUpdateService.updateOrderRemark(reqVO);
|
||||
return success(true);
|
||||
@@ -162,8 +157,7 @@ public class TradeOrderController {
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/fastPhoto")
|
||||
@PermitAll
|
||||
// @PreAuthorize("@ss.hasPermission('trade:order:query')")
|
||||
@PreAuthorize("@ss.hasPermission('trade:order:query')")
|
||||
public CommonResult<TradeOrderFastPhotoRespVo> fastPhoto(@Valid TradeOrderFastPhotoReqVo reqVo) {
|
||||
//获取交易订单详情
|
||||
TradeOrderItemDO orderItem = tradeOrderQueryService.getOrderItem(reqVo.getItemId());
|
||||
@@ -178,8 +172,7 @@ public class TradeOrderController {
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/subTimeLog/{id}")
|
||||
@PermitAll
|
||||
// @PreAuthorize("@ss.hasPermission('trade:order:query')")
|
||||
@PreAuthorize("@ss.hasPermission('trade:order:query')")
|
||||
public CommonResult<List<TradeOrderSubLogDO>> subTimeLog(@PathVariable("id") Long id) {
|
||||
//获取订单预约时间修改列表
|
||||
List<TradeOrderSubLogDO> subLogDO = tradeOrderQueryService.getSubTimeLogList(id);
|
||||
|
||||
@@ -29,10 +29,12 @@ public class TradeOrderDetailRespVO extends TradeOrderBaseVO{
|
||||
//商家备注
|
||||
private String merchantRemark;
|
||||
//退款时间
|
||||
@JsonSerialize(using = StringLocalDateTimeSerializer.class)
|
||||
private LocalDateTime refundTime;
|
||||
//保障时间
|
||||
//售后保障时间
|
||||
@JsonSerialize(using = StringLocalDateTimeSerializer.class)
|
||||
private LocalDateTime propertyTime;
|
||||
//保障状态
|
||||
//售后保障状态
|
||||
private Integer propertyStatus;
|
||||
//订单金额
|
||||
private Integer price;
|
||||
@@ -81,14 +83,12 @@ public class TradeOrderDetailRespVO extends TradeOrderBaseVO{
|
||||
private String shopName;
|
||||
//店铺logo
|
||||
private String shopLogo;
|
||||
|
||||
//商品id
|
||||
private Long spuId;
|
||||
//skuId
|
||||
private Long skuId;
|
||||
//商品图片
|
||||
private String picUrl;
|
||||
|
||||
//商品名称
|
||||
private String spuName;
|
||||
//商品规格
|
||||
@@ -97,8 +97,6 @@ public class TradeOrderDetailRespVO extends TradeOrderBaseVO{
|
||||
private Long orderCategoryId;
|
||||
//订单类目名称
|
||||
private String orderCategoryName;
|
||||
|
||||
|
||||
// 购买的商品数量
|
||||
private Integer count;
|
||||
// 订单总价
|
||||
@@ -119,7 +117,6 @@ public class TradeOrderDetailRespVO extends TradeOrderBaseVO{
|
||||
private Integer handedPrice;
|
||||
//成本价
|
||||
private Integer expensePrice;
|
||||
|
||||
//服务保障列表
|
||||
private String properties;
|
||||
//服务内容
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
package com.tashow.cloud.trade.controller.admin.order.vo;
|
||||
|
||||
import com.tashow.cloud.trade.dal.dataobject.order.TradeOrderSubLogDO;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class TradeOrderSubTimeListRespVo {
|
||||
|
||||
private List<TradeOrderSubLogDO> subTimeList;
|
||||
}
|
||||
@@ -93,9 +93,9 @@ public interface TradeOrderConvert {
|
||||
//endregion
|
||||
|
||||
//region 订单详情
|
||||
default TradeOrderDetailRespVO convert(TradeOrderDO order, List<TradeOrderItemDO> orderItems, List<TradeOrderLogDO> orderLogs) {
|
||||
default TradeOrderDetailRespVO convert(TradeOrderDO order, List<TradeOrderItemDO> orderItems,Map<Long, UserMemberRespDTO> userMap, List<TradeOrderLogDO> orderLogs) {
|
||||
//订单基本信息
|
||||
TradeOrderDetailRespVO orderVO = convert2(order, orderItems, orderLogs);
|
||||
TradeOrderDetailRespVO orderVO = convertDetail(order,userMap.get(order.getUserId()), orderItems, orderLogs);
|
||||
//计算商品到手价
|
||||
orderVO.getItems().stream().forEach(item -> {
|
||||
item.setHandedPrice(item.getPrice() - item.getDiscountPrice());
|
||||
@@ -122,7 +122,13 @@ public interface TradeOrderConvert {
|
||||
}
|
||||
return orderVO;
|
||||
}
|
||||
TradeOrderDetailRespVO convert2(TradeOrderDO order, List<TradeOrderItemDO> items, List<TradeOrderLogDO> statusList);
|
||||
@Mappings({
|
||||
@Mapping(target = "id",source = "order.id"),
|
||||
@Mapping(target = "createTime",source = "order.createTime"),
|
||||
@Mapping(source = "userMemberRespDTO.nickname", target = "userNickName"),
|
||||
@Mapping(source = "userMemberRespDTO.avatar", target = "userAvatar"),
|
||||
})
|
||||
TradeOrderDetailRespVO convertDetail(TradeOrderDO order,UserMemberRespDTO userMemberRespDTO,List<TradeOrderItemDO> items, List<TradeOrderLogDO> statusList);
|
||||
//endregion
|
||||
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ package com.tashow.cloud.trade.dal.dataobject.order;
|
||||
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.tashow.cloud.mybatis.mybatis.core.dataobject.BaseDO;
|
||||
import com.tashow.cloud.tenant.core.db.TenantBaseDO;
|
||||
import lombok.*;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
@@ -21,7 +21,7 @@ import java.time.LocalDateTime;
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class TradeOrderDO extends BaseDO {
|
||||
public class TradeOrderDO extends TenantBaseDO {
|
||||
|
||||
/**
|
||||
* 订单编号,主键自增
|
||||
@@ -81,6 +81,10 @@ public class TradeOrderDO extends BaseDO {
|
||||
* 取消原因
|
||||
*/
|
||||
private String cancelReason;
|
||||
/**
|
||||
* 取消备注
|
||||
*/
|
||||
private String cancelRemark;
|
||||
/**
|
||||
* 商家编号
|
||||
*/
|
||||
@@ -174,10 +178,19 @@ public class TradeOrderDO extends BaseDO {
|
||||
* 退款状态 (枚举 TradeOrderRefundStatusEnum)
|
||||
*/
|
||||
private Integer refundStatus;
|
||||
|
||||
/**
|
||||
* 订单金额,单位:分
|
||||
*/
|
||||
private Integer price;
|
||||
/**
|
||||
* 退款金额,单位:分
|
||||
*/
|
||||
private Integer refundPrice;
|
||||
/**
|
||||
* 退款金额,单位:分
|
||||
*/
|
||||
private Integer discountPrice;
|
||||
/**
|
||||
* 退款时间
|
||||
*/
|
||||
|
||||
@@ -3,7 +3,7 @@ package com.tashow.cloud.trade.dal.dataobject.order;
|
||||
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.tashow.cloud.mybatis.mybatis.core.dataobject.BaseDO;
|
||||
import com.tashow.cloud.tenant.core.db.TenantBaseDO;
|
||||
import lombok.*;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
@@ -21,7 +21,7 @@ import java.time.LocalDateTime;
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class TradeOrderItemDO extends BaseDO {
|
||||
public class TradeOrderItemDO extends TenantBaseDO {
|
||||
|
||||
/**
|
||||
* 编号
|
||||
|
||||
@@ -3,11 +3,11 @@ package com.tashow.cloud.user.controller.app.auth;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.tashow.cloud.common.enums.UserTypeEnum;
|
||||
import com.tashow.cloud.common.pojo.CommonResult;
|
||||
import com.tashow.cloud.user.controller.app.auth.vo.*;
|
||||
import com.tashow.cloud.security.security.config.SecurityProperties;
|
||||
import com.tashow.cloud.security.security.core.util.SecurityFrameworkUtils;
|
||||
import com.tashow.cloud.systemapi.api.social.SocialClientApi;
|
||||
import com.tashow.cloud.systemapi.api.social.dto.SocialWxJsapiSignatureRespDTO;
|
||||
import com.tashow.cloud.user.controller.app.auth.vo.*;
|
||||
import com.tashow.cloud.user.convert.auth.AuthConvert;
|
||||
import com.tashow.cloud.user.service.auth.MemberAuthService;
|
||||
import jakarta.annotation.Resource;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.tashow.cloud.user.convert.auth;
|
||||
|
||||
import com.tashow.cloud.user.controller.app.auth.vo.*;
|
||||
import com.tashow.cloud.systemapi.api.oauth2.dto.OAuth2AccessTokenRespDTO;
|
||||
import com.tashow.cloud.systemapi.api.sms.dto.code.SmsCodeSendReqDTO;
|
||||
import com.tashow.cloud.systemapi.api.sms.dto.code.SmsCodeUseReqDTO;
|
||||
@@ -8,7 +9,6 @@ import com.tashow.cloud.systemapi.api.social.dto.SocialUserBindReqDTO;
|
||||
import com.tashow.cloud.systemapi.api.social.dto.SocialUserUnbindReqDTO;
|
||||
import com.tashow.cloud.systemapi.api.social.dto.SocialWxJsapiSignatureRespDTO;
|
||||
import com.tashow.cloud.systemapi.enums.sms.SmsSceneEnum;
|
||||
import com.tashow.cloud.user.controller.app.auth.vo.*;
|
||||
import com.tashow.cloud.user.controller.app.user.vo.AppMemberUserResetPasswordReqVO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
@@ -6,6 +6,7 @@ import com.tashow.cloud.common.enums.TerminalEnum;
|
||||
import com.tashow.cloud.common.enums.UserTypeEnum;
|
||||
import com.tashow.cloud.common.util.monitor.TracerUtils;
|
||||
import com.tashow.cloud.common.util.servlet.ServletUtils;
|
||||
import com.tashow.cloud.user.controller.app.auth.vo.*;
|
||||
import com.tashow.cloud.systemapi.api.logger.LoginLogApi;
|
||||
import com.tashow.cloud.systemapi.api.logger.dto.LoginLogCreateReqDTO;
|
||||
import com.tashow.cloud.systemapi.api.oauth2.OAuth2TokenApi;
|
||||
@@ -22,7 +23,6 @@ import com.tashow.cloud.systemapi.enums.logger.LoginResultEnum;
|
||||
import com.tashow.cloud.systemapi.enums.oauth2.OAuth2ClientConstants;
|
||||
import com.tashow.cloud.systemapi.enums.sms.SmsSceneEnum;
|
||||
import com.tashow.cloud.systemapi.enums.social.SocialTypeEnum;
|
||||
import com.tashow.cloud.user.controller.app.auth.vo.*;
|
||||
import com.tashow.cloud.user.convert.auth.AuthConvert;
|
||||
import com.tashow.cloud.user.dal.dataobject.user.UserLoginDO;
|
||||
import com.tashow.cloud.user.service.user.UserLoginService;
|
||||
|
||||
@@ -12,6 +12,7 @@ import com.tashow.cloud.common.enums.CommonStatusEnum;
|
||||
import com.tashow.cloud.common.enums.UserTypeEnum;
|
||||
import com.tashow.cloud.common.pojo.PageResult;
|
||||
import com.tashow.cloud.common.util.object.BeanUtils;
|
||||
import com.tashow.cloud.user.controller.app.user.vo.*;
|
||||
import com.tashow.cloud.systemapi.api.sms.SmsCodeApi;
|
||||
import com.tashow.cloud.systemapi.api.sms.dto.code.SmsCodeUseReqDTO;
|
||||
import com.tashow.cloud.systemapi.api.social.SocialClientApi;
|
||||
@@ -19,7 +20,6 @@ import com.tashow.cloud.systemapi.api.social.dto.SocialWxPhoneNumberInfoRespDTO;
|
||||
import com.tashow.cloud.systemapi.enums.sms.SmsSceneEnum;
|
||||
import com.tashow.cloud.user.controller.admin.user.vo.UserLoginPageReqVO;
|
||||
import com.tashow.cloud.user.controller.admin.user.vo.MemberUserUpdateReqVO;
|
||||
import com.tashow.cloud.user.controller.app.user.vo.*;
|
||||
import com.tashow.cloud.user.convert.auth.AuthConvert;
|
||||
import com.tashow.cloud.user.convert.user.MemberUserConvert;
|
||||
import com.tashow.cloud.user.dal.dataobject.user.UserLoginDO;
|
||||
|
||||
Reference in New Issue
Block a user