From 5899f2350cbcff0c05eede090713bfa519a3b88c Mon Sep 17 00:00:00 2001 From: yiwenpeng <ywp303@163.com> Date: Mon, 25 Mar 2024 10:36:34 +0800 Subject: [PATCH] feat:开发看板介绍获取所以图片接口 --- src/main/java/com/huaheng/api/tv/controller/TvController.java | 34 ++++++++++++++++++++++++++++++++++ src/main/java/com/huaheng/framework/config/ShiroConfig.java | 16 ++++++++-------- 2 files changed, 42 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/huaheng/api/tv/controller/TvController.java b/src/main/java/com/huaheng/api/tv/controller/TvController.java index 7f896ce..2862d9d 100644 --- a/src/main/java/com/huaheng/api/tv/controller/TvController.java +++ b/src/main/java/com/huaheng/api/tv/controller/TvController.java @@ -34,6 +34,7 @@ import org.jetbrains.annotations.NotNull; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; +import java.io.File; import java.util.*; @RestController @@ -84,6 +85,39 @@ public class TvController extends BaseController { // allBean.setUpList(upList); // return TVResult.success(allBean); //} + @GetMapping("/queryAllPicture") + public List<String> queryAllPicture() { + //String directoryPath = "D:/Huaheng/uploadPath/file/"; + String directoryPath = "/Users/yiwenpeng/Desktop/素材"; + return listImageFiles(directoryPath); + } + + public List<String> listImageFiles(String directoryPath) { + List<String> imageFiles = new ArrayList<>(); + + File directory = new File(directoryPath); + File[] files = directory.listFiles(); + + if (files != null) { + for (File file : files) { + if (file.isFile() && isImageFile(file.getName())) { + imageFiles.add(file.getAbsolutePath()); + } + } + } + + return imageFiles; + } + + public boolean isImageFile(String fileName) { + String[] imageExtensions = {".jpg", ".jpeg", ".png", ".gif", ".bmp"}; + for (String extension : imageExtensions) { + if (fileName.toLowerCase().endsWith(extension)) { + return true; + } + } + return false; + } //入库看板1,240221(未完成任务) diff --git a/src/main/java/com/huaheng/framework/config/ShiroConfig.java b/src/main/java/com/huaheng/framework/config/ShiroConfig.java index c29e19f..3e566d0 100644 --- a/src/main/java/com/huaheng/framework/config/ShiroConfig.java +++ b/src/main/java/com/huaheng/framework/config/ShiroConfig.java @@ -280,14 +280,14 @@ public class ShiroConfig { filterChainDefinitionMap.put("/mobile/receipt/batch/**", "anon"); //todo pda出入库查询,测试后注释 - filterChainDefinitionMap.put("/receipt/receiptHeader/listPda", "anon"); - filterChainDefinitionMap.put("/receipt/receiptDetail/list", "anon"); - filterChainDefinitionMap.put("/receipt/receiptDetail/pdaList", "anon"); - filterChainDefinitionMap.put("/task/taskHeader/getTaskByTaskId", "anon"); - filterChainDefinitionMap.put("/task/taskHeader/getTaskByShipmentCode", "anon"); - filterChainDefinitionMap.put("/mobile/inventory/completeTaskListByWMS", "anon"); - filterChainDefinitionMap.put("/receipt/receiving/saveBatch", "anon"); - filterChainDefinitionMap.put("/config/zone/getAllFlatLocation", "anon"); + //filterChainDefinitionMap.put("/receipt/receiptHeader/listPda", "anon"); + //filterChainDefinitionMap.put("/receipt/receiptDetail/list", "anon"); + //filterChainDefinitionMap.put("/receipt/receiptDetail/pdaList", "anon"); + //filterChainDefinitionMap.put("/task/taskHeader/getTaskByTaskId", "anon"); + //filterChainDefinitionMap.put("/task/taskHeader/getTaskByShipmentCode", "anon"); + //filterChainDefinitionMap.put("/mobile/inventory/completeTaskListByWMS", "anon"); + //filterChainDefinitionMap.put("/receipt/receiving/saveBatch", "anon"); + //filterChainDefinitionMap.put("/config/zone/getAllFlatLocation", "anon"); // 系统权限列表 -- libgit2 0.22.2