...
|
...
|
@@ -293,6 +293,7 @@ public class GrassArticleServiceImpl implements IGrassArticleService { |
|
|
try {
|
|
|
if (CollectionUtils.isNotEmpty(grassArticleChannels) && sort != 3) {
|
|
|
grassArticleChannelDao.insertArticleChannels(grassArticleChannels);
|
|
|
updateFindgoodsList(article.getId(),channelIds);
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
logger.warn("publishArticle ,grassArticleChannelDao insertArticleChannels error, uid is {}, e is {}", req.getAuthorUid(), e);
|
...
|
...
|
@@ -332,6 +333,40 @@ public class GrassArticleServiceImpl implements IGrassArticleService { |
|
|
return article.getId();
|
|
|
}
|
|
|
|
|
|
private void updateFindgoodsList(Integer articleId , List<Integer> channelIdList){
|
|
|
grassFindGoodsDAO.deleteByArticleId(articleId);
|
|
|
//同时更新发现好物表,兼容以前逻辑
|
|
|
if(channelIdList.contains(1)){
|
|
|
long time = System.currentTimeMillis();
|
|
|
List<GrassArticleProduct> grassArticleProductList = grassArticleProductDao.selectByArticleId(articleId);
|
|
|
if (CollectionUtils.isNotEmpty(grassArticleProductList)) {
|
|
|
GrassArticleProduct product = grassArticleProductList.get(0);
|
|
|
GrassFindGoods grassFindGoods = new GrassFindGoods();
|
|
|
grassFindGoods.setCreateTime(time);
|
|
|
grassFindGoods.setArticleId(articleId);
|
|
|
grassFindGoods.setOrderBy(1);
|
|
|
grassFindGoods.setProductType(product.getProductSource());
|
|
|
grassFindGoods.setProductSkn(product.getProductSkn());
|
|
|
grassFindGoods.setUpdateTime(time);
|
|
|
//发现好物初始喜欢数
|
|
|
String initThresholdStr = configReader.getString("platform.grass.findgoods.favoriteNum.initThreshold", "");
|
|
|
//取区间随机数
|
|
|
String[] initStr = initThresholdStr.split(",");
|
|
|
int min = Integer.valueOf(initStr[0]);
|
|
|
int max = Integer.valueOf(initStr[1]);
|
|
|
grassFindGoods.setVirtualNum((new Random().nextInt(max - min)) + min);
|
|
|
grassFindGoodsDAO.insert(grassFindGoods);
|
|
|
|
|
|
//清除发现好物列表缓存
|
|
|
logger.info("clear findgoodlist, type=1008");
|
|
|
GrassCacheReq cacheReq = new GrassCacheReq();
|
|
|
cacheReq.setClearCode(1008);
|
|
|
grassRefreshCacheService.refreshGrassCache(cacheReq);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
private List<GrassArticleLabel> buildArticleLabels(int articleId, List<Integer> lableList, Integer authStatus) {
|
|
|
List<GrassArticleLabel> grassArticleLables = Lists.newArrayList();
|
|
|
for (Integer lableId : lableList) {
|
...
|
...
|
@@ -802,6 +837,7 @@ public class GrassArticleServiceImpl implements IGrassArticleService { |
|
|
try {
|
|
|
if (CollectionUtils.isNotEmpty(grassArticleChannels) && 3 != sort) {
|
|
|
grassArticleChannelDao.insertArticleChannels(grassArticleChannels);
|
|
|
updateFindgoodsList(articleId,channels);
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
logger.warn("updateArticle grassArticleChannelDao insertArticleChannels error, uid is {}, e is {}", req.getAuthorUid(), e);
|
...
|
...
|
@@ -1416,6 +1452,7 @@ public class GrassArticleServiceImpl implements IGrassArticleService { |
|
|
}
|
|
|
}
|
|
|
grassArticleChannelDao.insertArticleChannels(grassArticleChannels);
|
|
|
updateFindgoodsList(articleId,channels);
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
logger.warn("updateArticleDraft ,grassArticleChannelDao insertArticleChannels error, uid is {}, e is {}", req.getAuthorUid(), e);
|
...
|
...
|
@@ -1609,6 +1646,7 @@ public class GrassArticleServiceImpl implements IGrassArticleService { |
|
|
channel.setCreateTime(time);
|
|
|
}
|
|
|
grassArticleChannelDao.insertArticleChannels(grassArticleChannels);
|
|
|
updateFindgoodsList(article.getId(),channels);
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
logger.warn("timerPublish ,grassArticleChannelDao insertArticleChannels error, uid is {}, e is {}", req.getAuthorUid(), e);
|
...
|
...
|
|