@Override
 public List<DeviceBrandRankValue> deviceBrandRanking(
     String idshop, RankingType ranktype, Date start, Date end, int limit, int skip) {
   long tuv = 0, tvt = 0;
   List<DeviceBrandRankValue> list =
       mapper.deviceBrandRank(idshop, ranktype.name(), start, end, limit, skip);
   for (DeviceBrandRankValue value : list) {
     tuv += value.getUv();
     tvt += value.getVt();
     value.setName(MacBrandMemory.parser(value.getName()));
   }
   for (DeviceBrandRankValue value : list) {
     value.setRuv(1f * value.getUv() / tuv);
     value.setRvt(1f * value.getVt() / tvt);
   }
   return list;
 }
  @Override
  public List<DeviceBrandRankValue> deviceBrandRank(
      String idshop, RankingType ranktype, Date start, Date end, int limit, int skip) {
    int olimit = limit;
    limit = limit + limit / 2;

    List<DeviceBrandRankValue> list = new ArrayList<>(), tmps;
    do {
      tmps = mapper.deviceBrandRank(idshop, ranktype.name(), start, end, limit, skip);
      for (int i = 0; i < tmps.size() && list.size() < olimit - 1; i++) {
        DeviceBrandRankValue value = tmps.get(i);
        String brand = MacBrandMemory.parserNull(value.getName());
        if (brand != null) {
          value.setName(brand);
          list.add(value);
        }
      }
      skip += tmps.size();
    } while (list.size() < olimit - 1 && tmps.size() == limit);

    if (list.size() > 0) {
      DeviceBrandRankValue top = tmps.get(0);
      DeviceBrandRankValue total = new DeviceBrandRankValue();
      total.setVt(Float.valueOf(1f * top.getVt() / top.getRvt()).intValue());
      total.setUv(Float.valueOf(1f * top.getUv() / top.getRuv()).intValue());
      DeviceBrandRankValue other = new DeviceBrandRankValue();
      for (DeviceBrandRankValue value : list) {
        other.setVt(other.getVt() + value.getVt());
        other.setUv(other.getUv() + value.getUv());
      }
      other.setVt(total.getVt() - other.getVt());
      other.setUv(total.getUv() - other.getUv());
      other.setRvt(1f * other.getVt() / total.getVt());
      other.setRuv(1f * other.getUv() / total.getUv());

      if (other.getVt() > 0 || other.getUv() > 0) {
        other.setName("其他");
        list.add(other);
      }
    }
    return list;
  }
 @Override
 public List<LoginAuthTypeRankValue> loginAuthTypeRank(
     String idshop, RankingType ranktype, Date start, Date end, int limit, int skip) {
   return mapper.loginAuthTypeRank(idshop, ranktype.name(), start, end, limit, skip);
 }