/** * <br> * Created on: 2013-10-3 下午07:35:49 * * @param list * @param subFeeNameList * @return */ private String getFinalSubRec(List<String> subFeeNameList) { try { RecommendationInfo info = new RecommendationInfo(); info.setUserMsisdn(this.USR_NBR); info.setCurrentPackagesId(this.currentPackagesId); info.setMsisdnInfoList(msisdnInfoList); if (!DataTools.isEmpty(subFeeNameList)) info.setRecommendationPackagesNameList(subFeeNameList); return JsonTools.entityToJson(info); } catch (Exception e) { LogTools.getLogger(getClass()) .error( "When [{} - {}] , \n MASSAGE : {} \n CAUSE :{} \n CLASS : {}", new Object[] { this.getClass().getName(), "getFinalSubRec --> Exception() ", e.getMessage(), e.getCause(), e.getClass() }); return ERROR_CODE; } }
/** * <br> * Created on: 2013-11-12 下午03:53:46 * * @return */ public List<ViewTreeResourceRote> getAllTreeNodes() { String hql = "from TbResourceRote"; List<TbResourceRote> list = resourceRoteDao.find(hql, null); List<ViewTreeResourceRote> vList = new ArrayList<ViewTreeResourceRote>(); if (!DataTools.isEmpty(list)) for (TbResourceRote t : list) { ViewTreeResourceRote vm = new ViewTreeResourceRote(); BeanUtils.copyProperties(t, vm); vm.setId(t.getNmResourceRoteid()); TbResourceRote st = t.getTbResourceRote(); if (!DataTools.isEmpty(st)) vm.setIntPRRId(st.getNmResourceRoteid()); setAttributes(t, vm); vList.add(vm); } return vList; }
/** * <br> * Created on: 2013-11-12 下午03:39:40 */ private void setSpendingSystem() { String vcNote = "系統管理"; TbResourceRote rote = getRoteByNote(vcNote, true); if (DataTools.isEmpty(rote)) { rote = new TbResourceRote(); rote.setVcNote(vcNote); } vcNote = "收支項目"; TbResourceRote subRote = getRoteByNote(vcNote, false); if (DataTools.isEmpty(subRote)) { subRote = new TbResourceRote(); subRote.setVcNote(vcNote); } String vcRotePage = "/system/spending.jsp"; subRote.setVcNote(vcNote); subRote.setVcRotePage(vcRotePage); subRote.setTbResourceRote(rote); addResourceRote(subRote); vcNote = "錢包管理"; subRote = getRoteByNote(vcNote, false); if (DataTools.isEmpty(subRote)) { subRote = new TbResourceRote(); subRote.setVcNote(vcNote); } vcRotePage = "/system/dielectric.jsp"; subRote.setVcNote(vcNote); subRote.setVcRotePage(vcRotePage); subRote.setTbResourceRote(rote); addResourceRote(subRote); }
/** * <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); }
/** * <br> * Created on: 2013-11-12 下午03:39:25 */ private void setSpendingList() { String vcNote = "賬單列表"; TbResourceRote rote = getRoteByNote(vcNote, true); if (DataTools.isEmpty(rote)) { rote = new TbResourceRote(); rote.setVcNote(vcNote); } vcNote = DateTools.getParseDateToStr(DateTools.getCurrentDate(), DateTools.YYYY_MM); TbResourceRote subRote = getRoteByNote(vcNote, false); if (DataTools.isEmpty(subRote)) { subRote = new TbResourceRote(); subRote.setVcNote(vcNote); } String vcRotePage = getVcRotePage(); subRote.setVcNote(vcNote); subRote.setVcRotePage(vcRotePage); subRote.setTbResourceRote(rote); addResourceRote(subRote); }
/* * (non-Javadoc) * * @see z.z.w.project.test.rs.ISubscriptionRecommend#getUserMsisdnInfos() */ public synchronized String getUserMsisdnInfos(String userMsisdn) { try { this.USR_NBR = userMsisdn; LogTools.getLogger(getClass()).debug("Get msisdn : [{}] info...", USR_NBR); list = baseMsisdnInfoCache.getMsisdnInfo(this.USR_NBR); if (DataTools.isEmpty(list)) return ERROR_CODE; sortList(); String subscriptionRecommend = getSubscriptionRecommend(); LogTools.getLogger(getClass()) .debug("Get subscriptionRecommend : [{}].", subscriptionRecommend); return subscriptionRecommend; } catch (Exception e) { LogTools.getLogger(getClass()) .error( "When [{} - {}] , \n MASSAGE : {} \n CAUSE :{} \n CLASS : {}", new Object[] { this.getClass().getName(), "getUserMsisdnInfos --> Exception() ", e.getMessage(), e.getCause(), e.getClass() }); return ERROR_CODE; } finally { } }