|
@@ -1,5 +1,10 @@
|
|
|
package com.ym.mec.biz.service.impl;
|
|
|
|
|
|
+import com.ym.mec.biz.dal.dao.MusicGroupPaymentCalenderDao;
|
|
|
+import com.ym.mec.biz.dal.dao.MusicGroupPaymentCalenderDetailDao;
|
|
|
+import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender;
|
|
|
+import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalenderDetail;
|
|
|
+import com.ym.mec.common.exception.BizException;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
@@ -8,16 +13,45 @@ import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalenderCourseSettings;
|
|
|
import com.ym.mec.biz.service.MusicGroupPaymentCalenderCourseSettingsService;
|
|
|
import com.ym.mec.common.dal.BaseDAO;
|
|
|
import com.ym.mec.common.service.impl.BaseServiceImpl;
|
|
|
+import org.springframework.util.CollectionUtils;
|
|
|
+
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+import java.util.Objects;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
@Service
|
|
|
public class MusicGroupPaymentCalenderCourseSettingsServiceImpl extends BaseServiceImpl<Integer, MusicGroupPaymentCalenderCourseSettings> implements MusicGroupPaymentCalenderCourseSettingsService {
|
|
|
|
|
|
@Autowired
|
|
|
private MusicGroupPaymentCalenderCourseSettingsDao musicGroupPaymentCalenderCourseSettingsDao;
|
|
|
+ @Autowired
|
|
|
+ private MusicGroupPaymentCalenderDao musicGroupPaymentCalenderDao;
|
|
|
+ @Autowired
|
|
|
+ private MusicGroupPaymentCalenderDetailDao musicGroupPaymentCalenderDetailDao;
|
|
|
|
|
|
@Override
|
|
|
public BaseDAO<Integer, MusicGroupPaymentCalenderCourseSettings> getDAO() {
|
|
|
return musicGroupPaymentCalenderCourseSettingsDao;
|
|
|
}
|
|
|
-
|
|
|
-}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<MusicGroupPaymentCalenderCourseSettings> getMusicCourseSettingsWithStudents(String musicGroupId, List<Integer> studentIds) {
|
|
|
+ MusicGroupPaymentCalender musicGroupUnusedFirstPaymentCalender = musicGroupPaymentCalenderDao.getMusicGroupUnusedFirstPaymentCalender(musicGroupId, studentIds);
|
|
|
+ if(Objects.isNull(musicGroupUnusedFirstPaymentCalender)){
|
|
|
+ throw new BizException("当前乐团暂无新缴费设置");
|
|
|
+ }
|
|
|
+
|
|
|
+ List<MusicGroupPaymentCalenderDetail> unusedPaymentCalenderDetail = musicGroupPaymentCalenderDetailDao.getCalenderDetailWithCalender(musicGroupUnusedFirstPaymentCalender.getId());
|
|
|
+ if(CollectionUtils.isEmpty(unusedPaymentCalenderDetail)){
|
|
|
+ throw new BizException("当前乐团无学员缴费信息");
|
|
|
+ }
|
|
|
+ Map<Integer, List<MusicGroupPaymentCalenderDetail>> studentPaymentCalenderMap = unusedPaymentCalenderDetail.stream().collect(Collectors.groupingBy(MusicGroupPaymentCalenderDetail::getUserId));
|
|
|
+
|
|
|
+ List<MusicGroupPaymentCalenderCourseSettings> calenderCourseSettings = musicGroupPaymentCalenderCourseSettingsDao.getWithPaymentCalender(musicGroupUnusedFirstPaymentCalender.getId());
|
|
|
+ if(CollectionUtils.isEmpty(calenderCourseSettings)){
|
|
|
+ throw new BizException("课程收费标准设置异常");
|
|
|
+ }
|
|
|
+ return calenderCourseSettings;
|
|
|
+ }
|
|
|
+}
|