|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.qxueyou.scc.base.model.Result; | 
|---|
|  |  |  | import com.qxueyou.scc.teach.student.model.StuStudent; | 
|---|
|  |  |  | import com.qxueyou.scc.teach.subject.model.Subject; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import java.util.List; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 打卡 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | String attendanceUpAndAdd(String studentId,String SubjectId); | 
|---|
|  |  |  | String attendanceUpAndAdd(String userId,String SubjectId, String subjectName); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 查询考勤信息 | 
|---|
|  |  |  | 
|---|
|  |  |  | package com.qxueyou.scc.admin.attendance.impl; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.qxueyou.scc.admin.attendance.AttendanceService; | 
|---|
|  |  |  | import com.qxueyou.scc.admin.classes.model.ClsClassReSubject; | 
|---|
|  |  |  | import com.qxueyou.scc.base.model.Pager; | 
|---|
|  |  |  | import com.qxueyou.scc.base.model.Result; | 
|---|
|  |  |  | import com.qxueyou.scc.base.service.ICommonService; | 
|---|
|  |  |  | 
|---|
|  |  |  | import com.qxueyou.scc.base.util.CollectionUtils; | 
|---|
|  |  |  | import com.qxueyou.scc.base.util.TraceUtils; | 
|---|
|  |  |  | import com.qxueyou.scc.teach.student.model.StuStudent; | 
|---|
|  |  |  | import com.qxueyou.scc.teach.subject.model.Subject; | 
|---|
|  |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
|---|
|  |  |  | import org.springframework.beans.factory.annotation.Qualifier; | 
|---|
|  |  |  | import org.springframework.stereotype.Service; | 
|---|
|  |  |  | 
|---|
|  |  |  | public class AttendanceServiceImpl extends CommonAppService implements AttendanceService { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public String attendanceUpAndAdd(String studentId, String subjectId) { | 
|---|
|  |  |  | public String attendanceUpAndAdd(String userId, String subjectId, String subjectName) { | 
|---|
|  |  |  | String s=""; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | StringBuffer hql=new StringBuffer("from StuStudent where studentId=? and deleteFlag is false"); | 
|---|
|  |  |  | StringBuffer hql=new StringBuffer("from StuStudent where userId=? and deleteFlag is false"); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | List<Object> args = CollectionUtils.newList(studentId); | 
|---|
|  |  |  | List<Object> args = CollectionUtils.newList(userId); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | StuStudent stuStudent = findUnique(hql.toString(), args, StuStudent.class); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | try{ | 
|---|
|  |  |  | SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss"); | 
|---|
|  |  |  | //上课时间 | 
|---|
|  |  |  | String s1 = "9:00:00"; | 
|---|
|  |  |  | //如果上课时间(9点)>当前时间 | 
|---|
|  |  |  | //上课时间 | 
|---|
|  |  |  | String s1 = "9:00:00"; | 
|---|
|  |  |  | //当前时间 | 
|---|
|  |  |  | String s2 = sdf.format(new Date()); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //赋值一个课程id | 
|---|
|  |  |  | String hqlTwo = "from Subject where name = ?"; | 
|---|
|  |  |  | List<Object> argsTwo = CollectionUtils.newList(subjectName); | 
|---|
|  |  |  | Subject subject = findUnique(hqlTwo,argsTwo,Subject.class); | 
|---|
|  |  |  | //添加subjectId | 
|---|
|  |  |  | if(subject.getSubjectId() == subjectId){ | 
|---|
|  |  |  | stuStudent.setSubjectId(subjectId); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //时间计算 | 
|---|
|  |  |  | }else { | 
|---|
|  |  |  | stuStudent.setSubjectId(subject.getSubjectId()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //如果上课时间(9点)>当前时间 | 
|---|
|  |  |  | int compareTo = s1.compareTo(s2); | 
|---|
|  |  |  | if(compareTo>0) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | s="签到时间已过,本节课按照旷课处理"; | 
|---|
|  |  |  | stuStudent.setAttendanceStatus("旷课"); | 
|---|
|  |  |  | s="签到时间已过,本节课按照旷课处理"; | 
|---|
|  |  |  | stuStudent.setAttendanceStatus("旷课"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else | 
|---|
|  |  |  | { | 
|---|
|  |  |  | String s3 = "8:50:00"; | 
|---|
|  |  |  | String s3 = "8:50:00"; | 
|---|
|  |  |  | compareTo = s2.compareTo(s3); | 
|---|
|  |  |  | if(compareTo<0) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | s="未到签到时间,请与上课时间前10分钟签到"; | 
|---|
|  |  |  | stuStudent.setAttendanceStatus("未打卡"); | 
|---|
|  |  |  | s="未到签到时间,请与上课时间前10分钟签到"; | 
|---|
|  |  |  | stuStudent.setAttendanceStatus("未打卡"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else | 
|---|
|  |  |  | { | 
|---|
|  |  |  | if(stuStudent!=null && subjectId!=null){ | 
|---|
|  |  |  | stuStudent.setAttendanceStatus("已打卡"); | 
|---|
|  |  |  | s = "成功完成签到"; | 
|---|
|  |  |  | stuStudent.setAttendanceStatus("已打卡"); | 
|---|
|  |  |  | s = "成功签到"; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
| New file | 
|  |  |  | 
|---|
|  |  |  | package com.qxueyou.scc.admin.graduation; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.qxueyou.scc.base.model.Result; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public interface GraduationService { | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | *添加修改毕业状态 | 
|---|
|  |  |  | * @param studentIds | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | Result graduationAddAndUp(String[] studentIds, String graduationText); | 
|---|
|  |  |  | } | 
|---|
| New file | 
|  |  |  | 
|---|
|  |  |  | package com.qxueyou.scc.admin.graduation.impl; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.qxueyou.scc.admin.attendance.AttendanceService; | 
|---|
|  |  |  | import com.qxueyou.scc.admin.graduation.GraduationService; | 
|---|
|  |  |  | import com.qxueyou.scc.base.model.Result; | 
|---|
|  |  |  | import com.qxueyou.scc.base.service.impl.CommonAppService; | 
|---|
|  |  |  | import com.qxueyou.scc.base.util.CollectionUtils; | 
|---|
|  |  |  | import com.qxueyou.scc.teach.student.model.StuStudent; | 
|---|
|  |  |  | import org.springframework.stereotype.Service; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import java.util.List; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Service | 
|---|
|  |  |  | public class GraduationServiceImpl  extends CommonAppService implements GraduationService { | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public Result graduationAddAndUp(String[] studentIds, String graduationText) { | 
|---|
|  |  |  | StringBuffer hql=new StringBuffer("from StuStudent where studentId=? and deleteFlag is false"); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | List<Object> args = CollectionUtils.newList(studentIds); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | StuStudent stuStudent = findUnique(hql.toString(), args, StuStudent.class); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | stuStudent.setStatus("已毕业"); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if(stuStudent.getStatus() == "已毕业"){ | 
|---|
|  |  |  | stuStudent.setGraduationText(graduationText); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | save(stuStudent); | 
|---|
|  |  |  | return new Result(true); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
| New file | 
|  |  |  | 
|---|
|  |  |  | package com.qxueyou.scc.controller; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.qxueyou.scc.admin.graduation.GraduationService; | 
|---|
|  |  |  | import com.qxueyou.scc.base.model.Result; | 
|---|
|  |  |  | import io.swagger.annotations.Api; | 
|---|
|  |  |  | import io.swagger.annotations.ApiOperation; | 
|---|
|  |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.GetMapping; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.RequestMapping; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.RestController; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Api(tags="毕业管理接口") | 
|---|
|  |  |  | @RestController | 
|---|
|  |  |  | @RequestMapping("/admin/Graduation") | 
|---|
|  |  |  | public class GraduationController { | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private GraduationService graduationService; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ApiOperation(value = "毕业", notes = "") | 
|---|
|  |  |  | @GetMapping(value = "/graduationAddAndUp") | 
|---|
|  |  |  | public Result graduationAddAndUp(String[] studentIds, String graduationText) { | 
|---|
|  |  |  | return graduationService.graduationAddAndUp(studentIds,graduationText); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | private BigDecimal score; | 
|---|
|  |  |  | private String studentNumber; | 
|---|
|  |  |  | private String attendanceStatus; | 
|---|
|  |  |  | private String graduationText; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public StuStudent() { | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public StuStudent(String studentId, Date createTime, Date updateTime, String creator, String createId, | 
|---|
|  |  |  | String updator, String updateId, boolean deleteFlag, String userId, String name, String classId, | 
|---|
|  |  |  | String tenantId, String status, String attendanceStatus,String studentNumber) { | 
|---|
|  |  |  | String tenantId, String status, String attendanceStatus, String graduationText,String studentNumber) { | 
|---|
|  |  |  | this.studentId = studentId; | 
|---|
|  |  |  | this.createTime = createTime; | 
|---|
|  |  |  | this.updateTime = updateTime; | 
|---|
|  |  |  | 
|---|
|  |  |  | this.tenantId = tenantId; | 
|---|
|  |  |  | this.status = status; | 
|---|
|  |  |  | this.attendanceStatus = attendanceStatus; | 
|---|
|  |  |  | this.graduationText = graduationText; | 
|---|
|  |  |  | this.studentNumber=studentNumber; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | this.attendanceStatus = attendanceStatus; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Column(name = "GRADUATION_TEXT", length = 200) | 
|---|
|  |  |  | public String getGraduationText() { | 
|---|
|  |  |  | return this.graduationText; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public void setGraduationText(String graduationText) { | 
|---|
|  |  |  | this.graduationText = graduationText; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Column(name = "STUDENT_NO", length = 32) | 
|---|
|  |  |  | public String getStudentNo() { | 
|---|
|  |  |  | return studentNo; | 
|---|
|  |  |  | 
|---|
|  |  |  | 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)) | 
|---|
|  |  |  | 
|---|
|  |  |  | 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()); | 
|---|