|
@@ -11,6 +11,7 @@ import com.ym.mec.biz.dal.entity.*;
|
|
|
import com.ym.mec.biz.dal.enums.*;
|
|
|
import com.ym.mec.biz.service.*;
|
|
|
import com.ym.mec.common.constant.CommonConstants;
|
|
|
+import com.ym.mec.common.controller.BaseController;
|
|
|
import com.ym.mec.common.entity.ImGroupMember;
|
|
|
import com.ym.mec.common.entity.ImGroupModel;
|
|
|
import com.ym.mec.common.exception.BizException;
|
|
@@ -20,9 +21,11 @@ import com.ym.mec.util.date.DateUtil;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.apache.poi.util.StringUtil;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.http.HttpStatus;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Isolation;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
+import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
@@ -103,6 +106,9 @@ public class OnlineMusicGroupServiceImpl implements OnlineMusicGroupService {
|
|
|
if(Objects.isNull(studentFee)){
|
|
|
throw new BizException("学员缴费信息不存在");
|
|
|
}
|
|
|
+ if(studentFee.getRemainNetworkClassTimes()<=0){
|
|
|
+ throw new BizException("该学员费用不足");
|
|
|
+ }
|
|
|
|
|
|
SysUser student = studentDao.lockUserReturnInfo(onlineMusicGroupCourseInfo.getStudentId());
|
|
|
if(Objects.isNull(student)){
|
|
@@ -235,6 +241,26 @@ public class OnlineMusicGroupServiceImpl implements OnlineMusicGroupService {
|
|
|
courseScheduleStudentPaymentDao.batchInsert(courseScheduleStudentPayments);
|
|
|
teacherAttendanceDao.batchInsert(teacherAttendances);
|
|
|
|
|
|
+ try {
|
|
|
+ courseScheduleService.checkNewCourseSchedulesWithoutMusicGroup(courses,false);
|
|
|
+ } catch (Exception e) {
|
|
|
+ TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
|
+ String errMessage=new String();
|
|
|
+ if(e.getMessage().indexOf("主教冲突")!=-1){
|
|
|
+ errMessage="抱歉啦,当前所选时段组合,「" + teacher.getRealName() + "」老师已被预约,请重新选择时段或更换老师后重试。";
|
|
|
+ }else{
|
|
|
+ String courseName=e.getMessage().substring(e.getMessage().indexOf(")-")+2);
|
|
|
+ courseName = courseName.substring(0,courseName.indexOf("("));
|
|
|
+ errMessage="抱歉啦,当前所选时段组合,与您现有课程「";
|
|
|
+ errMessage+=courseName;
|
|
|
+ errMessage+="」时段冲突,请选择其他时段重试。";
|
|
|
+ }
|
|
|
+ throw new BizException(errMessage);
|
|
|
+ }
|
|
|
+
|
|
|
+ studentFee.setRemainNetworkClassTimes(studentFee.getRemainNetworkClassTimes()-1);
|
|
|
+ musicGroupStudentFeeDao.update(studentFee);
|
|
|
+
|
|
|
try{
|
|
|
List<String> cdstrs=new ArrayList<>();
|
|
|
for(int i=0;i<courses.size();i++){
|
|
@@ -249,7 +275,7 @@ public class OnlineMusicGroupServiceImpl implements OnlineMusicGroupService {
|
|
|
|
|
|
Map<Integer, String> teacherMap = new HashMap<>();
|
|
|
teacherMap.put(onlineMusicGroupCourseInfo.getTeacherId(), onlineMusicGroupCourseInfo.getTeacherId().toString());
|
|
|
- sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.JIGUANG, MessageTypeEnum.MUSIC_NETWORK_CRATE_STUDENT,
|
|
|
+ sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.JIGUANG, MessageTypeEnum.MUSIC_NETWORK_CRATE_TEACHER,
|
|
|
teacherMap, null, 0, null, "TEACHER", teacher.getRealName(), classGroup.getName(),
|
|
|
StringUtils.join(cdstrs, ","));
|
|
|
}catch (Exception e){
|