|
@@ -2,23 +2,26 @@ package com.ym.mec.biz.service.impl;
|
|
|
|
|
|
import com.ym.mec.auth.api.client.SysUserFeignService;
|
|
import com.ym.mec.auth.api.client.SysUserFeignService;
|
|
import com.ym.mec.auth.api.entity.SysUser;
|
|
import com.ym.mec.auth.api.entity.SysUser;
|
|
|
|
+import com.ym.mec.biz.dal.dao.CourseHomeworkDao;
|
|
import com.ym.mec.biz.dal.dao.StudentCourseHomeworkDao;
|
|
import com.ym.mec.biz.dal.dao.StudentCourseHomeworkDao;
|
|
import com.ym.mec.biz.dal.dto.CourseHomeworkStudentDetailDto;
|
|
import com.ym.mec.biz.dal.dto.CourseHomeworkStudentDetailDto;
|
|
import com.ym.mec.biz.dal.entity.CourseHomework;
|
|
import com.ym.mec.biz.dal.entity.CourseHomework;
|
|
import com.ym.mec.biz.dal.entity.StudentCourseHomework;
|
|
import com.ym.mec.biz.dal.entity.StudentCourseHomework;
|
|
|
|
+import com.ym.mec.biz.dal.enums.YesOrNoEnum;
|
|
import com.ym.mec.biz.dal.page.CourseHomeworkQueryInfo;
|
|
import com.ym.mec.biz.dal.page.CourseHomeworkQueryInfo;
|
|
import com.ym.mec.biz.service.CourseHomeworkService;
|
|
import com.ym.mec.biz.service.CourseHomeworkService;
|
|
import com.ym.mec.biz.service.StudentCourseHomeworkService;
|
|
import com.ym.mec.biz.service.StudentCourseHomeworkService;
|
|
import com.ym.mec.common.dal.BaseDAO;
|
|
import com.ym.mec.common.dal.BaseDAO;
|
|
|
|
+import com.ym.mec.common.exception.BizException;
|
|
import com.ym.mec.common.page.PageInfo;
|
|
import com.ym.mec.common.page.PageInfo;
|
|
import com.ym.mec.common.page.QueryInfo;
|
|
import com.ym.mec.common.page.QueryInfo;
|
|
import com.ym.mec.common.service.impl.BaseServiceImpl;
|
|
import com.ym.mec.common.service.impl.BaseServiceImpl;
|
|
-
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
-import java.io.IOException;
|
|
|
|
|
|
+import java.util.List;
|
|
|
|
+import java.util.Objects;
|
|
|
|
|
|
@Service
|
|
@Service
|
|
public class StudentCourseHomeworkServiceImpl extends BaseServiceImpl<Long, StudentCourseHomework> implements StudentCourseHomeworkService {
|
|
public class StudentCourseHomeworkServiceImpl extends BaseServiceImpl<Long, StudentCourseHomework> implements StudentCourseHomeworkService {
|
|
@@ -27,6 +30,8 @@ public class StudentCourseHomeworkServiceImpl extends BaseServiceImpl<Long, Stud
|
|
private StudentCourseHomeworkDao studentCourseHomeworkDao;
|
|
private StudentCourseHomeworkDao studentCourseHomeworkDao;
|
|
@Autowired
|
|
@Autowired
|
|
private CourseHomeworkService courseHomeworkService;
|
|
private CourseHomeworkService courseHomeworkService;
|
|
|
|
+ @Autowired
|
|
|
|
+ private CourseHomeworkDao courseHomeworkDao;
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
private SysUserFeignService sysUserFeignService;
|
|
private SysUserFeignService sysUserFeignService;
|
|
@@ -43,6 +48,7 @@ public class StudentCourseHomeworkServiceImpl extends BaseServiceImpl<Long, Stud
|
|
public long insert(StudentCourseHomework bean) {
|
|
public long insert(StudentCourseHomework bean) {
|
|
SysUser user = sysUserFeignService.queryUserInfo();
|
|
SysUser user = sysUserFeignService.queryUserInfo();
|
|
bean.setUserId(Long.valueOf(user.getId()));
|
|
bean.setUserId(Long.valueOf(user.getId()));
|
|
|
|
+ bean.setStatus(YesOrNoEnum.YES);
|
|
long insert = super.insert(bean);
|
|
long insert = super.insert(bean);
|
|
|
|
|
|
CourseHomework courseHomework=new CourseHomework();
|
|
CourseHomework courseHomework=new CourseHomework();
|
|
@@ -53,9 +59,25 @@ public class StudentCourseHomeworkServiceImpl extends BaseServiceImpl<Long, Stud
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public CourseHomeworkStudentDetailDto findCourseHomeworkStudentDetail(Long courseScheduleID) throws IOException {
|
|
|
|
- SysUser user = sysUserFeignService.queryUserInfo();
|
|
|
|
- return studentCourseHomeworkDao.findCourseHomeworkStudentDetail(courseScheduleID,Long.valueOf(user.getId()));
|
|
|
|
|
|
+ public CourseHomeworkStudentDetailDto findCourseHomeworkStudentDetail(Long courseScheduleID,Long userId){
|
|
|
|
+ return studentCourseHomeworkDao.findCourseHomeworkStudentDetail(courseScheduleID,userId);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public boolean updateReplyStatus(Long teacherId, Long courseHomeworkId, Long studentId) {
|
|
|
|
+ StudentCourseHomework byStudentAndCourseHomewok = studentCourseHomeworkDao.findByStudentAndCourseHomewok(courseHomeworkId, studentId);
|
|
|
|
+ if(Objects.isNull(byStudentAndCourseHomewok)){
|
|
|
|
+ throw new BizException("作业记录不存在");
|
|
|
|
+ }
|
|
|
|
+ if(byStudentAndCourseHomewok.getIsReplied()==YesOrNoEnum.YES){
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+ CourseHomework byTeacherAndCourseHomewok = courseHomeworkDao.findByTeacherAndCourseHomewok(courseHomeworkId, teacherId);
|
|
|
|
+ if(Objects.nonNull(byTeacherAndCourseHomewok)){
|
|
|
|
+ byStudentAndCourseHomewok.setIsView(YesOrNoEnum.YES);
|
|
|
|
+ studentCourseHomeworkDao.update(byStudentAndCourseHomewok);
|
|
|
|
+ }
|
|
|
|
+ return true;
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -65,4 +87,12 @@ public class StudentCourseHomeworkServiceImpl extends BaseServiceImpl<Long, Stud
|
|
courseHomeworkQueryInfo.setUserId(Long.valueOf(user.getId()));
|
|
courseHomeworkQueryInfo.setUserId(Long.valueOf(user.getId()));
|
|
return super.queryPage(queryInfo);
|
|
return super.queryPage(queryInfo);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public List<StudentCourseHomework> findStudentCourseHomeworkByCourse(Long courseSchedule, String userName) {
|
|
|
|
+ if(Objects.isNull(courseSchedule)){
|
|
|
|
+ throw new BizException("请指定课程");
|
|
|
|
+ }
|
|
|
|
+ return studentCourseHomeworkDao.findByCourseSchedule(courseSchedule,userName);
|
|
|
|
+ }
|
|
}
|
|
}
|