public OrderVO getOrderVO(TbBizOrderBO bo) { OrderVO vo = new OrderVO(); vo.setOrderid(bo.getOrderId()); vo.setTravelDate(bo.getTravelDate().toString()); vo.setContactName(bo.getContactPersonName()); vo.setContactNumber(bo.getContactNumber()); vo.setContactEmail(bo.getContactEmail()); vo.setContactGender(bo.getContactPersonGenderCd()); vo.setcTime(bo.getCreateTime()); vo.setPrice(bo.getPrice()); vo.setStatus(bo.getOrderStatusCd()); vo.setType(bo.getTourTypeCd()); vo.setUserId(bo.getCreateUser().getUserId()); vo.setNumOfAdult(bo.getAdultsCount()); vo.setNumOfChild(bo.getChildrenCount()); vo.setRemarks(bo.getRemarks()); if (bo.getPayments().size() != 0) { System.out.println(bo.getPayments().iterator().next().getPaymentId()); vo.setPaymentExist(true); } else { vo.setPaymentExist(false); } DetailVO dvo = getDetailVO(bo.getRouteDetail()); vo.setDetail(dvo); TbBizRouteBO oneroute = bo.getRouteDetail().getRoute(); RouteVO route = new RouteVO(); route.setRouteid(oneroute.getRouteId()); route.setName(oneroute.getRouteName()); route.setDes(oneroute.getDescription()); dvo.setInfo(route); return vo; }
public RouteVO getRouteDetail(TbBizRouteBO oneroute) { RouteVO route = new RouteVO(); TbBizRouteTypeBO routeTypeBO = oneroute.getRouteType(); RouteTypeVO routeType = new RouteTypeVO(); routeType.setRouteTypeId(routeTypeBO.getRouteTypeId()); routeType.setDescrition(routeTypeBO.getDescrition()); routeType.setRouteName(routeTypeBO.getRouteName()); route.setRouteid(oneroute.getRouteId()); route.setName(oneroute.getRouteName()); route.setDes(oneroute.getDescription()); route.setcTime(oneroute.getCreateTime()); route.seteTime(oneroute.getUpdateTime()); route.setStatus(oneroute.getRouteStatusCd()); route.setThemeImageUrl(oneroute.getThemeImage()); route.setRoutetype(routeType.getRouteTypeId()); List<NodeVO> ns = new ArrayList<NodeVO>(); Set<TbBizRouteNodeBO> nodes = oneroute.getRouteNodes(); for (Iterator<TbBizRouteNodeBO> nodeiterator = nodes.iterator(); nodeiterator.hasNext(); ) { TbBizRouteNodeBO day = nodeiterator.next(); NodeVO node = new NodeVO(); node.setName(day.getNodeName()); node.setDescription(day.getDescription()); node.setAccommodation(day.getAccommodation()); node.setKeywords(day.getKeywords()); node.setSequence(day.getSequentialNum()); node.setIpath(day.getImageUrl()); ns.add(node); } List<DetailVO> ds = new ArrayList<DetailVO>(); SortByday sort = new SortByday(); Collections.sort(ns, sort); String days = ""; List<String> cars = new ArrayList<String>(); Set<TbBizRouteDetailBO> details = oneroute.getDetails(); for (TbBizRouteDetailBO o : details) { days = o.getDayOfWeek(); break; } for (Iterator<TbBizRouteDetailBO> detailiterator = details.iterator(); detailiterator.hasNext(); ) { TbBizRouteDetailBO detail = detailiterator.next(); DetailVO detailVO = getDetailVO(detail); ds.add(detailVO); } route.setNodes(ns); route.setDetails(ds); String[] dayofweek = days.split(""); route.setDayofweek(dayofweek); String[] car = new String[cars.size()]; // route.setCars(cars.toArray(car)); HostelVO vo = getHostel(oneroute.getHostel()); route.setHotel(vo); return route; }