renqianlong 1 năm trước cách đây
mục cha
commit
6998e4b080

+ 17 - 7
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/service/impl/ClassGradeServiceImpl.java

@@ -946,15 +946,25 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
 
     @Override
     public HashMap<String, Object> getPlush(ClassGradeUserQueryBo bo) {
-        List<ClassGradeStudentVo> classGradeStudentVos = this.baseMapper.listGradeAll(bo);
-        bo.setPeriodPlush(1);
-        Integer plush = this.baseMapper.getPlush(bo);
         HashMap<String, Object> stringObjectHashMap = new HashMap<>();
-        stringObjectHashMap.put("plush",plush);
-        if (classGradeStudentVos.size()<=plush){
-            stringObjectHashMap.put("notPlush",0);
+        if(ObjectUtils.isNotEmpty(bo.getPeriodPlush())&&bo.getPeriodPlush()!=1){
+            List<ClassGradeStudentVo> classGradeStudentVos = this.baseMapper.listGradeAll(bo);
+            stringObjectHashMap.put("notPlush",classGradeStudentVos.size());
+            stringObjectHashMap.put("plush",0);
         }else {
-            stringObjectHashMap.put("notPlush",classGradeStudentVos.size()-plush);
+            List<ClassGradeStudentVo> classGradeStudentVos= this.baseMapper.listGradeAll(bo);
+            if (!classGradeStudentVos.isEmpty()){
+                int plush = classGradeStudentVos.stream().filter(s -> s.getPeriodPlush().equals(1)).collect(Collectors.toList()).size();
+                stringObjectHashMap.put("plush",plush);
+                if (classGradeStudentVos.size()<=plush){
+                    stringObjectHashMap.put("notPlush",0);
+                }else {
+                    stringObjectHashMap.put("notPlush",classGradeStudentVos.size()-plush);
+                }
+            }else {
+                stringObjectHashMap.put("notPlush",0);
+                stringObjectHashMap.put("plush",0);
+            }
         }
         return stringObjectHashMap;
     }