刘光辉
16 小时以前 34981c30a78e8bbd7791131059a9210f9928b62c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
package jnpf.base.service.impl;
 
 
import jnpf.base.service.SuperServiceImpl;
import jnpf.base.UserInfo;
import jnpf.base.mapper.LogMapper;
import jnpf.base.model.logmodel.PaginationLogModel;
import jnpf.base.service.LogService;
import jnpf.base.entity.LogEntity;
import jnpf.config.ConfigValueUtil;
import jnpf.database.util.TenantDataSourceUtil;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
 
import java.util.List;
import java.util.Set;
 
/**
 * 系统日志
 *
 * @author JNPF开发平台组
 * @version V3.1.0
 * @copyright 引迈信息技术有限公司(https://www.jnpfsoft.com)
 * @date 2019年9月27日 上午9:18
 */
@Service
@RequiredArgsConstructor
public class LogServiceImpl extends SuperServiceImpl<LogMapper, LogEntity> implements LogService {
 
 
    private final ConfigValueUtil configValueUtil;
 
    @Override
    public List<LogEntity> getList(int category, PaginationLogModel paginationTime, Boolean filterUser) {
        return this.baseMapper.getList(category,paginationTime,filterUser);
    }
 
    @Override
    public LogEntity getInfo(String id) {
        return this.baseMapper.getInfo(id);
    }
 
    @Override
    public boolean delete(String[] ids) {
        return this.baseMapper.delete(ids);
    }
 
    @Override
    public void writeLogAsync(String userId, String userName, String abstracts, long requestDuration) {
        this.baseMapper.writeLogAsync(userId, userName, abstracts, null, 1, null, requestDuration);
    }
 
    @Override
    public void writeLogAsync(String userId, String userName, String abstracts, UserInfo userInfo, int loginMark, Integer loginType, long requestDuration) {
        if (configValueUtil.isMultiTenancy()) {
            try {
                TenantDataSourceUtil.switchTenant(userInfo.getTenantId());
            } catch (Exception e) {
                return;
            }
        }
        this.baseMapper.writeLogAsync(userId,userName,abstracts,userInfo,loginMark,loginType,requestDuration);
    }
 
    @Override
    public void writeLogAsync(LogEntity entity) {
        this.baseMapper.writeLogAsync(entity);
    }
 
    @Override
    public void deleteHandleLog(String type, Integer userOnline, String dataInterfaceId) {
        this.baseMapper.deleteHandleLog(type,userOnline,dataInterfaceId);
    }
 
    @Override
    public Set<String> queryList() {
        return this.baseMapper.queryList();
    }
}