夏文涛 2 jaren geleden
bovenliggende
commit
71cb64f7dc

+ 240 - 15
src/main/java/com/template/controller/SmartScoreController.java

@@ -26,6 +26,7 @@ import org.apache.poi.ss.util.CellRangeAddress;
 import org.apache.poi.xssf.usermodel.XSSFRow;
 import org.apache.poi.xssf.usermodel.XSSFSheet;
 import org.apache.poi.xssf.usermodel.XSSFWorkbook;
+import org.omg.CORBA.INTERNAL;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.util.StringUtils;
 import org.springframework.validation.BindingResult;
@@ -37,6 +38,7 @@ import org.springframework.web.multipart.MultipartFile;
 import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
 import java.io.InputStream;
+import java.math.BigDecimal;
 import java.time.LocalDateTime;
 import java.util.*;
 import java.util.stream.Collectors;
@@ -278,6 +280,22 @@ public class SmartScoreController implements SmartScoreControllerAPI {
             return CommonResult.fail("选择的用户身份非学生,无法添加成绩");
         }
 
+        SmartSubject subject = smartSubjectService.getSmartById(isr.getSubjectId());
+        if (subject == null) {
+            return CommonResult.fail(subject.getName() + "的科目数据为空,新增成绩失败");
+        }
+
+        SmartExamtype examtype = smartExamtypeService.getSmartById(isr.getExamType());
+        if (examtype == null) {
+            return CommonResult.fail(examtype.getName() + "的考试类型数据为空,新增成绩失败");
+        }
+
+        //成绩去重判断  一个学生同一个学期同一个考试类型同一个科目只能加一次
+        int existCount = smartScoreService.getExistScore(isr.getUserId(), isr.getSemesterId(), isr.getExamType(), isr.getSubjectId());
+        if (existCount > 0) {
+            return CommonResult.ok(user.getName() + "的" + isr.getSemester() + "的" + examtype.getName() + "的" + subject.getName() + "的成绩在系统中已存在");
+        }
+
         SmartScore ss = new SmartScore();
         ss.setSemester(isr.getSemester());
         ss.setSemesterId(isr.getSemesterId());
@@ -293,8 +311,58 @@ public class SmartScoreController implements SmartScoreControllerAPI {
         ss.setScore(isr.getScore());
 
         int result = smartScoreService.insertSmartScore(ss);
+        if (result <= 0) {
+            return CommonResult.fail("添加失败");
+        }
+
+        SmartExamtype examType = smartExamtypeService.getSmartById(isr.getExamType());
+        if (examType == null) {
+            return CommonResult.fail("考试类型数据为空,添加失败");
+        }
+
+        //学生综合评价中是否存在历史数据
+        //更新综合素质评价
+        SmartEvaluateStudent evaStudent = smartEvaluateStudentService.getEvaluateStudent(isr.getUserId(), isr.getSemesterId(), isr.getExamType());
+        if (evaStudent != null) {
+            BigDecimal scoreNum = new BigDecimal(evaStudent.getScoreNum()).add(new BigDecimal(isr.getScore()));
+            evaStudent.setScoreNum(scoreNum.doubleValue());
+            int updateEva = smartEvaluateStudentService.updateSmartEvaluateStudent(evaStudent);
+            if (updateEva <= 0) {
+                return CommonResult.fail("添加失败");
+            }
+        } else {
+            //region 添加到学生综合素质评价表中
+            SmartEvaluateStudent ses = new SmartEvaluateStudent();
+            ses.setTermId(isr.getSemesterId());
+            ses.setTerm(isr.getSemester());
+            ses.setGradeName(isr.getGrade());
+            ses.setGradeId(isr.getGradeId());
+            ses.setExamType(examType == null ? "" : examType.getName());
+            ses.setExamTypeId(isr.getExamType());
+            ses.setClassId(isr.getSchoolClassId());
+            ses.setClassName(isr.getSchoolClass());
+            ses.setCardNo(isr.getCardNo());
+            ses.setName(user.getName());
+            ses.setUserId(isr.getUserId());
+
+            BigDecimal totalScore = new BigDecimal(0.0);
+            List<SmartScore> userScores = smartScoreService.getScores(isr.getUserId(), isr.getSemesterId(), isr.getExamType());
+            for (SmartScore userScore : userScores) {
+                totalScore.add(new BigDecimal(userScore.getScore()));
+            }
+
+            totalScore = totalScore.add(new BigDecimal(isr.getScore()));
+            ses.setScoreNum(totalScore.doubleValue());//分数要计算 已经加进去的成绩的
 
-        return result > 0 ? CommonResult.ok("添加成功") : CommonResult.fail("添加失败");
+            Integer insertStudent = smartEvaluateStudentService.insertSmartEvaluateStudent(ses);
+
+            if (insertStudent <= 0) {
+                return CommonResult.fail("添加失败");
+            }
+            //endregion
+        }
+
+        return CommonResult.ok("添加成功");
     }
 
     @Override
@@ -310,6 +378,60 @@ public class SmartScoreController implements SmartScoreControllerAPI {
             return CommonResult.fail("成绩数据无效,无法编辑");
         }
 
+        //更新综合素质评价
+        SmartEvaluateStudent evaStudent = smartEvaluateStudentService.getEvaluateStudent(usr.getUserId(), usr.getSemesterId(), usr.getExamType());
+        if (evaStudent != null) {
+            BigDecimal scoreNum = new BigDecimal(evaStudent.getScoreNum());
+            scoreNum = scoreNum.subtract(scoreNum);
+            scoreNum = scoreNum.add(new BigDecimal(usr.getScore()));
+
+            evaStudent.setScoreNum(scoreNum.doubleValue());
+
+            int updateStudent = smartEvaluateStudentService.updateSmartEvaluateStudent(evaStudent);
+            if (updateStudent <= 0) {
+                return CommonResult.fail("编辑失败");
+            }
+        } else {
+            //判断学生是否有效
+            SmartUser user = smartUserService.getSmartById(usr.getUserId());
+            if (user == null) {
+                return CommonResult.fail("学生信息无效,无法编辑学生成绩");
+            }
+
+            SmartExamtype examType = smartExamtypeService.getSmartById(usr.getExamType());
+            if (examType == null) {
+                return CommonResult.fail("考试类型数据为空,编辑失败");
+            }
+
+            //region 添加到学生综合素质评价表中
+            SmartEvaluateStudent ses = new SmartEvaluateStudent();
+            ses.setTermId(usr.getSemesterId());
+            ses.setTerm(usr.getSemester());
+            ses.setGradeName(usr.getGrade());
+            ses.setGradeId(usr.getGradeId());
+            ses.setExamType(examType == null ? "" : examType.getName());
+            ses.setExamTypeId(usr.getExamType());
+            ses.setClassId(usr.getSchoolClassId());
+            ses.setClassName(usr.getSchoolClass());
+            ses.setCardNo(usr.getCardNo());
+            ses.setName(user.getName());
+            ses.setUserId(usr.getUserId());
+
+            BigDecimal totalScore = new BigDecimal(0.0);
+            List<SmartScore> userScores = smartScoreService.getScores(usr.getUserId(), usr.getSemesterId(), usr.getExamType());
+            for (SmartScore userScore : userScores) {
+                totalScore.add(new BigDecimal(userScore.getScore()));
+            }
+            ses.setScoreNum(totalScore.doubleValue());//分数要计算 已经加进去的成绩的
+
+            Integer insertStudent = smartEvaluateStudentService.insertSmartEvaluateStudent(ses);
+
+            if (insertStudent <= 0) {
+                return CommonResult.fail("添加失败");
+            }
+            //endregion
+        }
+
         //判断学生是否有效
         SmartUser user = smartUserService.getSmartById(usr.getUserId());
         if (user == null) {
@@ -333,9 +455,9 @@ public class SmartScoreController implements SmartScoreControllerAPI {
         score.setExamType(usr.getExamType());
         score.setScore(usr.getScore());
 
-
         int result = smartScoreService.updateSmartScore(score);
 
+
         return result > 0 ? CommonResult.ok("编辑成功") : CommonResult.fail("编辑失败");
     }
 
@@ -360,6 +482,49 @@ public class SmartScoreController implements SmartScoreControllerAPI {
     @Override
     @DESRespondSecret(validated = true)
     public CommonResult deleteSmartScoresByIds(deleteSmartScoreRequest dssr, BindingResult bindingResult) {
+        List<SmartScore> scores = smartScoreService.querySmartScoreByIds(dssr.getIds());
+        if (scores != null && scores.size() > 0) {
+            //用户 学期 考试类型
+            List<Integer> userIds = scores.stream().map(SmartScore::getUserId).collect(Collectors.toList());
+            List<Integer> semesterIds = scores.stream().map(SmartScore::getSemesterId).collect(Collectors.toList());
+            List<Integer> examTypes = scores.stream().map(SmartScore::getExamType).collect(Collectors.toList());
+            List<SmartEvaluateStudent> students = smartEvaluateStudentService.getEvaluateStudents(userIds, semesterIds, examTypes);
+
+            List<Integer> deleteStudents = new ArrayList<>();
+            for (SmartEvaluateStudent student : students) {
+                Optional<SmartScore> scoreData = scores.stream().filter(e -> e.getUserId().equals(student.getUserId()) && e.getSemesterId().equals(student.getTermId())
+                        && e.getExamType().equals(student.getExamTypeId())).findFirst();
+                if (scoreData != null && scoreData.isPresent()) {
+                    BigDecimal restScore = new BigDecimal(0.0);
+                    restScore = new BigDecimal(student.getScoreNum()).subtract(new BigDecimal(scoreData.get().getScore()));
+
+                    if (restScore.doubleValue() > 0) {
+                        student.setScoreNum(restScore.doubleValue());
+                    } else {
+                        // 删除成绩的时候如果减掉的分数小于等于零
+                        // 则把综合评价里的学生的成绩总分数数据删掉
+                        deleteStudents.add(student.getId());
+                    }
+                }
+            }
+
+            //删除和更新已有的综合评价数据
+            if (students != null && students.size() > 0) {
+                boolean updateStudents = smartEvaluateStudentService.updateBatchById(students);
+                if (!updateStudents) {
+                    return CommonResult.fail("删除失败");
+                }
+            }
+
+            if (deleteStudents != null && deleteStudents.size() > 0) {
+                int deleteStudentDatas = smartEvaluateStudentService.deleteEvaluateStudents(deleteStudents);
+                if (deleteStudentDatas <= 0) {
+                    return CommonResult.fail("删除失败");
+                }
+            }
+
+        }
+
         int result = smartScoreService.deleteSmartScoreByIds(dssr.getIds());
 
         return result > 0 ? CommonResult.ok("删除成功") : CommonResult.fail("删除失败");
@@ -469,7 +634,7 @@ public class SmartScoreController implements SmartScoreControllerAPI {
         //b表示要冻结的行数;
         //c表示右边区域[可见]的首列序号;
         //d表示下边区域[可见]的首行序号;
-        sheet.createFreezePane(6,3,0,0);
+        sheet.createFreezePane(6, 3, 0, 0);
 
         Row headerRow = sheet.createRow(0);
         for (int i = 0; i < (subjects.size() + 6); i++) {
@@ -625,6 +790,66 @@ public class SmartScoreController implements SmartScoreControllerAPI {
             return CommonResult.fail("耗材数据导入只支持Xls、Xlsx");
         }
 
+        //region 循环成绩加进综合评价学生里
+        List<SmartEvaluateStudent> addSess = new ArrayList<>();
+        List<SmartEvaluateStudent> sess = new ArrayList<>();
+        List<SmartScore> allUserScores = new ArrayList<>();
+        List<SmartExamtype> examtypes = new ArrayList<>();
+        if (result != null && result.size() > 0) {
+            List<Integer> userIds = result.stream().map(SmartScore::getUserId).collect(Collectors.toList());
+            List<Integer> semesterIds = result.stream().map(SmartScore::getSemesterId).collect(Collectors.toList());
+            List<Integer> examTypes = result.stream().map(SmartScore::getExamType).collect(Collectors.toList());
+            allUserScores = smartScoreService.getScores(userIds, semesterIds, examTypes);
+            sess = smartEvaluateStudentService.getEvaluateStudents(userIds, semesterIds, examTypes);
+            examtypes = smartExamtypeService.getSmartByIdes(examTypes);
+        }
+        for (SmartScore score : result) {
+            List<SmartScore> userScores = allUserScores == null ? new ArrayList<>() : allUserScores.stream().filter(e -> e.getUserId().equals(score.getUserId())
+                    && e.getSemesterId().equals(score.getSemesterId()) && e.getExamType().equals(score.getExamType())).collect(Collectors.toList());
+            Optional<SmartEvaluateStudent> userSes = sess.stream().filter(e -> e.getUserId().equals(score.getUserId())
+                    && e.getTermId().equals(score.getSemesterId()) && e.getExamTypeId().equals(score.getExamType())).findFirst();
+            //region 添加到学生综合素质评价表中
+            SmartEvaluateStudent ses = new SmartEvaluateStudent();
+            if (userSes != null && userSes.isPresent()) {
+                ses = userSes.get();
+                BigDecimal totalScore = new BigDecimal(ses.getScoreNum()).add(new BigDecimal(score.getScore()));
+                ses.setScoreNum(totalScore.doubleValue());//分数要计算 已经加进去的成绩的
+            } else {
+                Optional<SmartExamtype> examType = examtypes.stream().filter(e -> e.getId().equals(score.getExamType())).findFirst();
+                ses.setTermId(score.getSemesterId());
+                ses.setTerm(score.getSemester());
+                ses.setGradeName(score.getGrade());
+                ses.setGradeId(score.getGradeId());
+                ses.setExamType(examType != null && examType.isPresent() ? examType.get().getName() : "");
+                ses.setExamTypeId(score.getExamType());
+                ses.setClassId(score.getSchoolClassId());
+                ses.setClassName(score.getSchoolClass());
+                ses.setCardNo(score.getCardNo());
+                ses.setName(score.getName());
+                ses.setUserId(score.getUserId());
+
+                BigDecimal totalScore = new BigDecimal(0.0);
+
+                for (SmartScore userScore : userScores) {
+                    totalScore.add(new BigDecimal(userScore.getScore()));
+                }
+
+                totalScore = totalScore.add(new BigDecimal(score.getScore()));
+                ses.setScoreNum(totalScore.doubleValue());//分数要计算 已经加进去的成绩的
+            }
+
+            addSess.add(ses);
+            //endregion
+        }
+
+        if(addSess != null && addSess.size() > 0){
+            boolean insertEvaluate = smartEvaluateStudentService.saveBatch(addSess);
+            if (!insertEvaluate) {
+                return CommonResult.fail("导入失败");
+            }
+        }
+        //endregion
+
         boolean resultBool = smartScoreService.saveBatch(result);
 
         return resultBool ? CommonResult.ok("导入成功") : CommonResult.fail("导入失败");
@@ -651,11 +876,11 @@ public class SmartScoreController implements SmartScoreControllerAPI {
         for (SmartSubject smartSubject : list) {
             AverageScoreVo averageScoreVo = new AverageScoreVo();
             Integer smartSemesterId = smartSemester.getId();
-            Double score =smartScoreService.getAverageScore(userId,semesterId,smartSemesterId);
+            Double score = smartScoreService.getAverageScore(userId, semesterId, smartSemesterId);
             averageScoreVo.setSubjectName(smartSubject.getName());
             if (ObjectUtils.isNotEmpty(score)) {
                 averageScoreVo.setScore(score);
-            }else {
+            } else {
                 averageScoreVo.setScore(0.0);
             }
 
@@ -673,13 +898,13 @@ public class SmartScoreController implements SmartScoreControllerAPI {
             return CommonResult.ok("当前时间不属于任何学期");
         }
         String name = smartSemester.getName();
-        SmartEvaluateStudent smartEvaluateStudent =smartEvaluateStudentService.getTeacherMessage(cardNo,name);
+        SmartEvaluateStudent smartEvaluateStudent = smartEvaluateStudentService.getTeacherMessage(cardNo, name);
         HashMap<String, String> map = new HashMap<>();
         if (ObjectUtils.isNotEmpty(smartEvaluateStudent)) {
             String scoreComment = smartEvaluateStudent.getScoreComment();
-            map.put("teacherMessage",scoreComment);
-        }else {
-            map.put("teacherMessage","暂无");
+            map.put("teacherMessage", scoreComment);
+        } else {
+            map.put("teacherMessage", "暂无");
         }
         return CommonResult.ok(map);
     }
@@ -687,14 +912,14 @@ public class SmartScoreController implements SmartScoreControllerAPI {
     @Override
     @DESRespondSecret(validated = true)
     public CommonResult studentExamName(int userId) {
-       List<StudentExamNameVo> vos =smartScoreService.getstudentExamName(userId);
-       return CommonResult.ok(vos);
+        List<StudentExamNameVo> vos = smartScoreService.getstudentExamName(userId);
+        return CommonResult.ok(vos);
     }
 
     @Override
     @DESRespondSecret(validated = true)
     public CommonResult historicalExam(int userId, int semesterId, int examTypeId) {
-        List<HistoricalExamVo> list = smartScoreService.getHistoricalExam(userId,semesterId,examTypeId);
+        List<HistoricalExamVo> list = smartScoreService.getHistoricalExam(userId, semesterId, examTypeId);
         return CommonResult.ok(list);
     }
 
@@ -703,7 +928,7 @@ public class SmartScoreController implements SmartScoreControllerAPI {
     public CommonResult teachingResultsExamName(int userId) {
         SmartUser smartUser = smartUserService.getSmartById(userId);
         Integer schoolClassId = smartUser.getSchoolClass();
-        List<StudentExamNameVo> vos= smartScoreService.getTeachingResultsExamName(schoolClassId);
+        List<StudentExamNameVo> vos = smartScoreService.getTeachingResultsExamName(schoolClassId);
         return CommonResult.ok(vos);
     }
 
@@ -796,7 +1021,7 @@ public class SmartScoreController implements SmartScoreControllerAPI {
 
                     String name = dataFormatter.formatCellValue(row.getCell(0));//姓名
 
-                    if(name.equals("")){
+                    if (name.equals("")) {
                         continue;
                     }
 
@@ -965,7 +1190,7 @@ public class SmartScoreController implements SmartScoreControllerAPI {
 
                     String name = dataFormatter.formatCellValue(row.getCell(0));//姓名
 
-                    if(name.equals("")){
+                    if (name.equals("")) {
                         continue;
                     }
                     String cardNo = dataFormatter.formatCellValue(row.getCell(1));//学号

+ 9 - 0
src/main/java/com/template/model/evaluate/student/SmartEvaluateSdetail.java

@@ -17,12 +17,21 @@ public class SmartEvaluateSdetail {
     @ApiModelProperty(value = "学期")
     public String term;
 
+    @ApiModelProperty(value = "学期Id")
+    public String term_id;
+
     @ApiModelProperty(value = "学号")
     public String cardNo;
 
+    @ApiModelProperty(value = "用户ID")
+    public Integer userId;
+
     @ApiModelProperty(value = "学科")
     public String subjectName;
 
+    @ApiModelProperty(value = "学科Id")
+    public String subject_id;
+
     @ApiModelProperty(value = "分值")
     public Double scoreNum;
 

+ 17 - 2
src/main/java/com/template/model/evaluate/student/SmartEvaluateStudent.java

@@ -17,21 +17,36 @@ public class SmartEvaluateStudent {
     @ApiModelProperty(value = "学期")
     public String term;
 
-    @ApiModelProperty(value = "年级")
+    @ApiModelProperty(value = "学期Id")
+    public Integer termId;
+
+    @ApiModelProperty(value = "年级名称")
     public String gradeName;
 
-    @ApiModelProperty(value = "年级")
+    @ApiModelProperty(value = "年级Id")
+    public Integer gradeId;
+
+    @ApiModelProperty(value = "考试类型")
     public String examType;
 
+    @ApiModelProperty(value = "考试类型Id")
+    public Integer examTypeId;
+
     @ApiModelProperty(value = "班级")
     public String className;
 
+    @ApiModelProperty(value = "班级Id")
+    public Integer classId;
+
     @ApiModelProperty(value = "学号")
     public String cardNo;
 
     @ApiModelProperty(value = "姓名")
     public String name;
 
+    @ApiModelProperty(value = "用户ID")
+    private Integer userId;
+
     @ApiModelProperty(value = "分值")
     public Double scoreNum;
 

+ 3 - 0
src/main/java/com/template/model/evaluate/teacher/SmartEvaluateTdetail.java

@@ -20,6 +20,9 @@ public class SmartEvaluateTdetail {
     @ApiModelProperty(value = "学期")
     public String term;
 
+    @ApiModelProperty(value = "学期Id")
+    public String term_id;
+
     @ApiModelProperty(value = "评分项")
     public String scoreItem;
 

+ 13 - 1
src/main/java/com/template/model/evaluate/teacher/SmartEvaluateTeacher.java

@@ -20,15 +20,27 @@ public class SmartEvaluateTeacher {
     @ApiModelProperty(value = "姓名")
     public String name;
 
+    @ApiModelProperty(value = "学期Id")
+    public Integer term_id;
+
     @ApiModelProperty(value = "学期")
     public String term;
 
+    @ApiModelProperty(value = "学科Id")
+    public Integer subject_id;
+
     @ApiModelProperty(value = "学科")
     public String subject;
 
-    @ApiModelProperty(value = "班级")
+    @ApiModelProperty(value = "年级Id")
+    public Integer gradeId;
+
+    @ApiModelProperty(value = "年级")
     public String gradeName;
 
+    @ApiModelProperty(value = "班级Id")
+    public Integer classId;
+
     @ApiModelProperty(value = "班级")
     public String className;
 

+ 15 - 7
src/main/java/com/template/services/SmartEvaluateStudentService.java

@@ -18,22 +18,23 @@ import java.util.List;
  */
 public interface SmartEvaluateStudentService extends IService<SmartEvaluateStudent> {
 
-    public int insertSmartEvaluateStudent(SmartEvaluateStudent sa);
+    int insertSmartEvaluateStudent(SmartEvaluateStudent sa);
 
-    public int updateSmartEvaluateStudent(SmartEvaluateStudent sa);
+    int updateSmartEvaluateStudent(SmartEvaluateStudent sa);
 
-    public PageUtils<SmartEvaluateStudent> queryPageSmartEvaluateStudent(int currentPage, int pageCount, QueryWrapper<SmartEvaluateStudent> queryWrapper);
+    PageUtils<SmartEvaluateStudent> queryPageSmartEvaluateStudent(int currentPage, int pageCount, QueryWrapper<SmartEvaluateStudent> queryWrapper);
 
-    public int deleteSmartEvaluateStudentById(int id);
+    int deleteSmartEvaluateStudentById(int id);
 
-    public SmartEvaluateStudent getSmartEvaluateStudentById(int id);
+    SmartEvaluateStudent getSmartEvaluateStudentById(int id);
 
-    public List<SmartEvaluateStudent> getSmartEvaluateStudentList();
+    List<SmartEvaluateStudent> getSmartEvaluateStudentList();
 
-    public List<SmartEvaluateStudent> getSmartEvaluateStudentByKey(QueryWrapper<SmartEvaluateStudent> queryWrapper);
+    List<SmartEvaluateStudent> getSmartEvaluateStudentByKey(QueryWrapper<SmartEvaluateStudent> queryWrapper);
 
     /**
      * 通过学期和卡号找到当前评语
+     *
      * @param cardNo
      * @param name
      * @return
@@ -41,4 +42,11 @@ public interface SmartEvaluateStudentService extends IService<SmartEvaluateStude
     SmartEvaluateStudent getTeacherMessage(String cardNo, String name);
 
     List<HistoricalEvaluationVo> getHistoricalEvaluation(String cardNo);
+
+    List<SmartEvaluateStudent> getEvaluateStudents(List<Integer> userIds, List<Integer> semesterIds, List<Integer> examTypes);
+
+    int deleteEvaluateStudents(List<Integer> ids);
+
+    SmartEvaluateStudent getEvaluateStudent(Integer userId, Integer semesterId, Integer examType);
+
 }

+ 2 - 0
src/main/java/com/template/services/SmartExamtypeService.java

@@ -29,4 +29,6 @@ public interface SmartExamtypeService extends IService<SmartExamtype> {
 
     List<SmartExamtype> getSmartByIds(List<String> ids);
 
+    List<SmartExamtype> getSmartByIdes(List<Integer> ids);
+
 }

+ 10 - 0
src/main/java/com/template/services/SmartScoreService.java

@@ -8,6 +8,7 @@ import com.template.model.vo.HistoricalExamVo;
 import com.template.model.vo.ScorePageVo;
 import com.template.model.vo.StudentExamNameVo;
 
+import java.io.InputStream;
 import java.util.List;
 
 /**
@@ -37,6 +38,7 @@ public interface SmartScoreService extends IService<SmartScore> {
 
     /**
      * 获取该学期单个学生的单科总平均分
+     *
      * @param userId
      * @param semesterId
      * @param smartSemesterId
@@ -49,4 +51,12 @@ public interface SmartScoreService extends IService<SmartScore> {
     List<HistoricalExamVo> getHistoricalExam(int userId, int semesterId, int examTypeId);
 
     List<StudentExamNameVo> getTeachingResultsExamName(Integer schoolClassId);
+
+    Integer getExistScore(Integer userId, Integer semesterId, Integer examType, Integer subjectId);
+
+    List<SmartScore> getScores(Integer userId, Integer semesterId, Integer examType);
+
+    List<SmartScore> getScores(List<Integer> userIds, List<Integer> semesterIds, List<Integer> examTypes);
+
+    List<SmartScore> querySmartScoreByIds(List<Integer> ids);
 }

+ 26 - 0
src/main/java/com/template/services/impl/SmartEvaluateStudentServiceImpl.java

@@ -89,4 +89,30 @@ public class SmartEvaluateStudentServiceImpl extends ServiceImpl<SmartEvaluateSt
         return smartEvaluateStudentMapper.getHistoricalEvaluation(cardNo);
     }
 
+    @Override
+    public List<SmartEvaluateStudent> getEvaluateStudents(List<Integer> userIds, List<Integer> semesterIds, List<Integer> examTypes) {
+        QueryWrapper<SmartEvaluateStudent> queryWrapper = new QueryWrapper<>();
+        queryWrapper.in("user_id",userIds);
+        queryWrapper.in("semester_id",semesterIds);
+        queryWrapper.in("exam_type",examTypes);
+        List<SmartEvaluateStudent> evaluateStudents = smartEvaluateStudentMapper.selectList(queryWrapper);
+        return evaluateStudents;
+    }
+
+    @Override
+    public int deleteEvaluateStudents(List<Integer> ids) {
+        int result = smartEvaluateStudentMapper.deleteBatchIds(ids);
+        return result;
+    }
+
+    @Override
+    public SmartEvaluateStudent getEvaluateStudent(Integer userId, Integer semesterId, Integer examType) {
+        QueryWrapper<SmartEvaluateStudent> queryWrapper = new QueryWrapper<>();
+        queryWrapper.in("user_id",userId);
+        queryWrapper.in("semester_id",semesterId);
+        queryWrapper.in("exam_type",examType);
+        SmartEvaluateStudent result = smartEvaluateStudentMapper.selectOne(queryWrapper);
+        return result;
+    }
+
 }

+ 8 - 0
src/main/java/com/template/services/impl/SmartExamtypeServiceImpl.java

@@ -76,4 +76,12 @@ public class SmartExamtypeServiceImpl extends ServiceImpl<SmartExamtypeMapper, S
         List<SmartExamtype> result = smartExamtypeMapper.selectList(query);
         return result;
     }
+
+    @Override
+    public List<SmartExamtype> getSmartByIdes(List<Integer> ids) {
+        QueryWrapper<SmartExamtype> query = new QueryWrapper<>();
+        query.in(ids != null && ids.size() > 0, "id", ids);
+        List<SmartExamtype> result = smartExamtypeMapper.selectList(query);
+        return result;
+    }
 }

+ 44 - 5
src/main/java/com/template/services/impl/SmartScoreServiceImpl.java

@@ -74,9 +74,9 @@ public class SmartScoreServiceImpl extends ServiceImpl<SmartScoreMapper, SmartSc
 
 
     @Override
-    public PageUtils<ScorePageVo> querySmartScorePage(int currentPage, int pageCount, String name, String semester, String grade, String schoolClass, Integer subject, Integer examType, Double MinScore, Double MaxScore,Integer userGradeId, Integer userSchoolClass) {
+    public PageUtils<ScorePageVo> querySmartScorePage(int currentPage, int pageCount, String name, String semester, String grade, String schoolClass, Integer subject, Integer examType, Double MinScore, Double MaxScore, Integer userGradeId, Integer userSchoolClass) {
         Page<ScorePageVo> page = new Page<>(currentPage, pageCount);
-        IPage<ScorePageVo> result = smartScoreMapper.querySmartScorePage(page, name, semester, grade, schoolClass, subject, examType, MinScore, MaxScore,userGradeId,userSchoolClass);
+        IPage<ScorePageVo> result = smartScoreMapper.querySmartScorePage(page, name, semester, grade, schoolClass, subject, examType, MinScore, MaxScore, userGradeId, userSchoolClass);
         return new PageUtils<>(result);
     }
 
@@ -88,7 +88,7 @@ public class SmartScoreServiceImpl extends ServiceImpl<SmartScoreMapper, SmartSc
 
     @Override
     public Double getAverageScore(int userId, Integer semesterId, Integer smartSemesterId) {
-        return smartScoreMapper.getAverageScore(userId,semesterId,smartSemesterId);
+        return smartScoreMapper.getAverageScore(userId, semesterId, smartSemesterId);
     }
 
     @Override
@@ -97,8 +97,8 @@ public class SmartScoreServiceImpl extends ServiceImpl<SmartScoreMapper, SmartSc
     }
 
     @Override
-    public  List<HistoricalExamVo> getHistoricalExam(int userId, int semesterId, int examTypeId) {
-        List<HistoricalExamVo> list = smartScoreMapper.getHistoricalExam(userId,semesterId,examTypeId);
+    public List<HistoricalExamVo> getHistoricalExam(int userId, int semesterId, int examTypeId) {
+        List<HistoricalExamVo> list = smartScoreMapper.getHistoricalExam(userId, semesterId, examTypeId);
         return list;
     }
 
@@ -107,4 +107,43 @@ public class SmartScoreServiceImpl extends ServiceImpl<SmartScoreMapper, SmartSc
         return smartScoreMapper.getTeachingResultsExamName(schoolClassId);
     }
 
+    @Override
+    public Integer getExistScore(Integer userId, Integer semesterId, Integer examType, Integer subjectId) {
+        QueryWrapper<SmartScore> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("user_id", userId);
+        queryWrapper.eq("semester_id", semesterId);
+        queryWrapper.eq("exam_type", examType);
+        queryWrapper.eq("subject_id", subjectId);
+        Integer existCount = smartScoreMapper.selectCount(queryWrapper);
+        return existCount;
+    }
+
+    @Override
+    public List<SmartScore> getScores(Integer userId, Integer semesterId, Integer examType) {
+        QueryWrapper<SmartScore> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("user_id", userId);
+        queryWrapper.eq("semester_id", semesterId);
+        queryWrapper.eq("exam_type", examType);
+        List<SmartScore> scores = smartScoreMapper.selectList(queryWrapper);
+        return scores;
+    }
+
+    @Override
+    public List<SmartScore> getScores(List<Integer> userIds, List<Integer> semesterIds, List<Integer> examTypes) {
+        QueryWrapper<SmartScore> queryWrapper = new QueryWrapper<>();
+        queryWrapper.in("user_id", userIds);
+        queryWrapper.in("semester_id", semesterIds);
+        queryWrapper.in("exam_type", examTypes);
+        List<SmartScore> scores = smartScoreMapper.selectList(queryWrapper);
+        return scores;
+    }
+
+    @Override
+    public List<SmartScore> querySmartScoreByIds(List<Integer> ids) {
+        QueryWrapper<SmartScore> queryWrapper = new QueryWrapper<>();
+        queryWrapper.in("id",ids);
+        List<SmartScore>  scores = smartScoreMapper.selectList(queryWrapper);
+        return scores;
+    }
+
 }