| | |
| | | import cn.lili.base.AbsQuery; |
| | | import cn.lili.group.Update; |
| | | import cn.lili.group.Add; |
| | | import cn.lili.modules.lmk.domain.form.VideoFootPrintForm; |
| | | import cn.lili.modules.member.entity.dos.FootPrint; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import lombok.RequiredArgsConstructor; |
| | |
| | | return videoService.recommendVideo(query); |
| | | } |
| | | |
| | | @PostMapping("/view/record") |
| | | @ApiOperation(value = "保存观看记录", notes = "保存观看记录") |
| | | public Result saveViewRecord(VideoFootPrintForm form) { |
| | | return videoService.saveViewRecord(form); |
| | | } |
| | | } |
| | |
| | | import cn.lili.modules.goods.service.WholesaleService; |
| | | import cn.lili.modules.goods.sku.GoodsSkuBuilder; |
| | | import cn.lili.modules.goods.sku.render.SalesModelRender; |
| | | import cn.lili.modules.lmk.enums.general.ViewTypeEnum; |
| | | import cn.lili.modules.member.entity.dos.FootPrint; |
| | | import cn.lili.modules.promotion.entity.dos.Coupon; |
| | | import cn.lili.modules.promotion.entity.dos.PromotionGoods; |
| | |
| | | |
| | | //记录用户足迹 |
| | | if (currentUser != null) { |
| | | FootPrint footPrint = new FootPrint(currentUser.getId(), goodsIndex.getStoreId(), goodsId, skuId); |
| | | FootPrint footPrint = new FootPrint(currentUser.getId(), goodsIndex.getStoreId(), goodsId, skuId, ViewTypeEnum.GOODS.getValue(), null); |
| | | String destination = rocketmqCustomProperties.getGoodsTopic() + ":" + GoodsTagsEnum.VIEW_GOODS.name(); |
| | | rocketMQTemplate.asyncSend(destination, footPrint, RocketmqSendCallbackBuilder.commonCallback()); |
| | | } |
| | |
| | | /** 视频填充模式 */ |
| | | private String videoFit; |
| | | |
| | | @TableField("video_duration") |
| | | /** 视频长度(秒) */ |
| | | private Long videoDuration; |
| | | |
| | | @TableField("title") |
| | | /** 视频标题 */ |
| | | private String title; |
New file |
| | |
| | | package cn.lili.modules.lmk.domain.form; |
| | | |
| | | import cn.lili.base.AbsForm; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author:xp |
| | | * @date:2025/5/26 15:15 |
| | | */ |
| | | @Data |
| | | @ApiModel("浏览足迹-视频") |
| | | public class VideoFootPrintForm extends AbsForm { |
| | | |
| | | @ApiModelProperty("视频id") |
| | | private String videoId; |
| | | |
| | | @ApiModelProperty("观看时长") |
| | | private Long viewDuration; |
| | | |
| | | } |
| | |
| | | @ApiModelProperty("视频填充模式") |
| | | private String videoFit; |
| | | |
| | | @ApiModelProperty("视频长度:秒") |
| | | private Long videoDuration; |
| | | |
| | | @ApiModelProperty("文件信息") |
| | | @Valid |
| | | private FileInfoForm fileInfo; |
| | |
| | | @ApiModelProperty("视频填充模式") |
| | | private String videoFit; |
| | | |
| | | @ApiModelProperty("视频长度:秒") |
| | | private Long videoDuration; |
| | | |
| | | /** 视频标题 */ |
| | | @ApiModelProperty("视频标题") |
| | | private String title; |
New file |
| | |
| | | package cn.lili.modules.lmk.enums.general; |
| | | |
| | | import lombok.Getter; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | |
| | | /** |
| | | * 浏览类型 |
| | | * |
| | | * @author:xp |
| | | * @date:2025/5/14 10:30 |
| | | */ |
| | | @Getter |
| | | public enum ViewTypeEnum { |
| | | |
| | | VIDEO("video", "视频"), |
| | | GOODS("goods", "商品"), |
| | | ; |
| | | |
| | | private final String value; |
| | | |
| | | |
| | | private final String desc; |
| | | |
| | | ViewTypeEnum(String value, String desc) { |
| | | this.value = value; |
| | | this.desc = desc; |
| | | } |
| | | |
| | | /** |
| | | * 获取含义 |
| | | * |
| | | * @param value |
| | | * @return |
| | | */ |
| | | public static String getDescByValue(String value) { |
| | | if (StringUtils.isBlank(value)) { |
| | | return null; |
| | | } |
| | | for (ViewTypeEnum e : ViewTypeEnum.values()){ |
| | | if (value.equals(e.getValue())) { |
| | | return e.getDesc(); |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | } |
| | |
| | | |
| | | import cn.lili.base.AbsQuery; |
| | | import cn.lili.modules.lmk.domain.entity.Video; |
| | | import cn.lili.modules.lmk.domain.form.VideoAuditingForm; |
| | | import cn.lili.modules.lmk.domain.form.VideoDownForm; |
| | | import cn.lili.modules.lmk.domain.form.VideoRecommendForm; |
| | | import cn.lili.modules.lmk.domain.form.*; |
| | | import cn.lili.modules.lmk.domain.query.ManagerVideoQuery; |
| | | import cn.lili.modules.lmk.domain.vo.CollectTypeNumVO; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import cn.lili.base.Result; |
| | | import cn.lili.modules.lmk.domain.form.VideoForm; |
| | | import cn.lili.modules.lmk.domain.query.VideoQuery; |
| | | import java.util.List; |
| | | |
| | |
| | | * @param numList |
| | | */ |
| | | void updateCollectNumBatch(List<CollectTypeNumVO> numList); |
| | | |
| | | /** |
| | | * 保存视频观看记录 |
| | | * |
| | | * @param form |
| | | * @return |
| | | */ |
| | | Result saveViewRecord(VideoFootPrintForm form); |
| | | } |
| | |
| | | import cn.lili.modules.lmk.domain.entity.VideoAuditRecord; |
| | | import cn.lili.modules.lmk.domain.entity.VideoTag; |
| | | import cn.lili.modules.lmk.domain.entity.VideoTagRef; |
| | | import cn.lili.modules.lmk.domain.form.VideoAuditingForm; |
| | | import cn.lili.modules.lmk.domain.form.VideoDownForm; |
| | | import cn.lili.modules.lmk.domain.form.VideoRecommendForm; |
| | | import cn.lili.modules.lmk.domain.form.*; |
| | | import cn.lili.modules.lmk.domain.query.ManagerVideoQuery; |
| | | import cn.lili.modules.lmk.domain.vo.*; |
| | | import cn.lili.modules.lmk.enums.general.TagCreateTypeEnum; |
| | | import cn.lili.modules.lmk.enums.general.VideoStatusEnum; |
| | | import cn.lili.modules.lmk.enums.general.ViewTypeEnum; |
| | | import cn.lili.modules.lmk.service.*; |
| | | import cn.lili.modules.member.entity.dos.FootPrint; |
| | | import cn.lili.modules.member.service.FootprintService; |
| | | import cn.lili.utils.COSUtil; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import cn.lili.modules.lmk.domain.entity.Video; |
| | |
| | | import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper; |
| | | import com.baomidou.mybatisplus.extension.conditions.update.LambdaUpdateChainWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import cn.lili.modules.lmk.domain.form.VideoForm; |
| | | import cn.lili.modules.lmk.domain.query.VideoQuery; |
| | | import org.apache.commons.collections4.CollectionUtils; |
| | | import org.apache.commons.collections4.ListUtils; |
| | |
| | | private final VideoAuditRecordService videoAuditRecordService; |
| | | private final MyCollectService myCollectService; |
| | | private final COSUtil cosUtil; |
| | | private final FootprintService footprintService; |
| | | |
| | | /** |
| | | * 添加 |
| | |
| | | baseMapper.updateCollectNumBatch(chunk); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public Result saveViewRecord(VideoFootPrintForm form) { |
| | | FootPrint footPrint = new FootPrint(); |
| | | footPrint.setViewType(ViewTypeEnum.VIDEO.getValue()); |
| | | footPrint.setRefId(form.getVideoId()); |
| | | footPrint.setMemberId(UserContext.getCurrentUserId()); |
| | | footPrint.setViewDuration(form.getViewDuration()); |
| | | footprintService.saveFootprint(footPrint); |
| | | return Result.ok(); |
| | | } |
| | | } |
| | |
| | | @ApiModelProperty(value = "店铺Id") |
| | | private String storeId; |
| | | |
| | | @ApiModelProperty(value = "商品ID") |
| | | private String goodsId; |
| | | @ApiModelProperty(value = "商品ID/视频ID") |
| | | private String refId; |
| | | |
| | | @ApiModelProperty(value = "规格ID") |
| | | private String skuId; |
| | | |
| | | } |
| | | @ApiModelProperty(value = "浏览类型:goods商品、view视频") |
| | | private String viewType; |
| | | |
| | | @ApiModelProperty(value = "观看时长:秒") |
| | | private Long viewDuration; |
| | | |
| | | } |
| | |
| | | @ApiModelProperty("店铺Id") |
| | | private String storeId; |
| | | |
| | | @ApiModelProperty("浏览类型:goods商品、view视频") |
| | | private String viewType; |
| | | |
| | | public <T> QueryWrapper<T> queryWrapper() { |
| | | QueryWrapper<T> queryWrapper = new QueryWrapper<>(); |
| | | if (CharSequenceUtil.isNotEmpty(memberId)) { |
| | |
| | | if (CharSequenceUtil.isNotEmpty(storeId)) { |
| | | queryWrapper.eq("store_id", storeId); |
| | | } |
| | | if (CharSequenceUtil.isNotEmpty(viewType)) { |
| | | queryWrapper.eq("view_type", viewType); |
| | | } |
| | | queryWrapper.eq("delete_flag",false); |
| | | queryWrapper.orderByDesc("create_time"); |
| | | return queryWrapper; |
| | |
| | | |
| | | @Override |
| | | public FootPrint saveFootprint(FootPrint footPrint) { |
| | | LambdaQueryWrapper<FootPrint> queryWrapper = Wrappers.lambdaQuery(); |
| | | queryWrapper.eq(FootPrint::getMemberId, footPrint.getMemberId()); |
| | | queryWrapper.eq(FootPrint::getGoodsId, footPrint.getGoodsId()); |
| | | //如果已存在某商品记录,则更新其修改时间 |
| | | //如果不存在则添加记录 |
| | | //为了保证足迹的排序,将原本足迹删除后重新添加 |
| | | List<FootPrint> oldPrints = list(queryWrapper); |
| | | if (oldPrints != null && !oldPrints.isEmpty()) { |
| | | FootPrint oldPrint = oldPrints.get(0); |
| | | this.removeById(oldPrint.getId()); |
| | | } |
| | | footPrint.setCreateTime(new Date()); |
| | | this.save(footPrint); |
| | | //删除超过100条后的记录 |
| | | this.baseMapper.deleteLastFootPrint(footPrint.getMemberId()); |
| | | return footPrint; |
| | | } |
| | | |
| | |
| | | public boolean deleteByIds(List<String> ids) { |
| | | LambdaQueryWrapper<FootPrint> lambdaQueryWrapper = Wrappers.lambdaQuery(); |
| | | lambdaQueryWrapper.eq(FootPrint::getMemberId, UserContext.getCurrentUser().getId()); |
| | | lambdaQueryWrapper.in(FootPrint::getGoodsId, ids); |
| | | lambdaQueryWrapper.in(FootPrint::getRefId, ids); |
| | | return this.remove(lambdaQueryWrapper); |
| | | } |
| | | |
| | |
| | | lambdaQueryWrapper.eq(FootPrint::getDeleteFlag, false); |
| | | return this.count(lambdaQueryWrapper); |
| | | } |
| | | } |
| | | } |
| | |
| | | <result column="title" property="title" /> |
| | | <result column="goods_id" property="goodsId" /> |
| | | <result column="goods_view_num" property="goodsViewNum" /> |
| | | <result column="video_duration" property="videoDuration" /> |
| | | <result column="goods_order_num" property="goodsOrderNum" /> |
| | | <result column="recommend" property="recommend" /> |
| | | <result column="status" property="status" /> |
| | |
| | | LV.author_id, |
| | | LV.cover_url, |
| | | LV.video_fit, |
| | | LV.video_duration, |
| | | LV.video_file_key, |
| | | LV.title, |
| | | LV.goods_id, |
| | |
| | | LV.author_id, |
| | | LV.cover_url, |
| | | LV.video_fit, |
| | | LV.video_duration, |
| | | LV.video_file_key, |
| | | LV.title, |
| | | LV.goods_id, |
| | |
| | | LV.recommend, |
| | | LV.status, |
| | | LV.play_num, |
| | | LV.collect_num, |
| | | LV.comment_num, |
| | | LV.weight, |
| | | LV.audit_pass_time, |
| | | LV.update_time, |
| | | LV.id, |
| | | LM.nick_name as authorName, |
| | | (SELECT COUNT(*) FROM lmk_my_collect WHERE ref_id = LV.id AND collect_type = 'video' AND delete_flag = 0) as collect_num |
| | | LM.nick_name as authorName |
| | | FROM |
| | | lmk_video LV |
| | | LEFT JOIN li_member LM ON LV.author_id = LM.id |
| | |
| | | LV.author_id, |
| | | LV.cover_url, |
| | | LV.video_fit, |
| | | LV.video_duration, |
| | | LV.video_file_key, |
| | | LV.title, |
| | | LV.goods_id, |
| | |
| | | LV.recommend, |
| | | LV.status, |
| | | LV.play_num, |
| | | LV.collect_num, |
| | | LV.comment_num, |
| | | LV.weight, |
| | | LV.audit_pass_time, |
| | | LV.update_time, |
| | | LV.id, |
| | | LM.nick_name as authorName, |
| | | (SELECT COUNT(*) FROM lmk_my_collect WHERE ref_id = LV.id AND collect_type = 'video' AND delete_flag = 0) as collect_num |
| | | LM.nick_name as authorName |
| | | FROM |
| | | lmk_video LV |
| | | LEFT JOIN li_member LM ON LV.author_id = LM.id |
| | |
| | | LV.author_id, |
| | | LV.cover_url, |
| | | LV.video_fit, |
| | | LV.video_duration, |
| | | LV.video_file_key, |
| | | LV.title, |
| | | LV.goods_id, |
| | |
| | | LV.status, |
| | | LV.play_num, |
| | | LV.comment_num, |
| | | LV.collect_num, |
| | | LV.weight, |
| | | LV.audit_pass_time, |
| | | LV.update_time, |
| | | LV.id, |
| | | LM.nick_name as authorName, |
| | | LM.face as authorAvatar, |
| | | (SELECT COUNT(*) FROM lmk_my_collect WHERE ref_id = LV.id AND collect_type = 'video' AND delete_flag = 0) as collect_num |
| | | LM.face as authorAvatar |
| | | FROM |
| | | lmk_video LV |
| | | LEFT JOIN li_member LM ON LV.author_id = LM.id |