田源
2023-11-09 2bfad65f3f4ed0282f53e3ae01fc10c879a734bc
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 com.vci.ubcs.core.log.service.impl;
 
import com.vci.ubcs.core.log.service.ILogSystemService;
import com.vci.ubcs.log.entity.SystemLog;
import com.vci.ubcs.resource.bo.FileObjectBO;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
 
import java.io.File;
import java.rmi.ServerException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
 
/**
 * 本地系统日志
 * @author ludc
 * @date 2023/10/31 15:39
 */
@Service
public class LogSystemServiceImpl implements ILogSystemService {
 
    /**
     * 各个服务存放的的父路径
     */
    private final String parentPath = "/data1/ubcs/ubcs-server";
    //@Value("#{'${ip-whitelist.ip}'.split(',')}")
    private List<String> serviceDirNames = new ArrayList<>(Arrays.asList("/ubcs_code/target/log","/ubcs_omd/target/log","/ubcs_system/target/log"));
 
    /**
     * 获取本地日志列表
     */
    @Override
    public List<SystemLog> getSystemLogList() {
        serviceDirNames.stream().forEach(serviceDirName->{
            File file = new File(parentPath+serviceDirName);
 
            if(file.isDirectory()){
 
                File[] files = file.listFiles();
 
                for(File f : files){
 
                    if(f.isDirectory()){
 
                        //readAllFiles(f.getAbsolutePath());
 
                    }else{
 
                        System.out.println(f.getName());
 
                    }
 
                }
 
            }else{
 
                System.out.println(file.getName());
 
            }
 
        });
 
        return null;
    }
 
    @Override
    public FileObjectBO downloadLogByServiceNameAndFileName(Map<String, String> condition) throws ServerException {
        return null;
    }
 
    @Override
    public void deleteLogFile(Map<String, String> condition) throws ServerException {
 
    }
 
 
}