package com.hotent.uc.controller;

import com.hotent.Feign.BpmModelFeignClient;
import com.hotent.Feign.BpmRuntimeFeignClient;
import com.hotent.base.annotation.ApiGroup;
import com.hotent.base.constants.ApiGroupConsts;
import com.hotent.base.model.CommonResult;
import com.hotent.uc.manager.UserManager;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;


/**
 * @Author: Cola
 * @Date: 2021/08/16/13:51
 * @Description:
 **/

@RequestMapping("/apiManager")
@RestController
@Api(tags="获取对外接口的访问权限（获取token）")
@ApiGroup(group= {ApiGroupConsts.GROUP_UC})
public class GetApiTokenController {

    public static final Logger logger= LoggerFactory.getLogger(GetApiTokenController.class);

    @Autowired
    private UserManager userManager;
    @Autowired
    private BpmModelFeignClient bpmModelFeignClient;
    @Autowired
    private BpmRuntimeFeignClient bpmRuntimeFeignClient;

    @GetMapping("/getToken")
    @ApiOperation(value = "获取对外接口访问的Token", httpMethod = "GET", notes = "获取对外接口访问的Token")
    public CommonResult getApiToken(@RequestParam("sysCode")String sysCode, @RequestParam("secretKey")String secretKey,
                                    @RequestParam(value = "account",required = false)String account){

        return userManager.getApiToken(sysCode,secretKey,account);
    }

}
