lyhzzz 3 лет назад
Родитель
Сommit
c69a91dd92
21 измененных файлов с 30 добавлено и 1745 удалено
  1. 1 1
      4dkankan-center-modeling/pom.xml
  2. 1 1
      4dkankan-center-modeling/src/main/java/com/fdkankan/modeling/ModelingApplication.java
  3. 1 1
      4dkankan-center-modeling/src/main/java/com/fdkankan/modeling/receiver/BuildSceneMQListener.java
  4. 5 21
      4dkankan-center-platform/pom.xml
  5. 0 54
      4dkankan-center-platform/src/main/java/com/fdkankan/platform/user/common/util/LogoConfig.java
  6. 0 104
      4dkankan-center-platform/src/main/java/com/fdkankan/platform/user/common/util/MatrixToImageWriterUtil.java
  7. 0 158
      4dkankan-center-platform/src/main/java/com/fdkankan/platform/user/common/util/QiniuUpload.java
  8. 0 237
      4dkankan-center-platform/src/main/java/com/fdkankan/platform/user/common/util/QiniuUtil.java
  9. 1 1
      4dkankan-center-platform/src/main/java/com/fdkankan/platform/user/service/impl/UserServiceImpl.java
  10. 0 1
      4dkankan-center-platform/src/main/java/com/fdkankan/platform/user/service/sso/LoginService.java
  11. 6 0
      4dkankan-center-scene/pom.xml
  12. 1 0
      4dkankan-center-scene/src/main/java/com/fdkankan/scene/SceneApplication.java
  13. 1 1
      4dkankan-center-scene/src/main/java/com/fdkankan/scene/service/impl/Scene3dfamilyServiceImpl.java
  14. 1 1
      4dkankan-center-scene/src/main/java/com/fdkankan/scene/service/impl/SceneAppServiceImpl.java
  15. 1 0
      4dkankan-center-scene/src/main/java/com/fdkankan/scene/service/impl/SceneFileBuildServiceImpl.java
  16. 1 0
      4dkankan-center-scene/src/main/java/com/fdkankan/scene/service/impl/SceneProAppServiceImpl.java
  17. 1 0
      4dkankan-center-scene/src/main/java/com/fdkankan/scene/service/impl/SceneProServiceImpl.java
  18. 9 5
      4dkankan-center-scene/src/main/java/com/fdkankan/scene/service/impl/SceneServiceImpl.java
  19. 0 169
      4dkankan-common/src/main/java/com/fdkankan/common/util/QiniuUpload.java
  20. 0 262
      4dkankan-common/src/main/java/com/fdkankan/common/util/QiniuUtil.java
  21. 0 728
      4dkankan-common/src/main/java/com/fdkankan/common/util/UploadToOssUtil.java

+ 1 - 1
4dkankan-center-modeling/pom.xml

@@ -28,7 +28,7 @@
 		</dependency>
 		<dependency>
 			<groupId>com.fdkankan</groupId>
-			<artifactId>4dkankan-common-utils</artifactId>
+			<artifactId>4dkankan-utils-fyun</artifactId>
 			<version>2.0.0</version>
 		</dependency>
 

+ 1 - 1
4dkankan-center-modeling/src/main/java/com/fdkankan/modeling/ModelingApplication.java

@@ -12,7 +12,7 @@ import org.springframework.context.annotation.ComponentScan;
 @ComponentScan(basePackages = {
 		"com.fdkankan.common",
 		"com.fdkankan.modeling",
-		"com.fdkankan.oss",
+		"com.fdkankan.fyun",
 		"com.fdkankan.redis",
 		"com.fdkankan.mq",
 		"com.fdkankan.db"})

+ 1 - 1
4dkankan-center-modeling/src/main/java/com/fdkankan/modeling/receiver/BuildSceneMQListener.java

@@ -5,7 +5,7 @@ import cn.hutool.core.util.StrUtil;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.fdkankan.common.util.ComputerUtil;
-import com.fdkankan.common.util.UploadToOssUtil;
+import com.fdkankan.fyun.oss.UploadToOssUtil;
 import com.fdkankan.modeling.constants.RedisKey;
 import com.fdkankan.modeling.constants.SysConstants;
 import com.fdkankan.modeling.entity.SceneFileBuild;

+ 5 - 21
4dkankan-center-platform/pom.xml

@@ -49,38 +49,22 @@
           <groupId>org.projectlombok</groupId>
           <artifactId>lombok</artifactId>
       </dependency>
-<!--      二维码-->
-      <dependency>
-          <groupId>com.github.penggle</groupId>
-          <artifactId>kaptcha</artifactId>
-          <version>2.3.2</version>
-      </dependency>
-      <dependency>
-          <groupId>com.google.zxing</groupId>
-          <artifactId>core</artifactId>
-          <version>2.1</version>
-      </dependency>
-      <dependency>
-          <groupId>com.google.code.gson</groupId>
-          <artifactId>gson</artifactId>
-          <version>2.8.5</version>
-      </dependency>
 
       <dependency>
-          <groupId>com.qiniu</groupId>
-          <artifactId>qiniu-java-sdk</artifactId>
-          <version>7.2.0</version>
+          <groupId>com.fdkankan</groupId>
+          <artifactId>4dkankan-utils-mq</artifactId>
+          <version>2.0.0</version>
       </dependency>
 
       <dependency>
           <groupId>com.fdkankan</groupId>
-          <artifactId>4dkankan-utils-mq</artifactId>
+          <artifactId>4dkankan-utils-db</artifactId>
           <version>2.0.0</version>
       </dependency>
 
       <dependency>
           <groupId>com.fdkankan</groupId>
-          <artifactId>4dkankan-utils-db</artifactId>
+          <artifactId>4dkankan-utils-fyun</artifactId>
           <version>2.0.0</version>
       </dependency>
 

+ 0 - 54
4dkankan-center-platform/src/main/java/com/fdkankan/platform/user/common/util/LogoConfig.java

@@ -1,54 +0,0 @@
-package com.fdkankan.platform.user.common.util;
-
-import javax.imageio.ImageIO;
-import java.awt.*;
-import java.awt.geom.RoundRectangle2D;
-import java.awt.image.BufferedImage;
-import java.io.File;
-import java.io.IOException;
-
-public class LogoConfig {
-    /**
-     * 设置 logo
-     * @param matrixImage 源二维码图片
-     * @return 返回带有logo的二维码图片
-     * @throws IOException
-     * @author Administrator sangwenhao
-     */
-    public BufferedImage LogoMatrix(BufferedImage matrixImage, String logoPath) throws IOException{
-        /**
-         * 读取二维码图片,并构建绘图对象
-         */
-        Graphics2D g2 = matrixImage.createGraphics();
-
-        int matrixWidth = matrixImage.getWidth();
-        int matrixHeigh = matrixImage.getHeight();
-        /**
-         * 读取Logo图片
-         */
-        if(logoPath == null){
-            logoPath = this.getClass().getResource("/static/img/logo.png").getPath();
-        }
-        BufferedImage logo = ImageIO.read(new File(logoPath));
-
-        //开始绘制图片
-        g2.drawImage(logo,matrixWidth/5*2,matrixHeigh/5*2, matrixWidth/5, matrixHeigh/5, null);//绘制
-        BasicStroke stroke = new BasicStroke(5,BasicStroke.CAP_ROUND,BasicStroke.JOIN_ROUND);
-        g2.setStroke(stroke);// 设置笔画对象
-        //指定弧度的圆角矩形
-        RoundRectangle2D.Float round = new RoundRectangle2D.Float(matrixWidth/5*2, matrixHeigh/5*2, matrixWidth/5, matrixHeigh/5,20,20);
-        g2.setColor(Color.white);
-        g2.draw(round);// 绘制圆弧矩形
-
-        //设置logo 有一道灰色边框
-        BasicStroke stroke2 = new BasicStroke(1,BasicStroke.CAP_ROUND,BasicStroke.JOIN_ROUND);
-        g2.setStroke(stroke2);// 设置笔画对象
-        RoundRectangle2D.Float round2 = new RoundRectangle2D.Float(matrixWidth/5*2+2, matrixHeigh/5*2+2, matrixWidth/5-4, matrixHeigh/5-4,20,20);
-        g2.setColor(new Color(128,128,128));
-        g2.draw(round2);// 绘制圆弧矩形
-
-        g2.dispose();
-        matrixImage.flush() ;
-        return matrixImage ;
-    }
-}

+ 0 - 104
4dkankan-center-platform/src/main/java/com/fdkankan/platform/user/common/util/MatrixToImageWriterUtil.java

@@ -1,104 +0,0 @@
-package com.fdkankan.platform.user.common.util;
-
-import com.fdkankan.common.util.FileUtils;
-import com.google.zxing.BarcodeFormat;
-import com.google.zxing.EncodeHintType;
-import com.google.zxing.MultiFormatWriter;
-import com.google.zxing.common.BitMatrix;
-import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.imageio.ImageIO;
-import java.awt.image.BufferedImage;
-import java.io.File;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.util.Hashtable;
-
-public class MatrixToImageWriterUtil {
-    private static Logger log = LoggerFactory.getLogger("programLog");
-
-    private static final int BLACK = 0xFF000000;//用于设置图案的颜色
-    private static final int WHITE = 0xFFFFFFFF; //用于背景色
-
-    private MatrixToImageWriterUtil() {}
-
-    public static BufferedImage toBufferedImage(BitMatrix matrix) {
-        int width = matrix.getWidth();
-        int height = matrix.getHeight();
-        BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
-        for (int x = 0; x < width; x++) {
-            for (int y = 0; y < height; y++) {
-                image.setRGB(x, y, (matrix.get(x, y) ? BLACK : WHITE));
-//              image.setRGB(x, y,  (matrix.get(x, y) ? Color.YELLOW.getRGB() : Color.CYAN.getRGB()));
-            }
-        }
-        return image;
-    }
-
-    public static boolean writeToFile(BitMatrix matrix, String format, File file, String logoPath) throws IOException {
-        BufferedImage image = toBufferedImage(matrix);
-        //设置logo图标
-        LogoConfig logoConfig = new LogoConfig();
-        image = logoConfig.LogoMatrix(image, logoPath);
-
-        File parFile = new File(file.getParent() + File.separator);
-        if (!parFile.exists()){
-            parFile.mkdirs();
-        }
-
-        if (!ImageIO.write(image, format, file)) {
-            //throw new IOException("Could not write an image of format " + format + " to " + file);
-            log.info("Could not write an image of format " + format + " to " + file);
-            return false;
-        } else {
-            log.info("二维码生成成功!");
-            return true;
-        }
-    }
-
-    public static void writeToStream(BitMatrix matrix, String format, OutputStream stream) throws IOException {
-        BufferedImage image = toBufferedImage(matrix);
-        //设置logo图标
-        LogoConfig logoConfig = new LogoConfig();
-        image = logoConfig.LogoMatrix(image, null);
-
-        if (!ImageIO.write(image, format, stream)) {
-            throw new IOException("Could not write an image of format " + format);
-        }
-    }
-
-    //url
-    public static boolean createQRCode(String url, String outPath, String logoPath) throws Exception {
-        // 生成二维码
-
-        int width = 3000; // 二维码图片宽度 300
-        int height = 3000; // 二维码图片高度300
-
-        String format = "jpg";// 二维码的图片格式 gif
-
-        Hashtable<EncodeHintType, Object> hints = new Hashtable<EncodeHintType, Object>();
-        // 指定纠错等级,纠错级别(L 7%、M 15%、Q 25%、H 30%)
-        hints.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.H);
-        // 内容所使用字符集编码
-        hints.put(EncodeHintType.CHARACTER_SET, "utf-8");
-//      hints.put(EncodeHintType.MAX_SIZE, 350);//设置图片的最大值
-//      hints.put(EncodeHintType.MIN_SIZE, 100);//设置图片的最小值
-        hints.put(EncodeHintType.MARGIN, 1);//设置二维码边的空度,非负数
-
-        BitMatrix bitMatrix = new MultiFormatWriter().encode(url,
-                //编码类型,目前zxing支持:Aztec 2D,CODABAR 1D format,Code 39 1D,Code 93 1D ,Code 128 1D,
-                //Data Matrix 2D , EAN-8 1D,EAN-13 1D,ITF (Interleaved Two of Five) 1D,
-                //MaxiCode 2D barcode,PDF417,QR Code 2D,RSS 14,RSS EXPANDED,UPC-A 1D,UPC-E 1D,UPC/EAN extension,UPC_EAN_EXTENSION
-                BarcodeFormat.QR_CODE,
-                width, //条形码的宽度
-                height, //条形码的高度
-                hints);//生成条形码时的一些配置,此项可选
-
-        //File outputFile = new File("d:" + File.separator + "new-1.gif");//指定输出路径
-        File outputFile = new File(outPath);//指定输出路径
-        FileUtils.deleteFile(outPath);
-        return writeToFile(bitMatrix, format, outputFile, logoPath);
-    }
-}

+ 0 - 158
4dkankan-center-platform/src/main/java/com/fdkankan/platform/user/common/util/QiniuUpload.java

@@ -1,158 +0,0 @@
-package com.fdkankan.platform.user.common.util;
-
-import com.google.gson.Gson;
-import com.qiniu.cdn.CdnManager;
-import com.qiniu.common.QiniuException;
-import com.qiniu.http.Response;
-import com.qiniu.storage.BucketManager;
-import com.qiniu.storage.Configuration;
-import com.qiniu.storage.UploadManager;
-import com.qiniu.storage.model.DefaultPutRet;
-import com.qiniu.util.Auth;
-import com.qiniu.util.StringMap;
-import com.qiniu.util.UrlSafeBase64;
-
-import java.io.File;
-
-
-public class QiniuUpload {
-    //删除文件
-    public static void delete(String key) throws QiniuException{
-        Configuration cfg = new Configuration(QiniuUtil.zone);
-        Auth auth = Auth.create(QiniuUtil.accessKey, QiniuUtil.secretKey);
-        BucketManager bucketManager = new BucketManager(auth, cfg);
-        bucketManager.delete(QiniuUtil.bucket, key);
-    }
-
-    //刷新文件
-    public static void refresh(String url) throws QiniuException{
-        String [] urls = {url};
-        Auth auth = Auth.create(QiniuUtil.accessKey, QiniuUtil.secretKey);
-        CdnManager c = new CdnManager(auth);
-        Response response = c.refreshUrls(urls);
-    }
-
-
-    /**
-     * 上传单个文件到七牛云
-     * @param key
-     * @param localFilePath
-     */
-    public static boolean setFileToBucket(String key, String localFilePath){
-        Configuration cfg = new Configuration(QiniuUtil.zone);
-        Auth auth = Auth.create(QiniuUtil.accessKey, QiniuUtil.secretKey);
-        UploadManager uploadManager = new UploadManager(cfg);
-
-        String upToken = auth.uploadToken(QiniuUtil.bucket);
-
-        try {
-            Response response = uploadManager.put(localFilePath, key, upToken);
-            //解析上传成功的结果
-            DefaultPutRet putRet = new Gson().fromJson(response.bodyString(), DefaultPutRet.class);
-            System.out.println(putRet.key);
-            System.out.println(putRet.hash);
-            return true;
-        } catch (QiniuException ex) {
-            Response r = ex.response;
-            System.err.println(r.toString());
-            try {
-                System.err.println(r.bodyString());
-            } catch (QiniuException ex2) {
-            }
-            return false;
-        }
-    }
-
-    /**
-     * 上传本地目录下所有文件到七牛云上
-     * @param remoteFolder
-     * @param localFolderPath
-     */
-    public static void setFilesToBucket(String remoteFolder, String localFolderPath) {
-        Configuration cfg = new Configuration(QiniuUtil.zone);
-        Auth auth = Auth.create(QiniuUtil.accessKey, QiniuUtil.secretKey);
-        UploadManager uploadManager = new UploadManager(cfg);
-
-        File file = new File(localFolderPath);
-        File[] files = file.listFiles();// 获取目录下的所有文件或文件夹
-        if (files == null) {// 如果目录为空,直接退出
-            return;
-        }
-
-        // 遍历,目录下的所有文件
-        for (File f : files) {
-            if (f.isFile()) {
-                String key = f.getName();
-                if (remoteFolder != null) {
-                    key = remoteFolder + key;
-                }
-                // 再上传文件
-                String upToken = auth.uploadToken(QiniuUtil.bucket);
-                try {
-                    Response res = uploadManager.put(f, key, upToken);
-                    System.out.println(res.bodyString());
-                } catch (QiniuException e) {
-                    Response r = e.response;
-                    System.err.println(r.toString());
-                    try {
-                        System.err.println(r.bodyString());
-                    } catch (QiniuException ex2) {
-                    }
-                }
-            } else if (f.isDirectory()) {
-                String key = f.getName() + "/";
-                if (remoteFolder != null) {
-                    key = remoteFolder + key;
-                }
-                setFilesToBucket(key, f.getAbsolutePath());
-            }
-        }
-    }
-
-    /**
-     * 测试七牛上传后,自动进行数据处理操作,并另存处理后的文件
-     * @param domain 存储空间所对应的域名
-     * @param file 上传文件
-     */
-    public static void testFops(String domain, File file) {
-        //通过AK,SK创建Auth 对象
-        Auth auth = Auth.create(QiniuUtil.accessKey, QiniuUtil.secretKey);
-        Configuration cfg = new Configuration(QiniuUtil.zone);
-        //上传对象
-        UploadManager uploadMgr = new UploadManager(cfg);
-        //私有队列
-        String pipeline = "av-pipeline";
-        //水印文字
-        String wmText = UrlSafeBase64.encodeToString("Word For Test");
-        //水印文字的颜色
-        String wmFontColor = UrlSafeBase64.encodeToString("#FFFF00");
-        //设置avthumb 接口
-        StringBuffer ops = new StringBuffer("");
-        ops.append("avthumb/mp4/wmText/" + wmText +"/wmGravityText/NorthEast/wmFontColor/" + wmFontColor);
-        String saveAs = UrlSafeBase64.encodeToString(QiniuUtil.bucket + ":" + "new_" + file.getName());
-        //通过管道符 "|" 拼接 saveas 接口, 保存 数据处理后的视频
-        ops.append("|saveas/" + saveAs);
-        //saveas 接口 需要签名 sign
-        String sign = domain + "/" + file.getName() + "?" + ops.toString();
-        String encodeSign = UrlSafeBase64.encodeToString(sign);
-        ops.append("/sign/" + encodeSign);
-        //指定 数据处理 的 上传策略, 当文件上传成功后,自定执行数据处理操作,即:ops 的接口,图片加水印,另存为 new_file.getName();
-        StringMap putPolicy = new StringMap();
-        putPolicy.put("persistentOps", ops.toString())      //数据处理接口及参数
-                .put("persistentPipeline", pipeline);      //私有数据处理队列
-
-        //获取上传凭证, 包含上传策略
-        String uploadToken = auth.uploadToken(QiniuUtil.bucket, file.getName(), 3600, putPolicy);
-
-        try {
-            //上传
-            Response resp = uploadMgr.put(file, file.getName(), uploadToken);
-            //查看结果
-            System.out.println(resp.statusCode + ":" + resp.bodyString());
-        } catch (QiniuException e) {
-            // TODO Auto-generated catch block
-            e.printStackTrace();
-        }
-
-    }
-}

+ 0 - 237
4dkankan-center-platform/src/main/java/com/fdkankan/platform/user/common/util/QiniuUtil.java

@@ -1,237 +0,0 @@
-package com.fdkankan.platform.user.common.util;
-
-import com.qiniu.common.Zone;
-import com.qiniu.util.Auth;
-import com.qiniu.util.UrlSafeBase64;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.http.HttpResponse;
-import org.apache.http.client.HttpClient;
-import org.apache.http.client.methods.HttpPost;
-import org.apache.http.entity.StringEntity;
-import org.apache.http.impl.client.DefaultHttpClient;
-import org.apache.http.protocol.HTTP;
-import org.apache.http.util.EntityUtils;
-
-import java.io.IOException;
-import java.net.URLEncoder;
-
-public class QiniuUtil {
-
-    public static String accessKey = "dlPPwgZky_F-iP8CbSbJpiAtAcqw3BYwb9rdHMrS";
-    public static String secretKey = "YEtkLKDsImXB-8m1CT1zV_YwCwwGvrUvo2ktj9KZ";
-    public static Zone zone = Zone.zone1();
-    public static String bucket = "scene3d";
-    public static String remoteUrl = "https://4dkanzhan.4dkankan.com/";
-
-    /**
-     * 视频帧缩略图接口(vframe)用于从视频流中截取指定时刻的单帧画面并按指定大小缩放成图片
-     * @param key 文件名  a.mp4
-     * @param suffixName 输出的目标截图格式,支持jpg、png等。
-     * @param second 指定截取视频的时刻,单位:秒,精确到毫秒。
-     * @param width 缩略图宽度,单位:像素(px),取值范围为1-3840, 可不传。
-     * @param height 缩略图高度,单位:像素(px),取值范围为1-2160, 可不传。
-     * @param rotate 指定顺时针旋转的度数,可取值为90、180、270、auto,默认为不旋转,可不传。
-     * @param newKey 新文件名称
-     * @param notifyURL 回调地址
-     * @throws IOException
-     */
-    public static void getVideoFrame(String key, String suffixName, String second, Integer width, Integer height, Integer rotate, String newKey, String notifyURL) throws IOException {
-        StringBuffer sb = new StringBuffer("vframe/").append(suffixName).append("/offset/").append(second);
-        if (width != null){
-            sb.append("/w/").append(width);
-        }
-        if (height != null){
-            sb.append("/h/").append(height);
-        }
-        if (rotate != null){
-            sb.append("/rotate/").append(rotate);
-        }
-
-        String fop = URLEncoder.encode(sb.toString(), "utf-8");
-        StringBuffer ops = new StringBuffer("bucket=").append(bucket).append("&key=").append(key).append("&fops=").append(fop);
-        String saveAs = UrlSafeBase64.encodeToString(bucket + ":" + newKey);
-        ops.append("|saveas/").append(saveAs);
-
-        ops.append("&notifyURL=").append(notifyURL);
-
-        HttpPost post = new HttpPost("http://api.qiniu.com/pfop/");
-        post.setHeader(HTTP.CONTENT_TYPE, "application/x-www-form-urlencoded");
-        StringEntity entity = new StringEntity(ops.toString(), "utf-8");
-        entity.setContentType("application/x-www-form-urlencoded");
-        post.setEntity(entity);
-
-        Auth auth = Auth.create(accessKey, secretKey);
-        String si = auth.signRequest("http://api.qiniu.com/pfop/", ops.toString().getBytes(), "application/x-www-form-urlencoded");
-        post.setHeader("Authorization", "QBox " + si);
-        HttpClient client = new DefaultHttpClient();
-        HttpResponse res = client.execute(post);
-        String ret = EntityUtils.toString(res.getEntity(), "UTF-8");
-        System.out.println(ret);
-
-    }
-
-    /**
-     * 给视频添加水印
-     * @param key a.mp4
-     * @param text  4dage
-     * @param fontColor #FFFF00
-     * @param newKey new_a.mp4
-     * @param notifyURL 回调地址
-     * @throws IOException
-     */
-    public static void waterMark(String key, String text, String fontColor, String newKey, String notifyURL) throws IOException {
-        String fop = "avthumb/mp4/";
-        fop = URLEncoder.encode(fop, "utf-8");
-        //水印文字
-        String wmText = UrlSafeBase64.encodeToString(text);
-        //水印文字的颜色
-        String wmFontColor = UrlSafeBase64.encodeToString(fontColor);
-        //设置avthumb 接口
-        StringBuffer ops = new StringBuffer("bucket=").append(bucket).append("&key=").append(key).append("&fops=").append(fop);
-        ops.append("avthumb/mp4/wmText/").append(wmText).append("/wmGravityText/NorthEast/wmFontColor/").append(wmFontColor);
-        String saveAs = UrlSafeBase64.encodeToString(bucket + ":" + newKey);
-        ops.append("|saveas/").append(saveAs);
-        ops.append("&notifyURL=").append(notifyURL);
-
-        HttpPost post = new HttpPost("http://api.qiniu.com/pfop/");
-        post.setHeader(HTTP.CONTENT_TYPE, "application/x-www-form-urlencoded");
-        StringEntity entity = new StringEntity(ops.toString(), "utf-8");
-        entity.setContentType("application/x-www-form-urlencoded");
-        post.setEntity(entity);
-
-        Auth auth = Auth.create(accessKey, secretKey);
-        String si = auth.signRequest("http://api.qiniu.com/pfop/", ops.toString().getBytes(), "application/x-www-form-urlencoded");
-        post.setHeader("Authorization", "QBox " + si);
-        HttpClient client = new DefaultHttpClient();
-        HttpResponse res = client.execute(post);
-        String ret = EntityUtils.toString(res.getEntity(), "UTF-8");
-        System.out.println(ret);
-    }
-
-    /**
-     * 将4K图片裁剪成64张512*512
-     * @param key
-     * @param notifyURL  回调地址 "http://wwww.cn/qn/notify&force=1"
-     * @throws IOException
-     */
-    public static void crop4K(String key, String notifyURL) throws IOException {
-        String fop = "imageMogr2/auto-orient/";
-        fop = URLEncoder.encode(fop, "utf-8");
-
-        String fileName = key.substring(0, key.lastIndexOf("."));
-        String suffixName = key.substring(key.lastIndexOf("."));
-
-        Auth auth = Auth.create(accessKey, secretKey);
-
-        for (int i = 0; i < 8; i++) {
-            for (int j = 0; j < 8; j++) {
-                String ret = crop(key, notifyURL, fop, fileName, suffixName, auth, i, j);
-                System.out.println(ret);
-            }
-        }
-    }
-
-    /**
-     * 将2K图片裁剪成16张512*512
-     * @param key
-     * @param notifyURL 回调地址 "http://wwww.cn/qn/notify&force=1"
-     * @throws IOException
-     */
-    public static void crop2k(String key, String notifyURL) throws IOException {
-        String fop = "imageMogr2/auto-orient/";
-        fop = URLEncoder.encode(fop, "utf-8");
-
-        String fileName = key.substring(0, key.lastIndexOf("."));
-        String suffixName = key.substring(key.lastIndexOf("."));
-
-        Auth auth = Auth.create(accessKey, secretKey);
-
-        for (int i = 0; i < 4; i++) {
-            for (int j = 0; j < 4; j++) {
-                String ret = crop(key, notifyURL, fop, fileName, suffixName, auth, i, j);
-                System.out.println(ret);
-            }
-        }
-    }
-
-    /**
-     * 将1K图片裁剪成4张512*512
-     * @param key
-     * @param notifyURL 回调地址 "http://wwww.cn/qn/notify&force=1"
-     * @throws IOException
-     */
-    public static void crop1k(String key, String notifyURL) throws IOException {
-        String fop = "imageMogr2/auto-orient/";
-        fop = URLEncoder.encode(fop, "utf-8");
-
-        String fileName = key.substring(0, key.lastIndexOf("."));
-        String suffixName = key.substring(key.lastIndexOf("."));
-
-        Auth auth = Auth.create(accessKey, secretKey);
-
-        for (int i = 0; i < 2; i++) {
-            for (int j = 0; j < 2; j++) {
-                String ret = crop(key, notifyURL, fop, fileName, suffixName, auth, i, j);
-                System.out.println(ret);
-            }
-        }
-    }
-
-    private static String crop(String key, String notifyURL, String fop, String fileName, String suffixName, Auth auth, int i, int j) throws IOException {
-        StringBuffer ops = new StringBuffer("bucket=").append(bucket).append("&key=").append(key).append("&fops=").append(fop);
-        ops.append("crop/!512x512a" + j * 512 + "a" + i * 512);
-
-        String saveAs = UrlSafeBase64.encodeToString(bucket + ":" + fileName + "_" + j + "_" + i + suffixName);
-        ops.append("|saveas/").append(saveAs);
-        ops.append("&notifyURL=").append(notifyURL);
-        HttpPost post = new HttpPost("http://api.qiniu.com/pfop/");
-        post.setHeader(HTTP.CONTENT_TYPE, "application/x-www-form-urlencoded");
-        StringEntity entity = new StringEntity(ops.toString(), "utf-8");
-        entity.setContentType("application/x-www-form-urlencoded");
-        post.setEntity(entity);
-
-        String si = auth.signRequest("http://api.qiniu.com/pfop/", ops.toString().getBytes(), "application/x-www-form-urlencoded");
-        post.setHeader("Authorization", "QBox " + si);
-        HttpClient client = new DefaultHttpClient();
-        HttpResponse res = client.execute(post);
-        return EntityUtils.toString(res.getEntity(), "UTF-8");
-    }
-
-    /**
-     * 将七牛云上的图片缩放成指定大小的图片
-     * @param key
-     * @param width
-     * @param height
-     * @param notifyURL
-     * @throws IOException
-     */
-    public static void thumb(String key, String width, String height, String notifyURL, String newKey) throws IOException {
-        String fop = "imageMogr2/auto-orient/";
-        fop = URLEncoder.encode(fop, "utf-8");
-
-        String fileName = key.substring(0, key.lastIndexOf("."));
-        String suffixName = key.substring(key.lastIndexOf("."));
-
-        Auth auth = Auth.create(accessKey, secretKey);
-
-        StringBuffer ops = new StringBuffer("bucket=").append(bucket).append("&key=").append(key).append("&fops=").append(fop);
-        ops.append("thumbnail/"+width+"x"+height+"!");
-
-        //saveAs新生成文件的名称
-        newKey = StringUtils.isNotEmpty(newKey) ? newKey : (fileName + "_thumb" + suffixName);
-        String saveAs = UrlSafeBase64.encodeToString(bucket + ":" + newKey);
-        ops.append("|saveas/").append(saveAs);
-        ops.append("&notifyURL=").append(notifyURL);
-        HttpPost post = new HttpPost("http://api.qiniu.com/pfop/");
-        post.setHeader(HTTP.CONTENT_TYPE, "application/x-www-form-urlencoded");
-        StringEntity entity = new StringEntity(ops.toString(), "utf-8");
-        entity.setContentType("application/x-www-form-urlencoded");
-        post.setEntity(entity);
-
-        String si = auth.signRequest("http://api.qiniu.com/pfop/", ops.toString().getBytes(), "application/x-www-form-urlencoded");
-        post.setHeader("Authorization", "QBox " + si);
-        HttpClient client = new DefaultHttpClient();
-        HttpResponse res = client.execute(post);
-        System.out.println(EntityUtils.toString(res.getEntity(), "UTF-8"));
-    }
-}

+ 1 - 1
4dkankan-center-platform/src/main/java/com/fdkankan/platform/user/service/impl/UserServiceImpl.java

@@ -10,6 +10,7 @@ import com.fdkankan.common.user.SSOUser;
 import com.fdkankan.common.util.Base64Converter;
 import com.fdkankan.common.util.FileUtils;
 import com.fdkankan.common.validation.Variable;
+import com.fdkankan.fyun.qiniu.QiniuUpload;
 import com.fdkankan.platform.goods.entity.CameraDetail;
 import com.fdkankan.platform.goods.entity.CameraDetailNumEntity;
 import com.fdkankan.platform.goods.service.ICameraDetailService;
@@ -28,7 +29,6 @@ import com.fdkankan.platform.user.vo.ReceiverInfoVo;
 import com.fdkankan.platform.user.vo.ResponseCamera;
 import com.fdkankan.platform.user.vo.ResponseUser;
 import com.fdkankan.platform.user.vo.SSOUserVo;
-import com.fdkankan.platform.user.common.util.QiniuUpload;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;

+ 0 - 1
4dkankan-center-platform/src/main/java/com/fdkankan/platform/user/service/sso/LoginService.java

@@ -6,7 +6,6 @@ import com.fdkankan.common.constant.ConstantFilePath;
 import com.fdkankan.common.constant.LoginType;
 import com.fdkankan.common.util.*;
 import com.fdkankan.common.user.SSOLoginHelper;
-import com.fdkankan.platform.user.common.util.MatrixToImageWriterUtil;
 import com.fdkankan.common.user.SSOUser;
 import com.fdkankan.platform.user.entity.User;
 import com.fdkankan.platform.user.request.RequestUser;

+ 6 - 0
4dkankan-center-scene/pom.xml

@@ -45,6 +45,12 @@
             <version>2.0.0</version>
         </dependency>
 
+        <dependency>
+            <groupId>com.fdkankan</groupId>
+            <artifactId>4dkankan-utils-fyun</artifactId>
+            <version>2.0.0</version>
+        </dependency>
+
 <!--        <dependency>-->
 <!--            <groupId>com.alibaba.cloud</groupId>-->
 <!--            <artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>-->

+ 1 - 0
4dkankan-center-scene/src/main/java/com/fdkankan/scene/SceneApplication.java

@@ -18,6 +18,7 @@ import org.springframework.scheduling.annotation.EnableScheduling;
         "com.fdkankan.redis",
         "com.fdkankan.mq",
         "com.fdkankan.db",
+        "com.fdkankan.fyun",
 })
 @MapperScan("com.fdkankan.**.mapper")
 public class SceneApplication {

+ 1 - 1
4dkankan-center-scene/src/main/java/com/fdkankan/scene/service/impl/Scene3dfamilyServiceImpl.java

@@ -7,7 +7,7 @@ import com.fdkankan.common.constant.RecStatus;
 import com.fdkankan.common.constant.ZipStatus;
 import com.fdkankan.common.util.CreateObjUtil;
 import com.fdkankan.common.util.FileUtils;
-import com.fdkankan.common.util.UploadToOssUtil;
+import com.fdkankan.fyun.oss.UploadToOssUtil;
 import com.fdkankan.scene.entity.Scene3dfamily;
 import com.fdkankan.scene.mapper.IScene3dfamilyMapper;
 import com.fdkankan.scene.service.IScene3dfamilyService;

+ 1 - 1
4dkankan-center-scene/src/main/java/com/fdkankan/scene/service/impl/SceneAppServiceImpl.java

@@ -7,7 +7,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.fdkankan.common.constant.*;
 import com.fdkankan.common.util.ConvertCommonUtils;
 import com.fdkankan.common.util.FileUtils;
-import com.fdkankan.common.util.UploadToOssUtil;
+import com.fdkankan.fyun.oss.UploadToOssUtil;
 import com.fdkankan.common.util.WeiXinUtils;
 import com.fdkankan.redis.constant.RedisKey;
 import com.fdkankan.redis.util.RedisLockUtil;

+ 1 - 0
4dkankan-center-scene/src/main/java/com/fdkankan/scene/service/impl/SceneFileBuildServiceImpl.java

@@ -38,6 +38,7 @@ import org.springframework.scheduling.annotation.Async;
 import org.springframework.stereotype.Service;
 import org.springframework.util.ObjectUtils;
 import org.springframework.web.multipart.MultipartFile;
+import com.fdkankan.fyun.oss.UploadToOssUtil;
 
 import java.io.BufferedReader;
 import java.io.File;

+ 1 - 0
4dkankan-center-scene/src/main/java/com/fdkankan/scene/service/impl/SceneProAppServiceImpl.java

@@ -21,6 +21,7 @@ import com.fdkankan.scene.vo.SceneEditVO;
 import com.fdkankan.common.constant.ErrorCode;
 import com.fdkankan.common.exception.BusinessException;
 import com.fdkankan.common.response.ResultData;
+import com.fdkankan.fyun.oss.UploadToOssUtil;
 import lombok.extern.slf4j.Slf4j;
 import net.coobird.thumbnailator.Thumbnails;
 import org.apache.commons.lang3.StringUtils;

+ 1 - 0
4dkankan-center-scene/src/main/java/com/fdkankan/scene/service/impl/SceneProServiceImpl.java

@@ -26,6 +26,7 @@ import com.fdkankan.scene.vo.SceneVO;
 import com.fdkankan.common.constant.ErrorCode;
 import com.fdkankan.common.exception.BusinessException;
 import com.fdkankan.common.response.ResultData;
+import com.fdkankan.fyun.oss.UploadToOssUtil;
 import lombok.extern.slf4j.Slf4j;
 import net.coobird.thumbnailator.Thumbnails;
 import org.joda.time.DateTime;

+ 9 - 5
4dkankan-center-scene/src/main/java/com/fdkankan/scene/service/impl/SceneServiceImpl.java

@@ -11,7 +11,13 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.fdkankan.common.constant.*;
-import com.fdkankan.common.util.*;
+import com.fdkankan.common.exception.BusinessException;
+import com.fdkankan.common.response.ResultData;
+import com.fdkankan.common.util.ConvertUtils;
+import com.fdkankan.common.util.DateExtUtil;
+import com.fdkankan.common.util.FileUtils;
+import com.fdkankan.fyun.oss.UploadToOssUtil;
+import com.fdkankan.fyun.qiniu.QiniuUpload;
 import com.fdkankan.redis.constant.RedisKey;
 import com.fdkankan.redis.util.RedisLockUtil;
 import com.fdkankan.redis.util.RedisUtil;
@@ -24,9 +30,6 @@ import com.fdkankan.scene.service.ISceneService;
 import com.fdkankan.scene.vo.SceneEditVO;
 import com.fdkankan.scene.vo.SceneParamVO;
 import com.fdkankan.scene.vo.SceneVO;
-import com.fdkankan.common.constant.ErrorCode;
-import com.fdkankan.common.exception.BusinessException;
-import com.fdkankan.common.response.ResultData;
 import lombok.extern.slf4j.Slf4j;
 import org.joda.time.DateTime;
 import org.springframework.beans.BeanUtils;
@@ -36,6 +39,7 @@ import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 import org.springframework.web.multipart.MultipartFile;
 
+import javax.annotation.Resource;
 import java.io.File;
 import java.io.IOException;
 import java.util.*;
@@ -59,7 +63,7 @@ public class SceneServiceImpl extends ServiceImpl<ISceneMapper, Scene> implement
     @Value("${oss.prefix.ali}")
     private String prefixAli;
 
-    @Autowired
+    @Resource
     ISceneProMapper sceneProMapper;
     @Autowired
     ISceneProService sceneProService;

+ 0 - 169
4dkankan-common/src/main/java/com/fdkankan/common/util/QiniuUpload.java

@@ -1,169 +0,0 @@
-package com.fdkankan.common.util;
-
-import com.google.gson.Gson;
-import com.qiniu.cdn.CdnManager;
-import com.qiniu.cdn.CdnResult;
-import com.qiniu.common.QiniuException;
-import com.qiniu.http.Response;
-import com.qiniu.storage.BucketManager;
-import com.qiniu.storage.Configuration;
-import com.qiniu.storage.UploadManager;
-import com.qiniu.storage.model.DefaultPutRet;
-import com.qiniu.util.Auth;
-import com.qiniu.util.StringMap;
-import com.qiniu.util.UrlSafeBase64;
-
-import java.io.File;
-
-public class QiniuUpload {
-
-	//删除文件
-	public static void delete(String key) throws QiniuException{
-		Configuration cfg = new Configuration(QiniuUtil.zone);
-		Auth auth = Auth.create(QiniuUtil.accessKey, QiniuUtil.secretKey);
-		BucketManager bucketManager = new BucketManager(auth, cfg);
-        bucketManager.delete(QiniuUtil.bucket, key);
-	}
-
-	//刷新文件
-	public static void refresh(String url) throws QiniuException{
-		String [] urls = {url};
-		Auth auth = Auth.create(QiniuUtil.accessKey, QiniuUtil.secretKey);
-		CdnManager c = new CdnManager(auth);
-		CdnResult.RefreshResult response = c.refreshUrls(urls);
-	}
-
-
-	/**
-	 * 上传单个文件到七牛云
-	 * @param key
-	 * @param localFilePath
-	 */
-	public static boolean setFileToBucket(String key, String localFilePath){
-		Configuration cfg = new Configuration(QiniuUtil.zone);
-		Auth auth = Auth.create(QiniuUtil.accessKey, QiniuUtil.secretKey);
-		UploadManager uploadManager = new UploadManager(cfg);
-		
-		String upToken = auth.uploadToken(QiniuUtil.bucket);
-		
-		try {
-		    Response response = uploadManager.put(localFilePath, key, upToken);
-		    //解析上传成功的结果
-		    DefaultPutRet putRet = new Gson().fromJson(response.bodyString(), DefaultPutRet.class);
-		    System.out.println(putRet.key);
-		    System.out.println(putRet.hash);
-		    return true;
-		} catch (QiniuException ex) {
-		    Response r = ex.response;
-		    System.err.println(r.toString());
-		    try {
-		        System.err.println(r.bodyString());
-		    } catch (QiniuException ex2) {
-		    }
-		    return false;
-		}
-	}
-	
-	/**
-	 * 上传本地目录下所有文件到七牛云上
-	 * @param remoteFolder
-	 * @param localFolderPath
-	 */
-	public static void setFilesToBucket(String remoteFolder, String localFolderPath) {
-		Configuration cfg = new Configuration(QiniuUtil.zone);
-		Auth auth = Auth.create(QiniuUtil.accessKey, QiniuUtil.secretKey);
-		UploadManager uploadManager = new UploadManager(cfg);
-		
-		File file = new File(localFolderPath);
-		File[] files = file.listFiles();// 获取目录下的所有文件或文件夹
-		if (files == null) {// 如果目录为空,直接退出
-			return;
-		}
-
-		// 遍历,目录下的所有文件
-		for (File f : files) {
-			if (f.isFile()) {
-				String key = f.getName();
-				if (remoteFolder != null) {
-					key = remoteFolder + key;
-				} 
-				// 再上传文件
-				String upToken = auth.uploadToken(QiniuUtil.bucket);
-				try {
-					Response res = uploadManager.put(f, key, upToken);
-					System.out.println(res.bodyString());
-				} catch (QiniuException e) {
-					Response r = e.response;
-					System.err.println(r.toString());
-					try {
-						System.err.println(r.bodyString());
-					} catch (QiniuException ex2) {
-					}
-				}
-			} else if (f.isDirectory()) {
-				String key = f.getName() + "/";
-				if (remoteFolder != null) {
-					key = remoteFolder + key;
-				}
-				setFilesToBucket(key, f.getAbsolutePath());
-			}
-		}
-	}
-
-	/**
-	 * 测试七牛上传后,自动进行数据处理操作,并另存处理后的文件
-	 * @param domain 存储空间所对应的域名
-	 * @param file 上传文件
-	 */
-	public static void testFops(String domain, File file) {
-		//通过AK,SK创建Auth 对象
-		Auth auth = Auth.create(QiniuUtil.accessKey, QiniuUtil.secretKey);
-		Configuration cfg = new Configuration(QiniuUtil.zone);
-		//上传对象
-		UploadManager uploadMgr = new UploadManager(cfg);
-		//私有队列
-		String pipeline = "av-pipeline";
-		//水印文字
-		String wmText = UrlSafeBase64.encodeToString("Word For Test");
-		//水印文字的颜色
-		String wmFontColor = UrlSafeBase64.encodeToString("#FFFF00");
-		//设置avthumb 接口
-		StringBuffer ops = new StringBuffer("");
-		ops.append("avthumb/mp4/wmText/" + wmText +"/wmGravityText/NorthEast/wmFontColor/" + wmFontColor);
-		String saveAs = UrlSafeBase64.encodeToString(QiniuUtil.bucket + ":" + "new_" + file.getName());
-		//通过管道符 "|" 拼接 saveas 接口, 保存 数据处理后的视频
-		ops.append("|saveas/" + saveAs);
-		//saveas 接口 需要签名 sign
-		String sign = domain + "/" + file.getName() + "?" + ops.toString();
-		String encodeSign = UrlSafeBase64.encodeToString(sign);
-		ops.append("/sign/" + encodeSign);
-		//指定 数据处理 的 上传策略, 当文件上传成功后,自定执行数据处理操作,即:ops 的接口,图片加水印,另存为 new_file.getName();
-		StringMap putPolicy = new StringMap();
-		putPolicy.put("persistentOps", ops.toString())      //数据处理接口及参数
-				.put("persistentPipeline", pipeline);      //私有数据处理队列
-
-		//获取上传凭证, 包含上传策略
-		String uploadToken = auth.uploadToken(QiniuUtil.bucket, file.getName(), 3600, putPolicy);
-
-		try {
-			//上传
-			Response resp = uploadMgr.put(file, file.getName(), uploadToken);
-			//查看结果
-			System.out.println(resp.statusCode + ":" + resp.bodyString());
-		} catch (QiniuException e) {
-			// TODO Auto-generated catch block
-			e.printStackTrace();
-		}
-
-	}
-
-    public static void main(String[] args) {
-        QiniuUpload upload = new QiniuUpload();
-        try {
-            QiniuUpload.delete("head/13211064273/head.png");
-//            QiniuUpload.refresh("http://scene3d.4dage.com/head/13211064273/head.png");
-        } catch (QiniuException e) {
-            e.printStackTrace();
-        }
-    }
-}

+ 0 - 262
4dkankan-common/src/main/java/com/fdkankan/common/util/QiniuUtil.java

@@ -1,262 +0,0 @@
-package com.fdkankan.common.util;
-
-import com.qiniu.common.Zone;
-import com.qiniu.util.Auth;
-import com.qiniu.util.UrlSafeBase64;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.http.HttpResponse;
-import org.apache.http.client.HttpClient;
-import org.apache.http.client.methods.HttpPost;
-import org.apache.http.entity.StringEntity;
-import org.apache.http.impl.client.DefaultHttpClient;
-import org.apache.http.protocol.HTTP;
-import org.apache.http.util.EntityUtils;
-
-import java.io.IOException;
-import java.net.URLEncoder;
-
-public class QiniuUtil {
-
-    public static String accessKey = "dlPPwgZky_F-iP8CbSbJpiAtAcqw3BYwb9rdHMrS";
-    public static String secretKey = "YEtkLKDsImXB-8m1CT1zV_YwCwwGvrUvo2ktj9KZ";
-    public static Zone zone = Zone.zone1();
-    public static String bucket = "scene3d";
-    public static String remoteUrl = "https://4dkanzhan.4dkankan.com/";
-
-    public static void main(String[] args) throws IOException {
-//        crop4K("4k.jpg", "http://www.baidu.com");
-//        thumb("test111.jpg", "128", "128", "http://www.baidu.com");
-
-        /*try{
-            File f = new File("D:/usr/local/szggkfzlg/upload/20190125181036.png");
-            FileInputStream fi = new FileInputStream(f);
-            try{
-                BufferedImage sourceImg =ImageIO.read(fi);//判断图片是否损坏
-                int picWidth= sourceImg.getWidth(); //确保图片是正确的(正确的图片可以取得宽度)
-            }catch (Exception e) {
-                // TODO: handle exception
-                fi.close();//关闭IO流才能操作图片
-            }finally{
-                fi.close();//最后一定要关闭IO流
-            }
-        }catch (Exception e  ) {
-            // TODO: handle exception
-            System.out.println(e.toString());
-        }*/
-
-        getVideoFrame("a.mp4", "png", "6.010", null, null, null, "a_framw.png", "http://www.baidu.com");
-    }
-
-    /**
-     * 视频帧缩略图接口(vframe)用于从视频流中截取指定时刻的单帧画面并按指定大小缩放成图片
-     * @param key 文件名  a.mp4
-     * @param suffixName 输出的目标截图格式,支持jpg、png等。
-     * @param second 指定截取视频的时刻,单位:秒,精确到毫秒。
-     * @param width 缩略图宽度,单位:像素(px),取值范围为1-3840, 可不传。
-     * @param height 缩略图高度,单位:像素(px),取值范围为1-2160, 可不传。
-     * @param rotate 指定顺时针旋转的度数,可取值为90、180、270、auto,默认为不旋转,可不传。
-     * @param newKey 新文件名称
-     * @param notifyURL 回调地址
-     * @throws IOException
-     */
-    public static void getVideoFrame(String key, String suffixName, String second, Integer width, Integer height, Integer rotate, String newKey, String notifyURL) throws IOException {
-        StringBuffer sb = new StringBuffer("vframe/").append(suffixName).append("/offset/").append(second);
-        if (width != null){
-            sb.append("/w/").append(width);
-        }
-        if (height != null){
-            sb.append("/h/").append(height);
-        }
-        if (rotate != null){
-            sb.append("/rotate/").append(rotate);
-        }
-
-        String fop = URLEncoder.encode(sb.toString(), "utf-8");
-        StringBuffer ops = new StringBuffer("bucket=").append(bucket).append("&key=").append(key).append("&fops=").append(fop);
-        String saveAs = UrlSafeBase64.encodeToString(bucket + ":" + newKey);
-        ops.append("|saveas/").append(saveAs);
-
-        ops.append("&notifyURL=").append(notifyURL);
-
-        HttpPost post = new HttpPost("http://api.qiniu.com/pfop/");
-        post.setHeader(HTTP.CONTENT_TYPE, "application/x-www-form-urlencoded");
-        StringEntity entity = new StringEntity(ops.toString(), "utf-8");
-        entity.setContentType("application/x-www-form-urlencoded");
-        post.setEntity(entity);
-
-        Auth auth = Auth.create(accessKey, secretKey);
-        String si = auth.signRequest("http://api.qiniu.com/pfop/", ops.toString().getBytes(), "application/x-www-form-urlencoded");
-        post.setHeader("Authorization", "QBox " + si);
-        HttpClient client = new DefaultHttpClient();
-        HttpResponse res = client.execute(post);
-        String ret = EntityUtils.toString(res.getEntity(), "UTF-8");
-        System.out.println(ret);
-
-    }
-
-    /**
-     * 给视频添加水印
-     * @param key a.mp4
-     * @param text  4dage
-     * @param fontColor #FFFF00
-     * @param newKey new_a.mp4
-     * @param notifyURL 回调地址
-     * @throws IOException
-     */
-    public static void waterMark(String key, String text, String fontColor, String newKey, String notifyURL) throws IOException {
-        String fop = "avthumb/mp4/";
-        fop = URLEncoder.encode(fop, "utf-8");
-        //水印文字
-        String wmText = UrlSafeBase64.encodeToString(text);
-        //水印文字的颜色
-        String wmFontColor = UrlSafeBase64.encodeToString(fontColor);
-        //设置avthumb 接口
-        StringBuffer ops = new StringBuffer("bucket=").append(bucket).append("&key=").append(key).append("&fops=").append(fop);
-        ops.append("avthumb/mp4/wmText/").append(wmText).append("/wmGravityText/NorthEast/wmFontColor/").append(wmFontColor);
-        String saveAs = UrlSafeBase64.encodeToString(bucket + ":" + newKey);
-        ops.append("|saveas/").append(saveAs);
-        ops.append("&notifyURL=").append(notifyURL);
-
-        HttpPost post = new HttpPost("http://api.qiniu.com/pfop/");
-        post.setHeader(HTTP.CONTENT_TYPE, "application/x-www-form-urlencoded");
-        StringEntity entity = new StringEntity(ops.toString(), "utf-8");
-        entity.setContentType("application/x-www-form-urlencoded");
-        post.setEntity(entity);
-
-        Auth auth = Auth.create(accessKey, secretKey);
-        String si = auth.signRequest("http://api.qiniu.com/pfop/", ops.toString().getBytes(), "application/x-www-form-urlencoded");
-        post.setHeader("Authorization", "QBox " + si);
-        HttpClient client = new DefaultHttpClient();
-        HttpResponse res = client.execute(post);
-        String ret = EntityUtils.toString(res.getEntity(), "UTF-8");
-        System.out.println(ret);
-    }
-
-    /**
-     * 将4K图片裁剪成64张512*512
-     * @param key
-     * @param notifyURL  回调地址 "http://wwww.cn/qn/notify&force=1"
-     * @throws IOException
-     */
-    public static void crop4K(String key, String notifyURL) throws IOException {
-        String fop = "imageMogr2/auto-orient/";
-        fop = URLEncoder.encode(fop, "utf-8");
-
-        String fileName = key.substring(0, key.lastIndexOf("."));
-        String suffixName = key.substring(key.lastIndexOf("."));
-
-        Auth auth = Auth.create(accessKey, secretKey);
-
-        for (int i = 0; i < 8; i++) {
-            for (int j = 0; j < 8; j++) {
-                String ret = crop(key, notifyURL, fop, fileName, suffixName, auth, i, j);
-                System.out.println(ret);
-            }
-        }
-    }
-
-    /**
-     * 将2K图片裁剪成16张512*512
-     * @param key
-     * @param notifyURL 回调地址 "http://wwww.cn/qn/notify&force=1"
-     * @throws IOException
-     */
-    public static void crop2k(String key, String notifyURL) throws IOException {
-        String fop = "imageMogr2/auto-orient/";
-        fop = URLEncoder.encode(fop, "utf-8");
-
-        String fileName = key.substring(0, key.lastIndexOf("."));
-        String suffixName = key.substring(key.lastIndexOf("."));
-
-        Auth auth = Auth.create(accessKey, secretKey);
-
-        for (int i = 0; i < 4; i++) {
-            for (int j = 0; j < 4; j++) {
-                String ret = crop(key, notifyURL, fop, fileName, suffixName, auth, i, j);
-                System.out.println(ret);
-            }
-        }
-    }
-
-    /**
-     * 将1K图片裁剪成4张512*512
-     * @param key
-     * @param notifyURL 回调地址 "http://wwww.cn/qn/notify&force=1"
-     * @throws IOException
-     */
-    public static void crop1k(String key, String notifyURL) throws IOException {
-        String fop = "imageMogr2/auto-orient/";
-        fop = URLEncoder.encode(fop, "utf-8");
-
-        String fileName = key.substring(0, key.lastIndexOf("."));
-        String suffixName = key.substring(key.lastIndexOf("."));
-
-        Auth auth = Auth.create(accessKey, secretKey);
-
-        for (int i = 0; i < 2; i++) {
-            for (int j = 0; j < 2; j++) {
-                String ret = crop(key, notifyURL, fop, fileName, suffixName, auth, i, j);
-                System.out.println(ret);
-            }
-        }
-    }
-
-    private static String crop(String key, String notifyURL, String fop, String fileName, String suffixName, Auth auth, int i, int j) throws IOException {
-        StringBuffer ops = new StringBuffer("bucket=").append(bucket).append("&key=").append(key).append("&fops=").append(fop);
-        ops.append("crop/!512x512a" + j * 512 + "a" + i * 512);
-
-        String saveAs = UrlSafeBase64.encodeToString(bucket + ":" + fileName + "_" + j + "_" + i + suffixName);
-        ops.append("|saveas/").append(saveAs);
-        ops.append("&notifyURL=").append(notifyURL);
-        HttpPost post = new HttpPost("http://api.qiniu.com/pfop/");
-        post.setHeader(HTTP.CONTENT_TYPE, "application/x-www-form-urlencoded");
-        StringEntity entity = new StringEntity(ops.toString(), "utf-8");
-        entity.setContentType("application/x-www-form-urlencoded");
-        post.setEntity(entity);
-
-        String si = auth.signRequest("http://api.qiniu.com/pfop/", ops.toString().getBytes(), "application/x-www-form-urlencoded");
-        post.setHeader("Authorization", "QBox " + si);
-        HttpClient client = new DefaultHttpClient();
-        HttpResponse res = client.execute(post);
-        return EntityUtils.toString(res.getEntity(), "UTF-8");
-    }
-
-    /**
-     * 将七牛云上的图片缩放成指定大小的图片
-     * @param key
-     * @param width
-     * @param height
-     * @param notifyURL
-     * @throws IOException
-     */
-    public static void thumb(String key, String width, String height, String notifyURL, String newKey) throws IOException {
-        String fop = "imageMogr2/auto-orient/";
-        fop = URLEncoder.encode(fop, "utf-8");
-
-        String fileName = key.substring(0, key.lastIndexOf("."));
-        String suffixName = key.substring(key.lastIndexOf("."));
-
-        Auth auth = Auth.create(accessKey, secretKey);
-
-        StringBuffer ops = new StringBuffer("bucket=").append(bucket).append("&key=").append(key).append("&fops=").append(fop);
-        ops.append("thumbnail/"+width+"x"+height+"!");
-
-        //saveAs新生成文件的名称
-        newKey = StringUtils.isNotEmpty(newKey) ? newKey : (fileName + "_thumb" + suffixName);
-        String saveAs = UrlSafeBase64.encodeToString(bucket + ":" + newKey);
-        ops.append("|saveas/").append(saveAs);
-        ops.append("&notifyURL=").append(notifyURL);
-        HttpPost post = new HttpPost("http://api.qiniu.com/pfop/");
-        post.setHeader(HTTP.CONTENT_TYPE, "application/x-www-form-urlencoded");
-        StringEntity entity = new StringEntity(ops.toString(), "utf-8");
-        entity.setContentType("application/x-www-form-urlencoded");
-        post.setEntity(entity);
-
-        String si = auth.signRequest("http://api.qiniu.com/pfop/", ops.toString().getBytes(), "application/x-www-form-urlencoded");
-        post.setHeader("Authorization", "QBox " + si);
-        HttpClient client = new DefaultHttpClient();
-        HttpResponse res = client.execute(post);
-        System.out.println(EntityUtils.toString(res.getEntity(), "UTF-8"));
-    }
-
-}

+ 0 - 728
4dkankan-common/src/main/java/com/fdkankan/common/util/UploadToOssUtil.java

@@ -1,728 +0,0 @@
-package com.fdkankan.common.util;
-
-import com.aliyun.oss.OSSClient;
-import com.aliyun.oss.model.OSSObjectSummary;
-import com.aliyun.oss.model.ObjectListing;
-import com.aliyun.oss.model.ObjectMetadata;
-import com.aliyun.oss.model.PutObjectResult;
-import com.amazonaws.HttpMethod;
-import com.amazonaws.auth.AWSStaticCredentialsProvider;
-import com.amazonaws.auth.BasicAWSCredentials;
-import com.amazonaws.regions.Regions;
-import com.amazonaws.services.s3.AmazonS3;
-import com.amazonaws.services.s3.AmazonS3ClientBuilder;
-import com.amazonaws.services.s3.model.CannedAccessControlList;
-import com.amazonaws.services.s3.model.GeneratePresignedUrlRequest;
-import com.amazonaws.services.s3.model.GetObjectRequest;
-import com.amazonaws.services.s3.model.PutObjectRequest;
-import com.qiniu.common.Zone;
-import com.qiniu.storage.Configuration;
-import com.qiniu.storage.UploadManager;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.commons.fileupload.FileItem;
-import org.apache.commons.fileupload.FileItemFactory;
-import org.apache.commons.fileupload.disk.DiskFileItemFactory;
-import org.apache.commons.lang3.StringUtils;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.stereotype.Component;
-import org.springframework.web.multipart.MultipartFile;
-import org.springframework.web.multipart.commons.CommonsMultipartFile;
-
-import java.io.*;
-import java.net.FileNameMap;
-import java.net.URL;
-import java.net.URLConnection;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-@Slf4j
-@Component
-public class UploadToOssUtil {
-
-//    String ACCESS_KEY = "dlPPwgZky_F-iP8CbSbJpiAtAcqw3BYwb9rdHMrS";
-//    String SECRET_KEY = "YEtkLKDsImXB-8m1CT1zV_YwCwwGvrUvo2ktj9KZ";
-//
-//    String bucketname = "scene3d";
-
-//    Auth auth = Auth.create(ACCESS_KEY, SECRET_KEY);
-
-	Zone zone = Zone.autoZone();
-
-	Configuration config = new Configuration(zone);
-	UploadManager uploadManager = new UploadManager(config);
-
-	@Value("${oss.point:http://oss-cn-shenzhen-internal.aliyuncs.com}")
-	private String point;
-
-	@Value("${oss.key:LTAIUrvuHqj8pvry}")
-	private String key;
-
-	@Value("${oss.secrey:JLOVl0k8Ke0aaM8nLMMiUAZ3EiiqI4}")
-	private String secrey;
-
-	@Value("${oss.bucket:4dkankan}")
-	private String bucket;
-
-	@Value("${oss.sdk:4dscene}")
-	private String bucketSdk;
-
-
-
-	@Value("${oss.type:oss}")
-	private String type;
-
-	@Value("${oss.s3key:AKIAWCV5QFZ3ZNELKYUY}")
-	private String s3key;
-
-	@Value("${oss.s3secrey:epS5ghyR4LJ7rxk/qJO9ZYh6m9Oz6g5haKDu4yws}")
-	private String s3secrey;
-
-	@Value("${oss.s3bucket:4dkankan}")
-	private String s3bucket;
-
-
-	public void delete(String key1) throws IOException{
-		OSSClient ossClient = new OSSClient(point, key, secrey);
-		try {
-			// bucketMgr.delete(bucketname, key);
-
-			// 2019-2-28 启动aliyun oss 空间
-			ossClient.deleteObject(bucket, key1);
-		} catch (Exception e) {
-			e.printStackTrace();
-		}
-	}
-
-	//上传的数据是byte[],key是上传后的文件名
-	public void upload(byte[] data,String key1) throws IOException{
-		OSSClient ossClient = new OSSClient(point, key, secrey);
-		try
-		{
-
-			//bucketMgr.delete(bucketname, key);
-			//Response res = uploadManager.put(data, key, getUpToken(key));
-
-			// 2019-2-28 启动aliyun oss 空间
-			ossClient.putObject(bucket, key1, new ByteArrayInputStream(data));
-			//log.info(res.bodyString());
-		} catch (Exception e) {
-			log.error(e.toString()+key1);
-		}
-	}
-
-
-	public void upload(String filePath, String key1) {
-		log.info("开始上传文件 源路径:{},目标路径:{},point:{}" , filePath,key1,point);
-		if("oss".equals(type)){
-			OSSClient ossClient = new OSSClient(point, key, secrey);
-			try {
-				File file = new File(filePath);
-				if (!file.exists()) {
-					log.error("要上传的文件不存在:" + filePath);
-				}
-				ObjectMetadata metadata = new ObjectMetadata();
-				if(filePath.contains(".jpg")){
-					metadata.setContentType("image/jpeg");
-				}
-				ossClient.putObject(bucket, key1, new File(filePath), metadata);
-
-			} catch (Exception e) {
-				log.error(e.toString() + filePath);
-			}
-		}
-
-		if("s3".equals(type)){
-			try{
-				uploadS3File(filePath, key1);
-			}catch (Exception e){
-				e.printStackTrace();
-			}
-		}
-	}
-
-	public void uploadSdk(String filePath, String key1) {
-		if("oss".equals(type)){
-			OSSClient ossClient = new OSSClient(point, key, secrey);
-			try {
-				File file = new File(filePath);
-				if (!file.exists()) {
-					log.error("要上传的文件不存在:" + filePath);
-				}
-				// 调用put方法上传
-				// Response res = uploadManager.put(FilePath, key, getUpToken(key));
-				// 打印返回的信息
-				// log.info(res.bodyString());
-
-				// 2019-2-28 启动aliyun oss 空间
-//			ObjectMetadata meta = new ObjectMetadata();
-//			meta.setCacheControl("no-cache");
-//			ossClient.putObject(BUCKET_NAME, key, new File(filePath), meta);
-
-				ObjectMetadata metadata = new ObjectMetadata();
-				if(filePath.contains(".jpg")){
-					metadata.setContentType("image/jpeg");
-				}
-				ossClient.putObject(bucketSdk, key1, new File(filePath), metadata);
-
-			} catch (Exception e) {
-				log.error(e.toString() + filePath);
-			}
-		}
-
-		if("s3".equals(type)){
-			try{
-				uploadS3File(filePath, key1);
-			}catch (Exception e){
-				e.printStackTrace();
-			}
-		}
-	}
-
-	public void upload2(String filePath, String key1) {
-		log.info("开始上传文件 源路径:{},目标路径:{},point:{}" , filePath,key1,point);
-		if("oss".equals(type)){
-			OSSClient ossClient = new OSSClient(point, key, secrey);
-			try {
-				// 调用put方法上传
-				// Response res = uploadManager.put(FilePath, key, getUpToken(key));
-				// 打印返回的信息
-				// log.info(res.bodyString());
-
-				// 2019-2-28 启动aliyun oss 空间
-				ObjectMetadata metadata = new ObjectMetadata();
-				if(filePath.contains(".jpg")){
-					metadata.setContentType("image/jpeg");
-				}
-				if(filePath.contains(".mp4")){
-					metadata.setContentType("video/mp4");
-				}
-				if(filePath.contains(".mp3")){
-					metadata.setContentType("audio/mp3");
-				}
-				ossClient.putObject(bucket, key1, new File(filePath), metadata);
-			} catch (Exception e) {
-				log.error(e.toString() + filePath);
-			}
-		}
-
-		if("s3".equals(type)){
-			try{
-				uploadS3File(filePath, key1);
-			}catch (Exception e){
-				e.printStackTrace();
-			}
-		}
-	}
-
-	//上传的数据是文件夹,参数是文件夹路径,key是上传后的文件名
-	public void uploadMulFiles(Map<String, String> filepaths) {
-		if (filepaths == null) {
-			return;
-		}
-		Long start = System.currentTimeMillis();
-		log.info("开始批量上传文件:");
-		if (filepaths.size() > 50) {
-			filepaths.entrySet().parallelStream().forEach(entry->{
-				upload2(entry.getKey(), entry.getValue());
-			});
-		} else {
-			filepaths.entrySet().parallelStream().forEach(entry->{
-				upload(entry.getKey(), entry.getValue());
-			});
-		}
-		log.info("批量上传文件结束,用时:{}" ,(System.currentTimeMillis() - start));
-	}
-
-	public int deleteFile(String prefix){
-		if("oss".equals(type)){
-			OSSClient ossClient = new OSSClient(point, key, secrey);
-
-			ObjectListing objectListing = ossClient.listObjects(bucket, prefix);
-			List<OSSObjectSummary> sums = objectListing.getObjectSummaries();
-			try {
-				for (OSSObjectSummary s : sums) {
-					delete(s.getKey());
-				}
-			} catch (IOException e) {
-				e.printStackTrace();
-			}
-
-		}
-
-		if("s3".equals(type)){
-			deleteS3Object(prefix);
-		}
-		return 1;
-	}
-
-	public static void main(String[] args) throws IOException {
-
-//		UploadToQiniuForScene3DServiceImpl impl = new UploadToQiniuForScene3DServiceImpl();
-//		impl.delete("read_me.txt");
-
-//		impl.upload("C:\\Users\\Administrator\\Desktop\\update\\read_me.txt", "read_me.txt");
-//		Map<String, String> filepaths = new HashMap<>();
-//		filepaths.put("C:\\Users\\Administrator\\Desktop\\update\\read_me.txt", "txt/read_me1.txt");
-//		filepaths.put("C:\\Users\\Administrator\\Desktop\\update\\read_me2.txt", "txt/read_me2.txt");
-//		impl.uploadMulFiles(filepaths);
-
-//		impl.deleteFile("txt");
-
-
-//		byte[] content = "Hello OSS".getBytes();
-//		impl.upload(content, "Hello OSS");
-//		UploadToOssUtil uploadToOssUtil = new UploadToOssUtil();
-//		uploadToOssUtil.downFromS3(s3bucket, "log/4DKKPRO_74EE2AB80D9F_2020-04-23.zip", "F:\\桌面\\datagu6HmTLKp\\4DKKPRO_74EE2AB80D9F_2020-04-23.zip");
-
-//		System.out.println("/00152212.jpg".length());
-
-//		BasicAWSCredentials awsCred = new BasicAWSCredentials(s3key, s3secrey);
-//
-//		AmazonS3 s3Client = AmazonS3ClientBuilder.standard()
-//				.withCredentials(new AWSStaticCredentialsProvider(awsCred))
-//				.withRegion(Regions.EU_WEST_2)
-//				.build();
-//
-//		// Set the pre-signed URL to expire after one hour.
-//		java.util.Date expiration = new java.util.Date();
-//		long expTimeMillis = expiration.getTime();
-//		expTimeMillis += 1000 * 60 * 60;
-//		expiration.setTime(expTimeMillis);
-//
-//		long begin = System.currentTimeMillis();
-//		// Generate the pre-signed URL.
-//		System.out.println("Generating pre-signed URL.");
-//		GeneratePresignedUrlRequest generatePresignedUrlRequest = new GeneratePresignedUrlRequest(s3bucket, "4K-Chimei-inn-2011-1013_30p.mp4")
-//				.withMethod(HttpMethod.PUT)
-//				.withExpiration(expiration);
-//		URL url = s3Client.generatePresignedUrl(generatePresignedUrlRequest);
-//		long end = System.currentTimeMillis();
-//		System.out.println(end-begin);
-//		System.out.println("url:" + url);
-
-		// Create the connection and use it to upload the new object using the pre-signed URL.
-//		HttpURLConnection connection = (HttpURLConnection) url.openConnection();
-//		connection.setDoOutput(true);
-//		connection.setRequestMethod("PUT");
-//		OutputStreamWriter out = new OutputStreamWriter(connection.getOutputStream());
-//		out.write("This text uploaded as an object via presigned URL.");
-//		out.close();
-//
-//		// Check the HTTP response code. To complete the upload and make the object available,
-//		// you must interact with the connection object in some way.
-//		connection.getResponseCode();
-//		System.out.println("HTTP response code: " + connection.getResponseCode());
-//
-//		// Check to make sure that the object was uploaded successfully.
-//		S3Object object = s3Client.getObject(bucketName, objectKey);
-//		System.out.println("Object " + object.getKey() + " created in bucket " + object.getBucketName());
-
-//		BasicAWSCredentials awsCred = new BasicAWSCredentials("AKIAWCV5QFZ32ZUXFGDR", "WHKH1PxQFdqvRahZpAAdUFvqZpgfJaJXo754vQfM");
-//
-//		AWSSecurityTokenService sts_client = AWSSecurityTokenServiceClientBuilder.standard()
-//				.withCredentials(new AWSStaticCredentialsProvider(awsCred))
-//				.withRegion(Regions.EU_WEST_2).build();
-//
-//		GetFederationTokenRequest getFederationTokenRequest = new GetFederationTokenRequest();
-//		getFederationTokenRequest.setDurationSeconds(7200);
-//		getFederationTokenRequest.setName("admin");
-//
-//		// Define the policy and add it to the request.
-//		Policy policy = new Policy();
-//		policy.withStatements(new Statement(Statement.Effect.Allow)
-//				.withActions(S3Actions.ListObjects)
-//				.withResources(new Resource("arn:aws:s3:::" + s3bucket)));
-//		getFederationTokenRequest.setPolicy(policy.toJson());
-//
-//		// Get the temporary security credentials.
-//		GetFederationTokenResult federationTokenResult = sts_client.getFederationToken(getFederationTokenRequest);
-//		Credentials sessionCredentials = federationTokenResult.getCredentials();
-//		System.out.println("key:" + sessionCredentials.getAccessKeyId());
-//		System.out.println("access:" + sessionCredentials.getSecretAccessKey());
-//		System.out.println("token:" + sessionCredentials.getSessionToken());
-//
-//		BasicSessionCredentials awsCredentials = new BasicSessionCredentials(
-//				sessionCredentials.getAccessKeyId(),
-//				sessionCredentials.getSecretAccessKey(),
-//				sessionCredentials.getSessionToken());
-//
-//		AmazonS3 s3Client = AmazonS3ClientBuilder.standard()
-//				.withCredentials(new AWSStaticCredentialsProvider(awsCredentials))
-//				.withRegion(Regions.EU_WEST_2)
-//				.build();
-//		// 设置文件并设置公读
-////		PutObjectRequest request = new PutObjectRequest(s3bucket, "log/console2.log", new File("F:\\桌面\\652586408623472640\\60aefd3b380ffc6d5ad3e6aa71b9d817_201912061859305930_edit\\console.log"));
-////		request.withCannedAcl(CannedAccessControlList.PublicRead);
-////		s3Client.putObject(request);
-//		s3Client.putObject(s3bucket, "log/console5.log", new File("F:\\桌面\\652586408623472640\\60aefd3b380ffc6d5ad3e6aa71b9d817_201912061859305930_edit\\console.log"));
-//
-//		com.amazonaws.services.s3.model.ObjectListing objects = s3Client.listObjects(s3bucket);
-//		System.out.println("No. of Objects: " + objects.getObjectSummaries().size());
-
-		try{
-//			Map<String,String> map = new HashMap<String,String>();
-//			boolean vision2 = false;
-//			String projectNum = "eur-enNBY1Trl";
-//			String path = "F:\\文档\\710578959925903360\\B58DDC27DB8B4C05B5DBE1AEF1708C5F_202005141944424442";
-//			UploadToOssUtil uploadToOssUtil = new UploadToOssUtil();
-//			String data = FileUtils.readFile("F:\\文档\\710578959925903360\\B58DDC27DB8B4C05B5DBE1AEF1708C5F_202005141944424442\\results\\upload.json");
-//			JSONObject uploadJson = JSON.parseObject(data);
-//			JSONArray array = null;
-//			array = uploadJson.getJSONArray("upload");
-//			if(array == null){
-//				throw new Exception("upload.json数据出错");
-//			}
-//			JSONObject fileJson = null;
-//			String fileName = "";
-//			String meshfix = "";  //双模型时候会有改文件路径
-//			for(int i = 0, len = array.size(); i < len; i++){
-//				fileJson = array.getJSONObject(i);
-//				fileName = fileJson.getString("file");
-//				//文件不存在抛出异常
-//				if(!new File(path + File.separator + "results" +File.separator + fileName).exists()){
-//					throw new Exception(path + File.separator + "results" +File.separator + fileName+"文件不存在");
-//				}
-//
-//				//判断是否有vision2.txt
-//				if("vision2.txt".equals(fileName)){
-//					vision2 = true;
-//				}
-//
-//				//tex文件夹
-//				if(fileJson.getIntValue("clazz") == 2 && !fileJson.containsKey("pack-file")){
-//					if(fileName.contains("meshfix.txt")){
-//						meshfix = fileName;
-//					}else {
-//						map.put(path + File.separator + "results" +File.separator+ fileName,"images/images"+
-//								projectNum+"/"+ ConstantFileName.modelUUID+"_50k_texture_jpg_high1/"+fileName.replace("tex/", ""));
-//					}
-//					continue;
-//				}
-//
-//				//high文件夹
-//				if(fileJson.getIntValue("clazz") == 3){
-//					map.put(path + File.separator + "results" +File.separator+ fileName,"images/images"+
-//							projectNum+"/pan/high/"+ fileName.replace("high/", ""));
-//					continue;
-//				}
-//				//low文件夹
-//				if(fileJson.getIntValue("clazz") == 4){
-//					map.put(path + File.separator + "results" +File.separator+ fileName,"images/images"+
-//							projectNum+"/pan/low/"+ fileName.replace("low/", ""));
-//					continue;
-//				}
-//
-//				//tiles文件夹
-//				if(fileJson.getIntValue("clazz") == 5 && fileName.contains("4k")){
-//					map.put(path + File.separator + "results" + File.separator+ fileName,"images/images"+
-//							projectNum+ File.separator + fileName);
-//					continue;
-//				}
-//
-//				//updown文件复制一份到ecs中并去掉换行符
-//				if(fileJson.getIntValue("clazz") == 10){
-//					String updown = FileUtils.readFile(path + File.separator + "results" +File.separator+ fileName);
-//					JSONObject updownJson = JSONObject.parseObject(updown);
-//					FileUtils.writeFile(ConstantFilePath.SCENE_PATH + "data" + File.separator + "data" + projectNum +
-//							File.separator + fileName.replace("updown", "mapping"), updownJson.toString());
-//					continue;
-//				}
-//
-//				//video视频文件或封面图
-////				if(fileJson.getIntValue("clazz") == 11 || fileJson.getIntValue("clazz") == 12){
-////					map.put(path + File.separator + "results" + File.separator+ fileName,"video/video"+
-////							projectNum+ File.separator + fileName.replace("videos/", ""));
-////
-////					if(fileName.contains(".mp4")){
-////						CreateObjUtil.mp4ToFlv(path + File.separator + "results" + File.separator+ fileName,
-////								path + File.separator + "results" + File.separator+ fileName.replace("mp4", "flv"));
-////
-////						map.put(path + File.separator + "results" + File.separator+ fileName.replace("mp4", "flv"),"video/video"+
-////								projectNum+ File.separator + fileName.replace("videos/", "").replace("mp4", "flv"));
-////					}
-////				}
-//			}
-//			System.out.println(map.size());
-			UploadToOssUtil uploadToOssUtil = new UploadToOssUtil();
-//			uploadToOssUtil.uploadMulFiles(map);
-
-			uploadToOssUtil.uploadS3File("F:\\文档\\下载\\result (3).png", "images/imageseur-EBajWJTgS/result.png");
-		}catch (Exception e){
-			e.printStackTrace();
-		}
-	}
-
-	public Map<String, String> getUploadS3Url(List<String> urls){
-		if(urls == null || urls.size() <= 0){
-			return null;
-		}
-		BasicAWSCredentials awsCred = new BasicAWSCredentials(s3key, s3secrey);
-
-		AmazonS3 s3Client = AmazonS3ClientBuilder.standard()
-				.withCredentials(new AWSStaticCredentialsProvider(awsCred))
-				.withRegion(Regions.EU_WEST_2)
-				.build();
-
-		// Set the pre-signed URL to expire after one hour.
-		java.util.Date expiration = new java.util.Date();
-		long expTimeMillis = expiration.getTime();
-		expTimeMillis += 1000 * 60 * 60 * 8;
-		expiration.setTime(expTimeMillis);
-
-		//生成预签名URL
-		log.info("生成预签名URL");
-		GeneratePresignedUrlRequest generatePresignedUrlRequest = null;
-		URL url = null;
-		Map<String, String> map = new HashMap();
-		for(String path : urls){
-//			if(path.contains(".jpg") || path.contains("png")){
-//				generatePresignedUrlRequest = new GeneratePresignedUrlRequest(s3bucket, path)
-//						.withMethod(HttpMethod.PUT)
-//						.withExpiration(expiration)
-//						.withContentType("image/jpeg");
-//			}else {
-				generatePresignedUrlRequest = new GeneratePresignedUrlRequest(s3bucket, path)
-						.withMethod(HttpMethod.PUT)
-						.withExpiration(expiration);
-//			}
-			url = s3Client.generatePresignedUrl(generatePresignedUrlRequest);
-			map.put(path, url.toString());
-		}
-		return map;
-	}
-
-
-	public String upload5(String filePath, String key1) {
-		OSSClient ossClient = new OSSClient(point, key, secrey);
-		PutObjectResult result = null;
-		try {
-			File file = new File(filePath);
-			if (!file.exists()) {
-				log.error("要上传的文件不存在:" + filePath);
-			}
-
-
-			result = ossClient.putObject(bucket, key1, new File(filePath));
-
-		} catch (Exception e) {
-			log.error(e.toString() + filePath);
-		}
-
-		log.info(" getETag : " + result.getETag());
-		log.info("1 : " + result.toString());
-		log.info("2 : " + result.getRequestId());
-		log.info("3 : " + result.getClientCRC());
-		log.info("4 : " + result.getResponse());
-		log.info("5 : " + result.getServerCRC());
-		return result.getETag();
-	}
-
-
-	//海外亚马逊s3
-
-
-	/**
-	 * s3上传文件流
-	 *
-	 * @param file       文件
-	 * @param updatePath 上传路径[ eg: xxx/xxx ]
-	 */
-	public String updateS3LoadFile(MultipartFile file, String updatePath) {
-
-		if (isEmpty(file)) {
-			return null;
-		}
-
-		/**
-		 * 创建s3对象
-		 */
-		BasicAWSCredentials awsCreds = new BasicAWSCredentials(s3key, s3secrey);
-		AmazonS3 s3 = AmazonS3ClientBuilder.standard()
-				.withCredentials(new AWSStaticCredentialsProvider(awsCreds))
-				.withRegion(Regions.EU_WEST_2)
-				.build();
-
-		try {
-			// 创建临时文件,程序运行结束,会自动删除
-			File localFile = File.createTempFile("temp", null);
-			// 把文件写入内存中
-			file.transferTo(localFile);
-
-			// 指定要上传到服务器上的路径
-			String key = updatePath;
-
-			// 设置文件并设置公读
-			PutObjectRequest request = new PutObjectRequest(s3bucket, key, localFile);
-			request.withCannedAcl(CannedAccessControlList.PublicRead);
-
-			// 上传文件
-			com.amazonaws.services.s3.model.PutObjectResult putObjectResult = s3.putObject(request);
-			if (StringUtils.isNotEmpty(putObjectResult.getETag())) {
-				System.out.println("success");
-				return key;
-			}
-			return null;
-
-		} catch (IOException e) {
-		}
-		return null;
-	}
-
-	/**
-	 * s3上传文件
-	 * @param filePath
-	 * @param key1
-	 * @throws IOException
-     */
-	private void uploadS3File(String filePath, String key1) throws IOException {
-		File file = new File(filePath);
-		if(!file.exists()){
-			log.info("要上传s3的文件不存在");
-			return;
-		}
-
-		/**
-		 * 创建s3对象
-		 */
-		BasicAWSCredentials awsCreds = new BasicAWSCredentials(s3key, s3secrey);
-		AmazonS3 s3 = AmazonS3ClientBuilder.standard()
-				.withCredentials(new AWSStaticCredentialsProvider(awsCreds))
-				.withRegion(Regions.EU_WEST_2)
-				.build();
-
-		// 设置文件并设置公读
-		com.amazonaws.services.s3.model.ObjectMetadata metadata = new com.amazonaws.services.s3.model.ObjectMetadata();
-		if(filePath.contains(".jpg")){
-			metadata.setContentType("image/jpeg");
-		}
-		if(filePath.contains(".png")){
-			metadata.setContentType("image/png");
-		}
-		PutObjectRequest request = new PutObjectRequest(s3bucket, key1, file);
-		request.withCannedAcl(CannedAccessControlList.PublicRead);
-		request.withMetadata(metadata);
-
-		// 上传文件
-		com.amazonaws.services.s3.model.PutObjectResult putObjectResult = s3.putObject(request);
-		if (StringUtils.isNotEmpty(putObjectResult.getETag())) {
-			log.info("s3上传文件成功:" + key1);
-		}
-	}
-
-	/**
-	 * 删除单个文件
-	 *
-	 * @param filePath 文件路径[ eg: /head/xxxx.jpg ]
-	 * @return
-	 */
-	public void deleteS3Object(String filePath) {
-
-		/**
-		 * 创建s3对象
-		 */
-		BasicAWSCredentials awsCreds = new BasicAWSCredentials(s3key, s3secrey);
-		AmazonS3 s3 = AmazonS3ClientBuilder.standard()
-				.withCredentials(new AWSStaticCredentialsProvider(awsCreds))
-				.withRegion(Regions.EU_WEST_2)
-				.build();
-
-		if (filePath.startsWith("/")) {
-			filePath = filePath.substring(1);
-		}
-
-		try {
-			s3.deleteObject(s3bucket, filePath);
-		} catch (Exception e) {
-		}
-	}
-
-
-
-	/**
-	 * 获取文件类型
-	 */
-	public static String getContentType(String filePath){
-		FileNameMap fileNameMap = URLConnection.getFileNameMap();
-		String contentType = fileNameMap.getContentTypeFor(filePath);
-		System.out.println(contentType);
-		return contentType;
-
-	}
-
-	/**
-	 * 检查文件是否为空
-	 *
-	 * @param imageFile
-	 * @return
-	 */
-	private static boolean isEmpty(MultipartFile imageFile) {
-		if (imageFile == null || imageFile.getSize() <= 0) {
-			return true;
-		}
-		return false;
-	}
-
-	private static MultipartFile getMulFileByPath(String picPath) {
-		FileItem fileItem = createFileItem(picPath);
-		MultipartFile mfile = new CommonsMultipartFile(fileItem);
-		return mfile;
-	}
-
-	private static FileItem createFileItem(String filePath)
-	{
-		FileItemFactory factory = new DiskFileItemFactory(16, null);
-		String textFieldName = "textField";
-		int num = filePath.lastIndexOf(".");
-		String extFile = filePath.substring(num);
-		FileItem item = factory.createItem(textFieldName, "text/plain", true,
-				"MyFileName" + extFile);
-		File newfile = new File(filePath);
-		int bytesRead = 0;
-		byte[] buffer = new byte[8192];
-		try
-		{
-			FileInputStream fis = new FileInputStream(newfile);
-			OutputStream os = item.getOutputStream();
-			while ((bytesRead = fis.read(buffer, 0, 8192))
-					!= -1)
-			{
-				os.write(buffer, 0, bytesRead);
-			}
-			os.close();
-			fis.close();
-		}
-		catch (IOException e)
-		{
-			e.printStackTrace();
-		}
-		return item;
-	}
-
-	/**
-	 * 下载文件
-	 * @param bucketName	桶名
-	 * @param remoteFileName	文件名
-	 * @param path	下载路径
-	 */
-	public boolean downFromS3(String bucketName, String remoteFileName, String path) {
-		try {
-			/**
-			 * 创建s3对象
-			 */
-			BasicAWSCredentials awsCreds = new BasicAWSCredentials(s3key, s3secrey);
-			AmazonS3 s3 = AmazonS3ClientBuilder.standard()
-					.withCredentials(new AWSStaticCredentialsProvider(awsCreds))
-					.withRegion(Regions.EU_WEST_2)
-					.build();
-
-			GetObjectRequest request  = new GetObjectRequest(bucketName,remoteFileName);
-			s3.getObject(request,new File(path));
-			return true;
-		} catch (Exception ase) {
-			log.error("amazonS3下载文件异常 " + ase.getMessage(), ase);
-		}
-		return false;
-	}
-
-}