| | |
| | | import com.ots.project.tool.CacheServiceFactory; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | | @Slf4j |
| | |
| | | public abstract String getName(); |
| | | |
| | | public abstract TLibraryCode calculate(Map<String, String> map, LangTypeEnum langType); |
| | | public List<TLibraryCode> calculateList(Map<String, String> map, LangTypeEnum langType){ |
| | | return null; |
| | | } |
| | | |
| | | public abstract Map<String, String> getMAQwaterDropsImages(); |
| | | |
| | | /** |
| | | * 根据参数获取命中的指标 |
| | | * @param calculateMap |
| | | * @return |
| | | */ |
| | | protected String selectTrueObject(Map<Boolean, String> calculateMap) { |
| | | for (Map.Entry<Boolean, String> entry : calculateMap.entrySet()) { |
| | | Boolean mapKey = entry.getKey(); |
| | |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * 获取报告字典 |
| | | * @param map |
| | | * @param codeId |
| | | * @param langType |
| | | * @return |
| | | */ |
| | | public TLibraryCode getMaqReportLibrary(Map<String, String> map, String codeId, LangTypeEnum langType) { |
| | | if (Objects.isNull(codeId)) { |
| | | return null; |
| | |
| | | StringBuilder content = new StringBuilder(); |
| | | String[] split = codeId.split(","); |
| | | TLibraryCode result = new TLibraryCode(); |
| | | /** |
| | | * 根据字典CODE获取对应的字典详情 |
| | | */ |
| | | Arrays.stream(split).forEach(item -> { |
| | | TLibraryCode maqReportLibrary = CacheServiceFactory.getInstance().getMAQReportLibrary(item); |
| | | if (Objects.isNull(maqReportLibrary)) { |
| | |
| | | result.setLibraryCode(maqReportLibrary.getLibraryCode()); |
| | | } |
| | | }); |
| | | //设置对应语言的文字内容 |
| | | result.setLangTypeContext(content.toString(), langType); |
| | | //替换报告字典内容的变量 |
| | | dynamicParameterSubstitution(map, result, langType); |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * 替换报告字典内容的变量 |
| | | * 报告字典里面还有%%变量 进行替换 |
| | | * @param map |
| | | * @param maqReportLibrary |
| | | * @param langType |
| | | */ |
| | | public void dynamicParameterSubstitution(Map<String, String> map, TLibraryCode maqReportLibrary, LangTypeEnum langType) { |
| | | //根据报告字典内容 定位变量名位置 替换结果 |
| | | map.forEach((key, value) -> { |
| | | String content = maqReportLibrary.getLangTypeContext(langType); |
| | | String replaceStr = "%" + key + "%"; |