소스 검색

作业报告班级

tags/正式3.10.0
雍文秀 1 년 전
부모
커밋
55b6d22604

+ 3
- 2
sstudy/src/main/java/com/xhkjedu/sstudy/controller/paper/PaperAnalyzeController.java 파일 보기

@@ -158,8 +158,9 @@ public class PaperAnalyzeController {
158 158
     public ResultVo paperClass(@RequestBody TPaper paper){
159 159
         Integer paperid = paper.getPaperid();
160 160
         Integer schoolid = paper.getSchoolid();
161
-        N_Utils.validation(new Object[]{paperid,"作业id",1,schoolid,"学校id",1});
162
-        List<Map> list = paperAnalyzeService.listPaperClass(paperid,schoolid);
161
+        Integer createid = paper.getCreateid();
162
+        N_Utils.validation(new Object[]{paperid,"作业id",1,schoolid,"学校id",1,createid,"用户id",1});
163
+        List<Map> list = paperAnalyzeService.listPaperClass(paperid,schoolid,createid);
163 164
         return new ResultVo(0,"获取作业班级列表成功",list);
164 165
     }
165 166
 

+ 2
- 1
sstudy/src/main/java/com/xhkjedu/sstudy/mapper/paper/PaperAnalyzeMapper.java 파일 보기

@@ -192,7 +192,8 @@ public interface PaperAnalyzeMapper extends TkMapper<TPaperAnalyze> {
192 192
      * @Date 2020/9/23 16:58
193 193
      * @return java.util.List<com.xhkjedu.vo.gradeclass.ClassVo>
194 194
      **/
195
-    List<Map> listPaperClass(Integer paperid, Integer schoolid);
195
+    List<Map> listPaperClass(@Param("paperid") Integer paperid,@Param("schoolid") Integer schoolid
196
+            ,@Param("classids") String classids);
196 197
 
197 198
     /**
198 199
      * 作业班级学生列表

+ 2
- 16
sstudy/src/main/java/com/xhkjedu/sstudy/service/gradeclass/ClassService.java 파일 보기

@@ -1,6 +1,7 @@
1 1
 package com.xhkjedu.sstudy.service.gradeclass;
2 2
 
3 3
 import com.xhkjedu.sstudy.mapper.gradeclass.ClassMapper;
4
+import com.xhkjedu.sstudy.utils.StudyUtil;
4 5
 import com.xhkjedu.utils.N_Utils;
5 6
 import org.apache.commons.lang3.StringUtils;
6 7
 import org.springframework.stereotype.Service;
@@ -30,21 +31,6 @@ public class ClassService {
30 31
         //获取教师权限下班级包含集团校
31 32
         List<Map> classlist = classMapper.listQxClassByTeacherid(teacherid, year);
32 33
 
33
-        //所有权限班级集合
34
-        List<Integer> classidlist = classlist.stream().map(s -> Integer.parseInt(s.get("classid").toString())).collect(Collectors.toList());
35
-        //本校班级集合
36
-        List<Integer> bxclassidlist = classlist.stream().filter(c -> c.get("schoolid").equals(c.get("userschoolid")))
37
-                                               .map(s -> Integer.parseInt(s.get("classid").toString())).collect(Collectors.toList());
38
-
39
-        String classids = StringUtils.join(classidlist, ",");
40
-        String bxclassids = StringUtils.join(bxclassidlist,",");
41
-        if(N_Utils.isEmpty(classids)) classids = "0";
42
-        if(N_Utils.isEmpty(bxclassids)) bxclassids = "0";
43
-
44
-        Map rtnmap = new HashMap();
45
-        rtnmap.put("classids",classids);
46
-        rtnmap.put("bxclassids",bxclassids);
47
-
48
-        return rtnmap;
34
+        return StudyUtil.setQxClass(classlist);
49 35
     }
50 36
 }

+ 16
- 5
sstudy/src/main/java/com/xhkjedu/sstudy/service/paper/PaperAnalyzeService.java 파일 보기

@@ -16,7 +16,6 @@ import com.xhkjedu.sstudy.vo.paper.*;
16 16
 import com.xhkjedu.sstudy.vo.paperstudent.StudentPaperTypeVo;
17 17
 import com.xhkjedu.sstudy.vo.paperstudent.StudentPaperVo;
18 18
 import com.xhkjedu.utils.N_Utils;
19
-import org.springframework.beans.factory.annotation.Autowired;
20 19
 import org.springframework.stereotype.Service;
21 20
 
22 21
 import javax.annotation.Resource;
@@ -31,9 +30,9 @@ import java.util.stream.Collectors;
31 30
  **/
32 31
 @Service
33 32
 public class PaperAnalyzeService {
34
-    @Autowired
33
+    @Resource
35 34
     private PaperAnalyzeMapper paperAnalyzeMapper;
36
-    @Autowired
35
+    @Resource
37 36
     private PaperMapper paperMapper;
38 37
     @Resource
39 38
     private ClassMapper classMapper;
@@ -233,8 +232,20 @@ public class PaperAnalyzeService {
233 232
      * @Date 2020/9/23 16:58
234 233
      * @return java.util.List<com.xhkjedu.sstudy.vo.gradeclass.ClassVo>
235 234
      **/
236
-    public List<Map> listPaperClass(Integer paperid, Integer schoolid) {
237
-        return paperAnalyzeMapper.listPaperClass(paperid, schoolid);
235
+    public List<Map> listPaperClass(Integer paperid, Integer schoolid, Integer createid) {
236
+        TPaper paper = paperMapper.selectByPrimaryKey(paperid);
237
+        Integer hashb = paper.getHashb();
238
+        List<Map> classlist = classMapper.listQxClassByTeacherid(createid, paper.getYear());
239
+        Map<String, String> cmap = StudyUtil.setQxClass(classlist);
240
+        String classids;
241
+        if (createid.equals(paper.getCreateid())) {//自己发布的看所有班级
242
+            classids = null;
243
+        } else if (hashb == 1 && paper.getSchoolid().equals(schoolid)) {//有伙伴学校并且是本校发的
244
+            classids = cmap.get("classids");
245
+        } else {
246
+            classids = cmap.get("bxclassids");
247
+        }
248
+        return paperAnalyzeMapper.listPaperClass(paperid, schoolid, classids);
238 249
     }
239 250
 
240 251
     /**

+ 27
- 4
sstudy/src/main/java/com/xhkjedu/sstudy/utils/StudyUtil.java 파일 보기

@@ -8,6 +8,7 @@ import com.xhkjedu.sstudy.vo.paperstudent.PaperStudentQuestionVo;
8 8
 import com.xhkjedu.sstudy.vo.paperstudent.StudentPaperTypeVo;
9 9
 import com.xhkjedu.utils.N_Utils;
10 10
 import lombok.extern.slf4j.Slf4j;
11
+import org.apache.commons.lang3.StringUtils;
11 12
 import org.springframework.http.HttpEntity;
12 13
 import org.springframework.http.HttpHeaders;
13 14
 import org.springframework.http.MediaType;
@@ -16,10 +17,7 @@ import org.springframework.util.MultiValueMap;
16 17
 import org.springframework.web.client.RestClientException;
17 18
 import org.springframework.web.client.RestTemplate;
18 19
 
19
-import java.util.ArrayList;
20
-import java.util.LinkedHashMap;
21
-import java.util.List;
22
-import java.util.Map;
20
+import java.util.*;
23 21
 import java.util.concurrent.ConcurrentHashMap;
24 22
 import java.util.stream.Collectors;
25 23
 
@@ -246,4 +244,29 @@ public class StudyUtil {
246 244
         }
247 245
         return list;
248 246
     }
247
+
248
+    /**
249
+     * @Description 教师权限班级
250
+     * @Param [classlist]
251
+     * @Author ywx
252
+     * @Date 2023/7/31 14:03
253
+     * @return java.util.Map
254
+     **/
255
+    public static Map setQxClass(List<Map> classlist) {
256
+        //所有权限班级集合
257
+        List<Integer> classidlist = classlist.stream().map(s -> Integer.parseInt(s.get("classid").toString())).collect(Collectors.toList());
258
+        //本校班级集合
259
+        List<Integer> bxclassidlist = classlist.stream().filter(c -> c.get("schoolid").equals(c.get("userschoolid")))
260
+                                               .map(s -> Integer.parseInt(s.get("classid").toString())).collect(Collectors.toList());
261
+
262
+        String classids = StringUtils.join(classidlist, ",");
263
+        String bxclassids = StringUtils.join(bxclassidlist,",");
264
+        if(N_Utils.isEmpty(classids)) classids = "0";
265
+        if(N_Utils.isEmpty(bxclassids)) bxclassids = "0";
266
+
267
+        Map rtnmap = new HashMap();
268
+        rtnmap.put("classids",classids);
269
+        rtnmap.put("bxclassids",bxclassids);
270
+        return rtnmap;
271
+    }
249 272
 }

+ 1
- 0
sstudy/src/main/resources/mapper/paper/PaperAnalyzeMapper.xml 파일 보기

@@ -314,6 +314,7 @@
314 314
         from t_paper_class pg left join t_class c on pg.classid = c.classid
315 315
         left join t_school s on c.schoolid = s.schoolid
316 316
         where pg.paperid=#{paperid}
317
+        <if test="classids!=null and classids!=''"> and pg.classid in (${classids})</if>
317 318
         group by pg.classid order by case c.schoolid when #{schoolid} then 0 else c.schoolid end,c.gradeid,c.classtype,c.classorder
318 319
     </select>
319 320
     <!--作业班级学生列表-->

Loading…
취소
저장