Преглед изворни кода

Merge remote-tracking branch 'origin/master'

by su пре 3 година
родитељ
комит
886f0936f6
33 измењених фајлова са 61 додато и 2482 уклоњено
  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. 0 58
      4dkankan-center-modeling/src/main/java/com/fdkankan/modeling/receiver/BuildSceneMQListenerTest.java
  5. 13 23
      4dkankan-center-platform/pom.xml
  6. 9 9
      4dkankan-center-platform/src/main/java/com/fdkankan/platform/agent/service/impl/AgentServiceImpl.java
  7. 1 7
      4dkankan-center-modeling/src/main/java/com/fdkankan/modeling/test/TestSendController.java
  8. 0 28
      4dkankan-center-platform/src/main/java/com/fdkankan/platform/user/common/SSOLoginHelper.java
  9. 0 57
      4dkankan-center-platform/src/main/java/com/fdkankan/platform/user/common/SSOLoginStore.java
  10. 0 54
      4dkankan-center-platform/src/main/java/com/fdkankan/platform/user/common/util/LogoConfig.java
  11. 0 104
      4dkankan-center-platform/src/main/java/com/fdkankan/platform/user/common/util/MatrixToImageWriterUtil.java
  12. 0 158
      4dkankan-center-platform/src/main/java/com/fdkankan/platform/user/common/util/QiniuUpload.java
  13. 0 237
      4dkankan-center-platform/src/main/java/com/fdkankan/platform/user/common/util/QiniuUtil.java
  14. 1 1
      4dkankan-center-platform/src/main/java/com/fdkankan/platform/user/service/impl/UserServiceImpl.java
  15. 6 9
      4dkankan-center-platform/src/main/java/com/fdkankan/platform/user/service/sso/AppService.java
  16. 0 1
      4dkankan-center-platform/src/main/java/com/fdkankan/platform/user/service/sso/LoginService.java
  17. 2 2
      4dkankan-center-platform/src/main/java/com/fdkankan/platform/user/service/sso/MsgService.java
  18. 3 3
      4dkankan-center-platform/src/main/java/com/fdkankan/platform/user/service/sso/SsoManagerService.java
  19. 6 0
      4dkankan-center-scene/pom.xml
  20. 1 0
      4dkankan-center-scene/src/main/java/com/fdkankan/scene/SceneApplication.java
  21. 1 1
      4dkankan-center-scene/src/main/java/com/fdkankan/scene/service/impl/Scene3dfamilyServiceImpl.java
  22. 1 1
      4dkankan-center-scene/src/main/java/com/fdkankan/scene/service/impl/SceneAppServiceImpl.java
  23. 1 0
      4dkankan-center-scene/src/main/java/com/fdkankan/scene/service/impl/SceneFileBuildServiceImpl.java
  24. 1 0
      4dkankan-center-scene/src/main/java/com/fdkankan/scene/service/impl/SceneProAppServiceImpl.java
  25. 1 0
      4dkankan-center-scene/src/main/java/com/fdkankan/scene/service/impl/SceneProServiceImpl.java
  26. 9 5
      4dkankan-center-scene/src/main/java/com/fdkankan/scene/service/impl/SceneServiceImpl.java
  27. 0 61
      4dkankan-common/pom.xml
  28. 2 2
      4dkankan-center-platform/src/main/java/com/fdkankan/platform/common/DefaultConfig.java
  29. 0 271
      4dkankan-common/src/main/java/com/fdkankan/common/sms/SendMailAcceUtils.java
  30. 0 228
      4dkankan-common/src/main/java/com/fdkankan/common/sms/SmsService.java
  31. 0 169
      4dkankan-common/src/main/java/com/fdkankan/common/util/QiniuUpload.java
  32. 0 262
      4dkankan-common/src/main/java/com/fdkankan/common/util/QiniuUtil.java
  33. 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;

+ 0 - 58
4dkankan-center-modeling/src/main/java/com/fdkankan/modeling/receiver/BuildSceneMQListenerTest.java

@@ -1,58 +0,0 @@
-package com.fdkankan.modeling.receiver;
-
-import com.fdkankan.mq.util.RocketMQProducer;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.rocketmq.spring.annotation.ConsumeMode;
-import org.apache.rocketmq.spring.annotation.MessageModel;
-import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
-import org.apache.rocketmq.spring.core.RocketMQListener;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-
-import java.util.concurrent.*;
-
-
-@Slf4j
-@Component
-@RocketMQMessageListener(
-        consumerGroup = "test_model_order",
-        topic = "test_model_order",
-        messageModel = MessageModel.CLUSTERING,consumeMode = ConsumeMode.ORDERLY)
-public class BuildSceneMQListenerTest implements RocketMQListener<String> {
-
-    private String consumerGroup ="test_model_order";
-
-    private String topicName = "test_model_order";
-
-    @Autowired
-    RocketMQProducer rocketMQProducer;
-
-    @Override
-    public  void onMessage(String message) {
-        log.info("开始处理消息,消费者组:{},主题名:{}, 消息内容:{}", consumerGroup, topicName, message);
-        System.out.println(1);
-        process2();
-        System.out.println(2);
-    }
-    public   void process2() {
-        Long startTime = System.currentTimeMillis();
-        final ExecutorService exec = Executors.newFixedThreadPool(1);
-        Callable<String> call = (Callable<String>) () -> {
-            while (System.currentTimeMillis() - startTime <=1000 * 60 ){
-
-            }
-          return "success";
-        };
-        Future<String> future = exec.submit(call);
-        try {
-            future.get(1, TimeUnit.HOURS); //任务处理超时时间设为 24个小时
-        } catch (InterruptedException e) {
-            e.printStackTrace();
-        } catch (ExecutionException e) {
-            e.printStackTrace();
-        } catch (TimeoutException e) {
-            e.printStackTrace();
-        }
-    }
-
-}

+ 13 - 23
4dkankan-center-platform/pom.xml

@@ -41,6 +41,12 @@
 
       <dependency>
           <groupId>com.fdkankan</groupId>
+          <artifactId>4dkankan-utils-sms</artifactId>
+          <version>2.0.0</version>
+      </dependency>
+
+      <dependency>
+          <groupId>com.fdkankan</groupId>
           <artifactId>4dkankan-pay</artifactId>
           <version>2.0.0</version>
       </dependency>
@@ -49,38 +55,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>
-      </dependency>
+<!--      <dependency>-->
+<!--          <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>
 

+ 9 - 9
4dkankan-center-platform/src/main/java/com/fdkankan/platform/agent/service/impl/AgentServiceImpl.java

@@ -4,7 +4,15 @@ import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.fdkankan.common.config.RedisDefaultConfig;
+import com.fdkankan.common.constant.ConstantFilePath;
+import com.fdkankan.common.constant.ErrorCode;
 import com.fdkankan.common.constant.LoginType;
+import com.fdkankan.common.constant.ServerCode;
+import com.fdkankan.common.exception.BusinessException;
+import com.fdkankan.common.util.JwtUtil;
+import com.fdkankan.common.util.PasswordUtils;
+import com.fdkankan.common.util.SsoUtil;
 import com.fdkankan.platform.agent.entity.Agent;
 import com.fdkankan.platform.agent.mapper.IAgentMapper;
 import com.fdkankan.platform.agent.request.RequestAgent;
@@ -14,20 +22,12 @@ import com.fdkankan.platform.agent.vo.AgentDetailTotalAmount;
 import com.fdkankan.platform.agent.vo.AgentTotalAmountVo;
 import com.fdkankan.platform.agent.vo.AgentVo;
 import com.fdkankan.platform.agent.vo.ResponseAgentCamera;
-import com.fdkankan.common.constant.ConstantFilePath;
-import com.fdkankan.common.util.PasswordUtils;
-import com.fdkankan.common.util.SsoUtil;
-import com.fdkankan.platform.common.DefaultConfig;
 import com.fdkankan.platform.goods.entity.Camera;
 import com.fdkankan.platform.goods.entity.CameraDetail;
 import com.fdkankan.platform.goods.service.ICameraDetailService;
 import com.fdkankan.platform.goods.service.ICameraService;
 import com.fdkankan.platform.order.service.IVirtualOrderService;
 import com.fdkankan.redis.util.RedisUtil;
-import com.fdkankan.common.constant.ErrorCode;
-import com.fdkankan.common.constant.ServerCode;
-import com.fdkankan.common.exception.BusinessException;
-import com.fdkankan.common.util.JwtUtil;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -83,7 +83,7 @@ public class AgentServiceImpl extends ServiceImpl<IAgentMapper, Agent> implement
         }
         String key = SsoUtil.PREFIX_CACHE_AGENT + agent.getAgentId();
         String token = JwtUtil.createJWT(-1, key, LoginType.AGENT.name());
-        redisUtil.set(key,token, DefaultConfig.USER_EXPIRE_TIME);
+        redisUtil.set(key,token, RedisDefaultConfig.USER_EXPIRE_TIME);
         JSONObject obj = new JSONObject();
         obj.put("token", token);
         return obj;

+ 1 - 7
4dkankan-center-modeling/src/main/java/com/fdkankan/modeling/test/TestSendController.java

@@ -1,25 +1,19 @@
-package com.fdkankan.modeling.test;
+package com.fdkankan.platform.test;
 
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
-import javax.annotation.Resource;
-
 @RestController
 @RequestMapping("/send")
 public class TestSendController {
 
-    @Resource
-    com.fdkankan.mq.util.RocketMQProducer rocketMQProducer;
 
     private final String topic ="test_model_order";
 
     @RequestMapping("/test")
     private void sentTest(){
-        rocketMQProducer.sendInOrder(topic,"1");
     }
     @RequestMapping("/test1")
     private void sentTest1(){
-        rocketMQProducer.sendOneWay(topic,"1");
     }
 }

+ 0 - 28
4dkankan-center-platform/src/main/java/com/fdkankan/platform/user/common/SSOLoginHelper.java

@@ -1,28 +0,0 @@
-//package com.fdkankan.user.common;
-//
-//import com.fdkankan.user.entity.SSOUser;
-//import org.springframework.beans.factory.annotation.Autowired;
-//import org.springframework.stereotype.Component;
-//
-//@Component
-//public class SSOLoginHelper {
-//    @Autowired
-//    private SSOLoginStore ssoLoginStore;
-//    public  SSOUser loginCheck(String sessionId) {
-//        if (sessionId != null && sessionId.trim().length() > 0) {
-//            SSOUser ssoUser = ssoLoginStore.get(sessionId);
-//            if (ssoUser != null) {
-//                return ssoUser;
-//            }
-//        }
-//        return null;
-//    }
-//
-//    public void login(String token, SSOUser ssoUser) {
-//        ssoLoginStore.put(token, ssoUser);
-//    }
-//
-//    public  void logout(String sessionId) {
-//        ssoLoginStore.remove(sessionId);
-//    }
-//}

+ 0 - 57
4dkankan-center-platform/src/main/java/com/fdkankan/platform/user/common/SSOLoginStore.java

@@ -1,57 +0,0 @@
-//package com.fdkankan.user.common;
-//
-//import com.alibaba.fastjson.JSONObject;
-//import com.fdkankan.common.util.SsoUtil;
-//import com.fdkankan.user.entity.SSOUser;
-//import org.springframework.data.redis.core.RedisTemplate;
-//import org.springframework.stereotype.Component;
-//
-//import javax.annotation.Resource;
-//import java.util.concurrent.TimeUnit;
-//
-//@Component
-//public class SSOLoginStore {
-//
-//    @Resource
-//    private RedisTemplate<String,String> redisTemplate;
-//    /**
-//     * get
-//     *
-//     * @param sessionId
-//     * @return
-//     */
-//    public  SSOUser get(String sessionId) {
-//
-//        String redisKey = redisKey(sessionId);
-//        String objectValue = redisTemplate.opsForValue().get(redisKey);
-//        if (objectValue != null) {
-//            return JSONObject.parseObject(objectValue, SSOUser.class);
-//        }
-//        return null;
-//    }
-//
-//    /**
-//     * remove
-//     *
-//     * @param sessionId
-//     */
-//    public  void remove(String sessionId) {
-//        String redisKey = redisKey(sessionId);
-//        redisTemplate.delete(redisKey);
-//    }
-//
-//    /**
-//     * put
-//     *
-//     * @param sessionId
-//     * @param ssoUser
-//     */
-//    public  void put(String sessionId, SSOUser ssoUser) {
-//        String redisKey = redisKey(sessionId);
-//        redisTemplate.opsForValue().set(redisKey, JSONObject.toJSONString(ssoUser), 216000, TimeUnit.SECONDS);
-//    }
-//
-//    private static String redisKey(String sessionId){
-//        return SsoUtil.SSO_SESSIONID.concat("#").concat(sessionId);
-//    }
-//}

+ 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;

+ 6 - 9
4dkankan-center-platform/src/main/java/com/fdkankan/platform/user/service/sso/AppService.java

@@ -1,12 +1,14 @@
 package com.fdkankan.platform.user.service.sso;
 
+import com.fdkankan.common.config.RedisDefaultConfig;
 import com.fdkankan.common.constant.*;
+import com.fdkankan.common.exception.BusinessException;
 import com.fdkankan.common.user.SSOUser;
+import com.fdkankan.common.util.JwtUtil;
 import com.fdkankan.common.util.RandomUtil;
 import com.fdkankan.common.util.SecurityUtil;
 import com.fdkankan.common.util.SsoUtil;
 import com.fdkankan.common.validation.Variable;
-import com.fdkankan.platform.common.DefaultConfig;
 import com.fdkankan.platform.goods.entity.Camera;
 import com.fdkankan.platform.goods.entity.CameraDetail;
 import com.fdkankan.platform.goods.service.ICameraDetailService;
@@ -16,11 +18,6 @@ import com.fdkankan.platform.user.request.RequestUser;
 import com.fdkankan.platform.user.service.IUserService;
 import com.fdkankan.platform.user.vo.ResponseUser;
 import com.fdkankan.platform.user.vo.SSOUserVo;
-import com.fdkankan.common.constant.CameraConstant;
-import com.fdkankan.common.constant.ErrorCode;
-import com.fdkankan.common.constant.ServerCode;
-import com.fdkankan.common.exception.BusinessException;
-import com.fdkankan.common.util.JwtUtil;
 import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -62,7 +59,7 @@ public class AppService {
         if (entity == null ){
             throw new BusinessException(AppConstant.FAILURE_CODE_4012, AppConstant.FAILURE_MSG_4012);
         }
-        redisTemplate.opsForValue().set(user.getUuid(),user.getAppUserName(), DefaultConfig.DEFAULT_EXPIRE_TIME, DefaultConfig.DEFAULT_TIME_UNIT);
+        redisTemplate.opsForValue().set(user.getUuid(),user.getAppUserName(), RedisDefaultConfig.DEFAULT_EXPIRE_TIME, RedisDefaultConfig.DEFAULT_TIME_UNIT);
         return ServerCode.SUCCESS.message();
     }
 
@@ -76,7 +73,7 @@ public class AppService {
         }
         String token = JwtUtil.createJWT(-1, cameraEntity.getChildName(), LoginType.APP.name());
         String key = SsoUtil.PREFIX_CACHE_CAMERA + cameraEntity.getChildName();
-        redisTemplate.opsForValue().set(key, token, DefaultConfig.CAMERA_EXPIRE_TIME,DefaultConfig.DEFAULT_TIME_UNIT);
+        redisTemplate.opsForValue().set(key, token, RedisDefaultConfig.CAMERA_EXPIRE_TIME,RedisDefaultConfig.DEFAULT_TIME_UNIT);
         HashMap<String,String> obj = new HashMap<>();
         obj.put("token", token);
         return obj;
@@ -108,7 +105,7 @@ public class AppService {
     private SSOUserVo setRedisToken(SSOUser ssoUser,User userEntity,Integer CameraType){
         String key = SsoUtil.PREFIX_CACHE_CAMERA + ssoUser.getUserName();
         String token = JwtUtil.createJWT(-1, ssoUser.getUserName(),LoginType.APP.name());
-        redisTemplate.opsForValue().set(key, token, DefaultConfig.USER_EXPIRE_TIME,DefaultConfig.DEFAULT_TIME_UNIT);
+        redisTemplate.opsForValue().set(key, token, RedisDefaultConfig.USER_EXPIRE_TIME,RedisDefaultConfig.DEFAULT_TIME_UNIT);
         Integer cameraType = CameraType == null ? 4 : CameraType;
         return userService.getUserInfoByUser(cameraType, userEntity, token);
     }

+ 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;

+ 2 - 2
4dkankan-center-platform/src/main/java/com/fdkankan/platform/user/service/sso/MsgService.java

@@ -1,7 +1,7 @@
 package com.fdkankan.platform.user.service.sso;
 
-import com.fdkankan.common.sms.SendMailAcceUtils;
-import com.fdkankan.common.sms.SmsService;
+import com.fdkankan.sms.SendMailAcceUtils;
+import com.fdkankan.sms.SmsService;
 import com.fdkankan.common.util.PatternUtils;
 import com.fdkankan.common.util.SsoUtil;
 import com.fdkankan.platform.user.entity.User;

+ 3 - 3
4dkankan-center-platform/src/main/java/com/fdkankan/platform/user/service/sso/SsoManagerService.java

@@ -2,15 +2,15 @@ package com.fdkankan.platform.user.service.sso;
 
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.fdkankan.common.config.RedisDefaultConfig;
 import com.fdkankan.common.constant.ErrorCode;
 import com.fdkankan.common.constant.LoginType;
 import com.fdkankan.common.constant.ServerCode;
 import com.fdkankan.common.exception.BusinessException;
 import com.fdkankan.common.util.Base64Converter;
+import com.fdkankan.common.util.JwtUtil;
 import com.fdkankan.common.util.PasswordUtils;
 import com.fdkankan.common.util.SsoUtil;
-import com.fdkankan.common.util.JwtUtil;
-import com.fdkankan.platform.common.DefaultConfig;
 import com.fdkankan.platform.order.entity.SpaceSdk;
 import com.fdkankan.platform.order.service.ISpaceSdkService;
 import com.fdkankan.platform.user.entity.Manager;
@@ -67,7 +67,7 @@ public class SsoManagerService {
         }
         String key = SsoUtil.PREFIX_CACHE_MANAGER + managerEntity.getUserName();
         String token = JwtUtil.createJWT(-1, key, LoginType.MANAGER.name());
-        redisTemplate.opsForValue().set(key, token, DefaultConfig.USER_EXPIRE_TIME,DefaultConfig.DEFAULT_TIME_UNIT);
+        redisTemplate.opsForValue().set(key, token, RedisDefaultConfig.USER_EXPIRE_TIME,RedisDefaultConfig.DEFAULT_TIME_UNIT);
         JSONObject obj = new JSONObject();
         obj.put("token", token);
         return obj;

+ 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 - 61
4dkankan-common/pom.xml

@@ -59,50 +59,11 @@
         </dependency>
 
         <dependency>
-            <groupId>org.apache.ant</groupId>
-            <artifactId>ant</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.bytedeco</groupId>
-            <artifactId>javacv-platform</artifactId>
-            <version>1.4.3</version>
-        </dependency>
-        <dependency>
             <groupId>org.apache.shiro</groupId>
             <artifactId>shiro-spring</artifactId>
         </dependency>
 
         <dependency>
-            <groupId>com.aliyun.oss</groupId>
-            <artifactId>aliyun-sdk-oss</artifactId>
-            <version>2.8.3</version>
-        </dependency>
-
-        <dependency>
-            <groupId>com.amazonaws</groupId>
-            <artifactId>aws-java-sdk</artifactId>
-            <version>1.11.327</version>
-        </dependency>
-
-        <dependency>
-            <groupId>com.qiniu</groupId>
-            <artifactId>qiniu-java-sdk</artifactId>
-            <version>7.2.0</version>
-        </dependency>
-
-        <dependency>
-            <groupId>com.qiniu</groupId>
-            <artifactId>qiniu-java-sdk</artifactId>
-            <version>[7.2.0,7.2.99]</version>
-        </dependency>
-        <dependency>
-            <groupId>com.qiniu</groupId>
-            <artifactId>happy-dns-java</artifactId>
-            <version>0.1.4</version>
-            <scope>compile</scope>
-        </dependency>
-
-        <dependency>
             <groupId>net.coobird</groupId>
             <artifactId>thumbnailator</artifactId>
             <version>0.4.8</version>
@@ -115,28 +76,6 @@
         </dependency>
 
         <dependency>
-            <groupId>com.aliyun</groupId>
-            <artifactId>aliyun-java-sdk-dysmsapi</artifactId>
-            <version>1.1.0</version>
-        </dependency>
-
-        <dependency>
-            <groupId>com.amazonaws</groupId>
-            <artifactId>aws-java-sdk</artifactId>
-            <version>1.11.327</version>
-        </dependency>
-        <dependency>
-            <groupId>com.sun.mail</groupId>
-            <artifactId>javax.mail</artifactId>
-            <version>1.5.4</version>
-        </dependency>
-
-        <dependency>
-            <groupId>com.fdkankan</groupId>
-            <artifactId>4dkankan-utils-mq</artifactId>
-            <version>2.0.0</version>
-        </dependency>
-        <dependency>
             <groupId>com.fdkankan</groupId>
             <artifactId>4dkankan-utils-redis</artifactId>
             <version>2.0.0</version>

+ 2 - 2
4dkankan-center-platform/src/main/java/com/fdkankan/platform/common/DefaultConfig.java

@@ -1,8 +1,8 @@
-package com.fdkankan.platform.common;
+package com.fdkankan.common.config;
 
 import java.util.concurrent.TimeUnit;
 
-public class DefaultConfig {
+public class RedisDefaultConfig {
     public static final int DEFAULT_EXPIRE_TIME = 7200;  // redis默认过期时间,单位/秒, 60*60*2=2H, 两小时
     public static final TimeUnit DEFAULT_TIME_UNIT = TimeUnit.SECONDS; //redis默认过期时间单位
     public static final int CAMERA_EXPIRE_TIME = 604800;  // 相机登陆7天有效期

Разлика између датотеке није приказан због своје велике величине
+ 0 - 271
4dkankan-common/src/main/java/com/fdkankan/common/sms/SendMailAcceUtils.java


+ 0 - 228
4dkankan-common/src/main/java/com/fdkankan/common/sms/SmsService.java

@@ -1,228 +0,0 @@
-package com.fdkankan.common.sms;
-
-import com.alibaba.fastjson.JSONObject;
-import com.aliyuncs.DefaultAcsClient;
-import com.aliyuncs.IAcsClient;
-import com.aliyuncs.dysmsapi.model.v20170525.SendSmsRequest;
-import com.aliyuncs.dysmsapi.model.v20170525.SendSmsResponse;
-import com.aliyuncs.exceptions.ClientException;
-import com.aliyuncs.exceptions.ServerException;
-import com.aliyuncs.http.MethodType;
-import com.aliyuncs.profile.DefaultProfile;
-import com.aliyuncs.profile.IClientProfile;
-import com.amazonaws.auth.AWSCredentials;
-import com.amazonaws.auth.AWSCredentialsProvider;
-import com.amazonaws.services.sns.AmazonSNS;
-import com.amazonaws.services.sns.AmazonSNSClientBuilder;
-import com.amazonaws.services.sns.model.MessageAttributeValue;
-import com.amazonaws.services.sns.model.PublishRequest;
-import com.amazonaws.services.sns.model.PublishResult;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.stereotype.Component;
-import org.springframework.util.StringUtils;
-
-import java.util.HashMap;
-import java.util.Map;
-
-@Component
-public class SmsService {
-
-    private static Logger log = LoggerFactory.getLogger("programLog");
-
-    //初始化ascClient需要的几个参数
-    private static final String product = "Dysmsapi";//短信API产品名称(短信产品名固定,无需修改)
-    private static final String domain = "dysmsapi.aliyuncs.com";//短信API产品域名(接口地址固定,无需修改)
-    private static final String accessKeyId = "LTAIUrvuHqj8pvry";//你的accessKeyId,参考本文档步骤2
-    private static final String accessKeySecret = "JLOVl0k8Ke0aaM8nLMMiUAZ3EiiqI4";//你的accessKeySecret,参考本文档步骤2
-
-    private static final String EN_CODE_MSG = "Your vertification code is ${code}. Thank you for using 4DKanKan, please complete your identity verification by entering this code in 5 minutes. Please ignore this message if you don't operate by yourself.";
-
-
-    @Value("${phone.sign:四维看看}")
-    private String sign;
-
-    public String sendSms(String phoneNum, String templateParam, String templateCode) throws Exception {
-        log.info("cnCode:" + templateCode);
-        log.info("templateParam:" + templateParam);
-        log.info("sign:" + sign);
-        log.info("sign:" + new String(sign.getBytes("ISO-8859-1"),"utf-8"));
-        // 可自助调整超时时间
-        System.setProperty("sun.net.client.defaultConnectTimeout", "10000");
-        System.setProperty("sun.net.client.defaultReadTimeout", "10000");
-        String result = null;
-        try {
-            // 初始化acsClient,暂不支持region化
-            IClientProfile profile = DefaultProfile.getProfile("cn-hangzhou", accessKeyId, accessKeySecret);
-            DefaultProfile.addEndpoint("cn-hangzhou", "cn-hangzhou", product, domain);
-            IAcsClient acsClient = new DefaultAcsClient(profile);
-
-            // 组装请求对象-具体描述见控制台-文档部分内容
-            SendSmsRequest request = new SendSmsRequest();
-
-            // 必填:待发送手机号
-            request.setPhoneNumbers(phoneNum);
-            // 必填:短信签名-可在短信控制台中找到
-            request.setSignName(new String(sign.getBytes("ISO-8859-1"),"utf-8"));
-            // 必填:短信模板-可在短信控制台中找到
-            request.setTemplateCode(templateCode);
-
-            // 可选:模板中的变量替换JSON串,如模板内容为"亲爱的${name},您的验证码为${code}"时,此处的值为
-            request.setTemplateParam(templateParam);
-
-            // 选填-上行短信扩展码(无特殊需求用户请忽略此字段)
-            // request.setSmsUpExtendCode("90997");
-
-            // 可选:outId为提供给业务方扩展字段,最终在短信回执消息中将此值带回给调用者
-            // request.setOutId("yourOutId");
-
-            // hint 此处可能会抛出异常,注意catch
-            SendSmsResponse sendSmsResponse = acsClient.getAcsResponse(request);
-            if (sendSmsResponse != null
-                    && !StringUtils.isEmpty(sendSmsResponse.getCode())){
-
-                if("OK".equals(sendSmsResponse.getCode())){
-                    log.debug("阿里云短信发送成功");
-                }else {
-                    log.debug("阿里云短信发送失败:" + sendSmsResponse.getCode());
-                    log.debug("阿里云短信发送失败原因:" + sendSmsResponse.getMessage());
-                }
-                result = sendSmsResponse.getCode();
-            }
-        }catch (ClientException e){
-            log.error("阿里云短信发送失败:" + e);
-        }
-        return result;
-    }
-
-
-    public boolean sendBuildFailSms(String name, String scene,String userPhone) throws Exception{
-
-        //设置超时时间-可自行调整
-        System.setProperty("sun.net.client.defaultConnectTimeout", "10000");
-        System.setProperty("sun.net.client.defaultReadTimeout", "10000");
-        //初始化ascClient需要的几个参数
-        final String product = "Dysmsapi";//短信API产品名称(短信产品名固定,无需修改)
-        final String domain = "dysmsapi.aliyuncs.com";//短信API产品域名(接口地址固定,无需修改)
-        //替换成你的AK
-        final String accessKeyId = "LTAIUrvuHqj8pvry";//你的accessKeyId,参考本文档步骤2
-        final String accessKeySecret = "JLOVl0k8Ke0aaM8nLMMiUAZ3EiiqI4";//你的accessKeySecret,参考本文档步骤2
-        //初始化ascClient,暂时不支持多region
-        IClientProfile profile = DefaultProfile.getProfile("cn-hangzhou", accessKeyId,
-                accessKeySecret);
-        try {
-            DefaultProfile.addEndpoint("cn-hangzhou", "cn-hangzhou", product, domain);
-        } catch (ClientException e1) {
-            // TODO Auto-generated catch block
-            e1.printStackTrace();
-        }
-        IAcsClient acsClient = new DefaultAcsClient(profile);
-        //组装请求对象
-        SendSmsRequest request = new SendSmsRequest();
-        //使用post提交
-        request.setMethod(MethodType.POST);
-        //必填:待发送手机号。支持以逗号分隔的形式进行批量调用,批量上限为1000个手机号码,批量调用相对于单条调用及时性稍有延迟,验证码类型的短信推荐使用单条调用的方式
-        request.setPhoneNumbers(userPhone);
-        //必填:短信签名-可在短信控制台中找到
-        request.setSignName(new String(sign.getBytes("ISO-8859-1"),"utf-8"));
-        //必填:短信模板-可在短信控制台中找到
-        request.setTemplateCode("SMS_199808901");
-        JSONObject jsonObject = new JSONObject();
-        jsonObject.put("name", name);
-        jsonObject.put("scene", scene);
-        request.setTemplateParam(jsonObject.toJSONString());
-
-        SendSmsResponse sendSmsResponse = null;
-        try {
-            sendSmsResponse = acsClient.getAcsResponse(request);
-        } catch (ServerException e) {
-            // TODO Auto-generated catch block
-            e.printStackTrace();
-        } catch (ClientException e) {
-            // TODO Auto-generated catch block
-            e.printStackTrace();
-            //System.out.println("向阿里请求发短信失败");
-            log.error("sendSms:向阿里请求发短信失败");
-        }
-        if(sendSmsResponse == null)
-        {
-            log.error("sendSms:向阿里请求发短信失败");
-        }
-        if(sendSmsResponse.getCode() != null && sendSmsResponse.getCode().equals("OK")) {
-            //请求成功
-            //System.out.println("向阿里请求发短信成功");
-            log.info("sendSms:向阿里请求发短信成功");
-            return true;
-
-        }else {
-            log.debug("阿里云短信发送失败:" + sendSmsResponse.getCode());
-            log.debug("阿里云短信发送失败原因:" + sendSmsResponse.getMessage());
-        }
-        return false;
-    }
-
-
-    //aws短信
-    private Map<String, MessageAttributeValue> smsAttributes;
-
-
-    public Map<String, MessageAttributeValue> getDefaultSMSAttributes() {
-        if (smsAttributes == null) {
-            smsAttributes = new HashMap<>();
-            smsAttributes.put("AWS.SNS.SMS.SenderID", new MessageAttributeValue()
-                    .withStringValue("4dkankan")
-                    .withDataType("String"));
-            smsAttributes.put("AWS.SNS.SMS.MaxPrice", new MessageAttributeValue()
-                    .withStringValue("1.05")
-                    .withDataType("Number"));
-            smsAttributes.put("AWS.SNS.SMS.SMSType", new MessageAttributeValue()
-                    .withStringValue("Transactional")
-                    .withDataType("String"));
-        }
-        return smsAttributes;
-    }
-
-    public PublishResult sendSMSMessage(String phoneNumber, String message) {
-        return sendSMSMessage(phoneNumber, message, getDefaultSMSAttributes());
-    }
-
-    public PublishResult sendSMSMessage(String phoneNumber, String message, Map<String, MessageAttributeValue> smsAttributes) {
-        AWSCredentials awsCredentials = new AWSCredentials() {
-            @Override
-            public String getAWSAccessKeyId() {
-                return "AKIAWCV5QFZ3ZQS7LBNL"; // 带有发短信权限的 IAM 的 ACCESS_KEY
-            }
-
-            @Override
-            public String getAWSSecretKey() {
-                return "NDzNp/5tqypSxxyPkkoixeJntn5W6dq0cLYV2FUH"; // 带有发短信权限的 IAM 的 SECRET_KEY
-            }
-        };
-        AWSCredentialsProvider provider = new AWSCredentialsProvider() {
-            @Override
-            public AWSCredentials getCredentials() {
-                return awsCredentials;
-            }
-
-            @Override
-            public void refresh() {
-            }
-        };
-        AmazonSNS amazonSNS = null;
-        try {
-            amazonSNS = AmazonSNSClientBuilder.standard().withCredentials(provider).withRegion("eu-central-1").build();
-        } catch (Exception e) {
-
-        }
-        return amazonSNS.publish(
-                new PublishRequest()
-                        .withMessage(EN_CODE_MSG.replace("${code}", message))
-                        .withPhoneNumber(phoneNumber)
-                        .withMessageAttributes(smsAttributes)
-        );
-    }
-
-
-
-}

+ 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;
-	}
-
-}