package org.wfc.user.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 org.wfc.common.core.constant.SecurityConstants;
import org.wfc.common.core.constant.ServiceNameConstants;
import org.wfc.common.core.domain.R;
import org.wfc.user.api.domain.ULogininfor;
import org.wfc.user.api.domain.UOperLog;
import org.wfc.user.api.factory.RemoteULogFallbackFactory;

/**
 * 日志服务
 * 
 * @author wfc
 */
@FeignClient(contextId = "remoteULogService", value = ServiceNameConstants.USER_SERVICE, fallbackFactory = RemoteULogFallbackFactory.class)
public interface RemoteULogService
{
    /**
     * 保存系统日志
     *
     * @param operLog 日志实体
     * @param source 请求来源
     * @return 结果
     */
    @PostMapping("/operlog")
    public R<Boolean> saveLog(@RequestBody UOperLog operLog, @RequestHeader(SecurityConstants.FROM_SOURCE) String source) throws Exception;

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