Browse Source

Merge remote-tracking branch 'origin/master'

Joburgess 5 years ago
parent
commit
dedb42692b

+ 7 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/TeacherDao.java

@@ -282,4 +282,11 @@ public interface TeacherDao extends BaseDAO<Integer, Teacher> {
     CourseHomework getCourseScheduleHomework(Integer courseScheduleId);
 
     List<Integer> lockTeachers(@Param("userIds") List<Integer> userIds);
+
+    /**
+     * 获取user
+     * @param userId
+     * @return
+     */
+    SysUser getUser(int userId);
 }

+ 11 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/page/TeacherQueryInfo.java

@@ -24,6 +24,9 @@ public class TeacherQueryInfo extends QueryInfo {
 
     @ApiModelProperty(value = "账号状态")
     private String lockFlag;
+    
+    @ApiModelProperty(value = "是否支持额外陪练课授课")
+    private Boolean isSupportExtraPracticeLesson;
 
     public List<Integer> getTeacherId() {
         return teacherId;
@@ -72,4 +75,12 @@ public class TeacherQueryInfo extends QueryInfo {
     public void setLockFlag(String lockFlag) {
         this.lockFlag = lockFlag;
     }
+
+	public Boolean getIsSupportExtraPracticeLesson() {
+		return isSupportExtraPracticeLesson;
+	}
+
+	public void setIsSupportExtraPracticeLesson(Boolean isSupportExtraPracticeLesson) {
+		this.isSupportExtraPracticeLesson = isSupportExtraPracticeLesson;
+	}
 }

+ 6 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/CourseScheduleService.java

@@ -399,4 +399,10 @@ public interface CourseScheduleService extends BaseService<Long, CourseSchedule>
 	 * @return void
 	 */
 	void practiceCourseAdjust(CourseSchedule courseSchedule);
+
+	/**
+	 * 陪练课老师调整
+	 * @param courseSchedule
+	 */
+    void practiceCourseTeacherAdjust(CourseSchedule courseSchedule);
 }

+ 29 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/CourseScheduleServiceImpl.java

@@ -2374,4 +2374,33 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
         checkNewCourseSchedules(courseSchedules,false);
         courseScheduleDao.update(oldCourseSchedule);
     }
+
+    @Override
+    public void practiceCourseTeacherAdjust(CourseSchedule courseSchedule) {
+        if(Objects.isNull(courseSchedule.getId())){
+            throw new BizException("请指定课程");
+        }
+        if(Objects.isNull(courseSchedule.getActualTeacherId())){
+            throw new BizException("请指定上课老师");
+        }
+        CourseSchedule oldCourseSchedule = courseScheduleDao.get(courseSchedule.getId());
+        if(Objects.isNull(oldCourseSchedule)){
+            throw new BizException("未找到对应课程");
+        }
+        if(!oldCourseSchedule.getGroupType().equals(GroupType.PRACTICE)){
+            throw new BizException("请选择陪练课");
+        }
+        Integer practiceCourseMinutes=25;
+        SysConfig practiceCourseMinutesConfig = sysConfigService.findByParamName(SysConfigService.PRACTICE_COURSE_MINUTES);
+        if(Objects.nonNull(practiceCourseMinutesConfig)){
+            practiceCourseMinutes=practiceCourseMinutesConfig.getParanValue(Integer.class);
+        }
+        oldCourseSchedule.setClassDate(courseSchedule.getStartClassTime());
+        oldCourseSchedule.setStartClassTime(courseSchedule.getStartClassTime());
+        oldCourseSchedule.setEndClassTime(DateUtil.addMinutes(courseSchedule.getStartClassTime(),practiceCourseMinutes));
+        List<CourseSchedule> courseSchedules=new ArrayList<>();
+        courseSchedules.add(oldCourseSchedule);
+        checkNewCourseSchedules(courseSchedules,false);
+        courseScheduleDao.update(oldCourseSchedule);
+    }
 }

+ 41 - 2
mec-biz/src/main/resources/config/mybatis/TeacherMapper.xml

@@ -54,7 +54,7 @@
     <select id="get" resultMap="Teacher">
         SELECT t.id_,t.organ_id_ teacher_organ_id_,t.job_type_,t.job_nature_,t.is_probation_period_,t.education_background_,t.graduate_school_,t.graduate_school_,
         t.technical_titles_,t.work_unit_,t.subject_id_,t.entry_date_,t.certificate_type_,t.certificate_num_,t.flow_organ_range_,t.update_time_,
-        t.create_time_,t.introduction_,t.demission_date_,t.is_support_course_schedule_rewards_rules_,
+        t.create_time_,t.introduction_,t.demission_date_,t.is_support_course_schedule_rewards_rules_,t.is_support_extra_practice_lesson_,
         su.real_name_,su.password_,su.salt_,su.phone_,su.avatar_,
         su.lock_flag_,su.del_flag_,su.wx_openid_,su.qq_openid_,su.user_type_,
         su.gender_,su.nation_,su.birthdate_,su.email_,su.im_token_,su.username_,su.organ_id_
@@ -216,7 +216,7 @@
 
     <!-- 分页查询 -->
     <select id="queryPage" resultMap="Teacher" parameterType="map">
-        SELECT t.id_,su.real_name_,su.lock_flag_,t.subject_id_,su.phone_,t.organ_id_ teacher_organ_id_,t.organ_id_,
+        SELECT t.id_,su.real_name_,su.lock_flag_,t.subject_id_,su.phone_,t.organ_id_ teacher_organ_id_,t.organ_id_,t.is_support_extra_practice_lesson_,
         t.job_nature_,t.is_probation_period_,GROUP_CONCAT(s.name_) subject_name_,su.del_flag_
         FROM teacher t LEFT JOIN sys_user su ON t.id_ = su.id_
         LEFT JOIN `subject` s ON FIND_IN_SET(s.id_,t.subject_id_)
@@ -247,6 +247,9 @@
         <if test="search != null">
             AND (su.real_name_ LIKE CONCAT('%',#{search},'%') OR su.phone_ LIKE CONCAT('%',#{search},'%') OR t.id_ = #{search})
         </if>
+        <if test="isSupportExtraPracticeLesson != null">
+            AND is_support_extra_practice_lesson_ = #{isSupportExtraPracticeLesson}
+        </if>
     </sql>
 
     <!-- 根据证件号查询老师 -->
@@ -634,6 +637,9 @@
             <if test="isProbationPeriod != null">
                 AND t.is_probation_period_ = #{isProbationPeriod}
             </if>
+            <if test="isSupportExtraPracticeLesson != null">
+                AND t.is_support_extra_practice_lesson_ = #{isSupportExtraPracticeLesson}
+            </if>
         </where>
     </select>
 
@@ -715,4 +721,37 @@
         </foreach>
         FOR UPDATE
     </select>
+    <resultMap type="com.ym.mec.auth.api.entity.SysUser" id="SysUser">
+        <result column="id_" property="id"/>
+        <result column="username_" property="username"/>
+        <result column="real_name_" property="realName"/>
+        <result column="password_" property="password"/>
+        <result column="salt_" property="salt"/>
+        <result column="phone_" property="phone"/>
+        <result column="avatar_" property="avatar"/>
+        <result column="organ_id_" property="organId"/>
+        <result column="create_time_" property="createTime"/>
+        <result column="update_time_" property="updateTime"/>
+        <result column="lock_flag_" property="lockFlag"/>
+        <result column="del_flag_" property="delFlag" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
+        <result column="wx_openid_" property="wxOpenid"/>
+        <result column="qq_openid_" property="qqOpenid"/>
+        <result column="user_type_" property="userType"/>
+        <result column="gender_" property="gender"/>
+        <result column="nation_" property="nation"/>
+        <result column="birthdate_" property="birthdate"/>
+        <result column="email_" property="email"/>
+        <result column="im_token_" property="imToken"/>
+        <result column="id_card_no_" property="idCardNo"/>
+        <result column="wechat_id_" property="wechatId"/>
+        <result column="is_super_admin_" property="isSuperAdmin"/>
+        <result column="current_grade_" property="currentGrade"/>
+        <result column="current_class_" property="currentClass"/>
+    </resultMap>
+
+    <select id="getUser" resultMap="SysUser">
+        SELECT su.*
+        FROM sys_user su
+        WHERE su.id_ = #{id} LIMIT 1
+    </select>
 </mapper>

+ 1 - 1
mec-im/src/main/java/com/ym/job/ScheduleManager.java

@@ -86,8 +86,8 @@ public class ScheduleManager implements SchedulingConfigurer {
             @Override
             public void run() {
                 ScheduledTask task = roomCacheTasks.remove(roomId);
-                task.cancel();
                 roomService.destroyRoom(roomId);
+                task.cancel();
             }
         }, roomProperties.getRoomTtl() * 10, roomProperties.getRoomTtl(), null));
         roomCacheTasks.put(roomId, task);

+ 5 - 2
mec-im/src/main/java/com/ym/service/Impl/RoomServiceImpl.java

@@ -118,6 +118,7 @@ public class RoomServiceImpl implements RoomService {
                 log.error("joinRoom IM error: roomId={}, {}", roomId, resultInfo.getErrorMessage());
                 throw new ApiException(ErrorEnum.ERR_CREATE_ROOM_ERROR, resultInfo.getErrorMessage());
             } else {
+//                destroyRoom(roomId);
                 scheduleManager.addExpiredTask(this, roomId);
             }
         } else {
@@ -354,7 +355,7 @@ public class RoomServiceImpl implements RoomService {
     public Boolean downgrade(String roomId, List<ReqChangeUserRoleData.ChangedUser> users) throws ApiException, Exception {
         CheckUtils.checkArgument(roomId != null, "roomId must't be null");
         CheckUtils.checkArgument(users.size() > 0, "the changed user list must't be null");
-        String token = SecurityUtils.getAuthenticationValue();
+//        String token = SecurityUtils.getAuthenticationValue();
         SysUser authUser = sysUserFeignService.queryUserInfo();
         String userId = authUser.getId().toString();
         List<Room> roomList = roomDao.findByRid(roomId);
@@ -1135,10 +1136,12 @@ public class RoomServiceImpl implements RoomService {
     }
 
     @Override
+    @Transactional(rollbackFor = Exception.class)
     public boolean statusSync(String roomId,String userId) throws Exception {
         List<RoomMember> byRidAndUid = roomMemberDao.findByRidAndUid(roomId, userId);
         if(byRidAndUid.size() > 0){
-            SysUser sysUser = sysUserFeignService.queryUserById(Integer.parseInt(userId));
+//            SysUser sysUser = sysUserFeignService.queryUserById(Integer.parseInt(userId));
+            SysUser sysUser = teacherDao.getUser(Integer.parseInt(userId));
             Teacher teacher = teacherDao.get(sysUser.getId());
             CourseSchedule courseSchedule = courseScheduleDao.get(Long.parseLong(roomId.substring(4)));
             try {

+ 8 - 0
mec-web/src/main/java/com/ym/mec/web/controller/CourseScheduleController.java

@@ -304,5 +304,13 @@ public class CourseScheduleController extends BaseController {
         scheduleService.practiceCourseAdjust(courseSchedule);
         return succeed();
     }
+
+    @ApiOperation(value = "陪练课老师调整")
+    @PostMapping("/practiceCourseTeacherAdjust")
+    @PreAuthorize("@pcs.hasPermissions('courseSchedule/practiceCourseTeacherAdjust')")
+    public Object practiceCourseTeacherAdjust(CourseSchedule courseSchedule){
+        scheduleService.practiceCourseTeacherAdjust(courseSchedule);
+        return succeed();
+    }
 }