소스 검색

add 需提交报告列表接口

周箭河 5 년 전
부모
커밋
986eab7f21

+ 5 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/SysConfigService.java

@@ -168,6 +168,11 @@ public interface SysConfigService extends BaseService<Long, SysConfig> {
     String PRACTICE_RENEW_URL = "practice_renew_url";
 
     /**
+     * @describe 老师端baseUrl
+     */
+    String TEACHER_BASE_URL = "teacher_base_url";
+
+    /**
      * @return com.ym.mec.biz.dal.entity.SysConfig
      * @params paramName
      * @describe 根据配置名称获取配置信息

+ 14 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/impl/CourseScheduleEvaluateServiceImpl.java

@@ -100,7 +100,20 @@ public class CourseScheduleEvaluateServiceImpl extends BaseServiceImpl<Long, Cou
 
     @Override
     public CourseScheduleEvaluate findById(Integer id) {
-        return courseScheduleEvaluateDao.findById(id);
+        CourseScheduleEvaluate studyReport = courseScheduleEvaluateDao.findById(id);
+        if (studyReport == null) {
+            throw new BizException("报告不存在");
+        }
+        SysUser user = teacherDao.getUser(studyReport.getStudentId());
+        BasicUserDto teacherInfo = teacherDao.findTeacherInfo(studyReport.getTeacherId());
+        studyReport.setStudent(user);
+        studyReport.setTeacher(teacherInfo);
+        long practiceGroupId = Long.parseLong(studyReport.getMusicGroupId());
+        PracticeGroup practiceGroup = practiceGroupDao.get(practiceGroupId);
+        ClassGroup classGroup = classGroupDao.get(studyReport.getClassGroupId());
+        studyReport.setTimes(classGroup.getTotalClassTimes());
+        studyReport.setTotalMinutes(classGroup.getTotalClassTimes() * practiceGroup.getSingleClassMinutes());
+        return studyReport;
     }
 
     @Override

+ 20 - 10
mec-teacher/src/main/java/com/ym/mec/teacher/controller/StudyReportController.java

@@ -2,8 +2,11 @@ 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.SysConfigDao;
 import com.ym.mec.biz.dal.entity.CourseScheduleEvaluate;
+import com.ym.mec.biz.dal.entity.SysConfig;
 import com.ym.mec.biz.service.CourseScheduleEvaluateService;
+import com.ym.mec.biz.service.SysConfigService;
 import com.ym.mec.common.controller.BaseController;
 import com.ym.mec.common.entity.HttpResponseResult;
 import com.ym.mec.util.date.DateUtil;
@@ -26,6 +29,8 @@ public class StudyReportController extends BaseController {
     private CourseScheduleEvaluateService courseScheduleEvaluateService;
     @Autowired
     private SysUserFeignService sysUserFeignService;
+    @Autowired
+    private SysConfigDao sysConfigDao;
 
 
     @ApiOperation("获取学生陪练报告信息")
@@ -38,10 +43,15 @@ public class StudyReportController extends BaseController {
     @GetMapping("getGroupReviews")
     public Object getGroupReviews(Integer groupId) {
         List<CourseScheduleEvaluate> courseScheduleEvaluates = courseScheduleEvaluateService.findByGroupId(groupId);
+        String teacherBaseUrl = sysConfigDao.findConfigValue(SysConfigService.TEACHER_BASE_URL);
         for (CourseScheduleEvaluate courseScheduleEvaluate : courseScheduleEvaluates) {
             courseScheduleEvaluate.setTimes(2);
             courseScheduleEvaluate.setTotalMinutes(100);
-            courseScheduleEvaluate.setReportLink("http://www.baidu.com");
+            if (courseScheduleEvaluate.getStatus().equals(1)) {
+                courseScheduleEvaluate.setReportLink(teacherBaseUrl + "/#/reportDetailNew?id=" + courseScheduleEvaluate.getId() + "&classGroupId=" + courseScheduleEvaluate.getClassGroupId());
+            } else {
+                courseScheduleEvaluate.setReportLink(teacherBaseUrl + "/#/studyReportNew?id=" + courseScheduleEvaluate.getId() + "&classGroupId=" + courseScheduleEvaluate.getClassGroupId());
+            }
         }
         return succeed(courseScheduleEvaluates);
     }
@@ -66,7 +76,7 @@ public class StudyReportController extends BaseController {
     @GetMapping("createEvaluate")
     public Object createEvaluate(Date date) {
         Date nowDate = new Date();
-        if(date != null){
+        if (date != null) {
             nowDate = date;
         }
         Date afterDate = DateUtil.addDays1(nowDate, 5);
@@ -77,17 +87,17 @@ public class StudyReportController extends BaseController {
     @PostMapping(value = "/addStudyReport")
     public HttpResponseResult addStudyReport(@RequestBody CourseScheduleEvaluate courseScheduleEvaluate) {
         SysUser sysUser = sysUserFeignService.queryUserInfo();
-        if(Objects.isNull(sysUser)){
-            return failed(HttpStatus.FORBIDDEN,"请登录");
+        if (Objects.isNull(sysUser)) {
+            return failed(HttpStatus.FORBIDDEN, "请登录");
         }
-        if(courseScheduleEvaluate.getId()==null || courseScheduleEvaluate.getId()<0){
-            return failed(HttpStatus.BAD_REQUEST,"报告id不能为空");
+        if (courseScheduleEvaluate.getId() == null || courseScheduleEvaluate.getId() < 0) {
+            return failed(HttpStatus.BAD_REQUEST, "报告id不能为空");
         }
-        if(courseScheduleEvaluate.getClassGroupId()==null || courseScheduleEvaluate.getClassGroupId()<0){
-            return failed(HttpStatus.BAD_REQUEST,"班级id必须大于0");
+        if (courseScheduleEvaluate.getClassGroupId() == null || courseScheduleEvaluate.getClassGroupId() < 0) {
+            return failed(HttpStatus.BAD_REQUEST, "班级id必须大于0");
         }
-        if(courseScheduleEvaluate.getItem()==null || courseScheduleEvaluate.getItem().isEmpty()){
-            return failed(HttpStatus.BAD_REQUEST,"课程评价选项不能为空");
+        if (courseScheduleEvaluate.getItem() == null || courseScheduleEvaluate.getItem().isEmpty()) {
+            return failed(HttpStatus.BAD_REQUEST, "课程评价选项不能为空");
         }
         courseScheduleEvaluate.setTeacherId(sysUser.getId());
         return succeed(courseScheduleEvaluateService.updateStudyReport(courseScheduleEvaluate));