word文档导入案例题,求救啊

故冗 2025-12-01 22:29:08

这个是word解析文档的题目代码,
    /**
     * word导入试题-有返回值
     *
     * @param wordFile      导入文件
     * @param catalogId 题库ID
     * @return 处理结果
     */
    @Transactional(rollbackFor = Exception.class)
    public Result<CrmQuestionInfoWordImportParseResp> importWordResultQuestion(MultipartFile wordFile, Long catalogId) {
        FeignEnterpriseUserInfoResp enterpriseUserInfo = checkAndReturnUserBaseInfo(ThreadContext.eid(), ThreadContext.userNo());
        if (ObjectUtil.isNull(enterpriseUserInfo)) {
            return Result.error(toI18n("user.enterprise.user.not.exist"));
        }
        if (!StatusIdEnum.YES.getCode().equals(enterpriseUserInfo.getStatusId())) {
            return Result.error(toI18n("user.enterprise.user.status.error"));
        }
        if (wordFile.getSize() > MAX_FILE_SIZE) {
            return Result.error("导入文档大小超出100M,请调整后重新导入");
        }
        XWPFDocument document = null;
        CrmQuestionInfoWordImportParseResp crmQuestionInfoWordImportParseResp =new CrmQuestionInfoWordImportParseResp();
        String originalFilename = wordFile.getOriginalFilename();
        crmQuestionInfoWordImportParseResp.setFileName(originalFilename);
        List<CrmQuestionInfoWordResp> questionInfoWordRespList = new ArrayList<>();
        //导入失败的题目和原因
        Map<CrmQuestionInfoWordResp,String> crmQuestionInfoWordImportFailMap =new Hashtable<>();
        int successCount = 0;
        int failureCount = 0;
        try {
            document = new XWPFDocument(wordFile.getInputStream());
            XWPFWordExtractor extractor = new XWPFWordExtractor(document);
            List<XWPFParagraph> xWPFParagraphs = document.getParagraphs();
            int startIndex = 1;
            int number = 1;
            boolean stopFlag = true;
            String searchString = "(以上文字会自动忽略,请勿删除,否则会导入不成功)#】";
            boolean found = false;
            for (int i = 0; i < xWPFParagraphs.size(); i++) {
                if(!stopFlag)break;
                String paraText = xWPFParagraphs.get(i).getText();
                if (!found && paraText.contains(searchString)) {
                    found = true;
                    startIndex = i;
                }
                //文件不包含说明
                if(!found && i == xWPFParagraphs.size()-1){
                    found = true;
                    startIndex = 0;
                    i=0;
                }
                if (found) {
                    String title = null;
                    CrmQuestionInfoWordResp questionInfo = new CrmQuestionInfoWordResp();
                    //单选、多选、判断 选项list
                    List<QuestionOption> _quesionOptions = new ArrayList<QuestionOption>();
                    //单选、多选、判断map key选项 value答案
                    Map<String, String> optionMap = new HashMap<String, String>();
                    //答案list
                    List<String> answerList = new ArrayList<String>();
                    //答案选项list
                    List<String> questionOptionList =new ArrayList<>();
                    //图片map key图片名称 value图片路径
                    Map<String, CrmQuestionInfoWordImageResp> images = new HashMap<>();
                    //解析里的图片
                    Map<String, CrmQuestionInfoWordImageResp> analysisImages = new HashMap<>();
                    Map<String, Boolean> completeItemMap = new HashMap<String, Boolean>();
                    completeItemMap.put(questionAnalysis, Boolean.FALSE);
                    completeItemMap.put(questionAnswer, Boolean.FALSE);
                    completeItemMap.put(knowledgePoint, Boolean.FALSE);
                    completeItemMap.put(difficultyLevel, Boolean.FALSE);
                    completeItemMap.put(questionOptions, Boolean.FALSE);
                    completeItemMap.put(questionContent, Boolean.FALSE);
                    int nextIndex = startIndex;
                    String currentItem = "";
                    while (true) {
                        if (nextIndex >= xWPFParagraphs.size()) break;
                        if (isParseFinished(completeItemMap)) {
                            log.debug("解析完成");
                            break;
                        }
                        XWPFParagraph xWPFParagraph = xWPFParagraphs.get(nextIndex);
                        //含题号的题目
                        String orgText = xWPFParagraph.getText();
                        log.debug(orgText);
                        List<XWPFPicture> pictures = xWPFParagraph.getRuns().stream()
                                .filter(run -> run instanceof XWPFRun)
                                .map(run -> (XWPFRun) run)
                                .flatMap(run -> run.getEmbeddedPictures().stream())
                                .collect(Collectors.toList());
                        if (StringUtil.isNotBlank(orgText)) {
                            //题干
                            String text = orgText;
                            //todo 解决上一道题目结构缺失的情况 将解析失败的题目暂存,放到失败提示中
//                            if(textQuestionType(text)){
//                                title = null;
//                            }
                            if (StringUtils.isBlank(title)) {
                                //此处因为最大1000道题所以判断前5位
                                if(CharUtil.isNumber(text.charAt(0))&&text.substring(0, 4).contains("、")){
                                    String substring = text.substring(0, text.indexOf("、"));
                                    questionInfo.setNumber(substring);
                                }else if(CharUtil.isNumber(text.charAt(0))&&text.substring(0, 4).contains(".")){
                                    String substring = text.substring(0, text.indexOf("."));
                                    questionInfo.setNumber(substring);
                                }else if(CharUtil.isNumber(text.charAt(0))&&text.substring(0, 4).contains(".")){
                                    String substring = text.substring(0, text.indexOf("."));
                                    questionInfo.setNumber(substring);
                                }
                                text = getQuestionText(text);
                                log.debug("不含题号的题目:{}",text);
                                QuestionTypeWordEnum questionTypeWord = whichQuestionType(text);
                                boolean aNull = ObjectUtil.isNull(questionTypeWord);
                                if(aNull){
                                    nextIndex = nextIndex + 1;
                                    continue;
                                }
                                questionInfo.setQuestionType(questionTypeWord.getCode());
                                title = text.replaceFirst(questionTypeWord.getName(), "");
                                title =  StringUtils.isBlank(title)?"【空】":title;
                                questionInfo.setQuestionTitle(title);
                                completeItemMap.put(questionContent, Boolean.TRUE);
                                log.debug("题目内容:{}",title);
                                currentItem = questionContent;
                            } else {
                                //题目选项
                                if (questionInfo.getQuestionType().equals(QuestionTypeWordEnum.SINGLE.getCode()) || questionInfo.getQuestionType().equals(QuestionTypeWordEnum.MULTIPLE.getCode()) || questionInfo.getQuestionType().equals(QuestionTypeWordEnum.ESTIMATE.getCode())) {
                                    if(text.length()>1){
                                        if (options.contains(text.substring(0, 2))||options2.contains(text.substring(0, 2))||options3.contains(text.substring(0, 2))) {
                                            QuestionOption questionOption = new QuestionOption();
                                            questionOption.setOptionContent(text.substring(2, text.length()));
                                            _quesionOptions.add(questionOption);
                                            optionMap.put(text.substring(0, 1), questionOption.getOptionContent());
                                            questionOption.setSort(_quesionOptions.size() - 1);
                                            log.debug("试题选项:{}", JSONObject.toJSONString(questionOption));
                                            completeItemMap.put(questionOptions, Boolean.TRUE);
                                            currentItem = questionOptions;
                                        }
                                    }
                                } else {
                                    completeItemMap.put(questionOptions, Boolean.TRUE);
                                    currentItem = questionOptions;
                                }
                                //答案
                                if (questionInfo.getQuestionType().equals(QuestionTypeWordEnum.SINGLE.getCode()) || questionInfo.getQuestionType().equals(QuestionTypeWordEnum.MULTIPLE.getCode()) || questionInfo.getQuestionType().equals(QuestionTypeWordEnum.ESTIMATE.getCode())) {
                                    if (text.startsWith(CrmQuestionInfoBiz.questionAnswer + CrmQuestionInfoBiz.CHINESE_COLON)||text.startsWith(CrmQuestionInfoBiz.questionAnswer + CrmQuestionInfoBiz.ENGLISH_COLON)) {
                                        String answer;
                                        if(text.startsWith(CrmQuestionInfoBiz.questionAnswer + CrmQuestionInfoBiz.CHINESE_COLON)){
                                            answer= text.replaceFirst(CrmQuestionInfoBiz.questionAnswer + CrmQuestionInfoBiz.CHINESE_COLON, "").replace(",","");
                                        }else{
                                            answer = text.replaceFirst(CrmQuestionInfoBiz.questionAnswer + CrmQuestionInfoBiz.ENGLISH_COLON, "").replace(",","");;
                                        }
                                        if (QuestionTypeEnum.ESTIMATE.getCode().equals(questionInfo.getQuestionType()) && answer.matches("[a-zA-Z]+")){
                                            String lowerCase = answer.toLowerCase();
                                            // 将首字母大写
                                            lowerCase = Character.toUpperCase(lowerCase.charAt(0)) + lowerCase.substring(1);
                                            answer = lowerCase;
                                        }
                                        answer.replace(" ","");
                                        for (int a = 0; a < answer.length(); a++) {
                                            String answerOption = String.valueOf(answer.charAt(a));
                                            questionOptionList.add(answerOption);
                                            answerList.add(optionMap.isEmpty()?"":optionMap.get(answerOption));
//                                        answerList.add(answerOption);
                                        }
                                        log.debug("答案list:{}",JSONObject.toJSONString(answerList));
                                        completeItemMap.put(questionAnswer, Boolean.TRUE);
                                        currentItem = questionAnswer;
                                    }
                                    //填空题
                                } else if (questionInfo.getQuestionType() == QuestionTypeWordEnum.FILL.getCode()) {
                                    if (text.startsWith(CrmQuestionInfoBiz.questionAnswer + CrmQuestionInfoBiz.CHINESE_COLON)||text.startsWith(CrmQuestionInfoBiz.questionAnswer + CrmQuestionInfoBiz.ENGLISH_COLON)) {
                                        String answer;
                                        if(text.startsWith(CrmQuestionInfoBiz.questionAnswer + CrmQuestionInfoBiz.CHINESE_COLON)){
                                            answer= text.replaceFirst(CrmQuestionInfoBiz.questionAnswer + CrmQuestionInfoBiz.CHINESE_COLON, "");
                                        }else{
                                            answer = text.replaceFirst(CrmQuestionInfoBiz.questionAnswer + CrmQuestionInfoBiz.ENGLISH_COLON, "");;
                                        }
                                        Pattern pattern = Pattern.compile(regex);
                                        Matcher matcher = pattern.matcher(answer);
                                        while (matcher.find()) {
                                            String match = matcher.group(1);
                                            answerList.add(match);
                                        }
                                        completeItemMap.put(questionAnswer, Boolean.TRUE);
                                        currentItem = questionAnswer;
                                    }
                                    //简答题
                                }else if (questionInfo.getQuestionType().equals(QuestionTypeWordEnum.SHORT_ANSWER.getCode())) {
                                    if (text.startsWith(CrmQuestionInfoBiz.questionAnswer + CrmQuestionInfoBiz.CHINESE_COLON)||text.startsWith(CrmQuestionInfoBiz.questionAnswer + CrmQuestionInfoBiz.ENGLISH_COLON)) {
                                        String answer;
                                        if(text.startsWith(CrmQuestionInfoBiz.questionAnswer + CrmQuestionInfoBiz.CHINESE_COLON)){
                                            answer= text.replaceFirst(CrmQuestionInfoBiz.questionAnswer + CrmQuestionInfoBiz.CHINESE_COLON, "");
                                        }else{
                                            answer = text.replaceFirst(CrmQuestionInfoBiz.questionAnswer + CrmQuestionInfoBiz.ENGLISH_COLON, "");;
                                        }
                                        answerList.add(answer);
                                        completeItemMap.put(questionAnswer, Boolean.TRUE);
                                        currentItem = questionAnswer;
                                    }
                                }else{
                                    //不是已知题型
                                    //存入选项、答案、解析、知识点、难易程度
                                    crmQuestionInfoWordImportFailMap.put(questionInfo,"当前题型不是已知题型");
                                    failureCount++;
                                }

                                //解析
                                if (text.startsWith(CrmQuestionInfoBiz.questionAnalysis + CrmQuestionInfoBiz.ENGLISH_COLON)||text.startsWith(CrmQuestionInfoBiz.questionAnalysis + CrmQuestionInfoBiz.CHINESE_COLON)) {
                                    if(text.startsWith(CrmQuestionInfoBiz.questionAnalysis + CrmQuestionInfoBiz.ENGLISH_COLON)){
                                        questionInfo.setQuestionAnalysis(text.replaceFirst(CrmQuestionInfoBiz.questionAnalysis + CrmQuestionInfoBiz.ENGLISH_COLON, ""));
                                    }else{
                                        questionInfo.setQuestionAnalysis(text.replaceFirst(CrmQuestionInfoBiz.questionAnalysis + CrmQuestionInfoBiz.CHINESE_COLON, ""));
                                    }
                                    log.debug(questionInfo.getQuestionAnalysis());
                                    completeItemMap.put(questionAnalysis, Boolean.TRUE);
                                    currentItem = questionAnalysis;
                                }
                                //难易程度
                                if (text.startsWith(CrmQuestionInfoBiz.difficultyLevel + CrmQuestionInfoBiz.ENGLISH_COLON)||text.startsWith(CrmQuestionInfoBiz.difficultyLevel + CrmQuestionInfoBiz.CHINESE_COLON)) {
                                    if(text.startsWith(CrmQuestionInfoBiz.difficultyLevel + CrmQuestionInfoBiz.ENGLISH_COLON)){
                                        questionInfo.setDifficultyLevel(whichDifficultyLevel(text.replaceFirst(CrmQuestionInfoBiz.difficultyLevel + CrmQuestionInfoBiz.ENGLISH_COLON, "").trim()));
                                    }else{
                                        questionInfo.setDifficultyLevel(whichDifficultyLevel(text.replaceFirst(CrmQuestionInfoBiz.difficultyLevel + CrmQuestionInfoBiz.CHINESE_COLON, "").trim()));
                                    }
                                    log.debug("" + questionInfo.getDifficultyLevel());
                                    completeItemMap.put(difficultyLevel, Boolean.TRUE);
                                    currentItem = difficultyLevel;
                                    //解析完成还没有选项则跳过
                                    if(optionMap.isEmpty()){
                                        completeItemMap.put(questionOptions, Boolean.TRUE);
                                    }
                                }

                                //知识点
                                if (text.startsWith(CrmQuestionInfoBiz.knowledgePoint + CrmQuestionInfoBiz.ENGLISH_COLON)||text.startsWith(CrmQuestionInfoBiz.knowledgePoint + CrmQuestionInfoBiz.CHINESE_COLON)) {
                                    if(text.startsWith(CrmQuestionInfoBiz.knowledgePoint + CrmQuestionInfoBiz.ENGLISH_COLON)){
                                        questionInfo.setKnowledgePoint(text.replaceFirst(CrmQuestionInfoBiz.knowledgePoint + CrmQuestionInfoBiz.ENGLISH_COLON, ""));
                                    }else{
                                        questionInfo.setKnowledgePoint(text.replaceFirst(CrmQuestionInfoBiz.knowledgePoint + CrmQuestionInfoBiz.CHINESE_COLON, ""));
                                    }
                                    log.debug(questionInfo.getKnowledgePoint());
                                    completeItemMap.put(knowledgePoint, Boolean.TRUE);
                                    currentItem = knowledgePoint;
                                }

                                if (currentItem.equals(knowledgePoint)) {
                                    questionInfo.setKnowledgePoint(questionInfo.getKnowledgePoint());
                                }

                                if (currentItem.equals(questionAnalysis)) {
                                    questionInfo.setQuestionAnalysis(questionInfo.getQuestionAnalysis());
                                }

                            }
                        }
                        //是图片才进来
                        else if(CollectionUtil.isNotEmpty(pictures)){
                            for (XWPFPicture picture : pictures) {
                                XWPFPictureData xWPFPictureData = picture.getPictureData();
                                if(StringUtils.isBlank(title)){
                                    continue;
                                }
                                String fileName = xWPFPictureData.getFileName();
                                File tempFile = File.createTempFile(fileName, fileName.substring(fileName.indexOf(".")));
                                FileOutputStream file = new FileOutputStream(tempFile);
                                file.write(xWPFPictureData.getData());
                                file.close();
                                FeignSysConfigStorageResp sysConfigStorage = feignSysConfig.getStorage(ThreadContext.eid());
//                                FeignSysConfigStorageResp sysConfigStorage = feignSysConfig.getStorage(1746842294465658881L);
                                // 上传文件
                                // 记录原始minio外网地址
                                String minioFileDomainUrl = sysConfigStorage.getMinioFileDomain();
                                //2024-11-21生产环境文件下载地址替换内网地址
                                sysConfigStorage.setMinioFileDomain(sysConfigStorage.getMinioEndpoint());
                                String fileUrl = UploadManage.uploadPic(tempFile, sysConfigStorage);
                                if (StringUtils.isBlank(fileUrl)) {
                                    log.error("图片上传失败,返回文件Url为空,存储平台:{}", sysConfigStorage.getStoragePlatform());
                                }
//                            images.add(title + "_" + questionInfo.getNumber() + "_" + fileName);
                                CrmQuestionInfoWordImageResp crmQuestionInfoWordImageResp = new CrmQuestionInfoWordImageResp();
                                if(!sysConfigStorage.getMinioEndpoint().equals(minioFileDomainUrl)){
                                    fileUrl = fileUrl.replace(sysConfigStorage.getMinioEndpoint(), minioFileDomainUrl);
                                }
                                crmQuestionInfoWordImageResp.setUrl(fileUrl);
                                crmQuestionInfoWordImageResp.setResourceSize(Math.toIntExact(tempFile.length()));
                                //存放解析图片
                                if(currentItem.equals(questionAnalysis)){
                                    analysisImages.put(fileName,crmQuestionInfoWordImageResp);
                                }else{
                                    images.put(fileName,crmQuestionInfoWordImageResp);
                                }
                                completeItemMap.put(questionContent, Boolean.TRUE);
                            }
                        }

                        nextIndex = nextIndex + 1;
                    }

                    if (StringUtil.isNotBlank(questionInfo.getQuestionTitle())) {
                        String answerStr = "";
                        for (int t = 0; t < answerList.size(); t++) {
                            answerStr = answerStr + answerList.get(t);
                            if (t < answerList.size() - 1) {
                                answerStr = answerStr + "|";
                            }
                        }
                        questionInfo.setQuestionAnswer(answerStr);
                        String optionStr = "";
                        for (int t = 0; t < questionOptionList.size(); t++) {
                            optionStr = optionStr + questionOptionList.get(t);
                            if (t < questionOptionList.size() - 1) {
                                optionStr = optionStr + ",";
                            }
                        }
                        questionInfo.setQuestionOptions(optionStr);

                        //<p>请找出下图中存在的安全隐患( )。<img src="http://47.92.37.104:59001/online-education/1746842294465658881/public/8337e2b961a348e988e9bf69a004f1e6.png" alt="图片1.png" contenteditable="false" style="font-size: 14px;"/></p>
                        if (images.entrySet().size() > 0) {
                            String tmp = questionInfo.getQuestionTitle();
                            String imageContent = "";
                            for (Map.Entry<String, CrmQuestionInfoWordImageResp> entry : images.entrySet()) {
                                String imageItem = "<br><img src=\"" + entry.getValue().getUrl() + "\" alt=\"" + entry.getKey() + "\" contenteditable=\"false\" style=\"font-size: 14px;\"/>";
                                imageContent = imageContent + imageItem;
                            }
                            questionInfo.setQuestionTitle("<p>" + tmp + imageContent + "</p>");
                        }
                        if (analysisImages.entrySet().size() > 0) {
                            String tmp = questionInfo.getQuestionAnalysis();
                            String imageContent = "";
                            for (Map.Entry<String, CrmQuestionInfoWordImageResp> entry : analysisImages.entrySet()) {
                                String imageItem = "<br><img src=\"" + entry.getValue().getUrl() + "\" alt=\"" + entry.getKey() + "\" contenteditable=\"false\" style=\"font-size: 14px;\"/>";
                                imageContent = imageContent + imageItem;
                            }
                            questionInfo.setQuestionAnalysis("<p>" + tmp + imageContent + "</p>");
//                            images.putAll(analysisImages);
                        }
                        questionInfo.setOptionMap(optionMap);
                        questionInfo.setCatalogId(catalogId);
                        questionInfo.setImages(images);
                        questionInfo.setAnalysisImages(analysisImages);
                    }
                    log.debug("第 " + number + " 题");
                    startIndex=nextIndex;
                    number++;
                    //排除文件后面空格
                    if(StringUtil.isNotBlank(questionInfo.getQuestionTitle())){
                        if(questionInfoWordRespList.size() == MAXIMUM_QUANTITY){
                            log.debug("题目数量达到上限");
                            stopFlag=false;
                            continue;
                        }

                        //校验导入成功或失败 失败的不返回
                        String check = this.checkWordImportLecturerInfo(questionInfo);
                        if (StrUtil.isBlank(check)) {
                            successCount++;
                            questionInfoWordRespList.add(questionInfo);
                        } else {
                            crmQuestionInfoWordImportFailMap.put(questionInfo,check);
                            failureCount++;
                        }
                    }
                }
            }
            extractor.close();
        } catch (FileNotFoundException e) {
            log.error(String.valueOf(e));
        } catch (IOException e) {
            log.error(String.valueOf(e));
        } finally {
            if (document != null)
                try {
                    document.close();
                } catch (IOException e) {
                    log.error(String.valueOf(e));
                }
        }

        String key = "category::course::number";
        myRedisTemplate.delete(key);

        String importToken = wordCacheParseInfo(questionInfoWordRespList, catalogId);
        //解析失败的存储题目、原因后上传文件服务器返回url供前端下载
        String importFailUrl = wordImportFailHandle(crmQuestionInfoWordImportFailMap);
        crmQuestionInfoWordImportParseResp.setCrmQuestionInfoWordRespList(questionInfoWordRespList);
        crmQuestionInfoWordImportParseResp.setImportToken(importToken);
        crmQuestionInfoWordImportParseResp.setSuccessCount(successCount);
        crmQuestionInfoWordImportParseResp.setFailureCount(failureCount);
        crmQuestionInfoWordImportParseResp.setImportFailUrl(importFailUrl);
        return Result.success(crmQuestionInfoWordImportParseResp);
    }
    
这个是解析题目的属性类
package com.roncoo.education.exam.service.crm.resp;


import io.swagger.annotations.ApiModel;
import lombok.Data;
import lombok.experimental.Accessors;


import java.util.HashMap;
import java.util.List;
import java.util.Map;


@Data
@Accessors(chain = true)
@ApiModel(description = "word试题信息解析结果")
public class CrmQuestionInfoWordResp {


    /**
     * 序号
     */
    private String number;


    /**
     * 目录ID
     */
    private Long catalogId;


    /**
     * 题目类型(1:单选题、2:多选题、3:判断题、4:填空题、5:简答题)
     */
    private Integer questionType;


    /**
     * 难度等级(1:简单、2:一般、3:较难、4:困难)
     */
    private Integer difficultyLevel;


    /**
     * 题目内容
     */
    private String questionTitle;


    /**
     * 答案选项
     */
    private String questionOptions;


    /**
     * 题目答案
     */
    private String questionAnswer;


    /**
     * 题目解析
     */
    private String questionAnalysis;


    /**
     * 知识点
     */
    
    /**
     * 选项集合
     */
    private Map<String, String
//    private List<String> 
    private Map<String, CrmQuestionInfoWordImageResp> images;
    private Map<String, CrmQuestionInfoWordImageResp> analysisImages;


    /**
     * 案例小题内容
     */
    private List<CrmQuestionInfoWordResp> caseInfo;


}
把案例题按照普通题来进行解析,案例题的案例内容就是questionTitle,选项值没有就没有,然后把案例小题小题按照原来普通题的样子保存在caseInfo这个列表里面,casetype值为7
我案例题的格式是这样的
9、【案例题】阅读以下内容,并完成小题。
老屋的钥匙
母亲从包里掏出一个小布包,层层打开,里面是一把锈迹斑斑的铜钥匙。“这是老屋的钥匙,”她轻声说,“你拿着吧。”
我接过钥匙,冰凉的触感瞬间勾起了无数回忆。老屋其实并不老,只是我们搬离后,它在岁月里慢慢旧了下去。我记得那扇墨绿色的木门,锁孔周围满是划痕。小时候,我总够不着锁孔,需要踮起脚尖,费力地将钥匙塞进去,再“咔嚓”一声,推开一个充满饭菜香味和温暖灯光的世界。
后来,我长大了,能轻易地打开那扇门,却越来越晚地回家。锁孔前的身影,从焦急等待的孩子,变成了倚门张望的父母。那“咔嚓”一声,对他们而言,是世界上最动听的音乐。
我们搬进新家后,老屋就租了出去。如今,租客也搬走了,老屋即将被拆除,这里要建一座新的公园。这把钥匙,或许是它存在过的唯一证明。
我摩挲着钥匙上的锈迹,它曾经那么光亮,被无数次的紧握磨得光滑温润。现在,它冷了,锈了,像一段凝固的旧时光。我知道,即使拿着这把钥匙,我也再也打不开那扇门了——无论是那扇真实的、即将消失的木门,还是那扇通往无忧无虑童年的、无形的门。
9-1、【单选题】该篇短文运用了什么修辞手法?
A.比喻
B.拟人
C.无
D.无
答案:A
解析:运用了比喻的修辞手法,将开门声比作音乐,生动形象地写出了父母听到孩子回家时的喜悦与安心,表现了父母对子女深沉的爱与牵挂
知识点:
难易程度:一般
9-2、【多选题】文中表达了作者怎么的感情
A.思念
B.怀念
C.想念
D.无
答案:A,B,C
解析:无
知识点:
难易程度:一般

我想要的结构是这样
{
  "number": "9",
  "questionType": 7,
  "questionTitle": "【案例题】阅读以下内容,并完成小题。老屋的钥匙母亲从包里掏出一个小布包...(完整案例文本)",
  "catalogId": 123,
  "difficultyLevel": null, // 案例题可无难度等级(或按需解析)
  "questionOptions": "", // 案例题无选项
  "questionAnswer": "", // 案例题无答案
  "questionAnalysis": "", // 案例题可无解析
  "knowledgePoint": "", // 案例题可无知识点
  "optionMap": {},
  "images": {},
  "analysisImages": {},
  "caseInfo": [
    {
      "number": "9-1",
      "questionType": 1,
      "questionTitle": "该篇短文运用了什么修辞手法?",
      "questionOptions": "A,B,C,D",
      "questionAnswer": "比喻",
      "questionAnalysis": "运用了比喻的修辞手法...",
      "knowledgePoint": "",
      "difficultyLevel": 2,
      "optionMap": {
        "A": "比喻",
        "B": "拟人",
        "C": "无",
        "D": "无"
      },
      // 其他字段...
    },
    {
      "number": "9-2",
      "questionType": 2,
      "questionTitle": "文中表达了作者怎么的感情",
      "questionOptions": "A,B,C,D",
      "questionAnswer": "思念|怀念|想念",
      "questionAnalysis": "无",
      // 其他字段...
    }
  ]
}
怎么才能实现啊

...全文
18 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

108

社区成员

发帖
与我相关
我的任务
社区描述
全栈领域基础知识共享社区。 前端基础知识和前端常用的框架、后端知识和后端常用的框架。linux方面的相关知识、jvm相关的知识、数据库相关的知识。目的是分享知识、对新手小白很友好
前端后端微信小程序 个人社区 广东省·广州市
社区管理员
  • 乡下小哥编程
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧