/**
   * 房间推荐
   *
   * @param roomCode
   * @return
   */
  public String recommendRoom(Integer roomCode) {

    Room room = houseAndRoomMapper.selectRoomByCode(roomCode);
    String isTop = room.getIsTop();
    if (isTop.equals("N")) {
      // 验证房屋中存在推荐的房间数量
      int topNum = houseAndRoomMapper.countTopRoomNum(room.getSysHouseId());
      if (topNum != 0) {
        return "一个房屋只能推荐一个房源!";
      }
      // 验证已经推荐的房源数量
      User user = (User) SessionManager.getAttr(SessionManager.USER_KEY);
      if (user.getSetidJobcode() != null
          && (user.getSetidJobcode().equals("主管")
              || user.getSetidJobcode().equals("总监")
              || user.getSetidJobcode().equals("副总经理"))) {
        int num = houseAndRoomMapper.countTop(user.getStaffid());
        if (num >= 3) {
          return "对多只能推荐3个房间!";
        }
        room.setIsTop("Y");
      }
    } else {
      room.setIsTop("N");
    }

    // 更新房间推荐状态
    houseAndRoomMapper.updateRoom(room);

    return "success";
  }
 /**
  * 房间发布功能
  *
  * @param roomCode
  */
 public void pubRoom(Room r) {
   // 房间编号查询房间
   Room room = houseAndRoomMapper.selectRoomByCode(r.getSysRoomId());
   // 房间发布状态变更
   if (room != null) {
     if (room.getIsShow().equals("Y")) {
       room.setIsShow("N");
       room.setIsPromotions("N");
       room.setIsTop("N");
       room.setCkd("1");
       room.setCheckInTime(null);
     } else if (room.getIsShow().equals("N")) {
       room.setIsShow("Y");
       room.setCkd("1");
       if (r.getCheckInTime() != null) {
         room.setCheckInTime(r.getCheckInTime());
       }
     }
   }
   houseAndRoomMapper.updateRoom(room);
   // 获得房屋房间数量及发布房间数量
   int countRoom = houseAndRoomMapper.countRoom(room.getSysHouseId());
   int countPubRoom = houseAndRoomMapper.countPubRoom(room);
   if (countRoom == countPubRoom) {
     House h = new House();
     h.setSysHouseId(room.getSysHouseId());
     h.setIsShow(room.getIsShow());
     houseAndRoomMapper.updateHouse(h);
   }
 }
 /**
  * 房屋发布业务处理方法
  *
  * @param houseCode
  */
 public void pubHouse(House house) {
   House h = houseAndRoomMapper.selectHouseByCode(house.getSysHouseId());
   if (h != null) {
     Room r = new Room();
     r.setSysHouseId(h.getSysHouseId());
     // 根据房屋状态设置房屋发布情况
     if (h.getIsShow().equals("N")) {
       h.setIsShow("Y");
       h.setCkd("1");
       h.setCheckInTime(house.getCheckInTime());
       // 房屋设置"发布"状态,房间中除了已出租的房间外都更新为发布状态。
       r.setIsShow("Y");
       r.setCkd("1");
       r.setCheckInTime(house.getCheckInTime());
     } else if (h.getIsShow().equals("Y")) {
       h.setIsShow("N");
       h.setCkd("1");
       h.setCheckInTime(null);
       // 如果房屋"取消发布"状态,房间状态全部更改为"不发布"。
       r.setIsShow("N");
       r.setIsPromotions("N");
       r.setIsTop("N");
       r.setCkd("1");
       r.setCheckInTime(null);
     }
     houseAndRoomMapper.updateRoomByHouseCode(r);
     houseAndRoomMapper.updateHouse(h);
   }
 }