Преглед на файлове

fix:字典翻译问题

zhangkai преди 3 месеца
родител
ревизия
6eba67ecea
променени са 1 файла, в които са добавени 16 реда и са изтрити 6 реда
  1. 16 6
      nationrel-module-pdsc-biz/src/main/java/com/nationrel/modules/pdsc/service/impl/ProjectInfoServiceImpl.java

+ 16 - 6
nationrel-module-pdsc-biz/src/main/java/com/nationrel/modules/pdsc/service/impl/ProjectInfoServiceImpl.java

@@ -33,6 +33,7 @@ import org.jeecg.common.constant.enums.FileTypeEnum;
 import org.jeecg.common.system.vo.DictModel;
 import org.jeecg.common.system.vo.LoginUser;
 import org.jeecg.common.util.WrapperUtil;
+import org.jeecg.config.i18n.MessageUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -315,12 +316,9 @@ public class ProjectInfoServiceImpl extends ServiceImpl<ProjectInfoMapper, Proje
     private List<Map<String, Object>> buildExportExcelRows(List<ProjectInfoListVo> projectInfoListVos) {
         List<Map<String, Object>> rows = CollUtil.newArrayList();
         int num = 1;
-        Map<String, String> projectTypeMap = commonApi.queryDictItemsByCode("nationrel_pdsc_project_type")
-                .stream().collect(Collectors.toMap(DictModel::getValue, DictModel::getText));
-        Map<String, String> ctqGradeMap = commonApi.queryDictItemsByCode("nationrel_pdsc_ctq_grade")
-                .stream().collect(Collectors.toMap(DictModel::getValue, DictModel::getText));
-        Map<String, String> statusMap = commonApi.queryDictItemsByCode("nationrel_pdsc_status")
-                .stream().collect(Collectors.toMap(DictModel::getValue, DictModel::getText));
+        Map<String, String> projectTypeMap = translateDict("nationrel_pdsc_project_type");
+        Map<String, String> ctqGradeMap = translateDict("nationrel_pdsc_ctq_grade");
+        Map<String, String> statusMap = translateDict("nationrel_pdsc_status");
         String createBy = projectInfoListVos.stream().map(ProjectInfoListVo::getCreateBy).distinct().collect(Collectors.joining(SymbolConstant.COMMA));
         Map<String, String> usernameMap = commonApi.translateDictFromTableByKeys("sys_user", "realname", "username", createBy, "master")
                 .stream().collect(Collectors.toMap(DictModel::getValue, DictModel::getText));
@@ -361,6 +359,18 @@ public class ProjectInfoServiceImpl extends ServiceImpl<ProjectInfoMapper, Proje
         return rows;
     }
 
+    /**
+     * 翻译字典
+     *
+     * @param code key值
+     * @return 结果
+     */
+    private Map<String, String> translateDict(String code) {
+        return commonApi.queryDictItemsByCode(code)
+                .stream().peek(v -> v.setText(MessageUtils.get(v.getText()))).toList()
+                .stream().collect(Collectors.toMap(DictModel::getValue, DictModel::getText));
+    }
+
     /**
      * 拷贝项目信息-团队成员
      *