linzhijie
2021-04-12 c632636e2f5b4188b430f5efc9d9f68c8dbe3d6d
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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
package com.ots.project.exam.restcontroller;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.ots.common.enums.LangTypeEnum;
import com.ots.common.enums.TestMemberStatusEnum;
import com.ots.common.enums.UserTypeEnum;
import com.ots.common.utils.StringUtils;
import com.ots.common.utils.Threads;
import com.ots.common.utils.bean.BeanUtils;
import com.ots.project.common.BaseApiController;
import com.ots.project.exam.domain.*;
import com.ots.project.exam.dto.*;
import com.ots.project.exam.service.*;
import com.ots.project.exam.service.impl.TExamPaperServiceImpl;
import com.ots.project.exam.viewmodel.ExamPaperSubmitItemVM;
import com.ots.project.exam.viewmodel.ExamPaperSubmitVM;
import com.ots.project.exam.viewmodel.ExamPaperTitleItemVM;
import com.ots.project.exam.viewmodel.QuestionEditRequestVM;
import com.ots.project.tool.exam.DateTimeUtil;
import com.ots.project.tool.exam.ExamUtil;
import com.ots.project.tool.exam.JsonUtil;
import com.ots.project.tool.report.MAQ.MAQReport;
import com.ots.project.tool.report.ReportResultData;
import lombok.AllArgsConstructor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.util.*;
import java.util.stream.Collectors;
import static com.ots.common.enums.ReportTypeEnum.Brief;
import static com.ots.common.enums.SenderCode.noSend;
import static com.ots.common.enums.SenderCode.send;
@RestController("StudentExamPaperAnswerController")
@RequestMapping(value = "/api/exam/exampaper/answer")
@AllArgsConstructor
public class ExamPaperAnswerController extends BaseApiController {
    @Autowired
    private ExamPaperAnswerService examPaperAnswerService;
    @Autowired
    private MemberService memberService;
    @Autowired
    private ITQuestionService questionService;
    @Autowired
    private ITExamReportService examReportService;
    @Autowired
    private IEntTestMemberService entTestMemberService;
    @Autowired
    private ExamPaperController examPaperController;
    @Autowired
    private TExamPaperServiceImpl examPaperService;
    private static final Logger logger = LoggerFactory.getLogger(Threads.class);
    
    @RequestMapping(value = "/answerSubmit/{tokenId}", method = RequestMethod.POST)
    public RestResponse answerSubmit(@RequestBody @Valid ExamPaperSubmitVM examPaperSubmitVM, @PathVariable String tokenId) {
        logger.info("tokenId:" + tokenId);
        logger.info("itemOrder:" + examPaperSubmitVM.getItemOrder());
        try {
            
            ExamUser user = new ExamUser();
            
            RelatedParty relatedParty = memberService.queryProdidByToken(tokenId);
            
            
            
            List<DataReport> dataReportList = getDemographicDataReport(examPaperSubmitVM, tokenId, user);
            
            Map<Long, QuestionObject> questionObjectMap = getLongQuestionObjectMap(examPaperSubmitVM);
            
            
            setReportInfo(examPaperSubmitVM, relatedParty, dataReportList);
            examPaperSubmitVM.setInterfaceContentList(new ArrayList<>());
            TExamReport tExamReportQuery = new TExamReport();
            tExamReportQuery.setTokenId(tokenId);
            setExamPaperSubTERList(examPaperSubmitVM, tExamReportQuery);
            
            
            
            
            
            Map<String, String> lastContentMap = getLastChioce(examPaperSubmitVM);
            
            Map<String, String> choiceMap = getThisChioce(examPaperSubmitVM);
            
            setQuestionReport(examPaperSubmitVM);
            
            ExamPaperAnswerInfo examPaperAnswerInfo = answerSubmitResult(examPaperSubmitVM, tokenId, relatedParty, user, dataReportList, lastContentMap, choiceMap);
            return RestResponse.ok(examPaperAnswerInfo.getSubmitReport());
        } catch (Exception e) {
            logger.error("{}", e.getMessage(), e);
            TExamReport tExamReportUpdate = new TExamReport();
            tExamReportUpdate.setTokenId(tokenId);
            tExamReportUpdate.setFinish(0);
            List<TExamReport> tExamReportList = examReportService.selectTExamReportList(tExamReportUpdate);
            tExamReportUpdate.setRemark(tExamReportList.get(0).getRemark() + "," + e.getMessage());
            examReportService.updateTExamReportDeleteLastOneByTokenId(tExamReportUpdate);
            throw e;
        }
    }
    private void setExamPaperSubTERList(@RequestBody @Valid ExamPaperSubmitVM examPaperSubmitVM, TExamReport tExamReportQuery) {
        List<TExamReport> tExamReportList = examReportService.selectTExamReportList(tExamReportQuery);
        if (ExamUtil.isListEmpty(tExamReportList)) {
            tExamReportList = new ArrayList<>();
        }
        examPaperSubmitVM.setTExamReportList(tExamReportList);
    }
    private void setRemoteCallReport(ExamPaperSubmitVM examPaperSubmitVM, @PathVariable String tokenId, RelatedParty relatedParty, List<DataReport> dataReportList) {
        List<InterfaceContent> interfaceContentList = examPaperSubmitVM.getInterfaceContentList();
        if (!StringUtils.equals(examPaperSubmitVM.getIsCallTain(), "callTain")) {
            
            setInterfaceContent(examPaperSubmitVM, interfaceContentList);
            return;
        }
        
        Map<String, String> thaiCalculationMap = new HashMap<>();
        MAQReport maqReport = new MAQReport();
        maqReport.setQuestionnaireTaker(relatedParty.getMemberName());
        maqReport.setQuestionnaireID(tokenId);
        maqReport.setReportGenerationDate(DateTimeUtil.dateShortFormat(new Date()));
        thaiCalculationMap.put("P_SDE_T1", "95");
        thaiCalculationMap.put("P_IM_T1", "95");
        thaiCalculationMap.put("P_INCON_T", "95");
        thaiCalculationMap.put("P_INCON_T1", "95");
        thaiCalculationMap.put("P_SDE23", "95");
        thaiCalculationMap.put("P_IM24", "95");
        thaiCalculationMap.put("P_INCON25", "96");
        thaiCalculationMap.put("P_Flex01", "80");
        thaiCalculationMap.put("P_Creat02", "80");
        ReportResultData resultData = maqReport.getTemplateParameters(thaiCalculationMap, Brief, LangTypeEnum.English);
        Map<String, String> thaiDataMap = resultData.getTextMap();
        InterfaceContent interfaceContent = new InterfaceContent();
        interfaceContent.setPartOrder(examPaperSubmitVM.getPartOrder());
        interfaceContent.setDataReportList(new ArrayList<>());
        List<DataReport> iterFDataReportList = interfaceContent.getDataReportList();
        thaiDataMap.forEach((key, value) -> {
            iterFDataReportList.add(new DataReport(key, value, UserTypeEnum.SYS_USER.getUserType(), examPaperSubmitVM.getLangType()));
        });
        
        setInterfaceContent(examPaperSubmitVM, interfaceContentList);
        interfaceContentList.add(interfaceContent);
    }
    private void setInterfaceContent(ExamPaperSubmitVM examPaperSubmitVM, List<InterfaceContent> interfaceContentList) {
        if (ExamUtil.isListNotEmpty(examPaperSubmitVM.getTExamReportList())) {
            List<InterfaceContent> interfaceContentOldList = null;
            String interfaceContentStr = examPaperSubmitVM.getTExamReportList().get(0).getInterfaceContent();
            if (StringUtils.isNotEmpty(interfaceContentStr)) {
                interfaceContentOldList = JsonUtil.toJsonListObject(interfaceContentStr, InterfaceContent.class);
                interfaceContentList.addAll(interfaceContentOldList);
            }
        }
    }
    
    private void setReportInfo(@RequestBody @Valid ExamPaperSubmitVM examPaperSubmitVM, RelatedParty relatedParty, List<DataReport> dataReportList) {
        dataReportList.add(new DataReport("Test Package", relatedParty.getTestName(), "", examPaperSubmitVM.getLangType()));
        dataReportList.add(new DataReport("Test", relatedParty.getProdName(), "", examPaperSubmitVM.getLangType()));
        List<ExamPaperSubmitItemVM> answerItemList = examPaperSubmitVM.getAnswerItems();
        String beginTime = answerItemList.get(0).getStartTime();
        String endTime = answerItemList.get(answerItemList.size() - 1).getEndTime();
        dataReportList.add(new DataReport("Begin Time", beginTime, "", examPaperSubmitVM.getLangType()));
        dataReportList.add(new DataReport("End Time", endTime, "", examPaperSubmitVM.getLangType()));
    }
    
    private Map<String, String> getThisChioce(@RequestBody @Valid ExamPaperSubmitVM examPaperSubmitVM) {
        Map<String, String> choiceMap = new LinkedHashMap<String, String>();
        examPaperSubmitVM.getAnswerItems().stream().forEach(it -> {
            choiceMap.put(it.getItemOrder().toString(), it.getContent());
        });
        return choiceMap;
    }
    
    private Map<String, String> getLastChioce(@RequestBody @Valid ExamPaperSubmitVM examPaperSubmitVM) {
        Map<String, String> lastContentMap = new LinkedHashMap<String, String>();
        examPaperSubmitVM.getAnswerItems().stream().forEach(it -> {
            lastContentMap.put(it.getItemOrder().toString(), it.getLastContent());
        });
        return lastContentMap;
    }
    
    private void setQuestionAndAnswer(@RequestBody @Valid ExamPaperSubmitVM examPaperSubmitVM, String tokenId, RelatedParty relatedParty, List<DataReport> dataReportList, Map<Long, QuestionObject> questionObjectMap) {
        List<QuestionAnswer> questionAnswers = examPaperSubmitVM.getAnswerItems().stream().map(item -> {
            
            QuestionAnswer questionAnswer = new QuestionAnswer();
            QuestionObject questionObject = questionObjectMap.get(item.getQuestionId().longValue());
            try {
                
                questionAnswer.setQuestionItem(item.getItemOrder() + "." + ExamUtil.html2Text(questionObject.getTitleContent()));
                
                questionObject.getQuestionItemObjects().stream().forEach(q -> {
                    if (item.getContent().equals(q.getPrefix())) {
                        questionAnswer.setAnswerItem(q.getContent());
                    }
                });
                
                questionAnswer.setPermanentId(item.getQuestionReport().getPermanentId());
                
                questionAnswer.setPartOrder(item.getQuestionReport().getPartOrder());
            } catch (Exception e) {
            }
            return questionAnswer;
        }).collect(Collectors.toList());
        for (int i = 0; i < questionAnswers.size(); i++) {
            if (StringUtils.isEmpty(questionAnswers.get(i).getAnswerItem())) {
                break;
            }
            
            if (i == 0 || questionAnswers.get(i - 1).getPartOrder() != questionAnswers.get(i).getPartOrder()) {
                if (ExamUtil.isListNotEmpty(examPaperSubmitVM.getInterfaceContentList())) {
                    InterfaceContent interfaceContent = examPaperSubmitVM.getInterfaceContentList().get(0);
                    dataReportList.addAll(interfaceContent.getDataReportList());
                }
            }
            dataReportList.add(new DataReport(questionAnswers.get(i).getPermanentId(), questionAnswers.get(i).getAnswerItem(), UserTypeEnum.SYS_USER.getUserType(), examPaperSubmitVM.getLangType()));
        }
    }
    
    private Map<Long, QuestionObject> getLongQuestionObjectMap(@RequestBody @Valid ExamPaperSubmitVM examPaperSubmitVM) {
        List<Long> questionIdList = examPaperSubmitVM.getAnswerItems().stream().map(i -> {
            return i.getQuestionId().longValue();
        }).collect(Collectors.toList());
        
        List<TQuestion> tQuestionList = questionService.selectTQuestionByIds(questionIdList);
        
        Map<Long, QuestionObject> questionObjectMap = new HashMap<Long, QuestionObject>();
        tQuestionList.stream().forEach(it -> {
            questionObjectMap.put(it.getId(), JSONObject.parseObject(it.getContent(), QuestionObject.class));
        });
        return questionObjectMap;
    }
    
    private Map<String, String> getDemographicReport(@PathVariable String tokenId, ExamUser user) {
        Map<String, String> examInfoMap = new LinkedHashMap<String, String>();
        try {
            List<EntDemographyInfo> entDemographyInfoList = memberService.queryDemographyParamInfo(tokenId);
            
            EntDemographyInfo entDemographyInfo = entDemographyInfoList.get(0);
            user.setId(entDemographyInfo.getMemberId().intValue());
            entDemographyInfoList.stream().forEach(item -> examInfoMap.put(item.getParamName(), item.getParamValue()));
        } catch (Exception e) {
            RelatedParty relatedParty = memberService.queryProdidByToken(tokenId);
            user.setId(relatedParty.getMemberId().intValue());
        }
        return examInfoMap;
    }
    
    private List<DataReport> getDemographicDataReport(ExamPaperSubmitVM examPaperSubmitVM, @PathVariable String tokenId, ExamUser user) {
        List<DataReport> dataReportList = new ArrayList<>();
        try {
            List<EntDemographyInfo> entDemographyInfoList = memberService.queryDemographyParamInfo(tokenId);
            
            EntDemographyInfo entDemographyInfo = entDemographyInfoList.get(0);
            user.setId(entDemographyInfo.getMemberId().intValue());
            entDemographyInfoList.stream().forEach(item -> {
                dataReportList.add(new DataReport(item.getParamName(), item.getParamValue(), "", examPaperSubmitVM.getLangType()));
            });
        } catch (Exception e) {
            RelatedParty relatedParty = memberService.queryProdidByToken(tokenId);
            user.setId(relatedParty.getMemberId().intValue());
        }
        return dataReportList;
    }
    private void setQuestionReport(@RequestBody @Valid ExamPaperSubmitVM examPaperSubmitVM) {
        List<ExamPaperTitleItemVM> titleItems = examPaperSubmitVM.getTitleItems();
        List<ExamPaperSubmitItemVM> anserItems = examPaperSubmitVM.getAnswerItems();
        
        if (Objects.isNull(titleItems)) {
            if (Objects.isNull(anserItems)) {
                return;
            }
            for (ExamPaperSubmitItemVM examPaperSubmitItemVM : anserItems) {
                QuestionReport questionReport = examPaperSubmitItemVM.getQuestionReport();
                questionReport.setId(questionReport.getQuestionOrder() + 1);
                questionReport.setTimeSpent(ExamUtil.timeSpent(DateTimeUtil.parseToOften(questionReport.getStartTime()), DateTimeUtil.parseToOften(questionReport.getEndTime())));
            }
            
        } else {
            for (ExamPaperTitleItemVM examPaperTitleItemVM : titleItems) {
                
                QuestionReport questionReport = examPaperTitleItemVM.getQuestionReport();
                questionReport.setId(questionReport.getQuestionOrder() + 1);
                questionReport.setTimeSpent(ExamUtil.timeSpent(DateTimeUtil.parseToOften(questionReport.getStartTime()), DateTimeUtil.parseToOften(questionReport.getEndTime())));
            }
        }
    }
    private ExamPaperAnswerInfo answerSubmitResult(@RequestBody @Valid ExamPaperSubmitVM examPaperSubmitVM, @PathVariable String tokenId, RelatedParty relatedParty, ExamUser user, List<DataReport> dataReportList, Map<String, String> lastContentMap, Map<String, String> choiceMap) {
        TExamReport tExamReport = new TExamReport();
        TExamReport tExamReportQuery = new TExamReport();
        tExamReport.setContent(JSON.toJSON(dataReportList).toString());
        tExamReport.setProductId(examPaperSubmitVM.getId().longValue());
        tExamReport.setQuestionReport(getQuestionReportsJson(examPaperSubmitVM));
        ExamPaperAnswerInfo examPaperAnswerInfo = examPaperAnswerService.calculateExamPaperAnswer(examPaperSubmitVM, user);
        TExamPaper examPaper = examPaperAnswerInfo.getExamPaper();
        tExamReport.setProductName(examPaper.getName());
        tExamReport.setTokenId(tokenId);
        tExamReport.setStates("1");
        tExamReport.setLastContent(JSON.toJSON(lastContentMap).toString());
        tExamReport.setChoice(JSON.toJSON(choiceMap).toString());
        tExamReport.setDoTime(examPaperSubmitVM.getDoTime());
        tExamReport.setLangType(examPaperSubmitVM.getLangType());
        
        setAutoSendReportStatus(relatedParty, tExamReport);
        BeanUtils.copyBeanProp(tExamReportQuery, tExamReport);
        tExamReportQuery.setProductId(null);
        tExamReportQuery.setProductName(null);
        List<TExamReport> tExamReportList = examPaperSubmitVM.getTExamReportList();
        
        
        tExamReport.setQuestionCount(0);
        
        tExamReport.setMemberId(relatedParty.getMemberId().intValue());
        
        tExamReport.setUserId(relatedParty.getUser_id());
        
        tExamReport.setParentId(relatedParty.getUser_parent_id());
        
        tExamReport.setTestId(relatedParty.getTestId());
        
        tExamReport.setFinish(examPaperSubmitVM.getFinish());
        setVerifyStatus(examPaperSubmitVM, tExamReport);
        
        tExamReport.setQuestionTemplateId(relatedParty.getQuestionTemplateId());
        
        tExamReport.setQuestionOrder(JSON.toJSONString(examPaperSubmitVM.getQuestionOrder()));
        
        tExamReport.setOptionOrder(JSON.toJSONString(examPaperSubmitVM.getOptionOrder()));
        
        tExamReport.setMemberName(relatedParty.getMemberName());
        
        tExamReport.setReportTemplateId(relatedParty.getReportTemplateId());
        
        
        setRemainPartTime(examPaperSubmitVM, tExamReport, tExamReportList);
        
        updateTExamReport(examPaperSubmitVM, tokenId, relatedParty, tExamReport, tExamReportList);
        
        callThaiInteface(examPaperSubmitVM, tokenId, tExamReport, examPaperAnswerInfo);
        return examPaperAnswerInfo;
    }
    private void updateTExamReport(@RequestBody @Valid ExamPaperSubmitVM examPaperSubmitVM, @PathVariable String tokenId, RelatedParty relatedParty, TExamReport tExamReport, List<TExamReport> tExamReportList) {
        
        if (Objects.isNull(relatedParty.getStartTime())) {
            entTestMemberService.updateTestMemberStatus(TestMemberStatusEnum.answering, memberService.queryProdidByToken(tokenId).getMemberId());
        }
        if (tExamReportList.size() > 0) {
            
            examReportService.updateTExamReportByTokenId(tExamReport);
        } else {
            examReportService.insertTExamReport(tExamReport);
        }
        
        if (!Objects.isNull(examPaperSubmitVM.getFinish())) {
            
            checkCaqQuestionItem(tExamReport);
            
            TestMemberStatusEnum testMemberStatusEnum = TestMemberStatusEnum.codeOf(examPaperSubmitVM.getFinish().toString());
            if (Objects.equals(Integer.parseInt(TestMemberStatusEnum.completed.getCode()), tExamReport.getVerifyStatus())) {
                testMemberStatusEnum = TestMemberStatusEnum.completed;
            }
            entTestMemberService.updateTestMemberStatus(testMemberStatusEnum, tExamReport.getMemberId());
        }
    }
    private void checkCaqQuestionItem(TExamReport tExamReport) {
        if (!Objects.equals(tExamReport.getQuestionTemplateId(), "job")) {
            return;
        }
        List<QuestionReport> questionReportList = JsonUtil.parseArray(tExamReport.getQuestionReport(), QuestionReport.class);
        for (QuestionReport questionReport : questionReportList) {
 
            List<QuestionEditRequestVM> questionItems = questionReport.getQuestionItems();
        }
    }
    private void setVerifyStatus(@RequestBody @Valid ExamPaperSubmitVM examPaperSubmitVM, TExamReport tExamReport) {
        if (Objects.equals(examPaperSubmitVM.getFinish(), 6)) {
            tExamReport.setVerifyStatus(Integer.parseInt(TestMemberStatusEnum.timeOut.getCode()));
        } else {
            
            tExamReport.setVerifyStatus(examPaperSubmitVM.getVerifyStatus());
        }
    }
    private void setRemainPartTime(@RequestBody @Valid ExamPaperSubmitVM examPaperSubmitVM, TExamReport tExamReport, List<TExamReport> tExamReportList) {
        if (Objects.isNull(examPaperSubmitVM.getRemainTime())) {
            return;
        }
        Map<Integer, Integer> remainPartTimeMap = null;
        if (tExamReportList.size() > 0) {
            remainPartTimeMap = JsonUtil.parseObject(tExamReportList.get(0).getRemainPartTime(), HashMap.class);
        } else {
            remainPartTimeMap = new HashMap<>();
        }
        remainPartTimeMap.put(examPaperSubmitVM.getPartOrder(), examPaperSubmitVM.getRemainTime());
        tExamReport.setRemainPartTime(JsonUtil.toJSONString(remainPartTimeMap));
    }
    private void callThaiInteface(ExamPaperSubmitVM examPaperSubmitVM, @PathVariable String tokenId, TExamReport tExamReport, ExamPaperAnswerInfo examPaperAnswerInfo) {
        if (Objects.equals(examPaperSubmitVM.getIsCallTain(), "CallThai")) {
            SignalObject signalObject = examPaperService.callTaiData(tokenId, tExamReport.getLangType(), examPaperSubmitVM);
            SubmitReport submitReport = examPaperAnswerInfo.getSubmitReport();
            submitReport.setSignalObject(signalObject);
        }
    }
    
    private void setAutoSendReportStatus(RelatedParty relatedParty, TExamReport tExamReport) {
        
        if (relatedParty.isAutoSendReport()) {
            tExamReport.setSendHrStatus(send.getCode());
            tExamReport.setSendTesterStatus(send.getCode());
            tExamReport.setReportTemplateId(relatedParty.getReportTemplateId());
        } else {
            tExamReport.setSendHrStatus(noSend.getCode());
            tExamReport.setSendTesterStatus(noSend.getCode());
        }
    }
    
    private String getQuestionReportsJson(@RequestBody @Valid ExamPaperSubmitVM examPaperSubmitVM) {
        List<ExamPaperTitleItemVM> titleItems = examPaperSubmitVM.getTitleItems();
        List<ExamPaperSubmitItemVM> answerItems = examPaperSubmitVM.getAnswerItems();
        List<QuestionReport> questionReportList = null;
        if (Objects.isNull(titleItems)) {
            if (Objects.isNull(answerItems)) {
                return "";
            }
            questionReportList = answerItems.stream().map(answer -> {
                return answer.getQuestionReport();
            }).collect(Collectors.toList());
        } else {
            questionReportList = titleItems.stream().map(title -> {
                return title.getQuestionReport();
            }).collect(Collectors.toList());
        }
        return JsonUtil.toJsonStr(questionReportList);
    }
    
    @RequestMapping(value = "/updateTestMemberStatus/{tokenId}", method = RequestMethod.POST)
    public RestResponse updateTestMemberStatus(@PathVariable String tokenId) {
        entTestMemberService.updateTestMemberStatus(TestMemberStatusEnum.answering, memberService.queryProdidByToken(tokenId).getMemberId());
        return RestResponse.ok();
    }
}