xuhj 1 год назад
Родитель
Сommit
3f60241720

+ 20 - 0
dcuc-duceap-api/src/main/java/com/dragoninfo/dcuc/duceap/facade/IDuceapCodeFacade.java

@@ -65,4 +65,24 @@ public interface IDuceapCodeFacade {
     @GetMapping(value = "getCodeResource")
     List<Map<String, Object>> getCodeResource(@RequestParam("codeDicId") String codeDicId);
 
+    /**
+     * 翻译表码
+     *
+     * @param codeDicId 表码
+     * @param value     值
+     * @return 翻译后的值
+     */
+    @GetMapping(value = "getCodeLabel")
+    String getCodeLabel(@RequestParam("codeDicId") String codeDicId, @RequestParam("value") String value);
+
+    /**
+     * 翻译表码
+     *
+     * @param codeDicId 表码
+     * @param label     名称
+     * @return 翻译后的值
+     */
+    @GetMapping(value = "getCodeValue")
+    String getCodeValue(@RequestParam("codeDicId") String codeDicId, @RequestParam("label") String label);
+
 }

+ 11 - 0
dcuc-duceap-service/src/main/java/com/dragoninfo/dcuc/duceap/facade/DuceapCodeFacade.java

@@ -3,6 +3,7 @@ package com.dragoninfo.dcuc.duceap.facade;
 import com.dragonsoft.duceap.base.entity.metadata.CodeDicDTO;
 import com.dragonsoft.duceap.code.CodeInfoService;
 import com.dragonsoft.duceap.code.model.base.CodeDic;
+import com.dragonsoft.duceap.code.util.CodeInfoUtils;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -65,4 +66,14 @@ public class DuceapCodeFacade implements IDuceapCodeFacade {
     public List<Map<String, Object>> getCodeResource(String codeDicId) {
         return codeInfoService.getCodeResource(codeDicId, true);
     }
+
+    @Override
+    public String getCodeLabel(String codeDicId, String value) {
+        return CodeInfoUtils.getLabel(codeDicId, value);
+    }
+
+    @Override
+    public String getCodeValue(String codeDicId, String label) {
+        return CodeInfoUtils.getFirstValueByLabel(codeDicId, label);
+    }
 }