| | |
| | | package com.vci.ubcs.log.service.impl; |
| | | |
| | | import com.vci.ubcs.log.enumpack.ServiceNameRoleEnum; |
| | | import com.vci.ubcs.log.vo.LocalLogVO; |
| | | import com.vci.ubcs.log.service.ILogLocalService; |
| | | import com.vci.ubcs.log.entity.LocalLog; |
| | |
| | | * @return |
| | | */ |
| | | //@Override |
| | | public List<LocalLog> getSystemLogList(String logParentPath) { |
| | | List<LocalLog> localLogs = new ArrayList<>(); |
| | | public List<LocalLogVO> getSystemLogList(String logParentPath) { |
| | | List<LocalLogVO> localLogsVO = new ArrayList<>(); |
| | | // 不为空说明是加载当前这个服务路径下的日志文件 |
| | | if(Func.isNotEmpty(logParentPath)){ |
| | | File file = new File(logParentPath); |
| | |
| | | File[] files = file.listFiles(); |
| | | Arrays.stream(files).forEach(item->{ |
| | | // 组建日志文件对象 |
| | | LocalLog localLog = new LocalLog(); |
| | | LocalLogVO localLog = new LocalLogVO(); |
| | | localLog.setLogName(item.getName()); |
| | | localLog.setLogType(getLogType(item.getName())); |
| | | localLog.setCreateTime(getLastModifiedOrCreatTime(false,logParentPath)); |
| | |
| | | localLog.setServiceId(serviceId); |
| | | localLog.setServiceName(getServiceName(serviceId)); |
| | | localLog.setHasChildren(false); |
| | | localLogs.add(localLog); |
| | | localLogsVO.add(localLog); |
| | | }); |
| | | } |
| | | }else { |
| | |
| | | String fullPath = dir.getPath() + LOGPATH; |
| | | File file = new File(fullPath); |
| | | if(file.exists()){ |
| | | LocalLog localLog = new LocalLog(); |
| | | localLog.setLastModifier(getLastModifiedOrCreatTime(true,fullPath)); |
| | | localLog.setCreateTime(getLastModifiedOrCreatTime(false,fullPath)); |
| | | localLog.setLogPath(fullPath); |
| | | LocalLogVO localLogVO = new LocalLogVO(); |
| | | localLogVO.setLastModifier(getLastModifiedOrCreatTime(true,fullPath)); |
| | | localLogVO.setCreateTime(getLastModifiedOrCreatTime(false,fullPath)); |
| | | localLogVO.setLogPath(fullPath); |
| | | String serviceId = getServiceId(file.getPath()); |
| | | localLog.setServiceId(serviceId); |
| | | localLogVO.setServiceId(serviceId); |
| | | String serviceName = getServiceName(serviceId); |
| | | localLog.setServiceName(serviceName); |
| | | localLog.setLogType(serviceName+"日志父目录"); |
| | | localLog.setLogName(serviceName+"日志父目录"); |
| | | localLog.setHasChildren(true); |
| | | localLogs.add(localLog); |
| | | localLogVO.setServiceName(serviceName); |
| | | localLogVO.setLogType(serviceName+"日志父目录"); |
| | | localLogVO.setLogName(serviceName+"日志父目录"); |
| | | localLogVO.setHasChildren(true); |
| | | localLogsVO.add(localLogVO); |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | return localLogs; |
| | | return localLogsVO; |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | private String getServiceName(String serViceId){ |
| | | return EnumCache.getValue(EnumEnum.SERCIVE_NAME_ROLE, serViceId); |
| | | // EnumCache.getValue(EnumEnum.SERCIVE_NAME_ROLE, serViceId) |
| | | return ServiceNameRoleEnum.getTextByValue(serViceId); |
| | | } |
| | | |
| | | /** |