Ejemplo n.º 1
0
  /*
   * Process the cancelled orders
   *
   * @see
   * com.ecommerce.econcierge.service.XeroxService#processCancelledOrders()
   */
  @LogIt
  public void processCancelledOrders() throws XeroxServiceException {
    try {
      // Get all cancelled orders
      List<CancelledOrderModel> cancelledOrders = xeroxDao.getCancelledOrders();
      if (cancelledOrders != null) {
        OrderStatusModel orderStatus;
        for (CancelledOrderModel order : cancelledOrders) {
          // perform push
          xeroxWs.pushCancelOrder(order);

          orderStatus = new OrderStatusModel();
          orderStatus.setSentStatus(OrderStatusModel.ALREADY_SENT_STATUS);
          // update sent status
          xeroxDao.updateSentStatus(orderStatus);
        }
      } else {
        logger.info("No cancelled orders to process.");
      }
    } catch (XeroxDataAccessException e) {
      throw new XeroxServiceException(e);
    } catch (XeroxWebServiceException e) {
      throw new XeroxServiceException(e);
    }
  }
Ejemplo n.º 2
0
  /*
   * Process the for shipment notification
   *
   * @see
   * com.ecommerce.econcierge.service.XeroxService#processShipmentNotification
   * ()
   */
  @LogIt
  public void processShipmentNotification() throws XeroxServiceException {
    try {
      // Get all notified shipments
      List<NotifiedShipmentOrderModel> notifiedShipmentOrders =
          xeroxDao.getNotifiedShipmentOrders();
      if (notifiedShipmentOrders != null) {
        OrderStatusModel orderStatus;
        for (NotifiedShipmentOrderModel order : notifiedShipmentOrders) {
          // set shipment tracking url
          order.setShipmentTrackingURL(getShipmentTrackingUrl(order.getShipmentTrackingNumber()));

          // perform push
          xeroxWs.pushNotifyShipment(order);

          // update order status if all ship
          if (isAllShip(order.getShipmentStatus())) {
            orderStatus = new OrderStatusModel();
            orderStatus.setNpOrderNumber(order.getNpOrderNumber());
            orderStatus.setTbOrderNumber(order.getNpOrderNumber());
            orderStatus.setStopShippingNotification(OrderStatusModel.STOP_SHIPPING_STATUS);
            xeroxDao.updateStopShippingNotification(orderStatus);
          }
        }
      } else {
        logger.info("No shipment notifications to process.");
      }
    } catch (XeroxDataAccessException e) {
      throw new XeroxServiceException(e);
    } catch (XeroxWebServiceException e) {
      throw new XeroxServiceException(e);
    }
  }