Rev 7190 | Rev 9263 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
package in.shop2020.hotspot.dashbaord.shared.actions;import java.util.Date;import com.google.gwt.user.client.rpc.IsSerializable;public class Order implements IsSerializable{private static final long serialVersionUID = 5804421607858217477L;private static final long MS_IN_HOUR = 3600000;private long orderId;private long customerId;private String customerName;private String customerMobileNumber;private String customerPincode;private String customerAddress1;private String customerAddress2;private String customerCity;private String customerState;private String customerEmail;private long createdOn;private long shippedAt;private long verifiedAt;private long expectedDeliveryTime;private long promisedDeliveryTime;private long expectedShippingTime;private long promisedShippingTime;private long status;private String statusMessage;private String orderType;private long itemId;private long freebieItemId;private String productGroup;private String brand;private String modelName;private String modelNumber;private String color;private String extraInfo;private String dealText;private double quantity;private double totalAmount;private double totalWeight;private String airwayBillNo;private String billedBy;private String invoiceNumber;private long jacketNumber;private String itemNumber;private String serialNumber;private long batchNo;private long serialNo;private boolean doaFlag;private String pickupRequestNo;private boolean cod;private long pickupStoreId;private String delayReason;private String pickFromWarehouse;private boolean hasItemNumber;private long fulfilmentWarehouseId;private boolean serialized;private OrderAlert alert;private String source;@SuppressWarnings("unused")private Order(){}public Order(long orderId, long customerId, String customerName,String customerMobileNumber, String customerPincode,String customerAddress1, String customerAddress2, String customerCity, String customerState, String customerEmail, long createdOn,long shippedAt,long verifiedAt,long expectedDeliveryTime,long promisedDeliveryTime,long expectedShippingTime,long promisedShippingTime,long status, String statusMessage,String orderType, long itemId, String productGroup, String brand, String modelName,String modelNumber, String color, String extraInfo, String dealText, double quantity,double totalAmount, double totalWeight, String airwayBillNo, String billedBy,String invoiceNumber, long jacketNumber, String itemNumber,String serialNumber, long batchNo, long serialNo,boolean doaFlag, String pickupRequestNo, boolean cod, String delayReason,String pickFromWarehouse, boolean serialized, boolean hasItemNumber, long fulfilmentWarehouseId, long pickupStoreId, long freebieItemId, String source) {super();this.orderId = orderId;this.customerId = customerId;this.customerName = customerName;this.customerMobileNumber = customerMobileNumber;this.customerPincode = customerPincode;this.customerAddress1 = customerAddress1;this.customerAddress2 = customerAddress2;this.customerCity = customerCity;this.customerState = customerState;this.customerEmail = customerEmail;this.createdOn = createdOn;this.shippedAt = shippedAt;this.verifiedAt = verifiedAt;this.expectedDeliveryTime = expectedDeliveryTime;this.promisedDeliveryTime = promisedDeliveryTime;this.expectedShippingTime = expectedShippingTime;this.promisedShippingTime = promisedShippingTime;this.status = status;this.statusMessage = statusMessage;this.orderType = orderType;this.itemId = itemId;this.productGroup = productGroup;this.brand = brand;this.modelName = modelName;this.modelNumber = modelNumber;this.color = color;this.extraInfo = extraInfo;this.dealText = dealText;this.setQuantity(quantity);this.totalAmount = totalAmount;this.totalWeight = totalWeight;this.airwayBillNo = airwayBillNo;this.billedBy = billedBy;this.invoiceNumber = invoiceNumber;this.jacketNumber = jacketNumber;this.itemNumber = itemNumber;this.serialNumber = serialNumber;this.batchNo = batchNo;this.serialNo = serialNo;this.doaFlag = doaFlag;this.pickupRequestNo = pickupRequestNo;this.cod = cod;this.delayReason = delayReason;this.pickFromWarehouse = pickFromWarehouse;this.serialized = serialized;this.hasItemNumber = hasItemNumber;this.fulfilmentWarehouseId = fulfilmentWarehouseId;this.setPickupStoreId(pickupStoreId);this.freebieItemId = freebieItemId;this.source = source;checkForAlerts();}private void checkForAlerts(){this.alert = OrderAlert.NONE;Date date = new Date();long currentTime = date.getTime();if(this.expectedDeliveryTime <= currentTime && this.status < 12){//Orders whose delivery dates have passed but which are not yet deliveredthis.alert = OrderAlert.DELIVERY_TIME_EXCEEDED;return;}if(this.expectedShippingTime <= currentTime && this.status < 9){//Orders whose expected shipping dates have passed but which have not been shipped yetthis.alert = OrderAlert.SHIPPING_TIME_EXCEEDED;return;}if(this.createdOn <= currentTime - 2 * MS_IN_HOUR && this.status == 3 && !this.cod){//A prepaid order has neither been accepted nor marked out of stock after 2 hours of order creationthis.alert = OrderAlert.ACCEPTANCE_DELAYED_TOO_MUCH;return;}if(this.verifiedAt <= currentTime - 2 * MS_IN_HOUR && this.status == 3 && this.cod){//A COD order has neither been accepted nor marked out of stock after 2 hours of order verificationthis.alert = OrderAlert.ACCEPTANCE_DELAYED_TOO_MUCH;return;}if(this.shippedAt <= currentTime - 27 * MS_IN_HOUR && this.status == 9){//A shipped order has not been picked up even after 6 hours of pickup mismatch being reportedthis.alert = OrderAlert.ORDER_NOT_CONNECTED_FOR_TOO_LONG;return;}if(this.cod && this.status == 2 && this.createdOn <= currentTime - MS_IN_HOUR){//A COD order has not been verified for an hourthis.alert = OrderAlert.VERIFICATION_DELAYED;return;}if(this.createdOn <= currentTime - MS_IN_HOUR && this.status == 3 && !this.cod){//A prepaid order has neither been accepted nor marked out of stock after 1 hour of order creationthis.alert = OrderAlert.ACCEPTANCE_DELAYED;return;}if(this.verifiedAt <= currentTime - MS_IN_HOUR && this.status == 3 && this.cod){//A COD order has neither been accepted nor marked out of stock after an hour of order verificationthis.alert = OrderAlert.ACCEPTANCE_DELAYED;return;}if(this.status == 9 && this.shippedAt <= currentTime - 20 * MS_IN_HOUR){//A shipped order has not been picked upthis.alert = OrderAlert.ORDER_NOT_CONNECTED;return;}}public long getCustomerId() {return customerId;}public long getCreatedOn() {return createdOn;}public long getExpectedDeliveryTime() {return expectedDeliveryTime;}public long getPromisedDeliveryTime() {return promisedDeliveryTime;}public void setStatusMessage(String message){this.statusMessage = message;}public String getStatusMessage() {return statusMessage;}public void setOrderId(long orderId) {this.orderId = orderId;}public long getOrderId() {return orderId;}public void setCustomerName(String customerName) {this.customerName = customerName;}public String getCustomerName() {return customerName;}public void setCustomerMobileNumber(String customerMobileNumber) {this.customerMobileNumber = customerMobileNumber;}public String getCustomerMobileNumber() {return customerMobileNumber;}public void setCustomerPincode(String customerPincode) {this.customerPincode = customerPincode;}public String getCustomerPincode() {return customerPincode;}public void setCustomerEmail(String customerEmail) {this.customerEmail = customerEmail;}public String getCustomerEmail() {return customerEmail;}public void setCustomerAddress1(String customerAddress) {this.customerAddress1 = customerAddress;}public String getCustomerAddress1() {return customerAddress1;}public void setCustomerAddress2(String customerAddress2) {this.customerAddress2 = customerAddress2;}public String getCustomerAddress2() {return customerAddress2;}public String getCustomerCity() {return customerCity;}public void setCustomerCity(String customerCity) {this.customerCity = customerCity;}public String getCustomerState() {return customerState;}public void setCustomerState(String customerState) {this.customerState = customerState;}public void setModelName(String modelName) {this.modelName = modelName;}public String getModelName() {return modelName;}public void setTotalWeight(double totalWeight) {this.totalWeight = totalWeight;}public double getTotalWeight() {return totalWeight;}public void setTotalAmount(double totalAmount) {this.totalAmount = totalAmount;}public double getTotalAmount() {return totalAmount;}public void setItemId(long itemId) {this.itemId = itemId;}public long getItemId() {return itemId;}public void setProductGroup(String productGroup) {this.productGroup = productGroup;}public String getProductGroup() {return productGroup;}public void setBrand(String brand) {this.brand = brand;}public String getBrand() {return brand;}public void setModelNumber(String modelNumber) {this.modelNumber = modelNumber;}public String getModelNumber() {return modelNumber;}public String getColor() {return color;}public void setColor(String color) {this.color = color;}public void setExtraInfo(String extraInfo) {this.extraInfo = extraInfo;}public String getExtraInfo() {return extraInfo;}public void setStatus(long status) {this.status = status;}public long getStatus() {return status;}public void setAirwayBillNo(String airwayBillNo) {this.airwayBillNo = airwayBillNo;}public String getAirwayBillNo() {return airwayBillNo;}public void setBilledBy(String billedBy) {this.billedBy = billedBy;}public String getBilledBy() {return billedBy;}public void setInvoiceNumber(String invoiceNumber) {this.invoiceNumber = invoiceNumber;}public String getInvoiceNumber() {return invoiceNumber;}public long getJacketNumber() {return jacketNumber;}public void setJacketNumber(long jacketNumber) {this.jacketNumber = jacketNumber;}public void setItemNumber(String itemNumber) {this.itemNumber = itemNumber;}public String getItemNumber() {return itemNumber;}public void setImeiNumber(String imeiNumber) {this.serialNumber = imeiNumber;}public String getImeiNumber() {return serialNumber;}public long getBatchNo() {return batchNo;}public void setBatchNo(long batchNo) {this.batchNo = batchNo;}public long getSerialNo() {return serialNo;}public void setSerialNo(long serialNo) {this.serialNo = serialNo;}public void setDoaFlag(boolean doaFlag) {this.doaFlag = doaFlag;}public boolean isDoaFlag() {return doaFlag;}public void setPickupRequestNo(String pickupRequestNo) {this.pickupRequestNo = pickupRequestNo;}public String getPickupRequestNo() {return pickupRequestNo;}public boolean isCod() {return cod;}public String getDelayReason() {return delayReason;}public void setAlert(OrderAlert alert) {this.alert = alert;}public OrderAlert getAlert() {return alert;}public String getDealText() {return dealText;}public void setDealText(String dealText) {this.dealText = dealText;}public void setPromisedShippingTime(long promisedShippingTime) {this.promisedShippingTime = promisedShippingTime;}public long getPromisedShippingTime() {return promisedShippingTime;}public String getPickFromWarehouse() {return pickFromWarehouse;}public void setPickFromWarehouse(String pickFromWarehouse) {this.pickFromWarehouse = pickFromWarehouse;}public boolean isSerialized() {return serialized;}public void setSerialized(boolean serialized) {this.serialized = serialized;}public long getFulfilmentWarehouseId() {return fulfilmentWarehouseId;}public void setFulfilmentWarehouseId(long fulfilmentWarehouseId) {this.fulfilmentWarehouseId = fulfilmentWarehouseId;}public void setQuantity(double quantity) {this.quantity = quantity;}public double getQuantity() {return quantity;}public boolean isHasItemNumber() {return hasItemNumber;}public void setHasItemNumber(boolean hasItemNumber) {this.hasItemNumber = hasItemNumber;}public String getOrderType() {return orderType;}public void setOrderType(String orderType) {this.orderType = orderType;}public void setPickupStoreId(long pickupStoreId) {this.pickupStoreId = pickupStoreId;}public long getPickupStoreId() {return pickupStoreId;}public long getFreebieItemId() {return freebieItemId;}public void setFreebieItemId(long freebieItemId) {this.freebieItemId = freebieItemId;}public String getSource(){return this.source;}}