From 96286178ee1c257c130cb2ad964a781f36c4eee5 Mon Sep 17 00:00:00 2001
From: yn147 <2270338776@qq.com>
Date: 星期三, 10 五月 2023 16:23:27 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 src/main/java/com/qxueyou/scc/teach/student/service/impl/StudentService.java |   45 ++++++++++++++++++++++++++++++++++++---------
 1 files changed, 36 insertions(+), 9 deletions(-)

diff --git a/src/main/java/com/qxueyou/scc/teach/student/service/impl/StudentService.java b/src/main/java/com/qxueyou/scc/teach/student/service/impl/StudentService.java
index 13b8d8d..b43fee9 100644
--- a/src/main/java/com/qxueyou/scc/teach/student/service/impl/StudentService.java
+++ b/src/main/java/com/qxueyou/scc/teach/student/service/impl/StudentService.java
@@ -10,7 +10,9 @@
 import cn.hutool.core.date.LocalDateTimeUtil;
 import cn.hutool.core.util.RandomUtil;
 import com.qxueyou.scc.admin.classes.model.ClsClass;
+import com.qxueyou.scc.base.dao.CommonDAO;
 import com.qxueyou.scc.exam.model.ExamResultV;
+import com.qxueyou.scc.exercise.model.ExerciseCompleteInfo;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -48,6 +50,9 @@
     @Autowired
     StudentDAO dao;
 
+    @Autowired
+    CommonDAO commonDAO;
+
     @Override
     public Result insertStudent(String classId, String name, String studentNo, boolean sex, String phoneNo, String orgId) {
 
@@ -83,7 +88,7 @@
     public Result insertStudent(String classId, String name, String studentNo, boolean sex, String phoneNo, String orgId,String comName) {
 
         if (dao.exists(studentNo, orgId)) {
-            return new Result(false, "瀛﹀彿宸插瓨鍦�");
+            return new Result(false, "韬唤璇佸凡瀛樺湪");
         }
 
         User user = userService.insertUser(name, studentNo, phoneNo, "000000", sex, orgId);
@@ -92,7 +97,9 @@
 
         StuStudent student = new StuStudent();
         TraceUtils.setCreateTrace(student);
-
+        String currentTime = LocalDateTimeUtil.format(LocalDateTime.now(), "yyMMddHHmmssSSS");
+        String examCardNo = currentTime.concat(RandomUtil.randomNumbers(1));
+        student.setStudentNumber(examCardNo);
         student.setStatus(StuStudent.STATUS_ACTIVE);
         student.setClassId(classId);
         //student.setSubjectId(cls.getSubjects().get(0).getSubjectId());
@@ -155,7 +162,7 @@
         QStuStudent qStuStudent = QStuStudent.stuStudent;
         return this.getQueryFactory()
                 .select(qStuStudent.studentId, qStuStudent.name, qStuStudent.studentNo, qStuStudent.sex,
-                        qStuStudent.mobilePhone, qStuStudent.status, qStuStudent.studyDuration, qStuStudent.tenantId, qStuStudent.score,
+                        qStuStudent.mobilePhone, qStuStudent.status, qStuStudent.studyDuration, qStuStudent.tenantId, qStuStudent.score, qStuStudent.graduationText,
                         qUser.imgPath)
                 .from(qUser, qStuStudent)
                 .where(qUser.deleteFlag.isFalse().and(qUser.userId.eq(qStuStudent.userId))
@@ -172,6 +179,7 @@
                     map.put("studyDuration", tuple.get(qStuStudent.studyDuration));
                     map.put("tenantId", tuple.get(qStuStudent.tenantId));
                     map.put("score", tuple.get(qStuStudent.score));
+                    map.put("graduationText", tuple.get(qStuStudent.graduationText));
                     map.put("imgPath", tuple.get(qUser.imgPath));
                     return map;
                 }).collect(Collectors.toList());
@@ -221,6 +229,7 @@
     public Result doActivateStudent(String[] studentIds) {
         for (String studentId : studentIds) {
             activateStudent(studentId, StuStudent.STATUS_ACTIVE);
+            ModeUpdate(studentId,StuStudent.STATUS_ACTIVE);
         }
         return new Result(true);
     }
@@ -229,6 +238,24 @@
     public Result doDeActivateStudent(String[] studentIds) {
         for (String studentId : studentIds) {
             activateStudent(studentId, StuStudent.STATUS_DEACTIVE);
+            ModeUpdate(studentId,StuStudent.STATUS_DEACTIVE);
+        }
+        return new Result(true);
+    }
+
+    private Result ModeUpdate(String studentId,String status){
+        if(status.equals(StuStudent.STATUS_ACTIVE)){
+            String	hql = "from ExerciseCompleteInfo where studentId=? and deleteFlag is false";
+            List<Object> Params =  CollectionUtils.newList(studentId);
+            ExerciseCompleteInfo unique = findUnique(hql, Params, ExerciseCompleteInfo.class);
+            unique.setDeleteFlag(false);
+            commonDAO.update(unique);
+        }else {
+            String	hql = "from ExerciseCompleteInfo where studentId=? and deleteFlag is false";
+            List<Object> Params =  CollectionUtils.newList(studentId);
+            ExerciseCompleteInfo unique = findUnique(hql, Params, ExerciseCompleteInfo.class);
+            unique.setDeleteFlag(true);
+            commonDAO.update(unique);
         }
         return new Result(true);
     }
@@ -241,13 +268,13 @@
         }
 
         TraceUtils.setUpdateTrace(student);
-        String currentTime = LocalDateTimeUtil.format(LocalDateTime.now(), "yyMMddHHmmssSSS");
-
-        String examCardNo = currentTime.concat(RandomUtil.randomNumbers(1));
-
-        student.setStudentNumber(examCardNo);
+//        String currentTime = LocalDateTimeUtil.format(LocalDateTime.now(), "yyMMddHHmmssSSS");
+//
+//        String examCardNo = currentTime.concat(RandomUtil.randomNumbers(1));
+//
+//        student.setStudentNumber(examCardNo);
         student.setStatus(status);
-        save(student);
+        commonDAO.update(student);
 
         clsService.addStudent(student.getClassId(), StuStudent.STATUS_DEACTIVE.equals(status) ? -1 : 1);
 

--
Gitblit v1.8.0