Эх сурвалжийг харах

Merge branch 'dev-v5.2' into dev

he2802 3 жил өмнө
parent
commit
c9523f07e7

+ 69 - 71
zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/service/impl/QuestionServiceImpl.java

@@ -911,7 +911,7 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
                 String qContent = ""; //题目正文
                 String answerQuestion = null; //答案
                 String analysisContent = ""; //解析文本
-                int index = 1; //题目序列号
+                int index = 0; //题目序列号
                 List<QuestionBusinessAddBo> businessList = new ArrayList<>();
                 QuestionBusinessAddBo questionBusinessAddBo = new QuestionBusinessAddBo();
                 questionBusinessAddBo.setEducationTypeId(eduId);
@@ -929,6 +929,7 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
                 String strContent = "";
                 String imgUrl  = null;
                 boolean hasQuestion = false;
+                boolean hasError = false;
                 for (XWPFParagraph paragraph : paragraphList) {
                     content = paragraph.getText();
                     content = dealTxt(content);
@@ -984,54 +985,57 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
                     }
                     if (content.startsWith("#")||isQuestionStart(content)) {
                         if(hasQuestion){
+                            index++;
                             hasQuestion = false;
                             //插入上一条
                             QuestionAddBo addBo = new QuestionAddBo();
                             qContent = removeNo(qContent);
                             if (Validator.isEmpty(qContent)) {
+                                hasError = true;
                                 errorLog += "第" + index + "条题目内容错误\n";
-                                continue;
                             }
                             QuestionAddBo bo = new QuestionAddBo();
                             if (type == -1) {
+                                hasError = true;
                                 errorLog += "第" + index + "条题目选项错误\n";
-                                continue;
-                            }
-                            bo.setType(type);
-
-                            bo.setStatus(1);
-                            bo.setContent(qContent);
-                            bo.setAnswerQuestion(answerQuestion);
-                            bo.setAnalysisContent(analysisContent);
-                            bo.setOptionsList(copyList(optionsList));
-                            bo.setCreateBy(SecurityUtils.getUsername());
-                            bo.setImportNo(importNo);
-                            bo.setPublishStatus(1);
-                            bo.setBusinessList(businessList);
-                            bo.setCreateTime(nowTime);
-                            if(type==1){
-                                list1.add(bo);
-                            }
-                            if(type==2){
-                                list2.add(bo);
-                            }
-                            if(type==3){
-                                list4.add(bo);
                             }
-                            if(type==5){
-                                list3.add(bo);
+                            if(!hasError){
+                                bo.setType(type);
+                                bo.setStatus(1);
+                                bo.setContent(qContent);
+                                bo.setAnswerQuestion(answerQuestion);
+                                bo.setAnalysisContent(analysisContent);
+                                bo.setOptionsList(copyList(optionsList));
+                                bo.setCreateBy(SecurityUtils.getUsername());
+                                bo.setImportNo(importNo);
+                                bo.setPublishStatus(1);
+                                bo.setBusinessList(businessList);
+                                bo.setCreateTime(nowTime);
+                                if(type==1){
+                                    list1.add(bo);
+                                }
+                                if(type==2){
+                                    list2.add(bo);
+                                }
+                                if(type==3){
+                                    list4.add(bo);
+                                }
+                                if(type==5){
+                                    list3.add(bo);
+                                }
                             }
+
                             sort++;
 
                             //清空数据
                             isOption = false;
                             type = -1;
                             qContent = "";
-                            index++;
                             answerQuestion = null;
                             analysisContent = "";
                             optionsList.clear();
                             nowPart = -1;
+                            hasError = false;
                         }
                     }
 
@@ -1052,10 +1056,7 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
                     }
                     //第一个选项(包含西里尔字母А)
                     if(content.startsWith("А.")||content.startsWith("A.")||(nowPart==1&&!isLineStart(content))) {
-                        if (Validator.isEmpty(qContent)) {
-                            errorLog += "第" + index + "条题目内容错误\n";
-                            continue;
-                        }
+                        hasQuestion = true;
                         if(nowPart!=1){
                             strContent = "";
                         }
@@ -1181,10 +1182,7 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
                     }
                     //答案和题型
                     if (content.startsWith("正确答案:")||(nowPart==7&&!isLineStart(content))) {
-                        if (Validator.isEmpty(qContent)) {
-                            errorLog += "第" + index + "条题目内容错误\n";
-                            continue;
-                        }
+                        hasQuestion = true;
                         if(nowPart!=7){
                             strContent = "";
                         }
@@ -1291,7 +1289,7 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
                 String qContent = ""; //题目正文
                 String answerQuestion = null; //答案
                 String analysisContent = ""; //解析文本
-                int index = 1; //题目序列号
+                int index = 0; //题目序列号
                 List<QuestionBusinessAddBo> businessList = new ArrayList<>();
                 QuestionBusinessAddBo questionBusinessAddBo = new QuestionBusinessAddBo();
                 questionBusinessAddBo.setEducationTypeId(eduId);
@@ -1309,6 +1307,7 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
                 String strContent = "";
                 String imgUrl = "";
                 boolean hasQuestion = false;
+                boolean hasError = false;
                 for (XWPFParagraph paragraph : paragraphList) {
                     content = paragraph.getText();
                     List<XWPFRun> runs = paragraph.getRuns();
@@ -1359,50 +1358,54 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
                     content = dealTxt(content);
                     if (content.startsWith("#")||isQuestionStart(content)) {
                         if(hasQuestion){
+                            index++;
                             hasQuestion = false;
                             //插入上一条
                             QuestionAddBo addBo = new QuestionAddBo();
                             qContent = removeNo(qContent);
                             if (Validator.isEmpty(qContent)) {
+                                hasError = true;
                                 errorLog += "第" + index + "条题目内容错误\n";
-                                continue;
+
                             }
                             QuestionAddBo bo = new QuestionAddBo();
                             if (type == -1) {
+                                hasError = true;
                                 errorLog += "第" + index + "条题目选项错误\n";
-                                continue;
-                            }
-                            bo.setType(type);
-
-                            bo.setStatus(1);
-                            bo.setContent(qContent);
-                            bo.setAnswerQuestion(answerQuestion);
-                            bo.setAnalysisContent(analysisContent);
-                            bo.setOptionsList(copyList(optionsList));
-                            bo.setCreateBy(SecurityUtils.getUsername());
-                            bo.setImportNo(importNo);
-                            bo.setPublishStatus(1);
-                            bo.setBusinessList(businessList);
-                            bo.setCreateTime(nowTime);
-                            if(type==1){
-                                list1.add(bo);
-                            }
-                            if(type==2){
-                                list2.add(bo);
-                            }
-                            if(type==3){
-                                list4.add(bo);
+
                             }
-                            if(type==5){
-                                list3.add(bo);
+                            if(!hasError){
+                                bo.setType(type);
+                                bo.setStatus(1);
+                                bo.setContent(qContent);
+                                bo.setAnswerQuestion(answerQuestion);
+                                bo.setAnalysisContent(analysisContent);
+                                bo.setOptionsList(copyList(optionsList));
+                                bo.setCreateBy(SecurityUtils.getUsername());
+                                bo.setImportNo(importNo);
+                                bo.setPublishStatus(1);
+                                bo.setBusinessList(businessList);
+                                bo.setCreateTime(nowTime);
+                                if(type==1){
+                                    list1.add(bo);
+                                }
+                                if(type==2){
+                                    list2.add(bo);
+                                }
+                                if(type==3){
+                                    list4.add(bo);
+                                }
+                                if(type==5){
+                                    list3.add(bo);
+                                }
                             }
-                            sort++;
 
+                            sort++;
+                            hasError = false;
                             //清空数据
                             isOption = false;
                             type = -1;
                             qContent = "";
-                            index++;
                             answerQuestion = null;
                             analysisContent = "";
                             optionsList.clear();
@@ -1428,10 +1431,7 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
                     }
                     //第一个选项
                     if(content.startsWith("А.")||content.startsWith("A.")||(nowPart==1&&!isLineStart(content))) {
-                        if (Validator.isEmpty(qContent)) {
-                            errorLog += "第" + index + "条题目内容错误\n";
-                            continue;
-                        }
+                        hasQuestion = true;
                         if(nowPart!=1){
                             strContent = "";
                         }
@@ -1557,10 +1557,7 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
                     }
                     //答案和题型
                     if (content.startsWith("正确答案:")||(nowPart==7&&!isLineStart(content))) {
-                        if (Validator.isEmpty(qContent)) {
-                            errorLog += "第" + index + "条题目内容错误\n";
-                            continue;
-                        }
+                        hasQuestion = true;
                         if(nowPart!=7){
                             strContent = "";
                         }
@@ -1644,6 +1641,7 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
         return list;
     }
 
+
     private String removeNo(String txt) {
         int intIndex = txt.indexOf("、");
         if (intIndex != -1) {

+ 2 - 2
zhongzheng-system/src/main/resources/mapper/modules/user/UserExamWrongRecordMapper.xml

@@ -158,8 +158,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         user_exam_wrong_record
         WHERE
         1 = 1
-        <if test="goodsId != null and goodsId != ''">
-        AND goods_id = #{goodsId}
+        <if test="orderGoodsId != null and orderGoodsId != ''">
+        AND order_goods_id = #{orderGoodsId}
         </if>
         AND user_id = #{userId}
         <if test="recordId != null and recordId != ''">