美文网首页
2018-08-31

2018-08-31

作者: 残光夜影 | 来源:发表于2018-08-31 16:37 被阅读0次
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;

        }

    }

相关文章

网友评论

      本文标题:2018-08-31

      本文链接:https://www.haomeiwen.com/subject/ocqewftx.html