package com.hxhq.system.api;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import com.hxhq.common.core.constant.SecurityConstants;
import com.hxhq.common.core.constant.ServiceNameConstants;
import com.hxhq.common.core.domain.R;
import com.hxhq.system.api.domain.SysLogininfor;
import com.hxhq.system.api.domain.SysOperLog;
import com.hxhq.system.api.factory.RemoteLogFallbackFactory;

/**
 * 日志服务
 * 
 * @author hxhq
 */
@FeignClient(contextId = "remoteLogService", value = ServiceNameConstants.SYSTEM_SERVICE, fallbackFactory = RemoteLogFallbackFactory.class)
public interface RemoteLogService
{
    /**
     * 保存系统日志
     * @param sysOperLog
     * @param source
     * @return
     * @throws Exception
     */
    @PostMapping("/operlog")
    public R<Boolean> saveLog(@RequestBody SysOperLog sysOperLog, @RequestHeader(SecurityConstants.FROM_SOURCE) String source) throws Exception;

    /**
     * 保存访问记录
     *
     * @param sysLogininfor 访问实体
     * @param source 请求来源
     * @return 结果
     */
    @PostMapping("/logininfor")
    public R<Boolean> saveLogininfor(@RequestBody SysLogininfor sysLogininfor, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
}
