|
@@ -1,13 +1,13 @@
|
|
|
package com.ym.mec.teacher.controller;
|
|
|
|
|
|
-import com.ym.mec.auth.api.client.SysUserFeignService;
|
|
|
-import com.ym.mec.auth.api.entity.SysUser;
|
|
|
import com.ym.mec.biz.dal.dao.StudentAttendanceDao;
|
|
|
import com.ym.mec.biz.dal.dto.StudentAttendanceDto;
|
|
|
+import com.ym.mec.biz.dal.dto.StudentAttendanceViewDto;
|
|
|
import com.ym.mec.biz.dal.dto.TeacherSignOutDto;
|
|
|
import com.ym.mec.biz.dal.entity.CourseSchedule;
|
|
|
import com.ym.mec.biz.dal.entity.MusicGroup;
|
|
|
import com.ym.mec.biz.dal.entity.StudentAttendance;
|
|
|
+import com.ym.mec.biz.dal.entity.TeacherAttendance;
|
|
|
import com.ym.mec.biz.dal.enums.GroupType;
|
|
|
import com.ym.mec.biz.dal.enums.MessageTypeEnum;
|
|
|
import com.ym.mec.biz.dal.enums.StudentAttendanceStatusEnum;
|
|
@@ -17,17 +17,16 @@ import com.ym.mec.biz.dal.wrapper.LiveGroupWrapper;
|
|
|
import com.ym.mec.biz.service.*;
|
|
|
import com.ym.mec.common.controller.BaseController;
|
|
|
import com.ym.mec.common.entity.HttpResponseResult;
|
|
|
-import com.ym.mec.common.exception.BizException;
|
|
|
+import com.ym.mec.common.page.PageInfo;
|
|
|
import com.ym.mec.thirdparty.message.MessageSenderPluginContext;
|
|
|
import com.ym.mec.util.date.DateUtil;
|
|
|
import com.yonge.log.model.AuditLogAnnotation;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.http.HttpStatus;
|
|
|
-import org.springframework.util.CollectionUtils;
|
|
|
+import org.apache.commons.collections.CollectionUtils;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
+import javax.annotation.Resource;
|
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
@@ -36,42 +35,42 @@ import java.util.stream.Collectors;
|
|
|
@RestController
|
|
|
public class TeacherAttendanceController extends BaseController {
|
|
|
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private TeacherAttendanceService teacherAttendanceService;
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private StudentAttendanceService studentAttendanceService;
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private StudentAttendanceDao studentAttendanceDao;
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private ClassGroupService classGroupService;
|
|
|
- @Autowired
|
|
|
- private SysUserFeignService sysUserFeignService;
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
+ private SysUserService sysUserService;
|
|
|
+ @Resource
|
|
|
private SysMessageService sysMessageService;
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private CourseScheduleService courseScheduleService;
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private MusicGroupService musicGroupService;
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private OrganizationService organizationService;
|
|
|
|
|
|
@ApiOperation(value = "新增教师签到")
|
|
|
@PostMapping("/add")
|
|
|
@AuditLogAnnotation(operateName = "新增教师签到")
|
|
|
- public Object add(@RequestBody TeacherSignOutDto teacherSignOutDto) {
|
|
|
+ public HttpResponseResult<Map<String, Object>> add(@RequestBody TeacherSignOutDto teacherSignOutDto) {
|
|
|
return succeed(teacherAttendanceService.addTeacherAttendanceRecord(teacherSignOutDto));
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "分页查询教师签到列表")
|
|
|
@GetMapping("/queryPage")
|
|
|
- public Object queryPage(TeacherAttendanceQueryInfo queryInfo) {
|
|
|
+ public HttpResponseResult<PageInfo<TeacherAttendance>> queryPage(TeacherAttendanceQueryInfo queryInfo) {
|
|
|
return succeed(teacherAttendanceService.queryPage(queryInfo));
|
|
|
}
|
|
|
|
|
|
|
|
|
@ApiOperation(value = "根据班级ID获取当前课程的学生")
|
|
|
@GetMapping("/getCurrentCourseStudents")
|
|
|
- public Object getCurrentCourseStudents(Long courseScheduleId){
|
|
|
+ public HttpResponseResult<List<StudentAttendanceViewDto>> getCurrentCourseStudents(Long courseScheduleId){
|
|
|
return succeed(classGroupService.findAttendanceStudentByCourse(courseScheduleId));
|
|
|
}
|
|
|
|
|
@@ -79,7 +78,7 @@ public class TeacherAttendanceController extends BaseController {
|
|
|
|
|
|
@ApiOperation(value = "根据班级ID获取当前课程的学生")
|
|
|
@PostMapping("/getLiveCurrentCourseStudents")
|
|
|
- public Object getLiveCurrentCourseStudents(@RequestBody LiveGroupWrapper.LiveCourseStudentQuery query){
|
|
|
+ public HttpResponseResult<List<StudentAttendanceViewDto>> getLiveCurrentCourseStudents(@RequestBody LiveGroupWrapper.LiveCourseStudentQuery query){
|
|
|
return succeed(classGroupService.getLiveCurrentCourseStudents(query));
|
|
|
}
|
|
|
|
|
@@ -87,23 +86,19 @@ public class TeacherAttendanceController extends BaseController {
|
|
|
@GetMapping("/getGradeList")
|
|
|
public HttpResponseResult<Map<Integer,String>> getGradeList(Long courseScheduleId) {
|
|
|
CourseSchedule courseSchedule = courseScheduleService.get(courseScheduleId);
|
|
|
- SysUser sysUser = sysUserFeignService.queryUserInfo();
|
|
|
- if(sysUser == null){
|
|
|
- return failed("请重新登录");
|
|
|
- }
|
|
|
return succeed(organizationService.getGradeList(courseSchedule.getOrganId()));
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "点名")
|
|
|
@PostMapping("/addStudentAttendances")
|
|
|
@AuditLogAnnotation(operateName = "点名")
|
|
|
- public Object addStudentAttendances(@RequestBody StudentAttendanceDto studentAttendanceInfo){
|
|
|
+ public HttpResponseResult<Map<String, Object>> addStudentAttendances(@RequestBody StudentAttendanceDto studentAttendanceInfo){
|
|
|
return succeed(studentAttendanceService.addStudentAttendances(studentAttendanceInfo));
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "学员到课提醒")
|
|
|
@PostMapping("/studentAttendanceNormalRemind")
|
|
|
- public HttpResponseResult studentAttendanceNormalRemind(Long courseId){
|
|
|
+ public HttpResponseResult<Object> studentAttendanceNormalRemind(Long courseId){
|
|
|
int remindNum = studentAttendanceDao.countNormalRemindNum(courseId);
|
|
|
if(remindNum > 0){
|
|
|
return failed("您已发送过到课提醒");
|
|
@@ -129,7 +124,7 @@ public class TeacherAttendanceController extends BaseController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if (normal != null && normal.size() > 0) {
|
|
|
+ if (CollectionUtils.isNotEmpty(normal)) {
|
|
|
Map<Integer, String> receivers = new HashMap<>(normal.size());
|
|
|
normal.forEach(e -> receivers.put(e.getUserId(), e.getUserId().toString()));
|
|
|
sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.JIGUANG, MessageTypeEnum.STUDENT_PUSH_NAMES_ACHIEVE,
|
|
@@ -143,29 +138,21 @@ public class TeacherAttendanceController extends BaseController {
|
|
|
|
|
|
@ApiOperation(value = "获取签退详情")
|
|
|
@GetMapping("/getTeacherSignDetail")
|
|
|
- public Object getTeacherSignDetail(Integer courseScheduleId){
|
|
|
- SysUser user = sysUserFeignService.queryUserInfo();
|
|
|
- if(Objects.isNull(user)){
|
|
|
- return failed(HttpStatus.FORBIDDEN,"请登录");
|
|
|
- }
|
|
|
- return succeed(teacherAttendanceService.getTeacherSignDetail(courseScheduleId, user.getId()));
|
|
|
+ public HttpResponseResult<TeacherSignOutDto> getTeacherSignDetail(Integer courseScheduleId){
|
|
|
+ return succeed(teacherAttendanceService.getTeacherSignDetail(courseScheduleId, sysUserService.getUserId()));
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "提交考勤申述")
|
|
|
@PostMapping("/addComplaints")
|
|
|
- public Object addComplaints(Long courseScheduleId, String content, String url, UpdateAttendanceEnum complaintsType){
|
|
|
+ public HttpResponseResult<Object> addComplaints(Long courseScheduleId, String content, String url, UpdateAttendanceEnum complaintsType){
|
|
|
teacherAttendanceService.addComplaints(courseScheduleId,content,url,null,complaintsType);
|
|
|
return succeed();
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "撤销考勤申述")
|
|
|
@PostMapping("/repealComplaints")
|
|
|
- public Object repealComplaints(Long courseScheduleId){
|
|
|
- SysUser user = sysUserFeignService.queryUserInfo();
|
|
|
- if(Objects.isNull(user)){
|
|
|
- throw new BizException("请登录");
|
|
|
- }
|
|
|
- teacherAttendanceService.repealComplaints(courseScheduleId,user.getId());
|
|
|
+ public HttpResponseResult<Object> repealComplaints(Long courseScheduleId){
|
|
|
+ teacherAttendanceService.repealComplaints(courseScheduleId,sysUserService.getUserId());
|
|
|
return succeed();
|
|
|
}
|
|
|
}
|