Package com.skyline.wo.model

Examples of com.skyline.wo.model.Album


    }
    int authority = AuthorityUtil.getAuthority(null, viewerId);

    page.setSize(listPhotoPageSize);

    Album album = albumService.getAlbumById(albumId);
    // 判断权限
    if (album != null) {
      int albumAuth = album.getAuthority();
      if (authority < albumAuth) {
        throw new NoVisitPermissionException("ID为:" + viewerId + "的用户没有访问ID为:"
            + album.getId() + "相册的权限");
      }
    } else {
      throw new NoVisitPermissionException("ID:" + viewerId + "没有访问相册的权限");
    }
    List<Photo> photos = albumService.listPhotosOfAlbum(albumId, viewerId, authority, page,
        addVisitCount);

    ModelAndView mav = new ModelAndView(ViewPaths.ALBUM_VIEWALBUM);
    mav.addObject("ownerId", album.getOwnerId());
    mav.addObject("ownerName", album.getOwnerNickname());
    mav.addObject("albumId", album.getId());
    mav.addObject("page", page);
    mav.addObject("photos", photos);
    mav.addObject("album", album);

    return mav;
View Full Code Here


      userId = user.getId();
    } else {
      throw new NotLoginException("登录后才能创建相册");
    }

    Album album = albumService.getAlbumForChange(albumId, userId);

    ModelAndView mav = new ModelAndView(ViewPaths.ALBUM_EDITALBUM);
    mav.addObject("album", album);
    mav.addObject("page", page);
View Full Code Here

    if (errMsg != null) {
      ModelAndView returnMav = newAlbum();
      return processValidationErrors("errMsg", errMsg, returnMav);
    }

    Album resultAlbum = albumService.createAlbum(user, album);
    if (resultAlbum == null) {
      LOGGER.warn("数据异常,如果结果为空,应该早已抛出异常!");
      throw new OperateFailedException("创建相册失败");
    }
    String url = buildRecirectPath(URL_PREFIX + "/bupload/" + resultAlbum.getId());
    ModelAndView mav = new ModelAndView(new RedirectView(url));
    return mav;
  }
View Full Code Here

    User user = (User) WebHelper.getSessionAttribute(null, Constant.SESSION_USER);
    if (user == null) {
      throw new NotLoginException("上传照片必须登录");
    }
    long userId = user.getId();
    Album album = albumService.getAlbumForChange(albumId, userId);
    ModelAndView mav = new ModelAndView(ViewPaths.ALBUM_TOUPLOAD);
    mav.addObject("album", album);
    // WebHelper.saveToken(request);
    return mav;
  }
View Full Code Here

    User user = (User) WebHelper.getSessionAttribute(null, Constant.SESSION_USER);
    if (user == null) {
      throw new NotLoginException("上传照片必须登录");
    }
    long userId = user.getId();
    Album album = albumService.getAlbumForChange(albumId, userId);
    ModelAndView mav = new ModelAndView(ViewPaths.ALBUM_SWFUPLOAD);
    mav.addObject("album", album);
    // WebHelper.saveToken(request);
    return mav;
  }
View Full Code Here

      ModelAndView returnMav = toUpload(albumId);
      return processValidationErrors("errMsg", errMsg, returnMav);
    }

    long userId = user.getId();
    Album album = albumService.getAlbumForChange(albumId, userId);
    List<MultipartFile> files = request.getFiles("file");
    StringBuilder message = new StringBuilder();
    List<SkylineImageResizeTask> tasks = prepareResizeTask(files, userId, albumId, message);
    if (CollectionUtils.isEmpty(tasks)) {
      ModelAndView mav = new ModelAndView(ViewPaths.ALBUM_TOUPLOAD);
      mav.addObject("message", "没有找到您想传的图片");
      mav.addObject("album", album);
      return mav;
    }

    List<ImageResizeResult> results = imagine.processImage(localStorePath, tasks);
    List<ImageResizeResult> filesInfo = processResizeResult(results, message);

    List<Photo> photos = null;
    if (!CollectionUtils.isEmpty(filesInfo)) {
      photos = albumService.createPhotos(user, album, filesInfo);
    }

    ModelAndView mav = new ModelAndView(ViewPaths.ALBUM_UPLOADOK);
    mav.addObject("album", album);
    mav.addObject("message", message);
    Map<Long, List<Photo>> filesMap = (Map<Long, List<Photo>>) WebHelper.getSessionAttribute(
        request, Constant.SESSION_UPLOAD_OK_FILES);
    if (filesMap == null) {
      filesMap = new HashMap<Long, List<Photo>>();
    }
    filesMap.put(album.getId(), photos);
    WebHelper.setSessionAttribute(request, Constant.SESSION_UPLOAD_OK_FILES, filesMap);

    return mav;
  }
View Full Code Here

    }

    List<ImageResizeResult> results = imagine.processImage(localStorePath, tasks);
    List<ImageResizeResult> filesInfo = processResizeResult(results, message);

    Album album = null;
    try {
      album = albumService.getAlbumForChange(albumId, userId);
    } catch (Exception e) {
      LOGGER.warn("获取相册失败", e);
      result.put("success", Boolean.FALSE);
      result.put("errmsg", "没有找到对应相册,压缩图片失败!");
      return result;

    }
    List<Photo> photos = null;
    if (!CollectionUtils.isEmpty(filesInfo)) {
      photos = albumService.createPhotos(user, album, filesInfo);
    }

    Map<Long, List<Photo>> filesMap = (Map<Long, List<Photo>>) WebHelper.getSessionAttribute(
        null, Constant.SESSION_UPLOAD_OK_FILES);
    if (filesMap == null) {
      filesMap = new HashMap<Long, List<Photo>>();
    }
    filesMap.put(album.getId(), photos);
    WebHelper.setSessionAttribute(null, Constant.SESSION_UPLOAD_OK_FILES, filesMap);

    if (StringUtils.hasLength(message)) {// 存在错误
      result.put("success", Boolean.FALSE);
      result.put("errmsg", message);
View Full Code Here

    User user = (User) WebHelper.getSessionAttribute(null, Constant.SESSION_USER);
    if (user == null) {
      throw new NotLoginException("上传照片必须登录");
    }
    long userId = user.getId();
    Album album = albumService.getAlbumForChange(albumId, userId);

    ModelAndView mav = new ModelAndView(ViewPaths.ALBUM_UPLOADOK);
    mav.addObject("album", album);

    return mav;
View Full Code Here

      return processValidationErrors("errMsg", errMsg, returnMav);
    }

    long userId = user.getId();
    Photo photo = albumService.getPhotoForChange(userId, photoId);
    Album origAlbum = albumService.getAlbumForChange(photo.getAlbumId(), userId);
    if (setCover == null) {
      if (!photo.getAlbumId().equals(toAlbum)) {
        albumService.changePhotoAlbum(userId, photoId, photo.getAlbumId(), toAlbum);
        if (origAlbum.getCover().equals(photo.getSmallFile())) {// 取消原有封面
          albumService.changeAlbumCover(userId, photo.getAlbumId(), cover, ext);
        }
      }
    } else {
      albumService.changeAlbumCover(userId, photo.getAlbumId(), photo.getSmallFile(),
View Full Code Here

    result.put("logined", Boolean.TRUE);

    try {
      Long ownerId = user.getId();
      Photo photo = albumService.getPhotoForChange(ownerId, photoId);
      Album portraitAlbum = albumService.getUserPortraitAlbum(ownerId);
      Long albumId = portraitAlbum.getId();
      String photoExt = photo.getExt();
      String remoteFileKey = photo.getSmallFile() + '.' + photoExt;
      if (SkylineImagineUtils.isExtMultiFrame(photoExt)) {// 如果是动态图,需要压缩成单帧图
        remoteFileKey = photo.getMiddleFile() + '.' + photoExt;
        String filename = FilenameUtils.getName(remoteFileKey);
View Full Code Here

TOP

Related Classes of com.skyline.wo.model.Album

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.