yujian
2019-05-14 ad9fbd2c18f280ef9bba47f28353d367cf2d94e8
fanli/src/main/java/com/yeshi/fanli/service/impl/lable/QualityFactoryServiceImpl.java
@@ -8,16 +8,15 @@
import java.util.Map;
import javax.annotation.Resource;
import javax.transaction.Transactional;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.yeshi.fanli.dao.mybatis.TaoBaoClassRelationMapper;
import com.yeshi.fanli.dao.mybatis.lable.LabelGoodsMapper;
import com.yeshi.fanli.dao.mybatis.lable.QualityFactoryMapper;
import com.yeshi.fanli.dao.mybatis.lable.QualityFlashSaleMapper;
import com.yeshi.fanli.dao.mybatis.taobao.TaoBaoGoodsBriefMapper;
import com.yeshi.fanli.dao.mybatis.taobao.TaoBaoGoodsBriefRecordMapper;
import com.yeshi.fanli.entity.bus.clazz.TaoBaoClassRelation;
import com.yeshi.fanli.entity.bus.lable.BoutiqueAutoRule;
import com.yeshi.fanli.entity.bus.lable.Label;
@@ -28,6 +27,7 @@
import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
import com.yeshi.fanli.exception.QualityFactoryException;
import com.yeshi.fanli.exception.taobao.TaobaoGoodsDownException;
import com.yeshi.fanli.exception.taobao.TaobaoGoodsUpdateException;
import com.yeshi.fanli.log.LogHelper;
import com.yeshi.fanli.service.inter.goods.TaoBaoGoodsBriefService;
import com.yeshi.fanli.service.inter.lable.LabelService;
@@ -40,6 +40,7 @@
import com.yeshi.fanli.util.StringUtil;
import com.yeshi.fanli.util.taobao.TaoBaoUtil;
import com.yeshi.fanli.util.taobao.TaoKeApiUtil;
import com.yeshi.fanli.vo.quality.QualityFactoryVO;
@Service
public class QualityFactoryServiceImpl implements QualityFactoryService {
@@ -59,8 +60,6 @@
   @Resource
   private TaoBaoUnionConfigService taoBaoUnionConfigService;
   @Resource
   private TaoBaoGoodsBriefRecordMapper taoBaoGoodsBriefRecordMapper;
   @Resource
   private TaoBaoClassRelationMapper taoBaoClassRelationMapper;
   @Resource
   private QualityFlashSaleService qualityFlashSaleService;
@@ -70,12 +69,10 @@
   @Resource
   private TaoBaoGoodsUpdateService taoBaoGoodsUpdateService;
   @Override
   public int updateByPrimaryKeySelective(QualityFactory record) throws QualityFactoryException {
      return qualityFactoryMapper.updateByPrimaryKeySelective(record);
   }
   @Override
   public void deleteByTbAuctionId(Long auctionId) {
@@ -147,7 +144,6 @@
      labelGoodsMapper.deleteBatchByGoodsId(listGid);
   }
   @Override
   @Transactional
   public void deleteByGoodsId(List<String> ids) throws QualityFactoryException {
@@ -158,7 +154,6 @@
         }
      }
   }
   @Override
   public QualityFactory selectByPrimaryKey(Long id) throws QualityFactoryException {
@@ -177,29 +172,13 @@
   }
   @Override
   public List<QualityFactory> query(long start, int count, String key, Integer totalSales, Integer price,
         Integer tkRate, Integer propor, Integer goodsSource, Integer days, Integer startZkPrice, Integer endZkPrice,
         Integer startBiz30day, Integer endBiz30day, Integer startWeight, Integer endWeight, Integer startTkRate,
         Integer endTkRate, Integer startAmount, Integer endAmount, Integer hasCoupon, Integer freeShipment,
         Integer isPrepay, Integer payRate30, Integer goodRate, Integer rfdRate, Integer startPropor,
         Integer endPropor, Long gcid, Integer keyType) throws QualityFactoryException {
      return qualityFactoryMapper.query(start, count, key, totalSales, price, tkRate, propor, goodsSource, days,
            startZkPrice, endZkPrice, startBiz30day, endBiz30day, startWeight, endWeight, startTkRate, endTkRate,
            startAmount, endAmount, hasCoupon, freeShipment, isPrepay, payRate30, goodRate, rfdRate, startPropor,
            endPropor, gcid, keyType);
   public List<QualityFactory> query(QualityFactoryVO qualityFactoryVO) throws QualityFactoryException {
      return qualityFactoryMapper.query(qualityFactoryVO);
   }
   @Override
   public long queryCount(String key, Integer goodsSource, Integer days, Integer startZkPrice, Integer endZkPrice,
         Integer startBiz30day, Integer endBiz30day, Integer startWeight, Integer endWeight, Integer startTkRate,
         Integer endTkRate, Integer startAmount, Integer endAmount, Integer hasCoupon, Integer freeShipment,
         Integer isPrepay, Integer payRate30, Integer goodRate, Integer rfdRate, Integer startPropor,
         Integer endPropor, Long gcid, Integer keyType) throws QualityFactoryException {
      return qualityFactoryMapper.queryCount(key, goodsSource, days, startZkPrice, endZkPrice, startBiz30day,
            endBiz30day, startWeight, endWeight, startTkRate, endTkRate, startAmount, endAmount, hasCoupon,
            freeShipment, isPrepay, payRate30, goodRate, rfdRate, startPropor, endPropor, gcid, keyType);
   public long queryCount(QualityFactoryVO qualityFactoryVO) throws QualityFactoryException {
      return qualityFactoryMapper.queryCount(qualityFactoryVO);
   }
   @Override
@@ -219,102 +198,44 @@
   @Override
   @Transactional
   public void addBatch(List<Long> auctionIdList, String lableNames, AdminUser admin) throws Exception {
   public void addBatchTaoBaoGoods(List<TaoBaoGoodsBrief> listTaoBaoGoods, String lableNames, AdminUser admin)
         throws Exception {
      List<Label> listLabs = new ArrayList<Label>();
      if (!StringUtil.isNullOrEmpty(lableNames)) {
         // 空格隔开
         String[] arrtitles = lableNames.split("\\s+");
         for (String title : arrtitles) {
            /* 遍历标签名称:查询数据库中是否已存在 */
            List<Label> labels = labelService.selectByTitle(title.trim());
            if (labels != null && labels.size() > 0) {
               Label label = labels.get(0);
               listLabs.add(label);
            } else {
               // 新增
               Label label = new Label();
               label.setTitle(title);// 名称
               label.setEntrymode(Label.MODE_SYSTEM); // 批量录入
               label.setCreatetime(new Date());
               label.setUpdatetime(new Date());
               label.setCreateUser(admin);
               label.setIosClick(0l);
               label.setAndroidClick(0l);
               labelService.insertSelective(label);
               listLabs.add(label);
            }
         }
      if (listTaoBaoGoods == null || listTaoBaoGoods.size() == 0) {
         throw new Exception("未找到匹配的商品");
      }
      List<String> strList = new ArrayList<String>();
      for (Long id : auctionIdList) {
         strList.add(id + "");
      }
      List<TaoBaoGoodsBrief> existList = taoBaoGoodsBriefRecordMapper.queryGoodsByAuctionId(strList);
      // 创建标签
      List<Label> listLabel = labelService.addBatchByNames(lableNames, admin);
      List<QualityFactory> addList = new ArrayList<QualityFactory>();
      List<LabelGoods> addLabelList = new ArrayList<LabelGoods>();
      List<QualityFactory> listQuality = new ArrayList<QualityFactory>();
      List<LabelGoods> listLabelGoods = new ArrayList<LabelGoods>();
      for (Long auctionId : auctionIdList) {
      for (TaoBaoGoodsBrief goodsBrief : listTaoBaoGoods) {
         boolean process = false;
         TaoBaoGoodsBrief goodsBrief = null;
         // 本地是否已存在此商品
         List<TaoBaoGoodsBrief> hasList = taoBaoGoodsBriefService.queryByAuctionId(goodsBrief.getAuctionId());
         if (existList != null && existList.size() > 0) {
            for (TaoBaoGoodsBrief taoBaoGoodsBrief : existList) {
               Long aId = taoBaoGoodsBrief.getAuctionId();
               if (auctionId.equals(aId)) {
                  goodsBrief = taoBaoGoodsBrief;
                  goodsBrief.setId(null);
                  process = true;
               }
            }
         }
         if (!process) {
            /* 根据auctionId 获取淘宝商品 */
            goodsBrief = redisManager.getTaoBaoGoodsBrief(auctionId);
         }
         if (goodsBrief == null)
            continue;
         /* 判断商品 是否已经存在数据库 */
         List<TaoBaoGoodsBrief> taoBaoGoodsBriefList = taoBaoGoodsBriefService.queryByAuctionId(auctionId);
         if (taoBaoGoodsBriefList != null && taoBaoGoodsBriefList.size() > 0) {
            TaoBaoGoodsBrief currentGoodsBrief = taoBaoGoodsBriefList.get(0);
         if (hasList != null && hasList.size() > 0) {
            TaoBaoGoodsBrief currentGoodsBrief = hasList.get(0);
            goodsBrief.setId(currentGoodsBrief.getId());
            // 更新商品最新信息
            taoBaoGoodsUpdateService.updateTaoBaoGoods(goodsBrief);
         } else {
            // 插入本地数据库
            goodsBrief.setId(null);
            goodsBrief.setState(0);
            goodsBrief.setCreatetime(new Date());
            goodsBrief.setUpdatetime(new Date());
            // 非空项 处理
            // 非空项 设置默认值
            setTaoBaoGoodsBriefDefault(goodsBrief);
            // 保存至本地
            taoBaoGoodsBriefService.insertSelective(goodsBrief);
         }
         // 是否已入库
         Long id = goodsBrief.getId();
         List<QualityFactory> selectionList = qualityFactoryMapper.queryByGoodsId(id);
         List<QualityFactory> selectionList = qualityFactoryMapper.queryByGoodsId(goodsBrief.getId());
         /* 进入精选商品库 */
         if (selectionList == null || selectionList.size() == 0) {
            // 添加至精选商品库
            QualityFactory selectionGoods = new QualityFactory();
@@ -329,7 +250,7 @@
            selectionGoods.setEntryMode(QualityFactory.MODE_MANUAL);// 人工筛选
            selectionGoods.setGoodsSource(QualityFactory.SOURCE_TAOBAO);// 来源淘宝
            addList.add(selectionGoods);
            listQuality.add(selectionGoods);
         } else {
            // 更新商品
            QualityFactory selectionGoods = selectionList.get(0);
@@ -337,10 +258,10 @@
            qualityFactoryMapper.updateByPrimaryKeySelective(selectionGoods);
         }
         if (listLabs.size() > 0) {
            for (Label label : listLabs) {
         if (listLabel != null && listLabel.size() > 0) {
            for (Label label : listLabel) {
               /* 贴上标签 : 已贴不处理则 */
               Long existence = labelGoodsMapper.isExistence(id, label.getId());
               Long existence = labelGoodsMapper.isExistence(goodsBrief.getId(), label.getId());
               // 该商品不存在此标签则添加, 反之不做处理
               if (existence == null || existence == 0l) {
@@ -350,19 +271,19 @@
                  lg.setCreateUser(admin);
                  lg.setCreatetime(new Date());
                  lg.setTaoBaoGoodsBrief(goodsBrief);
                  addLabelList.add(lg);
                  listLabelGoods.add(lg);
               }
            }
         }
      }
      if (addList.size() > 0) {
         qualityFactoryMapper.insertBatch(addList);
      if (listQuality.size() > 0) {
         qualityFactoryMapper.insertBatch(listQuality);
      }
      if (addLabelList.size() > 0) {
         labelGoodsMapper.insertBatch(addLabelList);
      if (listLabelGoods.size() > 0) {
         labelGoodsMapper.insertBatch(listLabelGoods);
      }
   }
@@ -419,22 +340,24 @@
      return qualityFactoryMapper.queryNeedUpdate(start, count, hour);
   }
   /**
    * 获取缓存
    * @param key 键
    * @param title 标签名称
    *
    * @param key
    *            键
    * @param title
    *            标签名称
    * @return
    */
   public String getLabelIdByRedis (String key, String title) throws Exception {
   public String getLabelIdByRedis(String key, String title) throws Exception {
      String value = redisManager.getCommonString(key);
      if (StringUtil.isNullOrEmpty(value)) {
         // id为空时系统进行查询
         List<Label> list9K9 = labelService.selectByTitle(title);
         if (list9K9 != null && list9K9.size() > 0) {
            Long id = list9K9.get(0).getId();
            if (id != null) {
@@ -444,10 +367,10 @@
            }
         }
      }
      return value;
   }
   @Override
   @Transactional
   public void updateGoodsFactory(List<Long> listId) {
@@ -461,9 +384,11 @@
         return;
      }
      // 删除精选库
      List<Long> listDeleteQuality = new ArrayList<Long>();
      // 删除标签
      List<Long> listDeleteLabel = new ArrayList<Long>();
      List<QualityFactory> listUpdateQuality = new ArrayList<QualityFactory>();
      List<TaoBaoGoodsBrief> listUpdateGoodsBrief = new ArrayList<TaoBaoGoodsBrief>();
@@ -473,37 +398,37 @@
      List<LabelGoods> listLabelAdd = new ArrayList<LabelGoods>();
      try {
         List<Long> list9Class = new ArrayList<Long>();
         Map<String, Label> map = new HashMap<String, Label>();
         if (Constant.IS_OUTNET) {
            String value9K9 = getLabelIdByRedis("lab-9K9", "9.9");
            String value19K9 = getLabelIdByRedis("lab-19K9", "19.9");
            String value29K9 = getLabelIdByRedis("lab-29K9", "29.9");
            String value49K9 = getLabelIdByRedis("lab-49K9", "49.9");
            if (!StringUtil.isNullOrEmpty(value9K9)) {
               map.put("9.9", new Label(Long.parseLong(value9K9)));
               list9Class.add(Long.parseLong(value9K9));
               list9Class.add(Long.parseLong(value9K9));
            }
            if (!StringUtil.isNullOrEmpty(value19K9)) {
               map.put("19.9", new Label(Long.parseLong(value19K9)));
               list9Class.add(Long.parseLong(value19K9));
               list9Class.add(Long.parseLong(value19K9));
            }
            if (!StringUtil.isNullOrEmpty(value29K9)) {
               map.put("29.9", new Label(Long.parseLong(value29K9)));
               list9Class.add(Long.parseLong(value29K9));
               list9Class.add(Long.parseLong(value29K9));
            }
            if (!StringUtil.isNullOrEmpty(value49K9)) {
               map.put("49.9", new Label(Long.parseLong(value49K9)));
               list9Class.add(Long.parseLong(value49K9));
               list9Class.add(Long.parseLong(value49K9));
            }
         }
         listQuality.parallelStream().forEach(quality -> {
@@ -540,6 +465,8 @@
                  /* 无券信息 移除精选库 */
                  listDeleteQuality.add(quality.getId());
                  // 移除标签
                  listDeleteLabel.add(goods.getId());
               } else {
                  /* 无券信息 移除精选库 */
@@ -548,13 +475,17 @@
                     // 移除精选库
                     listDeleteQuality.add(quality.getId());
                     // 移除标签
                     listDeleteLabel.add(goods.getId());
                  } else {
                     /* 更新商品信息 */
                     TaoBaoGoodsBrief updateGoods = taoBaoGoodsUpdateService
                           .getUpdateTaoBaoGoodsBrief(newGoodsBrief);
                     updateGoods.setId(id);
                     taoBaoGoodsBriefService.setGoodsBriefDefault(updateGoods);
                     listUpdateGoodsBrief.add(updateGoods);
                     /* 更新精选库 信息时间 */
@@ -592,7 +523,7 @@
         // 更新商品信息
         if (listUpdateGoodsBrief.size() > 0) {
            taoBaoGoodsBriefService.updateBatchSelective(listUpdateGoodsBrief);
            taoBaoGoodsUpdateService.updateTaoBaoGoods(listUpdateGoodsBrief);
         }
         // 更新精选库
@@ -603,6 +534,13 @@
         // 批量删除精选库
         if (listDeleteQuality.size() > 0) {
            qualityFactoryMapper.deleteBatchByPrimaryKey(listDeleteQuality);
            // 批量删除限时抢购
            qualityFlashSaleMapper.deleteBatchByQualityID(listDeleteQuality);
         }
         // 删除对应标签
         if (listDeleteLabel.size() > 0) {
            labelGoodsMapper.deleteBatchByGoodsId(listDeleteLabel);
         }
         // 添加标签
@@ -624,7 +562,6 @@
      }
   }
   @Override
   public void autoInsertOrUpadateStorage(List<TaoBaoGoodsBrief> goodsList, List<Label> listLabs,
         BoutiqueAutoRule autoRule) throws Exception {
@@ -643,6 +580,7 @@
            try {
               TaoBaoGoodsBrief taoBaoGoodsBrief = TaoKeApiUtil.searchGoodsDetail(goods.getAuctionId());
               if (taoBaoGoodsBrief != null) {
                  listGoodsBrief.add(taoBaoGoodsBrief);
               }
@@ -660,8 +598,13 @@
         }
      }
      for (int i = 0; i < goodsList.size(); i++) {
         if (goodsList.get(i).getMaterialLibType() != null && goodsList.get(i).getMaterialLibType() == 0) {
            goodsList.remove(i);
            i--;
         }
      }
      // 商品id集合
      List<Long> listSystemTBid = new ArrayList<Long>();
@@ -677,7 +620,6 @@
      List<QualityFactory> listAddInsert = new ArrayList<QualityFactory>();
      // 进入精选商品列表
      List<QualityFactory> listAddUpdate = new ArrayList<QualityFactory>();
      // 插入商品淘宝ID集合
      List<Long> listAuctionId = new ArrayList<Long>();
@@ -738,10 +680,10 @@
         /* 商品已存在数据库 */
         if (isExist && systemId != null) {
            // 用于确定是否存在精选库
            listSystemTBid.add(systemId);
            // 更新商品信息
            TaoBaoGoodsBrief updateGoods = taoBaoGoodsUpdateService.getUpdateTaoBaoGoodsBrief(newGoodsBrief);
            // 设置主键id
@@ -751,41 +693,42 @@
            updateGoods.setCreatetime(date);
            updateGoods.setUpdatetime(date);
            taoBaoGoodsBriefService.setGoodsBriefDefault(updateGoods);
            listGoodsUpdate.add(updateGoods);
            Long has9k9ID = null;
            /* 贴上标签   */
            /* 贴上标签 */
            if (listLabs != null && listLabs.size() > 0) {
               for (Label label : listLabs) {
                  //  包含 9.9/19.9/29.9/49.9 、同时来源淘宝推荐: 由于获取详情与推荐接口的券信息存在出入  以最后详情为准
                  if (list9Class.contains(label.getId()) && autoRule.isCalss9k9() && QualityFactory.SOURCE_TAOBAO_MATERIAL == autoRule.getGoodsSource()) {
                     /* 获取商品详情后计算是否属于 9k9系列  加入对应的标签*/
                  // 包含 9.9/19.9/29.9/49.9 、同时来源淘宝推荐: 由于获取详情与推荐接口的券信息存在出入
                  // 以最后详情为准
                  if (list9Class.contains(label.getId()) && autoRule.isCalss9k9()
                        && QualityFactory.SOURCE_TAOBAO_MATERIAL == autoRule.getGoodsSource()) {
                     /* 获取商品详情后计算是否属于 9k9系列 加入对应的标签 */
                     LabelGoods labelGds = screen9K9(updateGoods, map);
                     if (labelGds != null) {
                        Label label9k = labelGds.getLabel();
                        Long id = label9k.getId();
                        long existence = labelGoodsMapper.isExistence(systemId, id);
                        if (existence <= 0) {
                           // 不存在对应标签
                           listLabelAdd.add(labelGds);
                        } else {
                           // 已存在
                           has9k9ID = id;
                           has9k9ID = id;
                        }
                     }
                  } else {
                     long existence = labelGoodsMapper.isExistence(systemId, label.getId());
                     if (existence <= 0) {
                        // 贴上新标签
@@ -797,54 +740,52 @@
                        listLabelAdd.add(lg);
                     } else {
                        if(list9Class.contains(label.getId())){
                        if (list9Class.contains(label.getId())) {
                           // 已存在
                           has9k9ID = label.getId();
                           has9k9ID = label.getId();
                        }
                     }
                  }
               }
            }
            /* 判断是否已经贴上标签 9k9标签 */
            if (list9Class.size() > 0) {
               List<LabelGoods> listGlid = labelGoodsMapper.listQuery9k9Class(systemId, list9Class);
               if (listGlid != null && listGlid.size() > 0) {
                  if (has9k9ID == null && !autoRule.isCalss9k9()) {
                     // 非9k9入库规则  若商品信息变化 对应的标签根据价格 修改
                     // 非9k9入库规则 若商品信息变化 对应的标签根据价格 修改
                     LabelGoods labelGds = screen9K9(updateGoods, map);
                     if (labelGds != null) {
                        Label label9k = labelGds.getLabel();
                        Long id = label9k.getId();
                        long existence = labelGoodsMapper.isExistence(systemId, id);
                        if (existence <= 0) {
                           // 不存在对应标签
                           listLabelAdd.add(labelGds);
                        } else {
                           // 已存在
                           has9k9ID = id;
                           has9k9ID = id;
                        }
                     }
                  }
                  // 清空 9K9系列标签
                  for (LabelGoods labelGoods : listGlid) {
                     Label label = labelGoods.getLabel();
                     if (has9k9ID != null && has9k9ID.equals(label.getId())) {
                        continue;
                     }
                     list9ClassDelete.add(labelGoods.getId());
                  }
               }
            }
         } else {
            newGoodsBrief.setId(null);
            newGoodsBrief.setState(0); // 状态启用
@@ -860,19 +801,20 @@
            // 贴上标签
            if (listLabs != null && listLabs.size() > 0) {
               for (Label label : listLabs) {
                  // 包含 9.9/19.9/29.9/49.9 、同时来源淘宝推荐: 由于获取详情与推荐接口的券信息存在出入  以最后详情为准
                  if (list9Class.contains(label.getId()) && autoRule.isCalss9k9() &&
                        QualityFactory.SOURCE_TAOBAO_MATERIAL == autoRule.getGoodsSource()) {
                     /*  加入对应的9.9/19.9/29.9/49.9 标签*/
                  // 包含 9.9/19.9/29.9/49.9 、同时来源淘宝推荐: 由于获取详情与推荐接口的券信息存在出入
                  // 以最后详情为准
                  if (list9Class.contains(label.getId()) && autoRule.isCalss9k9()
                        && QualityFactory.SOURCE_TAOBAO_MATERIAL == autoRule.getGoodsSource()) {
                     /* 加入对应的9.9/19.9/29.9/49.9 标签 */
                     LabelGoods labelGds = screen9K9(newGoodsBrief, map);
                     if (labelGds != null) {
                        listLabelAdd.add(labelGds);
                     }
                  } else {
                     // 贴上新标签
                     LabelGoods lg = new LabelGoods();
@@ -882,9 +824,9 @@
                     lg.setTaoBaoGoodsBrief(newGoodsBrief);
                     listLabelAdd.add(lg);
                  }
               }
            }
         }
      }
@@ -944,8 +886,11 @@
            }
         }
         taoBaoGoodsBriefService.updateBatchSelective(listGoodsUpdate);
         try {
            taoBaoGoodsUpdateService.updateTaoBaoGoods(listGoodsUpdate);
         } catch (TaobaoGoodsUpdateException e) {
            System.out.println(e.getMsg());
         }
      }
      // 淘宝商品插入数据库
@@ -1012,29 +957,29 @@
      // 查询已存在显示限时抢购的商品
      List<QualityFlashSale> listQuery = qualityFlashSaleService.listQueryByQualityID(listQFId);
      if (listQuery == null || listQuery.size() == 0) {
         // 全部新增入库
         int i = 0;
         for (Long qfId : listQFId) {
            listFlashSale.add(getNewQualityFlashSale(qfId, i, startWeight, endWeight, goodsSource));
         }
      } else {
         int i = 0;
         boolean exist = false;
         for (Long qfId : listQFId) {
            for (QualityFlashSale flashSale : listQuery) {
               QualityFactory qualityFactory = flashSale.getQualityFactory();
               if (qfId.equals(qualityFactory.getId())) {
                  exist = true;
                  //即将准备时间段时间
                  //int nowType = qualityFlashSaleService.getQueryType();
                  //flashSale.setType(nowType);
                  // 即将准备时间段时间
                  // int nowType = qualityFlashSaleService.getQueryType();
                  // flashSale.setType(nowType);
                  double weight = startWeight + (Math.random() * ((endWeight - startWeight) + 1));
                  flashSale.setWeight(weight);
@@ -1049,7 +994,7 @@
               listFlashSale.add(getNewQualityFlashSale(qfId, i, startWeight, endWeight, goodsSource));
            }
         }
      }
      // 插入限时抢购
@@ -1087,8 +1032,8 @@
         flashSale.setWeight(weight);
      }
      //int nowType = qualityFlashSaleService.getNowType();
      //flashSale.setType(nowType);
      // int nowType = qualityFlashSaleService.getNowType();
      // flashSale.setType(nowType);
      flashSale.setCreatetime(new Date());
      flashSale.setUpdatetime(new Date());
@@ -1300,4 +1245,10 @@
      return lg;
   }
   @Override
   public List<QualityFactory> listByMinSalesCountOrderByCreateTimeDesc(int salesCount, int page, int pageSize) {
      return qualityFactoryMapper.listByMinSalesCountOrderByCreateTimeDesc(salesCount, (page - 1) * pageSize,
            pageSize);
   }
}