package com.skr.mdm.controller;

import com.skr.mdm.dto.LoginUserDTO;
import com.skr.mdm.result.ResponseResult;
import com.skr.mdm.service.ApplicationService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.Authentication;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;

/**
 * @author nfq
 * @date 2020/9/14 10:03
 */
@RestController
@Api(tags = "客户端系统接口")
public class ApplicationController {

    @Autowired
    private ApplicationService applicationService;

    @PostMapping("heartbeat")
    @ApiOperation(value = "客户端心跳接口")
    public ResponseResult heartbeat(@ApiIgnore Authentication authentication) {
        LoginUserDTO loginUserDTO = (LoginUserDTO) authentication.getPrincipal();
        return applicationService.heartbeat(loginUserDTO);
    }

}
