styles: 代码格式化
This commit is contained in:
@@ -120,7 +120,13 @@ public class SchisandraAuthPermissionController {
|
||||
return Result.fail("删除权限信息失败");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 查询用户菜单权限
|
||||
* @param: [userId]
|
||||
* @return: com.schisandra.auth.common.entity.Result<java.lang.Object>
|
||||
* @author: landaiqing
|
||||
* @date: 2024/7/8 下午4:09
|
||||
*/
|
||||
@GetMapping("selectUserPermission")
|
||||
public Result<Object> selectUserPermission(@RequestParam("userId") Long userId) {
|
||||
if (userId == null) {
|
||||
|
@@ -32,7 +32,7 @@ public class SchisandraAuthPermissionDTO implements Serializable {
|
||||
/**
|
||||
* 权限路径
|
||||
*/
|
||||
private String menuUrl;
|
||||
private String path;
|
||||
/**
|
||||
* 权限状态
|
||||
*/
|
||||
@@ -49,25 +49,6 @@ public class SchisandraAuthPermissionDTO implements Serializable {
|
||||
* 权限标识
|
||||
*/
|
||||
private String permissionKey;
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
private String createdBy;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createdTime;
|
||||
/**
|
||||
* 更新人
|
||||
*/
|
||||
private String updateBy;
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private Date updateTime;
|
||||
/**
|
||||
* 是否删除
|
||||
*/
|
||||
private Integer isDeleted;
|
||||
|
||||
|
||||
|
@@ -26,7 +26,7 @@ SchisandraAuthPermissionBO implements Serializable {
|
||||
|
||||
private Integer type;
|
||||
|
||||
private String menuUrl;
|
||||
private String path;
|
||||
|
||||
private Integer status;
|
||||
|
||||
|
@@ -52,11 +52,11 @@ public class SchisandraAuthPermissionDomainServiceImpl implements SchisandraAuth
|
||||
public Result<Object> selectUserPermissionTree(Long userId) {
|
||||
SchisandraAuthUserRole schisandraAuthRole = schisandraAuthUserRoleService.queryById(userId);
|
||||
if (schisandraAuthRole == null||schisandraAuthRole.getRoleId()==null) {
|
||||
return Result.ok("用户没有角色");
|
||||
return Result.fail("用户没有角色");
|
||||
}
|
||||
List<SchisandraAuthRolePermission> schisandraAuthRolePermissions = schisandraAuthRolePermissionService.queryByRoleId(schisandraAuthRole.getRoleId());
|
||||
if (schisandraAuthRolePermissions.size()==0){
|
||||
return Result.ok("当前角色用户没有权限");
|
||||
return Result.fail("当前角色用户没有权限");
|
||||
}
|
||||
List<SchisandraAuthPermissionBO> schisandraAuthPermissions =new ArrayList<>();
|
||||
List<SchisandraAuthPermissionBO> schisandraAuthPermissionParents = new ArrayList<>();
|
||||
|
@@ -29,7 +29,7 @@ public class SchisandraAuthPermission implements Serializable {
|
||||
|
||||
private Integer type;
|
||||
|
||||
private String menuUrl;
|
||||
private String path;
|
||||
|
||||
private Integer status;
|
||||
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<result property="name" column="name" jdbcType="VARCHAR"/>
|
||||
<result property="parentId" column="parent_id" jdbcType="INTEGER"/>
|
||||
<result property="type" column="type" jdbcType="INTEGER"/>
|
||||
<result property="menuUrl" column="menu_url" jdbcType="VARCHAR"/>
|
||||
<result property="path" column="path" jdbcType="VARCHAR"/>
|
||||
<result property="status" column="status" jdbcType="INTEGER"/>
|
||||
<result property="show" column="show" jdbcType="INTEGER"/>
|
||||
<result property="icon" column="icon" jdbcType="VARCHAR"/>
|
||||
|
@@ -2,21 +2,16 @@ 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.SchisandraOssAliDTOConverter;
|
||||
import com.schisandra.oss.application.dto.SchisandraOssAliDTO;
|
||||
import com.schisandra.oss.application.oss.core.ali.AliOssClient;
|
||||
import com.schisandra.oss.application.oss.core.ali.AliOssConfiguration;
|
||||
|
||||
import com.schisandra.oss.application.oss.model.OssInfo;
|
||||
import com.schisandra.oss.common.entity.Result;
|
||||
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.infra.basic.dao.SchisandraOssAliDao;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
@@ -33,7 +28,7 @@ import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* controller
|
||||
* controller
|
||||
*
|
||||
* @author landaiqing
|
||||
* @since 2024-05-14 20:45:32
|
||||
@@ -54,6 +49,7 @@ public class SchisandraOssAliController {
|
||||
|
||||
/**
|
||||
* 返回ali表所有数据
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("returnAll")
|
||||
@@ -62,9 +58,8 @@ public class SchisandraOssAliController {
|
||||
}
|
||||
|
||||
|
||||
|
||||
@GetMapping("init")
|
||||
public void init(@RequestParam String userId){
|
||||
public void init(@RequestParam String userId) {
|
||||
if (log.isInfoEnabled()) {
|
||||
log.info("SchisandraOssAliController.init.userId:{}", userId);
|
||||
}
|
||||
@@ -98,7 +93,6 @@ public class SchisandraOssAliController {
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*/
|
||||
@@ -146,19 +140,19 @@ public class SchisandraOssAliController {
|
||||
* @date: 2024/7/5 13:55
|
||||
*/
|
||||
@GetMapping("listDir")
|
||||
public Result<String> listAliDir(@RequestParam String userId,@RequestParam String bucket,@RequestParam String prefix) throws Exception {
|
||||
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));
|
||||
if (prefix == null)
|
||||
prefix = "";
|
||||
return Result.ok(bean.listAliInfo(bucket, prefix));
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 查找bucket
|
||||
*
|
||||
* @param userId
|
||||
*/
|
||||
@PostMapping("seleteBucket")
|
||||
@@ -186,6 +180,7 @@ public class SchisandraOssAliController {
|
||||
|
||||
/**
|
||||
* 删除bucket
|
||||
*
|
||||
* @param userId
|
||||
* @param bucket
|
||||
* @return
|
||||
@@ -213,15 +208,15 @@ public class SchisandraOssAliController {
|
||||
Preconditions.checkNotNull(bucket, "不能为空");
|
||||
|
||||
//设置热力图
|
||||
Date date =new Date();
|
||||
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 {
|
||||
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));
|
||||
}
|
||||
// 获取文件输入流
|
||||
@@ -232,7 +227,6 @@ public class SchisandraOssAliController {
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @description: 下载文件
|
||||
* @param: [schisandraOssMinioDTO]
|
||||
@@ -250,8 +244,9 @@ public class SchisandraOssAliController {
|
||||
response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(filePath.substring(filePath.lastIndexOf("/") + 1), "UTF-8"));
|
||||
response.setContentType("application/octet-stream");
|
||||
response.setCharacterEncoding("UTF-8");
|
||||
bean.downLoad(output,filePath);
|
||||
bean.downLoad(output, filePath);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 删除文件
|
||||
* @param: [schisandraOssAliDTO]
|
||||
@@ -287,7 +282,7 @@ public class SchisandraOssAliController {
|
||||
bean.getAliOssConfig().setBucketName(bucket);
|
||||
try {
|
||||
bean.rename(oldFileName, newFileName);
|
||||
}catch (Exception e){
|
||||
} catch (Exception e) {
|
||||
return Result.fail(e.getMessage());
|
||||
}
|
||||
return Result.ok();
|
||||
|
@@ -3,21 +3,16 @@ package com.schisandra.oss.application.controller;
|
||||
import cn.hutool.core.util.ZipUtil;
|
||||
import cn.hutool.extra.spring.SpringUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.amazonaws.util.IOUtils;
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.gson.Gson;
|
||||
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.oss.core.minio.MinioOssClient;
|
||||
import com.schisandra.oss.application.oss.core.minio.MinioOssConfiguration;
|
||||
import com.schisandra.oss.application.oss.model.OssInfo;
|
||||
import com.schisandra.oss.common.entity.Result;
|
||||
import com.schisandra.oss.domain.bo.SchisandraOssMinioBO;
|
||||
import com.schisandra.oss.domain.redis.RedisUtil;
|
||||
import com.schisandra.oss.domain.service.SchisandraOssMinioDomainService;
|
||||
import io.minio.errors.*;
|
||||
import lombok.Data;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
@@ -31,8 +26,7 @@ import java.net.URLEncoder;
|
||||
import java.security.InvalidKeyException;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
@@ -60,6 +54,7 @@ public class SchisandraOssMinioController {
|
||||
|
||||
/**
|
||||
* 返回minio表所有数据
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("returnAll")
|
||||
@@ -89,6 +84,7 @@ public class SchisandraOssMinioController {
|
||||
log.error("用户: {}-> minio 初始化完成!", userId);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 获取文件目录信息
|
||||
* @param: [target, userId, dirName]
|
||||
@@ -97,7 +93,7 @@ public class SchisandraOssMinioController {
|
||||
* @date: 2024/6/26 13:55
|
||||
*/
|
||||
@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(userId, "不能为空");
|
||||
MinioOssClient bean = SpringUtil.getBean(userId);
|
||||
bean.getMinioOssConfig().setBucketName(bucket);
|
||||
@@ -112,21 +108,21 @@ public class SchisandraOssMinioController {
|
||||
* @date: 2024/6/26 13:56
|
||||
*/
|
||||
@GetMapping("downloadMinioFile")
|
||||
public void getMinioFile(@RequestParam String bucket, @RequestParam String userId, @RequestParam List<String> listObjectsArgs , HttpServletResponse response) throws Exception {
|
||||
public void getMinioFile(@RequestParam String bucket, @RequestParam String userId, @RequestParam List<String> listObjectsArgs, HttpServletResponse response) throws Exception {
|
||||
Preconditions.checkNotNull(bucket, "不能为空");
|
||||
Preconditions.checkNotNull(userId, "不能为空");
|
||||
Preconditions.checkNotNull(listObjectsArgs, "不能为空");
|
||||
MinioOssClient bean = SpringUtil.getBean(userId);
|
||||
bean.getMinioOssConfig().setBucketName(bucket);
|
||||
HashMap<String, InputStream> list=bean.getTargetDir(listObjectsArgs);
|
||||
HashMap<String, InputStream> list = bean.getTargetDir(listObjectsArgs);
|
||||
ServletOutputStream output = response.getOutputStream();
|
||||
response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode("下载.zip", "UTF-8"));
|
||||
response.setContentType("application/octet-stream");
|
||||
response.setCharacterEncoding("UTF-8");
|
||||
String[] path = new String[list.size()];
|
||||
InputStream[] inputStreams= new InputStream[list.size()];
|
||||
path=list.keySet().toArray(path);
|
||||
inputStreams=list.values().toArray(inputStreams);
|
||||
InputStream[] inputStreams = new InputStream[list.size()];
|
||||
path = list.keySet().toArray(path);
|
||||
inputStreams = list.values().toArray(inputStreams);
|
||||
ZipUtil.zip(output, path, inputStreams);
|
||||
}
|
||||
|
||||
@@ -161,15 +157,15 @@ public class SchisandraOssMinioController {
|
||||
Preconditions.checkNotNull(fileName, "不能为空");
|
||||
Preconditions.checkNotNull(bucket, "不能为空");
|
||||
//设置热力图
|
||||
Date date =new Date();
|
||||
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 {
|
||||
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));
|
||||
}
|
||||
|
||||
@@ -200,11 +196,12 @@ public class SchisandraOssMinioController {
|
||||
bean.getMinioOssConfig().setBucketName(bucket);
|
||||
try {
|
||||
bean.rename(oldFileName, newFileName);
|
||||
}catch (Exception e){
|
||||
} catch (Exception e) {
|
||||
return Result.fail(e.getMessage());
|
||||
}
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 拷贝文件
|
||||
* @param: [userId, bucket, oldFilePath, newFilePath]
|
||||
@@ -223,11 +220,12 @@ public class SchisandraOssMinioController {
|
||||
bean.getMinioOssConfig().setBucketName(bucket);
|
||||
try {
|
||||
bean.copy(oldFilePath, newFilePath);
|
||||
}catch (Exception e){
|
||||
} catch (Exception e) {
|
||||
return Result.fail(e.getMessage());
|
||||
}
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 预览文件
|
||||
* @param: [userId, bucket, filePath]
|
||||
@@ -249,6 +247,7 @@ public class SchisandraOssMinioController {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 分享文件
|
||||
* @param: [userId, bucket, filePath]
|
||||
@@ -264,7 +263,7 @@ public class SchisandraOssMinioController {
|
||||
MinioOssClient bean = SpringUtil.getBean(userId);
|
||||
bean.getMinioOssConfig().setBucketName(bucket);
|
||||
try {
|
||||
return Result.ok(bean.shareMinioFile(filePath,time));
|
||||
return Result.ok(bean.shareMinioFile(filePath, time));
|
||||
} catch (Exception e) {
|
||||
return Result.fail(e.getMessage());
|
||||
}
|
||||
@@ -283,6 +282,7 @@ public class SchisandraOssMinioController {
|
||||
MinioOssClient bean = SpringUtil.getBean(userId);
|
||||
return Result.ok(bean.selectAllBucket());
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 创建bucket
|
||||
* @param: [userId, bucket]
|
||||
@@ -389,7 +389,7 @@ public class SchisandraOssMinioController {
|
||||
log.error("容器获取失败!");
|
||||
return null;
|
||||
}
|
||||
return Result.ok(bean.getInfo(fileName,true));
|
||||
return Result.ok(bean.getInfo(fileName, true));
|
||||
}
|
||||
|
||||
@GetMapping("getAllMinioInfo")
|
||||
@@ -400,11 +400,6 @@ public class SchisandraOssMinioController {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private void parameterCheck(SchisandraOssMinioDTO schisandraOssMinioDTO) {
|
||||
Preconditions.checkNotNull(schisandraOssMinioDTO.getId(), "不能为空");
|
||||
Preconditions.checkNotNull(schisandraOssMinioDTO.getUserId(), "不能为空");
|
||||
|
@@ -5,7 +5,6 @@ import com.alibaba.fastjson.JSON;
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.schisandra.oss.application.convert.SchisandraOssQiniuDTOConverter;
|
||||
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;
|
||||
@@ -16,6 +15,7 @@ import com.schisandra.oss.domain.service.SchisandraOssQiniuDomainService;
|
||||
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;
|
||||
@@ -48,6 +48,7 @@ public class SchisandraOssQiniuController {
|
||||
|
||||
/**
|
||||
* 返回七牛表所有数据
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("returnAll")
|
||||
@@ -86,7 +87,7 @@ public class SchisandraOssQiniuController {
|
||||
bean.getQiNiuOssConfig().setBucketName(bucket);
|
||||
try {
|
||||
bean.rename(oldFileName, newFileName);
|
||||
}catch (Exception e){
|
||||
} catch (Exception e) {
|
||||
return Result.fail(e.getMessage());
|
||||
}
|
||||
return Result.ok();
|
||||
@@ -110,7 +111,7 @@ public class SchisandraOssQiniuController {
|
||||
bean.getQiNiuOssConfig().setBucketName(bucket);
|
||||
try {
|
||||
bean.copy(oldFilePath, newFilePath);
|
||||
}catch (Exception e){
|
||||
} catch (Exception e) {
|
||||
return Result.fail(e.getMessage());
|
||||
}
|
||||
return Result.ok();
|
||||
@@ -125,7 +126,7 @@ public class SchisandraOssQiniuController {
|
||||
* @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 {
|
||||
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();
|
||||
@@ -134,7 +135,7 @@ public class SchisandraOssQiniuController {
|
||||
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);
|
||||
bean.downLoad_open(output, filename, endpoint);
|
||||
}
|
||||
|
||||
|
||||
@@ -169,15 +170,15 @@ public class SchisandraOssQiniuController {
|
||||
Preconditions.checkNotNull(bucket, "不能为空");
|
||||
|
||||
//设置热力图
|
||||
Date date =new Date();
|
||||
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 {
|
||||
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));
|
||||
}
|
||||
|
||||
@@ -219,19 +220,20 @@ public class SchisandraOssQiniuController {
|
||||
|
||||
/**
|
||||
* 创建桶createbucket
|
||||
*
|
||||
* @param userId
|
||||
* @param bucket
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("createBucket")
|
||||
public Result<String> createBucket(@RequestParam String userId, @RequestParam String bucket,@RequestParam String region) {
|
||||
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));
|
||||
return Result.ok(bean.createBucket(bucket, region));
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
@@ -259,7 +261,6 @@ public class SchisandraOssQiniuController {
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 新增七牛云对象存储配置表
|
||||
*/
|
||||
|
@@ -5,10 +5,6 @@ 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;
|
||||
@@ -55,6 +51,7 @@ public class SchisandraOssSftpController {
|
||||
|
||||
/**
|
||||
* 返回up表所有数据
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("returnAll")
|
||||
@@ -77,7 +74,7 @@ public class SchisandraOssSftpController {
|
||||
QiNiuOssClient bean = SpringUtil.getBean(userId);
|
||||
try {
|
||||
bean.copy(oldFilePath, newFilePath);
|
||||
}catch (Exception e){
|
||||
} catch (Exception e) {
|
||||
return Result.fail(e.getMessage());
|
||||
}
|
||||
return Result.ok();
|
||||
@@ -87,7 +84,7 @@ public class SchisandraOssSftpController {
|
||||
* 重命名
|
||||
*/
|
||||
@PostMapping("renameFile")
|
||||
public Result renameSftpFile(@RequestParam String userId, @RequestParam String oldFileName, @RequestParam String newFileName) throws IOException {
|
||||
public Result renameSftpFile(@RequestParam String userId, @RequestParam String oldFileName, @RequestParam String newFileName) throws IOException {
|
||||
|
||||
Preconditions.checkNotNull(userId, "不能为空");
|
||||
Preconditions.checkNotNull(oldFileName, "不能为空");
|
||||
@@ -95,7 +92,7 @@ public class SchisandraOssSftpController {
|
||||
SftpOssClient bean = SpringUtil.getBean(userId);
|
||||
try {
|
||||
bean.rename(oldFileName, newFileName);
|
||||
}catch (Exception e){
|
||||
} catch (Exception e) {
|
||||
return Result.fail(e.getMessage());
|
||||
}
|
||||
return Result.ok();
|
||||
@@ -131,7 +128,7 @@ public class SchisandraOssSftpController {
|
||||
*/
|
||||
|
||||
@GetMapping("downloadFile")
|
||||
public void downloadSftpFile(@RequestParam String userId, @RequestParam String filename, HttpServletResponse response) throws IOException {
|
||||
public void downloadSftpFile(@RequestParam String userId, @RequestParam String filename, HttpServletResponse response) throws IOException {
|
||||
SftpOssClient bean = SpringUtil.getBean(userId);
|
||||
ServletOutputStream output = response.getOutputStream();
|
||||
|
||||
@@ -139,7 +136,7 @@ public class SchisandraOssSftpController {
|
||||
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);
|
||||
bean.downLoad(output, filename);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -147,21 +144,21 @@ public class SchisandraOssSftpController {
|
||||
*/
|
||||
@PostMapping("uploadFile")
|
||||
@SneakyThrows
|
||||
public Result<OssInfo> uploadSftpFile(@RequestParam String userId , @RequestParam MultipartFile file, @RequestParam String fileName) {
|
||||
public Result<OssInfo> uploadSftpFile(@RequestParam String userId, @RequestParam MultipartFile file, @RequestParam String fileName) {
|
||||
Preconditions.checkNotNull(userId, "不能为空");
|
||||
Preconditions.checkNotNull(fileName, "不能为空");
|
||||
|
||||
|
||||
//设置热力图
|
||||
Date date =new Date();
|
||||
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 {
|
||||
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));
|
||||
}
|
||||
|
||||
|
@@ -1,12 +1,10 @@
|
||||
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.google.common.base.Preconditions;
|
||||
import com.schisandra.oss.application.convert.SchisandraOssUpDTOConverter;
|
||||
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.UpOssConfiguration;
|
||||
import com.schisandra.oss.application.oss.model.OssInfo;
|
||||
@@ -15,18 +13,14 @@ import com.schisandra.oss.domain.bo.SchisandraOssUpBO;
|
||||
import com.schisandra.oss.domain.service.SchisandraOssUpDomainService;
|
||||
import lombok.SneakyThrows;
|
||||
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.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import javax.servlet.ServletOutputStream;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.InputStream;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 又拍云对象存储配置表 controller
|
||||
@@ -43,8 +37,10 @@ public class SchisandraOssUpController {
|
||||
private SchisandraOssUpDomainService schisandraOssUpDomainService;
|
||||
@Resource
|
||||
private UpOssConfiguration upOssConfiguration;
|
||||
|
||||
/**
|
||||
* 返回up表所有数据
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("returnAll")
|
||||
|
@@ -29,7 +29,7 @@ public class AwsOssConfig {
|
||||
|
||||
private AwsRegion region;
|
||||
|
||||
private DefaultsMode mode;
|
||||
private DefaultsMode mode;
|
||||
|
||||
private AwsOssClientConfig clientConfig;
|
||||
/**
|
||||
|
@@ -1,8 +1,7 @@
|
||||
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.convert.SchisandraFileHeatmapBOConverter;
|
||||
import com.schisandra.oss.domain.service.SchisandraFileHeatmapDomainService;
|
||||
import com.schisandra.oss.infra.basic.entity.SchisandraFileHeatmap;
|
||||
import com.schisandra.oss.infra.basic.service.SchisandraFileHeatmapService;
|
||||
|
@@ -8,7 +8,6 @@ import com.schisandra.oss.domain.service.SchisandraOssAliDomainService;
|
||||
import com.schisandra.oss.infra.basic.entity.SchisandraOssAli;
|
||||
import com.schisandra.oss.infra.basic.service.SchisandraOssAliService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.slf4j.Logger;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
@@ -58,7 +57,7 @@ public class SchisandraOssAliDomainServiceImpl implements SchisandraOssAliDomain
|
||||
|
||||
|
||||
@Override
|
||||
public List<SchisandraOssAliBO> selectAll(){
|
||||
public List<SchisandraOssAliBO> selectAll() {
|
||||
List<SchisandraOssAli> list = schisandraOssAliService.selectAll();
|
||||
List<SchisandraOssAliBO> schisandraOssAliBO_list = new ArrayList<>();
|
||||
for (SchisandraOssAli schisandraOssAli : list) {
|
||||
|
@@ -60,11 +60,6 @@ public class SchisandraOssTencent implements Serializable {
|
||||
*/
|
||||
@Column("app_id")
|
||||
private String appId;
|
||||
/**
|
||||
* 地域
|
||||
*/
|
||||
@Column("app_id")
|
||||
private String appId;
|
||||
|
||||
@Column("region")
|
||||
private String region;
|
||||
|
Reference in New Issue
Block a user