package com.ym.mec.web.controller.teacher;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.ym.mec.auth.api.client.SysUserFeignService;
import com.ym.mec.auth.api.entity.SysUser;
import com.ym.mec.biz.dal.dto.VipGroupApplyDto;
import com.ym.mec.biz.service.VipGroupService;
import com.ym.mec.common.controller.BaseController;

/**
 * @Author Joburgess
 * @Date 2019/9/21
 */
@Api(tags = "vip课-教师端")
@RequestMapping("teacherVipGroup")
@RestController
public class TeacherVipGroupController extends BaseController {

    @Autowired
    private VipGroupService vipGroupService;

    @Autowired
    private SysUserFeignService sysUserFeignService;

    @ApiOperation("vip课申请")
    @PostMapping("/vipGroupApply")
    public Object vipGroupApply(@RequestBody VipGroupApplyDto vipGroupApplyDto){
        SysUser user = sysUserFeignService.queryUserInfo();
        vipGroupApplyDto.getVipGroupApplyBaseInfo().setTeacherId(Long.valueOf(user.getId()));
        vipGroupService.createVipGroup(vipGroupApplyDto);
        return succeed();
    }

}
