sugb преди 9 месеца
родител
ревизия
a5fa4a93be

+ 2 - 2
jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/oss/OssBootUtil.java

@@ -136,7 +136,7 @@ public class OssBootUtil {
             }
             PutObjectResult result = ossClient.putObject(newBucket, fileUrl.toString(), file.getInputStream());
             // 设置权限(公开读)
-//            ossClient.setBucketAcl(newBucket, CannedAccessControlList.PublicRead);
+            ossClient.setBucketAcl(newBucket, CannedAccessControlList.PublicRead);
             if (result != null) {
                 log.info("------OSS文件上传成功------" + fileUrl);
             }
@@ -336,7 +336,7 @@ public class OssBootUtil {
         }
         PutObjectResult result = ossClient.putObject(bucketName, fileUrl.toString(),stream);
         // 设置权限(公开读)
-        ossClient.setBucketAcl(bucketName, CannedAccessControlList.PublicRead);
+        //ossClient.setBucketAcl(bucketName, CannedAccessControlList.PublicRead);
         if (result != null) {
             log.info("------OSS文件上传成功------" + fileUrl);
         }

+ 13 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/controller/CommonController.java

@@ -90,6 +90,7 @@ public class CommonController {
                 bizPath = "";
             }
         }
+        //本地
         if(CommonConstant.UPLOAD_TYPE_LOCAL.equals(uploadType)){
             //update-begin-author:lvdandan date:20200928 for:修改JEditor编辑器本地上传
             savePath = this.uploadLocal(file,bizPath);
@@ -105,6 +106,8 @@ public class CommonController {
                 savePath = this.uploadLocal(file,bizPath);
             }
             */
+            log.info("本地路径:{}",savePath);
+            log.info("上传路径:{}",bizPath);
         }else{
             //update-begin-author:taoyan date:20200814 for:文件上传改造
             savePath = CommonUtils.upload(file, bizPath, uploadType);
@@ -145,8 +148,17 @@ public class CommonController {
                 fileName = orgName+ "_" + System.currentTimeMillis();
             }
             String savePath = file.getPath() + File.separator + fileName;
+            log.info("最终上传路径:{}",savePath);
             File savefile = new File(savePath);
             FileCopyUtils.copy(mf.getBytes(), savefile);
+            try {
+                if (System.getProperty("os.name").toLowerCase().contains("linux")) {
+                    Runtime.getRuntime().exec(new String[]{"chmod", "644", file.getPath()});
+                }
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+            log.info("上传完成:{}",savefile.getName());
             String dbpath = null;
             if(oConvertUtils.isNotEmpty(bizPath)){
                 dbpath = bizPath + File.separator + fileName;
@@ -286,7 +298,7 @@ public class CommonController {
             if (imgPath.endsWith(",")) {
                 imgPath = imgPath.substring(0, imgPath.length() - 1);
             }
-            String filePath = "D:/images" + File.separator + imgPath;
+            String filePath = uploadpath + File.separator + imgPath;
             File file = new File(filePath);
             if(!file.exists()){
                 response.setStatus(404);

+ 3 - 3
jeecg-boot-module-system/src/main/resources/application-prod.yml

@@ -201,8 +201,8 @@ jeecg:
   path:
     #文件上传根目录 设置
     # /usr/local/webserver/nginx/html/tdzcxx
-    # upload: D:/upload
-    upload: /opt/tdzcxx/data
+    #upload: D:/upload
+    upload: /usr/local/nginx/html/images/upload
     #webapp文件路径
     webapp: /opt/jeecg-boot/webapp
   shiro:
@@ -289,7 +289,7 @@ knife4j:
   basic:
     enable: true
     username: jeecg
-    password: jeecg1314
+    password: jeecg1314122
 #第三方登录
 justauth:
   enabled: true