Browse Source

Merge remote-tracking branch 'origin/ywx' into wn

ywx
王宁 2 months ago
parent
commit
76634cc444

+ 79
- 24
smarking/src/main/java/com/xhkjedu/smarking/controller/papercheck/MsPaperCheckController.java View File

@@ -1,17 +1,14 @@
1 1
 package com.xhkjedu.smarking.controller.papercheck;
2 2
 
3
-import com.github.pagehelper.PageHelper;
4
-import com.github.pagehelper.PageInfo;
5 3
 import com.xhkjedu.smarking.model.papercheck.MsPaperCheck;
6 4
 import com.xhkjedu.smarking.service.papercheck.MsPaperCheckService;
7 5
 import com.xhkjedu.utils.N_Utils;
8
-import com.xhkjedu.utils.PageUtil;
9
-import com.xhkjedu.vo.PageResult;
10 6
 import com.xhkjedu.vo.ResultVo;
11 7
 import org.springframework.web.bind.annotation.*;
12 8
 
13 9
 import javax.annotation.Resource;
14 10
 import java.util.List;
11
+import java.util.Map;
15 12
 
16 13
 /**
17 14
  * @Description 阅卷试卷阅卷方式表相关操作
@@ -25,33 +22,91 @@ public class MsPaperCheckController {
25 22
     private MsPaperCheckService msPaperCheckService;
26 23
 
27 24
     /**
28
-     * @Description 新增
25
+     * @Description 设置评卷方式
26
+     * @Date 2024/10/24 14:16
27
+     * @Author YWX
29 28
      * @Param [msPaperCheck]
30
-     * @Author auto
31
-     * @Date 2024-10-15
32
-     * @return com.xhkjedu.vo.ResultVo
29
+     * @Return com.xhkjedu.vo.ResultVo
33 30
      **/
34
-    @PostMapping("/save")
35
-    public ResultVo save(@RequestBody MsPaperCheck msPaperCheck) {
31
+    @PostMapping("/set_check_type")
32
+    public ResultVo setCheckType(@RequestBody MsPaperCheck msPaperCheck) {
33
+        N_Utils.validation(new Object[]{
34
+                msPaperCheck.getMpid(), "试卷id", 1
35
+                , msPaperCheck.getMblockid(), "题块id", 1
36
+                , msPaperCheck.getChecktype(), "评卷方式", 1
37
+        });
36 38
         msPaperCheckService.add(msPaperCheck);
37
-        return new ResultVo(0, "保存成功!");
39
+        return new ResultVo(0, "设置成功");
38 40
     }
39 41
 
40 42
     /**
41
-     * @Description 列表
43
+     * @Description 阅卷分配列表
44
+     * @Date 2024/10/24 14:19
45
+     * @Author YWX
42 46
      * @Param [msPaperCheck]
43
-     * @Author auto
44
-     * @Date 2024-10-15
45
-     * @return com.xhkjedu.vo.ResultVo
47
+     * @Return com.xhkjedu.vo.ResultVo
46 48
      **/
47
-    @PostMapping("/list")
48
-    public ResultVo queryList(@RequestBody MsPaperCheck msPaperCheck) {
49
-        Integer page = msPaperCheck.getPage();
50
-        Integer size = msPaperCheck.getPageSize();
51
-        N_Utils.validation(new Object[]{page, "显示页码", 1, size, "显示条数", 1});
52
-        PageHelper.startPage(page, size);
53
-        List<MsPaperCheck> list = msPaperCheckService.queryList(msPaperCheck);
54
-        PageResult pageResult = PageUtil.getPageResult(new PageInfo<>(list));
55
-        return new ResultVo(0, "查询成功!", pageResult);
49
+    @PostMapping("/list_paper_check")
50
+    public ResultVo listPaperCheck(@RequestBody MsPaperCheck msPaperCheck) {
51
+        Integer mpid = msPaperCheck.getMpid();
52
+        N_Utils.validation(new Object[]{
53
+                mpid, "试卷id", 1
54
+        });
55
+        List<Map> list = msPaperCheckService.listPaperCheck(mpid);
56
+        return new ResultVo(0, "查询成功", list);
57
+    }
58
+
59
+    /**
60
+     * @Description 设置仲裁教师
61
+     * @Date 2024/10/24 14:40
62
+     * @Author YWX
63
+     * @Param [msPaperCheck]
64
+     * @Return com.xhkjedu.vo.ResultVo
65
+     **/
66
+    @PostMapping("/set_arbitrate")
67
+    public ResultVo setArbitrate(@RequestBody MsPaperCheck msPaperCheck) {
68
+        N_Utils.validation(new Object[]{
69
+                msPaperCheck.getMpid(), "试卷id", 1
70
+                , msPaperCheck.getMblockid(), "题块id", 1
71
+                , msPaperCheck.getArbitrateid(), "仲裁教师id", 1
72
+        });
73
+        msPaperCheckService.setArbitrate(msPaperCheck);
74
+        return new ResultVo(0, "设置成功");
75
+    }
76
+
77
+    /**
78
+     * @Description 设置阅卷教师
79
+     * @Date 2024/10/24 15:24
80
+     * @Author YWX
81
+     * @Param [msPaperCheck]
82
+     * @Return com.xhkjedu.vo.ResultVo
83
+     **/
84
+    @PostMapping("/set_check_teacher")
85
+    public ResultVo setCheckTeacher(@RequestBody MsPaperCheck msPaperCheck) {
86
+        N_Utils.validation(new Object[]{
87
+                msPaperCheck.getMpid(), "试卷id", 1
88
+                , msPaperCheck.getMblockid(), "题块id", 1
89
+                , msPaperCheck.getTeachers(), "阅卷教师", 3
90
+        });
91
+        msPaperCheckService.setCheckTeacher(msPaperCheck);
92
+        return new ResultVo(0, "设置成功");
93
+    }
94
+
95
+    /**
96
+     * @Description 设置分配方式
97
+     * @Date 2024/10/24 15:42
98
+     * @Author YWX
99
+     * @Param [msPaperCheck]
100
+     * @Return com.xhkjedu.vo.ResultVo
101
+     **/
102
+    @PostMapping("/set_dispense_way")
103
+    public ResultVo setDispenseWay(@RequestBody MsPaperCheck msPaperCheck) {
104
+        N_Utils.validation(new Object[]{
105
+                msPaperCheck.getMpid(), "试卷id", 1
106
+                , msPaperCheck.getMblockid(), "题块id", 1
107
+                , msPaperCheck.getDispenseway(), "分配方式", 1
108
+        });
109
+        msPaperCheckService.setDispenseWay(msPaperCheck);
110
+        return new ResultVo(0, "设置成功");
56 111
     }
57 112
 }

+ 1
- 1
smarking/src/main/java/com/xhkjedu/smarking/mapper/exam/MsClassMapper.java View File

@@ -18,7 +18,7 @@ public interface MsClassMapper extends TkMapper<MsClass> {
18 18
     List<MsClass> listByClassIds(@Param("classids") List<Integer> classids);
19 19
 
20 20
     //考试班级
21
-    List<Map> listByExamId(@Param("examid") Integer examid);
21
+    List<Map> listByExamId(@Param("examid") Integer examid,@Param("subjectid") String subjectid);
22 22
 
23 23
     //考试关联学校班级
24 24
     List<Map> listSchoolClassByExamId(@Param("schoolid") Integer schoolid,@Param("examid") Integer examid);

+ 9
- 0
smarking/src/main/java/com/xhkjedu/smarking/mapper/papercheck/MsPaperCheckMapper.java View File

@@ -2,6 +2,10 @@ package com.xhkjedu.smarking.mapper.papercheck;
2 2
 
3 3
 import com.xhkjedu.base.TkMapper;
4 4
 import com.xhkjedu.smarking.model.papercheck.MsPaperCheck;
5
+import org.apache.ibatis.annotations.Param;
6
+
7
+import java.util.List;
8
+import java.util.Map;
5 9
 
6 10
 /**
7 11
  * @Description 阅卷试卷阅卷方式表 Mapper 接口
@@ -9,4 +13,9 @@ import com.xhkjedu.smarking.model.papercheck.MsPaperCheck;
9 13
  * @Date 2024-10-15
10 14
  */
11 15
 public interface MsPaperCheckMapper extends TkMapper<MsPaperCheck> {
16
+    //根据题块id获取阅卷方式id
17
+    Integer getMpcIdByMBlockId(@Param("mblockid") Integer mblockid);
18
+
19
+    //阅卷分配列表
20
+    List<Map> listPaperCheck(@Param("mpid") Integer mpid);
12 21
 }

+ 5
- 0
smarking/src/main/java/com/xhkjedu/smarking/mapper/papercheck/MsPaperCheckTeacherMapper.java View File

@@ -2,6 +2,9 @@ package com.xhkjedu.smarking.mapper.papercheck;
2 2
 
3 3
 import com.xhkjedu.base.TkMapper;
4 4
 import com.xhkjedu.smarking.model.papercheck.MsPaperCheckTeacher;
5
+import org.apache.ibatis.annotations.Param;
6
+
7
+import java.util.List;
5 8
 
6 9
 /**
7 10
  * @Description 阅卷批阅分配教师表 Mapper 接口
@@ -9,4 +12,6 @@ import com.xhkjedu.smarking.model.papercheck.MsPaperCheckTeacher;
9 12
  * @Date 2024-10-15
10 13
  */
11 14
 public interface MsPaperCheckTeacherMapper extends TkMapper<MsPaperCheckTeacher> {
15
+    //批量保存
16
+    void batchSave(@Param("list") List<MsPaperCheckTeacher> teachers);
12 17
 }

+ 6
- 2
smarking/src/main/java/com/xhkjedu/smarking/model/papercheck/MsPaperCheck.java View File

@@ -3,8 +3,8 @@ package com.xhkjedu.smarking.model.papercheck;
3 3
 import com.xhkjedu.model.BaseBean;
4 4
 import lombok.Data;
5 5
 
6
-import javax.persistence.Id;
7
-import javax.persistence.Table;
6
+import javax.persistence.*;
7
+import java.util.List;
8 8
 
9 9
 /**
10 10
  * @Description 阅卷试卷阅卷方式表
@@ -39,4 +39,8 @@ public class MsPaperCheck extends BaseBean {
39 39
     private Integer createid;
40 40
     //创建时间ID
41 41
     private Integer createtime;
42
+
43
+    @Transient
44
+    //阅卷教师
45
+    private List<MsPaperCheckTeacher> teachers;
42 46
 }

+ 1
- 1
smarking/src/main/java/com/xhkjedu/smarking/service/exam/MsSubjectSearchService.java View File

@@ -66,7 +66,7 @@ public class MsSubjectSearchService {
66 66
 
67 67
     // 按班设置
68 68
     public List<Map> listClassTeacher(Integer examid, String subjectid) {
69
-        List<Map> list = classMapper.listByExamId(examid);
69
+        List<Map> list = classMapper.listByExamId(examid, subjectid);
70 70
         String classids = list.stream().map(c -> c.get("classid").toString()).collect(Collectors.joining(","));
71 71
         List<Map> teacherList = classMapper.listClassTeacher(classids, subjectid);
72 72
         for (Map map : list) {

+ 1
- 1
smarking/src/main/java/com/xhkjedu/smarking/service/notice/NoticeService.java View File

@@ -131,7 +131,7 @@ public class NoticeService {
131 131
             List<TNoticeUser> users = new ArrayList<>();
132 132
             List<TMsg> msgList = new ArrayList<>();
133 133
             String noticetitle = examname + "-考试公告";
134
-            List<Map> classes = msClassMapper.listByExamId(examid);
134
+            List<Map> classes = msClassMapper.listByExamId(examid,null);
135 135
             String classids = classes.stream().map(c -> c.get("classid").toString()).collect(Collectors.joining(","));
136 136
             List<UserVo> teachers = userMapper.listTeacherByClassIds(classids);//获取考试班级任教老师
137 137
             if (notice == 1) {

+ 90
- 13
smarking/src/main/java/com/xhkjedu/smarking/service/papercheck/MsPaperCheckService.java View File

@@ -1,11 +1,16 @@
1 1
 package com.xhkjedu.smarking.service.papercheck;
2 2
 
3
+import com.xhkjedu.exception.ServiceException;
3 4
 import com.xhkjedu.smarking.mapper.papercheck.MsPaperCheckMapper;
5
+import com.xhkjedu.smarking.mapper.papercheck.MsPaperCheckTeacherMapper;
4 6
 import com.xhkjedu.smarking.model.papercheck.MsPaperCheck;
7
+import com.xhkjedu.smarking.model.papercheck.MsPaperCheckTeacher;
8
+import com.xhkjedu.utils.N_Utils;
5 9
 import org.springframework.stereotype.Service;
10
+import org.springframework.transaction.annotation.Transactional;
6 11
 
7 12
 import javax.annotation.Resource;
8
-import java.util.List;
13
+import java.util.*;
9 14
 
10 15
 /**
11 16
  * @Description 阅卷试卷阅卷方式表 服务实现类
@@ -16,26 +21,98 @@ import java.util.List;
16 21
 public class MsPaperCheckService {
17 22
     @Resource
18 23
     private MsPaperCheckMapper msPaperCheckMapper;
24
+    @Resource
25
+    private MsPaperCheckTeacherMapper msPaperCheckTeacherMapper;
26
+
27
+    /**
28
+     * @Description 设置评卷方式
29
+     * @Date 2024/10/24 14:16
30
+     * @Author YWX
31
+     * @Param [msPaperCheck]
32
+     * @Return void
33
+     **/
34
+    public void add(MsPaperCheck msPaperCheck) {
35
+        saveOrUpdate(msPaperCheck);
36
+    }
37
+
38
+    //添加或更新阅卷方式
39
+    private MsPaperCheck saveOrUpdate(MsPaperCheck msPaperCheck) {
40
+        Integer mpcid = msPaperCheckMapper.getMpcIdByMBlockId(msPaperCheck.getMblockid());
41
+        if (N_Utils.isTrueInteger(mpcid)) {
42
+            msPaperCheck.setMpcid(mpcid);
43
+            msPaperCheckMapper.updateByPrimaryKeySelective(msPaperCheck);
44
+        } else {
45
+            msPaperCheck.setCreatetime(N_Utils.getSecondTimestamp());
46
+            msPaperCheckMapper.insertSelective(msPaperCheck);
47
+        }
48
+        return msPaperCheck;
49
+    }
50
+
51
+    /**
52
+     * @Description 阅卷分配列表
53
+     * @Date 2024/10/24 14:19
54
+     * @Author YWX
55
+     * @Param [mpid]
56
+     * @Return java.util.List<java.util.Map>
57
+     **/
58
+    public List<Map> listPaperCheck(Integer mpid) {
59
+        return msPaperCheckMapper.listPaperCheck(mpid);
60
+    }
61
+
62
+    /**
63
+     * @Description 设置仲裁教师
64
+     * @Date 2024/10/24 14:40
65
+     * @Author YWX
66
+     * @Param [msPaperCheck]
67
+     * @Return void
68
+     **/
69
+    public void setArbitrate(MsPaperCheck msPaperCheck) {
70
+        saveOrUpdate(msPaperCheck);
71
+    }
19 72
 
20 73
     /**
21
-     * @Description 新增
74
+     * @Description 设置阅卷教师
75
+     * @Date 2024/10/24 15:24
76
+     * @Author YWX
22 77
      * @Param [msPaperCheck]
23
-     * @Author auto
24
-     * @Date 2024-10-15
25
-     * @return void
78
+     * @Return void
26 79
      **/
27
-    public void add(MsPaperCheck msPaperCheck){
28
-        msPaperCheckMapper.insert(msPaperCheck);
80
+    public void setCheckTeacher(MsPaperCheck msPaperCheck) {
81
+        MsPaperCheck check = saveOrUpdate(msPaperCheck);
82
+        Integer mpid = check.getMpid();
83
+        Integer mblockid = check.getMblockid();
84
+        Integer createid = msPaperCheck.getCreateid();
85
+        int timestamp = N_Utils.getSecondTimestamp();
86
+        List<MsPaperCheckTeacher> teachers = msPaperCheck.getTeachers();
87
+        for (MsPaperCheckTeacher teacher : teachers) {
88
+            teacher.setMpid(mpid);
89
+            teacher.setMblockid(mblockid);
90
+            teacher.setCreateid(createid);
91
+            teacher.setCreatetime(timestamp);
92
+        }
93
+        msPaperCheckTeacherMapper.insertList(teachers);
29 94
     }
30 95
 
31 96
     /**
32
-     * @Description 列表
97
+     * @Description 设置分配方式
98
+     * @Date 2024/10/24 15:41
99
+     * @Author YWX
33 100
      * @Param [msPaperCheck]
34
-     * @Author auto
35
-     * @Date 2024-10-15
36
-     * @return java.util.List<com.xhkjedu.smarking.model.papercheck.MsPaperCheck>
101
+     * @Return void
37 102
      **/
38
-    public List<MsPaperCheck> queryList(MsPaperCheck msPaperCheck){
39
-        return msPaperCheckMapper.selectAll();
103
+    @Transactional(rollbackFor = Exception.class)
104
+    public void setDispenseWay(MsPaperCheck msPaperCheck) {
105
+        Integer dispenseway = msPaperCheck.getDispenseway();
106
+        if (dispenseway.equals(3)) {
107
+            List<MsPaperCheckTeacher> teachers = msPaperCheck.getTeachers();
108
+            if (N_Utils.isListEmpty(teachers)) throw new ServiceException("请选择阅卷教师");
109
+            for (MsPaperCheckTeacher teacher : teachers) {
110
+                if (N_Utils.isTrueInteger(teacher.getTasknum())) {
111
+                    throw new ServiceException("请设置每位教师的阅卷任务数");
112
+                }
113
+            }
114
+            msPaperCheckTeacherMapper.batchSave(teachers);
115
+        }
116
+        saveOrUpdate(msPaperCheck);
40 117
     }
41 118
 }

+ 4
- 0
smarking/src/main/resources/mapper/exam/MsClassMapper.xml View File

@@ -22,6 +22,10 @@
22 22
         select mc.classid,mc.classname
23 23
         from ms_class mc left join t_class c on mc.classid = c.classid
24 24
         where examid=#{examid}
25
+        <if test="subjectid!=null and subjectid!='' and subjectid!='0'">
26
+            and mc.subjectid=#{subjectid}
27
+        </if>
28
+        group by mc.classid
25 29
         order by c.classtype,c.classorder,mc.mcid
26 30
     </select>
27 31
     <!--考试关联学校班级-->

+ 1
- 0
smarking/src/main/resources/mapper/exam/MsSubjectMapper.xml View File

@@ -13,6 +13,7 @@
13 13
     <select id="examOverview" resultType="java.util.Map">
14 14
         select s.msid,s.subjectid,s.subjectname,s.pstate,s.ptstate,if(ps.sstate=2,ps.mpsid,null) tjnum,count(ps.mpsid) stunum
15 15
         ,s.pbstate,s.checkset,p.answered,if(ps.checked=2,ps.mpsid,null) pynum,u.username as teachername
16
+        ,p.mpid
16 17
         from ms_subject s left join t_user u on s.teacherid=u.userid
17 18
         left join ms_paper_student ps on s.msid = ps.msid
18 19
         left join ms_paper p on p.msid = s.msid

+ 23
- 0
smarking/src/main/resources/mapper/papercheck/MsPaperCheckMapper.xml View File

@@ -1,4 +1,27 @@
1 1
 <?xml version="1.0" encoding="UTF-8"?>
2 2
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3 3
 <mapper namespace="com.xhkjedu.smarking.mapper.papercheck.MsPaperCheckMapper">
4
+    <!--根据题块id获取阅卷方式id-->
5
+    <select id="getMpcIdByMBlockId" resultType="java.lang.Integer">
6
+        select mpcid from ms_paper_check where mblockid = #{mblockid}
7
+    </select>
8
+
9
+    <resultMap id="paperCheckResultMap" type="java.util.Map">
10
+        <collection property="teachers" select="listCheckTeacher" column="mblockid"/>
11
+    </resultMap>
12
+    <!--题块阅卷教师列表-->
13
+    <select id="listCheckTeacher" resultType="java.util.Map">
14
+        select mct.teacherid,u.username as teachername
15
+        from t_user u,ms_paper_check_teacher mct
16
+        where u.userid = mct.teacherid and mct.mblockid = #{mblockid}
17
+    </select>
18
+    <!--阅卷分配列表-->
19
+    <select id="listPaperCheck" resultMap="paperCheckResultMap">
20
+        select pc.mpcid,pb.mpid,pb.mblockid,pb.blockname,pb.blockorder,pb.bqnum,pb.bqscore
21
+        ,pc.checktype,pc.dispenseway
22
+        ,if(pc.checktype=2,(select u.username from t_user u where u.userid=pc.arbitrateid),'') as arbitratename
23
+        from ms_paper_check pc right join ms_paper_block pb on pc.mblockid = pb.mblockid
24
+        where pb.mpid = #{mpid} and pb.blocktype = 2
25
+        order by pb.blockorder
26
+    </select>
4 27
 </mapper>

+ 8
- 0
smarking/src/main/resources/mapper/papercheck/MsPaperCheckTeacherMapper.xml View File

@@ -1,4 +1,12 @@
1 1
 <?xml version="1.0" encoding="UTF-8"?>
2 2
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3 3
 <mapper namespace="com.xhkjedu.smarking.mapper.papercheck.MsPaperCheckTeacherMapper">
4
+    <!--批量保存-->
5
+    <insert id="batchSave">
6
+        <foreach collection ="list" item="s" index= "index" separator =";">
7
+            insert into ms_paper_check_teacher (mpid, mblockid, teacherid, tasknum, createid, createtime)
8
+            values (#{s.mpid},#{s.mblockid},#{s.teacherid},#{s.tasknum},#{s.createid},#{s.createtime})
9
+            on duplicate key update tasknum=#{s.tasknum}
10
+        </foreach>
11
+    </insert>
4 12
 </mapper>

Loading…
Cancel
Save