|
@@ -125,7 +125,9 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
List<SubjectRegisterDto> subjectRegisters = subFeeSettingDto.getSubjectRegisters();
|
|
|
String musicGroupId = idGeneratorService.generatorId() + "";
|
|
|
musicGroup.setId(musicGroupId);
|
|
|
- musicGroup.setStatus(MusicGroupStatusEnum.DRAFT);
|
|
|
+ if(musicGroup.getStatus() != MusicGroupStatusEnum.DRAFT && musicGroup.getStatus() != MusicGroupStatusEnum.AUDIT){
|
|
|
+ throw new Exception("乐团初始状态错误");
|
|
|
+ }
|
|
|
// 保存乐团基本信息
|
|
|
musicGroupDao.insert(musicGroup);
|
|
|
// 保存乐团付费主体列表
|
|
@@ -173,7 +175,8 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
musicGroupSubjectGoodsGroupDao.batchInsert(musicGroupSubjectGoodsGroups,musicGroupId);
|
|
|
}
|
|
|
// 记录创建日志
|
|
|
- musicGroupBuildLogDao.insert(new MusicGroupBuildLog(musicGroupId, "保存乐团草稿", sysUser.getId(), ""));
|
|
|
+ String event = musicGroup.getStatus() == MusicGroupStatusEnum.AUDIT?"新建乐团,提交审核":"保存乐团草稿";
|
|
|
+ musicGroupBuildLogDao.insert(new MusicGroupBuildLog(musicGroupId, event, sysUser.getId(), ""));
|
|
|
return musicGroupId;
|
|
|
}
|
|
|
|
|
@@ -189,8 +192,8 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
//乐团状态是否正确
|
|
|
MusicGroup musicGroup = musicGroupDao.get(musicGroupId);
|
|
|
if(musicGroup != null){
|
|
|
- if(musicGroup.getStatus() != MusicGroupStatusEnum.AUDIT || musicGroup.getStatus() != MusicGroupStatusEnum.DRAFT){
|
|
|
- throw new Exception("乐团状态异常");
|
|
|
+ if(musicGroup.getStatus() != MusicGroupStatusEnum.DRAFT || musicGroup.getStatus() != MusicGroupStatusEnum.AUDIT_FAILED){
|
|
|
+ throw new Exception("当前乐团状态不支持此操作");
|
|
|
}
|
|
|
//记录日志信息
|
|
|
musicGroupBuildLogDao.insert(new MusicGroupBuildLog(musicGroupId,"修改乐团计划声部、乐器",sysUser.getId(), JSONObject.toJSONString(subFeeSettingDto)));
|
|
@@ -208,8 +211,10 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
- public int updateExpectedStudentNum(List<UpdateExpectedNumDto> updateExpectedNumDtos) {
|
|
|
- return musicGroupSubjectPlanDao.updateExpectedStudentNum(updateExpectedNumDtos);
|
|
|
+ public void updateExpectedStudentNum(List<UpdateExpectedNumDto> updateExpectedNumDtos) {
|
|
|
+ updateExpectedNumDtos.forEach(e->{
|
|
|
+ musicGroupSubjectPlanDao.updateExpectedStudentNum(e.getExpectedStudentNum(),e.getMusicGroupSubjectPlanId());
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -242,7 +247,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
throw new Exception("乐团信息不存在");
|
|
|
}
|
|
|
if(musicGroup.getStatus() != statusEnum){
|
|
|
- throw new Exception("乐团状态异常");
|
|
|
+ throw new Exception("当前乐团状态不支持此操作");
|
|
|
}
|
|
|
musicGroup.setUpdateTime(date);
|
|
|
return musicGroup;
|
|
@@ -262,6 +267,33 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
+ public void musicGroupAuditFailed(String musicGroupId,String memo) throws Exception {
|
|
|
+ SysUser sysUser = sysUserFeignService.queryUserInfo();
|
|
|
+ if(sysUser == null){
|
|
|
+ throw new Exception("用户信息获取失败");
|
|
|
+ }
|
|
|
+ MusicGroup musicGroup = saveLog(musicGroupId,MusicGroupStatusEnum.AUDIT);
|
|
|
+ //记录操作日志
|
|
|
+ musicGroupBuildLogDao.insert(new MusicGroupBuildLog(musicGroupId,"审核失败(审核中 -> 审核失败)",sysUser.getId(),memo));
|
|
|
+ musicGroup.setMemo(memo);
|
|
|
+ musicGroup.setStatus(MusicGroupStatusEnum.AUDIT_FAILED);
|
|
|
+ musicGroupDao.update(musicGroup);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void musicGroupAuditSuccess(String musicGroupId) throws Exception {
|
|
|
+ SysUser sysUser = sysUserFeignService.queryUserInfo();
|
|
|
+ if(sysUser == null){
|
|
|
+ throw new Exception("用户信息获取失败");
|
|
|
+ }
|
|
|
+ MusicGroup musicGroup = saveLog(musicGroupId,MusicGroupStatusEnum.AUDIT);
|
|
|
+ //记录操作日志
|
|
|
+ musicGroupBuildLogDao.insert(new MusicGroupBuildLog(musicGroupId,"审核失败(审核中 -> 报名中)",sysUser.getId(),""));
|
|
|
+ musicGroup.setStatus(MusicGroupStatusEnum.APPLY);
|
|
|
+ musicGroupDao.update(musicGroup);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
public List<MusicCardDto> queryUserMusicGroups(Integer userId) {
|
|
|
List<MusicCardDto> musicCardDtos = musicGroupDao.queryUserMusicGroups(userId);
|
|
|
Set<String> musicGroupIds = musicCardDtos.stream().map(MusicCardDto::getMusicGroupId).collect(Collectors.toSet());
|
|
@@ -683,57 +715,64 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public void updateBaseInfo(SubFeeSettingDto subFeeSettingDto) throws Exception {
|
|
|
- MusicGroup musicGroup = subFeeSettingDto.getMusicGroup();
|
|
|
- String musicGroupId = musicGroup.getId();
|
|
|
- MusicGroup group = musicGroupDao.get(musicGroupId);
|
|
|
- if(group != null){
|
|
|
- Date date = new Date();
|
|
|
- List<Integer> months = subFeeSettingDto.getMonths();
|
|
|
- //删除乐团相关付费周期
|
|
|
- musicGroupPaymentCalenderDao.delByGroupId(musicGroupId);
|
|
|
- if(months != null && months.size() > 0){
|
|
|
- Integer num = musicGroupStudentFeeDao.countStudentNoPayNum(musicGroupId);
|
|
|
- if(num > 0){
|
|
|
- throw new Exception("缴费周期更新失败,当前乐团有未缴费的学员");
|
|
|
- }
|
|
|
- //修改学员下次缴费日期
|
|
|
- //获取当前月份
|
|
|
- int currentMonth = Integer.parseInt(DateUtil.getMonth(date));
|
|
|
- int nextMonth = currentMonth;
|
|
|
- for (int i = 0;i < months.size();i++){
|
|
|
- if(i == months.size()-1 && months.get(i) <= currentMonth){
|
|
|
- nextMonth = months.get(0);
|
|
|
- break;
|
|
|
- }else if(months.get(i) > currentMonth){
|
|
|
- nextMonth = months.get(i);
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- // 修改学员付费周期
|
|
|
- Date nextPaymentDate = null;
|
|
|
- if(nextMonth > currentMonth){
|
|
|
- nextPaymentDate = DateUtil.addMonths(date, nextMonth - currentMonth);
|
|
|
- }else if(nextMonth < currentMonth) {
|
|
|
- nextPaymentDate = DateUtil.addMonths(date, 12 - currentMonth + nextMonth);
|
|
|
- }else {
|
|
|
- nextPaymentDate = DateUtil.addMonths(date, 12);
|
|
|
- }
|
|
|
- musicGroupStudentFeeDao.updateNextPaymentDate(musicGroupId,nextPaymentDate);
|
|
|
- //批量插入
|
|
|
- musicGroupPaymentCalenderDao.batchAdd(months,musicGroupId);
|
|
|
+ SysUser sysUser = sysUserFeignService.queryUserInfo();
|
|
|
+ if(sysUser == null){
|
|
|
+ throw new Exception("用户信息获取失败");
|
|
|
+ }
|
|
|
+ String musicGroupId = subFeeSettingDto.getMusicGroup().getId();
|
|
|
+ MusicGroup musicGroup = saveLog(musicGroupId,MusicGroupStatusEnum.DRAFT);
|
|
|
+ if(musicGroup.getStatus() != MusicGroupStatusEnum.AUDIT_FAILED){
|
|
|
+ throw new Exception("当前乐团状态不支持此操作");
|
|
|
+ }
|
|
|
+
|
|
|
+ Date date = new Date();
|
|
|
+ List<Integer> months = subFeeSettingDto.getMonths();
|
|
|
+ //删除乐团相关付费周期
|
|
|
+ musicGroupPaymentCalenderDao.delByGroupId(musicGroupId);
|
|
|
+ if(months != null && months.size() > 0){
|
|
|
+ Integer num = musicGroupStudentFeeDao.countStudentNoPayNum(musicGroupId);
|
|
|
+ if(num > 0){
|
|
|
+ throw new Exception("缴费周期更新失败,当前乐团有未缴费的学员");
|
|
|
}
|
|
|
- musicGroupDao.update(musicGroup);
|
|
|
- //修改课程里面的教学点
|
|
|
- if(!group.getSchoolId().equals(musicGroup.getSchoolId())){
|
|
|
- courseScheduleDao.updateByMusicGroupId(musicGroupId,musicGroup.getSchoolId());
|
|
|
+ //修改学员下次缴费日期
|
|
|
+ //获取当前月份
|
|
|
+ int currentMonth = Integer.parseInt(DateUtil.getMonth(date));
|
|
|
+ int nextMonth = currentMonth;
|
|
|
+ for (int i = 0;i < months.size();i++){
|
|
|
+ if(i == months.size()-1 && months.get(i) <= currentMonth){
|
|
|
+ nextMonth = months.get(0);
|
|
|
+ break;
|
|
|
+ }else if(months.get(i) > currentMonth){
|
|
|
+ nextMonth = months.get(i);
|
|
|
+ break;
|
|
|
+ }
|
|
|
}
|
|
|
- // 删除乐团付费主体列表
|
|
|
- musicGroupPaymentEntitiesDao.delByGroupId(musicGroupId);
|
|
|
- //批量新增
|
|
|
- if(subFeeSettingDto.getMusicGroupPaymentEntities() != null && subFeeSettingDto.getMusicGroupPaymentEntities().size() > 0){
|
|
|
- musicGroupPaymentEntitiesDao.batchAdd(subFeeSettingDto.getMusicGroupPaymentEntities(),musicGroupId);
|
|
|
+ // 修改学员付费周期
|
|
|
+ Date nextPaymentDate = null;
|
|
|
+ if(nextMonth > currentMonth){
|
|
|
+ nextPaymentDate = DateUtil.addMonths(date, nextMonth - currentMonth);
|
|
|
+ }else if(nextMonth < currentMonth) {
|
|
|
+ nextPaymentDate = DateUtil.addMonths(date, 12 - currentMonth + nextMonth);
|
|
|
+ }else {
|
|
|
+ nextPaymentDate = DateUtil.addMonths(date, 12);
|
|
|
}
|
|
|
+ musicGroupStudentFeeDao.updateNextPaymentDate(musicGroupId,nextPaymentDate);
|
|
|
+ //批量插入
|
|
|
+ musicGroupPaymentCalenderDao.batchAdd(months,musicGroupId);
|
|
|
+ }
|
|
|
+ musicGroupDao.update(musicGroup);
|
|
|
+ //修改课程里面的教学点
|
|
|
+ if(!musicGroup.getSchoolId().equals(musicGroup.getSchoolId())){
|
|
|
+ courseScheduleDao.updateByMusicGroupId(musicGroupId,musicGroup.getSchoolId());
|
|
|
}
|
|
|
+ // 删除乐团付费主体列表
|
|
|
+ musicGroupPaymentEntitiesDao.delByGroupId(musicGroupId);
|
|
|
+ //批量新增
|
|
|
+ if(subFeeSettingDto.getMusicGroupPaymentEntities() != null && subFeeSettingDto.getMusicGroupPaymentEntities().size() > 0){
|
|
|
+ musicGroupPaymentEntitiesDao.batchAdd(subFeeSettingDto.getMusicGroupPaymentEntities(),musicGroupId);
|
|
|
+ }
|
|
|
+ //记录操作日志
|
|
|
+ musicGroupBuildLogDao.insert(new MusicGroupBuildLog(musicGroupId,"修改乐团基本信息数据",sysUser.getId(),JSONObject.toJSONString(subFeeSettingDto)));
|
|
|
}
|
|
|
|
|
|
@Override
|