public List<BabysitterView> getPanicBabysitters(String serviceOrderId) { long serviceOrderIdl = Long.valueOf(serviceOrderId); String hql = "from PanicBuyingOrder t where t.ovld = true and t.serviceOrder.id = ? and t.serviceOrder.orderGuid is null"; List<PanicBuyingOrder> orders = dao.getListResultByHQL(PanicBuyingOrder.class, hql, serviceOrderIdl); List<BabysitterView> views = new ArrayList<BabysitterView>(); for (PanicBuyingOrder order : orders) { views.add(order.getBabysitter().view()); } return views; }
@Transactional public void addServiceOrderPanic(String babysitterId, String serviceOrderId) { long babysitterIdl = Long.valueOf(babysitterId); long serviceOrderIdl = Long.valueOf(serviceOrderId); Babysitter babysitter = dao.getResultById(Babysitter.class, babysitterIdl); ServiceOrder order = dao.getResultById(ServiceOrder.class, serviceOrderIdl); if (order != null) { PanicBuyingOrder buyingOrder = PanicBuyingOrder.getInstance(); buyingOrder.setBabysitter(babysitter); buyingOrder.setServiceOrder(order); dao.add(buyingOrder); } }