From e179d8660bf4837455a38c24e74320143e0d2e17 Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期三, 23 一月 2019 16:05:28 +0800
Subject: [PATCH] 首页的邀请控制

---
 fanli/src/main/java/com/yeshi/fanli/service/impl/lable/QualityFactoryServiceImpl.java |  369 ++++++++++++++++------------------------------------
 1 files changed, 112 insertions(+), 257 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/lable/QualityFactoryServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/lable/QualityFactoryServiceImpl.java
index 266345e..020d4f2 100644
--- a/fanli/src/main/java/com/yeshi/fanli/service/impl/lable/QualityFactoryServiceImpl.java
+++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/lable/QualityFactoryServiceImpl.java
@@ -28,6 +28,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;
@@ -71,23 +72,8 @@
 	private TaoBaoGoodsUpdateService taoBaoGoodsUpdateService;
 
 	@Override
-	public int insert(QualityFactory record) throws QualityFactoryException {
-		return qualityFactoryMapper.insert(record);
-	}
-
-	@Override
-	public int updateByPrimaryKey(QualityFactory record) throws QualityFactoryException {
-		return qualityFactoryMapper.updateByPrimaryKey(record);
-	}
-
-	@Override
 	public int updateByPrimaryKeySelective(QualityFactory record) throws QualityFactoryException {
 		return qualityFactoryMapper.updateByPrimaryKeySelective(record);
-	}
-
-	@Override
-	public int deleteByPrimaryKey(Long id) throws QualityFactoryException {
-		return qualityFactoryMapper.deleteByPrimaryKey(id);
 	}
 
 	@Override
@@ -162,17 +148,6 @@
 
 	@Override
 	@Transactional
-	public void deleteBatchByPrimaryKey(List<String> ids) throws QualityFactoryException {
-
-		if (ids != null) {
-			for (String id : ids) {
-				qualityFactoryMapper.deleteByPrimaryKey(Long.parseLong(id));
-			}
-		}
-	}
-
-	@Override
-	@Transactional
 	public void deleteByGoodsId(List<String> ids) throws QualityFactoryException {
 
 		if (ids != null && ids.size() > 0) {
@@ -180,11 +155,6 @@
 				qualityFactoryMapper.deleteByGoodsId(Long.parseLong(goodsId));
 			}
 		}
-	}
-
-	@Override
-	public int removeStorageGoods(String doTime, Long gcids) throws QualityFactoryException {
-		return qualityFactoryMapper.removeStorageGoods(doTime, gcids);
 	}
 
 	@Override
@@ -279,11 +249,7 @@
 			}
 		}
 
-		List<String> strList = new ArrayList<String>();
-		for (Long id : auctionIdList) {
-			strList.add(id + "");
-		}
-		List<TaoBaoGoodsBrief> existList = taoBaoGoodsBriefRecordMapper.queryGoodsByAuctionId(strList);
+		List<TaoBaoGoodsBrief> existList = taoBaoGoodsBriefRecordMapper.queryByAuctionIdList(auctionIdList);
 
 		List<QualityFactory> addList = new ArrayList<QualityFactory>();
 		List<LabelGoods> addLabelList = new ArrayList<LabelGoods>();
@@ -320,10 +286,10 @@
 				TaoBaoGoodsBrief currentGoodsBrief = taoBaoGoodsBriefList.get(0);
 
 				goodsBrief.setId(currentGoodsBrief.getId());
-				// 闈炵┖椤� 澶勭悊
-				setTaoBaoGoodsBriefDefault(goodsBrief);
+
 				// 鏇存柊鍟嗗搧鏈�鏂颁俊鎭�
-				taoBaoGoodsBriefService.updateByPrimaryKey(goodsBrief);
+				taoBaoGoodsUpdateService.updateTaoBaoGoods(goodsBrief);
+
 			} else {
 
 				// 鎻掑叆鏈湴鏁版嵁搴�
@@ -361,7 +327,7 @@
 				// 鏇存柊鍟嗗搧
 				QualityFactory selectionGoods = selectionList.get(0);
 				selectionGoods.setUpdatetime(new Date());
-				qualityFactoryMapper.updateByPrimaryKey(selectionGoods);
+				qualityFactoryMapper.updateByPrimaryKeySelective(selectionGoods);
 			}
 
 			if (listLabs.size() > 0) {
@@ -419,7 +385,7 @@
 			}
 
 			// 淇敼鏉冮噸
-			// selectionGoods.setUpdateUser(admin);
+			selectionGoods.setUpdateUser(admin);
 			selectionGoods.setWeight(resultWeight);
 			qualityFactoryMapper.updateByPrimaryKeySelective(selectionGoods);
 		}
@@ -443,25 +409,27 @@
 
 	@Override
 	public List<Long> queryNeedUpdate(long start, int count, int hour) {
-		return qualityFactoryMapper.queryNeedUpdate(0, count, hour);
+		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) {
@@ -471,10 +439,10 @@
 				}
 			}
 		}
-		
+
 		return value;
 	}
-	
+
 	@Override
 	@Transactional
 	public void updateGoodsFactory(List<Long> listId) {
@@ -488,9 +456,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>();
@@ -500,37 +470,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 -> {
@@ -567,6 +537,8 @@
 
 						/* 鏃犲埜淇℃伅 绉婚櫎绮鹃�夊簱 */
 						listDeleteQuality.add(quality.getId());
+						// 绉婚櫎鏍囩
+						listDeleteLabel.add(goods.getId());
 
 					} else {
 						/* 鏃犲埜淇℃伅 绉婚櫎绮鹃�夊簱 */
@@ -575,13 +547,17 @@
 
 							// 绉婚櫎绮鹃�夊簱
 							listDeleteQuality.add(quality.getId());
+							// 绉婚櫎鏍囩
+							listDeleteLabel.add(goods.getId());
 
 						} else {
 							/* 鏇存柊鍟嗗搧淇℃伅 */
 							TaoBaoGoodsBrief updateGoods = taoBaoGoodsUpdateService
 									.getUpdateTaoBaoGoodsBrief(newGoodsBrief);
+
 							updateGoods.setId(id);
 							taoBaoGoodsBriefService.setGoodsBriefDefault(updateGoods);
+
 							listUpdateGoodsBrief.add(updateGoods);
 
 							/* 鏇存柊绮鹃�夊簱 淇℃伅鏃堕棿 */
@@ -619,7 +595,7 @@
 
 			// 鏇存柊鍟嗗搧淇℃伅
 			if (listUpdateGoodsBrief.size() > 0) {
-				taoBaoGoodsBriefService.updateBatchSelective(listUpdateGoodsBrief);
+				taoBaoGoodsUpdateService.updateTaoBaoGoods(listUpdateGoodsBrief);
 			}
 
 			// 鏇存柊绮鹃�夊簱
@@ -630,6 +606,13 @@
 			// 鎵归噺鍒犻櫎绮鹃�夊簱
 			if (listDeleteQuality.size() > 0) {
 				qualityFactoryMapper.deleteBatchByPrimaryKey(listDeleteQuality);
+				// 鎵归噺鍒犻櫎闄愭椂鎶㈣喘
+				qualityFlashSaleMapper.deleteBatchByQualityID(listDeleteQuality);
+			}
+
+			// 鍒犻櫎瀵瑰簲鏍囩
+			if (listDeleteLabel.size() > 0) {
+				labelGoodsMapper.deleteBatchByGoodsId(listDeleteLabel);
 			}
 
 			// 娣诲姞鏍囩
@@ -648,140 +631,6 @@
 			} catch (Exception e1) {
 				e1.printStackTrace();
 			}
-		}
-	}
-
-	@Override
-	@Transactional
-	public void updateBatchQualityFactory(List<QualityFactory> listQuality, List<Long> list9Class,
-			Map<String, Label> map) throws Exception {
-
-		if (listQuality == null || listQuality.size() == 0) {
-			return;
-		}
-
-		List<Long> listDeleteQuality = new ArrayList<Long>();
-		List<QualityFactory> listUpdateQuality = new ArrayList<QualityFactory>();
-
-		List<Long> listGid = new ArrayList<Long>();
-		List<TaoBaoGoodsBrief> listUpdateGoodsBrief = new ArrayList<TaoBaoGoodsBrief>();
-
-		List<Long> list9ClassDelete = new ArrayList<Long>();
-		// 娣诲姞鍟嗗搧鏍囩鍒楄〃
-		List<LabelGoods> listLabelAdd = new ArrayList<LabelGoods>();
-
-		listQuality.parallelStream().forEach(quality -> {
-
-			TaoBaoGoodsBrief goods = quality.getTaoBaoGoodsBrief();
-			if (goods == null) {
-				// 绉婚櫎绮鹃�夊簱
-				listDeleteQuality.add(quality.getId());
-			} else {
-				Long id = goods.getId();
-				Long auctionId = goods.getAuctionId();
-
-				try {
-					// 鑾峰彇璇︽儏
-					TaoBaoGoodsBrief taoBaoGoodsBrief = TaoKeApiUtil.searchGoodsDetail(auctionId);
-
-					if (taoBaoGoodsBrief == null) {
-						/* 鏃犲埜淇℃伅 绉婚櫎绮鹃�夊簱 */
-						listGid.add(id);
-					} else {
-						/* 鏃犲埜淇℃伅 绉婚櫎绮鹃�夊簱 */
-						if (StringUtil.isNullOrEmpty(taoBaoGoodsBrief.getCouponInfo())
-								&& StringUtil.isNullOrEmpty(taoBaoGoodsBrief.getCouponActivityId())) { // 鏃犲埜淇℃伅
-							// 绉婚櫎绮鹃�夊簱
-							listGid.add(id);
-
-							/* 鏇存柊鍟嗗搧淇℃伅 */
-							TaoBaoGoodsBrief updateGoods = taoBaoGoodsUpdateService
-									.getUpdateTaoBaoGoodsBrief(taoBaoGoodsBrief);
-							updateGoods.setId(id);
-							taoBaoGoodsBriefService.setGoodsBriefDefault(updateGoods);
-							listUpdateGoodsBrief.add(updateGoods);
-						} else {
-							/* 鏇存柊鍟嗗搧淇℃伅 */
-
-							TaoBaoGoodsBrief updateGoods = taoBaoGoodsUpdateService
-									.getUpdateTaoBaoGoodsBrief(taoBaoGoodsBrief);
-							updateGoods.setId(id);
-							taoBaoGoodsBriefService.setGoodsBriefDefault(updateGoods);
-							listUpdateGoodsBrief.add(updateGoods);
-
-							/* 鏇存柊绮鹃�夊簱 淇℃伅鏃堕棿 */
-							Integer biz30day = updateGoods.getBiz30day();
-							if (biz30day < 1000) {
-								// 閿�閲忓皬浜�1000 閲嶆柊璁剧疆鏉冮噸
-								int weight = 10 + (int) (Math.random() * 2000);
-								quality.setWeight(weight);
-							}
-							quality.setUpdatetime(new Date());
-
-							listUpdateQuality.add(quality);
-
-							/* 鍒ゆ柇鏄惁宸茬粡璐翠笂鏍囩 9k9鏍囩 瀵瑰簲浠锋牸鍙樺寲 */
-							if (list9Class.size() > 0) {
-								List<LabelGoods> listGlid = labelGoodsMapper.listQuery9k9Class(id, list9Class);
-								if (listGlid != null && listGlid.size() > 0) {
-									/* 鍒犻櫎鍘熸爣绛� 9k9 */
-									for (LabelGoods labelGoods : listGlid) {
-										list9ClassDelete.add(labelGoods.getId());
-									}
-
-									/* 璐翠笂鏂版爣绛� 9k9 */
-									LabelGoods labelGds = screen9K9(updateGoods, map);
-									if (labelGds != null) {
-										listLabelAdd.add(labelGds);
-									}
-								}
-							}
-						}
-					}
-
-				} catch (TaobaoGoodsDownException e1) {
-					// 鍟嗗搧涓嬫灦 绉婚櫎鏁版嵁搴�
-					taoBaoGoodsUpdateService.deleteTaoBaoGoods(auctionId);
-
-				} catch (Exception e) {
-					try {
-						LogHelper.errorDetailInfo(e);
-					} catch (Exception e1) {
-						e1.printStackTrace();
-					}
-				}
-			}
-
-		});
-
-		// 鏇存柊鍟嗗搧淇℃伅
-		if (listUpdateGoodsBrief.size() > 0) {
-			taoBaoGoodsBriefService.updateBatchSelective(listUpdateGoodsBrief);
-		}
-
-		// 鏇存柊绮鹃�夊簱
-		if (listUpdateQuality.size() > 0) {
-			qualityFactoryMapper.updateBatchSelective(listUpdateQuality);
-		}
-
-		// 鎵归噺绉婚櫎绮鹃�夊簱
-		if (listGid.size() > 0) {
-			deleteBatchByTaoBaoGoodsId(listGid);
-		}
-
-		// 鎵归噺鍒犻櫎绮鹃�夊簱
-		if (listDeleteQuality.size() > 0) {
-			qualityFactoryMapper.deleteBatchByPrimaryKey(listDeleteQuality);
-		}
-
-		// 娣诲姞鏍囩
-		if (listLabelAdd.size() > 0) {
-			labelGoodsMapper.insertBatch(listLabelAdd);
-		}
-
-		// 鍒犻櫎鏍囩
-		if (list9ClassDelete.size() > 0) {
-			labelGoodsMapper.deleteBatchByPK(list9ClassDelete);
 		}
 	}
 
@@ -820,8 +669,6 @@
 			}
 		}
 
-		
-		
 		// 鍟嗗搧id闆嗗悎
 		List<Long> listSystemTBid = new ArrayList<Long>();
 
@@ -837,7 +684,6 @@
 		List<QualityFactory> listAddInsert = new ArrayList<QualityFactory>();
 		// 杩涘叆绮鹃�夊晢鍝佸垪琛�
 		List<QualityFactory> listAddUpdate = new ArrayList<QualityFactory>();
-		
 
 		// 鎻掑叆鍟嗗搧娣樺疂ID闆嗗悎
 		List<Long> listAuctionId = new ArrayList<Long>();
@@ -898,10 +744,10 @@
 
 			/* 鍟嗗搧宸插瓨鍦ㄦ暟鎹簱 */
 			if (isExist && systemId != null) {
-				
+
 				// 鐢ㄤ簬纭畾鏄惁瀛樺湪绮鹃�夊簱
 				listSystemTBid.add(systemId);
-				
+
 				// 鏇存柊鍟嗗搧淇℃伅
 				TaoBaoGoodsBrief updateGoods = taoBaoGoodsUpdateService.getUpdateTaoBaoGoodsBrief(newGoodsBrief);
 				// 璁剧疆涓婚敭id
@@ -911,41 +757,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 銆佸悓鏃舵潵婧愭窐瀹濇帹鑽�: 鐢变簬鑾峰彇璇︽儏涓庢帹鑽愭帴鍙g殑鍒镐俊鎭瓨鍦ㄥ嚭鍏�  浠ユ渶鍚庤鎯呬负鍑�
-						if (list9Class.contains(label.getId()) && autoRule.isCalss9k9() && QualityFactory.SOURCE_TAOBAO_MATERIAL == autoRule.getGoodsSource()) {
-							
-							/* 鑾峰彇鍟嗗搧璇︽儏鍚庤绠楁槸鍚﹀睘浜� 9k9绯诲垪  鍔犲叆瀵瑰簲鐨勬爣绛�*/
+
+						// 鍖呭惈 9.9/19.9/29.9/49.9 銆佸悓鏃舵潵婧愭窐瀹濇帹鑽�: 鐢变簬鑾峰彇璇︽儏涓庢帹鑽愭帴鍙g殑鍒镐俊鎭瓨鍦ㄥ嚭鍏�
+						// 浠ユ渶鍚庤鎯呬负鍑�
+						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) {
 								// 璐翠笂鏂版爣绛�
@@ -957,54 +804,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); // 鐘舵�佸惎鐢�
@@ -1020,19 +865,20 @@
 
 				// 璐翠笂鏍囩
 				if (listLabs != null && listLabs.size() > 0) {
-					
+
 					for (Label label : listLabs) {
-						
-						// 鍖呭惈 9.9/19.9/29.9/49.9 銆佸悓鏃舵潵婧愭窐瀹濇帹鑽�: 鐢变簬鑾峰彇璇︽儏涓庢帹鑽愭帴鍙g殑鍒镐俊鎭瓨鍦ㄥ嚭鍏�  浠ユ渶鍚庤鎯呬负鍑�
-						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 銆佸悓鏃舵潵婧愭窐瀹濇帹鑽�: 鐢变簬鑾峰彇璇︽儏涓庢帹鑽愭帴鍙g殑鍒镐俊鎭瓨鍦ㄥ嚭鍏�
+						// 浠ユ渶鍚庤鎯呬负鍑�
+						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();
@@ -1042,9 +888,9 @@
 							lg.setTaoBaoGoodsBrief(newGoodsBrief);
 							listLabelAdd.add(lg);
 						}
-						
+
 					}
-					
+
 				}
 			}
 		}
@@ -1104,8 +950,11 @@
 				}
 
 			}
-
-			taoBaoGoodsBriefService.updateBatchSelective(listGoodsUpdate);
+			try {
+				taoBaoGoodsUpdateService.updateTaoBaoGoods(listGoodsUpdate);
+			} catch (TaobaoGoodsUpdateException e) {
+				System.out.println(e.getMsg());
+			}
 		}
 
 		// 娣樺疂鍟嗗搧鎻掑叆鏁版嵁搴�
@@ -1172,29 +1021,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);
@@ -1209,7 +1058,7 @@
 					listFlashSale.add(getNewQualityFlashSale(qfId, i, startWeight, endWeight, goodsSource));
 				}
 			}
-			
+
 		}
 
 		// 鎻掑叆闄愭椂鎶㈣喘
@@ -1247,8 +1096,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());
@@ -1460,4 +1309,10 @@
 		return lg;
 	}
 
+	@Override
+	public List<QualityFactory> listByMinSalesCountOrderByCreateTimeDesc(int salesCount, int page, int pageSize) {
+		return qualityFactoryMapper.listByMinSalesCountOrderByCreateTimeDesc(salesCount, (page - 1) * pageSize,
+				pageSize);
+	}
+
 }

--
Gitblit v1.8.0