Package com.skyline.spot.model

Examples of com.skyline.spot.model.Spot


    ModelAndView mav = new ModelAndView();
    if (user == null) {
      mav.setViewName(ViewPaths.USER_LOGIN);
      return mav;
    }
    Spot spotInfo = spotService.getSpot(spotId);
    mav.addObject("spotInfo", spotInfo);
    Page page = new Page();
    page.setSize(listRefrencePageSize);
    if (refType.equals("ALBUM")) {
      List<Album> albumList = albumService
View Full Code Here


      return mav;
    }
    Integer authority = Authority.PUBLIC;
    Page page = new Page();
    page.setSize(6);
    Spot spot = spotService.view(spotId);
    if (user.getId().equals(spot.getAdministratorId())) {
      authority = Authority.ADMIN;
    }
    List<SpotCharacteristic> scList = spotCharaService.queryCharacteristicBySpotId(spotId,
        page, Activity.NORMAL);
    mav.addObject("spotInfo", spot);
View Full Code Here

  public @ResponseBody
  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);
    Spot spot = spotService.getSpot(ownerId);
    if (spot == null) {
      result.put("success", Boolean.FALSE);
      result.put("errmsg", "不存在制定spot");
      return result;
    }
    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, ownerId, 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, ownerId);
    } catch (Exception e) {
      LOGGER.warn("获取相册失败", e);
      result.put("success", Boolean.FALSE);
      result.put("errmsg", "没有找到对应相册,压缩图片失败!");
      return result;

    }
    List<Photo> photos = null;

    if (!filesInfo.isEmpty()) {
      /**
       * 构造一个spot User
       */
      User tempUser = new User();
      tempUser.setId(ownerId);
      tempUser.setNickname(spot.getName());
      tempUser.setPortrait(spot.getPortrait());
      photos = albumService.createPhotos(tempUser, album, filesInfo);
    }

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

TOP

Related Classes of com.skyline.spot.model.Spot

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.