|
@@ -17,19 +17,23 @@ 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;
|
|
|
import com.ym.mec.biz.service.TeacherDefaultVipGroupSalaryService;
|
|
|
import com.ym.mec.common.dal.BaseDAO;
|
|
|
+import com.ym.mec.common.exception.BizException;
|
|
|
import com.ym.mec.common.service.impl.BaseServiceImpl;
|
|
|
|
|
|
@Service
|
|
@@ -46,6 +50,9 @@ public class TeacherDefaultVipGroupSalaryServiceImpl extends BaseServiceImpl<Lon
|
|
|
|
|
|
@Autowired
|
|
|
private VipGroupActivityDao vipGroupActivityDao;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private TeacherDao teacherDao;
|
|
|
|
|
|
@Override
|
|
|
public BaseDAO<Long, TeacherDefaultVipGroupSalary> getDAO() {
|
|
@@ -69,15 +76,19 @@ public class TeacherDefaultVipGroupSalaryServiceImpl extends BaseServiceImpl<Lon
|
|
|
|
|
|
TeacherDefaultVipGroupSalary salary = teacherDefaultVipGroupSalaries.get(0);
|
|
|
Integer userId = salary.getUserId();
|
|
|
+ Teacher teacher = teacherDao.get(userId);
|
|
|
+ if(teacher == null){
|
|
|
+ throw new BizException("老师信息在系统中找不到");
|
|
|
+ }
|
|
|
// 获取老师默认VIP课课酬
|
|
|
- /*List<TeacherDefaultVipGroupSalary> origSalaryList = teacherDefaultVipGroupSalaryDao.queryByUserId(userId);
|
|
|
+ List<TeacherDefaultVipGroupSalary> origSalaryList = teacherDefaultVipGroupSalaryDao.queryByUserId(userId);
|
|
|
|
|
|
Map<Integer, TeacherDefaultVipGroupSalary> map = new HashMap<Integer, TeacherDefaultVipGroupSalary>();
|
|
|
if (origSalaryList != null && origSalaryList.size() > 0) {
|
|
|
for (TeacherDefaultVipGroupSalary ms : origSalaryList) {
|
|
|
map.put(ms.getVipGroupCategoryId(), ms);
|
|
|
}
|
|
|
- }*/
|
|
|
+ }
|
|
|
|
|
|
Map<Integer, TeacherDefaultVipGroupSalary> salaryMap = new HashMap<Integer, TeacherDefaultVipGroupSalary>();
|
|
|
for (TeacherDefaultVipGroupSalary ms : teacherDefaultVipGroupSalaries) {
|
|
@@ -89,6 +100,9 @@ public class TeacherDefaultVipGroupSalaryServiceImpl extends BaseServiceImpl<Lon
|
|
|
|| oldMS.getOnlineClassesSalary() == null || oldMS.getOnlineClassesSalary().doubleValue() != ms.getOnlineClassesSalary().doubleValue()) {
|
|
|
salaryMap.put(ms.getVipGroupCategoryId(), ms);
|
|
|
}*/
|
|
|
+ if(teacher.getJobNature() == JobNatureEnum.FULL_TIME){
|
|
|
+ ms.setOnlineClassesSalary(new BigDecimal(0));
|
|
|
+ }
|
|
|
salaryMap.put(ms.getVipGroupCategoryId(), ms);
|
|
|
}
|
|
|
|
|
@@ -140,14 +154,16 @@ public class TeacherDefaultVipGroupSalaryServiceImpl extends BaseServiceImpl<Lon
|
|
|
}
|
|
|
|
|
|
TeacherDefaultVipGroupSalary tdms = salaryMap.get(vipGroup.getVipGroupCategoryId());
|
|
|
- if (tdms != null) {
|
|
|
+ TeacherDefaultVipGroupSalary origTdms = map.get(vipGroup.getVipGroupCategoryId());
|
|
|
+ if (tdms != null && origTdms != null) {
|
|
|
if (vipGroupSalarySettlementDto.getOnlineSalarySettlement() != null && vipGroupSalarySettlementDto.getOnlineSalarySettlement().getSalarySettlementType() == SalarySettlementTypeEnum.TEACHER_DEFAULT
|
|
|
&& (ts.getCourseSchedule().getTeachMode() == TeachModeEnum.ONLINE)) {// 线上课
|
|
|
-
|
|
|
- ts.setExpectSalary(tdms.getOnlineClassesSalary());
|
|
|
- list.add(ts);
|
|
|
+ if (teacher.getJobNature() != JobNatureEnum.FULL_TIME && tdms.getOnlineClassesSalary().compareTo(origTdms.getOnlineClassesSalary()) != 0) {
|
|
|
+ ts.setExpectSalary(tdms.getOnlineClassesSalary());
|
|
|
+ list.add(ts);
|
|
|
+ }
|
|
|
} else if (vipGroupSalarySettlementDto.getOfflineSalarySettlement() != null && vipGroupSalarySettlementDto.getOfflineSalarySettlement().getSalarySettlementType() == SalarySettlementTypeEnum.TEACHER_DEFAULT
|
|
|
- && ts.getCourseSchedule().getTeachMode() == TeachModeEnum.OFFLINE) {// 线下课
|
|
|
+ && ts.getCourseSchedule().getTeachMode() == TeachModeEnum.OFFLINE && tdms.getOnlineClassesSalary().compareTo(origTdms.getOnlineClassesSalary()) != 0) {// 线下课
|
|
|
ts.setExpectSalary(tdms.getOfflineClassesSalary());
|
|
|
list.add(ts);
|
|
|
}
|