|
@@ -6,6 +6,7 @@ import com.aliyun.oss.OSSException;
|
|
import com.aliyun.oss.model.*;
|
|
import com.aliyun.oss.model.*;
|
|
import com.jeeplus.common.config.Global;
|
|
import com.jeeplus.common.config.Global;
|
|
import com.jeeplus.common.utils.Encodes;
|
|
import com.jeeplus.common.utils.Encodes;
|
|
|
|
+import com.jeeplus.common.utils.StringUtils;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.LoggerFactory;
|
|
import org.slf4j.LoggerFactory;
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
@@ -620,7 +621,22 @@ public class OSSClientUtil {
|
|
* @param response
|
|
* @param response
|
|
*/
|
|
*/
|
|
public void downByStream(String key, String fileName, HttpServletResponse response,String agent){
|
|
public void downByStream(String key, String fileName, HttpServletResponse response,String agent){
|
|
|
|
+ downByStream(key,fileName,response,agent,null);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 附件下载
|
|
|
|
+ * @param key
|
|
|
|
+ * @param fileName
|
|
|
|
+ * @param response
|
|
|
|
+ * @param agent
|
|
|
|
+ * @param bucketName
|
|
|
|
+ */
|
|
|
|
+ public void downByStream(String key, String fileName, HttpServletResponse response,String agent,String bucketName){
|
|
try {
|
|
try {
|
|
|
|
+ if (StringUtils.isEmpty(bucketName)) {
|
|
|
|
+ bucketName = this.bucketName;
|
|
|
|
+ }
|
|
String newName = URLEncoder.encode(fileName, "UTF-8").replaceAll("\\+", "%20").replaceAll("%28", "\\(").replaceAll("%29", "\\)").replaceAll("%3B", ";").replaceAll("%40", "@").replaceAll("%23", "\\#").replaceAll("%26", "\\&").replaceAll("%2C", "\\,");
|
|
String newName = URLEncoder.encode(fileName, "UTF-8").replaceAll("\\+", "%20").replaceAll("%28", "\\(").replaceAll("%29", "\\)").replaceAll("%3B", ";").replaceAll("%40", "@").replaceAll("%23", "\\#").replaceAll("%26", "\\&").replaceAll("%2C", "\\,");
|
|
// 创建OSSClient实例
|
|
// 创建OSSClient实例
|
|
OSSObject ossObject = ossClient.getObject(bucketName, key);
|
|
OSSObject ossObject = ossClient.getObject(bucketName, key);
|