public String renderOrder(OrderVO order, User user, List<DishGroup> dishGroups, String template) { VelocityContext context = new VelocityContext(); context.put("dishGroups", dishGroups); context.put("order", order); context.put("table", order.getTable()); context.put("time", utils.formatDate(order.getUpdateTime())); String userName = user.getRealName(); if (userName == null) { userName = ""; } context.put("userName", userName); return render(context, template); }
public String renderBill( Bill bill, Vip vip, User user, List<DishGroup> dishGroups, List<RecordVO> cancelRecord, List<RecordVO> addRecord, String template) { VelocityContext context = new VelocityContext(); context.put("bill", bill); context.put("dishGroups", dishGroups); context.put("order", bill.getOrder()); context.put("table", bill.getOrder().getTable()); context.put("cancelrecord", cancelRecord); context.put("addrecord", addRecord); context.put("time", utils.formatDate(bill.getCreatedTime())); context.put("coupons", bill.getCoupons()); context.put("vipusage", 0); context.put("vipid", vip.getId()); context.put("vipleft", vip.getMoney()); String userName = user.getRealName(); if (userName == null) { userName = ""; } context.put("userName", userName); int payType = bill.getPayType(); String payTypeString = null; switch (payType) { case 1: payTypeString = "现金"; break; case 2: payTypeString = "刷卡"; break; case 3: payTypeString = "会员卡"; break; case 4: payTypeString = "签单"; break; default: payTypeString = "现金"; break; } context.put("paytype", payTypeString); return render(context, template); }