This commit is contained in:
ls
2024-10-23 18:11:26 +08:00
parent 672735c539
commit 44dfbb4cc1
4 changed files with 100 additions and 71 deletions

1
.gitignore vendored
View File

@@ -13,3 +13,4 @@ os_del.cmd
os_del_doc.cmd os_del_doc.cmd
.svn .svn
derby.log derby.log
/scripts/downloaded_files/

View File

@@ -80,6 +80,10 @@ services:
- 8005:80 - 8005:80
physical-crawler: physical-crawler:
container_name: physical-crawler container_name: physical-crawler
restart: on-failure
depends_on:
- physical-mysql
- physical-minio
image: registry.cn-shanghai.aliyuncs.com/physical/physical-crawler image: registry.cn-shanghai.aliyuncs.com/physical/physical-crawler
ports: ports:
- "25000:5000" - "25000:5000"

View File

@@ -1,9 +1,13 @@
package org.jeecg.modules.oss.controller; package org.jeecg.modules.oss.controller;
import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.v3.oas.annotations.Operation;
import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletRequest;
import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.apache.shiro.authz.annotation.RequiresRoles;
import org.jeecg.common.api.vo.Result; import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.query.QueryGenerator; import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.modules.oss.entity.OssFile; import org.jeecg.modules.oss.entity.OssFile;
@@ -13,14 +17,12 @@ import org.springframework.stereotype.Controller;
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 com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import java.util.ArrayList;
import com.baomidou.mybatisplus.core.metadata.IPage; import java.util.List;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.extern.slf4j.Slf4j;
/** /**
* 云存储示例 DEMO * 云存储示例 DEMO
*
* @author: jeecg-boot * @author: jeecg-boot
*/ */
@Slf4j @Slf4j
@@ -54,8 +56,7 @@ public class OssFileController {
try { try {
ossFileService.upload(multipartFile); ossFileService.upload(multipartFile);
result.success("上传成功!"); result.success("上传成功!");
} } catch (Exception ex) {
catch (Exception ex) {
log.info(ex.getMessage(), ex); log.info(ex.getMessage(), ex);
result.error500("上传失败"); result.error500("上传失败");
} }
@@ -69,7 +70,7 @@ public class OssFileController {
OssFile file = ossFileService.getById(id); OssFile file = ossFileService.getById(id);
if (file == null) { if (file == null) {
result.error500("未找到对应实体"); result.error500("未找到对应实体");
}else { } else {
boolean ok = ossFileService.delete(file); boolean ok = ossFileService.delete(file);
result.success("删除成功!"); result.success("删除成功!");
} }
@@ -81,17 +82,40 @@ public class OssFileController {
*/ */
@ResponseBody @ResponseBody
@GetMapping("/queryById") @GetMapping("/queryById")
@Operation(summary = "文件管理-通过id查询")
public Result<OssFile> queryById(@RequestParam(name = "id") String id) { public Result<OssFile> queryById(@RequestParam(name = "id") String id) {
Result<OssFile> result = new Result<>(); Result<OssFile> result = new Result<>();
OssFile file = ossFileService.getById(id); OssFile file = ossFileService.getById(id);
if (file == null) { if (file == null) {
result.error500("未找到对应实体"); result.error500("未找到对应实体");
} } else {
else {
result.setResult(file); result.setResult(file);
result.setSuccess(true); result.setSuccess(true);
} }
return result; return result;
} }
/**
* 通过id查询.
*/
@ResponseBody
@GetMapping("/queryByIds")
@Operation(summary = "文件管理-通过多个id逗号分割批量查询查询")
public Result<List<OssFile>> queryByIdList(@RequestParam(name = "ids") String ids) {
Result<List<OssFile>> result = new Result<>();
String[] idList = ids.split(",");
List<OssFile> resultList = new ArrayList<>();
for (int i = 0; i < idList.length; i++) {
OssFile file = ossFileService.getById(idList[i]);
resultList.add(file);
}
if (CollectionUtil.isEmpty(resultList)) {
result.error500("未找到对应实体");
} else {
result.setResult(resultList);
result.setSuccess(true);
}
return result;
}
} }

View File

@@ -9,10 +9,10 @@ from minio.error import S3Error
minio_public_url = 'http://58.215.212.230:8005/oss/' minio_public_url = 'http://58.215.212.230:8005/oss/'
# MySQL 连接配置 # MySQL 连接配置
db_config = { db_config = {
# 'host': 'physical-mysql', 'host': 'physical-mysql',
# 'port': 3306, 'port': 3306,
'host': '192.168.50.100', # 'host': '192.168.50.100',
'port': 23306, # 'port': 23306,
'user': 'root', 'user': 'root',
'password': '123456', 'password': '123456',
'database': 'physical-boot' 'database': 'physical-boot'
@@ -20,8 +20,8 @@ db_config = {
# minio 配置 # minio 配置
minio_client = Minio( minio_client = Minio(
# "physical-minio:9000", # MinIO服务器地址或IP "physical-minio:9000", # MinIO服务器地址或IP
"192.168.50.100:29000", # MinIO服务器地址或IP # "192.168.50.100:29000", # MinIO服务器地址或IP
access_key="root", # 替换为你的Access Key access_key="root", # 替换为你的Access Key
secret_key="12345678", # 替换为你的Secret Key secret_key="12345678", # 替换为你的Secret Key
secure=False # 如果使用的是http则为False secure=False # 如果使用的是http则为False