zouxuan há 3 anos atrás
pai
commit
6298f2e167

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

@@ -163,6 +163,8 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 	private MusicGroupTrainPlanService musicGroupTrainPlanService;
     @Autowired
 	private PracticeGroupSellPriceDao practiceGroupSellPriceDao;
+    @Autowired
+	private TenantAssetsInfoService tenantAssetsInfoService;
 
     private final Logger LOGGER = LoggerFactory
             .getLogger(this.getClass());
@@ -4135,6 +4137,11 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 
 		if (updateList.size() > 0) {
             courseScheduleDao.batchUpdate(updateList);
+			try {
+				tenantAssetsInfoService.deductAmount(updateList);
+			}catch (Exception e){
+				LOGGER.error("deductAmount  >>>>>>>>>",e);
+			}
 			List<Long> courseIds = updateList.stream().map(CourseSchedule::getId).collect(Collectors.toList());
 			List<CourseSchedule> beMergeCourses = courseScheduleDao.getBeMergeCourseWithMainCourseIds(courseIds);
 			if(!CollectionUtils.isEmpty(beMergeCourses)){

+ 1 - 0
mec-im/src/main/java/com/ym/common/ErrorEnum.java

@@ -19,6 +19,7 @@ public enum ErrorEnum {
     ERR_JOIN_ROOM_ERROR(12, "Join room error"),
     JOIN_ROOM_ERROR(35, "加入房间失败,请前往线下教室"),
     ROOM_NOT_START(36, "网络教室暂未开启,请稍后重试"),
+    CLOUD_BALANCE_NOT_FEE(37, "云教室余额不足,请联系教务老师"),
     ERR_MESSAGE_ERROR(13, "IM Message send error"),
 
 

+ 12 - 4
mec-im/src/main/java/com/ym/service/Impl/RoomServiceImpl.java

@@ -21,11 +21,9 @@ import com.ym.mec.biz.dal.dto.RongyunBasicUserDto;
 import com.ym.mec.biz.dal.entity.*;
 import com.ym.mec.biz.dal.enums.GroupType;
 import com.ym.mec.biz.dal.enums.TeachModeEnum;
-import com.ym.mec.biz.service.StudentAttendanceService;
-import com.ym.mec.biz.service.SysConfigService;
-import com.ym.mec.biz.service.SysTenantConfigService;
-import com.ym.mec.biz.service.TeacherAttendanceService;
+import com.ym.mec.biz.service.*;
 import com.ym.mec.common.exception.BizException;
+import com.ym.mec.common.page.WrapperUtil;
 import com.ym.mec.im.IMHelper;
 import com.ym.mec.im.message.*;
 import com.ym.mec.util.collection.MapUtil;
@@ -38,6 +36,7 @@ import com.ym.utils.DateTimeUtils;
 import com.ym.utils.IdentifierUtils;
 import com.ym.whiteboard.WhiteBoardHelper;
 import lombok.extern.slf4j.Slf4j;
+import lombok.val;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.redis.core.RedisTemplate;
@@ -98,6 +97,8 @@ public class RoomServiceImpl implements RoomService {
     @Autowired
     private SysTenantConfigService sysTenantConfigService;
     @Autowired
+    private TenantAssetsInfoService tenantAssetsInfoService;
+    @Autowired
     private RedisTemplate<String,String> redisTemplate;
 
     @Override
@@ -148,6 +149,13 @@ public class RoomServiceImpl implements RoomService {
             throw new ApiException(ErrorEnum.ROOM_NOT_START);
 //            throw new BizException("网络教室暂未开启,请在{}分钟后进入教室",DateUtil.minutesBetween(addMinutes,courseSchedule.getStartClassTime()));
         }
+        final TenantAssetsInfo one = tenantAssetsInfoService.getOne(new WrapperUtil<TenantAssetsInfo>()
+                .hasEq("tenant_id_", courseSchedule.getTenantId())
+                .queryWrapper()
+                .gt("balance_", 0));
+        if(one == null){
+            throw new ApiException(ErrorEnum.CLOUD_BALANCE_NOT_FEE);
+        }
 
         //是否是连堂课
         String continueCourseTime = sysTenantConfigService.getTenantConfigValue(SysConfigService.ONLINE_CONTINUE_COURSE_TIME,courseSchedule.getTenantId());