fix: update

This commit is contained in:
landaiqing
2024-05-18 23:23:45 +08:00
parent 8f4b8a3331
commit 047c019151
19 changed files with 1375 additions and 15 deletions

View File

@@ -23,15 +23,15 @@ public class SmsInitConfig implements SmartLifecycle {
@Resource
RedisUtil redisUtil;
private final String smsConfigPrefix="sys.config.sms";
private final String smsConfigPrefix="sys.config.";
public void init() {
SmsConfigInfo configInfo = smsConfigRpc.getConfigInfo(SmsConfigContext.SMS_CONFIG_KEY);
String key = redisUtil.buildKey(smsConfigPrefix, SmsConfigContext.SMS_CONFIG_KEY);
redisUtil.set(key, configInfo.getConfigValue());
if (ObjectUtil.isEmpty(configInfo)){
log.info("短信配置获取失败!");
}
String key = redisUtil.buildKey(smsConfigPrefix, SmsConfigContext.SMS_CONFIG_KEY);
redisUtil.set(key, configInfo.getConfigValue());
// 初始化短信配置
SmsFactory.createSmsBlend(smsReadConfig, configInfo.getConfigValue());
}

View File

@@ -24,5 +24,4 @@ public class ThreadPoolConfig {
new CustomNameThreadFactory("rotateCaptcha"),
new ThreadPoolExecutor.CallerRunsPolicy());
}
}

View File

@@ -8,7 +8,7 @@
# 数据库连接信息
jdbc:
dbName: schisandra-cloud-storage
tableName: schisandra_oss_ali
tableName: schisandra_oss_baidu
url: jdbc:mysql://1.95.0.111:3306/
username: root
password: LDQ20020618xxx

View File

@@ -0,0 +1,29 @@
package com.schisandra.oss.application.config;
import com.schisandra.oss.application.factory.CustomNameThreadFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import java.util.concurrent.LinkedBlockingDeque;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
/**
* 线程池的config管理
*
* @author: landaiqing
* @date: 2024/2/18
*/
@Configuration
public class ThreadPoolConfig {
@Bean(name = "ossThreadPool")
public ThreadPoolExecutor getLabelThreadPool() {
return new ThreadPoolExecutor(20, 100, 5,
TimeUnit.SECONDS, new LinkedBlockingDeque<>(40),
new CustomNameThreadFactory("oss"),
new ThreadPoolExecutor.CallerRunsPolicy());
}
}

View File

@@ -0,0 +1,209 @@
package com.schisandra.oss.application.controller;
import com.alibaba.fastjson.JSON;
import com.google.common.base.Preconditions;
import com.schisandra.oss.application.convert.SchisandraOssBaiduDTOConverter;
import com.schisandra.oss.application.dto.SchisandraOssBaiduDTO;
import com.schisandra.oss.common.entity.Result;
import com.schisandra.oss.domain.bo.SchisandraOssBaiduBO;
import com.schisandra.oss.domain.service.SchisandraOssBaiduDomainService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
/**
* controller
*
* @author landaiqing
* @since 2024-05-17 21:17:28
*/
@RestController
@RequestMapping("/oss/")
@Slf4j
public class SchisandraOssBaiduController {
@Resource
private SchisandraOssBaiduDomainService schisandraOssBaiduDomainService;
/**
* 新增
*/
@RequestMapping("add")
public Result<Boolean> add(@RequestBody SchisandraOssBaiduDTO schisandraOssBaiduDTO) {
try {
if (log.isInfoEnabled()) {
log.info("SchisandraOssBaiduController.add.dto:{}", JSON.toJSONString(schisandraOssBaiduDTO));
}
Preconditions.checkNotNull(schisandraOssBaiduDTO.getId(), "不能为空");
Preconditions.checkNotNull(schisandraOssBaiduDTO.getUserId(), "不能为空");
Preconditions.checkNotNull(schisandraOssBaiduDTO.getBasePath(), "不能为空");
Preconditions.checkNotNull(schisandraOssBaiduDTO.getBucketName(), "不能为空");
Preconditions.checkNotNull(schisandraOssBaiduDTO.getAccessKeyId(), "不能为空");
Preconditions.checkNotNull(schisandraOssBaiduDTO.getSecretAccessKey(), "不能为空");
Preconditions.checkNotNull(schisandraOssBaiduDTO.getCnameEnabled(), "使用cname访问BOS资源不能为空");
Preconditions.checkNotNull(schisandraOssBaiduDTO.getEnableHttpAsyncPut(), "异步put不能为空");
Preconditions.checkNotNull(schisandraOssBaiduDTO.getConnectionTimeoutInMillis(), "建立连接的超时时间(单位:毫秒)不能为空");
Preconditions.checkNotNull(schisandraOssBaiduDTO.getMaxConnections(), "允许打开的最大HTTP连接数不能为空");
Preconditions.checkNotNull(schisandraOssBaiduDTO.getProtocol(), "连接协议类型不能为空");
Preconditions.checkNotNull(schisandraOssBaiduDTO.getProxyDomain(), "访问NTLM验证的代理服务器的Windows域名不能为空");
Preconditions.checkNotNull(schisandraOssBaiduDTO.getProxyHost(), "代理服务器主机地址不能为空");
Preconditions.checkNotNull(schisandraOssBaiduDTO.getProxyPassword(), "代理服务器验证的密码不能为空");
Preconditions.checkNotNull(schisandraOssBaiduDTO.getProxyPort(), "代理服务器端口不能为空");
Preconditions.checkNotNull(schisandraOssBaiduDTO.getProxyUsername(), "代理服务器验证的用户名不能为空");
Preconditions.checkNotNull(schisandraOssBaiduDTO.getProxyWorkstation(), "NTLM代理服务器的Windows工作站名称不能为空");
Preconditions.checkNotNull(schisandraOssBaiduDTO.getProxyPreemptiveAuthenticationEnable(), "是否设置用户代理认证不能为空");
Preconditions.checkNotNull(schisandraOssBaiduDTO.getSocketTimeoutInMillis(), "通过打开的连接传输数据的超时时间(单位:毫秒)不能为空");
Preconditions.checkNotNull(schisandraOssBaiduDTO.getSocketBufferSizeInBytes(), "Socket缓冲区大小不能为空");
Preconditions.checkNotNull(schisandraOssBaiduDTO.getEndpoint(), "访问域名不能为空");
Preconditions.checkNotNull(schisandraOssBaiduDTO.getRegion(), "地域不能为空");
Preconditions.checkNotNull(schisandraOssBaiduDTO.getRedirectsEnabled(), "是否开启HTTP重定向。默认开启不能为空");
Preconditions.checkNotNull(schisandraOssBaiduDTO.getLocalAddress(), "本地地址不能为空");
Preconditions.checkNotNull(schisandraOssBaiduDTO.getMaxErrorRetry(), "请求失败最大重试次数不能为空");
Preconditions.checkNotNull(schisandraOssBaiduDTO.getMaxDelayInMillis(), "最大延迟时间,单位:毫秒不能为空");
Preconditions.checkNotNull(schisandraOssBaiduDTO.getStreamBufferSize(), "流文件缓冲区大小不能为空");
Preconditions.checkNotNull(schisandraOssBaiduDTO.getUserAgent(), "用户代理指HTTP的User-Agent头不能为空");
Preconditions.checkNotNull(schisandraOssBaiduDTO.getPartSize(), "分片大小,默认5MB不能为空");
Preconditions.checkNotNull(schisandraOssBaiduDTO.getTaskNum(), "并发线程数,默认等于CPU的核数不能为空");
Preconditions.checkNotNull(schisandraOssBaiduDTO.getStatus(), "状态不能为空");
Preconditions.checkNotNull(schisandraOssBaiduDTO.getOpenAdvancedSetup(), "是否开启高级设置不能为空");
Preconditions.checkNotNull(schisandraOssBaiduDTO.getCreatedBy(), "创建人不能为空");
Preconditions.checkNotNull(schisandraOssBaiduDTO.getCreatedTime(), "创建时间不能为空");
Preconditions.checkNotNull(schisandraOssBaiduDTO.getUpdateTime(), "更新时间不能为空");
Preconditions.checkNotNull(schisandraOssBaiduDTO.getUpdateBy(), "更新人不能为空");
Preconditions.checkNotNull(schisandraOssBaiduDTO.getIsDeleted(), "是否删除 0 未删除 1已删除不能为空");
Preconditions.checkNotNull(schisandraOssBaiduDTO.getExtraJson(), "额外字段不能为空");
Preconditions.checkNotNull(schisandraOssBaiduDTO.getCreateBucket(), "当桶不存在,是否创建不能为空");
Preconditions.checkNotNull(schisandraOssBaiduDTO.getCheckBucket(), "启动检测桶,是否存在不能为空");
SchisandraOssBaiduBO SchisandraOssBaiduBO = SchisandraOssBaiduDTOConverter.INSTANCE.convertDTOToBO(schisandraOssBaiduDTO);
return Result.ok(schisandraOssBaiduDomainService.add(SchisandraOssBaiduBO));
} catch (Exception e) {
log.error("SchisandraOssBaiduController.register.error:{}", e.getMessage(), e);
return Result.fail("新增失败");
}
}
/**
* 修改
*/
@RequestMapping("update")
public Result<Boolean> update(@RequestBody SchisandraOssBaiduDTO schisandraOssBaiduDTO) {
try {
if (log.isInfoEnabled()) {
log.info("SchisandraOssBaiduController.update.dto:{}", JSON.toJSONString(schisandraOssBaiduDTO));
}
Preconditions.checkNotNull(schisandraOssBaiduDTO.getId(), "不能为空");
Preconditions.checkNotNull(schisandraOssBaiduDTO.getUserId(), "不能为空");
Preconditions.checkNotNull(schisandraOssBaiduDTO.getBasePath(), "不能为空");
Preconditions.checkNotNull(schisandraOssBaiduDTO.getBucketName(), "不能为空");
Preconditions.checkNotNull(schisandraOssBaiduDTO.getAccessKeyId(), "不能为空");
Preconditions.checkNotNull(schisandraOssBaiduDTO.getSecretAccessKey(), "不能为空");
Preconditions.checkNotNull(schisandraOssBaiduDTO.getCnameEnabled(), "使用cname访问BOS资源不能为空");
Preconditions.checkNotNull(schisandraOssBaiduDTO.getEnableHttpAsyncPut(), "异步put不能为空");
Preconditions.checkNotNull(schisandraOssBaiduDTO.getConnectionTimeoutInMillis(), "建立连接的超时时间(单位:毫秒)不能为空");
Preconditions.checkNotNull(schisandraOssBaiduDTO.getMaxConnections(), "允许打开的最大HTTP连接数不能为空");
Preconditions.checkNotNull(schisandraOssBaiduDTO.getProtocol(), "连接协议类型不能为空");
Preconditions.checkNotNull(schisandraOssBaiduDTO.getProxyDomain(), "访问NTLM验证的代理服务器的Windows域名不能为空");
Preconditions.checkNotNull(schisandraOssBaiduDTO.getProxyHost(), "代理服务器主机地址不能为空");
Preconditions.checkNotNull(schisandraOssBaiduDTO.getProxyPassword(), "代理服务器验证的密码不能为空");
Preconditions.checkNotNull(schisandraOssBaiduDTO.getProxyPort(), "代理服务器端口不能为空");
Preconditions.checkNotNull(schisandraOssBaiduDTO.getProxyUsername(), "代理服务器验证的用户名不能为空");
Preconditions.checkNotNull(schisandraOssBaiduDTO.getProxyWorkstation(), "NTLM代理服务器的Windows工作站名称不能为空");
Preconditions.checkNotNull(schisandraOssBaiduDTO.getProxyPreemptiveAuthenticationEnable(), "是否设置用户代理认证不能为空");
Preconditions.checkNotNull(schisandraOssBaiduDTO.getSocketTimeoutInMillis(), "通过打开的连接传输数据的超时时间(单位:毫秒)不能为空");
Preconditions.checkNotNull(schisandraOssBaiduDTO.getSocketBufferSizeInBytes(), "Socket缓冲区大小不能为空");
Preconditions.checkNotNull(schisandraOssBaiduDTO.getEndpoint(), "访问域名不能为空");
Preconditions.checkNotNull(schisandraOssBaiduDTO.getRegion(), "地域不能为空");
Preconditions.checkNotNull(schisandraOssBaiduDTO.getRedirectsEnabled(), "是否开启HTTP重定向。默认开启不能为空");
Preconditions.checkNotNull(schisandraOssBaiduDTO.getLocalAddress(), "本地地址不能为空");
Preconditions.checkNotNull(schisandraOssBaiduDTO.getMaxErrorRetry(), "请求失败最大重试次数不能为空");
Preconditions.checkNotNull(schisandraOssBaiduDTO.getMaxDelayInMillis(), "最大延迟时间,单位:毫秒不能为空");
Preconditions.checkNotNull(schisandraOssBaiduDTO.getStreamBufferSize(), "流文件缓冲区大小不能为空");
Preconditions.checkNotNull(schisandraOssBaiduDTO.getUserAgent(), "用户代理指HTTP的User-Agent头不能为空");
Preconditions.checkNotNull(schisandraOssBaiduDTO.getPartSize(), "分片大小,默认5MB不能为空");
Preconditions.checkNotNull(schisandraOssBaiduDTO.getTaskNum(), "并发线程数,默认等于CPU的核数不能为空");
Preconditions.checkNotNull(schisandraOssBaiduDTO.getStatus(), "状态不能为空");
Preconditions.checkNotNull(schisandraOssBaiduDTO.getOpenAdvancedSetup(), "是否开启高级设置不能为空");
Preconditions.checkNotNull(schisandraOssBaiduDTO.getCreatedBy(), "创建人不能为空");
Preconditions.checkNotNull(schisandraOssBaiduDTO.getCreatedTime(), "创建时间不能为空");
Preconditions.checkNotNull(schisandraOssBaiduDTO.getUpdateTime(), "更新时间不能为空");
Preconditions.checkNotNull(schisandraOssBaiduDTO.getUpdateBy(), "更新人不能为空");
Preconditions.checkNotNull(schisandraOssBaiduDTO.getIsDeleted(), "是否删除 0 未删除 1已删除不能为空");
Preconditions.checkNotNull(schisandraOssBaiduDTO.getExtraJson(), "额外字段不能为空");
Preconditions.checkNotNull(schisandraOssBaiduDTO.getCreateBucket(), "当桶不存在,是否创建不能为空");
Preconditions.checkNotNull(schisandraOssBaiduDTO.getCheckBucket(), "启动检测桶,是否存在不能为空");
SchisandraOssBaiduBO schisandraOssBaiduBO = SchisandraOssBaiduDTOConverter.INSTANCE.convertDTOToBO(schisandraOssBaiduDTO);
return Result.ok(schisandraOssBaiduDomainService.update(schisandraOssBaiduBO));
} catch (Exception e) {
log.error("SchisandraOssBaiduController.update.error:{}", e.getMessage(), e);
return Result.fail("更新信息失败");
}
}
/**
* 删除
*/
@RequestMapping("delete")
public Result<Boolean> delete(@RequestBody SchisandraOssBaiduDTO schisandraOssBaiduDTO) {
try {
if (log.isInfoEnabled()) {
log.info("SchisandraOssBaiduController.delete.dto:{}", JSON.toJSONString(schisandraOssBaiduDTO));
}
Preconditions.checkNotNull(schisandraOssBaiduDTO.getId(), "不能为空");
Preconditions.checkNotNull(schisandraOssBaiduDTO.getUserId(), "不能为空");
Preconditions.checkNotNull(schisandraOssBaiduDTO.getBasePath(), "不能为空");
Preconditions.checkNotNull(schisandraOssBaiduDTO.getBucketName(), "不能为空");
Preconditions.checkNotNull(schisandraOssBaiduDTO.getAccessKeyId(), "不能为空");
Preconditions.checkNotNull(schisandraOssBaiduDTO.getSecretAccessKey(), "不能为空");
Preconditions.checkNotNull(schisandraOssBaiduDTO.getCnameEnabled(), "使用cname访问BOS资源不能为空");
Preconditions.checkNotNull(schisandraOssBaiduDTO.getEnableHttpAsyncPut(), "异步put不能为空");
Preconditions.checkNotNull(schisandraOssBaiduDTO.getConnectionTimeoutInMillis(), "建立连接的超时时间(单位:毫秒)不能为空");
Preconditions.checkNotNull(schisandraOssBaiduDTO.getMaxConnections(), "允许打开的最大HTTP连接数不能为空");
Preconditions.checkNotNull(schisandraOssBaiduDTO.getProtocol(), "连接协议类型不能为空");
Preconditions.checkNotNull(schisandraOssBaiduDTO.getProxyDomain(), "访问NTLM验证的代理服务器的Windows域名不能为空");
Preconditions.checkNotNull(schisandraOssBaiduDTO.getProxyHost(), "代理服务器主机地址不能为空");
Preconditions.checkNotNull(schisandraOssBaiduDTO.getProxyPassword(), "代理服务器验证的密码不能为空");
Preconditions.checkNotNull(schisandraOssBaiduDTO.getProxyPort(), "代理服务器端口不能为空");
Preconditions.checkNotNull(schisandraOssBaiduDTO.getProxyUsername(), "代理服务器验证的用户名不能为空");
Preconditions.checkNotNull(schisandraOssBaiduDTO.getProxyWorkstation(), "NTLM代理服务器的Windows工作站名称不能为空");
Preconditions.checkNotNull(schisandraOssBaiduDTO.getProxyPreemptiveAuthenticationEnable(), "是否设置用户代理认证不能为空");
Preconditions.checkNotNull(schisandraOssBaiduDTO.getSocketTimeoutInMillis(), "通过打开的连接传输数据的超时时间(单位:毫秒)不能为空");
Preconditions.checkNotNull(schisandraOssBaiduDTO.getSocketBufferSizeInBytes(), "Socket缓冲区大小不能为空");
Preconditions.checkNotNull(schisandraOssBaiduDTO.getEndpoint(), "访问域名不能为空");
Preconditions.checkNotNull(schisandraOssBaiduDTO.getRegion(), "地域不能为空");
Preconditions.checkNotNull(schisandraOssBaiduDTO.getRedirectsEnabled(), "是否开启HTTP重定向。默认开启不能为空");
Preconditions.checkNotNull(schisandraOssBaiduDTO.getLocalAddress(), "本地地址不能为空");
Preconditions.checkNotNull(schisandraOssBaiduDTO.getMaxErrorRetry(), "请求失败最大重试次数不能为空");
Preconditions.checkNotNull(schisandraOssBaiduDTO.getMaxDelayInMillis(), "最大延迟时间,单位:毫秒不能为空");
Preconditions.checkNotNull(schisandraOssBaiduDTO.getStreamBufferSize(), "流文件缓冲区大小不能为空");
Preconditions.checkNotNull(schisandraOssBaiduDTO.getUserAgent(), "用户代理指HTTP的User-Agent头不能为空");
Preconditions.checkNotNull(schisandraOssBaiduDTO.getPartSize(), "分片大小,默认5MB不能为空");
Preconditions.checkNotNull(schisandraOssBaiduDTO.getTaskNum(), "并发线程数,默认等于CPU的核数不能为空");
Preconditions.checkNotNull(schisandraOssBaiduDTO.getStatus(), "状态不能为空");
Preconditions.checkNotNull(schisandraOssBaiduDTO.getOpenAdvancedSetup(), "是否开启高级设置不能为空");
Preconditions.checkNotNull(schisandraOssBaiduDTO.getCreatedBy(), "创建人不能为空");
Preconditions.checkNotNull(schisandraOssBaiduDTO.getCreatedTime(), "创建时间不能为空");
Preconditions.checkNotNull(schisandraOssBaiduDTO.getUpdateTime(), "更新时间不能为空");
Preconditions.checkNotNull(schisandraOssBaiduDTO.getUpdateBy(), "更新人不能为空");
Preconditions.checkNotNull(schisandraOssBaiduDTO.getIsDeleted(), "是否删除 0 未删除 1已删除不能为空");
Preconditions.checkNotNull(schisandraOssBaiduDTO.getExtraJson(), "额外字段不能为空");
Preconditions.checkNotNull(schisandraOssBaiduDTO.getCreateBucket(), "当桶不存在,是否创建不能为空");
Preconditions.checkNotNull(schisandraOssBaiduDTO.getCheckBucket(), "启动检测桶,是否存在不能为空");
SchisandraOssBaiduBO schisandraOssBaiduBO = SchisandraOssBaiduDTOConverter.INSTANCE.convertDTOToBO(schisandraOssBaiduDTO);
return Result.ok(schisandraOssBaiduDomainService.delete(schisandraOssBaiduBO));
} catch (Exception e) {
log.error("SchisandraOssBaiduController.delete.error:{}", e.getMessage(), e);
return Result.fail("删除信息失败");
}
}
}

View File

@@ -8,6 +8,7 @@ import com.schisandra.oss.application.dto.SchisandraOssMinioDTO;
import com.schisandra.oss.application.oss.core.minio.MinioOssClient;
import com.schisandra.oss.application.oss.core.minio.MinioOssConfiguration;
import com.schisandra.oss.common.entity.Result;
import com.schisandra.oss.common.redis.RedisUtil;
import com.schisandra.oss.domain.bo.SchisandraOssMinioBO;
import com.schisandra.oss.domain.service.SchisandraOssMinioDomainService;
import lombok.extern.slf4j.Slf4j;
@@ -31,6 +32,11 @@ public class SchisandraOssMinioController {
@Resource
MinioOssConfiguration minioOssConfiguration;
@Resource
RedisUtil redisUtil;
private final String MINIO_OSS_CLIENT_CONFIG_KEY = "oss.minio.init";
/**
* @description: minio 初始化
* @param: []
@@ -45,8 +51,15 @@ public class SchisandraOssMinioController {
}
Preconditions.checkNotNull(userId, "用户id不能为空");
try {
String key = redisUtil.buildKey(MINIO_OSS_CLIENT_CONFIG_KEY, userId);
boolean exists = redisUtil.exist(key);
if(exists){
log.info("用户: " + userId + "-> minio 已经初始化!");
return;
}
minioOssConfiguration.minioOssClient(userId);
log.info("用户: " + userId + "-> minio 初始化完成!");
redisUtil.set(key, "true");
} catch (Exception e) {
log.error("用户: " + userId + "-> minio 初始化失败!", e.getMessage(), e);
}
@@ -78,7 +91,6 @@ public class SchisandraOssMinioController {
*/
@RequestMapping("update")
public Result<Boolean> updateMinioOss(@RequestBody SchisandraOssMinioDTO schisandraOssMinioDTO) {
try {
if (log.isInfoEnabled()) {
log.info("SchisandraOssMinioController.update.dto:{}", JSON.toJSONString(schisandraOssMinioDTO));
@@ -116,9 +128,11 @@ public class SchisandraOssMinioController {
@PostMapping("getBaseInfo")
public Result getBaseInfo(@RequestParam String fileName,@RequestParam String userId) {
MinioOssClient bean = SpringUtil.getBean(userId);
System.out.println(bean);
if (bean == null){
log.error("容器获取失败!");
return null;
}
return Result.ok(bean.getBaseInfo(fileName));
}

View File

@@ -0,0 +1,22 @@
package com.schisandra.oss.application.convert;
import com.schisandra.oss.application.dto.SchisandraOssBaiduDTO;
import com.schisandra.oss.domain.bo.SchisandraOssBaiduBO;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
/**
* dto转换器
*
* @author landaiqing
* @since 2024-05-17 21:17:28
*/
@Mapper
public interface SchisandraOssBaiduDTOConverter {
SchisandraOssBaiduDTOConverter INSTANCE = Mappers.getMapper(SchisandraOssBaiduDTOConverter.class);
SchisandraOssBaiduBO convertDTOToBO(SchisandraOssBaiduDTO schisandraOssBaiduDTO);
}

View File

@@ -0,0 +1,218 @@
package com.schisandra.oss.application.dto;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* dto
*
* @author landaiqing
* @since 2024-05-17 21:17:28
*/
@Data
public class SchisandraOssBaiduDTO implements Serializable {
/**
*
*/
private Long id;
/**
*
*/
private Long userId;
/**
*
*/
private String basePath;
/**
*
*/
private String bucketName;
/**
*
*/
private String accessKeyId;
/**
*
*/
private String secretAccessKey;
/**
* 使用cname访问BOS资源
*/
private String cnameEnabled;
/**
* 异步put
*/
private String enableHttpAsyncPut;
/**
* 建立连接的超时时间(单位:毫秒)
*/
private Integer connectionTimeoutInMillis;
/**
* 允许打开的最大HTTP连接数
*/
private Integer maxConnections;
/**
* 连接协议类型
*/
private String protocol;
/**
* 访问NTLM验证的代理服务器的Windows域名
*/
private String proxyDomain;
/**
* 代理服务器主机地址
*/
private String proxyHost;
/**
* 代理服务器验证的密码
*/
private String proxyPassword;
/**
* 代理服务器端口
*/
private Integer proxyPort;
/**
* 代理服务器验证的用户名
*/
private String proxyUsername;
/**
* NTLM代理服务器的Windows工作站名称
*/
private String proxyWorkstation;
/**
* 是否设置用户代理认证
*/
private String proxyPreemptiveAuthenticationEnable;
/**
* 通过打开的连接传输数据的超时时间(单位:毫秒)
*/
private Integer socketTimeoutInMillis;
/**
* Socket缓冲区大小
*/
private Integer socketBufferSizeInBytes;
/**
* 访问域名
*/
private String endpoint;
/**
* 地域
*/
private String region;
/**
* 是否开启HTTP重定向。默认开启
*/
private String redirectsEnabled;
/**
* 本地地址
*/
private String localAddress;
/**
* 请求失败最大重试次数
*/
private Integer maxErrorRetry;
/**
* 最大延迟时间,单位:毫秒
*/
private Integer maxDelayInMillis;
/**
* 流文件缓冲区大小
*/
private Double streamBufferSize;
/**
* 用户代理指HTTP的User-Agent头
*/
private String userAgent;
/**
* 分片大小,默认5MB
*/
private Integer partSize;
/**
* 并发线程数,默认等于CPU的核数
*/
private Integer taskNum;
/**
* 状态
*/
private String status;
/**
* 是否开启高级设置
*/
private String openAdvancedSetup;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新时间
*/
private Date updateTime;
/**
* 更新人
*/
private String updateBy;
/**
* 是否删除 0 未删除 1已删除
*/
private Integer isDeleted;
/**
* 额外字段
*/
private String extraJson;
/**
* 当桶不存在,是否创建
*/
private String createBucket;
/**
* 启动检测桶,是否存在
*/
private String checkBucket;
}

View File

@@ -0,0 +1,49 @@
package com.schisandra.oss.application.factory;
import org.apache.commons.lang3.StringUtils;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.atomic.AtomicInteger;
/**
* 自定义名称的线程工厂
*
* @author: landaiqing
* @date: 2024/2/18
*/
public class CustomNameThreadFactory implements ThreadFactory {
private static final AtomicInteger poolNumber = new AtomicInteger(1);
private final ThreadGroup group;
private final AtomicInteger threadNumber = new AtomicInteger(1);
private final String namePrefix;
public CustomNameThreadFactory(String name) {
SecurityManager s = System.getSecurityManager();
group = (s != null) ? s.getThreadGroup() :
Thread.currentThread().getThreadGroup();
if (StringUtils.isBlank(name)) {
name = "pool";
}
namePrefix = name + "-" +
poolNumber.getAndIncrement() +
"-thread-";
}
@Override
public Thread newThread(Runnable r) {
Thread t = new Thread(group, r,
namePrefix + threadNumber.getAndIncrement(),
0);
// 设置线程为非守护线程
if (t.isDaemon()){
t.setDaemon(false);
}
// 设置线程优先级为正常优先级
if (t.getPriority() != Thread.NORM_PRIORITY){
t.setPriority(Thread.NORM_PRIORITY);
}
return t;
}
}

View File

@@ -6,20 +6,16 @@ import com.schisandra.oss.application.dto.SchisandraOssMinioDTO;
import com.schisandra.oss.application.oss.core.StandardOssClient;
import com.schisandra.oss.application.oss.core.minio.model.MinioOssClientConfig;
import com.schisandra.oss.application.oss.core.minio.model.MinioOssConfig;
import com.schisandra.oss.common.redis.RedisUtil;
import com.schisandra.oss.domain.bo.SchisandraOssMinioBO;
import com.schisandra.oss.domain.service.SchisandraOssMinioDomainService;
import io.minio.MinioClient;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
import okhttp3.OkHttpClient;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.context.annotation.Scope;
import org.springframework.context.annotation.ScopedProxyMode;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.HashMap;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.TimeUnit;
@@ -32,10 +28,13 @@ import java.util.concurrent.TimeUnit;
@Slf4j
public class MinioOssConfiguration {
@Resource
private RedisUtil redisUtil;
@Resource
private SchisandraOssMinioDomainService schisandraOssMinioDomainService;
public void minioOssClient(String userId) {
public StandardOssClient minioOssClient(String userId) {
CompletableFuture<SchisandraOssMinioDTO> futurePrice = CompletableFuture.supplyAsync(() -> {
SchisandraOssMinioBO minioBO = schisandraOssMinioDomainService.getMinioConfig(Long.valueOf(userId));
SchisandraOssMinioDTO minioDTO = SchisandraOssMinioDTOConverter.INSTANCE.convertBOToDTO(minioBO);
@@ -44,6 +43,7 @@ public class MinioOssConfiguration {
SchisandraOssMinioDTO minio = futurePrice.join();
if (ObjectUtils.isEmpty(minio)) {
log.error("minio配置信息获取失败");
return null;
}
MinioOssConfig minioOssConfig = new MinioOssConfig();
minioOssConfig.setBasePath(minio.getBasePath());
@@ -64,8 +64,8 @@ public class MinioOssConfiguration {
minioOssClientConfig.setCallTimeout(minio.getCallTimeout());
minioOssConfig.setClientConfig(minioOssClientConfig);
}
minioOssClient(minioOssConfig);
SpringUtil.registerBean(userId,minioOssClient(minioOssConfig));
return minioOssClient(minioOssConfig);
}

View File

@@ -0,0 +1,218 @@
package com.schisandra.oss.domain.bo;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* bo
*
* @author landaiqing
* @since 2024-05-17 21:17:28
*/
@Data
public class SchisandraOssBaiduBO implements Serializable {
/**
*
*/
private Long id;
/**
*
*/
private Long userId;
/**
*
*/
private String basePath;
/**
*
*/
private String bucketName;
/**
*
*/
private String accessKeyId;
/**
*
*/
private String secretAccessKey;
/**
* 使用cname访问BOS资源
*/
private String cnameEnabled;
/**
* 异步put
*/
private String enableHttpAsyncPut;
/**
* 建立连接的超时时间(单位:毫秒)
*/
private Integer connectionTimeoutInMillis;
/**
* 允许打开的最大HTTP连接数
*/
private Integer maxConnections;
/**
* 连接协议类型
*/
private String protocol;
/**
* 访问NTLM验证的代理服务器的Windows域名
*/
private String proxyDomain;
/**
* 代理服务器主机地址
*/
private String proxyHost;
/**
* 代理服务器验证的密码
*/
private String proxyPassword;
/**
* 代理服务器端口
*/
private Integer proxyPort;
/**
* 代理服务器验证的用户名
*/
private String proxyUsername;
/**
* NTLM代理服务器的Windows工作站名称
*/
private String proxyWorkstation;
/**
* 是否设置用户代理认证
*/
private String proxyPreemptiveAuthenticationEnable;
/**
* 通过打开的连接传输数据的超时时间(单位:毫秒)
*/
private Integer socketTimeoutInMillis;
/**
* Socket缓冲区大小
*/
private Integer socketBufferSizeInBytes;
/**
* 访问域名
*/
private String endpoint;
/**
* 地域
*/
private String region;
/**
* 是否开启HTTP重定向。默认开启
*/
private String redirectsEnabled;
/**
* 本地地址
*/
private String localAddress;
/**
* 请求失败最大重试次数
*/
private Integer maxErrorRetry;
/**
* 最大延迟时间,单位:毫秒
*/
private Integer maxDelayInMillis;
/**
* 流文件缓冲区大小
*/
private Double streamBufferSize;
/**
* 用户代理指HTTP的User-Agent头
*/
private String userAgent;
/**
* 分片大小,默认5MB
*/
private Integer partSize;
/**
* 并发线程数,默认等于CPU的核数
*/
private Integer taskNum;
/**
* 状态
*/
private String status;
/**
* 是否开启高级设置
*/
private String openAdvancedSetup;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新时间
*/
private Date updateTime;
/**
* 更新人
*/
private String updateBy;
/**
* 是否删除 0 未删除 1已删除
*/
private Integer isDeleted;
/**
* 额外字段
*/
private String extraJson;
/**
* 当桶不存在,是否创建
*/
private String createBucket;
/**
* 启动检测桶,是否存在
*/
private String checkBucket;
}

View File

@@ -0,0 +1,22 @@
package com.schisandra.oss.domain.convert;
import com.schisandra.oss.domain.bo.SchisandraOssBaiduBO;
import com.schisandra.oss.infra.basic.entity.SchisandraOssBaidu;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
/**
* bo转换器
*
* @author landaiqing
* @since 2024-05-17 21:17:28
*/
@Mapper
public interface SchisandraOssBaiduBOConverter {
SchisandraOssBaiduBOConverter INSTANCE = Mappers.getMapper(SchisandraOssBaiduBOConverter.class);
SchisandraOssBaidu convertBOToEntity(SchisandraOssBaiduBO schisandraOssBaiduBO);
}

View File

@@ -0,0 +1,28 @@
package com.schisandra.oss.domain.service;
import com.schisandra.oss.domain.bo.SchisandraOssBaiduBO;
/**
* 领域service
*
* @author landaiqing
* @since 2024-05-17 21:17:28
*/
public interface SchisandraOssBaiduDomainService {
/**
* 添加 信息
*/
Boolean add(SchisandraOssBaiduBO schisandraOssBaiduBO);
/**
* 更新 信息
*/
Boolean update(SchisandraOssBaiduBO schisandraOssBaiduBO);
/**
* 删除 信息
*/
Boolean delete(SchisandraOssBaiduBO schisandraOssBaiduBO);
}

View File

@@ -0,0 +1,48 @@
package com.schisandra.oss.domain.service.impl;
import com.schisandra.oss.common.enums.IsDeletedFlagEnum;
import com.schisandra.oss.domain.bo.SchisandraOssBaiduBO;
import com.schisandra.oss.domain.convert.SchisandraOssBaiduBOConverter;
import com.schisandra.oss.domain.service.SchisandraOssBaiduDomainService;
import com.schisandra.oss.infra.basic.entity.SchisandraOssBaidu;
import com.schisandra.oss.infra.basic.service.SchisandraOssBaiduService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
/**
* 领域service实现了
*
* @author landaiqing
* @since 2024-05-17 21:17:28
*/
@Service
@Slf4j
public class SchisandraOssBaiduDomainServiceImpl implements SchisandraOssBaiduDomainService {
@Resource
private SchisandraOssBaiduService schisandraOssBaiduService;
@Override
public Boolean add(SchisandraOssBaiduBO schisandraOssBaiduBO) {
SchisandraOssBaidu schisandraOssBaidu = SchisandraOssBaiduBOConverter.INSTANCE.convertBOToEntity(schisandraOssBaiduBO);
schisandraOssBaidu.setIsDeleted(IsDeletedFlagEnum.UN_DELETED.getCode());
return schisandraOssBaiduService.insert(schisandraOssBaidu) > 0;
}
@Override
public Boolean update(SchisandraOssBaiduBO schisandraOssBaiduBO) {
SchisandraOssBaidu schisandraOssBaidu = SchisandraOssBaiduBOConverter.INSTANCE.convertBOToEntity(schisandraOssBaiduBO);
return schisandraOssBaiduService.update(schisandraOssBaidu) > 0;
}
@Override
public Boolean delete(SchisandraOssBaiduBO schisandraOssBaiduBO) {
SchisandraOssBaidu schisandraOssBaidu = new SchisandraOssBaidu();
schisandraOssBaidu.setId(schisandraOssBaiduBO.getId());
schisandraOssBaidu.setIsDeleted(IsDeletedFlagEnum.DELETED.getCode());
return schisandraOssBaiduService.update(schisandraOssBaidu) > 0;
}
}

View File

@@ -0,0 +1,18 @@
package com.schisandra.oss.infra.basic.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.schisandra.oss.infra.basic.entity.SchisandraOssBaidu;
import org.springframework.stereotype.Repository;
/**
* 表数据库访问层
*
* @author landaiqing
* @since 2024-05-17 21:17:28
*/
@Repository
public interface SchisandraOssBaiduDao extends BaseMapper<SchisandraOssBaidu> {
}

View File

@@ -0,0 +1,263 @@
package com.schisandra.oss.infra.basic.entity;
import lombok.Data;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.util.Date;
/**
* 实体类
*
* @author landaiqing
* @since 2024-05-17 21:17:28
*/
@Data
@TableName("schisandra_oss_baidu")
public class SchisandraOssBaidu implements Serializable {
/**
*
*/
@TableId(value = "`id`", type = IdType.AUTO)
private Long id;
/**
*
*/
@TableField("`user_id`")
private Long userId;
/**
*
*/
@TableField("`base_path`")
private String basePath;
/**
*
*/
@TableField("`bucket_name`")
private String bucketName;
/**
*
*/
@TableField("`access_key_id`")
private String accessKeyId;
/**
*
*/
@TableField("`secret_access_key`")
private String secretAccessKey;
/**
* 使用cname访问BOS资源
*/
@TableField("`cname_enabled`")
private String cnameEnabled;
/**
* 异步put
*/
@TableField("`enable_http_async_put`")
private String enableHttpAsyncPut;
/**
* 建立连接的超时时间(单位:毫秒)
*/
@TableField("`connection_timeoutIn_millis`")
private Integer connectionTimeoutInMillis;
/**
* 允许打开的最大HTTP连接数
*/
@TableField("`max_connections`")
private Integer maxConnections;
/**
* 连接协议类型
*/
@TableField("`protocol`")
private String protocol;
/**
* 访问NTLM验证的代理服务器的Windows域名
*/
@TableField("`proxy_domain`")
private String proxyDomain;
/**
* 代理服务器主机地址
*/
@TableField("`proxy_host`")
private String proxyHost;
/**
* 代理服务器验证的密码
*/
@TableField("`proxy_password`")
private String proxyPassword;
/**
* 代理服务器端口
*/
@TableField("`proxy_port`")
private Integer proxyPort;
/**
* 代理服务器验证的用户名
*/
@TableField("`proxy_username`")
private String proxyUsername;
/**
* NTLM代理服务器的Windows工作站名称
*/
@TableField("`proxy_workstation`")
private String proxyWorkstation;
/**
* 是否设置用户代理认证
*/
@TableField("`proxy_preemptive_authentication_enable`")
private String proxyPreemptiveAuthenticationEnable;
/**
* 通过打开的连接传输数据的超时时间(单位:毫秒)
*/
@TableField("`socket_timeoutIn_millis`")
private Integer socketTimeoutInMillis;
/**
* Socket缓冲区大小
*/
@TableField("`socket_buffer_sizeIn_bytes`")
private Integer socketBufferSizeInBytes;
/**
* 访问域名
*/
@TableField("`endpoint`")
private String endpoint;
/**
* 地域
*/
@TableField("`region`")
private String region;
/**
* 是否开启HTTP重定向。默认开启
*/
@TableField("`redirects_enabled`")
private String redirectsEnabled;
/**
* 本地地址
*/
@TableField("`local_address`")
private String localAddress;
/**
* 请求失败最大重试次数
*/
@TableField("`max_error_retry`")
private Integer maxErrorRetry;
/**
* 最大延迟时间,单位:毫秒
*/
@TableField("`max_delayIn_millis`")
private Integer maxDelayInMillis;
/**
* 流文件缓冲区大小
*/
@TableField("`stream_buffer_size`")
private Double streamBufferSize;
/**
* 用户代理指HTTP的User-Agent头
*/
@TableField("`user_agent`")
private String userAgent;
/**
* 分片大小,默认5MB
*/
@TableField("`part_size`")
private Integer partSize;
/**
* 并发线程数,默认等于CPU的核数
*/
@TableField("`task_num`")
private Integer taskNum;
/**
* 状态
*/
@TableField("`status`")
private String status;
/**
* 是否开启高级设置
*/
@TableField("`open_advanced_setup`")
private String openAdvancedSetup;
/**
* 创建人
*/
@TableField("`created_by`")
private String createdBy;
/**
* 创建时间
*/
@TableField("`created_time`")
private Date createdTime;
/**
* 更新时间
*/
@TableField("`update_time`")
private Date updateTime;
/**
* 更新人
*/
@TableField("`update_by`")
private String updateBy;
/**
* 是否删除 0 未删除 1已删除
*/
@TableField("`is_deleted`")
private Integer isDeleted;
/**
* 额外字段
*/
@TableField("`extra_json`")
private String extraJson;
/**
* 当桶不存在,是否创建
*/
@TableField("`create_bucket`")
private String createBucket;
/**
* 启动检测桶,是否存在
*/
@TableField("`check_bucket`")
private String checkBucket;
}

View File

@@ -0,0 +1,50 @@
package com.schisandra.oss.infra.basic.service;
import com.schisandra.oss.infra.basic.entity.SchisandraOssBaidu;
/**
* 表服务接口
*
* @author landaiqing
* @since 2024-05-17 21:17:28
*/
public interface SchisandraOssBaiduService {
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
SchisandraOssBaidu queryById(Long id);
/**
* 新增数据
*
* @param schisandraOssBaidu 实例对象
* @return 实例对象
*/
int insert(SchisandraOssBaidu schisandraOssBaidu);
/**
* 修改数据
*
* @param schisandraOssBaidu 实例对象
* @return 实例对象
*/
int update(SchisandraOssBaidu schisandraOssBaidu);
/**
* 通过主键删除数据
*
* @param id 主键
* @return 是否成功
*/
boolean deleteById(Long id);
/**
* 根据条件查询角色
*/
SchisandraOssBaidu queryByCondition(SchisandraOssBaidu schisandraOssBaidu);
}

View File

@@ -0,0 +1,125 @@
package com.schisandra.oss.infra.basic.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.schisandra.oss.infra.basic.dao.SchisandraOssBaiduDao;
import com.schisandra.oss.infra.basic.entity.SchisandraOssBaidu;
import com.schisandra.oss.infra.basic.service.SchisandraOssBaiduService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Objects;
/**
* 表服务实现类
*
* @author landaiqing
* @since 2024-05-17 21:17:28
*/
@Service("SchisandraOssBaiduService")
public class SchisandraOssBaiduServiceImpl implements SchisandraOssBaiduService {
@Resource
private SchisandraOssBaiduDao schisandraOssBaiduDao;
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
@Override
public SchisandraOssBaidu queryById(Long id) {
return this.schisandraOssBaiduDao.selectById(id);
}
/**
* 新增数据
*
* @param schisandraOssBaidu 实例对象
* @return 实例对象
*/
@Override
public int insert(SchisandraOssBaidu schisandraOssBaidu) {
return this.schisandraOssBaiduDao.insert(schisandraOssBaidu);
}
/**
* 修改数据
*
* @param schisandraOssBaidu 实例对象
* @return 实例对象
*/
@Override
public int update(SchisandraOssBaidu schisandraOssBaidu) {
return this.schisandraOssBaiduDao.updateById(schisandraOssBaidu);
}
/**
* 通过主键删除数据
*
* @param id 主键
* @return 是否成功
*/
@Override
public boolean deleteById(Long id) {
return this.schisandraOssBaiduDao.deleteById(id) > 0;
}
/**
* 条件查询
*
* @param schisandraOssBaidu 条件
* @return 实例对象
*/
@Override
public SchisandraOssBaidu queryByCondition(SchisandraOssBaidu schisandraOssBaidu) {
LambdaQueryWrapper<SchisandraOssBaidu> queryWrapper = Wrappers.<SchisandraOssBaidu>lambdaQuery()
.eq(Objects.nonNull(schisandraOssBaidu.getId()), SchisandraOssBaidu::getId, schisandraOssBaidu.getId())
.eq(Objects.nonNull(schisandraOssBaidu.getUserId()), SchisandraOssBaidu::getUserId, schisandraOssBaidu.getUserId())
.eq(Objects.nonNull(schisandraOssBaidu.getBasePath()), SchisandraOssBaidu::getBasePath, schisandraOssBaidu.getBasePath())
.eq(Objects.nonNull(schisandraOssBaidu.getBucketName()), SchisandraOssBaidu::getBucketName, schisandraOssBaidu.getBucketName())
.eq(Objects.nonNull(schisandraOssBaidu.getAccessKeyId()), SchisandraOssBaidu::getAccessKeyId, schisandraOssBaidu.getAccessKeyId())
.eq(Objects.nonNull(schisandraOssBaidu.getSecretAccessKey()), SchisandraOssBaidu::getSecretAccessKey, schisandraOssBaidu.getSecretAccessKey())
.eq(Objects.nonNull(schisandraOssBaidu.getCnameEnabled()), SchisandraOssBaidu::getCnameEnabled, schisandraOssBaidu.getCnameEnabled())
.eq(Objects.nonNull(schisandraOssBaidu.getEnableHttpAsyncPut()), SchisandraOssBaidu::getEnableHttpAsyncPut, schisandraOssBaidu.getEnableHttpAsyncPut())
.eq(Objects.nonNull(schisandraOssBaidu.getConnectionTimeoutInMillis()), SchisandraOssBaidu::getConnectionTimeoutInMillis, schisandraOssBaidu.getConnectionTimeoutInMillis())
.eq(Objects.nonNull(schisandraOssBaidu.getMaxConnections()), SchisandraOssBaidu::getMaxConnections, schisandraOssBaidu.getMaxConnections())
.eq(Objects.nonNull(schisandraOssBaidu.getProtocol()), SchisandraOssBaidu::getProtocol, schisandraOssBaidu.getProtocol())
.eq(Objects.nonNull(schisandraOssBaidu.getProxyDomain()), SchisandraOssBaidu::getProxyDomain, schisandraOssBaidu.getProxyDomain())
.eq(Objects.nonNull(schisandraOssBaidu.getProxyHost()), SchisandraOssBaidu::getProxyHost, schisandraOssBaidu.getProxyHost())
.eq(Objects.nonNull(schisandraOssBaidu.getProxyPassword()), SchisandraOssBaidu::getProxyPassword, schisandraOssBaidu.getProxyPassword())
.eq(Objects.nonNull(schisandraOssBaidu.getProxyPort()), SchisandraOssBaidu::getProxyPort, schisandraOssBaidu.getProxyPort())
.eq(Objects.nonNull(schisandraOssBaidu.getProxyUsername()), SchisandraOssBaidu::getProxyUsername, schisandraOssBaidu.getProxyUsername())
.eq(Objects.nonNull(schisandraOssBaidu.getProxyWorkstation()), SchisandraOssBaidu::getProxyWorkstation, schisandraOssBaidu.getProxyWorkstation())
.eq(Objects.nonNull(schisandraOssBaidu.getProxyPreemptiveAuthenticationEnable()), SchisandraOssBaidu::getProxyPreemptiveAuthenticationEnable, schisandraOssBaidu.getProxyPreemptiveAuthenticationEnable())
.eq(Objects.nonNull(schisandraOssBaidu.getSocketTimeoutInMillis()), SchisandraOssBaidu::getSocketTimeoutInMillis, schisandraOssBaidu.getSocketTimeoutInMillis())
.eq(Objects.nonNull(schisandraOssBaidu.getSocketBufferSizeInBytes()), SchisandraOssBaidu::getSocketBufferSizeInBytes, schisandraOssBaidu.getSocketBufferSizeInBytes())
.eq(Objects.nonNull(schisandraOssBaidu.getEndpoint()), SchisandraOssBaidu::getEndpoint, schisandraOssBaidu.getEndpoint())
.eq(Objects.nonNull(schisandraOssBaidu.getRegion()), SchisandraOssBaidu::getRegion, schisandraOssBaidu.getRegion())
.eq(Objects.nonNull(schisandraOssBaidu.getRedirectsEnabled()), SchisandraOssBaidu::getRedirectsEnabled, schisandraOssBaidu.getRedirectsEnabled())
.eq(Objects.nonNull(schisandraOssBaidu.getLocalAddress()), SchisandraOssBaidu::getLocalAddress, schisandraOssBaidu.getLocalAddress())
.eq(Objects.nonNull(schisandraOssBaidu.getMaxErrorRetry()), SchisandraOssBaidu::getMaxErrorRetry, schisandraOssBaidu.getMaxErrorRetry())
.eq(Objects.nonNull(schisandraOssBaidu.getMaxDelayInMillis()), SchisandraOssBaidu::getMaxDelayInMillis, schisandraOssBaidu.getMaxDelayInMillis())
.eq(Objects.nonNull(schisandraOssBaidu.getStreamBufferSize()), SchisandraOssBaidu::getStreamBufferSize, schisandraOssBaidu.getStreamBufferSize())
.eq(Objects.nonNull(schisandraOssBaidu.getUserAgent()), SchisandraOssBaidu::getUserAgent, schisandraOssBaidu.getUserAgent())
.eq(Objects.nonNull(schisandraOssBaidu.getPartSize()), SchisandraOssBaidu::getPartSize, schisandraOssBaidu.getPartSize())
.eq(Objects.nonNull(schisandraOssBaidu.getTaskNum()), SchisandraOssBaidu::getTaskNum, schisandraOssBaidu.getTaskNum())
.eq(Objects.nonNull(schisandraOssBaidu.getStatus()), SchisandraOssBaidu::getStatus, schisandraOssBaidu.getStatus())
.eq(Objects.nonNull(schisandraOssBaidu.getOpenAdvancedSetup()), SchisandraOssBaidu::getOpenAdvancedSetup, schisandraOssBaidu.getOpenAdvancedSetup())
.eq(Objects.nonNull(schisandraOssBaidu.getCreatedBy()), SchisandraOssBaidu::getCreatedBy, schisandraOssBaidu.getCreatedBy())
.eq(Objects.nonNull(schisandraOssBaidu.getCreatedTime()), SchisandraOssBaidu::getCreatedTime, schisandraOssBaidu.getCreatedTime())
.eq(Objects.nonNull(schisandraOssBaidu.getUpdateTime()), SchisandraOssBaidu::getUpdateTime, schisandraOssBaidu.getUpdateTime())
.eq(Objects.nonNull(schisandraOssBaidu.getUpdateBy()), SchisandraOssBaidu::getUpdateBy, schisandraOssBaidu.getUpdateBy())
.eq(Objects.nonNull(schisandraOssBaidu.getIsDeleted()), SchisandraOssBaidu::getIsDeleted, schisandraOssBaidu.getIsDeleted())
.eq(Objects.nonNull(schisandraOssBaidu.getExtraJson()), SchisandraOssBaidu::getExtraJson, schisandraOssBaidu.getExtraJson())
.eq(Objects.nonNull(schisandraOssBaidu.getCreateBucket()), SchisandraOssBaidu::getCreateBucket, schisandraOssBaidu.getCreateBucket())
.eq(Objects.nonNull(schisandraOssBaidu.getCheckBucket()), SchisandraOssBaidu::getCheckBucket, schisandraOssBaidu.getCheckBucket())
;
return schisandraOssBaiduDao.selectOne(queryWrapper);
}
}

View File

@@ -0,0 +1,48 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.schisandra.oss.infra.basic.dao.SchisandraOssBaiduDao">
<resultMap id="BaseResultMap" type="com.schisandra.oss.infra.basic.entity.SchisandraOssBaidu">
<id column="id" jdbcType="BIGINT" property="id"/>
<result column="user_id" jdbcType="BIGINT" property="userId"/>
<result column="base_path" jdbcType="VARCHAR" property="basePath"/>
<result column="bucket_name" jdbcType="VARCHAR" property="bucketName"/>
<result column="access_key_id" jdbcType="VARCHAR" property="accessKeyId"/>
<result column="secret_access_key" jdbcType="VARCHAR" property="secretAccessKey"/>
<result column="cname_enabled" jdbcType="VARCHAR" property="cnameEnabled"/>
<result column="enable_http_async_put" jdbcType="VARCHAR" property="enableHttpAsyncPut"/>
<result column="connection_timeoutIn_millis" jdbcType="INTEGER" property="connectionTimeoutInMillis"/>
<result column="max_connections" jdbcType="INTEGER" property="maxConnections"/>
<result column="protocol" jdbcType="VARCHAR" property="protocol"/>
<result column="proxy_domain" jdbcType="VARCHAR" property="proxyDomain"/>
<result column="proxy_host" jdbcType="VARCHAR" property="proxyHost"/>
<result column="proxy_password" jdbcType="VARCHAR" property="proxyPassword"/>
<result column="proxy_port" jdbcType="INTEGER" property="proxyPort"/>
<result column="proxy_username" jdbcType="VARCHAR" property="proxyUsername"/>
<result column="proxy_workstation" jdbcType="VARCHAR" property="proxyWorkstation"/>
<result column="proxy_preemptive_authentication_enable" jdbcType="VARCHAR" property="proxyPreemptiveAuthenticationEnable"/>
<result column="socket_timeoutIn_millis" jdbcType="INTEGER" property="socketTimeoutInMillis"/>
<result column="socket_buffer_sizeIn_bytes" jdbcType="INTEGER" property="socketBufferSizeInBytes"/>
<result column="endpoint" jdbcType="VARCHAR" property="endpoint"/>
<result column="region" jdbcType="VARCHAR" property="region"/>
<result column="redirects_enabled" jdbcType="VARCHAR" property="redirectsEnabled"/>
<result column="local_address" jdbcType="VARCHAR" property="localAddress"/>
<result column="max_error_retry" jdbcType="INTEGER" property="maxErrorRetry"/>
<result column="max_delayIn_millis" jdbcType="INTEGER" property="maxDelayInMillis"/>
<result column="stream_buffer_size" jdbcType="DOUBLE" property="streamBufferSize"/>
<result column="user_agent" jdbcType="VARCHAR" property="userAgent"/>
<result column="part_size" jdbcType="INTEGER" property="partSize"/>
<result column="task_num" jdbcType="INTEGER" property="taskNum"/>
<result column="status" jdbcType="VARCHAR" property="status"/>
<result column="open_advanced_setup" jdbcType="VARCHAR" property="openAdvancedSetup"/>
<result column="created_by" jdbcType="VARCHAR" property="createdBy"/>
<result column="created_time" jdbcType="TIMESTAMP" property="createdTime"/>
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
<result column="update_by" jdbcType="VARCHAR" property="updateBy"/>
<result column="is_deleted" jdbcType="INTEGER" property="isDeleted"/>
<result column="extra_json" jdbcType="VARCHAR" property="extraJson"/>
<result column="create_bucket" jdbcType="VARCHAR" property="createBucket"/>
<result column="check_bucket" jdbcType="VARCHAR" property="checkBucket"/>
</resultMap>
</mapper>