|
@@ -26,7 +26,6 @@ import java.util.Objects;
|
|
|
import java.util.Set;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
-import com.alibaba.fastjson.JSONArray;
|
|
|
import com.ym.mec.biz.dal.dao.*;
|
|
|
import com.ym.mec.biz.dal.dto.*;
|
|
|
import com.ym.mec.biz.dal.entity.*;
|
|
@@ -165,6 +164,8 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
|
|
|
private MusicGroupPaymentCalenderService musicGroupPaymentCalenderService;
|
|
|
@Autowired
|
|
|
private IdGeneratorService idGeneratorService;
|
|
|
+ @Autowired
|
|
|
+ private MusicGroupStudentClassAdjustDao musicGroupStudentClassAdjustDao;
|
|
|
|
|
|
@Override
|
|
|
public BaseDAO<Integer, ClassGroup> getDAO() {
|
|
@@ -3281,19 +3282,29 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
|
|
|
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
- public Object mergeClassSplitClassAffirm(MergeClassSplitClassAffirmDto mergeClassSplitClassAffirmDto) {
|
|
|
+ public void mergeClassSplitClassAffirm(MergeClassSplitClassAffirmDto mergeClassSplitClassAffirmDto) {
|
|
|
List<Integer> classGroupIds = mergeClassSplitClassAffirmDto.getClassGroupIds();
|
|
|
if(classGroupIds == null || classGroupIds.size() == 0){
|
|
|
throw new BizException("参数校验失败");
|
|
|
}
|
|
|
+ //班级信息
|
|
|
+ List<ClassGroup4MixDto> classGroup4MixDtos = mergeClassSplitClassAffirmDto.getClassGroup4MixDtos();
|
|
|
+ if(CollectionUtils.isEmpty(classGroup4MixDtos)){
|
|
|
+ throw new BizException("请填写班级信息");
|
|
|
+ }
|
|
|
+ List<Integer> studentIds = mergeClassSplitClassAffirmDto.getStudentIds();
|
|
|
+ if(CollectionUtils.isEmpty(studentIds)){
|
|
|
+ throw new BizException("学员列表不可为空");
|
|
|
+ }
|
|
|
SysUser sysUser = sysUserFeignService.queryUserInfo();
|
|
|
- MusicGroup musicGroup = musicGroupDao.findByClassGroupId(classGroupIds.get(0));
|
|
|
|
|
|
+ MusicGroup musicGroup = musicGroupDao.findByClassGroupId(classGroupIds.get(0));
|
|
|
//生成缴费记录,同一个批次
|
|
|
MusicGroupPaymentCalender.PaymentCalenderStatusEnum status = null;
|
|
|
- List<MusicGroupPaymentCalenderDto> paymentCalenderDtos = mergeClassSplitClassAffirmDto.getMusicGroupPaymentCalenderDtos();
|
|
|
+ String batchNo = null;
|
|
|
+ List<MusicGroupPaymentCalenderDto> paymentCalenderDtos = mergeClassSplitClassAffirmDto.getMusicGroupPaymentCalenderDtos();
|
|
|
if(paymentCalenderDtos != null && paymentCalenderDtos.size() > 0){
|
|
|
- String batchNo = idGeneratorService.generatorId() + "";
|
|
|
+ batchNo = idGeneratorService.generatorId() + "";
|
|
|
for (MusicGroupPaymentCalenderDto calenderDto : paymentCalenderDtos) {
|
|
|
if(status != null && status != AUDITING){
|
|
|
List<MusicGroupPaymentCalenderCourseSettings> musicGroupPaymentCalenderCourseSettingsList = calenderDto.getMusicGroupPaymentCalenderCourseSettingsList();
|
|
@@ -3312,6 +3323,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ //创建缴费项目
|
|
|
for (MusicGroupPaymentCalenderDto calenderDto : paymentCalenderDtos) {
|
|
|
if(status != null && status == AUDITING){
|
|
|
calenderDto.setStatus(AUDITING);
|
|
@@ -3321,17 +3333,42 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
|
|
|
musicGroupPaymentCalenderService.create(calenderDto);
|
|
|
}
|
|
|
}
|
|
|
- //新增班级
|
|
|
- List<ClassGroup4MixDto> classGroup4MixDtos = mergeClassSplitClassAffirmDto.getClassGroup4MixDtos();
|
|
|
- if(CollectionUtils.isEmpty(classGroup4MixDtos)){
|
|
|
- throw new BizException("请填写班级信息");
|
|
|
- }
|
|
|
- classGroupService.classGroupAdjust(classGroup4MixDtos);
|
|
|
//冻结所选班级的课程
|
|
|
- courseScheduleDao.batchUpdateLockByClassGroupIds(classGroupIds,1);
|
|
|
- //保存学员应该增加的课程时长
|
|
|
+ List<Long> allLockCourseIds = courseScheduleDao.queryStudentNotStartByClassIdsAndStudentIds(classGroupIds,null);
|
|
|
+ courseScheduleDao.batchUpdateLockByClassGroupIds(allLockCourseIds,1);
|
|
|
+
|
|
|
//记录申请信息
|
|
|
-
|
|
|
- return null;
|
|
|
+ MusicGroupStudentClassAdjust musicGroupStudentClassAdjust = new MusicGroupStudentClassAdjust();
|
|
|
+ musicGroupStudentClassAdjust.setBatchNo(batchNo);
|
|
|
+ musicGroupStudentClassAdjust.setBatchNo(batchNo);
|
|
|
+ musicGroupStudentClassAdjust.setCalenderStatus(status);
|
|
|
+ musicGroupStudentClassAdjust.setCourseFlag(false);
|
|
|
+ musicGroupStudentClassAdjust.setMusicGroupId(musicGroup.getId());
|
|
|
+ musicGroupStudentClassAdjust.setOperatorId(sysUser.getId());
|
|
|
+ musicGroupStudentClassAdjust.setNewClassGroupJson(JSON.toJSONString(classGroup4MixDtos));
|
|
|
+ musicGroupStudentClassAdjust.setClassGroupIds(JSON.toJSONString(classGroupIds));
|
|
|
+ musicGroupStudentClassAdjust.setStudentIds(JSON.toJSONString(studentIds));
|
|
|
+ musicGroupStudentClassAdjust.setAllLockCourseIds(JSON.toJSONString(allLockCourseIds));
|
|
|
+ List<Long> courseIds = courseScheduleDao.queryStudentNotStartByClassIdsAndStudentIds(classGroupIds,studentIds);
|
|
|
+ musicGroupStudentClassAdjust.setSubLockCourseIds(JSON.toJSONString(courseIds));
|
|
|
+ //计算新增班级的可排课时长,总课次*默认时长 (用学员剩余的课程时长加上购买的时长,可能导致同一班级学员时长不一致)
|
|
|
+ musicGroupStudentClassAdjust.setClassCourseMinute(JSON.toJSONString(findClassCourseMinuteMap(classGroupIds)));
|
|
|
+ musicGroupStudentClassAdjustDao.insert(musicGroupStudentClassAdjust);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Map<String,Long> findClassCourseMinuteMap(List<Integer> classGroupIds){
|
|
|
+ Map<String,Long> resultMap = new HashMap<>();
|
|
|
+ //获取默认的排课时长
|
|
|
+ String courseDefaultMinutes = sysConfigDao.findConfigValue("music_course_default_minutes");
|
|
|
+ JSONObject jsonObject = JSON.parseObject(courseDefaultMinutes);
|
|
|
+ //获取所选班级最大剩余课时
|
|
|
+ Map<String,Long> map = MapUtil.convertIntegerMap(courseScheduleDao.findClassMaxCourseNumMap(classGroupIds));
|
|
|
+ Set<String> courseTypes = map.keySet();
|
|
|
+ for (String courseType : courseTypes) {
|
|
|
+ //剩余时长*默认排课时长
|
|
|
+ resultMap.put(courseType,Integer.parseInt(jsonObject.get(courseType).toString()) * map.get(courseType));
|
|
|
+ }
|
|
|
+ return resultMap;
|
|
|
}
|
|
|
}
|