[测评系统]--测评系统核心代码库
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
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.report.MAQ.base.BaseCondition;
import com.ots.project.tool.report.MAQ.base.MAQSummaryCondition;
import lombok.Getter;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import static com.ots.common.enums.LangTypeEnum.*;
 
@Setter
@Getter
@Slf4j
public class MAQSummary extends BaseCondition {
    private final List<MAQSummaryCondition> paramList;
    private String name;
    public MAQSummary(String name, List<MAQSummaryCondition> paramList) {
        this.name = name;
        this.paramList = paramList;
    }
    @Override
    public TLibraryCode calculate(Map<String, String> map, LangTypeEnum langType) {
        if (Objects.isNull(paramList) || paramList.isEmpty()) {
            return null;
        }
        StringBuffer context = new StringBuffer();
        paramList.stream().forEach(item -> {
            TLibraryCode calculate = item.calculate(map, langType);
            if (Objects.nonNull(calculate)) {
                context.append(calculate.getLangTypeContext(langType));
                context.append("%line-feed%");
            }
        });
        TLibraryCode maqReportLibrary = new TLibraryCode();
        if (StringUtils.isBlank(context)) {
            if (langType== English) {
                context.append("Mid-range on all these scales.Implications Notes: No strength and weakness was found.");
            } else if (langType== Chinese) {
                context.append("所有维度的分数都在中等范围,没有高分和低分项。");
            } else if (langType== Thai) {
                context.append("Mid-range on all these scales.Implications Notes: No strength and weakness was found.");
            }
        }
        maqReportLibrary.setLangTypeContext(context.toString(), langType);
        return maqReportLibrary;
    }
    @Override
    public Map<String, String> getMAQwaterDropsImages() {
        return null;
    }
}