| | |
| | | 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; |
| | |
| | | |
| | | @Autowired |
| | | StudentDAO dao; |
| | | |
| | | @Autowired |
| | | CommonDAO commonDAO; |
| | | |
| | | @Override |
| | | public Result insertStudent(String classId, String name, String studentNo, boolean sex, String phoneNo, String orgId) { |
| | |
| | | public Result doActivateStudent(String[] studentIds) { |
| | | for (String studentId : studentIds) { |
| | | activateStudent(studentId, StuStudent.STATUS_ACTIVE); |
| | | ModeUpdate(studentId,StuStudent.STATUS_ACTIVE); |
| | | } |
| | | return new Result(true); |
| | | } |
| | |
| | | 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); |
| | | } |
| | |
| | | } |
| | | |
| | | 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); |
| | | |