package com.zt.life.modules.mainPart.utils; import com.zt.core.sys.model.SysUser; import com.zt.life.sys.dto.OssDto; import com.zt.modules.oss.cloud.LocalStorageService; import com.zt.modules.oss.model.SysOss; import com.zt.modules.oss.service.SysOssService; import com.zt.modules.sys.service.SysUserService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; @Service public class GetFilesPath { @Autowired private SysUserService sysUserService; @Autowired private SysOssService sysOssService; public String getSignPath(Long userId) { SysUser data = sysUserService.getUserInfo(userId); OssDto oss = data.getFiles2(); return getFirstImagePath(oss); } public String getFirstImagePath(OssDto oss) { String filePath = ""; if (oss != null) { if (oss.getGroups().size() > 0) { OssDto.OssFieldGroupDto group = oss.getGroups().get(0); if (group.getFields().size() > 0) { OssDto.OssFieldDto field = group.getFields().get(0); if (field.getFiles().size() > 0) { com.zt.core.oss.dto.OssDto file = field.getFiles().get(0); SysOss sysOss = sysOssService.get(file.getId()); filePath = sysOss.getPath(); } } } } return filePath; } }