Beispiel #1
0
 public Map<CalendarDay, Map<Ryxx, BaseVo>> getEveryDayCameCustomersInOneMonth(
     FzxDto fzx, String yearMonthString) {
   List<Ryxx> tmks = ryxxDao.getRyxxsByRole(Role.ROLE_MARKET_TMK_WORKER, fzx);
   Map<CalendarDay, Map<Ryxx, BaseVo>> result = new TreeMap<CalendarDay, Map<Ryxx, BaseVo>>();
   List<CalendarDay> days =
       DateUtils.getDaysInOneMonth(DateUtils.parseDate("yyyyMM", yearMonthString));
   for (CalendarDay day : days) {
     result.put(day, new HashMap<Ryxx, BaseVo>());
     for (Ryxx tmk : tmks) {
       result.get(day).put(tmk, null);
     }
   }
   for (Ryxx tmk : tmks) {
     RC rc = new RC();
     rc.setRyxx(tmk);
     rc.setFzx(fzx);
     List<BaseVo> vs = tmkUtilsDao.getTmkCameCustomersInThisMonth(rc, yearMonthString);
     for (BaseVo v : vs) {
       CalendarDay cd = new CalendarDay(v.getSTime());
       if (result.containsKey(cd)) {
         result.get(cd).put(tmk, v);
       }
     }
   }
   return result;
 }
Beispiel #2
0
 public List<TmkReportVo> getThisCenterEveryTmkReport(FzxDto fzx) {
   String yearMonthString = DateUtils.getCurYearMonthString();
   List<TmkReportVo> rvs = new ArrayList<TmkReportVo>();
   List<Ryxx> ryxxs = ryxxDao.getRyxxsByRole(Role.ROLE_MARKET_TMK_WORKER, fzx);
   for (Ryxx ryxx : ryxxs) {
     RC rc = new RC();
     rc.setRyxx(ryxx);
     rc.setFzx(fzx);
     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));
     rvs.add(vo);
     // rvs.add((TmkReportVo) getObjectFromCache(tmkUtilsListCache, this
     // .getCacheKeyFromRyxxAndFzx(ryxx, fzx),
     // TmkUtilsBaseVo.TMK_REPORT));
   }
   return rvs;
 }
Beispiel #3
0
  public Map<String, Object> getThisTmkResult(Ryxx ryxx, FzxDto fzx) {
    String yearMonthString = DateUtils.getCurYearMonthString();
    Map<String, Object> result = new HashMap<String, Object>();
    RC rc = new RC();
    rc.setFzx(fzx);
    rc.setRyxx(ryxx);

    result.put(TmkUtilsBaseVo.TMK_TOTAL, tmkUtilsDao.getAllMyCustomerCount(rc));

    result.put(
        TmkUtilsBaseVo.TMK_ADDED,
        tmkUtilsDao.getAddedMyCustomerCountInThisMonth(rc, yearMonthString));

    result.put(
        TmkUtilsBaseVo.TMK_CAME,
        tmkUtilsDao.getMyHasComeCustomerCountInThisMonth(rc, yearMonthString));

    result.put(
        TmkUtilsBaseVo.TMK_TARGET,
        tmkUtilsDao.getMyComeCustomerTargetInThisMonth(rc, yearMonthString));

    result.put(TmkUtilsBaseVo.TMK_FROM_EXTPOOL, tmkUtilsDao.getTodayFromExtPool(ryxx, fzx));
    result.put(TmkUtilsBaseVo.TMK_FROM_TMKPOOL, tmkUtilsDao.getTodayFromTmkPool(ryxx, fzx));
    return result;
  }
Beispiel #4
0
 public void initTmkUtilsListCache() {
   String yearMonthString = DateUtils.getCurYearMonthString();
   cacheCenterEverydayAddedCustomers(yearMonthString);
   cacheCenterEverydayCameCustomers(yearMonthString);
   cacheEveryTmkEverydayCameCustomers(yearMonthString);
   cacheEveryTmkReport(yearMonthString);
 }
Beispiel #5
0
 @SuppressWarnings("unchecked")
 public Map<String, Map<String, BaseVo>> getThisTmkEverydayCameCustomers(Ryxx ryxx, FzxDto fzx) {
   String yearMonthString = DateUtils.getCurYearMonthString();
   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());
   }
   RC rc = new RC();
   rc.setRyxx(ryxx);
   rc.setFzx(fzx);
   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();
     }
   }
   return result;
   // return (Map<String, Map<String, BaseVo>>) getObjectFromCache(
   // tmkUtilsListCache, this.getCacheKeyFromRyxxAndFzx(ryxx, fzx),
   // TmkUtilsBaseVo.TMK_EVERYDAY_CAME_CUSTOMERS);
 }
Beispiel #6
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);
   }
 }
Beispiel #7
0
 @SuppressWarnings("unchecked")
 public Map<String, Map<String, BaseVo>> getThisCenterEverydayAddedCustomers(FzxDto fzx) {
   String yearMonthString = DateUtils.getCurYearMonthString();
   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.CENTER_EVERYDAY_ADDED_CUSTOMERS, new BaseVo());
   }
   List<BaseVo> vs = tmkUtilsDao.getCenterAddInThisMonth(fzx, yearMonthString);
   for (BaseVo v : vs) {
     if (result.containsKey(v.getSTime())) {
       result.get(v.getSTime()).put(TmkUtilsBaseVo.CENTER_EVERYDAY_ADDED_CUSTOMERS, v);
     }
   }
   return result;
   // return (Map<String, Map<String, BaseVo>>) getObjectFromCache(
   // tmkUtilsListCache, fzx.getZdbm(),
   // TmkUtilsBaseVo.CENTER_EVERYDAY_ADDED_CUSTOMERS);
 }
Beispiel #8
0
 /** 供缓存使用 */
 private void cacheCenterEverydayCameCustomers(String yearMonthString) {
   List<Fzx> centers = fzxDao.getAllValid(true);
   for (Fzx center : centers) {
     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.CENTER_EVERYDAY_CAME_CUSTOMERS, new BaseVo());
       result.get(day).put(TmkUtilsBaseVo.CENTER_TOTAL, new BaseVo());
     }
     Integer tmpTotal = 0;
     List<BaseVo> vs = tmkUtilsDao.getCenterComeInThisMonth(center.getFzxDto(), yearMonthString);
     Integer monthTarget =
         tmkUtilsDao.getThisCenterCameCustomerTargetInThisMonth(
             center.getFzxDto(), 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.CENTER_EVERYDAY_CAME_CUSTOMERS, v);
       } else {
         todayTotal.setSValue(tmpTotal);
       }
       result.get(v.getSTime()).put(TmkUtilsBaseVo.CENTER_TOTAL, todayTotal);
       result.get(v.getSTime()).put(TmkUtilsBaseVo.CENTER_TARGET, target);
       tmpTotal = todayTotal.getSValue();
     }
     Integer maxTotal = 0;
     for (Map.Entry<String, Map<String, BaseVo>> r : result.entrySet()) {
       if (r.getValue().get(TmkUtilsBaseVo.CENTER_TOTAL).getSValue() <= maxTotal) {
         r.getValue().get(TmkUtilsBaseVo.CENTER_TOTAL).setSValue(maxTotal);
       } else {
         maxTotal = r.getValue().get(TmkUtilsBaseVo.CENTER_TOTAL).getSValue();
       }
     }
     putObjectInCache(
         tmkUtilsListCache, center.getId(), TmkUtilsBaseVo.CENTER_EVERYDAY_CAME_CUSTOMERS, result);
   }
 }
Beispiel #9
0
 /** 供缓存使用 */
 private void cacheCenterEverydayAddedCustomers(String yearMonthString) {
   List<Fzx> centers = fzxDao.getAllValid(true);
   for (Fzx center : centers) {
     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.CENTER_EVERYDAY_ADDED_CUSTOMERS, new BaseVo());
     }
     List<BaseVo> vs = tmkUtilsDao.getCenterAddInThisMonth(center.getFzxDto(), yearMonthString);
     for (BaseVo v : vs) {
       if (result.containsKey(v.getSTime())) {
         result.get(v.getSTime()).put(TmkUtilsBaseVo.CENTER_EVERYDAY_ADDED_CUSTOMERS, v);
       }
     }
     putObjectInCache(
         tmkUtilsListCache,
         center.getId(),
         TmkUtilsBaseVo.CENTER_EVERYDAY_ADDED_CUSTOMERS,
         result);
   }
 }
Beispiel #10
0
 public Map<String, Object> getThisCenterTmksResutlt(Ryxx ryxx, FzxDto fzx) {
   String yearMonthString = DateUtils.getCurYearMonthString();
   Map<String, Object> result = new HashMap<String, Object>();
   result.put(TmkUtilsBaseVo.CENTER_TOTAL, tmkUtilsDao.getAllCustomerCountInThisCenter(fzx));
   result.put(
       TmkUtilsBaseVo.CENTER_ADDED,
       tmkUtilsDao.getThisCenterAddedCustomerCountInThisMonth(fzx, yearMonthString));
   result.put(
       TmkUtilsBaseVo.CENTER_TARGET,
       tmkUtilsDao.getThisCenterCameCustomerTargetInThisMonth(fzx, yearMonthString));
   result.put(
       TmkUtilsBaseVo.CENTER_CAME,
       tmkUtilsDao.getThisCenterCustomerHasComeCountInThisMonth(fzx, yearMonthString));
   return result;
 }
Beispiel #11
0
 public void initTmkUtilsCountCache() {
   String yearMonthString = DateUtils.getCurYearMonthString();
   cacheCenterCount(yearMonthString);
   cacheEveryTmkCount(yearMonthString);
 }
Beispiel #12
0
 public String addDept() {
   lyff.setLybh(DateUtils.format("yyyyMMddHHmm", new Date()));
   lyff.setLylx(LylxDto.getDept());
   return SUCCESS;
 }