Browse Source

feat:乐理课

Joburgess 4 years ago
parent
commit
41a2bc9fd7

+ 13 - 14
mec-biz/src/main/java/com/ym/mec/biz/service/impl/TeacherDefaultVipGroupSalaryServiceImpl.java

@@ -10,6 +10,8 @@ import java.util.Objects;
 import java.util.Set;
 import java.util.stream.Collectors;
 
+import com.ym.mec.biz.dal.dao.*;
+import com.ym.mec.biz.dal.entity.*;
 import com.ym.mec.biz.service.VipGroupService;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -17,18 +19,8 @@ import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
 import com.alibaba.fastjson.JSON;
-import com.ym.mec.biz.dal.dao.CourseScheduleTeacherSalaryDao;
-import com.ym.mec.biz.dal.dao.TeacherDao;
-import com.ym.mec.biz.dal.dao.TeacherDefaultVipGroupSalaryDao;
-import com.ym.mec.biz.dal.dao.VipGroupActivityDao;
-import com.ym.mec.biz.dal.dao.VipGroupDao;
 import com.ym.mec.biz.dal.dto.VipGroupSalarySettlementDto;
 import com.ym.mec.biz.dal.entity.CourseSchedule.CourseScheduleType;
-import com.ym.mec.biz.dal.entity.CourseScheduleTeacherSalary;
-import com.ym.mec.biz.dal.entity.Teacher;
-import com.ym.mec.biz.dal.entity.TeacherDefaultVipGroupSalary;
-import com.ym.mec.biz.dal.entity.VipGroup;
-import com.ym.mec.biz.dal.entity.VipGroupActivity;
 import com.ym.mec.biz.dal.enums.JobNatureEnum;
 import com.ym.mec.biz.dal.enums.SalarySettlementTypeEnum;
 import com.ym.mec.biz.dal.enums.TeachModeEnum;
@@ -58,6 +50,9 @@ public class TeacherDefaultVipGroupSalaryServiceImpl extends BaseServiceImpl<Lon
 	@Autowired
 	private VipGroupService vipGroupService;
 
+	@Autowired
+	private VipGroupCategoryDao vipGroupCategoryDao;
+
 	@Override
 	public BaseDAO<Long, TeacherDefaultVipGroupSalary> getDAO() {
 		return teacherDefaultVipGroupSalaryDao;
@@ -146,24 +141,28 @@ public class TeacherDefaultVipGroupSalaryServiceImpl extends BaseServiceImpl<Lon
 						// 课酬结算标准
 						if (vipGroup != null) {
 
+							VipGroupCategory vipGroupCategory = vipGroupCategoryDao.get(vipGroup.getVipGroupCategoryId());
+
 							VipGroupActivity vipGroupActivity = vipGroupActivityMap.get(vipGroup.getVipGroupActivityId());
-							if (vipGroupActivity == null) {
+							if (!vipGroupCategory.getMusicTheory()&&vipGroupActivity == null) {
 								continue;
 							}
 
 							VipGroupSalarySettlementDto vipGroupSalarySettlementDto = JSON.parseObject(vipGroupActivity.getSalarySettlementJson(),
 									VipGroupSalarySettlementDto.class);
 
-							if (vipGroupSalarySettlementDto == null) {
+							if (!vipGroupCategory.getMusicTheory()&&vipGroupSalarySettlementDto == null) {
 								continue;
 							}
 
 							TeacherDefaultVipGroupSalary tdms = salaryMap.get(vipGroup.getVipGroupCategoryId());
 							TeacherDefaultVipGroupSalary origTdms = map.get(vipGroup.getVipGroupCategoryId());
 							if (tdms != null && origTdms != null) {
-								Map<String, BigDecimal> teachModeSalaryMap = vipGroupService.countVipGroupCoursePredictFee(vipGroup, ts.getUserId(), ts.getCourseScheduleId());
-								if(Objects.isNull(vipGroup.getVipGroupActivityId())){
+								Map<String, BigDecimal> teachModeSalaryMap = new HashMap<>();
+								if(vipGroupCategory.getMusicTheory()){
 									teachModeSalaryMap = vipGroupService.countVipGroupPredictFee(vipGroup, ts.getUserId());
+								}else{
+									teachModeSalaryMap = vipGroupService.countVipGroupCoursePredictFee(vipGroup, ts.getUserId(), ts.getCourseScheduleId());
 								}
 								if(TeachModeEnum.ONLINE.equals(ts.getCourseSchedule().getTeachMode())&&teachModeSalaryMap.containsKey("onlineTeacherSalary")){
 									ts.setExpectSalary(teachModeSalaryMap.get("onlineTeacherSalary"));