Authored by 张帅

重复审核,不给@用户重复推送

... ... @@ -21,6 +21,7 @@ import com.yoho.service.model.social.response.UserInfoRspBO;
import com.yohobuy.platform.common.enums.ArticleTypeEnum;
import com.yohobuy.platform.common.exception.PlatformException;
import com.yohobuy.platform.common.helper.ImagesHelper;
import com.yohobuy.platform.common.util.CollectionUtil;
import com.yohobuy.platform.common.util.DateUtil;
import com.yohobuy.platform.common.util.SerializeUtils;
import com.yohobuy.platform.common.util.StringUtil;
... ... @@ -28,6 +29,7 @@ import com.yohobuy.platform.dal.grass.*;
import com.yohobuy.platform.dal.grass.model.*;
import com.yohobuy.platform.dal.guang.IAuthorDAO;
import com.yohobuy.platform.dal.guang.model.Author;
import com.yohobuy.platform.dal.product.model.Goods;
import com.yohobuy.platform.grass.cache.UserInfoCacheHelper;
import com.yohobuy.platform.grass.service.IGrassArticleService;
import com.yohobuy.platform.grass.service.IGrassRefreshCacheService;
... ... @@ -845,6 +847,24 @@ public class GrassArticleServiceImpl implements IGrassArticleService {
List<GrassArticleBlock> articleBlocks = grassArticleBlockDao.selectByArticleId(articleId);
List<Integer> uidList = handleUserWithAt(articleBlocks);
if(CollectionUtils.isNotEmpty(uidList)){
List<GrassInformRecord> informRecordList = grassInformRecordDao.selectByArticleIdAndUidsAndSceneType(articleId, uidList, MsgInformSceneEnum.ARTICLE_AT_INFORM.getType());
Map<Integer, List<GrassInformRecord>> map = informRecordList.stream().collect(Collectors.groupingBy(GrassInformRecord::getUid));
List<GrassInformRecord> addInformRecords = Lists.newArrayList();
List<Integer> sendedList = Lists.newArrayList();
for (Integer uid : uidList) {
//已经发过站内信了
if (CollectionUtils.isNotEmpty(map.get(uid))) {
sendedList.add(uid);
} else { //第一次发,记录发送
GrassInformRecord grassInformRecord = new GrassInformRecord();
grassInformRecord.setArticleId(articleId);
grassInformRecord.setUid(uid);
grassInformRecord.setSceneType(MsgInformSceneEnum.ARTICLE_AT_INFORM.getType());
grassInformRecord.setCreateTime(com.yoho.core.common.utils.DateUtil.getCurrentTimeSecond());
addInformRecords.add(grassInformRecord);
}
}
uidList.removeAll(sendedList);
if(filterFlag){
//查询社区大号、品牌号、KOL的uid
List<Integer> groupIds = new ArrayList<>();
... ... @@ -926,12 +946,17 @@ public class GrassArticleServiceImpl implements IGrassArticleService {
addReqList.add(addReq);
});
sendBatchInbox(addReqList);
if(CollectionUtils.isNotEmpty(addInformRecords)){
grassInformRecordDao.insertBatch(addInformRecords);
}
}
}
public void sendBatchInbox(List<GrassInBoxAddReq> reqs){
try {
if(CollectionUtils.isEmpty(reqs)){
return;
}
logger.info("before gateway.addBatchGrassInBox.addReqList size is {}", reqs.size());
String url = apiUrl + "/guang/api/addBatchInBox/?client_type=h5";
serviceCaller.post("gateway.addBatchGrassInBox", url, reqs,
... ...
... ... @@ -106,13 +106,14 @@ public class GrassRewardsServiceImpl implements IGrassRewardsService {
}
@Override
public PageResponseVO<GrassRewardRsp> getRewardsList(GrassRewardReq req) {
Integer type = req.getType();
Integer type = req.getType()==null || req.getType()== 8 ? null : req.getType();
Integer startTime = req.getStartTime();
Integer endTime = req.getEndTime();
Integer status = req.getStatus();
Integer valid = req.getValid();
Integer valid = req.getValid()==null || req.getValid()== 8 ? null : req.getValid();
String rewardName = StringUtils.isEmpty(req.getRewardName())? null : req.getRewardName();
Integer priorityOrder = req.getPriorityOrder();
int total = grassRewardsConfigDAO.selectTotalByCondition(type, startTime, endTime,
status, priorityOrder, rewardName,valid,DateUtil.getCurrentTimeSeconds());
if(total == 0){
... ...
package com.yohobuy.platform.grass.util;
public enum MsgInformSceneEnum {
ARTICLE_RECOMMEND_INFORM(1, "文章推荐通知");
ARTICLE_RECOMMEND_INFORM(1, "文章推荐通知"),
ARTICLE_AT_INFORM(2, "文章@用户通知");
private Integer type;
private String name;
... ...