Merge remote-tracking branch 'origin/master'

# Conflicts:
#	cdp-tools/cdp-tool-dy/dy-tool-member/dy-tool-member-api/src/main/java/com/baiye/controller/TiktokVideoCommentController.java
master
bynt 2 years ago
commit 0d3eb26a15

@ -87,7 +87,10 @@ public interface TiktokRequestConstants {
*
*/
String GET_FOLLOWER_LIST = "/api/user/optFollowerList";
/**
*
*/
String GET_FOLLOW_USER ="/api/user/optFollowUser";
/**
*

@ -1,5 +1,6 @@
package com.baiye.controller;
import com.baiye.core.base.api.Result;
import com.baiye.core.page.PageResult;
import com.baiye.query.FollowerListQuery;
import com.baiye.service.FollowerListService;
@ -27,4 +28,9 @@ public class FollowerListController {
public PageResult queryFollowerList(FollowerListQuery followerListQuery, Pageable pageable) {
return followerListService.queryFollowerList(followerListQuery,pageable);
}
@GetMapping("follow/user")
@ApiOperation("关注人员")
public Result<Object> optFollowUser(String vendorId, String userId) {
return followerListService.optFollowUser(vendorId,userId);
}
}

@ -53,9 +53,9 @@ public class TiktokSopController {
return Result.success();
}
@DeleteMapping("delete")
@DeleteMapping("delete/{sopId}")
@ApiOperation("删除sop")
public Result<Object> deleteSop(Long sopId) {
public Result<Object> deleteSop(@PathVariable Long sopId) {
tiktokSopService.deleteSop(sopId);
return Result.success();
}
@ -65,11 +65,13 @@ public class TiktokSopController {
tiktokSopService.search(dyId);
return Result.success();
}
@GetMapping("filterSop")
public Result<Object> filterSop() {
tiktokSopService.filterSop();
return Result.success();
}
@GetMapping("preciseReview")
public Result<Object> preciseReview(String dyId) {
tiktokSopService.search(dyId);

@ -63,9 +63,9 @@ public class TiktokVideoCommentController {
@ApiOperation("删除评论")
@GetMapping("/delete")
public Result<String> deleteMessage
(@RequestParam("tiktokId") Long tiktokId,@RequestParam("videoId") Long videoId) {
this.tiktokVideoCommentService.deleteComment(tiktokId, videoId);
public Result<PageResult> deleteMessage
(@RequestParam("userId") Long memberId) {
this.tiktokVideoCommentService.deleteComment(memberId);
return Result.success();
}

@ -0,0 +1,37 @@
package com.baiye.job.dy_tool_member;
import com.baiye.service.impl.TiktokSopServiceImpl;
import com.dangdang.ddframe.job.api.ShardingContext;
import com.dangdang.ddframe.job.api.simple.SimpleJob;
import com.example.autoconfig.ElasticSimpleJob;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
import javax.annotation.Resource;
/**
* @author jt
*/
@ElasticSimpleJob(jobName = "TiktokCommentSearchVideoJob", cron = "0 0 0/2 * * ? ")
//@ElasticSimpleJob(jobName = "TiktokCommentSearchVideoJob", cron = "0/1 * * * * ? ", shardingTotalCount = 1, overwrite = true, jobEvent = false)
@Slf4j
@Component
public class TiktokCommentSearchVideoJob implements SimpleJob {
private static TiktokCommentSearchVideoJob videoJob;
//
// @Resource
// private TiktokSopServiceImpl tiktokSopService;
@PostConstruct
public void init() {
videoJob = this;
}
@Override
public void execute(ShardingContext shardingContext) {
log.info("===========================开始执行(评论sop获取视频)定时任务===========================");
// videoJob.tiktokSopService.search();
}
}

@ -16,7 +16,7 @@ import java.util.List;
@Mapper
public interface PreciseResourceMapper extends BaseMapper<PreciseResourceEntity> {
List<PreciseResourceDto> queryPage(@Param("preciseResourceQuery") PreciseResourceQuery preciseResourceQuery, @Param("pageable") Pageable pageable);
List<PreciseResourceDto> queryPage(@Param("preciseResourceQuery") PreciseResourceQuery preciseResourceQuery ,@Param("pageNumber") Integer pageNumber,@Param("pageSize")Integer pageSize);
Long countAll(@Param("preciseResourceQuery") PreciseResourceQuery preciseResourceQuery);

@ -18,6 +18,4 @@ public interface ReviewContentMapper extends BaseMapper<ReviewContentEntity> {
* @param list
*/
void insertAll(@Param("list") List<ReviewContentEntity> list);
void deleteByKeyWordIds(@Param("ids") List<Long> ids);
}

@ -16,7 +16,7 @@ import java.util.List;
@Mapper
public interface RoughResourceMapper extends BaseMapper<RoughResourceEntity> {
List<RoughResourceDto> queryPage(@Param("roughResourceQuery") RoughResourceQuery roughResourceQuery, @Param("pageable") Pageable pageable);
List<RoughResourceDto> queryPage(@Param("roughResourceQuery") RoughResourceQuery roughResourceQuery,@Param("pageNumber") Integer pageNumber,@Param("pageSize")Integer pageSize);
Long countAll(@Param("roughResourceQuery") RoughResourceQuery roughResourceQuery);

@ -50,7 +50,11 @@ public class SopDto {
*/
@ApiModelProperty(value = "描述")
private String remake;
/**
*
*/
@ApiModelProperty(value = "状态0-未执行 1- 执行")
private Integer status;
/**
* 0-
*/

@ -36,6 +36,7 @@ public class CommentEntity {
private String avatarUrl;
private String uniqueId;
private Long organizeId;
private Integer commentType;
@TableField(exist = false)
private List<Map<String, Object>> typeMapList;

@ -30,6 +30,8 @@ public class FollowerListEntity {
private Long sopId;
@ApiModelProperty(value = "sop名")
private String sopName;
@ApiModelProperty(value = "搜索使用得设备id")
private String vendorId;
@ApiModelProperty(value = "视频用户id")
private String userId;
@ApiModelProperty(value = "视频用户名")

@ -58,8 +58,8 @@ public class PreciseResourceEntity {
/**
*
*/
@TableField(value = "create_time", fill = FieldFill.INSERT)
@TableField(value = "match_time", fill = FieldFill.INSERT)
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date match;
private Date matchTime;
}

@ -70,8 +70,8 @@ public class RoughResourceEntity {
*
*/
@ApiModelProperty(value = "匹配时间")
@TableField(value = "match", fill = FieldFill.INSERT)
@TableField(value = "match_time", fill = FieldFill.INSERT)
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date match;
private Date matchTime;
}

@ -19,13 +19,12 @@ import java.util.Date;
@TableName("tb_sop")
public class SopEntity implements Serializable {
/**
* id
*/
@TableId(value = "sop_id",type = IdType.INPUT)
@JsonSerialize(using = ToStringSerializer.class)
@ApiModelProperty(value = "id")
@ApiModelProperty(value = "sop_id")
private Long sopId;
/**

@ -1,5 +1,8 @@
package com.baiye.query;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
@ -7,5 +10,21 @@ import lombok.Data;
*/
@Data
public class PreciseResourceQuery {
/**
* id
*/
@TableId(type = IdType.INPUT)
@ApiModelProperty(value = "视频id")
private String awemeId;
/**
*
*/
@ApiModelProperty(value = "视频名称")
private String awemeName;
/**
*
*/
@ApiModelProperty(value = "sopId")
private Long sopId;
}

@ -1,5 +1,8 @@
package com.baiye.query;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
@ -7,5 +10,21 @@ import lombok.Data;
*/
@Data
public class RoughResourceQuery {
/**
* id
*/
@TableId(type = IdType.INPUT)
@ApiModelProperty(value = "视频id")
private String awemeId;
/**
*
*/
@ApiModelProperty(value = "视频名称")
private String awemeName;
/**
*
*/
@ApiModelProperty(value = "sopId")
private Long sopId;
}

@ -15,6 +15,6 @@ public class SopQuery {
@ApiModelProperty(value = "评论sop 名")
private String sopName;
@Query
@ApiModelProperty(value = "评论sop 名")
@ApiModelProperty(value = "状态")
private Integer status;
}

@ -1,5 +1,6 @@
package com.baiye.service;
import com.baiye.core.base.api.Result;
import com.baiye.core.page.PageResult;
import com.baiye.query.FollowerListQuery;
import org.springframework.data.domain.Pageable;
@ -9,4 +10,7 @@ import org.springframework.data.domain.Pageable;
*/
public interface FollowerListService {
PageResult queryFollowerList(FollowerListQuery followerListQuery, Pageable pageable);
Result<Object> optFollowUser(String vendorId, String userId);
}

@ -121,9 +121,20 @@ public interface TiktokUserService {
/**
*
*
* @param vendorId
* @param userId
* @return
*/
Result<JSONObject> optFollowerList(String vendorId, String userId);
/**
*
* @param vendorId
* @param userId ID
* @param type 10
* @param followSourceType 13 2-;11- ; 13- ; 14- ; 16- ; 17- ; 19- ; 20-
* @return
*/
Result<JSONObject> optFollowUser(String vendorId, String userId, Integer type, Integer followSourceType);
}

@ -1,16 +1,21 @@
package com.baiye.service.impl;
import cn.hutool.json.JSONObject;
import com.baiye.core.base.api.Result;
import com.baiye.core.constant.HttpStatus;
import com.baiye.core.page.PageResult;
import com.baiye.dao.FollowerListMapper;
import com.baiye.entity.FollowerListEntity;
import com.baiye.query.FollowerListQuery;
import com.baiye.service.FollowerListService;
import com.baiye.service.TiktokUserService;
import com.baiye.util.PageUtils;
import com.baiye.util.QueryHelpUtils;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
@ -18,9 +23,11 @@ import org.springframework.stereotype.Service;
* @author jt
*/
@Service
@Slf4j
@RequiredArgsConstructor
public class FollowerListServiceImpl implements FollowerListService {
private final FollowerListMapper followerListMapper;
private final TiktokUserService userService;
@Override
public PageResult queryFollowerList(FollowerListQuery followerListQuery, Pageable pageable) {
@ -29,4 +36,14 @@ public class FollowerListServiceImpl implements FollowerListService {
IPage<FollowerListEntity> selectPage = followerListMapper.selectPage(page, queryWrapper);
return PageResult.success(selectPage.getTotal(), selectPage.getPages(), selectPage.getRecords());
}
@Override
public Result<Object> optFollowUser(String vendorId, String userId) {
Result<JSONObject> result = userService.optFollowUser(vendorId, userId, 1, 13);
if (result.getCode() == HttpStatus.SUCCESS && result.getData() != null) {
return Result.success("关注成功");
}
log.info("关注用户 result={}", result);
return Result.fail("关注失败");
}
}

@ -24,7 +24,7 @@ public class TiktokPreciseResourceServiceImpl extends ServiceImpl<PreciseResourc
@Override
public PageResult queryPreciseResource(PreciseResourceQuery preciseResourceQuery, Pageable pageable) {
Long integer = preciseResourceMapper.countAll(preciseResourceQuery);
List<PreciseResourceDto> preciseResourceDtos = preciseResourceMapper.queryPage(preciseResourceQuery, pageable);
List<PreciseResourceDto> preciseResourceDtos = preciseResourceMapper.queryPage(preciseResourceQuery, (pageable.getPageNumber()-1) * pageable.getPageSize(), pageable.getPageSize());
return PageResult.success(integer, preciseResourceDtos);
}
}

@ -31,7 +31,7 @@ public class TiktokRoughResourceServiceImpl extends ServiceImpl<RoughResourceMap
@Override
public PageResult queryRoughResource(RoughResourceQuery roughResourceQuery, Pageable pageable) {
Long integer = roughResourceMapper.countAll(roughResourceQuery);
List<RoughResourceDto> roughResourceDtos = roughResourceMapper.queryPage(roughResourceQuery, pageable);
List<RoughResourceDto> roughResourceDtos = roughResourceMapper.queryPage(roughResourceQuery,(pageable.getPageNumber()-1) * pageable.getPageSize(),pageable.getPageSize());
return PageResult.success(integer, roughResourceDtos);
}

@ -33,7 +33,6 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.swagger.annotations.ApiModelProperty;
import lombok.RequiredArgsConstructor;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
@ -175,7 +174,6 @@ public class TiktokSopServiceImpl extends ServiceImpl<SopMapper, SopEntity> impl
List<KeyWordEntity> keyWordByFilterKeys = new ArrayList<>();
List<SopDto.PreciseResource> keyWordByMatchKeys = new ArrayList<>();
if (CollUtil.isNotEmpty(keyWordEntityList)) {
for (KeyWordEntity keyWord : keyWordEntityList) {
if (keyWord.getType() == 0) {
keyWordBySearchKeys.add(keyWord);
@ -223,7 +221,7 @@ public class TiktokSopServiceImpl extends ServiceImpl<SopMapper, SopEntity> impl
return map;
}
@Transactional
@Transactional(rollbackFor = Exception.class)
@Override
public void updateSop(SopEntity sop) {
this.updateById(sop);
@ -236,9 +234,13 @@ public class TiktokSopServiceImpl extends ServiceImpl<SopMapper, SopEntity> impl
sopMapper.deleteById(sopId);
//删除关键词
List<Long> keyWordIds = keyWordMapper.queryIdbySopIdAndType(sopId, 2);
keyWordMapper.deleteBySopId(sopId);
//删除回评内容
reviewContentMapper.deleteByKeyWordIds(keyWordIds);
QueryWrapper<ReviewContentEntity> deleteByKeyWordIds = new QueryWrapper<>();
deleteByKeyWordIds.in("key_word_id", keyWordIds);
reviewContentMapper.delete(deleteByKeyWordIds);
}
@ -271,9 +273,9 @@ public class TiktokSopServiceImpl extends ServiceImpl<SopMapper, SopEntity> impl
String word = keyWord.getWord();
//搜索
boolean searchValue = reqSearchVideo(dyId, word, sop.getSopId(), sop.getSopName());
if (searchValue) {
setCache(sop.getSearchInterval(), dyId);
}
// if (searchValue) {
// setCache(sop.getSearchInterval(), dyId);
// }
}
}
@ -398,7 +400,10 @@ public class TiktokSopServiceImpl extends ServiceImpl<SopMapper, SopEntity> impl
for (int i = 0; i < array.size(); i++) {
JSONObject comment = array.getJSONObject(i);
String cid = comment.getStr(DefaultKeyConstants.CID);
//TODO 评论id加缓存
// 评论id加缓存
if (redisUtils.get(DefaultKeyConstants.SOP_COMMENT_KEY + cid) != null) {
continue;
}
String text = comment.getStr("text");
//评论人
String userId = comment.getJSONObject(DefaultKeyConstants.USER).getStr(DefaultKeyConstants.UID);
@ -418,7 +423,11 @@ public class TiktokSopServiceImpl extends ServiceImpl<SopMapper, SopEntity> impl
// continue;
// }
//TODO 进行回评
userService.optCommentVideoComment(vendorId, awemeId, cid, contentEntities.get(i).getWord(), userId);
Result<JSONObject> optCommentVideoCommentResult = userService.optCommentVideoComment(vendorId, awemeId, cid, contentEntities.get(i).getWord(), userId);
if (optCommentVideoCommentResult.getCode() != HttpStatus.SUCCESS) {
//未评论成
continue;
}
//执行完后,加一
Object day = redisUtils.get(DefaultKeyConstants.COMMENT_SOP_DAY);
if (day != null) {
@ -450,7 +459,9 @@ public class TiktokSopServiceImpl extends ServiceImpl<SopMapper, SopEntity> impl
commentEntity.setAvatarUrl(avatarUrl);
commentEntity.setUniqueId(comment.getStr(DefaultKeyConstants.UNIQUE_ID));
commentEntity.setOrganizeId(sop.getOrganizeId());
commentEntity.setCommentType(0);
list.add(commentEntity);
redisUtils.set(DefaultKeyConstants.SOP_COMMENT_KEY + cid, DefaultNumberConstants.ZERO_NUMBER);
}
}
}
@ -576,6 +587,7 @@ public class TiktokSopServiceImpl extends ServiceImpl<SopMapper, SopEntity> impl
followerListEntity.setFollowStatus(0);
followerListEntity.setUserId(uid);
followerListEntity.setUserNickName(nickname);
followerListEntity.setVendorId(dyId);
followerListEntities.add(followerListEntity);
}
}

@ -222,9 +222,25 @@ public class TiktokUserServiceImpl implements TiktokUserService {
jsonObject.putOpt("vendorId", vendorId);
jsonObject.putOpt("userId", userId);
jsonObject.putOpt("offset", DefaultNumberConstants.ZERO_NUMBER);
jsonObject.putOpt("checkLogin", DefaultKeyConstants.TRUE);
jsonObject.putOpt("checkProxyInfo", DefaultKeyConstants.FLASE);
return implementPost(jsonObject, TiktokRequestConstants.GET_FOLLOWER_LIST);
}
return Result.fail(ResultCode.REQUEST_PARAMETER_ERROR.getMsg());
}
@Override
public Result<JSONObject> optFollowUser(String vendorId, String userId, Integer type, Integer followSourceType) {
if (StringUtils.isNotBlank(vendorId) && StringUtils.isNotBlank(userId)) {
JSONObject jsonObject = new JSONObject();
jsonObject.putOpt("vendorId", vendorId);
jsonObject.putOpt("userId", userId);
jsonObject.putOpt("type", type);
jsonObject.putOpt("followSourceType", followSourceType);
jsonObject.putOpt("offset", DefaultNumberConstants.ZERO_NUMBER);
jsonObject.putOpt("checkLogin", DefaultKeyConstants.FLASE);
jsonObject.putOpt("checkProxyInfo", DefaultKeyConstants.TRUE);
return implementPost(jsonObject, TiktokRequestConstants.GET_FOLLOWER_LIST);
return implementPost(jsonObject, TiktokRequestConstants.GET_FOLLOW_USER);
}
return Result.fail(ResultCode.REQUEST_PARAMETER_ERROR.getMsg());
}

@ -20,18 +20,16 @@
</insert>
<delete id="deleteBySopId">
delete
tb_key_word where sop_id =
#{sopId}
delete from tb_key_word where sop_id = #{sopId}
</delete>
<select id="queryIdbySopIdAndType" resultType="Long">
select id from tb_key_word
select kw.id from tb_key_word as kw
<where>
<if test="sopId!=null">
sop_id = #{sopId}
and kw.sop_id = #{sopId}
</if>
<if test="type!=null">
type = #{type}
and kw.type = #{type}
</if>
</where>
</select>

@ -12,28 +12,43 @@
<select id="queryPage" resultType="com.baiye.dto.PreciseResourceDto">
select trr.*, ts.sop_name as sopName
from tb_precise_resource as trr
left join tb_sop as ts on trr.sop_id = ts.sop_id limit #{pageable.getPageNumber() * pageable.getPageSize()}, #{pageable.getPageSize()}
left join tb_sop as ts on trr.sop_id = ts.sop_id
<where>
<if test="sopId !=null">
trr.sop_id = #{sopId}
<if test="preciseResourceQuery.sopId !=null">
and trr.sop_id = #{preciseResourceQuery.sopId}
</if>
<if test="preciseResourceQuery.awemeId !=null">
and trr.aweme_id = #{preciseResourceQuery.awemeId}
</if>
<if test="preciseResourceQuery.awemeName !=null">
and trr.aweme_name = #{preciseResourceQuery.awemeName}
</if>
</where>
limit #{pageNumber}, #{pageSize}
</select>
<select id="countAll" resultType="Long">
select count(*)
from tb_precise_resource
<where>
<if test="sopId !=null">
trr.sop_id = #{sopId}
<if test="preciseResourceQuery.sopId !=null">
and sop_id = #{preciseResourceQuery.sopId}
</if>
<if test="preciseResourceQuery.awemeId !=null">
and aweme_id = #{preciseResourceQuery.awemeId}
</if>
<if test="preciseResourceQuery.awemeName !=null">
and aweme_name = #{preciseResourceQuery.awemeName}
</if>
</where>
</select>
<insert id="insertAll">
insert into tb_precise_resource (aweme_id,aweme_name,sop_id,organize_id,word,like_num,collect_num,comment_num,forward_num,match)
insert into tb_precise_resource
(aweme_id,aweme_name,sop_id,organize_id,word,like_num,collect_num,comment_num,forward_num,match)
values
<foreach collection="list" item="item" index="index" separator=",">
( #{item.awemeId}, #{item.awemeName},#{item.sopId},#{item.organizeId},#{item.word},#{item.likeNum},#{item.collectNum},#{item.commentNum},#{item.forwardNum},#{item.match})
( #{item.awemeId},
#{item.awemeName},#{item.sopId},#{item.organizeId},#{item.word},#{item.likeNum},#{item.collectNum},#{item.commentNum},#{item.forwardNum},#{item.match})
</foreach>
</insert>
</mapper>

@ -16,9 +16,4 @@
(#{item.word},#{item.keyWordId})
</foreach>
</insert>
<delete id="deleteByKeyWordIds">
delete
tb_review_content where key_word_id in
#{ids}
</delete>
</mapper>

@ -12,18 +12,31 @@
<select id="queryPage" resultType="com.baiye.dto.RoughResourceDto">
select trr.*, ts.sop_name as sopName
from tb_rough_resource as trr
left join tb_sop as ts on trr.sop_id = ts.sop_id limit #{pageable.getPageNumber() * pageable.getPageSize()}, #{pageable.getPageSize()}
left join tb_sop as ts on trr.sop_id = ts.sop_id
<where>
<if test="sopId !=null">
trr.sop_id = #{sopId}
<if test="roughResourceQuery.sopId !=null">
and trr.sop_id = #{roughResourceQuery.sopId}
</if>
<if test="roughResourceQuery.awemeId !=null">
and trr.aweme_id = #{roughResourceQuery.awemeId}
</if>
<if test="roughResourceQuery.awemeName !=null">
and trr.aweme_name = #{roughResourceQuery.awemeName}
</if>
</where>
limit #{pageNumber}, #{pageSize}
</select>
<select id="countAll" resultType="Long">
select count(*) from tb_rough_resource
<where>
<if test="sopId !=null">
sop_id = #{sopId}
<if test="roughResourceQuery.sopId !=null">
and sop_id = #{roughResourceQuery.sopId}
</if>
<if test="roughResourceQuery.awemeId !=null">
and aweme_id = #{roughResourceQuery.awemeId}
</if>
<if test="roughResourceQuery.awemeName !=null">
and aweme_name = #{roughResourceQuery.awemeName}
</if>
</where>
</select>

@ -3,7 +3,7 @@ spring:
cloud:
nacos:
discovery:
server-addr: ${NACOS_HOST:8.130.96.163}:${NACOS_PORT:8848}
server-addr: ${NACOS_HOST:localhost}:${NACOS_PORT:8848}
# Spring Cloud Stream 配置项,对应 BindingServiceProperties 类
stream:
# Binding 配置项,对应 BindingProperties Map

Loading…
Cancel
Save