Package com.skyline.spot.model

Examples of com.skyline.spot.model.Spot


    ModelAndView v = new ModelAndView();
    if (user == null) {
      v.setViewName(ViewPaths.USER_LOGIN);
      return v;
    }
    Spot spot = spotService.getSpot(spotId);
    if (spot.getAdministratorId().equals(user.getId())) {
      Album portraitAlbum = albumService.getUserPortraitAlbum(spotId);
      Photo portraitPhoto = albumService.getCurrentPortraitPhotoFromAlbum(portraitAlbum);
      v.addObject("portraitAlbumId", portraitAlbum.getId());
      v.addObject("portrait", portraitPhoto);
      v.addObject("spotInfo", spot);
View Full Code Here


    ModelAndView v = new ModelAndView(ViewPaths.USER_LOGIN);
    Page page = new Page();
    page.setSize(spotPageSize);
    Integer authority = Authority.PUBLIC;
    User user = (User) WebHelper.getSessionAttribute(null, Constant.SESSION_USER);
    Spot spotInfo = spotService.view(spotId);
    if (spotInfo == null) {
      v.setViewName(ViewPaths.SPOT_NOTFOUND);
      return v;

    }
    spotService.addVisitNum(spotId);

    if (user != null) {
      if (attentionService.isFan(spotId, user.getId())) {
        authority = Authority.ONLY_TO_FANS;
      }

      if (user.getId().equals(spotInfo.getAdministratorId())) {
        authority = Authority.PRIVATE;
      }
    }
    List<SpotCharacteristic> scList = spotCharacteristicService.queryCharacteristicBySpotId(
        spotId, page, Activity.NORMAL);
View Full Code Here

  @RequestMapping(value = "/{spotId}/edit", method = RequestMethod.GET)
  public ModelAndView modifySpotRequest(@PathVariable("spotId") Long spotId) {
    User user = (User) WebHelper.getSessionAttribute(null, Constant.SESSION_USER);
    ModelAndView v = new ModelAndView(ViewPaths.USER_LOGIN);

    Spot spot = spotService.view(spotId);
    if (spot == null)
      return null;
    if(spot.getAdministratorId().equals(user.getId()))
    {
    v.setViewName(ViewPaths.SPOT_EDIT);
    v.addObject("spotInfo", spot);
    }
    return v;
View Full Code Here

        map.put("loginStatus", false);
        return map;
      }
      map.put("loginStatus", true);
      if (ratyService.isRaty(objId, user.getId())) {
        Spot spot = spotService.view(objId);

        map.put("SpotStar", spot.getStar());
        map.put("VoteNum", spot.getVotes());
        map.put("Raty_Tag", true);
        return map;
      }
      Spot spot = (Spot) ratyService.ratyStar(objId, RatyObjType.SPOT, user.getId(), star);
      map.put("Star", spot.getStar());
      map.put("VoteNum", spot.getVotes());
      return map;

    } catch (Exception e) {
      e.printStackTrace();
      return null;
View Full Code Here

   * @return
   ***************************************************************/
  @RequestMapping(value = "{spotId}/map", method = RequestMethod.GET)
  public ModelAndView viewMapRequest(@PathVariable("spotId") Long spotId) {
    ModelAndView v = new ModelAndView(ViewPaths.SPOT_MAP);
    Spot spotInfo = spotService.view(spotId);
    v.addObject("spotInfo", spotInfo);
    return v;
  }
View Full Code Here

  public static SpotMapper getMapper() {
    return MAPPER;
  }

  public Spot mapRow(ResultSet rs, int rowNum) throws SQLException {
    Spot s = new Spot();

    try {
      s.setId(rs.getLong(COLUMN_ID));
    } catch (Exception e) {

    }
    try {
      s.setName(rs.getString(COLUMN_NAME));
      s.setPortrait(rs.getString(COLUMN_PORTRAIT));
      s.setCategory(SpotType.valueOf(rs.getString(COLUMN_CATEGORY)));
    } catch (Exception e) {

    }
    try {
      s.setCreatorId(rs.getLong(COLUMN_CREATORID));
      s.setCreatorNickname(rs.getString(COLUMN_CREATORNICKNAME));
      s.setCreatorEmail(rs.getString(COLUMN_CREATOREMAIL));
      s.setCreatorPortrait(rs.getString(COLUMN_CREATORPORTRAIT));
    } catch (Exception e) {

    }
    try {
      s.setAdministratorId(rs.getLong(COLUMN_ADMINISTRATORID));
      s.setAdministratorNickname(rs
          .getString(COLUMN_ADMINISTRATORNICKNAME));
      s.setAdministratorEmail(rs.getString(COLUMN_ADMINISTRATOREMAIL));
      s.setAdministratorPortrait(rs
          .getString(COLUMN_ADMINISTRATORPORTRAIT));
    } catch (Exception e) {

    }
    try {
      s.setCountry(rs.getString(COLUMN_COUNTRY));
      s.setProvince(rs.getString(COLUMN_PROVINCE));
      s.setCity(rs.getString(COLUMN_CITY));
      s.setSiteId(rs.getString(COLUMN_SITE_ID));

      s.setDetailAddress(rs.getString(COLUMN_DETAILADDRESS));
    } catch (Exception e) {

    }
    try {
      s.setIntroduction(rs.getString(COLUMN_INTRODUCTION));
      s.setCreateTime(rs.getDate(COLUMN_CREATETIME));
      s.setUpdateTime(rs.getDate(COLUMN_UPDATETIME));
    } catch (Exception e) {

    }
    try {
      s.setLatitude(rs.getDouble(COLUMN_LATITUDE));
      s.setLongitude(rs.getDouble(COLUMN_LONGITUDE));
    //  s.setPosition(new Position(rs.getDouble(COLUMN_LATITUDE),rs.getDouble(COLUMN_LONGITUDE)));
    } catch (Exception e) {

    }
   
    try {
      s.setStar(rs.getFloat(COLUMN_STAR));
      s.setVotes(rs.getInt(COLUMN_VOTES));
    } catch (Exception e) {

    }
    s.setVisitNum(rs.getInt(COLUMN_VISTNUM));
    try {
      s.setActivity(Activity.valueOf((rs.getString(COLUMN_ACTIVITY))));
    } catch (Exception e) {

    }

    return s;
View Full Code Here

      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;

      SkylineImageCropTask cropTask = new SkylineImageCropTask(remoteFileKey, portraitSize);
      cropTask.setAlbumId(albumId);
      cropTask.setUserId(spotId);
      ImageCropResult cropResult = crop.processImage(basePath, cropTask);
      String portraitFile = cropResult.getFileKey();
      spotService.updateSpotPortrait(spotId, portraitFile);
     
      spot.setPortrait(portraitFile);
      //WebHelper.setSessionAttribute(request, Constant.SESSION_USER, user);

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

        Constant.SESSION_USER);
    ModelAndView mav = new ModelAndView();
    if (user == null) {
      throw new NotLoginException("上传照片必须登录");
    }
    Spot spot = spotService.getSpot(spotId);
    if (spot == null) {
      mav.setViewName(ViewPaths.SPOT_NOTFOUND);
      return mav;
    }
    Album album = new Album();
    album.setAlbumName(spot.getName());
    album.setPlace(spot.getCity());
    album.setDescription(spot.getName());
    album.setAuthority(Authority.PUBLIC);
    album = albumService.createAlbum(user, album);
    mav.addObject("album", album);
    mav.addObject("spotId", spot.getId());
    mav.setViewName(ViewPaths.SOPTREF_NEWALBUMREF);
    return mav;
  }
View Full Code Here

        Constant.SESSION_USER);
    if (user == null) {
      throw new NotLoginException("添加REF必须登录");
    }
    ModelAndView mav = new ModelAndView(ViewPaths.SPOTREF_NEWALBUMREFOK);
    Spot spot = spotService.getSpot(ownerId);
    if (spot == null) {
      mav.setViewName(ViewPaths.SPOT_NOTFOUND);
    }

    mav.addObject("spotInfo", spot);
View Full Code Here

        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;
    }
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.