zouxuan %!s(int64=4) %!d(string=hai) anos
pai
achega
df1eeb24db

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

@@ -3707,7 +3707,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
         Integer masterClassGroupId = mergeClassSplitClassAffirmDto.getMasterClassGroupId();
         //学员列表
         List<Integer> studentIds = mergeClassSplitClassAffirmDto.getStudentIds();
-        //主班是否包含所选学员学员
+        //主班是否包含所选学员列表
         Boolean hasStudent = classGroupStudentMapperDao.hasStudent(masterClassGroupId,studentIds);
         if(hasStudent){
             throw new BizException("操作失败: 主班包含部分已选学员");

+ 14 - 11
mec-biz/src/main/java/com/ym/mec/biz/service/impl/ClassGroupStudentMapperServiceImpl.java

@@ -560,23 +560,26 @@ public class ClassGroupStudentMapperServiceImpl extends BaseServiceImpl<Long, Cl
 
         Date now = new Date();
         List<ClassGroupStudentMapper> classGroupStudentMappers = new ArrayList<>();
-        //获取分布默认的课程类型单价
-//        MusicGroup musicGroup = musicGroupDao.findByClassGroupId(classGroupId.intValue());
-//        Map<String, BigDecimal> unitPriceMap = MapUtil.convertIntegerMap(organizationCourseUnitPriceSettingsDao.queryMapByOrganIdAndChargeTypeId(musicGroup.getChargeTypeId(), musicGroup.getOrganId()));
 
         BigDecimal divide = masterTotalPrice.divide(new BigDecimal(classGroupNotStartCourse.size()), 2, BigDecimal.ROUND_HALF_UP);
         BigDecimal decimal = divide.multiply(new BigDecimal(classGroupNotStartCourse.size()));
 
         //生成班级关联
         for (Integer studentId : studentIds) {
-            ClassGroupStudentMapper classGroupStudentMapper = new ClassGroupStudentMapper();
-            classGroupStudentMapper.setMusicGroupId(classGroup.getMusicGroupId());
-            classGroupStudentMapper.setClassGroupId(classGroupId.intValue());
-            classGroupStudentMapper.setUserId(studentId);
-            classGroupStudentMapper.setCreateTime(now);
-            classGroupStudentMapper.setStatus(ClassGroupStudentStatusEnum.NORMAL);
-            classGroupStudentMapper.setGroupType(GroupType.MUSIC);
-            classGroupStudentMappers.add(classGroupStudentMapper);
+            ClassGroupStudentMapper classGroupStudent = classGroupStudentMapperDao.findClassGroupStudent(classGroupId.intValue(), studentId);
+            if(classGroupStudent != null){
+                classGroupStudent.setStatus(ClassGroupStudentStatusEnum.NORMAL);
+                classGroupStudentMapperDao.update(classGroupStudent);
+            }else {
+                ClassGroupStudentMapper classGroupStudentMapper = new ClassGroupStudentMapper();
+                classGroupStudentMapper.setMusicGroupId(classGroup.getMusicGroupId());
+                classGroupStudentMapper.setClassGroupId(classGroupId.intValue());
+                classGroupStudentMapper.setUserId(studentId);
+                classGroupStudentMapper.setCreateTime(now);
+                classGroupStudentMapper.setStatus(ClassGroupStudentStatusEnum.NORMAL);
+                classGroupStudentMapper.setGroupType(GroupType.MUSIC);
+                classGroupStudentMappers.add(classGroupStudentMapper);
+            }
             //生成课程关联
             for (int i = 0; i < classGroupNotStartCourse.size(); i++) {
                 CourseSchedule courseSchedule = classGroupNotStartCourse.get(i);

+ 1 - 1
mec-biz/src/main/resources/config/mybatis/ClassGroupStudentMapperMapper.xml

@@ -583,7 +583,7 @@
 
     <select id="hasStudent" resultType="java.lang.Boolean">
         SELECT COUNT(DISTINCT class_group_id_) FROM class_group_student_mapper
-        WHERE class_group_id_ = #{masterClassGroupId} AND user_id_ IN
+        WHERE class_group_id_ = #{masterClassGroupId} AND status_ != 'QUIT' AND user_id_ IN
         <foreach collection="studentIds" separator="," open="(" close=")" item="item">
             #{item}
         </foreach>