Sfoglia il codice sorgente

作业补交

tags/正式3.13.6
雍文秀 8 mesi fa
parent
commit
9ceda7e489
19 ha cambiato i file con 219 aggiunte e 100 eliminazioni
  1. 8
    0
      scommons/src/main/java/com/xhkjedu/constant/PlatformConstant.java
  2. 16
    4
      sstudy/src/main/java/com/xhkjedu/sstudy/controller/paper/PaperController.java
  3. 10
    34
      sstudy/src/main/java/com/xhkjedu/sstudy/controller/paperstudent/PaperStudentController.java
  4. 11
    14
      sstudy/src/main/java/com/xhkjedu/sstudy/controller/paperstudent/PaperStudentWebController.java
  5. 3
    0
      sstudy/src/main/java/com/xhkjedu/sstudy/mapper/paper/PaperMapper.java
  6. 12
    0
      sstudy/src/main/java/com/xhkjedu/sstudy/mapper/paperstudent/PaperStudentMapper.java
  7. 3
    0
      sstudy/src/main/java/com/xhkjedu/sstudy/model/paper/TPaper.java
  8. 4
    0
      sstudy/src/main/java/com/xhkjedu/sstudy/model/paperstudent/TPaperStudent.java
  9. 14
    8
      sstudy/src/main/java/com/xhkjedu/sstudy/service/paper/PaperService.java
  10. 48
    21
      sstudy/src/main/java/com/xhkjedu/sstudy/service/paperstudent/PaperStudentService.java
  11. 13
    9
      sstudy/src/main/java/com/xhkjedu/sstudy/service/paperstudent/PaperStudentWebService.java
  12. 13
    0
      sstudy/src/main/java/com/xhkjedu/sstudy/task/PaperStudentTask.java
  13. 14
    0
      sstudy/src/main/java/com/xhkjedu/sstudy/utils/StudyUtil.java
  14. 5
    0
      sstudy/src/main/java/com/xhkjedu/sstudy/vo/paper/PaperListVo.java
  15. 3
    0
      sstudy/src/main/java/com/xhkjedu/sstudy/vo/paper/PaperTeacherAppVo.java
  16. 2
    0
      sstudy/src/main/java/com/xhkjedu/sstudy/vo/paperstudent/PaperGroupParam.java
  17. 23
    7
      sstudy/src/main/resources/mapper/paper/PaperMapper.xml
  18. 4
    3
      sstudy/src/main/resources/mapper/paper/PaperTeaAppMapper.xml
  19. 13
    0
      sstudy/src/main/resources/mapper/paperstudent/PaperStudentMapper.xml

+ 8
- 0
scommons/src/main/java/com/xhkjedu/constant/PlatformConstant.java Vedi File

@@ -1,5 +1,7 @@
1 1
 package com.xhkjedu.constant;
2 2
 
3
+import com.xhkjedu.vo.ResultVo;
4
+
3 5
 /*
4 6
  * @Description:项目常量
5 7
  * @Author: WN
@@ -25,4 +27,10 @@ public final class PlatformConstant {
25 27
     //请求头内容——版本号
26 28
     public static final String XH_VERSION = "Xh-Version";
27 29
 
30
+    public static final ResultVo AFTER_COMMIT = new ResultVo(3, "作业已过截止时间!");
31
+
32
+    public static final ResultVo PAPER_COMMIT = new ResultVo(3, "作业已提交!");
33
+
34
+    public static final ResultVo COMMIT_SUCCESS = new ResultVo(0, "提交成功!");
35
+
28 36
 }

+ 16
- 4
sstudy/src/main/java/com/xhkjedu/sstudy/controller/paper/PaperController.java Vedi File

@@ -213,11 +213,10 @@ public class PaperController {
213 213
     //作业列表
214 214
     @PostMapping("/list")
215 215
     public ResultVo list(@RequestBody PaperSearchVo paper) {
216
-        String lsbid = paper.getLsbid();
217 216
         Integer createid = paper.getCreateid();
218 217
         Integer page = paper.getPage();
219 218
         Integer pageSize = paper.getPageSize();
220
-        N_Utils.validation(new Object[]{lsbid,"教材关联关系id",2,createid,"教师id",1,page,"显示页码",1,pageSize,"显示条数",1});
219
+        N_Utils.validation(new Object[]{createid,"教师id",1,page,"显示页码",1,pageSize,"显示条数",1});
221 220
         UserVo userVo = userMapper.getUserInfoForHandleLog(createid);
222 221
         if (userVo != null && !userVo.getUsertype().equals(0)) {
223 222
             //获取当前教师权限班级
@@ -234,11 +233,10 @@ public class PaperController {
234 233
 
235 234
     @PostMapping("/list_my")
236 235
     public ResultVo listMy(@RequestBody PaperSearchVo paper) {
237
-        String lsbid = paper.getLsbid();
238 236
         Integer createid = paper.getCreateid();
239 237
         Integer page = paper.getPage();
240 238
         Integer pageSize = paper.getPageSize();
241
-        N_Utils.validation(new Object[]{lsbid,"教材关联关系id",2,createid,"教师id",1,page,"显示页码",1,pageSize,"显示条数",1});
239
+        N_Utils.validation(new Object[]{createid,"教师id",1,page,"显示页码",1,pageSize,"显示条数",1});
242 240
         UserVo userVo = userMapper.getUserInfoForHandleLog(createid);
243 241
         // if (userVo != null && !userVo.getUsertype().equals(0)) {
244 242
         //     //获取当前教师权限班级
@@ -385,4 +383,18 @@ public class PaperController {
385 383
         return new ResultVo(0, "成功获取作业教师和学生", rtnMap);
386 384
     }
387 385
 
386
+    /**
387
+     * @Description 修改补交状态
388
+     * @Date 2024/4/1 12:45
389
+     * @Author YWX
390
+     * @Param [paper]
391
+     * @Return com.xhkjedu.vo.ResultVo
392
+     **/
393
+    @PostMapping("/update_ac")
394
+    public ResultVo updateAfterCommit(@RequestBody TPaper paper) {
395
+        N_Utils.validation(new Object[]{paper.getPaperid(), "作业id", 1});
396
+        paperService.updateAfterCommit(paper);
397
+        return new ResultVo(0, "修改成功!");
398
+    }
399
+
388 400
 }

+ 10
- 34
sstudy/src/main/java/com/xhkjedu/sstudy/controller/paperstudent/PaperStudentController.java Vedi File

@@ -13,9 +13,9 @@ import com.xhkjedu.sstudy.vo.paperstudent.PaperStudentScantronVo;
13 13
 import com.xhkjedu.sstudy.vo.paperstudent.PaperStudentVo;
14 14
 import com.xhkjedu.utils.N_Utils;
15 15
 import com.xhkjedu.vo.ResultVo;
16
-import org.springframework.beans.factory.annotation.Autowired;
17 16
 import org.springframework.web.bind.annotation.*;
18 17
 
18
+import javax.annotation.Resource;
19 19
 import java.util.List;
20 20
 import java.util.Map;
21 21
 
@@ -28,7 +28,7 @@ import java.util.Map;
28 28
 @RestController
29 29
 @RequestMapping("/ps")
30 30
 public class PaperStudentController {
31
-    @Autowired
31
+    @Resource
32 32
     private PaperStudentService paperStudentService;
33 33
 
34 34
     /**
@@ -56,6 +56,8 @@ public class PaperStudentController {
56 56
     public ResultVo startPaper(@RequestBody TPaperStudent paperStudent) {
57 57
         Integer psid = paperStudent.getPsid();
58 58
         N_Utils.validation(new Object[]{psid,"试卷学生id",1});
59
+        ResultVo vo = paperStudentService.checkPsStateByPsId(psid);
60
+        if (vo != null) return vo;
59 61
         List<PaperStudentQuestionVo> paperQuestionBeans = paperStudentService.startPaper(psid);
60 62
         return new ResultVo(0,"开始成功!",paperQuestionBeans);
61 63
     }
@@ -101,14 +103,7 @@ public class PaperStudentController {
101 103
     @PostMapping("/submit_question")
102 104
     public ResultVo submitQuestion(@RequestBody TPaperStudentQuestion psq) {
103 105
         N_Utils.validation(new Object[]{psq.getPsqid(),"试卷学生试题id",1});
104
-        int result = 0;
105
-        try {
106
-            result = paperStudentService.submitQuestion(psq);
107
-        } catch (Exception e) {
108
-            new ResultVo(1, "提交失败!");
109
-        }
110
-        if (result >= 0) return new ResultVo(0, "提交成功!");
111
-        else return new ResultVo(1, "提交失败!");
106
+        return paperStudentService.submitQuestion(psq);
112 107
     }
113 108
 
114 109
     /**
@@ -120,14 +115,7 @@ public class PaperStudentController {
120 115
     @Action("作业管理-提交题库作业")
121 116
     public ResultVo submitPaper(@RequestBody TPaperStudent ps) {
122 117
         N_Utils.validation(new Object[]{ps.getPsid(),"试卷学生id",1});
123
-        int result = 0;
124
-        try {
125
-            result = paperStudentService.submitPaper(ps.getPsid());
126
-        } catch (Exception e) {
127
-            return new ResultVo(1, "提交失败!");
128
-        }
129
-        if (result >= 0) return new ResultVo(0, "提交成功!");
130
-        else return new ResultVo(1, "提交失败!");
118
+        return paperStudentService.submitPaper(ps.getPsid());
131 119
     }
132 120
 
133 121
     /**
@@ -262,6 +250,8 @@ public class PaperStudentController {
262 250
     public ResultVo scantronStartPaper(@RequestBody TPaperStudent paperStudent) {
263 251
         Integer psid = paperStudent.getPsid();
264 252
         N_Utils.validation(new Object[]{psid,"试卷学生id",1});
253
+        ResultVo vo = paperStudentService.checkPsStateByPsId(psid);
254
+        if (vo != null) return vo;
265 255
         List<Map> psscanlst = paperStudentService.scantronStartPaper(psid);
266 256
         return new ResultVo(0,"开始成功!",psscanlst);
267 257
     }
@@ -300,14 +290,7 @@ public class PaperStudentController {
300 290
     @PostMapping("/ssubmit_question")
301 291
     public ResultVo scantronSubmitQuestion(@RequestBody TPaperStudentScantron pss) {
302 292
         N_Utils.validation(new Object[]{pss.getPssid(),"试卷学生试题id",1});
303
-        int result = 0;
304
-        try {
305
-            result = paperStudentService.scantronSubmitQuestion(pss);
306
-        } catch (Exception e) {
307
-            return new ResultVo(1, "提交失败!");
308
-        }
309
-        if (result >= 0) return new ResultVo(0, "提交成功!");
310
-        else return new ResultVo(1, "提交失败!");
293
+        return paperStudentService.scantronSubmitQuestion(pss);
311 294
     }
312 295
     /**
313 296
      *功能描述 图片作业--提交作业
@@ -318,14 +301,7 @@ public class PaperStudentController {
318 301
     @Action("作业管理-提交附件作业")
319 302
     public ResultVo scantronSubmitPaper(@RequestBody TPaperStudent ps) {
320 303
         N_Utils.validation(new Object[]{ps.getPsid(),"试卷学生id",1});
321
-        int result = 0;
322
-        try {
323
-            result = paperStudentService.scantronSubmitPaper(ps.getPsid());
324
-        } catch (Exception e) {
325
-            return new ResultVo(1, "提交失败!");
326
-        }
327
-        if (result >= 0) return new ResultVo(0, "提交成功!");
328
-        else return new ResultVo(1, "提交失败!");
304
+        return paperStudentService.scantronSubmitPaper(ps.getPsid());
329 305
     }
330 306
 
331 307
     /**

+ 11
- 14
sstudy/src/main/java/com/xhkjedu/sstudy/controller/paperstudent/PaperStudentWebController.java Vedi File

@@ -5,6 +5,7 @@ import com.github.pagehelper.PageInfo;
5 5
 import com.xhkjedu.sstudy.model.paperstudent.TPaperStudent;
6 6
 import com.xhkjedu.sstudy.model.paperstudent.TPaperStudentQuestion;
7 7
 import com.xhkjedu.sstudy.model.paperstudent.TPaperStudentScantron;
8
+import com.xhkjedu.sstudy.service.paperstudent.PaperStudentService;
8 9
 import com.xhkjedu.sstudy.service.paperstudent.PaperStudentWebService;
9 10
 import com.xhkjedu.utils.N_Utils;
10 11
 import com.xhkjedu.utils.PageUtil;
@@ -14,12 +15,12 @@ import com.xhkjedu.sstudy.vo.paperstudent.PaperSearchVo;
14 15
 import com.xhkjedu.sstudy.vo.paperstudent.PaperStudentVo;
15 16
 import com.xhkjedu.sstudy.vo.paperstudent.PaperStudentWebVo;
16 17
 import com.xhkjedu.sstudy.vo.paperstudent.StudentPaperVo;
17
-import org.springframework.beans.factory.annotation.Autowired;
18 18
 import org.springframework.web.bind.annotation.PostMapping;
19 19
 import org.springframework.web.bind.annotation.RequestBody;
20 20
 import org.springframework.web.bind.annotation.RequestMapping;
21 21
 import org.springframework.web.bind.annotation.RestController;
22 22
 
23
+import javax.annotation.Resource;
23 24
 import java.util.List;
24 25
 
25 26
 /**
@@ -31,8 +32,10 @@ import java.util.List;
31 32
 @RestController
32 33
 @RequestMapping("/psw")
33 34
 public class PaperStudentWebController {
34
-    @Autowired
35
+    @Resource
35 36
     private PaperStudentWebService paperStudentWebService;
37
+    @Resource
38
+    private PaperStudentService paperStudentService;
36 39
 
37 40
     /**
38 41
      * 学生作业列表
@@ -64,6 +67,8 @@ public class PaperStudentWebController {
64 67
     public ResultVo startPaper(@RequestBody TPaperStudent paperStudent) {
65 68
         Integer psid = paperStudent.getPsid();
66 69
         N_Utils.validation(new Object[]{psid,"试卷学生id",1});
70
+        ResultVo vo = paperStudentService.checkPsStateByPsId(psid);
71
+        if (vo != null) return vo;
67 72
         StudentPaperVo paper = paperStudentWebService.startPaper(psid);
68 73
         return new ResultVo(0,"开始成功!",paper);
69 74
     }
@@ -79,6 +84,8 @@ public class PaperStudentWebController {
79 84
     public ResultVo scantronStartPaper(@RequestBody TPaperStudent paperStudent) {
80 85
         Integer psid = paperStudent.getPsid();
81 86
         N_Utils.validation(new Object[]{psid,"试卷学生id",1});
87
+        ResultVo vo = paperStudentService.checkPsStateByPsId(psid);
88
+        if (vo != null) return vo;
82 89
         StudentPaperVo paper = paperStudentWebService.scantronStartPaper(psid);
83 90
         return new ResultVo(0,"开始成功!",paper);
84 91
     }
@@ -96,12 +103,7 @@ public class PaperStudentWebController {
96 103
         if (N_Utils.isListEmpty(psqs)){
97 104
             return new ResultVo(1, "作答详情不能为空");
98 105
         }
99
-        try {
100
-            paperStudentWebService.submitPaper(paper);
101
-            return new ResultVo(0, "提交成功!");
102
-        } catch (Exception e) {
103
-            return new ResultVo(1, "提交失败!");
104
-        }
106
+        return paperStudentWebService.submitPaper(paper);
105 107
     }
106 108
 
107 109
     @PostMapping("/ssubmit_paper")
@@ -110,12 +112,7 @@ public class PaperStudentWebController {
110 112
         if (N_Utils.isListEmpty(pss)){
111 113
             return new ResultVo(1, "作答详情不能为空");
112 114
         }
113
-        try {
114
-            paperStudentWebService.scantronSubmitPaper(paper);
115
-            return new ResultVo(0, "提交成功!");
116
-        } catch (Exception e) {
117
-            return new ResultVo(1, "提交失败!");
118
-        }
115
+        return paperStudentWebService.scantronSubmitPaper(paper);
119 116
     }
120 117
 
121 118
     //学生作业详情——答题卡作业

+ 3
- 0
sstudy/src/main/java/com/xhkjedu/sstudy/mapper/paper/PaperMapper.java Vedi File

@@ -176,4 +176,7 @@ public interface PaperMapper extends TkMapper<TPaper> {
176 176
 
177 177
     //获取所有作业,处理学生试题关联关系
178 178
     List<TPaper> listPapersForAllFb();
179
+
180
+    //修改补交状态
181
+    void updateAfterCommit(@Param("paper") TPaper paper);
179 182
 }

+ 12
- 0
sstudy/src/main/java/com/xhkjedu/sstudy/mapper/paperstudent/PaperStudentMapper.java Vedi File

@@ -147,6 +147,15 @@ public interface PaperStudentMapper extends TkMapper<TPaperStudent> {
147 147
      */
148 148
     void updateShowanswer(@Param("stoptime") int stoptime);
149 149
 
150
+    /**
151
+     * @Description 作业自动收卷
152
+     * @Date 2024/4/1 14:38
153
+     * @Author YWX
154
+     * @Param [stoptime]
155
+     * @Return void
156
+     **/
157
+    void updatePaperRollUp(@Param("stoptime") int stoptime);
158
+
150 159
 
151 160
     //////////////////////////////////////////////学生WEB端//////////////////////////////////////////////
152 161
     //获取作业列表
@@ -224,4 +233,7 @@ public interface PaperStudentMapper extends TkMapper<TPaperStudent> {
224 233
 
225 234
     //批阅学生列表
226 235
     List<Map> listCorrectStu(@Param("ps") TPaperStudent ps);
236
+
237
+    //根据学生作业id获取提交状态
238
+    Integer getPsStateByPsId(@Param("psid") Integer psid);
227 239
 }

+ 3
- 0
sstudy/src/main/java/com/xhkjedu/sstudy/model/paper/TPaper.java Vedi File

@@ -73,6 +73,9 @@ public class TPaper extends BaseBean {
73 73
     //时间类型:1统一布置2分班布置
74 74
     private Integer timetype;
75 75
 
76
+    //补交:0不允许 1允许
77
+    private Integer aftercommit;
78
+
76 79
     //作业附件:0没有1有
77 80
     private Integer hasfile;
78 81
 

+ 4
- 0
sstudy/src/main/java/com/xhkjedu/sstudy/model/paperstudent/TPaperStudent.java Vedi File

@@ -88,4 +88,8 @@ public class TPaperStudent extends BaseBean {
88 88
     //退回原因
89 89
     private String comm;
90 90
 
91
+    @Transient
92
+    //补交:0不允许 1允许
93
+    private Integer aftercommit;
94
+
91 95
 }

+ 14
- 8
sstudy/src/main/java/com/xhkjedu/sstudy/service/paper/PaperService.java Vedi File

@@ -3,7 +3,6 @@ package com.xhkjedu.sstudy.service.paper;
3 3
 import com.alibaba.fastjson.JSON;
4 4
 import com.xhkjedu.constant.PlatformConstant;
5 5
 import com.xhkjedu.exception.MissingParametersException;
6
-import com.xhkjedu.sstudy.listener.MessageSender;
7 6
 import com.xhkjedu.sstudy.mapper.gradeclass.ClassMapper;
8 7
 import com.xhkjedu.sstudy.mapper.paper.*;
9 8
 import com.xhkjedu.sstudy.mapper.paperstudent.PaperClassMapper;
@@ -22,7 +21,6 @@ import com.xhkjedu.utils.N_Utils;
22 21
 import com.xhkjedu.vo.ResultVo;
23 22
 import com.xhkjedu.vo.system.UserVo;
24 23
 import lombok.extern.slf4j.Slf4j;
25
-import org.springframework.beans.factory.annotation.Autowired;
26 24
 import org.springframework.stereotype.Service;
27 25
 import org.springframework.transaction.annotation.Transactional;
28 26
 import org.springframework.transaction.interceptor.TransactionAspectSupport;
@@ -41,13 +39,13 @@ import java.util.stream.Collectors;
41 39
 @Slf4j
42 40
 @Service
43 41
 public class PaperService {
44
-    @Autowired
42
+    @Resource
45 43
     private PaperMapper paperMapper;
46
-    @Autowired
44
+    @Resource
47 45
     private PaperFileService paperFileService;
48
-    @Autowired
46
+    @Resource
49 47
     private PaperScantronQtypeMapper paperScantronQtypeMapper;
50
-    @Autowired
48
+    @Resource
51 49
     private PaperScantronMapper paperScantronMapper;
52 50
     @Resource
53 51
     private PaperQtypeMapper paperQtypeMapper;
@@ -57,8 +55,6 @@ public class PaperService {
57 55
     private PaperAnalyzeMapper paperAnalyzeMapper;
58 56
     @Resource
59 57
     private PaperStudentMapper paperStudentMapper;
60
-    @Autowired
61
-    private MessageSender messageSender;
62 58
     @Resource
63 59
     private ClassMapper classMapper;
64 60
     @Resource
@@ -1452,4 +1448,14 @@ public class PaperService {
1452 1448
         return rtnMap;
1453 1449
     }
1454 1450
 
1451
+    /**
1452
+     * @Description 修改补交状态
1453
+     * @Date 2024/4/1 12:45
1454
+     * @Author YWX
1455
+     * @Param [paper]
1456
+     * @Return void
1457
+     **/
1458
+    public void updateAfterCommit(TPaper paper) {
1459
+        paperMapper.updateAfterCommit(paper);
1460
+    }
1455 1461
 }

+ 48
- 21
sstudy/src/main/java/com/xhkjedu/sstudy/service/paperstudent/PaperStudentService.java Vedi File

@@ -1,6 +1,8 @@
1 1
 package com.xhkjedu.sstudy.service.paperstudent;
2 2
 
3 3
 import com.alibaba.fastjson.JSON;
4
+import com.xhkjedu.constant.PlatformConstant;
5
+import com.xhkjedu.exception.MissingParametersException;
4 6
 import com.xhkjedu.sstudy.mapper.paper.PaperMapper;
5 7
 import com.xhkjedu.sstudy.mapper.paper.PaperScantronMapper;
6 8
 import com.xhkjedu.sstudy.mapper.paperstudent.*;
@@ -10,8 +12,7 @@ import com.xhkjedu.sstudy.model.paper.TPaperScantron;
10 12
 import com.xhkjedu.sstudy.model.paperstudent.*;
11 13
 import com.xhkjedu.sstudy.model.question.TQuestion;
12 14
 import com.xhkjedu.sstudy.service.system.NoticeService;
13
-import com.xhkjedu.sstudy.utils.ArithUtil;
14
-import com.xhkjedu.sstudy.utils.ConvertUtil;
15
+import com.xhkjedu.sstudy.utils.*;
15 16
 import com.xhkjedu.sstudy.vo.paperreport.PaperRQuestionVo;
16 17
 import com.xhkjedu.sstudy.vo.paperstudent.*;
17 18
 import com.xhkjedu.utils.N_Utils;
@@ -187,11 +188,14 @@ public class PaperStudentService {
187 188
         return paperStudentMapper.updateState(psstate, pschecked, psid, operate,timestamp);
188 189
     }
189 190
 
190
-    public int submitQuestion(TPaperStudentQuestion psq) throws Exception {
191
+    public ResultVo submitQuestion(TPaperStudentQuestion psq) {
191 192
         try {
192 193
             //获取作业学生试题详情
193 194
             TPaperStudentQuestion psq1 = paperStudentQuestionService.findById(psq.getPsqid());
194
-            //获取试题详情
195
+            if (psq1 == null) throw new Exception("该学生作业不存在");
196
+            ResultVo vo = checkPsStateByPsId(psq1.getPsid());//根据学生作业id校验提交状态
197
+            if (vo != null) return vo;
198
+//获取试题详情
195 199
             TQuestion questionBean = questionMapper.selectByPrimaryKey(psq1.getQuestionid());
196 200
             psq.setChecked(0);
197 201
             psq.setAnswertime(N_Utils.getSecondTimestamp());
@@ -305,12 +309,13 @@ public class PaperStudentService {
305 309
             if (costtime == null) costtime = 0;
306 310
             psq.setCosttime(psq.getCosttime() + costtime);
307 311
             psq.setConverted(converted);
308
-            return paperStudentQuestionService.update(psq);
312
+            paperStudentQuestionService.update(psq);
309 313
 //            return updateStuScore(psq1.getPsid());//自动批改单题提交时修改学生总得分
310 314
         } catch (Exception e) {
311 315
             log.error("提交试题失败:"+e.getMessage());
312
-            throw new Exception("提交试题失败");
316
+            return new ResultVo(1, "提交失败!");
313 317
         }
318
+        return new ResultVo(0, "提交成功!");
314 319
     }
315 320
 
316 321
     /**
@@ -331,12 +336,12 @@ public class PaperStudentService {
331 336
      * @Date 2020/6/11 10:44
332 337
      * @return int
333 338
      **/
334
-    public int submitPaper(Integer psid) throws Exception {
339
+    public ResultVo submitPaper(Integer psid) {
335 340
         try {
336 341
             TPaperStudent ps = findById(psid);
337 342
             //如果学生作业不存在或是已提交,直接返回1提交成功
338
-            Integer psstate = ps.getPsstate();
339
-            if (ps == null || (psstate != 0 && psstate != 3)) return 1;
343
+            ResultVo vo = StudyUtil.checkPsState(ps);//校验学生作业提交状态
344
+            if (vo != null) return vo;
340 345
             Integer paperid = ps.getPaperid();
341 346
             Integer classid = ps.getClassid();
342 347
             TPaperStudent paperStudentBean = new TPaperStudent();
@@ -369,12 +374,20 @@ public class PaperStudentService {
369 374
                 }
370 375
             }
371 376
 
372
-            return result;
373 377
         } catch (Exception e) {
374 378
             log.error("提交作业失败:"+e.getMessage());
375 379
             TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
376
-            throw new RuntimeException("提交失败");
380
+            return new ResultVo(1, "提交失败!");
377 381
         }
382
+        return new ResultVo(0, "提交成功!");
383
+    }
384
+
385
+    //根据学生作业id校验提交状态
386
+    public ResultVo checkPsStateByPsId(Integer psid) {
387
+        Integer psstate = paperStudentMapper.getPsStateByPsId(psid);
388
+        if (psstate == null || psstate.equals(1) || psstate.equals(2)) return PlatformConstant.PAPER_COMMIT;
389
+        if (psstate.equals(4)) return PlatformConstant.AFTER_COMMIT;
390
+        return null;
378 391
     }
379 392
 
380 393
     /**
@@ -571,11 +584,13 @@ public class PaperStudentService {
571 584
      * @param  * @param pss
572 585
      * @return int
573 586
      */
574
-    public int scantronSubmitQuestion(TPaperStudentScantron pss) throws Exception {
587
+    public ResultVo scantronSubmitQuestion(TPaperStudentScantron pss) {
575 588
         try {
576 589
             //学生作业试题
577 590
             TPaperStudentScantron pss1 = paperStudentScantronService.getObjById(pss.getPssid());
578 591
             if (pss1 == null) throw new Exception("该学生作业不存在");
592
+            ResultVo vo = checkPsStateByPsId(pss1.getPsid());//根据学生作业id校验提交状态
593
+            if (vo != null) return vo;
579 594
             //获取原试题情况
580 595
             TPaperScantron scantronBean = paperScantronMapper.findById(pss1.getPscaid());
581 596
             pss.setChecked(0);
@@ -691,12 +706,13 @@ public class PaperStudentService {
691 706
             if (costtime == null) costtime = 0;
692 707
             pss.setCosttime(pss.getCosttime() + costtime);
693 708
             pss.setConverted(converted);
694
-            return paperStudentScantronService.updateStudentScantron(pss);
709
+            paperStudentScantronService.updateStudentScantron(pss);
695 710
 //            updateScantronStuScore(pss1.getPsid());//自动批改单题提交时修改学生总得分
696 711
         } catch (Exception e) {
697 712
             log.error("图片作业提交单题失败:"+e.getMessage());
698
-            throw new Exception("提交失败");
713
+            return new ResultVo(1, "提交失败!");
699 714
         }
715
+        return new ResultVo(0, "提交成功!");
700 716
     }
701 717
 
702 718
     /**
@@ -706,12 +722,11 @@ public class PaperStudentService {
706 722
      * @param  * @param psid
707 723
      * @return int
708 724
      */
709
-    public int scantronSubmitPaper(Integer psid) throws Exception {
725
+    public ResultVo scantronSubmitPaper(Integer psid) {
710 726
         try {
711 727
             TPaperStudent ps = findById(psid);
712
-            //如果学生作业不存在或是已提交,直接返回1提交成功
713
-            Integer psstate = ps.getPsstate();
714
-            if (ps == null || (psstate != 0 && psstate != 3)) return 1;
728
+            ResultVo vo = StudyUtil.checkPsState(ps);//校验学生作业提交状态
729
+            if (vo != null) return vo;
715 730
             Integer paperid = ps.getPaperid();
716 731
             Integer classid = ps.getClassid();
717 732
             TPaperStudent paperStudentBean = new TPaperStudent();
@@ -730,7 +745,7 @@ public class PaperStudentService {
730 745
                 showanswer = 1;
731 746
             }
732 747
             paperStudentBean.setShowanswer(showanswer);
733
-            Integer result = updateSPaper(psid, paperStudentBean, pg);
748
+            updateSPaper(psid, paperStudentBean, pg);
734 749
             //获取未合并的学生答案
735 750
             List<TPaperStudentScantron> list = paperStudentScantronService.listNoMergeUserAnswer(psid);
736 751
             if (N_Utils.isListNotEmpty(list)) {
@@ -741,11 +756,11 @@ public class PaperStudentService {
741 756
                     }
742 757
                 }
743 758
             }
744
-            return result;
745 759
         } catch (Exception e) {
746 760
             log.error("图片作业提交作业失败:"+e.getMessage());
747
-            throw new Exception("提交失败");
761
+            return new ResultVo(1, "提交失败!");
748 762
         }
763
+        return new ResultVo(0, "提交成功!");
749 764
     }
750 765
 
751 766
     /**
@@ -864,6 +879,18 @@ public class PaperStudentService {
864 879
         paperStudentMapper.updateShowanswer(timestamp);
865 880
     }
866 881
 
882
+    /**
883
+     * @Description 作业自动收卷
884
+     * @Date 2024/4/1 14:39
885
+     * @Author YWX
886
+     * @Param []
887
+     * @Return void
888
+     **/
889
+    public void updatePaperRollUp(){
890
+        int timestamp = N_Utils.getSecondTimestamp();
891
+        paperStudentMapper.updatePaperRollUp(timestamp);
892
+    }
893
+
867 894
 
868 895
 
869 896
     //////////////////////////////////////////////图片作业 end//////////////////////////////////////////////////////////////////////

+ 13
- 9
sstudy/src/main/java/com/xhkjedu/sstudy/service/paperstudent/PaperStudentWebService.java Vedi File

@@ -1,6 +1,8 @@
1 1
 package com.xhkjedu.sstudy.service.paperstudent;
2 2
 
3 3
 import com.alibaba.fastjson.JSON;
4
+import com.xhkjedu.constant.PlatformConstant;
5
+import com.xhkjedu.exception.MissingParametersException;
4 6
 import com.xhkjedu.sstudy.mapper.paper.PaperAnalyzeMapper;
5 7
 import com.xhkjedu.sstudy.mapper.paper.PaperMapper;
6 8
 import com.xhkjedu.sstudy.mapper.paper.PaperQtypeQuestionMapper;
@@ -21,6 +23,7 @@ import com.xhkjedu.sstudy.utils.ConvertUtil;
21 23
 import com.xhkjedu.sstudy.utils.StudyUtil;
22 24
 import com.xhkjedu.sstudy.vo.paperstudent.*;
23 25
 import com.xhkjedu.utils.N_Utils;
26
+import com.xhkjedu.vo.ResultVo;
24 27
 import lombok.extern.slf4j.Slf4j;
25 28
 import org.springframework.stereotype.Service;
26 29
 import org.springframework.transaction.annotation.Transactional;
@@ -146,7 +149,7 @@ public class PaperStudentWebService {
146 149
      * @return void
147 150
      **/
148 151
     @Transactional(rollbackFor = Exception.class)
149
-    public void submitPaper(PaperStudentWebVo paper) throws Exception {
152
+    public ResultVo submitPaper(PaperStudentWebVo paper) {
150 153
         try {
151 154
             List<TPaperStudentQuestion> psqs = paper.getPsqs();
152 155
             TPaperStudentQuestion psq = psqs.get(0);
@@ -156,8 +159,8 @@ public class PaperStudentWebService {
156 159
             Integer psid = psq.getPsid();
157 160
             TPaperStudent ps2 = paperStudentMapper.findById(psid);
158 161
             //学生作业不存在或是已提交不处理
159
-            Integer psstate = ps2.getPsstate();
160
-            if (ps2 == null || (psstate != 0 && psstate != 3)) return;
162
+            ResultVo vo = StudyUtil.checkPsState(ps2);//校验学生作业提交状态
163
+            if (vo != null) return vo;
161 164
             Integer paperid = psq.getPaperid();
162 165
             Integer classid = paper.getClassid();
163 166
             int nowTime = N_Utils.getSecondTimestamp();
@@ -319,8 +322,9 @@ public class PaperStudentWebService {
319 322
         } catch (Exception e) {
320 323
             log.error("提交试卷失败:"+e.getMessage());
321 324
             TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
322
-            throw new RuntimeException("提交试卷失败");
325
+            return new ResultVo(1, "提交失败!");
323 326
         }
327
+        return new ResultVo(0, "提交成功!");
324 328
     }
325 329
 
326 330
     /**
@@ -331,7 +335,7 @@ public class PaperStudentWebService {
331 335
      * @return void
332 336
      **/
333 337
     @Transactional(rollbackFor = Exception.class)
334
-    public void scantronSubmitPaper(PaperStudentWebVo paper) throws Exception {
338
+    public ResultVo scantronSubmitPaper(PaperStudentWebVo paper) {
335 339
         try {
336 340
             List<TPaperStudentScantron> psqs = paper.getPss();
337 341
             TPaperStudentScantron pss = psqs.get(0);
@@ -340,9 +344,8 @@ public class PaperStudentWebService {
340 344
             Integer checknum = 0;
341 345
             Integer psid = pss.getPsid();
342 346
             TPaperStudent ps2 = paperStudentMapper.findById(psid);
343
-            //学生作业不存在或是已提交不处理
344
-            Integer psstate = ps2.getPsstate();
345
-            if (ps2 == null || (psstate != 0 && psstate != 3)) return;
347
+            ResultVo vo = StudyUtil.checkPsState(ps2);//校验学生作业提交状态
348
+            if (vo != null) return vo;
346 349
             Integer paperid = pss.getPaperid();
347 350
             Integer classid = paper.getClassid();
348 351
             int nowTime = N_Utils.getSecondTimestamp();
@@ -505,8 +508,9 @@ public class PaperStudentWebService {
505 508
         } catch (Exception e) {
506 509
             log.error("图片作业提交失败:"+e.getMessage());
507 510
             TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
508
-            throw new RuntimeException("图片作业提交失败");
511
+            return new ResultVo(1, "提交失败!");
509 512
         }
513
+        return new ResultVo(0, "提交成功!");
510 514
     }
511 515
 
512 516
     /**

+ 13
- 0
sstudy/src/main/java/com/xhkjedu/sstudy/task/PaperStudentTask.java Vedi File

@@ -26,6 +26,19 @@ public class PaperStudentTask {
26 26
         paperStudentService.updateShowanswer();
27 27
     }
28 28
 
29
+    /**
30
+     * @Description 作业自动收卷
31
+     * @Date 2024/4/1 14:39
32
+     * @Author YWX
33
+     * @Param []
34
+     * @Return void
35
+     **/
36
+    @Async("threadPoolTaskScheduler")
37
+    @Scheduled(cron = "${cron.updatePaperStuShowanswer}")
38
+    public void updatePaperRollUp() {
39
+        paperStudentService.updatePaperRollUp();
40
+    }
41
+
29 42
     /**
30 43
      * 合并学生答案-题库作业
31 44
      *

+ 14
- 0
sstudy/src/main/java/com/xhkjedu/sstudy/utils/StudyUtil.java Vedi File

@@ -1,12 +1,16 @@
1 1
 package com.xhkjedu.sstudy.utils;
2 2
 
3
+import com.xhkjedu.constant.PlatformConstant;
4
+import com.xhkjedu.exception.MissingParametersException;
3 5
 import com.xhkjedu.sstudy.config.ConfigKey;
4 6
 import com.xhkjedu.sstudy.mapper.paper.PaperAnalyzeMapper;
7
+import com.xhkjedu.sstudy.model.paperstudent.TPaperStudent;
5 8
 import com.xhkjedu.sstudy.vo.paper.PaperClassVo;
6 9
 import com.xhkjedu.sstudy.vo.paper.PaperListVo;
7 10
 import com.xhkjedu.sstudy.vo.paperstudent.PaperStudentQuestionVo;
8 11
 import com.xhkjedu.sstudy.vo.paperstudent.StudentPaperTypeVo;
9 12
 import com.xhkjedu.utils.N_Utils;
13
+import com.xhkjedu.vo.ResultVo;
10 14
 import lombok.extern.slf4j.Slf4j;
11 15
 import org.apache.commons.lang3.StringUtils;
12 16
 import org.springframework.http.HttpEntity;
@@ -269,4 +273,14 @@ public class StudyUtil {
269 273
         rtnmap.put("bxclassids",bxclassids);
270 274
         return rtnmap;
271 275
     }
276
+
277
+    //校验学生作业提交状态
278
+    public static ResultVo checkPsState(TPaperStudent ps) {
279
+        //如果学生作业不存在或是已提交,直接返回提交成功
280
+        if (ps == null) return PlatformConstant.COMMIT_SUCCESS;
281
+        Integer psstate = ps.getPsstate();
282
+        if (psstate.equals(1) || psstate.equals(2)) return PlatformConstant.COMMIT_SUCCESS;
283
+        if (psstate.equals(4)) return PlatformConstant.AFTER_COMMIT;
284
+        return null;
285
+    }
272 286
 }

+ 5
- 0
sstudy/src/main/java/com/xhkjedu/sstudy/vo/paper/PaperListVo.java Vedi File

@@ -2,6 +2,7 @@ package com.xhkjedu.sstudy.vo.paper;
2 2
 
3 3
 import lombok.Data;
4 4
 
5
+import javax.persistence.Transient;
5 6
 import java.util.List;
6 7
 import java.util.Map;
7 8
 
@@ -77,4 +78,8 @@ public class PaperListVo {
77 78
 
78 79
     //是否有伙伴学校:0没有1有
79 80
     private Integer hashb;
81
+
82
+    @Transient
83
+    //补交:0不允许 1允许
84
+    private Integer aftercommit;
80 85
 }

+ 3
- 0
sstudy/src/main/java/com/xhkjedu/sstudy/vo/paper/PaperTeacherAppVo.java Vedi File

@@ -77,4 +77,7 @@ public class PaperTeacherAppVo {
77 77
 
78 78
     //是否有伙伴学校:0没有1有
79 79
     private Integer hashb;
80
+
81
+    //补交:0不允许 1允许
82
+    private Integer aftercommit;
80 83
 }

+ 2
- 0
sstudy/src/main/java/com/xhkjedu/sstudy/vo/paperstudent/PaperGroupParam.java Vedi File

@@ -56,4 +56,6 @@ public class PaperGroupParam {
56 56
     //发布年份
57 57
     private Integer year;
58 58
 
59
+    //补交:0不允许 1允许
60
+    private Integer aftercommit;
59 61
 }

+ 23
- 7
sstudy/src/main/resources/mapper/paper/PaperMapper.xml Vedi File

@@ -40,6 +40,7 @@
40 40
     <!-- 修改作业状态 -->
41 41
     <update id="updatePaperState">
42 42
         UPDATE t_paper SET paperstate=#{pg.paperstate},hashb=#{pg.hashb},committype=#{pg.committype},timetype=#{pg.timetype}
43
+        ,aftercommit=#{pg.aftercommit}
43 44
         <if test="ctypecount==0">,checktype=4</if>
44 45
         WHERE paperid= #{pg.paperid}
45 46
     </update>
@@ -88,6 +89,7 @@
88 89
         <result property="ytjnum" column="ytjnum"/>
89 90
         <result property="ypgnum" column="ypgnum"/>
90 91
         <result property="hashb" column="hashb"/>
92
+        <result property="aftercommit" column="aftercommit"/>
91 93
         <collection property="schools" ofType="java.util.Map" javaType="java.util.List"
92 94
                     select="listClass" column="{paperid=paperid,createid=createid,checkid=checkid,checktype=checktype,logschoolid=logschoolid,classids=classids}">
93 95
         </collection>
@@ -199,11 +201,11 @@
199 201
     <select id="listAll" resultMap="paperResult">
200 202
         select p.paperid,p.papername,p.papertype,p.paperclass,p.paperstate,p.checktype,p.createtime,p.schoolid,p.hasreport,p.timetype,p.hashb,
201 203
         #{paper.schoolid} logschoolid,u.username createname,pg.starttime,pg.stoptime,pg.showtype,p.papernum,p.createid,#{paper.createid} as checkid
202
-        ,group_concat(pg.classid) classids
204
+        ,group_concat(pg.classid) classids,p.aftercommit
203 205
         from t_paper p left join t_user u on p.createid=u.userid
204 206
         left join t_paper_class pg on p.paperid=pg.paperid
205 207
         left join t_director d on p.directorid=d.directorid
206
-        where p.deleted=0 and p.lsbid=#{paper.lsbid} and (d.disabled=0 or p.directorid is null)
208
+        where p.deleted=0 and (d.disabled=0 or p.directorid is null)
207 209
         <if test="userVo.usertype!=null and userVo.usertype==0">
208 210
             and p.schoolid=#{userVo.schoolid}
209 211
         </if>
@@ -212,6 +214,9 @@
212 214
             (p.hashb=1 and p.schoolid=#{paper.schoolid} and pg.classid in (${paper.classids})) or
213 215
             (pg.classid in (${paper.bxclassids})))
214 216
         </if>
217
+        <if test="paper.lsbid!=null and paper.lsbid!='0'.toString() and paper.lsbid!=''">
218
+            and p.lsbid=#{paper.lsbid}
219
+        </if>
215 220
         <if test="paper.directorid!=null and paper.directorid!='0'.toString() and paper.directorid!=''">
216 221
             and p.directorid=#{paper.directorid}
217 222
         </if>
@@ -236,11 +241,14 @@
236 241
     <select id="listAllMy" resultMap="paperResult">
237 242
         select p.paperid,p.papername,p.papertype,p.paperclass,p.paperstate,p.checktype,p.createtime,p.schoolid,p.hasreport,p.timetype,p.hashb,
238 243
         #{paper.schoolid} logschoolid,u.username createname,pg.starttime,pg.stoptime,pg.showtype,p.papernum,p.createid,#{paper.createid} as checkid
239
-        ,group_concat(pg.classid) classids
244
+        ,group_concat(pg.classid) classids,p.aftercommit
240 245
         from t_paper p left join t_user u on p.createid=u.userid
241 246
         left join t_paper_class pg on p.paperid=pg.paperid
242 247
         left join t_director d on p.directorid=d.directorid
243
-        where p.deleted=0 and p.lsbid=#{paper.lsbid} and p.createid=#{paper.createid} and (d.disabled=0 or p.directorid is null)
248
+        where p.deleted=0 and p.createid=#{paper.createid} and (d.disabled=0 or p.directorid is null)
249
+        <if test="paper.lsbid!=null and paper.lsbid!='0'.toString() and paper.lsbid!=''">
250
+            and p.lsbid=#{paper.lsbid}
251
+        </if>
244 252
         <if test="paper.directorid!=null and paper.directorid!='0'.toString() and paper.directorid!=''">
245 253
             and p.directorid=#{paper.directorid}
246 254
         </if>
@@ -266,14 +274,18 @@
266 274
     <select id="listWfbPapers" resultType="com.xhkjedu.sstudy.vo.paper.PaperListVo">
267 275
         select p.paperid,p.papername,p.papertype,p.paperclass,p.paperstate,p.checktype,p.createtime,p.createid,p.hasreport,p.schoolid
268 276
         ,(select u.username from t_user u where u.userid=p.createid)createname
277
+        ,p.aftercommit
269 278
         from t_paper p left join t_director d on p.directorid=d.directorid
270
-        where p.deleted=0 and p.lsbid=#{paper.lsbid} and p.paperstate=21 and (d.disabled=0 or p.directorid is null)
279
+        where p.deleted=0 and p.paperstate=21 and (d.disabled=0 or p.directorid is null)
271 280
         <if test="userVo.usertype!=null and userVo.usertype==0">
272 281
             and p.schoolid=#{userVo.schoolid}
273 282
         </if>
274 283
         <if test="userVo.usertype!=0">
275 284
             and p.createid=#{paper.createid}
276 285
         </if>
286
+        <if test="paper.lsbid!=null and paper.lsbid!='0'.toString() and paper.lsbid!=''">
287
+            and p.lsbid=#{paper.lsbid}
288
+        </if>
277 289
         <if test="paper.directorid!=null and paper.directorid!='0'.toString() and paper.directorid!=''">
278 290
             and p.directorid=#{paper.directorid}
279 291
         </if>
@@ -306,7 +318,7 @@
306 318
     <select id="correctList" resultMap="paperResult">
307 319
         select p.paperid,p.papername,p.papertype,p.paperclass,p.paperstate,p.checktype,p.createtime,p.schoolid,p.hasreport,p.timetype,p.hashb
308 320
         ,#{schoolid} as logschoolid,u.username createname,pg.starttime,pg.stoptime,pg.showtype,p.papernum,p.createid,#{checkid} as checkid
309
-        ,group_concat(pg.classid) classids
321
+        ,group_concat(pg.classid) classids,p.aftercommit
310 322
         from t_paper p left join t_user u on p.createid=u.userid
311 323
         left join t_paper_class pg on p.paperid=pg.paperid
312 324
         left join t_paper_student ps on p.paperid=ps.paperid and pg.classid=ps.classid
@@ -361,7 +373,7 @@
361 373
     <select id="listPaper" resultMap="paperResult">
362 374
         select p.paperid,p.papername,p.papertype,p.paperclass,p.paperstate,p.checktype,p.createtime,p.timetype
363 375
         ,pg.starttime,pg.stoptime,p.papernum,p.createid,#{paper.teacherid} as checkid,p.schoolid,#{paper.schoolid} as logschoolid
364
-        ,pg.showtype,p.hasreport,p.hashb,group_concat(pg.classid) classids
376
+        ,pg.showtype,p.hasreport,p.hashb,group_concat(pg.classid) classids,p.aftercommit
365 377
         ,(select u.username from t_user u where u.userid=p.createid)createname
366 378
         from t_paper p left join t_paper_class pg on p.paperid=pg.paperid
367 379
         left join t_class c on pg.classid=c.classid
@@ -399,6 +411,10 @@
399 411
     <update id="updatePaperDeleted">
400 412
         update t_paper set deleted=#{deleted} where paperid=#{paperid}
401 413
     </update>
414
+    <!--修改补交状态-->
415
+    <update id="updateAfterCommit">
416
+        update t_paper set aftercommit=#{paper.aftercommit} where paperid=#{paper.paperid}
417
+    </update>
402 418
 
403 419
     <!--获取作业原文件保存地址列表-->
404 420
     <select id="listSourcePath" resultType="java.lang.String">

+ 4
- 3
sstudy/src/main/resources/mapper/paper/PaperTeaAppMapper.xml Vedi File

@@ -14,6 +14,7 @@
14 14
         <result property="logschoolid" column="logschoolid"/>
15 15
         <result property="createname" column="createname"/>
16 16
         <result property="hashb" column="hashb"/>
17
+        <result property="aftercommit" column="aftercommit"/>
17 18
         <collection property="students" ofType="com.xhkjedu.sstudy.vo.paperstudent.StudentVo"
18 19
                     select="listPaperStu" column="{paperid=paperid,createid=createid,checkid=checkid,logschoolid=logschoolid,classids=classids}">
19 20
         </collection>
@@ -29,7 +30,7 @@
29 30
     <select id="listTeacherApp" resultMap="paperResult">
30 31
         select p.paperid,p.papername,p.papernum,p.papertype,p.paperclass,p.paperstate,p.checktype,p.createid,#{paper.teacherid} as checkid
31 32
         ,min(pg.starttime) as starttime,min(pg.stoptime) as stoptime,pg.checked,p.subjectid,p.paperscore,p.schoolid,#{paper.schoolid} logschoolid
32
-        ,group_concat(pg.classid) classids,p.hashb
33
+        ,group_concat(pg.classid) classids,p.hashb,p.aftercommit
33 34
         ,(select u.username from t_user u where u.userid=p.createid)createname
34 35
         from t_paper p left join t_paper_class pg on p.paperid=pg.paperid
35 36
         left join t_director d on p.directorid=d.directorid
@@ -54,7 +55,7 @@
54 55
     <select id="listMyTeacherApp" resultMap="paperResult">
55 56
         select p.paperid,p.papername,p.papernum,p.papertype,p.paperclass,p.paperstate,p.checktype,p.createid,#{paper.teacherid} as checkid
56 57
         ,min(pg.starttime) as starttime,min(pg.stoptime) as stoptime,pg.checked,p.subjectid,p.paperscore,p.schoolid,#{paper.schoolid} logschoolid
57
-        ,group_concat(pg.classid) classids,p.hashb
58
+        ,group_concat(pg.classid) classids,p.hashb,p.aftercommit
58 59
         ,(select u.username from t_user u where u.userid=p.createid)createname
59 60
         from t_paper p left join t_paper_class pg on p.paperid=pg.paperid
60 61
         left join t_director d on p.directorid=d.directorid
@@ -75,7 +76,7 @@
75 76
     <!--未布置作业列表-->
76 77
     <select id="listWbz" resultType="com.xhkjedu.sstudy.vo.paper.PaperTeacherAppVo">
77 78
         select p.paperid,p.papername,p.papernum,p.papertype,p.paperclass,p.paperstate,p.checktype,p.createid
78
-        ,p.subjectid,p.paperscore,p.schoolid
79
+        ,p.subjectid,p.paperscore,p.schoolid,p.aftercommit
79 80
         ,(select u.username from t_user u where u.userid=p.createid)createname
80 81
         from t_paper p left join t_director d on p.directorid=d.directorid
81 82
         where p.deleted=0 and p.createid=#{paper.teacherid} and p.paperstate=#{paper.psstate} and (d.disabled=0 or p.directorid is null)

+ 13
- 0
sstudy/src/main/resources/mapper/paperstudent/PaperStudentMapper.xml Vedi File

@@ -192,6 +192,15 @@
192 192
         update t_paper_student ps left join t_paper_class pg on ps.paperid=pg.paperid and ps.classid=pg.classid
193 193
         set ps.showanswer=1 where pg.pgstate=22 AND pg.showtype=1 and ps.showanswer=0 and pg.stoptime <![CDATA[ <= ]]> #{stoptime}
194 194
     </update>
195
+    <!--作业自动收卷-->
196
+    <update id="updatePaperRollUp">
197
+        update t_paper p left join t_paper_class pg on p.paperid=pg.paperid
198
+        left join t_paper_student ps on ps.paperid=pg.paperid and ps.classid=pg.classid
199
+        set ps.psstate=4,ps.stoptime=#{stoptime},pg.rollup=1
200
+        ,ps.userscore=if(p.papertype=2,(select sum(q.stuscore) from t_paper_student_scantron q where q.psid=ps.psid)
201
+            ,(select sum(q.stuscore) from t_paper_student_question q where q.psid=ps.psid))
202
+        where p.aftercommit=0 and pg.pgstate=22 and pg.rollup=0 and ps.psstate=0 and pg.stoptime <![CDATA[ <= ]]> #{stoptime}
203
+    </update>
195 204
 
196 205
 
197 206
 
@@ -418,4 +427,8 @@
418 427
         <if test="ps.psstate!=null and ps.psstate==2">and ps.psstate in(1,2)</if>
419 428
         order by field(ps.psstate,1,2,0,3)
420 429
     </select>
430
+    <!--根据学生作业id获取提交状态-->
431
+    <select id="getPsStateByPsId" resultType="java.lang.Integer">
432
+        select ps.psstate from t_paper_student ps where ps.psid=#{psid}
433
+    </select>
421 434
 </mapper>

Loading…
Annulla
Salva