[测评系统]--测评系统核心代码库
linzhijie
2021-06-02 880bf98e33e0143a66a56ae781c470e4b39fbdd1
Merge remote-tracking branch 'origin/framework-youhua' into framework-youhua
2个文件已修改
63 ■■■■■ 已修改文件
src/main/java/com/ots/project/tool/CacheServiceFactory.java 29 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ots/project/tool/report/MAQNEW/MAQReport_V2.java 34 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ots/project/tool/CacheServiceFactory.java
@@ -8,6 +8,9 @@
import java.util.Objects;
import java.util.stream.Collectors;
/**
 * 缓存报告字典
 */
@Slf4j
public class CacheServiceFactory {
    private static final String MAQ_REPORT_LIBRARY = "MAQ_REPORT_LIBRARY";
@@ -15,7 +18,11 @@
    private static Cache<String, List<TLibraryCode>> lruCache = CacheUtil.newLRUCache(5);
    private CacheServiceFactory() {
    }
    /**
     * 获取缓存实例
     * @return
     */
    public static CacheServiceFactory getInstance() {
        if (Objects.isNull(instance)) {
            synchronized (CacheServiceFactory.class) {
@@ -26,10 +33,19 @@
        }
        return instance;
    }
    /**
     * 清除缓存
     */
    public void reLoad() {
        lruCache.clear();
        lruCache.put(MAQ_REPORT_LIBRARY, null);
    }
    /**
     * 获取所有报告缓存字典
     * @return
     */
    public List<TLibraryCode> getMAQReportLibrary() {
        List<TLibraryCode> maqReportLibraries = lruCache.get(MAQ_REPORT_LIBRARY);
        if (Objects.isNull(maqReportLibraries)) {
@@ -37,6 +53,12 @@
        }
        return maqReportLibraries;
    }
    /**
     * 根据报告字典ID获取报告字典
     * @param coreId
     * @return
     */
    public TLibraryCode getMAQReportLibrary(String coreId) {
        List<TLibraryCode> maqReportLibrary = getMAQReportLibrary();
        TLibraryCode library = null;
@@ -52,6 +74,11 @@
        }
        return library;
    }
    /**
     * 获取所有报告字典 加入缓存
     * @return
     */
    private List<TLibraryCode> loadExcel() {
        TLibraryCodeServiceImpl itLibraryCodeService = AppUtil.getObject("iTLibraryCodeService", TLibraryCodeServiceImpl.class);
        TLibraryCode libraryCode = new TLibraryCode();
src/main/java/com/ots/project/tool/report/MAQNEW/MAQReport_V2.java
@@ -34,9 +34,21 @@
    private Map otherParams;
    
    private LangTypeEnum langType;
    /**
     * 根据报告类型初始化数据
     * @param reportTypeEnum
     * @return
     */
    public List<BaseCondition_V2> getParamList(ReportTypeEnum reportTypeEnum) {
        return init(reportTypeEnum);
    }
    /**
     * 根据报告类型初始化所有
     * @param reportTypeEnum
     * @return
     */
    private List<BaseCondition_V2> init(ReportTypeEnum reportTypeEnum) {
        List<BaseCondition_V2> paramList = new ArrayList<>();
        
@@ -187,13 +199,21 @@
        conditionVOList.add(new MAQConditionVO_V2("People_Orientation_32", "P_People32", "LIBMAQV2320"));
        return conditionVOList;
    }
    /**
     * 获取报告字典替换值
     * @param thaiCalculationMap
     * @param type
     * @param langType
     * @return
     */
    public ReportResultData getTemplateParameters(Map<String, String> thaiCalculationMap, ReportTypeEnum type, LangTypeEnum langType) {
        this.reportTypeEnum = type;
        this.langType = langType;
        
        Map textMap = new HashMap();
        Map waterDropsMap = new HashMap();
        //基本信息字段
        textMap.put("questionnaireTaker", getQuestionnaireTaker());
        textMap.put("questionnaireID", getQuestionnaireID());
        textMap.put("reportGenerationDate", getReportGenerationDate());
@@ -201,18 +221,28 @@
        textMap.put("questionnaireEmail", getQuestionnaireEmail());
        textMap.put("questionnaireStartTime", getQuestionnaireStartTime());
        textMap.put("questionnaireEndTime", getQuestionnaireEndTime());
        //根据报告类型获取报告字典
        getParamList(type).stream().forEach(p -> {
            //获取对应语言报告字典
            TLibraryCode calculate = p.calculate(thaiCalculationMap, langType);
            List<TLibraryCode> tLibraryCodes = p.calculateList(thaiCalculationMap, langType);
            if(tLibraryCodes != null && tLibraryCodes.size() > 0){
                //表格多位 计算分数值赋值 例如
                // 表格的:%P_Regula19_XX1%
                // 表格的:%P_Regula19_XX2%
                // 表格的:%P_Regula19_XX3%
                // 表格的:%P_Regula19_XX4%
                // 表格的:%P_Regula19_XX5%
                // 表格的:%P_Regula19_XX6%
                for (int i = 0; i < tLibraryCodes.size(); i++) {
                    TLibraryCode tLibraryCode = tLibraryCodes.get(i);
                    textMap.put(p.getName() + "_" + i, Objects.isNull(tLibraryCode) || StringUtils.isBlank(tLibraryCode.getLangTypeContext(langType)) ? "N/A NONE" : tLibraryCode.getLangTypeContext(langType));
                }
            }else{
                //普通报告字典赋值
                textMap.put(p.getName(), Objects.isNull(calculate) || StringUtils.isBlank(calculate.getLangTypeContext(langType)) ? "N/A NONE" : calculate.getLangTypeContext(langType));
            }
            //水滴集合
            if (Objects.nonNull(p.getMAQwaterDropsImages())) {
                waterDropsMap.putAll(p.getMAQwaterDropsImages());
            }