From 0d5c6037e39490a8cb18716aa8b024d4c3d82735 Mon Sep 17 00:00:00 2001 From: fans <1141904845@qq.com> Date: Sat, 13 Jan 2024 16:39:33 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=BB=84=E4=BB=B6=E5=88=86?= =?UTF-8?q?=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- react-ui/config/proxy.ts | 4 ++-- .../controller/component/ComponentController.java | 2 +- .../platform/controller/model/ModelsController.java | 4 ++-- .../com/ruoyi/platform/service/ComponentService.java | 2 +- .../platform/service/impl/ComponentServiceImpl.java | 11 ++++++++--- 5 files changed, 14 insertions(+), 9 deletions(-) diff --git a/react-ui/config/proxy.ts b/react-ui/config/proxy.ts index 65f73f16..5f33242d 100644 --- a/react-ui/config/proxy.ts +++ b/react-ui/config/proxy.ts @@ -15,14 +15,14 @@ export default { // localhost:8000/api/** -> https://preview.pro.ant.design/api/** '/api/': { // 要代理的地址 - target: 'http://localhost:8081', + target: 'http://localhost:8082', // 配置了这个可以从 http 代理到 https // 依赖 origin 的功能可能需要这个,比如 cookie changeOrigin: true, pathRewrite: { '^/api': '' }, }, '/profile/avatar/': { - target: 'http://localhost:8081', + target: 'http://localhost:8082', changeOrigin: true, } }, diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/controller/component/ComponentController.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/controller/component/ComponentController.java index 382cba45..b15d73d8 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/controller/component/ComponentController.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/controller/component/ComponentController.java @@ -53,7 +53,7 @@ public class ComponentController { */ @GetMapping("/components/all") @ApiOperation("查询全部") - public ResponseEntity queryAll(){ + public ResponseEntity queryAll() throws Exception { return ResponseEntity.ok(this.componentService.queryAllGroupedByCategory()); } diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/controller/model/ModelsController.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/controller/model/ModelsController.java index 569d31ae..15e9f4d2 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/controller/model/ModelsController.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/controller/model/ModelsController.java @@ -116,8 +116,8 @@ public class ModelsController { * @return 上传结果 */ @PostMapping("/upload_pipeline") - @ApiOperation(value = "从流水线上传模型", notes = "并将信息存入数据库。") - public ResponseEntity uploadModelsPipeline(@RequestBody ModelsVersion modelsVersion) throws Exception { + @ApiOperation("从流水线上传模型,并将信息存入数据库") + public ResponseEntity uploadModelsPipeline(@RequestBody ModelsVersion modelsVersion){ return ResponseEntity.ok(this.modelsService.uploadModelsPipeline(modelsVersion)); } diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/ComponentService.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/ComponentService.java index 49a03333..1f29c543 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/ComponentService.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/ComponentService.java @@ -59,6 +59,6 @@ public interface ComponentService { String removeById(Integer id); - List queryAllGroupedByCategory(); + List queryAllGroupedByCategory() throws Exception; } diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ComponentServiceImpl.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ComponentServiceImpl.java index 2d59866a..ef3fc4ed 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ComponentServiceImpl.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ComponentServiceImpl.java @@ -7,6 +7,7 @@ import com.ruoyi.platform.service.ComponentService; import com.ruoyi.platform.mapper.ComponentDao; import com.ruoyi.platform.utils.ConvertUtil; import com.ruoyi.platform.vo.ComponentVo; +import com.ruoyi.system.api.domain.SysDictData; import com.ruoyi.system.api.model.LoginUser; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Value; @@ -51,18 +52,22 @@ public class ComponentServiceImpl implements ComponentService { } @Override - public List queryAllGroupedByCategory() { + public List queryAllGroupedByCategory() throws Exception { List componentList = this.componentDao.queryAll(); List result = new ArrayList<>(); if (componentList.isEmpty()){ return result; } + List categoryTypeList = DictUtils.getDictCache("category_type"); Map> groupedComponent = componentList.stream().collect(Collectors.groupingBy(Component::getCategoryId)); for (Map.Entry > entry : groupedComponent.entrySet()) { - String name = DictUtils.getCacheKey(String.valueOf(entry.getKey())); + List categorys = categoryTypeList.stream().filter(sysDictData -> StringUtils.equals(sysDictData.getDictValue(), String.valueOf(entry.getKey()))).collect(Collectors.toList()); + if (categorys.size() ==0){ + throw new Exception("组件类型不存在"); + } Map map = new HashMap(); map.put("key", entry.getKey()); - map.put("name", name); + map.put("name", categorys.get(0).getDictLabel()); map.put("value", entry.getValue()); result.add(map); }