|
@@ -29,6 +29,7 @@ import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
import static com.ym.mec.biz.dal.enums.ComplaintsStatusEnum.REPEAL;
|
|
|
+import static com.ym.mec.biz.dal.enums.JobNatureEnum.PART_TIME;
|
|
|
import static com.ym.mec.biz.dal.enums.SignInStatusEnum.*;
|
|
|
|
|
|
@Service
|
|
@@ -710,13 +711,8 @@ public class TeacherAttendanceServiceImpl extends BaseServiceImpl<Long, TeacherA
|
|
|
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
- public synchronized void addComplaints(Long courseScheduleId, String content,String url) {
|
|
|
- SysUser user = sysUserFeignService.queryUserInfo();
|
|
|
- if(Objects.isNull(user)){
|
|
|
- throw new BizException("请登录");
|
|
|
- }
|
|
|
- TeacherAttendance teacherAttendance = teacherAttendanceDao.findByTeacherAttendanceInfo(user.getId().longValue(), courseScheduleId);
|
|
|
-
|
|
|
+ public void addComplaints(Long courseScheduleId, String content,String url,Integer userId) {
|
|
|
+ TeacherAttendance teacherAttendance = teacherAttendanceDao.findByTeacherAttendanceInfo(userId.longValue(), courseScheduleId);
|
|
|
CourseSchedule courseSchedule = courseScheduleDao.get(courseScheduleId);
|
|
|
if(courseSchedule == null){
|
|
|
throw new BizException("课程不存在");
|
|
@@ -724,7 +720,7 @@ public class TeacherAttendanceServiceImpl extends BaseServiceImpl<Long, TeacherA
|
|
|
if(teacherAttendance == null){
|
|
|
teacherAttendance = new TeacherAttendance();
|
|
|
teacherAttendance.setMusicGroupId(courseSchedule.getMusicGroupId());
|
|
|
- teacherAttendance.setTeacherId(user.getId());
|
|
|
+ teacherAttendance.setTeacherId(userId);
|
|
|
teacherAttendance.setClassGroupId(courseSchedule.getClassGroupId());
|
|
|
teacherAttendance.setGroupType(courseSchedule.getGroupType());
|
|
|
teacherAttendance.setCourseScheduleId(courseScheduleId);
|
|
@@ -732,11 +728,21 @@ public class TeacherAttendanceServiceImpl extends BaseServiceImpl<Long, TeacherA
|
|
|
}else if(teacherAttendance.getComplaintsStatus() != null && teacherAttendance.getComplaintsStatus() != REPEAL){
|
|
|
throw new BizException("请勿重复提交考勤申述");
|
|
|
}
|
|
|
- //如果课程时间在两天前
|
|
|
+ Teacher teacher = teacherDao.get(userId);
|
|
|
Date date = new Date();
|
|
|
- int i = DateUtil.daysBetween(courseSchedule.getClassDate(), DateUtil.stringToDate(DateUtil.format(date,DateUtil.DEFAULT_PATTERN),DateUtil.DEFAULT_PATTERN));
|
|
|
- if(i > 1){
|
|
|
- throw new BizException("超出可申述时间");
|
|
|
+ if(teacher.getJobNature() == PART_TIME){
|
|
|
+ //获取上课时间下个月5号
|
|
|
+ date = DateUtil.addDays(DateUtil.getFirstDayOfMonth(DateUtil.addMonths(courseSchedule.getClassDate(), 1)), 5);
|
|
|
+ int i = DateUtil.daysBetween(date,new Date());
|
|
|
+ if(i > 0){
|
|
|
+ throw new BizException("超出可申述时间");
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ //如果课程时间在两天前
|
|
|
+ int i = DateUtil.daysBetween(courseSchedule.getClassDate(), DateUtil.stringToDate(DateUtil.format(date,DateUtil.DEFAULT_PATTERN),DateUtil.DEFAULT_PATTERN));
|
|
|
+ if(i > 1){
|
|
|
+ throw new BizException("超出可申述时间");
|
|
|
+ }
|
|
|
}
|
|
|
teacherAttendance.setIsComplaints(1);
|
|
|
teacherAttendance.setComplaintsStatus(ComplaintsStatusEnum.WAIT);
|
|
@@ -748,12 +754,8 @@ public class TeacherAttendanceServiceImpl extends BaseServiceImpl<Long, TeacherA
|
|
|
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
- public void repealComplaints(Long courseScheduleId) {
|
|
|
- SysUser user = sysUserFeignService.queryUserInfo();
|
|
|
- if(Objects.isNull(user)){
|
|
|
- throw new BizException("请登录");
|
|
|
- }
|
|
|
- TeacherAttendance teacherAttendance = teacherAttendanceDao.findByTeacherAttendanceInfo(user.getId().longValue(), courseScheduleId);
|
|
|
+ public void repealComplaints(Long courseScheduleId,Integer userId) {
|
|
|
+ TeacherAttendance teacherAttendance = teacherAttendanceDao.findByTeacherAttendanceInfo(userId.longValue(), courseScheduleId);
|
|
|
if(teacherAttendance == null){
|
|
|
throw new BizException("考勤信息不存在");
|
|
|
}
|