| | |
| | | |
| | | try{ |
| | | SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss"); |
| | | //上课时间 |
| | | String classTime = "9:00:00"; |
| | | //当前时间 |
| | | String currentTime = sdf.format(new Date()); |
| | | String hqlTwo = "from Subject where name = ?"; |
| | | List<Object> argsTwo = CollectionUtils.newList(subjectName); |
| | | Subject subject = findUnique(hqlTwo,argsTwo,Subject.class); |
| | | //上课时间 |
| | | String classTime = subject.getEndTime(); |
| | | //当前时间 |
| | | String currentTime = sdf.format(new Date()); |
| | | //添加subjectId |
| | | if(subject.getSubjectId() == subjectId){ |
| | | stuStudent.setSubjectId(subjectId); |
| | |
| | | int compareTo = classTime.compareTo(currentTime); |
| | | if(compareTo>0) |
| | | { |
| | | s="签到时间已过,本节课按照旷课处理"; |
| | | s="签到时间已过"; |
| | | stuStudent.setAttendanceStatus(stuStudent.STATUS_TRUANCY); |
| | | } |
| | | else |
| | | { |
| | | //打卡时间 |
| | | String clockTime = "8:50:00"; |
| | | String clockTime = subject.getEndTime(); |
| | | compareTo = currentTime.compareTo(clockTime); |
| | | if(compareTo<0) |
| | | { |
| | | s="未到签到时间,请与上课时间前10分钟签到"; |
| | | s="未到签到时间"; |
| | | stuStudent.setAttendanceStatus(stuStudent.STATUS_NO_CLOCKING); |
| | | } |
| | | else |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<StuStudent> findAttendanceList(Integer limit, Integer pageNum, String keyword, String subjectId) { |
| | | StringBuffer hql=new StringBuffer("from StuStudent where name like ? and subjectId = ? and deleteFlag is false"); |
| | | public List<StuStudent> findAttendanceList(Integer limit, Integer pageNum, String keyword, String classId) { |
| | | StringBuffer hql=new StringBuffer("from StuStudent where name like ? and classId = ? and deleteFlag is false"); |
| | | |
| | | List<Object> args = CollectionUtils.newList(keyword + "%",subjectId); |
| | | List<Object> args = CollectionUtils.newList(keyword + "%",classId); |
| | | |
| | | hql.append(" order by createTime desc"); |
| | | |
| | |
| | | import com.qxueyou.scc.base.util.CollectionUtils; |
| | | import com.qxueyou.scc.base.util.QBeanUtils; |
| | | import com.qxueyou.scc.teach.student.model.StuStudent; |
| | | import com.qxueyou.scc.teach.subject.model.Subject; |
| | | import com.qxueyou.scc.teach.subject.service.ISubjectService; |
| | | import com.qxueyou.scc.teach.subject.service.impl.SubjectService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | @Api(tags="考勤管理接口") |
| | | @RestController |
| | |
| | | @Autowired |
| | | private AttendanceService attendanceService; |
| | | |
| | | private SubjectService subjectService; |
| | | @Autowired |
| | | private ISubjectService iSubjectService; |
| | | |
| | | @ApiOperation(value = "打卡", notes = "") |
| | | @GetMapping(value = "/attendanceUpAndAdd") |
| | |
| | | |
| | | @ApiOperation(value = "考勤信息", notes = "") |
| | | @GetMapping(value = "/attendanceList") |
| | | public Result attendanceList(@RequestParam(defaultValue = "10") Integer limit, @RequestParam(defaultValue = "1") Integer pageNum, String keyword, String subjectId) { |
| | | public Result attendanceList(@RequestParam(defaultValue = "10") Integer limit, @RequestParam(defaultValue = "1") Integer pageNum, String keyword, String classId) { |
| | | |
| | | List<StuStudent> attendanceList = attendanceService.findAttendanceList(limit, pageNum, keyword,subjectId); |
| | | List<StuStudent> attendanceList = attendanceService.findAttendanceList(limit, pageNum, keyword,classId); |
| | | |
| | | int count = attendanceService.findAttendanceListCount(keyword,subjectId); |
| | | int count = attendanceService.findAttendanceListCount(keyword,classId); |
| | | |
| | | List<Object> list = new ArrayList<>(); |
| | | for (StuStudent stuStudent : attendanceList){ |
| | | Map<String,String> mapList = new HashMap<>(); |
| | | mapList.put("name",stuStudent.getName()); |
| | | mapList.put("studentNo",stuStudent.getStudentNo()); |
| | | mapList.put("sex",String.valueOf(stuStudent.getSex())); |
| | | mapList.put("mobilePhone",stuStudent.getMobilePhone()); |
| | | mapList.put("attendanceStatus",stuStudent.getAttendanceStatus()); |
| | | mapList.put("createTime",String.valueOf(stuStudent.getCreateTime())); |
| | | mapList.put("studentId",stuStudent.getStudentId()); |
| | | mapList.put("photo",stuStudent.getPhoto()); |
| | | mapList.put("passporName",stuStudent.getPassporName()); |
| | | mapList.put("nationality",stuStudent.getNationality()); |
| | | mapList.put("ancestralHome",stuStudent.getAncestralHome()); |
| | | mapList.put("birthday",stuStudent.getBirthday()); |
| | | mapList.put("birthplace",stuStudent.getBirthplace()); |
| | | mapList.put("chinaStatus",stuStudent.getChinaStatus()); |
| | | mapList.put("registeredAddress",stuStudent.getRegisteredAddress()); |
| | | mapList.put("homeAddress",stuStudent.getHomeAddress()); |
| | | mapList.put("religiousBelief",stuStudent.getReligiousBelief()); |
| | | mapList.put("email",stuStudent.getEmail()); |
| | | mapList.put("workUnit",stuStudent.getWorkUnit()); |
| | | mapList.put("graduationDestination",stuStudent.getGraduationDestination()); |
| | | if(stuStudent.getSubjectId()!=null){ |
| | | String subjectName = iSubjectService.findSubjectName(stuStudent.getSubjectId()); |
| | | mapList.put("subjectName",subjectName); |
| | | } |
| | | list.add(mapList); |
| | | } |
| | | |
| | | |
| | | return new Result(true,"success", CollectionUtils.newObjectMap("attendanceList", |
| | | QBeanUtils.listBean2ListMap(attendanceList, |
| | | QBeanUtils.listBean2ListMap(list, |
| | | CollectionUtils.newStringMap("name", "studentName", "studentNo", "studentNo","sex","sex","mobilePhone","mobilePhone", "attendanceStatus", |
| | | "attendanceStatus", "createTime", "createTime", "studentId", "studentId")), |
| | | "attendanceStatus", "createTime", "createTime", "studentId", "studentId","photo","photo","passporName","passporName","nationality","nationality","ancestralHome","ancestralHome","birthday","birthday","birthplace","birthplace","chinaStatus","chinaStatus","registeredAddress","registeredAddress","homeAddress","homeAddress","religiousBelief","religiousBelief","email","email","workUnit","workUnit","graduationDestination","graduationDestination","subjectName","subjectName")), |
| | | "attendanceCount", count)); |
| | | } |
| | | |
| | |
| | | * 课程介绍 |
| | | */ |
| | | @PostMapping(value = "/copy") |
| | | public Result copy(String subjectId, String subjectName, String imgPath, String content,int type) { |
| | | return add(subjectName, imgPath, content,type); |
| | | public Result copy(String subjectId, String subjectName, String imgPath, String content,int type,String startTime,String endTime) { |
| | | return add(subjectName, imgPath, content,type,startTime,endTime); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @PostMapping(value = "/add") |
| | | public Result add(String subjectName, String imgPath, String content,int type) { |
| | | public Result add(String subjectName, String imgPath, String content,int type,String startTime,String endTime) { |
| | | String contentFileId = null; |
| | | |
| | | if(StringUtils.isNotEmpty(content)){ |
| | |
| | | coverPageFileId = fileService.readIdByPath(imgPath); |
| | | } |
| | | |
| | | return subjectService.add(subjectName, coverPageFileId,contentFileId,type); |
| | | return subjectService.add(subjectName, coverPageFileId,contentFileId,type,startTime,endTime); |
| | | } |
| | | |
| | | /** |
| | |
| | | @Column(name="CONTENT_FILE_ID") |
| | | private String contentFileId; |
| | | |
| | | @Column(name = "START_TIME") |
| | | private String startTime; |
| | | |
| | | @Column(name = "END_TIME") |
| | | private String endTime; |
| | | |
| | | public final static String STATUS_DRAFT = "0"; |
| | | |
| | | public final static String STATUS_ISSUED = "1"; |
| | |
| | | this.orgId = orgId; |
| | | } |
| | | |
| | | public String getStartTime() { |
| | | return startTime; |
| | | } |
| | | |
| | | public void setStartTime(String startTime) { |
| | | this.startTime = startTime; |
| | | } |
| | | |
| | | public String getEndTime() { |
| | | return endTime; |
| | | } |
| | | |
| | | public void setEndTime(String endTime) { |
| | | this.endTime = endTime; |
| | | } |
| | | } |
| | |
| | | * 内容文件id |
| | | * @return |
| | | */ |
| | | Result add(String subjectName, String coverPageFileId, String contentFileId,int type); |
| | | Result add(String subjectName, String coverPageFileId, String contentFileId,int type,String startTime,String endTime); |
| | | |
| | | /** |
| | | * 修改课程 |
| | |
| | | * @return |
| | | */ |
| | | public long getLectureCount(String subjectId); |
| | | |
| | | /** |
| | | * 获取课程名称 |
| | | * @param subjectId |
| | | * @return |
| | | */ |
| | | String findSubjectName(String subjectId); |
| | | } |
| | |
| | | |
| | | |
| | | @Override |
| | | public Result add(String subjectName, String coverPageFileId, String contentFileId, int type) { |
| | | public Result add(String subjectName, String coverPageFileId, String contentFileId, int type,String startTime,String endTime) { |
| | | |
| | | Subject subject = new Subject(); |
| | | if (StringUtils.isNotEmpty(coverPageFileId)) { |
| | |
| | | subject.setStatus(Subject.STATUS_DRAFT); |
| | | subject.setLectureCount(0); |
| | | subject.setType(type); |
| | | //签到时间 |
| | | subject.setStartTime(startTime); |
| | | subject.setEndTime(endTime); |
| | | subject.setOrgId(ClientUtils.getOrgId()); |
| | | |
| | | save(subject); |
| | |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public String findSubjectName(String subjectId) { |
| | | Subject subject = findUnique("from Subject where subjectId = ? ",CollectionUtils.newList(subjectId),Subject.class); |
| | | return subject.getName(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 我的公开课列表 |