抖音评论列表代码提交(合代码,未完成测试)

master
yqy 2 years ago
parent 622d8a1545
commit a70a0c81cc

@ -82,8 +82,8 @@ public class TiktokHotCommentSopController {
@GetMapping("/commentPageList") @GetMapping("/commentPageList")
@ApiOperation("视频评论列表分页") @ApiOperation("视频评论列表分页")
public PageResult commentPageList(VideoDto videoDto, Pageable pageable) { public PageResult commentPageList(@RequestParam("videoId") String videoId, Pageable pageable) {
return hotCommentSopService.commentPageList(videoDto, pageable); return hotCommentSopService.commentPageList(videoId, pageable);
} }
@PostMapping("/updateVideo") @PostMapping("/updateVideo")

@ -86,4 +86,7 @@ public class DefaultKeyConstants {
public static final String IP_LABEL = "ip_label"; public static final String IP_LABEL = "ip_label";
public static final String URL_LIST = "url_list";
public static final String AVATAR_MEDIUM = "avatar_medium";
} }

@ -1,11 +1,14 @@
package com.baiye.entity; package com.baiye.entity;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data; import lombok.Data;
import java.util.Date; import java.util.Date;
import java.util.List;
import java.util.Map;
/** /**
* @author jt * @author jt
@ -27,5 +30,12 @@ public class CommentEntity {
private String nickName; private String nickName;
private Date createTime; private Date createTime;
private String vendorId; private String vendorId;
private String word;
private String matchingWord;
private String address;
private String avatarUrl;
@TableField(exist = false)
private List<Map<String, Object>> typeMapList;
} }

@ -53,7 +53,7 @@ public interface TiktokHotCommentSopService extends IService<TiktokHotCommentSop
/** /**
* *
*/ */
PageResult commentPageList(VideoDto videoDto, Pageable pageable); PageResult commentPageList(String videoId, Pageable pageable);
/** /**
* *

@ -12,7 +12,6 @@ import com.baiye.core.base.api.Result;
import com.baiye.core.constant.DefaultNumberConstants; import com.baiye.core.constant.DefaultNumberConstants;
import com.baiye.core.constant.HttpStatus; import com.baiye.core.constant.HttpStatus;
import com.baiye.core.page.PageResult; import com.baiye.core.page.PageResult;
import com.baiye.core.page.PageUtil;
import com.baiye.core.util.RedisUtils; import com.baiye.core.util.RedisUtils;
import com.baiye.core.util.StringUtils; import com.baiye.core.util.StringUtils;
import com.baiye.dao.*; import com.baiye.dao.*;
@ -26,7 +25,6 @@ import com.baiye.service.TiktokHotCommentSopService;
import com.baiye.service.TiktokNumOrganizeService; import com.baiye.service.TiktokNumOrganizeService;
import com.baiye.service.TiktokUserService; import com.baiye.service.TiktokUserService;
import com.baiye.utils.TiktokControlUtil; import com.baiye.utils.TiktokControlUtil;
import com.baiye.vo.CommentVo;
import com.baiye.vo.WriterInfoVo; import com.baiye.vo.WriterInfoVo;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
@ -60,6 +58,7 @@ public class TiktokHotCommentSopServiceImpl extends ServiceImpl<TiktokHotComment
private final TiktokEquipmentService equipmentService; private final TiktokEquipmentService equipmentService;
private final TiktokControlUtil controlUtil; private final TiktokControlUtil controlUtil;
private final RedisUtils redisUtils; private final RedisUtils redisUtils;
private final CommentMapper commentMapper;
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@ -202,46 +201,35 @@ public class TiktokHotCommentSopServiceImpl extends ServiceImpl<TiktokHotComment
} }
@Override @Override
public PageResult commentPageList(VideoDto videoDto, Pageable pageable) { public PageResult commentPageList(String videoId, Pageable pageable) {
List<CommentVo> commentVoList = new ArrayList<>(); Page<CommentEntity> page = new Page<>(pageable.getPageNumber(), pageable.getPageSize());
String videoId = videoDto.getVideoId(); QueryWrapper<CommentEntity> wrapper = new QueryWrapper<>();
List<KeyWordEntity> keyWordEntities = keyWordMapper.selectList(new QueryWrapper<KeyWordEntity>().eq("sop_id", videoDto.getHotCommentId())); wrapper.eq("aweme_id", videoId);
JSONObject videoCommentList = requestTiktok.getVideoCommentList("83f268b5-52ed-470c-a6b2-5111ed0d6d11", videoId); IPage<CommentEntity> iPage = commentMapper.selectPage(page, wrapper);
if (videoCommentList != null) { for (CommentEntity record : iPage.getRecords()) {
JSONArray jsonArray = videoCommentList.getJSONArray(DefaultKeyConstants.COMMENTS); List<Map<String, Object>> list = new ArrayList<>();
if (CollUtil.isNotEmpty(jsonArray)) { for (String str : record.getWord().split("\\s+")) {
for (Object obj : jsonArray) { boolean flag = false;
JSONObject commentObj = JSONUtil.parseObj(obj); for (String s : record.getMatchingWord().split("\\s+")) {
String text = commentObj.get(DefaultKeyConstants.TEXT) + ""; if (str.equals(s)) {
JSONObject userObj = commentObj.getJSONObject(DefaultKeyConstants.USER); flag = true;
for (KeyWordEntity keyWordEntity : keyWordEntities) { continue;
String[] arr = keyWordEntity.getWord().trim().split("\\s+"); }
WordTree tree = new WordTree(); }
for (String s : arr) { Map<String, Object> map = new HashMap<>();
tree.addWord(s); map.put("type", 0);
} map.put("word", str);
List<String> matchAll = tree.matchAll(text, -1, false, false); if (flag) {
if (CollUtil.isNotEmpty(matchAll)) { map.put("type", 1);
CommentVo commentVo = new CommentVo(); }
commentVo.setCommentId(commentObj.get(DefaultKeyConstants.CID) + ""); list.add(map);
long dateObj = Long.parseLong(commentObj.get(DefaultKeyConstants.CREATE_TIME) + "");
commentVo.setCommentTime(new Date(dateObj));
commentVo.setAddress(commentObj.get(DefaultKeyConstants.IP_LABEL) + "");
commentVo.setName(userObj.get(DefaultKeyConstants.NICK_NAME) + "");
commentVo.setText(text);
commentVo.setSpecificKeyWord(matchAll);
List<String> list = Arrays.asList(arr);
list.removeAll(matchAll);
commentVo.setKeyWord(list);
commentVoList.add(commentVo);
}
}
}
} }
record.setTypeMapList(list);
record.setWord(null);
record.setMatchingWord(null);
} }
List<CommentVo> returnList = commentVoList.stream().collect(Collectors.collectingAndThen(Collectors.toCollection( return PageResult.success(iPage.getTotal(), iPage.getPages(), iPage.getRecords());
() -> new TreeSet<>(Comparator.comparing(CommentVo::getCommentId))), ArrayList::new));
return PageResult.success((long) returnList.size(), PageUtil.toPage(pageable.getPageNumber() - 1, pageable.getPageSize(), returnList));
} }
@Override @Override
@ -283,9 +271,9 @@ public class TiktokHotCommentSopServiceImpl extends ServiceImpl<TiktokHotComment
for (TiktokHotCommentVideoEntity videoEntity : videoEntityList) { for (TiktokHotCommentVideoEntity videoEntity : videoEntityList) {
Result<Object> result = userService.awemeDetail(null, videoEntity.getVideoId()); Result<Object> result = userService.awemeDetail(null, videoEntity.getVideoId());
if (result.getCode() == HttpStatus.SUCCESS) { if (result.getCode() == HttpStatus.SUCCESS) {
JSONObject awemeDetailObj = JSONUtil.parseObj(result.getData()).getJSONObject(DefaultKeyConstants.AWEME_DETAIL); JSONObject videoDetailObj = JSONUtil.parseObj(result.getData()).getJSONObject(DefaultKeyConstants.AWEME_DETAIL);
if (awemeDetailObj != null) { if (videoDetailObj != null) {
JSONObject statisticsObj = awemeDetailObj.getJSONObject(DefaultKeyConstants.STATISTICS); JSONObject statisticsObj = videoDetailObj.getJSONObject(DefaultKeyConstants.STATISTICS);
videoEntity.setFabulousNum(Convert.toInt(statisticsObj.get(DefaultKeyConstants.ADMIRE_COUNT)));//????? videoEntity.setFabulousNum(Convert.toInt(statisticsObj.get(DefaultKeyConstants.ADMIRE_COUNT)));//?????
videoEntity.setCollectionNum(Convert.toInt(statisticsObj.get(DefaultKeyConstants.COLLECT_COUNT))); videoEntity.setCollectionNum(Convert.toInt(statisticsObj.get(DefaultKeyConstants.COLLECT_COUNT)));
videoEntity.setCommentNum(Convert.toInt(statisticsObj.get(DefaultKeyConstants.COMMENT_COUNT))); videoEntity.setCommentNum(Convert.toInt(statisticsObj.get(DefaultKeyConstants.COMMENT_COUNT)));
@ -338,12 +326,12 @@ public class TiktokHotCommentSopServiceImpl extends ServiceImpl<TiktokHotComment
for (TiktokHotCommentSearchEntity searchEntity : searchEntities) { for (TiktokHotCommentSearchEntity searchEntity : searchEntities) {
Result<Object> result = userService.searchUser(searchEntity.getMatchingMedia()); Result<Object> result = userService.searchUser(searchEntity.getMatchingMedia());
if (result.getCode() != HttpStatus.SUCCESS) { if (result.getCode() != HttpStatus.SUCCESS) {
log.error("========userId搜索失败:{}========", result.getMsg()); log.error("========搜索用户失败,错误信息:{}========", result.getMsg());
return; return;
} }
String userId = this.getUserId(result.getData()); String userId = this.getUserId(result.getData());
if (StringUtils.isBlank(userId)) { if (StringUtils.isBlank(userId)) {
log.error("========userId搜索为空========"); log.error("========搜索用户为空========");
return; return;
} }
userIdList.add(userId); userIdList.add(userId);
@ -358,7 +346,9 @@ public class TiktokHotCommentSopServiceImpl extends ServiceImpl<TiktokHotComment
this.parseGetVideoList(result.getData(), type, sopEntity, newVideoList); this.parseGetVideoList(result.getData(), type, sopEntity, newVideoList);
} }
} }
// 3、最新请求视频信息和数据库的视频信息“去重”然后插入-执行脚本 // 3、关键词匹配评论操作跟评
this.commentList(newVideoList, sopEntity);
// 4、最新请求视频信息和数据库的视频信息“去重”然后插入-执行脚本
if (CollUtil.isNotEmpty(newVideoList)) { if (CollUtil.isNotEmpty(newVideoList)) {
// 求差集-执行脚本-插入 // 求差集-执行脚本-插入
List<TiktokHotCommentVideoEntity> videoEntityList = videoMapper.selectList(new QueryWrapper<>()); List<TiktokHotCommentVideoEntity> videoEntityList = videoMapper.selectList(new QueryWrapper<>());
@ -377,13 +367,148 @@ public class TiktokHotCommentSopServiceImpl extends ServiceImpl<TiktokHotComment
} }
} }
/**
* JSON userId
*
* @param data
*/
public String getUserId(Object data) {
JSONObject jsonObject = JSONUtil.parseObj(data);
JSONArray jsonArray = JSONUtil.parseArray(jsonObject.get(DefaultKeyConstants.USER_LIST));
if (CollUtil.isNotEmpty(jsonArray)) {
// 取user_list集合的第一个数据就是准确匹配的那一个人
Object obj = jsonArray.get(DefaultNumberConstants.ZERO_NUMBER);
JSONObject dynamicPatch = JSONUtil.parseObj(obj).getJSONObject(DefaultKeyConstants.DYNAMIC_PATCH);
JSONObject rawData = dynamicPatch.getJSONObject(DefaultKeyConstants.RAW_DATA);
JSONObject rawDataObj = JSONUtil.parseObj(JSONUtil.toJsonStr(rawData));
JSONObject userInfoObj = rawDataObj.getJSONObject(DefaultKeyConstants.USER_INFO);
return userInfoObj.get(DefaultKeyConstants.UID).toString();
}
return null;
}
/**
* JSON,
*
* @param data JSON
* @param type
* @param hotCommentSopEntity sop
* @param newVideoList
*/
public void parseGetVideoList(Object data, String type, TiktokHotCommentSopEntity hotCommentSopEntity, List<TiktokHotCommentVideoEntity> newVideoList) {
Object objList = JSONUtil.parseObj(data).get(DefaultKeyConstants.AWEME_LIST);
JSONArray array = JSONUtil.parseArray(objList);
if (CollUtil.isNotEmpty(array)) {
List<TiktokHotCommentVideoEntity> videoEntityList = new ArrayList<>();
for (Object o : array) {
JSONObject obj = JSONUtil.parseObj(o);
TiktokHotCommentVideoEntity video = new TiktokHotCommentVideoEntity();
video.setVideoId(obj.get(DefaultKeyConstants.AWEME_ID) + "");
video.setHotCommentId(hotCommentSopEntity.getId());
video.setHotCommentName(hotCommentSopEntity.getName());
video.setVideoName(obj.get(DefaultKeyConstants.DESC) + "");
JSONObject authorObj = obj.getJSONObject(DefaultKeyConstants.AUTHOR);
video.setAuthorId(authorObj.get(DefaultKeyConstants.UID) + "");
video.setAuthorName(authorObj.get(DefaultKeyConstants.NICK_NAME) + "");
JSONObject statisticsObj = obj.getJSONObject(DefaultKeyConstants.STATISTICS);
video.setFabulousNum(Convert.toInt(statisticsObj.get(DefaultKeyConstants.ADMIRE_COUNT)));//?????
video.setCollectionNum(Convert.toInt(statisticsObj.get(DefaultKeyConstants.COLLECT_COUNT)));
video.setCommentNum(Convert.toInt(statisticsObj.get(DefaultKeyConstants.COMMENT_COUNT)));
video.setForwardNum(Convert.toInt(statisticsObj.get(DefaultKeyConstants.FORWARD_COUNT)));
video.setSortContent(type);
long dateObj = Long.parseLong(obj.get(DefaultKeyConstants.CREATE_TIME) + "");
video.setCreateTime(new Date(dateObj));
videoEntityList.add(video);
}
// 获取此人的第一个视频
if (CollUtil.isNotEmpty(videoEntityList)) {
TiktokHotCommentVideoEntity videoEntity = videoEntityList.stream()
.sorted((TiktokHotCommentVideoEntity o1, TiktokHotCommentVideoEntity o2) -> Long.compare(o2.getCreateTime().getTime(), o1.getCreateTime().getTime()))
.collect(Collectors.toList()).get(DefaultNumberConstants.ZERO_NUMBER);
newVideoList.add(videoEntity);
}
}
}
/**
*
*
* @param videoEntityList
* @param sopEntity
*/
public void commentList(List<TiktokHotCommentVideoEntity> videoEntityList, TiktokHotCommentSopEntity sopEntity) {
if (CollUtil.isNotEmpty(videoEntityList)) {
JSONArray jsonArrayAll = new JSONArray();
// 1、获取到所有视频的所有评论存入jsonArrayAll
for (TiktokHotCommentVideoEntity videoEntity : videoEntityList) {
JSONObject videoCommentList = requestTiktok.getVideoCommentList("83f268b5-52ed-470c-a6b2-5111ed0d6d11", videoEntity.getVideoId());
if (videoCommentList != null) {
JSONArray jsonArray = videoCommentList.getJSONArray(DefaultKeyConstants.COMMENTS);
if (CollUtil.isNotEmpty(jsonArray)) {
jsonArrayAll.addAll(jsonArray);
}
}
}
// 2、取出一个sop中所有关键词加入到DFA查找中
WordTree tree = new WordTree();
for (KeyWordEntity keyWordEntity : sopEntity.getKeyWordList()) {
String[] arr = keyWordEntity.getWord().trim().split("\\s+");
for (String str : arr) {
tree.addWord(str);
}
}
// 3、循环评论进行匹配
if (CollUtil.isNotEmpty(jsonArrayAll)) {
List<CommentEntity> saveList = new ArrayList<>();
for (Object obj : jsonArrayAll) {
JSONObject commentObj = JSONUtil.parseObj(obj);
String text = commentObj.get(DefaultKeyConstants.TEXT) + "";
JSONObject userObj = commentObj.getJSONObject(DefaultKeyConstants.USER);
// 3.1、匹配成功后添加信息
List<String> matchAll = tree.matchAll(text, -1, false, false);
if (CollUtil.isNotEmpty(matchAll)) {
CommentEntity commentEntity = new CommentEntity();
commentEntity.setCid(commentObj.get(DefaultKeyConstants.CID) + "");
long dateObj = Long.parseLong(commentObj.get(DefaultKeyConstants.CREATE_TIME) + "");
commentEntity.setCreateTime(new Date(dateObj));
commentEntity.setText(text);
commentEntity.setAwemeId(commentObj.get(DefaultKeyConstants.AWEME_ID) + "");
commentEntity.setMatchingWord(StringUtils.join((CharSequence) matchAll, ","));
commentEntity.setNickName(userObj.get(DefaultKeyConstants.NICK_NAME) + "");
commentEntity.setUserId(userObj.get(DefaultKeyConstants.UID) + "");
List<KeyWordEntity> keyWordList = sopEntity.getKeyWordList();
commentEntity.setWord(StringUtils.join((CharSequence) keyWordList, "\\+s"));
commentEntity.setAddress(commentObj.get(DefaultKeyConstants.IP_LABEL) + "");
String avatarUrl = (String) userObj.getJSONObject(DefaultKeyConstants.AVATAR_MEDIUM).getJSONArray(DefaultKeyConstants.URL_LIST).get(0);
commentEntity.setAvatarUrl(avatarUrl);
saveList.add(commentEntity);
}
}
// 3.2、插入信息
if (CollUtil.isNotEmpty(saveList)) {
// ArrayList<CommentEntity> insert = saveList.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(
// () -> new TreeSet<>(Comparator.comparing(CommentEntity::getCid))), ArrayList::new));
commentMapper.insertAll(saveList);
}
//4、匹配到的评论进行跟评
if (CollUtil.isNotEmpty(saveList)){
for (CommentEntity comment : saveList) {
requestTiktok.optCommentVideoComment("", comment.getAwemeId(), comment.getCid(),"小可爱");
}
}
}
}
}
/** /**
* *
* *
* @param videoEntityList * @param videoEntityList
* @param searchVendorId * @param searchVendorId
*/ */
public void implementScript(List<TiktokHotCommentVideoEntity> videoEntityList, String searchVendorId, TiktokHotCommentSopEntity sopEntity) { public void implementScript(List<TiktokHotCommentVideoEntity> videoEntityList, String
searchVendorId, TiktokHotCommentSopEntity sopEntity) {
List<TiktokHotCommentScriptEntity> scriptEntityList = scriptMapper.selectList( List<TiktokHotCommentScriptEntity> scriptEntityList = scriptMapper.selectList(
new QueryWrapper<TiktokHotCommentScriptEntity>().eq("hot_comment_id", sopEntity.getId())); new QueryWrapper<TiktokHotCommentScriptEntity>().eq("hot_comment_id", sopEntity.getId()));
Map<String, List<TiktokHotCommentVideoEntity>> videoMap = videoEntityList.stream().collect(Collectors.groupingBy(TiktokHotCommentVideoEntity::getSortContent)); Map<String, List<TiktokHotCommentVideoEntity>> videoMap = videoEntityList.stream().collect(Collectors.groupingBy(TiktokHotCommentVideoEntity::getSortContent));
@ -452,69 +577,6 @@ public class TiktokHotCommentSopServiceImpl extends ServiceImpl<TiktokHotComment
return null; return null;
} }
/**
* JSON userId
*
* @param data
*/
public String getUserId(Object data) {
JSONObject jsonObject = JSONUtil.parseObj(data);
JSONArray jsonArray = JSONUtil.parseArray(jsonObject.get(DefaultKeyConstants.USER_LIST));
if (CollUtil.isNotEmpty(jsonArray)) {
// 取user_list集合的第一个数据就是准确匹配的那一个人
Object obj = jsonArray.get(DefaultNumberConstants.ZERO_NUMBER);
JSONObject dynamicPatch = JSONUtil.parseObj(obj).getJSONObject(DefaultKeyConstants.DYNAMIC_PATCH);
JSONObject rawData = dynamicPatch.getJSONObject(DefaultKeyConstants.RAW_DATA);
JSONObject rawDataObj = JSONUtil.parseObj(JSONUtil.toJsonStr(rawData));
JSONObject userInfoObj = rawDataObj.getJSONObject(DefaultKeyConstants.USER_INFO);
return userInfoObj.get(DefaultKeyConstants.UID).toString();
}
return null;
}
/**
* JSON,
*
* @param data JSON
* @param type
* @param hotCommentSopEntity sop
* @param newVideoList
*/
public void parseGetVideoList(Object data, String type, TiktokHotCommentSopEntity hotCommentSopEntity, List<TiktokHotCommentVideoEntity> newVideoList) {
Object objList = JSONUtil.parseObj(data).get(DefaultKeyConstants.AWEME_LIST);
JSONArray array = JSONUtil.parseArray(objList);
if (CollUtil.isNotEmpty(array)) {
List<TiktokHotCommentVideoEntity> videoEntityList = new ArrayList<>();
for (Object o : array) {
JSONObject obj = JSONUtil.parseObj(o);
TiktokHotCommentVideoEntity video = new TiktokHotCommentVideoEntity();
video.setVideoId(obj.get(DefaultKeyConstants.AWEME_ID) + "");
video.setHotCommentId(hotCommentSopEntity.getId());
video.setHotCommentName(hotCommentSopEntity.getName());
video.setVideoName(obj.get(DefaultKeyConstants.DESC) + "");
JSONObject authorObj = obj.getJSONObject(DefaultKeyConstants.AUTHOR);
video.setAuthorId(authorObj.get(DefaultKeyConstants.UID) + "");
video.setAuthorName(authorObj.get(DefaultKeyConstants.NICK_NAME) + "");
JSONObject statisticsObj = obj.getJSONObject(DefaultKeyConstants.STATISTICS);
video.setFabulousNum(Convert.toInt(statisticsObj.get(DefaultKeyConstants.ADMIRE_COUNT)));//?????
video.setCollectionNum(Convert.toInt(statisticsObj.get(DefaultKeyConstants.COLLECT_COUNT)));
video.setCommentNum(Convert.toInt(statisticsObj.get(DefaultKeyConstants.COMMENT_COUNT)));
video.setForwardNum(Convert.toInt(statisticsObj.get(DefaultKeyConstants.FORWARD_COUNT)));
video.setSortContent(type);
long dateObj = Long.parseLong(obj.get(DefaultKeyConstants.CREATE_TIME) + "");
video.setCreateTime(new Date(dateObj));
videoEntityList.add(video);
}
// 获取此人的第一个视频
if (CollUtil.isNotEmpty(videoEntityList)) {
TiktokHotCommentVideoEntity videoEntity = videoEntityList.stream()
.sorted((TiktokHotCommentVideoEntity o1, TiktokHotCommentVideoEntity o2) -> Long.compare(o2.getCreateTime().getTime(), o1.getCreateTime().getTime()))
.collect(Collectors.toList()).get(DefaultNumberConstants.ZERO_NUMBER);
newVideoList.add(videoEntity);
}
}
}
/** /**
* *
* *
@ -522,7 +584,8 @@ public class TiktokHotCommentSopServiceImpl extends ServiceImpl<TiktokHotComment
* @param hotCommentSopEntity sop * @param hotCommentSopEntity sop
* @return key:ID val: * @return key:ID val:
*/ */
public Map<Long, String> getVendorId(List<TiktokHotCommentScriptEntity> scriptEntityList, TiktokHotCommentSopEntity hotCommentSopEntity) { public Map<Long, String> getVendorId
(List<TiktokHotCommentScriptEntity> scriptEntityList, TiktokHotCommentSopEntity hotCommentSopEntity) {
Map<Long, Integer> dataMap = new HashMap<>(); Map<Long, Integer> dataMap = new HashMap<>();
for (TiktokHotCommentScriptEntity scriptEntity : scriptEntityList) { for (TiktokHotCommentScriptEntity scriptEntity : scriptEntityList) {
Long preemptCommentOrganize = scriptEntity.getPreemptCommentOrganize(); Long preemptCommentOrganize = scriptEntity.getPreemptCommentOrganize();

@ -8,10 +8,11 @@
</resultMap> </resultMap>
<insert id="insertAll"> <insert id="insertAll">
insert into tb_comment (cid,text,awemeId,status,userId,nickName,createTime,vendorId) insert into tb_comment (cid,text,awemeId,status,userId,nickName,createTime,vendorId,word,matching_word,address,avatar_url)
values values
<foreach collection="list" item="item" index="index" separator=","> <foreach collection="list" item="item" index="index" separator=",">
( #{item.cid}, #{item.text},#{item.awemeId},#{item.status},#{item.userId},#{item.nickName},#{item.createTime},#{item.vendorId}) (#{item.cid}, #{item.text},#{item.awemeId},#{item.status},#{item.userId},#{item.nickName},#{item.createTime}
,#{item.vendorId},#{item.word},#{item.matchingWord},#{item.address},#{item.avatarUrl})
</foreach> </foreach>
</insert> </insert>
</mapper> </mapper>
Loading…
Cancel
Save