Advertisement
Guest User

Untitled

a guest
Jul 27th, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.42 KB | None | 0 0
  1. package models.OnlineOrdering;
  2.  
  3. import models.CRM.Member;
  4. import com.avaje.ebean.Model;
  5. import models.Infrastructure.User;
  6. import com.fasterxml.jackson.databind.JsonNode;
  7. import com.fasterxml.jackson.databind.node.ArrayNode;
  8. import com.fasterxml.jackson.databind.node.ObjectNode;
  9. import play.libs.Json;
  10. import javax.persistence.CascadeType;
  11. import javax.persistence.*;
  12. import java.util.*;
  13.  
  14. /**
  15. * Created by FruitTec on 26/6/17.
  16. */
  17. @Entity
  18. public class Meal extends Model {
  19. @Id
  20. private long id;
  21.  
  22. private Date submittedTime;
  23. private Date reservationTime;
  24. private Date finishTime;
  25.  
  26. private int tax = 0;
  27. private int serviceCharge = 0;
  28. private int discount = 0;
  29. private int discountRate = 0;
  30. private int rebate = 0;
  31. private int subtotal = 0;
  32. private int totalPrice = 0;
  33.  
  34. @ManyToMany(cascade = CascadeType.ALL)
  35. private List<Member> customerList;
  36. @OneToMany(cascade = CascadeType.ALL)
  37. private List<DishOrder> dishOrderList;
  38. private int customerCount = 0;
  39. private long outletId;
  40.  
  41. private String status;
  42. private boolean paid;
  43. private String paymentId;
  44.  
  45. private String message;
  46. private String rejectionMsg;
  47. private long promoCodeId;
  48.  
  49.  
  50. public final static String IN_CART = "IN_CART";
  51. public final static String CANCELED = "CANCELED";
  52. public final static String SUBMITTED = "SUBMITTED";
  53. public final static String CONFIRMED = "CONFIRMED";
  54. public final static String COMPLETED = "COMPLETED";
  55. public final static String LOCK_DOWN = "LOCK_DOWN";
  56.  
  57. public static Finder<Long, Meal> find = new Finder<Long, Meal>(Long.class, Meal.class);
  58. public long getId() {
  59. return id;
  60. }
  61.  
  62. public void setId(long id) {
  63. this.id = id;
  64. }
  65.  
  66. public Date getSubmittedTime() {
  67. return submittedTime;
  68. }
  69.  
  70. public void setSubmittedTime(Date submittedTime) {
  71. this.submittedTime = submittedTime;
  72. }
  73.  
  74. public Date getReservationTime() {
  75. return reservationTime;
  76. }
  77.  
  78. public void setReservationTime(Date reservationTime) {
  79. this.reservationTime = reservationTime;
  80. }
  81.  
  82. public Date getFinishTime() {
  83. return finishTime;
  84. }
  85.  
  86. public void setFinishTime(Date finishTime) {
  87. this.finishTime = finishTime;
  88. }
  89.  
  90. public int getTax() {
  91. return tax;
  92. }
  93.  
  94. public void setTax(int tax) {
  95. this.tax = tax;
  96. }
  97.  
  98. public int getServiceCharge() {
  99. return serviceCharge;
  100. }
  101.  
  102. public void setServiceCharge(int serviceCharge) {
  103. this.serviceCharge = serviceCharge;
  104. }
  105.  
  106. public int getDiscount() {
  107. return discount;
  108. }
  109.  
  110. public void setDiscount(int discount) {
  111. this.discount = discount;
  112. }
  113.  
  114. public int getDiscountRate() {
  115. return discountRate;
  116. }
  117.  
  118. public void setDiscountRate(int discountRate) {
  119. this.discountRate = discountRate;
  120. }
  121.  
  122. public int getRebate() {
  123. return rebate;
  124. }
  125.  
  126. public void setRebate(int rebate) {
  127. this.rebate = rebate;
  128. }
  129.  
  130. public int getSubtotal() {
  131. return subtotal;
  132. }
  133.  
  134. public void setSubtotal(int subtotal) {
  135. this.subtotal = subtotal;
  136. }
  137.  
  138. public int getTotalPrice() {
  139. return totalPrice;
  140. }
  141.  
  142. public void setTotalPrice(int totalPrice) {
  143. this.totalPrice = totalPrice;
  144. }
  145.  
  146. public List<User> getCustomerList() {
  147. return customerList;
  148. }
  149.  
  150. public void setCustomerList(List<User> customerList) {
  151. this.customerList = customerList;
  152. }
  153.  
  154. public List<DishOrder> getDishOrderList() {
  155. return dishOrderList;
  156. }
  157.  
  158. public void setDishOrderList(List<DishOrder> dishOrderList) {
  159. this.dishOrderList = dishOrderList;
  160. }
  161.  
  162. public int getCustomerCount() {
  163. return customerCount;
  164. }
  165.  
  166. public void setCustomerCount(int customerCount) {
  167. this.customerCount = customerCount;
  168. }
  169.  
  170. public long getOutletId() {
  171. return outletId;
  172. }
  173.  
  174. public void setOutletId(long outletId) {
  175. this.outletId = outletId;
  176. }
  177.  
  178. public String getStatus() {
  179. return status;
  180. }
  181.  
  182. public void setStatus(String status) {
  183. this.status = status;
  184. }
  185.  
  186. public boolean isPaid() {
  187. return paid;
  188. }
  189.  
  190. public void setPaid(boolean paid) {
  191. this.paid = paid;
  192. }
  193.  
  194. public String getPaymentId() {
  195. return paymentId;
  196. }
  197.  
  198. public void setPaymentId(String paymentId) {
  199. this.paymentId = paymentId;
  200. }
  201.  
  202. public String getMessage() {
  203. return message;
  204. }
  205.  
  206. public void setMessage(String message) {
  207. this.message = message;
  208. }
  209.  
  210. public String getRejectionMsg() {
  211. return rejectionMsg;
  212. }
  213.  
  214. public void setRejectionMsg(String rejectionMsg) {
  215. this.rejectionMsg = rejectionMsg;
  216. }
  217.  
  218. public long getPromoCodeId() {
  219. return promoCodeId;
  220. }
  221.  
  222. public void setPromoCodeId(long promoCodeId) {
  223. this.promoCodeId = promoCodeId;
  224. }
  225.  
  226. public JsonNode getJSON(){
  227. Map<String,Object> node = new HashMap<>();
  228.  
  229. node.put("id", id);
  230. node.put("tax", tax);
  231. node.put("totalPrice", totalPrice);
  232. node.put("customerCount", customerCount);
  233. ArrayNode memberArray = Json.newArray();
  234. for (Member member : customerList){
  235. memberArray.add(member.getJSON());
  236. }
  237. ArrayNode dishOrderArray = Json.newArray();
  238. for (DishOrder dishOrder : dishOrderList){
  239.  
  240. }
  241. return Json.toJson(node);
  242. }
  243. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement