|
@@ -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);
|
|
|
}
|
|
|
|
|
|
}
|