Package com.skyline.user.model

Examples of com.skyline.user.model.User


//  private String listVideoView;

  @RequestMapping(value = "/queryInfo", method = RequestMethod.GET)
  public @ResponseBody
  Video queryVideoInfo(String url) {
    User user = (User) WebHelper.getSessionAttribute(null, Constant.SESSION_USER);
    if (user == null || user.getId() == 0) {
      return null;
    } else {
      Video video;
      try {
        video = videoService.queryVideoInfo(url);
        if (video != null) {
          video.setOwnerId(user.getId());
          video.setOwnerNickname(user.getNickname());
          video.setOwnerPortrait(user.getPortrait());
          WebHelper.setSessionAttribute(null, "lastQueryVideoInfo", video);
        }
      } catch (Exception e) {
        // 对出错的情况进行处理
        video = null;
View Full Code Here


  @RequestMapping(value = "/addVideo", method = RequestMethod.POST)
  @ResponseBody
  public long addVideo(Video modifyedVideo) {
    Video video = (Video) WebHelper.getSessionAttribute(null, "lastQueryVideoInfo");
    User user = (User) WebHelper.getSessionAttribute(null, Constant.SESSION_USER);
    if (video == null || user == null || user.getId() == 0) {
      return 0;
    } else {
      long id = videoService.addVideo(user.getId(), user.getPortrait(), user.getNickname(), modifyedVideo.getTitle(),
          video.getThumbnail(), modifyedVideo.getSummary(), video.getTime(), video.getSource(), video.getPageUrl(),
          video.getFlashUrl(), video.getHtmlCode());
      return id;
    }
  }
View Full Code Here

//  private String inviteSuccessView;

  @RequestMapping(value = "/joinUs", method = RequestMethod.GET)
  public ModelAndView inviteRequest() {
    ModelAndView mav = new ModelAndView();
    User user = (User) WebHelper.getSessionAttribute(null, Constant.SESSION_USER);
    if (user == null || user.getId() == 0) {
      throw new NotLoginException();
    } else {
      mav.setViewName(ViewPaths.INVITE_REQUEST);
    }
    return mav;
View Full Code Here

  }

  @RequestMapping(value = "/joinUs", method = RequestMethod.POST)
  public ModelAndView inviteExecute(String[] emails,int valideEmailCount) {
    ModelAndView mav = new ModelAndView();
    User user = (User) WebHelper.getSessionAttribute(null, Constant.SESSION_USER);
    if (user == null || user.getId() == 0) {
      throw new NotLoginException();
    } else {
      //System.out.println(valideEmailCount);
      inviteService.sendInvitation(emails, user,valideEmailCount);
      mav.setViewName(ViewPaths.INVITE_SUCCESS);
View Full Code Here

      throws IOException {
    if (!"POST".equals(request.getMethod())) {
      response.sendRedirect(buildRecirectPath(request, "/user/photoupload", null));
    }
   
    User user = (User) WebHelper.getSessionAttribute(request, Constant.SESSION_USER);
    Map<String, Object> jsonMap = null;
    if (user == null) {
      jsonMap = toJsonMap(false, "修改照片描述必须登录");
      jsonMap.put("logined", Boolean.FALSE);
      OutputStream out = response.getOutputStream();
      outputJsonResult(out, jsonMap);
      return;
    }

    try {
      long userId = user.getId();
      Album album = albumService.getUserPortraitAlbum(userId);
      long albumId = album.getId();

      MultipartFile file = ((MultipartHttpServletRequest) request).getFile("file");
      if (file == null) {
        jsonMap = resultToJsonMap(ResultState.NO_FILE_EXIST, null);
        OutputStream out = response.getOutputStream();
        outputJsonResult(out, jsonMap);
        return;
      }
      MultipartImageResizeTask resizeTask = new MultipartImageResizeTask(file, baseSizes,
          null, false);
      resizeTask.setAlbumId(albumId);
      resizeTask.setUserId(userId);
      resizeTask.setSupportMulitFrame(false);
      ImageResizeResult processResult = imagine.processSingleImage(basePath, resizeTask);
      ResultState resultState = processResult.getResultState();
      if (resultState != ResultState.SUCCESS) {
        jsonMap = resultToJsonMap(resultState, null);
        OutputStream out = response.getOutputStream();
        outputJsonResult(out, jsonMap);
        return;
      }
      Photo portrait = albumService.createPortraitPhoto(user, album, processResult);

      String smallFile = portrait.getSmallFile();
      String ext = portrait.getExt();
      String remoteFileKey = smallFile + '.' + ext;

      SkylineImageCropTask cropTask = new SkylineImageCropTask(remoteFileKey, portraitSize);
      cropTask.setAlbumId(albumId);
      cropTask.setUserId(userId);
      ImageCropResult cropResult = crop.processImage(basePath, cropTask);
      String portraitFile = cropResult.getFileKey();

      personalInfoService.changeUserPortrait(userId, portraitFile);
      user.setPortrait(portraitFile);
      WebHelper.setSessionAttribute(request, Constant.SESSION_USER, user);

      jsonMap = toJsonMap(true, "上传头像成功");
      jsonMap.put("fileKey", remoteFileKey);
    } catch (Exception e) {
View Full Code Here

    if (!"POST".equals(request.getMethod())) {
      response.sendRedirect(buildRecirectPath(request, "/spot/spotId/editPortrait", null));
    }
    long spotId = Long.parseLong(spotIdStr);
    long albumId = Long.parseLong(albumIdStr);
    User user = (User) WebHelper.getSessionAttribute(request, Constant.SESSION_USER);
    Map<String, Object> jsonMap = null;
    if (user == null) {
      jsonMap = toJsonMap(false, "修改照片描述必须登录");
      jsonMap.put("logined", Boolean.FALSE);
      OutputStream out = response.getOutputStream();
      outputJsonResult(out, jsonMap);
      return;
    }

    try {
      Album album =albumService.getAlbumById(albumId);
      Spot spot=spotService.getSpot(spotId);
      MultipartFile file = ((MultipartHttpServletRequest) request).getFile("file");
      if (file == null) {
        jsonMap = resultToJsonMap(ResultState.NO_FILE_EXIST, null);
        OutputStream out = response.getOutputStream();
        outputJsonResult(out, jsonMap);
        return;
      }
      MultipartImageResizeTask resizeTask = new MultipartImageResizeTask(file, baseSizes,
          null, false);
      resizeTask.setAlbumId(albumId);
      resizeTask.setUserId(spotId);
      resizeTask.setSupportMulitFrame(false);
      ImageResizeResult processResult = imagine.processSingleImage(basePath, resizeTask);
      ResultState resultState = processResult.getResultState();
      if (resultState != ResultState.SUCCESS) {
        jsonMap = resultToJsonMap(resultState, null);
        OutputStream out = response.getOutputStream();
        outputJsonResult(out, jsonMap);
        return;
      }
      /**
       * 构造一个spot的user
       */
      User tempuser=new User();
      tempuser.setId(spot.getId());
      tempuser.setNickname(spot.getName());
      tempuser.setPortrait(spot.getPortrait());
      Photo portrait = albumService.createPortraitPhoto(tempuser, album, processResult);

      String smallFile = portrait.getSmallFile();
      String ext = portrait.getExt();
      String remoteFileKey = smallFile + '.' + ext;
View Full Code Here

   * @return
   */
  @RequestMapping(value = "/{spotId}/photo/new", method = RequestMethod.GET)
  public ModelAndView newAlbumRefToSpotRequest(
      @PathVariable("spotId") Long spotId) {
    User user = (User) WebHelper.getSessionAttribute(null,
        Constant.SESSION_USER);
    ModelAndView mav = new ModelAndView();
    if (user == null) {
      throw new NotLoginException("上传照片必须登录");
    }
View Full Code Here

  Map<String, Object> batchUploadSpotOk(
      @PathVariable("ownerId") Long ownerId,
      @PathVariable("albumId") Long albumId,
      @RequestParam("files") String files) {
    Map<String, Object> result = new HashMap<String, Object>();
    User user = (User) WebHelper.getSessionAttribute(null,
        Constant.SESSION_USER);
    if (user == null) {
      result.put("success", Boolean.FALSE);
      result.put("errmsg", "压缩图片必须");
      result.put("logined", Boolean.FALSE);
      return result;
    } else {
      result.put("logined", Boolean.TRUE);
    }
    String[] filesPath = files.split("\\|");
    List<File> localFiles = new ArrayList<File>();
    for (String filePath : filesPath) {
      if (!StringUtils.hasLength(filePath)) {
        continue;
      }
      File localFile = new File(filePath);
      localFiles.add(localFile);
    }
    if (localFiles.isEmpty()) {
      result.put("success", Boolean.FALSE);
      result.put("errmsg", "没有找到需要压缩的文件!");
      return result;
    }
    StringBuilder message = new StringBuilder();
    List<SkylineImageResizeTask> tasks = prepareResizeTask(localFiles,
        user.getId(), albumId, message);
    if (tasks == null || tasks.isEmpty()) {
      result.put("success", Boolean.FALSE);
      result.put("errmsg", "没有找到需要压缩的文件!");
      return result;
    }

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

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

    }
    List<Photo> photos = null;

    if (!filesInfo.isEmpty()) {
      photos = albumService.createPhotos(user, album, filesInfo);
    }
    albumService.changeAlbumCover(user.getId(), album.getId(), photos
        .get(0).getSmallFile(), photos.get(0).getExt());

    Map<Long, List<Photo>> filesMap = (Map<Long, List<Photo>>) WebHelper
        .getSessionAttribute(null, Constant.SESSION_UPLOAD_OK_FILES);
    if (filesMap == null) {
View Full Code Here

  @RequestMapping(value = "/uploadok/{ownerId}/{albumId}", method = RequestMethod.GET)
  public ModelAndView newAlbumRefUploadOk(
      @PathVariable("ownerId") Long ownerId,
      @PathVariable("albumId") Long albumId) {
    User user = (User) WebHelper.getSessionAttribute(null,
        Constant.SESSION_USER);
    if (user == null) {
      throw new NotLoginException("添加REF必须登录");
    }
    ModelAndView mav = new ModelAndView(ViewPaths.SPOTREF_NEWALBUMREFOK);
View Full Code Here

  }

  @RequestMapping(value = "/uploadok/{ownerId}/{albumId}", method = RequestMethod.POST)
  public ModelAndView newAlbumRefToSpotRequestOK(Long spotId, Long albumId,
      String refTitle, String refrenceDigest) {
    User user = (User) WebHelper.getSessionAttribute(null,
        Constant.SESSION_USER);
    ModelAndView mav = new ModelAndView();
    if (user == null) {
      throw new NotLoginException("添加REF必须登录");
    }
    Spot spot = spotService.getSpot(spotId);

    if (spot == null) {
      mav.setViewName(ViewPaths.SPOT_NOTFOUND);
      return mav;
    }
    Album album = albumService.getAlbumById(albumId);
    if (album == null) {
      mav.setViewName(ViewPaths.SPOT_NOTFOUND);
      return mav;
    }
    Long returnRefId = spotRefrenceService.postToSpot(album.getId(),
        album.getCover() + "." + album.getCoverExt(), refTitle,
        refrenceDigest, SpotRefrenceType.ALBUM, spotId, spot.getName(),
        spot.getPortrait(), user.getId(), user.getNickname(),
        user.getPortrait(), user.getEmail());
    if (returnRefId == 0 || returnRefId == null) {
      mav.setViewName(ViewPaths.SPOT_NOTFOUND);
      return mav;
    }
    String url = buildRecirectPath("/spot/" + spotId);
View Full Code Here

TOP

Related Classes of com.skyline.user.model.User

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.