فهرست منبع

Merge remote-tracking branch 'origin/master'

Joburgess 5 سال پیش
والد
کامیت
e421a4b074

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

@@ -44,7 +44,7 @@ public interface StudentDao extends com.ym.mec.common.dal.BaseDAO<Integer, Stude
      * @param teacherIds
      * @return
      */
-    List<Student4operating> getTeacherOperatingStudentsNum(@Param("teacherIds") String teacherIds);
+    List<Map<Integer,Integer>> getTeacherOperatingStudentsNum(@Param("teacherIds") String teacherIds);
 
     /**
      * 根据类型批量获取老师转化
@@ -52,12 +52,12 @@ public interface StudentDao extends com.ym.mec.common.dal.BaseDAO<Integer, Stude
      * @param groupType
      * @return
      */
-    List<Student4operating> getBuyNums(@Param("teacherIds") String teacherIds, @Param("groupType") GroupType groupType);
+    List<Map<Integer,Integer>> getBuyNums(@Param("teacherIds") String teacherIds, @Param("groupType") GroupType groupType);
 
      /**
      * 根据同事存在vip和网管的转化
      * @param teacherIds
      * @return
      */
-    List<Student4operating> getPracticeAndVipNums(@Param("teacherIds") String teacherIds);
+    List<Map<Integer,Integer>> getPracticeAndVipNums(@Param("teacherIds") String teacherIds);
 }

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

@@ -468,6 +468,7 @@ public class StudentAttendanceServiceImpl extends BaseServiceImpl<Long, StudentA
 			studentAttendance.setTeacherId(courseSchedule.getActualTeacherId());
 			studentAttendance.setUpdateTime(date);
 		}
+		Date signInTime = studentAttendance.getSignInTime();
 		//没有签到信息才会生成
 		if(signStatusEnum == SignStatusEnum.SIGN_IN && studentAttendance.getSignInTime() == null){
 			//判断是否在签到时间段内(课程开始前20~结束前)
@@ -524,19 +525,20 @@ public class StudentAttendanceServiceImpl extends BaseServiceImpl<Long, StudentA
 					totalMinutes -= firstMinutes;
 					if(totalMinutes > 0){
 						String courseClassDate;
-						String courseStartDateTime;
+//						String courseStartDateTime;
 						String courseEndDateTime;
-						for (CourseSchedule e:courseSchedules) {
-							//获取当前课程的单节课时长
-//							int signClassMinutes = courseScheduleDao.getSingleClassMinutes(e.getId());
-//							totalMinutes -= signClassMinutes;
-							//补充签到签退时间
-							courseClassDate = DateUtil.format(e.getClassDate(), DateUtil.DEFAULT_PATTERN);
-							courseStartDateTime = DateUtil.format(e.getStartClassTime(), DateUtil.EXPANDED_TIME_FORMAT);
-							courseEndDateTime = DateUtil.format(e.getEndClassTime(), DateUtil.EXPANDED_TIME_FORMAT);
-							Date startDateTime = DateUtil.stringToDate(courseClassDate + " " + courseStartDateTime, DateUtil.EXPANDED_DATE_TIME_FORMAT);
+						for (int i = 0; i < courseSchedules.size(); i++) {
+							courseClassDate = DateUtil.format(courseSchedules.get(i).getClassDate(), DateUtil.DEFAULT_PATTERN);
+//							courseStartDateTime = DateUtil.format(courseSchedules.get(i).getStartClassTime(), DateUtil.EXPANDED_TIME_FORMAT);
+							courseEndDateTime = DateUtil.format(courseSchedules.get(i).getEndClassTime(), DateUtil.EXPANDED_TIME_FORMAT);
+//							Date startDateTime = DateUtil.stringToDate(courseClassDate + " " + courseStartDateTime, DateUtil.EXPANDED_DATE_TIME_FORMAT);
 							Date endDateTime = DateUtil.stringToDate(courseClassDate + " " + courseEndDateTime, DateUtil.EXPANDED_DATE_TIME_FORMAT);
-							StudentAttendance byStatusAndCourseScheduleId = studentAttendanceDao.findByStatusAndCourseScheduleId(userId, e.getId().intValue());
+							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){
 								byStatusAndCourseScheduleId.setSignOutTime(date);
 								byStatusAndCourseScheduleId.setStatus(statusEnum);
@@ -544,20 +546,20 @@ public class StudentAttendanceServiceImpl extends BaseServiceImpl<Long, StudentA
 								studentAttendanceDao.update(byStatusAndCourseScheduleId);
 							}else {
 								byStatusAndCourseScheduleId = new StudentAttendance();
-								byStatusAndCourseScheduleId.setSignOutTime(endDateTime);
+								byStatusAndCourseScheduleId.setSignOutTime(date);
 								byStatusAndCourseScheduleId.setStatus(statusEnum);
-								byStatusAndCourseScheduleId.setSignInTime(startDateTime);
+								byStatusAndCourseScheduleId.setSignInTime(signInTime);
 								byStatusAndCourseScheduleId.setUpdateTime(date);
 								byStatusAndCourseScheduleId.setUserId(userId);
 								byStatusAndCourseScheduleId.setTeacherId(courseSchedule.getActualTeacherId());
-								byStatusAndCourseScheduleId.setClassGroupId(e.getClassGroupId());
-								byStatusAndCourseScheduleId.setCourseScheduleId(e.getId());
-								byStatusAndCourseScheduleId.setMusicGroupId(e.getMusicGroupId());
-								byStatusAndCourseScheduleId.setGroupType(e.getGroupType());
+								byStatusAndCourseScheduleId.setClassGroupId(courseSchedules.get(i).getClassGroupId());
+								byStatusAndCourseScheduleId.setCourseScheduleId(courseSchedules.get(i).getId());
+								byStatusAndCourseScheduleId.setMusicGroupId(courseSchedules.get(i).getMusicGroupId());
+								byStatusAndCourseScheduleId.setGroupType(courseSchedules.get(i).getGroupType());
 								byStatusAndCourseScheduleId.setCurrentClassTimes(classGroup.getCurrentClassTimes() + 1);
 								studentAttendanceDao.insert(byStatusAndCourseScheduleId);
 							}
-							if(!date.before(endDateTime)){
+							if(!date.after(endDateTime)){
 								break;
 							}
 						}

+ 16 - 12
mec-biz/src/main/java/com/ym/mec/biz/service/impl/TeacherAttendanceServiceImpl.java

@@ -310,6 +310,7 @@ public class TeacherAttendanceServiceImpl extends BaseServiceImpl<Long, TeacherA
 		if(SignStatusEnum.SIGN_OUT.equals(signStatus)){
 			if(DateUtil.minutesBetween(classEndDateTime,date) >= 0){
 				teacherAttendance.setSignOutStatus(YesOrNoEnum.YES);
+				Date signInTime = teacherAttendance.getSignInTime();
 				List<CourseSchedule> courseSchedules = new ArrayList<>();
 				CourseSchedule cs = courseSchedule;
 				while (true){
@@ -333,24 +334,27 @@ public class TeacherAttendanceServiceImpl extends BaseServiceImpl<Long, TeacherA
 					totalMinutes -= firstMinutes;
 					if(totalMinutes > 0){
 						String courseClassDate;
-						String courseStartDateTime;
+//						String courseStartDateTime;
 						String courseEndDateTime;
-						for (CourseSchedule e:courseSchedules) {
-							//获取当前课程的单节课时长
-//							int signClassMinutes = courseScheduleDao.getSingleClassMinutes(e.getId());
-							courseClassDate = DateUtil.format(e.getClassDate(), DateUtil.DEFAULT_PATTERN);
-							courseStartDateTime = DateUtil.format(e.getStartClassTime(), DateUtil.EXPANDED_TIME_FORMAT);
-							courseEndDateTime = DateUtil.format(e.getEndClassTime(), DateUtil.EXPANDED_TIME_FORMAT);
-							Date startDateTime = DateUtil.stringToDate(courseClassDate + " " + courseStartDateTime, DateUtil.EXPANDED_DATE_TIME_FORMAT);
+						for (int i = 0; i < courseSchedules.size(); i++) {
+							courseClassDate = DateUtil.format(courseSchedules.get(i).getClassDate(), DateUtil.DEFAULT_PATTERN);
+//							courseStartDateTime = DateUtil.format(courseSchedules.get(i).getStartClassTime(), DateUtil.EXPANDED_TIME_FORMAT);
+							courseEndDateTime = DateUtil.format(courseSchedules.get(i).getEndClassTime(), DateUtil.EXPANDED_TIME_FORMAT);
+//							Date startDateTime = DateUtil.stringToDate(courseClassDate + " " + courseStartDateTime, DateUtil.EXPANDED_DATE_TIME_FORMAT);
 							Date endDateTime = DateUtil.stringToDate(courseClassDate + " " + courseEndDateTime, DateUtil.EXPANDED_DATE_TIME_FORMAT);
+//							Date signOutTime = date;
+//							if(i < courseSchedules.size() - 1 && date.after(endDateTime)){
+								//不是最后一节连堂课,并且签退时间大于课程结束时间,签退时间等于课程结束时间
+//								signOutTime = endDateTime;
+//							}
 							//如果签退时间大于课程结束时间
-							if(date.before(endDateTime)){
-								teacherAttendanceDao.cuntinueCourseSign(e.getId(),startDateTime,endDateTime,1);
+							if(date.after(endDateTime)){
+								teacherAttendanceDao.cuntinueCourseSign(courseSchedules.get(i).getId(),signInTime,date,1);
 							}else if (date.equals(endDateTime)){
-								teacherAttendanceDao.cuntinueCourseSign(e.getId(),startDateTime,endDateTime,1);
+								teacherAttendanceDao.cuntinueCourseSign(courseSchedules.get(i).getId(),signInTime,date,1);
 								break;
 							}else {
-								teacherAttendanceDao.cuntinueCourseSign(e.getId(),startDateTime,endDateTime,0);
+								teacherAttendanceDao.cuntinueCourseSign(courseSchedules.get(i).getId(),signInTime,date,0);
 								break;
 							}
 						}

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

@@ -1,5 +1,7 @@
 package com.ym.mec.biz.service.impl;
 
+import com.ym.mec.auth.api.client.SysUserFeignService;
+import com.ym.mec.auth.api.entity.SysUser;
 import com.ym.mec.biz.dal.dao.CourseScheduleTeacherSalaryDao;
 import com.ym.mec.biz.dal.dao.TeacherSalaryModifyLogDao;
 import com.ym.mec.biz.dal.entity.CourseScheduleTeacherSalary;
@@ -7,11 +9,14 @@ import com.ym.mec.biz.dal.entity.TeacherSalaryModifyLog;
 import com.ym.mec.biz.service.CourseScheduleTeacherSalaryService;
 import com.ym.mec.biz.service.TeacherSalaryModifyLogService;
 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 org.springframework.transaction.annotation.Transactional;
 
+import java.math.BigDecimal;
+
 @Service
 public class TeacherSalaryModifyLogServiceImpl extends BaseServiceImpl<Long, TeacherSalaryModifyLog>  implements TeacherSalaryModifyLogService {
 	
@@ -19,6 +24,8 @@ public class TeacherSalaryModifyLogServiceImpl extends BaseServiceImpl<Long, Tea
 	private TeacherSalaryModifyLogDao teacherSalaryModifyLogDao;
 	@Autowired
 	private CourseScheduleTeacherSalaryDao courseScheduleTeacherSalaryDao;
+	@Autowired
+	private SysUserFeignService sysUserFeignService;
 
 	@Override
 	public BaseDAO<Long, TeacherSalaryModifyLog> getDAO() {
@@ -28,12 +35,17 @@ public class TeacherSalaryModifyLogServiceImpl extends BaseServiceImpl<Long, Tea
 	@Override
 	@Transactional(rollbackFor = Exception.class)
 	public Object add(TeacherSalaryModifyLog modifyLog) {
+		SysUser sysUser = sysUserFeignService.queryUserInfo();
+		if (sysUser == null) {
+			throw new BizException("用户信息获取失败");
+		}
 		//获取之前的课酬信息
 		CourseScheduleTeacherSalary salary = courseScheduleTeacherSalaryDao.queryByCourseScheduleIdAndUserId(modifyLog.getCourseScheduleId(), modifyLog.getTeacherId());
 		courseScheduleTeacherSalaryDao.updateSalary(modifyLog);
 		//修改教师课酬
 		modifyLog.setPreExpectSalary(salary.getActualSalary());
-		modifyLog.setPreReduceSalary(salary.getReduceSalary());
+		modifyLog.setPreReduceSalary(salary.getReduceSalary()==null? BigDecimal.ZERO:salary.getReduceSalary());
+		modifyLog.setOperatorId(sysUser.getId());
 		return teacherSalaryModifyLogDao.insert(modifyLog);
 	}
 }

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

@@ -7,6 +7,7 @@ import com.ym.mec.auth.api.enums.YesOrNoEnum;
 import com.ym.mec.biz.dal.dao.*;
 import com.ym.mec.biz.dal.dto.*;
 import com.ym.mec.biz.dal.entity.*;
+import com.ym.mec.biz.dal.enums.GroupType;
 import com.ym.mec.biz.dal.page.*;
 import com.ym.mec.biz.service.ClassGroupService;
 import com.ym.mec.biz.service.TeacherService;
@@ -65,6 +66,8 @@ public class TeacherServiceImpl extends BaseServiceImpl<Integer, Teacher>  imple
 	private SysConfigDao configDao;
 	@Autowired
 	private StudentExtracurricularExercisesSituationDao studentExtracurricularExercisesSituationDao;
+	@Autowired
+	private StudentDao studentDao;
 
 
 	@Override
@@ -451,6 +454,11 @@ public class TeacherServiceImpl extends BaseServiceImpl<Integer, Teacher>  imple
 			List<TeacherExercisesServiceDto> teacherExercisesServiceSituations = studentExtracurricularExercisesSituationDao.findTeacherExercisesServiceSituations(monDayDate.toString(), new ArrayList<>(teachers));
 			Map<Integer, TeacherExercisesServiceDto> teacherServiceMap = teacherExercisesServiceSituations.stream().collect(Collectors.toMap(TeacherExercisesServiceDto::getTeacherId, t -> t));
 
+			Map<Integer,String> operatingStudentsNum = MapUtil.convertMybatisMap(studentDao.getTeacherOperatingStudentsNum(teacherIds));
+			Map<Integer,String> practiceStudentsNum = MapUtil.convertMybatisMap(studentDao.getBuyNums(teacherIds, GroupType.PRACTICE));
+			Map<Integer,String> vipStudentsNum = MapUtil.convertMybatisMap(studentDao.getBuyNums(teacherIds, GroupType.VIP));
+			Map<Integer,String> practiceAndVipStudentsNum = MapUtil.convertMybatisMap(studentDao.getPracticeAndVipNums(teacherIds));
+
 			rows.forEach(e->{
 //				e.setSubjectName(subjectDao.findBySubIds(e.getSubjectId()));
 				e.setOrganName(organNames.get(e.getTeacherOrganId()));
@@ -469,6 +477,19 @@ public class TeacherServiceImpl extends BaseServiceImpl<Integer, Teacher>  imple
 				}else{
 					e.setServiceIndex(BigDecimal.ZERO);
 				}
+				//运营指标
+				String studentNum = operatingStudentsNum.get(e.getId());
+				if(studentNum != null){
+					String practiceNum = practiceStudentsNum.get(e.getId()) ==null ? "0" : practiceStudentsNum.get(e.getId());
+					String vipNum = vipStudentsNum.get(e.getId()) ==null ? "0" : vipStudentsNum.get(e.getId());
+					String practiceAndVipNum = practiceAndVipStudentsNum.get(e.getId()) ==null ? "0" : practiceAndVipStudentsNum.get(e.getId());
+					int allNum = Integer.parseInt(practiceNum) + Integer.parseInt(vipNum) + Integer.parseInt(practiceAndVipNum);
+					BigDecimal operatingIndex = new BigDecimal(allNum).multiply(new BigDecimal(100)).divide(new BigDecimal(studentNum), CommonConstants.DECIMAL_FINAL_PLACE, BigDecimal.ROUND_HALF_UP);
+					e.setOperatingIndex(operatingIndex);
+				}else {
+					e.setOperatingIndex(BigDecimal.ZERO);
+				}
+
 			});
 		}
 		return pageInfo;
@@ -516,7 +537,7 @@ public class TeacherServiceImpl extends BaseServiceImpl<Integer, Teacher>  imple
 				&& StringUtils.isNotBlank(teacher.getIdcardHandImg())) {
 			throw new BizException("已实名认证,不能重复操作");
 		}
-		
+
 		IdcardValidator validator = new IdcardValidator();
 		if (validator.isValidatedAllIdcard(idcardNo) == false) {
 			throw new BizException("身份证校验失败");

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

@@ -368,18 +368,16 @@
     </select>
 
     <select id="getVipBuyNums" resultMap="practice4Organ">
-        SELECT vg.organ_id_, COUNT(DISTINCT cssp.user_id_) vip_num_
+        SELECT su.organ_id_,COUNT(DISTINCT cssp.user_id_) vip_num_
         FROM course_schedule_student_payment cssp
-        LEFT JOIN vip_group vg ON cssp.music_group_id_ = vg.id_ AND cssp.group_type_ = 'VIP'
-        LEFT JOIN course_schedule cs ON cs.id_ = cssp.course_schedule_id_ AND cs.teach_mode_ = 'ONLINE'
-        WHERE vg.id_ >= 1
-        AND cs.id_ >=1
-        AND CONCAT(cs.class_date_, ' ', cs.end_class_time_) >= #{classDate}
+        LEFT JOIN course_schedule cs ON cs.id_ = cssp.course_schedule_id_ AND cssp.group_type_='VIP'
+        left JOIN sys_user su ON su.id_=cssp.user_id_
+        WHERE CONCAT(cs.class_date_, ' ', cs.end_class_time_) >= #{classDate}
         <if test="endDate != null">
             <![CDATA[AND CONCAT(cs.class_date_, ' ', cs.end_class_time_) < #{endDate}]]>
         </if>
-        AND (cs.is_lock_ IS NULL OR cs.is_lock_=0)
-        GROUP BY vg.organ_id_
+        AND cs.teach_mode_ = 'ONLINE'
+        GROUP BY su.organ_id_
     </select>
 
     <select id="getPracticeBuyNums" resultMap="practice4Organ">
@@ -424,9 +422,11 @@
 
     <!-- 获取所有体验人数 -->
     <select id="getAllTryNums" resultMap="practice4Organ">
-        SELECT su.organ_id_, COUNT(s.user_id_) try_num_ FROM student s
-        LEFT JOIN sys_user su ON  su.id_ = s.user_id_
-            WHERE s.operating_tag_ =1 AND su.organ_id_ >0
+        SELECT su.organ_id_, COUNT(s.user_id_) try_num_
+        FROM student s
+                 LEFT JOIN sys_user su ON su.id_ = s.user_id_
+        WHERE s.operating_tag_ = 1
+          AND su.organ_id_ > 0
         GROUP BY su.organ_id_
     </select>
 </mapper>

+ 2 - 1
mec-biz/src/main/resources/config/mybatis/CourseScheduleTeacherSalaryMapper.xml

@@ -445,7 +445,8 @@
 	</update>
 
     <update id="updateSalary" parameterType="com.ym.mec.biz.dal.entity.TeacherSalaryModifyLog">
-		UPDATE course_schedule_teacher_salary SET actual_salary_ = #{modifyLog.currentExpectSalary},reduce_salary = #{modifyLog.currentReduceSalary},update_time_ = NOW()
+		UPDATE course_schedule_teacher_salary SET actual_salary_ = #{modifyLog.currentExpectSalary},
+		reduce_salary = #{modifyLog.currentReduceSalary},update_time_ = NOW(),memo_ = #{modifyLog.memo}
 		WHERE course_schedule_id_ = #{modifyLog.courseScheduleId} AND user_id_ = #{modifyLog.teacherId}
 	</update>
 	<update id="updateTeacherSalaryConfirmStatus">

+ 153 - 141
mec-biz/src/main/resources/config/mybatis/StudentMapper.xml

@@ -5,16 +5,16 @@
 不要修改此文件。所有改动将在下次重新自动生成时丢失。
 -->
 <mapper namespace="com.ym.mec.biz.dal.dao.StudentDao">
-	
-	<resultMap type="com.ym.mec.biz.dal.entity.Student" id="Student">
-		<result column="user_id_" property="userId" />
-		<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>
+
+    <resultMap type="com.ym.mec.biz.dal.entity.Student" id="Student">
+        <result column="user_id_" property="userId"/>
+        <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>
 
     <!-- 根据主键查询一条记录 -->
     <select id="get" resultMap="Student">
@@ -29,120 +29,128 @@
         FROM student
     </select>
 
-	<select id="lockUser" resultType="int" useCache="false" flushCache="true">
-		SELECT id_ FROM sys_user WHERE id_=#{userId} FOR UPDATE
-	</select>
-	
-	<!-- 向数据库增加一条记录 -->
-	<insert id="insert" parameterType="com.ym.mec.biz.dal.entity.Student" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
-		INSERT INTO student (user_id_,subject_id_list_,
-		<if test="serviceTag != null">
-			service_tag_,
-		</if>
-		<if test="operatingTag != null">
-			operating_tag_,
-		</if>
-		teacher_id_,create_time_,update_time_)
-		VALUES
-		(#{userId},#{subjectIdList},
-		<if test="serviceTag != null">
-			#{serviceTag},
-		</if>
-		<if test="operatingTag != null">
-			#{operatingTag},
-		</if>
-		#{teacherId},NOW(),NOW())
-	</insert>
+    <select id="lockUser" resultType="int" useCache="false" flushCache="true">
+        SELECT id_
+        FROM sys_user
+        WHERE id_ = #{userId} FOR
+        UPDATE
+    </select>
 
-	<update id="update" parameterType="com.ym.mec.biz.dal.entity.Student">
-		UPDATE student
-		<set>
-			<if test="subjectIdList != null">
-				subject_id_list_ = #{subjectIdList},
-			</if>
-			<if test="serviceTag != null">
-				service_tag_ = #{serviceTag},
-			</if>
-			<if test="operatingTag != null">
-				operating_tag_ = #{operatingTag},
-			</if>
-			<if test="teacherId != null">
-				teacher_id_=#{teacherId},
-			</if>
-			<if test="updateTime != null">
-				update_time_ = #{updateTime},
-			</if>
-			<if test="updateTime == null">
-				update_time_ = NOW()
-			</if>
-		</set>
-		WHERE user_id_ = #{userId}
-	</update>
+    <!-- 向数据库增加一条记录 -->
+    <insert id="insert" parameterType="com.ym.mec.biz.dal.entity.Student" useGeneratedKeys="true" keyColumn="id"
+            keyProperty="id">
+        INSERT INTO student (user_id_,subject_id_list_,
+        <if test="serviceTag != null">
+            service_tag_,
+        </if>
+        <if test="operatingTag != null">
+            operating_tag_,
+        </if>
+        teacher_id_,create_time_,update_time_)
+        VALUES
+        (#{userId},#{subjectIdList},
+        <if test="serviceTag != null">
+            #{serviceTag},
+        </if>
+        <if test="operatingTag != null">
+            #{operatingTag},
+        </if>
+        #{teacherId},NOW(),NOW())
+    </insert>
 
-	<!-- 分页查询 -->
-	<select id="queryPage" resultMap="Student" parameterType="map">
-		SELECT * FROM student <include refid="global.limit"/>
-	</select>
+    <update id="update" parameterType="com.ym.mec.biz.dal.entity.Student">
+        UPDATE student
+        <set>
+            <if test="subjectIdList != null">
+                subject_id_list_ = #{subjectIdList},
+            </if>
+            <if test="serviceTag != null">
+                service_tag_ = #{serviceTag},
+            </if>
+            <if test="operatingTag != null">
+                operating_tag_ = #{operatingTag},
+            </if>
+            <if test="teacherId != null">
+                teacher_id_=#{teacherId},
+            </if>
+            <if test="updateTime != null">
+                update_time_ = #{updateTime},
+            </if>
+            <if test="updateTime == null">
+                update_time_ = NOW()
+            </if>
+        </set>
+        WHERE user_id_ = #{userId}
+    </update>
 
-	<!-- 查询当前表的总记录数 -->
-	<select id="queryCount" resultType="int">
-		SELECT COUNT(*) FROM student
-	</select>
-	<select id="findStudents" resultMap="com.ym.mec.biz.dal.dao.TeacherDao.SysUser">
-		SELECT id_, username_, phone_,avatar_ FROM sys_user
-		<include refid="studentQueryCondition"/>
-		ORDER BY id_
-		<include refid="global.limit"/>
-	</select>
-	<select id="countStudents" resultType="int">
-		SELECT COUNT(id_) FROM sys_user
-		<include refid="studentQueryCondition"/>
-	</select>
-	<sql id="studentQueryCondition">
-		<where>
-			<if test="organIdList!=null">
-				organ_id_ IN
-				<foreach collection="organIdList" item="organId" open="(" close=")" separator=",">
-					#{organId}
-				</foreach>
-			</if>
-			<if test="search!=null">
-				AND (username_ LIKE CONCAT('%', #{search}, '%') OR phone_ LIKE CONCAT('%', #{search}, '%'))
-			</if>
-			AND FIND_IN_SET("STUDENT", user_type_)
-		</where>
-	</sql>
+    <!-- 分页查询 -->
+    <select id="queryPage" resultMap="Student" parameterType="map">
+        SELECT * FROM student
+        <include refid="global.limit"/>
+    </select>
 
-	<select id="queryByOperatingTag" resultMap="Student">
-		SELECT * FROM student WHERE operating_tag_ = #{operatingTag}
-	</select>
+    <!-- 查询当前表的总记录数 -->
+    <select id="queryCount" resultType="int">
+        SELECT COUNT(*)
+        FROM student
+    </select>
+    <select id="findStudents" resultMap="com.ym.mec.biz.dal.dao.TeacherDao.SysUser">
+        SELECT id_, username_, phone_,avatar_ FROM sys_user
+        <include refid="studentQueryCondition"/>
+        ORDER BY id_
+        <include refid="global.limit"/>
+    </select>
+    <select id="countStudents" resultType="int">
+        SELECT COUNT(id_) FROM sys_user
+        <include refid="studentQueryCondition"/>
+    </select>
+    <sql id="studentQueryCondition">
+        <where>
+            <if test="organIdList!=null">
+                organ_id_ IN
+                <foreach collection="organIdList" item="organId" open="(" close=")" separator=",">
+                    #{organId}
+                </foreach>
+            </if>
+            <if test="search!=null">
+                AND (username_ LIKE CONCAT('%', #{search}, '%') OR phone_ LIKE CONCAT('%', #{search}, '%'))
+            </if>
+            AND FIND_IN_SET("STUDENT", user_type_)
+        </where>
+    </sql>
+
+    <select id="queryByOperatingTag" resultMap="Student">
+        SELECT *
+        FROM student
+        WHERE operating_tag_ = #{operatingTag}
+    </select>
 
-	<update id="batchUpdate" parameterType="java.util.List">
-    	<foreach collection="studentList" item="item" index="index" open="" close="" separator=";">
-			UPDATE student
-			<set>
-				<if test="item.subjectIdList != null">
-					subject_id_list_ = #{item.subjectIdList},
-				</if>
-				<if test="item.serviceTag != null">
-					service_tag_ = #{item.serviceTag},
-				</if>
-				<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>
-				<if test="item.updateTime == null">
-					update_time_ = NOW()
-				</if>
-			</set>
-			WHERE user_id_ = #{item.userId}
+    <update id="batchUpdate" parameterType="java.util.List">
+        <foreach collection="studentList" item="item" index="index" open="" close="" separator=";">
+            UPDATE student
+            <set>
+                <if test="item.subjectIdList != null">
+                    subject_id_list_ = #{item.subjectIdList},
+                </if>
+                <if test="item.serviceTag != null">
+                    service_tag_ = #{item.serviceTag},
+                </if>
+                <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>
+                <if test="item.updateTime == null">
+                    update_time_ = NOW()
+                </if>
+            </set>
+            WHERE user_id_ = #{item.userId}
         </foreach>
-	</update>
+    </update>
 
     <resultMap id="student4operating" type="com.ym.mec.biz.dal.dto.Student4operating">
         <result column="organ_name_" property="organName"/>
@@ -174,15 +182,14 @@
         LEFT JOIN sys_user tsu ON tsu.id_ = s.teacher_id_
         LEFT JOIN organization o ON o.id_ = su.organ_id_
         LEFT JOIN (
-        SELECT s.user_id_,
+        SELECT cssp.user_id_,
         SUM(case when (cs.group_type_ = 'VIP' AND cs.teach_mode_='ONLINE') then 1 ELSE 0 END) vip_times_,
         SUM(case when (pg.buy_months_ > 0) then 1 ELSE 0 END) buy_practice_times_
-        FROM student s
-        LEFT JOIN course_schedule_student_payment cssp ON cssp.user_id_ = s.user_id_
+        FROM course_schedule_student_payment cssp
         LEFT JOIN course_schedule cs ON cs.id_ = cssp.course_schedule_id_
         LEFT JOIN practice_group pg ON pg.`id_` = cs.`music_group_id_` AND cs.`group_type_` = 'PRACTICE'
         WHERE cs.status_ IN ('NOT_START','UNDERWAY') AND (cs.is_lock_ IS NULL OR cs.is_lock_=0)
-        GROUP BY s.user_id_
+        GROUP BY cssp.user_id_
         ) a on a.user_id_ = s.user_id_
         LEFT JOIN (
         SELECT student_id_, count(id_) free_practice_times_
@@ -200,15 +207,14 @@
         LEFT JOIN sys_user su ON s.user_id_ = su.id_
         LEFT JOIN sys_user tsu ON tsu.id_ = s.teacher_id_
         LEFT JOIN (
-        SELECT s.user_id_,
+        SELECT cssp.user_id_,
         SUM(case when (cs.group_type_ = 'VIP' AND cs.teach_mode_='ONLINE') then 1 ELSE 0 END) vip_times_,
         SUM(case when (pg.buy_months_ > 0) then 1 ELSE 0 END) buy_practice_times_
-        FROM student s
-        LEFT JOIN course_schedule_student_payment cssp ON cssp.user_id_ = s.user_id_
+        FROM course_schedule_student_payment cssp
         LEFT JOIN course_schedule cs ON cs.id_ = cssp.course_schedule_id_
         LEFT JOIN practice_group pg ON pg.`id_` = cs.`music_group_id_` AND cs.`group_type_` = 'PRACTICE'
         WHERE cs.status_ IN ('NOT_START','UNDERWAY') AND (cs.is_lock_ IS NULL OR cs.is_lock_=0)
-        GROUP BY s.user_id_
+        GROUP BY cssp.user_id_
         ) a on a.user_id_ = s.user_id_
         LEFT JOIN (
         SELECT student_id_, count(id_) free_practice_times_
@@ -221,7 +227,7 @@
 
     <sql id="student4OperatingQueryCondition">
         <where>
-            su.user_type_ LIKE '%STUDENT%' AND su.del_flag_ = 0
+            su.user_type_ LIKE '%STUDENT%'
             <if test="search != null and search != ''">
                 AND (su.phone_ LIKE CONCAT('%',#{search},'%') OR su.username_ LIKE CONCAT('%',#{search},'%') OR su.id_
                 LIKE CONCAT('%',#{search},'%'))
@@ -256,28 +262,36 @@
         </where>
     </sql>
 
-    <select id="getTeacherOperatingStudentsNum" resultMap="student4operating">
-        select teacher_id_, count(*) student_num_
+    <select id="getTeacherOperatingStudentsNum" resultType="java.util.Map">
+        select teacher_id_ 'key', count(*) 'value'
         FROM student
         WHERE FIND_IN_SET(teacher_id_, #{teacherIds})
+          AND operating_tag_ = 1
         GROUP BY teacher_id_
     </select>
 
-    <select id="getBuyNums" resultMap="student4operating">
-        SELECT s.teacher_id_, COUNT(DISTINCT cssp.user_id_) student_num_
+    <select id="getBuyNums" resultType="java.util.Map">
+        SELECT s.teacher_id_ 'key', COUNT(DISTINCT cssp.user_id_) 'value'
         FROM course_schedule_student_payment cssp
         LEFT JOIN course_schedule cs ON cs.id_ = cssp.course_schedule_id_ AND cs.teach_mode_ = 'ONLINE'
         LEFT JOIN student s ON s.user_id_ = cssp.user_id_
-        WHERE cs.status_ IN ('NOT_START', 'UNDERWAY')
+        <if test="groupType != null and groupType==@com.ym.mec.biz.dal.enums.GroupType@PRACTICE">
+            LEFT JOIN practice_group pg ON cssp.music_group_id_ = pg.id_ AND cssp.group_type_ = 'PRACTICE'
+        </if>
+        WHERE FIND_IN_SET(s.teacher_id_, #{teacherIds})
+        AND cs.status_ IN ('NOT_START', 'UNDERWAY')
         AND (cs.is_lock_ IS NULL OR cs.is_lock_ = 0)
         <if test="groupType != null">
             AND cs.group_type_ = #{groupType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
         </if>
-        AND FIND_IN_SET(s.teacher_id_, #{teacherIds})
+        <if test="groupType != null and groupType==@com.ym.mec.biz.dal.enums.GroupType@PRACTICE">
+            AND pg.group_status_ IN ('NORMAL', 'FINISH')
+            AND pg.buy_months_ >= 1
+        </if>
         GROUP BY s.teacher_id_
     </select>
-    <select id="getPracticeAndVipNums" resultMap="student4operating">
-        SELECT s.teacher_id_, COUNT(DISTINCT pg.student_id_) student_num_
+    <select id="getPracticeAndVipNums" resultType="java.util.Map">
+        SELECT s.teacher_id_ 'key', COUNT(DISTINCT pg.student_id_) 'value'
         FROM practice_group pg
                  LEFT JOIN student s on s.user_id_ = pg.student_id_
                  LEFT JOIN course_schedule_student_payment vcssp
@@ -286,15 +300,13 @@
                            ON pcssp.user_id_ = pg.student_id_ AND pcssp.group_type_ = 'PRACTICE'
                  LEFT JOIN course_schedule vcs ON vcs.id_ = vcssp.course_schedule_id_ AND vcs.teach_mode_ = 'ONLINE'
                  LEFT JOIN course_schedule pcs ON pcs.id_ = pcssp.course_schedule_id_
-        WHERE pg.group_status_ IN ('NORMAL', 'FINISH')
-          AND vcs.id_ >= 1
-          AND pcs.id_ >= 1
-          AND (vcs.is_lock_ IS NULL OR vcs.is_lock_ = 0)
-          AND (pcs.is_lock_ IS NULL OR pcs.is_lock_ = 0)
+        WHERE FIND_IN_SET(s.teacher_id_, #{teacherIds})
+          AND pg.group_status_ IN ('NORMAL', 'FINISH')
           AND vcs.status_ IN ('NOT_START', 'UNDERWAY')
           AND pcs.status_ IN ('NOT_START', 'UNDERWAY')
+          AND (vcs.is_lock_ IS NULL OR vcs.is_lock_ = 0)
+          AND (pcs.is_lock_ IS NULL OR pcs.is_lock_ = 0)
           AND pg.buy_months_ >= 1
-          AND FIND_IN_SET(s.teacher_id_, #{teacherIds})
         GROUP BY s.teacher_id_
     </select>
 </mapper>

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

@@ -96,8 +96,8 @@
 			<if test="organId != null">
 				t.organ_id_ = #{organId}
 			</if>
-			<if test="salarySettlementMonth != null">
-				AND tsc.salary_settlement_month_ &lt;= #{salarySettlementMonth}
+			<if test="salarySettlementMonth != null and salarySettlementMonth != ''">
+				AND tsc.salary_settlement_month_ = #{salarySettlementMonth}
 			</if>
 			<if test="teacherId != null">
 				AND tsc.teacher_id_ = #{teacherId}

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

@@ -78,6 +78,39 @@ public class ExportController extends BaseController {
     private ExtracurricularExercisesReplyService extracurricularExercisesReplyService;
     @Autowired
     private StudentExtracurricularExercisesSituationService studentExtracurricularExercisesSituationService;
+    @Autowired
+    private TeacherSalaryComplaintsService teacherSalaryComplaintsService;
+
+    @ApiOperation(value = "导出申述处理列表")
+    @PostMapping("export/teacherSalaryComplaints")
+    @PreAuthorize("@pcs.hasPermissions('export/teacherSalaryComplaints')")
+    public void exportTeacherSalaryComplaints(HttpServletResponse response, TeacherSalaryModifyQueryInfo queryInfo) throws IOException {
+        queryInfo.setRows(49999);
+        List<TeacherSalaryComplaints> rows = teacherSalaryComplaintsService.queryPage(queryInfo).getRows();
+        OutputStream outputStream = response.getOutputStream();
+        try {
+            HSSFWorkbook workbook = POIUtil.exportExcel(new String[]{"分部", "老师ID", "老师姓名", "课酬归属时间", "申述提交时间", "状态",
+                    "申述处理者"}, new String[]{
+                    "organName", "teacherId", "realName", "salarySettlementMonth", "createTime", "statusEnum.msg",
+                    "operatorRealName"}, rows);
+            response.setContentType("application/octet-stream");
+            response.setHeader("Content-Disposition", "attachment;filename=lender-" + DateUtil.getDate(new Date()) + ".xls");
+            response.flushBuffer();
+            outputStream = response.getOutputStream();
+            workbook.write(outputStream);
+            outputStream.flush();
+        } catch (Exception e) {
+            e.printStackTrace();
+        } finally {
+            if (outputStream != null) {
+                try {
+                    outputStream.close();
+                } catch (IOException e) {
+                    e.printStackTrace();
+                }
+            }
+        }
+    }
 
     @ApiOperation(value = "网管课购买列表")
     @PostMapping("export/studentBuyPractice")