Sfoglia il codice sorgente

Merge commit 'bdf4576ae9f491f51b169cbed273bf1a65ceeb76'

tags/正式3.14.2^0
王宁 2 settimane fa
parent
commit
3500ed413e

+ 2
- 2
sclass/src/main/java/com/xhkjedu/sclass/controller/classroom/ClassroomController.java Vedi File

@@ -194,7 +194,7 @@ public class ClassroomController {
194 194
                 }
195 195
             });
196 196
         });
197
-        return classroomService.batchSaveClass(startclassList, stopclassList, savefileList
197
+        return classroomService.batchSaveClass(rooms,startclassList, stopclassList, savefileList
198 198
                 , askteacherList, askstudentList, signList
199 199
                 , paperList, nodename, stupaperList, paperFileList, paperQtypeList, paperScantronList, voteList, votestuList,profileList,profileStudentList);
200 200
     }
@@ -352,7 +352,7 @@ public class ClassroomController {
352 352
                 profileStudentList.add(stuProfile);
353 353
             }
354 354
         }
355
-        return classroomService.saveClass(startclass, stopclass, savefileList
355
+        return classroomService.saveClass(r,startclass, stopclass, savefileList
356 356
                 , askteacherList, askstudentList, signList
357 357
                 , paperList, nodename, stupaperList, paperFileList, paperQtypeList, paperScantronList, voteList, votestuList, profileList, profileStudentList);
358 358
     }

+ 9
- 181
sclass/src/main/java/com/xhkjedu/sclass/service/classroom/ClassroomService.java Vedi File

@@ -7,15 +7,14 @@ import com.xhkjedu.sclass.utils.ArithUtil;
7 7
 import com.xhkjedu.sclass.vo.classroom.*;
8 8
 import com.xhkjedu.sclass.vo.paper.CheckClassVo;
9 9
 import com.xhkjedu.sclass.vo.room.DirectorVo;
10
+import com.xhkjedu.sclass.vo.room.RoomPVo;
10 11
 import com.xhkjedu.sclass.vo.room.RoomParamVo;
11 12
 import com.xhkjedu.utils.N_Utils;
12 13
 import com.xhkjedu.vo.ResultVo;
13 14
 import com.xhkjedu.vo.system.UserVo;
14 15
 import lombok.extern.slf4j.Slf4j;
15
-import org.springframework.dao.DuplicateKeyException;
16 16
 import org.springframework.stereotype.Service;
17 17
 import org.springframework.transaction.annotation.Transactional;
18
-import org.springframework.transaction.interceptor.TransactionAspectSupport;
19 18
 import org.springframework.util.CollectionUtils;
20 19
 
21 20
 import javax.annotation.Resource;
@@ -62,178 +61,6 @@ public class ClassroomService {
62 61
     @Resource
63 62
     private ClassroomProfileStudentMapper classroomProfileStudentMapper;
64 63
 
65
-    /**
66
-     * 开始课堂
67
-     *
68
-     * @return void
69
-     * @Param [room]
70
-     * @Author ywx
71
-     * @Date 2020/7/14 17:17
72
-     **/
73
-    @Transactional(rollbackFor = Exception.class)
74
-    public boolean startClass(TClassroom room) {
75
-        boolean rtn = false;//课堂是否重复请求
76
-        try {
77
-            room.setRoomstate(1);
78
-            Integer num = classroomMapper.getStudentNumById(room.getClassid());//根据班级id获取学生数量
79
-            room.setClassnum(num);
80
-            classroomMapper.save(room);
81
-            classroomActivestudentMapper.saveStuActive(room.getRoomid(), room.getClassid(), room.getSchoolid(), N_Utils.getSecondTimestamp());
82
-        } catch (Exception e) {
83
-            if (e instanceof DuplicateKeyException) {
84
-                rtn = true;
85
-                log.error("接口重复请求,课堂id:" + room.getRoomid() + ",课堂名称:" + room.getRoomname());
86
-            } else {
87
-                log.error("开始课堂失败:" + e.getMessage());
88
-            }
89
-            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
90
-        }
91
-        return rtn;
92
-    }
93
-
94
-    /**
95
-     * 结束课堂
96
-     *
97
-     * @return void
98
-     * @Param [room]
99
-     * @Author ywx
100
-     * @Date 2020/7/14 17:17
101
-     **/
102
-    @Transactional(rollbackFor = Exception.class)
103
-    public void stopClass(TClassroom room) {
104
-        try {
105
-            Long roomid = room.getRoomid();
106
-            if (N_Utils.isEmptyInteger(room.getEndtime())) {//异常结束:结束时间=开始时间+45分钟
107
-                TClassroom tClassroom = classroomMapper.selectByPrimaryKey(roomid);
108
-                room.setEndtime(tClassroom.getCreatetime() + 60 * 45);
109
-            }
110
-            classroomMapper.endClass(room);//结束课堂
111
-            classroomActivestudentMapper.updateActiveRank(roomid);//更新活跃值排名
112
-        } catch (Exception e) {
113
-            log.error("结束课堂失败:" + e.getMessage());
114
-            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
115
-        }
116
-    }
117
-
118
-    /**
119
-     * 保存学生签到信息
120
-     *
121
-     * @return void
122
-     * @Param [sign]
123
-     * @Author ywx
124
-     * @Date 2020/7/14 16:32
125
-     **/
126
-    @Transactional(rollbackFor = Exception.class)
127
-    public void saveStudentSign(TClassroomSign sign) {
128
-        try {
129
-            Long roomid = sign.getRoomid();
130
-            Integer userid = sign.getUserid();
131
-            List<Integer> studentids = classroomMapper.listStudentId(roomid);//获取班级学生id集合
132
-            if (N_Utils.numInList(userid, studentids)) {//签到学生是本课堂所在班级学生,添加签到信息
133
-                classroomSignMapper.save(sign);
134
-                //如果一个学生退出课堂再进来数据就不对了,最后计算
135
-                //classroomMapper.updateRealStuNum(sign.getRoomid());//更新班级实际签到学生数量
136
-                classroomActivestudentMapper.updateActiveNum(roomid, userid);//更新学生活跃值
137
-            }
138
-        } catch (Exception e) {
139
-            log.error("保存学生签到信息失败:" + e.getMessage());
140
-            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
141
-        }
142
-    }
143
-
144
-    /**
145
-     * 功能描述 最后更新课堂名称
146
-     *
147
-     * @param * @param roomlist
148
-     * @return void
149
-     * @author WN
150
-     * @date 2020/8/14
151
-     */
152
-    public void updateBatchRoomRealStunum(List<Long> roomlist) {
153
-        classroomMapper.updateBatchRoomRealStunum(roomlist);
154
-    }
155
-
156
-    /**
157
-     * 互动发起
158
-     *
159
-     * @return void
160
-     * @Param [teacher]
161
-     * @Author ywx
162
-     * @Date 2020/6/15 9:58
163
-     **/
164
-    public void saveWork(TClassroomAskteacher teacher) {
165
-        try {
166
-            if (teacher.getPaperid() == null) {
167
-                teacher.setPaperid(0L);
168
-            }
169
-            if (teacher.getRadionum() == null) {
170
-                teacher.setRadionum(0);
171
-            }
172
-            classroomAskteacherMapper.save(teacher);
173
-        } catch (Exception e) {
174
-            log.error("互动发起失败:" + e.getMessage());
175
-        }
176
-    }
177
-
178
-    /**
179
-     * 保存学生作答情况
180
-     *
181
-     * @return void
182
-     * @Param [student]
183
-     * @Author ywx
184
-     * @Date 2020/7/14 16:34
185
-     **/
186
-    @Transactional(rollbackFor = Exception.class)
187
-    public void saveStuAnswer(TClassroomAskstudent student) {
188
-        try {
189
-            if (student.getStudentradio() == null) {
190
-                student.setStudentradio("");
191
-            }
192
-            if (student.getStudentpic() == null) {
193
-                student.setStudentpic("");
194
-            }
195
-            if (student.getRadiocorrect() == null) {
196
-                student.setRadiocorrect(0);
197
-            }
198
-            if (student.getStudentselected() == null) {
199
-                student.setStudentselected(0);
200
-            }
201
-            classroomAskstudentMapper.save(student);
202
-            //保存成功更新学生活跃值
203
-            classroomActivestudentMapper.updateActiveNum(student.getRoomid(), student.getStudentid());
204
-        } catch (Exception e) {
205
-            log.error("保存学生作答情况失败:" + e.getMessage());
206
-            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
207
-        }
208
-    }
209
-
210
-    /**
211
-     * 保存课堂图片
212
-     *
213
-     * @return void
214
-     * @Param [file]
215
-     * @Author ywx
216
-     * @Date 2020/7/14 16:42
217
-     **/
218
-    public void saveFile(TClassroomFile file) {
219
-        try {
220
-            classroomFileMapper.save(file);
221
-        } catch (Exception e) {
222
-            log.error("批量保存课堂图片失败:" + e.getMessage());
223
-        }
224
-    }
225
-
226
-    /**
227
-     * 功能描述 批量结束班级之前的课堂
228
-     *
229
-     * @param * @param classidlist
230
-     * @return void
231
-     * @author WN
232
-     * @date 2020/8/14
233
-     */
234
-    public void updateBatchRoomState(List<Integer> classidlist) {
235
-        classroomMapper.updateBatchRoomState(classidlist);
236
-    }
237 64
 
238 65
     /**
239 66
      * 获取批阅信息
@@ -561,7 +388,7 @@ public class ClassroomService {
561 388
      * @Date 2022/6/28 16:51
562 389
      **/
563 390
     @Transactional(rollbackFor = Exception.class)
564
-    public ResultVo batchSaveClass(List<TClassroom> startclassList, List<TClassroom> stopclassList
391
+    public ResultVo batchSaveClass(List<RoomPVo> rooms,List<TClassroom> startclassList, List<TClassroom> stopclassList
565 392
             , List<TClassroomFile> savefileList
566 393
             , List<TClassroomAskteacher> askteacherList, List<TClassroomAskstudent> askstudentList
567 394
             , List<TClassroomSign> signList
@@ -629,8 +456,9 @@ public class ClassroomService {
629 456
             resultVo.setMsg("保存成功");
630 457
         } catch (Exception e) {
631 458
             log.error("批量保存课堂数据失败:" + e.getMessage());
459
+            log.error(JSON.toJSONString(rooms));
632 460
             resultVo.setMsg("保存失败");
633
-            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
461
+            throw new RuntimeException(e.getMessage());
634 462
         }
635 463
         return resultVo;
636 464
     }
@@ -781,13 +609,13 @@ public class ClassroomService {
781 609
      * @Date 2022/6/30 11:12
782 610
      **/
783 611
     @Transactional(rollbackFor = Exception.class)
784
-    public ResultVo saveClass(TClassroom startclass, TClassroom stopclass, List<TClassroomFile> savefileList
612
+    public ResultVo saveClass(RoomPVo r,TClassroom startclass, TClassroom stopclass, List<TClassroomFile> savefileList
785 613
             , List<TClassroomAskteacher> askteacherList, List<TClassroomAskstudent> askstudentList, List<TClassroomSign> signList
786 614
             , List<TClassroomPaper> paperList, String nodename
787 615
             , List<TClassroomPaperStudent> stupaperList, List<TClassroomPaperFile> paperFileList
788 616
             , List<TClassroomPaperQtype> paperQtypeList, List<TClassroomPaperScantron> paperScantronList
789
-            ,List<TClassroomVote> voteList,List<TClassroomVoteStudent> votestuList
790
-            ,List<TClassroomProfile> profileList,List<TClassroomProfileStudent> profileStudentList) {
617
+            , List<TClassroomVote> voteList, List<TClassroomVoteStudent> votestuList
618
+            , List<TClassroomProfile> profileList, List<TClassroomProfileStudent> profileStudentList) {
791 619
 
792 620
         ResultVo resultVo = new ResultVo();
793 621
         resultVo.setCode(1);
@@ -847,9 +675,9 @@ public class ClassroomService {
847 675
             resultVo.setMsg("保存成功");
848 676
         } catch (Exception e) {
849 677
             log.error("批量保存课堂数据失败:" + e.getMessage());
678
+            log.error(JSON.toJSONString(r));
850 679
             resultVo.setMsg("保存失败");
851
-            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
852
-            return resultVo;
680
+            throw new RuntimeException("保存失败");
853 681
         }
854 682
         return resultVo;
855 683
     }

Loading…
Annulla
Salva