Browse Source

班级合并

zouxuan 3 years ago
parent
commit
31789bb4b6

+ 16 - 3
mec-biz/src/main/java/com/ym/mec/biz/service/impl/ClassGroupServiceImpl.java

@@ -4348,6 +4348,19 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
         Map<Integer, Integer> studentCLassMap = new HashMap<>();
         List<Map<Integer, BigDecimal>> surplusCourseFeeMapList = new ArrayList<>();
         List<Map<String, String>> classGroupStudents = (List<Map<String, String>>) JSON.parse(classGroupStudentMap);
+        //班级列表
+        List<Integer> classGroupIds = classGroupStudents.stream().map(e -> Integer.parseInt(e.keySet().iterator().next())).collect(Collectors.toList());
+        classGroupIds.add(masterClassGroupId);
+        List<ClassGroup> byClassGroupIds = classGroupDao.findByClassGroupIds(classGroupIds, null);
+        long count = byClassGroupIds.stream().map(e -> e.getMusicGroupId()).distinct().count();
+        if(count > 1){
+            //获取分布默认的课程类型单价
+            MusicGroup musicGroup = musicGroupDao.findByClassGroupId(masterClassGroupId);
+            //主班乐团不能是系统收费团
+            if(musicGroup.getCourseViewType() == CourseViewTypeEnum.MEMBER_FEE){
+                throw new BizException("操作失败:主班乐团不能是系统收费团");
+            }
+        }
         //学员剩余课程价值
         Map<Integer, BigDecimal> classGroupTotalPrice = new HashMap<>();
         //主班剩余课程价值
@@ -4426,9 +4439,9 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
         //获取分布默认的课程类型单价
         MusicGroup musicGroup = musicGroupDao.findByClassGroupId(masterClassGroupId);
         //主班乐团不能是系统收费团
-        if(musicGroup.getCourseViewType() == CourseViewTypeEnum.MEMBER_FEE){
-            throw new BizException("操作失败:主班乐团不能是系统收费团");
-        }
+//        if(musicGroup.getCourseViewType() == CourseViewTypeEnum.MEMBER_FEE){
+//            throw new BizException("操作失败:主班乐团不能是系统收费团");
+//        }
         Map<String, BigDecimal> unitPriceMap = MapUtil.convertIntegerMap(organizationCourseUnitPriceSettingsDao.queryMapByOrganIdAndChargeTypeId(musicGroup.getChargeTypeId(), musicGroup.getOrganId()));
         Set<String> masterKeySet = masterMap.keySet();
         //计算主班课程类型剩余价值