package com.jiayue.ssi.factory;

import com.jiayue.ssi.entity.SysOperLog;
import com.jiayue.ssi.service.SysOperLogService;
import com.jiayue.ssi.util.AddressUtils;
import com.jiayue.ssi.util.SpringUtils;

/**
 * 操作日志工厂
 *
 * @author xsl
 * @since 2023/03/30
 */
public class OperateLogFactory {
    /**
     * 操作日志记录
     *
     * @param operLog 操作日志信息
     * @return
     */
    public static void recordOper(final SysOperLog operLog) {
        // 远程查询操作地点
        operLog.setOperLocation(AddressUtils.getRealAddressByIP(operLog.getOperIp()));
        SpringUtils.getBean(SysOperLogService.class).insertOperlog(operLog);
    }
}
