Jelajahi Sumber

fix 修复 翻译报错问题

疯狂的狮子Li 1 tahun lalu
induk
melakukan
ffe8b16ff3

+ 1 - 1
ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/service/IFlwCategoryService.java

@@ -27,7 +27,7 @@ public interface IFlwCategoryService {
      * @param categoryId 流程分类ID
      * @param categoryId 流程分类ID
      * @return 流程分类名称
      * @return 流程分类名称
      */
      */
-    String selectCategoryNameById(String categoryId);
+    String selectCategoryNameById(Long categoryId);
 
 
     /**
     /**
      * 查询符合条件的流程分类列表
      * 查询符合条件的流程分类列表

+ 6 - 2
ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/service/impl/CategoryNameTranslationImpl.java

@@ -1,5 +1,6 @@
 package org.dromara.workflow.service.impl;
 package org.dromara.workflow.service.impl;
 
 
+import cn.hutool.core.convert.Convert;
 import lombok.RequiredArgsConstructor;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import lombok.extern.slf4j.Slf4j;
 import org.dromara.common.translation.annotation.TranslationType;
 import org.dromara.common.translation.annotation.TranslationType;
@@ -25,9 +26,12 @@ public class CategoryNameTranslationImpl implements TranslationInterface<String>
 
 
     @Override
     @Override
     public String translation(Object key, String other) {
     public String translation(Object key, String other) {
+        Long id = null;
         if (key instanceof String categoryId) {
         if (key instanceof String categoryId) {
-            return flwCategoryService.selectCategoryNameById(categoryId);
+            id = Convert.toLong(categoryId);
+        } else if (key instanceof Long categoryId) {
+            id = categoryId;
         }
         }
-        return null;
+        return flwCategoryService.selectCategoryNameById(id);
     }
     }
 }
 }

+ 2 - 2
ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/service/impl/FlwCategoryServiceImpl.java

@@ -66,8 +66,8 @@ public class FlwCategoryServiceImpl implements IFlwCategoryService {
      */
      */
     @Cacheable(cacheNames = FlowConstant.FLOW_CATEGORY_NAME, key = "#categoryId")
     @Cacheable(cacheNames = FlowConstant.FLOW_CATEGORY_NAME, key = "#categoryId")
     @Override
     @Override
-    public String selectCategoryNameById(String categoryId) {
-        if (StringUtils.isBlank(categoryId)) {
+    public String selectCategoryNameById(Long categoryId) {
+        if (ObjectUtil.isNull(categoryId)) {
             return null;
             return null;
         }
         }
         FlowCategory category = baseMapper.selectOne(new LambdaQueryWrapper<FlowCategory>()
         FlowCategory category = baseMapper.selectOne(new LambdaQueryWrapper<FlowCategory>()