Pārlūkot izejas kodu

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

zouxuan 5 gadi atpakaļ
vecāks
revīzija
77412c97ae

+ 12 - 6
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/CourseScheduleTeacherSalaryDao.java

@@ -1,17 +1,22 @@
 package com.ym.mec.biz.dal.dao;
 
+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.CourseScheduleTeachersDto;
 import com.ym.mec.biz.dal.dto.ExportTeacherSalaryDto;
 import com.ym.mec.biz.dal.dto.TeacherSalaryDto;
+import com.ym.mec.biz.dal.dto.TeacherVipSalaryDto;
 import com.ym.mec.biz.dal.dto.VipGroupSalaryDto;
 import com.ym.mec.biz.dal.entity.CourseSchedule;
 import com.ym.mec.biz.dal.entity.CourseScheduleTeacherSalary;
 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.*;
 
 public interface CourseScheduleTeacherSalaryDao extends BaseDAO<Long, CourseScheduleTeacherSalary> {
 
@@ -352,10 +357,11 @@ public interface CourseScheduleTeacherSalaryDao extends BaseDAO<Long, CourseSche
 	
 	/**
 	 * 获取所有线上课
-	 * @param groupType
+	 * @param startDate
+	 * @param endDate
 	 * @return
 	 */
-	List<CourseScheduleTeacherSalary> queryOnlineCourseByGroupType(GroupType groupType);
+	List<TeacherVipSalaryDto> queryOnlineCourseByGroupType(@Param("startDate") Date startDate, @Param("endDate") Date endDate);
 	/**
 	 * 该用户是不是这个群组的老师
 	 * @param groupId

+ 48 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/TeacherVipSalaryDto.java

@@ -0,0 +1,48 @@
+package com.ym.mec.biz.dal.dto;
+
+import com.ym.mec.biz.dal.entity.CourseScheduleTeacherSalary;
+import com.ym.mec.biz.dal.enums.JobNatureEnum;
+import com.ym.mec.biz.dal.enums.TeachModeEnum;
+
+public class TeacherVipSalaryDto extends CourseScheduleTeacherSalary {
+
+	private JobNatureEnum teacherJobNature;
+
+	private String vipGroupCategoryName;
+	
+	private Integer vipGroupCategoryId;
+
+	private TeachModeEnum teachMode;
+
+	public JobNatureEnum getTeacherJobNature() {
+		return teacherJobNature;
+	}
+
+	public void setTeacherJobNature(JobNatureEnum teacherJobNature) {
+		this.teacherJobNature = teacherJobNature;
+	}
+
+	public String getVipGroupCategoryName() {
+		return vipGroupCategoryName;
+	}
+
+	public void setVipGroupCategoryName(String vipGroupCategoryName) {
+		this.vipGroupCategoryName = vipGroupCategoryName;
+	}
+
+	public Integer getVipGroupCategoryId() {
+		return vipGroupCategoryId;
+	}
+
+	public void setVipGroupCategoryId(Integer vipGroupCategoryId) {
+		this.vipGroupCategoryId = vipGroupCategoryId;
+	}
+
+	public TeachModeEnum getTeachMode() {
+		return teachMode;
+	}
+
+	public void setTeachMode(TeachModeEnum teachMode) {
+		this.teachMode = teachMode;
+	}
+}

+ 30 - 8
mec-biz/src/main/java/com/ym/mec/biz/service/VipGroupService.java

@@ -1,17 +1,37 @@
 package com.ym.mec.biz.service;
 
-import com.ym.mec.biz.dal.dto.*;
-import com.ym.mec.biz.dal.entity.*;
+import java.math.BigDecimal;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+import com.ym.mec.biz.dal.dto.StudentRecoverInfoDto;
+import com.ym.mec.biz.dal.dto.StudentVipGroupDetailDto;
+import com.ym.mec.biz.dal.dto.TeacherBasicDto;
+import com.ym.mec.biz.dal.dto.TeachingRecordBaseInfo;
+import com.ym.mec.biz.dal.dto.VipBuyResultDto;
+import com.ym.mec.biz.dal.dto.VipGroupApplyBaseInfoDto;
+import com.ym.mec.biz.dal.dto.VipGroupApplyDto;
+import com.ym.mec.biz.dal.dto.VipGroupBuyParamsDto;
+import com.ym.mec.biz.dal.dto.VipGroupCostCountDto;
+import com.ym.mec.biz.dal.dto.VipGroupCostCountParamsDto;
+import com.ym.mec.biz.dal.dto.VipGroupManageDetailDto;
+import com.ym.mec.biz.dal.dto.VipGroupPayInfoDto;
+import com.ym.mec.biz.dal.entity.ClassGroup;
+import com.ym.mec.biz.dal.entity.School;
 import com.ym.mec.biz.dal.entity.StudentApplyRefunds.StudentApplyRefundsStatus;
+import com.ym.mec.biz.dal.entity.StudentPaymentOrder;
+import com.ym.mec.biz.dal.entity.StudentRecoverDto;
+import com.ym.mec.biz.dal.entity.VipGroup;
 import com.ym.mec.biz.dal.enums.AuditStatusEnum;
-import com.ym.mec.biz.dal.page.*;
+import com.ym.mec.biz.dal.page.StudentVipGroupQueryInfo;
+import com.ym.mec.biz.dal.page.VipGroupAttendanceQueryInfo;
+import com.ym.mec.biz.dal.page.VipGroupQueryInfo;
+import com.ym.mec.biz.dal.page.VipGroupSalaryQueryInfo;
+import com.ym.mec.biz.dal.page.VipGroupTeachingRecordQueryInfo;
 import com.ym.mec.common.page.PageInfo;
 import com.ym.mec.common.service.BaseService;
 
-import java.math.BigDecimal;
-import java.util.List;
-import java.util.Map;
-
 public interface VipGroupService extends BaseService<Long, VipGroup> {
 
     /**
@@ -394,7 +414,9 @@ public interface VipGroupService extends BaseService<Long, VipGroup> {
 
     /**
      * 更新线上课老师的课酬
+     * @param startDate
+     * @param endDate
      * @return
      */
-    void updateHistoryTeacherSalaryOfOnline();
+    void updateHistoryTeacherSalaryOfOnline(Date startDate, Date endDate);
 }

+ 4 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentCourseHomeworkServiceImpl.java

@@ -26,6 +26,7 @@ import com.ym.mec.thirdparty.message.MessageSenderPluginContext;
 import com.ym.mec.thirdparty.message.MessageSenderPluginContext.MessageSender;
 import com.ym.mec.util.collection.MapUtil;
 import com.ym.mec.util.date.DateUtil;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -83,6 +84,9 @@ public class StudentCourseHomeworkServiceImpl extends BaseServiceImpl<Long, Stud
     @Override
     @Transactional(rollbackFor = Exception.class)
     public void submitHomework(StudentCourseHomework bean) {
+        if(Objects.isNull(bean.getAttachments())||StringUtils.isBlank(bean.getAttachments())){
+            throw new BizException("请选择作业");
+        }
         StudentCourseHomework existHomework = studentCourseHomeworkDao.get(bean.getId());
         if (Objects.isNull(bean) || Objects.isNull(bean.getId()) || Objects.isNull(existHomework)) {
             throw new BizException("作业不存在");

+ 29 - 12
mec-biz/src/main/java/com/ym/mec/biz/service/impl/VipGroupServiceImpl.java

@@ -24,6 +24,7 @@ import com.ym.mec.im.ImFeignService;
 import com.ym.mec.thirdparty.message.MessageSenderPluginContext;
 import com.ym.mec.util.collection.MapUtil;
 import com.ym.mec.util.date.DateUtil;
+
 import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -2799,26 +2800,42 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 
 	@Override
 	@Async
-	public void updateHistoryTeacherSalaryOfOnline() {
+	public void updateHistoryTeacherSalaryOfOnline(Date startDate, Date endDate) {
 		// 查询所有含有线上课的课程组,线上课节数,实付金额
 		List<VipCourseStudentInfoDto> list = vipGroupDao.queryVipCourseStudentInfo();
 		Map<String, VipCourseStudentInfoDto> map = list.stream().collect(Collectors.toMap(VipCourseStudentInfoDto::getMusicGroupId, e -> e));
 
 		VipCourseStudentInfoDto dto = null;
 		// 查询需要修改的课酬记录
-		List<CourseScheduleTeacherSalary> teacherSalaryList = courseScheduleTeacherSalaryDao.queryOnlineCourseByGroupType(GroupType.VIP);
-		for (CourseScheduleTeacherSalary ts : teacherSalaryList) {
-			dto = map.get(ts.getMusicGroupId());
-			if (dto != null) {
-				ts.setExpectSalary(dto
-						.getTotalAmount()
-						.divide(new BigDecimal(dto.getTotalCourseTimes()).divide(new BigDecimal(dto.getStudentNum()), RoundingMode.HALF_UP),
-								RoundingMode.HALF_UP).multiply(new BigDecimal(0.6)));
+		List<TeacherVipSalaryDto> teacherSalaryList = courseScheduleTeacherSalaryDao.queryOnlineCourseByGroupType(startDate, endDate);
+		for (TeacherVipSalaryDto ts : teacherSalaryList) {
+			// 修复兼职老师不管1v?和全职老师1vn的课酬为系统默认课酬(不管线上还是线下课)
+			if (ts.getTeacherJobNature() != JobNatureEnum.FULL_TIME || !StringUtils.equalsIgnoreCase("1v1", ts.getVipGroupCategoryName())) {
+				// 查询默认课酬
+				TeacherDefaultVipGroupSalary tdvs = teacherDefaultVipGroupSalaryDao.findByTeacherAndCategory(ts.getUserId(), ts.getVipGroupCategoryId());
+				if (tdvs != null) {
+					if (ts.getTeachMode() == TeachModeEnum.ONLINE) {
+						ts.setExpectSalary(tdvs.getOnlineClassesSalary());
+					} else {
+						ts.setExpectSalary(tdvs.getOfflineClassesSalary());
+					}
+				}
+			} else {
+				if (ts.getTeachMode() == TeachModeEnum.ONLINE && ts.getTeacherJobNature() == JobNatureEnum.FULL_TIME) {
+					dto = map.get(ts.getMusicGroupId());
+					if (dto != null) {
+						ts.setExpectSalary(dto
+								.getTotalAmount()
+								.divide(new BigDecimal(dto.getTotalCourseTimes()).divide(new BigDecimal(dto.getStudentNum()), RoundingMode.HALF_UP),
+										RoundingMode.HALF_UP).multiply(new BigDecimal(0.6)));
+					}
+				}
 			}
+			courseScheduleTeacherSalaryDao.update(ts);
 		}
-		
-		if(teacherSalaryList.size() > 0){
-			courseScheduleTeacherSalaryDao.batchUpdateTeacherExpectSalarys(teacherSalaryList);
+
+		if (teacherSalaryList.size() > 0) {
+			// courseScheduleTeacherSalaryDao.batchUpdateTeacherExpectSalarys(teacherSalaryList);
 		}
 
 	}

+ 10 - 3
mec-biz/src/main/resources/config/mybatis/CourseScheduleTeacherSalaryMapper.xml

@@ -28,6 +28,13 @@
 		<result column="end_class_time_" property="courseSchedule.endClassTime" />
 	</resultMap>
 	
+	<resultMap type="com.ym.mec.biz.dal.dto.TeacherVipSalaryDto" id="teacherVipSalaryDto" extends="CourseScheduleTeacherSalary">
+		<result column="vip_group_category_id_" property="vipGroupCategoryId" />
+		<result column="vip_group_category_name_" property="vipGroupCategoryName" />
+		<result column="job_nature_" property="teacherJobNature" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
+		<result column="teach_mode_" property="teachMode" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
+	</resultMap>
+	
 	<!-- 根据主键查询一条记录 -->
 	<select id="get" resultMap="CourseScheduleTeacherSalary" >
 		SELECT * FROM course_schedule_teacher_salary WHERE id_ = #{id} 
@@ -666,12 +673,12 @@
 		GROUP BY ts.id_,ta.id_
 	</select>
 	
-	<select id="queryOnlineCourseByGroupType" resultMap="CourseScheduleTeacherSalary">
-		SELECT csts.*  FROM `course_schedule_teacher_salary` csts LEFT JOIN `course_schedule` cs on csts.`course_schedule_id_` = cs.`id_` 
+	<select id="queryOnlineCourseByGroupType" resultMap="teacherVipSalaryDto" parameterType="map">
+		SELECT csts.*,cs.teach_mode_,vgc.name_ vip_group_category_name_,vg.vip_group_category_id_, t.job_nature_  FROM `course_schedule_teacher_salary` csts LEFT JOIN `course_schedule` cs on csts.`course_schedule_id_` = cs.`id_` 
 		left join vip_group vg on vg.id_ = csts.music_group_id_ and csts.group_type_ = 'VIP'
 		left join vip_group_category vgc on vgc.id_ = vg.vip_group_category_id_
 		left join teacher t on t.id_ = csts.user_id_ 
-		WHERE cs.`group_type_` = 'VIP' and cs.`teach_mode_` = 'ONLINE' and vgc.name_ = '1v1' and t.job_nature_ = 'FULL_TIME'
+		WHERE cs.`group_type_` = 'VIP' and cs.class_date_ between #{startDate} and #{endDate}
 	</select>
 
     <select id="isTeacher" resultType="java.lang.Boolean">

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

@@ -935,7 +935,7 @@
     <select id="queryVipCourseStudentInfo" resultMap="vipCourseStudentInfoDto">
         SELECT cssp.music_group_id_,ifnull(sum(cssp.expect_price_),0) total_amount_,ifnull(count(DISTINCT(cssp.user_id_)),0) student_num_,ifnull(count(cssp.id_),0) total_times_   
 		FROM course_schedule_student_payment cssp LEFT JOIN course_schedule cs on cs.id_ = cssp.course_schedule_id_
-		WHERE cs.group_type_ = 'VIP' and cs.teach_mode_ = 'ONLINE'
+		WHERE cs.group_type_ = 'VIP'
 		GROUP BY cssp.music_group_id_
     </select>
 

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

@@ -1,5 +1,7 @@
 package com.ym.mec.web.controller;
 
+import java.util.Date;
+
 import com.ym.mec.biz.dal.page.CourseScheduleTeacherSalaryQueryInfo;
 import com.ym.mec.biz.service.CourseScheduleTeacherSalaryService;
 import com.ym.mec.biz.service.VipGroupService;
@@ -33,8 +35,8 @@ public class CourseScheduleTeacherSalaryController extends BaseController {
     }
     
     @GetMapping("/updateHistoryTeacherSalaryOfOnline")
-    public Object updateHistoryTeacherSalaryOfOnline() {
-    	vipGroupService.updateHistoryTeacherSalaryOfOnline();
+    public Object updateHistoryTeacherSalaryOfOnline(Date startDate, Date endDate) {
+    	vipGroupService.updateHistoryTeacherSalaryOfOnline(startDate, endDate);
         return succeed();
     }
 }