lyhzzz před 2 roky
rodič
revize
ff7111593a
27 změnil soubory, kde provedl 43 přidání a 3822 odebrání
  1. 0 47
      pom.xml
  2. 0 27
      src/main/java/com/fdkankan/tools/httpClient/client/FdkkClient.java
  3. 0 23
      src/main/java/com/fdkankan/tools/httpClient/client/ZfbClient.java
  4. 1 10
      src/main/java/com/fdkankan/tools/service/IScenePlusService.java
  5. 0 67
      src/main/java/com/fdkankan/tools/service/impl/CnToZfbService.java
  6. 1 399
      src/main/java/com/fdkankan/tools/service/impl/ScenePlusServiceImpl.java
  7. 3 3
      src/main/java/com/fdkankan/tools/service/impl/TbBuildingServiceImpl.java
  8. 2 2
      src/main/java/com/fdkankan/tools/service/impl/TbCameraInstanceServiceImpl.java
  9. 3 3
      src/main/java/com/fdkankan/tools/service/impl/TbHouseServiceImpl.java
  10. 4 4
      src/main/java/com/fdkankan/tools/service/impl/TbScene3dNumNewServiceImpl.java
  11. 0 1
      src/main/java/com/fdkankan/tools/service/impl/TbSceneNumServiceImpl.java
  12. 3 3
      src/main/java/com/fdkankan/tools/service/impl/TbSceneProServiceImpl.java
  13. 4 4
      src/main/java/com/fdkankan/tools/service/impl/TbSceneServiceImpl.java
  14. 2 2
      src/main/java/com/fdkankan/tools/service/impl/TbUserServiceImpl.java
  15. 6 1
      src/main/java/com/fdkankan/tools/task/TaskService.java
  16. 0 82
      src/main/java/com/fdkankan/tools/utils/OssToOssUtil.java
  17. 0 37
      src/main/java/com/fdkankan/tools/utils/StorageType.java
  18. 0 1057
      src/main/java/com/fdkankan/tools/utils/UploadToAws.java
  19. 0 971
      src/main/java/com/fdkankan/tools/utils/UploadToOss.java
  20. 0 881
      src/main/java/com/fdkankan/tools/utils/UploadToOss2.java
  21. 0 18
      src/main/java/com/fdkankan/tools/vo/CameraVo.java
  22. 0 57
      src/main/resources/application-cnToJp.yaml
  23. 0 47
      src/main/resources/application-eurToJp.yaml
  24. 0 43
      src/main/resources/application-local.yaml
  25. 6 17
      src/main/resources/application-zfbOldToNew.yaml
  26. 7 15
      src/main/resources/application-cnToZfb.yaml
  27. 1 1
      src/main/resources/application.yaml

+ 0 - 47
pom.xml

@@ -20,11 +20,6 @@
 
     <dependencies>
 
-        <dependency>
-            <groupId>com.baomidou</groupId>
-            <artifactId>dynamic-datasource-spring-boot-starter</artifactId>
-            <version>3.5.0</version>
-        </dependency>
 
 
         <dependency>
@@ -48,23 +43,7 @@
             <artifactId>lombok</artifactId>
         </dependency>
 
-        <dependency>
-            <groupId>com.dtflys.forest</groupId>
-            <artifactId>forest-spring-boot-starter</artifactId>
-            <version>1.5.24</version>
-        </dependency>
-
-        <dependency>
-            <groupId>io.jsonwebtoken</groupId>
-            <artifactId>jjwt</artifactId>
-            <version>0.9.1</version>
-        </dependency>
 
-        <dependency>
-            <groupId>com.auth0</groupId>
-            <artifactId>java-jwt</artifactId>
-            <version>3.10.3</version>
-        </dependency>
 
 
         <dependency>
@@ -103,39 +82,13 @@
         </dependency>
 
 
-
-
-        <!-- 阿里云 OSS 不使用的情况下可以不引入 -->
-        <dependency>
-            <groupId>com.aliyun.oss</groupId>
-            <artifactId>aliyun-sdk-oss</artifactId>
-            <version>3.15.1</version>
-        </dependency>
-
-
-        <!-- AWS S3 不使用的情况下可以不引入 -->
-        <dependency>
-            <groupId>com.amazonaws</groupId>
-            <artifactId>aws-java-sdk-s3</artifactId>
-            <version>1.12.272</version>
-        </dependency>
         <dependency>
             <groupId>cn.hutool</groupId>
             <artifactId>hutool-all</artifactId>
             <version>5.7.17</version>
         </dependency>
 
-        <dependency>
-            <groupId>com.dtflys.forest</groupId>
-            <artifactId>forest-spring-boot-starter</artifactId>
-            <version>1.5.20</version>
-        </dependency>
 
-        <dependency>
-            <groupId>com.alibaba</groupId>
-            <artifactId>easyexcel</artifactId>
-            <version>3.1.0</version>
-        </dependency>
     </dependencies>
 
 

+ 0 - 27
src/main/java/com/fdkankan/tools/httpClient/client/FdkkClient.java

@@ -1,27 +0,0 @@
-package com.fdkankan.tools.httpClient.client;
-
-import com.alibaba.fastjson.JSONObject;
-import com.dtflys.forest.annotation.*;
-import org.springframework.web.multipart.MultipartFile;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * 获取四维看看相关数据
- */
-public interface FdkkClient {
-
-    /**
-     * 重算
-     */
-    @Get("https://www.4dkankan.jp/api/scene/file/rebuildScene")
-    JSONObject rebuildScene(@Query("num") String num);
-    /**
-     * 升级
-     */
-    @Get("https://www.4dkankan.jp/ucenter/user/scene/upgradeToV4")
-    JSONObject upgradeToV4(@Query("num") String num);
-
-}

+ 0 - 23
src/main/java/com/fdkankan/tools/httpClient/client/ZfbClient.java

@@ -1,23 +0,0 @@
-package com.fdkankan.tools.httpClient.client;
-
-import com.alibaba.fastjson.JSONObject;
-import com.dtflys.forest.annotation.Get;
-import com.dtflys.forest.annotation.Query;
-
-/**
- * 获取四维看看相关数据
- */
-public interface ZfbClient {
-
-    /**
-     * 重算
-     */
-    @Get("https://zfb.4dkankan.com/api/scene/rebuildScene")
-    JSONObject rebuildScene(@Query("num") String num);
-    /**
-     * 升级
-     */
-    @Get("https://www.4dkankan.jp/ucenter/user/scene/upgradeToV4")
-    JSONObject upgradeToV4(@Query("num") String num);
-
-}

+ 1 - 10
src/main/java/com/fdkankan/tools/service/IScenePlusService.java

@@ -1,6 +1,6 @@
 package com.fdkankan.tools.service;
 
-import com.baomidou.dynamic.datasource.annotation.DS;
+
 import com.fdkankan.tools.entity.*;
 import com.baomidou.mybatisplus.extension.service.IService;
 
@@ -17,14 +17,5 @@ import java.util.List;
 public interface IScenePlusService extends IService<ScenePlus> {
 
 
-    Boolean db1ToDb2(String num);
-
-    void db2Save(String type) ;
-
-    ScenePlus getByNum(String num);
-
-    Object db1ToDb2ByUserId(Long userId);
-
-    void updateSceneScheme(List<String> asList);
 
 }

+ 0 - 67
src/main/java/com/fdkankan/tools/service/impl/CnToZfbService.java

@@ -1,67 +0,0 @@
-package com.fdkankan.tools.service.impl;
-
-import com.fdkankan.tools.entity.*;
-import com.fdkankan.tools.httpClient.client.ZfbClient;
-import com.fdkankan.tools.service.*;
-import com.fdkankan.tools.utils.OssToOssUtil;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import java.util.List;
-import java.util.stream.Collectors;
-
-@Service
-@Slf4j
-public class CnToZfbService {
-    @Autowired
-    ISceneProService cnSceneProService;
-    @Autowired
-    ISceneProEditService cnSceneProEditService;
-    @Autowired
-    IUserService userService;
-
-    @Autowired
-    ITbSceneProService zfbSceneProService;
-    @Autowired
-    ITbSceneProEditService zfbSceneProEditService;
-    @Autowired
-    OssToOssUtil ossToOssUtil;
-    @Autowired
-    ZfbClient zfbClient;
-    @Autowired
-    ICameraService cameraService;
-
-
-    public void cnSceneToZfb(String cnPhone,String zfbPhone,String zfbSnCode) {
-        User user = userService.getByUserName(cnPhone);
-        if(user == null){
-            log.info("db1-user-not-exist--chPhone:{}",cnPhone);
-            return;
-        }
-        Camera camera = cameraService.getBySnCode(zfbSnCode);
-        if(camera == null){
-            log.info("db1-camera-not-exist--zfbSnCode:{}",zfbSnCode);
-            return;
-        }
-        List<ScenePro> scenePros = cnSceneProService.getByUserId(user.getId(),camera.getId());
-        if(scenePros.size() <=0){
-            log.info("db1-scenePro-not-exist--user:{}",user);
-            return;
-        }
-        List<Long> proIds = scenePros.stream().map(ScenePro::getId).collect(Collectors.toList());
-        List<SceneProEdit> sceneProEdits = cnSceneProEditService.getByProIds(proIds);
-
-        List<TbScenePro> list = zfbSceneProService.saveDb(scenePros, sceneProEdits, zfbPhone, zfbSnCode);
-
-        if(list ==null || list.size() <=0){
-            log.info("db2-scenePro-not-in--user:{}",user);
-            return;
-        }
-        for (TbScenePro tbScenePro : list) {
-            ossToOssUtil.awsToOss(tbScenePro.getDataSource(),tbScenePro.getNum(),"zfb");
-            zfbClient.rebuildScene(tbScenePro.getNum());
-        }
-
-    }
-}

+ 1 - 399
src/main/java/com/fdkankan/tools/service/impl/ScenePlusServiceImpl.java

@@ -5,18 +5,13 @@ import java.util.*;
 import cn.hutool.core.date.DateUtil;
 import cn.hutool.core.io.FileUtil;
 import cn.hutool.core.lang.hash.Hash;
-import com.baomidou.dynamic.datasource.annotation.DS;
+
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.fdkankan.tools.entity.*;
-import com.fdkankan.tools.httpClient.client.FdkkClient;
 import com.fdkankan.tools.mapper.IScenePlusMapper;
 import com.fdkankan.tools.service.*;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.fdkankan.tools.utils.OssToOssUtil;
-import com.fdkankan.tools.utils.UploadToAws;
-import com.fdkankan.tools.utils.UploadToOss;
-import com.fdkankan.tools.utils.UploadToOss2;
 import javafx.scene.Scene;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
@@ -39,398 +34,5 @@ import org.springframework.stereotype.Service;
 public class ScenePlusServiceImpl extends ServiceImpl<IScenePlusMapper, ScenePlus> implements IScenePlusService {
 
 
-    @Autowired
-    IScenePlusExtService scenePlusExtService;
-    @Autowired
-    ISceneEditControlsService sceneEditControlsService;
-    @Autowired
-    ISceneEditInfoService sceneEditInfoService;
-    @Autowired
-    ISceneEditInfoExtService sceneEditInfoExtService;
-    @Autowired
-    ISceneFileBuildService sceneFileBuildService;
-    @Autowired
-    ISceneProService sceneProService;
-    @Autowired
-    ISceneProEditService sceneProEditService;
-    @Autowired
-    ICameraService cameraService;
-    @Autowired
-    ICameraDetailService cameraDetailService;
-    @Autowired
-    OssToOssUtil ossToOssUtil;
-    @Autowired
-    FdkkClient fdkkClient;
-
-    @Value("${db1.fyun.host}")
-    private String db1Host;
-    @Value("${db2.fyun.host}")
-    private String db2Host;
-    @Value("${db1.main}")
-    private String db1main;
-    @Value("${db2.main}")
-    private String db2main;
-
-    static HashMap<String,ScenePlus> plusMap = new HashMap<>();
-    static HashMap<String,ScenePlusExt> extMap = new HashMap<>();
-    static HashMap<String,SceneEditInfo> editInfoMap = new HashMap<>();
-    static HashMap<String,SceneEditInfoExt> editInfoExtMap = new HashMap<>();
-    static HashMap<String,SceneEditControls> editControlsMap = new HashMap<>();
-    static HashMap<String,ScenePro> proMap = new HashMap<>();
-    static HashMap<String,SceneProEdit> proEditMap = new HashMap<>();
-    static HashMap<Long,Camera> cameraMap = new HashMap<>();
-    static HashMap<Long,CameraDetail> cameraDetailMap = new HashMap<>();
-
-    @Override
-    public Object db1ToDb2ByUserId(Long userId) {
-        LambdaQueryWrapper<ScenePlus> wrapper = new LambdaQueryWrapper<>();
-        wrapper.eq(ScenePlus::getUserId,userId);
-        List<ScenePlus> list = this.list(wrapper);
-        for (ScenePlus scenePlus : list) {
-            db1ToDb2(scenePlus.getNum());
-        }
-        return null;
-    }
-
-    @Override
-    public Boolean db1ToDb2(String num) {
-
-        ScenePro scenePro = this.getByNumPro(num);
-        if(scenePro != null){
-            SceneProEdit sceneProEdit = this.getEditByProId(scenePro.getId());
-            if(sceneProEdit == null){
-                return false;
-            }
-            proMap.put(num,scenePro);
-            proEditMap.put(num,sceneProEdit);
-            this.setCameraMap(scenePro.getCameraId());
-            return true;
-        }
-
-        ScenePlus scenePlus = this.getByNum(num);
-        if(scenePlus == null){
-            return false;
-        }
-        ScenePlusExt scenePlusExt = this.getPlusExtByPlusId(scenePlus.getId());
-        if(scenePlusExt == null){
-            return false;
-        }
-        SceneEditInfo sceneEditInfo = this.getEditInfoByPlusId(scenePlus.getId());
-        if(sceneEditInfo == null){
-            return false;
-        }
-        SceneEditInfoExt sceneEditInfoExt = this.getEditInfoExtByPlusId(sceneEditInfo.getId());
-        if(sceneEditInfoExt == null){
-            return false;
-        }
-        SceneEditControls sceneEditControls = this.getEditControlsByPlusId(sceneEditInfo.getId());
-        if(sceneEditControls == null){
-            return false;
-        }
-        this.setCameraMap(scenePlus.getCameraId());
-        plusMap.put(num,scenePlus);
-        extMap.put(num,scenePlusExt);
-        editInfoMap.put(num,sceneEditInfo);
-        editInfoExtMap.put(num,sceneEditInfoExt);
-        editControlsMap.put(num,sceneEditControls);
-
-        return true;
-    }
-
-    private void setCameraMap(Long cameraId) {
-        if(cameraMap.get(cameraId) == null){
-            Camera camera = this.getCameraById(cameraId);
-            if(camera == null){
-                return ;
-            }
-            CameraDetail cameraDetail = this.getCameraDetailByCameraId(cameraId);
-            if(cameraDetail == null){
-                return;
-            }
-            cameraMap.put(camera.getId(),camera);
-            cameraDetailMap.put(camera.getId(),cameraDetail);
-        }
-    }
-
-
-    @Override
-    @DS("flowable")
-    public void db2Save(String type) {
-        for (String num : plusMap.keySet()) {
-            this.db2Save(plusMap.get(num),extMap.get(num),editInfoMap.get(num),
-                    editInfoExtMap.get(num),editControlsMap.get(num),type);
-        }
-        for (String num : proMap.keySet()) {
-            this.db2Save(proMap.get(num),proEditMap.get(num),type);
-        }
-    }
-
-
-
-    @DS("flowable")
-    public void db2Save(ScenePro scenePro,SceneProEdit sceneProEdit,String type) {
-        Long newCameraId = this.saveCamera(scenePro.getCameraId());
-        ScenePro pro = this.getByNumPro(scenePro.getNum());
-        if(pro != null){
-            if(pro.getStatus() == -1){
-                ossToOssUtil.awsToOss(scenePro.getDataSource(), scenePro.getNum(),type);
-                if(pro.getIsUpgrade() == 0 && pro.getSceneSource() == 4){
-                    fdkkClient.upgradeToV4(scenePro.getNum());
-                    waitNumUp(scenePro.getNum());
-                }
-                fdkkClient.rebuildScene(scenePro.getNum());
-            }
-            return;
-        }
-        scenePro.setId(null);
-        scenePro.setUserId(null);
-        scenePro.setCameraId(newCameraId);
-        String webSite = scenePro.getWebSite();
-        String newWebSite = webSite.replaceAll(db1main,db2main);
-        String thumb = scenePro.getThumb();
-        String newThumb = thumb.replaceAll(db1Host,db2Host);
-        String videos = scenePro.getVideos();
-        String newVideos = videos.replaceAll(db1Host,db2Host);
-        scenePro.setWebSite(newWebSite);
-        scenePro.setThumb(newThumb);
-        scenePro.setVideos(newVideos);
-        scenePro.setSceneScheme(10);
-        sceneProService.save(scenePro);
-        sceneProEdit.setId(null);
-        sceneProEdit.setProId(scenePro.getId());
-        sceneProEditService.save(sceneProEdit);
-        this.fileBuild(scenePro.getDataSource(),scenePro.getNum(),type,"v3");
-    }
-
-    @DS("flowable")
-    private void waitNumUp(String num) {
-        ScenePro pro = this.getByNumProV3(num);
-        while (pro.getIsUpgrade() != 1){
-            try {
-                pro = this.getByNumProV3(num);
-                log.info("v3场景:{}未升级完成,等待中。。。",pro.getNum());
-                Thread.sleep(2000L);
-            }catch ( Exception e){
-
-            }
-        }
-        log.info("v3场景:{}升级完成",pro.getNum());
-
-    }
-
-
-
-    @DS("flowable")
-    private Long saveCamera(Long cameraId) {
-        Camera camera = cameraMap.get(cameraId);
-        CameraDetail cameraDetail = cameraDetailMap.get(cameraId);
-
-        LambdaQueryWrapper<Camera> wrapper = new LambdaQueryWrapper<>();
-        wrapper.eq(Camera::getSnCode,camera.getSnCode());
-        Camera dbCamera = cameraService.getOne(wrapper);
-        if(dbCamera!=null){
-            return dbCamera.getId();
-        }
-
-        camera.setId(null);
-        cameraService.save(camera);
-
-        cameraDetail.setId(null);
-        cameraDetail.setCameraId(camera.getId());
-        cameraDetail.setUserId(null);
-        cameraDetail.setOutTime(new Date());
-        cameraDetail.setAddress(camera.getSnCode());
-        cameraDetail.setAddress(camera.getSnCode());
-        cameraDetail.setTotalSpace(0L);
-        cameraDetail.setUsedSpace(0L);
-        cameraDetailService.save(cameraDetail);
-        return camera.getId();
-    }
-
-    @DS("flowable")
-    public void fileBuild(String dataSource,String num,String type,String version) {
-        SceneFileBuild sceneFileBuild = new SceneFileBuild();
-        String[] split = dataSource.split("/");
-        sceneFileBuild.setChildName(split[3]);
-        sceneFileBuild.setFileId(split[4]);
-        sceneFileBuild.setUnicode(split[5]);
-        sceneFileBuild.setUploadStatus(0);
-        sceneFileBuild.setBuildStatus(3);
-        sceneFileBuild.setTotalPicNum(1000);
-        sceneFileBuild.setChunks(3);
-        sceneFileBuild.setCreateTime(new Date());
-        sceneFileBuild.setRecStatus("A");
-        sceneFileBuild.setUpdateTime(new Date());
-        sceneFileBuildService.save(sceneFileBuild);
-
-        ossToOssUtil.awsToOss(dataSource,num,type);
-        if(version.equals("v3") && num.contains("SS-")){
-            fdkkClient.upgradeToV4(num);
-            waitNumUp(num);
-
-        }
-        fdkkClient.rebuildScene(num);
-    }
-
-    @DS("flowable")
-    public void db2Save(ScenePlus scenePlus, ScenePlusExt scenePlusExt,
-                        SceneEditInfo sceneEditInfo, SceneEditInfoExt sceneEditInfoExt,
-                        SceneEditControls sceneEditControls,String type) {
-        ScenePlus plus = this.getByNum(scenePlus.getNum());
-        if(plus != null){
-            ScenePlusExt scenePlusExt1 = this.getPlusExtByPlusId(plus.getId());
-            if(scenePlusExt1 !=null  ){
-                Boolean reBuild = false;
-                if(scenePlusExt1.getSceneScheme() !=10){
-                    LambdaUpdateWrapper<ScenePlusExt> wrapper = new LambdaUpdateWrapper<>();
-                    wrapper.eq(ScenePlusExt::getId,scenePlusExt1.getId());
-                    wrapper.set(ScenePlusExt::getSceneScheme,10);
-                    wrapper.set(ScenePlusExt::getSceneKind,"tiles");
-                    scenePlusExtService.update(wrapper);
-                    reBuild = true;
-                }
-                if(plus.getSceneStatus() == -1 || reBuild){
-                    ossToOssUtil.awsToOss(scenePlusExt1.getDataSource(), plus.getNum(),type);
-                    fdkkClient.rebuildScene(plus.getNum());
-                }
-            }
-            return;
-        }
-        Long newCameraId = this.saveCamera(scenePlus.getCameraId());
-        scenePlus.setCameraId(newCameraId);
-        scenePlus.setId(null);
-        scenePlus.setUserId(null);
-        scenePlusExt.setId(null);
-        sceneEditInfo.setId(null);
-        sceneEditInfoExt.setId(null);
-        sceneEditControls.setId(null);
-        this.save(scenePlus);
-        Long plusId = scenePlus.getId();
-
-        scenePlusExt.setPlusId(plusId);
-        scenePlusExt.setYunFileBucket(null);
-        if(scenePlusExt.getSceneKind().equals("face")){
-            scenePlusExt.setSceneKind("tiles");
-        }
-        scenePlusExt.setSceneScheme(10);
-        String webSite = scenePlusExt.getWebSite();
-        String newWebSite = webSite.replaceAll(db1main,db2main);
-        String thumb = scenePlusExt.getThumb();
-        String newThumb = thumb.replaceAll(db1Host,db2Host);
-        String videos = scenePlusExt.getVideos();
-        String newVideos = videos.replaceAll(db1Host,db2Host);
-
-        scenePlusExt.setWebSite(newWebSite);
-        scenePlusExt.setThumb(newThumb);
-        scenePlusExt.setVideos(newVideos);
-
-        scenePlusExtService.save(scenePlusExt);
-
-        sceneEditInfo.setScenePlusId(plusId);
-        sceneEditInfo.setFloorPlanUser(0);
-        sceneEditInfo.setTags(0);
-        sceneEditInfo.setIsUploadObj(0);
-        sceneEditInfo.setBuildVideoStatus(0);
-        sceneEditInfo.setFloorPlanUpload(null);
-        sceneEditInfoService.save(sceneEditInfo);
-
-        sceneEditInfoExt.setEditInfoId(sceneEditInfo.getId());
-        sceneEditInfoExt.setScenePlusId(plusId);
-        sceneEditInfoExt.setTours(0);
-        sceneEditInfoExt.setMosaic(0);
-        sceneEditInfoExt.setLinks(0);
-        sceneEditInfoExt.setFilters(0);
-        sceneEditInfoExt.setSurveillances(0);
-        sceneEditInfoExtService.save(sceneEditInfoExt);
-
-        sceneEditControls.setEditInfoId(sceneEditInfo.getId());
-        sceneEditControlsService.save(sceneEditControls);
-
-        this.fileBuild(scenePlusExt.getDataSource(),scenePlus.getNum(),type,"v4");
-
-    }
-
-
-
-
-    @Override
-    @DS("flowable")
-    public void updateSceneScheme(List<String> asList) {
-        LambdaQueryWrapper<ScenePlus> wrapper = new LambdaQueryWrapper<>();
-        wrapper.in(ScenePlus::getNum,asList);
-        List<ScenePlus> list = this.list(wrapper);
-        for (ScenePlus scenePlus : list) {
-            ScenePlusExt scenePlusExt = this.getPlusExtByPlusId(scenePlus.getId());
-            if(scenePlusExt != null && scenePlusExt.getSceneScheme() !=10){
-                LambdaUpdateWrapper<ScenePlusExt> updateWrapper = new LambdaUpdateWrapper<>();
-                updateWrapper.eq(ScenePlusExt::getId,scenePlusExt.getId());
-                updateWrapper.set(ScenePlusExt::getSceneScheme,10);
-                updateWrapper.set(ScenePlusExt::getSceneKind,"tiles");
-                scenePlusExtService.update(updateWrapper);
-                fdkkClient.rebuildScene(scenePlus.getNum());
-            }
-        }
-    }
-
-    public SceneEditInfoExt getEditInfoExtByPlusId(Long id) {
-        LambdaQueryWrapper<SceneEditInfoExt> wrapper = new LambdaQueryWrapper<>();
-        wrapper.eq(SceneEditInfoExt::getEditInfoId,id);
-        return sceneEditInfoExtService.getOne(wrapper);
-    }
-
-    public SceneEditInfo getEditInfoByPlusId(Long plusId) {
-        LambdaQueryWrapper<SceneEditInfo> wrapper = new LambdaQueryWrapper<>();
-        wrapper.eq(SceneEditInfo::getScenePlusId,plusId);
-        return sceneEditInfoService.getOne(wrapper);
-    }
-
-    public SceneEditControls getEditControlsByPlusId(Long editInfoId) {
-        LambdaQueryWrapper<SceneEditControls> wrapper = new LambdaQueryWrapper<>();
-        wrapper.eq(SceneEditControls::getEditInfoId,editInfoId);
-        return sceneEditControlsService.getOne(wrapper);
-    }
-
-    public ScenePlusExt getPlusExtByPlusId(Long plusId) {
-        LambdaQueryWrapper<ScenePlusExt> wrapper = new LambdaQueryWrapper<>();
-        wrapper.eq(ScenePlusExt::getPlusId,plusId);
-        return scenePlusExtService.getOne(wrapper);
-    }
-
-    @Override
-    public ScenePlus getByNum(String num) {
-        LambdaQueryWrapper<ScenePlus> wrapper = new LambdaQueryWrapper<>();
-        wrapper.eq(ScenePlus::getNum,num);
-        return this.getOne(wrapper);
-    }
-
-    private SceneProEdit getEditByProId(Long proId) {
-        LambdaQueryWrapper<SceneProEdit> wrapper = new LambdaQueryWrapper<>();
-        wrapper.eq(SceneProEdit::getProId,proId);
-        return sceneProEditService.getOne(wrapper);
-    }
-
-    private ScenePro getByNumPro(String num) {
-        LambdaQueryWrapper<ScenePro> wrapper = new LambdaQueryWrapper<>();
-        wrapper.eq(ScenePro::getNum,num);
-        wrapper.eq(ScenePro::getIsUpgrade,0);
-        return sceneProService.getOne(wrapper);
-    }
-    private ScenePro getByNumProV3(String num) {
-        LambdaQueryWrapper<ScenePro> wrapper = new LambdaQueryWrapper<>();
-        wrapper.eq(ScenePro::getNum,num);
-        return sceneProService.getOne(wrapper);
-    }
-
-    private CameraDetail getCameraDetailByCameraId(Long cameraId) {
-        LambdaQueryWrapper<CameraDetail> wrapper = new LambdaQueryWrapper<>();
-        wrapper.eq(CameraDetail::getCameraId,cameraId);
-        return cameraDetailService.getOne(wrapper);
-    }
-
-    private Camera getCameraById(Long cameraId) {
-        LambdaQueryWrapper<Camera> wrapper = new LambdaQueryWrapper<>();
-        wrapper.eq(Camera::getId,cameraId);
-        return cameraService.getOne(wrapper);
-    }
 
 }

+ 3 - 3
src/main/java/com/fdkankan/tools/service/impl/TbBuildingServiceImpl.java

@@ -1,6 +1,6 @@
 package com.fdkankan.tools.service.impl;
 
-import com.baomidou.dynamic.datasource.annotation.DS;
+
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.fdkankan.tools.entity.TbBuilding;
 import com.fdkankan.tools.mapper.ITbBuildingMapper;
@@ -19,7 +19,7 @@ import org.springframework.stereotype.Service;
 @Service
 public class TbBuildingServiceImpl extends ServiceImpl<ITbBuildingMapper, TbBuilding> implements ITbBuildingService {
 
-    @DS("flowable")
+
     @Override
     public TbBuilding getDb2Id(Long buildingId) {
         return this.getById(buildingId);
@@ -32,7 +32,7 @@ public class TbBuildingServiceImpl extends ServiceImpl<ITbBuildingMapper, TbBuil
     }
 
 
-    @DS("flowable")
+
     @Override
     public TbBuilding saveDb2(TbBuilding building) {
         building.setId(null);

+ 2 - 2
src/main/java/com/fdkankan/tools/service/impl/TbCameraInstanceServiceImpl.java

@@ -1,6 +1,6 @@
 package com.fdkankan.tools.service.impl;
 
-import com.baomidou.dynamic.datasource.annotation.DS;
+
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.fdkankan.tools.entity.TbCameraInstance;
 import com.fdkankan.tools.mapper.ITbCameraInstanceMapper;
@@ -19,7 +19,7 @@ import org.springframework.stereotype.Service;
 @Service
 public class TbCameraInstanceServiceImpl extends ServiceImpl<ITbCameraInstanceMapper, TbCameraInstance> implements ITbCameraInstanceService {
 
-    @DS("flowable")
+
     @Override
     public TbCameraInstance getBySnCode(String zfbSnCode) {
         LambdaQueryWrapper<TbCameraInstance> wrapper = new LambdaQueryWrapper<>();

+ 3 - 3
src/main/java/com/fdkankan/tools/service/impl/TbHouseServiceImpl.java

@@ -1,6 +1,6 @@
 package com.fdkankan.tools.service.impl;
 
-import com.baomidou.dynamic.datasource.annotation.DS;
+
 import com.fdkankan.tools.entity.TbHouse;
 import com.fdkankan.tools.mapper.ITbHouseMapper;
 import com.fdkankan.tools.service.ITbHouseService;
@@ -18,7 +18,7 @@ import org.springframework.stereotype.Service;
 @Service
 public class TbHouseServiceImpl extends ServiceImpl<ITbHouseMapper, TbHouse> implements ITbHouseService {
 
-    @DS("flowable")
+
     @Override
     public TbHouse getDb2Id(Long houseId) {
         return this.getById(houseId);
@@ -29,7 +29,7 @@ public class TbHouseServiceImpl extends ServiceImpl<ITbHouseMapper, TbHouse> imp
         return this.getById(houseId);
     }
 
-    @DS("flowable")
+
     @Override
     public Long saveDb2(TbHouse tbHouse1) {
         tbHouse1.setId(null);

+ 4 - 4
src/main/java/com/fdkankan/tools/service/impl/TbScene3dNumNewServiceImpl.java

@@ -1,6 +1,6 @@
 package com.fdkankan.tools.service.impl;
 
-import com.baomidou.dynamic.datasource.annotation.DS;
+
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.fdkankan.tools.entity.TbScene3dNumNew;
 import com.fdkankan.tools.entity.TbSceneNum;
@@ -30,7 +30,7 @@ import java.util.List;
 public class TbScene3dNumNewServiceImpl extends ServiceImpl<ITbScene3dNumNewMapper, TbScene3dNumNew> implements ITbScene3dNumNewService {
 
 
-    @DS("flowable")
+
     @Override
     public void genDb2(Integer count) {
         Long noUsedCount = this.checkGen();
@@ -56,14 +56,14 @@ public class TbScene3dNumNewServiceImpl extends ServiceImpl<ITbScene3dNumNewMapp
         log.info("task-genNew--生成数量:{}",strings.size());
     }
 
-    @DS("flowable")
+
     private Long checkGen() {
         LambdaQueryWrapper<TbScene3dNumNew> wrapper = new LambdaQueryWrapper<>();
         wrapper.eq(TbScene3dNumNew::getUsed,0);
         return this.count(wrapper);
     }
 
-    @DS("flowable")
+
     private List<TbScene3dNumNew> getByCode(String code) {
         LambdaQueryWrapper<TbScene3dNumNew> wrapper = new LambdaQueryWrapper<>();
         wrapper.eq(TbScene3dNumNew::getCode,code);

+ 0 - 1
src/main/java/com/fdkankan/tools/service/impl/TbSceneNumServiceImpl.java

@@ -28,7 +28,6 @@ import java.util.List;
 public class TbSceneNumServiceImpl extends ServiceImpl<ITbSceneNumMapper, TbSceneNum> implements ITbSceneNumService {
 
 
-
     @Override
     public void  genDb1(Integer count) {
         Long noUsedCount = this.checkGen();

+ 3 - 3
src/main/java/com/fdkankan/tools/service/impl/TbSceneProServiceImpl.java

@@ -1,6 +1,6 @@
 package com.fdkankan.tools.service.impl;
 
-import com.baomidou.dynamic.datasource.annotation.DS;
+
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.fdkankan.tools.entity.*;
 import com.fdkankan.tools.mapper.ITbSceneProMapper;
@@ -47,7 +47,7 @@ public class TbSceneProServiceImpl extends ServiceImpl<ITbSceneProMapper, TbScen
     @Autowired
     ITbSceneProEditService tbSceneProEditService;
 
-    @DS("flowable")
+
     @Override
     public List<TbScenePro> getByNumList(List<String> numList) {
         if(numList.size() >0){
@@ -59,7 +59,7 @@ public class TbSceneProServiceImpl extends ServiceImpl<ITbSceneProMapper, TbScen
     }
 
 
-    @DS("flowable")
+
     @Override
     public List<TbScenePro> saveDb(List<ScenePro> scenePros, List<SceneProEdit> sceneProEdits, String zfbPhone, String zfbSnCode) {
 

+ 4 - 4
src/main/java/com/fdkankan/tools/service/impl/TbSceneServiceImpl.java

@@ -1,6 +1,6 @@
 package com.fdkankan.tools.service.impl;
 
-import com.baomidou.dynamic.datasource.annotation.DS;
+
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.fdkankan.tools.entity.TbScene;
 import com.fdkankan.tools.mapper.ITbSceneMapper;
@@ -29,7 +29,7 @@ public class TbSceneServiceImpl extends ServiceImpl<ITbSceneMapper, TbScene> imp
         return this.list(wrapper);
     }
 
-    @DS("flowable")
+
     @Override
     public List<TbScene> getByNumListDb2(List<String> numList) {
         LambdaQueryWrapper<TbScene> wrapper = new LambdaQueryWrapper<>();
@@ -37,13 +37,13 @@ public class TbSceneServiceImpl extends ServiceImpl<ITbSceneMapper, TbScene> imp
         return this.list(wrapper);
     }
 
-    @DS("flowable")
+
     @Override
     public void saveDb2(TbScene tbScene) {
         this.save(tbScene);
     }
 
-    @DS("flowable")
+
     @Override
     public List<TbScene> getByUserIdDb2(Long userId) {
         return this.list();

+ 2 - 2
src/main/java/com/fdkankan/tools/service/impl/TbUserServiceImpl.java

@@ -1,6 +1,6 @@
 package com.fdkankan.tools.service.impl;
 
-import com.baomidou.dynamic.datasource.annotation.DS;
+
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.fdkankan.tools.entity.TbUser;
 import com.fdkankan.tools.mapper.ITbUserMapper;
@@ -19,7 +19,7 @@ import org.springframework.stereotype.Service;
 @Service
 public class TbUserServiceImpl extends ServiceImpl<ITbUserMapper, TbUser> implements ITbUserService {
 
-    @DS("flowable")
+
     @Override
     public TbUser getByUserName(String zfbPhone) {
         LambdaQueryWrapper<TbUser> wrapper = new LambdaQueryWrapper<>();

+ 6 - 1
src/main/java/com/fdkankan/tools/task/TaskService.java

@@ -5,6 +5,7 @@ import lombok.extern.slf4j.Slf4j;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.stereotype.Component;
 import org.springframework.web.bind.annotation.GetMapping;
@@ -21,7 +22,8 @@ public class TaskService {
 
     @Autowired
     ZfbOldToNewService zfbOldToNewService;
-
+    @Value("${spring.profiles.active}")
+    private String active;
 
     @Scheduled(cron = "0 */1 * * * ?}")
     public void genOldCode() {
@@ -33,6 +35,9 @@ public class TaskService {
     //@Scheduled(cron = "0 0 1 * * ?}")
     @Scheduled(cron = "0 */1 * * * ?}")
     public void genNewCode() {
+        if(active.contains("old")){
+            return;
+        }
         Integer count = 10000;
         log.info("task-genNewCode:{}","触发定时任务生成new-prod指房宝场景码");
         zfbOldToNewService.genNewCode(count);

+ 0 - 82
src/main/java/com/fdkankan/tools/utils/OssToOssUtil.java

@@ -1,82 +0,0 @@
-package com.fdkankan.tools.utils;
-
-import cn.hutool.core.io.FileUtil;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.stereotype.Component;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
-
-@Component
-@Slf4j
-public class OssToOssUtil {
-    @Autowired
-    UploadToOss uploadToOss;
-    @Autowired
-    UploadToOss2 uploadToOss2;
-    @Autowired
-    UploadToAws uploadToAws;
-    @Value("${fyun.oss.bucket:zfb-4dkankan}")
-    private String bucket2;
-    @Value("${fyun2.oss.bucket:4dkankan}")
-    private String bucket1;
-
-    public void awsToOss(String dataSource, String num, String type)  {
-        try {
-
-            String  fdagePaht =  dataSource.replace("/mnt/data","home");
-            if("zfb".equals(type)){
-                UploadToOss.copy("http://oss-cn-shenzhen.aliyuncs.com",
-                        "LTAIUrvuHqj8pvry","JLOVl0k8Ke0aaM8nLMMiUAZ3EiiqI4",
-                        fdagePaht,
-                        "4dkankan","zfb-4dkankan");
-
-                Thread.sleep(1000L);
-                return;
-            }
-            log.info("下载上传中num:{},dataSource:{}",num,dataSource);
-            String localPath = "/home/jar/tools/ossdata/";
-            File file = new File(localPath);
-            if(!file.exists()){
-                file.mkdirs();
-            }
-
-
-            List<String> fileStr = new ArrayList<>();
-            if( "cn".equals(type)){
-                fileStr = uploadToOss2.listKeys(fdagePaht);
-            }else {
-                fileStr = uploadToAws.listKeys(fdagePaht);
-            }
-            for (String filePath : fileStr) {
-                if(uploadToOss.existKey(filePath)){
-                    continue;
-                }
-                if( "cn".equals(type)){
-                    uploadToOss2.download(filePath,localPath+filePath);
-                    Thread.sleep(1000L);
-                    uploadToOss.upload(localPath+filePath,filePath);
-                    FileUtil.del(localPath+filePath);
-                }
-                if("eur".equals(type)){
-                    uploadToAws.download(filePath,localPath+filePath);
-                    Thread.sleep(1000L);
-                    uploadToOss.upload(localPath+filePath,filePath);
-                    FileUtil.del(localPath+filePath);
-                }
-                Thread.sleep(1000L);
-
-            }
-            log.info("下载完成num:{},dataSource:{}",num,dataSource);
-        }catch ( Exception e){
-
-        }finally {
-
-        }
-
-    }
-
-}

+ 0 - 37
src/main/java/com/fdkankan/tools/utils/StorageType.java

@@ -1,37 +0,0 @@
-package com.fdkankan.tools.utils;
-
-public enum StorageType {
-
-    OSS("oss", "阿里云"),
-    AWS("aws", "亚马逊"),
-    LOCAL("local", "本地");
-
-    private String code;
-    private String message;
-
-    private StorageType(String code, String message) {
-        this.code = code;
-        this.message = message;
-    }
-
-    public String code() {
-        return code;
-    }
-
-    public String message() {
-        return message;
-    }
-
-    public static StorageType get(String code){
-        StorageType[] values = StorageType.values();
-        String enumValue = null;
-        for(StorageType eachValue : values){
-            enumValue = eachValue.code();
-            if(enumValue.equals(code)){
-                return eachValue;
-            }
-        }
-        return null;
-    }
-
-}

Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 0 - 1057
src/main/java/com/fdkankan/tools/utils/UploadToAws.java


+ 0 - 971
src/main/java/com/fdkankan/tools/utils/UploadToOss.java

@@ -1,971 +0,0 @@
-package com.fdkankan.tools.utils;
-import cn.hutool.core.collection.CollUtil;
-import cn.hutool.core.io.FileUtil;
-import com.aliyun.oss.OSSClient;
-import com.aliyun.oss.model.ListObjectsRequest;
-import com.aliyun.oss.model.ObjectListing;
-import com.aliyun.oss.model.ObjectMetadata;
-import com.aliyun.oss.model.*;
-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.GetObjectRequest;
-import com.amazonaws.services.s3.model.PutObjectRequest;
-import com.amazonaws.services.s3.model.*;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.commons.io.FileUtils;
-import org.apache.commons.lang3.StringUtils;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.stereotype.Component;
-import org.springframework.util.CollectionUtils;
-
-import java.io.*;
-import java.net.FileNameMap;
-import java.net.URLConnection;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.stream.Collectors;
-
-@Slf4j
-@Component
-public class UploadToOss {
-
-
-	@Value("${fyun.oss.point:http://oss-cn-shenzhen-internal.aliyuncs.com}")
-	private String point;
-
-	@Value("${fyun.oss.key:LTAIUrvuHqj8pvry}")
-	private String key;
-
-	@Value("${fyun.oss.secrey:JLOVl0k8Ke0aaM8nLMMiUAZ3EiiqI4}")
-	private String secrey;
-
-	@Value("${fyun.oss.bucket:4dkankan}")
-	private String bucket;
-
-	@Value("${upload.type:oss}")
-	private String type;
-
-	@Value("${fdkk.aws.s3key:AKIAWCV5QFZ3ZNELKYUY}")
-	private String s3key;
-
-	@Value("${fdkk.aws.s3secrey:epS5ghyR4LJ7rxk/qJO9ZYh6m9Oz6g5haKDu4yws}")
-	private String s3secrey;
-
-	@Value("${fdkk.aws.s3bucket:4dkankan}")
-	private String s3bucket;
-
-	@Value("${local.path:/home/4dkankan}")
-	private String localPath;
-
-	/**
-	 * oss文件上传命令
-	 * 第一个参数是oss路径,要包含bucket名称
-	 * 第二个参数是本地文件路径
-	 */
-	private static final String UPLOAD_SH = "bash /opt/ossutil/upload.sh %s %s";
-
-	//上传的数据是byte[],key是上传后的文件名
-	public void upload(byte[] data,String key1) throws IOException{
-		//log.info("开始上传文件 源路径:{},目标路径:{},type:{}" , new String(data, "UTF-8"),key1,type);
-		StorageType storageType = StorageType.get(type);
-		switch (storageType){
-			case OSS:
-				uploadOss(data,key1);
-				break;
-			case AWS:
-				uploadAws(data,key1);
-				break;
-			case LOCAL:
-				uploadLocal(data,key1);
-				break;
-		}
-	}
-	public void upload(String filePath, String key1) {
-		//log.info("开始上传文件 源路径:{},目标路径:{},type:{}" , filePath,key1,type);
-		StorageType storageType = StorageType.get(type);
-		switch (storageType){
-			case OSS:
-				uploadOss(filePath,key1);
-				break;
-			case AWS:
-				uploadAws(filePath,key1);
-				break;
-			case LOCAL:
-				uploadLocal(filePath,key1);
-				break;
-		}
-	}
-
-	public void upload2(String filePath, String key1) {
-		//log.info("开始上传文件 源路径:{},目标路径:{},type:{}" , filePath,key1,type);
-		switch (type){
-			case "oss":upload2Oss(filePath,key1); break;
-			case "aws": uploadAws(filePath,key1); break;
-			case "local":uploadLocal(filePath,key1);  break;
-		}
-	}
-	public void delete(String key1) throws IOException{
-		switch (type){
-			case "oss":deleteOss(key1); break;
-			case "aws": deleteS3Object(key1); break;
-			case "local":
-				FileUtil.del(key1);  break;
-		}
-	}
-	public int deleteFile(String prefix){
-		switch (type){
-			case "oss":deleteOssFile(prefix); break;
-			case "aws": deleteS3Object(prefix); break;
-			case "local":FileUtil.del(prefix);  break;
-		}
-		return 1;
-	}
-
-	public void deleteOss(String objectName){
-		OSSClient ossClient = new OSSClient(point, key, secrey);
-		try {
-			ossClient.deleteObject(bucket, objectName);
-		} catch (Exception e) {
-			log.error("OSS删除文件失败,key=" + objectName);
-		}finally {
-			if(ossClient != null){
-				ossClient.shutdown();
-			}
-		}
-	}
-
-	public void deleteOssFile(String prefix){
-		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();
-		}
-	}
-
-	public void uploadOss(byte[] data,String objectName){
-		OSSClient ossClient = new OSSClient(point, key, secrey);
-		try {
-			ossClient.putObject(bucket, objectName, new ByteArrayInputStream(data));
-		} catch (Exception e) {
-			log.error("oss上传文件失败", e);
-		}finally {
-			if(ossClient != null){
-				ossClient.shutdown();
-			}
-		}
-	}
-	public void uploadAws(byte[] data,String objectName){
-		BasicAWSCredentials awsCreds = new BasicAWSCredentials(s3key, s3secrey);
-		AmazonS3 s3 = AmazonS3ClientBuilder.standard()
-			.withCredentials(new AWSStaticCredentialsProvider(awsCreds))
-			.withRegion(Regions.EU_WEST_2)
-			.build();
-		try {
-			com.amazonaws.services.s3.model.ObjectMetadata metadata = new com.amazonaws.services.s3.model.ObjectMetadata();
-			s3.putObject(this.bucket, objectName, new ByteArrayInputStream(data), metadata);
-		}catch (Exception e){
-			log.error("s3上传文件失败", e);
-		}finally {
-			if(s3 != null){
-				s3.shutdown();
-			}
-		}
-	}
-	public void uploadLocal(byte[] data,String key1){
-		InputStream in = new ByteArrayInputStream(data);
-		File file = new File(key1);
-		String path = key1.substring(0, key1.lastIndexOf("/"));
-		if (!file.exists()) {
-			new File(path).mkdir();
-		}
-		FileOutputStream fos = null;
-		try {
-			fos = new FileOutputStream(file);
-			int len = 0;
-			byte[] buf = new byte[1024];
-			while ((len = in.read(buf)) != -1) {
-				fos.write(buf, 0, len);
-			}
-			fos.flush();
-		} catch (Exception e) {
-			e.printStackTrace();
-		} finally {
-			if (null != fos) {
-				try {
-					fos.close();
-				} catch (IOException e) {
-					e.printStackTrace();
-				}
-			}
-		}
-	}
-
-
-	public void uploadOss(String filePath, String key1){
-		OSSClient ossClient = new OSSClient(point, key, secrey);
-		try {
-			File file = new File(filePath);
-			if (!file.exists()) {
-				log.error("要上传的文件不存在:" + filePath);
-				return;
-			}
-			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);
-		} finally {
-			ossClient.shutdown();
-		}
-	}
-
-	public void uploadAws(String filePath, String key1){
-		try{
-			uploadS3File(filePath, key1);
-		}catch (Exception e){
-			e.printStackTrace();
-		}
-	}
-	public void uploadLocal(String filePath, String key1){
-		try {
-			File srcFile = new File(filePath);
-			File file = new File(localPath + key1);
-			FileUtils.copyFile(srcFile,file);
-		}catch (Exception e){
-			e.printStackTrace();
-		}
-	}
-
-
-
-	public void upload2Oss(String filePath, String key1){
-		OSSClient ossClient = new OSSClient(point, key, secrey);
-		try {
-			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);
-		}
-	}
-
-
-
-
-
-	//海外亚马逊s3
-
-
-	/**
-	 * s3上传文件
-	 * @param filePath
-	 * @param key1
-	 * @throws IOException
-     */
-	private void uploadS3File(String filePath, String key1) throws Exception {
-		/**
-		 * 创建s3对象
-		 */
-		BasicAWSCredentials awsCreds = new BasicAWSCredentials(s3key, s3secrey);
-		AmazonS3 s3 = AmazonS3ClientBuilder.standard()
-			.withCredentials(new AWSStaticCredentialsProvider(awsCreds))
-			.withRegion(Regions.EU_WEST_2)
-			.build();
-		try{
-			File file = new File(filePath);
-			if(!file.exists()){
-				log.info("要上传s3的文件不存在");
-				return;
-			}
-
-			// 设置文件并设置公读
-			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);
-			}
-		}catch (Exception e){
-			throw e;
-		}finally {
-			s3.shutdown();
-		}
-
-	}
-
-	/**
-	 * 删除单个文件
-	 *
-	 * @param objectName 文件路径[ eg: /head/xxxx.jpg ]
-	 * @return
-	 */
-	public void deleteS3Object(String objectName) {
-
-		/**
-		 * 创建s3对象
-		 */
-		BasicAWSCredentials awsCreds = new BasicAWSCredentials(s3key, s3secrey);
-		AmazonS3 s3 = AmazonS3ClientBuilder.standard()
-				.withCredentials(new AWSStaticCredentialsProvider(awsCreds))
-				.withRegion(Regions.EU_WEST_2)
-				.build();
-
-		if (objectName.startsWith("/")) {
-			objectName = objectName.substring(1);
-		}
-
-		try {
-			s3.deleteObject(s3bucket, objectName);
-		} catch (Exception e) {
-			log.error("s3删除文件失败,key="+objectName, e);
-		}finally {
-			if(s3 != null){
-				s3.shutdown();
-			}
-		}
-	}
-
-
-
-	/**
-	 * 获取文件类型
-	 */
-	public static String getContentType(String filePath){
-		FileNameMap fileNameMap = URLConnection.getFileNameMap();
-		String contentType = fileNameMap.getContentTypeFor(filePath);
-		System.out.println(contentType);
-		return contentType;
-
-	}
-
-
-
-	/**
-	 * 获得文件列表-阿里云
-	 * @return
-	 */
-	public List<String> listKeysFromAli(String sourcePath) {
-		List<String> keyList = new ArrayList<>();
-		OSSClient ossClient = new OSSClient(point, key, secrey);
-		try {
-			boolean flag = true;
-			String nextMaker = null;
-			ListObjectsRequest listObjectsRequest = new ListObjectsRequest(this.bucket);
-			//指定下一级文件
-			listObjectsRequest.setPrefix(sourcePath);
-			//设置分页的页容量
-			listObjectsRequest.setMaxKeys(200);
-			do
-			{
-				//获取下一页的起始点,它的下一项
-				listObjectsRequest.setMarker(nextMaker);
-				ObjectListing objectListing = ossClient.listObjects(listObjectsRequest);
-				List<OSSObjectSummary> objectSummaries = objectListing.getObjectSummaries();
-				List<String> collect = objectSummaries.stream().map(summary -> {
-					return summary.getKey();
-				}).collect(Collectors.toList());
-				if(collect.size() >0){
-					keyList.addAll(collect);
-				}
-				nextMaker = objectListing.getNextMarker();
-				//全部执行完后,为false
-				flag = objectListing.isTruncated();
-			} while (flag);
-		}catch (Exception e){
-			log.error("获取文件列表失败,path="+sourcePath, e);
-		}finally {
-			if(ossClient != null){
-				ossClient.shutdown();
-			}
-		}
-
-
-		ossClient.shutdown();
-
-		return keyList;
-	}
-
-	/**
-	 * 获得文件列表-亚马逊
-	 * @return
-	 */
-	public List<String> listKeysFromAws(String sourcePath) {
-		List<String> keyList = new ArrayList<>();
-
-		BasicAWSCredentials awsCreds = new BasicAWSCredentials(s3key, s3secrey);
-		AmazonS3 s3 = AmazonS3ClientBuilder.standard()
-			.withCredentials(new AWSStaticCredentialsProvider(awsCreds))
-			.withRegion(Regions.EU_WEST_2)
-			.build();
-
-		try {
-			boolean flag = true;
-			String nextMaker = null;
-			com.amazonaws.services.s3.model.ListObjectsRequest listObjectsRequest = new com.amazonaws.services.s3.model.ListObjectsRequest();
-			listObjectsRequest.setBucketName(this.s3bucket);
-			listObjectsRequest.setPrefix(sourcePath);
-			listObjectsRequest.setMaxKeys(200);
-
-			do{
-				listObjectsRequest.setMarker(nextMaker);
-				com.amazonaws.services.s3.model.ObjectListing objectListing = s3.listObjects(listObjectsRequest);
-				List<S3ObjectSummary> objectSummaries = objectListing.getObjectSummaries();
-				List<String> collect =objectSummaries.stream().map(summary->{
-					return summary.getKey();
-				}).collect(Collectors.toList());
-				if(collect.size() >0){
-					keyList.addAll(collect);
-				}
-				nextMaker = objectListing.getNextMarker();
-				flag = objectListing.isTruncated();
-			}while (flag);
-		}catch (Exception e){
-			log.error("获取文件列表失败,path="+sourcePath, e);
-		}finally {
-			if(s3 != null){
-				s3.shutdown();
-			}
-		}
-		return keyList;
-	}
-
-	/**
-	 * 获得文件列表-阿里云
-	 * @return
-	 */
-	public List<String> listKeysFromLocal(String sourcePath) {
-		List<String> keyList = new ArrayList<>();
-		return keyList;
-	}
-
-	/**
-	 * <p>
-	        拷贝目录
-	 * </p>
-	 * @author dengsixing
-	 * @date 2022/1/18
-	 * @param sourcePath
-	 * @param targetPath
-	 **/
-	public void copyFiles(String sourcePath, String targetPath) throws IOException {
-		StorageType storageType = StorageType.get(type);
-		switch (storageType){
-			case OSS:
-				this.copyFilesFromAli(sourcePath, targetPath);
-				break;
-			case AWS:
-				this.copyFilesFromAws(sourcePath, targetPath);
-				break;
-			case LOCAL: this.copyFilesFromLocal(sourcePath, targetPath);
-		}
-	}
-
-	/**
-	 * <p>
-	 拷贝文件
-	 * </p>
-	 * @author dengsixing
-	 * @date 2022/1/18
-	 * @param sourceKey
-	 * @param targetKey
-	 **/
-	public void copyObject(String sourceKey, String targetKey) throws IOException {
-		StorageType storageType = StorageType.get(type);
-		switch (storageType){
-			case OSS:
-				this.copyObjectFromAli(sourceKey, targetKey);
-				break;
-			case AWS:
-				this.copyObjectFromAws(sourceKey, targetKey);
-				break;
-		}
-	}
-
-	/**
-	 * <p>
-	 拷贝-阿里云
-	 * </p>
-	 * @author dengsixing
-	 * @date 2022/1/18
-	 * @param sourcePath
-	 * @param targetPath
-	 **/
-	public void copyObjectFromAli(String sourcePath, String targetPath) throws IOException {
-
-		// 创建OSSClient实例。
-		OSSClient ossClient = new OSSClient(point, key, secrey);
-		// 复制文件
-		log.info("开始复制:" + sourcePath);
-		ossClient.copyObject(this.bucket, sourcePath, this.bucket, targetPath);
-		log.info("复制成功:" + sourcePath);
-		ossClient.shutdown();
-	}
-
-
-
-	/**
-	 * <p>
-	 拷贝-阿里云
-	 * </p>
-	 * @author dengsixing
-	 * @date 2022/1/18
-	 * @param sourcePath
-	 * @param targetPath
-	 **/
-	public void copyFilesFromAli(String sourcePath, String targetPath) throws IOException {
-
-		//获取源文件列表
-		List<String> sourceKeyList = this.listKeysFromAli(sourcePath);
-		if(CollUtil.isEmpty(sourceKeyList)){
-			return;
-		}
-		// 创建OSSClient实例。
-		OSSClient ossClient = new OSSClient(point, key, secrey);
-		// 复制文件
-		sourceKeyList.parallelStream().forEach(key -> {
-			log.info("开始复制:" + key);
-			ossClient.copyObject(this.bucket, key, this.bucket, key.replace(sourcePath, targetPath));
-			log.info("复制成功:" + key);
-		});
-
-		ossClient.shutdown();
-	}
-
-
-	/**
-	 * <p>
-	 拷贝-亚马逊
-	 * </p>
-	 * @author dengsixing
-	 * @date 2022/1/18
-	 * @param sourcePath
-	 * @param targetPath
-	 **/
-	public void copyFilesFromAws(String sourcePath, String targetPath){
-
-		try {
-			List<String> sourceKeyList = this.listKeysFromAws(sourcePath);
-			/**
-			 * 创建s3对象
-			 */
-			BasicAWSCredentials awsCreds = new BasicAWSCredentials(s3key, s3secrey);
-			AmazonS3 s3 = AmazonS3ClientBuilder.standard()
-				.withCredentials(new AWSStaticCredentialsProvider(awsCreds))
-				.withRegion(Regions.EU_WEST_2)//s3 地区位置
-				.build();
-
-			// 复制文件
-			sourceKeyList.parallelStream().forEach(key -> {
-				log.info("开始复制:" + key);
-				s3.copyObject(this.s3bucket, key, this.s3bucket, key.replace(sourcePath, targetPath));
-				log.info("复制成功:" + key);
-			});
-			s3.shutdown();
-		} catch (Exception ase) {
-			log.error("amazonS拷贝异常 " + ase.getMessage(), ase);
-		}
-	}
-
-	/**
-	 * <p>
-	 拷贝-亚马逊
-	 * </p>
-	 * @author dengsixing
-	 * @date 2022/1/18
-	 * @param sourceKey
-	 * @param targetKey
-	 **/
-	public void copyObjectFromAws(String sourceKey, String targetKey){
-			BasicAWSCredentials awsCreds = new BasicAWSCredentials(s3key, s3secrey);
-			AmazonS3 s3 = AmazonS3ClientBuilder.standard()
-				.withCredentials(new AWSStaticCredentialsProvider(awsCreds))
-				.withRegion(Regions.EU_WEST_2)//s3 地区位置
-				.build();
-			// 复制文件
-			log.info("开始复制:" + sourceKey);
-			s3.copyObject(this.s3bucket, sourceKey, this.s3bucket, targetKey);
-			log.info("复制成功:" + sourceKey);
-			s3.shutdown();
-	}
-
-	/**
-	 * <p>
-	 拷贝-本地
-	 * </p>
-	 * @author dengsixing
-	 * @date 2022/1/18
-	 * @param sourcePath
-	 * @param targetPath
-	 **/
-	public void copyFilesFromLocal(String sourcePath, String targetPath) throws IOException {
-		// TODO: 2022/1/21
-
-	}
-
-	/**
-	 * 获取文件内容
-	 * @param objectName
-	 * @return
-	 */
-	public String getObjectContent( String objectName){
-		log.info("下载文件:"+objectName);
-		StorageType storageType = StorageType.get(type);
-		switch (storageType){
-			case OSS:
-				return this.getObjectContentFromAli(bucket, objectName);
-			case AWS:
-				return this.getObjectContentFromAws(s3bucket, objectName);
-			case LOCAL:
-				return this.getObjectContentFromLocal(objectName);
-		}
-		return null;
-	}
-
-	/**
-	 * 获取文件内容-阿里云
-	 * @param bucketName
-	 * @param objectName
-	 * @return
-	 */
-	public String getObjectContentFromAli(String bucketName, String objectName){
-		//创建oss客戶端
-		OSSClient ossClient = new OSSClient(point, key, secrey);
-		InputStream objectContent = null;
-		StringBuilder contentJson = new StringBuilder();
-		try {
-			// ossObject包含文件所在的存储空间名称、文件名称、文件元信息以及一个输入流。
-			OSSObject ossObject = ossClient.getObject(bucketName, objectName);
-			objectContent = ossObject.getObjectContent();
-			try(BufferedReader reader = new BufferedReader(new InputStreamReader(objectContent))){
-				while (true) {
-					String line = reader.readLine();
-					if (line == null) break;
-					contentJson.append(line);
-				}
-			} catch (IOException e) {
-				log.error("读取scene.json文件流失败", e);
-			}
-		}catch (Exception e){
-			log.error("s3获取文件内容失败,key="+objectName, e);
-		}finally {
-			if(ossClient != null){
-				ossClient.shutdown();
-			}
-		}
-
-		return contentJson.toString();
-	}
-
-	/**
-	 * 获取文件内容-阿里云
-	 * @param objectName
-	 * @return
-	 */
-	public boolean existOnAli(String objectName){
-		//创建oss客戶端
-		OSSClient ossClient = new OSSClient(point, key, secrey);
-		// ossObject包含文件所在的存储空间名称、文件名称、文件元信息以及一个输入流。
-		try{
-			boolean exist = ossClient.doesObjectExist(bucket, objectName);
-			return exist;
-		}catch (Exception e){
-			log.error("s4判断是否存在key异常,key=" + objectName, e);
-		}finally {
-			if(ossClient != null){
-				ossClient.shutdown();
-			}
-		}
-		return false;
-	}
-
-	/**
-	 * 获取文件内容-亚马逊
-	 * @param bucketName
-	 * @param objectName
-	 * @return
-	 */
-	public String getObjectContentFromAws(String bucketName, String objectName){
-
-		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,objectName);
-			S3Object object = s3.getObject(request);
-			S3ObjectInputStream inputStream = object.getObjectContent();
-			StringBuilder content = new StringBuilder();
-			try(BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream))){
-				while (true) {
-					String line = reader.readLine();
-					if (line == null) break;
-					content.append(line);
-				}
-			} catch (IOException e) {
-				log.error("读取aws文件流失败", e);
-			}
-			return content.toString();
-		} catch (Exception ase) {
-			log.error("amazonS3下载文件异常 " + ase.getMessage(), ase);
-		}
-		return null;
-
-	}
-
-	/**
-	 * 获取文件内容-亚马逊
-	 * @param objectName
-	 * @return
-	 */
-	public boolean existOnAws(String objectName){
-
-		BasicAWSCredentials awsCreds = new BasicAWSCredentials(s3key, s3secrey);
-		AmazonS3 s3 = AmazonS3ClientBuilder.standard()
-			.withCredentials(new AWSStaticCredentialsProvider(awsCreds))
-			.withRegion(Regions.EU_WEST_2)
-			.build();
-		try {
-			boolean exist = s3.doesObjectExist(s3bucket, objectName);
-			return exist;
-		}catch (Exception e){
-			log.error("s4判断是否存在key异常,key=" + objectName, e);
-		}finally {
-			if(s3 != null){
-				s3.shutdown();
-			}
-		}
-		return false;
-	}
-
-	/**
-	 * 判断key是否存在
-	 * @param key
-	 * @return
-	 */
-	public boolean existKey(String key){
-		StorageType storageType = StorageType.get(type);
-		switch (storageType){
-			case OSS:
-				return this.existOnAli(key);
-			case AWS:
-				return this.existOnAws(key);
-			default:
-				return false;
-		}
-	}
-
-	/**
-	 * 获取文件内容-本地
-	 * @param objectName
-	 * @return
-	 */
-	public String getObjectContentFromLocal(String objectName){
-		// TODO: 2022/1/21
-		return null;
-	}
-
-	/**
-	 * oss下载文件到本地
-	 * @param objectName
-	 * @param localPath
-	 */
-	public boolean download(String objectName, String localPath){
-		StorageType storageType = StorageType.get(this.type);
-		switch (storageType){
-			case OSS:
-				return this.downFormAli(objectName, localPath);
-			case AWS:
-				return this.downFromS3(objectName, localPath);
-		}
-		return false;
-	}
-
-	/**
-	 * 从阿里云oss下载文件到本地
-	 * @param objectName 云端文件k地址
-	 * @param localPath 本地文件地址
-	 * @return
-	 */
-	public boolean downFormAli(String objectName, String localPath){
-		OSSClient ossClient = new OSSClient(point, key, secrey);
-		try {
-			com.aliyun.oss.model.GetObjectRequest request  = new com.aliyun.oss.model.GetObjectRequest(bucket,objectName);
-			ossClient.getObject(request, new File(localPath));
-			return true;
-		}catch (Exception e){
-			log.error("阿里云oss文件下载失败,key=" + objectName, e);
-		}finally {
-			if(ossClient != null){
-				ossClient.shutdown();
-			}
-		}
-		return false;
-	}
-
-	/**
-	 * 从s3下载文件到本地
-	 * @param objectName 云端文件k地址
-	 * @param localPath 本地文件地址
-	 * @return
-	 */
-	public boolean downFromS3(String objectName, String localPath) {
-		BasicAWSCredentials awsCreds = new BasicAWSCredentials(s3key, s3secrey);
-		AmazonS3 s3 = AmazonS3ClientBuilder.standard()
-			.withCredentials(new AWSStaticCredentialsProvider(awsCreds))
-			.withRegion(Regions.EU_WEST_2)
-			.build();
-		try {
-			GetObjectRequest request  = new GetObjectRequest(this.s3bucket,objectName);
-			s3.getObject(request,new File(localPath));
-			return true;
-		} catch (Exception e) {
-			log.error("amazonS3下载文件失败,key=" + objectName, e);
-		}finally {
-			if(s3 != null){
-				s3.shutdown();
-			}
-		}
-		return false;
-	}
-
-	public List<String> listKeys(String sourcePath) {
-		StorageType storageType = StorageType.get(type);
-		switch (storageType){
-			case OSS:
-				return this.listKeysFromAli(sourcePath);
-			case AWS:
-				return this.listKeysFromAws(sourcePath);
-			case LOCAL:
-				return this.listKeysFromLocal(sourcePath);
-		}
-		return null;
-	}
-
-	public  List<String> listRemoteFiles(String sourcePath) {
-		ArrayList keyList = new ArrayList();
-		OSSClient ossClient = new OSSClient(point, key, secrey);
-		try {
-			boolean flag = true;
-			String nextMaker = null;
-			ListObjectsRequest listObjectsRequest = new ListObjectsRequest(bucket);
-			listObjectsRequest.setPrefix(sourcePath);
-			listObjectsRequest.setMaxKeys(200);
-
-			do {
-				listObjectsRequest.setMarker(nextMaker);
-				ObjectListing objectListing = ossClient.listObjects(listObjectsRequest);
-				List<String> collect = (List)objectListing.getObjectSummaries().parallelStream().map(OSSObjectSummary::getKey).collect(Collectors.toList());
-				if (!CollectionUtils.isEmpty(collect)) {
-					keyList.addAll(collect);
-				}
-
-				nextMaker = objectListing.getNextMarker();
-				flag = objectListing.isTruncated();
-			} while(flag);
-		} catch (Exception var9) {
-			log.error("获取文件列表失败,path:" + sourcePath, var9);
-		}
-
-		return keyList;
-	}
-
-
-	public  void copy(String sourcePath ,String bucket1,String bucket2) {
-		OSSClient ossClient = new OSSClient(point, key, secrey);
-		log.info("ossCopy--sourcePath:{},bucket1:{},bucket2:{}",sourcePath,bucket1,bucket2);
-		try {
-			List<String> files = listRemoteFiles(sourcePath);
-			for (String file : files) {
-				ossClient.copyObject(bucket1, file, bucket2,file);
-			}
-
-		} catch (Exception e) {
-			log.error("oss-copyError-sourcePath:{},error:{}",sourcePath,e);
-			throw e;
-		}finally {
-			ossClient.shutdown();
-		}
-	}
-
-	public static List<String> listRemoteFiles(String point,String key ,String secrey,String bucket,String sourcePath) {
-		ArrayList keyList = new ArrayList();
-		OSSClient ossClient = new OSSClient(point, key, secrey);
-		try {
-			boolean flag = true;
-			String nextMaker = null;
-			ListObjectsRequest listObjectsRequest = new ListObjectsRequest(bucket);
-			listObjectsRequest.setPrefix(sourcePath);
-			listObjectsRequest.setMaxKeys(200);
-
-			do {
-				listObjectsRequest.setMarker(nextMaker);
-				ObjectListing objectListing = ossClient.listObjects(listObjectsRequest);
-				List<String> collect = (List)objectListing.getObjectSummaries().parallelStream().map(OSSObjectSummary::getKey).collect(Collectors.toList());
-				if (!CollectionUtils.isEmpty(collect)) {
-					keyList.addAll(collect);
-				}
-
-				nextMaker = objectListing.getNextMarker();
-				flag = objectListing.isTruncated();
-			} while(flag);
-		} catch (Exception var9) {
-			log.error("获取文件列表失败,path:" + sourcePath, var9);
-		}
-
-		return keyList;
-	}
-
-
-	public  static  void copy(String point,String key ,String secrey,String sourcePath ,String bucket1,String bucket2) {
-		OSSClient ossClient = new OSSClient(point, key, secrey);
-		log.info("ossCopy--sourcePath:{},bucket1:{},bucket2:{}",sourcePath,bucket1,bucket2);
-		try {
-			List<String> files = listRemoteFiles(point,key,secrey,bucket1,sourcePath);
-			for (String file : files) {
-				ossClient.copyObject(bucket1, file, bucket2,file);
-			}
-
-		} catch (Exception e) {
-			log.error("oss-copyError-sourcePath:{},error:{}",sourcePath,e);
-			throw e;
-		}finally {
-			ossClient.shutdown();
-		}
-	}
-
-}

+ 0 - 881
src/main/java/com/fdkankan/tools/utils/UploadToOss2.java

@@ -1,881 +0,0 @@
-package com.fdkankan.tools.utils;
-import cn.hutool.core.collection.CollUtil;
-import cn.hutool.core.io.FileUtil;
-import com.aliyun.oss.OSSClient;
-import com.aliyun.oss.model.ListObjectsRequest;
-import com.aliyun.oss.model.ObjectListing;
-import com.aliyun.oss.model.ObjectMetadata;
-import com.aliyun.oss.model.*;
-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.GetObjectRequest;
-import com.amazonaws.services.s3.model.PutObjectRequest;
-import com.amazonaws.services.s3.model.*;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.commons.io.FileUtils;
-import org.apache.commons.lang3.StringUtils;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.stereotype.Component;
-
-import java.io.*;
-import java.net.FileNameMap;
-import java.net.URLConnection;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.stream.Collectors;
-
-@Slf4j
-@Component
-public class UploadToOss2 {
-
-
-	@Value("${fyun2.oss.point:http://oss-cn-shenzhen-internal.aliyuncs.com}")
-	private String point;
-
-	@Value("${fyun2.oss.key:LTAIUrvuHqj8pvry}")
-	private String key;
-
-	@Value("${fyun2.oss.secrey:JLOVl0k8Ke0aaM8nLMMiUAZ3EiiqI4}")
-	private String secrey;
-
-	@Value("${fyun2.oss.bucket:4dkankan}")
-	private String bucket;
-
-	@Value("${upload.type:oss}")
-	private String type;
-
-	@Value("${fdkk.aws.s3key:AKIAWCV5QFZ3ZNELKYUY}")
-	private String s3key;
-
-	@Value("${fdkk.aws.s3secrey:epS5ghyR4LJ7rxk/qJO9ZYh6m9Oz6g5haKDu4yws}")
-	private String s3secrey;
-
-	@Value("${fdkk.aws.s3bucket:4dkankan}")
-	private String s3bucket;
-
-	@Value("${local.path:/home/4dkankan}")
-	private String localPath;
-
-	/**
-	 * oss文件上传命令
-	 * 第一个参数是oss路径,要包含bucket名称
-	 * 第二个参数是本地文件路径
-	 */
-	private static final String UPLOAD_SH = "bash /opt/ossutil/upload.sh %s %s";
-
-	//上传的数据是byte[],key是上传后的文件名
-	public void upload(byte[] data,String key1) throws IOException{
-		//log.info("开始上传文件 源路径:{},目标路径:{},type:{}" , new String(data, "UTF-8"),key1,type);
-		StorageType storageType = StorageType.get(type);
-		switch (storageType){
-			case OSS:
-				uploadOss(data,key1);
-				break;
-			case AWS:
-				uploadAws(data,key1);
-				break;
-			case LOCAL:
-				uploadLocal(data,key1);
-				break;
-		}
-	}
-	public void upload(String filePath, String key1) {
-		//log.info("开始上传文件 源路径:{},目标路径:{},type:{}" , filePath,key1,type);
-		StorageType storageType = StorageType.get(type);
-		switch (storageType){
-			case OSS:
-				uploadOss(filePath,key1);
-				break;
-			case AWS:
-				uploadAws(filePath,key1);
-				break;
-			case LOCAL:
-				uploadLocal(filePath,key1);
-				break;
-		}
-	}
-
-	public void upload2(String filePath, String key1) {
-		//log.info("开始上传文件 源路径:{},目标路径:{},type:{}" , filePath,key1,type);
-		switch (type){
-			case "oss":upload2Oss(filePath,key1); break;
-			case "aws": uploadAws(filePath,key1); break;
-			case "local":uploadLocal(filePath,key1);  break;
-		}
-	}
-	public void delete(String key1) throws IOException{
-		switch (type){
-			case "oss":deleteOss(key1); break;
-			case "aws": deleteS3Object(key1); break;
-			case "local":
-				FileUtil.del(key1);  break;
-		}
-	}
-	public int deleteFile(String prefix){
-		switch (type){
-			case "oss":deleteOssFile(prefix); break;
-			case "aws": deleteS3Object(prefix); break;
-			case "local":FileUtil.del(prefix);  break;
-		}
-		return 1;
-	}
-
-	public void deleteOss(String objectName){
-		OSSClient ossClient = new OSSClient(point, key, secrey);
-		try {
-			ossClient.deleteObject(bucket, objectName);
-		} catch (Exception e) {
-			log.error("OSS删除文件失败,key=" + objectName);
-		}finally {
-			if(ossClient != null){
-				ossClient.shutdown();
-			}
-		}
-	}
-
-	public void deleteOssFile(String prefix){
-		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();
-		}
-	}
-
-	public void uploadOss(byte[] data,String objectName){
-		OSSClient ossClient = new OSSClient(point, key, secrey);
-		try {
-			ossClient.putObject(bucket, objectName, new ByteArrayInputStream(data));
-		} catch (Exception e) {
-			log.error("oss上传文件失败", e);
-		}finally {
-			if(ossClient != null){
-				ossClient.shutdown();
-			}
-		}
-	}
-	public void uploadAws(byte[] data,String objectName){
-		BasicAWSCredentials awsCreds = new BasicAWSCredentials(s3key, s3secrey);
-		AmazonS3 s3 = AmazonS3ClientBuilder.standard()
-			.withCredentials(new AWSStaticCredentialsProvider(awsCreds))
-			.withRegion(Regions.EU_WEST_2)
-			.build();
-		try {
-			com.amazonaws.services.s3.model.ObjectMetadata metadata = new com.amazonaws.services.s3.model.ObjectMetadata();
-			s3.putObject(this.bucket, objectName, new ByteArrayInputStream(data), metadata);
-		}catch (Exception e){
-			log.error("s3上传文件失败", e);
-		}finally {
-			if(s3 != null){
-				s3.shutdown();
-			}
-		}
-	}
-	public void uploadLocal(byte[] data,String key1){
-		InputStream in = new ByteArrayInputStream(data);
-		File file = new File(key1);
-		String path = key1.substring(0, key1.lastIndexOf("/"));
-		if (!file.exists()) {
-			new File(path).mkdir();
-		}
-		FileOutputStream fos = null;
-		try {
-			fos = new FileOutputStream(file);
-			int len = 0;
-			byte[] buf = new byte[1024];
-			while ((len = in.read(buf)) != -1) {
-				fos.write(buf, 0, len);
-			}
-			fos.flush();
-		} catch (Exception e) {
-			e.printStackTrace();
-		} finally {
-			if (null != fos) {
-				try {
-					fos.close();
-				} catch (IOException e) {
-					e.printStackTrace();
-				}
-			}
-		}
-	}
-
-
-	public void uploadOss(String filePath, String key1){
-		OSSClient ossClient = new OSSClient(point, key, secrey);
-		try {
-			File file = new File(filePath);
-			if (!file.exists()) {
-				log.error("要上传的文件不存在:" + filePath);
-				return;
-			}
-			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);
-		} finally {
-			ossClient.shutdown();
-		}
-	}
-
-	public void uploadAws(String filePath, String key1){
-		try{
-			uploadS3File(filePath, key1);
-		}catch (Exception e){
-			e.printStackTrace();
-		}
-	}
-	public void uploadLocal(String filePath, String key1){
-		try {
-			File srcFile = new File(filePath);
-			File file = new File(localPath + key1);
-			FileUtils.copyFile(srcFile,file);
-		}catch (Exception e){
-			e.printStackTrace();
-		}
-	}
-
-
-
-	public void upload2Oss(String filePath, String key1){
-		OSSClient ossClient = new OSSClient(point, key, secrey);
-		try {
-			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);
-		}
-	}
-
-
-
-
-
-	//海外亚马逊s3
-
-
-	/**
-	 * s3上传文件
-	 * @param filePath
-	 * @param key1
-	 * @throws IOException
-     */
-	private void uploadS3File(String filePath, String key1) throws Exception {
-		/**
-		 * 创建s3对象
-		 */
-		BasicAWSCredentials awsCreds = new BasicAWSCredentials(s3key, s3secrey);
-		AmazonS3 s3 = AmazonS3ClientBuilder.standard()
-			.withCredentials(new AWSStaticCredentialsProvider(awsCreds))
-			.withRegion(Regions.EU_WEST_2)
-			.build();
-		try{
-			File file = new File(filePath);
-			if(!file.exists()){
-				log.info("要上传s3的文件不存在");
-				return;
-			}
-
-			// 设置文件并设置公读
-			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);
-			}
-		}catch (Exception e){
-			throw e;
-		}finally {
-			s3.shutdown();
-		}
-
-	}
-
-	/**
-	 * 删除单个文件
-	 *
-	 * @param objectName 文件路径[ eg: /head/xxxx.jpg ]
-	 * @return
-	 */
-	public void deleteS3Object(String objectName) {
-
-		/**
-		 * 创建s3对象
-		 */
-		BasicAWSCredentials awsCreds = new BasicAWSCredentials(s3key, s3secrey);
-		AmazonS3 s3 = AmazonS3ClientBuilder.standard()
-				.withCredentials(new AWSStaticCredentialsProvider(awsCreds))
-				.withRegion(Regions.EU_WEST_2)
-				.build();
-
-		if (objectName.startsWith("/")) {
-			objectName = objectName.substring(1);
-		}
-
-		try {
-			s3.deleteObject(s3bucket, objectName);
-		} catch (Exception e) {
-			log.error("s3删除文件失败,key="+objectName, e);
-		}finally {
-			if(s3 != null){
-				s3.shutdown();
-			}
-		}
-	}
-
-
-
-	/**
-	 * 获取文件类型
-	 */
-	public static String getContentType(String filePath){
-		FileNameMap fileNameMap = URLConnection.getFileNameMap();
-		String contentType = fileNameMap.getContentTypeFor(filePath);
-		System.out.println(contentType);
-		return contentType;
-
-	}
-
-
-
-	/**
-	 * 获得文件列表-阿里云
-	 * @return
-	 */
-	public List<String> listKeysFromAli(String sourcePath) {
-		List<String> keyList = new ArrayList<>();
-		OSSClient ossClient = new OSSClient(point, key, secrey);
-		try {
-			boolean flag = true;
-			String nextMaker = null;
-			ListObjectsRequest listObjectsRequest = new ListObjectsRequest(this.bucket);
-			//指定下一级文件
-			listObjectsRequest.setPrefix(sourcePath);
-			//设置分页的页容量
-			listObjectsRequest.setMaxKeys(200);
-			do
-			{
-				//获取下一页的起始点,它的下一项
-				listObjectsRequest.setMarker(nextMaker);
-				ObjectListing objectListing = ossClient.listObjects(listObjectsRequest);
-				List<OSSObjectSummary> objectSummaries = objectListing.getObjectSummaries();
-				List<String> collect = objectSummaries.stream().map(summary -> {
-					return summary.getKey();
-				}).collect(Collectors.toList());
-				if(collect.size() >0){
-					keyList.addAll(collect);
-				}
-				nextMaker = objectListing.getNextMarker();
-				//全部执行完后,为false
-				flag = objectListing.isTruncated();
-			} while (flag);
-		}catch (Exception e){
-			log.error("获取文件列表失败,path="+sourcePath, e);
-		}finally {
-			if(ossClient != null){
-				ossClient.shutdown();
-			}
-		}
-
-
-		ossClient.shutdown();
-
-		return keyList;
-	}
-
-	/**
-	 * 获得文件列表-亚马逊
-	 * @return
-	 */
-	public List<String> listKeysFromAws(String sourcePath) {
-		List<String> keyList = new ArrayList<>();
-
-		BasicAWSCredentials awsCreds = new BasicAWSCredentials(s3key, s3secrey);
-		AmazonS3 s3 = AmazonS3ClientBuilder.standard()
-			.withCredentials(new AWSStaticCredentialsProvider(awsCreds))
-			.withRegion(Regions.EU_WEST_2)
-			.build();
-
-		try {
-			boolean flag = true;
-			String nextMaker = null;
-			com.amazonaws.services.s3.model.ListObjectsRequest listObjectsRequest = new com.amazonaws.services.s3.model.ListObjectsRequest();
-			listObjectsRequest.setBucketName(this.s3bucket);
-			listObjectsRequest.setPrefix(sourcePath);
-			listObjectsRequest.setMaxKeys(200);
-
-			do{
-				listObjectsRequest.setMarker(nextMaker);
-				com.amazonaws.services.s3.model.ObjectListing objectListing = s3.listObjects(listObjectsRequest);
-				List<S3ObjectSummary> objectSummaries = objectListing.getObjectSummaries();
-				List<String> collect =objectSummaries.stream().map(summary->{
-					return summary.getKey();
-				}).collect(Collectors.toList());
-				if(collect.size() >0){
-					keyList.addAll(collect);
-				}
-				nextMaker = objectListing.getNextMarker();
-				flag = objectListing.isTruncated();
-			}while (flag);
-		}catch (Exception e){
-			log.error("获取文件列表失败,path="+sourcePath, e);
-		}finally {
-			if(s3 != null){
-				s3.shutdown();
-			}
-		}
-		return keyList;
-	}
-
-	/**
-	 * 获得文件列表-阿里云
-	 * @return
-	 */
-	public List<String> listKeysFromLocal(String sourcePath) {
-		List<String> keyList = new ArrayList<>();
-		return keyList;
-	}
-
-	/**
-	 * <p>
-	        拷贝目录
-	 * </p>
-	 * @author dengsixing
-	 * @date 2022/1/18
-	 * @param sourcePath
-	 * @param targetPath
-	 **/
-	public void copyFiles(String sourcePath, String targetPath) throws IOException {
-		StorageType storageType = StorageType.get(type);
-		switch (storageType){
-			case OSS:
-				this.copyFilesFromAli(sourcePath, targetPath);
-				break;
-			case AWS:
-				this.copyFilesFromAws(sourcePath, targetPath);
-				break;
-			case LOCAL: this.copyFilesFromLocal(sourcePath, targetPath);
-		}
-	}
-
-	/**
-	 * <p>
-	 拷贝文件
-	 * </p>
-	 * @author dengsixing
-	 * @date 2022/1/18
-	 * @param sourceKey
-	 * @param targetKey
-	 **/
-	public void copyObject(String sourceKey, String targetKey) throws IOException {
-		StorageType storageType = StorageType.get(type);
-		switch (storageType){
-			case OSS:
-				this.copyObjectFromAli(sourceKey, targetKey);
-				break;
-			case AWS:
-				this.copyObjectFromAws(sourceKey, targetKey);
-				break;
-		}
-	}
-
-	/**
-	 * <p>
-	 拷贝-阿里云
-	 * </p>
-	 * @author dengsixing
-	 * @date 2022/1/18
-	 * @param sourcePath
-	 * @param targetPath
-	 **/
-	public void copyObjectFromAli(String sourcePath, String targetPath) throws IOException {
-
-		// 创建OSSClient实例。
-		OSSClient ossClient = new OSSClient(point, key, secrey);
-		// 复制文件
-		log.info("开始复制:" + sourcePath);
-		ossClient.copyObject(this.bucket, sourcePath, this.bucket, targetPath);
-		log.info("复制成功:" + sourcePath);
-		ossClient.shutdown();
-	}
-
-
-
-	/**
-	 * <p>
-	 拷贝-阿里云
-	 * </p>
-	 * @author dengsixing
-	 * @date 2022/1/18
-	 * @param sourcePath
-	 * @param targetPath
-	 **/
-	public void copyFilesFromAli(String sourcePath, String targetPath) throws IOException {
-
-		//获取源文件列表
-		List<String> sourceKeyList = this.listKeysFromAli(sourcePath);
-		if(CollUtil.isEmpty(sourceKeyList)){
-			return;
-		}
-		// 创建OSSClient实例。
-		OSSClient ossClient = new OSSClient(point, key, secrey);
-		// 复制文件
-		sourceKeyList.parallelStream().forEach(key -> {
-			log.info("开始复制:" + key);
-			ossClient.copyObject(this.bucket, key, this.bucket, key.replace(sourcePath, targetPath));
-			log.info("复制成功:" + key);
-		});
-
-		ossClient.shutdown();
-	}
-
-
-	/**
-	 * <p>
-	 拷贝-亚马逊
-	 * </p>
-	 * @author dengsixing
-	 * @date 2022/1/18
-	 * @param sourcePath
-	 * @param targetPath
-	 **/
-	public void copyFilesFromAws(String sourcePath, String targetPath){
-
-		try {
-			List<String> sourceKeyList = this.listKeysFromAws(sourcePath);
-			/**
-			 * 创建s3对象
-			 */
-			BasicAWSCredentials awsCreds = new BasicAWSCredentials(s3key, s3secrey);
-			AmazonS3 s3 = AmazonS3ClientBuilder.standard()
-				.withCredentials(new AWSStaticCredentialsProvider(awsCreds))
-				.withRegion(Regions.EU_WEST_2)//s3 地区位置
-				.build();
-
-			// 复制文件
-			sourceKeyList.parallelStream().forEach(key -> {
-				log.info("开始复制:" + key);
-				s3.copyObject(this.s3bucket, key, this.s3bucket, key.replace(sourcePath, targetPath));
-				log.info("复制成功:" + key);
-			});
-			s3.shutdown();
-		} catch (Exception ase) {
-			log.error("amazonS拷贝异常 " + ase.getMessage(), ase);
-		}
-	}
-
-	/**
-	 * <p>
-	 拷贝-亚马逊
-	 * </p>
-	 * @author dengsixing
-	 * @date 2022/1/18
-	 * @param sourceKey
-	 * @param targetKey
-	 **/
-	public void copyObjectFromAws(String sourceKey, String targetKey){
-			BasicAWSCredentials awsCreds = new BasicAWSCredentials(s3key, s3secrey);
-			AmazonS3 s3 = AmazonS3ClientBuilder.standard()
-				.withCredentials(new AWSStaticCredentialsProvider(awsCreds))
-				.withRegion(Regions.EU_WEST_2)//s3 地区位置
-				.build();
-			// 复制文件
-			log.info("开始复制:" + sourceKey);
-			s3.copyObject(this.s3bucket, sourceKey, this.s3bucket, targetKey);
-			log.info("复制成功:" + sourceKey);
-			s3.shutdown();
-	}
-
-	/**
-	 * <p>
-	 拷贝-本地
-	 * </p>
-	 * @author dengsixing
-	 * @date 2022/1/18
-	 * @param sourcePath
-	 * @param targetPath
-	 **/
-	public void copyFilesFromLocal(String sourcePath, String targetPath) throws IOException {
-		// TODO: 2022/1/21
-
-	}
-
-	/**
-	 * 获取文件内容
-	 * @param objectName
-	 * @return
-	 */
-	public String getObjectContent( String objectName){
-		log.info("下载文件:"+objectName);
-		StorageType storageType = StorageType.get(type);
-		switch (storageType){
-			case OSS:
-				return this.getObjectContentFromAli(bucket, objectName);
-			case AWS:
-				return this.getObjectContentFromAws(s3bucket, objectName);
-			case LOCAL:
-				return this.getObjectContentFromLocal(objectName);
-		}
-		return null;
-	}
-
-	/**
-	 * 获取文件内容-阿里云
-	 * @param bucketName
-	 * @param objectName
-	 * @return
-	 */
-	public String getObjectContentFromAli(String bucketName, String objectName){
-		//创建oss客戶端
-		OSSClient ossClient = new OSSClient(point, key, secrey);
-		InputStream objectContent = null;
-		StringBuilder contentJson = new StringBuilder();
-		try {
-			// ossObject包含文件所在的存储空间名称、文件名称、文件元信息以及一个输入流。
-			OSSObject ossObject = ossClient.getObject(bucketName, objectName);
-			objectContent = ossObject.getObjectContent();
-			try(BufferedReader reader = new BufferedReader(new InputStreamReader(objectContent))){
-				while (true) {
-					String line = reader.readLine();
-					if (line == null) break;
-					contentJson.append(line);
-				}
-			} catch (IOException e) {
-				log.error("读取scene.json文件流失败", e);
-			}
-		}catch (Exception e){
-			log.error("s3获取文件内容失败,key="+objectName, e);
-		}finally {
-			if(ossClient != null){
-				ossClient.shutdown();
-			}
-		}
-
-		return contentJson.toString();
-	}
-
-	/**
-	 * 获取文件内容-阿里云
-	 * @param objectName
-	 * @return
-	 */
-	public boolean existOnAli(String objectName){
-		//创建oss客戶端
-		OSSClient ossClient = new OSSClient(point, key, secrey);
-		// ossObject包含文件所在的存储空间名称、文件名称、文件元信息以及一个输入流。
-		try{
-			boolean exist = ossClient.doesObjectExist(bucket, objectName);
-			return exist;
-		}catch (Exception e){
-			log.error("s4判断是否存在key异常,key=" + objectName, e);
-		}finally {
-			if(ossClient != null){
-				ossClient.shutdown();
-			}
-		}
-		return false;
-	}
-
-	/**
-	 * 获取文件内容-亚马逊
-	 * @param bucketName
-	 * @param objectName
-	 * @return
-	 */
-	public String getObjectContentFromAws(String bucketName, String objectName){
-
-		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,objectName);
-			S3Object object = s3.getObject(request);
-			S3ObjectInputStream inputStream = object.getObjectContent();
-			StringBuilder content = new StringBuilder();
-			try(BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream))){
-				while (true) {
-					String line = reader.readLine();
-					if (line == null) break;
-					content.append(line);
-				}
-			} catch (IOException e) {
-				log.error("读取aws文件流失败", e);
-			}
-			return content.toString();
-		} catch (Exception ase) {
-			log.error("amazonS3下载文件异常 " + ase.getMessage(), ase);
-		}
-		return null;
-
-	}
-
-	/**
-	 * 获取文件内容-亚马逊
-	 * @param objectName
-	 * @return
-	 */
-	public boolean existOnAws(String objectName){
-
-		BasicAWSCredentials awsCreds = new BasicAWSCredentials(s3key, s3secrey);
-		AmazonS3 s3 = AmazonS3ClientBuilder.standard()
-			.withCredentials(new AWSStaticCredentialsProvider(awsCreds))
-			.withRegion(Regions.EU_WEST_2)
-			.build();
-		try {
-			boolean exist = s3.doesObjectExist(s3bucket, objectName);
-			return exist;
-		}catch (Exception e){
-			log.error("s4判断是否存在key异常,key=" + objectName, e);
-		}finally {
-			if(s3 != null){
-				s3.shutdown();
-			}
-		}
-		return false;
-	}
-
-	/**
-	 * 判断key是否存在
-	 * @param key
-	 * @return
-	 */
-	public boolean existKey(String key){
-		StorageType storageType = StorageType.get(type);
-		switch (storageType){
-			case OSS:
-				return this.existOnAli(key);
-			case AWS:
-				return this.existOnAws(key);
-			default:
-				return false;
-		}
-	}
-
-	/**
-	 * 获取文件内容-本地
-	 * @param objectName
-	 * @return
-	 */
-	public String getObjectContentFromLocal(String objectName){
-		// TODO: 2022/1/21
-		return null;
-	}
-
-	/**
-	 * oss下载文件到本地
-	 * @param objectName
-	 * @param localPath
-	 */
-	public boolean download(String objectName, String localPath){
-		StorageType storageType = StorageType.get(this.type);
-		switch (storageType){
-			case OSS:
-				return this.downFormAli(objectName, localPath);
-			case AWS:
-				return this.downFromS3(objectName, localPath);
-		}
-		return false;
-	}
-
-	/**
-	 * 从阿里云oss下载文件到本地
-	 * @param objectName 云端文件k地址
-	 * @param localPath 本地文件地址
-	 * @return
-	 */
-	public boolean downFormAli(String objectName, String localPath){
-		OSSClient ossClient = new OSSClient(point, key, secrey);
-		try {
-			com.aliyun.oss.model.GetObjectRequest request  = new com.aliyun.oss.model.GetObjectRequest(bucket,objectName);
-			File file = new File(localPath);
-			if(!file.getParentFile().exists()){
-				file.getParentFile().mkdirs();
-			}
-			ossClient.getObject(request, file);
-			return true;
-		}catch (Exception e){
-			log.error("阿里云oss文件下载失败,key=" + objectName, e);
-		}finally {
-			if(ossClient != null){
-				ossClient.shutdown();
-			}
-		}
-		return false;
-	}
-
-	/**
-	 * 从s3下载文件到本地
-	 * @param objectName 云端文件k地址
-	 * @param localPath 本地文件地址
-	 * @return
-	 */
-	public boolean downFromS3(String objectName, String localPath) {
-		BasicAWSCredentials awsCreds = new BasicAWSCredentials(s3key, s3secrey);
-		AmazonS3 s3 = AmazonS3ClientBuilder.standard()
-			.withCredentials(new AWSStaticCredentialsProvider(awsCreds))
-			.withRegion(Regions.EU_WEST_2)
-			.build();
-		try {
-			GetObjectRequest request  = new GetObjectRequest(this.s3bucket,objectName);
-			s3.getObject(request,new File(localPath));
-			return true;
-		} catch (Exception e) {
-			log.error("amazonS3下载文件失败,key=" + objectName, e);
-		}finally {
-			if(s3 != null){
-				s3.shutdown();
-			}
-		}
-		return false;
-	}
-
-	public List<String> listKeys(String sourcePath) {
-		StorageType storageType = StorageType.get(type);
-		switch (storageType){
-			case OSS:
-				return this.listKeysFromAli(sourcePath);
-			case AWS:
-				return this.listKeysFromAws(sourcePath);
-			case LOCAL:
-				return this.listKeysFromLocal(sourcePath);
-		}
-		return null;
-	}
-}

+ 0 - 18
src/main/java/com/fdkankan/tools/vo/CameraVo.java

@@ -1,18 +0,0 @@
-package com.fdkankan.tools.vo;
-
-import com.alibaba.excel.annotation.ExcelProperty;
-import com.fdkankan.tools.entity.Camera;
-import lombok.Data;
-
-@Data
-public class CameraVo  {
-
-    @ExcelProperty("相机sn")
-    private String snCode;
-    @ExcelProperty("场景数量")
-    private Long count;
-    @ExcelProperty("是否有权益")
-    private Boolean vip = false;
-    @ExcelProperty("权益类型(SE高级会员,PR(专业会员))")
-    private String  vipType;
-}

+ 0 - 57
src/main/resources/application-cnToJp.yaml

@@ -1,57 +0,0 @@
-server:
-  port: 7001
-  servlet:
-    context-path: /tools
-  tomcat:
-    max-http-form-post-size: -1
-spring:
-  datasource:
-    type: com.alibaba.druid.pool.DruidDataSource
-    dynamic:
-      # 指定默认数据源
-      primary: master
-      # true:找不到数据源报错,false:找不到数据源则使用数据源
-      strict: false
-      datasource:
-        master:
-          driver-class-name: com.mysql.jdbc.Driver
-          #url: jdbc:mysql://120.24.144.164:3306/4dkankan_v4?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai&allowMultiQueries=true
-          url: jdbc:mysql://rm-wz90w10465iiwwv098o.mysql.rds.aliyuncs.com/4dkankan_v4_prod?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=UTC&allowMultiQueries=true
-          username: root
-          password: D2719bd0cae1a005
-        flowable:
-          driver-class-name: com.mysql.jdbc.Driver
-          url: jdbc:mysql://8.211.153.189:13306/4dkankan_v4?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai&allowMultiQueries=true
-          username: root
-          password: JK20220812!%JIK
-
-fyun2:
-  aws:
-    s3key: AKIAWCV5QFZ3ZNELKYUY
-    s3secrey: epS5ghyR4LJ7rxk/qJO9ZYh6m9Oz6g5haKDu4yws
-    s3bucket: 4dkankan
-  oss:
-    key: LTAIUrvuHqj8pvry
-    secrey: JLOVl0k8Ke0aaM8nLMMiUAZ3EiiqI4
-    bucket: 4dkankan
-    point: http://oss-cn-shenzhen.aliyuncs.com
-fyun:
-  aws:
-    s3key: AKIAWCV5QFZ3ZNELKYUY
-    s3secrey: epS5ghyR4LJ7rxk/qJO9ZYh6m9Oz6g5haKDu4yws
-    s3bucket: 4dkankan
-  oss:
-    key: LTAI5tQeKwSRQXHWVhM9NTtF
-    secrey: yu9qHI1otXKYjhka2fpSxvneRC1mlh
-    bucket: geosign-4dkk
-    point: http://oss-ap-northeast-1.aliyuncs.com
-db1:
-  fyun:
-    host: https://4dkk.4dage.com
-  main: https://www.4dkankan.com
-
-db2:
-  fyun:
-    host: https://oss.4dkankan.jp
-  main: https://www.4dkankan.jp
-

+ 0 - 47
src/main/resources/application-eurToJp.yaml

@@ -1,47 +0,0 @@
-server:
-  port: 7001
-  servlet:
-    context-path: /tools
-  tomcat:
-    max-http-form-post-size: -1
-spring:
-  datasource:
-    type: com.alibaba.druid.pool.DruidDataSource
-    dynamic:
-      # 指定默认数据源
-      primary: master
-      # true:找不到数据源报错,false:找不到数据源则使用数据源
-      strict: false
-      datasource:
-        master:
-          driver-class-name: com.mysql.jdbc.Driver
-          #url: jdbc:mysql://120.24.144.164:3306/4dkankan_v4?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai&allowMultiQueries=true
-          url: jdbc:mysql://3.120.132.91:13306/4dkankan_v4?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=UTC&allowMultiQueries=true
-          username: root
-          password: JK20220120%JIK
-        flowable:
-          driver-class-name: com.mysql.jdbc.Driver
-          url: jdbc:mysql://8.211.153.189:13306/4dkankan_v4?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai&allowMultiQueries=true
-          username: root
-          password: JK20220812!%JIK
-
-fyun:
-  aws:
-    s3key: AKIAWCV5QFZ3ZNELKYUY
-    s3secrey: epS5ghyR4LJ7rxk/qJO9ZYh6m9Oz6g5haKDu4yws
-    s3bucket: 4dkankan
-  oss:
-    key: LTAI5tQeKwSRQXHWVhM9NTtF
-    secrey: yu9qHI1otXKYjhka2fpSxvneRC1mlh
-    bucket: geosign-4dkk
-    point: http://oss-ap-northeast-1.aliyuncs.com
-db1:
-  fyun:
-    host: https://eurs3.4dkankan.com
-  main: https://eur.4dkankan.com
-
-db2:
-  fyun:
-    host: https://oss.4dkankan.jp
-  main: https://www.4dkankan.jp
-

+ 0 - 43
src/main/resources/application-local.yaml

@@ -1,43 +0,0 @@
-server:
-  port: 7001
-  servlet:
-    context-path: /
-  tomcat:
-    max-http-form-post-size: -1
-spring:
-  datasource:
-    type: com.alibaba.druid.pool.DruidDataSource
-    dynamic:
-      # 指定默认数据源
-      primary: master
-      # true:找不到数据源报错,false:找不到数据源则使用数据源
-      strict: false
-      datasource:
-        master:
-          driver-class-name: com.mysql.jdbc.Driver
-          #url: jdbc:mysql://120.24.144.164:3306/4dkankan_v4?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai&allowMultiQueries=true
-          url: jdbc:mysql://52.59.190.193:13306/4dkankan_v4?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=UTC&allowMultiQueries=true
-          username: root
-          password: JK20220120%JIK
-        flowable:
-          driver-class-name: com.mysql.jdbc.Driver
-          url: jdbc:mysql://120.24.144.164:3306/4dkankan_v4?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai&allowMultiQueries=true
-          username: root
-          password: 4Dage@4Dage#@168
-
-fyun:
-  aws:
-    s3key: AKIAWCV5QFZ3ZNELKYUY
-    s3secrey: epS5ghyR4LJ7rxk/qJO9ZYh6m9Oz6g5haKDu4yws
-    s3bucket: test-4dkankan
-  oss:
-    #key: LTAI5tQeKwSRQXHWVhM9NTtF
-    #secrey: yu9qHI1otXKYjhka2fpSxvneRC1mlh
-    #bucket: geosign-4dkk
-    #point: http://oss-ap-northeast-1.aliyuncs.com
-    key: LTAIUrvuHqj8pvry
-    secrey: JLOVl0k8Ke0aaM8nLMMiUAZ3EiiqI4
-    bucket: 4dkankan
-    point: http://oss-cn-shenzhen.aliyuncs.com
-
-

+ 6 - 17
src/main/resources/application-zfbOldToNew.yaml

@@ -7,23 +7,12 @@ server:
 spring:
   datasource:
     type: com.alibaba.druid.pool.DruidDataSource
-    dynamic:
-      # 指定默认数据源
-      primary: master
-      # true:找不到数据源报错,false:找不到数据源则使用数据源
-      strict: false
-      datasource:
-        master:
-          driver-class-name: com.mysql.jdbc.Driver
-          #url: jdbc:mysql://120.24.144.164:3306/4dkankan_v4?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai&allowMultiQueries=true
-          url: jdbc:mysql://47.112.166.173:3306/zhi_house?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai&allowMultiQueries=true
-          username: root
-          password: 4dkankan4dage
-        flowable:
-          driver-class-name: com.mysql.jdbc.Driver
-          url: jdbc:mysql://120.24.202.7:3306/zhi_house?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai&allowMultiQueries=true
-          username: root
-          password: zfb@20210727%
+    name: druidDataSource
+    druid:
+      driver-class-name: com.mysql.jdbc.Driver
+      url: jdbc:mysql://120.24.202.7:3306/zhi_house?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai&allowMultiQueries=true
+      username: root
+      password: zfb@20210727%
 #          url: jdbc:mysql://47.113.81.43:3306/zhi_house?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai&allowMultiQueries=true
 #          username: root
 #          password: zfb20211015G

+ 7 - 15
src/main/resources/application-cnToZfb.yaml

@@ -7,23 +7,15 @@ server:
 spring:
   datasource:
     type: com.alibaba.druid.pool.DruidDataSource
-    dynamic:
+    name: druidDataSource
       # 指定默认数据源
-      primary: master
       # true:找不到数据源报错,false:找不到数据源则使用数据源
-      strict: false
-      datasource:
-        master:
-          driver-class-name: com.mysql.jdbc.Driver
-          #url: jdbc:mysql://120.24.144.164:3306/4dkankan_v4?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai&allowMultiQueries=true
-          url: jdbc:mysql://rm-wz90w10465iiwwv098o.mysql.rds.aliyuncs.com/4dkankan_v4_prod?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=UTC&allowMultiQueries=true
-          username: root
-          password: D2719bd0cae1a005
-        flowable:
-          driver-class-name: com.mysql.jdbc.Driver
-          url: jdbc:mysql://120.24.202.7:3306/zhi_house?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai&allowMultiQueries=true
-          username: root
-          password: zfb@20210727%
+    druid:
+      driver-class-name: com.mysql.jdbc.Driver
+        #url: jdbc:mysql://120.24.144.164:3306/4dkankan_v4?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai&allowMultiQueries=true
+      url: jdbc:mysql://47.112.166.173:3306/zhi_house?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai&allowMultiQueries=true
+      username: root
+      password: 4dkankan4dage
 #源
 fyun2:
   aws:

+ 1 - 1
src/main/resources/application.yaml

@@ -1,6 +1,6 @@
 spring:
   profiles:
-    active: ${activeProfile:zfbOldToNew}
+    active: ${activeProfile:old-prod}
   servlet:
     multipart:
       # 设置单个文件大小