|
@@ -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,
|