Exemplo n.º 1
0
  protected MocamResult endSuccessProcess(LocalTransaction localTransaction) {
    CardInfo card = cardInfoManager.getByCardNo(localTransaction.getCardNo());
    ApplicationVersion applicationVersion =
        applicationVersionManager.getByAidAndVersionNo(
            localTransaction.getAid(), localTransaction.getAppVersion());

    if (null != applicationVersion
        && (null == applicationVersion.getApplication().getNeedSubscribe()
            || !applicationVersion
                .getApplication()
                .getNeedSubscribe())) { // 如果应用不需要单独订购/退订,则删除使用即为退订,添加退订记录
      subscribeHistoryManager.unsubscribeApplication(card, applicationVersion);
    }

    // 删除终端上客户端记录
    List<CardClient> cardClients =
        cardClientManager.getByCardAndApplication(card, applicationVersion.getApplication());
    if (null != cardClients) {
      for (CardClient cardClient : cardClients) {
        cardClientManager.remove(cardClient);
      }
    }

    return super.endSuccessProcess(localTransaction);
  }
Exemplo n.º 2
0
  protected String calcLoadPercent(LocalTransaction localTransaction) {
    ApplicationVersion applicationVersion =
        applicationVersionManager.getAidAndVersionNo(
            localTransaction.getAid(), localTransaction.getAppVersion());
    int totalCount = applicationVersion.getApplicationLoadFiles().size();
    int currentIndex = localTransaction.getCurrentLoadFileIndex();

    Integer percent = 5 + (int) (((new Double(currentIndex - 1) / totalCount) * 0.85) * 100);

    return percent.toString();
  }