| | |
| | | @Getter |
| | | public enum ReportTypeEnum { |
| | | Brief("Brief", "简易版"), Complete("Complete", "完整版"), SAQ("SAQ", "SAQ报告"), RuiLin("RuiLin", "睿邻报告"), CAQ("CAQ", "CAQ报告"), |
| | | JAQ("JAQ","JAQ报告"),MAQ("MAQ", "MAQ报告"),MAQV2("MAQV2", "MAQV2报告"); |
| | | JAQ("JAQ","JAQ报告"),MAQ("MAQ", "MAQ报告"),PAQ("PAQ", "PAQ报告"); |
| | | private final String code; |
| | | private final String message; |
| | | ReportTypeEnum(String code, String message) { |
New file |
| | |
| | | package com.ots.project.tool.report.PAQ; |
| | | |
| | | 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.MAQNEW.base.BaseCondition_V2; |
| | | import com.ots.project.tool.report.MAQNEW.base.MAQConditionVO_V2; |
| | | import com.ots.project.tool.report.MAQNEW.base.MAQSummaryCondition_V2; |
| | | import com.ots.project.tool.report.MAQNEW.condition.*; |
| | | import com.ots.project.tool.report.ReportResultData; |
| | | import lombok.Data; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @Data |
| | | @Slf4j |
| | | public class PAQReport { |
| | | private String questionnaireTaker; |
| | | private String questionnaireID; |
| | | private String reportGenerationDate; |
| | | private String userName; |
| | | private String questionnaireEmail; |
| | | private String questionnaireStartTime; |
| | | private String questionnaireEndTime; |
| | | private ReportTypeEnum reportTypeEnum; |
| | | |
| | | 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<>(); |
| | | |
| | | //普通信息 |
| | | paramList.addAll(getSimpleMessageCoreIds().stream().map(p -> { |
| | | SimpleMessage_V2 simpleMessage = new SimpleMessage_V2(p); |
| | | return simpleMessage; |
| | | }).collect(Collectors.toList())); |
| | | |
| | | //测试结果有效性诊断 |
| | | paramList.add(new ResponseFidelityDiagnosisTitle_V2()); |
| | | paramList.add(new ResponseFidelityDiagnosis_V2()); |
| | | |
| | | //表格计算数值 |
| | | paramList.addAll(getScoreCharacteristicsList().stream().map(p -> { |
| | | ScoreCharacteristics_V2 scoreCharacteristics = new ScoreCharacteristics_V2(p); |
| | | return scoreCharacteristics; |
| | | }).collect(Collectors.toList())); |
| | | |
| | | return paramList; |
| | | } |
| | | |
| | | /** |
| | | * 表格计算数值 |
| | | * @return |
| | | */ |
| | | private List<String> getScoreCharacteristicsList() { |
| | | return Arrays.asList("P_Flex01", "P_Creat02", "P_Analyt03", "P_Indep04", "P_Achiev05", |
| | | "P_Initi06", "P_Persis07", "P_Thorou08", "P_Depend09", "P_Plan10", |
| | | "P_Integr11", "P_Energy12", "P_Social13", "P_Lead14", "P_Influ15", |
| | | "P_Team16", "P_Empath17", "P_Polite18", "P_Regula19", "P_ManStr20", |
| | | "P_Confid21", "P_Mind22", "P_SDE23", "P_IM24", "P_INCON25", |
| | | "P_Open26", "P_Consci27", "P_Extrov28", "P_Agree29", "P_EmSt30", |
| | | "P_Task31", "P_People32", "P_Judg33"); |
| | | } |
| | | |
| | | /** |
| | | * 普通文本替换library |
| | | * @return |
| | | */ |
| | | private List<String> getSimpleMessageCoreIds() { |
| | | return Arrays.asList( |
| | | "LIBMAQV20001", "LIBMAQV20002", "LIBMAQV20003", "LIBMAQV20004", "LIBMAQV20005", |
| | | "LIBMAQV200101","LIBMAQV200201","LIBMAQV200301","LIBMAQV20041","LIBMAQV20042",//MAQV2简易版报告需要用到 |
| | | "LIBMAQV200071", "LIBMAQV20006", "LIBMAQV20009", "LIBMAQV20210", "LIBMAQV200077", |
| | | "LIBMAQV20008", "LIBMAQV20009", "LIBMAQV20010", "LIBMAQV20011", "LIBMAQV20030", |
| | | "LIBMAQV20040", "LIBMAQV20060", "LIBMAQV233000", "LIBMAQV20008", "LIBMAQV20065", |
| | | "LIBMAQV20070", "LIBMAQV20080", "LIBMAQV20085", "LIBMAQV20090", "LIBMAQV2000794", |
| | | "LIBMAQV2000795", "LIBMAQV20095", "LIBMAQV28800", "LIBMAQV20110", |
| | | "LIBMAQV201052", "LIBMAQV20120", "LIBMAQV201102", "LIBMAQV201202", "LIBMAQV20111", |
| | | "LIBMAQV20121", "LIBMAQV20105", "LIBMAQV20131", "LIBMAQV20141", "LIBMAQV20135", |
| | | "LIBMAQV20150", "LIBMAQV20155", "LIBMAQV20160", "LIBMAQV20170", "LIBMAQV20190", |
| | | "LIBMAQV20191", "LIBMAQV20192", "LIBMAQV20193", "LIBMAQV20194", "LIBMAQV20195", |
| | | "LIBMAQV20162", "LIBMAQV20164", "LIBMAQV20200", "LIBMAQV20205", "LIBMAQV20221", |
| | | "LIBMAQV20222", "LIBMAQV20223", "LIBMAQV20224", "LIBMAQV20225", "LIBMAQV20226", |
| | | "LIBMAQV20227", "LIBMAQV20228", "LIBMAQV20229", "LIBMAQV20230", "LIBMAQV20231", |
| | | "LIBMAQV20232", "LIBMAQV20233", "LIBMAQV20234", "LIBMAQV226006", "LIBMAQV20210", |
| | | "LIBMAQV20220", "LIBMAQV231000", "LIBMAQV231010", "LIBMAQV231013", "LIBMAQV232010", |
| | | "LIBMAQV232013", "LIBMAQV225000", "LIBMAQV225042", "LIBMAQV225043", "LIBMAQV225012", |
| | | "LIBMAQV225013", "LIBMAQV225032", "LIBMAQV225033", "LIBMAQV225022", "LIBMAQV225023", |
| | | "LIBMAQV225002", "LIBMAQV233010", "LIBMAQV233020", "LIBMAQV233021", "LIBMAQV233030", |
| | | "LIBMAQV233040", "LIBMAQV233045", "LIBMAQV233050", "LIBMAQV233060", "LIBMAQV226003", |
| | | "LIBMAQV226004", "LIBMAQV227003", "LIBMAQV227004", "LIBMAQV228003", "LIBMAQV228004", |
| | | "LIBMAQV229003", "LIBMAQV229004", "LIBMAQV230003", "LIBMAQV230004", "LIBMAQV21001", |
| | | "LIBMAQV21002", "LIBMAQV21007", "LIBMAQV22002", "LIBMAQV22007", "LIBMAQV23002", "LIBMAQV23007", |
| | | "LIBMAQV24002", "LIBMAQV24007", "LIBMAQV25002", "LIBMAQV25007", "LIBMAQV26002", "LIBMAQV26007", |
| | | "LIBMAQV27002", "LIBMAQV27007", "LIBMAQV28802", "LIBMAQV28007", "LIBMAQV29002", "LIBMAQV29007", |
| | | "LIBMAQV210002", "LIBMAQV210007", "LIBMAQV211002", "LIBMAQV211007", "LIBMAQV212002", "LIBMAQV212007", |
| | | "LIBMAQV213002", "LIBMAQV213007", "LIBMAQV214002", "LIBMAQV214007", "LIBMAQV215002", "LIBMAQV215007", |
| | | "LIBMAQV216002", "LIBMAQV216007", "LIBMAQV217002", "LIBMAQV217007", "LIBMAQV218002", "LIBMAQV218007", |
| | | "LIBMAQV219002", "LIBMAQV219007", "LIBMAQV220002", "LIBMAQV220007", "LIBMAQV221002", "LIBMAQV221007", |
| | | "LIBMAQV222002", "LIBMAQV222007", "LIBMAQV226001", "LIBMAQV226002", "LIBMAQV21000", "LIBMAQV21001", "LIBMAQV22000", |
| | | "LIBMAQV22001", "LIBMAQV23000", "LIBMAQV23001", "LIBMAQV24000", "LIBMAQV24001", "LIBMAQV227001", "LIBMAQV2270015", "LIBMAQV228002", |
| | | "LIBMAQV25000", "LIBMAQV25001", "LIBMAQV26000", "LIBMAQV26001", "LIBMAQV27000", "LIBMAQV27001", "LIBMAQV229002", |
| | | "LIBMAQV28000", "LIBMAQV28001", "LIBMAQV227002", "LIBMAQV29000", "LIBMAQV29001", "LIBMAQV210000", "LIBMAQV230002", |
| | | "LIBMAQV210001", "LIBMAQV211000", "LIBMAQV211001", "LIBMAQV228001", "LIBMAQV212000", "LIBMAQV212001", |
| | | "LIBMAQV213000", "LIBMAQV213001", "LIBMAQV214000", "LIBMAQV214001", "LIBMAQV215000", "LIBMAQV215001", |
| | | "LIBMAQV229001", "LIBMAQV216000", "LIBMAQV216001", "LIBMAQV217000", "LIBMAQV217001", "LIBMAQV218000", |
| | | "LIBMAQV218001", "LIBMAQV230001", "LIBMAQV219000", "LIBMAQV219001", "LIBMAQV220000", "LIBMAQV220001", |
| | | "LIBMAQV221000", "LIBMAQV221001", "LIBMAQV222000", "LIBMAQV222001", "LIBMAQV231003", "LIBMAQV231005", |
| | | "LIBMAQV232005", "LIBMAQV231010", "LIBMAQV231013", "LIBMAQV20020", "LIBMAQV233061", "LIBMAQV20007", "LIBMAQV200081", "LIBMAQV28002", |
| | | "LIBMAQV227006", "LIBMAQV228006", "LIBMAQV229006", "LIBMAQV230006", "LIBMAQV233061", "LIBMAQV233062", "LIBMAQV233063", "LIBMAQV233064", "LIBMAQV233065" |
| | | ); |
| | | } |
| | | |
| | | /** |
| | | * 获取报告字典替换值 |
| | | * @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()); |
| | | textMap.put("userName", getUserName()); |
| | | 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){ |
| | | //表格多位 计算分数值赋值 例如 |
| | | // 表格的:%ResponseFidelityDiagnosis_V2_0% |
| | | // 表格的:%ResponseFidelityDiagnosis_V2_1% |
| | | // 表格的:%ResponseFidelityDiagnosis_V2_2% |
| | | 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)); |
| | | } |
| | | }); |
| | | textMap.putAll(thaiCalculationMap); |
| | | ReportResultData reportResultData = new ReportResultData(); |
| | | reportResultData.setTextMap(textMap); |
| | | return reportResultData; |
| | | } |
| | | } |