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

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

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

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

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

Loading…
Cancel
Save