|
@@ -1,6 +1,7 @@
|
|
|
package com.ym.mec.biz.service.impl;
|
|
|
|
|
|
import com.ym.mec.biz.dal.dao.CourseScheduleDao;
|
|
|
+import com.ym.mec.biz.dal.dao.SubjectChangeDao;
|
|
|
import com.ym.mec.biz.dal.dao.TeacherDao;
|
|
|
import com.ym.mec.biz.dal.entity.CooperationShareProfitDto;
|
|
|
import com.ym.mec.biz.dal.entity.CourseSchedule;
|
|
@@ -9,16 +10,20 @@ import com.ym.mec.common.exception.BizException;
|
|
|
import com.ym.mec.common.page.PageInfo;
|
|
|
import com.ym.mec.common.page.QueryInfo;
|
|
|
import com.ym.mec.util.collection.MapUtil;
|
|
|
+
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+
|
|
|
import com.ym.mec.common.service.impl.BaseServiceImpl;
|
|
|
import com.ym.mec.biz.dal.entity.CooperationShareProfit;
|
|
|
import com.ym.mec.biz.service.CooperationShareProfitService;
|
|
|
import com.ym.mec.biz.dal.dao.CooperationShareProfitDao;
|
|
|
+
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
|
|
|
+import java.math.BigDecimal;
|
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
@@ -31,6 +36,9 @@ public class CooperationShareProfitServiceImpl extends BaseServiceImpl<Integer,
|
|
|
private CourseScheduleDao courseScheduleDao;
|
|
|
@Autowired
|
|
|
private TeacherDao teacherDao;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private SubjectChangeDao subjectChangeDao;
|
|
|
|
|
|
@Override
|
|
|
public BaseDAO<Integer, CooperationShareProfit> getDAO() {
|
|
@@ -85,10 +93,21 @@ public class CooperationShareProfitServiceImpl extends BaseServiceImpl<Integer,
|
|
|
if(CollectionUtils.isEmpty(musicGroupIds)){
|
|
|
return;
|
|
|
}
|
|
|
+
|
|
|
List<CooperationShareProfit> profits = cooperationShareProfitDao.initShareProfit(musicGroupIds);
|
|
|
if(CollectionUtils.isEmpty(profits)){
|
|
|
return;
|
|
|
}
|
|
|
+
|
|
|
+ //存在声部更换的学生
|
|
|
+ BigDecimal courseMargin = BigDecimal.ZERO;
|
|
|
+ for(CooperationShareProfit sp : profits){
|
|
|
+ courseMargin = subjectChangeDao.getTotalCourseMargin(sp.getMusicGroupId());
|
|
|
+ if(courseMargin != null){
|
|
|
+ sp.setTotalAmount(courseMargin.add(sp.getTotalAmount()));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
cooperationShareProfitDao.batchInsert(profits);
|
|
|
}
|
|
|
|