本文整理汇总了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);
}
示例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();
}
示例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();
}
示例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();
}
示例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);
}