Browse Source

Merge remote-tracking branch 'origin/master'

Joburgess 5 years ago
parent
commit
afdc13a2e9

+ 10 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/SysMessageConfig.java

@@ -28,6 +28,16 @@ public class SysMessageConfig {
 	
 	private String group;
 
+	private Integer sendFlag;
+
+	public Integer getSendFlag() {
+		return sendFlag;
+	}
+
+	public void setSendFlag(Integer sendFlag) {
+		this.sendFlag = sendFlag;
+	}
+
 	public void setId(Integer id) {
 		this.id = id;
 	}

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

@@ -7,6 +7,7 @@ public enum MessageTypeEnum implements BaseEnum<String, MessageTypeEnum> {
     PUSH_STUDENT_VIP_STOP("PUSH_STUDENT_VIP_STOP", "VIP课取消"),
     PUSH_TEACHER_VIP_STOP("PUSH_TEACHER_VIP_STOP", "VIP课取消"),
     SMS_MUSIC_GROUP_ADD_STUDENT("SMS_MUSIC_GROUP_ADD_STUDENT", "入团通知"),
+    SMS_MUSIC_GROUP_ADD_STUDENT_FREE("SMS_MUSIC_GROUP_ADD_STUDENT_FREE", "入团通知"),
     SMS_VERIFY_CODE_LOGIN("SMS_VERIFY_CODE_LOGIN", "验证码登录"),
     SMS_PAYMENT_MESSAGE("SMS_PAYMENT_MESSAGE", "缴费通知"),
     SMS_PAYMENT_SUCCESS("SMS_PAYMENT_SUCCESS", "缴费成功"),

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

@@ -3,6 +3,7 @@ package com.ym.mec.biz.service.impl;
 import com.ym.mec.biz.dal.dao.*;
 import com.ym.mec.biz.dal.dto.ClassGroupTeachersDto;
 import com.ym.mec.biz.dal.entity.*;
+import com.ym.mec.biz.dal.enums.CourseStatusEnum;
 import com.ym.mec.biz.dal.enums.GroupType;
 import com.ym.mec.biz.dal.enums.SalarySettlementTypeEnum;
 import com.ym.mec.biz.dal.enums.TeachTypeEnum;
@@ -49,6 +50,8 @@ public class ClassGroupTeacherMapperServiceImpl extends BaseServiceImpl<Long, Cl
     private MusicGroupService musicGroupService;
     @Autowired
     private TeacherAttendanceDao teacherAttendanceDao;
+    @Autowired
+    private CourseScheduleDao courseScheduleDao;
 
     @Override
     public BaseDAO<Long, ClassGroupTeacherMapper> getDAO() {
@@ -58,6 +61,13 @@ public class ClassGroupTeacherMapperServiceImpl extends BaseServiceImpl<Long, Cl
     @Override
     @Transactional(rollbackFor = Exception.class)
     public int classGroupTeachersInsert(List<ClassGroupTeacherMapper> classGroupTeacherMapperList) {
+        String musicGroupId = classGroupTeacherMapperList.get(0).getMusicGroupId();
+
+        //删除老师未开始的课程
+        List<CourseSchedule> musicGroupCourseSchedules = courseScheduleDao.findMusicGroupCourseSchedules(musicGroupId, GroupType.MUSIC.getCode(), CourseStatusEnum.NOT_START.getCode());
+        if(musicGroupCourseSchedules != null && musicGroupCourseSchedules.size() >0){
+            courseScheduleService.batchDeleteMusicGroupNotStartCourse(musicGroupId,GroupType.MUSIC);
+        }
         //老师加入群组
         List<ImGroupMember> imGroupMemberList = new ArrayList<>();
         String classGroupIds = classGroupTeacherMapperList.stream().map(classGroupTeacherMapper -> classGroupTeacherMapper.getClassGroupId().toString()).collect(Collectors.joining(","));

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

@@ -37,7 +37,7 @@ import java.util.stream.Stream;
 
 @Service
 public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSchedule>  implements CourseScheduleService {
-	
+
 	@Autowired
 	private CourseScheduleDao courseScheduleDao;
 	@Autowired
@@ -1091,7 +1091,7 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 		if(status == AuditStatusEnum.ING){
 			throw new BizException("审批状态不正确");
 		}
-		
+
 		CourseScheduleComplaints courseScheduleComplaints = courseScheduleComplaintsDao.get(id);
 		if (Objects.isNull(courseScheduleComplaints)) {
 			throw new BizException("投诉记录不存在");
@@ -1119,14 +1119,14 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 		if (studentAttendanceList != null && studentAttendanceList.size() > 0) {
 			studentAttendanceDao.addStudentAttendances(studentAttendanceList);
 		}
-		
+
 		//自动更新课程状态至“已结束”
 		List<CourseSchedule> list = courseScheduleDao.queryFinishedWithNoUpdateStatus();
 
 		List<CourseSchedule> updateList = new ArrayList<CourseSchedule>();
 		List<Integer> classGroupIds = new ArrayList<Integer>();
 		List<Long> courseScheduleIdList = new ArrayList<Long>();
-		
+
 		for (CourseSchedule courseSchedule : list) {
 			courseSchedule.setStatus(CourseStatusEnum.OVER);
 			courseSchedule.setUpdateTime(date);
@@ -1135,7 +1135,7 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 			if (!classGroupIds.contains(courseSchedule.getClassGroupId())) {
 				classGroupIds.add(courseSchedule.getClassGroupId());
 			}
-			
+
 			if(courseSchedule.getGroupType() == GroupType.VIP){
 				courseScheduleIdList.add(courseSchedule.getId());
 			}
@@ -1148,10 +1148,10 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 		// 更新班级已上课次
 		if (classGroupIds.size() > 0) {
 			classGroupService.batchIncreaseClassTimes(classGroupIds);
-			
+
 			//查询班级信息
 			List<ClassGroup> classGroupList = classGroupService.findClassGroupByIds(classGroupIds.stream().map(e->e.toString()).collect(Collectors.joining(",")));
-			
+
 			List<String> vipGroupIdList = new ArrayList<String>();
 			for(ClassGroup classGroup : classGroupList){
 				if(classGroup.getGroupType() == GroupType.VIP && classGroup.getCurrentClassTimes() == classGroup.getTotalClassTimes().intValue()){
@@ -1169,12 +1169,12 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 				vipGroupDao.batchUpdate(vipGroupList);
 			}
 		}
-		
+
 		if (courseScheduleIdList.size() > 0) {
 			// vip课自动签退
 			teacherAttendanceDao.updateViPSignOutStatus(courseScheduleIdList.stream().map(a -> a.toString()).collect(Collectors.joining(",")));
 		}
-		
+
 		return true;
 	}
 
@@ -1289,7 +1289,7 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 			for(Mapper mapper : mapperList){
 				Map<Integer, String> receivers = new HashMap<Integer, String>();
 				receivers.put((Integer) mapper.getKey(), mapper.getKey() + "");
-				
+
 				sysMessageService.batchSendMessage(MessageSender.JIGUANG, MessageTypeEnum.STUDENT_PUSH_ATTEND_COURSE_MESSAGE, receivers, null, 0, "2", mapper.getValue());
 			}
 		}

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

@@ -302,6 +302,13 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
 				studentRegistrationDao.batchInsert(studentRegistrationList);
 			}
             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();
+                if(size < 1){
+                    musicGroup.setStatus(MusicGroupStatusEnum.PREPARE);
+                }
+            }
             musicGroupDao.update(musicGroup);
             musicGroupBuildLogDao.insert(new MusicGroupBuildLog(musicGroupId, "跨团调整", sysUser.getId(),""));
         }
@@ -413,6 +420,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
         Date date = new Date();
 
         if(registerPayDto.getIsUseBalancePayment() || amount.doubleValue() == 0){
+            studentPaymentOrder.setPaymentChannel("BALANCE");
         	SysUserCashAccount userCashAccount = sysUserCashAccountService.getLocked(userId);
         	if(userCashAccount == null){
         		throw new BizException("用户账户找不到");
@@ -562,6 +570,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
         	if(userCashAccount == null){
         		throw new BizException("用户账户找不到");
         	}
+            studentPaymentOrder.setPaymentChannel("BALANCE");
         	if(userCashAccount.getBalance().subtract(amount).doubleValue() > 0){
         		// 更新订单信息
         		studentPaymentOrder.setBalancePaymentAmount(amount);
@@ -1263,12 +1272,12 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
         	if(userCashAccount == null){
         		throw new BizException("用户账户找不到");
         	}
+            studentPaymentOrder.setPaymentChannel("BALANCE");
         	if(userCashAccount.getBalance().subtract(amount).doubleValue() > 0){
         		// 更新订单信息
         		studentPaymentOrder.setBalancePaymentAmount(amount);
                 studentPaymentOrder.setStatus(DealStatusEnum.SUCCESS);
                 studentPaymentOrder.setUpdateTime(date);
-                studentPaymentOrder.setPaymentChannel("BALANCE");
                 studentPaymentOrderService.update(studentPaymentOrder);
                 
         		sysUserCashAccountService.updateBalance(userId, amount.negate(),PlatformCashAccountDetailTypeEnum.PAY_FEE,"乐团续费");
@@ -1280,7 +1289,6 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
                 musicGroupStudentFee.setTemporaryCourseFee(new BigDecimal(0));
                 musicGroupStudentFee.setNextPaymentDate(musicGroupPaymentCalenderService.getNextPaymentDate(musicGroupId));
                 musicGroupStudentFeeDao.update(musicGroupStudentFee);
-                
         		return null;
         	}else{
 				if (userCashAccount.getBalance().doubleValue() > 0) {
@@ -1609,8 +1617,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
         musicGroup.setPaymentExpireDate(DateUtil.toDate(expireDate));
         musicGroup.setStatus(MusicGroupStatusEnum.PAY);
         musicGroupDao.update(musicGroup);
-        //所有人开启缴费
-        studentRegistrationDao.musicGroupOpenPay(musicGroupId,PaymentStatusEnum.OPEN);
+
         //获取所有已报名学员列表
         HashMap<Integer,String> map = JSONObject.parseObject(JSONObject.toJSONString(MapUtil.convertMybatisMap(studentRegistrationDao.findMapByMusicGroupId(musicGroupId,0))), HashMap.class);
         if(map != null && map.size() > 0){
@@ -1625,6 +1632,8 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
 		roleIds.add(SysUserRole.OPERATION_EXECUTIVE);
 
         sysMessageService.batchSeoMessage(musicGroupDao.queryUserIdByRoleId(roleIds,musicGroup.getOrganId() + ""),MessageTypeEnum.BACKSTAGE_ACTION_PAYMENT,"",musicGroup.getName());
+        //所有人开启缴费
+        studentRegistrationDao.musicGroupOpenPay(musicGroupId,PaymentStatusEnum.OPEN);
         return musicGroup;
     }
 

+ 35 - 28
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentRegistrationServiceImpl.java

@@ -638,6 +638,12 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
                     studentRegistration.setPaymentStatus(PaymentStatusEnum.YES);
                     studentPaymentOrder.setActualAmount(reduce);
                     studentPaymentOrder.setPayTime(date);
+                }else {
+                    Map<Integer, String> receivers = new HashMap<>(1);
+                    receivers.put(studentRegistration.getUserId(), studentRegistration.getParentsPhone());
+                    String studentApplyUrl = sysConfigDao.findConfigValue(SysConfigService.STUDENT_APPLY_URL) + musicGroupId;
+                    sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.YIMEI, MessageTypeEnum.SMS_MUSIC_GROUP_ADD_STUDENT,
+                            receivers, null, 0, null, studentRegistration.getParentsName(), studentRegistration.getName(), musicGroup.getName(),HttpUtil.getSortUrl(studentApplyUrl));
                 }
                 studentPaymentOrder.setExpectAmount(reduce);
                 //当前学员是否以前存在过当前乐团
@@ -653,13 +659,17 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
                     e.setPaymentOrderId(studentPaymentOrder.getId());
                 });
                 studentPaymentOrderDetailService.batchAdd(studentPaymentOrderDetails);
+                Map<Integer, String> receivers = new HashMap<>(1);
+                receivers.put(studentRegistration.getUserId(), studentRegistration.getParentsPhone());
+                if (reduce == BigDecimal.ZERO) {
+                    sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.YIMEI, MessageTypeEnum.SMS_MUSIC_GROUP_ADD_STUDENT_FREE,
+                            receivers, null, 0, null, studentRegistration.getParentsName(), studentRegistration.getName(), musicGroup.getName());
+                }else {
+                    String studentApplyUrl = sysConfigDao.findConfigValue(SysConfigService.STUDENT_APPLY_URL) + musicGroupId;
+                    sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.YIMEI, MessageTypeEnum.SMS_MUSIC_GROUP_ADD_STUDENT,
+                            receivers, null, 0, null, studentRegistration.getParentsName(), studentRegistration.getName(), musicGroup.getName(),HttpUtil.getSortUrl(studentApplyUrl));
+                }
             }
-//            studentRegistrationDao.updateCurrentClass(studentRegistration);
-            Map<Integer, String> receivers = new HashMap<>(1);
-            receivers.put(studentRegistration.getUserId(), studentRegistration.getParentsPhone());
-            String studentApplyUrl = sysConfigDao.findConfigValue(SysConfigService.STUDENT_APPLY_URL) + musicGroupId;
-            sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.YIMEI, MessageTypeEnum.SMS_MUSIC_GROUP_ADD_STUDENT,
-                    receivers, null, 0, null, studentRegistration.getParentsName(), studentRegistration.getName(), musicGroup.getName(),HttpUtil.getSortUrl(studentApplyUrl));
             return userId;
         }
     }
@@ -670,7 +680,6 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
 //        List<ClassGroupStudentMapper> classGroupStudentMappers = new ArrayList<>();
 //        List<ImGroupMember> imGroupMemberList = new ArrayList<>();
         Integer classGroupId = classGroup.getId();
-        ClassGroupRelation classGroupRelation = classGroupRelationService.findClassGroupRelation(classGroupId);
 
         //校验是否存在历史记录
         ClassGroupStudentMapper classGroupStudentMapper = classGroupStudentMapperDao.findClassStudentMapperByUserIdAndClassGroupId(userId, classGroupId);
@@ -688,35 +697,32 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
             classGroupStudentMapper.setGroupType(GroupType.MUSIC);
             classGroupStudentMapperDao.insert(classGroupStudentMapper);
         }
-        ClassGroupStudentMapper classGroupStudentMapperMix = classGroupStudentMapperDao.findClassStudentMapperByUserIdAndClassGroupId(userId, classGroupRelation.getClassGroupId());
-        if(classGroupStudentMapperMix != null){
-            classGroupStudentMapperMix.setStatus(ClassGroupStudentStatusEnum.NORMAL);
-            classGroupStudentMapperMix.setClassGroupId(classGroupRelation.getClassGroupId());
-            classGroupStudentMapperDao.update(classGroupStudentMapperMix);
-        }else {
-            classGroupStudentMapperMix = new ClassGroupStudentMapper();
-            classGroupStudentMapperMix.setMusicGroupId(classGroup.getMusicGroupId());
-            classGroupStudentMapperMix.setClassGroupId(classGroupRelation.getClassGroupId());
-            classGroupStudentMapperMix.setUserId(userId);
-            classGroupStudentMapperMix.setCreateTime(nowDate);
-            classGroupStudentMapperMix.setStatus(ClassGroupStudentStatusEnum.NORMAL);
-            classGroupStudentMapperMix.setGroupType(GroupType.MUSIC);
-            classGroupStudentMapperDao.insert(classGroupStudentMapperMix);
-        }
-//        imGroupMemberList.add(new ImGroupMember(userId.toString()));
+
         //添加进IM群组
         ImGroupMember[] imGroupMembers = {new ImGroupMember(userId.toString())};
         imFeignService.groupJoin(new ImGroupModel(classGroup.getId().toString(), imGroupMembers, classGroup.getName()));
-
         //2、班级人数调整
         classGroupDao.updateClassStudentNum(classGroupId.longValue(), 1);
-
         //3、学生加入新班级未开始课程
         List<CourseSchedule> courseScheduleList = courseScheduleService.findNoStartCoursesByClassGroupId(classGroupId);
 
-        //4、班级在合奏班、添加合奏课程
-        if (classGroupRelation != null) {
-            //合奏班增加人数
+        ClassGroupRelation classGroupRelation = classGroupRelationService.findClassGroupRelation(classGroupId);
+        if(classGroupRelation != null){
+            ClassGroupStudentMapper classGroupStudentMapperMix = classGroupStudentMapperDao.findClassStudentMapperByUserIdAndClassGroupId(userId, classGroupRelation.getClassGroupId());
+            if(classGroupStudentMapperMix != null){
+                classGroupStudentMapperMix.setStatus(ClassGroupStudentStatusEnum.NORMAL);
+                classGroupStudentMapperMix.setClassGroupId(classGroupRelation.getClassGroupId());
+                classGroupStudentMapperDao.update(classGroupStudentMapperMix);
+            }else {
+                classGroupStudentMapperMix = new ClassGroupStudentMapper();
+                classGroupStudentMapperMix.setMusicGroupId(classGroup.getMusicGroupId());
+                classGroupStudentMapperMix.setClassGroupId(classGroupRelation.getClassGroupId());
+                classGroupStudentMapperMix.setUserId(userId);
+                classGroupStudentMapperMix.setCreateTime(nowDate);
+                classGroupStudentMapperMix.setStatus(ClassGroupStudentStatusEnum.NORMAL);
+                classGroupStudentMapperMix.setGroupType(GroupType.MUSIC);
+                classGroupStudentMapperDao.insert(classGroupStudentMapperMix);
+            }
             classGroupDao.updateClassStudentNum(classGroupRelation.getClassGroupId().longValue(), 1);
             List<CourseSchedule> mixCourseScheduleList = courseScheduleService.findNoStartCoursesByClassGroupId(classGroupRelation.getClassGroupId());
             courseScheduleList.addAll(mixCourseScheduleList);
@@ -857,6 +863,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
                     MessageTypeEnum.STUDENT_SMS_PAYMENT_SUCCESS, map, null, 0, "1",
                     studentRegistration.getParentsName(), studentPaymentOrder.getActualAmount());
             //push
+            map.put(studentPaymentOrder.getUserId(), studentPaymentOrder.getUserId().toString());
             sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.JIGUANG,
                     MessageTypeEnum.STUDENT_SMS_PAYMENT_SUCCESS, map, null, 0, "1",
                     studentRegistration.getParentsName(), studentPaymentOrder.getActualAmount());

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

@@ -67,7 +67,6 @@ public class SysMessageServiceImpl extends BaseServiceImpl<Long, SysMessage> imp
 
 	/**
 	 * 添加消息
-	 * @param userId 用户编号
 	 * @param subject 消息主题
 	 * @param content 消息内容
 	 * @param receivers 接收人,多个人用逗号分开
@@ -136,6 +135,8 @@ public class SysMessageServiceImpl extends BaseServiceImpl<Long, SysMessage> imp
 		SysMessageConfig messageConfig = sysMessageConfigService.queryByType(messageType);
 		if (messageConfig == null) {
 			throw new BizException("消息类型错误");
+		}else if(messageConfig.getSendFlag() == null || messageConfig.getSendFlag() == 0){
+			return true;
 		}
 		Date date = new Date();
 		SendStatusEnum status = SendStatusEnum.SUCCESSED;
@@ -219,6 +220,8 @@ public class SysMessageServiceImpl extends BaseServiceImpl<Long, SysMessage> imp
 		SysMessageConfig messageConfig = sysMessageConfigService.queryByType(type);
 		if (messageConfig == null) {
 			throw new BizException("消息类型错误");
+		}else if(messageConfig.getSendFlag() == null || messageConfig.getSendFlag() == 0){
+			return;
 		}
 		Date date = new Date();
 		SendStatusEnum status = SendStatusEnum.WAIT;

+ 20 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/SysUserCashAccountServiceImpl.java

@@ -1,16 +1,21 @@
 package com.ym.mec.biz.service.impl;
 
+import com.ym.mec.auth.api.client.SysUserFeignService;
+import com.ym.mec.auth.api.entity.SysUser;
 import com.ym.mec.biz.dal.dao.SysUserCashAccountDao;
 import com.ym.mec.biz.dal.dao.SysUserCashAccountDetailDao;
 import com.ym.mec.biz.dal.entity.SysUserCashAccount;
 import com.ym.mec.biz.dal.entity.SysUserCashAccountDetail;
 import com.ym.mec.biz.dal.enums.DealStatusEnum;
+import com.ym.mec.biz.dal.enums.MessageTypeEnum;
 import com.ym.mec.biz.dal.enums.PlatformCashAccountDetailTypeEnum;
 import com.ym.mec.biz.dal.enums.PlatformCashAccountStatusEnum;
+import com.ym.mec.biz.service.SysMessageService;
 import com.ym.mec.biz.service.SysUserCashAccountService;
 import com.ym.mec.common.dal.BaseDAO;
 import com.ym.mec.common.exception.BizException;
 import com.ym.mec.common.service.impl.BaseServiceImpl;
+import com.ym.mec.thirdparty.message.MessageSenderPluginContext;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Propagation;
@@ -18,12 +23,18 @@ import org.springframework.transaction.annotation.Transactional;
 
 import java.math.BigDecimal;
 import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
 
 @Service
 public class SysUserCashAccountServiceImpl extends BaseServiceImpl<Integer, SysUserCashAccount> implements SysUserCashAccountService {
 
 	@Autowired
 	private SysUserCashAccountDao sysUserCashAccountDao;
+	@Autowired
+	private SysUserFeignService sysUserFeignService;
+	@Autowired
+	private SysMessageService sysMessageService;
 
 	@Autowired
 	private SysUserCashAccountDetailDao sysUserCashAccountDetailDao;
@@ -93,6 +104,15 @@ public class SysUserCashAccountServiceImpl extends BaseServiceImpl<Integer, SysU
 
 		sysUserCashAccountDao.update(cashAccount);
 
+		//推送余额消费信息
+		Map<Integer,String> map = new HashMap<>(1);
+		SysUser sysUser = sysUserFeignService.queryUserById(userId);
+		map.put(userId,sysUser.getPhone());
+		sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.YIMEI, MessageTypeEnum.STUDENT_SMS_BALANCE_CONSUME,
+				map,null,0,null,decimal,balance);
+		map.put(userId,userId.toString());
+		sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.JIGUANG, MessageTypeEnum.STUDENT_SMS_BALANCE_CONSUME,
+				map,null,0,null,decimal,balance);
 		return true;
 	}
 

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

@@ -979,12 +979,12 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 			if(userCashAccount == null){
 				throw new BizException("用户账户找不到");
 			}
+			studentPaymentOrder.setPaymentChannel("BALANCE");
 			if(userCashAccount.getBalance().subtract(vipGroup.getTotalPrice()).doubleValue() > 0){
 				// 更新订单信息
 				studentPaymentOrder.setActualAmount(new BigDecimal(0));
 				studentPaymentOrder.setBalancePaymentAmount(amount);
 				studentPaymentOrder.setStatus(DealStatusEnum.SUCCESS);
-				studentPaymentOrder.setPaymentChannel("BALANCE");
 				studentPaymentOrder.setUpdateTime(date);
 
 				this.orderCallback(studentPaymentOrder);

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

@@ -81,7 +81,7 @@
 
     <!-- 查询班级父班级id -->
     <select id="findClassGroupRelation" resultMap="ClassGroupRelation">
-        SELECT * FROM class_group_relation WHERE sub_class_group_id_ = #{subClassGroupId}
+        SELECT * FROM class_group_relation WHERE sub_class_group_id_ = #{subClassGroupId} LIMIT 1
     </select>
     <select id="queryClassRelationIdMap" resultType="java.util.Map">
         SELECT class_group_id_ 'value',sub_class_group_id_ 'key' FROM class_group_relation cgr

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

@@ -200,6 +200,7 @@
         AND cgsm.user_id_=#{userId}
         AND cg.type_ = #{type,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
         AND FIND_IN_SET(cgsm.status_,'NORMAL,LEAVE')
+        AND cg.del_flag_='0'
     </select>
     <select id="findClassGroupIdByUserAndCourseDateAndStatus" resultType="int">
         SELECT

+ 3 - 3
mec-biz/src/main/resources/config/mybatis/StudentRegistrationMapper.xml

@@ -319,9 +319,9 @@
     <!-- 根据乐团和声部获取未分班人数 -->
     <select id="getNoClassStuCountByMusicGroupId" resultMap="getNoClassStuCountByMusicGroupId">
         SELECT actual_subject_id_ ,COUNT(*) nums FROM student_registration
-        WHERE music_group_id_ = #{musicGroupId} AND payment_status_=2 AND (class_group_id_= 0 OR class_group_id_ IS NULL)
+        WHERE music_group_id_ = #{musicGroupId} AND payment_status_ = 2 AND (class_group_id_= 0 OR class_group_id_ IS NULL)
         AND music_group_status_ != 'QUIT'
-        GROUP BY actual_subject_id_;
+        GROUP BY actual_subject_id_
     </select>
 
     <update id="updateByUserIdAndMusicGroupId" parameterType="com.ym.mec.biz.dal.entity.StudentRegistration">
@@ -345,7 +345,7 @@
     <select id="queryByUserIdAndMusicGroupId" resultMap="StudentRegistration">
         SELECT sr.*,su.id_card_no_ FROM student_registration sr
         LEFT JOIN sys_user su ON su.id_ =sr.user_id_
-        WHERE sr.music_group_id_ = #{musicGroupId} AND sr.user_id_ = #{userId} AND sr.music_group_status_ != 'QUIT'
+        WHERE sr.music_group_id_ = #{musicGroupId} AND sr.user_id_ = #{userId} AND sr.music_group_status_ != 'QUIT' LIMIT 1
     </select>
 
     <!-- 根据乐团编号和手机号查询注册乐团注册信息-->

+ 7 - 0
mec-biz/src/main/resources/config/mybatis/SysMessageConfigMapper.xml

@@ -13,6 +13,7 @@
 		<result column="modify_on_" property="modifyOn" />
 		<result column="url_" property="url" />
 		<result column="group_" property="group" />
+		<result column="send_flag_" property="sendFlag" />
 	</resultMap>
 
 	<sql id="queryCondition">
@@ -30,6 +31,9 @@
 			<if test="group != null">
 				and group_ = #{group,jdbcType=VARCHAR}
 			</if>
+			<if test="sendFlag != null">
+				and send_flag_ = #{sendFlag}
+			</if>
 		</where>
 	</sql>
 
@@ -80,6 +84,9 @@
 			<if test="description != null">
 				description_ = #{description},
 			</if>
+			<if test="sendFlag != null">
+				send_flag_ = #{sendFlag}
+			</if>
 		</set>
 		WHERE id_ = #{id}
 	</update>