Преглед на файлове

处理阅读理解完形填空新处理题型

tags/正式版本
王宁 преди 2 години
родител
ревизия
17c9819829

+ 4
- 4
sapi/src/main/resources/mapper/appversion/AppScanMapper.xml Целия файл

@@ -4,20 +4,20 @@
4 4
     <!--获取app版本列表-->
5 5
     <select id="listAll" resultType="com.xhkjedu.sapi.vo.appversion.AppversionVo">
6 6
         select v.versionid,v.versioncode,v.versionname,v.appsize,v.versionpath,v.createtime
7
-        from t_app_teacherlive v order by v.createtime desc
7
+        from t_app_scan v order by v.createtime desc
8 8
     </select>
9 9
     <!--获取最新app版本-->
10 10
     <select id="getNew" resultType="com.xhkjedu.sapi.model.appversion.TAppScan">
11
-        select v.* from t_app_teacherlive v order by v.versioncode desc limit 1
11
+        select v.* from t_app_scan v order by v.versioncode desc limit 1
12 12
     </select>
13 13
     <!--获取详情-->
14 14
     <select id="findById" resultType="com.xhkjedu.sapi.model.appversion.TAppScan">
15 15
         select v.*,u.username createname
16
-        from t_app_teacherlive v left join t_user u on v.createid=u.userid
16
+        from t_app_scan v left join t_user u on v.createid=u.userid
17 17
         where v.versionid=#{versionid} limit 1
18 18
     </select>
19 19
     <!--获取APP文件夹-->
20 20
     <select id="listFolder" resultType="java.lang.String">
21
-        SELECT SUBSTRING_INDEX(versionpath,'/',5) FROM t_app_teacherlive WHERE versionid=#{versionid}
21
+        SELECT SUBSTRING_INDEX(versionpath,'/',5) FROM t_app_scan WHERE versionid=#{versionid}
22 22
     </select>
23 23
 </mapper>

+ 3
- 0
sapi/src/test/java/com/xhkjedu/sapi/SapiApplicationTests.java Целия файл

@@ -3,6 +3,8 @@ package com.xhkjedu.sapi;
3 3
 import org.junit.jupiter.api.Test;
4 4
 import org.springframework.boot.test.context.SpringBootTest;
5 5
 
6
+import javax.annotation.Resource;
7
+
6 8
 @SpringBootTest
7 9
 class SapiApplicationTests {
8 10
 
@@ -10,4 +12,5 @@ class SapiApplicationTests {
10 12
     void contextLoads() {
11 13
     }
12 14
 
15
+
13 16
 }

+ 30
- 0
sstudy/src/main/java/com/xhkjedu/sstudy/controller/question/ZQuestionUpdateController.java Целия файл

@@ -0,0 +1,30 @@
1
+package com.xhkjedu.sstudy.controller.question;
2
+
3
+import com.xhkjedu.sstudy.model.question.TQuestion;
4
+import com.xhkjedu.sstudy.service.question.ZQuestionUpdateService;
5
+import com.xhkjedu.utils.N_Utils;
6
+import com.xhkjedu.vo.ResultVo;
7
+import org.springframework.web.bind.annotation.PostMapping;
8
+import org.springframework.web.bind.annotation.RequestBody;
9
+import org.springframework.web.bind.annotation.RequestMapping;
10
+import org.springframework.web.bind.annotation.RestController;
11
+
12
+import javax.annotation.Resource;
13
+
14
+/**
15
+ * @Description
16
+ * @Author WN
17
+ * Date 2022/8/17 8:59
18
+ **/
19
+@RestController
20
+@RequestMapping("zqu")
21
+public class ZQuestionUpdateController {
22
+    @Resource
23
+    private ZQuestionUpdateService zQuestionUpdateService;
24
+
25
+    @PostMapping("/up")
26
+    public ResultVo updateQuestionType(@RequestBody TQuestion question) {
27
+        zQuestionUpdateService.saveQuestions();
28
+        return new ResultVo(0, "处理成功");
29
+    }
30
+}

+ 18
- 0
sstudy/src/main/java/com/xhkjedu/sstudy/mapper/question/ZQuestionUpdateMapper.java Целия файл

@@ -0,0 +1,18 @@
1
+package com.xhkjedu.sstudy.mapper.question;
2
+
3
+import com.xhkjedu.sstudy.base.TkMapper;
4
+import com.xhkjedu.sstudy.model.question.TQuestion;
5
+import com.xhkjedu.sstudy.vo.question.QuestionVo;
6
+import org.springframework.stereotype.Repository;
7
+
8
+import java.util.List;
9
+
10
+/**
11
+ * @Description
12
+ * @Author WN
13
+ * Date 2022/8/16 16:48
14
+ **/
15
+@Repository
16
+public interface ZQuestionUpdateMapper extends TkMapper<TQuestion> {
17
+    List<QuestionVo> listQuestions();
18
+}

+ 175
- 0
sstudy/src/main/java/com/xhkjedu/sstudy/service/question/ZQuestionUpdateService.java Целия файл

@@ -0,0 +1,175 @@
1
+package com.xhkjedu.sstudy.service.question;
2
+
3
+import com.alibaba.fastjson.JSON;
4
+import com.xhkjedu.sstudy.mapper.question.QuestionDirectorMapper;
5
+import com.xhkjedu.sstudy.mapper.question.QuestionMapper;
6
+import com.xhkjedu.sstudy.mapper.question.QuestionPointMapper;
7
+import com.xhkjedu.sstudy.mapper.question.ZQuestionUpdateMapper;
8
+import com.xhkjedu.sstudy.model.question.TQuestion;
9
+import com.xhkjedu.sstudy.model.question.TQuestionDirector;
10
+import com.xhkjedu.sstudy.model.question.TQuestionPoint;
11
+import com.xhkjedu.sstudy.utils.StudyUtil;
12
+import com.xhkjedu.sstudy.vo.question.QuestionVo;
13
+import com.xhkjedu.sstudy.vo.subjectbook.DirectorVo;
14
+import com.xhkjedu.sstudy.vo.subjectbook.PointVo;
15
+import com.xhkjedu.utils.N_Utils;
16
+import org.springframework.stereotype.Service;
17
+import org.springframework.transaction.annotation.Transactional;
18
+
19
+import javax.annotation.Resource;
20
+import java.lang.reflect.Type;
21
+import java.math.BigDecimal;
22
+import java.util.ArrayList;
23
+import java.util.List;
24
+import java.util.Map;
25
+
26
+/**
27
+ * @Description
28
+ * @Author WN
29
+ * Date 2022/8/16 16:50
30
+ **/
31
+@Service
32
+public class ZQuestionUpdateService {
33
+    @Resource
34
+    private ZQuestionUpdateMapper zQuestionUpdateMapper;
35
+    @Resource
36
+    private QuestionMapper questionMapper;
37
+    @Resource
38
+    private QuestionDirectorMapper questionDirectorMapper;
39
+    @Resource
40
+    private QuestionPointMapper questionPointMapper;
41
+
42
+    /**
43
+     * @Description  处理万幸填空阅读理解
44
+     * @Param []
45
+     * @Return void
46
+     * @Author wn
47
+     * @Date 2022/8/17 8:52
48
+     **/
49
+    @Transactional(rollbackFor = Exception.class)
50
+    public void saveQuestions(){
51
+        List<QuestionVo> list = zQuestionUpdateMapper.listQuestions();
52
+
53
+        List<TQuestion> questions = new ArrayList<>();
54
+        List<TQuestionDirector> directors = new ArrayList<>();
55
+        List<TQuestionPoint> points = new ArrayList<>();
56
+        int timestamp = N_Utils.getSecondTimestamp();
57
+        for(int k=0;k<list.size();k++){
58
+//            System.out.println("第几题:"+(k+1));
59
+            QuestionVo qvo=list.get(k);
60
+            TQuestion q = new TQuestion();
61
+            String qid = StudyUtil.getId();
62
+
63
+            //处理子题
64
+            String qoption = qvo.getQoption();
65
+            String qanswer = qvo.getQanswer();
66
+            List<Map> optionlist = JSON.parseArray(qoption, Map.class);
67
+            List<String> answerlist = JSON.parseArray(qanswer,String.class);
68
+
69
+            q.setQuestionid(qid);
70
+            q.setQstem(qvo.getQstem());
71
+            q.setQstemtxt(qvo.getQstemtxt());
72
+            q.setQanalyze(qvo.getQanalyze());
73
+            q.setScore(qvo.getScore());
74
+            q.setComplexity(qvo.getComplexity());
75
+            q.setSubjectid(qvo.getSubjectid());
76
+            q.setCount(qvo.getCount());
77
+            q.setQlevel(2);
78
+            q.setSnum(optionlist.size());
79
+            q.setSorder(0);
80
+            q.setQstate(1);
81
+            q.setSource(qvo.getSource());
82
+            q.setYear(qvo.getYear());
83
+            q.setRegion(qvo.getRegion());
84
+            q.setSchoolname(qvo.getSchoolname());
85
+            q.setCreateid(qvo.getCreateid());
86
+            q.setCreatetime(timestamp);
87
+            q.setBelong(qvo.getBelong());
88
+            q.setSchoolid(qvo.getSchoolid());
89
+            if(qvo.getCtype() == 7 || qvo.getCtype() == 8 ){
90
+                q.setCtype(16);
91
+                q.setQtypeid("1QEQRU9B74");
92
+                q.setQtypename("完形填空(复合)");
93
+            }
94
+            if(qvo.getCtype() == 10){
95
+                q.setCtype(17);
96
+                q.setQtypeid("1QEQRV3BG1");
97
+                q.setQtypename("任务型阅读(复合)");
98
+            }
99
+            questions.add(q);//母题
100
+
101
+            List<PointVo> pointVoList = qvo.getPoints();
102
+            for(PointVo pointVo:pointVoList){
103
+                TQuestionPoint tp = new TQuestionPoint();
104
+                tp.setQpid(StudyUtil.getId());
105
+                tp.setQuestionid(qid);
106
+                tp.setPointid(pointVo.getPointid());
107
+                tp.setCreateid(qvo.getCreateid());
108
+                tp.setCreatetime(timestamp);
109
+                points.add(tp);
110
+            }
111
+            List<DirectorVo> directorVoList = qvo.getDirectors();
112
+            for(DirectorVo d : directorVoList){
113
+                TQuestionDirector td = new TQuestionDirector();
114
+                td.setQdid(StudyUtil.getId());
115
+                td.setQuestionid(qid);
116
+                td.setLsbid(d.getLsbid());
117
+                td.setDirectorid(d.getDirectorid());
118
+                td.setCreateid(qvo.getCreateid());
119
+                td.setCreatetime(timestamp);
120
+                directors.add(td);
121
+            }
122
+
123
+
124
+            for(int i=0;i<optionlist.size();i++){
125
+                Map map = optionlist.get(i);
126
+                String sqstem = map.get("sqstem").toString();
127
+                String sqoptions = map.get("sqoptions").toString();
128
+                String sanswer = answerlist.get(i);
129
+                List<String> sanswerlist = new ArrayList<>();
130
+                sanswerlist.add(sanswer);
131
+                Double sscore = getDivide(qvo.getScore(),optionlist.size());
132
+
133
+                TQuestion sq = new TQuestion();
134
+                sq.setQuestionid(StudyUtil.getId());
135
+                sq.setQuestionpid(qid);
136
+                sq.setQstem(sqstem);
137
+                sq.setQstemtxt(sqstem);
138
+                sq.setQoption(sqoptions);
139
+                sq.setQanswer(JSON.toJSONString(sanswerlist));
140
+                sq.setScore(sscore);
141
+                sq.setComplexity(qvo.getComplexity());
142
+                sq.setSubjectid(qvo.getSubjectid());
143
+                sq.setCount(0);
144
+                sq.setQlevel(3);
145
+                sq.setSnum(0);
146
+                sq.setSorder(i+1);
147
+                sq.setQstate(1);
148
+                sq.setSource(qvo.getSource());
149
+                sq.setYear(qvo.getYear());
150
+                sq.setRegion(qvo.getRegion());
151
+                sq.setSchoolname(qvo.getSchoolname());
152
+                sq.setCreateid(qvo.getCreateid());
153
+                sq.setCreatetime(timestamp);
154
+                sq.setBelong(qvo.getBelong());
155
+                sq.setSchoolid(qvo.getSchoolid());
156
+                sq.setCtype(1);
157
+                sq.setQtypeid("1NJCIQ");
158
+                sq.setQtypename("单选题");
159
+
160
+                questions.add(sq);
161
+            }
162
+        }
163
+        
164
+        questionMapper.saveBathQuestion(questions);
165
+        questionDirectorMapper.batchSave(directors);
166
+        questionPointMapper.batchSave(points);
167
+    }
168
+
169
+    private Double getDivide(Double score,Integer num){
170
+        BigDecimal score1 = new BigDecimal(score);
171
+        BigDecimal num1 = new BigDecimal(num);
172
+        BigDecimal divide = score1.divide(num1, 1, BigDecimal.ROUND_FLOOR);
173
+        return divide.doubleValue();
174
+    }
175
+}

+ 2
- 0
sstudy/src/main/java/com/xhkjedu/sstudy/vo/question/QuestionVo.java Целия файл

@@ -119,4 +119,6 @@ public class QuestionVo {
119 119
 
120 120
     //子题
121 121
     private List<Map> sonqlist;
122
+
123
+    private String qstemtxt;
122 124
 }

+ 1
- 0
sstudy/src/main/resources/mapper/question/QuestionMapper.xml Целия файл

@@ -310,4 +310,5 @@
310 310
              #{p.qstate},#{p.source},#{p.year},#{p.region},#{p.schoolname},#{p.createid},#{p.createtime},#{p.belong},#{p.schoolid})
311 311
         </foreach>
312 312
     </insert>
313
+
313 314
 </mapper>

+ 57
- 0
sstudy/src/main/resources/mapper/question/ZQuestionUpdateMapper.xml Целия файл

@@ -0,0 +1,57 @@
1
+<?xml version="1.0" encoding="UTF-8" ?>
2
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
+<mapper namespace="com.xhkjedu.sstudy.mapper.question.ZQuestionUpdateMapper">
4
+
5
+    <!--试题知识点列表-->
6
+    <resultMap id="questionResult" type="com.xhkjedu.sstudy.vo.question.QuestionVo">
7
+        <result property="questionid" column="questionid"></result>
8
+        <result property="qstem" column="qstem"></result>
9
+        <result property="qstemtxt" column="qstemtxt"></result>
10
+        <result property="qoption" column="qoption"></result>
11
+        <result property="qanswer" column="qanswer"></result>
12
+        <result property="qanalyze" column="qanalyze"></result>
13
+        <result property="score" column="score"></result>
14
+        <result property="complexity" column="complexity"></result>
15
+        <result property="ctype" column="ctype"></result>
16
+        <result property="hearfile" column="hearfile"></result>
17
+        <result property="qtypeid" column="qtypeid"></result>
18
+        <result property="qtypename" column="qtypename"></result>
19
+        <result property="subjectid" column="subjectid"></result>
20
+        <result property="count" column="count"></result>
21
+        <result property="qlevel" column="qlevel"></result>
22
+        <result property="qstate" column="qstate"></result>
23
+        <result property="questionpid" column="questionpid"></result>
24
+        <result property="source" column="source"></result>
25
+        <result property="year" column="year"></result>
26
+        <result property="region" column="region"></result>
27
+        <result property="schoolname" column="schoolname"></result>
28
+        <result property="schoolid" column="schoolid"></result>
29
+        <result property="belong" column="belong"></result>
30
+        <result property="createtime" column="createtime"></result>
31
+
32
+        <collection property="points" ofType="com.xhkjedu.sstudy.vo.subjectbook.PointVo" javaType="java.util.List"
33
+                    select="listPoint" column="{questionid=questionid}">
34
+        </collection>
35
+        <collection property="directors" ofType="com.xhkjedu.sstudy.vo.subjectbook.DirectorVo" javaType="java.util.List">
36
+            <result property="lsbid" column="lsbid"></result>
37
+            <result property="directorid" column="directorid"></result>
38
+        </collection>
39
+    </resultMap>
40
+    <resultMap id="pointResult" type="com.xhkjedu.sstudy.vo.subjectbook.PointVo">
41
+        <result property="pointid" column="pointid"></result>
42
+        <result property="pointname" column="pointname"></result>
43
+    </resultMap>
44
+    <select id="listPoint" resultMap="pointResult">
45
+        select qp.pointid,p.pointname from t_question_point qp left join t_point p on qp.pointid = p.pointid
46
+        where qp.questionid=#{questionid}
47
+    </select>
48
+    <select id="listQuestions" resultMap="questionResult">
49
+        select q.questionid,q.qstem,q.qstemtxt,q.qoption,q.qanswer,q.qanalyze,q.score,q.complexity,q.ctype,q.belong
50
+        ,q.qtypeid,q.qtypename,q.createtime,q.hearfile,q.subjectid,q.count,q.qlevel,q.qstate,q.source,q.year,q.region,q.schoolname,
51
+        q.createid,q.schoolid ,qd.directorid,qd.lsbid
52
+        from t_question q
53
+        left join t_question_director qd on q.questionid=qd.questionid
54
+        where q.qstate=1 and q.ctype in (7,8,10)
55
+    </select>
56
+
57
+</mapper>

+ 7
- 0
sstudy/src/test/java/com/xhkjedu/sstudy/SstudyApplicationTests.java Целия файл

@@ -1,13 +1,20 @@
1 1
 package com.xhkjedu.sstudy;
2 2
 
3
+import com.xhkjedu.sstudy.service.question.ZQuestionUpdateService;
3 4
 import org.junit.jupiter.api.Test;
5
+import org.springframework.beans.factory.annotation.Autowired;
4 6
 import org.springframework.boot.test.context.SpringBootTest;
5 7
 
8
+import javax.annotation.Resource;
9
+
6 10
 @SpringBootTest
7 11
 class SstudyApplicationTests {
12
+    @Resource
13
+    private ZQuestionUpdateService zQuestionUpdateService;
8 14
 
9 15
     @Test
10 16
     void contextLoads() {
17
+        zQuestionUpdateService.saveQuestions();
11 18
     }
12 19
 
13 20
 }

Loading…
Отказ
Запис