Browse Source

fix(service): 修复错误

Go 5 years ago
parent
commit
664d55e516
27 changed files with 115 additions and 83 deletions
  1. 6 2
      front/project/admin/routes/subject/question/page.js
  2. 2 2
      front/project/www/components/AnswerList/index.js
  3. 0 4
      front/project/www/components/OtherModal/index.less
  4. 4 4
      front/project/www/routes/exercise/list/page.js
  5. 2 2
      front/project/www/routes/exercise/main/page.js
  6. 1 1
      front/project/www/routes/page/export/page.js
  7. 1 1
      front/project/www/routes/paper/question/detail/index.js
  8. 2 0
      front/project/www/routes/paper/question/detail/index.less
  9. 3 3
      front/project/www/routes/paper/report/page.js
  10. 2 2
      front/project/www/routes/preview/list/page.js
  11. 2 2
      front/project/www/routes/textbook/list/page.js
  12. 26 21
      front/src/components/Editor/index.js
  13. 0 0
      server/NotoSerifCJKsc-Bold.otf
  14. 1 1
      server/data/src/main/java/com/qxgmat/data/relation/mapping/ExaminationPaperRelationMapper.xml
  15. 1 1
      server/data/src/main/java/com/qxgmat/data/relation/mapping/ExercisePaperRelationMapper.xml
  16. 4 4
      server/data/src/main/java/com/qxgmat/data/relation/mapping/QuestionNoRelationMapper.xml
  17. 1 0
      server/data/src/main/resources/db/migration/V4__update_paper.sql
  18. 1 1
      server/gateway-api/src/main/java/com/qxgmat/controller/api/MyController.java
  19. 1 1
      server/gateway-api/src/main/java/com/qxgmat/controller/api/QuestionController.java
  20. 3 3
      server/gateway-api/src/main/java/com/qxgmat/dto/response/UserExercisePaperDto.java
  21. 16 4
      server/gateway-api/src/main/java/com/qxgmat/service/extend/ExerciseService.java
  22. 8 1
      server/gateway-api/src/main/java/com/qxgmat/service/extend/QuestionFlowService.java
  23. 2 1
      server/gateway-api/src/main/java/com/qxgmat/service/extend/ToolsService.java
  24. 3 0
      server/gateway-api/src/main/java/com/qxgmat/service/inline/QuestionNoService.java
  25. 1 1
      server/gateway-api/src/main/java/com/qxgmat/service/inline/UserReportService.java
  26. 21 20
      server/gateway-api/src/main/java/com/qxgmat/task/AsyncTask.java
  27. 1 1
      server/gateway-api/src/main/java/com/qxgmat/util/shiro/ShiroConfig.java

+ 6 - 2
front/project/admin/routes/subject/question/page.js

@@ -205,7 +205,11 @@ export default class extends Page {
           form.setFieldsValue({ moduleStruct: [], questionNo: '', questionNoIds: questionNos.map(row => row.id) });
           asyncSMessage('保存成功');
         }).catch((e) => {
-          if (e.result) form.setFields(formatFormError(data, e.result));
+          if (e.result) {
+            form.setFields(formatFormError(data, e.result));
+          } else {
+            asyncSMessage(e.message);
+          }
         });
       }
     });
@@ -519,7 +523,7 @@ export default class extends Page {
           <Form.Item>
             {getFieldDecorator(`content.steps[${index}].stem`, {
             })(
-              <Editor placeholder='请输入内容' />,
+              <Editor placeholder='请输入内容' onUpload={(file) => System.uploadImage(file)} />,
             )}
           </Form.Item>
         </Form>

+ 2 - 2
front/project/www/components/AnswerList/index.js

@@ -27,8 +27,8 @@ export default class AnswerList extends Component {
   }
 
   renderList() {
-    const { selected = {}, answer = {}, show, list = [], distributed = [], type } = this.props;
-    const count = distributed.reduce((x, y) => x + y, 0);
+    const { selected = {}, answer = {}, show, list = [], distributed = {}, type } = this.props;
+    const count = (distributed[type] || []).reduce((x, y) => x + y, 0);
     return (
       <div className="list">
         {list.map((item, index) => {

+ 0 - 4
front/project/www/components/OtherModal/index.less

@@ -199,10 +199,6 @@
       padding: 5px 10px;
     }
 
-    .textarea::placeholder {
-      color: #A7A7B7;
-    }
-
     .bottom {
       border-top: 1px solid #E1E1E1;
       padding-top: 10px;

+ 4 - 4
front/project/www/routes/exercise/list/page.js

@@ -60,8 +60,8 @@ export default class extends Page {
       align: 'left',
       render: (record) => {
         let time = '--';
-        if (record.paper) {
-          time = formatSeconds(record.paper.report.userTime / record.paper.report.userNumber);
+        if (record.report) {
+          time = formatSeconds(record.report.userTime / record.report.userNumber);
         }
         return (
           <div className="table-row">
@@ -96,9 +96,9 @@ export default class extends Page {
             {(record.report && !record.report.isFinish) && <IconButton className="m-r-2" type="continue" tip="Continue" onClick={() => {
               Question.continueLink('exercise', record);
             }} />}
-            <IconButton type="restart" tip="Restart" onClick={() => {
+            {(record.report && record.report.isFinish) && <IconButton type="restart" tip="Restart" onClick={() => {
               this.restart(record);
-            }} />
+            }} />}
           </div>
         );
       },

+ 2 - 2
front/project/www/routes/exercise/main/page.js

@@ -74,8 +74,8 @@ const exerciseColumns = [{
   align: 'left',
   render: record => {
     let time = '--';
-    if (record.paper) {
-      time = formatSeconds(record.paper.report.userTime / record.paper.report.userNumber);
+    if (record.report) {
+      time = formatSeconds(record.report.userTime / record.report.userNumber);
     }
     return (
       <div className="table-row">

+ 1 - 1
front/project/www/routes/page/export/page.js

@@ -238,7 +238,7 @@ class BaseDetail extends Component {
     return (
       <div className="detail-item-block">
         <div className="title-item">题源联想</div>
-        {associations.map((item, index) => {
+        {associations.filter(row => row).map((item, index) => {
           return (
             <div className="m-b-2">
               <div className="t-1 t-s-16  m-b-1">

+ 1 - 1
front/project/www/routes/paper/question/detail/index.js

@@ -501,7 +501,7 @@ export default class extends Component {
         content = (
           <div className="detail-block">
             <Carousel>
-              {associations.map(association => {
+              {associations.filter(row => row).map(association => {
                 const { questions = [], type } = association.content || {};
                 return <div className="block-text">
                   <div dangerouslySetInnerHTML={{ __html: this.formatOtherStem(association) }} />

+ 2 - 0
front/project/www/routes/paper/question/detail/index.less

@@ -189,6 +189,7 @@
           flex-direction: column;
           width: 50%;
           overflow: hidden;
+          height: 100%;
         }
 
         .two {
@@ -201,6 +202,7 @@
 
         .block {
           flex: 1;
+          height: 100%;
         }
 
         .block-content,

+ 3 - 3
front/project/www/routes/paper/report/page.js

@@ -623,7 +623,7 @@ export default class extends Page {
   }
 
   toggleCollect(index) {
-    const { list } = this.props;
+    const { list } = this.state;
     const userQuestion = list[index];
     if (!userQuestion.collect) {
       My.addQuestionCollect(userQuestion.questionNo.id).then(() => {
@@ -639,7 +639,7 @@ export default class extends Page {
   }
 
   note(index) {
-    const { list } = this.props;
+    const { list } = this.state;
     const userQuestion = list[index];
     const { questionNo } = userQuestion;
     My.getQuestionNote(questionNo.id)
@@ -1104,7 +1104,7 @@ export default class extends Page {
           {info.userTime > info.time && <div className="tip">
             <div className="t1">在实战限时情况下,本套题正确率为 </div>
             <div className="t2">{formatPercent(limit.userCorrect, limit.userNumber)}</div>
-            <Tooltip message="仅统计在建议时间内完成题目正确率情况,更接近实战表现"><Icon type="question-circle" theme="filled" /></Tooltip>
+            <Tooltip title="仅统计在建议时间内完成题目正确率情况,更接近实战表现"><Icon type="question-circle" theme="filled" /></Tooltip>
           </div>}
           {info.userTime <= info.time && <div className="tip">
             <div className="t1">目前的做题速度已达到实战标准!很棒!请继续保持!</div>

+ 2 - 2
front/project/www/routes/preview/list/page.js

@@ -62,8 +62,8 @@ export default class extends Page {
         align: 'left',
         render: (record) => {
           let time = '--';
-          if (record.paper) {
-            time = formatSeconds(record.paper.report.userTime / record.paper.report.userNumber);
+          if (record.report) {
+            time = formatSeconds(record.report.userTime / record.report.userNumber);
           }
           return (
             <div className="table-row">

+ 2 - 2
front/project/www/routes/textbook/list/page.js

@@ -56,8 +56,8 @@ export default class extends Page {
       align: 'left',
       render: (record) => {
         let time = '--';
-        if (record.paper) {
-          time = formatSeconds(record.paper.report.userTime / record.paper.report.userNumber);
+        if (record.report) {
+          time = formatSeconds(record.report.userTime / record.report.userNumber);
         }
         return (
           <div className="table-row">

+ 26 - 21
front/src/components/Editor/index.js

@@ -3,24 +3,15 @@ import ReactQuill from 'react-quill';
 import 'react-quill/dist/quill.snow.css';
 import { generateUUID } from '../../services/Tools';
 
-const modules = {
-  toolbar: {
-    container: [
-      [{ header: '1' }, { header: '2' }],
-      ['bold', 'underline', 'blockquote'],
-      [{ color: [] }, { background: [] }],
-      [{ list: 'ordered' }, { list: 'bullet' }, { indent: '-1' }, { indent: '+1' }],
-      // ['image'],
-      // ['link', 'video'],
-      // ['clean'],
-    ],
-    handlers: {},
-  },
-  clipboard: {
-    // toggle to add extra line breaks when pasting HTML:
-    matchVisual: false,
-  },
-};
+const defaultContainer = [
+  [{ header: '1' }, { header: '2' }],
+  ['bold', 'underline', 'blockquote'],
+  [{ color: [] }, { background: [] }],
+  [{ list: 'ordered' }, { list: 'bullet' }, { indent: '-1' }, { indent: '+1' }],
+  // ['image'],
+  // ['link', 'video'],
+  // ['clean'],
+];
 
 const formats = [
   'header',
@@ -45,9 +36,23 @@ class Editor extends React.Component {
     this.quillRef = null;
     this.state = {};
     this.loading = 0;
-    this.modules = Object.assign({}, modules, props.modules);
-    if (props.onUpload && (!props.modules || !props.modules.toolbar)) {
-      this.modules.toolbar.container.unshift(['image']);
+    this.modules = {
+      toolbar: {
+        container: [
+        ],
+        handlers: {},
+      },
+      clipboard: {
+        // toggle to add extra line breaks when pasting HTML:
+        matchVisual: true,
+      },
+    };
+    this.modules = Object.assign(this.modules, props.modules);
+    if (this.modules.toolbar.container.length === 0) {
+      this.modules.toolbar.container = defaultContainer.map(row => row);
+      if (props.onUpload) {
+        this.modules.toolbar.container.unshift(['image']);
+      }
     }
     // console.log(this.modules);
     this.modules.toolbar.handlers.image = () => this.image();

server/gateway-api/src/main/resources/NotoSerifCJKsc-Bold.otf → server/NotoSerifCJKsc-Bold.otf


+ 1 - 1
server/data/src/main/java/com/qxgmat/data/relation/mapping/ExaminationPaperRelationMapper.xml

@@ -59,7 +59,7 @@
         </if>
       </if>
     </if>
-    where 1
+    where ep.`status` = 1
     <if test="structId != null">
       and (ep.`struct_three` = #{structId,jdbcType=VARCHAR} or ep.`struct_two` = #{structId,jdbcType=VARCHAR})
     </if>

+ 1 - 1
server/data/src/main/java/com/qxgmat/data/relation/mapping/ExercisePaperRelationMapper.xml

@@ -46,7 +46,7 @@
         </if>
       </if>
     </if>
-    where 1
+    where ep.`status` = 1
     <if test="structId != null">
       and (ep.`struct_three` = #{structId,jdbcType=VARCHAR} or ep.`struct_four` = #{structId,jdbcType=VARCHAR})
     </if>

+ 4 - 4
server/data/src/main/java/com/qxgmat/data/relation/mapping/QuestionNoRelationMapper.xml

@@ -99,7 +99,7 @@
         find_in_set(#{item}, qn.`module_struct`)
       </foreach>
     </if>
-    ORDER BY #{order} #{direction}, qn.`no`DESC
+    ORDER BY #{order} #{direction}, qn.`no` DESC
   </select>
 
   <!--
@@ -183,12 +183,12 @@
     select
     <include refid="Id_Column_List" />
     <if test="paperId != null">
-      , find_in_set(qn.`id`, trim(TRAILING ']' from trim(LEADING '[' from eq.`question_no_ids`))) as ep.`no`
+      , find_in_set(qn.`id`, trim(TRAILING ']' from trim(LEADING '[' from ep.`question_no_ids`))) as `no`
     </if>
     from `question_no` qn
     left join `question` q on q.`id` = qn.`question_id`
     <if test="paperId != null">
-      left join `exercise_paper` ep on find_in_set(qn.`id`, trim(TRAILING ']' from trim(LEADING '[' from eq.`question_no_ids`)))
+      left join `exercise_paper` ep on find_in_set(qn.`id`, trim(TRAILING ']' from trim(LEADING '[' from ep.`question_no_ids`)))
       and ep.`id` = #{paperId,jdbcType=VARCHAR}
     </if>
     where q.`id` &gt; 0 and qn.`question_id` &gt; 0 and qn.`delete_time` is null
@@ -229,7 +229,7 @@
     from `question_no` qn
     left join `question` q on q.`id` = qn.`question_id`
     <if test="paperId != null">
-      left join `examination_paper` ep on find_in_set(qn.`id`, trim(TRAILING ']' from trim(LEADING '[' from eq.`question_no_ids`)))
+      left join `examination_paper` ep on find_in_set(qn.`id`, trim(TRAILING ']' from trim(LEADING '[' from ep.`question_no_ids`)))
       and ep.`id` = #{paperId,jdbcType=VARCHAR}
     </if>
     where q.`id` &gt; 0 and qn.`question_id` &gt; 0 and qn.`delete_time` is null

+ 1 - 0
server/data/src/main/resources/db/migration/V4__update_paper.sql

@@ -0,0 +1 @@
+ALTER TABLE exercise_paper modify column title VARCHAR(50);

+ 1 - 1
server/gateway-api/src/main/java/com/qxgmat/controller/api/MyController.java

@@ -2206,7 +2206,7 @@ public class MyController {
         Collection questionNoIds = Transform.getIds(p, UserSearchHistory.class, "questionNoId");
         List<QuestionNo> questionNoList = questionNoService.select(questionNoIds);
         Transform.combine(pr, questionNoList, UserSearchHistoryDto.class, "questionNoId", "questionNo", QuestionNo.class, "id", QuestionNoExtendDto.class);
-
+        pr = pr.stream().filter(row->row != null && row.getQuestionNo()!=null && row.getQuestion() !=null).collect(Collectors.toList());
         return ResponseHelp.success(pr);
     }
 

+ 1 - 1
server/gateway-api/src/main/java/com/qxgmat/controller/api/QuestionController.java

@@ -413,7 +413,7 @@ public class QuestionController {
             // 获取最后一次作业结果
             Collection paperIds = Transform.getIds(paperList, UserPaper.class, "id");
             List<UserReport> reportList = userReportService.listWithLast(paperIds);
-            Transform.combine(pr, reportList, UserExercisePaperDto.class, "id", "report", UserReport.class, "paperId", UserReportExtendDto.class);
+            Transform.combine(pr, reportList, UserExercisePaperDto.class, "userPaperId", "report", UserReport.class, "paperId", UserReportExtendDto.class);
         }
 
         return ResponseHelp.success(pr, page, size, p.getTotal());

+ 3 - 3
server/gateway-api/src/main/java/com/qxgmat/dto/response/UserExercisePaperDto.java

@@ -11,7 +11,7 @@ import com.qxgmat.dto.extend.UserReportExtendDto;
 public class UserExercisePaperDto {
     private Integer id;
 
-    private Integer title;
+    private String title;
 
     private PaperStat stat;
 
@@ -61,11 +61,11 @@ public class UserExercisePaperDto {
         this.id = id;
     }
 
-    public Integer getTitle() {
+    public String getTitle() {
         return title;
     }
 
-    public void setTitle(Integer title) {
+    public void setTitle(String title) {
         this.title = title;
     }
 }

+ 16 - 4
server/gateway-api/src/main/java/com/qxgmat/service/extend/ExerciseService.java

@@ -29,13 +29,13 @@ import java.util.*;
 @Service
 public class ExerciseService extends AbstractService {
     @Value("${paper.exerciseLength}")
-    public Integer paperLength;
+    private Integer paperLength;
 
     @Value("${paper.irLength}")
-    public Integer irLength;
+    private Integer irLength;
 
     @Value("${paper.awaLength}")
-    public Integer awaLength;
+    private Integer awaLength;
 
     @Resource
     private QuestionService questionService;
@@ -133,7 +133,7 @@ public class ExerciseService extends AbstractService {
         Collection ids = Transform.getIds(p, ExercisePaper.class, "id");
         // 获取详细数据
         List<ExercisePaper> list = exercisePaperService.select(ids);
-        Transform.replace(p, list, QuestionNoRelation.class, "id");
+        Transform.replace(p, list, ExercisePaper.class, "id");
 
         return p;
     }
@@ -203,4 +203,16 @@ public class ExerciseService extends AbstractService {
         // 将新组卷启用
         exercisePaperService.updatePaper(ids, 1);
     }
+
+    public Integer getPaperLength() {
+        return paperLength;
+    }
+
+    public Integer getIrLength() {
+        return irLength;
+    }
+
+    public Integer getAwaLength() {
+        return awaLength;
+    }
 }

+ 8 - 1
server/gateway-api/src/main/java/com/qxgmat/service/extend/QuestionFlowService.java

@@ -182,6 +182,7 @@ public class QuestionFlowService {
             ExercisePaper paper = exercisePaperService.get(id);
             userPaper.setTitle(paper.getTitle());
             userPaper.setQuestionNoIds(paper.getQuestionNoIds());
+            userPaper.setQuestionNumber(paper.getQuestionNumber());
             // 获取考题时间
             List<QuestionNoRelation> relationList = questionNoService.listWithRelationByIds(userPaper.getQuestionNoIds());
             Integer time = toolsService.computerTime(relationList.toArray(new QuestionNoRelation[0]));
@@ -1235,6 +1236,9 @@ public class QuestionFlowService {
      */
     private void answerDistributed(UserQuestion userQuestion, Question question){
         JSONObject answerDistributed = question.getAnswerDistributed();
+        if (answerDistributed == null){
+            answerDistributed = new JSONObject();
+        }
         JSONObject answer = question.getAnswer();
         JSONObject userAnswer = userQuestion.getUserAnswer();
 
@@ -1250,7 +1254,10 @@ public class QuestionFlowService {
         for(int i = 0; i< questions.size(); i++){
             JSONObject userOne = userQuestions.getJSONObject(i);
             JSONObject one = questions.getJSONObject(i);
-            JSONObject target = distributed.getJSONObject(i);
+            JSONObject target = null;
+            if (distributed.size() > i){
+                target = distributed.getJSONObject(i);
+            }
             if (target == null || target.isEmpty()){
                 target = new JSONObject();
                 distributed.add(i, target);

+ 2 - 1
server/gateway-api/src/main/java/com/qxgmat/service/extend/ToolsService.java

@@ -171,7 +171,8 @@ public class ToolsService {
     public boolean filterTime(UserQuestion question){
         Setting setting = settingService.getByKey(SettingKey.FILTER_TIME);
         JSONObject value = setting.getValue();
-        if (value.getInteger("min")> question.getTime()) return false;
+        if (value == null || value.getInteger("min") == null || value.getInteger("max") == null) return true;
+        if (value.getInteger("min") > question.getTime()) return false;
         if (value.getInteger("max") < question.getTime()) return false;
         return  true;
     }

+ 3 - 0
server/gateway-api/src/main/java/com/qxgmat/service/inline/QuestionNoService.java

@@ -493,6 +493,9 @@ public class QuestionNoService extends AbstractService {
     public QuestionNo add(QuestionNo question){
         QuestionNo in = getByNo(question.getTitle(), question.getModule());
         if (in != null){
+            if (in.getQuestionId() == 0){
+                return in;
+            }
             throw new ParameterException("题目已经存在");
         }
         int result = insert(questionNoMapper, question);

+ 1 - 1
server/gateway-api/src/main/java/com/qxgmat/service/inline/UserReportService.java

@@ -110,7 +110,7 @@ public class UserReportService extends AbstractService {
      */
     public UserReportLimitRelation statLimit(String origin, Integer originId){
         List<UserReportLimitRelation> relations =  userReportRelationMapper.statLimit(origin, originId);
-        if (relations.size() > 0){
+        if (relations.size() > 0 && relations.get(0) != null){
             return relations.get(0);
         }else{
             return new UserReportLimitRelation();

+ 21 - 20
server/gateway-api/src/main/java/com/qxgmat/task/AsyncTask.java

@@ -81,8 +81,8 @@ public class AsyncTask {
         if (status == null) {
             status = new JSONObject();
         }
-        int progress = 0;
-        status.put("progress", 10);
+        int progress = 10;
+        status.put("progress", progress);
         settingService.edit(setting);
         // 按所有4级结构
         List<ExerciseStruct> p = exerciseStructService.all();
@@ -93,20 +93,21 @@ public class AsyncTask {
             progress += 70 / p.size();
             status.put("progress", progress);
             settingService.edit(setting);
-            String prefixTitle = String.format("%s%s", struct.getTitleEn(), struct.getTitleZh());
+            String prefixTitle = String.format("%s", struct.getTitleZh());
             QuestionType questionType = QuestionType.ValueOf(struct.getExtend());
             List<QuestionNoRelation> list = questionNoService.listWithRelationByStruct(StructModule.EXERCISE, struct.getId());
 
             // 按顺序组卷
-            List<ExercisePaper> noPapers = exerciseService.createPaper(prefixTitle, questionType, struct.getParentId(), struct.getId(), exerciseService.paperLength, ExerciseLogic.NO, null, list);
-            Collection noIds = Transform.getIds(noPapers, SentencePaper.class, "id");
+            logger.debug("{}", exerciseService.getPaperLength());
+            List<ExercisePaper> noPapers = exerciseService.createPaper(prefixTitle, questionType, struct.getParentId(), struct.getId(), exerciseService.getPaperLength(), ExerciseLogic.NO, null, list);
+            Collection noIds = Transform.getIds(noPapers, ExercisePaper.class, "id");
             exerciseService.switchPaper(struct.getParentId(), struct.getId(), ExerciseLogic.NO, noIds);
 
             // 按难度组卷
             List<Integer> allDifficultIds = new ArrayList<>();
             for(QuestionDifficult difficult : QuestionDifficult.all()){
                 List<QuestionNoRelation> difficultList = list.stream().filter((question)-> question.getQuestion().getDifficult().equals(difficult.key)).collect(Collectors.toList());
-                List<ExercisePaper> difficultPapers = exerciseService.createPaper(String.format("%s %s", prefixTitle, difficult.key), questionType, struct.getParentId(), struct.getId(), exerciseService.paperLength, ExerciseLogic.DIFFICULT, difficult.key, difficultList);
+                List<ExercisePaper> difficultPapers = exerciseService.createPaper(String.format("%s %s", prefixTitle, difficult.key), questionType, struct.getParentId(), struct.getId(), exerciseService.getPaperLength(), ExerciseLogic.DIFFICULT, difficult.key, difficultList);
                 Collection difficultIds = Transform.getIds(difficultPapers, ExercisePaper.class, "id");
                 allDifficultIds.addAll(difficultIds);
             }
@@ -125,7 +126,7 @@ public class AsyncTask {
             List<Integer> allPlaceIds = new ArrayList<>();
             for(String place: placeMap.keySet()){
                 List<QuestionNoRelation> placeList = placeMap.get(place);
-                List<ExercisePaper> difficultPapers = exerciseService.createPaper(String.format("%s %s", prefixTitle, place), questionType, struct.getParentId(), struct.getId(), exerciseService.paperLength, ExerciseLogic.PLACE, place, placeList);
+                List<ExercisePaper> difficultPapers = exerciseService.createPaper(String.format("%s %s", prefixTitle, place), questionType, struct.getParentId(), struct.getId(), exerciseService.getPaperLength(), ExerciseLogic.PLACE, place, placeList);
                 Collection placeIds = Transform.getIds(difficultPapers, ExercisePaper.class, "id");
                 allPlaceIds.addAll(placeIds);
             }
@@ -134,12 +135,12 @@ public class AsyncTask {
             // 按难易度组卷:保持和下方难易度组卷一致
             list.sort((x, y)-> {
                 // 难度从高到低
-                Integer xScore = x.getTotalCorrect() * 100/ x.getTotalNumber();
-                Integer yScore = y.getTotalCorrect() * 100/ y.getTotalNumber();
+                Integer xScore = x.getTotalNumber() > 0 ? x.getTotalCorrect() * 100/ x.getTotalNumber() : 0;
+                Integer yScore = y.getTotalNumber() > 0 ? y.getTotalCorrect() * 100/ y.getTotalNumber(): 0;
                 return yScore.compareTo(xScore);
             });
-            List<ExercisePaper> errorPapers = exerciseService.createPaper(prefixTitle, questionType, struct.getParentId(), struct.getId(), exerciseService.paperLength, ExerciseLogic.ERROR, null, list);
-            Collection errorIds = Transform.getIds(errorPapers, SentencePaper.class, "id");
+            List<ExercisePaper> errorPapers = exerciseService.createPaper(prefixTitle, questionType, struct.getParentId(), struct.getId(), exerciseService.getPaperLength(), ExerciseLogic.ERROR, null, list);
+            Collection errorIds = Transform.getIds(errorPapers, ExercisePaper.class, "id");
             exerciseService.switchPaper(struct.getParentId(), struct.getId(), ExerciseLogic.ERROR, errorIds);
         }
         status.put("progress", 80);
@@ -150,13 +151,13 @@ public class AsyncTask {
             if (struct.getLevel()!=3 || !struct.getExtend().equals(QuestionType.AWA.key)){
                 continue;
             }
-            String prefixTitle = String.format("%s%s", struct.getTitleEn(), struct.getTitleZh());
+            String prefixTitle = String.format("%s", struct.getTitleZh());
             QuestionType questionType = QuestionType.ValueOf(struct.getExtend());
             List<QuestionNoRelation> list = questionNoService.listWithRelationByStruct(StructModule.EXERCISE, struct.getId());
 
             // 按顺序组卷
-            List<ExercisePaper> noPapers = exerciseService.createPaper(prefixTitle, questionType, struct.getId(), 0, exerciseService.awaLength, ExerciseLogic.NO, null, list);
-            Collection noIds = Transform.getIds(noPapers, SentencePaper.class, "id");
+            List<ExercisePaper> noPapers = exerciseService.createPaper(prefixTitle, questionType, struct.getId(), 0, exerciseService.getAwaLength(), ExerciseLogic.NO, null, list);
+            Collection noIds = Transform.getIds(noPapers, ExercisePaper.class, "id");
             exerciseService.switchPaper(struct.getId(), 0, ExerciseLogic.NO, noIds);
         }
         status.put("progress", 80);
@@ -167,13 +168,13 @@ public class AsyncTask {
             if (struct.getLevel()!=3 || !struct.getExtend().equals(QuestionType.IR.key)){
                 continue;
             }
-            String prefixTitle = String.format("%s%s", struct.getTitleEn(), struct.getTitleZh());
+            String prefixTitle = String.format("%s", struct.getTitleZh());
             QuestionType questionType = QuestionType.ValueOf(struct.getExtend());
             List<QuestionNoRelation> list = questionNoService.listWithRelationByStruct(StructModule.EXERCISE, struct.getId());
 
             // 按顺序组卷
-            List<ExercisePaper> noPapers = exerciseService.createPaper(prefixTitle, questionType, struct.getId(), 0, exerciseService.irLength, ExerciseLogic.NO, null, list);
-            Collection noIds = Transform.getIds(noPapers, SentencePaper.class, "id");
+            List<ExercisePaper> noPapers = exerciseService.createPaper(prefixTitle, questionType, struct.getId(), 0, exerciseService.getIrLength(), ExerciseLogic.NO, null, list);
+            Collection noIds = Transform.getIds(noPapers, ExercisePaper.class, "id");
             exerciseService.switchPaper(struct.getId(), 0, ExerciseLogic.NO, noIds);
         }
 
@@ -200,11 +201,11 @@ public class AsyncTask {
             // 按难易度组卷:保持和上方难易度组卷一致
             list.sort((x, y)-> {
                 // 难度从高到低
-                Integer xScore = x.getTotalCorrect() * 100/ x.getTotalNumber();
-                Integer yScore = y.getTotalCorrect() * 100/ y.getTotalNumber();
+                Integer xScore = x.getTotalNumber() > 0 ? x.getTotalCorrect() * 100/ x.getTotalNumber() : 0;
+                Integer yScore = y.getTotalNumber() > 0 ? y.getTotalCorrect() * 100/ y.getTotalNumber(): 0;
                 return yScore.compareTo(xScore);
             });
-            List<ExercisePaper> errorPapers = exerciseService.createPaper(prefixTitle, questionType, struct.getParentId(), struct.getId(), exerciseService.paperLength, ExerciseLogic.ERROR, null, list);
+            List<ExercisePaper> errorPapers = exerciseService.createPaper(prefixTitle, questionType, struct.getParentId(), struct.getId(), exerciseService.getPaperLength(), ExerciseLogic.ERROR, null, list);
             Collection errorIds = Transform.getIds(errorPapers, SentencePaper.class, "id");
             exerciseService.switchPaper(struct.getParentId(), struct.getId(), ExerciseLogic.ERROR, errorIds);
         }

+ 1 - 1
server/gateway-api/src/main/java/com/qxgmat/util/shiro/ShiroConfig.java

@@ -52,7 +52,7 @@ public class ShiroConfig {
         chain.addPathDefinition("/admin/auth/**", "anon");
         chain.addPathDefinition("/admin/**", "role[manager]");
         chain.addPathDefinition("/api/auth/**", "anon");
-        chain.addPathDefinition("/api/my/**", "token,role[user]");
+        chain.addPathDefinition("/api/my/**", "role[user]");
 
         chain.addPathDefinition("/**", "anon");
         return chain;