|
@@ -163,6 +163,114 @@ public class ClassroomController {
|
163
|
163
|
, paperList, stupaperList, paperFileList, paperQtypeList, paperScantronList);
|
164
|
164
|
}
|
165
|
165
|
|
|
166
|
+ /**
|
|
167
|
+ * 保存单个课堂数据
|
|
168
|
+ *
|
|
169
|
+ * @return com.xhkjedu.vo.ResultVo
|
|
170
|
+ * @Param [r]
|
|
171
|
+ * @Author ywx
|
|
172
|
+ * @Date 2022/6/30 11:23
|
|
173
|
+ **/
|
|
174
|
+ @PostMapping("/save_class")
|
|
175
|
+ public ResultVo saveOneClass(@RequestBody RoomPVo r) {
|
|
176
|
+ String roomname = classroomService.getNameById(r.getRoomid());
|
|
177
|
+ //课堂数据已经存在直接返回保存成功
|
|
178
|
+ if (N_Utils.isNotEmpty(roomname)) return new ResultVo(0, "保存成功");
|
|
179
|
+
|
|
180
|
+ TClassroom startclass = new TClassroom();//开始课堂
|
|
181
|
+ TClassroom stopclass = new TClassroom();//结束课堂
|
|
182
|
+ List<TClassroomFile> savefileList = new ArrayList<>();//结束课堂集合
|
|
183
|
+ List<TClassroomAskteacher> askteacherList = new ArrayList<>();//结束课堂集合
|
|
184
|
+ List<TClassroomAskstudent> askstudentList = new ArrayList<>();//结束课堂集合
|
|
185
|
+ List<TClassroomSign> signList = new ArrayList<>();//结束课堂集合
|
|
186
|
+ List<TClassroomActivestudent> activestudentList = new ArrayList<>();//结束课堂集合
|
|
187
|
+ List<TClassroomPaper> paperList = new ArrayList<>();//结束课堂集合
|
|
188
|
+ List<TClassroomPaperStudent> stupaperList = new ArrayList<>();//结束课堂集合
|
|
189
|
+ List<TClassroomPaperFile> paperFileList = new ArrayList<>();//堂测附件集合
|
|
190
|
+ List<TClassroomPaperQtype> paperQtypeList = new ArrayList<>();//堂测答题卡集合
|
|
191
|
+ List<TClassroomPaperScantron> paperScantronList = new ArrayList<>();//堂测答题卡--题型试题集合
|
|
192
|
+ List<RoomParamVo> params = r.getParams();
|
|
193
|
+ for (RoomParamVo param : params) {
|
|
194
|
+ String rtype = param.getRtype();
|
|
195
|
+ String jsonstr = param.getJsonstr();
|
|
196
|
+ N_Utils.validation(new Object[]{rtype, "请求类型", 2, jsonstr, "请求json", 2});
|
|
197
|
+ if (rtype.equals("startclass")) {//课堂--开始
|
|
198
|
+ startclass = JSON.parseObject(jsonstr, TClassroom.class);
|
|
199
|
+ } else if (rtype.equals("stopclass")) {//课堂--结束
|
|
200
|
+ stopclass = JSON.parseObject(jsonstr, TClassroom.class);
|
|
201
|
+ } else if (rtype.equals("savefile")) {//课堂--保存图片
|
|
202
|
+ TClassroomFile file = JSON.parseObject(jsonstr, TClassroomFile.class);
|
|
203
|
+ if (N_Utils.isNotEmpty(file.getRfpath())) savefileList.add(file);
|
|
204
|
+ } else if (rtype.equals("askteacher")) {//互动--发起
|
|
205
|
+ TClassroomAskteacher teacher = JSON.parseObject(jsonstr, TClassroomAskteacher.class);
|
|
206
|
+ askteacherList.add(teacher);
|
|
207
|
+ } else if (rtype.equals("askstudent")) {//互动--保存学生作答情况
|
|
208
|
+ TClassroomAskstudent student = JSON.parseObject(jsonstr, TClassroomAskstudent.class);
|
|
209
|
+ askstudentList.add(student);
|
|
210
|
+ TClassroomActivestudent as = new TClassroomActivestudent();
|
|
211
|
+ as.setRoomid(student.getRoomid());
|
|
212
|
+ as.setStudentid(student.getStudentid());
|
|
213
|
+ activestudentList.add(as);
|
|
214
|
+ } else if (rtype.equals("sign")) {//学生--签到
|
|
215
|
+ TClassroomSign sign = JSON.parseObject(jsonstr, TClassroomSign.class);
|
|
216
|
+ signList.add(sign);
|
|
217
|
+ TClassroomActivestudent as = new TClassroomActivestudent();
|
|
218
|
+ as.setRoomid(sign.getRoomid());
|
|
219
|
+ as.setStudentid(sign.getUserid());
|
|
220
|
+ activestudentList.add(as);
|
|
221
|
+ } else if (rtype.equals("paper")) {//堂测--发布
|
|
222
|
+ TClassroomPaper paper = JSON.parseObject(jsonstr, TClassroomPaper.class);
|
|
223
|
+
|
|
224
|
+ //堂测附件
|
|
225
|
+ List<TClassroomPaperFile> lst = paper.getPfiles();
|
|
226
|
+ for (TClassroomPaperFile pf : lst) {
|
|
227
|
+ if (N_Utils.isEmpty(pf.getFilepath())) continue;//地址为空不处理
|
|
228
|
+ pf.setCreateid(paper.getCreateid());
|
|
229
|
+ pf.setCreatetime(N_Utils.getSecondTimestamp());
|
|
230
|
+ pf.setSchoolid(paper.getSchoolid());
|
|
231
|
+ pf.setPaperid(paper.getPaperid());
|
|
232
|
+ paperFileList.add(pf);
|
|
233
|
+ }
|
|
234
|
+
|
|
235
|
+ //答题卡信息
|
|
236
|
+ int sorder = 1;//答题卡试题序号
|
|
237
|
+ int qtypeorder = 1;//答题卡题型序号
|
|
238
|
+ //处理答题卡--题型--试题
|
|
239
|
+ List<TClassroomPaperQtype> qtypes = paper.getQtypes();
|
|
240
|
+ for (TClassroomPaperQtype qtype : qtypes) {
|
|
241
|
+ List<TClassroomPaperScantron> scanlst = qtype.getScantrons();//题型下试题
|
|
242
|
+ qtype.setCreateid(paper.getCreateid());
|
|
243
|
+ qtype.setCreatetime(paper.getCreatetime());
|
|
244
|
+ qtype.setSchoolid(paper.getSchoolid());
|
|
245
|
+ qtype.setPqnum(scanlst.size());
|
|
246
|
+ Double qtypescore = scanlst.stream().collect(Collectors.summingDouble(TClassroomPaperScantron::getPsscore));
|
|
247
|
+ qtype.setPqscore(qtypescore);
|
|
248
|
+ qtype.setPaperid(paper.getPaperid());
|
|
249
|
+ qtype.setPqorder(qtypeorder);
|
|
250
|
+ paperQtypeList.add(qtype);
|
|
251
|
+ qtypeorder++;
|
|
252
|
+
|
|
253
|
+ for (TClassroomPaperScantron sc : scanlst) {
|
|
254
|
+ sc.setCreateid(paper.getCreateid());
|
|
255
|
+ sc.setCreatetime(N_Utils.getSecondTimestamp());
|
|
256
|
+ sc.setSchoolid(paper.getSchoolid());
|
|
257
|
+ sc.setPaperid(paper.getPaperid());
|
|
258
|
+ sc.setPsorder(sorder);
|
|
259
|
+ paperScantronList.add(sc);
|
|
260
|
+ sorder++;
|
|
261
|
+ }
|
|
262
|
+ }
|
|
263
|
+ paperList.add(paper);
|
|
264
|
+ } else if (rtype.equals("stupaper")) {//堂测--学生作答详情
|
|
265
|
+ TClassroomPaperStudent student = JSON.parseObject(jsonstr, TClassroomPaperStudent.class);
|
|
266
|
+ stupaperList.add(student);
|
|
267
|
+ }
|
|
268
|
+ }
|
|
269
|
+ return classroomService.saveClass(startclass, stopclass, savefileList
|
|
270
|
+ , askteacherList, askstudentList, signList, activestudentList
|
|
271
|
+ , paperList, stupaperList, paperFileList, paperQtypeList, paperScantronList);
|
|
272
|
+ }
|
|
273
|
+
|
166
|
274
|
@PostMapping("/list_correct")
|
167
|
275
|
public ResultVo listCorrect(@RequestBody RoomVo room) {
|
168
|
276
|
Long roomid = room.getRoomid();
|