| | |
| | | package com.ots.project.tool.exam; |
| | | import com.ots.common.enums.ReportTypeEnum; |
| | | import com.ots.common.utils.StringUtils; |
| | | import java.util.Arrays; |
| | | import java.util.Date; |
| | |
| | | productTypeMap.put("RuiLin","RuiLin"); |
| | | productTypeMap.put("MAQ", "MAQ"); |
| | | productTypeMap.put("MAQV2", "MAQV2"); |
| | | productTypeMap.put("MAQIAR", "MAQIAR"); |
| | | productTypeMap.put("SAQ", "SAQ"); |
| | | productTypeMap.put("JAQ", "JAQ"); |
| | | } |
| | |
| | | } |
| | | return JsonUtil.toJSONString(map); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取提示语 |
| | | * @param langType 语言 |
| | | * @param contentMapJson 提示语内容 |
| | | * @return |
| | | */ |
| | | public static String getLangString(String langType, String contentMapJson) { |
| | | if (StringUtils.isEmpty(contentMapJson)) { |
| | | return ""; |
| | |
| | | if (StringUtils.isEmpty(langType)) { |
| | | return contentMapJson; |
| | | } |
| | | /** |
| | | * json 转为 map 方便根据key获取对应语言提示语 |
| | | */ |
| | | Map<String, String> contentMap = JsonUtil.parseObject(contentMapJson, HashMap.class); |
| | | if (Objects.isNull(contentMap)) { |
| | | return contentMapJson; |
| | | } |
| | | |
| | | |
| | | //对应语言提示语为空 |
| | | if (StringUtils.isNotEmpty(contentMap.get(langType))) { |
| | | return contentMap.get(langType); |
| | | } else if (StringUtils.isNotEmpty(contentMap.get("English"))) { |
| | | } /*else if (StringUtils.isNotEmpty(contentMap.get("English"))) { |
| | | contentMap.get("English"); |
| | | } |
| | | }*/ |
| | | if (contentMap.isEmpty()) { |
| | | return ""; |
| | | } |
| | | |
| | | return contentMap.values().stream().findFirst().get(); |
| | | } |
| | | |
| | | /** |
| | | * 判断对应语言的提示语是否存在 |
| | | * @param langType 语言 |
| | | * @param contentMapJson 提示语内容 |
| | | * @return |
| | | */ |
| | | public static boolean isLangType(String langType, String contentMapJson) { |
| | | if (StringUtils.isEmpty(contentMapJson)) { |
| | | return false; |
| | | } |
| | | if (StringUtils.isEmpty(langType)) { |
| | | return false; |
| | | } |
| | | /** |
| | | * json 转为 map 方便根据key获取对应语言提示语 |
| | | */ |
| | | Map<String, String> contentMap = JsonUtil.parseObject(contentMapJson, HashMap.class); |
| | | if (Objects.isNull(contentMap)) { |
| | | return false; |
| | | } |
| | | |
| | | //对应语言提示语为空 |
| | | if (StringUtils.isNotEmpty(contentMap.get(langType))) { |
| | | return StringUtils.isNotEmpty(contentMap.get(langType)); |
| | | } /*else if (StringUtils.isNotEmpty(contentMap.get("English"))) { |
| | | contentMap.get("English"); |
| | | }*/ |
| | | if (contentMap.isEmpty()) { |
| | | return false; |
| | | } |
| | | |
| | | return false; |
| | | } |
| | | |
| | | public static String getStringByLang(String langType, String contentMapJson) { |
| | |
| | | } |
| | | return ""; |
| | | } |
| | | |
| | | /** |
| | | * 是不是LAQ |
| | | * @return |
| | | */ |
| | | public static boolean isLAQ(String testName){ |
| | | if(StringUtils.isEmpty(testName)){ |
| | | return false; |
| | | } |
| | | return testName.contains(ReportTypeEnum.LAQ.getCode()); |
| | | } |
| | | } |