一周菜谱

This commit is contained in:
sxu 2025-02-05 19:04:37 +08:00
parent 517f628838
commit dfee652bf6
2 changed files with 0 additions and 181 deletions

View File

@ -1,163 +0,0 @@
//package com.bonus.core.common.utils;
//
//import cn.hutool.core.text.CharSequenceUtil;
//import javax.annotation.PostConstruct;
//import com.bonus.oss.OssProperties;
//import com.bonus.oss.OssTemplate;
//import com.bonus.utils.SpringContextHolder;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//import org.springframework.beans.factory.annotation.Value;
//import org.springframework.stereotype.Component;
//import java.io.InputStream;
//import java.net.URLDecoder;
//import java.nio.charset.StandardCharsets;
//import java.util.stream.Collectors;
//
//@Component
//public class SysUtil {
// private static final Logger log = LoggerFactory.getLogger(SysUtil.class);
// @Value("${system.sysfile.prefixOffline}")
// private String prefixOffline;
// @Value("${system.sysfile.bucket}")
// private String prefixBucket;
// @Value("${system.sysfile.prefixOnline}")
// private String prefixOnline;
// private static final SysUtilProxy sysUtilProxy = new SysUtilProxy();
// private static String prefixOn;
// private static String bucket;
// private static String prefixOff;
//
// @PostConstruct
// public void init() {
// prefixOn = this.prefixOnline;
// bucket = this.prefixBucket;
// prefixOff = this.prefixOffline;
// }
//
// public static String getPrefix() {
// return sysUtilProxy.getPrefix(prefixOn, prefixOff);
// }
//
// public static String getBucket() {
// return bucket;
// }
//
// public static String getCutFileUrl(String fileUrl) {
// log.info("出参_补图_原路径:{},前缀:{},存储桶:{}", new Object[]{fileUrl, getPrefix(), getBucket()});
// String cutFileUrl = getCutFileUrl(fileUrl, getPrefix(), getBucket());
// log.info("出参_补图_补图后路径:{}", cutFileUrl);
// return cutFileUrl;
// }
//
// public static String getCutPath(String fileUrl) {
// log.info("入参_裁图_原路径:{},前缀:{},存储桶:{}", new Object[]{fileUrl, getPrefix(), getBucket()});
// if (!CharSequenceUtil.isBlank(fileUrl) && !fileUrl.startsWith(getBucket())) {
// if (Boolean.FALSE.equals(getOssProperties().getUseToken())) {
// return fileUrl.replace(getPrefix(), getBucket());
// } else {
// fileUrl = getUnEncodeUrl(fileUrl);
// fileUrl = fileUrl.replace(getPrefix(), getBucket());
// fileUrl = getCutSignUrl(fileUrl);
// log.info("入参_裁图_裁剪后路径:{}", fileUrl);
// return fileUrl;
// }
// } else {
// return fileUrl;
// }
// }
//
// public static String getCutPathMulti(String fileUrl) {
// return CharSequenceUtil.contains(fileUrl, ",") ? (String)CharSequenceUtil.split(fileUrl, ",", true, true).stream().map(SysUtil::getCutPath).collect(Collectors.joining(",")) : getCutPath(fileUrl);
// }
//
// public static String getFilePath(String fileUrl) {
// if (CharSequenceUtil.isBlank(fileUrl)) {
// return fileUrl;
// } else {
// String cutPath = getCutPath(fileUrl);
// return cutPath.replace(getBucket(), "");
// }
// }
//
// public static String getObjectName(String fileUrl) {
// if (CharSequenceUtil.isBlank(fileUrl)) {
// return fileUrl;
// } else {
// String cutPath = getCutPath(fileUrl);
// String replace = cutPath.replace(getBucket(), "");
// if (CharSequenceUtil.startWith(replace, "/")) {
// replace = replace.substring(1);
// }
//
// return replace;
// }
// }
//
// public static InputStream getInputStream(String fileUrl) {
// OssTemplate ossTemplate = (OssTemplate)SpringContextHolder.getBean(OssTemplate.class);
// OssProperties ossProperties = (OssProperties)SpringContextHolder.getBean(OssProperties.class);
// return ossTemplate.getObject(ossProperties.getBucketName(), getObjectName(fileUrl));
// }
//
// public static void removeOssObject(String fileUrl) {
// if (!CharSequenceUtil.isBlank(fileUrl)) {
// OssTemplate ossTemplate = (OssTemplate)SpringContextHolder.getBean(OssTemplate.class);
// OssProperties ossProperties = (OssProperties)SpringContextHolder.getBean(OssProperties.class);
//
// try {
// ossTemplate.removeObject(ossProperties.getBucketName(), getObjectName(fileUrl));
// } catch (Exception var4) {
// log.error("路径:{}删除异常:{}", new Object[]{fileUrl, var4.getMessage(), var4});
// }
//
// }
// }
//
// public static OssTemplate getOssTemplate() {
// return (OssTemplate) SpringContextHolder.getBean(OssTemplate.class);
// }
//
// public static OssProperties getOssProperties() {
// return (OssProperties)SpringContextHolder.getBean(OssProperties.class);
// }
//
// public static String getUnEncodeUrl(String url) {
// if (CharSequenceUtil.isBlank(url)) {
// return url;
// } else {
// try {
// String decodedUrl = URLDecoder.decode(url);
// return !decodedUrl.equals(url) ? decodedUrl : url;
// } catch (IllegalArgumentException var2) {
// log.info("图片url解码失败,图片url:{},异常信息_:{},详情_:", new Object[]{url, var2.getMessage(), var2});
// return url;
// }
// }
// }
//
// public static String getCutSignUrl(String fileUrl) {
// return CharSequenceUtil.isNotBlank(fileUrl) && fileUrl.contains("?") ? fileUrl.substring(0, fileUrl.indexOf("?")) : fileUrl;
// }
//
// public static String getCutFileUrl(String fileUrl, String filePrefix, String prefixBucket) {
// if (CharSequenceUtil.isBlank(fileUrl)) {
// return fileUrl;
// } else if (Boolean.FALSE.equals(getOssProperties().getUseToken())) {
// return !fileUrl.startsWith("http") && !fileUrl.startsWith("https") ? fileUrl.replace(prefixBucket, filePrefix) : fileUrl;
// } else {
// if (fileUrl.startsWith("http") || fileUrl.startsWith("https")) {
// fileUrl = fileUrl.replace(filePrefix + "/", "");
// }
//
// fileUrl = getCutSignUrl(fileUrl);
// fileUrl = fileUrl.replace(prefixBucket + "/", "");
// return getOssTemplate().getObjectURL(prefixBucket, fileUrl, getOssProperties().getExpiresTime());
// }
// }
//
// public static String getCutFileUrl4Open(String fileUrl) {
// fileUrl = getCutFileUrl(fileUrl, getPrefix(), getBucket());
// return !CharSequenceUtil.isBlank(fileUrl) && !fileUrl.startsWith(getBucket()) ? fileUrl.replace(getPrefix(), getBucket()) : fileUrl;
// }
//}

View File

@ -1,18 +0,0 @@
//package com.bonus.core.common.utils;
//
//import javax.servlet.http.HttpServletRequest;
//import org.springframework.web.context.request.RequestContextHolder;
//import org.springframework.web.context.request.ServletRequestAttributes;
//import java.util.Objects;
//
//public class SysUtilProxy {
// public String getPrefix(String prefixOn, String prefixOff) {
// if (RequestContextHolder.getRequestAttributes() != null) {
// HttpServletRequest request = ((ServletRequestAttributes)Objects.requireNonNull(RequestContextHolder.getRequestAttributes())).getRequest();
// String headerValue = request.getHeader("X-Env");
// return "online".equals(headerValue) ? prefixOn : prefixOff;
// } else {
// return prefixOff;
// }
// }
//}