浏览代码

乐团调整逻辑修改

周箭河 5 年之前
父节点
当前提交
81e76bc4a4
共有 1 个文件被更改,包括 29 次插入24 次删除
  1. 29 24
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupServiceImpl.java

+ 29 - 24
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupServiceImpl.java

@@ -210,34 +210,39 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
                 }
                 //原来乐团的注册学生
                 List<StudentRegistration> musicGroupStudentRegistrationList = studentRegistrationDao.findStudentListByIdList(e.getRegisterIdList());
-                for (StudentRegistration studentRegistration : musicGroupStudentRegistrationList) {
-                    studentRegistration.setId(null);
-                    studentRegistration.setMusicGroupStatus(StudentMusicGroupStatusEnum.APPLY);
-                    studentRegistration.setPaymentStatus(PaymentStatusEnum.OPEN);
-                    studentRegistration.setMusicGroupId(musicGroupId);
-                    studentRegistration.setSubjectId(e.getSubjectId());
-                    studentRegistration.setActualSubjectId(e.getSubjectId());
-                    studentRegistration.setTemporaryCourseFee(null);
-                }
-                studentRegistrationList.addAll(musicGroupStudentRegistrationList);
 
                 for (MusicGroupSubjectPlan musicGroupSubjectPlan : musicGroupSubjectPlans) {
                     if (!musicGroupSubjectPlan.getSubjectId().equals(e.getSubjectId())) continue;
                     musicGroupSubjectPlan.setExpectedStudentNum(e.getRegisterIdList().size());
                     musicGroupSubjectPlan.setApplyStudentNum(e.getRegisterIdList().size());
+                    if (musicGroupSubjectPlan.getFee().compareTo(BigDecimal.ZERO) == 0) {
+                        musicGroupSubjectPlan.setPaidStudentNum(e.getRegisterIdList().size());
+                    }
+
+                    for (StudentRegistration studentRegistration : musicGroupStudentRegistrationList) {
+                        studentRegistration.setId(null);
+                        if (musicGroupSubjectPlan.getFee().compareTo(BigDecimal.ZERO) == 0) {
+                            studentRegistration.setMusicGroupStatus(StudentMusicGroupStatusEnum.NORMAL);
+                            studentRegistration.setPaymentStatus(PaymentStatusEnum.YES);
+                        } else {
+                            studentRegistration.setMusicGroupStatus(StudentMusicGroupStatusEnum.APPLY);
+                            studentRegistration.setPaymentStatus(PaymentStatusEnum.OPEN);
+                        }
+                        studentRegistration.setMusicGroupId(musicGroupId);
+                        studentRegistration.setSubjectId(e.getSubjectId());
+                        studentRegistration.setActualSubjectId(e.getSubjectId());
+                        studentRegistration.setTemporaryCourseFee(null);
+                    }
                 }
+
+                studentRegistrationList.addAll(musicGroupStudentRegistrationList);
             });
             musicGroup.setStatus(MusicGroupStatusEnum.PAY);
             //是否是免费团
             if (musicGroupSubjectPlans != null && musicGroupSubjectPlans.size() > 0) {
-                int size = musicGroupSubjectPlans.stream().filter(e -> e.getFee().compareTo(BigDecimal.ZERO) == 1).collect(Collectors.toList()).size();
+                int size = (int) musicGroupSubjectPlans.stream().filter(e -> e.getFee().compareTo(BigDecimal.ZERO) > 0).count();
                 if (size < 1) {
                     musicGroup.setStatus(MusicGroupStatusEnum.PREPARE);
-                    if (studentRegistrationList.size() > 0) {
-                        //修改为已缴费
-                        studentRegistrationList.forEach(e -> e.setPaymentStatus(PaymentStatusEnum.YES));
-                    }
-                    musicGroupSubjectPlans.forEach(e -> e.setPaidStudentNum(e.getApplyStudentNum()));
                 }
             }
             if (studentRegistrationList.size() > 0) {
@@ -351,9 +356,9 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
         String receiver = "daya";
         //深圳的零星缴费是在深圳
         String sDaYaOrganIds = sysConfigDao.findConfigValue(SysConfigService.SZ_DA_YA_ORGAN_IDS);
-        if(StringUtils.isNotBlank(sDaYaOrganIds)){
+        if (StringUtils.isNotBlank(sDaYaOrganIds)) {
             List<String> sDaYaOrganIdList = Arrays.asList(sDaYaOrganIds.split(","));
-            if(sDaYaOrganIdList.contains(chargeInfo.getOrganId().toString())){
+            if (sDaYaOrganIdList.contains(chargeInfo.getOrganId().toString())) {
                 receiver = "sdaya";
             }
         }
@@ -1061,7 +1066,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
         }
         List<HighClassGroupDto> highClassGroup = classGroupDao.findHighClassGroup(musicGroupId, classGroupIds);
 
-        if(classGroupIds != null && !classGroupIds.isEmpty()){
+        if (classGroupIds != null && !classGroupIds.isEmpty()) {
             List<Integer> classGroupSet = highClassGroup.stream().map(HighClassGroupDto::getId).collect(Collectors.toList());
             Map<Integer, Long> totalNumMap = MapUtil.convertIntegerMap(courseScheduleDao.countTotalNumByClassGroupId(classGroupSet, null));
             highClassGroup.removeIf(next -> totalNumMap.get(next.getId()) != null && totalNumMap.get(next.getId()) > 0);
@@ -1102,9 +1107,9 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
 
         String baseURL = sysConfigDao.findConfigValue(SysConfigService.BASE_API_URL);
         String url = baseURL + "/#/smallRegister?musicGroupId=" + musicGroupId;
-        classGroupIds =  highClassGroup.stream().map(e->e.getId().toString()).collect(Collectors.joining(","));
-        if(classGroupIds != null && !classGroupIds.isEmpty()){
-            url = baseURL + "/#/smallRegister?musicGroupId=" + musicGroupId+"&classGroupIds="+classGroupIds;
+        classGroupIds = highClassGroup.stream().map(e -> e.getId().toString()).collect(Collectors.joining(","));
+        if (classGroupIds != null && !classGroupIds.isEmpty()) {
+            url = baseURL + "/#/smallRegister?musicGroupId=" + musicGroupId + "&classGroupIds=" + classGroupIds;
         }
         String serverPhone = sysConfigDao.findConfigValue(SysConfigService.SERVER_PHONE);
         sysMessageService.batchSendMessage(MessageSender.JIGUANG, MessageTypeEnum.SMS_BASICS_SKILL_APPLY_MESSAGE,
@@ -1434,7 +1439,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
             //删除续费周期
             musicGroupStudentFeeDao.deleteByUserIdAndMusicGroupId(userId, musicGroupId);
             //删除缴费明细
-            musicGroupPaymentCalenderDetailDao.deleteByUserIdAndMusicGroupId(userId,musicGroupId);
+            musicGroupPaymentCalenderDetailDao.deleteByUserIdAndMusicGroupId(userId, musicGroupId);
             // 退团
             studentRegistration.setMusicGroupStatus(StudentMusicGroupStatusEnum.QUIT);
             studentRegistration.setUpdateTime(date);
@@ -1536,7 +1541,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
         //删除续费周期
         musicGroupStudentFeeDao.deleteByUserIdAndMusicGroupId(userId, musicGroupId);
         //删除缴费明细
-        musicGroupPaymentCalenderDetailDao.deleteByUserIdAndMusicGroupId(userId,musicGroupId);
+        musicGroupPaymentCalenderDetailDao.deleteByUserIdAndMusicGroupId(userId, musicGroupId);
 
         // 退团
         studentRegistration.setMusicGroupStatus(StudentMusicGroupStatusEnum.QUIT);