package com.bonus.sgzb.system.api;

import com.bonus.sgzb.base.api.domain.BmStorageLog;
import com.bonus.sgzb.system.api.domain.BmNumLogs;
import com.bonus.sgzb.system.api.domain.SysOperLog;
import com.bonus.sgzb.system.api.factory.RemoteLogFallbackFactory;
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.bonus.sgzb.common.core.constant.SecurityConstants;
import com.bonus.sgzb.common.core.constant.ServiceNameConstants;
import com.bonus.sgzb.common.core.domain.R;
import com.bonus.sgzb.system.api.domain.SysLogininfor;

import java.util.List;

/**
 * 日志服务
 * 
 * @author ruoyi
 */
@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 bmNumLogs 物资信息
     * @param source 请求来源
     * @return 结果
     * @throws Exception 异常信息
     */
    @PostMapping("/bm_num_logs")
    public R<Boolean> saveNumberLog(@RequestBody BmNumLogs bmNumLogs, @RequestHeader(SecurityConstants.FROM_SOURCE) String source) throws Exception;


    /**
     * 保存物资记录日志
     * @param bmStorageLogList 物资信息
     * @param source 请求来源
     * @return 结果
     * @throws Exception 异常信息
     */
    @PostMapping("/bm_storage_logs")
    public R<Boolean> batchInsert(@RequestBody List<BmStorageLog> bmStorageLogList, @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);
}
