ludc
2024-04-25 a9b01d5e2433a1afdd9683d92ccb2f7f3b1cc9a0
Source/UBCS/ubcs-ops/ubcs-log/src/main/java/com/vci/ubcs/log/service/impl/LogLocalServiceImpl.java
@@ -26,6 +26,7 @@
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.attribute.BasicFileAttributes;
import java.nio.file.attribute.FileTime;
import java.rmi.ServerException;
import java.text.SimpleDateFormat;
import java.util.*;
@@ -84,7 +85,7 @@
    */
   @Override
   public List<LocalLogVO> getSystemLogList(String logParentPath) {
      List<LocalLogVO> localLogsVO = new ArrayList<>();
      List<LocalLogVO> localLogsVOS = new ArrayList<>();
      // 不为空说明是加载当前这个服务路径下的日志文件
      if(Func.isNotEmpty(logParentPath)){
         File file = new File(logParentPath);
@@ -96,14 +97,14 @@
                  LocalLogVO localLog = new LocalLogVO();
                  localLog.setLogName(item.getName());
                  localLog.setLogType(getLogType(item.getName()));
                  localLog.setCreateTime(getLastModifiedOrCreatTime(false,logParentPath));
                  localLog.setLastModifier(getLastModifiedOrCreatTime(true,logParentPath));
                  localLog.setCreateTime(getLastModifiedOrCreatTime(false,item.getPath()));
                  localLog.setLastModifier(getLastModifiedOrCreatTime(true,item.getPath()));
                  localLog.setLogPath(logParentPath);
                  String serviceId = getServiceId(logParentPath);
                  localLog.setServiceId(serviceId);
                  localLog.setServiceName(getServiceName(serviceId));
                  localLog.setHasChildren(false);
                  localLogsVO.add(localLog);
                  localLogsVOS.add(localLog);
               });
            }
         }
@@ -117,8 +118,8 @@
                  File file = new File(fullPath);
                  if(file.exists()){
                     LocalLogVO localLogVO = new LocalLogVO();
                     localLogVO.setLastModifier(getLastModifiedOrCreatTime(true,fullPath));
                     localLogVO.setCreateTime(getLastModifiedOrCreatTime(false,fullPath));
                     localLogVO.setLastModifier(getLastModifiedOrCreatTime(true,file.getPath()));
                     localLogVO.setCreateTime(getLastModifiedOrCreatTime(false,file.getPath()));
                     localLogVO.setLogPath(fullPath);
                     String serviceId = getServiceId(file.getPath());
                     localLogVO.setServiceId(serviceId);
@@ -127,13 +128,15 @@
                     localLogVO.setLogType(serviceName+"日志父目录");
                     localLogVO.setLogName(serviceName+"日志父目录");
                     localLogVO.setHasChildren(true);
                     localLogsVO.add(localLogVO);
                     localLogsVOS.add(localLogVO);
                  }
               }
            });
         }
      }
      return localLogsVO;
      // 对日志进行降序排序
      List<LocalLogVO> resLocalLogVOS = localLogsVOS.stream().sorted(Comparator.comparing(LocalLogVO::getLastModifier).reversed()).collect(Collectors.toList());
      return resLocalLogVOS;
   }
   /**