/**
   * 下载一个文件
   *
   * @param dirType
   * @param subPath
   * @param url
   * @param isOverite 复盖原有文件,删除原来的链接
   * @return
   */
  public long downLoadFile(
      String dirType, String subPath, final String url, boolean isExternal, boolean isOverite) {

    if (isOverite) {
      // 如果存在就先删除
      final File dirtype = context.getExternalFilesDir(dirType);
      Uri.Builder builder = Uri.fromFile(dirtype).buildUpon();
      builder = builder.appendEncodedPath(subPath);
      File file = new File(builder.build().getPath());
      if (file.exists()) {
        file.delete();
      }
      // 判断是否在下载列表中,有在下载列表中就先删除
      List<DownloadStatus> downloadStatusList = getAllDownloadList();
      for (DownloadStatus downloadStatus : downloadStatusList) {
        if (downloadStatus.getUrl().equals(url)) {
          deleteDownload(downloadStatus.getDownloadId());
        }
      }

      return downLoadFile(dirType, subPath, url, isExternal);
    } else {
      return downLoadFile(dirType, subPath, url, isExternal);
    }
  }