zoukankan      html  css  js  c++  java
  • 开发细节

    收集重复的门店,给出异常提示

    背景:需要建立一个门店组,门店明细不允许重复,重复时收集重复的门店

    点击查看代码
    	
    public Map getByStoreList(String bufferId,List storeList) {
        Map allMap = new HashMap<>();
        if (storeList == null || storeList.isEmpty()) {
          return allMap;
        }
        /**
         * 举个例子:重复的明细行不用收集太多,收集达到200的上限就可以了.
         * storeIds.size() = 1000
         *
         * 200 只统计200以内的重复的明细行
         */
        List storeIds = new ArrayList<>(storeList);
        int fromIndex = 0;
        while (fromIndex < storeIds.size()) {
          int toIndex = Math.min(fromIndex + 200, storeIds.size());
          List ids = storeIds.subList(fromIndex, toIndex);
          List lines = lineDao.getByStoreList(bufferId, ids);
          Map storeMap = new HashMap<>();
          for (BFreshGoodsAdjStoreLine line : lines) {
            storeMap.put(line.getStoreId(), line);
          }
          allMap.putAll(storeMap);
          fromIndex = toIndex;
        }
        return allMap;
      }
    
  • 相关阅读:
    6554545555
    484844
    学习资料整理
    word加上尾注之后参考文献下面的横线去除
    数据结构+算法
    python编程
    计算机网络(1)
    数据结构
    数据分析笔试(3)
    数据分析笔试(2)
  • 原文地址:https://www.cnblogs.com/erlangha/p/14658948.html
Copyright © 2011-2022 走看看