| | |
| | | .eq(Config::getFlag, flag) |
| | | .eq(Config::getStatus, StatusType.ENABLE.val) |
| | | .last("limit 1")); |
| | | return R.ok().add(configs.stream().findFirst().orElse(null)); |
| | | |
| | | Config config = configs.stream().findFirst().orElse(null); |
| | | if (config != null && PROJECT_LOGO_FLAG.equals(flag)) { |
| | | config.setVal(resolveProjectLogoValue(config.getVal())); |
| | | } |
| | | return R.ok().add(config); |
| | | } |
| | | |
| | | @PreAuthorize("hasAnyAuthority('system:config:save','system:config:update')") |
| | |
| | | return resolvedPath; |
| | | } |
| | | |
| | | private String resolveProjectLogoValue(String value) { |
| | | if (!StringUtils.hasText(value)) { |
| | | return ""; |
| | | } |
| | | int pathIndex = value.indexOf("?path="); |
| | | if (pathIndex < 0) { |
| | | return value; |
| | | } |
| | | String relativePath = value.substring(pathIndex + 6); |
| | | if (!StringUtils.hasText(relativePath)) { |
| | | return ""; |
| | | } |
| | | File file = resolveLogoPath(relativePath).toFile(); |
| | | return file.exists() && file.isFile() ? value : ""; |
| | | } |
| | | |
| | | private String resolveImageContentType(String fileName) { |
| | | String normalizedName = StringUtils.hasText(fileName) ? fileName.toLowerCase(Locale.ROOT) : ""; |
| | | if (normalizedName.endsWith(".png")) { |