Browse Source

添加获取附件文件

tags/正式版本
王宁 2 years ago
parent
commit
7f6dcda8e3

+ 9
- 2
sexam/src/main/java/com/xhkjedu/sexam/controller/paper/EPaperController.java View File

@@ -5,6 +5,7 @@ import com.github.pagehelper.PageInfo;
5 5
 import com.xhkjedu.sexam.model.exam.ESubject;
6 6
 import com.xhkjedu.sexam.model.paper.EPaper;
7 7
 import com.xhkjedu.sexam.model.paper.EPaperBack;
8
+import com.xhkjedu.sexam.model.paperstudent.EPaperStudent;
8 9
 import com.xhkjedu.sexam.service.paper.EPaperService;
9 10
 import com.xhkjedu.utils.N_Utils;
10 11
 import com.xhkjedu.utils.PageUtil;
@@ -59,8 +60,6 @@ public class EPaperController {
59 60
         return new ResultVo(0,"成功获取试卷退回原因",list);
60 61
     }
61 62
 
62
-
63
-
64 63
     //教师出卷列表
65 64
     @PostMapping("/listt")
66 65
     public ResultVo examTeacherPaperList(@RequestBody ESubject subject){
@@ -73,5 +72,13 @@ public class EPaperController {
73 72
         return new ResultVo(0,"成功获取教师出卷信息",pageResult);
74 73
     }
75 74
 
75
+    //获取试卷文件
76
+    @PostMapping("/files")
77
+    public ResultVo listPaperFiles(@RequestBody EPaperStudent ePaperStudent){
78
+        N_Utils.validation(new Object[]{ePaperStudent.getEpsid(),"学生试卷id",1});
79
+        List<Map> list = ePaperService.listExamPaperFiles(ePaperStudent.getEpsid());
80
+        return new ResultVo(0,"成功获取试卷文件",list);
81
+    }
82
+
76 83
 
77 84
 }

+ 2
- 0
sexam/src/main/java/com/xhkjedu/sexam/mapper/paper/EPaperFileMapper.java View File

@@ -18,4 +18,6 @@ public interface EPaperFileMapper extends TkMapper<EPaperFile> {
18 18
 
19 19
     //删除附件
20 20
     void deleteByEpid(@Param("epid") Integer epid);
21
+
22
+    List<Map> listPaperFilesByEpsid(@Param("epsid") Integer epsid);
21 23
 }

+ 3
- 0
sexam/src/main/java/com/xhkjedu/sexam/service/paper/EPaperQtypeService.java View File

@@ -179,10 +179,13 @@ public class EPaperQtypeService {
179 179
     //设置附件
180 180
     private void setPaperFiles(EPaper paper,List<EPaperFile> pfiles) {
181 181
         if(paper.getHasfile() == 1){
182
+            int order= 1;
182 183
             for(EPaperFile pf :pfiles){
183 184
                 pf.setCreateid(paper.getCreateid());
184 185
                 pf.setCreatetime(paper.getHandletime());
185 186
                 pf.setEpid(paper.getEpid());
187
+                pf.setFileorder(order);
188
+                order ++;
186 189
             }
187 190
         }
188 191
     }

+ 8
- 0
sexam/src/main/java/com/xhkjedu/sexam/service/paper/EPaperService.java View File

@@ -4,6 +4,7 @@ import com.xhkjedu.sexam.mapper.exam.EBaseMapper;
4 4
 import com.xhkjedu.sexam.mapper.exam.ESubjectMapper;
5 5
 import com.xhkjedu.sexam.mapper.paper.EPaperAnalyzeMapper;
6 6
 import com.xhkjedu.sexam.mapper.paper.EPaperBackMapper;
7
+import com.xhkjedu.sexam.mapper.paper.EPaperFileMapper;
7 8
 import com.xhkjedu.sexam.mapper.paper.EPaperMapper;
8 9
 import com.xhkjedu.sexam.model.paper.EPaper;
9 10
 import com.xhkjedu.sexam.model.paper.EPaperAnalyze;
@@ -37,6 +38,8 @@ public class EPaperService {
37 38
     private EPaperAnalyzeMapper ePaperAnalyzeMapper;
38 39
     @Resource
39 40
     private EBaseMapper eBaseMapper;
41
+    @Resource
42
+    private EPaperFileMapper ePaperFileMapper;
40 43
 
41 44
 
42 45
 
@@ -89,6 +92,11 @@ public class EPaperService {
89 92
         return ePaperMapper.listExamPapersByTeacherid(teacherid,esstate);
90 93
     }
91 94
 
95
+    //根据试卷学生id获取附件文件
96
+    public List<Map> listExamPaperFiles(Integer epsid){
97
+        return ePaperFileMapper.listPaperFilesByEpsid(epsid);
98
+    }
99
+
92 100
 
93 101
 
94 102
 }

+ 10
- 0
sexam/src/main/java/com/xhkjedu/sexam/service/paperstudent/EPaperStudentService.java View File

@@ -1,10 +1,12 @@
1 1
 package com.xhkjedu.sexam.service.paperstudent;
2 2
 
3 3
 import com.alibaba.fastjson.JSON;
4
+import com.xhkjedu.sexam.mapper.paper.EPaperFileMapper;
4 5
 import com.xhkjedu.sexam.mapper.paper.EPaperQtypeMapper;
5 6
 import com.xhkjedu.sexam.mapper.paperstudent.EPaperStudentMapper;
6 7
 import com.xhkjedu.sexam.mapper.paperstudent.EPaperStudentQuestionMapper;
7 8
 import com.xhkjedu.sexam.mapper.system.UserMapper;
9
+import com.xhkjedu.sexam.model.paper.EPaperFile;
8 10
 import com.xhkjedu.sexam.model.paper.EPaperQtype;
9 11
 import com.xhkjedu.sexam.model.paper.EPaperQtypeQuestion;
10 12
 import com.xhkjedu.sexam.model.paperstudent.EPaperStudent;
@@ -41,6 +43,8 @@ public class EPaperStudentService {
41 43
     private EPaperStudentQuestionMapper ePaperStudentQuestionMapper;
42 44
     @Resource
43 45
     private UserMapper userMapper;
46
+    @Resource
47
+    private EPaperFileMapper ePaperFileMapper;
44 48
     @Autowired
45 49
     private ConvertUtil convertUtil;
46 50
 
@@ -112,6 +116,7 @@ public class EPaperStudentService {
112 116
                 questions = ePaperStudentMapper.listStuPaperFjQuestionsForAndroid(epsid);
113 117
             }
114 118
         }
119
+
115 120
         return questions;
116 121
     }
117 122
 
@@ -174,6 +179,11 @@ public class EPaperStudentService {
174 179
             }
175 180
         }
176 181
 
182
+        if(ptype==2){
183
+            List<Map> files = ePaperFileMapper.listPaperFiles(psvo.getEpid());
184
+            psvo.setFiles(files);
185
+        }
186
+
177 187
         psvo.setQtypelist(questions);
178 188
         return psvo;
179 189
     }

+ 3
- 0
sexam/src/main/java/com/xhkjedu/sexam/vo/paperstudent/EPaperStudentVo.java View File

@@ -51,4 +51,7 @@ public class EPaperStudentVo {
51 51
 
52 52
     //试题集合
53 53
     private List<EPaperQtype> qtypelist;
54
+
55
+    //附件
56
+    private List<Map> files;
54 57
 }

+ 7
- 0
sexam/src/main/resources/mapper/paper/EPaperFileMapper.xml View File

@@ -10,4 +10,11 @@
10 10
     <delete id="deleteByEpid">
11 11
         delete from e_paper_file where epid=#{epid}
12 12
     </delete>
13
+
14
+    <!--获取文件信息-->
15
+    <select id="listPaperFilesByEpsid" resultType="java.util.Map">
16
+        select f.* from e_paper_file f
17
+        left join e_paper_student ps on f.epid=ps.epid
18
+        where ps.epsid=99 group by f.epfid order by fileorder
19
+    </select>
13 20
 </mapper>

Loading…
Cancel
Save