package com.lantone.qc.kernel.web.controller;


import com.lantone.qc.pub.model.vo.LoginKeyVO;
import com.lantone.qc.pub.model.vo.TokenVO;
import com.lantone.qc.security.aop.Security;
import com.lantone.qc.security.dto.RespDTO;
import com.lantone.qc.security.facade.TokenFacade;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
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;

/**
 * <p>
 * 病历质控token信息 前端控制器
 * </p>
 *
 * @author zhoutg
 * @since 2019-12-23
 */
@RestController
@RequestMapping("/token")
@Api(value = "token相关接口", tags = { "token相关接口" })
@Slf4j
public class MrqcTokenController {

    @Autowired
    TokenFacade tokenFacade;

    @ApiOperation(value = "获取token",
            notes = "")
    @PostMapping("/getToken")
    public RespDTO<String> list(@RequestBody LoginKeyVO loginKeyVO) {
        String token = tokenFacade.getToken(loginKeyVO);
        return RespDTO.onSuc(token);
    }


    @ApiOperation(value = "模拟接口测试",
            notes = "")
    @PostMapping("/test")
    @Security
    public RespDTO<String> test(@RequestBody TokenVO tokenVO) {
        return RespDTO.onSuc("测试成功了");
    }
}
