From ef926f0a53f25444854cb4c2acbafa68cefc6e9d Mon Sep 17 00:00:00 2001
From: yujian <yujian>
Date: 星期三, 06 三月 2019 11:40:19 +0800
Subject: [PATCH] 系统券查询加入缓存
---
fanli/src/main/java/com/yeshi/fanli/service/impl/lable/QualityFactoryServiceImpl.java | 327 ++++++++++++++++++++++-------------------------------
1 files changed, 136 insertions(+), 191 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 eb7eba4..a77aa6f 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
@@ -41,6 +41,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 {
@@ -71,12 +72,10 @@
@Resource
private TaoBaoGoodsUpdateService taoBaoGoodsUpdateService;
-
@Override
public int updateByPrimaryKeySelective(QualityFactory record) throws QualityFactoryException {
return qualityFactoryMapper.updateByPrimaryKeySelective(record);
}
-
@Override
public void deleteByTbAuctionId(Long auctionId) {
@@ -148,7 +147,6 @@
labelGoodsMapper.deleteBatchByGoodsId(listGid);
}
-
@Override
@Transactional
public void deleteByGoodsId(List<String> ids) throws QualityFactoryException {
@@ -159,7 +157,6 @@
}
}
}
-
@Override
public QualityFactory selectByPrimaryKey(Long id) throws QualityFactoryException {
@@ -178,29 +175,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
@@ -220,102 +201,61 @@
@Override
@Transactional
- public void addBatch(List<Long> auctionIdList, 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);
- }
-
- }
- }
-
- List<String> strList = new ArrayList<String>();
- for (Long id : auctionIdList) {
- strList.add(id + "");
- }
- List<TaoBaoGoodsBrief> existList = taoBaoGoodsBriefRecordMapper.queryGoodsByAuctionId(strList);
-
- List<QualityFactory> addList = new ArrayList<QualityFactory>();
- List<LabelGoods> addLabelList = new ArrayList<LabelGoods>();
-
- for (Long auctionId : auctionIdList) {
-
- boolean process = false;
- TaoBaoGoodsBrief goodsBrief = null;
-
- 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) {
+ public void addBatchGoodsByTaoBaoId(List<Long> listTaoBaoId, String lableNames, AdminUser admin)
+ throws Exception {
+
+ List<TaoBaoGoodsBrief> listAddGoods = new ArrayList<TaoBaoGoodsBrief>();
+ if (listTaoBaoId != null && listTaoBaoId.size() > 0) {
+ for (Long auctionId: listTaoBaoId) {
/* 鏍规嵁auctionId 鑾峰彇娣樺疂鍟嗗搧 */
- goodsBrief = redisManager.getTaoBaoGoodsBrief(auctionId);
+ TaoBaoGoodsBrief goodsBrief = TaoKeApiUtil.searchGoodsDetail(auctionId);
+ if (goodsBrief != null) {
+ listAddGoods.add(goodsBrief);
+ }
}
+ }
+ }
- if (goodsBrief == null)
- continue;
+
+ @Override
+ @Transactional
+ public void addBatchTaoBaoGoods(List<TaoBaoGoodsBrief> listTaoBaoGoods, String lableNames, AdminUser admin) throws Exception {
+
+ if (listTaoBaoGoods == null || listTaoBaoGoods.size() == 0) {
+ throw new Exception("鏈壘鍒板尮閰嶇殑鍟嗗搧");
+ }
+
+ // 鍒涘缓鏍囩
+ List<Label> listLabel = labelService.addBatchByNames(lableNames, admin);
- /* 鍒ゆ柇鍟嗗搧 鏄惁宸茬粡瀛樺湪鏁版嵁搴� */
- List<TaoBaoGoodsBrief> taoBaoGoodsBriefList = taoBaoGoodsBriefService.queryByAuctionId(auctionId);
+ List<QualityFactory> listQuality = new ArrayList<QualityFactory>();
+ List<LabelGoods> listLabelGoods = new ArrayList<LabelGoods>();
- if (taoBaoGoodsBriefList != null && taoBaoGoodsBriefList.size() > 0) {
+ for (TaoBaoGoodsBrief goodsBrief: listTaoBaoGoods) {
- TaoBaoGoodsBrief currentGoodsBrief = taoBaoGoodsBriefList.get(0);
+ // 鏈湴鏄惁宸插瓨鍦ㄦ鍟嗗搧
+ List<TaoBaoGoodsBrief> hasList = taoBaoGoodsBriefService.queryByAuctionId(goodsBrief.getAuctionId());
+ 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();
@@ -330,7 +270,7 @@
selectionGoods.setEntryMode(QualityFactory.MODE_MANUAL);// 浜哄伐绛涢��
selectionGoods.setGoodsSource(QualityFactory.SOURCE_TAOBAO);// 鏉ユ簮娣樺疂
- addList.add(selectionGoods);
+ listQuality.add(selectionGoods);
} else {
// 鏇存柊鍟嗗搧
QualityFactory selectionGoods = selectionList.get(0);
@@ -338,10 +278,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) {
@@ -351,23 +291,24 @@
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);
}
}
+
@Override
@Transactional
public void setWeightBatch(List<Long> idList, AdminUser admin, Integer weight, Integer weightSmall,
@@ -420,22 +361,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) {
@@ -445,10 +388,10 @@
}
}
}
-
+
return value;
}
-
+
@Override
@Transactional
public void updateGoodsFactory(List<Long> listId) {
@@ -466,8 +409,7 @@
List<Long> listDeleteQuality = new ArrayList<Long>();
// 鍒犻櫎鏍囩
List<Long> listDeleteLabel = new ArrayList<Long>();
-
-
+
List<QualityFactory> listUpdateQuality = new ArrayList<QualityFactory>();
List<TaoBaoGoodsBrief> listUpdateGoodsBrief = new ArrayList<TaoBaoGoodsBrief>();
@@ -477,37 +419,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 -> {
@@ -559,11 +501,12 @@
} else {
/* 鏇存柊鍟嗗搧淇℃伅 */
- TaoBaoGoodsBrief updateGoods = taoBaoGoodsUpdateService.getUpdateTaoBaoGoodsBrief(newGoodsBrief);
-
+ TaoBaoGoodsBrief updateGoods = taoBaoGoodsUpdateService
+ .getUpdateTaoBaoGoodsBrief(newGoodsBrief);
+
updateGoods.setId(id);
taoBaoGoodsBriefService.setGoodsBriefDefault(updateGoods);
-
+
listUpdateGoodsBrief.add(updateGoods);
/* 鏇存柊绮鹃�夊簱 淇℃伅鏃堕棿 */
@@ -620,7 +563,7 @@
if (listDeleteLabel.size() > 0) {
labelGoodsMapper.deleteBatchByGoodsId(listDeleteLabel);
}
-
+
// 娣诲姞鏍囩
if (listLabelAdd.size() > 0) {
labelGoodsMapper.insertBatch(listLabelAdd);
@@ -639,7 +582,6 @@
}
}
}
-
@Override
public void autoInsertOrUpadateStorage(List<TaoBaoGoodsBrief> goodsList, List<Label> listLabs,
@@ -676,8 +618,6 @@
}
}
-
-
// 鍟嗗搧id闆嗗悎
List<Long> listSystemTBid = new ArrayList<Long>();
@@ -693,7 +633,6 @@
List<QualityFactory> listAddInsert = new ArrayList<QualityFactory>();
// 杩涘叆绮鹃�夊晢鍝佸垪琛�
List<QualityFactory> listAddUpdate = new ArrayList<QualityFactory>();
-
// 鎻掑叆鍟嗗搧娣樺疂ID闆嗗悎
List<Long> listAuctionId = new ArrayList<Long>();
@@ -754,10 +693,10 @@
/* 鍟嗗搧宸插瓨鍦ㄦ暟鎹簱 */
if (isExist && systemId != null) {
-
+
// 鐢ㄤ簬纭畾鏄惁瀛樺湪绮鹃�夊簱
listSystemTBid.add(systemId);
-
+
// 鏇存柊鍟嗗搧淇℃伅
TaoBaoGoodsBrief updateGoods = taoBaoGoodsUpdateService.getUpdateTaoBaoGoodsBrief(newGoodsBrief);
// 璁剧疆涓婚敭id
@@ -767,41 +706,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) {
// 璐翠笂鏂版爣绛�
@@ -813,54 +753,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); // 鐘舵�佸惎鐢�
@@ -876,19 +814,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();
@@ -898,9 +837,9 @@
lg.setTaoBaoGoodsBrief(newGoodsBrief);
listLabelAdd.add(lg);
}
-
+
}
-
+
}
}
}
@@ -1031,29 +970,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);
@@ -1068,7 +1007,7 @@
listFlashSale.add(getNewQualityFlashSale(qfId, i, startWeight, endWeight, goodsSource));
}
}
-
+
}
// 鎻掑叆闄愭椂鎶㈣喘
@@ -1106,8 +1045,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());
@@ -1319,4 +1258,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