Authored by 张帅

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

@@ -21,6 +21,7 @@ import com.yoho.service.model.social.response.UserInfoRspBO; @@ -21,6 +21,7 @@ import com.yoho.service.model.social.response.UserInfoRspBO;
21 import com.yohobuy.platform.common.enums.ArticleTypeEnum; 21 import com.yohobuy.platform.common.enums.ArticleTypeEnum;
22 import com.yohobuy.platform.common.exception.PlatformException; 22 import com.yohobuy.platform.common.exception.PlatformException;
23 import com.yohobuy.platform.common.helper.ImagesHelper; 23 import com.yohobuy.platform.common.helper.ImagesHelper;
  24 +import com.yohobuy.platform.common.util.CollectionUtil;
24 import com.yohobuy.platform.common.util.DateUtil; 25 import com.yohobuy.platform.common.util.DateUtil;
25 import com.yohobuy.platform.common.util.SerializeUtils; 26 import com.yohobuy.platform.common.util.SerializeUtils;
26 import com.yohobuy.platform.common.util.StringUtil; 27 import com.yohobuy.platform.common.util.StringUtil;
@@ -28,6 +29,7 @@ import com.yohobuy.platform.dal.grass.*; @@ -28,6 +29,7 @@ import com.yohobuy.platform.dal.grass.*;
28 import com.yohobuy.platform.dal.grass.model.*; 29 import com.yohobuy.platform.dal.grass.model.*;
29 import com.yohobuy.platform.dal.guang.IAuthorDAO; 30 import com.yohobuy.platform.dal.guang.IAuthorDAO;
30 import com.yohobuy.platform.dal.guang.model.Author; 31 import com.yohobuy.platform.dal.guang.model.Author;
  32 +import com.yohobuy.platform.dal.product.model.Goods;
31 import com.yohobuy.platform.grass.cache.UserInfoCacheHelper; 33 import com.yohobuy.platform.grass.cache.UserInfoCacheHelper;
32 import com.yohobuy.platform.grass.service.IGrassArticleService; 34 import com.yohobuy.platform.grass.service.IGrassArticleService;
33 import com.yohobuy.platform.grass.service.IGrassRefreshCacheService; 35 import com.yohobuy.platform.grass.service.IGrassRefreshCacheService;
@@ -845,6 +847,24 @@ public class GrassArticleServiceImpl implements IGrassArticleService { @@ -845,6 +847,24 @@ public class GrassArticleServiceImpl implements IGrassArticleService {
845 List<GrassArticleBlock> articleBlocks = grassArticleBlockDao.selectByArticleId(articleId); 847 List<GrassArticleBlock> articleBlocks = grassArticleBlockDao.selectByArticleId(articleId);
846 List<Integer> uidList = handleUserWithAt(articleBlocks); 848 List<Integer> uidList = handleUserWithAt(articleBlocks);
847 if(CollectionUtils.isNotEmpty(uidList)){ 849 if(CollectionUtils.isNotEmpty(uidList)){
  850 + List<GrassInformRecord> informRecordList = grassInformRecordDao.selectByArticleIdAndUidsAndSceneType(articleId, uidList, MsgInformSceneEnum.ARTICLE_AT_INFORM.getType());
  851 + Map<Integer, List<GrassInformRecord>> map = informRecordList.stream().collect(Collectors.groupingBy(GrassInformRecord::getUid));
  852 + List<GrassInformRecord> addInformRecords = Lists.newArrayList();
  853 + List<Integer> sendedList = Lists.newArrayList();
  854 + for (Integer uid : uidList) {
  855 + //已经发过站内信了
  856 + if (CollectionUtils.isNotEmpty(map.get(uid))) {
  857 + sendedList.add(uid);
  858 + } else { //第一次发,记录发送
  859 + GrassInformRecord grassInformRecord = new GrassInformRecord();
  860 + grassInformRecord.setArticleId(articleId);
  861 + grassInformRecord.setUid(uid);
  862 + grassInformRecord.setSceneType(MsgInformSceneEnum.ARTICLE_AT_INFORM.getType());
  863 + grassInformRecord.setCreateTime(com.yoho.core.common.utils.DateUtil.getCurrentTimeSecond());
  864 + addInformRecords.add(grassInformRecord);
  865 + }
  866 + }
  867 + uidList.removeAll(sendedList);
848 if(filterFlag){ 868 if(filterFlag){
849 //查询社区大号、品牌号、KOL的uid 869 //查询社区大号、品牌号、KOL的uid
850 List<Integer> groupIds = new ArrayList<>(); 870 List<Integer> groupIds = new ArrayList<>();
@@ -926,12 +946,17 @@ public class GrassArticleServiceImpl implements IGrassArticleService { @@ -926,12 +946,17 @@ public class GrassArticleServiceImpl implements IGrassArticleService {
926 addReqList.add(addReq); 946 addReqList.add(addReq);
927 }); 947 });
928 sendBatchInbox(addReqList); 948 sendBatchInbox(addReqList);
929 - 949 + if(CollectionUtils.isNotEmpty(addInformRecords)){
  950 + grassInformRecordDao.insertBatch(addInformRecords);
  951 + }
930 } 952 }
931 } 953 }
932 954
933 public void sendBatchInbox(List<GrassInBoxAddReq> reqs){ 955 public void sendBatchInbox(List<GrassInBoxAddReq> reqs){
934 try { 956 try {
  957 + if(CollectionUtils.isEmpty(reqs)){
  958 + return;
  959 + }
935 logger.info("before gateway.addBatchGrassInBox.addReqList size is {}", reqs.size()); 960 logger.info("before gateway.addBatchGrassInBox.addReqList size is {}", reqs.size());
936 String url = apiUrl + "/guang/api/addBatchInBox/?client_type=h5"; 961 String url = apiUrl + "/guang/api/addBatchInBox/?client_type=h5";
937 serviceCaller.post("gateway.addBatchGrassInBox", url, reqs, 962 serviceCaller.post("gateway.addBatchGrassInBox", url, reqs,
@@ -106,13 +106,14 @@ public class GrassRewardsServiceImpl implements IGrassRewardsService { @@ -106,13 +106,14 @@ public class GrassRewardsServiceImpl implements IGrassRewardsService {
106 } 106 }
107 @Override 107 @Override
108 public PageResponseVO<GrassRewardRsp> getRewardsList(GrassRewardReq req) { 108 public PageResponseVO<GrassRewardRsp> getRewardsList(GrassRewardReq req) {
109 - Integer type = req.getType(); 109 + Integer type = req.getType()==null || req.getType()== 8 ? null : req.getType();
110 Integer startTime = req.getStartTime(); 110 Integer startTime = req.getStartTime();
111 Integer endTime = req.getEndTime(); 111 Integer endTime = req.getEndTime();
112 Integer status = req.getStatus(); 112 Integer status = req.getStatus();
113 - Integer valid = req.getValid(); 113 + Integer valid = req.getValid()==null || req.getValid()== 8 ? null : req.getValid();
114 String rewardName = StringUtils.isEmpty(req.getRewardName())? null : req.getRewardName(); 114 String rewardName = StringUtils.isEmpty(req.getRewardName())? null : req.getRewardName();
115 Integer priorityOrder = req.getPriorityOrder(); 115 Integer priorityOrder = req.getPriorityOrder();
  116 +
116 int total = grassRewardsConfigDAO.selectTotalByCondition(type, startTime, endTime, 117 int total = grassRewardsConfigDAO.selectTotalByCondition(type, startTime, endTime,
117 status, priorityOrder, rewardName,valid,DateUtil.getCurrentTimeSeconds()); 118 status, priorityOrder, rewardName,valid,DateUtil.getCurrentTimeSeconds());
118 if(total == 0){ 119 if(total == 0){
1 package com.yohobuy.platform.grass.util; 1 package com.yohobuy.platform.grass.util;
2 2
3 public enum MsgInformSceneEnum { 3 public enum MsgInformSceneEnum {
4 - ARTICLE_RECOMMEND_INFORM(1, "文章推荐通知"); 4 + ARTICLE_RECOMMEND_INFORM(1, "文章推荐通知"),
  5 + ARTICLE_AT_INFORM(2, "文章@用户通知");
5 6
6 private Integer type; 7 private Integer type;
7 private String name; 8 private String name;