Merge remote-tracking branch 'refs/remotes/origin/dev'
# Conflicts: # schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-application/schisandra-cloud-storage-auth-application-controller/src/main/java/com/schisandra/auth/application/controller/SchisandraAuthUserController.java # schisandra-cloud-storage-oss/schisandra-cloud-storage-oss-application/schisandra-cloud-storage-oss-application-controller/src/main/java/com/schisandra/oss/application/controller/SchisandraOssMinioController.java # schisandra-cloud-storage-oss/schisandra-cloud-storage-oss-application/schisandra-cloud-storage-oss-application-controller/src/main/java/com/schisandra/oss/application/controller/SchisandraOssUpController.java
This commit is contained in:
@@ -29,6 +29,8 @@ import lombok.SneakyThrows;
|
|||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.lang3.ObjectUtils;
|
import org.apache.commons.lang3.ObjectUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.cache.annotation.Cacheable;
|
||||||
import org.springframework.http.HttpRequest;
|
import org.springframework.http.HttpRequest;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
@@ -372,6 +374,23 @@ public class SchisandraAuthUserController {
|
|||||||
}
|
}
|
||||||
return Result.ok(JSONObject.parseObject(result));
|
return Result.ok(JSONObject.parseObject(result));
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* @description: 获取用户信息
|
||||||
|
* @param: [userId]
|
||||||
|
* @return: com.schisandra.auth.common.entity.Result<com.schisandra.auth.application.dto.SchisandraAuthUserDTO>
|
||||||
|
* @author zlg
|
||||||
|
* @date: 2024/7/11 9:39
|
||||||
|
*/
|
||||||
|
@GetMapping("getUserInfo")
|
||||||
|
public Result<SchisandraAuthUserDTO> getUserInfo(@RequestParam("userId") Long userId) {
|
||||||
|
SchisandraAuthUserDTO schisandraAuthUserDTO = SchisandraAuthUserDTOConverter.INSTANCE.convertBOToDTO(schisandraAuthUserDomainService.queryById(userId));
|
||||||
|
if ( schisandraAuthUserDTO== null) {
|
||||||
|
return Result.fail("该用户不存在");
|
||||||
|
}else {
|
||||||
|
return Result.ok(schisandraAuthUserDTO);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -5,6 +5,9 @@ import com.schisandra.auth.common.entity.Result;
|
|||||||
import com.schisandra.auth.domain.bo.SchisandraAuthUserBO;
|
import com.schisandra.auth.domain.bo.SchisandraAuthUserBO;
|
||||||
import com.schisandra.auth.infra.basic.entity.SchisandraAuthUser;
|
import com.schisandra.auth.infra.basic.entity.SchisandraAuthUser;
|
||||||
import me.zhyd.oauth.model.AuthUser;
|
import me.zhyd.oauth.model.AuthUser;
|
||||||
|
import org.springframework.cache.annotation.CacheEvict;
|
||||||
|
import org.springframework.cache.annotation.CachePut;
|
||||||
|
import org.springframework.cache.annotation.Cacheable;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
@@ -61,6 +64,7 @@ public interface SchisandraAuthUserDomainService {
|
|||||||
* @author schisandra
|
* @author schisandra
|
||||||
* @date 2024/3/21 23:14
|
* @date 2024/3/21 23:14
|
||||||
*/
|
*/
|
||||||
|
@CachePut(value = "userInfo", key = "#schisandraAuthUserBO.id")
|
||||||
Object update(SchisandraAuthUserBO schisandraAuthUserBO);
|
Object update(SchisandraAuthUserBO schisandraAuthUserBO);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -70,6 +74,7 @@ public interface SchisandraAuthUserDomainService {
|
|||||||
* @author: landaiqing
|
* @author: landaiqing
|
||||||
* @date: 2024/5/26 17:27
|
* @date: 2024/5/26 17:27
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Result insertAuthUserByOauth(AuthUser data, String type);
|
Result insertAuthUserByOauth(AuthUser data, String type);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -79,7 +84,8 @@ public interface SchisandraAuthUserDomainService {
|
|||||||
* @author: landaiqing
|
* @author: landaiqing
|
||||||
* @date: 2024/5/26 17:27
|
* @date: 2024/5/26 17:27
|
||||||
*/
|
*/
|
||||||
SchisandraAuthUserBO queryById(SchisandraAuthUserBO schisandraAuthUserBO);
|
@Cacheable(value = "userInfo", key = "#userId")
|
||||||
|
SchisandraAuthUserBO queryById(Long userId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param schisandraAuthUserBO
|
* @param schisandraAuthUserBO
|
||||||
@@ -95,6 +101,7 @@ public interface SchisandraAuthUserDomainService {
|
|||||||
* @description 删除用户(物理)
|
* @description 删除用户(物理)
|
||||||
* @author msz
|
* @author msz
|
||||||
*/
|
*/
|
||||||
|
@CacheEvict(value = "userInfo",key = "id")
|
||||||
Object deleteById(Long id);
|
Object deleteById(Long id);
|
||||||
|
|
||||||
SchisandraAuthUser queryByPhone(String phone);
|
SchisandraAuthUser queryByPhone(String phone);
|
||||||
|
@@ -167,15 +167,15 @@ public class SchisandraAuthUserDomainServiceImpl implements SchisandraAuthUserDo
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param schisandraAuthUserBO
|
* @param Long
|
||||||
* @return
|
* @return
|
||||||
* @description 查询用户信息
|
* @description 查询用户信息
|
||||||
* @author msz
|
* @author msz
|
||||||
* @date 2024/4/3 22:10
|
* @date 2024/4/3 22:10
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public SchisandraAuthUserBO queryById(SchisandraAuthUserBO schisandraAuthUserBO) {
|
public SchisandraAuthUserBO queryById(Long userId) {
|
||||||
SchisandraAuthUser schisandraAuthUser = schisandraAuthUserService.queryById(schisandraAuthUserBO.getId());
|
SchisandraAuthUser schisandraAuthUser = schisandraAuthUserService.queryById(userId);
|
||||||
SchisandraAuthUserBO schisandraAuthUserBO1 = SchisandraAuthUserBOConverter.INSTANCE.convertEntityToBO(schisandraAuthUser);
|
SchisandraAuthUserBO schisandraAuthUserBO1 = SchisandraAuthUserBOConverter.INSTANCE.convertEntityToBO(schisandraAuthUser);
|
||||||
return schisandraAuthUserBO1;
|
return schisandraAuthUserBO1;
|
||||||
}
|
}
|
||||||
|
@@ -3,6 +3,7 @@ package com.schisandra.auth;
|
|||||||
import org.mybatis.spring.annotation.MapperScan;
|
import org.mybatis.spring.annotation.MapperScan;
|
||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
import org.springframework.cache.annotation.EnableCaching;
|
||||||
import org.springframework.cloud.openfeign.EnableFeignClients;
|
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||||
import org.springframework.context.annotation.ComponentScan;
|
import org.springframework.context.annotation.ComponentScan;
|
||||||
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
||||||
@@ -18,6 +19,7 @@ import org.springframework.transaction.annotation.EnableTransactionManagement;
|
|||||||
@MapperScan("com.schisandra.**.dao")
|
@MapperScan("com.schisandra.**.dao")
|
||||||
@EnableFeignClients(basePackages = "com.schisandra")
|
@EnableFeignClients(basePackages = "com.schisandra")
|
||||||
@EnableTransactionManagement
|
@EnableTransactionManagement
|
||||||
|
@EnableCaching
|
||||||
public class AuthApplication {
|
public class AuthApplication {
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
SpringApplication.run(AuthApplication.class);
|
SpringApplication.run(AuthApplication.class);
|
||||||
|
@@ -27,6 +27,11 @@ spring:
|
|||||||
enabled: true
|
enabled: true
|
||||||
config:
|
config:
|
||||||
enabled: true
|
enabled: true
|
||||||
|
#caffeine缓存
|
||||||
|
cache:
|
||||||
|
type: caffeine
|
||||||
|
caffeine:
|
||||||
|
spec: maximumSize=10000,expireAfterAccess=60s
|
||||||
# redis配置
|
# redis配置
|
||||||
redis:
|
redis:
|
||||||
# Redis数据库索引(默认为0)
|
# Redis数据库索引(默认为0)
|
||||||
@@ -108,3 +113,4 @@ rocketmq:
|
|||||||
producer:
|
producer:
|
||||||
group: schisandra-cloud-storage-auth-group
|
group: schisandra-cloud-storage-auth-group
|
||||||
send-message-timeout: 6000
|
send-message-timeout: 6000
|
||||||
|
|
||||||
|
@@ -91,5 +91,12 @@
|
|||||||
<artifactId>schisandra-cloud-storage-asyncTool</artifactId>
|
<artifactId>schisandra-cloud-storage-asyncTool</artifactId>
|
||||||
<version>1.4.1-SNAPSHOT</version>
|
<version>1.4.1-SNAPSHOT</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.qiniu</groupId>
|
||||||
|
<artifactId>qiniu-java-sdk</artifactId>
|
||||||
|
<version>7.13.0</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
||||||
|
@@ -2,21 +2,22 @@ package com.schisandra.oss.application.controller;
|
|||||||
|
|
||||||
import cn.hutool.extra.spring.SpringUtil;
|
import cn.hutool.extra.spring.SpringUtil;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.amazonaws.util.IOUtils;
|
|
||||||
import com.google.common.base.Preconditions;
|
import com.google.common.base.Preconditions;
|
||||||
|
|
||||||
import com.schisandra.oss.application.convert.SchisandraOssAliDTOConverter;
|
import com.schisandra.oss.application.convert.SchisandraOssAliDTOConverter;
|
||||||
import com.schisandra.oss.application.dto.SchisandraOssAliDTO;
|
import com.schisandra.oss.application.dto.SchisandraOssAliDTO;
|
||||||
import com.schisandra.oss.application.oss.core.ali.AliOssClient;
|
import com.schisandra.oss.application.oss.core.ali.AliOssClient;
|
||||||
import com.schisandra.oss.application.oss.core.ali.AliOssConfiguration;
|
import com.schisandra.oss.application.oss.core.ali.AliOssConfiguration;
|
||||||
import com.schisandra.oss.application.oss.core.minio.MinioOssClient;
|
|
||||||
import com.schisandra.oss.application.oss.model.OssInfo;
|
import com.schisandra.oss.application.oss.model.OssInfo;
|
||||||
import com.schisandra.oss.common.entity.Result;
|
import com.schisandra.oss.common.entity.Result;
|
||||||
import com.schisandra.oss.domain.bo.SchisandraOssAliBO;
|
import com.schisandra.oss.domain.bo.SchisandraOssAliBO;
|
||||||
|
import com.schisandra.oss.domain.redis.RedisUtil;
|
||||||
import com.schisandra.oss.domain.service.SchisandraOssAliDomainService;
|
import com.schisandra.oss.domain.service.SchisandraOssAliDomainService;
|
||||||
import io.minio.errors.*;
|
|
||||||
|
import com.schisandra.oss.infra.basic.dao.SchisandraOssAliDao;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
@@ -26,8 +27,10 @@ import javax.servlet.http.HttpServletResponse;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.net.URLEncoder;
|
import java.net.URLEncoder;
|
||||||
import java.security.InvalidKeyException;
|
import java.text.SimpleDateFormat;
|
||||||
import java.security.NoSuchAlgorithmException;
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* controller
|
* controller
|
||||||
@@ -44,8 +47,21 @@ public class SchisandraOssAliController {
|
|||||||
private SchisandraOssAliDomainService schisandraOssAliDomainService;
|
private SchisandraOssAliDomainService schisandraOssAliDomainService;
|
||||||
@Resource
|
@Resource
|
||||||
private AliOssConfiguration aliOssConfiguration;
|
private AliOssConfiguration aliOssConfiguration;
|
||||||
@Autowired
|
|
||||||
private AliOssClient aliOssClient;
|
private final String USER_OSS_PREFIX = "oss:user:heat";
|
||||||
|
@Resource
|
||||||
|
RedisUtil redisUtil;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 返回ali表所有数据
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("returnAll")
|
||||||
|
public List<SchisandraOssAliDTO> returnAll() {
|
||||||
|
return aliOssConfiguration.selectAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@GetMapping("init")
|
@GetMapping("init")
|
||||||
public void init(@RequestParam String userId){
|
public void init(@RequestParam String userId){
|
||||||
@@ -123,22 +139,30 @@ public class SchisandraOssAliController {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 获取文件目录信息
|
||||||
|
* @param: [target, userId, dirName]
|
||||||
|
* @return: com.schisandra.oss.common.entity.Result<java.lang.String>
|
||||||
|
* @date: 2024/7/5 13:55
|
||||||
|
*/
|
||||||
|
@GetMapping("listDir")
|
||||||
|
public Result<String> listAliDir(@RequestParam String userId,@RequestParam String bucket,@RequestParam String prefix) throws Exception {
|
||||||
|
Preconditions.checkNotNull(userId, "不能为空");
|
||||||
|
AliOssClient bean = SpringUtil.getBean(userId);
|
||||||
|
bean.getAliOssConfig().setBucketName(bucket);
|
||||||
|
if(prefix==null)
|
||||||
|
prefix="";
|
||||||
|
return Result.ok(bean.listAliInfo(bucket,prefix));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查找bucket
|
* 查找bucket
|
||||||
* @param userId
|
* @param userId
|
||||||
* @return
|
|
||||||
* @throws ServerException
|
|
||||||
* @throws InsufficientDataException
|
|
||||||
* @throws ErrorResponseException
|
|
||||||
* @throws IOException
|
|
||||||
* @throws NoSuchAlgorithmException
|
|
||||||
* @throws InvalidKeyException
|
|
||||||
* @throws InvalidResponseException
|
|
||||||
* @throws XmlParserException
|
|
||||||
* @throws InternalException
|
|
||||||
*/
|
*/
|
||||||
@PostMapping("seleteBucket")
|
@PostMapping("seleteBucket")
|
||||||
public Result<String> seleteBucket(@RequestParam String userId) throws ServerException, InsufficientDataException, ErrorResponseException, IOException, NoSuchAlgorithmException, InvalidKeyException, InvalidResponseException, XmlParserException, InternalException {
|
public Result<String> seleteBucket(@RequestParam String userId) {
|
||||||
Preconditions.checkNotNull(userId, "不能为空");
|
Preconditions.checkNotNull(userId, "不能为空");
|
||||||
AliOssClient bean = SpringUtil.getBean(userId);
|
AliOssClient bean = SpringUtil.getBean(userId);
|
||||||
return Result.ok(bean.selectAllBucket());
|
return Result.ok(bean.selectAllBucket());
|
||||||
@@ -182,11 +206,24 @@ public class SchisandraOssAliController {
|
|||||||
* @return: void
|
* @return: void
|
||||||
* @date: 2024/6/26 14:34
|
* @date: 2024/6/26 14:34
|
||||||
*/
|
*/
|
||||||
@PostMapping("uploadMinioFile")
|
@PostMapping("uploadFile")
|
||||||
public Result<OssInfo> uploadMinioFile(@RequestParam String userId, @RequestParam MultipartFile file, @RequestParam String fileName, @RequestParam String bucket) throws IOException {
|
public Result<OssInfo> uploadAliFile(@RequestParam String userId, @RequestParam MultipartFile file, @RequestParam String fileName, @RequestParam String bucket) throws IOException {
|
||||||
Preconditions.checkNotNull(userId, "不能为空");
|
Preconditions.checkNotNull(userId, "不能为空");
|
||||||
Preconditions.checkNotNull(fileName, "不能为空");
|
Preconditions.checkNotNull(fileName, "不能为空");
|
||||||
Preconditions.checkNotNull(bucket, "不能为空");
|
Preconditions.checkNotNull(bucket, "不能为空");
|
||||||
|
|
||||||
|
//设置热力图
|
||||||
|
Date date =new Date();
|
||||||
|
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
||||||
|
String formattedDate = dateFormat.format(date);
|
||||||
|
String key = redisUtil.buildKey(USER_OSS_PREFIX+":"+userId,formattedDate);
|
||||||
|
int count=1;
|
||||||
|
if (redisUtil.exist(key)){
|
||||||
|
count= Integer.parseInt(redisUtil.get(key));
|
||||||
|
redisUtil.set(key, String.valueOf(count+1));
|
||||||
|
}else {
|
||||||
|
redisUtil.set(key, String.valueOf(1));
|
||||||
|
}
|
||||||
// 获取文件输入流
|
// 获取文件输入流
|
||||||
InputStream is = file.getInputStream();
|
InputStream is = file.getInputStream();
|
||||||
AliOssClient bean = SpringUtil.getBean(userId);
|
AliOssClient bean = SpringUtil.getBean(userId);
|
||||||
@@ -202,7 +239,7 @@ public class SchisandraOssAliController {
|
|||||||
* @return: voiD
|
* @return: voiD
|
||||||
* @date: 2024/6/26 13:56
|
* @date: 2024/6/26 13:56
|
||||||
*/
|
*/
|
||||||
@GetMapping("downloadAliFile")
|
@GetMapping("downloadFile")
|
||||||
public void getAliFile(@RequestParam String bucket, @RequestParam String userId, @RequestParam String filePath, HttpServletResponse response) throws Exception {
|
public void getAliFile(@RequestParam String bucket, @RequestParam String userId, @RequestParam String filePath, HttpServletResponse response) throws Exception {
|
||||||
Preconditions.checkNotNull(bucket, "不能为空");
|
Preconditions.checkNotNull(bucket, "不能为空");
|
||||||
Preconditions.checkNotNull(userId, "不能为空");
|
Preconditions.checkNotNull(userId, "不能为空");
|
||||||
@@ -221,8 +258,8 @@ public class SchisandraOssAliController {
|
|||||||
* @return: void
|
* @return: void
|
||||||
* @date: 2024/6/26 14:34
|
* @date: 2024/6/26 14:34
|
||||||
*/
|
*/
|
||||||
@PostMapping("deleteAliFile")
|
@PostMapping("deleteFile")
|
||||||
public Result deleteMinioFile(@RequestParam String bucket, @RequestParam String userId, @RequestParam String filePath) {
|
public Result deleteAliFile(@RequestParam String bucket, @RequestParam String userId, @RequestParam String filePath) {
|
||||||
Preconditions.checkNotNull(bucket, "不能为空");
|
Preconditions.checkNotNull(bucket, "不能为空");
|
||||||
Preconditions.checkNotNull(userId, "不能为空");
|
Preconditions.checkNotNull(userId, "不能为空");
|
||||||
Preconditions.checkNotNull(filePath, "不能为空");
|
Preconditions.checkNotNull(filePath, "不能为空");
|
||||||
@@ -239,8 +276,8 @@ public class SchisandraOssAliController {
|
|||||||
* @return: com.schisandra.oss.common.entity.Result
|
* @return: com.schisandra.oss.common.entity.Result
|
||||||
* @date: 2024/6/27 9:41
|
* @date: 2024/6/27 9:41
|
||||||
*/
|
*/
|
||||||
@PostMapping("renameAliFile")
|
@PostMapping("renameFile")
|
||||||
public Result renameMinioFile(@RequestParam String userId, @RequestParam String bucket, @RequestParam String oldFileName, @RequestParam String newFileName) throws IOException {
|
public Result renameAliFile(@RequestParam String userId, @RequestParam String bucket, @RequestParam String oldFileName, @RequestParam String newFileName) throws IOException {
|
||||||
|
|
||||||
Preconditions.checkNotNull(userId, "不能为空");
|
Preconditions.checkNotNull(userId, "不能为空");
|
||||||
Preconditions.checkNotNull(bucket, "不能为空");
|
Preconditions.checkNotNull(bucket, "不能为空");
|
||||||
|
@@ -1,18 +1,21 @@
|
|||||||
package com.schisandra.oss.application.controller;
|
package com.schisandra.oss.application.controller;
|
||||||
|
|
||||||
|
import cn.hutool.extra.spring.SpringUtil;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.google.common.base.Preconditions;
|
import com.google.common.base.Preconditions;
|
||||||
import com.schisandra.oss.application.convert.SchisandraOssFtpDTOConverter;
|
import com.schisandra.oss.application.convert.SchisandraOssFtpDTOConverter;
|
||||||
import com.schisandra.oss.application.dto.SchisandraOssFtpDTO;
|
import com.schisandra.oss.application.dto.SchisandraOssFtpDTO;
|
||||||
|
import com.schisandra.oss.application.oss.core.ftp.FtpOssClient;
|
||||||
|
import com.schisandra.oss.application.oss.model.OssInfo;
|
||||||
import com.schisandra.oss.common.entity.Result;
|
import com.schisandra.oss.common.entity.Result;
|
||||||
import com.schisandra.oss.domain.bo.SchisandraOssFtpBO;
|
import com.schisandra.oss.domain.bo.SchisandraOssFtpBO;
|
||||||
import com.schisandra.oss.domain.service.SchisandraOssFtpDomainService;
|
import com.schisandra.oss.domain.service.SchisandraOssFtpDomainService;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ftp存储配置表 controller
|
* ftp存储配置表 controller
|
||||||
@@ -157,4 +160,21 @@ public class SchisandraOssFtpController {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 上传文件
|
||||||
|
* @param: [schisandraOssFTPDTO]
|
||||||
|
* @return: void
|
||||||
|
* @date: 2024/6/26 14:34
|
||||||
|
*/
|
||||||
|
@PostMapping("uploadFtpFile")
|
||||||
|
public Result<OssInfo> uploadAliFile(@RequestParam String userId, @RequestParam MultipartFile file, @RequestParam String fileName, @RequestParam String bucket) throws IOException {
|
||||||
|
Preconditions.checkNotNull(userId, "不能为空");
|
||||||
|
Preconditions.checkNotNull(fileName, "不能为空");
|
||||||
|
Preconditions.checkNotNull(bucket, "不能为空");
|
||||||
|
// 获取文件输入流
|
||||||
|
InputStream is = file.getInputStream();
|
||||||
|
FtpOssClient bean = SpringUtil.getBean(userId);
|
||||||
|
return Result.ok(bean.upLoad(is, fileName, true));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -5,7 +5,9 @@ import cn.hutool.extra.spring.SpringUtil;
|
|||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.amazonaws.util.IOUtils;
|
import com.amazonaws.util.IOUtils;
|
||||||
import com.google.common.base.Preconditions;
|
import com.google.common.base.Preconditions;
|
||||||
|
import com.google.gson.Gson;
|
||||||
import com.schisandra.oss.application.convert.SchisandraOssMinioDTOConverter;
|
import com.schisandra.oss.application.convert.SchisandraOssMinioDTOConverter;
|
||||||
|
import com.schisandra.oss.application.dto.SchisandraOssAliDTO;
|
||||||
import com.schisandra.oss.application.dto.SchisandraOssMinioDTO;
|
import com.schisandra.oss.application.dto.SchisandraOssMinioDTO;
|
||||||
import com.schisandra.oss.application.oss.core.minio.MinioOssClient;
|
import com.schisandra.oss.application.oss.core.minio.MinioOssClient;
|
||||||
import com.schisandra.oss.application.oss.core.minio.MinioOssConfiguration;
|
import com.schisandra.oss.application.oss.core.minio.MinioOssConfiguration;
|
||||||
@@ -15,6 +17,7 @@ import com.schisandra.oss.domain.bo.SchisandraOssMinioBO;
|
|||||||
import com.schisandra.oss.domain.redis.RedisUtil;
|
import com.schisandra.oss.domain.redis.RedisUtil;
|
||||||
import com.schisandra.oss.domain.service.SchisandraOssMinioDomainService;
|
import com.schisandra.oss.domain.service.SchisandraOssMinioDomainService;
|
||||||
import io.minio.errors.*;
|
import io.minio.errors.*;
|
||||||
|
import lombok.Data;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
@@ -27,6 +30,9 @@ import java.io.InputStream;
|
|||||||
import java.net.URLEncoder;
|
import java.net.URLEncoder;
|
||||||
import java.security.InvalidKeyException;
|
import java.security.InvalidKeyException;
|
||||||
import java.security.NoSuchAlgorithmException;
|
import java.security.NoSuchAlgorithmException;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -47,11 +53,21 @@ public class SchisandraOssMinioController {
|
|||||||
private SchisandraOssMinioDomainService schisandraOssMinioDomainService;
|
private SchisandraOssMinioDomainService schisandraOssMinioDomainService;
|
||||||
@Resource
|
@Resource
|
||||||
MinioOssConfiguration minioOssConfiguration;
|
MinioOssConfiguration minioOssConfiguration;
|
||||||
|
private final String USER_OSS_PREFIX = "oss:user:heat";
|
||||||
@Resource
|
@Resource
|
||||||
RedisUtil redisUtil;
|
RedisUtil redisUtil;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 返回minio表所有数据
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("returnAll")
|
||||||
|
public List<SchisandraOssMinioDTO> returnAll() {
|
||||||
|
return minioOssConfiguration.selectAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description: minio 初始化
|
* @description: minio 初始化
|
||||||
* @param: []
|
* @param: []
|
||||||
@@ -82,7 +98,6 @@ public class SchisandraOssMinioController {
|
|||||||
*/
|
*/
|
||||||
@GetMapping("listMinioDir")
|
@GetMapping("listMinioDir")
|
||||||
public Result<String> listMinioInfo( @RequestParam String userId, @RequestParam String dirName,@RequestParam String bucket) throws Exception {
|
public Result<String> listMinioInfo( @RequestParam String userId, @RequestParam String dirName,@RequestParam String bucket) throws Exception {
|
||||||
Preconditions.checkNotNull(bucket, "不能为空");
|
|
||||||
Preconditions.checkNotNull(userId, "不能为空");
|
Preconditions.checkNotNull(userId, "不能为空");
|
||||||
MinioOssClient bean = SpringUtil.getBean(userId);
|
MinioOssClient bean = SpringUtil.getBean(userId);
|
||||||
bean.getMinioOssConfig().setBucketName(bucket);
|
bean.getMinioOssConfig().setBucketName(bucket);
|
||||||
@@ -141,15 +156,29 @@ public class SchisandraOssMinioController {
|
|||||||
* @date: 2024/6/26 14:34
|
* @date: 2024/6/26 14:34
|
||||||
*/
|
*/
|
||||||
@PostMapping("uploadMinioFile")
|
@PostMapping("uploadMinioFile")
|
||||||
public Result<OssInfo> uploadMinioFile(@RequestParam String userId, @RequestParam MultipartFile file, @RequestParam String fileName, @RequestParam String bucket) throws IOException {
|
public Result<Object> uploadMinioFile(@RequestParam String userId, @RequestParam MultipartFile file, @RequestParam String fileName, @RequestParam String bucket) throws IOException {
|
||||||
Preconditions.checkNotNull(userId, "不能为空");
|
Preconditions.checkNotNull(userId, "不能为空");
|
||||||
Preconditions.checkNotNull(fileName, "不能为空");
|
Preconditions.checkNotNull(fileName, "不能为空");
|
||||||
Preconditions.checkNotNull(bucket, "不能为空");
|
Preconditions.checkNotNull(bucket, "不能为空");
|
||||||
|
//设置热力图
|
||||||
|
Date date =new Date();
|
||||||
|
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
||||||
|
String formattedDate = dateFormat.format(date);
|
||||||
|
String key = redisUtil.buildKey(USER_OSS_PREFIX+":"+userId,formattedDate);
|
||||||
|
int count=1;
|
||||||
|
if (redisUtil.exist(key)){
|
||||||
|
count= Integer.parseInt(redisUtil.get(key));
|
||||||
|
redisUtil.set(key, String.valueOf(count+1));
|
||||||
|
}else {
|
||||||
|
redisUtil.set(key, String.valueOf(1));
|
||||||
|
}
|
||||||
|
|
||||||
// 获取文件输入流
|
// 获取文件输入流
|
||||||
InputStream is = file.getInputStream();
|
InputStream is = file.getInputStream();
|
||||||
MinioOssClient bean = SpringUtil.getBean(userId);
|
MinioOssClient bean = SpringUtil.getBean(userId);
|
||||||
bean.getMinioOssConfig().setBucketName(bucket);
|
bean.getMinioOssConfig().setBucketName(bucket);
|
||||||
return Result.ok(bean.upLoad(is, fileName, true));
|
return Result.ok(bean.upLoad(is, fileName, true));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -285,6 +314,7 @@ public class SchisandraOssMinioController {
|
|||||||
bean.getMinioOssConfig().setBucketName(bucket);
|
bean.getMinioOssConfig().setBucketName(bucket);
|
||||||
return Result.ok(bean.deleteBucket(bucket));
|
return Result.ok(bean.deleteBucket(bucket));
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("get")
|
@PostMapping("get")
|
||||||
public SchisandraOssMinioDTO getMinioOss(@RequestParam String userId) {
|
public SchisandraOssMinioDTO getMinioOss(@RequestParam String userId) {
|
||||||
return SchisandraOssMinioDTOConverter.INSTANCE.convertBOToDTO(schisandraOssMinioDomainService.getMinioConfig(Long.valueOf(userId)));
|
return SchisandraOssMinioDTOConverter.INSTANCE.convertBOToDTO(schisandraOssMinioDomainService.getMinioConfig(Long.valueOf(userId)));
|
||||||
|
@@ -1,18 +1,30 @@
|
|||||||
package com.schisandra.oss.application.controller;
|
package com.schisandra.oss.application.controller;
|
||||||
|
|
||||||
|
import cn.hutool.extra.spring.SpringUtil;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.google.common.base.Preconditions;
|
import com.google.common.base.Preconditions;
|
||||||
import com.schisandra.oss.application.convert.SchisandraOssQiniuDTOConverter;
|
import com.schisandra.oss.application.convert.SchisandraOssQiniuDTOConverter;
|
||||||
import com.schisandra.oss.application.dto.SchisandraOssQiniuDTO;
|
import com.schisandra.oss.application.dto.SchisandraOssQiniuDTO;
|
||||||
|
import com.schisandra.oss.application.dto.SchisandraOssUpDTO;
|
||||||
|
import com.schisandra.oss.application.oss.core.qiniu.QiNiuOssClient;
|
||||||
|
import com.schisandra.oss.application.oss.core.qiniu.QiNiuOssConfiguration;
|
||||||
|
import com.schisandra.oss.application.oss.model.OssInfo;
|
||||||
import com.schisandra.oss.common.entity.Result;
|
import com.schisandra.oss.common.entity.Result;
|
||||||
import com.schisandra.oss.domain.bo.SchisandraOssQiniuBO;
|
import com.schisandra.oss.domain.bo.SchisandraOssQiniuBO;
|
||||||
|
import com.schisandra.oss.domain.redis.RedisUtil;
|
||||||
import com.schisandra.oss.domain.service.SchisandraOssQiniuDomainService;
|
import com.schisandra.oss.domain.service.SchisandraOssQiniuDomainService;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import javax.servlet.ServletOutputStream;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.net.URLEncoder;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 七牛云对象存储配置表 controller
|
* 七牛云对象存储配置表 controller
|
||||||
@@ -27,6 +39,226 @@ public class SchisandraOssQiniuController {
|
|||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private SchisandraOssQiniuDomainService schisandraOssQiniuDomainService;
|
private SchisandraOssQiniuDomainService schisandraOssQiniuDomainService;
|
||||||
|
@Resource
|
||||||
|
private QiNiuOssConfiguration qiNiuOssConfiguration;
|
||||||
|
|
||||||
|
private final String USER_OSS_PREFIX = "oss:user:heat";
|
||||||
|
@Resource
|
||||||
|
RedisUtil redisUtil;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 返回七牛表所有数据
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("returnAll")
|
||||||
|
public List<SchisandraOssQiniuDTO> returnAll() {
|
||||||
|
return qiNiuOssConfiguration.selectAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 获取文件目录信息
|
||||||
|
* @param: [target, userId, dirName]
|
||||||
|
* @return: com.schisandra.oss.common.entity.Result<java.lang.String>
|
||||||
|
* @date: 2024/6/26 13:55
|
||||||
|
*/
|
||||||
|
@GetMapping("listDir")
|
||||||
|
public Result<String> listQiniuInfo(@RequestParam String userId, @RequestParam String prefix, @RequestParam String bucket) throws Exception {
|
||||||
|
Preconditions.checkNotNull(userId, "不能为空");
|
||||||
|
QiNiuOssClient bean = SpringUtil.getBean(userId);
|
||||||
|
bean.getQiNiuOssConfig().setBucketName(bucket);
|
||||||
|
return Result.ok(bean.listfile(bucket, prefix));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 重命名文件
|
||||||
|
* @param: [userId, bucket, oldFileName, newFileName]
|
||||||
|
* @return: com.schisandra.oss.common.entity.Result
|
||||||
|
* @date: 2024/6/27 9:41
|
||||||
|
*/
|
||||||
|
@PostMapping("renameFile")
|
||||||
|
public Result renameQiniuFile(@RequestParam String userId, @RequestParam String bucket, @RequestParam String oldFileName, @RequestParam String newFileName) throws IOException {
|
||||||
|
|
||||||
|
Preconditions.checkNotNull(userId, "不能为空");
|
||||||
|
Preconditions.checkNotNull(bucket, "不能为空");
|
||||||
|
Preconditions.checkNotNull(oldFileName, "不能为空");
|
||||||
|
Preconditions.checkNotNull(newFileName, "不能为空");
|
||||||
|
QiNiuOssClient bean = SpringUtil.getBean(userId);
|
||||||
|
bean.getQiNiuOssConfig().setBucketName(bucket);
|
||||||
|
try {
|
||||||
|
bean.rename(oldFileName, newFileName);
|
||||||
|
}catch (Exception e){
|
||||||
|
return Result.fail(e.getMessage());
|
||||||
|
}
|
||||||
|
return Result.ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 拷贝文件
|
||||||
|
* @param: [userId, bucket, oldFilePath, newFilePath]
|
||||||
|
* @return: com.schisandra.oss.common.entity.Result
|
||||||
|
* @date: 2024/6/27 9:52
|
||||||
|
*/
|
||||||
|
@PostMapping("copyFile")
|
||||||
|
public Result copyQiniuFile(@RequestParam String userId, @RequestParam String bucket, @RequestParam String oldFilePath, @RequestParam String newFilePath) throws IOException {
|
||||||
|
|
||||||
|
Preconditions.checkNotNull(userId, "不能为空");
|
||||||
|
Preconditions.checkNotNull(bucket, "不能为空");
|
||||||
|
Preconditions.checkNotNull(oldFilePath, "不能为空");
|
||||||
|
Preconditions.checkNotNull(newFilePath, "不能为空");
|
||||||
|
QiNiuOssClient bean = SpringUtil.getBean(userId);
|
||||||
|
bean.getQiNiuOssConfig().setBucketName(bucket);
|
||||||
|
try {
|
||||||
|
bean.copy(oldFilePath, newFilePath);
|
||||||
|
}catch (Exception e){
|
||||||
|
return Result.fail(e.getMessage());
|
||||||
|
}
|
||||||
|
return Result.ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 下载文件
|
||||||
|
* @param: [schisandraOssMinioDTO]
|
||||||
|
* @return: void
|
||||||
|
* @author sjm
|
||||||
|
* @date: 2024/7/8 13:56
|
||||||
|
*/
|
||||||
|
@GetMapping("downloadFile")
|
||||||
|
public void download_open(@RequestParam String userId,@RequestParam String endpoint, @RequestParam String filename,HttpServletResponse response) throws IOException {
|
||||||
|
QiNiuOssClient bean = SpringUtil.getBean(userId);
|
||||||
|
bean.getQiNiuOssConfig().setEndpoint(endpoint);
|
||||||
|
ServletOutputStream output = response.getOutputStream();
|
||||||
|
|
||||||
|
|
||||||
|
response.setCharacterEncoding("UTF-8");
|
||||||
|
response.setContentType("application/vnd.ms-excel");
|
||||||
|
response.setHeader("Content-disposition", "attachment;filename=" + URLEncoder.encode(filename, "utf-8"));
|
||||||
|
bean.downLoad_open(output,filename,endpoint);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 删除文件
|
||||||
|
* @param: [schisandraOssMinioDTO]
|
||||||
|
* @return: void
|
||||||
|
* @date: 2024/7/8 14:34
|
||||||
|
*/
|
||||||
|
@PostMapping("deleteFile")
|
||||||
|
public Result deleteQiniuFile(@RequestParam String bucket, @RequestParam String userId, @RequestParam String filePath) {
|
||||||
|
Preconditions.checkNotNull(bucket, "不能为空");
|
||||||
|
Preconditions.checkNotNull(userId, "不能为空");
|
||||||
|
Preconditions.checkNotNull(filePath, "不能为空");
|
||||||
|
QiNiuOssClient bean = SpringUtil.getBean(userId);
|
||||||
|
bean.getQiNiuOssConfig().setBucketName(bucket);
|
||||||
|
bean.delete(filePath);
|
||||||
|
return Result.ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 上传文件
|
||||||
|
* @param: [schisandraOssMinioDTO]
|
||||||
|
* @return: void
|
||||||
|
* @date: 2024/7/8 14:34
|
||||||
|
*/
|
||||||
|
@PostMapping("uploadFile")
|
||||||
|
public Result<OssInfo> uploadQiniuFile(@RequestParam String userId, @RequestParam MultipartFile file, @RequestParam String fileName, @RequestParam String bucket) throws IOException {
|
||||||
|
Preconditions.checkNotNull(userId, "不能为空");
|
||||||
|
Preconditions.checkNotNull(fileName, "不能为空");
|
||||||
|
Preconditions.checkNotNull(bucket, "不能为空");
|
||||||
|
|
||||||
|
//设置热力图
|
||||||
|
Date date =new Date();
|
||||||
|
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
||||||
|
String formattedDate = dateFormat.format(date);
|
||||||
|
String key = redisUtil.buildKey(USER_OSS_PREFIX+":"+userId,formattedDate);
|
||||||
|
int count=1;
|
||||||
|
if (redisUtil.exist(key)){
|
||||||
|
count= Integer.parseInt(redisUtil.get(key));
|
||||||
|
redisUtil.set(key, String.valueOf(count+1));
|
||||||
|
}else {
|
||||||
|
redisUtil.set(key, String.valueOf(1));
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取文件输入流
|
||||||
|
InputStream is = file.getInputStream();
|
||||||
|
QiNiuOssClient bean = SpringUtil.getBean(userId);
|
||||||
|
bean.getQiNiuOssConfig().setBucketName(bucket);
|
||||||
|
return Result.ok(bean.upLoad(is, fileName, true));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 获取所有bucket
|
||||||
|
* @param: [userId, bucket]
|
||||||
|
* @return: com.schisandra.oss.common.entity.Result<java.lang.String>
|
||||||
|
* @date: 2024/7/8 17:37
|
||||||
|
*/
|
||||||
|
@GetMapping("seleteBucket")
|
||||||
|
public Result<String> seleteBucket(@RequestParam String userId) {
|
||||||
|
Preconditions.checkNotNull(userId, "不能为空");
|
||||||
|
QiNiuOssClient bean = SpringUtil.getBean(userId);
|
||||||
|
return Result.ok(bean.selectAllBucket());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 删除bucket
|
||||||
|
* @param: [userId, bucket]
|
||||||
|
* @return: com.schisandra.oss.common.entity.Result<java.lang.String>
|
||||||
|
* @date: 2024/7/8 17:38
|
||||||
|
*/
|
||||||
|
@PostMapping("deleteBucket")
|
||||||
|
public Result<String> deleteBucket(@RequestParam String userId, @RequestParam String bucket) {
|
||||||
|
Preconditions.checkNotNull(userId, "不能为空");
|
||||||
|
Preconditions.checkNotNull(bucket, "不能为空");
|
||||||
|
QiNiuOssClient bean = SpringUtil.getBean(userId);
|
||||||
|
bean.getQiNiuOssConfig().setBucketName(bucket);
|
||||||
|
return Result.ok(bean.deleteBucket(bucket));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建桶createbucket
|
||||||
|
* @param userId
|
||||||
|
* @param bucket
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping("createBucket")
|
||||||
|
public Result<String> createBucket(@RequestParam String userId, @RequestParam String bucket,@RequestParam String region) {
|
||||||
|
Preconditions.checkNotNull(userId, "不能为空");
|
||||||
|
Preconditions.checkNotNull(bucket, "不能为空");
|
||||||
|
QiNiuOssClient bean = SpringUtil.getBean(userId);
|
||||||
|
bean.getQiNiuOssConfig().setBucketName(bucket);
|
||||||
|
bean.getQiNiuOssConfig().setRegion(region);
|
||||||
|
try {
|
||||||
|
return Result.ok(bean.createBucket(bucket,region));
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: qiniu 初始化
|
||||||
|
* @param: []
|
||||||
|
* @return: void
|
||||||
|
* @date: 2024/7/8 13:34
|
||||||
|
*/
|
||||||
|
@PostMapping("init")
|
||||||
|
public void initQiniu(@RequestParam String userId) {
|
||||||
|
if (log.isInfoEnabled()) {
|
||||||
|
log.info("SchisandraOssQiniuController.init.userId:{}", userId);
|
||||||
|
}
|
||||||
|
Preconditions.checkNotNull(userId, "用户id不能为空!");
|
||||||
|
|
||||||
|
Result result = qiNiuOssConfiguration.qiNiuOssClient(userId);
|
||||||
|
if (result != null) {
|
||||||
|
log.info("用户: {}-> qiniu 初始化完成!", userId);
|
||||||
|
} else {
|
||||||
|
log.error("用户: {}-> qiniu 初始化失败!", userId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增七牛云对象存储配置表
|
* 新增七牛云对象存储配置表
|
||||||
|
@@ -0,0 +1,321 @@
|
|||||||
|
package com.schisandra.oss.application.controller;
|
||||||
|
|
||||||
|
import cn.hutool.extra.spring.SpringUtil;
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.google.common.base.Preconditions;
|
||||||
|
import com.schisandra.oss.application.convert.SchisandraOssSftpDTOConverter;
|
||||||
|
import com.schisandra.oss.application.dto.SchisandraOssSftpDTO;
|
||||||
|
import com.schisandra.oss.application.dto.SchisandraOssUpDTO;
|
||||||
|
import com.schisandra.oss.application.oss.core.ali.AliOssClient;
|
||||||
|
import com.schisandra.oss.application.oss.core.ftp.FtpOssClient;
|
||||||
|
import com.schisandra.oss.application.oss.core.ftp.FtpOssConfiguration;
|
||||||
|
import com.schisandra.oss.application.oss.core.qiniu.QiNiuOssClient;
|
||||||
|
import com.schisandra.oss.application.oss.core.sftp.SftpOssClient;
|
||||||
|
import com.schisandra.oss.application.oss.core.sftp.SftpOssConfiguration;
|
||||||
|
import com.schisandra.oss.application.oss.model.OssInfo;
|
||||||
|
import com.schisandra.oss.common.entity.Result;
|
||||||
|
import com.schisandra.oss.domain.bo.SchisandraOssSftpBO;
|
||||||
|
import com.schisandra.oss.domain.redis.RedisUtil;
|
||||||
|
import com.schisandra.oss.domain.service.SchisandraOssSftpDomainService;
|
||||||
|
import lombok.SneakyThrows;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import javax.servlet.ServletOutputStream;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.net.URLEncoder;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* sftp存储配置表 controller
|
||||||
|
*
|
||||||
|
* @author landaiqing
|
||||||
|
* @since 2024-07-12 15:44:04
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/oss/sftp/")
|
||||||
|
@Slf4j
|
||||||
|
public class SchisandraOssSftpController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private SchisandraOssSftpDomainService schisandraOssSftpDomainService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private SftpOssConfiguration sftpOssConfiguration;
|
||||||
|
|
||||||
|
private final String USER_OSS_PREFIX = "oss:user:heat";
|
||||||
|
@Resource
|
||||||
|
RedisUtil redisUtil;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 返回up表所有数据
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("returnAll")
|
||||||
|
public List<SchisandraOssSftpDTO> returnAll() {
|
||||||
|
return sftpOssConfiguration.selectAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 拷贝文件
|
||||||
|
* @param: [userId, bucket, oldFilePath, newFilePath]
|
||||||
|
* @return: com.schisandra.oss.common.entity.Result
|
||||||
|
* @date: 2024/6/27 9:52
|
||||||
|
*/
|
||||||
|
@PostMapping("copyFile")
|
||||||
|
public Result copySftpFile(@RequestParam String userId, @RequestParam String oldFilePath, @RequestParam String newFilePath) throws IOException {
|
||||||
|
|
||||||
|
Preconditions.checkNotNull(userId, "不能为空");
|
||||||
|
Preconditions.checkNotNull(oldFilePath, "不能为空");
|
||||||
|
Preconditions.checkNotNull(newFilePath, "不能为空");
|
||||||
|
QiNiuOssClient bean = SpringUtil.getBean(userId);
|
||||||
|
try {
|
||||||
|
bean.copy(oldFilePath, newFilePath);
|
||||||
|
}catch (Exception e){
|
||||||
|
return Result.fail(e.getMessage());
|
||||||
|
}
|
||||||
|
return Result.ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 重命名
|
||||||
|
*/
|
||||||
|
@PostMapping("renameFile")
|
||||||
|
public Result renameSftpFile(@RequestParam String userId, @RequestParam String oldFileName, @RequestParam String newFileName) throws IOException {
|
||||||
|
|
||||||
|
Preconditions.checkNotNull(userId, "不能为空");
|
||||||
|
Preconditions.checkNotNull(oldFileName, "不能为空");
|
||||||
|
Preconditions.checkNotNull(newFileName, "不能为空");
|
||||||
|
SftpOssClient bean = SpringUtil.getBean(userId);
|
||||||
|
try {
|
||||||
|
bean.rename(oldFileName, newFileName);
|
||||||
|
}catch (Exception e){
|
||||||
|
return Result.fail(e.getMessage());
|
||||||
|
}
|
||||||
|
return Result.ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 获取文件目录信息
|
||||||
|
* @param: [target, userId, dirName]
|
||||||
|
* @return: com.schisandra.oss.common.entity.Result<java.lang.String>
|
||||||
|
*/
|
||||||
|
@GetMapping("listDir")
|
||||||
|
public Result<String> listSftpInfo(@RequestParam String userId, @RequestParam String prefix) throws Exception {
|
||||||
|
Preconditions.checkNotNull(userId, "不能为空");
|
||||||
|
SftpOssClient bean = SpringUtil.getBean(userId);
|
||||||
|
return Result.ok(bean.listfile(prefix));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除文件
|
||||||
|
*/
|
||||||
|
@PostMapping("deleteFile")
|
||||||
|
public Result deleteSftpFile(@RequestParam String userId, @RequestParam String fileName) {
|
||||||
|
SftpOssClient bean = SpringUtil.getBean(userId);
|
||||||
|
bean.delete(fileName);
|
||||||
|
return Result.ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 下载文件
|
||||||
|
*/
|
||||||
|
|
||||||
|
@GetMapping("downloadFile")
|
||||||
|
public void downloadSftpFile(@RequestParam String userId, @RequestParam String filename, HttpServletResponse response) throws IOException {
|
||||||
|
SftpOssClient bean = SpringUtil.getBean(userId);
|
||||||
|
ServletOutputStream output = response.getOutputStream();
|
||||||
|
|
||||||
|
|
||||||
|
response.setCharacterEncoding("UTF-8");
|
||||||
|
response.setContentType("application/vnd.ms-excel");
|
||||||
|
response.setHeader("Content-disposition", "attachment;filename=" + URLEncoder.encode(filename, "utf-8"));
|
||||||
|
bean.downLoad(output,filename);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上传文件
|
||||||
|
*/
|
||||||
|
@PostMapping("uploadFile")
|
||||||
|
@SneakyThrows
|
||||||
|
public Result<OssInfo> uploadSftpFile(@RequestParam String userId , @RequestParam MultipartFile file, @RequestParam String fileName) {
|
||||||
|
Preconditions.checkNotNull(userId, "不能为空");
|
||||||
|
Preconditions.checkNotNull(fileName, "不能为空");
|
||||||
|
|
||||||
|
|
||||||
|
//设置热力图
|
||||||
|
Date date =new Date();
|
||||||
|
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
||||||
|
String formattedDate = dateFormat.format(date);
|
||||||
|
String key = redisUtil.buildKey(USER_OSS_PREFIX+":"+userId,formattedDate);
|
||||||
|
int count=1;
|
||||||
|
if (redisUtil.exist(key)){
|
||||||
|
count= Integer.parseInt(redisUtil.get(key));
|
||||||
|
redisUtil.set(key, String.valueOf(count+1));
|
||||||
|
}else {
|
||||||
|
redisUtil.set(key, String.valueOf(1));
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取文件输入流
|
||||||
|
InputStream is = file.getInputStream();
|
||||||
|
SftpOssClient bean = SpringUtil.getBean(userId);
|
||||||
|
|
||||||
|
return Result.ok(bean.upLoad(is, fileName, true));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: sftp初始化
|
||||||
|
* @param: []
|
||||||
|
* @return: void
|
||||||
|
* @date: 2024/7/12 13:34
|
||||||
|
*/
|
||||||
|
@PostMapping("init")
|
||||||
|
public void initSftp(@RequestParam String userId) {
|
||||||
|
if (log.isInfoEnabled()) {
|
||||||
|
log.info("SchisandraOssSftpController.init.userId:{}", userId);
|
||||||
|
}
|
||||||
|
Preconditions.checkNotNull(userId, "用户id不能为空!");
|
||||||
|
|
||||||
|
Result result = sftpOssConfiguration.sftpOssClient(userId);
|
||||||
|
if (result != null) {
|
||||||
|
log.info("用户: {}-> sftp 初始化完成!", userId);
|
||||||
|
} else {
|
||||||
|
log.error("用户: {}-> sftp 初始化失败!", userId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增sftp存储配置表
|
||||||
|
*/
|
||||||
|
@RequestMapping("add")
|
||||||
|
public Result<Boolean> add(@RequestBody SchisandraOssSftpDTO schisandraOssSftpDTO) {
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (log.isInfoEnabled()) {
|
||||||
|
log.info("SchisandraOssSftpController.add.dto:{}", JSON.toJSONString(schisandraOssSftpDTO));
|
||||||
|
}
|
||||||
|
Preconditions.checkNotNull(schisandraOssSftpDTO.getId(), "不能为空");
|
||||||
|
Preconditions.checkNotNull(schisandraOssSftpDTO.getUserId(), "不能为空");
|
||||||
|
Preconditions.checkNotNull(schisandraOssSftpDTO.getHost(), "主机不能为空");
|
||||||
|
Preconditions.checkNotNull(schisandraOssSftpDTO.getPort(), "端口不能为空");
|
||||||
|
Preconditions.checkNotNull(schisandraOssSftpDTO.getBasePath(), "不能为空");
|
||||||
|
Preconditions.checkNotNull(schisandraOssSftpDTO.getUser(), "不能为空");
|
||||||
|
Preconditions.checkNotNull(schisandraOssSftpDTO.getPassword(), "不能为空");
|
||||||
|
Preconditions.checkNotNull(schisandraOssSftpDTO.getCharset(), "编码不能为空");
|
||||||
|
Preconditions.checkNotNull(schisandraOssSftpDTO.getConnectionTimeout(), "连接超时时长,单位毫秒不能为空");
|
||||||
|
Preconditions.checkNotNull(schisandraOssSftpDTO.getSoTimeout(), "Socket连接超时时长,单位毫秒不能为空");
|
||||||
|
Preconditions.checkNotNull(schisandraOssSftpDTO.getServerLanguageCode(), "设置服务器语言不能为空");
|
||||||
|
Preconditions.checkNotNull(schisandraOssSftpDTO.getSystemKey(), "设置服务器系统关键词不能为空");
|
||||||
|
Preconditions.checkNotNull(schisandraOssSftpDTO.getPartSize(), "分片大小,默认5MB不能为空");
|
||||||
|
Preconditions.checkNotNull(schisandraOssSftpDTO.getTaskNum(), "并发线程数,默认等于CPU的核数不能为空");
|
||||||
|
Preconditions.checkNotNull(schisandraOssSftpDTO.getStatus(), "状态不能为空");
|
||||||
|
Preconditions.checkNotNull(schisandraOssSftpDTO.getOpenAdvancedSetup(), "是否开启高级设置不能为空");
|
||||||
|
Preconditions.checkNotNull(schisandraOssSftpDTO.getCreatedBy(), "创建人不能为空");
|
||||||
|
Preconditions.checkNotNull(schisandraOssSftpDTO.getCreatedTime(), "创建时间不能为空");
|
||||||
|
Preconditions.checkNotNull(schisandraOssSftpDTO.getUpdateTime(), "更新时间不能为空");
|
||||||
|
Preconditions.checkNotNull(schisandraOssSftpDTO.getUpdateBy(), "更新人不能为空");
|
||||||
|
Preconditions.checkNotNull(schisandraOssSftpDTO.getIsDeleted(), "是否删除 0 未删除 1已删除不能为空");
|
||||||
|
Preconditions.checkNotNull(schisandraOssSftpDTO.getExtraJson(), "额外字段不能为空");
|
||||||
|
SchisandraOssSftpBO SchisandraOssSftpBO = SchisandraOssSftpDTOConverter.INSTANCE.convertDTOToBO(schisandraOssSftpDTO);
|
||||||
|
return Result.ok(schisandraOssSftpDomainService.add(SchisandraOssSftpBO));
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("SchisandraOssSftpController.register.error:{}", e.getMessage(), e);
|
||||||
|
return Result.fail("新增sftp存储配置表失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改sftp存储配置表
|
||||||
|
*/
|
||||||
|
@RequestMapping("update")
|
||||||
|
public Result<Boolean> update(@RequestBody SchisandraOssSftpDTO schisandraOssSftpDTO) {
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (log.isInfoEnabled()) {
|
||||||
|
log.info("SchisandraOssSftpController.update.dto:{}", JSON.toJSONString(schisandraOssSftpDTO));
|
||||||
|
}
|
||||||
|
Preconditions.checkNotNull(schisandraOssSftpDTO.getId(), "不能为空");
|
||||||
|
Preconditions.checkNotNull(schisandraOssSftpDTO.getUserId(), "不能为空");
|
||||||
|
Preconditions.checkNotNull(schisandraOssSftpDTO.getHost(), "主机不能为空");
|
||||||
|
Preconditions.checkNotNull(schisandraOssSftpDTO.getPort(), "端口不能为空");
|
||||||
|
Preconditions.checkNotNull(schisandraOssSftpDTO.getBasePath(), "不能为空");
|
||||||
|
Preconditions.checkNotNull(schisandraOssSftpDTO.getUser(), "不能为空");
|
||||||
|
Preconditions.checkNotNull(schisandraOssSftpDTO.getPassword(), "不能为空");
|
||||||
|
Preconditions.checkNotNull(schisandraOssSftpDTO.getCharset(), "编码不能为空");
|
||||||
|
Preconditions.checkNotNull(schisandraOssSftpDTO.getConnectionTimeout(), "连接超时时长,单位毫秒不能为空");
|
||||||
|
Preconditions.checkNotNull(schisandraOssSftpDTO.getSoTimeout(), "Socket连接超时时长,单位毫秒不能为空");
|
||||||
|
Preconditions.checkNotNull(schisandraOssSftpDTO.getServerLanguageCode(), "设置服务器语言不能为空");
|
||||||
|
Preconditions.checkNotNull(schisandraOssSftpDTO.getSystemKey(), "设置服务器系统关键词不能为空");
|
||||||
|
Preconditions.checkNotNull(schisandraOssSftpDTO.getPartSize(), "分片大小,默认5MB不能为空");
|
||||||
|
Preconditions.checkNotNull(schisandraOssSftpDTO.getTaskNum(), "并发线程数,默认等于CPU的核数不能为空");
|
||||||
|
Preconditions.checkNotNull(schisandraOssSftpDTO.getStatus(), "状态不能为空");
|
||||||
|
Preconditions.checkNotNull(schisandraOssSftpDTO.getOpenAdvancedSetup(), "是否开启高级设置不能为空");
|
||||||
|
Preconditions.checkNotNull(schisandraOssSftpDTO.getCreatedBy(), "创建人不能为空");
|
||||||
|
Preconditions.checkNotNull(schisandraOssSftpDTO.getCreatedTime(), "创建时间不能为空");
|
||||||
|
Preconditions.checkNotNull(schisandraOssSftpDTO.getUpdateTime(), "更新时间不能为空");
|
||||||
|
Preconditions.checkNotNull(schisandraOssSftpDTO.getUpdateBy(), "更新人不能为空");
|
||||||
|
Preconditions.checkNotNull(schisandraOssSftpDTO.getIsDeleted(), "是否删除 0 未删除 1已删除不能为空");
|
||||||
|
Preconditions.checkNotNull(schisandraOssSftpDTO.getExtraJson(), "额外字段不能为空");
|
||||||
|
SchisandraOssSftpBO schisandraOssSftpBO = SchisandraOssSftpDTOConverter.INSTANCE.convertDTOToBO(schisandraOssSftpDTO);
|
||||||
|
return Result.ok(schisandraOssSftpDomainService.update(schisandraOssSftpBO));
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("SchisandraOssSftpController.update.error:{}", e.getMessage(), e);
|
||||||
|
return Result.fail("更新sftp存储配置表信息失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除sftp存储配置表
|
||||||
|
*/
|
||||||
|
@RequestMapping("delete")
|
||||||
|
public Result<Boolean> delete(@RequestBody SchisandraOssSftpDTO schisandraOssSftpDTO) {
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (log.isInfoEnabled()) {
|
||||||
|
log.info("SchisandraOssSftpController.delete.dto:{}", JSON.toJSONString(schisandraOssSftpDTO));
|
||||||
|
}
|
||||||
|
Preconditions.checkNotNull(schisandraOssSftpDTO.getId(), "不能为空");
|
||||||
|
Preconditions.checkNotNull(schisandraOssSftpDTO.getUserId(), "不能为空");
|
||||||
|
Preconditions.checkNotNull(schisandraOssSftpDTO.getHost(), "主机不能为空");
|
||||||
|
Preconditions.checkNotNull(schisandraOssSftpDTO.getPort(), "端口不能为空");
|
||||||
|
Preconditions.checkNotNull(schisandraOssSftpDTO.getBasePath(), "不能为空");
|
||||||
|
Preconditions.checkNotNull(schisandraOssSftpDTO.getUser(), "不能为空");
|
||||||
|
Preconditions.checkNotNull(schisandraOssSftpDTO.getPassword(), "不能为空");
|
||||||
|
Preconditions.checkNotNull(schisandraOssSftpDTO.getCharset(), "编码不能为空");
|
||||||
|
Preconditions.checkNotNull(schisandraOssSftpDTO.getConnectionTimeout(), "连接超时时长,单位毫秒不能为空");
|
||||||
|
Preconditions.checkNotNull(schisandraOssSftpDTO.getSoTimeout(), "Socket连接超时时长,单位毫秒不能为空");
|
||||||
|
Preconditions.checkNotNull(schisandraOssSftpDTO.getServerLanguageCode(), "设置服务器语言不能为空");
|
||||||
|
Preconditions.checkNotNull(schisandraOssSftpDTO.getSystemKey(), "设置服务器系统关键词不能为空");
|
||||||
|
Preconditions.checkNotNull(schisandraOssSftpDTO.getPartSize(), "分片大小,默认5MB不能为空");
|
||||||
|
Preconditions.checkNotNull(schisandraOssSftpDTO.getTaskNum(), "并发线程数,默认等于CPU的核数不能为空");
|
||||||
|
Preconditions.checkNotNull(schisandraOssSftpDTO.getStatus(), "状态不能为空");
|
||||||
|
Preconditions.checkNotNull(schisandraOssSftpDTO.getOpenAdvancedSetup(), "是否开启高级设置不能为空");
|
||||||
|
Preconditions.checkNotNull(schisandraOssSftpDTO.getCreatedBy(), "创建人不能为空");
|
||||||
|
Preconditions.checkNotNull(schisandraOssSftpDTO.getCreatedTime(), "创建时间不能为空");
|
||||||
|
Preconditions.checkNotNull(schisandraOssSftpDTO.getUpdateTime(), "更新时间不能为空");
|
||||||
|
Preconditions.checkNotNull(schisandraOssSftpDTO.getUpdateBy(), "更新人不能为空");
|
||||||
|
Preconditions.checkNotNull(schisandraOssSftpDTO.getIsDeleted(), "是否删除 0 未删除 1已删除不能为空");
|
||||||
|
Preconditions.checkNotNull(schisandraOssSftpDTO.getExtraJson(), "额外字段不能为空");
|
||||||
|
SchisandraOssSftpBO schisandraOssSftpBO = SchisandraOssSftpDTOConverter.INSTANCE.convertDTOToBO(schisandraOssSftpDTO);
|
||||||
|
return Result.ok(schisandraOssSftpDomainService.delete(schisandraOssSftpBO));
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("SchisandraOssSftpController.delete.error:{}", e.getMessage(), e);
|
||||||
|
return Result.fail("删除sftp存储配置表信息失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@@ -10,11 +10,13 @@ import com.qcloud.cos.model.DeleteObjectsResult;
|
|||||||
import com.schisandra.oss.application.convert.SchisandraOssTencentDTOConverter;
|
import com.schisandra.oss.application.convert.SchisandraOssTencentDTOConverter;
|
||||||
import com.schisandra.oss.application.dto.SchisandraOssTencentDTO;
|
import com.schisandra.oss.application.dto.SchisandraOssTencentDTO;
|
||||||
|
|
||||||
|
import com.schisandra.oss.application.dto.SchisandraOssUpDTO;
|
||||||
import com.schisandra.oss.application.oss.core.minio.MinioOssClient;
|
import com.schisandra.oss.application.oss.core.minio.MinioOssClient;
|
||||||
import com.schisandra.oss.application.oss.core.tencent.TencentOssClient;
|
import com.schisandra.oss.application.oss.core.tencent.TencentOssClient;
|
||||||
import com.schisandra.oss.application.oss.core.tencent.TencentOssConfiguration;
|
import com.schisandra.oss.application.oss.core.tencent.TencentOssConfiguration;
|
||||||
import com.schisandra.oss.common.entity.Result;
|
import com.schisandra.oss.common.entity.Result;
|
||||||
import com.schisandra.oss.domain.bo.SchisandraOssTencentBO;
|
import com.schisandra.oss.domain.bo.SchisandraOssTencentBO;
|
||||||
|
import com.schisandra.oss.domain.redis.RedisUtil;
|
||||||
import com.schisandra.oss.domain.service.SchisandraOssTencentDomainService;
|
import com.schisandra.oss.domain.service.SchisandraOssTencentDomainService;
|
||||||
import io.minio.errors.*;
|
import io.minio.errors.*;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@@ -26,6 +28,8 @@ import java.io.IOException;
|
|||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.security.InvalidKeyException;
|
import java.security.InvalidKeyException;
|
||||||
import java.security.NoSuchAlgorithmException;
|
import java.security.NoSuchAlgorithmException;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -43,6 +47,19 @@ public class SchisandraOssTencentController {
|
|||||||
private SchisandraOssTencentDomainService schisandraOssTencentDomainService;
|
private SchisandraOssTencentDomainService schisandraOssTencentDomainService;
|
||||||
@Resource
|
@Resource
|
||||||
TencentOssConfiguration tencentOssConfiguration;
|
TencentOssConfiguration tencentOssConfiguration;
|
||||||
|
private final String USER_OSS_PREFIX = "oss:user:heat";
|
||||||
|
@Resource
|
||||||
|
RedisUtil redisUtil;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 返回tencent表所有数据
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("returnAll")
|
||||||
|
public List<SchisandraOssTencentDTO> returnAll() {
|
||||||
|
return tencentOssConfiguration.selectAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("init")
|
@PostMapping("init")
|
||||||
public void initTencent(@RequestParam String userId) throws ServerException, InsufficientDataException, ErrorResponseException, IOException, NoSuchAlgorithmException, InvalidKeyException, InvalidResponseException, XmlParserException, InternalException {
|
public void initTencent(@RequestParam String userId) throws ServerException, InsufficientDataException, ErrorResponseException, IOException, NoSuchAlgorithmException, InvalidKeyException, InvalidResponseException, XmlParserException, InternalException {
|
||||||
@@ -154,6 +171,18 @@ public class SchisandraOssTencentController {
|
|||||||
TencentOssClient bean = SpringUtil.getBean(userId);
|
TencentOssClient bean = SpringUtil.getBean(userId);
|
||||||
InputStream is = file.getInputStream();
|
InputStream is = file.getInputStream();
|
||||||
bean.getTencentOssConfig().setBucketName(bucket);
|
bean.getTencentOssConfig().setBucketName(bucket);
|
||||||
|
//设置热力图
|
||||||
|
Date date =new Date();
|
||||||
|
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
||||||
|
String formattedDate = dateFormat.format(date);
|
||||||
|
String key = redisUtil.buildKey(USER_OSS_PREFIX+":"+userId,formattedDate);
|
||||||
|
int count=1;
|
||||||
|
if (redisUtil.exist(key)){
|
||||||
|
count= Integer.parseInt(redisUtil.get(key));
|
||||||
|
redisUtil.set(key, String.valueOf(count+1));
|
||||||
|
}else {
|
||||||
|
redisUtil.set(key, String.valueOf(1));
|
||||||
|
}
|
||||||
return Result.ok(bean.upLoadParts(is,target,file.getOriginalFilename()));
|
return Result.ok(bean.upLoadParts(is,target,file.getOriginalFilename()));
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
@@ -1,10 +1,12 @@
|
|||||||
package com.schisandra.oss.application.controller;
|
package com.schisandra.oss.application.controller;
|
||||||
|
|
||||||
|
import cn.hutool.extra.spring.SpringUtil;
|
||||||
import cn.hutool.extra.spring.SpringUtil;
|
import cn.hutool.extra.spring.SpringUtil;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.google.common.base.Preconditions;
|
import com.google.common.base.Preconditions;
|
||||||
import com.schisandra.oss.application.convert.SchisandraOssUpDTOConverter;
|
import com.schisandra.oss.application.convert.SchisandraOssUpDTOConverter;
|
||||||
import com.schisandra.oss.application.dto.SchisandraOssUpDTO;
|
import com.schisandra.oss.application.dto.SchisandraOssUpDTO;
|
||||||
|
import com.schisandra.oss.application.oss.core.up.UpOssConfiguration;
|
||||||
import com.schisandra.oss.application.oss.core.up.UpOssClient;
|
import com.schisandra.oss.application.oss.core.up.UpOssClient;
|
||||||
import com.schisandra.oss.application.oss.core.up.UpOssConfiguration;
|
import com.schisandra.oss.application.oss.core.up.UpOssConfiguration;
|
||||||
import com.schisandra.oss.application.oss.model.OssInfo;
|
import com.schisandra.oss.application.oss.model.OssInfo;
|
||||||
@@ -13,10 +15,15 @@ import com.schisandra.oss.domain.bo.SchisandraOssUpBO;
|
|||||||
import com.schisandra.oss.domain.service.SchisandraOssUpDomainService;
|
import com.schisandra.oss.domain.service.SchisandraOssUpDomainService;
|
||||||
import lombok.SneakyThrows;
|
import lombok.SneakyThrows;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
import javax.servlet.ServletOutputStream;
|
import javax.servlet.ServletOutputStream;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
@@ -34,9 +41,16 @@ public class SchisandraOssUpController {
|
|||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private SchisandraOssUpDomainService schisandraOssUpDomainService;
|
private SchisandraOssUpDomainService schisandraOssUpDomainService;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private UpOssConfiguration upOssConfiguration;
|
private UpOssConfiguration upOssConfiguration;
|
||||||
|
/**
|
||||||
|
* 返回up表所有数据
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("returnAll")
|
||||||
|
public List<SchisandraOssUpDTO> returnAll() {
|
||||||
|
return upOssConfiguration.selectAll();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description: 初始化
|
* @description: 初始化
|
||||||
@@ -120,7 +134,6 @@ public class SchisandraOssUpController {
|
|||||||
return Result.ok();
|
return Result.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description: 新增又拍云对象存储配置
|
* @description: 新增又拍云对象存储配置
|
||||||
* @param: [schisandraOssUpDTO]
|
* @param: [schisandraOssUpDTO]
|
||||||
|
@@ -0,0 +1,156 @@
|
|||||||
|
package com.schisandra.oss.application.controller;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.google.common.base.Preconditions;
|
||||||
|
import com.schisandra.oss.application.convert.SchisandraUserOssDTOConverter;
|
||||||
|
import com.schisandra.oss.application.dto.SchisandraUserOssDTO;
|
||||||
|
import com.schisandra.oss.common.entity.Result;
|
||||||
|
import com.schisandra.oss.domain.bo.SchisandraUserOssBO;
|
||||||
|
import com.schisandra.oss.domain.redis.RedisUtil;
|
||||||
|
import com.schisandra.oss.domain.service.SchisandraUserOssDomainService;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户对象存储映射表 controller
|
||||||
|
*
|
||||||
|
* @author landaiqing
|
||||||
|
* @since 2024-07-10 16:14:33
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/oss/user/")
|
||||||
|
@Slf4j
|
||||||
|
public class SchisandraUserOssController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private SchisandraUserOssDomainService schisandraUserOssDomainService;
|
||||||
|
private final String USER_OSS_PREFIX = "oss:user:heat";
|
||||||
|
@Resource
|
||||||
|
RedisUtil redisUtil;
|
||||||
|
/**
|
||||||
|
* 新增用户对象存储映射表
|
||||||
|
*/
|
||||||
|
@RequestMapping("add")
|
||||||
|
public Result<Boolean> add(@RequestBody SchisandraUserOssDTO schisandraUserOssDTO) {
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (log.isInfoEnabled()) {
|
||||||
|
log.info("SchisandraUserOssController.add.dto:{}", JSON.toJSONString(schisandraUserOssDTO));
|
||||||
|
}
|
||||||
|
Preconditions.checkNotNull(schisandraUserOssDTO.getId(), "不能为空");
|
||||||
|
Preconditions.checkNotNull(schisandraUserOssDTO.getUserId(), "不能为空");
|
||||||
|
Preconditions.checkNotNull(schisandraUserOssDTO.getOssType(), "不能为空");
|
||||||
|
Preconditions.checkNotNull(schisandraUserOssDTO.getIcon(), "不能为空");
|
||||||
|
Preconditions.checkNotNull(schisandraUserOssDTO.getName(), "不能为空");
|
||||||
|
Preconditions.checkNotNull(schisandraUserOssDTO.getBucketCount(), "不能为空");
|
||||||
|
Preconditions.checkNotNull(schisandraUserOssDTO.getCreatedBy(), "创建人不能为空");
|
||||||
|
Preconditions.checkNotNull(schisandraUserOssDTO.getCreatedTime(), "创建时间不能为空");
|
||||||
|
Preconditions.checkNotNull(schisandraUserOssDTO.getUpdateBy(), "更新人不能为空");
|
||||||
|
Preconditions.checkNotNull(schisandraUserOssDTO.getUpdateTime(), "更新时间不能为空");
|
||||||
|
Preconditions.checkNotNull(schisandraUserOssDTO.getIsDeleted(), "不能为空");
|
||||||
|
SchisandraUserOssBO SchisandraUserOssBO = SchisandraUserOssDTOConverter.INSTANCE.convertDTOToBO(schisandraUserOssDTO);
|
||||||
|
return Result.ok(schisandraUserOssDomainService.add(SchisandraUserOssBO));
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("SchisandraUserOssController.register.error:{}", e.getMessage(), e);
|
||||||
|
return Result.fail("新增用户对象存储映射表失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改用户对象存储映射表
|
||||||
|
*/
|
||||||
|
@RequestMapping("update")
|
||||||
|
public Result<Boolean> update(@RequestBody SchisandraUserOssDTO schisandraUserOssDTO) {
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (log.isInfoEnabled()) {
|
||||||
|
log.info("SchisandraUserOssController.update.dto:{}", JSON.toJSONString(schisandraUserOssDTO));
|
||||||
|
}
|
||||||
|
Preconditions.checkNotNull(schisandraUserOssDTO.getId(), "不能为空");
|
||||||
|
Preconditions.checkNotNull(schisandraUserOssDTO.getUserId(), "不能为空");
|
||||||
|
Preconditions.checkNotNull(schisandraUserOssDTO.getOssType(), "不能为空");
|
||||||
|
Preconditions.checkNotNull(schisandraUserOssDTO.getIcon(), "不能为空");
|
||||||
|
Preconditions.checkNotNull(schisandraUserOssDTO.getName(), "不能为空");
|
||||||
|
Preconditions.checkNotNull(schisandraUserOssDTO.getBucketCount(), "不能为空");
|
||||||
|
Preconditions.checkNotNull(schisandraUserOssDTO.getCreatedBy(), "创建人不能为空");
|
||||||
|
Preconditions.checkNotNull(schisandraUserOssDTO.getCreatedTime(), "创建时间不能为空");
|
||||||
|
Preconditions.checkNotNull(schisandraUserOssDTO.getUpdateBy(), "更新人不能为空");
|
||||||
|
Preconditions.checkNotNull(schisandraUserOssDTO.getUpdateTime(), "更新时间不能为空");
|
||||||
|
Preconditions.checkNotNull(schisandraUserOssDTO.getIsDeleted(), "不能为空");
|
||||||
|
SchisandraUserOssBO schisandraUserOssBO = SchisandraUserOssDTOConverter.INSTANCE.convertDTOToBO(schisandraUserOssDTO);
|
||||||
|
return Result.ok(schisandraUserOssDomainService.update(schisandraUserOssBO));
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("SchisandraUserOssController.update.error:{}", e.getMessage(), e);
|
||||||
|
return Result.fail("更新用户对象存储映射表信息失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除用户对象存储映射表
|
||||||
|
*/
|
||||||
|
@RequestMapping("delete")
|
||||||
|
public Result<Boolean> delete(@RequestBody SchisandraUserOssDTO schisandraUserOssDTO) {
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (log.isInfoEnabled()) {
|
||||||
|
log.info("SchisandraUserOssController.delete.dto:{}", JSON.toJSONString(schisandraUserOssDTO));
|
||||||
|
}
|
||||||
|
Preconditions.checkNotNull(schisandraUserOssDTO.getId(), "不能为空");
|
||||||
|
Preconditions.checkNotNull(schisandraUserOssDTO.getUserId(), "不能为空");
|
||||||
|
Preconditions.checkNotNull(schisandraUserOssDTO.getOssType(), "不能为空");
|
||||||
|
Preconditions.checkNotNull(schisandraUserOssDTO.getIcon(), "不能为空");
|
||||||
|
Preconditions.checkNotNull(schisandraUserOssDTO.getName(), "不能为空");
|
||||||
|
Preconditions.checkNotNull(schisandraUserOssDTO.getBucketCount(), "不能为空");
|
||||||
|
Preconditions.checkNotNull(schisandraUserOssDTO.getCreatedBy(), "创建人不能为空");
|
||||||
|
Preconditions.checkNotNull(schisandraUserOssDTO.getCreatedTime(), "创建时间不能为空");
|
||||||
|
Preconditions.checkNotNull(schisandraUserOssDTO.getUpdateBy(), "更新人不能为空");
|
||||||
|
Preconditions.checkNotNull(schisandraUserOssDTO.getUpdateTime(), "更新时间不能为空");
|
||||||
|
Preconditions.checkNotNull(schisandraUserOssDTO.getIsDeleted(), "不能为空");
|
||||||
|
SchisandraUserOssBO schisandraUserOssBO = SchisandraUserOssDTOConverter.INSTANCE.convertDTOToBO(schisandraUserOssDTO);
|
||||||
|
return Result.ok(schisandraUserOssDomainService.delete(schisandraUserOssBO));
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("SchisandraUserOssController.delete.error:{}", e.getMessage(), e);
|
||||||
|
return Result.fail("删除用户对象存储映射表信息失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @description: 查询用户对象存储映射表
|
||||||
|
* @param: [userId]
|
||||||
|
* @return: com.schisandra.oss.common.entity.Result<java.lang.Object>
|
||||||
|
* @author zlg
|
||||||
|
* @date: 2024/7/11 14:41
|
||||||
|
*/
|
||||||
|
@GetMapping("selectUserOSSType")
|
||||||
|
public Result<Object> selectUserOSSType(Long userId){
|
||||||
|
Preconditions.checkNotNull(userId, "不能为空");
|
||||||
|
List<SchisandraUserOssDTO> SchisandraUserOssDTOList=SchisandraUserOssDTOConverter.INSTANCE.convertBOListToDTOList(schisandraUserOssDomainService.queryOSSByUserId(userId));
|
||||||
|
if (SchisandraUserOssDTOList.isEmpty()) {
|
||||||
|
return Result.fail("没有查询到用户对象存储映射表信息");
|
||||||
|
}else {
|
||||||
|
return Result.ok(SchisandraUserOssDTOList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @description: 查询用户文件热度
|
||||||
|
* @param: [userId]
|
||||||
|
* @return: com.schisandra.oss.common.entity.Result<java.lang.Object>
|
||||||
|
* @author zlg
|
||||||
|
* @date: 2024/7/11 14:41
|
||||||
|
*/
|
||||||
|
@GetMapping("selectUserFileHeat")
|
||||||
|
public Result<Object> selectUserFileHeat(@RequestParam Long userId){
|
||||||
|
Preconditions.checkNotNull(userId, "不能为空");
|
||||||
|
String key = redisUtil.buildKey(USER_OSS_PREFIX+":"+userId);
|
||||||
|
return Result.ok(redisUtil.getDataFromDirectory(key));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1,22 @@
|
|||||||
|
package com.schisandra.oss.application.convert;
|
||||||
|
|
||||||
|
import com.schisandra.oss.application.dto.SchisandraFileHeatmapDTO;
|
||||||
|
import com.schisandra.oss.domain.bo.SchisandraFileHeatmapBO;
|
||||||
|
import org.mapstruct.Mapper;
|
||||||
|
import org.mapstruct.factory.Mappers;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件上传热力图表 dto转换器
|
||||||
|
*
|
||||||
|
* @author landaiqing
|
||||||
|
* @since 2024-07-11 10:43:27
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface SchisandraFileHeatmapDTOConverter {
|
||||||
|
|
||||||
|
SchisandraFileHeatmapDTOConverter INSTANCE = Mappers.getMapper(SchisandraFileHeatmapDTOConverter.class);
|
||||||
|
|
||||||
|
SchisandraFileHeatmapBO convertDTOToBO(SchisandraFileHeatmapDTO schisandraFileHeatmapDTO);
|
||||||
|
SchisandraFileHeatmapDTO convertBOToDTO(SchisandraFileHeatmapBO schisandraFileHeatmapBO);
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1,22 @@
|
|||||||
|
package com.schisandra.oss.application.convert;
|
||||||
|
|
||||||
|
import com.schisandra.oss.application.dto.SchisandraOssSftpDTO;
|
||||||
|
import com.schisandra.oss.domain.bo.SchisandraOssSftpBO;
|
||||||
|
import org.mapstruct.Mapper;
|
||||||
|
import org.mapstruct.factory.Mappers;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* sftp存储配置表 dto转换器
|
||||||
|
*
|
||||||
|
* @author landaiqing
|
||||||
|
* @since 2024-07-12 15:44:04
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface SchisandraOssSftpDTOConverter {
|
||||||
|
|
||||||
|
SchisandraOssSftpDTOConverter INSTANCE = Mappers.getMapper(SchisandraOssSftpDTOConverter.class);
|
||||||
|
|
||||||
|
SchisandraOssSftpBO convertDTOToBO(SchisandraOssSftpDTO schisandraOssSftpDTO);
|
||||||
|
SchisandraOssSftpDTO convertBOToDTO(SchisandraOssSftpBO schisandraOssSftpBO);
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1,26 @@
|
|||||||
|
package com.schisandra.oss.application.convert;
|
||||||
|
|
||||||
|
import com.schisandra.oss.application.dto.SchisandraUserOssDTO;
|
||||||
|
import com.schisandra.oss.domain.bo.SchisandraUserOssBO;
|
||||||
|
import org.mapstruct.Mapper;
|
||||||
|
import org.mapstruct.factory.Mappers;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户对象存储映射表 dto转换器
|
||||||
|
*
|
||||||
|
* @author landaiqing
|
||||||
|
* @since 2024-07-10 16:14:33
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface SchisandraUserOssDTOConverter {
|
||||||
|
|
||||||
|
SchisandraUserOssDTOConverter INSTANCE = Mappers.getMapper(SchisandraUserOssDTOConverter.class);
|
||||||
|
|
||||||
|
SchisandraUserOssBO convertDTOToBO(SchisandraUserOssDTO schisandraUserOssDTO);
|
||||||
|
SchisandraUserOssDTO convertBOToDTO(SchisandraUserOssBO schisandraUserOssBO);
|
||||||
|
|
||||||
|
List<SchisandraUserOssDTO> convertBOListToDTOList(List<SchisandraUserOssBO> schisandraUserOssBOList);
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1,38 @@
|
|||||||
|
package com.schisandra.oss.application.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件上传热力图表 dto
|
||||||
|
*
|
||||||
|
* @author landaiqing
|
||||||
|
* @since 2024-07-11 10:43:27
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class SchisandraFileHeatmapDTO implements Serializable {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private Date date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private Long count;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@@ -1,5 +1,6 @@
|
|||||||
package com.schisandra.oss.application.dto;
|
package com.schisandra.oss.application.dto;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
@@ -234,11 +235,14 @@ public class SchisandraOssAliDTO implements Serializable {
|
|||||||
/**
|
/**
|
||||||
* 创建时间
|
* 创建时间
|
||||||
*/
|
*/
|
||||||
|
@JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
private Date createdTime;
|
private Date createdTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新时间
|
* 更新时间
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
private Date updateTime;
|
private Date updateTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
package com.schisandra.oss.application.dto;
|
package com.schisandra.oss.application.dto;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
@@ -157,11 +158,13 @@ public class SchisandraOssMinioDTO implements Serializable {
|
|||||||
/**
|
/**
|
||||||
* 创建时间
|
* 创建时间
|
||||||
*/
|
*/
|
||||||
|
@JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
private Date createdTime;
|
private Date createdTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新时间
|
* 更新时间
|
||||||
*/
|
*/
|
||||||
|
@JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
private Date updateTime;
|
private Date updateTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
package com.schisandra.oss.application.dto;
|
package com.schisandra.oss.application.dto;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
@@ -137,11 +138,13 @@ public class SchisandraOssQiniuDTO implements Serializable {
|
|||||||
/**
|
/**
|
||||||
* 创建时间
|
* 创建时间
|
||||||
*/
|
*/
|
||||||
|
@JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
private Date createdTime;
|
private Date createdTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新时间
|
* 更新时间
|
||||||
*/
|
*/
|
||||||
|
@JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
private Date updateTime;
|
private Date updateTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -169,5 +172,7 @@ public class SchisandraOssQiniuDTO implements Serializable {
|
|||||||
*/
|
*/
|
||||||
private String checkBucket;
|
private String checkBucket;
|
||||||
|
|
||||||
|
private String endpoint;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -0,0 +1,131 @@
|
|||||||
|
package com.schisandra.oss.application.dto;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* sftp存储配置表 dto
|
||||||
|
*
|
||||||
|
* @author landaiqing
|
||||||
|
* @since 2024-07-12 15:44:04
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class SchisandraOssSftpDTO implements Serializable {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主机
|
||||||
|
*/
|
||||||
|
private String host;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 端口
|
||||||
|
*/
|
||||||
|
private Integer port;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private String basePath;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private String user;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private String password;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 编码
|
||||||
|
*/
|
||||||
|
private String charset;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 连接超时时长,单位毫秒
|
||||||
|
*/
|
||||||
|
private Long connectionTimeout;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Socket连接超时时长,单位毫秒
|
||||||
|
*/
|
||||||
|
private Date soTimeout;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置服务器语言
|
||||||
|
*/
|
||||||
|
private String serverLanguageCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置服务器系统关键词
|
||||||
|
*/
|
||||||
|
private String systemKey;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分片大小,默认5MB
|
||||||
|
*/
|
||||||
|
private Integer partSize;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 并发线程数,默认等于CPU的核数
|
||||||
|
*/
|
||||||
|
private Integer taskNum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态
|
||||||
|
*/
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否开启高级设置
|
||||||
|
*/
|
||||||
|
private String openAdvancedSetup;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建人
|
||||||
|
*/
|
||||||
|
private String createdBy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
@JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private Date createdTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新时间
|
||||||
|
*/
|
||||||
|
@JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private Date updateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新人
|
||||||
|
*/
|
||||||
|
private String updateBy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否删除 0 未删除 1已删除
|
||||||
|
*/
|
||||||
|
private Integer isDeleted;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 额外字段
|
||||||
|
*/
|
||||||
|
private String extraJson;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@@ -1,5 +1,6 @@
|
|||||||
package com.schisandra.oss.application.dto;
|
package com.schisandra.oss.application.dto;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
@@ -154,11 +155,13 @@ public class SchisandraOssTencentDTO implements Serializable {
|
|||||||
/**
|
/**
|
||||||
* 创建时间
|
* 创建时间
|
||||||
*/
|
*/
|
||||||
|
@JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
private Date createdTime;
|
private Date createdTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新时间
|
* 更新时间
|
||||||
*/
|
*/
|
||||||
|
@JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
private Date updateTime;
|
private Date updateTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
package com.schisandra.oss.application.dto;
|
package com.schisandra.oss.application.dto;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
@@ -82,11 +83,13 @@ public class SchisandraOssUpDTO implements Serializable {
|
|||||||
/**
|
/**
|
||||||
* 创建时间
|
* 创建时间
|
||||||
*/
|
*/
|
||||||
|
@JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
private Date createdTime;
|
private Date createdTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新时间
|
* 更新时间
|
||||||
*/
|
*/
|
||||||
|
@JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
private Date updateTime;
|
private Date updateTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -0,0 +1,73 @@
|
|||||||
|
package com.schisandra.oss.application.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户对象存储映射表 dto
|
||||||
|
*
|
||||||
|
* @author landaiqing
|
||||||
|
* @since 2024-07-10 16:14:33
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class SchisandraUserOssDTO implements Serializable {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private String ossType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private String icon;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private Integer bucketCount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建人
|
||||||
|
*/
|
||||||
|
private String createdBy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
private Date createdTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新人
|
||||||
|
*/
|
||||||
|
private String updateBy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新时间
|
||||||
|
*/
|
||||||
|
private Date updateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private Integer isDeleted;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@@ -5,6 +5,7 @@ import cn.hutool.core.date.DatePattern;
|
|||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.core.io.IoUtil;
|
import cn.hutool.core.io.IoUtil;
|
||||||
import cn.hutool.core.io.file.FileNameUtil;
|
import cn.hutool.core.io.file.FileNameUtil;
|
||||||
|
import cn.hutool.core.io.unit.DataSizeUtil;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.hutool.core.util.ReflectUtil;
|
import cn.hutool.core.util.ReflectUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
@@ -31,6 +32,7 @@ import org.springframework.stereotype.Component;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -52,7 +54,6 @@ public class AliOssClient implements StandardOssClient {
|
|||||||
private OSS oss;
|
private OSS oss;
|
||||||
private AliOssConfig aliOssConfig;
|
private AliOssConfig aliOssConfig;
|
||||||
|
|
||||||
|
|
||||||
public List<String> selectAllBucket() {
|
public List<String> selectAllBucket() {
|
||||||
List<Bucket> buckets = oss.listBuckets();
|
List<Bucket> buckets = oss.listBuckets();
|
||||||
List<String> names = new ArrayList<>();
|
List<String> names = new ArrayList<>();
|
||||||
@@ -62,6 +63,80 @@ public class AliOssClient implements StandardOssClient {
|
|||||||
return names;
|
return names;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 获取目录文件信息
|
||||||
|
* @param: [bucket, dirName]
|
||||||
|
* @return: java.util.List<com.schisandra.oss.application.oss.model.OssInfo>
|
||||||
|
* @date: 2024/7/5 13:34
|
||||||
|
*/
|
||||||
|
public String transfer(String before){
|
||||||
|
SimpleDateFormat sdf = new SimpleDateFormat("EEE MMM dd HH:mm:ss zzz yyyy", Locale.US);
|
||||||
|
Date date = new Date();
|
||||||
|
try{
|
||||||
|
date = sdf.parse(before);
|
||||||
|
}catch (Exception e){
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
String formatStr = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(date);
|
||||||
|
|
||||||
|
return formatStr;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<OssInfo> listAliInfo(String bucket, String prefix){
|
||||||
|
// 列举文件。如果不设置Prefix,则列举存储空间下的所有文件。如果设置Prefix,则列举包含指定前缀的文件。
|
||||||
|
ObjectListing objectListing = oss.listObjects(bucket, prefix);
|
||||||
|
List<OSSObjectSummary> sums = objectListing.getObjectSummaries();
|
||||||
|
List<OssInfo> infos = new ArrayList<>();
|
||||||
|
if(prefix == ""){
|
||||||
|
for(OSSObjectSummary objectSummary : sums){
|
||||||
|
OssInfo info = new OssInfo();
|
||||||
|
|
||||||
|
String[] split_path = objectSummary.getKey().split("/");
|
||||||
|
if(split_path.length>=2)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
String[] split_path_again = split_path[0].split("\\.");
|
||||||
|
if(split_path_again.length>=2) {
|
||||||
|
info.setIsDir(false);
|
||||||
|
}else{
|
||||||
|
info.setIsDir(true);
|
||||||
|
}
|
||||||
|
info.setName(split_path[0]);
|
||||||
|
info.setPath(objectSummary.getKey());
|
||||||
|
info.setLength(DataSizeUtil.format(objectSummary.getSize()));
|
||||||
|
|
||||||
|
String formatStr = transfer(String.valueOf(objectSummary.getLastModified()));
|
||||||
|
info.setLastUpdateTime(formatStr);
|
||||||
|
infos.add(info);
|
||||||
|
}
|
||||||
|
|
||||||
|
}else{
|
||||||
|
for(OSSObjectSummary objectSummary : sums){
|
||||||
|
OssInfo info = new OssInfo();
|
||||||
|
|
||||||
|
int x = prefix.split("/").length;
|
||||||
|
String[] split_path = objectSummary.getKey().split("/");
|
||||||
|
if(split_path.length>=x+2)
|
||||||
|
continue;
|
||||||
|
String[] split_path_again = split_path[split_path.length-1].split("\\.");
|
||||||
|
if(split_path_again.length>=2){
|
||||||
|
info.setIsDir(false);
|
||||||
|
}else{
|
||||||
|
info.setIsDir(true);
|
||||||
|
}
|
||||||
|
info.setName(split_path[split_path.length-1]);
|
||||||
|
info.setPath(objectSummary.getKey());
|
||||||
|
info.setLength(DataSizeUtil.format(objectSummary.getSize()));
|
||||||
|
|
||||||
|
String formatStr = transfer(String.valueOf(objectSummary.getLastModified()));
|
||||||
|
info.setLastUpdateTime(formatStr);
|
||||||
|
infos.add(info);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return infos;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public String createBucket(String bucketName) {
|
public String createBucket(String bucketName) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -271,5 +346,4 @@ public class AliOssClient implements StandardOssClient {
|
|||||||
}
|
}
|
||||||
return ossInfo;
|
return ossInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -16,7 +16,8 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.Arrays;
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
|
||||||
@@ -32,6 +33,16 @@ public class AliOssConfiguration {
|
|||||||
@Resource
|
@Resource
|
||||||
SchisandraOssAliDomainService schisandraOssAliDomainService;
|
SchisandraOssAliDomainService schisandraOssAliDomainService;
|
||||||
|
|
||||||
|
public List<SchisandraOssAliDTO> selectAll(){
|
||||||
|
List<SchisandraOssAliBO> schisandraOssAliBO_list = schisandraOssAliDomainService.selectAll();
|
||||||
|
List<SchisandraOssAliDTO> schisandraOssAliDTO_list = new ArrayList<>();
|
||||||
|
for (SchisandraOssAliBO schisandraOssAliBO : schisandraOssAliBO_list ){
|
||||||
|
SchisandraOssAliDTO schisandraOssAliDTO = SchisandraOssAliDTOConverter.INSTANCE.convertBOToDTO(schisandraOssAliBO);
|
||||||
|
schisandraOssAliDTO_list.add(schisandraOssAliDTO);
|
||||||
|
}
|
||||||
|
return schisandraOssAliDTO_list;
|
||||||
|
}
|
||||||
|
|
||||||
public StandardOssClient aliOssClient(String userId) {
|
public StandardOssClient aliOssClient(String userId) {
|
||||||
CompletableFuture<SchisandraOssAliDTO> futurePrice = CompletableFuture.supplyAsync(() -> {
|
CompletableFuture<SchisandraOssAliDTO> futurePrice = CompletableFuture.supplyAsync(() -> {
|
||||||
SchisandraOssAliBO schisandraOssAliBO = schisandraOssAliDomainService.getAliOssConfig(Long.valueOf(userId));
|
SchisandraOssAliBO schisandraOssAliBO = schisandraOssAliDomainService.getAliOssConfig(Long.valueOf(userId));
|
||||||
@@ -49,33 +60,6 @@ public class AliOssConfiguration {
|
|||||||
aliOssConfig.setAccessKeySecret(ali.getAccessKeySecret());
|
aliOssConfig.setAccessKeySecret(ali.getAccessKeySecret());
|
||||||
aliOssConfig.setBasePath(ali.getBasePath());
|
aliOssConfig.setBasePath(ali.getBasePath());
|
||||||
|
|
||||||
|
|
||||||
// if (Boolean.parseBoolean(ali.getOpenAdvancedSetup())) {
|
|
||||||
// AliOssClientConfig aliOssClientConfig = new AliOssClientConfig();
|
|
||||||
// aliOssClientConfig.setCnameExcludeList(Arrays.asList(Optional.ofNullable(ali.getCnameExcludeList()).orElse("").split(",")));
|
|
||||||
// aliOssClientConfig.setConnectionTimeout(ali.getConnectionTimeout());
|
|
||||||
// aliOssClientConfig.setConnectionTTL(ali.getConnectionTTL());
|
|
||||||
// aliOssClientConfig.setProtocol(Protocol.valueOf(ali.getProtocol()));
|
|
||||||
// aliOssClientConfig.setConnectionRequestTimeout(ali.getConnectionRequestTimeout());
|
|
||||||
// aliOssClientConfig.setMaxConnections(ali.getMaxConnections());
|
|
||||||
// aliOssClientConfig.setProxyPort(Integer.parseInt(ali.getProxyPort()));
|
|
||||||
// aliOssClientConfig.setProxyDomain(ali.getProxyDomain());
|
|
||||||
// aliOssClientConfig.setCrcCheckEnabled(Boolean.parseBoolean(ali.getCrcCheckEnabled()));
|
|
||||||
// aliOssClientConfig.setTickOffset(ali.getTickOffset());
|
|
||||||
// aliOssClientConfig.setProxyHost(ali.getProxyHost());
|
|
||||||
// aliOssClientConfig.setProxyPassword(ali.getProxyPassword());
|
|
||||||
// aliOssClientConfig.setProxyUsername(ali.getProxyUsername());
|
|
||||||
// aliOssClientConfig.setVerifySSLEnable(Boolean.parseBoolean(ali.getVerifySSLEnable()));
|
|
||||||
// aliOssClientConfig.setUseSystemPropertyValues(Boolean.parseBoolean(ali.getUseSystemPropertyValues()));
|
|
||||||
// aliOssClientConfig.setUseReaper(Boolean.parseBoolean(ali.getUseReaper()));
|
|
||||||
// aliOssClientConfig.setSupportCname(Boolean.parseBoolean(ali.getSupportCname()));
|
|
||||||
// aliOssClientConfig.setSocketTimeout(ali.getSocketTimeout());
|
|
||||||
// aliOssClientConfig.setSldEnabled(Boolean.parseBoolean(ali.getSldEnabled()));
|
|
||||||
// aliOssClientConfig.setProxyWorkstation(ali.getProxyWorkstation());
|
|
||||||
// aliOssClientConfig.setIdleConnectionTime(ali.getIdleConnectionTime());
|
|
||||||
// aliOssClientConfig.setLogConnectionPoolStats(Boolean.parseBoolean(ali.getLogConnectionPoolStats()));
|
|
||||||
// aliOssConfig.setClientConfig(aliOssClientConfig);
|
|
||||||
// }
|
|
||||||
SpringUtil.registerBean(userId, aliOssClient(aliOssConfig));
|
SpringUtil.registerBean(userId, aliOssClient(aliOssConfig));
|
||||||
return aliOssClient(aliOssConfig);
|
return aliOssClient(aliOssConfig);
|
||||||
}
|
}
|
||||||
@@ -85,8 +69,21 @@ public class AliOssConfiguration {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public OSS ossClient(AliOssConfig aliOssConfig) {
|
public OSS ossClient(AliOssConfig aliOssConfig) {
|
||||||
|
String securityToken = aliOssConfig.getSecurityToken();
|
||||||
|
AliOssClientConfig clientConfiguration = aliOssConfig.getClientConfig();
|
||||||
|
if (ObjectUtil.isEmpty(securityToken) && ObjectUtil.isNotEmpty(clientConfiguration)) {
|
||||||
|
return new OSSClientBuilder().build(aliOssConfig.getEndpoint(),
|
||||||
|
aliOssConfig.getAccessKeyId(),
|
||||||
|
aliOssConfig.getAccessKeySecret(), clientConfiguration.toClientConfig());
|
||||||
|
}
|
||||||
|
if (ObjectUtil.isNotEmpty(securityToken) && ObjectUtil.isEmpty(clientConfiguration)) {
|
||||||
|
return new OSSClientBuilder().build(aliOssConfig.getEndpoint(),
|
||||||
|
aliOssConfig.getAccessKeyId(),
|
||||||
|
aliOssConfig.getAccessKeySecret(), securityToken);
|
||||||
|
}
|
||||||
return new OSSClientBuilder().build(aliOssConfig.getEndpoint(),
|
return new OSSClientBuilder().build(aliOssConfig.getEndpoint(),
|
||||||
aliOssConfig.getAccessKeyId(),
|
aliOssConfig.getAccessKeyId(),
|
||||||
aliOssConfig.getAccessKeySecret());
|
aliOssConfig.getAccessKeySecret(), securityToken,
|
||||||
|
Optional.ofNullable(clientConfiguration).orElse(new AliOssClientConfig()).toClientConfig());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -221,7 +221,7 @@ public class MinioOssClient implements StandardOssClient {
|
|||||||
info.setName(files[files.length - 1]);
|
info.setName(files[files.length - 1]);
|
||||||
info.setPath(item.objectName());
|
info.setPath(item.objectName());
|
||||||
info.setIsDir(item.isDir());
|
info.setIsDir(item.isDir());
|
||||||
info.setLength(String.valueOf(item.size()));
|
info.setLength( DataSizeUtil.format(item.size()));
|
||||||
info.setCreateTime(String.valueOf(item.lastModified()));
|
info.setCreateTime(String.valueOf(item.lastModified()));
|
||||||
}
|
}
|
||||||
infos.add(info);
|
infos.add(info);
|
||||||
|
@@ -2,12 +2,15 @@ package com.schisandra.oss.application.oss.core.minio;
|
|||||||
|
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.hutool.extra.spring.SpringUtil;
|
import cn.hutool.extra.spring.SpringUtil;
|
||||||
|
import com.schisandra.oss.application.convert.SchisandraOssAliDTOConverter;
|
||||||
import com.schisandra.oss.application.convert.SchisandraOssMinioDTOConverter;
|
import com.schisandra.oss.application.convert.SchisandraOssMinioDTOConverter;
|
||||||
|
import com.schisandra.oss.application.dto.SchisandraOssAliDTO;
|
||||||
import com.schisandra.oss.application.dto.SchisandraOssMinioDTO;
|
import com.schisandra.oss.application.dto.SchisandraOssMinioDTO;
|
||||||
import com.schisandra.oss.application.oss.core.StandardOssClient;
|
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.MinioOssClientConfig;
|
||||||
import com.schisandra.oss.application.oss.core.minio.model.MinioOssConfig;
|
import com.schisandra.oss.application.oss.core.minio.model.MinioOssConfig;
|
||||||
import com.schisandra.oss.common.entity.Result;
|
import com.schisandra.oss.common.entity.Result;
|
||||||
|
import com.schisandra.oss.domain.bo.SchisandraOssAliBO;
|
||||||
import com.schisandra.oss.domain.bo.SchisandraOssMinioBO;
|
import com.schisandra.oss.domain.bo.SchisandraOssMinioBO;
|
||||||
import com.schisandra.oss.domain.service.SchisandraOssMinioDomainService;
|
import com.schisandra.oss.domain.service.SchisandraOssMinioDomainService;
|
||||||
import io.minio.MinioClient;
|
import io.minio.MinioClient;
|
||||||
@@ -16,6 +19,8 @@ import okhttp3.OkHttpClient;
|
|||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
@@ -34,6 +39,16 @@ public class MinioOssConfiguration {
|
|||||||
@Resource
|
@Resource
|
||||||
private SchisandraOssMinioDomainService schisandraOssMinioDomainService;
|
private SchisandraOssMinioDomainService schisandraOssMinioDomainService;
|
||||||
|
|
||||||
|
public List<SchisandraOssMinioDTO> selectAll(){
|
||||||
|
List<SchisandraOssMinioBO> schisandraOssMinioBO_list = schisandraOssMinioDomainService.selectAll();
|
||||||
|
List<SchisandraOssMinioDTO> schisandraOssAliDTO_list = new ArrayList<>();
|
||||||
|
for (SchisandraOssMinioBO schisandraOssMinioBO : schisandraOssMinioBO_list ){
|
||||||
|
SchisandraOssMinioDTO schisandraOssMinioDTO = SchisandraOssMinioDTOConverter.INSTANCE.convertBOToDTO(schisandraOssMinioBO);
|
||||||
|
schisandraOssAliDTO_list.add(schisandraOssMinioDTO);
|
||||||
|
}
|
||||||
|
return schisandraOssAliDTO_list;
|
||||||
|
}
|
||||||
|
|
||||||
public Result minioOssClient(String userId) {
|
public Result minioOssClient(String userId) {
|
||||||
try {
|
try {
|
||||||
SchisandraOssMinioDTO minio = minioOssConfiguration.getSchisandraOssMinioDTO(userId);
|
SchisandraOssMinioDTO minio = minioOssConfiguration.getSchisandraOssMinioDTO(userId);
|
||||||
|
@@ -4,16 +4,14 @@ import cn.hutool.core.convert.Convert;
|
|||||||
import cn.hutool.core.date.DatePattern;
|
import cn.hutool.core.date.DatePattern;
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.core.io.file.FileNameUtil;
|
import cn.hutool.core.io.file.FileNameUtil;
|
||||||
|
import cn.hutool.core.io.unit.DataSizeUtil;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.hutool.core.util.ReflectUtil;
|
import cn.hutool.core.util.ReflectUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import cn.hutool.http.HttpResponse;
|
import cn.hutool.http.HttpResponse;
|
||||||
import cn.hutool.http.HttpUtil;
|
import cn.hutool.http.HttpUtil;
|
||||||
import com.qiniu.common.QiniuException;
|
import com.qiniu.common.QiniuException;
|
||||||
import com.qiniu.storage.BucketManager;
|
import com.qiniu.storage.*;
|
||||||
import com.qiniu.storage.Configuration;
|
|
||||||
import com.qiniu.storage.DownloadUrl;
|
|
||||||
import com.qiniu.storage.UploadManager;
|
|
||||||
import com.qiniu.storage.model.FileInfo;
|
import com.qiniu.storage.model.FileInfo;
|
||||||
import com.qiniu.storage.model.FileListing;
|
import com.qiniu.storage.model.FileListing;
|
||||||
import com.qiniu.storage.persistent.FileRecorder;
|
import com.qiniu.storage.persistent.FileRecorder;
|
||||||
@@ -34,21 +32,21 @@ import lombok.Data;
|
|||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
import lombok.SneakyThrows;
|
import lombok.SneakyThrows;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import okhttp3.OkHttpClient;
|
||||||
|
import okhttp3.Request;
|
||||||
|
|
||||||
import java.io.ByteArrayInputStream;
|
import java.io.*;
|
||||||
import java.io.File;
|
import java.net.URLEncoder;
|
||||||
import java.io.InputStream;
|
import java.text.SimpleDateFormat;
|
||||||
import java.io.OutputStream;
|
import java.util.*;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
import static com.aliyuncs.utils.Base64Helper.encode;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @author zlg
|
||||||
* @description: qiniu oss client
|
* @description: qiniu oss client
|
||||||
* @param:
|
* @param:
|
||||||
* @return:
|
* @return:
|
||||||
* @author zlg
|
|
||||||
* @date: 2024/6/25 14:00
|
* @date: 2024/6/25 14:00
|
||||||
*/
|
*/
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@@ -62,11 +60,167 @@ public class QiNiuOssClient implements StandardOssClient {
|
|||||||
public static final String BUCKET_OBJECT_NAME = "bucketManager";
|
public static final String BUCKET_OBJECT_NAME = "bucketManager";
|
||||||
|
|
||||||
private Auth auth;
|
private Auth auth;
|
||||||
|
|
||||||
private UploadManager uploadManager;
|
private UploadManager uploadManager;
|
||||||
private BucketManager bucketManager;
|
private BucketManager bucketManager;
|
||||||
private QiNiuOssConfig qiNiuOssConfig;
|
private QiNiuOssConfig qiNiuOssConfig;
|
||||||
private Configuration configuration;
|
private Configuration configuration;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 将时间转换为时间戳
|
||||||
|
*/
|
||||||
|
@SneakyThrows
|
||||||
|
public static long dateToStamp(String s) {
|
||||||
|
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
|
Date date = simpleDateFormat.parse(s);
|
||||||
|
long ts = date.getTime();
|
||||||
|
return ts;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 获取目录文件信息
|
||||||
|
* @param: [bucket, prefix] delimiter 指定目录分隔符,列出所有公共前缀(模拟列出目录效果)。缺省值为空字符串
|
||||||
|
* @return: java.util.List<com.schisandra.oss.application.oss.model.OssInfo>
|
||||||
|
* @date: 2024/6/26 13:34
|
||||||
|
*/
|
||||||
|
public List<OssInfo> listfile(String bucket, String prefix) {
|
||||||
|
String delimiter = "";
|
||||||
|
|
||||||
|
|
||||||
|
BucketManager.FileListIterator fileListIterator = bucketManager.createFileListIterator(bucket, prefix, 1000, delimiter);
|
||||||
|
List<OssInfo> infos = new ArrayList<>();
|
||||||
|
while (fileListIterator.hasNext()){
|
||||||
|
FileInfo[] items = fileListIterator.next();
|
||||||
|
for (FileInfo item : items) {
|
||||||
|
OssInfo info = new OssInfo();
|
||||||
|
info.setPath(item.key);
|
||||||
|
info.setLength(DataSizeUtil.format(item.fsize));
|
||||||
|
|
||||||
|
String[] split_path = item.key.split("/");
|
||||||
|
String[] split_path1 = split_path[split_path.length-1].split("\\.");
|
||||||
|
if(split_path.length >= 2 && split_path1.length >= 2){
|
||||||
|
info.setIsDir(false);
|
||||||
|
info.setName(split_path[split_path.length-1]);
|
||||||
|
}else if(split_path.length >= 2){
|
||||||
|
info.setIsDir(true);
|
||||||
|
info.setName(split_path[split_path.length-1]);
|
||||||
|
}else if(split_path.length < 2 && split_path1.length < 2){
|
||||||
|
info.setIsDir(true);
|
||||||
|
info.setName(item.key);
|
||||||
|
}else{
|
||||||
|
info.setIsDir(false);
|
||||||
|
info.setName(item.key);
|
||||||
|
}
|
||||||
|
|
||||||
|
String x = String.valueOf(item.putTime).substring(0, 10);
|
||||||
|
long y = Long.parseLong(x)*1000;
|
||||||
|
String result = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date(y));
|
||||||
|
info.setCreateTime(result);
|
||||||
|
infos.add(info);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return infos;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 七牛图片下载
|
||||||
|
*
|
||||||
|
* @param os targetName endpoint
|
||||||
|
* @param endpoint
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@SneakyThrows
|
||||||
|
public void downLoad_open(OutputStream os, String targetName,String endpoint) {
|
||||||
|
String filename = URLEncoder.encode(targetName,"UTF-8").replace("+", "%20");
|
||||||
|
DownloadUrl downloadUrl = new DownloadUrl(endpoint, false, getKey(filename, false));
|
||||||
|
try {
|
||||||
|
String url = downloadUrl.buildURL();
|
||||||
|
HttpUtil.download(url, os, false);
|
||||||
|
} catch (QiniuException e) {
|
||||||
|
String errorMsg = String.format("%s下载失败", targetName);
|
||||||
|
log.error(errorMsg, e);
|
||||||
|
throw new OssException(errorMsg, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@SneakyThrows
|
||||||
|
public String[] selectAllBucket() {
|
||||||
|
String[] buckets = bucketManager.buckets();
|
||||||
|
|
||||||
|
return buckets;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@SneakyThrows
|
||||||
|
public Integer deleteBucket(String bucketName) {
|
||||||
|
|
||||||
|
String path = "/drop/" + bucketName + "\n";
|
||||||
|
String access_token = auth.sign(path);
|
||||||
|
|
||||||
|
|
||||||
|
String url = "http://rs.qiniu.com/drop/" + bucketName;
|
||||||
|
OkHttpClient client = new OkHttpClient();
|
||||||
|
Request request = new Request.Builder().url(url).addHeader("Content-Type", "application/x-www-form-urlencoded")
|
||||||
|
|
||||||
|
.addHeader("Authorization", "QBox " + access_token)
|
||||||
|
.addHeader("Host", "uc.qiniuapi.com")
|
||||||
|
.addHeader("X-Qiniu-Date", "20060102T150405Z").build();
|
||||||
|
okhttp3.Response re = null;
|
||||||
|
re = client.newCall(request).execute();
|
||||||
|
if (re.isSuccessful() == true) {
|
||||||
|
|
||||||
|
System.out.println(re.code());
|
||||||
|
System.out.println(re.toString());
|
||||||
|
return re.code();
|
||||||
|
} else {
|
||||||
|
System.out.println(re.code());
|
||||||
|
System.out.println(re.toString());
|
||||||
|
return re.code();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* OSSClient
|
||||||
|
* 创建桶
|
||||||
|
*
|
||||||
|
* @param bucketName
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Integer createBucket(String bucketName, String region) throws IOException {
|
||||||
|
//mkbucketv2 此处不按照管网上的 管网上的会报401
|
||||||
|
String path = "/mkbucketv2/" + encode(bucketName.getBytes()) + "/region/" + region + "\n";
|
||||||
|
String access_token = auth.sign(path);
|
||||||
|
|
||||||
|
|
||||||
|
String url = "http://rs.qiniu.com/mkbucketv2/" + encode(bucketName.getBytes()) + "/region/" + region;
|
||||||
|
OkHttpClient client = new OkHttpClient();
|
||||||
|
Request request = new Request.Builder().url(url).addHeader("Content-Type", "application/x-www-form-urlencoded")
|
||||||
|
// Authorization 不以管网的 使用QBox +access_token 可以实现
|
||||||
|
.addHeader("Authorization", "QBox " + access_token)
|
||||||
|
.addHeader("Host", "uc.qiniuapi.com")
|
||||||
|
.addHeader("X-Qiniu-Date", "20060102T150405Z").build();
|
||||||
|
okhttp3.Response re = null;
|
||||||
|
try {
|
||||||
|
re = client.newCall(request).execute();
|
||||||
|
if (re.isSuccessful() == true) {
|
||||||
|
|
||||||
|
System.out.println(re.code());
|
||||||
|
System.out.println(re.toString());
|
||||||
|
return re.code();
|
||||||
|
} else {
|
||||||
|
System.out.println(re.code());
|
||||||
|
System.out.println(re.toString());
|
||||||
|
return re.code();
|
||||||
|
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public OssInfo upLoad(InputStream is, String targetName, Boolean isOverride) {
|
public OssInfo upLoad(InputStream is, String targetName, Boolean isOverride) {
|
||||||
try {
|
try {
|
||||||
@@ -96,9 +250,10 @@ public class QiNiuOssClient implements StandardOssClient {
|
|||||||
return getInfo(targetName);
|
return getInfo(targetName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//已废除
|
||||||
@Override
|
@Override
|
||||||
public void downLoad(OutputStream os, String targetName) {
|
public void downLoad(OutputStream os, String targetName) {
|
||||||
DownloadUrl downloadUrl = new DownloadUrl("qiniu.com", false, getKey(targetName, false));
|
DownloadUrl downloadUrl = new DownloadUrl("", false, getKey(targetName, false));
|
||||||
try {
|
try {
|
||||||
String url = downloadUrl.buildURL();
|
String url = downloadUrl.buildURL();
|
||||||
HttpUtil.download(url, os, false);
|
HttpUtil.download(url, os, false);
|
||||||
@@ -167,6 +322,8 @@ public class QiNiuOssClient implements StandardOssClient {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void delete(String targetName) {
|
public void delete(String targetName) {
|
||||||
try {
|
try {
|
||||||
|
@@ -2,24 +2,31 @@ package com.schisandra.oss.application.oss.core.qiniu;
|
|||||||
|
|
||||||
|
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import cn.hutool.extra.spring.SpringUtil;
|
||||||
import com.qiniu.storage.BucketManager;
|
import com.qiniu.storage.BucketManager;
|
||||||
import com.qiniu.storage.Configuration;
|
import com.qiniu.storage.Configuration;
|
||||||
import com.qiniu.storage.UploadManager;
|
import com.qiniu.storage.UploadManager;
|
||||||
import com.qiniu.util.Auth;
|
import com.qiniu.util.Auth;
|
||||||
import com.schisandra.oss.application.convert.SchisandraOssQiniuDTOConverter;
|
import com.schisandra.oss.application.convert.SchisandraOssQiniuDTOConverter;
|
||||||
|
import com.schisandra.oss.application.convert.SchisandraOssUpDTOConverter;
|
||||||
import com.schisandra.oss.application.dto.SchisandraOssQiniuDTO;
|
import com.schisandra.oss.application.dto.SchisandraOssQiniuDTO;
|
||||||
|
import com.schisandra.oss.application.dto.SchisandraOssUpDTO;
|
||||||
import com.schisandra.oss.application.oss.core.StandardOssClient;
|
import com.schisandra.oss.application.oss.core.StandardOssClient;
|
||||||
import com.schisandra.oss.application.oss.core.qiniu.model.QiNiuOssClientConfig;
|
import com.schisandra.oss.application.oss.core.qiniu.model.QiNiuOssClientConfig;
|
||||||
import com.schisandra.oss.application.oss.core.qiniu.model.QiNiuOssConfig;
|
import com.schisandra.oss.application.oss.core.qiniu.model.QiNiuOssConfig;
|
||||||
import com.schisandra.oss.application.oss.model.SliceConfig;
|
import com.schisandra.oss.application.oss.model.SliceConfig;
|
||||||
|
import com.schisandra.oss.common.entity.Result;
|
||||||
import com.schisandra.oss.domain.bo.SchisandraOssQiniuBO;
|
import com.schisandra.oss.domain.bo.SchisandraOssQiniuBO;
|
||||||
|
import com.schisandra.oss.domain.bo.SchisandraOssUpBO;
|
||||||
import com.schisandra.oss.domain.service.SchisandraOssQiniuDomainService;
|
import com.schisandra.oss.domain.service.SchisandraOssQiniuDomainService;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.context.annotation.Bean;
|
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description: qiniu oss 配置类
|
* @description: qiniu oss 配置类
|
||||||
@@ -32,25 +39,56 @@ import java.util.Optional;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
public class QiNiuOssConfiguration {
|
public class QiNiuOssConfiguration {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
QiNiuOssConfiguration qiniuOssConfiguration;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private SchisandraOssQiniuDomainService schisandraOssQiniuDomainService;
|
private SchisandraOssQiniuDomainService schisandraOssQiniuDomainService;
|
||||||
|
|
||||||
|
public List<SchisandraOssQiniuDTO> selectAll(){
|
||||||
|
List<SchisandraOssQiniuBO> schisandraOssQiniuBO_list = schisandraOssQiniuDomainService.selectAll();
|
||||||
|
List<SchisandraOssQiniuDTO> schisandraOssQiniuDTO_list = new ArrayList<>();
|
||||||
|
for (SchisandraOssQiniuBO schisandraOssQiniuBO : schisandraOssQiniuBO_list ){
|
||||||
|
SchisandraOssQiniuDTO schisandraOssQiniuDTO = SchisandraOssQiniuDTOConverter.INSTANCE.convertBOToDTO(schisandraOssQiniuBO);
|
||||||
|
schisandraOssQiniuDTO_list.add(schisandraOssQiniuDTO);
|
||||||
|
}
|
||||||
|
return schisandraOssQiniuDTO_list;
|
||||||
|
}
|
||||||
|
|
||||||
public StandardOssClient qiNiuOssClient(String userId) {
|
|
||||||
SchisandraOssQiniuBO schisandraOssQiniuBO = schisandraOssQiniuDomainService.getQiniuOssConfig(userId);
|
public SchisandraOssQiniuDTO getSchisandraOssQiNDTO(String userId) {
|
||||||
SchisandraOssQiniuDTO schisandraOssQiniuDTO = SchisandraOssQiniuDTOConverter.INSTANCE.convertBOToDTO(schisandraOssQiniuBO);
|
CompletableFuture<SchisandraOssQiniuDTO> futurePrice = CompletableFuture.supplyAsync(() -> {
|
||||||
if (ObjectUtil.isEmpty(schisandraOssQiniuDTO)) {
|
SchisandraOssQiniuBO qiniuBO = schisandraOssQiniuDomainService.getQiniuOssConfig(userId);
|
||||||
log.error("jd oss配置信息获取失败");
|
SchisandraOssQiniuDTO qiniuDTO = SchisandraOssQiniuDTOConverter.INSTANCE.convertBOToDTO(qiniuBO);
|
||||||
|
return qiniuDTO;
|
||||||
|
});
|
||||||
|
SchisandraOssQiniuDTO qiniu = futurePrice.join();
|
||||||
|
if (ObjectUtil.isEmpty(qiniu)) {
|
||||||
|
log.error("qiniu配置信息获取失败");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
String accessKey = schisandraOssQiniuDTO.getAccessKey();
|
return qiniu;
|
||||||
String secretKey = schisandraOssQiniuDTO.getSecretKey();
|
}
|
||||||
QiNiuOssConfig qiNiuOssConfig = new QiNiuOssConfig();
|
|
||||||
qiNiuOssConfig.setAccessKey(accessKey);
|
|
||||||
qiNiuOssConfig.setSecretKey(secretKey);
|
|
||||||
return qiNiuOssClient(qiNiuOssConfig);
|
|
||||||
|
|
||||||
|
public Result qiNiuOssClient(String userId) {
|
||||||
|
try {
|
||||||
|
SchisandraOssQiniuDTO qiniu = qiniuOssConfiguration.getSchisandraOssQiNDTO(userId);
|
||||||
|
if (qiniu == null) return null;
|
||||||
|
QiNiuOssConfig qiniuOssConfig = new QiNiuOssConfig();
|
||||||
|
qiniuOssConfig.setBasePath(qiniu.getBasePath());
|
||||||
|
qiniuOssConfig.setBucketName(qiniu.getBucketName());
|
||||||
|
qiniuOssConfig.setAccessKey(qiniu.getAccessKey());
|
||||||
|
qiniuOssConfig.setSecretKey(qiniu.getSecretKey());
|
||||||
|
qiniuOssConfig.setRegion(qiniu.getRegion());
|
||||||
|
qiniuOssConfig.setEndpoint(qiniu.getEndpoint());
|
||||||
|
qiniuOssConfig.init();
|
||||||
|
|
||||||
|
SpringUtil.registerBean(userId, qiNiuOssClient(qiniuOssConfig));
|
||||||
|
return Result.ok();
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("QiniuOssConfiguration.qiniuOssClient:{}", e.getMessage(), e);
|
||||||
|
return Result.fail();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private StandardOssClient qiNiuOssClient(QiNiuOssConfig qiNiuOssConfig) {
|
private StandardOssClient qiNiuOssClient(QiNiuOssConfig qiNiuOssConfig) {
|
||||||
|
@@ -13,7 +13,8 @@ public class QiNiuOssConfig {
|
|||||||
private String secretKey;
|
private String secretKey;
|
||||||
private String bucketName;
|
private String bucketName;
|
||||||
private QiNiuOssClientConfig clientConfig;
|
private QiNiuOssClientConfig clientConfig;
|
||||||
|
private String Region;
|
||||||
|
private String endpoint;
|
||||||
/**
|
/**
|
||||||
* 断点续传参数
|
* 断点续传参数
|
||||||
*/
|
*/
|
||||||
|
@@ -0,0 +1 @@
|
|||||||
|
/**
|
@@ -0,0 +1,239 @@
|
|||||||
|
package com.schisandra.oss.application.oss.core.sftp;
|
||||||
|
|
||||||
|
import cn.hutool.core.convert.Convert;
|
||||||
|
import cn.hutool.core.date.DatePattern;
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import cn.hutool.core.io.file.FileNameUtil;
|
||||||
|
import cn.hutool.core.io.unit.DataSizeUtil;
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import cn.hutool.core.util.ReflectUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import cn.hutool.extra.ssh.Sftp;
|
||||||
|
|
||||||
|
import com.jcraft.jsch.*;
|
||||||
|
import com.schisandra.oss.application.oss.core.StandardOssClient;
|
||||||
|
import com.schisandra.oss.application.oss.core.sftp.model.SftpOssConfig;
|
||||||
|
import com.schisandra.oss.application.oss.exception.OssException;
|
||||||
|
import com.schisandra.oss.application.oss.model.DirectoryOssInfo;
|
||||||
|
import com.schisandra.oss.application.oss.model.FileOssInfo;
|
||||||
|
import com.schisandra.oss.application.oss.model.OssInfo;
|
||||||
|
import com.schisandra.oss.application.oss.utils.OssPathUtil;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.SneakyThrows;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.io.OutputStream;
|
||||||
|
import java.nio.file.Paths;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
import static java.nio.file.Files.getLastModifiedTime;
|
||||||
|
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class SftpOssClient implements StandardOssClient {
|
||||||
|
|
||||||
|
public static final String SFTP_OBJECT_NAME = "sftp";
|
||||||
|
|
||||||
|
private Sftp sftp;
|
||||||
|
private SftpOssConfig sftpOssConfig;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public OssInfo upLoad(InputStream is, String targetName, Boolean isOverride) {
|
||||||
|
String key = getKey(targetName, true);
|
||||||
|
String parentPath = OssPathUtil.convertPath(Paths.get(key).getParent().toString(), true);
|
||||||
|
if (!sftp.exist(parentPath)) {
|
||||||
|
sftp.mkDirs(parentPath);
|
||||||
|
}
|
||||||
|
if (isOverride || !sftp.exist(key)) {
|
||||||
|
sftp.upload(parentPath, FileNameUtil.getName(targetName), is);
|
||||||
|
}
|
||||||
|
return getInfo(targetName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public OssInfo upLoadCheckPoint(File file, String targetName) {
|
||||||
|
String key = getKey(targetName, true);
|
||||||
|
String parentPath = OssPathUtil.convertPath(Paths.get(key).getParent().toString(), true);
|
||||||
|
if (!sftp.exist(parentPath)) {
|
||||||
|
sftp.mkDirs(parentPath);
|
||||||
|
}
|
||||||
|
sftp.put(file.getPath(), parentPath, new DefaultSftpProgressMonitor(file.length()), Sftp.Mode.RESUME);
|
||||||
|
return getInfo(targetName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void downLoad(OutputStream os, String targetName) {
|
||||||
|
sftp.download(getKey(targetName, true), os);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void downLoadCheckPoint(File localFile, String targetName) {
|
||||||
|
try {
|
||||||
|
OssInfo ossInfo = getInfo(targetName, false);
|
||||||
|
long skip = localFile.exists() ? localFile.length() : 0;
|
||||||
|
OutputStream os = new FileOutputStream(localFile);
|
||||||
|
ChannelSftp sftpClient = sftp.getClient();
|
||||||
|
sftpClient.get(getKey(targetName, true), os, new DefaultSftpProgressMonitor(Convert.toLong(ossInfo.getLength())), Sftp.Mode.RESUME.ordinal(), skip);
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new OssException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void delete(String targetName) {
|
||||||
|
String key = getKey(targetName, true);
|
||||||
|
if (isDirectory(targetName)) {
|
||||||
|
sftp.delDir(key);
|
||||||
|
} else {
|
||||||
|
sftp.delFile(key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void copy(String sourceName, String targetName, Boolean isOverride) {
|
||||||
|
log.warn("sftp协议不支持copy命令");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void move(String sourceName, String targetName, Boolean isOverride) {
|
||||||
|
log.warn("sftp协议不支持move命令");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void rename(String sourceName, String targetName, Boolean isOverride) {
|
||||||
|
String newSourceName = getKey(sourceName, true);
|
||||||
|
String newTargetName = getKey(targetName, true);
|
||||||
|
try {
|
||||||
|
if (isOverride || !isExist(newTargetName)) {
|
||||||
|
sftp.getClient().rename(newSourceName, newTargetName);
|
||||||
|
}
|
||||||
|
} catch (SftpException e) {
|
||||||
|
log.error("{}重命名为{}失败,错误信息为:", newSourceName, newTargetName, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public OssInfo getInfo(String targetName, Boolean isRecursion) {
|
||||||
|
String key = getKey(targetName, true);
|
||||||
|
OssInfo ossInfo = getBaseInfo(key);
|
||||||
|
if (isRecursion && sftp.isDir(key)) {
|
||||||
|
List<ChannelSftp.LsEntry> lsEntries = sftp.lsEntries(key);
|
||||||
|
List<OssInfo> fileOssInfos = new ArrayList<>();
|
||||||
|
List<OssInfo> directoryInfos = new ArrayList<>();
|
||||||
|
for (ChannelSftp.LsEntry lsEntry : lsEntries) {
|
||||||
|
SftpATTRS attrs = lsEntry.getAttrs();
|
||||||
|
String target = OssPathUtil.convertPath(targetName + StrUtil.SLASH + lsEntry.getFilename(), true);
|
||||||
|
if (attrs.isDir()) {
|
||||||
|
directoryInfos.add(getInfo(target, true));
|
||||||
|
} else {
|
||||||
|
fileOssInfos.add(getInfo(target, false));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ReflectUtil.setFieldValue(ossInfo, "fileInfos", fileOssInfos);
|
||||||
|
ReflectUtil.setFieldValue(ossInfo, "directoryInfos", directoryInfos);
|
||||||
|
}
|
||||||
|
return ossInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Boolean isExist(String targetName) {
|
||||||
|
return sftp.exist(getKey(targetName, true));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Boolean isFile(String targetName) {
|
||||||
|
return !isDirectory(targetName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Boolean isDirectory(String targetName) {
|
||||||
|
return sftp.isDir(getKey(targetName, true));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getBasePath() {
|
||||||
|
return sftpOssConfig.getBasePath();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, Object> getClientObject() {
|
||||||
|
return new HashMap<String, Object>() {
|
||||||
|
{
|
||||||
|
put(SFTP_OBJECT_NAME, getSftp());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
private OssInfo getBaseInfo(String targetName) {
|
||||||
|
String name = FileNameUtil.getName(targetName);
|
||||||
|
String path = OssPathUtil.replaceKey(name, getBasePath(), true);
|
||||||
|
ChannelSftp.LsEntry targetLsEntry = null;
|
||||||
|
OssInfo ossInfo;
|
||||||
|
if (sftp.isDir(targetName)) {
|
||||||
|
ossInfo = new DirectoryOssInfo();
|
||||||
|
List<ChannelSftp.LsEntry> lsEntries = sftp.lsEntries(OssPathUtil.convertPath(Paths.get(targetName).getParent().toString(), true));
|
||||||
|
for (ChannelSftp.LsEntry lsEntry : lsEntries) {
|
||||||
|
if (lsEntry.getFilename().equals(name)) {
|
||||||
|
targetLsEntry = lsEntry;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
ossInfo = new FileOssInfo();
|
||||||
|
List<ChannelSftp.LsEntry> lsEntries = sftp.lsEntries(targetName);
|
||||||
|
if (!lsEntries.isEmpty()) {
|
||||||
|
targetLsEntry = lsEntries.get(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (ObjectUtil.isNotEmpty(targetLsEntry)) {
|
||||||
|
SftpATTRS sftpattrs = targetLsEntry.getAttrs();
|
||||||
|
if (!sftpattrs.isDir()) {
|
||||||
|
ossInfo = new FileOssInfo();
|
||||||
|
}
|
||||||
|
ossInfo.setName(name);
|
||||||
|
ossInfo.setPath(path);
|
||||||
|
ossInfo.setLength(Convert.toStr(sftpattrs.getSize()));
|
||||||
|
ossInfo.setCreateTime(DateUtil.date(sftpattrs.getMTime() * 1000L).toString(DatePattern.NORM_DATETIME_PATTERN));
|
||||||
|
ossInfo.setLastUpdateTime(DateUtil.date(sftpattrs.getATime() * 1000L).toString(DatePattern.NORM_DATETIME_PATTERN));
|
||||||
|
}
|
||||||
|
return ossInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SneakyThrows
|
||||||
|
public List<OssInfo> listfile(String prefix) {
|
||||||
|
|
||||||
|
List<ChannelSftp.LsEntry> files = sftp.lsEntries(prefix);
|
||||||
|
List<OssInfo> infos = new ArrayList<>();
|
||||||
|
for (ChannelSftp.LsEntry file : files) {
|
||||||
|
OssInfo info = new OssInfo();
|
||||||
|
info.setName(file.getFilename());
|
||||||
|
info.setLength(DataSizeUtil.format(file.getAttrs().getSize()));
|
||||||
|
|
||||||
|
String path = prefix + StrUtil.SLASH + file.getFilename();
|
||||||
|
info.setPath(prefix + StrUtil.SLASH + file.getFilename());
|
||||||
|
|
||||||
|
if(isDirectory(path))
|
||||||
|
info.setIsDir(true);
|
||||||
|
else
|
||||||
|
info.setIsDir(false);
|
||||||
|
|
||||||
|
SimpleDateFormat sdf = new SimpleDateFormat("EEE MMM dd HH:mm:ss zzz yyyy", Locale.US);
|
||||||
|
Date date = (Date) sdf.parse(file.getAttrs().getMtimeString());
|
||||||
|
String formatStr = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(date);
|
||||||
|
info.setCreateTime(formatStr);
|
||||||
|
infos.add(info);
|
||||||
|
}
|
||||||
|
return infos;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1,91 @@
|
|||||||
|
package com.schisandra.oss.application.oss.core.sftp;
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import cn.hutool.extra.spring.SpringUtil;
|
||||||
|
import cn.hutool.extra.ssh.Sftp;
|
||||||
|
import com.schisandra.oss.application.convert.SchisandraOssSftpDTOConverter;
|
||||||
|
import com.schisandra.oss.application.convert.SchisandraOssUpDTOConverter;
|
||||||
|
import com.schisandra.oss.application.dto.SchisandraOssSftpDTO;
|
||||||
|
import com.schisandra.oss.application.dto.SchisandraOssUpDTO;
|
||||||
|
import com.schisandra.oss.application.oss.core.StandardOssClient;
|
||||||
|
import com.schisandra.oss.application.oss.core.sftp.model.SftpOssConfig;
|
||||||
|
import com.schisandra.oss.common.entity.Result;
|
||||||
|
import com.schisandra.oss.domain.bo.SchisandraOssSftpBO;
|
||||||
|
import com.schisandra.oss.domain.bo.SchisandraOssUpBO;
|
||||||
|
import com.schisandra.oss.domain.service.SchisandraOssSftpDomainService;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Component
|
||||||
|
@Slf4j
|
||||||
|
public class SftpOssConfiguration {
|
||||||
|
@Resource
|
||||||
|
SftpOssConfiguration sftpOssConfiguration;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private SchisandraOssSftpDomainService schisandraOssSftpDomainService;
|
||||||
|
|
||||||
|
public static final String DEFAULT_BEAN_NAME = "sftpOssClient";
|
||||||
|
|
||||||
|
public List<SchisandraOssSftpDTO> selectAll(){
|
||||||
|
List<SchisandraOssSftpBO> schisandraOssSftpBO_list = schisandraOssSftpDomainService.selectAll();
|
||||||
|
List<SchisandraOssSftpDTO> schisandraOssSdtpDTO_list = new ArrayList<>();
|
||||||
|
for (SchisandraOssSftpBO shisandraOssSftpBO : schisandraOssSftpBO_list ){
|
||||||
|
SchisandraOssSftpDTO schisandraOssSftpDTO = SchisandraOssSftpDTOConverter.INSTANCE.convertBOToDTO(shisandraOssSftpBO);
|
||||||
|
schisandraOssSdtpDTO_list.add(schisandraOssSftpDTO);
|
||||||
|
}
|
||||||
|
return schisandraOssSdtpDTO_list;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SchisandraOssSftpDTO getSchisandraOssSftpDTO(String userId) {
|
||||||
|
CompletableFuture<SchisandraOssSftpDTO> futurePrice = CompletableFuture.supplyAsync(() -> {
|
||||||
|
SchisandraOssSftpBO sftpBO = schisandraOssSftpDomainService.getSftpOssConfig(userId);
|
||||||
|
SchisandraOssSftpDTO sftpDTO = SchisandraOssSftpDTOConverter.INSTANCE.convertBOToDTO(sftpBO);
|
||||||
|
return sftpDTO;
|
||||||
|
});
|
||||||
|
SchisandraOssSftpDTO sftp = futurePrice.join();
|
||||||
|
if (ObjectUtil.isEmpty(sftp)) {
|
||||||
|
log.error("sftp配置信息获取失败");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return sftp;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public Result sftpOssClient(String userId) {
|
||||||
|
try {
|
||||||
|
SchisandraOssSftpDTO sftp = sftpOssConfiguration.getSchisandraOssSftpDTO(userId);
|
||||||
|
if (sftp == null) return null;
|
||||||
|
SftpOssConfig sftpOssConfig = new SftpOssConfig();
|
||||||
|
sftpOssConfig.setBasePath(sftp.getBasePath());
|
||||||
|
sftpOssConfig.setHost(sftp.getHost());
|
||||||
|
sftpOssConfig.setPort(sftp.getPort());
|
||||||
|
sftpOssConfig.setPassword(sftp.getPassword());
|
||||||
|
sftpOssConfig.setCharset(sftp.getCharset());
|
||||||
|
sftpOssConfig.init();
|
||||||
|
|
||||||
|
SpringUtil.registerBean(userId, sftpOssClient(sftpOssConfig));
|
||||||
|
return Result.ok();
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("SftpOssConfiguration.qiniuOssClient:{}", e.getMessage(), e);
|
||||||
|
return Result.fail();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public StandardOssClient sftpOssClient(SftpOssConfig sftpOssConfig) {
|
||||||
|
return new SftpOssClient(sftp(sftpOssConfig), sftpOssConfig);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Sftp sftp(SftpOssConfig sftpOssConfig) {
|
||||||
|
return new Sftp(sftpOssConfig.toFtpConfig());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1,31 @@
|
|||||||
|
package com.schisandra.oss.application.oss.core.sftp.model;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author 陈敏
|
||||||
|
* @version SftpOssClientConfig.java, v 1.0 2022/5/9 0:27 chenmin Exp $
|
||||||
|
* Created on 2022/5/9
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Accessors(chain = true)
|
||||||
|
public class SftpOssClientConfig {
|
||||||
|
/**
|
||||||
|
* 连接超时时长,单位毫秒
|
||||||
|
*/
|
||||||
|
private long connectionTimeout;
|
||||||
|
/**
|
||||||
|
* Socket连接超时时长,单位毫秒
|
||||||
|
*/
|
||||||
|
private long soTimeout;
|
||||||
|
/**
|
||||||
|
* 设置服务器语言
|
||||||
|
*/
|
||||||
|
private String serverLanguageCode;
|
||||||
|
/**
|
||||||
|
* 设置服务器系统关键词
|
||||||
|
*/
|
||||||
|
private String systemKey;
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1,57 @@
|
|||||||
|
package com.schisandra.oss.application.oss.core.sftp.model;
|
||||||
|
|
||||||
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
|
import cn.hutool.core.bean.copier.CopyOptions;
|
||||||
|
import cn.hutool.extra.ftp.FtpConfig;
|
||||||
|
|
||||||
|
import com.schisandra.oss.application.oss.utils.OssPathUtil;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.nio.charset.Charset;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author 陈敏
|
||||||
|
* @version SftpOssConfig.java, v 1.1 2022/2/20 9:06 chenmin Exp $
|
||||||
|
* Created on 2022/2/20
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class SftpOssConfig {
|
||||||
|
|
||||||
|
private String basePath;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主机
|
||||||
|
*/
|
||||||
|
private String host;
|
||||||
|
/**
|
||||||
|
* 端口
|
||||||
|
*/
|
||||||
|
private int port;
|
||||||
|
/**
|
||||||
|
* 用户名
|
||||||
|
*/
|
||||||
|
private String user;
|
||||||
|
/**
|
||||||
|
* 密码
|
||||||
|
*/
|
||||||
|
private String password;
|
||||||
|
/**
|
||||||
|
* 编码
|
||||||
|
*/
|
||||||
|
private String charset;
|
||||||
|
|
||||||
|
private SftpOssClientConfig clientConfig;
|
||||||
|
|
||||||
|
public void init() {
|
||||||
|
basePath = OssPathUtil.valid(basePath);
|
||||||
|
}
|
||||||
|
|
||||||
|
public FtpConfig toFtpConfig() {
|
||||||
|
FtpConfig ftpConfig = new FtpConfig();
|
||||||
|
BeanUtil.copyProperties(this, ftpConfig,
|
||||||
|
new CopyOptions().setIgnoreNullValue(true).setIgnoreProperties("basePath", "clientConfig"));
|
||||||
|
BeanUtil.copyProperties(this.getClientConfig(), ftpConfig, new CopyOptions().setIgnoreNullValue(true));
|
||||||
|
return ftpConfig;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@@ -11,18 +11,23 @@ import com.qcloud.cos.auth.COSCredentials;
|
|||||||
import com.qcloud.cos.http.HttpProtocol;
|
import com.qcloud.cos.http.HttpProtocol;
|
||||||
import com.qcloud.cos.region.Region;
|
import com.qcloud.cos.region.Region;
|
||||||
import com.schisandra.oss.application.convert.SchisandraOssTencentDTOConverter;
|
import com.schisandra.oss.application.convert.SchisandraOssTencentDTOConverter;
|
||||||
|
import com.schisandra.oss.application.convert.SchisandraOssUpDTOConverter;
|
||||||
import com.schisandra.oss.application.dto.SchisandraOssTencentDTO;
|
import com.schisandra.oss.application.dto.SchisandraOssTencentDTO;
|
||||||
|
import com.schisandra.oss.application.dto.SchisandraOssUpDTO;
|
||||||
import com.schisandra.oss.application.oss.core.StandardOssClient;
|
import com.schisandra.oss.application.oss.core.StandardOssClient;
|
||||||
import com.schisandra.oss.application.oss.core.tencent.model.TencentOssClientConfig;
|
import com.schisandra.oss.application.oss.core.tencent.model.TencentOssClientConfig;
|
||||||
import com.schisandra.oss.application.oss.core.tencent.model.TencentOssConfig;
|
import com.schisandra.oss.application.oss.core.tencent.model.TencentOssConfig;
|
||||||
import com.schisandra.oss.common.entity.Result;
|
import com.schisandra.oss.common.entity.Result;
|
||||||
import com.schisandra.oss.domain.bo.SchisandraOssTencentBO;
|
import com.schisandra.oss.domain.bo.SchisandraOssTencentBO;
|
||||||
|
import com.schisandra.oss.domain.bo.SchisandraOssUpBO;
|
||||||
import com.schisandra.oss.domain.service.SchisandraOssTencentDomainService;
|
import com.schisandra.oss.domain.service.SchisandraOssTencentDomainService;
|
||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
import static com.tencentcloudapi.common.profile.Region.Chengdu;
|
import static com.tencentcloudapi.common.profile.Region.Chengdu;
|
||||||
@@ -41,6 +46,15 @@ public class TencentOssConfiguration {
|
|||||||
@Resource
|
@Resource
|
||||||
private SchisandraOssTencentDomainService schisandraOssTencentDomainService;
|
private SchisandraOssTencentDomainService schisandraOssTencentDomainService;
|
||||||
|
|
||||||
|
public List<SchisandraOssTencentDTO> selectAll(){
|
||||||
|
List<SchisandraOssTencentBO> schisandraOssTencentBO_list = schisandraOssTencentDomainService.selectAll();
|
||||||
|
List<SchisandraOssTencentDTO> schisandraOssTencentDTO_list = new ArrayList<>();
|
||||||
|
for (SchisandraOssTencentBO schisandraOssTencentBO : schisandraOssTencentBO_list ){
|
||||||
|
SchisandraOssTencentDTO schisandraOssTencentDTO = SchisandraOssTencentDTOConverter.INSTANCE.convertBOToDTO(schisandraOssTencentBO);
|
||||||
|
schisandraOssTencentDTO_list.add(schisandraOssTencentDTO);
|
||||||
|
}
|
||||||
|
return schisandraOssTencentDTO_list;
|
||||||
|
}
|
||||||
|
|
||||||
public Result tencentOssClient(String userId) {
|
public Result tencentOssClient(String userId) {
|
||||||
SchisandraOssTencentBO schisandraOssTencentBO = schisandraOssTencentDomainService.getTencentOssConfig(userId);
|
SchisandraOssTencentBO schisandraOssTencentBO = schisandraOssTencentDomainService.getTencentOssConfig(userId);
|
||||||
|
@@ -3,8 +3,10 @@ package com.schisandra.oss.application.oss.core.up;
|
|||||||
import cn.hutool.core.text.CharPool;
|
import cn.hutool.core.text.CharPool;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.hutool.extra.spring.SpringUtil;
|
import cn.hutool.extra.spring.SpringUtil;
|
||||||
|
import com.schisandra.oss.application.convert.SchisandraOssAliDTOConverter;
|
||||||
import com.schisandra.oss.application.convert.SchisandraOssUcloudDTOConverter;
|
import com.schisandra.oss.application.convert.SchisandraOssUcloudDTOConverter;
|
||||||
import com.schisandra.oss.application.convert.SchisandraOssUpDTOConverter;
|
import com.schisandra.oss.application.convert.SchisandraOssUpDTOConverter;
|
||||||
|
import com.schisandra.oss.application.dto.SchisandraOssAliDTO;
|
||||||
import com.schisandra.oss.application.dto.SchisandraOssUcloudDTO;
|
import com.schisandra.oss.application.dto.SchisandraOssUcloudDTO;
|
||||||
import com.schisandra.oss.application.dto.SchisandraOssUpDTO;
|
import com.schisandra.oss.application.dto.SchisandraOssUpDTO;
|
||||||
import com.schisandra.oss.application.oss.constant.OssConstant;
|
import com.schisandra.oss.application.oss.constant.OssConstant;
|
||||||
@@ -12,6 +14,7 @@ import com.schisandra.oss.application.oss.core.StandardOssClient;
|
|||||||
import com.schisandra.oss.application.oss.core.up.model.UpOssClientConfig;
|
import com.schisandra.oss.application.oss.core.up.model.UpOssClientConfig;
|
||||||
import com.schisandra.oss.application.oss.core.up.model.UpOssConfig;
|
import com.schisandra.oss.application.oss.core.up.model.UpOssConfig;
|
||||||
import com.schisandra.oss.application.oss.model.SliceConfig;
|
import com.schisandra.oss.application.oss.model.SliceConfig;
|
||||||
|
import com.schisandra.oss.domain.bo.SchisandraOssAliBO;
|
||||||
import com.schisandra.oss.domain.bo.SchisandraOssUcloudBO;
|
import com.schisandra.oss.domain.bo.SchisandraOssUcloudBO;
|
||||||
import com.schisandra.oss.domain.bo.SchisandraOssUpBO;
|
import com.schisandra.oss.domain.bo.SchisandraOssUpBO;
|
||||||
import com.schisandra.oss.domain.service.SchisandraOssUcloudDomainService;
|
import com.schisandra.oss.domain.service.SchisandraOssUcloudDomainService;
|
||||||
@@ -29,6 +32,8 @@ import org.springframework.context.annotation.Bean;
|
|||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
@@ -48,6 +53,17 @@ public class UpOssConfiguration {
|
|||||||
@Resource
|
@Resource
|
||||||
private SchisandraOssUpDomainService schisandraOssUpDomainService;
|
private SchisandraOssUpDomainService schisandraOssUpDomainService;
|
||||||
|
|
||||||
|
public List<SchisandraOssUpDTO> selectAll(){
|
||||||
|
List<SchisandraOssUpBO> schisandraOssUpBO_list = schisandraOssUpDomainService.selectAll();
|
||||||
|
List<SchisandraOssUpDTO> schisandraOssUpDTO_list = new ArrayList<>();
|
||||||
|
for (SchisandraOssUpBO schisandraOssUpBO : schisandraOssUpBO_list ){
|
||||||
|
SchisandraOssUpDTO schisandraOssUpDTO = SchisandraOssUpDTOConverter.INSTANCE.convertBOToDTO(schisandraOssUpBO);
|
||||||
|
schisandraOssUpDTO_list.add(schisandraOssUpDTO);
|
||||||
|
}
|
||||||
|
return schisandraOssUpDTO_list;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public StandardOssClient upOssClient(String userId) {
|
public StandardOssClient upOssClient(String userId) {
|
||||||
SchisandraOssUpBO schisandraOssUpBO = schisandraOssUpDomainService.getUpOssConfig(userId);
|
SchisandraOssUpBO schisandraOssUpBO = schisandraOssUpDomainService.getUpOssConfig(userId);
|
||||||
|
@@ -213,6 +213,12 @@
|
|||||||
<artifactId>nos-sdk-java-publiccloud</artifactId>
|
<artifactId>nos-sdk-java-publiccloud</artifactId>
|
||||||
<version>1.3.1</version>
|
<version>1.3.1</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.jcraft</groupId>
|
||||||
|
<artifactId>jsch</artifactId>
|
||||||
|
<version>0.1.55</version>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
@@ -0,0 +1,37 @@
|
|||||||
|
package com.schisandra.oss.domain.bo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
/**
|
||||||
|
* 文件上传热力图表 bo
|
||||||
|
*
|
||||||
|
* @author landaiqing
|
||||||
|
* @since 2024-07-11 10:43:27
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class SchisandraFileHeatmapBO implements Serializable {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private Date date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private Long count;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@@ -168,5 +168,6 @@ public class SchisandraOssQiniuBO implements Serializable {
|
|||||||
*/
|
*/
|
||||||
private String checkBucket;
|
private String checkBucket;
|
||||||
|
|
||||||
|
private String endpoint;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -0,0 +1,127 @@
|
|||||||
|
package com.schisandra.oss.domain.bo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
/**
|
||||||
|
* sftp存储配置表 bo
|
||||||
|
*
|
||||||
|
* @author landaiqing
|
||||||
|
* @since 2024-07-12 15:44:04
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class SchisandraOssSftpBO implements Serializable {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主机
|
||||||
|
*/
|
||||||
|
private String host;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 端口
|
||||||
|
*/
|
||||||
|
private Integer port;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private String basePath;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private String user;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private String password;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 编码
|
||||||
|
*/
|
||||||
|
private String charset;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 连接超时时长,单位毫秒
|
||||||
|
*/
|
||||||
|
private Long connectionTimeout;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Socket连接超时时长,单位毫秒
|
||||||
|
*/
|
||||||
|
private Date soTimeout;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置服务器语言
|
||||||
|
*/
|
||||||
|
private String serverLanguageCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置服务器系统关键词
|
||||||
|
*/
|
||||||
|
private String systemKey;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分片大小,默认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;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@@ -0,0 +1,72 @@
|
|||||||
|
package com.schisandra.oss.domain.bo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
/**
|
||||||
|
* 用户对象存储映射表 bo
|
||||||
|
*
|
||||||
|
* @author landaiqing
|
||||||
|
* @since 2024-07-10 16:14:33
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class SchisandraUserOssBO implements Serializable {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private String ossType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private String icon;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private Integer bucketCount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建人
|
||||||
|
*/
|
||||||
|
private String createdBy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
private Date createdTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新人
|
||||||
|
*/
|
||||||
|
private String updateBy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新时间
|
||||||
|
*/
|
||||||
|
private Date updateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private Integer isDeleted;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@@ -0,0 +1,22 @@
|
|||||||
|
package com.schisandra.oss.domain.convert;
|
||||||
|
|
||||||
|
import com.schisandra.oss.domain.bo.SchisandraFileHeatmapBO;
|
||||||
|
import com.schisandra.oss.infra.basic.entity.SchisandraFileHeatmap;
|
||||||
|
import org.mapstruct.Mapper;
|
||||||
|
import org.mapstruct.factory.Mappers;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件上传热力图表 bo转换器
|
||||||
|
*
|
||||||
|
* @author landaiqing
|
||||||
|
* @since 2024-07-11 10:43:27
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface SchisandraFileHeatmapBOConverter {
|
||||||
|
|
||||||
|
SchisandraFileHeatmapBOConverter INSTANCE = Mappers.getMapper(SchisandraFileHeatmapBOConverter.class);
|
||||||
|
|
||||||
|
SchisandraFileHeatmap convertBOToEntity(SchisandraFileHeatmapBO schisandraFileHeatmapBO);
|
||||||
|
SchisandraFileHeatmapBO convertEntityToBO(SchisandraFileHeatmap schisandraFileHeatmap);
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1,22 @@
|
|||||||
|
package com.schisandra.oss.domain.convert;
|
||||||
|
|
||||||
|
import com.schisandra.oss.domain.bo.SchisandraOssSftpBO;
|
||||||
|
import com.schisandra.oss.infra.basic.entity.SchisandraOssSftp;
|
||||||
|
import org.mapstruct.Mapper;
|
||||||
|
import org.mapstruct.factory.Mappers;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* sftp存储配置表 bo转换器
|
||||||
|
*
|
||||||
|
* @author landaiqing
|
||||||
|
* @since 2024-07-12 15:44:04
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface SchisandraOssSftpBOConverter {
|
||||||
|
|
||||||
|
SchisandraOssSftpBOConverter INSTANCE = Mappers.getMapper(SchisandraOssSftpBOConverter.class);
|
||||||
|
|
||||||
|
SchisandraOssSftp convertBOToEntity(SchisandraOssSftpBO schisandraOssSftpBO);
|
||||||
|
SchisandraOssSftpBO convertEntityToBO(SchisandraOssSftp schisandraOssSftp);
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1,26 @@
|
|||||||
|
package com.schisandra.oss.domain.convert;
|
||||||
|
|
||||||
|
import com.schisandra.oss.domain.bo.SchisandraUserOssBO;
|
||||||
|
import com.schisandra.oss.infra.basic.entity.SchisandraUserOss;
|
||||||
|
import org.mapstruct.Mapper;
|
||||||
|
import org.mapstruct.factory.Mappers;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户对象存储映射表 bo转换器
|
||||||
|
*
|
||||||
|
* @author landaiqing
|
||||||
|
* @since 2024-07-10 16:14:33
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface SchisandraUserOssBOConverter {
|
||||||
|
|
||||||
|
SchisandraUserOssBOConverter INSTANCE = Mappers.getMapper(SchisandraUserOssBOConverter.class);
|
||||||
|
|
||||||
|
SchisandraUserOss convertBOToEntity(SchisandraUserOssBO schisandraUserOssBO);
|
||||||
|
SchisandraUserOssBO convertEntityToBO(SchisandraUserOss schisandraUserOss);
|
||||||
|
|
||||||
|
List<SchisandraUserOssBO> convertEntityListToBOList(List<SchisandraUserOss> schisandraUserOssList);
|
||||||
|
|
||||||
|
}
|
@@ -1,11 +1,14 @@
|
|||||||
package com.schisandra.oss.domain.redis;
|
package com.schisandra.oss.domain.redis;
|
||||||
|
|
||||||
|
import com.google.gson.Gson;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.data.redis.core.RedisTemplate;
|
import org.springframework.data.redis.core.RedisTemplate;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
@@ -26,6 +29,22 @@ public class RedisUtil {
|
|||||||
|
|
||||||
private static final String CACHE_KEY_SEPARATOR = ":";
|
private static final String CACHE_KEY_SEPARATOR = ":";
|
||||||
|
|
||||||
|
|
||||||
|
public List<Object> getDataFromDirectory(String directory) {
|
||||||
|
Set<String>keys=redisTemplate.keys(directory+":*");
|
||||||
|
List<Object> keysList=new ArrayList<>();
|
||||||
|
keys.forEach(key->{
|
||||||
|
HashMap<String,String> map=new HashMap<>();
|
||||||
|
String value= (String) redisTemplate.opsForValue().get(key);
|
||||||
|
String keyName=key.substring(key.lastIndexOf(":")+1);
|
||||||
|
map.put(keyName,value);
|
||||||
|
keysList.add(map);
|
||||||
|
});
|
||||||
|
return keysList;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 构建缓存key
|
* 构建缓存key
|
||||||
*/
|
*/
|
||||||
|
@@ -0,0 +1,28 @@
|
|||||||
|
package com.schisandra.oss.domain.service;
|
||||||
|
|
||||||
|
import com.schisandra.oss.domain.bo.SchisandraFileHeatmapBO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件上传热力图表 领域service
|
||||||
|
*
|
||||||
|
* @author landaiqing
|
||||||
|
* @since 2024-07-11 10:43:27
|
||||||
|
*/
|
||||||
|
public interface SchisandraFileHeatmapDomainService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加 文件上传热力图表 信息
|
||||||
|
*/
|
||||||
|
Boolean add(SchisandraFileHeatmapBO schisandraFileHeatmapBO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新 文件上传热力图表 信息
|
||||||
|
*/
|
||||||
|
Boolean update(SchisandraFileHeatmapBO schisandraFileHeatmapBO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除 文件上传热力图表 信息
|
||||||
|
*/
|
||||||
|
Boolean delete(SchisandraFileHeatmapBO schisandraFileHeatmapBO);
|
||||||
|
|
||||||
|
}
|
@@ -2,6 +2,7 @@ package com.schisandra.oss.domain.service;
|
|||||||
|
|
||||||
import com.schisandra.oss.domain.bo.SchisandraOssAliBO;
|
import com.schisandra.oss.domain.bo.SchisandraOssAliBO;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -28,4 +29,6 @@ public interface SchisandraOssAliDomainService {
|
|||||||
Boolean delete(SchisandraOssAliBO schisandraOssAliBO);
|
Boolean delete(SchisandraOssAliBO schisandraOssAliBO);
|
||||||
|
|
||||||
SchisandraOssAliBO getAliOssConfig(Long userId);
|
SchisandraOssAliBO getAliOssConfig(Long userId);
|
||||||
|
|
||||||
|
List<SchisandraOssAliBO> selectAll();
|
||||||
}
|
}
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
package com.schisandra.oss.domain.service;
|
package com.schisandra.oss.domain.service;
|
||||||
|
|
||||||
|
import com.schisandra.oss.domain.bo.SchisandraOssAliBO;
|
||||||
import com.schisandra.oss.domain.bo.SchisandraOssMinioBO;
|
import com.schisandra.oss.domain.bo.SchisandraOssMinioBO;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -31,4 +32,6 @@ public interface SchisandraOssMinioDomainService {
|
|||||||
SchisandraOssMinioBO getMinioConfig(Long userId);
|
SchisandraOssMinioBO getMinioConfig(Long userId);
|
||||||
|
|
||||||
List<SchisandraOssMinioBO> getAllMinioInfo();
|
List<SchisandraOssMinioBO> getAllMinioInfo();
|
||||||
|
|
||||||
|
List<SchisandraOssMinioBO> selectAll();
|
||||||
}
|
}
|
||||||
|
@@ -2,6 +2,8 @@ package com.schisandra.oss.domain.service;
|
|||||||
|
|
||||||
import com.schisandra.oss.domain.bo.SchisandraOssQiniuBO;
|
import com.schisandra.oss.domain.bo.SchisandraOssQiniuBO;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 七牛云对象存储配置表 领域service
|
* 七牛云对象存储配置表 领域service
|
||||||
*
|
*
|
||||||
@@ -32,4 +34,6 @@ public interface SchisandraOssQiniuDomainService {
|
|||||||
* @date: 2024/6/25 14:34
|
* @date: 2024/6/25 14:34
|
||||||
*/
|
*/
|
||||||
SchisandraOssQiniuBO getQiniuOssConfig(String userId);
|
SchisandraOssQiniuBO getQiniuOssConfig(String userId);
|
||||||
|
|
||||||
|
List<SchisandraOssQiniuBO> selectAll();
|
||||||
}
|
}
|
||||||
|
@@ -0,0 +1,34 @@
|
|||||||
|
package com.schisandra.oss.domain.service;
|
||||||
|
|
||||||
|
import com.schisandra.oss.domain.bo.SchisandraOssQiniuBO;
|
||||||
|
import com.schisandra.oss.domain.bo.SchisandraOssSftpBO;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* sftp存储配置表 领域service
|
||||||
|
*
|
||||||
|
* @author landaiqing
|
||||||
|
* @since 2024-07-12 15:44:04
|
||||||
|
*/
|
||||||
|
public interface SchisandraOssSftpDomainService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加 sftp存储配置表 信息
|
||||||
|
*/
|
||||||
|
Boolean add(SchisandraOssSftpBO schisandraOssSftpBO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新 sftp存储配置表 信息
|
||||||
|
*/
|
||||||
|
Boolean update(SchisandraOssSftpBO schisandraOssSftpBO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除 sftp存储配置表 信息
|
||||||
|
*/
|
||||||
|
Boolean delete(SchisandraOssSftpBO schisandraOssSftpBO);
|
||||||
|
|
||||||
|
SchisandraOssSftpBO getSftpOssConfig(String userId);
|
||||||
|
|
||||||
|
List<SchisandraOssSftpBO> selectAll();
|
||||||
|
}
|
@@ -2,6 +2,8 @@ package com.schisandra.oss.domain.service;
|
|||||||
|
|
||||||
import com.schisandra.oss.domain.bo.SchisandraOssTencentBO;
|
import com.schisandra.oss.domain.bo.SchisandraOssTencentBO;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 腾讯云对象存储配置表 领域service
|
* 腾讯云对象存储配置表 领域service
|
||||||
*
|
*
|
||||||
@@ -32,4 +34,6 @@ public interface SchisandraOssTencentDomainService {
|
|||||||
* @date: 2024/6/25 14:34
|
* @date: 2024/6/25 14:34
|
||||||
*/
|
*/
|
||||||
SchisandraOssTencentBO getTencentOssConfig(String id);
|
SchisandraOssTencentBO getTencentOssConfig(String id);
|
||||||
|
|
||||||
|
List<SchisandraOssTencentBO> selectAll();
|
||||||
}
|
}
|
||||||
|
@@ -2,6 +2,8 @@ package com.schisandra.oss.domain.service;
|
|||||||
|
|
||||||
import com.schisandra.oss.domain.bo.SchisandraOssUpBO;
|
import com.schisandra.oss.domain.bo.SchisandraOssUpBO;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 又拍云对象存储配置表 领域service
|
* 又拍云对象存储配置表 领域service
|
||||||
*
|
*
|
||||||
@@ -26,4 +28,6 @@ public interface SchisandraOssUpDomainService {
|
|||||||
Boolean delete(SchisandraOssUpBO schisandraOssUpBO);
|
Boolean delete(SchisandraOssUpBO schisandraOssUpBO);
|
||||||
|
|
||||||
SchisandraOssUpBO getUpOssConfig(String userId);
|
SchisandraOssUpBO getUpOssConfig(String userId);
|
||||||
|
|
||||||
|
List<SchisandraOssUpBO> selectAll();
|
||||||
}
|
}
|
||||||
|
@@ -0,0 +1,31 @@
|
|||||||
|
package com.schisandra.oss.domain.service;
|
||||||
|
|
||||||
|
import com.schisandra.oss.domain.bo.SchisandraUserOssBO;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户对象存储映射表 领域service
|
||||||
|
*
|
||||||
|
* @author landaiqing
|
||||||
|
* @since 2024-07-10 16:14:33
|
||||||
|
*/
|
||||||
|
public interface SchisandraUserOssDomainService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加 用户对象存储映射表 信息
|
||||||
|
*/
|
||||||
|
Boolean add(SchisandraUserOssBO schisandraUserOssBO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新 用户对象存储映射表 信息
|
||||||
|
*/
|
||||||
|
Boolean update(SchisandraUserOssBO schisandraUserOssBO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除 用户对象存储映射表 信息
|
||||||
|
*/
|
||||||
|
Boolean delete(SchisandraUserOssBO schisandraUserOssBO);
|
||||||
|
|
||||||
|
List<SchisandraUserOssBO> queryOSSByUserId(Long userId);
|
||||||
|
}
|
@@ -0,0 +1,46 @@
|
|||||||
|
package com.schisandra.oss.domain.service.impl;
|
||||||
|
|
||||||
|
import com.schisandra.oss.common.enums.IsDeletedFlagEnum;
|
||||||
|
import com.schisandra.oss.domain.convert.SchisandraFileHeatmapBOConverter;
|
||||||
|
import com.schisandra.oss.domain.bo.SchisandraFileHeatmapBO;
|
||||||
|
import com.schisandra.oss.domain.service.SchisandraFileHeatmapDomainService;
|
||||||
|
import com.schisandra.oss.infra.basic.entity.SchisandraFileHeatmap;
|
||||||
|
import com.schisandra.oss.infra.basic.service.SchisandraFileHeatmapService;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件上传热力图表 领域service实现了
|
||||||
|
*
|
||||||
|
* @author landaiqing
|
||||||
|
* @since 2024-07-11 10:43:27
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@Slf4j
|
||||||
|
public class SchisandraFileHeatmapDomainServiceImpl implements SchisandraFileHeatmapDomainService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private SchisandraFileHeatmapService schisandraFileHeatmapService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Boolean add(SchisandraFileHeatmapBO schisandraFileHeatmapBO) {
|
||||||
|
SchisandraFileHeatmap schisandraFileHeatmap = SchisandraFileHeatmapBOConverter.INSTANCE.convertBOToEntity(schisandraFileHeatmapBO);
|
||||||
|
return schisandraFileHeatmapService.insert(schisandraFileHeatmap) > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Boolean update(SchisandraFileHeatmapBO schisandraFileHeatmapBO) {
|
||||||
|
SchisandraFileHeatmap schisandraFileHeatmap = SchisandraFileHeatmapBOConverter.INSTANCE.convertBOToEntity(schisandraFileHeatmapBO);
|
||||||
|
return schisandraFileHeatmapService.update(schisandraFileHeatmap) > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Boolean delete(SchisandraFileHeatmapBO schisandraFileHeatmapBO) {
|
||||||
|
SchisandraFileHeatmap schisandraFileHeatmap = new SchisandraFileHeatmap();
|
||||||
|
schisandraFileHeatmap.setId(schisandraFileHeatmapBO.getId());
|
||||||
|
return schisandraFileHeatmapService.update(schisandraFileHeatmap) > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@@ -8,9 +8,12 @@ import com.schisandra.oss.domain.service.SchisandraOssAliDomainService;
|
|||||||
import com.schisandra.oss.infra.basic.entity.SchisandraOssAli;
|
import com.schisandra.oss.infra.basic.entity.SchisandraOssAli;
|
||||||
import com.schisandra.oss.infra.basic.service.SchisandraOssAliService;
|
import com.schisandra.oss.infra.basic.service.SchisandraOssAliService;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.slf4j.Logger;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 领域service实现了
|
* 领域service实现了
|
||||||
@@ -53,4 +56,16 @@ public class SchisandraOssAliDomainServiceImpl implements SchisandraOssAliDomain
|
|||||||
return schisandraOssAliBO;
|
return schisandraOssAliBO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<SchisandraOssAliBO> selectAll(){
|
||||||
|
List<SchisandraOssAli> list = schisandraOssAliService.selectAll();
|
||||||
|
List<SchisandraOssAliBO> schisandraOssAliBO_list = new ArrayList<>();
|
||||||
|
for (SchisandraOssAli schisandraOssAli : list) {
|
||||||
|
SchisandraOssAliBO schisandraOssAliBO = SchisandraOssAliBOConverter.INSTANCE.convertEntityToBO(schisandraOssAli);
|
||||||
|
schisandraOssAliBO_list.add(schisandraOssAliBO);
|
||||||
|
}
|
||||||
|
return schisandraOssAliBO_list;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -2,15 +2,19 @@ package com.schisandra.oss.domain.service.impl;
|
|||||||
|
|
||||||
|
|
||||||
import com.schisandra.oss.common.enums.IsDeletedFlagEnum;
|
import com.schisandra.oss.common.enums.IsDeletedFlagEnum;
|
||||||
|
import com.schisandra.oss.domain.bo.SchisandraOssAliBO;
|
||||||
import com.schisandra.oss.domain.bo.SchisandraOssMinioBO;
|
import com.schisandra.oss.domain.bo.SchisandraOssMinioBO;
|
||||||
|
import com.schisandra.oss.domain.convert.SchisandraOssAliBOConverter;
|
||||||
import com.schisandra.oss.domain.convert.SchisandraOssMinioBOConverter;
|
import com.schisandra.oss.domain.convert.SchisandraOssMinioBOConverter;
|
||||||
import com.schisandra.oss.domain.service.SchisandraOssMinioDomainService;
|
import com.schisandra.oss.domain.service.SchisandraOssMinioDomainService;
|
||||||
|
import com.schisandra.oss.infra.basic.entity.SchisandraOssAli;
|
||||||
import com.schisandra.oss.infra.basic.entity.SchisandraOssMinio;
|
import com.schisandra.oss.infra.basic.entity.SchisandraOssMinio;
|
||||||
import com.schisandra.oss.infra.basic.service.SchisandraOssMinioService;
|
import com.schisandra.oss.infra.basic.service.SchisandraOssMinioService;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -61,4 +65,15 @@ public class SchisandraOssMinioDomainServiceImpl implements SchisandraOssMinioDo
|
|||||||
return schisandraOssMinioBOS;
|
return schisandraOssMinioBOS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<SchisandraOssMinioBO> selectAll(){
|
||||||
|
List<SchisandraOssMinio> list = schisandraOssMinioService.selectAll();
|
||||||
|
List<SchisandraOssMinioBO> schisandraOssMinioBO_list = new ArrayList<>();
|
||||||
|
for (SchisandraOssMinio schisandraOssMinio : list) {
|
||||||
|
SchisandraOssMinioBO schisandraOssMinioBO = SchisandraOssMinioBOConverter.INSTANCE.convertEntityToBO(schisandraOssMinio);
|
||||||
|
schisandraOssMinioBO_list.add(schisandraOssMinioBO);
|
||||||
|
}
|
||||||
|
return schisandraOssMinioBO_list;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -2,17 +2,22 @@ package com.schisandra.oss.domain.service.impl;
|
|||||||
|
|
||||||
import com.schisandra.oss.common.enums.IsDeletedFlagEnum;
|
import com.schisandra.oss.common.enums.IsDeletedFlagEnum;
|
||||||
import com.schisandra.oss.domain.bo.SchisandraOssJdBO;
|
import com.schisandra.oss.domain.bo.SchisandraOssJdBO;
|
||||||
|
import com.schisandra.oss.domain.bo.SchisandraOssUpBO;
|
||||||
import com.schisandra.oss.domain.convert.SchisandraOssJdBOConverter;
|
import com.schisandra.oss.domain.convert.SchisandraOssJdBOConverter;
|
||||||
import com.schisandra.oss.domain.convert.SchisandraOssQiniuBOConverter;
|
import com.schisandra.oss.domain.convert.SchisandraOssQiniuBOConverter;
|
||||||
import com.schisandra.oss.domain.bo.SchisandraOssQiniuBO;
|
import com.schisandra.oss.domain.bo.SchisandraOssQiniuBO;
|
||||||
|
import com.schisandra.oss.domain.convert.SchisandraOssUpBOConverter;
|
||||||
import com.schisandra.oss.domain.service.SchisandraOssQiniuDomainService;
|
import com.schisandra.oss.domain.service.SchisandraOssQiniuDomainService;
|
||||||
import com.schisandra.oss.infra.basic.entity.SchisandraOssJd;
|
import com.schisandra.oss.infra.basic.entity.SchisandraOssJd;
|
||||||
import com.schisandra.oss.infra.basic.entity.SchisandraOssQiniu;
|
import com.schisandra.oss.infra.basic.entity.SchisandraOssQiniu;
|
||||||
|
import com.schisandra.oss.infra.basic.entity.SchisandraOssUp;
|
||||||
import com.schisandra.oss.infra.basic.service.SchisandraOssQiniuService;
|
import com.schisandra.oss.infra.basic.service.SchisandraOssQiniuService;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 七牛云对象存储配置表 领域service实现了
|
* 七牛云对象存储配置表 领域service实现了
|
||||||
@@ -55,4 +60,14 @@ public class SchisandraOssQiniuDomainServiceImpl implements SchisandraOssQiniuDo
|
|||||||
return schisandraOssQiniuBO;
|
return schisandraOssQiniuBO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<SchisandraOssQiniuBO> selectAll(){
|
||||||
|
List<SchisandraOssQiniu> list = schisandraOssQiniuService.selectAll();
|
||||||
|
List<SchisandraOssQiniuBO> SchisandraOssQiniuBO_list = new ArrayList<>();
|
||||||
|
for (SchisandraOssQiniu schisandraOssQiniu : list) {
|
||||||
|
SchisandraOssQiniuBO schisandraOssQiniuBO = SchisandraOssQiniuBOConverter.INSTANCE.convertEntityToBO(schisandraOssQiniu);
|
||||||
|
SchisandraOssQiniuBO_list.add(schisandraOssQiniuBO);
|
||||||
|
}
|
||||||
|
return SchisandraOssQiniuBO_list;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -0,0 +1,73 @@
|
|||||||
|
package com.schisandra.oss.domain.service.impl;
|
||||||
|
|
||||||
|
import com.schisandra.oss.common.enums.IsDeletedFlagEnum;
|
||||||
|
import com.schisandra.oss.domain.bo.SchisandraOssFtpBO;
|
||||||
|
import com.schisandra.oss.domain.bo.SchisandraOssUpBO;
|
||||||
|
import com.schisandra.oss.domain.convert.SchisandraOssFtpBOConverter;
|
||||||
|
import com.schisandra.oss.domain.convert.SchisandraOssSftpBOConverter;
|
||||||
|
import com.schisandra.oss.domain.bo.SchisandraOssSftpBO;
|
||||||
|
import com.schisandra.oss.domain.convert.SchisandraOssUpBOConverter;
|
||||||
|
import com.schisandra.oss.domain.service.SchisandraOssSftpDomainService;
|
||||||
|
import com.schisandra.oss.infra.basic.entity.SchisandraOssFtp;
|
||||||
|
import com.schisandra.oss.infra.basic.entity.SchisandraOssSftp;
|
||||||
|
import com.schisandra.oss.infra.basic.entity.SchisandraOssUp;
|
||||||
|
import com.schisandra.oss.infra.basic.service.SchisandraOssSftpService;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* sftp存储配置表 领域service实现了
|
||||||
|
*
|
||||||
|
* @author landaiqing
|
||||||
|
* @since 2024-07-12 15:44:04
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@Slf4j
|
||||||
|
public class SchisandraOssSftpDomainServiceImpl implements SchisandraOssSftpDomainService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private SchisandraOssSftpService schisandraOssSftpService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Boolean add(SchisandraOssSftpBO schisandraOssSftpBO) {
|
||||||
|
SchisandraOssSftp schisandraOssSftp = SchisandraOssSftpBOConverter.INSTANCE.convertBOToEntity(schisandraOssSftpBO);
|
||||||
|
schisandraOssSftp.setIsDeleted(IsDeletedFlagEnum.UN_DELETED.getCode());
|
||||||
|
return schisandraOssSftpService.insert(schisandraOssSftp) > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Boolean update(SchisandraOssSftpBO schisandraOssSftpBO) {
|
||||||
|
SchisandraOssSftp schisandraOssSftp = SchisandraOssSftpBOConverter.INSTANCE.convertBOToEntity(schisandraOssSftpBO);
|
||||||
|
return schisandraOssSftpService.update(schisandraOssSftp) > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Boolean delete(SchisandraOssSftpBO schisandraOssSftpBO) {
|
||||||
|
SchisandraOssSftp schisandraOssSftp = new SchisandraOssSftp();
|
||||||
|
schisandraOssSftp.setId(schisandraOssSftpBO.getId());
|
||||||
|
schisandraOssSftp.setIsDeleted(IsDeletedFlagEnum.DELETED.getCode());
|
||||||
|
return schisandraOssSftpService.update(schisandraOssSftp) > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SchisandraOssSftpBO getSftpOssConfig(String userId) {
|
||||||
|
SchisandraOssSftp schisandraOssSftp = schisandraOssSftpService.getSftpOssConfig(userId);
|
||||||
|
SchisandraOssSftpBO schisandraOssSftpBO = SchisandraOssSftpBOConverter.INSTANCE.convertEntityToBO(schisandraOssSftp);
|
||||||
|
return schisandraOssSftpBO;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<SchisandraOssSftpBO> selectAll(){
|
||||||
|
List<SchisandraOssSftp> list = schisandraOssSftpService.selectAll();
|
||||||
|
List<SchisandraOssSftpBO> SchisandraOssSftpBO_list = new ArrayList<>();
|
||||||
|
for (SchisandraOssSftp schisandraOssSftp : list) {
|
||||||
|
SchisandraOssSftpBO schisandraOssSftpBO = SchisandraOssSftpBOConverter.INSTANCE.convertEntityToBO(schisandraOssSftp);
|
||||||
|
SchisandraOssSftpBO_list.add(schisandraOssSftpBO);
|
||||||
|
}
|
||||||
|
return SchisandraOssSftpBO_list;
|
||||||
|
}
|
||||||
|
}
|
@@ -2,17 +2,22 @@ package com.schisandra.oss.domain.service.impl;
|
|||||||
|
|
||||||
import com.schisandra.oss.common.enums.IsDeletedFlagEnum;
|
import com.schisandra.oss.common.enums.IsDeletedFlagEnum;
|
||||||
import com.schisandra.oss.domain.bo.SchisandraOssQiniuBO;
|
import com.schisandra.oss.domain.bo.SchisandraOssQiniuBO;
|
||||||
|
import com.schisandra.oss.domain.bo.SchisandraOssUpBO;
|
||||||
import com.schisandra.oss.domain.convert.SchisandraOssQiniuBOConverter;
|
import com.schisandra.oss.domain.convert.SchisandraOssQiniuBOConverter;
|
||||||
import com.schisandra.oss.domain.convert.SchisandraOssTencentBOConverter;
|
import com.schisandra.oss.domain.convert.SchisandraOssTencentBOConverter;
|
||||||
import com.schisandra.oss.domain.bo.SchisandraOssTencentBO;
|
import com.schisandra.oss.domain.bo.SchisandraOssTencentBO;
|
||||||
|
import com.schisandra.oss.domain.convert.SchisandraOssUpBOConverter;
|
||||||
import com.schisandra.oss.domain.service.SchisandraOssTencentDomainService;
|
import com.schisandra.oss.domain.service.SchisandraOssTencentDomainService;
|
||||||
import com.schisandra.oss.infra.basic.entity.SchisandraOssQiniu;
|
import com.schisandra.oss.infra.basic.entity.SchisandraOssQiniu;
|
||||||
import com.schisandra.oss.infra.basic.entity.SchisandraOssTencent;
|
import com.schisandra.oss.infra.basic.entity.SchisandraOssTencent;
|
||||||
|
import com.schisandra.oss.infra.basic.entity.SchisandraOssUp;
|
||||||
import com.schisandra.oss.infra.basic.service.SchisandraOssTencentService;
|
import com.schisandra.oss.infra.basic.service.SchisandraOssTencentService;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 腾讯云对象存储配置表 领域service实现了
|
* 腾讯云对象存储配置表 领域service实现了
|
||||||
@@ -55,5 +60,14 @@ public class SchisandraOssTencentDomainServiceImpl implements SchisandraOssTence
|
|||||||
return schisandraOssTencentBO;
|
return schisandraOssTencentBO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<SchisandraOssTencentBO> selectAll(){
|
||||||
|
List<SchisandraOssTencent> list = schisandraOssTencentService.selectAll();
|
||||||
|
List<SchisandraOssTencentBO> SchisandraOssTencentBO_list = new ArrayList<>();
|
||||||
|
for (SchisandraOssTencent schisandraOssTencent : list) {
|
||||||
|
SchisandraOssTencentBO schisandraOssUpBO = SchisandraOssTencentBOConverter.INSTANCE.convertEntityToBO(schisandraOssTencent);
|
||||||
|
SchisandraOssTencentBO_list.add(schisandraOssUpBO);
|
||||||
|
}
|
||||||
|
return SchisandraOssTencentBO_list;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,15 +1,20 @@
|
|||||||
package com.schisandra.oss.domain.service.impl;
|
package com.schisandra.oss.domain.service.impl;
|
||||||
|
|
||||||
import com.schisandra.oss.common.enums.IsDeletedFlagEnum;
|
import com.schisandra.oss.common.enums.IsDeletedFlagEnum;
|
||||||
|
import com.schisandra.oss.domain.bo.SchisandraOssMinioBO;
|
||||||
|
import com.schisandra.oss.domain.convert.SchisandraOssMinioBOConverter;
|
||||||
import com.schisandra.oss.domain.convert.SchisandraOssUpBOConverter;
|
import com.schisandra.oss.domain.convert.SchisandraOssUpBOConverter;
|
||||||
import com.schisandra.oss.domain.bo.SchisandraOssUpBO;
|
import com.schisandra.oss.domain.bo.SchisandraOssUpBO;
|
||||||
import com.schisandra.oss.domain.service.SchisandraOssUpDomainService;
|
import com.schisandra.oss.domain.service.SchisandraOssUpDomainService;
|
||||||
|
import com.schisandra.oss.infra.basic.entity.SchisandraOssMinio;
|
||||||
import com.schisandra.oss.infra.basic.entity.SchisandraOssUp;
|
import com.schisandra.oss.infra.basic.entity.SchisandraOssUp;
|
||||||
import com.schisandra.oss.infra.basic.service.SchisandraOssUpService;
|
import com.schisandra.oss.infra.basic.service.SchisandraOssUpService;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 又拍云对象存储配置表 领域service实现了
|
* 又拍云对象存储配置表 领域service实现了
|
||||||
@@ -51,4 +56,15 @@ public class SchisandraOssUpDomainServiceImpl implements SchisandraOssUpDomainSe
|
|||||||
return SchisandraOssUpBOConverter.INSTANCE.convertEntityToBO(schisandraOssUp);
|
return SchisandraOssUpBOConverter.INSTANCE.convertEntityToBO(schisandraOssUp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<SchisandraOssUpBO> selectAll(){
|
||||||
|
List<SchisandraOssUp> list = schisandraOssUpService.selectAll();
|
||||||
|
List<SchisandraOssUpBO> SchisandraOssUpBO_list = new ArrayList<>();
|
||||||
|
for (SchisandraOssUp schisandraOssUp : list) {
|
||||||
|
SchisandraOssUpBO schisandraOssUpBO = SchisandraOssUpBOConverter.INSTANCE.convertEntityToBO(schisandraOssUp);
|
||||||
|
SchisandraOssUpBO_list.add(schisandraOssUpBO);
|
||||||
|
}
|
||||||
|
return SchisandraOssUpBO_list;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -0,0 +1,57 @@
|
|||||||
|
package com.schisandra.oss.domain.service.impl;
|
||||||
|
|
||||||
|
import com.schisandra.oss.common.enums.IsDeletedFlagEnum;
|
||||||
|
import com.schisandra.oss.domain.convert.SchisandraUserOssBOConverter;
|
||||||
|
import com.schisandra.oss.domain.bo.SchisandraUserOssBO;
|
||||||
|
import com.schisandra.oss.domain.service.SchisandraUserOssDomainService;
|
||||||
|
import com.schisandra.oss.infra.basic.entity.SchisandraUserOss;
|
||||||
|
import com.schisandra.oss.infra.basic.service.SchisandraUserOssService;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户对象存储映射表 领域service实现了
|
||||||
|
*
|
||||||
|
* @author landaiqing
|
||||||
|
* @since 2024-07-10 16:14:33
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@Slf4j
|
||||||
|
public class SchisandraUserOssDomainServiceImpl implements SchisandraUserOssDomainService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private SchisandraUserOssService schisandraUserOssService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Boolean add(SchisandraUserOssBO schisandraUserOssBO) {
|
||||||
|
SchisandraUserOss schisandraUserOss = SchisandraUserOssBOConverter.INSTANCE.convertBOToEntity(schisandraUserOssBO);
|
||||||
|
schisandraUserOss.setIsDeleted(IsDeletedFlagEnum.UN_DELETED.getCode());
|
||||||
|
return schisandraUserOssService.insert(schisandraUserOss) > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Boolean update(SchisandraUserOssBO schisandraUserOssBO) {
|
||||||
|
SchisandraUserOss schisandraUserOss = SchisandraUserOssBOConverter.INSTANCE.convertBOToEntity(schisandraUserOssBO);
|
||||||
|
return schisandraUserOssService.update(schisandraUserOss) > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Boolean delete(SchisandraUserOssBO schisandraUserOssBO) {
|
||||||
|
SchisandraUserOss schisandraUserOss = new SchisandraUserOss();
|
||||||
|
schisandraUserOss.setId(schisandraUserOssBO.getId());
|
||||||
|
schisandraUserOss.setIsDeleted(IsDeletedFlagEnum.DELETED.getCode());
|
||||||
|
return schisandraUserOssService.update(schisandraUserOss) > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<SchisandraUserOssBO> queryOSSByUserId(Long userId) {
|
||||||
|
List<SchisandraUserOssBO> SchisandraUserOssBOList= SchisandraUserOssBOConverter
|
||||||
|
.INSTANCE.convertEntityListToBOList(schisandraUserOssService.queryOSSByUserId(userId));
|
||||||
|
return SchisandraUserOssBOList;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1,17 @@
|
|||||||
|
package com.schisandra.oss.infra.basic.dao;
|
||||||
|
|
||||||
|
import com.schisandra.oss.infra.basic.entity.SchisandraFileHeatmap;
|
||||||
|
import com.mybatisflex.core.BaseMapper;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件上传热力图表 表数据库访问层
|
||||||
|
*
|
||||||
|
* @author landaiqing
|
||||||
|
* @since 2024-07-11 10:43:27
|
||||||
|
*/
|
||||||
|
@Repository
|
||||||
|
public interface SchisandraFileHeatmapDao extends BaseMapper<SchisandraFileHeatmap> {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@@ -0,0 +1,17 @@
|
|||||||
|
package com.schisandra.oss.infra.basic.dao;
|
||||||
|
|
||||||
|
import com.schisandra.oss.infra.basic.entity.SchisandraOssSftp;
|
||||||
|
import com.mybatisflex.core.BaseMapper;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* sftp存储配置表 表数据库访问层
|
||||||
|
*
|
||||||
|
* @author landaiqing
|
||||||
|
* @since 2024-07-12 15:44:04
|
||||||
|
*/
|
||||||
|
@Repository
|
||||||
|
public interface SchisandraOssSftpDao extends BaseMapper<SchisandraOssSftp> {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@@ -0,0 +1,17 @@
|
|||||||
|
package com.schisandra.oss.infra.basic.dao;
|
||||||
|
|
||||||
|
import com.schisandra.oss.infra.basic.entity.SchisandraUserOss;
|
||||||
|
import com.mybatisflex.core.BaseMapper;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户对象存储映射表 表数据库访问层
|
||||||
|
*
|
||||||
|
* @author landaiqing
|
||||||
|
* @since 2024-07-10 16:14:33
|
||||||
|
*/
|
||||||
|
@Repository
|
||||||
|
public interface SchisandraUserOssDao extends BaseMapper<SchisandraUserOss> {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@@ -0,0 +1,47 @@
|
|||||||
|
package com.schisandra.oss.infra.basic.entity;
|
||||||
|
|
||||||
|
import com.mybatisflex.annotation.Column;
|
||||||
|
import com.mybatisflex.annotation.Id;
|
||||||
|
import com.mybatisflex.annotation.KeyType;
|
||||||
|
import com.mybatisflex.annotation.Table;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件上传热力图表 实体类
|
||||||
|
*
|
||||||
|
* @author landaiqing
|
||||||
|
* @since 2024-07-11 10:43:27
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Table("schisandra_file_heatmap")
|
||||||
|
public class SchisandraFileHeatmap implements Serializable {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Id(value = "id", keyType = KeyType.Auto)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Column("user_id")
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Column("date")
|
||||||
|
private Date date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Column("count")
|
||||||
|
private Long count;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@@ -1,5 +1,6 @@
|
|||||||
package com.schisandra.oss.infra.basic.entity;
|
package com.schisandra.oss.infra.basic.entity;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import com.mybatisflex.annotation.Column;
|
import com.mybatisflex.annotation.Column;
|
||||||
import com.mybatisflex.annotation.Id;
|
import com.mybatisflex.annotation.Id;
|
||||||
import com.mybatisflex.annotation.KeyType;
|
import com.mybatisflex.annotation.KeyType;
|
||||||
|
@@ -0,0 +1,155 @@
|
|||||||
|
package com.schisandra.oss.infra.basic.entity;
|
||||||
|
|
||||||
|
import com.mybatisflex.annotation.Column;
|
||||||
|
import com.mybatisflex.annotation.Id;
|
||||||
|
import com.mybatisflex.annotation.KeyType;
|
||||||
|
import com.mybatisflex.annotation.Table;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* sftp存储配置表 实体类
|
||||||
|
*
|
||||||
|
* @author landaiqing
|
||||||
|
* @since 2024-07-12 15:44:04
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Table("schisandra_oss_sftp")
|
||||||
|
public class SchisandraOssSftp implements Serializable {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Id(value = "id", keyType = KeyType.Auto)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Column("user_id")
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主机
|
||||||
|
*/
|
||||||
|
@Column("host")
|
||||||
|
private String host;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 端口
|
||||||
|
*/
|
||||||
|
@Column("port")
|
||||||
|
private Integer port;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Column("basePath")
|
||||||
|
private String basePath;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Column("user")
|
||||||
|
private String user;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Column("password")
|
||||||
|
private String password;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 编码
|
||||||
|
*/
|
||||||
|
@Column("charset")
|
||||||
|
private String charset;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 连接超时时长,单位毫秒
|
||||||
|
*/
|
||||||
|
@Column("connection_timeout")
|
||||||
|
private Long connectionTimeout;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Socket连接超时时长,单位毫秒
|
||||||
|
*/
|
||||||
|
@Column("so_timeout")
|
||||||
|
private Date soTimeout;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置服务器语言
|
||||||
|
*/
|
||||||
|
@Column("server_language_code")
|
||||||
|
private String serverLanguageCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置服务器系统关键词
|
||||||
|
*/
|
||||||
|
@Column("system_key")
|
||||||
|
private String systemKey;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分片大小,默认5MB
|
||||||
|
*/
|
||||||
|
@Column("part_size")
|
||||||
|
private Integer partSize;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 并发线程数,默认等于CPU的核数
|
||||||
|
*/
|
||||||
|
@Column("task_num")
|
||||||
|
private Integer taskNum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态
|
||||||
|
*/
|
||||||
|
@Column("status")
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否开启高级设置
|
||||||
|
*/
|
||||||
|
@Column("open_advanced_setup")
|
||||||
|
private String openAdvancedSetup;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建人
|
||||||
|
*/
|
||||||
|
@Column("created_by")
|
||||||
|
private String createdBy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
@Column("created_time")
|
||||||
|
private Date createdTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新时间
|
||||||
|
*/
|
||||||
|
@Column("update_time")
|
||||||
|
private Date updateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新人
|
||||||
|
*/
|
||||||
|
@Column("update_by")
|
||||||
|
private String updateBy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否删除 0 未删除 1已删除
|
||||||
|
*/
|
||||||
|
@Column("is_deleted")
|
||||||
|
private Integer isDeleted;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 额外字段
|
||||||
|
*/
|
||||||
|
@Column("extra_json")
|
||||||
|
private String extraJson;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@@ -63,6 +63,9 @@ public class SchisandraOssTencent implements Serializable {
|
|||||||
/**
|
/**
|
||||||
* 地域
|
* 地域
|
||||||
*/
|
*/
|
||||||
|
@Column("app_id")
|
||||||
|
private String appId;
|
||||||
|
|
||||||
@Column("region")
|
@Column("region")
|
||||||
private String region;
|
private String region;
|
||||||
|
|
||||||
|
@@ -0,0 +1,89 @@
|
|||||||
|
package com.schisandra.oss.infra.basic.entity;
|
||||||
|
|
||||||
|
import com.mybatisflex.annotation.Column;
|
||||||
|
import com.mybatisflex.annotation.Id;
|
||||||
|
import com.mybatisflex.annotation.KeyType;
|
||||||
|
import com.mybatisflex.annotation.Table;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户对象存储映射表 实体类
|
||||||
|
*
|
||||||
|
* @author landaiqing
|
||||||
|
* @since 2024-07-10 16:14:33
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Table("schisandra_user_oss")
|
||||||
|
public class SchisandraUserOss implements Serializable {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Id(value = "id", keyType = KeyType.Auto)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Column("user_id")
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Column("oss_type")
|
||||||
|
private String ossType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Column("icon")
|
||||||
|
private String icon;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Column("name")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Column("bucket_count")
|
||||||
|
private Integer bucketCount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建人
|
||||||
|
*/
|
||||||
|
@Column("created_by")
|
||||||
|
private String createdBy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
@Column("created_time")
|
||||||
|
private Date createdTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新人
|
||||||
|
*/
|
||||||
|
@Column("update_by")
|
||||||
|
private String updateBy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新时间
|
||||||
|
*/
|
||||||
|
@Column("update_time")
|
||||||
|
private Date updateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Column("is_deleted")
|
||||||
|
private Integer isDeleted;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@@ -0,0 +1,46 @@
|
|||||||
|
package com.schisandra.oss.infra.basic.service;
|
||||||
|
|
||||||
|
import com.schisandra.oss.infra.basic.entity.SchisandraFileHeatmap;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件上传热力图表 表服务接口
|
||||||
|
*
|
||||||
|
* @author landaiqing
|
||||||
|
* @since 2024-07-11 10:43:27
|
||||||
|
*/
|
||||||
|
public interface SchisandraFileHeatmapService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过ID查询单条数据
|
||||||
|
*
|
||||||
|
* @param id 主键
|
||||||
|
* @return 实例对象
|
||||||
|
*/
|
||||||
|
SchisandraFileHeatmap queryById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增数据
|
||||||
|
*
|
||||||
|
* @param schisandraFileHeatmap 实例对象
|
||||||
|
* @return 实例对象
|
||||||
|
*/
|
||||||
|
int insert(SchisandraFileHeatmap schisandraFileHeatmap);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改数据
|
||||||
|
*
|
||||||
|
* @param schisandraFileHeatmap 实例对象
|
||||||
|
* @return 实例对象
|
||||||
|
*/
|
||||||
|
int update(SchisandraFileHeatmap schisandraFileHeatmap);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过主键删除数据
|
||||||
|
*
|
||||||
|
* @param id 主键
|
||||||
|
* @return 是否成功
|
||||||
|
*/
|
||||||
|
boolean deleteById(Long id);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@@ -2,6 +2,8 @@ package com.schisandra.oss.infra.basic.service;
|
|||||||
|
|
||||||
import com.schisandra.oss.infra.basic.entity.SchisandraOssAli;
|
import com.schisandra.oss.infra.basic.entity.SchisandraOssAli;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 表服务接口
|
* 表服务接口
|
||||||
@@ -45,4 +47,6 @@ public interface SchisandraOssAliService {
|
|||||||
|
|
||||||
|
|
||||||
SchisandraOssAli getAliOssConfig(Long userId);
|
SchisandraOssAli getAliOssConfig(Long userId);
|
||||||
|
|
||||||
|
List<SchisandraOssAli> selectAll();
|
||||||
}
|
}
|
||||||
|
@@ -50,4 +50,6 @@ public interface SchisandraOssMinioService {
|
|||||||
SchisandraOssMinio getMinioConfig(Long userId);
|
SchisandraOssMinio getMinioConfig(Long userId);
|
||||||
|
|
||||||
List<SchisandraOssMinio> getAllMinioInfo();
|
List<SchisandraOssMinio> getAllMinioInfo();
|
||||||
|
|
||||||
|
List<SchisandraOssMinio> selectAll();
|
||||||
}
|
}
|
||||||
|
@@ -1,6 +1,9 @@
|
|||||||
package com.schisandra.oss.infra.basic.service;
|
package com.schisandra.oss.infra.basic.service;
|
||||||
|
|
||||||
import com.schisandra.oss.infra.basic.entity.SchisandraOssQiniu;
|
import com.schisandra.oss.infra.basic.entity.SchisandraOssQiniu;
|
||||||
|
import com.schisandra.oss.infra.basic.entity.SchisandraOssTencent;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 七牛云对象存储配置表 表服务接口
|
* 七牛云对象存储配置表 表服务接口
|
||||||
@@ -51,4 +54,6 @@ public interface SchisandraOssQiniuService {
|
|||||||
*/
|
*/
|
||||||
SchisandraOssQiniu getQiniuOssConfig(String userId);
|
SchisandraOssQiniu getQiniuOssConfig(String userId);
|
||||||
|
|
||||||
|
|
||||||
|
List<SchisandraOssQiniu> selectAll();
|
||||||
}
|
}
|
||||||
|
@@ -0,0 +1,51 @@
|
|||||||
|
package com.schisandra.oss.infra.basic.service;
|
||||||
|
|
||||||
|
import com.schisandra.oss.infra.basic.entity.SchisandraOssFtp;
|
||||||
|
import com.schisandra.oss.infra.basic.entity.SchisandraOssSftp;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* sftp存储配置表 表服务接口
|
||||||
|
*
|
||||||
|
* @author landaiqing
|
||||||
|
* @since 2024-07-12 15:44:04
|
||||||
|
*/
|
||||||
|
public interface SchisandraOssSftpService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过ID查询单条数据
|
||||||
|
*
|
||||||
|
* @param id 主键
|
||||||
|
* @return 实例对象
|
||||||
|
*/
|
||||||
|
SchisandraOssSftp queryById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增数据
|
||||||
|
*
|
||||||
|
* @param schisandraOssSftp 实例对象
|
||||||
|
* @return 实例对象
|
||||||
|
*/
|
||||||
|
int insert(SchisandraOssSftp schisandraOssSftp);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改数据
|
||||||
|
*
|
||||||
|
* @param schisandraOssSftp 实例对象
|
||||||
|
* @return 实例对象
|
||||||
|
*/
|
||||||
|
int update(SchisandraOssSftp schisandraOssSftp);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过主键删除数据
|
||||||
|
*
|
||||||
|
* @param id 主键
|
||||||
|
* @return 是否成功
|
||||||
|
*/
|
||||||
|
boolean deleteById(Long id);
|
||||||
|
|
||||||
|
SchisandraOssSftp getSftpOssConfig(String userId);
|
||||||
|
|
||||||
|
List<SchisandraOssSftp> selectAll();
|
||||||
|
}
|
@@ -2,6 +2,8 @@ package com.schisandra.oss.infra.basic.service;
|
|||||||
|
|
||||||
import com.schisandra.oss.infra.basic.entity.SchisandraOssTencent;
|
import com.schisandra.oss.infra.basic.entity.SchisandraOssTencent;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 腾讯云对象存储配置表 表服务接口
|
* 腾讯云对象存储配置表 表服务接口
|
||||||
*
|
*
|
||||||
@@ -51,4 +53,5 @@ public interface SchisandraOssTencentService {
|
|||||||
*/
|
*/
|
||||||
SchisandraOssTencent getTencentOssConfig(String userId);
|
SchisandraOssTencent getTencentOssConfig(String userId);
|
||||||
|
|
||||||
|
List<SchisandraOssTencent> selectAll();
|
||||||
}
|
}
|
||||||
|
@@ -2,6 +2,8 @@ package com.schisandra.oss.infra.basic.service;
|
|||||||
|
|
||||||
import com.schisandra.oss.infra.basic.entity.SchisandraOssUp;
|
import com.schisandra.oss.infra.basic.entity.SchisandraOssUp;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 又拍云对象存储配置表 表服务接口
|
* 又拍云对象存储配置表 表服务接口
|
||||||
*
|
*
|
||||||
@@ -43,4 +45,6 @@ public interface SchisandraOssUpService {
|
|||||||
boolean deleteById(Long id);
|
boolean deleteById(Long id);
|
||||||
|
|
||||||
SchisandraOssUp getUpOssConfig(String userId);
|
SchisandraOssUp getUpOssConfig(String userId);
|
||||||
|
|
||||||
|
List<SchisandraOssUp> selectAll();
|
||||||
}
|
}
|
||||||
|
@@ -0,0 +1,50 @@
|
|||||||
|
package com.schisandra.oss.infra.basic.service;
|
||||||
|
|
||||||
|
import com.schisandra.oss.infra.basic.entity.SchisandraUserOss;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户对象存储映射表 表服务接口
|
||||||
|
*
|
||||||
|
* @author landaiqing
|
||||||
|
* @since 2024-07-10 16:14:33
|
||||||
|
*/
|
||||||
|
public interface SchisandraUserOssService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过ID查询单条数据
|
||||||
|
*
|
||||||
|
* @param id 主键
|
||||||
|
* @return 实例对象
|
||||||
|
*/
|
||||||
|
SchisandraUserOss queryById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增数据
|
||||||
|
*
|
||||||
|
* @param schisandraUserOss 实例对象
|
||||||
|
* @return 实例对象
|
||||||
|
*/
|
||||||
|
int insert(SchisandraUserOss schisandraUserOss);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改数据
|
||||||
|
*
|
||||||
|
* @param schisandraUserOss 实例对象
|
||||||
|
* @return 实例对象
|
||||||
|
*/
|
||||||
|
int update(SchisandraUserOss schisandraUserOss);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过主键删除数据
|
||||||
|
*
|
||||||
|
* @param id 主键
|
||||||
|
* @return 是否成功
|
||||||
|
*/
|
||||||
|
boolean deleteById(Long id);
|
||||||
|
|
||||||
|
List<SchisandraUserOss> queryOSSByUserId(Long userId);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1,67 @@
|
|||||||
|
package com.schisandra.oss.infra.basic.service.impl;
|
||||||
|
|
||||||
|
import com.schisandra.oss.infra.basic.entity.SchisandraFileHeatmap;
|
||||||
|
import com.schisandra.oss.infra.basic.dao.SchisandraFileHeatmapDao;
|
||||||
|
import com.schisandra.oss.infra.basic.service.SchisandraFileHeatmapService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件上传热力图表 表服务实现类
|
||||||
|
*
|
||||||
|
* @author landaiqing
|
||||||
|
* @since 2024-07-11 10:43:27
|
||||||
|
*/
|
||||||
|
@Service("SchisandraFileHeatmapService")
|
||||||
|
public class SchisandraFileHeatmapServiceImpl implements SchisandraFileHeatmapService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private SchisandraFileHeatmapDao schisandraFileHeatmapDao;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过ID查询单条数据
|
||||||
|
*
|
||||||
|
* @param id 主键
|
||||||
|
* @return 实例对象
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public SchisandraFileHeatmap queryById(Long id) {
|
||||||
|
return this.schisandraFileHeatmapDao.selectOneById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增数据
|
||||||
|
*
|
||||||
|
* @param schisandraFileHeatmap 实例对象
|
||||||
|
* @return 实例对象
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int insert(SchisandraFileHeatmap schisandraFileHeatmap) {
|
||||||
|
return this.schisandraFileHeatmapDao.insertSelective(schisandraFileHeatmap);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改数据
|
||||||
|
*
|
||||||
|
* @param schisandraFileHeatmap 实例对象
|
||||||
|
* @return 实例对象
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int update(SchisandraFileHeatmap schisandraFileHeatmap) {
|
||||||
|
return this.schisandraFileHeatmapDao.update(schisandraFileHeatmap,true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过主键删除数据
|
||||||
|
*
|
||||||
|
* @param id 主键
|
||||||
|
* @return 是否成功
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean deleteById(Long id) {
|
||||||
|
return this.schisandraFileHeatmapDao.deleteById(id) > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@@ -7,6 +7,7 @@ import com.schisandra.oss.infra.basic.service.SchisandraOssAliService;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 表服务实现类
|
* 表服务实现类
|
||||||
@@ -20,6 +21,14 @@ public class SchisandraOssAliServiceImpl implements SchisandraOssAliService {
|
|||||||
@Resource
|
@Resource
|
||||||
private SchisandraOssAliDao schisandraOssAliDao;
|
private SchisandraOssAliDao schisandraOssAliDao;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取数据库所有数据
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<SchisandraOssAli> selectAll(){return schisandraOssAliDao.selectAll();}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过ID查询单条数据
|
* 通过ID查询单条数据
|
||||||
*
|
*
|
||||||
|
@@ -9,6 +9,8 @@ import org.springframework.context.annotation.EnableAspectJAutoProxy;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -82,4 +84,7 @@ public class SchisandraOssMinioServiceImpl implements SchisandraOssMinioService
|
|||||||
return schisandraOssMinioDao.selectAll();
|
return schisandraOssMinioDao.selectAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<SchisandraOssMinio> selectAll(){return schisandraOssMinioDao.selectAll();}
|
||||||
}
|
}
|
||||||
|
@@ -7,6 +7,7 @@ import com.schisandra.oss.infra.basic.service.SchisandraOssQiniuService;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 七牛云对象存储配置表 表服务实现类
|
* 七牛云对象存储配置表 表服务实现类
|
||||||
@@ -67,8 +68,8 @@ public class SchisandraOssQiniuServiceImpl implements SchisandraOssQiniuService
|
|||||||
@Override
|
@Override
|
||||||
public SchisandraOssQiniu getQiniuOssConfig(String userId) {
|
public SchisandraOssQiniu getQiniuOssConfig(String userId) {
|
||||||
return schisandraOssQiniuDao.selectOneByCondition(SchisandraOssQiniuTableDef.SCHISANDRA_OSS_QINIU.USER_ID.eq(userId));
|
return schisandraOssQiniuDao.selectOneByCondition(SchisandraOssQiniuTableDef.SCHISANDRA_OSS_QINIU.USER_ID.eq(userId));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<SchisandraOssQiniu> selectAll() {return this.schisandraOssQiniuDao.selectAll();}
|
||||||
}
|
}
|
||||||
|
@@ -0,0 +1,77 @@
|
|||||||
|
package com.schisandra.oss.infra.basic.service.impl;
|
||||||
|
|
||||||
|
import com.schisandra.oss.infra.basic.entity.SchisandraOssFtp;
|
||||||
|
import com.schisandra.oss.infra.basic.entity.SchisandraOssSftp;
|
||||||
|
import com.schisandra.oss.infra.basic.dao.SchisandraOssSftpDao;
|
||||||
|
import com.schisandra.oss.infra.basic.entity.table.SchisandraOssFtpTableDef;
|
||||||
|
import com.schisandra.oss.infra.basic.entity.table.SchisandraOssSftpTableDef;
|
||||||
|
import com.schisandra.oss.infra.basic.service.SchisandraOssSftpService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* sftp存储配置表 表服务实现类
|
||||||
|
*
|
||||||
|
* @author landaiqing
|
||||||
|
* @since 2024-07-12 15:44:04
|
||||||
|
*/
|
||||||
|
@Service("SchisandraOssSftpService")
|
||||||
|
public class SchisandraOssSftpServiceImpl implements SchisandraOssSftpService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private SchisandraOssSftpDao schisandraOssSftpDao;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过ID查询单条数据
|
||||||
|
*
|
||||||
|
* @param id 主键
|
||||||
|
* @return 实例对象
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public SchisandraOssSftp queryById(Long id) {
|
||||||
|
return this.schisandraOssSftpDao.selectOneById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增数据
|
||||||
|
*
|
||||||
|
* @param schisandraOssSftp 实例对象
|
||||||
|
* @return 实例对象
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int insert(SchisandraOssSftp schisandraOssSftp) {
|
||||||
|
return this.schisandraOssSftpDao.insertSelective(schisandraOssSftp);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改数据
|
||||||
|
*
|
||||||
|
* @param schisandraOssSftp 实例对象
|
||||||
|
* @return 实例对象
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int update(SchisandraOssSftp schisandraOssSftp) {
|
||||||
|
return this.schisandraOssSftpDao.update(schisandraOssSftp,true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过主键删除数据
|
||||||
|
*
|
||||||
|
* @param id 主键
|
||||||
|
* @return 是否成功
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean deleteById(Long id) {
|
||||||
|
return this.schisandraOssSftpDao.deleteById(id) > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SchisandraOssSftp getSftpOssConfig(String userId) {
|
||||||
|
return schisandraOssSftpDao.selectOneByCondition(SchisandraOssSftpTableDef.SCHISANDRA_OSS_SFTP.USER_ID.eq(userId));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<SchisandraOssSftp> selectAll() {return schisandraOssSftpDao.selectAll();}
|
||||||
|
}
|
@@ -8,6 +8,7 @@ import com.schisandra.oss.infra.basic.service.SchisandraOssTencentService;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 腾讯云对象存储配置表 表服务实现类
|
* 腾讯云对象存储配置表 表服务实现类
|
||||||
@@ -70,5 +71,6 @@ public class SchisandraOssTencentServiceImpl implements SchisandraOssTencentServ
|
|||||||
return schisandraOssTencentDao.selectOneByCondition(SchisandraOssTencentTableDef.SCHISANDRA_OSS_TENCENT.USER_ID.eq(userId));
|
return schisandraOssTencentDao.selectOneByCondition(SchisandraOssTencentTableDef.SCHISANDRA_OSS_TENCENT.USER_ID.eq(userId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<SchisandraOssTencent> selectAll(){return this.schisandraOssTencentDao.selectAll();}
|
||||||
}
|
}
|
||||||
|
@@ -7,6 +7,8 @@ import com.schisandra.oss.infra.basic.service.SchisandraOssUpService;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 又拍云对象存储配置表 表服务实现类
|
* 又拍云对象存储配置表 表服务实现类
|
||||||
@@ -72,4 +74,8 @@ public class SchisandraOssUpServiceImpl implements SchisandraOssUpService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<SchisandraOssUp> selectAll() {return schisandraOssUpDao.selectAll();}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -0,0 +1,75 @@
|
|||||||
|
package com.schisandra.oss.infra.basic.service.impl;
|
||||||
|
|
||||||
|
import com.mybatisflex.core.query.QueryWrapper;
|
||||||
|
import com.schisandra.oss.infra.basic.entity.SchisandraUserOss;
|
||||||
|
import com.schisandra.oss.infra.basic.dao.SchisandraUserOssDao;
|
||||||
|
import com.schisandra.oss.infra.basic.entity.table.SchisandraUserOssTableDef;
|
||||||
|
import com.schisandra.oss.infra.basic.service.SchisandraUserOssService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户对象存储映射表 表服务实现类
|
||||||
|
*
|
||||||
|
* @author landaiqing
|
||||||
|
* @since 2024-07-10 16:14:33
|
||||||
|
*/
|
||||||
|
@Service("SchisandraUserOssService")
|
||||||
|
public class SchisandraUserOssServiceImpl implements SchisandraUserOssService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private SchisandraUserOssDao schisandraUserOssDao;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过ID查询单条数据
|
||||||
|
*
|
||||||
|
* @param id 主键
|
||||||
|
* @return 实例对象
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public SchisandraUserOss queryById(Long id) {
|
||||||
|
return this.schisandraUserOssDao.selectOneById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增数据
|
||||||
|
*
|
||||||
|
* @param schisandraUserOss 实例对象
|
||||||
|
* @return 实例对象
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int insert(SchisandraUserOss schisandraUserOss) {
|
||||||
|
return this.schisandraUserOssDao.insertSelective(schisandraUserOss);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改数据
|
||||||
|
*
|
||||||
|
* @param schisandraUserOss 实例对象
|
||||||
|
* @return 实例对象
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int update(SchisandraUserOss schisandraUserOss) {
|
||||||
|
return this.schisandraUserOssDao.update(schisandraUserOss,true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过主键删除数据
|
||||||
|
*
|
||||||
|
* @param id 主键
|
||||||
|
* @return 是否成功
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean deleteById(Long id) {
|
||||||
|
return this.schisandraUserOssDao.deleteById(id) > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<SchisandraUserOss> queryOSSByUserId(Long userId) {
|
||||||
|
return this.schisandraUserOssDao.selectListByCondition(SchisandraUserOssTableDef.SCHISANDRA_USER_OSS.USER_ID.eq(userId));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1,12 @@
|
|||||||
|
<?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.SchisandraFileHeatmapDao">
|
||||||
|
|
||||||
|
<resultMap id="BaseResultMap" type="com.schisandra.oss.infra.basic.entity.SchisandraFileHeatmap">
|
||||||
|
<id column="id" jdbcType="BIGINT" property="id"/>
|
||||||
|
<result column="user_id" jdbcType="BIGINT" property="userId"/>
|
||||||
|
<result column="date" jdbcType="DATE" property="date"/>
|
||||||
|
<result column="count" jdbcType="BIGINT" property="count"/>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
</mapper>
|
@@ -34,6 +34,7 @@
|
|||||||
<result column="extra_json" jdbcType="VARCHAR" property="extraJson"/>
|
<result column="extra_json" jdbcType="VARCHAR" property="extraJson"/>
|
||||||
<result column="create_bucket" jdbcType="VARCHAR" property="createBucket"/>
|
<result column="create_bucket" jdbcType="VARCHAR" property="createBucket"/>
|
||||||
<result column="check_bucket" jdbcType="VARCHAR" property="checkBucket"/>
|
<result column="check_bucket" jdbcType="VARCHAR" property="checkBucket"/>
|
||||||
|
<result column="endpoint" jdbcType="VARCHAR" property="endpoint"/>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
@@ -0,0 +1,30 @@
|
|||||||
|
<?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.SchisandraOssSftpDao">
|
||||||
|
|
||||||
|
<resultMap id="BaseResultMap" type="com.schisandra.oss.infra.basic.entity.SchisandraOssSftp">
|
||||||
|
<id column="id" jdbcType="BIGINT" property="id"/>
|
||||||
|
<result column="user_id" jdbcType="BIGINT" property="userId"/>
|
||||||
|
<result column="host" jdbcType="VARCHAR" property="host"/>
|
||||||
|
<result column="port" jdbcType="INTEGER" property="port"/>
|
||||||
|
<result column="basePath" jdbcType="VARCHAR" property="basePath"/>
|
||||||
|
<result column="user" jdbcType="VARCHAR" property="user"/>
|
||||||
|
<result column="password" jdbcType="VARCHAR" property="password"/>
|
||||||
|
<result column="charset" jdbcType="VARCHAR" property="charset"/>
|
||||||
|
<result column="connection_timeout" jdbcType="BIGINT" property="connectionTimeout"/>
|
||||||
|
<result column="so_timeout" jdbcType="TIMESTAMP" property="soTimeout"/>
|
||||||
|
<result column="server_language_code" jdbcType="VARCHAR" property="serverLanguageCode"/>
|
||||||
|
<result column="system_key" jdbcType="VARCHAR" property="systemKey"/>
|
||||||
|
<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"/>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
</mapper>
|
@@ -0,0 +1,19 @@
|
|||||||
|
<?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.SchisandraUserOssDao">
|
||||||
|
|
||||||
|
<resultMap id="BaseResultMap" type="com.schisandra.oss.infra.basic.entity.SchisandraUserOss">
|
||||||
|
<id column="id" jdbcType="BIGINT" property="id"/>
|
||||||
|
<result column="user_id" jdbcType="BIGINT" property="userId"/>
|
||||||
|
<result column="oss_type" jdbcType="VARCHAR" property="ossType"/>
|
||||||
|
<result column="icon" jdbcType="VARCHAR" property="icon"/>
|
||||||
|
<result column="name" jdbcType="VARCHAR" property="name"/>
|
||||||
|
<result column="bucket_count" jdbcType="INTEGER" property="bucketCount"/>
|
||||||
|
<result column="created_by" jdbcType="VARCHAR" property="createdBy"/>
|
||||||
|
<result column="created_time" jdbcType="TIMESTAMP" property="createdTime"/>
|
||||||
|
<result column="update_by" jdbcType="VARCHAR" property="updateBy"/>
|
||||||
|
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
|
||||||
|
<result column="is_deleted" jdbcType="INTEGER" property="isDeleted"/>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
</mapper>
|
Reference in New Issue
Block a user