Browse Source

1、课酬确认相关
2、VIP课导出添加学生姓名和编号
3、学员服务信息统计优化

Joburgess 5 years ago
parent
commit
2a77fcb5fb

+ 9 - 12
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/CourseScheduleStudentPaymentDao.java

@@ -1,23 +1,18 @@
 package 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.entity.CourseScheduleStudentPayment;
+import com.ym.mec.biz.dal.enums.GroupType;
+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;
 import java.util.Map;
 import java.util.Set;
 
-import org.apache.ibatis.annotations.Param;
-
-import com.ym.mec.biz.dal.dto.BasicUserDto;
-import com.ym.mec.biz.dal.dto.Practice4ExercisesSituationDto;
-import com.ym.mec.biz.dal.dto.StudentAttendanceStatisticsResponse;
-import com.ym.mec.biz.dal.dto.StudentCourseTimesDto;
-import com.ym.mec.biz.dal.dto.VipGroupGiveCourseSortDto;
-import com.ym.mec.biz.dal.entity.CourseSchedule;
-import com.ym.mec.biz.dal.entity.CourseScheduleStudentPayment;
-import com.ym.mec.biz.dal.enums.GroupType;
-import com.ym.mec.common.dal.BaseDAO;
-
 public interface CourseScheduleStudentPaymentDao extends BaseDAO<Long, CourseScheduleStudentPayment> {
 
     /**
@@ -259,4 +254,6 @@ public interface CourseScheduleStudentPaymentDao extends BaseDAO<Long, CourseSch
      * @return
      */
     List<StudentCourseTimesDto> queryStudentCourseTimesOfOnline(Date startDate);
+
+    List<StudentTeacherCourseDto> findAllStudentCourseInfo();
 }

+ 3 - 1
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/TeacherSalaryComplaintsDao.java

@@ -35,5 +35,7 @@ public interface TeacherSalaryComplaintsDao extends BaseDAO<Long, TeacherSalaryC
      * @return java.util.List<com.ym.mec.biz.dal.entity.TeacherSalaryComplaints>
      */
     List<TeacherSalaryComplaints> findTeacherSalaryComplaintsWithMonth(@Param("teacherId") Integer teacherId,
-                                                                       @Param("month") String month);
+                                                                       @Param("month") String month,
+                                                                        @Param("status") TeacherSalaryComplaintsStatusEnum status);
+
 }

+ 73 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/StudentTeacherCourseDto.java

@@ -0,0 +1,73 @@
+package com.ym.mec.biz.dal.dto;
+
+import com.ym.mec.biz.dal.entity.CourseSchedule;
+import com.ym.mec.biz.dal.enums.GroupType;
+
+import java.util.Date;
+
+/**
+ * @Author Joburgess
+ * @Date 2020/4/16
+ */
+public class StudentTeacherCourseDto {
+
+    private Integer studentId;
+
+    private Integer teacherId;
+
+    private GroupType groupType;
+
+    private String groupId;
+
+    private CourseSchedule.CourseScheduleType courseScheduleType;
+
+    private Date classesStartTime;
+
+    public Integer getStudentId() {
+        return studentId;
+    }
+
+    public void setStudentId(Integer studentId) {
+        this.studentId = studentId;
+    }
+
+    public Integer getTeacherId() {
+        return teacherId;
+    }
+
+    public void setTeacherId(Integer teacherId) {
+        this.teacherId = teacherId;
+    }
+
+    public GroupType getGroupType() {
+        return groupType;
+    }
+
+    public void setGroupType(GroupType groupType) {
+        this.groupType = groupType;
+    }
+
+    public String getGroupId() {
+        return groupId;
+    }
+
+    public void setGroupId(String groupId) {
+        this.groupId = groupId;
+    }
+
+    public CourseSchedule.CourseScheduleType getCourseScheduleType() {
+        return courseScheduleType;
+    }
+
+    public void setCourseScheduleType(CourseSchedule.CourseScheduleType courseScheduleType) {
+        this.courseScheduleType = courseScheduleType;
+    }
+
+    public Date getClassesStartTime() {
+        return classesStartTime;
+    }
+
+    public void setClassesStartTime(Date classesStartTime) {
+        this.classesStartTime = classesStartTime;
+    }
+}

+ 10 - 2
mec-biz/src/main/java/com/ym/mec/biz/service/StudentService.java

@@ -1,12 +1,12 @@
 package com.ym.mec.biz.service;
 
-import java.text.ParseException;
-
 import com.ym.mec.biz.dal.entity.Student;
 import com.ym.mec.biz.dal.page.StudentQueryInfo;
 import com.ym.mec.common.page.PageInfo;
 import com.ym.mec.common.service.BaseService;
 
+import java.text.ParseException;
+
 public interface StudentService extends BaseService<Integer, Student> {
 
     PageInfo findStudentVipGroupList(StudentQueryInfo queryInfo);
@@ -19,4 +19,12 @@ public interface StudentService extends BaseService<Integer, Student> {
      * @throws ParseException 
      */
     boolean updateOperatingTag() throws ParseException;
+
+    /**
+     * @describe 初始化教师编号
+     * @author Joburgess
+     * @date 2020/4/16
+     * @return void
+     */
+    void initTeacherId();
 }

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

@@ -895,7 +895,7 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
         }else{
             result.put("confirmStatus",0);
         }
-        List<TeacherSalaryComplaints> teacherSalaryComplaintsWithMonth = teacherSalaryComplaintsDao.findTeacherSalaryComplaintsWithMonth(queryInfo4Web.getTeacherId(), queryInfo4Web.getMonth());
+        List<TeacherSalaryComplaints> teacherSalaryComplaintsWithMonth = teacherSalaryComplaintsDao.findTeacherSalaryComplaintsWithMonth(queryInfo4Web.getTeacherId(), queryInfo4Web.getMonth(), TeacherSalaryComplaintsStatusEnum.PENDING);
         if(CollectionUtils.isEmpty(teacherSalaryComplaintsWithMonth)){
             result.put("haveComplaints",0);
         }else{

+ 62 - 13
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentServiceImpl.java

@@ -1,21 +1,10 @@
 package com.ym.mec.biz.service.impl;
 
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.stream.Collectors;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-
 import com.ym.mec.biz.dal.dao.CourseScheduleStudentPaymentDao;
 import com.ym.mec.biz.dal.dao.StudentDao;
 import com.ym.mec.biz.dal.dto.StudentCourseTimesDto;
+import com.ym.mec.biz.dal.dto.StudentTeacherCourseDto;
+import com.ym.mec.biz.dal.entity.CourseSchedule;
 import com.ym.mec.biz.dal.entity.Student;
 import com.ym.mec.biz.dal.page.StudentQueryInfo;
 import com.ym.mec.biz.service.StudentService;
@@ -23,6 +12,15 @@ import com.ym.mec.common.dal.BaseDAO;
 import com.ym.mec.common.page.PageInfo;
 import com.ym.mec.common.service.impl.BaseServiceImpl;
 import com.ym.mec.util.collection.MapUtil;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.CollectionUtils;
+
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.*;
+import java.util.stream.Collectors;
 
 @Service
 public class StudentServiceImpl extends BaseServiceImpl<Integer, Student> implements StudentService {
@@ -98,4 +96,55 @@ public class StudentServiceImpl extends BaseServiceImpl<Integer, Student> implem
 		
 		return true;
 	}
+
+	@Override
+	public void initTeacherId() {
+		List<StudentTeacherCourseDto> allStudentCourseInfo = courseScheduleStudentPaymentDao.findAllStudentCourseInfo();
+		Map<Integer, List<StudentTeacherCourseDto>> studentCoursesMap = allStudentCourseInfo.stream().collect(Collectors.groupingBy(StudentTeacherCourseDto::getStudentId));
+		List<Student> students=new ArrayList<>();
+		for (Map.Entry<Integer, List<StudentTeacherCourseDto>> studentCoursesEntry : studentCoursesMap.entrySet()) {
+			Map<CourseSchedule.CourseScheduleType, List<StudentTeacherCourseDto>> courseTypeCourseMap = studentCoursesEntry.getValue().stream().collect(Collectors.groupingBy(StudentTeacherCourseDto::getCourseScheduleType));
+			List<StudentTeacherCourseDto> practiceCourses = courseTypeCourseMap.get(CourseSchedule.CourseScheduleType.PRACTICE);
+			if (!CollectionUtils.isEmpty(practiceCourses)) {
+				practiceCourses.sort(Comparator.comparing(StudentTeacherCourseDto::getClassesStartTime).reversed());
+				Student student=new Student(studentCoursesEntry.getKey());
+				student.setTeacherId(practiceCourses.get(0).getTeacherId());
+				students.add(student);
+				continue;
+			}
+
+			List<StudentTeacherCourseDto> vipCourses = courseTypeCourseMap.get(CourseSchedule.CourseScheduleType.VIP);
+			if (!CollectionUtils.isEmpty(vipCourses)) {
+				Student student=new Student(studentCoursesEntry.getKey());
+				vipCourses.sort(Comparator.comparing(StudentTeacherCourseDto::getClassesStartTime).reversed());
+				student.setTeacherId(vipCourses.get(0).getTeacherId());
+				students.add(student);
+				continue;
+			}
+
+			List<StudentTeacherCourseDto> singleCourses = courseTypeCourseMap.get(CourseSchedule.CourseScheduleType.SINGLE);
+			if (!CollectionUtils.isEmpty(singleCourses)) {
+				Student student=new Student(studentCoursesEntry.getKey());
+				singleCourses.sort(Comparator.comparing(StudentTeacherCourseDto::getClassesStartTime).reversed());
+				student.setTeacherId(singleCourses.get(0).getTeacherId());
+				students.add(student);
+				continue;
+			}
+
+			List<StudentTeacherCourseDto> mixCourses = courseTypeCourseMap.get(CourseSchedule.CourseScheduleType.MIX);
+			if (!CollectionUtils.isEmpty(mixCourses)) {
+				Student student=new Student(studentCoursesEntry.getKey());
+				mixCourses.sort(Comparator.comparing(StudentTeacherCourseDto::getClassesStartTime).reversed());
+				student.setTeacherId(mixCourses.get(0).getTeacherId());
+				students.add(student);
+				continue;
+			}
+		}
+		if(!CollectionUtils.isEmpty(students)){
+			studentDao.batchUpdate(students);
+		}
+		students=null;
+		studentCoursesMap=null;
+		allStudentCourseInfo=null;
+	}
 }

+ 25 - 0
mec-biz/src/main/resources/config/mybatis/CourseScheduleStudentPaymentMapper.xml

@@ -391,4 +391,29 @@
 		WHERE cs.`teach_mode_` = 'ONLINE' AND cs.`class_date_` &gt;= #{startDate}
 		GROUP BY cssp.`user_id_`
 	</select>
+
+	<resultMap id="StudentTeacherCourseDto" type="com.ym.mec.biz.dal.dto.StudentTeacherCourseDto">
+		<result property="studentId" column="student_id_"/>
+		<result property="teacherId" column="teacher_id_"/>
+		<result property="groupType" column="group_type_" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
+		<result property="groupId" column="group_id_"/>
+		<result property="courseScheduleType" column="course_schedule_type_" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
+		<result property="classesStartTime" column="classes_start_time_"/>
+	</resultMap>
+
+	<select id="findAllStudentCourseInfo" resultMap="StudentTeacherCourseDto">
+		SELECT
+			cssp.user_id_ student_id_,
+			cssp.group_type_ group_type_,
+			cssp.music_group_id_ group_id_,
+			cs.type_ course_schedule_type_,
+			CONCAT(cs.class_date_, ' ', cs.start_class_time_) classes_start_time_,
+			cgtm.user_id_ teacher_id_
+		FROM
+			student s
+			LEFT JOIN course_schedule_student_payment cssp ON s.user_id_=cssp.user_id_
+			LEFT JOIN course_schedule cs ON cssp.course_schedule_id_ = cs.id_
+			LEFT JOIN class_group_teacher_mapper cgtm ON cssp.class_group_id_=cgtm.class_group_id_
+		WHERE cs.type_ IN ('PRACTICE', 'VIP', 'SINGLE', 'MIX') AND cgtm.teacher_role_='BISHOP';
+	</select>
 </mapper>

+ 9 - 2
mec-biz/src/main/resources/config/mybatis/StudentMapper.xml

@@ -11,6 +11,7 @@
 		<result column="subject_id_list_" property="subjectIdList" />
 		<result column="service_tag_" property="serviceTag" />
 		<result column="operating_tag_" property="operatingTag" />
+		<result column="teacher_id_" property="teacherId" />
 		<result column="create_time_" property="createTime" />
 		<result column="update_time_" property="updateTime" />
 	</resultMap>
@@ -38,7 +39,7 @@
 		<if test="operatingTag != null">
 			operating_tag_,
 		</if>
-		create_time_,update_time_)
+		teacher_id_,create_time_,update_time_)
 		VALUES
 		(#{userId},#{subjectIdList},
 		<if test="serviceTag != null">
@@ -47,7 +48,7 @@
 		<if test="operatingTag != null">
 			#{operatingTag},
 		</if>
-		NOW(),NOW())
+		#{teacherId},NOW(),NOW())
 	</insert>
 	
 	<update id="update" parameterType="com.ym.mec.biz.dal.entity.Student">
@@ -62,6 +63,9 @@
 			<if test="operatingTag != null">
 				operating_tag_ = #{operatingTag},
 			</if>
+			<if test="teacherId != null">
+				teacher_id_=#{teacherId},
+			</if>
 			<if test="updateTime != null">
 				update_time_ = #{updateTime},
 			</if>
@@ -123,6 +127,9 @@
 				<if test="item.operatingTag != null">
 					operating_tag_ = #{item.operatingTag},
 				</if>
+				<if test="item.teacherId != null">
+					teacher_id_=#{item.teacherId},
+				</if>
 				<if test="item.updateTime != null">
 					update_time_ = #{item.updateTime},
 				</if>

+ 3 - 0
mec-biz/src/main/resources/config/mybatis/TeacherSalaryComplaintsMapper.xml

@@ -124,6 +124,9 @@
 	<select id="findTeacherSalaryComplaintsWithMonth" resultMap="TeacherSalaryComplaints">
 		SELECT * FROM teacher_salary_complaints tsc
 		WHERE tsc.teacher_id_ = #{teacherId} AND tsc.salary_settlement_month_ = #{month}
+		<if test="status!=null">
+			AND tsc.status_ = #{status,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
+		</if>
 	</select>
 
 </mapper>

+ 15 - 5
mec-web/src/main/java/com/ym/mec/web/controller/StudentManageController.java

@@ -6,11 +6,9 @@ import com.ym.mec.biz.dal.dao.EmployeeDao;
 import com.ym.mec.biz.dal.dto.UpdateStudentFeeDto;
 import com.ym.mec.biz.dal.entity.Employee;
 import com.ym.mec.biz.dal.page.*;
-import com.ym.mec.biz.service.MusicGroupStudentFeeService;
-import com.ym.mec.biz.service.StudentCourseHomeworkService;
-import com.ym.mec.biz.service.StudentManageService;
-import com.ym.mec.biz.service.StudentRegistrationService;
+import com.ym.mec.biz.service.*;
 import com.ym.mec.common.controller.BaseController;
+import com.ym.mec.common.entity.HttpResponseResult;
 import com.ym.mec.common.exception.BizException;
 import com.ym.mec.common.page.QueryInfo;
 import io.swagger.annotations.*;
@@ -25,7 +23,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
 import java.util.Arrays;
-import java.util.Date;
 import java.util.List;
 
 @Api(tags = "学生管理")
@@ -45,6 +42,8 @@ public class StudentManageController extends BaseController {
     private StudentCourseHomeworkService studentCourseHomeworkService;
     @Autowired
     private EmployeeDao employeeDao;
+    @Autowired
+    private StudentService studentService;
 
     private final Logger LOGGER = LoggerFactory.getLogger(this.getClass());
     @ApiOperation(value = "获取学生列表")
@@ -286,4 +285,15 @@ public class StudentManageController extends BaseController {
         }
         return succeed(studentManageService.getOperatingStudents(queryInfo));
     }
+
+    @ApiOperation(value = "初始化教师编号")
+    @GetMapping("/initTeacherId")
+    public HttpResponseResult initTeacherId(){
+        SysUser sysUser = sysUserFeignService.queryUserInfo();
+        if (sysUser == null) {
+            return failed("用户信息获取失败");
+        }
+        studentService.initTeacherId();
+        return succeed();
+    }
 }