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


Java Period.setEnd方法代码示例

本文整理汇总了Java中nl.strohalm.cyclos.utils.Period.setEnd方法的典型用法代码示例。如果您正苦于以下问题:Java Period.setEnd方法的具体用法?Java Period.setEnd怎么用?Java Period.setEnd使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在nl.strohalm.cyclos.utils.Period的用法示例。


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

示例1: setPropertyValue

import nl.strohalm.cyclos.utils.Period; //导入方法依赖的package包/类
public void setPropertyValue(final Object component, final int property, final Object value) throws HibernateException {
    final Period period = (Period) component;
    switch (property) {
        case BEGIN:
            period.setBegin((Calendar) value);
            break;
        case END:
            period.setEnd((Calendar) value);
            break;
    }
}
 
开发者ID:crypto-coder,项目名称:open-cyclos,代码行数:12,代码来源:BasePeriodType.java

示例2: balanceDiff

import nl.strohalm.cyclos.utils.Period; //导入方法依赖的package包/类
@Override
public BigDecimal balanceDiff(final Account account, Period period, final Transfer transfer) {
    if (account == null) {
        return BigDecimal.ZERO;
    }
    period = period.clone();
    period.setEnd(null);
    Map<String, Object> params = new HashMap<String, Object>();
    params.put("account", account.getId());
    StringBuilder hql = new StringBuilder();
    hql.append(" select sum( ");
    hql.append("     case when t.chargebackOf.id is null then ");
    hql.append("         case when t.from.id = :account then -t.amount else t.amount end ");
    hql.append("     else ");
    hql.append("         case when t.to.id = :account then t.amount else -t.amount end ");
    hql.append("     end)");
    hql.append(" from Transfer t ");
    hql.append(" where (t.from.id = :account or t.to.id = :account) ");
    hql.append("   and t.processDate is not null ");
    if (period != null && period.getBegin() != null) {
        hql.append("   and (t.processDate >");
        if (period.isInclusiveBegin()) {
            hql.append("=");
        }
        hql.append(" :beginDate ) ");
        params.put("beginDate", period.getBegin());
    }
    params.put("endDate", transfer.getProcessDate());
    params.put("transferId", transfer.getId());
    hql.append("   and (t.processDate < :endDate or (t.processDate = :endDate and t.id <");
    if (period != null && period.isInclusiveEnd()) {
        hql.append("=");
    }
    hql.append(" :transferId) ) ");
    BigDecimal diff = (BigDecimal) uniqueResult(hql.toString().trim(), params);
    return BigDecimalHelper.nvl(diff);
}
 
开发者ID:crypto-coder,项目名称:open-cyclos,代码行数:38,代码来源:TransferDAOImpl.java

示例3: updatePreviousReferenceHistoryLog

import nl.strohalm.cyclos.utils.Period; //导入方法依赖的package包/类
private void updatePreviousReferenceHistoryLog(final Reference reference) {
    final ReferenceHistoryLogQuery query = new ReferenceHistoryLogQuery();
    query.setFrom(reference.getFrom());
    query.setTo(reference.getTo());
    final ReferenceHistoryLog previousLog = referenceHistoryDao.getOpenReferenceHistoryLog(query);
    if (previousLog != null) {
        final Period period = previousLog.getPeriod();
        period.setEnd(reference.getDate());
        previousLog.setPeriod(period);
        referenceHistoryDao.update(previousLog);
    }
}
 
开发者ID:crypto-coder,项目名称:open-cyclos,代码行数:13,代码来源:ReferenceServiceImpl.java

示例4: calculateChargeOverTransactionedVolume

import nl.strohalm.cyclos.utils.Period; //导入方法依赖的package包/类
private BigDecimal calculateChargeOverTransactionedVolume(final AccountFeeLog feeLog, final Member member) {
    AccountFee fee = feeLog.getAccountFee();
    if (!fee.isEnabled()) {
        return BigDecimal.ZERO;
    }
    MemberAccount account = (MemberAccount) accountService.getAccount(new AccountDTO(member, fee.getAccountType()));

    // We want to limit for diffs within the fee log period
    Period logPeriod = feeLog.getPeriod();
    Calendar beginDate = logPeriod.getBegin();
    if (fee.getEnabledSince().after(beginDate)) {
        // However, if the fee was enabled in the middle of the period, consider this date instead
        beginDate = fee.getEnabledSince();
    }
    if (account.getCreationDate().after(beginDate)) {
        // If the account was created after, use it's creation date
        beginDate = account.getCreationDate();
    }
    // As we calculate by whole days, make sure we're on the next day, so the balance will be ok
    beginDate = DateHelper.truncateNextDay(beginDate);

    Period period = Period.between(beginDate, logPeriod.getEnd());
    if (period.getBegin().after(period.getEnd())) {
        // In case of single days, the begin is the next day, and the end is the last second of the current day
        period.setEnd(period.getBegin());
    }
    return calculateVolumeCharge(account, fee, period, BigDecimal.ZERO, false);
}
 
开发者ID:crypto-coder,项目名称:open-cyclos,代码行数:29,代码来源:AccountFeeServiceImpl.java

示例5: createBrokeringCommissionStatus

import nl.strohalm.cyclos.utils.Period; //导入方法依赖的package包/类
@Override
public BrokeringCommissionStatus createBrokeringCommissionStatus(final Brokering brokering, final BrokerCommission brokerCommission) {
    // Create new instance
    final BrokeringCommissionStatus brokeringCommissionStatus = new BrokeringCommissionStatus();
    brokeringCommissionStatus.setBrokering(brokering);
    brokeringCommissionStatus.setBrokerCommission(brokerCommission);
    brokeringCommissionStatus.setCreationDate(Calendar.getInstance());
    boolean fillFromCommission = true;

    if (brokerCommission.isFromMember()) {
        // Get the data from the default broker commission
        final DefaultBrokerCommission defaultBrokerCommission = getDefaultBrokerCommission(brokering.getBroker(), brokerCommission);
        if (defaultBrokerCommission != null) {
            brokeringCommissionStatus.setAmount(defaultBrokerCommission.getAmount());
            brokeringCommissionStatus.setWhen(defaultBrokerCommission.getWhen());
            brokeringCommissionStatus.setMaxCount(defaultBrokerCommission.getCount());
            fillFromCommission = false;
        }
    }
    if (fillFromCommission) {
        // Get the data from the broker commission
        brokeringCommissionStatus.setAmount(brokerCommission.getAmount());
        brokeringCommissionStatus.setWhen(brokerCommission.getWhen());
        brokeringCommissionStatus.setMaxCount(brokerCommission.getCount());
    }

    // Set total
    final TransactionSummaryVO total = new TransactionSummaryVO();
    total.setCount(0);
    total.setAmount(new BigDecimal(0));
    brokeringCommissionStatus.setTotal(total);

    // Period
    final Period period = new Period();
    period.setBegin(brokering.getStartDate());

    // If the commission has a validity (number of days), set expiration date on the commission status and check if it is not expired
    if (brokeringCommissionStatus.getWhen() == BrokerCommission.When.DAYS) {

        // Calculate and set expiration date
        final Calendar brokeringStartDate = brokering.getStartDate();
        final int daysCount = brokeringCommissionStatus.getMaxCount();
        final Calendar expirationDate = new TimePeriod(daysCount, Field.DAYS).add(brokeringStartDate);
        brokeringCommissionStatus.setExpiryDate(expirationDate);

        // Check if the brokering commission status is expired
        final Calendar now = Calendar.getInstance();
        if (now.compareTo(expirationDate) >= 0) {
            period.setEnd(expirationDate);
        }
    }

    // Set period
    brokeringCommissionStatus.setPeriod(period);

    return brokeringCommissionStatusDao.insert(brokeringCommissionStatus);
}
 
开发者ID:crypto-coder,项目名称:open-cyclos,代码行数:58,代码来源:CommissionServiceImpl.java


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