buyer-api/src/main/java/cn/lili/controller/goods/GoodsBuyerController.java
@@ -14,7 +14,9 @@ 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.GoodsBannerQuery; import cn.lili.modules.lmk.domain.query.VideoGoodsEsQuery; import cn.lili.modules.lmk.service.GoodsBannerService; import cn.lili.modules.search.entity.dos.EsGoodsIndex; import cn.lili.modules.search.entity.dos.EsGoodsRelatedInfo; import cn.lili.modules.search.entity.dto.EsGoodsSearchDTO; @@ -74,6 +76,8 @@ @Autowired private COSUtil cosUtil; @Autowired private GoodsBannerService goodsBannerService; @ApiOperation(value = "通过id获取商品信息") @ApiImplicitParam(name = "goodsId", value = "商品ID", required = true, paramType = "path", dataType = "Long") @@ -139,6 +143,11 @@ }); return ResultUtil.data(ePage); } @ApiOperation(value = "获取推广信息") @GetMapping("/getBannerList") public Result getBannerList(GoodsBannerQuery query) { return goodsBannerService.getBannerList(query); } @ApiOperation(value = "商品分页-发布视频时关联商品") @GetMapping("/video/es") framework/src/main/java/cn/lili/modules/lmk/domain/entity/GoodsBanner.java
New file @@ -0,0 +1,42 @@ package cn.lili.modules.lmk.domain.entity; import cn.lili.mybatis.BaseEntity; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import java.io.Serializable; import io.swagger.annotations.ApiModelProperty; import lombok.Data; /** * 商品广场推荐 * * @author peng * @since 2025-08-07 */ @Data @TableName("lmk_goods_banner") public class GoodsBanner extends BaseEntity { private static final long serialVersionUID = 1L; @TableField("goods_id") /** 商品id */ private Long goodsId; @TableField("sku_id") /** skuId */ private Long skuId; @TableField("sort") private Integer sort; @TableField("can_show") private Boolean canShow; @TableField("banner_url") /** banner图片 */ private String bannerUrl; } framework/src/main/java/cn/lili/modules/lmk/domain/form/GoodsBannerForm.java
New file @@ -0,0 +1,55 @@ 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.GoodsBanner; 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 peng * @since 2025-08-07 */ @Data @ApiModel(value = "GoodsBanner表单", description = "商品广场推荐表单") public class GoodsBannerForm extends AbsForm { @NotNull(message = "商品id不能为空", groups = {Add.class, Update.class}) @ApiModelProperty("商品id") private Long goodsId; @NotNull(message = "skuId不能为空", groups = {Add.class, Update.class}) @ApiModelProperty("skuId") private Long skuId; @ApiModelProperty("sort") private Integer sort; @ApiModelProperty("canShow") @NotNull(message = "是否显示不能为空", groups = {Add.class, Update.class}) private Boolean canShow; @NotBlank(message = "banner图片不能为空", groups = {Add.class, Update.class}) @ApiModelProperty("banner图片") private String bannerUrl; public static GoodsBanner getEntityByForm(@NonNull GoodsBannerForm form, GoodsBanner entity) { if(entity == null) { entity = new GoodsBanner(); } BeanUtils.copyProperties(form, entity); return entity; } } framework/src/main/java/cn/lili/modules/lmk/domain/query/GoodsBannerQuery.java
New file @@ -0,0 +1,22 @@ 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 peng * @since 2025-08-07 */ @Data @ApiModel(value = "GoodsBanner查询参数", description = "商品广场推荐查询参数") public class GoodsBannerQuery extends AbsQuery { } framework/src/main/java/cn/lili/modules/lmk/domain/vo/GoodsBannerVO.java
New file @@ -0,0 +1,61 @@ package cn.lili.modules.lmk.domain.vo; import cn.lili.base.AbsVo; import cn.lili.group.Add; import cn.lili.group.Update; import cn.lili.modules.lmk.domain.entity.GoodsBanner; 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 javax.validation.constraints.NotNull; import java.util.Date; /** * 商品广场推荐展示 * * @author peng * @since 2025-08-07 */ @Data @ApiModel(value = "商品广场推荐响应数据", description = "商品广场推荐响应数据") public class GoodsBannerVO extends AbsVo { /** 商品id */ @ApiModelProperty("商品id") private String goodsId; /** skuId */ @ApiModelProperty("skuId") private String skuId; /** banner图片 */ @ApiModelProperty("banner图片") private String bannerUrl; /** banner图片 */ @ApiModelProperty("banner图片") private String showBannerUrl; @ApiModelProperty("sort") private Integer sort; private String goodsName; private String price; private String thumbnail; @ApiModelProperty("canShow") private Boolean canShow; public static GoodsBannerVO getVoByEntity(@NonNull GoodsBanner entity, GoodsBannerVO vo) { if(vo == null) { vo = new GoodsBannerVO(); } BeanUtils.copyProperties(entity, vo); return vo; } } framework/src/main/java/cn/lili/modules/lmk/mapper/GoodsBannerMapper.java
New file @@ -0,0 +1,37 @@ package cn.lili.modules.lmk.mapper; import cn.lili.modules.lmk.domain.entity.GoodsBanner; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import cn.lili.modules.lmk.domain.vo.GoodsBannerVO; import cn.lili.modules.lmk.domain.form.GoodsBannerForm; import cn.lili.modules.lmk.domain.query.GoodsBannerQuery; import java.util.List; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; /** * 商品广场推荐 Mapper 接口 * * @author peng * @since 2025-08-07 */ @Mapper public interface GoodsBannerMapper extends BaseMapper<GoodsBanner> { /** * id查找商品广场推荐 * @param id * @return */ GoodsBannerVO getById(String id); /** * 分页 */ IPage getPage(IPage page, @Param("query") GoodsBannerQuery query); List<GoodsBannerVO> getBannerList(@Param("query") GoodsBannerQuery query); } framework/src/main/java/cn/lili/modules/lmk/service/GoodsBannerService.java
New file @@ -0,0 +1,67 @@ package cn.lili.modules.lmk.service; import cn.lili.modules.lmk.domain.entity.GoodsBanner; import com.baomidou.mybatisplus.extension.service.IService; import cn.lili.base.Result; import cn.lili.modules.lmk.domain.form.GoodsBannerForm; import cn.lili.modules.lmk.domain.query.GoodsBannerQuery; import java.util.List; /** * 商品广场推荐 服务类 * * @author peng * @since 2025-08-07 */ public interface GoodsBannerService extends IService<GoodsBanner> { /** * 添加 * @param form * @return */ Result add(GoodsBannerForm form); /** * 修改 * @param form * @return */ Result update(GoodsBannerForm form); /** * 批量删除 * @param ids * @return */ Result remove(List<String> ids); /** * id删除 * @param id * @return */ Result removeById(String id); /** * 分页查询 * @param query * @return */ Result page(GoodsBannerQuery query); Result getBannerList(GoodsBannerQuery query); /** * 根据id查找 * @param id * @return */ Result detail(String id); /** * 列表 * @return */ Result all(); } framework/src/main/java/cn/lili/modules/lmk/service/impl/GoodsBannerServiceImpl.java
New file @@ -0,0 +1,143 @@ package cn.lili.modules.lmk.service.impl; import cn.lili.common.utils.StringUtils; import cn.lili.utils.COSUtil; import com.baomidou.mybatisplus.core.metadata.IPage; import cn.lili.modules.lmk.domain.entity.GoodsBanner; import cn.lili.modules.lmk.mapper.GoodsBannerMapper; import cn.lili.modules.lmk.service.GoodsBannerService; import cn.lili.base.Result; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import cn.lili.modules.lmk.domain.form.GoodsBannerForm; import cn.lili.modules.lmk.domain.vo.GoodsBannerVO; import cn.lili.modules.lmk.domain.query.GoodsBannerQuery; 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 peng * @since 2025-08-07 */ @Service @RequiredArgsConstructor public class GoodsBannerServiceImpl extends ServiceImpl<GoodsBannerMapper, GoodsBanner> implements GoodsBannerService { private final GoodsBannerMapper goodsBannerMapper; private final COSUtil cosUtil; /** * 添加 * @param form * @return */ @Override public Result add(GoodsBannerForm form) { GoodsBanner entity = GoodsBannerForm.getEntityByForm(form, null); baseMapper.insert(entity); return Result.ok("添加成功"); } /** * 修改 * @param form * @return */ @Override public Result update(GoodsBannerForm form) { GoodsBanner 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(GoodsBannerQuery query) { IPage<GoodsBannerVO> page = PageUtil.getPage(query, GoodsBannerVO.class); baseMapper.getPage(page, query); page.getRecords().stream().forEach(item -> { String bannerUrl = item.getBannerUrl(); if (StringUtils.isNotEmpty(bannerUrl)&&!bannerUrl.contains("http")) { item.setShowBannerUrl(cosUtil.getPreviewUrl(bannerUrl)); }else { item.setShowBannerUrl(bannerUrl); } }); return Result.ok().data(page.getRecords()).total(page.getTotal()); } @Override public Result getBannerList(GoodsBannerQuery query) { List<GoodsBannerVO> bannerList = baseMapper.getBannerList(query); bannerList.forEach(item -> { String bannerUrl = item.getBannerUrl(); if (StringUtils.isNotEmpty(bannerUrl)&&!bannerUrl.contains("http")) { item.setShowBannerUrl(cosUtil.getPreviewUrl(bannerUrl)); }else { item.setShowBannerUrl(bannerUrl); } }); return Result.ok().data(bannerList); } /** * 根据id查找 * @param id * @return */ @Override public Result detail(String id) { GoodsBannerVO vo = baseMapper.getById(id); Assert.notNull(vo, "记录不存在"); return Result.ok().data(vo); } /** * 列表 * @return */ @Override public Result all() { List<GoodsBanner> entities = baseMapper.selectList(null); List<GoodsBannerVO> vos = entities.stream() .map(entity -> GoodsBannerVO.getVoByEntity(entity, null)) .collect(Collectors.toList()); return Result.ok().data(vos); } } framework/src/main/java/cn/lili/modules/promotion/serviceimpl/CouponServiceImpl.java
@@ -96,7 +96,9 @@ AuthUser currentUser = Objects.requireNonNull(UserContext.getCurrentUser()); if (StringUtils.isNotBlank(currentUser.getId())){ List<String> ids = list.stream().map(CouponVO::getId).collect(Collectors.toList()); if (!(ids.size() >1)){ return; } //获得分页优惠劵后的结果后,判断对象是否被用户获得过。 List<MemberCoupon> userCouponVOS = new LambdaQueryChainWrapper<>(memberCouponMapper) .in(MemberCoupon::getCouponId,ids) framework/src/main/java/cn/lili/modules/search/entity/dos/EsGoodsIndex.java
@@ -297,6 +297,7 @@ @ApiModelProperty("商品促销活动集合JSON,key 为 促销活动类型,value 为 促销活动实体信息 ") private String promotionMapJson; @ApiModelProperty(value = "商品排序") @Field(type = FieldType.Long) private Integer goodsSort; public EsGoodsIndex(GoodsSku sku) { framework/src/main/resources/mapper/lmk/GoodsBannerMapper.xml
New file @@ -0,0 +1,71 @@ <?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.GoodsBannerMapper"> <!-- 通用查询映射结果 --> <resultMap id="BaseResultMap" type="cn.lili.modules.lmk.domain.vo.GoodsBannerVO"> <id column="id" property="id"/> <result column="goods_id" property="goodsId" /> <result column="sku_id" property="skuId" /> <result column="banner_url" property="bannerUrl" /> <result column="sort" property="sort" /> <result column="can_show" property="canShow" /> <result property="goodsName" column="goods_name"/> <result property="price" column="price"/> <result property="thumbnail" column="thumbnail"/> </resultMap> <select id="getById" resultMap="BaseResultMap"> SELECT LGB.goods_id, LGB.sku_id, LGB.banner_url, LGB.id FROM lmk_goods_banner LGB WHERE LGB.id = #{id} AND LGB.delete_flag = 0 </select> <select id="getPage" resultMap="BaseResultMap"> SELECT LGB.goods_id, LGB.sku_id, LGB.banner_url, LGB.id, LGB.sort, LGB.can_show, LGS.goods_name, LGS.price, LGS.thumbnail FROM lmk_goods_banner LGB JOIN li_goods_sku LGS ON LGS.id = LGB.sku_id AND LGS.delete_flag = 0 WHERE LGB.delete_flag = 0 </select> <select id="getBannerList" resultMap="BaseResultMap"> SELECT LGB.id, LGB.goods_id, LGB.sku_id, LGB.banner_url FROM lmk_goods_banner LGB JOIN li_goods_sku LGS ON LGS.id = LGB.sku_id AND LGS.delete_flag = 0 AND LGB.can_show = 1 WHERE LGB.delete_flag = 0 order by LGB.sort asc </select> </mapper> lmk-job/src/main/java/cn/lili/handler/impl/order/OrderEveryDayTaskExecute.java
@@ -89,7 +89,6 @@ */ @Override public void execute() { Setting setting = settingService.get(SettingEnum.ORDER_SETTING.name()); //订单设置 OrderSetting orderSetting = JSONUtil.toBean(setting.getSettingValue(), OrderSetting.class); manager-api/src/main/java/cn/lili/controller/lmk/GoodsBannerController.java
New file @@ -0,0 +1,76 @@ package cn.lili.controller.lmk; import cn.lili.group.Update; import cn.lili.group.Add; import org.springframework.validation.annotation.Validated; import org.springframework.security.access.prepost.PreAuthorize; import lombok.RequiredArgsConstructor; import java.util.List; import org.springframework.validation.annotation.Validated; import javax.validation.constraints.NotEmpty; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import cn.lili.modules.lmk.service.GoodsBannerService; import cn.lili.base.Result; import cn.lili.modules.lmk.domain.form.GoodsBannerForm; import cn.lili.modules.lmk.domain.query.GoodsBannerQuery; import lombok.RequiredArgsConstructor; import org.springframework.web.bind.annotation.*; /** * 商品广场推荐 前端控制器 * * @author peng * @since 2025-08-07 */ @Validated @RequiredArgsConstructor @Api(value = "商品广场推荐", tags = "商品广场推荐管理") @RestController @RequestMapping("/manager/lmk/goods-banner") public class GoodsBannerController { private final GoodsBannerService goodsBannerService; @PostMapping @ApiOperation(value = "添加", notes = "添加") public Result add(@RequestBody @Validated(Add.class) GoodsBannerForm form) { return goodsBannerService.add(form); } @PutMapping @ApiOperation(value = "修改", notes = "修改") public Result update(@RequestBody @Validated(Update.class) GoodsBannerForm form) { return goodsBannerService.update(form); } @DeleteMapping("/{id}") @ApiOperation(value = "ID删除", notes = "ID删除") public Result removeById(@PathVariable("id") String id) { return goodsBannerService.removeById(id); } @DeleteMapping("/batch") @ApiOperation(value = "批量删除", notes = "批量删除") public Result remove(@RequestBody @NotEmpty(message = "请选择数据") List<String> ids) { return goodsBannerService.remove(ids); } @GetMapping("/page") @ApiOperation(value = "分页", notes = "分页") public Result page(GoodsBannerQuery query) { return goodsBannerService.page(query); } @GetMapping("/{id}") @ApiOperation(value = "详情", notes = "详情") public Result detail(@PathVariable("id") String id) { return goodsBannerService.detail(id); } @GetMapping("/list") @ApiOperation(value = "列表", notes = "列表") public Result list() { return goodsBannerService.all(); } }