/**
  * <br>
  * Created on: 2013-10-4 下午03:17:02
  *
  * @param mi
  * @return
  */
 private HistoryMsisdnInfo getHistoryMsisdnInfo(MsisdnInfo mi) {
   HistoryMsisdnInfo info = new HistoryMsisdnInfo();
   info.setACT_CALL(mi.getACT_CALL());
   info.setCALL_FEE(mi.getCALL_FEE());
   info.setFLUX_FEE(mi.getFLUX_FEE());
   info.setGPRS_FLUX(mi.getGPRS_FLUX());
   info.setMONTH_CD(mi.getMONTH_CD());
   return info;
 }
  /**
   * <br>
   * Created on: 2013-10-3 下午02:06:43
   *
   * @param list
   * @return
   */
  private String getSubscriptionRecommend() {

    // Map<String, Double> fluxMap = new HashMap<String, Double>();
    // Map<String, Double> actMap = new HashMap<String, Double>();

    float GPRS_FLUX_tmp = -1;
    float ACT_CALL_tmp = -1;

    Iterator<MsisdnInfo> it = list.iterator();
    while (it.hasNext()) {
      MsisdnInfo mi = it.next();
      // 號碼,--- 月份 ,---品牌 ,--arup,--流量 ,---主叫時長
      // USR_NBR,MONTH_CD,BRND_NAME,ARUP,GPRS_FLUX,ACT_CALL,
      // 流量費用,通話費用 ,基本GPRS編碼,疊加套餐編碼1,2,3
      // FLUX_FEE,CALL_FEE,GPRS_PRCT_CD,ADD_GRPS_CD_1,ADD_GRPS_CD_2,ADD_GRPS_CD_3

      LogTools.getLogger(getClass()).debug("[{}].", mi.toString());

      GPRS_FLUX_tmp = getUserValue(GPRS_FLUX_tmp, mi.getGPRS_FLUX());
      ACT_CALL_tmp = getUserValue(ACT_CALL_tmp, mi.getACT_CALL());

      // other infos
      currentPackagesId = mi.getGPRS_PRCT_CD();

      HistoryMsisdnInfo info = getHistoryMsisdnInfo(mi);
      msisdnInfoList.add(info);
    }

    int size = list.size();
    GPRS_FLUX_tmp = GPRS_FLUX_tmp / size;
    ACT_CALL_tmp = ACT_CALL_tmp / size;

    LogTools.getLogger(getClass())
        .debug("Average GPRS_FLUX:[{}],Average ACT_CALL:[{}].", GPRS_FLUX_tmp, ACT_CALL_tmp);

    float subFee = baseMsisdnInfoCache.getSubscriptionRecommendFee(GPRS_FLUX_tmp, ACT_CALL_tmp);

    if (subFee == -1) return ERROR_CODE;

    LogTools.getLogger(getClass()).debug("SUB FEE : [{}].", subFee);

    if (!compareOldPackages(subFee)) return getFinalSubRec(null);

    List<String> subFeeNameList = baseMsisdnInfoCache.getSubscriptionRecommendName(subFee);

    if (DataTools.isEmpty(subFeeNameList)) return ERROR_CODE;

    return getFinalSubRec(subFeeNameList);
  }