Exemplo n.º 1
0
 /**
  * 缓存每个TMK的统计数据
  *
  * @param yearMonthString
  */
 private void cacheEveryTmkCount(String yearMonthString) {
   List<RC> tmks = ryxxDao.getRyxxCenterByRole(Role.ROLE_MARKET_TMK_WORKER);
   for (RC rc : tmks) {
     Integer tmkTotal = tmkUtilsDao.getAllMyCustomerCount(rc);
     this.putObjectInCache(
         tmkUtilsCountCache, this.getCacheKeyFromRC(rc), TmkUtilsBaseVo.TMK_TOTAL, tmkTotal);
     Integer tmkAdded = tmkUtilsDao.getAddedMyCustomerCountInThisMonth(rc, yearMonthString);
     this.putObjectInCache(
         tmkUtilsCountCache, this.getCacheKeyFromRC(rc), TmkUtilsBaseVo.TMK_ADDED, tmkAdded);
     Integer tmkCame = tmkUtilsDao.getMyHasComeCustomerCountInThisMonth(rc, yearMonthString);
     this.putObjectInCache(
         tmkUtilsCountCache, this.getCacheKeyFromRC(rc), TmkUtilsBaseVo.TMK_CAME, tmkCame);
     Integer tmkTarget = tmkUtilsDao.getMyComeCustomerTargetInThisMonth(rc, yearMonthString);
     this.putObjectInCache(
         tmkUtilsCountCache, this.getCacheKeyFromRC(rc), TmkUtilsBaseVo.TMK_TARGET, tmkTarget);
   }
 }
Exemplo n.º 2
0
 /** 缓存每个TMK的报告 */
 private void cacheEveryTmkReport(String yearMonthString) {
   List<RC> tmks = ryxxDao.getRyxxCenterByRole(Role.ROLE_MARKET_TMK_WORKER);
   for (RC rc : tmks) {
     TmkReportVo vo = new TmkReportVo();
     Integer target = tmkUtilsDao.getMyComeCustomerTargetInThisMonth(rc, yearMonthString);
     Integer finished = tmkUtilsDao.getMyHasComeCustomerCountInThisMonth(rc, yearMonthString);
     Integer money = tmkUtilsDao.getMyMoneyInThisMonth(rc, yearMonthString);
     vo.setMonthTarget(target);
     vo.setFinished(finished);
     vo.setName(rc.getRyxx().getYwm());
     vo.setRyxx(rc.getRyxx());
     vo.setMoney(money);
     vo.setRate(MathUtils.getPercentageString(finished, target));
     putObjectInCache(
         tmkUtilsListCache, this.getCacheKeyFromRC(rc), TmkUtilsBaseVo.TMK_REPORT, vo);
   }
 }
Exemplo n.º 3
0
 /** 供缓存使用 */
 private void cacheEveryTmkEverydayCameCustomers(String yearMonthString) {
   List<RC> tmks = ryxxDao.getRyxxCenterByRole(Role.ROLE_MARKET_TMK_WORKER);
   for (RC rc : tmks) {
     Map<String, Map<String, BaseVo>> result = new TreeMap<String, Map<String, BaseVo>>();
     List<String> days = DateUtils.getMonthDays(DateUtils.parseDate("yyyyMM", yearMonthString));
     for (String day : days) {
       result.put(day, new HashMap<String, BaseVo>());
       result.get(day).put(TmkUtilsBaseVo.TMK_EVERYDAY_CAME_CUSTOMERS, new BaseVo());
       result.get(day).put(TmkUtilsBaseVo.TMK_TOTAL, new BaseVo());
     }
     Integer tmpTotal = 0;
     List<BaseVo> vs = tmkUtilsDao.getTmkCameCustomersInThisMonth(rc, yearMonthString);
     Integer monthTarget = tmkUtilsDao.getMyComeCustomerTargetInThisMonth(rc, yearMonthString);
     BaseVo target = new BaseVo();
     target.setSValue(monthTarget);
     for (BaseVo v : vs) {
       BaseVo todayTotal = new BaseVo();
       if (result.containsKey(v.getSTime())) {
         todayTotal.setSValue(tmpTotal + v.getSValue());
         result.get(v.getSTime()).put(TmkUtilsBaseVo.TMK_EVERYDAY_CAME_CUSTOMERS, v);
       } else {
         todayTotal.setSValue(tmpTotal);
       }
       result.get(v.getSTime()).put(TmkUtilsBaseVo.TMK_TOTAL, todayTotal);
       result.get(v.getSTime()).put(TmkUtilsBaseVo.TMK_TARGET, target);
       tmpTotal = todayTotal.getSValue();
     }
     Integer maxTotal = 0;
     for (Map.Entry<String, Map<String, BaseVo>> r : result.entrySet()) {
       if (r.getValue().get(TmkUtilsBaseVo.TMK_TOTAL).getSValue() <= maxTotal) {
         r.getValue().get(TmkUtilsBaseVo.TMK_TOTAL).setSValue(maxTotal);
       } else {
         maxTotal = r.getValue().get(TmkUtilsBaseVo.TMK_TOTAL).getSValue();
       }
     }
     putObjectInCache(
         tmkUtilsListCache,
         this.getCacheKeyFromRC(rc),
         TmkUtilsBaseVo.TMK_EVERYDAY_CAME_CUSTOMERS,
         result);
   }
 }