Merge remote-tracking branch 'origin/dev' into dev
| | |
| | | package cn.lili.controller.goods; |
| | | |
| | | import cn.lili.base.Result; |
| | | import cn.lili.common.enums.ResultCode; |
| | | import cn.lili.common.enums.ResultUtil; |
| | | import cn.lili.common.exception.ServiceException; |
| | |
| | | import cn.lili.modules.goods.entity.vos.GoodsVO; |
| | | import cn.lili.modules.goods.service.GoodsService; |
| | | import cn.lili.modules.goods.service.GoodsSkuService; |
| | | import cn.lili.modules.lmk.domain.query.VideoGoodsEsQuery; |
| | | import cn.lili.modules.search.entity.dos.EsGoodsIndex; |
| | | import cn.lili.modules.search.entity.dos.EsGoodsRelatedInfo; |
| | | import cn.lili.modules.search.entity.dto.EsGoodsSearchDTO; |
| | |
| | | return ResultUtil.data(goodsSearchService.searchGoodsByPage(goodsSearchParams, pageVO)); |
| | | } |
| | | |
| | | @ApiOperation(value = "商品分页-发布视频时关联商品") |
| | | @GetMapping("/video/es") |
| | | public Result videoGoodsEsPage(VideoGoodsEsQuery query) { |
| | | return goodsSearchService.videoGoodsEsPage(query); |
| | | } |
| | | |
| | | @ApiOperation(value = "从ES中获取相关商品品牌名称,分类名称及属性") |
| | | @GetMapping("/es/related") |
| | | public ResultMessage<EsGoodsRelatedInfo> getGoodsRelatedByPageFromEs(EsGoodsSearchDTO goodsSearchParams, PageVO pageVO) { |
New file |
| | |
| | | package cn.lili.controller.lmk; |
| | | |
| | | import cn.lili.base.Result; |
| | | import cn.lili.group.Add; |
| | | import cn.lili.modules.lmk.domain.form.ShareClickRecordForm; |
| | | import cn.lili.modules.lmk.domain.form.ShareForm; |
| | | import cn.lili.modules.lmk.service.ShareService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * 分享记录 前端控制器 |
| | | * |
| | | * @author xp |
| | | * @since 2025-06-16 |
| | | */ |
| | | @Validated |
| | | @RequiredArgsConstructor |
| | | @Api(value = "分享记录", tags = "分享记录管理") |
| | | @RestController |
| | | @RequestMapping("/buyer/lmk/share") |
| | | public class ShareController { |
| | | |
| | | private final ShareService shareService; |
| | | |
| | | |
| | | @PostMapping |
| | | @ApiOperation(value = "添加分享", notes = "添加分享") |
| | | public Result add(@RequestBody @Validated(Add.class) ShareForm form) { |
| | | return shareService.add(form); |
| | | } |
| | | |
| | | @PostMapping("/click/record") |
| | | @ApiOperation(value = "添加分享访问记录", notes = "添加分享访问记录") |
| | | public Result addShareClick(@RequestBody @Validated(Add.class) ShareClickRecordForm form) { |
| | | return shareService.addShareClick(form); |
| | | } |
| | | } |
| | |
| | | return videoService.healthRecommendVideo(query); |
| | | } |
| | | |
| | | @GetMapping("/goods/detail/{videoId}") |
| | | @ApiOperation(value = "视频商品查看", notes = "视频商品查看") |
| | | public Result getGoodsDetail(@PathVariable("videoId") String videoId) { |
| | | return videoService.getGoodsDetail(videoId); |
| | | } |
| | | |
| | | @PostMapping("/view/record") |
| | | @ApiOperation(value = "保存观看记录", notes = "保存观看记录") |
| | | public Result saveViewRecord(@RequestBody VideoFootPrintForm form) { |
| | |
| | | package cn.lili.controller.passport.connect; |
| | | |
| | | import cn.lili.base.Result; |
| | | import cn.lili.common.enums.ResultUtil; |
| | | import cn.lili.common.security.token.Token; |
| | | import cn.lili.common.vo.ResultMessage; |
| | |
| | | return ResultUtil.data(this.connectService.miniProgramAutoLogin(params)); |
| | | } |
| | | |
| | | @GetMapping("/silent-login") |
| | | @ApiOperation(value = "小程序静默登录--不获取用户信息") |
| | | public Result silentLogin(String code) { |
| | | return this.connectService.silentLogin(code); |
| | | } |
| | | |
| | | @GetMapping("/subscribeMessage") |
| | | @ApiOperation(value = "消息订阅") |
| | | public ResultMessage<List<WechatMPMessage>> autoLogin() { |
| | |
| | | package cn.lili.modules.connect.service; |
| | | |
| | | import cn.lili.base.Result; |
| | | import cn.lili.cache.CachePrefix; |
| | | import cn.lili.common.security.token.Token; |
| | | import cn.lili.modules.connect.entity.Connect; |
| | |
| | | * @param type 平台类型 |
| | | */ |
| | | void loginBindUser(String userId, String unionId, String type); |
| | | } |
| | | |
| | | /** |
| | | * 小程序静默登录 |
| | | * |
| | | * @param code |
| | | * @return |
| | | */ |
| | | Result silentLogin(String code); |
| | | } |
| | |
| | | import cn.hutool.core.util.StrUtil; |
| | | import cn.hutool.json.JSONObject; |
| | | import cn.hutool.json.JSONUtil; |
| | | import cn.lili.base.Result; |
| | | import cn.lili.cache.Cache; |
| | | import cn.lili.common.enums.ClientTypeEnum; |
| | | import cn.lili.common.enums.ResultCode; |
| | |
| | | */ |
| | | @Autowired |
| | | private RocketmqCustomProperties rocketmqCustomProperties; |
| | | |
| | | static String DEFAULT_PASSWORD = "111111"; |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public Result silentLogin(String code) { |
| | | JSONObject res = this.getConnect(code); |
| | | String unionId = res.getStr("unionid"); |
| | | String openId = res.getStr("openid"); |
| | | Member user = memberService.findByUUID(openId); |
| | | // 不存在就注册 |
| | | if (Objects.isNull(user)) { |
| | | user = new Member(); |
| | | user.setUuId(openId); |
| | | user.setUsername(UuidUtils.getUUID()); |
| | | user.setNickName("微信用户"); |
| | | user.setPassword(DEFAULT_PASSWORD); |
| | | user.setFace("https://i.loli.net/2020/11/19/LyN6JF7zZRskdIe.png"); |
| | | memberService.registerHandler(user); |
| | | } |
| | | Token token = memberTokenGenerate.createToken(user, Boolean.TRUE); |
| | | return Result.ok().data(token); |
| | | } |
| | | |
| | | /** |
| | | * 第三方联合登陆 |
| | |
| | | } |
| | | |
| | | |
| | | } |
| | | } |
New file |
| | |
| | | package cn.lili.modules.lmk.domain.entity; |
| | | |
| | | import cn.lili.mybatis.BaseIdAndDeleteEntity; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.Data; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * 分享记录 |
| | | * |
| | | * @author xp |
| | | * @since 2025-06-16 |
| | | */ |
| | | @Data |
| | | @TableName("lmk_share") |
| | | public class Share extends BaseIdAndDeleteEntity { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @TableField("share_type") |
| | | /** 哪个业务的分享 */ |
| | | private String shareType; |
| | | |
| | | @TableField("ref_id") |
| | | /** 业务id */ |
| | | private String refId; |
| | | |
| | | @TableField("share_user") |
| | | /** 分享人 */ |
| | | private String shareUser; |
| | | |
| | | @TableField("share_time") |
| | | /** 分享时间 */ |
| | | private Date shareTime; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package cn.lili.modules.lmk.domain.entity; |
| | | |
| | | import cn.lili.mybatis.BaseIdAndDeleteEntity; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * 分享点击记录 |
| | | * |
| | | * @author xp |
| | | * @since 2025-06-16 |
| | | */ |
| | | @Data |
| | | @TableName("lmk_share_click_record") |
| | | public class ShareClickRecord extends BaseIdAndDeleteEntity { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @TableField("share_id") |
| | | /** 分享id */ |
| | | private String shareId; |
| | | |
| | | @TableField("user_id") |
| | | /** 谁点了这个分享 */ |
| | | private String userId; |
| | | |
| | | @TableField("click_time") |
| | | /** 点击时间 */ |
| | | private Date clickTime; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package cn.lili.modules.lmk.domain.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.FieldFill; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * 视频商品中间表 |
| | | * |
| | | * @author xp |
| | | * @since 2025-06-15 |
| | | */ |
| | | @Data |
| | | @TableName("lmk_video_goods") |
| | | public class VideoGoods { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @TableId |
| | | @ApiModelProperty(value = "唯一标识", hidden = true) |
| | | private String id; |
| | | |
| | | @TableField("video_id") |
| | | /** 视频id */ |
| | | private String videoId; |
| | | |
| | | @TableField("goods_id") |
| | | /** 商品id */ |
| | | private String goodsId; |
| | | |
| | | @TableField("order_num") |
| | | /** 排序 */ |
| | | private Integer orderNum; |
| | | |
| | | @TableField("goods_num") |
| | | /** 商品数量 */ |
| | | private Integer goodsNum; |
| | | |
| | | @TableField(fill = FieldFill.INSERT) |
| | | @ApiModelProperty(value = "删除标志 true/false 删除/未删除", hidden = true) |
| | | private Boolean deleteFlag; |
| | | } |
New file |
| | |
| | | package cn.lili.modules.lmk.domain.form; |
| | | |
| | | import cn.lili.group.Update; |
| | | import cn.lili.group.Add; |
| | | import cn.lili.base.AbsForm; |
| | | import cn.lili.modules.lmk.domain.entity.ShareClickRecord; |
| | | import org.springframework.beans.BeanUtils; |
| | | import javax.validation.constraints.NotBlank; |
| | | import javax.validation.constraints.NotNull; |
| | | import org.springframework.lang.NonNull; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * 分享点击记录表单 |
| | | * |
| | | * @author xp |
| | | * @since 2025-06-16 |
| | | */ |
| | | @Data |
| | | @ApiModel(value = "ShareClickRecord表单", description = "分享点击记录表单") |
| | | public class ShareClickRecordForm extends AbsForm { |
| | | |
| | | @NotBlank(message = "分享id不能为空", groups = {Add.class, Update.class}) |
| | | @ApiModelProperty("分享id") |
| | | private String shareId; |
| | | |
| | | public static ShareClickRecord getEntityByForm(@NonNull ShareClickRecordForm form, ShareClickRecord entity) { |
| | | if(entity == null) { |
| | | entity = new ShareClickRecord(); |
| | | } |
| | | BeanUtils.copyProperties(form, entity); |
| | | return entity; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package cn.lili.modules.lmk.domain.form; |
| | | |
| | | import cn.lili.group.Update; |
| | | import cn.lili.group.Add; |
| | | import cn.lili.base.AbsForm; |
| | | import cn.lili.modules.lmk.domain.entity.Share; |
| | | import org.springframework.beans.BeanUtils; |
| | | import javax.validation.constraints.NotBlank; |
| | | import javax.validation.constraints.NotNull; |
| | | import org.springframework.lang.NonNull; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * 分享记录表单 |
| | | * |
| | | * @author xp |
| | | * @since 2025-06-16 |
| | | */ |
| | | @Data |
| | | @ApiModel(value = "Share表单", description = "分享记录表单") |
| | | public class ShareForm extends AbsForm { |
| | | |
| | | @NotBlank(message = "业务类型不能为空", groups = {Add.class, Update.class}) |
| | | @ApiModelProperty("哪个业务的分享") |
| | | private String shareType; |
| | | |
| | | @NotBlank(message = "业务id不能为空", groups = {Add.class, Update.class}) |
| | | @ApiModelProperty("业务id") |
| | | private String refId; |
| | | |
| | | @NotBlank(message = "分享人不能为空", groups = {Add.class, Update.class}) |
| | | @ApiModelProperty("分享人") |
| | | private String shareUser; |
| | | |
| | | @ApiModelProperty("分享时间") |
| | | private Date shareTime; |
| | | |
| | | public static Share getEntityByForm(@NonNull ShareForm form, Share entity) { |
| | | if(entity == null) { |
| | | entity = new Share(); |
| | | } |
| | | BeanUtils.copyProperties(form, entity); |
| | | return entity; |
| | | } |
| | | |
| | | } |
| | |
| | | import cn.lili.group.Add; |
| | | import cn.lili.base.AbsForm; |
| | | import cn.lili.modules.lmk.domain.entity.Video; |
| | | import cn.lili.modules.lmk.domain.vo.VideoGoodsPublishVO; |
| | | import cn.lili.modules.lmk.domain.vo.VideoGoodsVO; |
| | | import org.hibernate.validator.constraints.Length; |
| | | import org.springframework.beans.BeanUtils; |
| | | |
| | |
| | | private List<WxVideoTagForm> tags = new ArrayList<>(2); |
| | | |
| | | // @NotBlank(message = "商品id不能为空", groups = {Add.class, Update.class}) |
| | | @ApiModelProperty("商品id") |
| | | private String goodsId; |
| | | @ApiModelProperty("商品列表") |
| | | private List<VideoGoodsPublishVO> goodsList; |
| | | |
| | | @ApiModelProperty("视频填充模式") |
| | | private String videoFit; |
New file |
| | |
| | | package cn.lili.modules.lmk.domain.query; |
| | | |
| | | import cn.lili.base.AbsQuery; |
| | | import java.util.List; |
| | | import org.springframework.lang.NonNull; |
| | | import javax.validation.constraints.NotBlank; |
| | | import javax.validation.constraints.NotNull; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * 分享点击记录查询 |
| | | * |
| | | * @author xp |
| | | * @since 2025-06-16 |
| | | */ |
| | | @Data |
| | | @ApiModel(value = "ShareClickRecord查询参数", description = "分享点击记录查询参数") |
| | | public class ShareClickRecordQuery extends AbsQuery { |
| | | } |
| | | |
New file |
| | |
| | | package cn.lili.modules.lmk.domain.query; |
| | | |
| | | import cn.lili.base.AbsQuery; |
| | | import java.util.List; |
| | | import org.springframework.lang.NonNull; |
| | | import javax.validation.constraints.NotBlank; |
| | | import javax.validation.constraints.NotNull; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * 分享记录查询 |
| | | * |
| | | * @author xp |
| | | * @since 2025-06-16 |
| | | */ |
| | | @Data |
| | | @ApiModel(value = "Share查询参数", description = "分享记录查询参数") |
| | | public class ShareQuery extends AbsQuery { |
| | | } |
| | | |
New file |
| | |
| | | package cn.lili.modules.lmk.domain.query; |
| | | |
| | | import cn.lili.base.AbsQuery; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * 发布视频时,关联商品的查询 |
| | | * |
| | | * @author:xp |
| | | * @date:2025/6/13 10:04 |
| | | */ |
| | | @Data |
| | | @ApiModel("发布视频时,关联商品的查询") |
| | | public class VideoGoodsEsQuery { |
| | | |
| | | @ApiModelProperty("搜索关键词") |
| | | private String keyword; |
| | | |
| | | @ApiModelProperty("查自家店铺的商品") |
| | | private Boolean searchFromSelfStore; |
| | | |
| | | |
| | | private int pageNumber; |
| | | |
| | | private int pageSize; |
| | | } |
New file |
| | |
| | | package cn.lili.modules.lmk.domain.vo; |
| | | |
| | | import cn.lili.base.AbsVo; |
| | | import cn.lili.modules.lmk.domain.entity.ShareClickRecord; |
| | | import java.util.List; |
| | | import org.springframework.lang.NonNull; |
| | | import org.springframework.beans.BeanUtils; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * 分享点击记录展示 |
| | | * |
| | | * @author xp |
| | | * @since 2025-06-16 |
| | | */ |
| | | @Data |
| | | @ApiModel(value = "分享点击记录响应数据", description = "分享点击记录响应数据") |
| | | public class ShareClickRecordVO extends AbsVo { |
| | | |
| | | /** 分享id */ |
| | | @ApiModelProperty("分享id") |
| | | private String shareId; |
| | | |
| | | /** 谁点了这个分享 */ |
| | | @ApiModelProperty("谁点了这个分享") |
| | | private String userId; |
| | | |
| | | /** 点击时间 */ |
| | | @ApiModelProperty("点击时间") |
| | | private Date clickTime; |
| | | |
| | | public static ShareClickRecordVO getVoByEntity(@NonNull ShareClickRecord entity, ShareClickRecordVO vo) { |
| | | if(vo == null) { |
| | | vo = new ShareClickRecordVO(); |
| | | } |
| | | BeanUtils.copyProperties(entity, vo); |
| | | return vo; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package cn.lili.modules.lmk.domain.vo; |
| | | |
| | | import cn.lili.base.AbsVo; |
| | | import cn.lili.modules.lmk.domain.entity.Share; |
| | | import java.util.List; |
| | | import org.springframework.lang.NonNull; |
| | | import org.springframework.beans.BeanUtils; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * 分享记录展示 |
| | | * |
| | | * @author xp |
| | | * @since 2025-06-16 |
| | | */ |
| | | @Data |
| | | @ApiModel(value = "分享记录响应数据", description = "分享记录响应数据") |
| | | public class ShareVO extends AbsVo { |
| | | |
| | | /** 哪个业务的分享 */ |
| | | @ApiModelProperty("哪个业务的分享") |
| | | private String shareType; |
| | | |
| | | /** 业务id */ |
| | | @ApiModelProperty("业务id") |
| | | private String refId; |
| | | |
| | | /** 分享人 */ |
| | | @ApiModelProperty("分享人") |
| | | private String shareUser; |
| | | |
| | | /** 分享时间 */ |
| | | @ApiModelProperty("分享时间") |
| | | private Date shareTime; |
| | | |
| | | public static ShareVO getVoByEntity(@NonNull Share entity, ShareVO vo) { |
| | | if(vo == null) { |
| | | vo = new ShareVO(); |
| | | } |
| | | BeanUtils.copyProperties(entity, vo); |
| | | return vo; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package cn.lili.modules.lmk.domain.vo; |
| | | |
| | | import cn.lili.base.AbsVo; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author:xp |
| | | * @date:2025/6/16 9:11 |
| | | */ |
| | | @Data |
| | | @ApiModel("视频商品详情") |
| | | public class VideoGoodsDetailVO { |
| | | |
| | | @ApiModelProperty("商品id") |
| | | private String goodsId; |
| | | |
| | | @ApiModelProperty("商品名称") |
| | | private String goodsName; |
| | | |
| | | @ApiModelProperty("价格") |
| | | private String price; |
| | | |
| | | @ApiModelProperty("缩略图") |
| | | private String thumbnail; |
| | | |
| | | @ApiModelProperty("商品数量") |
| | | private Integer goodsNum; |
| | | } |
New file |
| | |
| | | package cn.lili.modules.lmk.domain.vo; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author:xp |
| | | * @date:2025/6/15 19:10 |
| | | */ |
| | | @Data |
| | | @ApiModel("发布视频-商品信息") |
| | | public class VideoGoodsPublishVO { |
| | | |
| | | @ApiModelProperty("商品id") |
| | | private String goodsId; |
| | | |
| | | @ApiModelProperty("商品数量") |
| | | private Integer goodsNum; |
| | | |
| | | } |
| | |
| | | |
| | | /** 商品id */ |
| | | @ApiModelProperty("商品id") |
| | | private String goodsId; |
| | | |
| | | /** 商品查看次数 */ |
| | | @ApiModelProperty("商品查看次数") |
| | | private Long goodsViewNum; |
| | | |
| | | /** 商品下单次数 */ |
| | | @ApiModelProperty("商品下单次数") |
| | | private Long goodsOrderNum; |
| | | private List<VideoGoodsDetailVO> goodsList; |
| | | |
| | | /** 是否推荐 */ |
| | | @ApiModelProperty("是否推荐") |
| | |
| | | |
| | | /** 商品信息 */ |
| | | @ApiModelProperty("商品信息") |
| | | private VideoGoodsVO goods; |
| | | private List<VideoGoodsDetailVO> goodsList; |
| | | |
| | | @ApiModelProperty("当前用户是否收藏了该视频") |
| | | private Boolean collected = Boolean.FALSE; |
New file |
| | |
| | | package cn.lili.modules.lmk.mapper; |
| | | |
| | | import cn.lili.modules.lmk.domain.entity.ShareClickRecord; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import cn.lili.modules.lmk.domain.vo.ShareClickRecordVO; |
| | | import cn.lili.modules.lmk.domain.form.ShareClickRecordForm; |
| | | import cn.lili.modules.lmk.domain.query.ShareClickRecordQuery; |
| | | import java.util.List; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | /** |
| | | * 分享点击记录 Mapper 接口 |
| | | * |
| | | * @author xp |
| | | * @since 2025-06-16 |
| | | */ |
| | | @Mapper |
| | | public interface ShareClickRecordMapper extends BaseMapper<ShareClickRecord> { |
| | | |
| | | /** |
| | | * id查找分享点击记录 |
| | | * @param id |
| | | * @return |
| | | */ |
| | | ShareClickRecordVO getById(String id); |
| | | |
| | | /** |
| | | * 分页 |
| | | */ |
| | | IPage getPage(IPage page, @Param("query") ShareClickRecordQuery query); |
| | | |
| | | } |
New file |
| | |
| | | package cn.lili.modules.lmk.mapper; |
| | | |
| | | import cn.lili.modules.lmk.domain.entity.Share; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import cn.lili.modules.lmk.domain.vo.ShareVO; |
| | | import cn.lili.modules.lmk.domain.form.ShareForm; |
| | | import cn.lili.modules.lmk.domain.query.ShareQuery; |
| | | import java.util.List; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | /** |
| | | * 分享记录 Mapper 接口 |
| | | * |
| | | * @author xp |
| | | * @since 2025-06-16 |
| | | */ |
| | | @Mapper |
| | | public interface ShareMapper extends BaseMapper<Share> { |
| | | |
| | | /** |
| | | * id查找分享记录 |
| | | * @param id |
| | | * @return |
| | | */ |
| | | ShareVO getById(String id); |
| | | |
| | | /** |
| | | * 分页 |
| | | */ |
| | | IPage getPage(IPage page, @Param("query") ShareQuery query); |
| | | |
| | | } |
New file |
| | |
| | | package cn.lili.modules.lmk.mapper; |
| | | |
| | | import cn.lili.modules.lmk.domain.entity.VideoGoods; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | /** |
| | | * 视频商品中间表 Mapper 接口 |
| | | * |
| | | * @author xp |
| | | * @since 2025-06-15 |
| | | */ |
| | | @Mapper |
| | | public interface VideoGoodsMapper extends BaseMapper<VideoGoods> { |
| | | |
| | | |
| | | } |
| | |
| | | |
| | | import cn.lili.modules.lmk.domain.entity.Video; |
| | | import cn.lili.modules.lmk.domain.query.*; |
| | | import cn.lili.modules.lmk.domain.vo.CollectTypeNumVO; |
| | | import cn.lili.modules.lmk.domain.vo.VideoAccountVO; |
| | | import cn.lili.modules.lmk.domain.vo.VideoVO; |
| | | import cn.lili.modules.lmk.domain.vo.WxEditVideoVO; |
| | | import cn.lili.modules.lmk.domain.vo.*; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | |
| | | IPage healthPage(IPage page, @Param("query") HealthVideoQuery query); |
| | | |
| | | IPage kitchenPage(IPage page, @Param("query") KitchenVideoQuery query); |
| | | |
| | | /** |
| | | * 获取视频悬挂商品 |
| | | * |
| | | * @param videoId |
| | | * @return |
| | | */ |
| | | List<VideoGoodsDetailVO> getVideoGoods(@Param("id") String videoId); |
| | | } |
New file |
| | |
| | | package cn.lili.modules.lmk.service; |
| | | |
| | | import cn.lili.modules.lmk.domain.entity.ShareClickRecord; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import cn.lili.base.Result; |
| | | import cn.lili.modules.lmk.domain.form.ShareClickRecordForm; |
| | | import cn.lili.modules.lmk.domain.query.ShareClickRecordQuery; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 分享点击记录 服务类 |
| | | * |
| | | * @author xp |
| | | * @since 2025-06-16 |
| | | */ |
| | | public interface ShareClickRecordService extends IService<ShareClickRecord> { |
| | | |
| | | /** |
| | | * 添加 |
| | | * @param form |
| | | * @return |
| | | */ |
| | | Result add(ShareClickRecordForm form); |
| | | |
| | | /** |
| | | * 修改 |
| | | * @param form |
| | | * @return |
| | | */ |
| | | Result update(ShareClickRecordForm form); |
| | | |
| | | /** |
| | | * 批量删除 |
| | | * @param ids |
| | | * @return |
| | | */ |
| | | Result remove(List<String> ids); |
| | | |
| | | /** |
| | | * id删除 |
| | | * @param id |
| | | * @return |
| | | */ |
| | | Result removeById(String id); |
| | | |
| | | /** |
| | | * 分页查询 |
| | | * @param query |
| | | * @return |
| | | */ |
| | | Result page(ShareClickRecordQuery query); |
| | | |
| | | /** |
| | | * 根据id查找 |
| | | * @param id |
| | | * @return |
| | | */ |
| | | Result detail(String id); |
| | | |
| | | /** |
| | | * 列表 |
| | | * @return |
| | | */ |
| | | Result all(); |
| | | } |
New file |
| | |
| | | package cn.lili.modules.lmk.service; |
| | | |
| | | import cn.lili.modules.lmk.domain.entity.Share; |
| | | import cn.lili.modules.lmk.domain.form.ShareClickRecordForm; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import cn.lili.base.Result; |
| | | import cn.lili.modules.lmk.domain.form.ShareForm; |
| | | import cn.lili.modules.lmk.domain.query.ShareQuery; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 分享记录 服务类 |
| | | * |
| | | * @author xp |
| | | * @since 2025-06-16 |
| | | */ |
| | | public interface ShareService extends IService<Share> { |
| | | |
| | | /** |
| | | * 添加 |
| | | * @param form |
| | | * @return |
| | | */ |
| | | Result add(ShareForm form); |
| | | |
| | | /** |
| | | * 修改 |
| | | * @param form |
| | | * @return |
| | | */ |
| | | Result update(ShareForm form); |
| | | |
| | | /** |
| | | * 批量删除 |
| | | * @param ids |
| | | * @return |
| | | */ |
| | | Result remove(List<String> ids); |
| | | |
| | | /** |
| | | * id删除 |
| | | * @param id |
| | | * @return |
| | | */ |
| | | Result removeById(String id); |
| | | |
| | | /** |
| | | * 分页查询 |
| | | * @param query |
| | | * @return |
| | | */ |
| | | Result page(ShareQuery query); |
| | | |
| | | /** |
| | | * 根据id查找 |
| | | * @param id |
| | | * @return |
| | | */ |
| | | Result detail(String id); |
| | | |
| | | /** |
| | | * 列表 |
| | | * @return |
| | | */ |
| | | Result all(); |
| | | |
| | | /** |
| | | * 添加分享访问记录 |
| | | * |
| | | * @param form |
| | | * @return |
| | | */ |
| | | Result addShareClick(ShareClickRecordForm form); |
| | | } |
New file |
| | |
| | | package cn.lili.modules.lmk.service; |
| | | |
| | | import cn.lili.modules.lmk.domain.entity.VideoGoods; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | |
| | | /** |
| | | * 视频商品中间表 服务类 |
| | | * |
| | | * @author xp |
| | | * @since 2025-06-15 |
| | | */ |
| | | public interface VideoGoodsService extends IService<VideoGoods> { |
| | | |
| | | } |
| | |
| | | |
| | | Result delKitchen(String id); |
| | | |
| | | /** |
| | | * 视频商品查看 |
| | | * |
| | | * @param videoId |
| | | * @return |
| | | */ |
| | | Result getGoodsDetail(String videoId); |
| | | } |
New file |
| | |
| | | package cn.lili.modules.lmk.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import cn.lili.modules.lmk.domain.entity.ShareClickRecord; |
| | | import cn.lili.modules.lmk.mapper.ShareClickRecordMapper; |
| | | import cn.lili.modules.lmk.service.ShareClickRecordService; |
| | | import cn.lili.base.Result; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import cn.lili.modules.lmk.domain.form.ShareClickRecordForm; |
| | | import cn.lili.modules.lmk.domain.vo.ShareClickRecordVO; |
| | | import cn.lili.modules.lmk.domain.query.ShareClickRecordQuery; |
| | | import org.springframework.stereotype.Service; |
| | | import lombok.RequiredArgsConstructor; |
| | | import cn.lili.utils.PageUtil; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.util.Assert; |
| | | |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * 分享点击记录 服务实现类 |
| | | * |
| | | * @author xp |
| | | * @since 2025-06-16 |
| | | */ |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | public class ShareClickRecordServiceImpl extends ServiceImpl<ShareClickRecordMapper, ShareClickRecord> implements ShareClickRecordService { |
| | | |
| | | private final ShareClickRecordMapper shareClickRecordMapper; |
| | | |
| | | /** |
| | | * 添加 |
| | | * @param form |
| | | * @return |
| | | */ |
| | | @Override |
| | | public Result add(ShareClickRecordForm form) { |
| | | ShareClickRecord entity = ShareClickRecordForm.getEntityByForm(form, null); |
| | | baseMapper.insert(entity); |
| | | return Result.ok("添加成功"); |
| | | } |
| | | |
| | | /** |
| | | * 修改 |
| | | * @param form |
| | | * @return |
| | | */ |
| | | @Override |
| | | public Result update(ShareClickRecordForm form) { |
| | | ShareClickRecord entity = baseMapper.selectById(form.getId()); |
| | | |
| | | // 为空抛IllegalArgumentException,做全局异常处理 |
| | | Assert.notNull(entity, "记录不存在"); |
| | | BeanUtils.copyProperties(form, entity); |
| | | baseMapper.updateById(entity); |
| | | return Result.ok("修改成功"); |
| | | } |
| | | |
| | | /** |
| | | * 批量删除 |
| | | * @param ids |
| | | * @return |
| | | */ |
| | | @Override |
| | | public Result remove(List<String> ids) { |
| | | baseMapper.deleteBatchIds(ids); |
| | | return Result.ok("删除成功"); |
| | | } |
| | | |
| | | /** |
| | | * id删除 |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @Override |
| | | public Result removeById(String id) { |
| | | baseMapper.deleteById(id); |
| | | return Result.ok("删除成功"); |
| | | } |
| | | |
| | | /** |
| | | * 分页查询 |
| | | * @param query |
| | | * @return |
| | | */ |
| | | @Override |
| | | public Result page(ShareClickRecordQuery query) { |
| | | IPage<ShareClickRecordVO> page = PageUtil.getPage(query, ShareClickRecordVO.class); |
| | | baseMapper.getPage(page, query); |
| | | return Result.ok().data(page.getRecords()).total(page.getTotal()); |
| | | } |
| | | |
| | | /** |
| | | * 根据id查找 |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @Override |
| | | public Result detail(String id) { |
| | | ShareClickRecordVO vo = baseMapper.getById(id); |
| | | Assert.notNull(vo, "记录不存在"); |
| | | return Result.ok().data(vo); |
| | | } |
| | | |
| | | /** |
| | | * 列表 |
| | | * @return |
| | | */ |
| | | @Override |
| | | public Result all() { |
| | | List<ShareClickRecord> entities = baseMapper.selectList(null); |
| | | List<ShareClickRecordVO> vos = entities.stream() |
| | | .map(entity -> ShareClickRecordVO.getVoByEntity(entity, null)) |
| | | .collect(Collectors.toList()); |
| | | return Result.ok().data(vos); |
| | | } |
| | | } |
New file |
| | |
| | | package cn.lili.modules.lmk.service.impl; |
| | | |
| | | import cn.lili.common.security.context.UserContext; |
| | | import cn.lili.modules.lmk.domain.entity.ShareClickRecord; |
| | | import cn.lili.modules.lmk.domain.form.ShareClickRecordForm; |
| | | import cn.lili.modules.lmk.service.ShareClickRecordService; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import cn.lili.modules.lmk.domain.entity.Share; |
| | | import cn.lili.modules.lmk.mapper.ShareMapper; |
| | | import cn.lili.modules.lmk.service.ShareService; |
| | | import cn.lili.base.Result; |
| | | import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import cn.lili.modules.lmk.domain.form.ShareForm; |
| | | import cn.lili.modules.lmk.domain.vo.ShareVO; |
| | | import cn.lili.modules.lmk.domain.query.ShareQuery; |
| | | import org.springframework.stereotype.Service; |
| | | import lombok.RequiredArgsConstructor; |
| | | import cn.lili.utils.PageUtil; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.util.Assert; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * 分享记录 服务实现类 |
| | | * |
| | | * @author xp |
| | | * @since 2025-06-16 |
| | | */ |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | public class ShareServiceImpl extends ServiceImpl<ShareMapper, Share> implements ShareService { |
| | | |
| | | private final ShareMapper shareMapper; |
| | | private final ShareClickRecordService shareClickRecordService; |
| | | |
| | | /** |
| | | * 添加 |
| | | * @param form |
| | | * @return |
| | | */ |
| | | @Override |
| | | public Result add(ShareForm form) { |
| | | // 没分享过才新增 |
| | | boolean exists = new LambdaQueryChainWrapper<>(baseMapper) |
| | | .eq(Share::getShareType, form.getShareType()) |
| | | .eq(Share::getRefId, form.getRefId()) |
| | | .eq(Share::getShareUser, form.getShareUser()) |
| | | .exists(); |
| | | if (! exists) { |
| | | Share entity = ShareForm.getEntityByForm(form, null); |
| | | entity.setShareTime(new Date()); |
| | | baseMapper.insert(entity); |
| | | } |
| | | return Result.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 修改 |
| | | * @param form |
| | | * @return |
| | | */ |
| | | @Override |
| | | public Result update(ShareForm form) { |
| | | Share entity = baseMapper.selectById(form.getId()); |
| | | |
| | | // 为空抛IllegalArgumentException,做全局异常处理 |
| | | Assert.notNull(entity, "记录不存在"); |
| | | BeanUtils.copyProperties(form, entity); |
| | | baseMapper.updateById(entity); |
| | | return Result.ok("修改成功"); |
| | | } |
| | | |
| | | /** |
| | | * 批量删除 |
| | | * @param ids |
| | | * @return |
| | | */ |
| | | @Override |
| | | public Result remove(List<String> ids) { |
| | | baseMapper.deleteBatchIds(ids); |
| | | return Result.ok("删除成功"); |
| | | } |
| | | |
| | | /** |
| | | * id删除 |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @Override |
| | | public Result removeById(String id) { |
| | | baseMapper.deleteById(id); |
| | | return Result.ok("删除成功"); |
| | | } |
| | | |
| | | /** |
| | | * 分页查询 |
| | | * @param query |
| | | * @return |
| | | */ |
| | | @Override |
| | | public Result page(ShareQuery query) { |
| | | IPage<ShareVO> page = PageUtil.getPage(query, ShareVO.class); |
| | | baseMapper.getPage(page, query); |
| | | return Result.ok().data(page.getRecords()).total(page.getTotal()); |
| | | } |
| | | |
| | | /** |
| | | * 根据id查找 |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @Override |
| | | public Result detail(String id) { |
| | | ShareVO vo = baseMapper.getById(id); |
| | | Assert.notNull(vo, "记录不存在"); |
| | | return Result.ok().data(vo); |
| | | } |
| | | |
| | | /** |
| | | * 列表 |
| | | * @return |
| | | */ |
| | | @Override |
| | | public Result all() { |
| | | List<Share> entities = baseMapper.selectList(null); |
| | | List<ShareVO> vos = entities.stream() |
| | | .map(entity -> ShareVO.getVoByEntity(entity, null)) |
| | | .collect(Collectors.toList()); |
| | | return Result.ok().data(vos); |
| | | } |
| | | |
| | | @Override |
| | | public Result addShareClick(ShareClickRecordForm form) { |
| | | // 没有访问过才添加 |
| | | boolean exists = new LambdaQueryChainWrapper<>(shareClickRecordService.getBaseMapper()) |
| | | .eq(ShareClickRecord::getUserId, UserContext.getCurrentUserId()) |
| | | .eq(ShareClickRecord::getShareId, form.getShareId()) |
| | | .exists(); |
| | | if (! exists) { |
| | | ShareClickRecord record = ShareClickRecordForm.getEntityByForm(form, null); |
| | | record.setUserId(UserContext.getCurrentUserId()); |
| | | record.setClickTime(new Date()); |
| | | shareClickRecordService.save(record); |
| | | } |
| | | return Result.ok(); |
| | | } |
| | | } |
New file |
| | |
| | | package cn.lili.modules.lmk.service.impl; |
| | | |
| | | import cn.lili.modules.lmk.domain.entity.VideoGoods; |
| | | import cn.lili.modules.lmk.mapper.VideoGoodsMapper; |
| | | import cn.lili.modules.lmk.service.VideoGoodsService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * 视频商品中间表 服务实现类 |
| | | * |
| | | * @author xp |
| | | * @since 2025-06-15 |
| | | */ |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | public class VideoGoodsServiceImpl extends ServiceImpl<VideoGoodsMapper, VideoGoods> implements VideoGoodsService { |
| | | |
| | | private final VideoGoodsMapper videoGoodsMapper; |
| | | |
| | | } |
| | |
| | | private final MemberService memberService; |
| | | private final VideoAccountService videoAccountService; |
| | | private final KitchenVideoTypeRefService kitchenVideoTypeRefService; |
| | | private final VideoGoodsService videoGoodsService; |
| | | |
| | | |
| | | /** |
| | |
| | | return videoTagRef; |
| | | }).collect(Collectors.toList()); |
| | | videoTagRefService.saveBatch(videoTagRefs); |
| | | // 3.保存视频文件信息 |
| | | // 3. 保存视频文件信息 |
| | | lmkFileService.addByForm(form.getFileInfo()); |
| | | // 4. 处理选择的商品 |
| | | if (CollectionUtils.isNotEmpty(form.getGoodsList())) { |
| | | List<VideoGoods> videoGoods = new ArrayList<>(2); |
| | | for (int i = 0; i < form.getGoodsList().size(); i++) { |
| | | VideoGoods e = new VideoGoods(); |
| | | e.setVideoId(video.getId()); |
| | | e.setGoodsId(form.getGoodsList().get(i).getGoodsId()); |
| | | e.setGoodsNum(form.getGoodsList().get(i).getGoodsNum()); |
| | | e.setOrderNum(i); |
| | | videoGoods.add(e); |
| | | } |
| | | videoGoodsService.saveBatch(videoGoods); |
| | | } |
| | | return Result.ok("发布成功,视频审核中~"); |
| | | } |
| | | |
| | |
| | | if (page.getTotal() > 0) { |
| | | Map<String, List<SimpleVideoTagVO>> tagMap = videoTagRefService.getTagsByVideoIds( |
| | | page.getRecords().stream().map(VideoVO::getId).collect(Collectors.toList()) |
| | | ).stream().collect(Collectors.groupingBy(SimpleVideoTagVO::getVideoId));; |
| | | ).stream().collect(Collectors.groupingBy(SimpleVideoTagVO::getVideoId)); |
| | | // 3. 获取视频临时访问地址、设置视频标签 |
| | | page.getRecords().forEach(v -> { |
| | | v.setTagList(tagMap.get(v.getId())); |
| | |
| | | List<String> subscribes = mySubscribeService.getSubscribesByUserId(UserContext.getCurrentUserId()); |
| | | // 3. 获取视频临时访问地址、设置视频标签、我是否收藏、作者是否关注 |
| | | page.getRecords().forEach(v -> { |
| | | v.setGoods(new VideoGoodsVO()); |
| | | v.setTagList(tagMap.get(v.getId())); |
| | | v.setCollected(CollectionUtils.isNotEmpty(collectMap.get(v.getId()))); |
| | | if (VideoContentTypeEnum.VIDEO.getValue().equals(v.getVideoContentType())) { |
| | |
| | | } |
| | | |
| | | @Override |
| | | public Result getGoodsDetail(String videoId) { |
| | | List<VideoGoodsDetailVO> goodsList = baseMapper.getVideoGoods(videoId); |
| | | return Result.ok().data(goodsList); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public Result homePageInfoEdit(VideoHomePageInfoForm form) { |
| | | new LambdaUpdateChainWrapper<>(memberService.getBaseMapper()) |
| | |
| | | QRLoginResultVo loginWithSession(String token); |
| | | |
| | | Member findByUUID(String uuid); |
| | | } |
| | | |
| | | void registerHandler(Member user); |
| | | } |
| | |
| | | * @param member |
| | | */ |
| | | @Transactional |
| | | @Override |
| | | public void registerHandler(Member member) { |
| | | member.setId(SnowFlake.getIdStr()); |
| | | //保存会员 |
| | |
| | | package cn.lili.modules.search.service; |
| | | |
| | | import cn.lili.base.Result; |
| | | import cn.lili.common.vo.PageVO; |
| | | import cn.lili.modules.lmk.domain.query.VideoGoodsEsQuery; |
| | | import cn.lili.modules.search.entity.dos.EsGoodsIndex; |
| | | import cn.lili.modules.search.entity.dos.EsGoodsRelatedInfo; |
| | | import cn.lili.modules.search.entity.dto.EsGoodsSearchDTO; |
| | |
| | | * @return 商品索引 |
| | | */ |
| | | EsGoodsIndex getEsGoodsById(String id); |
| | | |
| | | /** |
| | | * 商品分页,发布视频时关联商品的查询 |
| | | * |
| | | * @param query |
| | | * @return |
| | | */ |
| | | Result videoGoodsEsPage(VideoGoodsEsQuery query); |
| | | } |
| | |
| | | import cn.hutool.core.convert.Convert; |
| | | import cn.hutool.core.text.CharSequenceUtil; |
| | | import cn.hutool.core.util.ArrayUtil; |
| | | import cn.lili.base.Result; |
| | | import cn.lili.cache.Cache; |
| | | import cn.lili.cache.CachePrefix; |
| | | import cn.lili.common.exception.ServiceException; |
| | | import cn.lili.common.security.context.UserContext; |
| | | import cn.lili.common.vo.PageVO; |
| | | import cn.lili.modules.goods.entity.enums.GoodsAuthEnum; |
| | | import cn.lili.modules.goods.entity.enums.GoodsStatusEnum; |
| | | import cn.lili.modules.lmk.domain.query.VideoGoodsEsQuery; |
| | | import cn.lili.modules.search.entity.dos.EsGoodsIndex; |
| | | import cn.lili.modules.search.entity.dos.EsGoodsRelatedInfo; |
| | | import cn.lili.modules.search.entity.dto.EsGoodsSearchDTO; |
| | |
| | | import org.elasticsearch.index.query.functionscore.FieldValueFactorFunctionBuilder; |
| | | import org.elasticsearch.index.query.functionscore.FunctionScoreQueryBuilder; |
| | | import org.elasticsearch.index.query.functionscore.ScoreFunctionBuilders; |
| | | import org.elasticsearch.index.search.MultiMatchQuery; |
| | | import org.elasticsearch.search.aggregations.*; |
| | | import org.elasticsearch.search.aggregations.bucket.nested.ParsedNested; |
| | | import org.elasticsearch.search.aggregations.bucket.terms.ParsedStringTerms; |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.domain.PageRequest; |
| | | import org.springframework.data.domain.Pageable; |
| | | import org.springframework.data.domain.Sort; |
| | | import org.springframework.data.elasticsearch.core.*; |
| | | import org.springframework.data.elasticsearch.core.query.NativeSearchQuery; |
| | | import org.springframework.data.elasticsearch.core.query.NativeSearchQueryBuilder; |
| | |
| | | return this.restTemplate.get(id, EsGoodsIndex.class); |
| | | } |
| | | |
| | | @Override |
| | | public Result videoGoodsEsPage(VideoGoodsEsQuery q) { |
| | | // 判断商品索引是否存在 |
| | | if (!restTemplate.indexOps(EsGoodsIndex.class).exists()) { |
| | | return Result.ok(); |
| | | } |
| | | // 根据销量倒序排列 |
| | | Pageable pageable = PageRequest.of(q.getPageNumber(), q.getPageSize(), Sort.by("buyCount").descending()); |
| | | |
| | | NativeSearchQueryBuilder queryBuilder = new NativeSearchQueryBuilder(); |
| | | queryBuilder.withPageable(pageable); |
| | | |
| | | BoolQueryBuilder boolQuery = QueryBuilders.boolQuery(); |
| | | |
| | | // 关键词匹配商品名称、商品编号 |
| | | if (!StringUtils.isEmpty(q.getKeyword())) { |
| | | boolQuery.must(QueryBuilders.multiMatchQuery(q.getKeyword(), "goodsName", "sn")); |
| | | } |
| | | |
| | | if (q.getSearchFromSelfStore()) { |
| | | // 如果只查自家店铺商品 |
| | | boolQuery.must(QueryBuilders.termQuery("storeId", UserContext.getCurrentUser().getStoreId())); |
| | | } |
| | | |
| | | queryBuilder.withQuery(boolQuery); |
| | | |
| | | NativeSearchQuery query = queryBuilder.build(); |
| | | SearchHits<EsGoodsIndex> searchHits = restTemplate.search(query, EsGoodsIndex.class); |
| | | List<EsGoodsIndex> data = searchHits.stream().map(hit -> hit.getContent()).collect(Collectors.toList()); |
| | | return Result.ok().data(data).total(searchHits.getTotalHits()); |
| | | } |
| | | |
| | | /** |
| | | * 转换搜索结果为聚合商品展示信息 |
| | | * |
New file |
| | |
| | | package cn.lili.mybatis; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.FieldFill; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Data; |
| | | import lombok.NoArgsConstructor; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | |
| | | /** |
| | | * 数据库基础实体类 |
| | | * |
| | | * @author Chopper |
| | | * @version v1.0 |
| | | * @since 2020/8/20 14:34 |
| | | */ |
| | | @Data |
| | | @JsonIgnoreProperties(value = { "handler", "fieldHandler"}) |
| | | @AllArgsConstructor |
| | | @NoArgsConstructor |
| | | public abstract class BaseIdAndDeleteEntity implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | |
| | | @TableId |
| | | @ApiModelProperty(value = "唯一标识", hidden = true) |
| | | private String id; |
| | | |
| | | |
| | | @TableField(fill = FieldFill.INSERT) |
| | | @ApiModelProperty(value = "删除标志 true/false 删除/未删除", hidden = true) |
| | | private Boolean deleteFlag; |
| | | |
| | | } |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="cn.lili.modules.lmk.mapper.ShareClickRecordMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="cn.lili.modules.lmk.domain.vo.ShareClickRecordVO"> |
| | | <id column="id" property="id"/> |
| | | <result column="share_id" property="shareId" /> |
| | | <result column="user_id" property="userId" /> |
| | | <result column="click_time" property="clickTime" /> |
| | | </resultMap> |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | <select id="getById" resultMap="BaseResultMap"> |
| | | SELECT |
| | | LSCR.share_id, |
| | | LSCR.user_id, |
| | | LSCR.click_time, |
| | | LSCR.id |
| | | FROM |
| | | lmk_share_click_record LSCR |
| | | WHERE |
| | | LSCR.id = #{id} AND LSCR.delete_flag = 0 |
| | | </select> |
| | | |
| | | |
| | | <select id="getPage" resultMap="BaseResultMap"> |
| | | SELECT |
| | | LSCR.share_id, |
| | | LSCR.user_id, |
| | | LSCR.click_time, |
| | | LSCR.id |
| | | FROM |
| | | lmk_share_click_record LSCR |
| | | WHERE |
| | | LSCR.delete_flag = 0 |
| | | </select> |
| | | |
| | | </mapper> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="cn.lili.modules.lmk.mapper.ShareMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="cn.lili.modules.lmk.domain.vo.ShareVO"> |
| | | <id column="id" property="id"/> |
| | | <result column="share_type" property="shareType" /> |
| | | <result column="ref_id" property="refId" /> |
| | | <result column="share_user" property="shareUser" /> |
| | | <result column="share_time" property="shareTime" /> |
| | | </resultMap> |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | <select id="getById" resultMap="BaseResultMap"> |
| | | SELECT |
| | | LS.share_type, |
| | | LS.ref_id, |
| | | LS.share_user, |
| | | LS.share_time, |
| | | LS.id |
| | | FROM |
| | | lmk_share LS |
| | | WHERE |
| | | LS.id = #{id} AND LS.delete_flag = 0 |
| | | </select> |
| | | |
| | | |
| | | <select id="getPage" resultMap="BaseResultMap"> |
| | | SELECT |
| | | LS.share_type, |
| | | LS.ref_id, |
| | | LS.share_user, |
| | | LS.share_time, |
| | | LS.id |
| | | FROM |
| | | lmk_share LS |
| | | WHERE |
| | | LS.delete_flag = 0 |
| | | </select> |
| | | |
| | | </mapper> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="cn.lili.modules.lmk.mapper.VideoGoodsMapper"> |
| | | |
| | | |
| | | |
| | | </mapper> |
| | |
| | | <result column="video_file_key" property="videoFileKey" /> |
| | | <result column="video_fit" property="videoFit" /> |
| | | <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" /> |
| | | <result column="play_num" property="playNum" /> |
| | |
| | | <result column="video_content_type" property="videoContentType" /> |
| | | <result column="video_type" property="videoType" /> |
| | | <result column="video_imgs" property="videoImgs" /> |
| | | <collection property="goodsList" column="id" select="getVideoGoods" ofType="cn.lili.modules.lmk.domain.vo.VideoGoodsDetailVO"/> |
| | | </resultMap> |
| | | |
| | | <resultMap id="VideoGoodsMap" type="cn.lili.modules.lmk.domain.vo.VideoGoodsDetailVO"> |
| | | <result column="goods_id" property="goodsId"/> |
| | | <result column="goods_num" property="goodsNum"/> |
| | | <result column="goods_name" property="goodsName"/> |
| | | <result column="thumbnail" property="thumbnail"/> |
| | | <result column="price" property="price"/> |
| | | </resultMap> |
| | | |
| | | <select id="getVideoGoods" parameterType="string" resultMap="VideoGoodsMap"> |
| | | SELECT |
| | | LVG.goods_id, |
| | | LVG.goods_num, |
| | | LVG.order_num, |
| | | LG.goods_name, |
| | | LG.thumbnail, |
| | | LG.price |
| | | FROM |
| | | lmk_video_goods LVG |
| | | INNER JOIN li_goods LG ON LVG.goods_id = LG.id AND LG.market_enable = 'UPPER' AND LG.delete_flag = 0 |
| | | WHERE |
| | | LVG.video_id = #{id} AND LVG.delete_flag = 0 |
| | | ORDER BY |
| | | LVG.order_num ASC |
| | | </select> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="KitchenVideoMap" type="cn.lili.modules.lmk.domain.vo.KitchenVideoVO"> |
| | | <id column="id" property="id"/> |
| | |
| | | <result column="video_file_key" property="videoFileKey" /> |
| | | <result column="video_fit" property="videoFit" /> |
| | | <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="video_content_type" property="videoContentType" /> |
| | | <result column="video_type" property="videoType" /> |
| | | <result column="video_imgs" property="videoImgs" /> |
| | | <collection property="goodsList" column="id" select="getVideoGoods" ofType="cn.lili.modules.lmk.domain.vo.VideoGoodsDetailVO"/> |
| | | </resultMap> |
| | | |
| | | |
| | |
| | | <result column="video_fit" property="videoFit" /> |
| | | <result column="title" property="title" /> |
| | | <result column="video_duration" property="videoDuration" /> |
| | | <result column="goods_id" property="goodsId" /> |
| | | </resultMap> |
| | | |
| | | <select id="wxDetail" resultMap="WxEditResultMap"> |