当前位置: 首页>>代码示例>>Java>>正文


Java FinAccountHelper类代码示例

本文整理汇总了Java中org.ofbiz.order.finaccount.FinAccountHelper的典型用法代码示例。如果您正苦于以下问题:Java FinAccountHelper类的具体用法?Java FinAccountHelper怎么用?Java FinAccountHelper使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


FinAccountHelper类属于org.ofbiz.order.finaccount包,在下文中一共展示了FinAccountHelper类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testCreateFinAccountBasic

import org.ofbiz.order.finaccount.FinAccountHelper; //导入依赖的package包/类
public void testCreateFinAccountBasic() throws Exception {
    String finAccountCode;
    GenericValue account;

    finAccountCode = FinAccountHelper.getNewFinAccountCode(20, delegator);
    System.err.printf("finAccountCode=%s\n", finAccountCode);
    assertNotNull(finAccountCode);

    account = FinAccountHelper.getFinAccountFromCode(finAccountCode, delegator);
    assertNull(account);

    delegator.createSetNextSeqId(delegator.makeValue("FinAccount", UtilMisc.toMap("finAccountCode", finAccountCode)));

    account = FinAccountHelper.getFinAccountFromCode(finAccountCode, delegator);
    assertNotNull(account);
    assertEquals(finAccountCode, account.get("finAccountCode"));
    account = FinAccountHelper.getFinAccountFromCode(finAccountCode.toUpperCase(), delegator);
    assertNotNull(account);
    assertEquals(finAccountCode, account.get("finAccountCode"));
    account = FinAccountHelper.getFinAccountFromCode(finAccountCode.toLowerCase(), delegator);
    assertNotNull(account);
    assertEquals(finAccountCode, account.get("finAccountCode"));

    delegator.createSetNextSeqId(delegator.makeValue("FinAccount", UtilMisc.toMap("finAccountCode", finAccountCode)));
    account = FinAccountHelper.getFinAccountFromCode(finAccountCode, delegator);
    assertNull(account);
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:28,代码来源:FinAccountTest.java

示例2: checkFinAccountStatus

import org.ofbiz.order.finaccount.FinAccountHelper; //导入依赖的package包/类
public static Map<String, Object> checkFinAccountStatus(DispatchContext dctx, Map<String, Object> context) {
    Delegator delegator = dctx.getDelegator();
    String finAccountId = (String) context.get("finAccountId");
    Locale locale = (Locale) context.get("locale");

    if (finAccountId == null) {
        return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, 
                "AccountingFinAccountNotFound", UtilMisc.toMap("finAccountId", ""), locale));
    }

    GenericValue finAccount;
    try {
        finAccount = EntityQuery.use(delegator).from("FinAccount").where("finAccountId", finAccountId).queryOne();
    } catch (GenericEntityException ex) {
        return ServiceUtil.returnError(ex.getMessage());
    }

    if (finAccount != null) {
        String statusId = finAccount.getString("statusId");
        if (statusId == null) statusId = "FNACT_ACTIVE";

        BigDecimal balance = finAccount.getBigDecimal("actualBalance");
        if (balance == null) {
            balance = FinAccountHelper.ZERO;
        }

        Debug.logInfo("Account #" + finAccountId + " Balance: " + balance + " Status: " + statusId, module);

        if ("FNACT_ACTIVE".equals(statusId) && balance.compareTo(FinAccountHelper.ZERO) < 1) {
            finAccount.set("statusId", "FNACT_MANFROZEN");
            Debug.logInfo("Financial account [" + finAccountId + "] has passed its threshold [" + balance + "] (Frozen)", module);
        } else if ("FNACT_MANFROZEN".equals(statusId) && balance.compareTo(FinAccountHelper.ZERO) > 0) {
            finAccount.set("statusId", "FNACT_ACTIVE");
            Debug.logInfo("Financial account [" + finAccountId + "] has been made current [" + balance + "] (Un-Frozen)", module);
        }
        try {
            finAccount.store();
        } catch (GenericEntityException e) {
            return ServiceUtil.returnError(e.getMessage());
        }
    }

    return ServiceUtil.returnSuccess();
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:45,代码来源:FinAccountServices.java

示例3: checkFinAccountStatus

import org.ofbiz.order.finaccount.FinAccountHelper; //导入依赖的package包/类
public static Map<String, Object> checkFinAccountStatus(DispatchContext dctx, Map<String, Object> context) {
    Delegator delegator = dctx.getDelegator();
    String finAccountId = (String) context.get("finAccountId");
    Locale locale = (Locale) context.get("locale");

    if (finAccountId == null) {
        return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, 
                "AccountingFinAccountNotFound", UtilMisc.toMap("finAccountId", ""), locale));
    }

    GenericValue finAccount;
    try {
        finAccount = delegator.findOne("FinAccount", UtilMisc.toMap("finAccountId", finAccountId), false);
    } catch (GenericEntityException ex) {
        return ServiceUtil.returnError(ex.getMessage());
    }

    if (finAccount != null) {
        String statusId = finAccount.getString("statusId");
        if (statusId == null) statusId = "FNACT_ACTIVE";

        BigDecimal balance = finAccount.getBigDecimal("actualBalance");
        if (balance == null) {
            balance = FinAccountHelper.ZERO;
        }

        Debug.logInfo("Account #" + finAccountId + " Balance: " + balance + " Status: " + statusId, module);

        if ("FNACT_ACTIVE".equals(statusId) && balance.compareTo(FinAccountHelper.ZERO) < 1) {
            finAccount.set("statusId", "FNACT_MANFROZEN");
            Debug.logInfo("Financial account [" + finAccountId + "] has passed its threshold [" + balance + "] (Frozen)", module);
        } else if ("FNACT_MANFROZEN".equals(statusId) && balance.compareTo(FinAccountHelper.ZERO) > 0) {
            finAccount.set("statusId", "FNACT_ACTIVE");
            Debug.logInfo("Financial account [" + finAccountId + "] has been made current [" + balance + "] (Un-Frozen)", module);
        }
        try {
            finAccount.store();
        } catch (GenericEntityException e) {
            return ServiceUtil.returnError(e.getMessage());
        }
    }

    return ServiceUtil.returnSuccess();
}
 
开发者ID:gildaslemoal,项目名称:elpi,代码行数:45,代码来源:FinAccountServices.java

示例4: getGiftCertSettingFromStore

import org.ofbiz.order.finaccount.FinAccountHelper; //导入依赖的package包/类
/**
 * Returns ProductStoreFinActSetting based on cart's productStoreId and FinAccountHelper's defined giftCertFinAcctTypeId
 * @param delegator the delegator
 * @return returns ProductStoreFinActSetting based on cart's productStoreId 
 * @throws GenericEntityException
 */
public GenericValue getGiftCertSettingFromStore(Delegator delegator) throws GenericEntityException {
    return EntityQuery.use(delegator).from("ProductStoreFinActSetting").where("productStoreId", getProductStoreId(), "finAccountTypeId", FinAccountHelper.giftCertFinAccountTypeId).cache().queryOne();
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:10,代码来源:ShoppingCart.java

示例5: getGiftCertSettingFromStore

import org.ofbiz.order.finaccount.FinAccountHelper; //导入依赖的package包/类
/**
 * Returns ProductStoreFinActSetting based on cart's productStoreId and FinAccountHelper's defined giftCertFinAcctTypeId
 * @param delegator the delegator
 * @return returns ProductStoreFinActSetting based on cart's productStoreId 
 * @throws GenericEntityException
 */
public GenericValue getGiftCertSettingFromStore(Delegator delegator) throws GenericEntityException {
    return delegator.findOne("ProductStoreFinActSetting", UtilMisc.toMap("productStoreId", getProductStoreId(), "finAccountTypeId", FinAccountHelper.giftCertFinAccountTypeId), true);
}
 
开发者ID:gildaslemoal,项目名称:elpi,代码行数:10,代码来源:ShoppingCart.java


注:本文中的org.ofbiz.order.finaccount.FinAccountHelper类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。