Explorar o código

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

zouxuan %!s(int64=5) %!d(string=hai) anos
pai
achega
0930d80447

+ 10 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/ClassGroupStudentMapperDao.java

@@ -33,6 +33,16 @@ public interface ClassGroupStudentMapperDao extends BaseDAO<Long, ClassGroupStud
     ClassGroupStudentMapper query(@Param("classGroupId") int classGroupId, @Param("userId") Integer userId);
 
     /**
+     * @describe 获取班级上的学员
+     * @author Joburgess
+     * @date 2019/12/18
+     * @param classGroupId: 班级编号
+     * @param userId: 学员编号
+     * @return com.ym.mec.biz.dal.entity.ClassGroupStudentMapper
+     */
+    ClassGroupStudentMapper findClassGroupStudent(@Param("classGroupId") int classGroupId, @Param("userId") Integer userId);
+
+    /**
      * 根据乐团编号删除指定学生
      *
      * @param musicGroupId 乐团编号

+ 1 - 1
mec-biz/src/main/java/com/ym/mec/biz/dal/enums/ClassGroupStudentStatusEnum.java

@@ -3,7 +3,7 @@ package com.ym.mec.biz.dal.enums;
 import com.ym.mec.common.enums.BaseEnum;
 
 public enum ClassGroupStudentStatusEnum implements BaseEnum<String, ClassGroupStudentStatusEnum> {
-    NORMAL("NORMAL", "在读"), LEAVE("LEAVE", "请假"), QUIT("QUIT", "退班");
+    NORMAL("NORMAL", "在读"), LEAVE("LEAVE", "请假"), QUIT("QUIT", "退班"), QUIT_SCHOOL("QUIT_SCHOOL","休学");
 
     private String code;
 

+ 10 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/VipGroupService.java

@@ -229,6 +229,16 @@ public interface VipGroupService extends BaseService<Long, VipGroup> {
 	void applyRefundForStudent(Long vipGroupId, Integer studentId, BigDecimal amount);
 
 	/**
+	 * @describe 对某个学生退学
+	 * @author Joburgess
+	 * @date 2019/12/18
+	 * @param vipGroupId: vip课编号
+	 * @param studentId: 学生编号
+	 * @return void
+	 */
+	void quitForStudent(Long vipGroupId, Integer studentId);
+
+	/**
 	 * @describe 获取指定学生的剩余课时费用
 	 * @author Joburgess
 	 * @date 2019/11/15

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

@@ -530,7 +530,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
 
         Integer userId = studentRegistration.getUserId();
         
-        StudentPaymentOrder ApplyOrder = studentPaymentOrderService.findMusicGroupApplyOrderByStatus(userId, studentRegistration.getMusicGroupId().toString(), DealStatusEnum.ING);
+        StudentPaymentOrder ApplyOrder = studentPaymentOrderService.findMusicGroupApplyOrderByStatus(userId, studentRegistration.getMusicGroupId(), DealStatusEnum.ING);
         if (ApplyOrder == null) {
             throw new BizException("没有支付中的订单,请勿非法请求");
         }

+ 56 - 2
mec-biz/src/main/java/com/ym/mec/biz/service/impl/VipGroupServiceImpl.java

@@ -1271,8 +1271,62 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 
         courseScheduleTeacherSalaryService.updateVipGroupCourseTeacherSalary(vipGroupId.intValue(),-1);
 
-//		classGroup.setStudentNum(classGroupStudentMapperDao.countClassGroupStudentNum(classGroup.getId()));
-//		classGroupDao.update(classGroup);
+		//学员退出班级群
+		ImGroupMember[] imGroupMembers = new ImGroupMember[]{new ImGroupMember(studentId.toString())};
+		imFeignService.groupJoin(new ImGroupModel(classGroup.getId().toString(), imGroupMembers, null));
+	}
+
+	@Override
+	@Transactional(rollbackFor = Exception.class)
+	public void quitForStudent(Long vipGroupId, Integer studentId) {
+		if(Objects.isNull(vipGroupId)||Objects.isNull(studentId)){
+			throw new BizException("请指定小课与学生");
+		}
+		VipGroup vipGroup=vipGroupDao.get(vipGroupId);
+		if(Objects.isNull(vipGroup)){
+			throw new BizException("指定的课程不存在");
+		}
+		if(vipGroup.getStatus().equals(VipGroupStatusEnum.CANCEL)){
+			throw new BizException("不能对已停止的课程进行此操作");
+		}
+		if(vipGroup.getStatus().equals(VipGroupStatusEnum.FINISHED)){
+			throw new BizException("此课程已结束");
+		}
+		List<StudentApplyRefunds> studentApplyRefunds = studentApplyRefundsDao.findByGroupAndUser(vipGroupId.toString(), GroupType.VIP.getCode(), studentId);
+		if(!CollectionUtils.isEmpty(studentApplyRefunds)){
+			throw new BizException("此学生存在退课申请,请到系统日志中查看");
+		}
+
+		ClassGroup classGroup = classGroupDao.findByVipGroup(vipGroupId, null);
+
+		ClassGroupStudentMapper classStudentMapperByUserIdAndClassGroupId = classGroupStudentMapperDao.query(classGroup.getId(),
+				studentId);
+
+		if(Objects.isNull(classStudentMapperByUserIdAndClassGroupId)){
+			throw new BizException("指定学生不在此课程中");
+		}
+
+		if(classStudentMapperByUserIdAndClassGroupId.getStatus().equals(ClassGroupStudentStatusEnum.QUIT)){
+			throw new BizException("当前学生已经退学");
+		}
+
+		if(classStudentMapperByUserIdAndClassGroupId.getStatus().equals(ClassGroupStudentStatusEnum.QUIT_SCHOOL)){
+			throw new BizException("当前学生已是休学状态");
+		}
+
+//		sysUserCashAccountService.updateBalance(studentId, amount);
+
+		classStudentMapperByUserIdAndClassGroupId.setStatus(ClassGroupStudentStatusEnum.QUIT_SCHOOL);
+		classGroupStudentMapperDao.update(classStudentMapperByUserIdAndClassGroupId);
+
+		courseScheduleService.batchDeleteMusicGroupCourseWithStudent(vipGroupId.toString(),studentId,GroupType.VIP);
+
+		List<Integer> studentPaymentIds = courseScheduleStudentPaymentDao.findNotStartCourseStudentPaymentIdsWithClassGroupAndStudent(classGroup.getId(), studentId);
+		if(!CollectionUtils.isEmpty(studentPaymentIds)){
+			courseScheduleStudentPaymentDao.batchDeleteWithID(studentPaymentIds);
+		}
+
+		courseScheduleTeacherSalaryService.updateVipGroupCourseTeacherSalary(vipGroupId.intValue(),-1);
 
 		//学员退出班级群
 		ImGroupMember[] imGroupMembers = new ImGroupMember[]{new ImGroupMember(studentId.toString())};

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

@@ -88,6 +88,11 @@
 		SELECT * FROM class_group_student_mapper
 		where class_group_id_ = #{classGroupId} and user_id_ = #{userId}  AND status_ != 'QUIT'
 	</select>
+
+    <select id="findClassGroupStudent" resultMap="ClassGroupStudentMapper">
+		SELECT * FROM class_group_student_mapper
+		where class_group_id_ = #{classGroupId} and user_id_ = #{userId}
+	</select>
     <select id="findStudentNumByClassGroupId" resultType="string">
         SELECT
             su.username_

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

@@ -1374,7 +1374,7 @@
             cs.schoole_id_
         FROM
             course_schedule cs
-        WHERE cs.class_date_=DATE_FORMAT(#{date},'%Y-%m-%d')
+        WHERE cs.class_date_&lt;=DATE_FORMAT(#{date},'%Y-%m-%d')
         AND cs.group_type_='MUSIC'
         AND (cs.del_flag_ IS NULL OR cs.del_flag_=0)
     </select>

+ 1 - 1
mec-thirdparty/src/main/java/com/ym/mec/thirdparty/eseal/provider/TsignPlugin.java

@@ -58,7 +58,7 @@ public class TsignPlugin implements ESealPlugin, InitializingBean, DisposableBea
 		projectconfig.setItsmApiUrl(apisUrl);
 		Result result = ServiceClientManager.registClient(projectconfig, null, null);
 		if (result.getErrCode() != 0) {
-			throw new ThirdpartyException("e签宝客户端注册失败");
+			throw new ThirdpartyException("e签宝客户端注册失败:{}", result.getMsg());
 		}
 
 		serviceClient = ServiceClientManager.get(projectId);