Joburgess 5 years ago
parent
commit
0d3c86172d

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

@@ -183,6 +183,15 @@ public interface VipGroupService extends BaseService<Long, VipGroup> {
     void createVipGroupCourseScheInfo(Long vipGroupId,ClassGroup classGroup);
     void createVipGroupCourseScheInfo(Long vipGroupId,ClassGroup classGroup);
 
 
     /**
     /**
+     * @describe 检测能否购买vip课
+     * @author Joburgess
+     * @date 2019/12/2
+     * @param vipGroupId:
+     * @return void
+     */
+    void enableBuyVipGroup(Integer vipGroupId);
+
+    /**
      * @Author: Joburgess
      * @Author: Joburgess
      * @Date: 2019/10/3
      * @Date: 2019/10/3
      * @params [vipGroupBuyParams]
      * @params [vipGroupBuyParams]

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

@@ -823,6 +823,16 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
     }
     }
 
 
 	@Override
 	@Override
+	public void enableBuyVipGroup(Integer vipGroupId) {
+		if (Objects.isNull(vipGroupId)){
+			throw new BizException("请指定VIP课");
+		}
+		VipGroup vipGroup = get(vipGroupId.longValue());
+		List<CourseSchedule> courseSchedules = JSON.parseArray(vipGroup.getCourseSchedulesJson(),CourseSchedule.class);
+		courseScheduleService.checkNewCourseSchedules(courseSchedules,false);
+	}
+
+	@Override
 	@Transactional(rollbackFor = Exception.class)
 	@Transactional(rollbackFor = Exception.class)
 	public void updateVipGroupStudentNumAndStatus(Long vipGroupId , ClassGroup classGroup, Integer num, boolean updateVipStatus) {
 	public void updateVipGroupStudentNumAndStatus(Long vipGroupId , ClassGroup classGroup, Integer num, boolean updateVipStatus) {
 		VipGroup vipGroup = vipGroupDao.getLockVipGroup(vipGroupId);
 		VipGroup vipGroup = vipGroupDao.getLockVipGroup(vipGroupId);

+ 11 - 2
mec-student/src/main/java/com/ym/mec/student/controller/StudentVipGroupController.java

@@ -10,10 +10,8 @@ import com.ym.mec.biz.service.SubjectService;
 import com.ym.mec.biz.service.VipGroupCategoryService;
 import com.ym.mec.biz.service.VipGroupCategoryService;
 import com.ym.mec.biz.service.VipGroupService;
 import com.ym.mec.biz.service.VipGroupService;
 import com.ym.mec.common.controller.BaseController;
 import com.ym.mec.common.controller.BaseController;
-
 import io.swagger.annotations.Api;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiOperation;
-
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.HttpStatus;
 import org.springframework.http.HttpStatus;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.bind.annotation.*;
@@ -75,6 +73,17 @@ public class StudentVipGroupController extends BaseController {
         return succeed(vipGroupService.getVipGroupShowDetail(vipGroupId));
         return succeed(vipGroupService.getVipGroupShowDetail(vipGroupId));
     }
     }
 
 
+    @ApiOperation(value = "检测vip课成能否购买")
+    @GetMapping(value = "/enableBuyGroup")
+    public Object enableBuyGroup(Integer vipGroupId){
+        SysUser sysUser = sysUserFeignService.queryUserInfo();
+        if (null == sysUser) {
+            return failed(HttpStatus.FORBIDDEN, "请登录");
+        }
+        vipGroupService.enableBuyVipGroup(vipGroupId);
+        return succeed();
+    }
+
     @ApiOperation(value = "vip课购买")
     @ApiOperation(value = "vip课购买")
     @PostMapping("/buyVipGroup")
     @PostMapping("/buyVipGroup")
     public Object buyVipGroup(VipGroupBuyParamsDto vipGroupBuyParams) throws Exception {
     public Object buyVipGroup(VipGroupBuyParamsDto vipGroupBuyParams) throws Exception {