package com.ots.project.tool.report.MAQ.condition; import com.ots.common.enums.LangTypeEnum; import com.ots.common.utils.StringUtils; import com.ots.project.exam.domain.TLibraryCode; import com.ots.project.tool.CacheServiceFactory; import com.ots.project.tool.report.MAQ.base.BaseCondition; import lombok.Getter; import lombok.Setter; import lombok.extern.slf4j.Slf4j; import java.util.HashMap; import java.util.Map; import java.util.Objects; import static com.ots.common.enums.LangTypeEnum.*; @Getter @Setter @Slf4j public class KeyPointsStrengths extends BaseCondition { private String name = "KeyPointsStrengths"; public TLibraryCode calculate(Map map, LangTypeEnum langType) { try { Map paramMap = new HashMap(); paramMap.put("LIBMAQ1010,LIBMAQ1055", map.get("P_Flex01")); paramMap.put("LIBMAQ2010,LIBMAQ2055", map.get("P_Creat02")); paramMap.put("LIBMAQ3010,LIBMAQ3055", map.get("P_Analyt03")); paramMap.put("LIBMAQ10010,LIBMAQ10055", map.get("P_Plan10")); paramMap.put("LIBMAQ16010,LIBMAQ16055", map.get("P_Team16")); paramMap.put("LIBMAQ21010,LIBMAQ21055", map.get("P_Confid21")); paramMap.put("LIBMAQ15010,LIBMAQ15055", map.get("P_Influ15")); Map calculateMap = new HashMap(); for (Map.Entry entry : paramMap.entrySet()) { if (checkParamsNonNull(entry.getValue()) && Double.valueOf(entry.getValue()) >= 70) { calculateMap.put(entry.getKey(), true); } } TLibraryCode maqReportLibrary = spliceTrueObject(calculateMap, map, langType); return maqReportLibrary; } catch (Exception ex) { log.error("KeyPointsStrengths error:{}", ex.getMessage(), ex); return null; } } @Override public Map getMAQwaterDropsImages() { return null; } protected TLibraryCode spliceTrueObject(Map calculateMap, Map map, LangTypeEnum langType) { TLibraryCode result = new TLibraryCode(); StringBuilder context = new StringBuilder(); for (Map.Entry entry : calculateMap.entrySet()) { Boolean value = entry.getValue(); if (value) { TLibraryCode ret = getMaqReportLibrary2(map, entry.getKey(), langType); context.append(ret.getLangTypeContext(langType)); context.append("%line-feed%"); } } result.setLangTypeContext(context.toString(), langType); if (StringUtils.isBlank(context)) { if (langType== English) { context.append("No caution was found."); } else if (langType== Chinese) { context.append("没有发现优势项。"); } else if (langType== Thai) { context.append("No caution was found."); } result.setLangTypeContext(context.toString(), langType); } return result; } public TLibraryCode getMaqReportLibrary2(Map map, String codeId, LangTypeEnum langType) { StringBuilder content = new StringBuilder(); String[] split = codeId.split(","); for (int i = 0;i"); content.append(maqReportLibrary.getLangTypeContext(langType)); content.append(""); } else { content.append(maqReportLibrary.getLangTypeContext(langType)); } } } TLibraryCode result = new TLibraryCode(); result.setLangTypeContext(content.toString(), langType); dynamicParameterSubstitution2(map, result, langType); return result; } public void dynamicParameterSubstitution2(Map map, TLibraryCode maqReportLibrary, LangTypeEnum langType) { map.forEach((key, value) -> { String content = maqReportLibrary.getLangTypeContext(langType); String replaceStr = "%" + key + "%"; maqReportLibrary.setLangTypeContext(content.replace(replaceStr, value), langType); }); } }