ke
2024-05-20 c863db455fe6590c2901d51a1606c8518e84119e
全景图更新切图功能kl  5-20 17
3 files modified
76 ■■■■ changed files
skjcmanager/skjcmanager-ops/skjcmanager-resource/src/main/java/cn/gistack/resource/builder/oss/OssBuilder.java 4 ●●● patch | view | raw | blame | history
skjcmanager/skjcmanager-ops/skjcmanager-resource/src/main/java/cn/gistack/resource/feign/OssClient.java 2 ●●● patch | view | raw | blame | history
skjcmanager/skjcmanager-service/skjcmanager-sm/src/main/java/cn/gistack/sm/skPanorama/controller/SkPanoramaController.java 70 ●●●● patch | view | raw | blame | history
skjcmanager/skjcmanager-ops/skjcmanager-resource/src/main/java/cn/gistack/resource/builder/oss/OssBuilder.java
@@ -175,15 +175,13 @@
     */
    public OssTemplate templateByPathPanorama(String code,String prefixPath,String resGuid) {
        String tenantId = AuthUtil.getTenantId();
        System.err.println("tenantId:"+tenantId);
//        System.err.println("tenantId:"+tenantId);
        if (StringUtil.isBlank(tenantId)){
            tenantId = "000000";
        }
        Oss oss = getOss(tenantId, code);
//        System.err.println("Oss");
//        System.err.println(oss.toString());
        OssTemplate template = null;
//        template = templatePool.get(tenantId);
skjcmanager/skjcmanager-ops/skjcmanager-resource/src/main/java/cn/gistack/resource/feign/OssClient.java
@@ -41,7 +41,7 @@
    @PostMapping(UPLOAD_QIETU)
    public R uploadQietu(QieTuEntity qieTuEntity) throws IOException {
        HashMap<String,String> qietuHashMap = qieTuEntity.getQietuHashMap();
        System.err.println("切图的路径:"+qietuHashMap);
//        System.err.println("切图的路径:"+qietuHashMap);
        String resGuid = qieTuEntity.getResGuid();
skjcmanager/skjcmanager-service/skjcmanager-sm/src/main/java/cn/gistack/sm/skPanorama/controller/SkPanoramaController.java
@@ -271,6 +271,36 @@
    }
     */
    /**
     * 批量切图
     * @param ids
     * @return
     * @throws IOException
     * @throws InterruptedException
     * @throws IM4JavaException
     * @throws IllegalAccessException
     */
    @PostMapping("/cutPicBatch")
    public  R cutPicBatch(@RequestParam String ids) throws IOException, InterruptedException, IM4JavaException, IllegalAccessException {
        List<Long> idlist = Func.toLongList(ids);
        if (idlist!= null && idlist.size()>0) {
            for (Long id : idlist ) {
                SkPanoramaEntity entity = skPanoramaService.getById(id);
                Integer status = entity.getStatus();
                String resGuname = entity.getResGuname();
                String name = entity.getName();
                if (PanoramaUtilDict.panorama_status_3 == status) continue;
                R r = cutPicture2(entity);
                boolean success = r.isSuccess();
                if (!success) {
                    return R.fail(resGuname+"-"+name+" 切图失败!");
                }
            }
        }
        return R.status(true);
    }
    private static final String  linShiBaseUrl = "/data/panorama/qietu/";
    @GetMapping("/cutPicture2")
@@ -332,8 +362,6 @@
        /************************************切图结束********************************************/
        // 上传切片全景图
        System.err.println("切图的路径数量"+qietuHashMap.size());
        System.err.println("水库编码"+resGuid);
        QieTuEntity qieTuEntity = new QieTuEntity();
        qieTuEntity.setQietuHashMap(qietuHashMap);
@@ -353,13 +381,11 @@
        entity.setUrlhead(urlHead);
        entity.setQierow(row);
        entity.setQiecol(col);
        entity.setPicwidth(width);
        entity.setPicheight(height);
        entity.setStatus(PanoramaUtilDict.panorama_status_3);
        skPanoramaService.updateById(entity);
        boolean b = skPanoramaService.updateById(entity);
        return R.status(true);
        return R.status(b);
    }
    private File getquanjingFile (String dirPath ,String linshiUrl , Long id) throws IOException {
@@ -373,7 +399,7 @@
        File dir = new File(dirPath);
        if (dir.isDirectory()) {
            // 清除该目录下的文件及子目录文件而不删除该目录文件夹。该目录不存在会报错
            FileUtils.cleanDirectory(dir);
//            FileUtils.cleanDirectory(dir);
        } else {
            dir.mkdirs();
        }
@@ -407,7 +433,7 @@
        ArrayList<SkPanoramaEntity> panoramalist = new ArrayList<SkPanoramaEntity>();
        // 已上传的全景图已符合比例,仅用改变数据状态
//        ArrayList<SkPanoramaEntity> justUpdateStatusList = new ArrayList<SkPanoramaEntity>();
        ArrayList<SkPanoramaEntity> justUpdateStatusList = new ArrayList<SkPanoramaEntity>();
        ArrayList<FormateTuEntity> list = new ArrayList<FormateTuEntity>();
@@ -418,6 +444,8 @@
                SkPanoramaEntity entity = skPanoramaService.getById(id);
                Integer status = entity.getStatus();
                if (PanoramaUtilDict.panorama_status_2 == status) continue;
                String picUrl = entity.getPicUrl();
                String picName = entity.getPicName();
                String resGuid = entity.getResGuid();
@@ -435,7 +463,8 @@
                File lingshigeshibilidir = new File(lingshigeshibilipath);
                if (lingshigeshibilidir.isDirectory()) {
                    // 清除该目录下的文件及子目录文件而不删除该目录文件夹。该目录不存在会报错
                    FileUtils.cleanDirectory(lingshigeshibilidir);
//                    FileUtils.cleanDirectory(lingshigeshibilidir);
                    // 批量操作不能清空文件夹下的全部文件
                } else {
                    lingshigeshibilidir.mkdirs();
                }
@@ -450,8 +479,9 @@
                    SkPanoramaEntity upEntity = new SkPanoramaEntity();
                    upEntity.setId(id);
                    upEntity.setStatus(PanoramaUtilDict.panorama_status_2);
                    boolean b = skPanoramaService.updateById(upEntity);
                    return R.status( b);
                    justUpdateStatusList.add(upEntity);
//                    boolean b = skPanoramaService.updateById(upEntity);
//                    return R.status( b);
                } else {
                    Integer newWidth = height * 2;
                    // 图片格式化
@@ -504,9 +534,23 @@
            }
        }
        boolean b = skPanoramaService.updateBatchById(panoramalist);
        boolean b = false;
        if (panoramalist != null && panoramalist.size()>0) {
             b = skPanoramaService.updateBatchById(panoramalist);
        } else {
             b = true;
        }
        return R.status(b);
        boolean formatB = false;
        // 已上传的全景图已符合比例,仅用改变数据状态
        if (panoramalist != null && panoramalist.size()>0) {
             formatB = skPanoramaService.updateBatchById(justUpdateStatusList);
        } else {
            formatB = true;
        }
        return R.status((formatB && b));
    }