Browse Source

Merge branch 'master' of http://git.dayaedu.com/yonge/mec

zouxuan 5 years ago
parent
commit
60120a44b9

+ 14 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/CourseScheduleEvaluateDao.java

@@ -0,0 +1,14 @@
+package com.ym.mec.biz.dal.dao;
+
+import com.ym.mec.biz.dal.entity.CourseScheduleEvaluate;
+import com.ym.mec.biz.dal.entity.TeacherCourseStatistics;
+import com.ym.mec.common.dal.BaseDAO;
+import org.apache.ibatis.annotations.Param;
+
+import java.math.BigDecimal;
+import java.util.Date;
+import java.util.List;
+
+public interface CourseScheduleEvaluateDao extends BaseDAO<Long, CourseScheduleEvaluate> {
+
+}

+ 90 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/CourseScheduleEvaluate.java

@@ -0,0 +1,90 @@
+package com.ym.mec.biz.dal.entity;
+
+import io.swagger.annotations.ApiModelProperty;
+
+import java.util.Date;
+
+public class CourseScheduleEvaluate {
+    private Long id;
+
+    private String musicGroupId;
+
+    @ApiModelProperty(value = "班级id")
+    private Integer classGroupId;
+
+    private Long courseScheduleId;
+
+    private Integer teacherId;
+
+    @ApiModelProperty(value = "评价选项,英文逗号分隔")
+    private String item;
+
+    @ApiModelProperty(value = "报告详情")
+    private String comment;
+
+    private Date createTime;
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public String getMusicGroupId() {
+        return musicGroupId;
+    }
+
+    public void setMusicGroupId(String musicGroupId) {
+        this.musicGroupId = musicGroupId;
+    }
+
+    public Integer getClassGroupId() {
+        return classGroupId;
+    }
+
+    public void setClassGroupId(Integer classGroupId) {
+        this.classGroupId = classGroupId;
+    }
+
+    public Long getCourseScheduleId() {
+        return courseScheduleId;
+    }
+
+    public void setCourseScheduleId(Long courseScheduleId) {
+        this.courseScheduleId = courseScheduleId;
+    }
+
+    public Integer getTeacherId() {
+        return teacherId;
+    }
+
+    public void setTeacherId(Integer teacherId) {
+        this.teacherId = teacherId;
+    }
+
+    public String getItem() {
+        return item;
+    }
+
+    public void setItem(String item) {
+        this.item = item;
+    }
+
+    public String getComment() {
+        return comment;
+    }
+
+    public void setComment(String comment) {
+        this.comment = comment;
+    }
+
+    public Date getCreateTime() {
+        return createTime;
+    }
+
+    public void setCreateTime(Date createTime) {
+        this.createTime = createTime;
+    }
+}

+ 14 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/CourseScheduleEvaluateService.java

@@ -0,0 +1,14 @@
+package com.ym.mec.biz.service;
+
+import com.ym.mec.biz.dal.entity.CourseScheduleEvaluate;
+import com.ym.mec.biz.dal.entity.TeacherCourseStatistics;
+import com.ym.mec.biz.dal.page.TeacherCourseStatisticsQueryInfo;
+import com.ym.mec.common.page.PageInfo;
+import com.ym.mec.common.service.BaseService;
+
+
+public interface CourseScheduleEvaluateService extends BaseService<Long, CourseScheduleEvaluate> {
+
+    boolean addStudyReport(CourseScheduleEvaluate courseScheduleEvaluate);
+
+}

+ 45 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/CourseScheduleEvaluateServiceImpl.java

@@ -0,0 +1,45 @@
+package com.ym.mec.biz.service.impl;
+
+
+import com.ym.mec.biz.dal.dao.ClassGroupDao;
+import com.ym.mec.biz.dal.dao.CourseScheduleEvaluateDao;
+import com.ym.mec.biz.dal.entity.ClassGroup;
+import com.ym.mec.biz.dal.entity.CourseScheduleEvaluate;
+import com.ym.mec.biz.service.CourseScheduleEvaluateService;
+import com.ym.mec.common.dal.BaseDAO;
+import com.ym.mec.common.exception.BizException;
+import com.ym.mec.common.service.impl.BaseServiceImpl;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.Date;
+
+@Service
+public class CourseScheduleEvaluateServiceImpl extends BaseServiceImpl<Long, CourseScheduleEvaluate> implements CourseScheduleEvaluateService {
+
+    @Autowired
+    private CourseScheduleEvaluateDao courseScheduleEvaluateDao;
+    @Autowired
+    private ClassGroupDao classGroupDao;
+
+    @Override
+    public BaseDAO<Long, CourseScheduleEvaluate> getDAO() {
+        return courseScheduleEvaluateDao;
+    }
+
+
+    @Override
+    public boolean addStudyReport(CourseScheduleEvaluate courseScheduleEvaluate) {
+        ClassGroup classGroup = classGroupDao.get(courseScheduleEvaluate.getClassGroupId());
+        if(classGroup==null){
+           throw new BizException("课程不存在!");
+        }
+        courseScheduleEvaluate.setMusicGroupId(classGroup.getMusicGroupId());
+        courseScheduleEvaluate.setCreateTime(new Date());
+        long num = courseScheduleEvaluateDao.insert(courseScheduleEvaluate);
+        if(num <= 0){
+            throw new BizException("报告添加失败,请重试");
+        }
+        return true;
+    }
+}

+ 40 - 0
mec-biz/src/main/resources/config/mybatis/CourseScheduleEvaluateMapper.xml

@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace=" com.ym.mec.biz.dal.dao.CourseScheduleEvaluateDao">
+  <resultMap id="CourseScheduleEvaluate" type="com.ym.mec.biz.dal.entity.CourseScheduleEvaluate">
+    <id column="id_" jdbcType="BIGINT" property="id" />
+    <result column="music_group_id_" jdbcType="VARCHAR" property="musicGroupId" />
+    <result column="class_group_id_" jdbcType="INTEGER" property="classGroupId" />
+    <result column="course_schedule_id_" jdbcType="BIGINT" property="courseScheduleId" />
+    <result column="teacher_id_" jdbcType="INTEGER" property="teacherId" />
+    <result column="item_" jdbcType="VARCHAR" property="item" />
+    <result column="comment_" jdbcType="LONGVARCHAR" property="comment" />
+    <result column="create_time_" jdbcType="TIMESTAMP" property="createTime" />
+  </resultMap>
+  <sql id="Base_Column_List">
+    <!--@mbg.generated-->
+    id_, music_group_id_, class_group_id_, course_schedule_id_, teacher_id_, item_, comment_, 
+    create_time_
+  </sql>
+  <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="CourseScheduleEvaluate">
+    <!--@mbg.generated-->
+    select 
+    <include refid="Base_Column_List" />
+    from course_schedule_evaluate
+    where id_ = #{id,jdbcType=BIGINT}
+  </select>
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
+    <!--@mbg.generated-->
+    delete from course_schedule_evaluate
+    where id_ = #{id,jdbcType=BIGINT}
+  </delete>
+  <insert id="insert" keyColumn="id_" keyProperty="id" parameterType="com.ym.mec.biz.dal.entity.CourseScheduleEvaluate" useGeneratedKeys="true">
+    <!--@mbg.generated-->
+    insert into course_schedule_evaluate (music_group_id_, class_group_id_, course_schedule_id_, 
+      teacher_id_, item_, comment_, 
+      create_time_)
+    values (#{musicGroupId,jdbcType=VARCHAR}, #{classGroupId,jdbcType=INTEGER}, #{courseScheduleId,jdbcType=BIGINT}, 
+      #{teacherId,jdbcType=INTEGER}, #{item,jdbcType=VARCHAR}, #{comment,jdbcType=LONGVARCHAR}, 
+      #{createTime,jdbcType=TIMESTAMP})
+  </insert>
+</mapper>

+ 30 - 3
mec-teacher/src/main/java/com/ym/mec/teacher/controller/ClassGroupController.java

@@ -1,15 +1,21 @@
 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.entity.CourseScheduleEvaluate;
 import com.ym.mec.biz.dal.page.CourseScheduleQueryInfo;
 import com.ym.mec.biz.service.ClassGroupService;
+import com.ym.mec.biz.service.CourseScheduleEvaluateService;
 import com.ym.mec.common.controller.BaseController;
+import com.ym.mec.common.entity.HttpResponseResult;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiParam;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.http.HttpStatus;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.Objects;
 
 /**
  * @Author Joburgess
@@ -22,6 +28,10 @@ public class ClassGroupController extends BaseController {
 
     @Autowired
     private ClassGroupService classGroupService;
+    @Autowired
+    private CourseScheduleEvaluateService courseScheduleEvaluateService;
+    @Autowired
+    private SysUserFeignService sysUserFeignService;
 
     @ApiOperation(value = "教师关联班级获取")
     @GetMapping("/findTeacherClassGroups")
@@ -41,4 +51,21 @@ public class ClassGroupController extends BaseController {
         return succeed(classGroupService.findTeacherClassStudents(queryInfo));
     }
 
+    @ApiOperation(value = "提交陪练报告")
+    @PostMapping(value = "/addStudyReport")
+    public HttpResponseResult addStudyReport(@RequestBody CourseScheduleEvaluate courseScheduleEvaluate) {
+        SysUser sysUser = sysUserFeignService.queryUserInfo();
+        if(Objects.isNull(sysUser)){
+            return failed(HttpStatus.FORBIDDEN,"请登录");
+        }
+        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,"课程评价选项不能为空");
+        }
+        courseScheduleEvaluate.setTeacherId(sysUser.getId());
+        return succeed(courseScheduleEvaluateService.addStudyReport(courseScheduleEvaluate));
+    }
+
 }