|
@@ -9,6 +9,7 @@ import java.util.Map;
|
|
|
import java.util.Set;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
+import com.ym.mec.biz.dal.dao.*;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
@@ -17,10 +18,6 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
-import com.ym.mec.biz.dal.dao.ClassGroupStudentMapperDao;
|
|
|
-import com.ym.mec.biz.dal.dao.CourseScheduleTeacherSalaryDao;
|
|
|
-import com.ym.mec.biz.dal.dao.MusicGroupDao;
|
|
|
-import com.ym.mec.biz.dal.dao.TeacherDefaultMusicGroupSalaryDao;
|
|
|
import com.ym.mec.biz.dal.entity.CourseSchedule.CourseScheduleType;
|
|
|
import com.ym.mec.biz.dal.entity.CourseScheduleTeacherSalary;
|
|
|
import com.ym.mec.biz.dal.entity.MusicGroup;
|
|
@@ -42,6 +39,9 @@ public class TeacherDefaultMusicGroupSalaryServiceImpl extends BaseServiceImpl<L
|
|
|
private TeacherDefaultMusicGroupSalaryDao teacherDefaultMusicGroupSalaryDao;
|
|
|
|
|
|
@Autowired
|
|
|
+ private CourseScheduleStudentPaymentDao courseScheduleStudentPaymentDao;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
private CourseScheduleTeacherSalaryDao courseScheduleTeacherSalaryDao;
|
|
|
|
|
|
@Autowired
|
|
@@ -125,25 +125,23 @@ public class TeacherDefaultMusicGroupSalaryServiceImpl extends BaseServiceImpl<L
|
|
|
.getEndClassTime()));
|
|
|
int mins = 0;
|
|
|
if(tdms.getCourseScheduleType() == CourseScheduleType.HIGH_ONLINE || tdms.getCourseScheduleType() == CourseScheduleType.MUSIC_NETWORK) {
|
|
|
- if (!classGroupStudentNumMap.containsKey(ts.getClassGroupId())) {
|
|
|
- // 查询 班级人数
|
|
|
- String[] strs = classGroupStudentMapperDao.findStudentNumByClassGroupId(ts.getClassGroupId());
|
|
|
- classGroupStudentNumMap.put(ts.getClassGroupId(), strs.length);
|
|
|
- }
|
|
|
+ int studentNum = courseScheduleStudentPaymentDao.countCourseOnlyStudentNum(ts.getCourseScheduleId());
|
|
|
+
|
|
|
String salaryRuleJson = tdms.getSalaryRuleJson();
|
|
|
if (StringUtils.isNotBlank(salaryRuleJson)) {
|
|
|
JSONObject obj = JSON.parseObject(salaryRuleJson);
|
|
|
if(obj == null){
|
|
|
throw new BizException("课酬设置不完整");
|
|
|
}
|
|
|
- Integer studentNum = classGroupStudentNumMap.get(ts.getClassGroupId());
|
|
|
- if(studentNum == null){
|
|
|
- studentNum = 0;
|
|
|
- }
|
|
|
+
|
|
|
if(studentNum>5){
|
|
|
studentNum = 5;
|
|
|
}
|
|
|
- ts.setExpectSalary(new BigDecimal(obj.getDouble(studentNum + "")));
|
|
|
+ if(studentNum==0){
|
|
|
+ ts.setExpectSalary(BigDecimal.ZERO);
|
|
|
+ }else{
|
|
|
+ ts.setExpectSalary(new BigDecimal(obj.getDouble(studentNum + "")));
|
|
|
+ }
|
|
|
list.add(ts);
|
|
|
}
|
|
|
|
|
@@ -164,15 +162,7 @@ public class TeacherDefaultMusicGroupSalaryServiceImpl extends BaseServiceImpl<L
|
|
|
}
|
|
|
}
|
|
|
if(CourseScheduleType.HIGH.equals(tdms.getCourseScheduleType())){
|
|
|
- if (!classGroupStudentNumMap.containsKey(ts.getClassGroupId())) {
|
|
|
- // 查询 班级人数
|
|
|
- String[] strs = classGroupStudentMapperDao.findStudentNumByClassGroupId(ts.getClassGroupId());
|
|
|
- classGroupStudentNumMap.put(ts.getClassGroupId(), strs.length);
|
|
|
- }
|
|
|
- Integer studentNum = classGroupStudentNumMap.get(ts.getClassGroupId());
|
|
|
- if(studentNum == null){
|
|
|
- studentNum = 0;
|
|
|
- }
|
|
|
+ int studentNum = courseScheduleStudentPaymentDao.countCourseOnlyStudentNum(ts.getCourseScheduleId());
|
|
|
ts.setExpectSalary(ts.getExpectSalary().multiply(new BigDecimal(studentNum)));
|
|
|
}
|
|
|
list.add(ts);
|
|
@@ -194,15 +184,7 @@ public class TeacherDefaultMusicGroupSalaryServiceImpl extends BaseServiceImpl<L
|
|
|
}
|
|
|
}
|
|
|
if(CourseScheduleType.HIGH.equals(tdms.getCourseScheduleType())){
|
|
|
- if (!classGroupStudentNumMap.containsKey(ts.getClassGroupId())) {
|
|
|
- // 查询 班级人数
|
|
|
- String[] strs = classGroupStudentMapperDao.findStudentNumByClassGroupId(ts.getClassGroupId());
|
|
|
- classGroupStudentNumMap.put(ts.getClassGroupId(), strs.length);
|
|
|
- }
|
|
|
- Integer studentNum = classGroupStudentNumMap.get(ts.getClassGroupId());
|
|
|
- if(studentNum == null){
|
|
|
- studentNum = 0;
|
|
|
- }
|
|
|
+ int studentNum = courseScheduleStudentPaymentDao.countCourseOnlyStudentNum(ts.getCourseScheduleId());
|
|
|
ts.setExpectSalary(ts.getExpectSalary().multiply(new BigDecimal(studentNum)));
|
|
|
}
|
|
|
list.add(ts);
|