Browse Source

Merge branch 'master' of http://git.dayaedu.com/yonge/mec

yonge 4 năm trước cách đây
mục cha
commit
9ea1cead6b

+ 1 - 1
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/ClassGroupDao.java

@@ -603,7 +603,7 @@ public interface ClassGroupDao extends BaseDAO<Integer, ClassGroup> {
      * @author Joburgess
      * @date 2019/11/21
      */
-    List<ClassGroup> findByClassGroupIds(@Param("classGroupIds") List<Integer> classGroupIds);
+    List<ClassGroup> findByClassGroupIds(@Param("classGroupIds") List<Integer> classGroupIds, @Param("lockFlag") Integer lockFlag);
 
     List<ImGroupModel> queryStudentGroup();
 

+ 1 - 1
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/CourseScheduleDao.java

@@ -170,7 +170,7 @@ public interface CourseScheduleDao extends BaseDAO<Long, CourseSchedule> {
      * @param courseIds:
      * @return java.util.List<java.lang.Long>
      */
-    List<Map<Long, Integer>> countCourseMergeCourseNum(@Param("courseIds") List<Long> courseIds);
+    List<Map<Long, Long>> countCourseMergeCourseNum(@Param("courseIds") List<Long> courseIds);
 
 
     /**

+ 0 - 11
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/MusicGroupStudentClassAdjust.java

@@ -40,9 +40,6 @@ public class MusicGroupStudentClassAdjust {
 	@ApiModelProperty(value = "每个班级对应的学员", required = false)
 	private String classGroupStudents;
 
-	@ApiModelProperty(value = "是否排课", required = false)
-	private boolean courseFlag;
-
 	private Integer operatorId;
 
 	private Date createTime;
@@ -130,14 +127,6 @@ public class MusicGroupStudentClassAdjust {
 		this.studentPaymentIds = studentPaymentIds;
 	}
 
-	public boolean isCourseFlag() {
-		return courseFlag;
-	}
-
-	public void setCourseFlag(boolean courseFlag) {
-		this.courseFlag = courseFlag;
-	}
-
 	public String getNewClassGroupJson() {
 		return newClassGroupJson;
 	}

+ 0 - 7
mec-biz/src/main/java/com/ym/mec/biz/service/ClassGroupService.java

@@ -386,13 +386,6 @@ public interface ClassGroupService extends BaseService<Integer, ClassGroup> {
      */
     Boolean checkSetSalary(String musicGroupId);
 
-    /**
-     * 根据classGroupIds获取班级列表
-     * @param classGroupIds
-     * @return
-     */
-    List<ClassGroup> findByClassGroupIds(List<Integer> classGroupIds);
-
     boolean updateTotalClassTimes(Integer classGroupId, Integer num);
 
     /**

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

@@ -168,8 +168,6 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
     @Autowired
     private MusicGroupPaymentCalenderService musicGroupPaymentCalenderService;
     @Autowired
-    private MusicGroupPaymentCalenderDetailService musicGroupPaymentCalenderDetailService;
-    @Autowired
     private IdGeneratorService idGeneratorService;
     @Autowired
     private MusicGroupStudentClassAdjustDao musicGroupStudentClassAdjustDao;
@@ -362,7 +360,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
 
     @Override
     @Transactional(rollbackFor = Exception.class)
-    public ClassGroup addMixClassGroup(String musicGroupId, String name, String classGroupIds) throws Exception {
+    public ClassGroup addMixClassGroup(String musicGroupId, String name, String classGroupIds){
         Date date;
         date = new Date();
 
@@ -3264,11 +3262,6 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
         return false;
     }
 
-    @Override
-    public List<ClassGroup> findByClassGroupIds(List<Integer> classGroupIds) {
-        return classGroupDao.findByClassGroupIds(classGroupIds);
-    }
-
     public Boolean batchAddImGroup(List<ClassGroupImGroupDto> classGroupImGroupList) {
 
         MusicGroup musicGroup = musicGroupDao.get(classGroupImGroupList.get(0).getClassGroup().getMusicGroupId());
@@ -3696,7 +3689,6 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
         //记录申请信息
         MusicGroupStudentClassAdjust musicGroupStudentClassAdjust = new MusicGroupStudentClassAdjust();
         musicGroupStudentClassAdjust.setBatchNo(batchNo);
-        musicGroupStudentClassAdjust.setCourseFlag(false);
         musicGroupStudentClassAdjust.setMusicGroupId(musicGroup.getId());
         musicGroupStudentClassAdjust.setOperatorId(sysUser.getId());
         musicGroupStudentClassAdjust.setNewClassGroupJson(JSON.toJSONString(classGroup4MixDtos));
@@ -3718,9 +3710,6 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
         musicGroupStudentClassAdjust.setStudentPaymentIds(JSON.toJSONString(studentPaymentIds));
         //计算新增班级的可排课时长,总课次*默认时长  (用学员剩余的课程时长加上购买的时长,可能导致同一班级学员时长不一致)
         musicGroupStudentClassAdjust.setClassCourseMinute(JSON.toJSONString(findClassCourseMinuteMap(classGroupIds)));
-        if(status == null || status != AUDITING){
-            musicGroupStudentClassAdjust.setCourseFlag(true);
-        }
         musicGroupStudentClassAdjustDao.insert(musicGroupStudentClassAdjust);
         //如果需要审核,校验参数配置
         checkMergeClassSplitClassAffirmParam(mergeClassSplitClassAffirmDto);
@@ -3783,17 +3772,20 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
         if(classGroupIds == null || classGroupIds.size() == 0){
             throw new BizException("请填写班级信息");
         }
+        //所选班级列表,是否包含已冻结的班级
+        List<ClassGroup> lockClassGroupIds = classGroupDao.findByClassGroupIds(classGroupIds, 1);
+        if(lockClassGroupIds != null && lockClassGroupIds.size() > 0){
+            throw new BizException("所选班级有审核中的合班申请");
+        }
         for (Integer classGroupId : classGroupIds) {
-            List<CourseSchedule> courseSchedules = courseScheduleService.classGroupNotStartMergeCourseReplace(classGroupId.longValue());
+            List<CourseSchedule> courseSchedules = courseScheduleDao.findCoursesByClassGroupId(classGroupId,CourseStatusEnum.NOT_START);
             if(courseSchedules != null && courseSchedules.size() > 0){
                 throw new BizException("所选班级不能有未开始的临时合并课程");
             }
         }
-
         List<Integer> allTeacherIds = classGroupTeacherMapperList.stream()
                 .map(ClassGroupTeacherMapper::getUserId)
                 .collect(Collectors.toList());
-
         //所有教师列表
         List<Teacher> teachers = teacherDao.findByTeacherIds(allTeacherIds);
         Map<Integer, Teacher> teacherMap = teachers.stream()

+ 2 - 5
mec-biz/src/main/java/com/ym/mec/biz/service/impl/ClassGroupStudentMapperServiceImpl.java

@@ -13,6 +13,7 @@ import java.util.Objects;
 import java.util.Set;
 import java.util.stream.Collectors;
 
+import com.ym.mec.biz.dal.enums.*;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Isolation;
@@ -36,10 +37,6 @@ import com.ym.mec.biz.dal.entity.CourseScheduleStudentPayment;
 import com.ym.mec.biz.dal.entity.CourseScheduleTeacherSalary;
 import com.ym.mec.biz.dal.entity.StudentRegistration;
 import com.ym.mec.biz.dal.entity.TeacherDefaultMusicGroupSalary;
-import com.ym.mec.biz.dal.enums.ClassGroupStudentStatusEnum;
-import com.ym.mec.biz.dal.enums.ClassGroupTypeEnum;
-import com.ym.mec.biz.dal.enums.GroupType;
-import com.ym.mec.biz.dal.enums.YesOrNoEnum;
 import com.ym.mec.biz.service.ClassGroupRelationService;
 import com.ym.mec.biz.service.ClassGroupService;
 import com.ym.mec.biz.service.ClassGroupStudentMapperService;
@@ -454,7 +451,7 @@ public class ClassGroupStudentMapperServiceImpl extends BaseServiceImpl<Long, Cl
 
         classGroupService.updateClassStudentNum(classGroupId.intValue(), allStudentIds.size());
 
-        List<CourseSchedule> classGroupNotStartCourse = courseScheduleService.classGroupNotStartMergeCourseReplace(classGroupId);
+        List<CourseSchedule> classGroupNotStartCourse = courseScheduleDao.findCoursesByClassGroupId(classGroupId.intValue(), CourseStatusEnum.NOT_START);
         if(CollectionUtils.isEmpty(classGroupNotStartCourse)){
             return;
         }

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

@@ -4447,8 +4447,8 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
                 idPracticeMap = practiceGroups.stream().collect(Collectors.toMap(PracticeGroup::getId, e->e));
 			}
 
-			List<Map<Long, Integer>> courseMergeCourseNum = courseScheduleDao.countCourseMergeCourseNum(courseScheduleIds);
-			Map<Long, Integer> courseMergeCourseNumMap = new HashMap<>();
+			List<Map<Long, Long>> courseMergeCourseNum = courseScheduleDao.countCourseMergeCourseNum(courseScheduleIds);
+			Map<Long, Long> courseMergeCourseNumMap = new HashMap<>();
 			if(!CollectionUtils.isEmpty(courseMergeCourseNum)){
 				courseMergeCourseNumMap = MapUtil.convertIntegerMap(courseMergeCourseNum);
 			}
@@ -5076,7 +5076,7 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 	@Transactional(rollbackFor = Exception.class)
 	public void batchUpdateClassTeacher(List<Integer> classGroupIds,Integer oldTeacherId,Integer newTeacherId){
 		//修改班级老师
-		List<ClassGroup> classGroupList = classGroupDao.findByClassGroupIds(classGroupIds);
+		List<ClassGroup> classGroupList = classGroupDao.findByClassGroupIds(classGroupIds,null);
 		classGroupList.forEach(e->{
 			e.setUserIds(newTeacherId.toString());
 		});

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

@@ -209,6 +209,9 @@ public class DegreeRegistrationServiceImpl extends BaseServiceImpl<Integer, Degr
                 if(additionCourseInfo.containsKey(CourseSchedule.CourseScheduleType.VIP)){
                     historyVipNum = historyVipNum + additionCourseInfo.get(CourseSchedule.CourseScheduleType.VIP);
                 }
+                if(additionCourseInfo.containsKey(CourseSchedule.CourseScheduleType.HIGH)){
+                    historyHighNum = historyHighNum + additionCourseInfo.get(CourseSchedule.CourseScheduleType.HIGH);
+                }
                 boolean vipMoreThan2 = historyVipNum>=2;
                 if(vipMoreThan2){
                     if(FREE_PRICE_LEVEL.contains(degreeRegistration.getLevel())){
@@ -218,7 +221,7 @@ public class DegreeRegistrationServiceImpl extends BaseServiceImpl<Integer, Degr
                     }
                     highUnitPrice = practiceGroupSellPrice.getHighOnlineTenCourseActivityPriceWithNewUser();
                 }
-                if(vipMoreThan2&&additionCourseInfo.containsKey(CourseSchedule.CourseScheduleType.HIGH)){
+                if(vipMoreThan2&&historyHighNum>0){
                     degreeRegistration.setTheoryMoney(BigDecimal.ZERO);
                 }
             }else{

+ 0 - 2
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupPaymentCalenderServiceImpl.java

@@ -952,7 +952,6 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 			classGroup4MixDto.setCourseTimeDtoList(courseTimeDtos);
 			classGroupService.classGroupAdjust2(classGroup4MixDto);
 		}
-		musicGroupStudentClassAdjust.setCourseFlag(true);
 		//排课完成后删除所选课程
 		List<Long> courseIds = JSON.parseArray(musicGroupStudentClassAdjust.getSubLockCourseIds(), Long.class);
 		List<Integer> studentIds = JSON.parseArray(musicGroupStudentClassAdjust.getStudentIds(), Integer.class);
@@ -963,7 +962,6 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 		//解冻班级
 		List<Integer> classGroupIds = JSON.parseArray(musicGroupStudentClassAdjust.getClassGroupIds(), Integer.class);
 		classGroupDao.batchUpdateLockByClassGroupIds(classGroupIds,0);
-		musicGroupStudentClassAdjust.setCourseFlag(true);
 		//删除班级学员
 		musicGroupStudentClassAdjustDao.update(musicGroupStudentClassAdjust);
 		String classGroupStudents = musicGroupStudentClassAdjust.getClassGroupStudents();

+ 2 - 13
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentRegistrationServiceImpl.java

@@ -17,6 +17,7 @@ import java.util.stream.Collectors;
 import javax.annotation.Resource;
 
 import com.ym.mec.biz.dal.dao.*;
+import com.ym.mec.biz.dal.enums.*;
 import com.ym.mec.util.date.DateUtil;
 import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
@@ -59,18 +60,6 @@ import com.ym.mec.biz.dal.entity.Subject;
 import com.ym.mec.biz.dal.entity.SubjectChange;
 import com.ym.mec.biz.dal.entity.SysUserCashAccount;
 import com.ym.mec.biz.dal.entity.SysUserCashAccountDetail;
-import com.ym.mec.biz.dal.enums.ClassGroupStudentStatusEnum;
-import com.ym.mec.biz.dal.enums.ClassGroupTypeEnum;
-import com.ym.mec.biz.dal.enums.DealStatusEnum;
-import com.ym.mec.biz.dal.enums.GoodsType;
-import com.ym.mec.biz.dal.enums.GroupType;
-import com.ym.mec.biz.dal.enums.KitGroupPurchaseTypeEnum;
-import com.ym.mec.biz.dal.enums.MessageTypeEnum;
-import com.ym.mec.biz.dal.enums.OrderDetailTypeEnum;
-import com.ym.mec.biz.dal.enums.OrderTypeEnum;
-import com.ym.mec.biz.dal.enums.PaymentStatusEnum;
-import com.ym.mec.biz.dal.enums.PlatformCashAccountDetailTypeEnum;
-import com.ym.mec.biz.dal.enums.StudentMusicGroupStatusEnum;
 import com.ym.mec.biz.dal.page.StudentRegistrationQueryInfo;
 import com.ym.mec.biz.service.ClassGroupService;
 import com.ym.mec.biz.service.ClassGroupStudentMapperService;
@@ -1293,7 +1282,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
         Map<CourseSchedule.CourseScheduleType, Integer> courseTypeCourseDurationMap = new HashMap<>();
         Map<CourseSchedule.CourseScheduleType, List<CourseSchedule>> typeCourseMap = new HashMap<>();
         if(Objects.nonNull(classGroupId)){
-            List<CourseSchedule> classGroupNotStartCourse = courseScheduleService.classGroupNotStartMergeCourseReplace(classGroupId);
+            List<CourseSchedule> classGroupNotStartCourse = courseScheduleDao.findCoursesByClassGroupId(classGroupId.intValue(), CourseStatusEnum.NOT_START);
             typeCourseMap = classGroupNotStartCourse.stream().collect(Collectors.groupingBy(CourseSchedule::getType));
             for (Map.Entry<CourseSchedule.CourseScheduleType, List<CourseSchedule>> typeCoursesEntry : typeCourseMap.entrySet()) {
                 int totalCourseDuration = 0;

+ 4 - 0
mec-biz/src/main/resources/config/mybatis/ClassGroupMapper.xml

@@ -18,6 +18,7 @@
         <result column="update_time_" property="updateTime"/>
         <result column="type_" property="type" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
         <result column="del_flag_" property="delFlag"/>
+        <result column="lock_flag_" property="lockFlag"/>
         <result column="expect_student_num_" property="expectStudentNum"/>
         <result column="total_class_times_" property="totalClassTimes"/>
         <result column="img_" property="img"/>
@@ -1074,6 +1075,9 @@
       <foreach collection="classGroupIds" item="classGroupId" open="(" close=")" separator=",">
           #{classGroupId}
       </foreach>
+      <if test="lockFlag != null">
+          lock_flag_ = #{lockFlag}
+      </if>
     </select>
 
     <resultMap id="ImGroupModelMap" type="com.ym.mec.common.entity.ImGroupModel">

+ 2 - 6
mec-biz/src/main/resources/config/mybatis/MusicGroupStudentClassAdjustMapper.xml

@@ -18,7 +18,6 @@
 		<result column="sub_lock_course_ids_" property="subLockCourseIds" />
 		<result column="student_payment_ids_" property="studentPaymentIds" />
 		<result column="class_group_students_" property="classGroupStudents" />
-		<result column="course_flag_" property="courseFlag" />
 		<result column="operator_id_" property="operatorId" />
 		<result column="create_time_" property="createTime" />
 		<result column="update_time_" property="updateTime" />
@@ -38,9 +37,9 @@
 	<insert id="insert" parameterType="com.ym.mec.biz.dal.entity.MusicGroupStudentClassAdjust" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
 		INSERT INTO music_group_student_class_adjust (music_group_id_,batch_no_,new_class_group_json_,
 		class_group_ids_,student_ids_,class_course_minute_,all_lock_course_ids_,sub_lock_course_ids_,
-		course_flag_,operator_id_,student_payment_ids_,class_group_students_,create_time_,update_time_)
+		operator_id_,student_payment_ids_,class_group_students_,create_time_,update_time_)
 		VALUES(#{musicGroupId},#{batchNo},#{newClassGroupJson},#{classGroupIds},#{studentIds},
-		#{classCourseMinute},#{allLockCourseIds},#{subLockCourseIds},#{courseFlag},#{operatorId},#{studentPaymentIds},#{classGroupStudents},NOW(),NOW())
+		#{classCourseMinute},#{allLockCourseIds},#{subLockCourseIds},#{operatorId},#{studentPaymentIds},#{classGroupStudents},NOW(),NOW())
 	</insert>
 	
 	<!-- 根据主键查询一条记录 -->
@@ -52,9 +51,6 @@
 		<if test="studentPaymentIds != null">
 			student_payment_ids_ = #{studentPaymentIds},
 		</if>
-		<if test="courseFlag != null">
-		course_flag_ = #{courseFlag},
-		</if>
 		<if test="allLockCourseIds != null">
 		all_lock_course_ids_ = #{allLockCourseIds},
 		</if>