[测评系统]--测评系统核心代码库
linzhijie
2021-03-11 84fea994d2db7dc313ad1774f34eb12a45f8d6e7
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
package com.ots.project.tool.report.RuilinMAQ;
import com.ots.common.enums.LangTypeEnum;
import com.ots.common.enums.ReportTypeEnum;
import com.ots.common.utils.StringUtils;
import com.ots.project.exam.domain.TLibraryCode;
import com.ots.project.tool.report.MAQ.base.BaseCondition;
import com.ots.project.tool.report.MAQ.condition.SimpleMessage;
import com.ots.project.tool.report.ReportResultData;
import com.ots.project.tool.report.RuilinMAQ.condition.*;
import lombok.Getter;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
import java.util.*;
import java.util.stream.Collectors;
@Setter
@Getter
@Slf4j
public class RuilinMAQReport {
    private String questionnaireTaker;
    private String questionnaireID;
    private String reportGenerationDate;
    public List<BaseCondition> getParamList() {
        List<BaseCondition> paramList = new ArrayList<>();
        
        paramList.addAll(getSimpleMessageCoreIds().stream().map(p -> {
            SimpleMessage simpleMessage = new SimpleMessage(p);
            return simpleMessage;
        }).collect(Collectors.toList()));
        paramList.add(new RuilinTestResultValidityDiagnosis());
        paramList.add(new RuilinTestResultValidityDiagnosisContext());
        
        paramList.addAll(getDataStartsInit().stream().map(item ->
                new NumberOfStars(item.split(",")[0])).collect(Collectors.toList()));
        
        paramList.addAll(getDataStartsInit().stream().map(item ->
        {
            String[] split = item.split(",");
            return new NumberOfStarsContext(split[0], split[1]);
        }).collect(Collectors.toList()));
        
        paramList.addAll(getDefine().stream().map(item ->
        {
            SimpleMessageDefine simpleMessageDefine = new SimpleMessageDefine(item);
            return simpleMessageDefine;
        }).collect(Collectors.toList()));
        
        paramList.addAll(getImage().stream().map(pp ->
        {
            SimpleMessage simpleMessage = new SimpleMessage(pp);
            return simpleMessage;
        }).collect(Collectors.toList()));
        return paramList;
    }
    private List<String> getImage() {
        return Arrays.asList("RL903002");
    }
    private List<String> getDefine() {
        return Arrays.asList("RL000101", "RL000102", "RL000103", "RL000104", "RL000201",
                "RL000202", "RL000203", "RL000204", "RL000301", "RL000302",
                "RL000303", "RL000304", "RL000401", "RL000402", "RL000403",
                "RL000501", "RL000502", "RL000503", "RL000601", "RL000602",
                "RL000603", "RL000701", "RL000702", "RL000703", "RL000801",
                "RL000802", "RL000803", "RL000901", "RL000902", "RL000903",
                "RL001001", "RL001002", "RL001003", "RL001004", "RL001101",
                "RL001102", "RL001103", "RL001201", "RL001202", "RL001203", "RL800009", "RL800010", "RL800011");
    }
    private List<String> getDataStartsInit() {
        return Arrays.asList("P_Com1,RL010101", "P_Com2,RL010102", "P_Com3,RL010103", "P_Com4,RL010104", "P_Com5,RL010201", "P_Com6,RL010202"
                , "P_Com7,RL010203", "P_Com8,RL010204", "P_Com9,RL010301", "P_Com10,RL010302", "P_Com11,RL010303", "P_Com12,RL010304"
                , "P_Com13,RL010401", "P_Com14,RL010402", "P_Com15,RL010403", "P_Com16,RL010501", "P_Com17,RL010502", "P_Com18,RL010503"
                , "P_Com19,RL010601", "P_Com20,RL010602", "P_Com21,RL010603", "P_Com22,RL010701", "P_Com23,RL010702", "P_Com24,RL010703"
                , "P_Com25,RL010801", "P_Com26,RL010802", "P_Com27,RL010803", "P_Com28,RL010901", "P_Com29,RL010902", "P_Com30,RL010903"
                , "P_Com31,RL011001", "P_Com32,RL011002", "P_Com33,RL011003", "P_Com34,RL011004", "P_Com35,RL011101", "P_Com36,RL011102"
                , "P_Com37,RL011103", "P_Com38,RL011201", "P_Com39,RL011202", "P_Com40,RL011203"
        );
    }
    private List<String> getSimpleMessageCoreIds() {
        return Arrays.asList("RL000000", "RL901001", "RL902001", "RL903001", "RL902002", "RL903003"
                , "RL903004", "RL904001", "RL904002", "RL904003", "RL904004", "RL903005"
                , "RL904005", "RL904006", "RL904007", "RL904008", "RL904009", "RL904010"
                , "RL904011", "RL904012", "RL904013", "RL904014", "RL904015", "RL904016"
                , "RL902003", "RL903006", "RL903007", "RL903008", "RL902004", "RL903009"
                , "RL904017", "RL904018", "RL904019", "RL904020", "RL905001", "RL905002"
                , "RL905003", "RL904021", "RL905004", "RL905005", "RL905006", "RL903010"
                , "RL904022", "RL905007", "RL905008", "RL905009", "RL905010", "RL904023"
                , "RL904024", "RL904025", "RL902005", "RL903011", "RL901002", "RL902006"
                , "RL902007", "RL902008", "RL903012", "RL903013", "RL903014", "RL903015"
                , "RL903016", "RL904026", "RL904027", "RL904028", "RL904029", "RL901003"
                , "RL902009", "RL902010", "RL990101", "RL990102"
                , "RL990103", "RL990104", "RL990201", "RL990202", "RL990203", "RL990204"
                , "RL990301", "RL990302", "RL990303", "RL990304", "RL990401", "RL990402"
                , "RL990403", "RL990501", "RL990502", "RL990503", "RL990601", "RL990602"
                , "RL990603", "RL990701", "RL990702", "RL990703", "RL990801", "RL990802"
                , "RL990803", "RL990901", "RL990902", "RL990903", "RL991001", "RL991002"
                , "RL991003", "RL991004", "RL991101", "RL991102", "RL991103", "RL991201"
                , "RL991202", "RL991203", "RL901004", "RL800001"
                , "RL800002", "RL800002", "RL800004", "RL800005", "RL800006", "RL800007"
                , "RL800008", "RL903017", "RL903018", "RL903019", "RL903020"
                , "RL800003", "RL800012", "RL800013", "RL800014"
                , "RL800015", "RL800016", "RL800017", "RL800018", "RL800019", "RL800020"
                , "RL800021", "RL800022", "RL800023", "RL800024"
        );
    }
    
    public ReportResultData getTemplateParameters(Map<String, String> thaiCalculationMap, ReportTypeEnum type, LangTypeEnum langType) {
 
 
 
 
 
 
 
 
        
        Map textMap = new HashMap();
        Map iconMap = new HashMap();
        Map waterDropsMap = new HashMap();
        textMap.put("questionnaireTaker", getQuestionnaireTaker());
        textMap.put("questionnaireID", getQuestionnaireID());
        textMap.put("reportGenerationDate", getReportGenerationDate());
        getParamList().stream().forEach(p -> {
            TLibraryCode calculate = p.calculate(thaiCalculationMap, langType);
            if (Objects.nonNull(calculate) && Objects.equals(calculate.getDictType(), "2")) {
                iconMap.put(p.getName(), calculate.getIcon());
            } 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());
            }
        });
        textMap.putAll(thaiCalculationMap);
        ReportResultData reportResultData = new ReportResultData();
        reportResultData.setTextMap(textMap);
        reportResultData.setIconMap(iconMap);
        reportResultData.setImageMap(waterDropsMap);
        return reportResultData;
    }
}