Procházet zdrojové kódy

Merge remote-tracking branch 'origin/master'

Joburgess před 5 roky
rodič
revize
c4e498f67b

+ 10 - 0
mec-auth/mec-auth-api/src/main/java/com/ym/mec/auth/api/entity/SysUser.java

@@ -116,6 +116,8 @@ public class SysUser implements Serializable{
 	private Integer serviceTag;
 
 	private Integer operatingTag;
+	
+	private Integer teacherId;
 
 	public Integer getServiceTag() {
 		return serviceTag;
@@ -349,6 +351,14 @@ public class SysUser implements Serializable{
 		this.isSuperAdmin = isSuperAdmin;
 	}
 
+	public Integer getTeacherId() {
+		return teacherId;
+	}
+
+	public void setTeacherId(Integer teacherId) {
+		this.teacherId = teacherId;
+	}
+
 	@Override
 	public String toString() {
 		return ToStringBuilder.reflectionToString(this);

+ 6 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/TeacherAttendanceDao.java

@@ -191,4 +191,10 @@ public interface TeacherAttendanceDao extends BaseDAO<Long, TeacherAttendance> {
 	 * @return
 	 */
     int getTotalMinutes(@Param("courseId") Long courseId, @Param("teacherId") Integer teacherId);
+
+	/**
+	 * 清空签退信息
+	 * @param courseId
+	 */
+	void cleanCourseTeacherSignOut(@Param("courseId") Long courseId);
 }

+ 20 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/StudentManageListDto.java

@@ -71,6 +71,10 @@ public class StudentManageListDto {
     private String vipGroupName;
 
     private String vipGroupStatus;
+    
+    private String teacherName;
+    
+    private Integer teacherId;
 
     public YesOrNoEnum getServiceTag() {
         return serviceTag;
@@ -263,4 +267,20 @@ public class StudentManageListDto {
 	public void setIsActive(YesOrNoEnum isActive) {
 		this.isActive = isActive;
 	}
+
+	public String getTeacherName() {
+		return teacherName;
+	}
+
+	public void setTeacherName(String teacherName) {
+		this.teacherName = teacherName;
+	}
+
+	public Integer getTeacherId() {
+		return teacherId;
+	}
+
+	public void setTeacherId(Integer teacherId) {
+		this.teacherId = teacherId;
+	}
 }

+ 12 - 3
mec-biz/src/main/java/com/ym/mec/biz/dal/page/StudentManageQueryInfo.java

@@ -1,13 +1,12 @@
 package com.ym.mec.biz.dal.page;
 
-import com.ym.mec.biz.dal.enums.YesOrNoEnum;
 import io.swagger.annotations.ApiModelProperty;
 
+import java.util.List;
+
 import com.ym.mec.biz.dal.enums.ClassGroupStudentStatusEnum;
 import com.ym.mec.common.page.QueryInfo;
 
-import java.util.List;
-
 /**
  * @Author Joburgess
  * @Date 2019/9/19
@@ -42,6 +41,8 @@ public class StudentManageQueryInfo extends QueryInfo {
     private Integer serviceTag;
 
     private Integer operatingTag;
+    
+    private Integer teacherId;
 
     public Integer getServiceTag() {
         return serviceTag;
@@ -138,4 +139,12 @@ public class StudentManageQueryInfo extends QueryInfo {
 	public void setIsActive(Boolean isActive) {
 		this.isActive = isActive;
 	}
+
+	public Integer getTeacherId() {
+		return teacherId;
+	}
+
+	public void setTeacherId(Integer teacherId) {
+		this.teacherId = teacherId;
+	}
 }

+ 21 - 6
mec-biz/src/main/java/com/ym/mec/biz/service/StudentManageService.java

@@ -1,14 +1,29 @@
 package com.ym.mec.biz.service;
 
-import com.ym.mec.auth.api.entity.SysUser;
-import com.ym.mec.biz.dal.dto.*;
-import com.ym.mec.biz.dal.entity.StudentAttendance;
-import com.ym.mec.biz.dal.page.*;
-import com.ym.mec.common.page.PageInfo;
-
 import java.util.List;
 import java.util.Map;
 
+import com.ym.mec.auth.api.entity.SysUser;
+import com.ym.mec.biz.dal.dto.ConditionDto;
+import com.ym.mec.biz.dal.dto.MusicGroupStudentSignDto;
+import com.ym.mec.biz.dal.dto.MusicGroupStudentsDto;
+import com.ym.mec.biz.dal.dto.Student4operating;
+import com.ym.mec.biz.dal.dto.StudentManageAccountBaseInfoDto;
+import com.ym.mec.biz.dal.dto.StudentManageBaseInfoOfMusicGroupDto;
+import com.ym.mec.biz.dal.dto.StudentManageListDto;
+import com.ym.mec.biz.dal.dto.StudentManageVipGroupClassDto;
+import com.ym.mec.biz.dal.dto.StudentManageVipGroupDto;
+import com.ym.mec.biz.dal.dto.StudentRegisterPerDto;
+import com.ym.mec.biz.dal.page.MusicGroupStudentQueryInfo;
+import com.ym.mec.biz.dal.page.StudentManageAttendanceQueryInfo;
+import com.ym.mec.biz.dal.page.StudentManageCourseQueryInfo;
+import com.ym.mec.biz.dal.page.StudentManageQueryInfo;
+import com.ym.mec.biz.dal.page.StudentManageVipClassQueryInfo;
+import com.ym.mec.biz.dal.page.StudentOperatingQueryInfo;
+import com.ym.mec.biz.dal.page.StudentSignQueryInfo;
+import com.ym.mec.biz.dal.page.TeacherPaymentRecordInfo;
+import com.ym.mec.common.page.PageInfo;
+
 /**
  * @Author Joburgess
  * @Date 2019/9/19

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

@@ -104,4 +104,18 @@ public interface TeacherAttendanceService extends BaseService<Long, TeacherAtten
 	 * @return void
 	 */
 	void updateTeacherAttendance(TeacherAttendance teacherAttendance);
+
+	/**
+	 * 清空考勤
+	 * @param courseId
+	 */
+	void cleanCourseTeacherSignOut(Long courseId);
+
+	/**
+	 * 获取教师签到信息
+	 * @param courseId
+	 * @param teacherId
+	 * @return
+	 */
+	TeacherAttendance findByTeacherAttendanceInfo(Long courseId, Integer teacherId);
 }

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

@@ -536,7 +536,7 @@ public class StudentAttendanceServiceImpl extends BaseServiceImpl<Long, StudentA
 							StudentAttendance byStatusAndCourseScheduleId = studentAttendanceDao.findByStatusAndCourseScheduleId(userId, courseSchedules.get(i).getId().intValue());
 //							Date signOutTime = date;
 //							if(i < courseSchedules.size() - 1 && date.after(endDateTime)){
-								//不是最后一节连堂课,并且签退时间大于课程结束时间,签退时间等于课程结束时间
+							//不是最后一节连堂课,并且签退时间大于课程结束时间,签退时间等于课程结束时间
 //								signOutTime = endDateTime;
 //							}
 							if(byStatusAndCourseScheduleId != null){

+ 45 - 11
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentManageServiceImpl.java

@@ -1,15 +1,54 @@
 package com.ym.mec.biz.service.impl;
 
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
 import com.ym.mec.auth.api.client.SysUserFeignService;
 import com.ym.mec.auth.api.entity.SysUser;
-import com.ym.mec.biz.dal.dao.*;
-import com.ym.mec.biz.dal.dto.*;
-import com.ym.mec.biz.dal.entity.CourseSchedule;
+import com.ym.mec.biz.dal.dao.ClassGroupDao;
+import com.ym.mec.biz.dal.dao.CourseScheduleStudentPaymentDao;
+import com.ym.mec.biz.dal.dao.MusicGroupDao;
+import com.ym.mec.biz.dal.dao.MusicGroupStudentFeeDao;
+import com.ym.mec.biz.dal.dao.OrganizationDao;
+import com.ym.mec.biz.dal.dao.StudentDao;
+import com.ym.mec.biz.dal.dao.StudentManageDao;
+import com.ym.mec.biz.dal.dao.StudentPaymentOrderDao;
+import com.ym.mec.biz.dal.dao.StudentRegistrationDao;
+import com.ym.mec.biz.dal.dao.SysUserCashAccountDao;
+import com.ym.mec.biz.dal.dao.TeacherDao;
+import com.ym.mec.biz.dal.dao.VipGroupDao;
+import com.ym.mec.biz.dal.dto.ConditionDto;
+import com.ym.mec.biz.dal.dto.MusicGroupStudentSignDto;
+import com.ym.mec.biz.dal.dto.MusicGroupStudentsDto;
+import com.ym.mec.biz.dal.dto.Student4operating;
+import com.ym.mec.biz.dal.dto.StudentManageAccountBaseInfoDto;
+import com.ym.mec.biz.dal.dto.StudentManageBaseInfoOfMusicGroupDto;
+import com.ym.mec.biz.dal.dto.StudentManageCourseListDto;
+import com.ym.mec.biz.dal.dto.StudentManageListDto;
+import com.ym.mec.biz.dal.dto.StudentManageVipGroupClassDto;
+import com.ym.mec.biz.dal.dto.StudentManageVipGroupDto;
+import com.ym.mec.biz.dal.dto.StudentRegisterPerDto;
 import com.ym.mec.biz.dal.entity.Student;
 import com.ym.mec.biz.dal.entity.StudentRegistration;
 import com.ym.mec.biz.dal.entity.SysUserCashAccount;
 import com.ym.mec.biz.dal.enums.YesOrNoEnum;
-import com.ym.mec.biz.dal.page.*;
+import com.ym.mec.biz.dal.page.MusicGroupStudentQueryInfo;
+import com.ym.mec.biz.dal.page.StudentManageAttendanceQueryInfo;
+import com.ym.mec.biz.dal.page.StudentManageCourseQueryInfo;
+import com.ym.mec.biz.dal.page.StudentManageQueryInfo;
+import com.ym.mec.biz.dal.page.StudentManageVipClassQueryInfo;
+import com.ym.mec.biz.dal.page.StudentOperatingQueryInfo;
+import com.ym.mec.biz.dal.page.StudentSignQueryInfo;
+import com.ym.mec.biz.dal.page.TeacherPaymentRecordInfo;
 import com.ym.mec.biz.service.StudentManageService;
 import com.ym.mec.biz.service.StudentService;
 import com.ym.mec.common.entity.ImResult;
@@ -18,13 +57,6 @@ import com.ym.mec.common.exception.BizException;
 import com.ym.mec.common.page.PageInfo;
 import com.ym.mec.im.ImFeignService;
 import com.ym.mec.util.collection.MapUtil;
-import org.apache.commons.lang3.StringUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-
-import java.util.*;
-import java.util.stream.Collectors;
 
 /**
  * @Author Joburgess
@@ -387,6 +419,7 @@ public class StudentManageServiceImpl implements StudentManageService {
         Student student = new Student(userId, studentRegistrationDao.getSubjectIds(userId));
         student.setOperatingTag(sysUser.getOperatingTag());
         student.setServiceTag(sysUser.getServiceTag());
+        student.setTeacherId(sysUser.getTeacherId());
         studentService.upSet(student);
         return userId;
     }
@@ -406,6 +439,7 @@ public class StudentManageServiceImpl implements StudentManageService {
         Student student = new Student(userId, studentRegistrationDao.getSubjectIds(userId));
         student.setOperatingTag(sysUser.getOperatingTag());
         student.setServiceTag(sysUser.getServiceTag());
+        student.setTeacherId(sysUser.getTeacherId());
         studentService.upSet(student);
         return userId;
     }

+ 17 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/impl/TeacherAttendanceServiceImpl.java

@@ -344,10 +344,15 @@ public class TeacherAttendanceServiceImpl extends BaseServiceImpl<Long, TeacherA
 							Date endDateTime = DateUtil.stringToDate(courseClassDate + " " + courseEndDateTime, DateUtil.EXPANDED_DATE_TIME_FORMAT);
 //							Date signOutTime = date;
 //							if(i < courseSchedules.size() - 1 && date.after(endDateTime)){
-								//不是最后一节连堂课,并且签退时间大于课程结束时间,签退时间等于课程结束时间
+							//不是最后一节连堂课,并且签退时间大于课程结束时间,签退时间等于课程结束时间
 //								signOutTime = endDateTime;
 //							}
 							//如果签退时间大于课程结束时间
+							//如果当前课程没有签退记录,那么正常更新
+							TeacherAttendance personalAttendance = teacherAttendanceDao.getTeacherPersonalAttendance(courseSchedules.get(i).getId().intValue());
+							if(personalAttendance != null && personalAttendance.getSignOutTime() != null){
+								continue;
+							}
 							if(date.after(endDateTime)){
 								teacherAttendanceDao.cuntinueCourseSign(courseSchedules.get(i).getId(),signInTime,date,1);
 							}else if (date.equals(endDateTime)){
@@ -496,4 +501,15 @@ public class TeacherAttendanceServiceImpl extends BaseServiceImpl<Long, TeacherA
 			teacherAttendanceDao.update(teacherAttendance);
 		}
 	}
+
+	@Override
+	@Transactional(rollbackFor = Exception.class)
+	public void cleanCourseTeacherSignOut(Long courseId) {
+		teacherAttendanceDao.cleanCourseTeacherSignOut(courseId);
+	}
+
+	@Override
+	public TeacherAttendance findByTeacherAttendanceInfo(Long courseId, Integer teacherId) {
+		return teacherAttendanceDao.findByTeacherAttendanceInfo(teacherId.longValue(),courseId);
+	}
 }

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

@@ -427,6 +427,7 @@
                  LEFT JOIN sys_user su ON su.id_ = s.user_id_
         WHERE s.operating_tag_ = 1
           AND su.organ_id_ > 0
+          AND su.user_type_ LIKE '%STUDENT%'
         GROUP BY su.organ_id_
     </select>
 </mapper>

+ 10 - 1
mec-biz/src/main/resources/config/mybatis/StudentManageDao.xml

@@ -114,10 +114,11 @@
         SELECT su.id_ user_id_,su.username_,su.gender_,su.phone_ parents_phone_,su.real_name_,
         su.birthdate_,su.nation_,su.organ_id_,
         CASE WHEN su.password_ IS NULL THEN 0 ELSE 1 END isActive_,
-        CASE WHEN pla.id_ IS NULL THEN 0 ELSE 1 END isMake_,st.service_tag_,st.operating_tag_
+        CASE WHEN pla.id_ IS NULL THEN 0 ELSE 1 END isMake_,st.service_tag_,st.operating_tag_,tu.real_name_ teacher_name_,st.teacher_id_
         FROM sys_user su
         LEFT JOIN practice_lesson_apply pla ON su.id_ = pla.user_id_
         LEFT JOIN student st ON st.user_id_ = su.id_
+        left join sys_user tu on tu.id_ = st.teacher_id_
         <include refid="findStudentsByOrganIdSql"/>
         ORDER BY su.create_time_ DESC
         <include refid="global.limit"/>
@@ -149,6 +150,9 @@
             <if test="serviceTag != null">
                 AND st.service_tag_ = #{serviceTag}
             </if>
+            <if test="teacherId != null">
+                AND st.teacher_id_ = #{teacherId}
+            </if>
             <if test="userIds != null">
                 AND su.id_ IN
                 <foreach collection="userIds" open="(" close=")" separator="," item="item">
@@ -605,6 +609,9 @@
         <if test="serviceTag != null">
             AND st.service_tag_ = #{serviceTag}
         </if>
+        <if test="teacherId != null">
+            AND st.teacher_id_ = #{teacherId}
+        </if>
     </sql>
     <select id="queryHasCourse" resultType="java.lang.Integer">
         SELECT su.id_ FROM sys_user su
@@ -745,6 +752,8 @@
         <result property="courseBalance" column="course_balance_"/>
         <result property="serviceTag" column="service_tag_" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
         <result property="operatingTag" column="operating_tag_" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
+        <result property="teacherName" column="teacher_name_"/>
+        <result property="teacherId" column="teacher_id_"/>
     </resultMap>
     <select id="queryHasCourseStudent" resultMap="studentManageListDto">
         SELECT su.id_ user_id_,su.username_,su.gender_,GROUP_CONCAT(DISTINCT sr.parents_name_)parents_name_,

+ 5 - 0
mec-biz/src/main/resources/config/mybatis/TeacherAttendanceMapper.xml

@@ -384,6 +384,11 @@
             #{courseScheduleId}
         </foreach>
     </update>
+    <update id="cleanCourseTeacherSignOut">
+        UPDATE teacher_attendance
+        SET sign_out_status_ = NULL,sign_out_time_= NULL
+    	WHERE course_schedule_id_=#{courseId}
+    </update>
 
     <delete id="deleteByMusicGroupId" parameterType="map" >
 		DELETE ta FROM teacher_attendance ta LEFT JOIN course_schedule cs ON ta.course_schedule_id_ = cs.id_

+ 29 - 3
mec-im/src/main/java/com/ym/service/Impl/RoomServiceImpl.java

@@ -17,6 +17,7 @@ import com.ym.mec.biz.dal.dao.SysConfigDao;
 import com.ym.mec.biz.dal.dao.TeacherDao;
 import com.ym.mec.biz.dal.entity.CourseSchedule;
 import com.ym.mec.biz.dal.entity.Teacher;
+import com.ym.mec.biz.dal.entity.TeacherAttendance;
 import com.ym.mec.biz.dal.enums.GroupType;
 import com.ym.mec.biz.dal.enums.SignStatusEnum;
 import com.ym.mec.biz.dal.enums.StudentAttendanceStatusEnum;
@@ -245,6 +246,7 @@ public class RoomServiceImpl implements RoomService {
         log.info("roomSignIn: roomId={}, userId={}", roomId, userId);
         Teacher teacher = teacherDao.get(Integer.parseInt(userId));
         CourseSchedule courseSchedule = courseScheduleDao.get(roomId);
+        Date date = new Date();
 
         String continueCourseTime = sysConfigDao.findConfigValue(SysConfigService.ONLINE_CONTINUE_COURSE_TIME);
         if(StringUtils.isEmpty(continueCourseTime)){
@@ -252,21 +254,45 @@ public class RoomServiceImpl implements RoomService {
         }
         CourseSchedule schedule = courseSchedule;
         //如果当前课程是连堂课,那么获取第一节课的课程编号
+        Long signInRoomId = null;
         while (true){
             String classDate = DateUtil.format(schedule.getClassDate(), DateUtil.DEFAULT_PATTERN);
             String startClassTime = DateUtil.format(schedule.getStartClassTime(), DateUtil.EXPANDED_TIME_FORMAT);
             schedule = courseScheduleDao.getLastCourse(schedule.getClassGroupId(),classDate + " " + startClassTime,schedule.getActualTeacherId(),continueCourseTime);
             if(schedule != null){
-                roomId = schedule.getId();
+                signInRoomId = schedule.getId();
             }else {
                 break;
             }
         }
+        if(signInRoomId == null){
+            signInRoomId = roomId;
+        }else {
+            if(teacher != null && teacher.getId().equals(courseSchedule.getActualTeacherId())){
+                String classDate = DateUtil.format(courseSchedule.getClassDate(), DateUtil.DEFAULT_PATTERN);
+                String startClassTime = DateUtil.format(courseSchedule.getStartClassTime(), DateUtil.EXPANDED_TIME_FORMAT);
+                //获取上一次课程
+                CourseSchedule lastCourse = courseScheduleDao.getLastCourse(courseSchedule.getClassGroupId(), classDate + " " + startClassTime, courseSchedule.getActualTeacherId(), continueCourseTime);
+                //获取当前课程的签退时间
+                TeacherAttendance teacherAttendance = teacherAttendanceService.findByTeacherAttendanceInfo(lastCourse.getId(),courseSchedule.getActualTeacherId());
+                //如果上次课签退时间和当前签到时间间隔小于等于5分钟,清除上一次课程的教师签退记录
+                Date signOutTime = teacherAttendance.getSignOutTime();
+                log.info("signOutTime: signOutTime={}, date={}", signOutTime, date);
+                if(signOutTime != null && DateUtil.minutesBetween(signOutTime,date) <= Integer.parseInt(continueCourseTime)){
+                    teacherAttendanceService.cleanCourseTeacherSignOut(lastCourse.getId());
+                }else {
+                    //如果大于5分钟,不换课堂,对当前课程进行签到
+                    teacherAttendanceService.addTeacherAttendanceRecord(roomId.intValue(),courseSchedule.getActualTeacherId(), SignStatusEnum.SIGN_IN,true);
+                }
+            }
+        }
+        //如果存在连堂课,并且跨课超过5分钟
+        log.info("signInRoomId: signInRoomId={}, userId={}", signInRoomId, userId);
         try {
             if(teacher != null && teacher.getId().equals(courseSchedule.getActualTeacherId())){
-                teacherAttendanceService.addTeacherAttendanceRecord(roomId.intValue(),courseSchedule.getActualTeacherId(), SignStatusEnum.SIGN_IN,true);
+                teacherAttendanceService.addTeacherAttendanceRecord(signInRoomId.intValue(),courseSchedule.getActualTeacherId(), SignStatusEnum.SIGN_IN,true);
             }else {
-                studentAttendanceService.addStudentAttendanceRecord(roomId.intValue(),Integer.parseInt(userId), StudentAttendanceStatusEnum.NORMAL,SignStatusEnum.SIGN_IN);
+                studentAttendanceService.addStudentAttendanceRecord(signInRoomId.intValue(),Integer.parseInt(userId), StudentAttendanceStatusEnum.NORMAL,SignStatusEnum.SIGN_IN);
             }
         }catch (Exception e){
             e.printStackTrace();

+ 2 - 2
mec-web/src/main/java/com/ym/mec/web/controller/ExportController.java

@@ -264,10 +264,10 @@ public class ExportController extends BaseController {
         try {
             HSSFWorkbook workbook = POIUtil.exportExcel(new String[]{"分部", "学员编号", "学员姓名", "性别", "家长姓名",
                     "家长联系电话", "是否激活", "是否有课", "是否预约网管课", "是否有网管课", "课程余额(元)",
-                    "所在乐团", "乐团所属声部", "所在乐团状态", "所在vip课", "所在VIP状态", "服务标签", "运营标签"}, new String[]{
+                    "所在乐团", "乐团所属声部", "所在乐团状态", "所在vip课", "所在VIP状态", "服务标签", "运营标签","指导老师"}, new String[]{
                     "organName", "userId", "username", "gender.description", "parentsName", "parentsPhone",
                     "isActive.msg", "hasCourse.msg", "isMake.msg", "hasPracticeCourse.msg", "courseBalance", "musicGroupName",
-                    "subjectName", "musicGroupStatus", "vipGroupName", "vipGroupStatus", "serviceTag.msg", "operatingTag.msg"}, rows);
+                    "subjectName", "musicGroupStatus", "vipGroupName", "vipGroupStatus", "serviceTag.msg", "operatingTag.msg","teacherName"}, rows);
             response.setContentType("application/octet-stream");
             response.setHeader("Content-Disposition", "attachment;filename=lender-" + DateUtil.getDate(new Date()) + ".xls");
             response.flushBuffer();