2018-08-31

public int saveGcda(IosGcdaModel igm, MultipartFile file) {

        String commitid = igm.getCommitid();

        String arch = igm.getArch();

        String timestamp = igm.getTimestamp();

        if(arch==null||"unknown".equals(arch)){

            return -100;

        }

        File iosRoot = new File(CocoConstant.IOS_BASE_DIR + File.separator + commitid + File.separator + arch

                + File.separator + "gcda" + File.separator + timestamp);

        iosRoot.mkdirs();

        File zipFile = new File(iosRoot.getAbsolutePath() + File.separator + file.getName() + ".zip");

        if (!zipFile.exists()) {

            try {

                zipFile.createNewFile();

                file.transferTo(zipFile);

                CocoUtil.unzip(zipFile.getAbsolutePath(), iosRoot.getAbsolutePath());

                CocoUtil.deleteFolder(zipFile);

            } catch (IOException e) {

                LogConstant.debugLog.info("IO异常");

                return -1;

            }

            int flag = saveGcda(igm);

            if (flag == 1) {

                LogConstant.debugLog.info("gcda文件上传并解压成功,解压路径:" + iosRoot.getAbsolutePath());

                return 1;

            } else {

                LogConstant.debugLog.info("gcda文件上传并解压成功,但是入库失败:");

                return -1;

            }

        } else {

            LogConstant.debugLog.info("IOS Gcda error file exist!");

            return -1;

        }

    }
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

友情链接更多精彩内容