Browse Source

参数

ywx
王宁 2 weeks ago
parent
commit
3c299cd642

+ 58
- 0
smarking/src/main/java/com/xhkjedu/smarking/controller/report/MsrReportparamController.java View File

@@ -0,0 +1,58 @@
1
+package com.xhkjedu.smarking.controller.report;
2
+
3
+import com.xhkjedu.smarking.model.report.reportother.MsrReportparam;
4
+import com.xhkjedu.smarking.service.report.reportother.MsrReportparamService;
5
+import com.xhkjedu.smarking.vo.report.reportother.ReportParams;
6
+import com.xhkjedu.utils.N_Utils;
7
+import com.xhkjedu.vo.ResultVo;
8
+import org.springframework.web.bind.annotation.PostMapping;
9
+import org.springframework.web.bind.annotation.RequestBody;
10
+import org.springframework.web.bind.annotation.RequestMapping;
11
+import org.springframework.web.bind.annotation.RestController;
12
+
13
+import javax.annotation.Resource;
14
+import java.util.List;
15
+
16
+/**
17
+ * @Description:考试报告参数
18
+ * @Author: WN
19
+ * @Date: 2024/12/9 15:08:10
20
+ **/
21
+@RestController
22
+@RequestMapping("/rpe")
23
+public class MsrReportparamController {
24
+    @Resource
25
+    MsrReportparamService msrReportparamService;
26
+    /*
27
+     * @Description 考试参数-保存
28
+     * @Date 2024/12/9 15:10:45
29
+     * @Author WN
30
+     * @Param [reportparam]
31
+     * @Return com.xhkjedu.vo.ResultVo
32
+     **/
33
+    @PostMapping("/save")
34
+    public ResultVo save(@RequestBody ReportParams reportparam) {
35
+        N_Utils.validation(new Object[]{reportparam.getExamid(), "考试id", 1,reportparam.getRpbelong(),"归属菜单",2});
36
+
37
+        if(reportparam.getParams() == null || reportparam.getParams().isEmpty()){
38
+            return new ResultVo(1, "参数不能为空");
39
+        }
40
+
41
+        msrReportparamService.saveReportparam(reportparam);
42
+        return new ResultVo(0, "保存成功");
43
+    }
44
+
45
+    /*
46
+     * @Description 保存参数
47
+     * @Date 2024/12/9 15:12:07
48
+     * @Author WN
49
+     * @Param [gradeparam]
50
+     * @Return com.xhkjedu.vo.ResultVo
51
+     **/
52
+    @PostMapping("/detail")
53
+    public ResultVo detail(@RequestBody ReportParams gradeparam) {
54
+        N_Utils.validation(new Object[]{gradeparam.getExamid(), "考试id", 1,gradeparam.getRpbelong(),"归属菜单",2});
55
+        List<MsrReportparam> rtnParams = msrReportparamService.listReportparamByRpbelong(gradeparam.getRpbelong(),gradeparam.getExamid());
56
+        return new ResultVo(0, "获取成功",rtnParams);
57
+    }
58
+}

+ 5
- 5
smarking/src/main/java/com/xhkjedu/smarking/controller/wholeparam/MspReportparamController.java View File

@@ -1,7 +1,7 @@
1 1
 package com.xhkjedu.smarking.controller.wholeparam;
2 2
 
3 3
 import com.xhkjedu.smarking.model.wholeparam.MspReportparam;
4
-import com.xhkjedu.smarking.service.wholeparam.MspGradeparamService;
4
+import com.xhkjedu.smarking.service.wholeparam.MspReportparamService;
5 5
 import com.xhkjedu.smarking.vo.wholeparam.GradeParams;
6 6
 import com.xhkjedu.utils.N_Utils;
7 7
 import com.xhkjedu.vo.ResultVo;
@@ -20,9 +20,9 @@ import java.util.List;
20 20
  **/
21 21
 @RestController
22 22
 @RequestMapping("/rparam")
23
-public class MspGradeparamController {
23
+public class MspReportparamController {
24 24
     @Resource
25
-    private MspGradeparamService mspGradeparamService;
25
+    private MspReportparamService mspReportparamService;
26 26
 
27 27
     /*
28 28
      * @Description 保存
@@ -41,7 +41,7 @@ public class MspGradeparamController {
41 41
             return new ResultVo(1, "参数不能为空");
42 42
         }
43 43
 
44
-        mspGradeparamService.saveGradeparam(gradeparam);
44
+        mspReportparamService.saveGradeparam(gradeparam);
45 45
         return new ResultVo(0, "保存成功",gradeparam);
46 46
     }
47 47
 
@@ -58,7 +58,7 @@ public class MspGradeparamController {
58 58
         if(gradeparam.getGradeid() == null){
59 59
             return new ResultVo(1, "年级不能为空");
60 60
         }
61
-        List<MspReportparam> rtnParams = mspGradeparamService.getMspGradeparam(gradeparam);
61
+        List<MspReportparam> rtnParams = mspReportparamService.getMspGradeparam(gradeparam);
62 62
         return new ResultVo(0, "保存成功",rtnParams);
63 63
     }
64 64
 

+ 9
- 0
smarking/src/main/java/com/xhkjedu/smarking/mapper/report/reportother/MsrReportparamMapper.java View File

@@ -2,6 +2,9 @@ package com.xhkjedu.smarking.mapper.report.reportother;
2 2
 
3 3
 import com.xhkjedu.base.TkMapper;
4 4
 import com.xhkjedu.smarking.model.report.reportother.MsrReportparam;
5
+import org.apache.ibatis.annotations.Param;
6
+
7
+import java.util.List;
5 8
 
6 9
 /**
7 10
  * @Description 阅卷指标参数-考试报告参数表 Mapper 接口
@@ -9,4 +12,10 @@ import com.xhkjedu.smarking.model.report.reportother.MsrReportparam;
9 12
  * @Date 2024-12-09
10 13
  */
11 14
 public interface MsrReportparamMapper extends TkMapper<MsrReportparam> {
15
+
16
+    //获取考试指定图例对应参数
17
+    List<MsrReportparam> listReportparamByRpbelong(@Param("rpbelong") String rpbelong,@Param("examid") Integer examid);
18
+
19
+    //批量删除
20
+    int deleteBatchReportparam(@Param("list") List<Integer> list);
12 21
 }

+ 1
- 1
smarking/src/main/java/com/xhkjedu/smarking/mapper/wholeparam/MspReportparamMapper.java View File

@@ -12,7 +12,7 @@ import java.util.List;
12 12
  * @Author: WN
13 13
  * @Date: 2024/12/2 16:14:48
14 14
  **/
15
-public interface MspGradeparamMapper extends TkMapper<MspReportparam> {
15
+public interface MspReportparamMapper extends TkMapper<MspReportparam> {
16 16
 
17 17
     //获取学校年级下指定模块参数
18 18
     List<MspReportparam> getGradeParamByGradeAndBelong(@Param("gp") GradeParams gp);

+ 121
- 0
smarking/src/main/java/com/xhkjedu/smarking/service/report/reportother/MsrReportparamService.java View File

@@ -0,0 +1,121 @@
1
+package com.xhkjedu.smarking.service.report.reportother;
2
+
3
+import com.xhkjedu.smarking.mapper.report.reportother.MsrReportparamMapper;
4
+import com.xhkjedu.smarking.mapper.wholeparam.MspReportparamMapper;
5
+import com.xhkjedu.smarking.model.report.reportother.MsrReportparam;
6
+import com.xhkjedu.smarking.model.wholeparam.MspReportparam;
7
+import com.xhkjedu.smarking.vo.report.reportother.ReportParams;
8
+import com.xhkjedu.utils.N_Utils;
9
+import org.springframework.stereotype.Service;
10
+import org.springframework.transaction.annotation.Transactional;
11
+
12
+import javax.annotation.Resource;
13
+import java.util.ArrayList;
14
+import java.util.List;
15
+import java.util.Map;
16
+import java.util.stream.Collectors;
17
+
18
+/**
19
+ * @Description:考试参数
20
+ * @Author: WN
21
+ * @Date: 2024/12/9 14:13:17
22
+ **/
23
+@Service
24
+public class MsrReportparamService {
25
+    @Resource
26
+    private MsrReportparamMapper msrReportparamMapper;
27
+    @Resource
28
+    private MspReportparamMapper mspReportparamMapper;
29
+
30
+
31
+    /*
32
+     * @Description 考试参数--保存
33
+     * @Date 2024/12/9 14:55:30
34
+     * @Author WN
35
+     * @Param [reportParams]
36
+     * @Return void
37
+     **/
38
+    @Transactional(rollbackFor = Exception.class)
39
+    public void saveReportparam(ReportParams reportParams) {
40
+        List<MsrReportparam> originalParams = msrReportparamMapper.listReportparamByRpbelong(reportParams.getRpbelong(), reportParams.getExamid());
41
+
42
+        Integer timestamp = N_Utils.getSecondTimestamp();
43
+        List<MsrReportparam> params = reportParams.getParams();
44
+        List<Integer> delids = new ArrayList<>();
45
+        for(MsrReportparam param : params) {
46
+            param.setRpbelong(reportParams.getRpbelong());
47
+            param.setExamid(reportParams.getExamid());
48
+            param.setHandleid(reportParams.getHandleid());
49
+            param.setHandletime(timestamp);
50
+            if(param.getRptype() == null) param.setRptype(0);
51
+            if(param.getGradenum() == null) param.setGradenum(0);
52
+
53
+            //如果同类型同科目的数据已存在,删除原数据
54
+            if(originalParams!= null && originalParams.size() > 0) {
55
+                MsrReportparam oldParam;
56
+                if(N_Utils.isNotEmpty(param.getSubjectid())){
57
+                    oldParam = originalParams.stream().filter(p -> param.getRptype().equals(p.getRptype()) && param.getSubjectid().equals(p.getSubjectid())).findFirst().orElse(null);
58
+                }else{
59
+                    oldParam = originalParams.stream().filter(p -> param.getRptype().equals(p.getRptype())).findFirst().orElse(null);
60
+                }
61
+                if(oldParam!= null) {
62
+                    delids.add(oldParam.getRpid());
63
+                }
64
+            }
65
+        }
66
+        if(delids.size() > 0) {
67
+            msrReportparamMapper.deleteBatchReportparam(delids);
68
+        }
69
+
70
+        msrReportparamMapper.insertList(params);
71
+    }
72
+
73
+    /*
74
+     * @Description 考试参数--获取
75
+     * @Date 2024/12/9 14:56:14
76
+     * @Author WN
77
+     * @Param [rpbelong, examid]
78
+     * @Return java.util.List<com.xhkjedu.smarking.model.report.reportother.MsrReportparam>
79
+     **/
80
+    public List<MsrReportparam> listReportparamByRpbelong(String rpbelong, Integer examid) {
81
+        return msrReportparamMapper.listReportparamByRpbelong(rpbelong, examid);
82
+    }
83
+
84
+    /*
85
+     * @Description 初始化参数
86
+     * @Date 2024/12/9 15:06:42
87
+     * @Author WN
88
+     * @Param [schoolid, gradeid, examid, handleid]
89
+     * @Return void
90
+     **/
91
+    public void initReportparam(Integer schoolid,Integer gradeid,Integer examid,Integer handleid) {
92
+        List<MspReportparam> mspParams = mspReportparamMapper.listAllByGrade(schoolid,gradeid);
93
+        List<MsrReportparam> saveParams = new ArrayList<>();
94
+        Integer timestamp = N_Utils.getSecondTimestamp();
95
+        //按类型进行分组
96
+        Map<String,List<MspReportparam>> mspParamMap = mspParams.stream().collect(Collectors.groupingBy(MspReportparam::getRpbelong));
97
+        for (Map.Entry<String, List<MspReportparam>> entry : mspParamMap.entrySet()) {
98
+            List<MspReportparam> params = entry.getValue();
99
+            //获取对应年级的
100
+            List<MspReportparam> gradeParams = params.stream().filter(p -> p.getGradeid().equals(gradeid)).collect(Collectors.toList());
101
+            if(gradeParams == null || gradeParams.size() == 0){
102
+                gradeParams = params;
103
+            }
104
+
105
+            //说明对应年级下有设置
106
+            for(MspReportparam param : gradeParams){
107
+                MsrReportparam rp = new MsrReportparam();
108
+                rp.setExamid(examid);
109
+                rp.setRpbelong(entry.getKey());
110
+                rp.setRptype(param.getRptype());
111
+                rp.setGradenum(param.getGradenum());
112
+                rp.setSubjectid(param.getSubjectid());
113
+                rp.setSzjson(param.getSzjson());
114
+                rp.setHandletime(timestamp);
115
+                rp.setHandleid(handleid);
116
+                saveParams.add(rp);
117
+            }
118
+        }
119
+        msrReportparamMapper.insertList(saveParams);
120
+    }
121
+}

+ 7
- 8
smarking/src/main/java/com/xhkjedu/smarking/service/wholeparam/MspReportparamService.java View File

@@ -1,6 +1,6 @@
1 1
 package com.xhkjedu.smarking.service.wholeparam;
2 2
 
3
-import com.xhkjedu.smarking.mapper.wholeparam.MspGradeparamMapper;
3
+import com.xhkjedu.smarking.mapper.wholeparam.MspReportparamMapper;
4 4
 import com.xhkjedu.smarking.model.wholeparam.MspReportparam;
5 5
 import com.xhkjedu.smarking.vo.wholeparam.GradeParams;
6 6
 import com.xhkjedu.utils.N_Utils;
@@ -17,9 +17,9 @@ import java.util.List;
17 17
  * @Date: 2024/12/2 16:19:44
18 18
  **/
19 19
 @Service
20
-public class MspGradeparamService {
20
+public class MspReportparamService {
21 21
     @Resource
22
-    private MspGradeparamMapper mspGradeparamMapper;
22
+    private MspReportparamMapper mspReportparamMapper;
23 23
 
24 24
     /*
25 25
      * @Description 保存参数
@@ -30,7 +30,7 @@ public class MspGradeparamService {
30 30
      **/
31 31
     @Transactional(rollbackFor = Exception.class)
32 32
     public void saveGradeparam(GradeParams gradeParams) {
33
-        List<MspReportparam> originalParams = mspGradeparamMapper.getGradeParamByGradeAndBelong(gradeParams);
33
+        List<MspReportparam> originalParams = mspReportparamMapper.getGradeParamByGradeAndBelong(gradeParams);
34 34
 
35 35
         Integer timestamp = N_Utils.getSecondTimestamp();
36 36
         List<MspReportparam> params = gradeParams.getParams();
@@ -58,11 +58,10 @@ public class MspGradeparamService {
58 58
             }
59 59
         }
60 60
         if(delids.size() > 0) {
61
-            mspGradeparamMapper.deleteGradeparam(delids);
61
+            mspReportparamMapper.deleteGradeparam(delids);
62 62
         }
63 63
 
64
-        mspGradeparamMapper.insertList(params);
65
-
64
+        mspReportparamMapper.insertList(params);
66 65
     }
67 66
 
68 67
     /*
@@ -73,6 +72,6 @@ public class MspGradeparamService {
73 72
      * @Return com.xhkjedu.smarking.model.wholeparam.MspGradeparam
74 73
      **/
75 74
     public List<MspReportparam> getMspGradeparam(GradeParams mspGradeparam) {
76
-        return mspGradeparamMapper.getGradeParamByGradeAndBelong(mspGradeparam);
75
+        return mspReportparamMapper.getGradeParamByGradeAndBelong(mspGradeparam);
77 76
     }
78 77
 }

+ 26
- 0
smarking/src/main/java/com/xhkjedu/smarking/vo/report/reportother/ReportParams.java View File

@@ -0,0 +1,26 @@
1
+package com.xhkjedu.smarking.vo.report.reportother;
2
+
3
+import com.xhkjedu.smarking.model.report.reportother.MsrReportparam;
4
+import lombok.Data;
5
+
6
+import java.util.List;
7
+
8
+/**
9
+ * @Description:报告参数
10
+ * @Author: WN
11
+ * @Date: 2024/12/9 14:25:28
12
+ **/
13
+@Data
14
+public class ReportParams {
15
+    //考试ID
16
+    private Integer examid;
17
+
18
+    //归属:allrate班级对比表综合率  gradescore分档分数线 nearline临界生群体分析 subjectshow学科考试表现
19
+    //  keystu重点学生信息
20
+    private String rpbelong;
21
+
22
+    //操作人ID
23
+    private Integer handleid;
24
+
25
+    private List<MsrReportparam> params;//所有参数集合
26
+}

+ 2
- 2
smarking/src/main/resources/application.properties View File

@@ -3,8 +3,8 @@ server.port=8090
3 3
 spring.application.name=smarking
4 4
 #\u6CE8\u518C\u5230\u6211\u4EEC\u672C\u5730\u7684eureka\u6CE8\u518C\u4E2D\u5FC3\uFF0C\u7AEF\u53E38081
5 5
 eureka.client.service-url.defaultZone=http://xhschool:Xhkjedud07@127.0.0.1:8081/eureka/
6
-eureka.client.register-with-eureka=true
7
-eureka.client.fetch-registry=true
6
+eureka.client.register-with-eureka=false
7
+eureka.client.fetch-registry=false
8 8
 #\u8BBE\u7F6Eeureka\u8F93\u51FA\u65E5\u5FD7\u7EA7\u522B
9 9
 logging.level.com.netflix=error
10 10
 

+ 11
- 0
smarking/src/main/resources/mapper/report/reportother/MsrReportparamMapper.xml View File

@@ -1,4 +1,15 @@
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.report.reportother.MsrReportparamMapper">
4
+
5
+    <!--获取考试对应参数-->
6
+    <select id="listReportparamByRpbelong" resultType="com.xhkjedu.smarking.model.report.reportother.MsrReportparam">
7
+        select * from msr_reportparam where examid=#{examid} and rpbelong = #{rpbelong}
8
+    </select>
9
+
10
+    <!--删除-->
11
+    <delete id="deleteBatchReportparam">
12
+        delete from msp_reportparam where rpid in
13
+        <foreach collection="list" item="rpid" open="(" separator="," close=")">#{rpid}</foreach>
14
+    </delete>
4 15
 </mapper>

+ 1
- 1
smarking/src/main/resources/mapper/wholeparam/MspReportparamMapper.xml View File

@@ -1,6 +1,6 @@
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
-<mapper namespace="com.xhkjedu.smarking.mapper.wholeparam.MspGradeparamMapper">
3
+<mapper namespace="com.xhkjedu.smarking.mapper.wholeparam.MspReportparamMapper">
4 4
 
5 5
     <!--获取学校年级下指定模块参数-->
6 6
     <select id="getGradeParamByGradeAndBelong" resultType="com.xhkjedu.smarking.model.wholeparam.MspReportparam">

Loading…
Cancel
Save