Package com.jada.jpa.entity

Examples of com.jada.jpa.entity.ShippingRateCurrency


          jsonShippingRate.put("shippingAdditionalRatePercentage", "");
          JSONEscapeObject.put(shippingRegions[j].getShippingRegionId().toString(), jsonShippingRate);
        }
        if (!form.isSiteCurrencyClassDefault()) {
          if (shippingRate != null) {
            ShippingRateCurrency shippingRateCurrency = new ShippingRateCurrency();
            for (ShippingRateCurrency srCurrency : shippingRate.getShippingRateCurrencies()) {
              if (srCurrency.getSiteCurrencyClass().getSiteCurrencyClassId().equals(form.getSiteCurrencyClassId())) {
                shippingRateCurrency = srCurrency;
                break;
              }
            }
            if (shippingRateCurrency.getShippingRateFee() != null) {
              jsonShippingRate.put("shippingRateFeeCurr", Format.getFloat(shippingRateCurrency.getShippingRateFee()));
              jsonShippingRate.put("shippingRateFeeCurrFlag", true);
            }
            else {
              jsonShippingRate.put("shippingRateFeeCurr", "");
              jsonShippingRate.put("shippingRateFeeCurrFlag", false);
            }
            if (shippingRateCurrency.getShippingAdditionalRateFee() != null) {
              jsonShippingRate.put("shippingAdditionalRateFeeCurr", Format.getFloat(shippingRateCurrency.getShippingAdditionalRateFee()));
              jsonShippingRate.put("shippingAdditionalRateFeeCurrFlag", true);
            }
            else {
              jsonShippingRate.put("shippingAdditionalRateFeeCurr", "");
              jsonShippingRate.put("shippingAdditionalRateFeeCurrFlag", false);
View Full Code Here


            }
          }
        }
      }
    }
    ShippingRateCurrency shippingRateCurrency = new ShippingRateCurrency();
    if (shippingRate.getShippingRateCurrency() != null) {
      shippingRateCurrency = shippingRate.getShippingRateCurrency();
    }
    if (shippingRateCurrency.getShippingRateFee() != null) {
      jsonRate.put("shippingRateFee", Format.getFloat(shippingRate.getShippingRateCurrency().getShippingRateFee()));
    }
    else {
      jsonRate.put("shippingRateFee", "");
    }
    if (shippingRate.getShippingRatePercentage() != null) {
      jsonRate.put("shippingRatePercentage", Format.getFloat(shippingRate.getShippingRatePercentage()));
    }
    else {
      jsonRate.put("shippingRatePercentage", "");
    }
    if (shippingRateCurrency.getShippingAdditionalRateFee() != null) {
      jsonRate.put("shippingAdditionalRateFee", Format.getFloat(shippingRate.getShippingRateCurrency().getShippingAdditionalRateFee()));
    }
    else {
      jsonRate.put("shippingAdditionalRateFee", "");
    }
    if (shippingRate.getShippingAdditionalRatePercentage() != null) {
      jsonRate.put("shippingAdditionalRatePercentage", Format.getFloat(shippingRate.getShippingAdditionalRatePercentage()));
    }
    else {
      jsonRate.put("shippingAdditionalRatePercentage", "");
    }
   
    if (!form.isSiteCurrencyClassDefault()) {
      shippingRateCurrency = new ShippingRateCurrency();
      for (ShippingRateCurrency srCurrency : shippingRate.getShippingRateCurrencies()) {
        if (srCurrency.getSiteCurrencyClass().getSiteCurrencyClassId().equals(form.getSiteCurrencyClassId())) {
          shippingRateCurrency = srCurrency;
          break;
        }
      }
      if (shippingRateCurrency.getShippingRateFee() != null) {
        jsonRate.put("shippingRateFeeCurr", Format.getFloat(shippingRateCurrency.getShippingRateFee()));
        jsonRate.put("shippingRateFeeCurrFlag", true);
      }
      else {
        jsonRate.put("shippingRateFeeCurr", "");
        jsonRate.put("shippingRateFeeCurrFlag", false);
      }
      if (shippingRateCurrency.getShippingAdditionalRateFee() != null) {
        jsonRate.put("shippingAdditionalRateFeeCurr", Format.getFloat(shippingRateCurrency.getShippingAdditionalRateFee()));
        jsonRate.put("shippingAdditionalRateFeeCurrFlag", true);
      }
      else {
        jsonRate.put("shippingAdditionalRateFeeCurr", "");
        jsonRate.put("shippingAdditionalRateFeeCurrFlag", false);
View Full Code Here

      Long shippingMethodId = Format.getLong(form.getShippingMethodId());
      Long shippingTypeId = Format.getLong(form.getShippingTypeId());
    ShippingMethod shippingMethod = (ShippingMethod) em.find(ShippingMethod.class, shippingMethodId);

    ShippingRate shippingRate = null;
    ShippingRateCurrency shippingRateCurrency = null;
    ShippingMethodRegionType shippingMethodRegionType = null;
    for (ShippingMethodRegion shippingMethodRegion : shippingMethod.getShippingMethodRegions()) {
      if (shippingMethodRegion.getShippingRegion().getShippingRegionId().equals(shippingRegionId)) {
        for (ShippingMethodRegionType smrt : shippingMethodRegion.getShippingMethodRegionTypes()) {
          if (smrt.getShippingType().getShippingTypeId().equals(shippingTypeId)) {
            shippingMethodRegionType = smrt;
            shippingRate = shippingMethodRegionType.getShippingRate();
            break;
          }
        }
      }
    }
    if (shippingRate == null) {
      shippingRate = new ShippingRate();
      shippingRate.setRecUpdateBy(adminBean.getUser().getUserId());
      shippingRate.setRecUpdateDatetime(new Date(System.currentTimeMillis()));
      shippingRate.setRecCreateBy(adminBean.getUser().getUserId());
      shippingRate.setRecCreateDatetime(new Date(System.currentTimeMillis()));
      shippingRate.setPublished(Constants.VALUE_YES);
      shippingMethodRegionType.setShippingRate(shippingRate);
    }
    if (form.isSiteCurrencyClassDefault()) {
      shippingRateCurrency = shippingRate.getShippingRateCurrency();
      if (shippingRateCurrency == null) {
        shippingRateCurrency = new ShippingRateCurrency();
        shippingRateCurrency.setShippingRate(shippingRate);
        shippingRateCurrency.setRecCreateBy(adminBean.getUser().getUserId());
        shippingRateCurrency.setRecCreateDatetime(new Date(System.currentTimeMillis()));
          SiteCurrencyClass siteCurrencyClass = SiteCurrencyClassDAO.load(form.getSiteCurrencyClassDefaultId());
          shippingRateCurrency.setSiteCurrencyClass(siteCurrencyClass);
        shippingRate.setShippingRateCurrency(shippingRateCurrency);
        shippingRate.getShippingRateCurrencies().add(shippingRateCurrency);
      }
      if (!Format.isNullOrEmpty(form.getShippingRateFee())) {
        shippingRateCurrency.setShippingRateFee(Format.getFloatObj(form.getShippingRateFee()));
      }
      if (!Format.isNullOrEmpty(form.getShippingRatePercentage())) {
        shippingRate.setShippingRatePercentage(Format.getFloatObj(form.getShippingRatePercentage()));
      }
      if (!Format.isNullOrEmpty(form.getShippingAdditionalRateFee())) {
        shippingRateCurrency.setShippingAdditionalRateFee(Format.getFloatObj(form.getShippingAdditionalRateFee()));
      }
      if (!Format.isNullOrEmpty(form.getShippingAdditionalRatePercentage())) {
        shippingRate.setShippingAdditionalRatePercentage(Format.getFloatObj(form.getShippingAdditionalRatePercentage()));
      }
      shippingRate.setRecUpdateBy(adminBean.getUser().getUserId());
      shippingRate.setRecUpdateDatetime(new Date(System.currentTimeMillis()));
     
      shippingRateCurrency.setRecUpdateBy(adminBean.getUser().getUserId());
      shippingRateCurrency.setRecUpdateDatetime(new Date(System.currentTimeMillis()));
      if (shippingRateCurrency.getShippingRateCurrId() == null) {
        em.persist(shippingRateCurrency);
      }
      if (shippingRate.getShippingRateId() == null) {
        em.persist(shippingRate);
      }
 
      if (shippingRate.getShippingRateCurrency().getShippingRateFee() != null) {
        jsonResult.put("shippingRateFee", Format.getFloat(shippingRate.getShippingRateCurrency().getShippingRateFee()));
      }
      else {
        jsonResult.put("shippingRateFee", "");
      }
      if (shippingRate.getShippingRatePercentage() != null) {
        jsonResult.put("shippingRatePercentage", Format.getFloat(shippingRate.getShippingRatePercentage()));
      }
      else {
        jsonResult.put("shippingRatePercentage", "");
      }
      if (shippingRate.getShippingRateCurrency().getShippingAdditionalRateFee() != null) {
        jsonResult.put("shippingAdditionalRateFee", Format.getFloat(shippingRate.getShippingRateCurrency().getShippingAdditionalRateFee()));
      }
      else {
        jsonResult.put("shippingAdditionalRateFee", "");
      }
      if (shippingRate.getShippingAdditionalRatePercentage() != null) {
        jsonResult.put("shippingAdditionalRatePercentage", Format.getFloat(shippingRate.getShippingAdditionalRatePercentage()));
      }
      else {
        jsonResult.put("shippingAdditionalRatePercentage", "");
      }
    }
    else {
      shippingRateCurrency = null;
      for (ShippingRateCurrency srCurrency : shippingRate.getShippingRateCurrencies()) {
        if (srCurrency.getSiteCurrencyClass().getSiteCurrencyClassId().equals(form.getSiteCurrencyClassId())) {
          shippingRateCurrency = srCurrency;
        }
      }
      if (shippingRateCurrency == null) {
        shippingRateCurrency = new ShippingRateCurrency();
        SiteCurrencyClass siteCurrencyClass = SiteCurrencyClassDAO.load(form.getSiteCurrencyClassId());
        shippingRateCurrency.setRecCreateBy(adminBean.getUser().getUserId());
        shippingRateCurrency.setRecCreateDatetime(new Date(System.currentTimeMillis()));
        shippingRateCurrency.setSiteCurrencyClass(siteCurrencyClass);
        shippingRateCurrency.setShippingRate(shippingRate);
        shippingRate.getShippingRateCurrencies().add(shippingRateCurrency);
      }
      shippingRate.setRecUpdateBy(adminBean.getUser().getUserId());
      shippingRate.setRecUpdateDatetime(new Date(System.currentTimeMillis()));
     
      if (form.isShippingRateFeeCurrFlag()) {
        shippingRateCurrency.setShippingRateFee(Format.getFloat(form.getShippingRateFeeCurr()));
      }
      else {
        shippingRateCurrency.setShippingRateFee(null);
      }
      if (form.isShippingAdditionalRateFeeCurrFlag()) {
        shippingRateCurrency.setShippingAdditionalRateFee(Format.getFloat(form.getShippingAdditionalRateFeeCurr()));
      }
      else {
        shippingRateCurrency.setShippingAdditionalRateFee(null);
      }
      shippingRateCurrency.setRecUpdateBy(adminBean.getUser().getUserId());
      shippingRateCurrency.setRecUpdateDatetime(new Date(System.currentTimeMillis()));
      if (shippingRate.getShippingRateId() == null) {
        em.persist(shippingRate);
      }
      if (shippingRateCurrency.getShippingRateCurrId() == null) {
        em.persist(shippingRateCurrency);
      }
     
      if (shippingRate.getShippingRateCurrency() != null && shippingRate.getShippingRateCurrency().getShippingRateFee() != null) {
        jsonResult.put("shippingRateFee", Format.getFloat(shippingRate.getShippingRateCurrency().getShippingRateFee()));
      }
      else {
        jsonResult.put("shippingRateFee", "");
      }
      if (shippingRate.getShippingRatePercentage() != null) {
        jsonResult.put("shippingRatePercentage", Format.getFloat(shippingRate.getShippingRatePercentage()));
      }
      else {
        jsonResult.put("shippingRatePercentage", "");
      }
      if (shippingRate.getShippingRateCurrency() != null && shippingRate.getShippingRateCurrency().getShippingAdditionalRateFee() != null) {
        jsonResult.put("shippingAdditionalRateFee", Format.getFloat(shippingRate.getShippingRateCurrency().getShippingAdditionalRateFee()));
      }
      else {
        jsonResult.put("shippingAdditionalRateFee", "");
      }
      if (shippingRate.getShippingAdditionalRatePercentage() != null) {
        jsonResult.put("shippingAdditionalRatePercentage", Format.getFloat(shippingRate.getShippingAdditionalRatePercentage()));
      }
      else {
        jsonResult.put("shippingAdditionalRatePercentage", "");
      }
      if (shippingRateCurrency.getShippingRateFee() != null) {
        jsonResult.put("shippingRateFeeCurr", Format.getFloat(shippingRateCurrency.getShippingRateFee()));
        jsonResult.put("shippingRateFeeCurrFlag", true);
      }
      else {
        jsonResult.put("shippingRateFeeCurr", "");
        jsonResult.put("shippingRateFeeCurrFlag", false);
      }
      if (shippingRateCurrency.getShippingAdditionalRateFee() != null) {
        jsonResult.put("shippingAdditionalRateFeeCurr", Format.getFloat(shippingRateCurrency.getShippingAdditionalRateFee()));
        jsonResult.put("shippingAdditionalRateFeeCurrFlag", true);
      }
      else {
        jsonResult.put("shippingAdditionalRateFeeCurr", "");
        jsonResult.put("shippingAdditionalRateFeeCurrFlag", false);
View Full Code Here

TOP

Related Classes of com.jada.jpa.entity.ShippingRateCurrency

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.