/** * 房间优先展示 * * @param roomCode * @return */ public String priorityRoom(Integer roomCode) { Room room = houseAndRoomMapper.selectRoomByCode(roomCode); String isPromotions = room.getIsPromotions(); if (isPromotions.equals("N")) { // 验证房屋中存在优先展示的房间数量 int promotionsNum = houseAndRoomMapper.countPromotionsRoomNum(room.getSysHouseId()); if (promotionsNum != 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.countPromotions(user.getStaffid()); if (num >= 3) { return "对多只能优先展示3个房间!"; } room.setIsPromotions("Y"); } } else { room.setIsPromotions("N"); } // 更新房间推荐状态 houseAndRoomMapper.updateRoom(room); return "success"; }
/** * 房间推荐 * * @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 house * @return */ public String searchHouse(House house) { User user = (User) SessionManager.getAttr(SessionManager.USER_KEY); if (user.getSetidJobcode() != null && user.getSetidJobcode().equals("专员")) { house.setStaffid(user.getStaffid()); } else if (user.getSetidJobcode() != null && user.getSetidJobcode().equals("主管")) { house.setDepartName(user.getDeptCode()); } else { house.setDepartName(user.getDeptCode()); } if (house.getR1() != null && !house.getR1().equals("")) { User u = new User(); u.setStaffid(house.getR1()); u = houseAndRoomMapper.selectByStaff(u); house.setR1(u.getDeptCode()); } return GeneralUtils.easyUI( houseAndRoomMapper.countHouse(house), houseAndRoomMapper.searchHouseList(house)); }