/** * @author bian.chengde 获取房型 * @param request * @return 2015-10-19 */ @PolicyJournal(accessLevel = AccessLevel.PUBLIC) @ResponseBody @RequestMapping("/to_roomType_query") public Response to_roomType_query(HttpServletRequest request, String hotelId) { Response res = new Response(); List<Map<String, Object>> roomList = hotelRoomService.selectRoomByHotelId(hotelId); res.setRtData(roomList); return res; }
/** * 查询生成单个房型日历价格方法 * * @author chivalry * @param request * @return 2015-10-13 */ @SuppressWarnings("rawtypes") @PolicyJournal(accessLevel = AccessLevel.PRIVATE) @RequestMapping( value = "/to_hotelRoomPrice_add", method = {RequestMethod.POST}) @ResponseBody public Response to_hotelRoomPrice_add( HttpServletRequest request, String hotelNameId, String hotelRoomId, String selectdate) { // 返回对象 Response response = new Response(); LoginUser user = LoginSessionUtil.getSystemSession(request); // 根据roomId查询room的默认价格 Map<String, Object> roomMap = this.hotelRoomService.selectHotelRoomByPk(hotelRoomId); String defaultPrice = "1000.00"; if (null != roomMap) { if (roomMap.get("price") != null) { defaultPrice = roomMap.get("price").toString(); } } // 设置客房日历信息并批量插入数据 List<HotelRoomCalendarBo> hotelRoomCalendarList = new ArrayList<HotelRoomCalendarBo>(); HotelRoomCalendarBo hotelRoomCalendar = new HotelRoomCalendarBo(); hotelRoomCalendar.setHotelId(hotelNameId); hotelRoomCalendar.setRoomId(hotelRoomId); hotelRoomCalendar.setRoomPrice(defaultPrice); int results = 1; hotelRoomCalendar.setCalendarDate(selectdate); // 先查询该日期下房型是否存在价格 List<Map<String, Object>> roomPriceList = this.hotelRoomCalendarService.selectRoomPriceListByExample(hotelRoomCalendar); Map<String, Object> map = new HashMap<String, Object>(); if (roomPriceList.size() == 0) { // 不存在价格日历插入数据 // results=this.hotelRoomCalendarService.insertHotelRoomCalendar(hotelRoomCalendar); hotelRoomCalendar.setUserbaseId(user.getId().toString()); hotelRoomCalendarList.add(hotelRoomCalendar); if (hotelRoomCalendarList != null && hotelRoomCalendarList.size() > 0 && hotelRoomCalendarList.get(0).getCalendarDate() != null && hotelRoomCalendarList.get(0).getCalendarDate() != "") { results = this.hotelRoomCalendarService.insertHotelRoomCalendar(hotelRoomCalendarList); } map.put("roomPrice", hotelRoomCalendar.getRoomPrice()); } else { // 存在读取价格 map.put("roomPrice", roomPriceList.get(0).get("roomPrice")); } if (results >= 1) { response.setSucceessMessage("执行成功"); response.setRtData(map); } else { response.setFailMessage("读取价格失败"); } return response; }
@SuppressWarnings("rawtypes") @PolicyJournal(accessLevel = AccessLevel.PRIVATE) @RequestMapping( value = "/getHotelRoomPriceByRoomId", method = {RequestMethod.POST}) @ResponseBody public Response testJson( HttpServletRequest request, String roomId, HotelRoomCalendarBo hotelRoomCalendar) { // 返回对象 Response response = new Response(); // System.out.println("****************"+hotelRoomCalendar.getRoomPrice()+"/"+hotelRoomCalendar.getStartTime()+"/"+hotelRoomCalendar.getEndTime()); /*hotelRoomCalendar.setRoomId(roomId); hotelRoomCalendar.setStartTime("2015-11-01"); hotelRoomCalendar.setEndTime("2015-11-30");*/ List<Map<String, Object>> list = this.hotelRoomCalendarService.selectRoomPriceListByExample(hotelRoomCalendar); for (int i = 0; i < list.size(); i++) { list.get(i).put("date", list.get(i).get("calendarDate").toString()); // System.out.println("*********"+Double.parseDouble(list.get(i).get("roomPrice").toString())); } response.setRtData(list); return response; }