Browse Source

课堂多节点图片保存

tags/正式版本
雍文秀 2 years ago
parent
commit
a5f4d56d08

+ 39
- 4
sclass/src/main/java/com/xhkjedu/sclass/controller/classroom/ClassroomController.java View File

@@ -60,6 +60,8 @@ public class ClassroomController {
60 60
         List<TClassroomPaperFile> paperFileList = new ArrayList<>();//堂测附件集合
61 61
         List<TClassroomPaperQtype> paperQtypeList = new ArrayList<>();//堂测答题卡集合
62 62
         List<TClassroomPaperScantron> paperScantronList = new ArrayList<>();//堂测答题卡--题型试题集合
63
+        if(N_Utils.isListEmpty(rooms)) return new ResultVo(0,"保存成功");
64
+        String nodename = rooms.get(0).getNodename();
63 65
         rooms.forEach(r -> {
64 66
             List<RoomParamVo> params = r.getParams();
65 67
             params.forEach(param -> {
@@ -74,12 +76,25 @@ public class ClassroomController {
74 76
                     stopclassList.add(room);
75 77
                 } else if (rtype.equals("savefile")) {//课堂--保存图片
76 78
                     TClassroomFile file = JSON.parseObject(jsonstr, TClassroomFile.class);
77
-                    if (N_Utils.isNotEmpty(file.getRfpath())) savefileList.add(file);
79
+                    if (N_Utils.isNotEmpty(file.getRfpath())) {
80
+                        if(N_Utils.isNotEmpty(nodename)) {
81
+                            file.setRfpath(nodename + "/" + file.getRfpath());
82
+                        }
83
+                        savefileList.add(file);
84
+                    }
78 85
                 } else if (rtype.equals("askteacher")) {//互动--发起
79 86
                     TClassroomAskteacher teacher = JSON.parseObject(jsonstr, TClassroomAskteacher.class);
87
+                    String teacherpic = teacher.getTeacherpic();
88
+                    if (N_Utils.isNotEmpty(nodename) && N_Utils.isNotEmpty(teacherpic)) {
89
+                        teacher.setTeacherpic(nodename + "/" + teacherpic);
90
+                    }
80 91
                     askteacherList.add(teacher);
81 92
                 } else if (rtype.equals("askstudent")) {//互动--保存学生作答情况
82 93
                     TClassroomAskstudent student = JSON.parseObject(jsonstr, TClassroomAskstudent.class);
94
+                    String studentpic = student.getStudentpic();
95
+                    if (N_Utils.isNotEmpty(nodename) && N_Utils.isNotEmpty(studentpic)) {
96
+                        student.setStudentpic(nodename + "/" + studentpic);
97
+                    }
83 98
                     askstudentList.add(student);
84 99
                 } else if (rtype.equals("sign")) {//学生--签到
85 100
                     TClassroomSign sign = JSON.parseObject(jsonstr, TClassroomSign.class);
@@ -95,6 +110,9 @@ public class ClassroomController {
95 110
                         pf.setCreatetime(N_Utils.getSecondTimestamp());
96 111
                         pf.setSchoolid(paper.getSchoolid());
97 112
                         pf.setPaperid(paper.getPaperid());
113
+                        if(N_Utils.isNotEmpty(nodename)) {
114
+                            pf.setFilepath(nodename + "/" + pf.getFilepath());
115
+                        }
98 116
                         paperFileList.add(pf);
99 117
                     }
100 118
 
@@ -135,7 +153,7 @@ public class ClassroomController {
135 153
         });
136 154
         return classroomService.batchSaveClass(startclassList, stopclassList, savefileList
137 155
                 , askteacherList, askstudentList, signList
138
-                , paperList, stupaperList, paperFileList, paperQtypeList, paperScantronList);
156
+                , paperList, nodename, stupaperList, paperFileList, paperQtypeList, paperScantronList);
139 157
     }
140 158
 
141 159
     /**
@@ -164,6 +182,7 @@ public class ClassroomController {
164 182
         List<TClassroomPaperQtype> paperQtypeList = new ArrayList<>();//堂测答题卡集合
165 183
         List<TClassroomPaperScantron> paperScantronList = new ArrayList<>();//堂测答题卡--题型试题集合
166 184
         List<RoomParamVo> params = r.getParams();
185
+        String nodename = r.getNodename();
167 186
         for (RoomParamVo param : params) {
168 187
             String rtype = param.getRtype();
169 188
             String jsonstr = param.getJsonstr();
@@ -174,12 +193,25 @@ public class ClassroomController {
174 193
                 stopclass = JSON.parseObject(jsonstr, TClassroom.class);
175 194
             } else if (rtype.equals("savefile")) {//课堂--保存图片
176 195
                 TClassroomFile file = JSON.parseObject(jsonstr, TClassroomFile.class);
177
-                if (N_Utils.isNotEmpty(file.getRfpath())) savefileList.add(file);
196
+                if (N_Utils.isNotEmpty(file.getRfpath())) {
197
+                    if(N_Utils.isNotEmpty(nodename)) {
198
+                        file.setRfpath(nodename + "/" + file.getRfpath());
199
+                    }
200
+                    savefileList.add(file);
201
+                }
178 202
             } else if (rtype.equals("askteacher")) {//互动--发起
179 203
                 TClassroomAskteacher teacher = JSON.parseObject(jsonstr, TClassroomAskteacher.class);
204
+                String teacherpic = teacher.getTeacherpic();
205
+                if (N_Utils.isNotEmpty(nodename) && N_Utils.isNotEmpty(teacherpic)) {
206
+                    teacher.setTeacherpic(nodename + "/" + teacherpic);
207
+                }
180 208
                 askteacherList.add(teacher);
181 209
             } else if (rtype.equals("askstudent")) {//互动--保存学生作答情况
182 210
                 TClassroomAskstudent student = JSON.parseObject(jsonstr, TClassroomAskstudent.class);
211
+                String studentpic = student.getStudentpic();
212
+                if (N_Utils.isNotEmpty(nodename) && N_Utils.isNotEmpty(studentpic)) {
213
+                    student.setStudentpic(nodename + "/" + studentpic);
214
+                }
183 215
                 askstudentList.add(student);
184 216
             } else if (rtype.equals("sign")) {//学生--签到
185 217
                 TClassroomSign sign = JSON.parseObject(jsonstr, TClassroomSign.class);
@@ -195,6 +227,9 @@ public class ClassroomController {
195 227
                     pf.setCreatetime(N_Utils.getSecondTimestamp());
196 228
                     pf.setSchoolid(paper.getSchoolid());
197 229
                     pf.setPaperid(paper.getPaperid());
230
+                    if(N_Utils.isNotEmpty(nodename)) {
231
+                        pf.setFilepath(nodename + "/" + pf.getFilepath());
232
+                    }
198 233
                     paperFileList.add(pf);
199 234
                 }
200 235
 
@@ -234,7 +269,7 @@ public class ClassroomController {
234 269
         }
235 270
         return classroomService.saveClass(startclass, stopclass, savefileList
236 271
                 , askteacherList, askstudentList, signList
237
-                , paperList, stupaperList, paperFileList, paperQtypeList, paperScantronList);
272
+                , paperList, nodename, stupaperList, paperFileList, paperQtypeList, paperScantronList);
238 273
     }
239 274
 
240 275
     @PostMapping("/list_correct")

+ 11
- 5
sclass/src/main/java/com/xhkjedu/sclass/service/classroom/ClassroomService.java View File

@@ -532,7 +532,7 @@ public class ClassroomService {
532 532
             , List<TClassroomFile> savefileList
533 533
             , List<TClassroomAskteacher> askteacherList, List<TClassroomAskstudent> askstudentList
534 534
             , List<TClassroomSign> signList
535
-            , List<TClassroomPaper> paperList, List<TClassroomPaperStudent> stupaperList
535
+            , List<TClassroomPaper> paperList,String nodename, List<TClassroomPaperStudent> stupaperList
536 536
             , List<TClassroomPaperFile> paperFileList, List<TClassroomPaperQtype> paperQtypeList
537 537
             , List<TClassroomPaperScantron> paperScantronList) {
538 538
         ResultVo resultVo = new ResultVo();
@@ -562,7 +562,7 @@ public class ClassroomService {
562 562
                 classroomPaperStudentMapper.insertList(stupaperList);//批量保存堂测--学生作答详情
563 563
                 List<TClassroomPaperStudentScantron> studentScantronList = new ArrayList<>();//堂测--学生作答详情
564 564
                 List<TClassroomPaperStudent> studentScoreList = new ArrayList<>();//堂测--学生得分
565
-                setPaperStudentScantron(stupaperList, studentScantronList, studentScoreList);
565
+                setPaperStudentScantron(stupaperList, studentScantronList, studentScoreList, nodename);
566 566
                 classroomPaperStudentScantronMapper.insertList(studentScantronList);//批量保存堂测--学生作答详情
567 567
                 classroomPaperStudentMapper.batchUpdateScantronStuScoreAndChecked(studentScoreList);//批量修改学生得分和批改状态
568 568
             }
@@ -587,7 +587,8 @@ public class ClassroomService {
587 587
     }
588 588
 
589 589
     //学生作答详情
590
-    private void setPaperStudentScantron(List<TClassroomPaperStudent> stupaperList, List<TClassroomPaperStudentScantron> studentScantronList, List<TClassroomPaperStudent> studentScoreList) {
590
+    private void setPaperStudentScantron(List<TClassroomPaperStudent> stupaperList, List<TClassroomPaperStudentScantron> studentScantronList
591
+            , List<TClassroomPaperStudent> studentScoreList, String nodename) {
591 592
         for (TClassroomPaperStudent student : stupaperList) {
592 593
             Integer psid = student.getId();
593 594
             Double userscore = 0.0;
@@ -670,6 +671,11 @@ public class ClassroomService {
670 671
                                 }
671 672
                             }
672 673
                             userScore = ArithUtil.round(userScoreDouble, 1);
674
+                        } else if (N_Utils.isNotEmpty(nodename)) {
675
+                            for (String userAnswer : userAnswers) {
676
+                                userAnswer = nodename + "/" + userAnswer;
677
+                            }
678
+                            s.setUseranswer(JSON.toJSONString(userAnswers));
673 679
                         }
674 680
                         if (userScore.compareTo(qscore) == 1) {
675 681
                             userScore = qscore;
@@ -707,7 +713,7 @@ public class ClassroomService {
707 713
      **/
708 714
     public ResultVo saveClass(TClassroom startclass, TClassroom stopclass, List<TClassroomFile> savefileList
709 715
             , List<TClassroomAskteacher> askteacherList, List<TClassroomAskstudent> askstudentList, List<TClassroomSign> signList
710
-            , List<TClassroomPaper> paperList
716
+            , List<TClassroomPaper> paperList, String nodename
711 717
             , List<TClassroomPaperStudent> stupaperList, List<TClassroomPaperFile> paperFileList
712 718
             , List<TClassroomPaperQtype> paperQtypeList, List<TClassroomPaperScantron> paperScantronList) {
713 719
         ResultVo resultVo = new ResultVo();
@@ -738,7 +744,7 @@ public class ClassroomService {
738 744
                 classroomPaperStudentMapper.insertList(stupaperList);//批量保存堂测--学生作答详情
739 745
                 List<TClassroomPaperStudentScantron> studentScantronList = new ArrayList<>();//堂测--学生作答详情
740 746
                 List<TClassroomPaperStudent> studentScoreList = new ArrayList<>();//堂测--学生得分
741
-                setPaperStudentScantron(stupaperList, studentScantronList, studentScoreList);
747
+                setPaperStudentScantron(stupaperList, studentScantronList, studentScoreList, nodename);
742 748
                 classroomPaperStudentScantronMapper.insertList(studentScantronList);//批量保存堂测--学生作答详情
743 749
                 classroomPaperStudentMapper.batchUpdateScantronStuScoreAndChecked(studentScoreList);//批量修改学生得分和批改状态
744 750
             }

+ 3
- 0
sclass/src/main/java/com/xhkjedu/sclass/vo/room/RoomPVo.java View File

@@ -9,6 +9,9 @@ public class RoomPVo {
9 9
     //课堂主键id
10 10
     private Long roomid;
11 11
 
12
+    //节点名称
13
+    private String nodename;
14
+
12 15
     //请求json
13 16
     private List<RoomParamVo> params;
14 17
 }

Loading…
Cancel
Save