master:推广营销功能;
parent
6508d9c44c
commit
a0d24cb415
|
|
@ -61,6 +61,13 @@ public class SysProductCategoryController extends XktBaseController {
|
|||
return R.ok(BeanUtil.toBean(prodCateService.selectById(prodCateId), ProdCateVO.class));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "管理员菜单获取商品分类树", httpMethod = "POST", response = R.class)
|
||||
@PostMapping("/tree")
|
||||
public R<List<ProdCateListResVO>> tree(@RequestBody ProdCateListVO listVO) {
|
||||
return R.ok(BeanUtil.copyToList(prodCateService.tree(BeanUtil.toBean(listVO, ProdCateListDTO.class)), ProdCateListResVO.class));
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "获取商品分类列表", httpMethod = "POST", response = R.class)
|
||||
@PostMapping("/list")
|
||||
public R<List<ProdCateListResVO>> list(@RequestBody ProdCateListVO listVO) {
|
||||
|
|
|
|||
|
|
@ -7,10 +7,7 @@ import com.ruoyi.common.core.domain.R;
|
|||
import com.ruoyi.common.core.page.Page;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.web.controller.xkt.vo.advert.*;
|
||||
import com.ruoyi.xkt.dto.advert.AdvertCreateDTO;
|
||||
import com.ruoyi.xkt.dto.advert.AdvertPageDTO;
|
||||
import com.ruoyi.xkt.dto.advert.AdvertResDTO;
|
||||
import com.ruoyi.xkt.dto.advert.AdvertUpdateDTO;
|
||||
import com.ruoyi.xkt.dto.advert.*;
|
||||
import com.ruoyi.xkt.service.IAdvertService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
|
@ -74,13 +71,13 @@ public class AdvertController extends XktBaseController {
|
|||
|
||||
|
||||
/**
|
||||
* 推广营销下线
|
||||
* 上线/下线 营销推广
|
||||
*/
|
||||
@ApiOperation(value = "推广营销下线", httpMethod = "PUT", response = R.class)
|
||||
@Log(title = "推广营销下线", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/offline/{advertId}")
|
||||
public R<Integer> offline(@PathVariable Long advertId) {
|
||||
return R.ok(advertService.offline(advertId));
|
||||
@ApiOperation(value = "上线/下线 营销推广", httpMethod = "PUT", response = R.class)
|
||||
@Log(title = "上线/下线 营销推广", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/change-status")
|
||||
public R<Integer> changeAdvertStatus(@Validated @RequestBody AdvertChangeStatusVO changeStatusVO) {
|
||||
return R.ok(advertService.changeAdvertStatus(BeanUtil.toBean(changeStatusVO, AdvertChangeStatusDTO.class)));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -0,0 +1,27 @@
|
|||
package com.ruoyi.web.controller.xkt.vo.advert;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* @author liujiang
|
||||
* @version v1.0
|
||||
* @date 2025/3/27 15:12
|
||||
*/
|
||||
@ApiModel("推广营销 上线/下线")
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class AdvertChangeStatusVO {
|
||||
|
||||
@ApiModelProperty(value = "推广ID")
|
||||
@NotNull(message = "推广ID不能为空!")
|
||||
private Long advertId;
|
||||
@ApiModelProperty(value = "推广状态")
|
||||
@NotNull(message = "推广状态不能为空!")
|
||||
private Integer status;
|
||||
|
||||
}
|
||||
|
|
@ -22,37 +22,37 @@ import java.util.Date;
|
|||
public class AdvertCreateVO {
|
||||
|
||||
@NotNull(message = "推广平台ID不能为空!")
|
||||
@ApiModelProperty(value = "推广平台ID")
|
||||
@ApiModelProperty(value = "推广平台ID", required = true)
|
||||
private Integer platformId;
|
||||
@NotNull(message = "推广类型不能为空!")
|
||||
@ApiModelProperty(value = "推广类型")
|
||||
@ApiModelProperty(value = "推广类型", required = true)
|
||||
private Integer typeId;
|
||||
@NotNull(message = "推广tab不能为空!")
|
||||
@ApiModelProperty(value = "推广tab")
|
||||
@ApiModelProperty(value = "推广tab", required = true)
|
||||
private Integer tabId;
|
||||
@NotNull(message = "每个档口可以购买当前广告位数量限制不能为空!")
|
||||
@ApiModelProperty(value = "每个档口可以购买当前广告位数量限制")
|
||||
@ApiModelProperty(value = "每个档口可以购买当前广告位数量限制", required = true)
|
||||
private Integer storeBuyLimit;
|
||||
@NotNull(message = "播放轮次展示类型不能为空!")
|
||||
@ApiModelProperty(value = "播放轮次展示类型 1 时间范围or 2位置枚举")
|
||||
@ApiModelProperty(value = "播放轮次展示类型 1 时间范围or 2位置枚举", required = true)
|
||||
private Integer showType;
|
||||
@NotNull(message = "prodMaxNum不能为空!")
|
||||
@ApiModelProperty(value = "播放商品,或者图及商品 最多可容纳的商品数量")
|
||||
@ApiModelProperty(value = "播放商品,或者图及商品 最多可容纳的商品数量", required = true)
|
||||
private Integer prodMaxNum;
|
||||
@NotNull(message = "展示类型不能为空!")
|
||||
@ApiModelProperty(value = "展示类型 1推广图、2商品、3推广图及商品")
|
||||
@ApiModelProperty(value = "展示类型 1推广图、2商品、3推广图及商品", required = true)
|
||||
private Integer displayType;
|
||||
@NotNull(message = "起拍价格不能为空!")
|
||||
@ApiModelProperty(value = "起拍价格")
|
||||
@ApiModelProperty(value = "起拍价格", required = true)
|
||||
private BigDecimal startPrice;
|
||||
@NotNull(message = "播放间隔不能为空!")
|
||||
@ApiModelProperty(value = "播放间隔")
|
||||
@ApiModelProperty(value = "播放间隔", required = true)
|
||||
private Integer playInterval;
|
||||
@NotNull(message = "播放轮次不能为空!")
|
||||
@ApiModelProperty(value = "播放轮次")
|
||||
@ApiModelProperty(value = "播放轮次", required = true)
|
||||
private Integer playRound;
|
||||
@NotNull(message = "播放数量不能为空!")
|
||||
@ApiModelProperty(value = "播放数量")
|
||||
@ApiModelProperty(value = "播放数量", required = true)
|
||||
private Integer playNum;
|
||||
@ApiModelProperty(value = "推广范例图片")
|
||||
private AdvertFileVO example;
|
||||
|
|
@ -70,6 +70,8 @@ public class AdvertCreateVO {
|
|||
@ApiModelProperty(value = "折扣失效时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm")
|
||||
private Date discountEndTime;
|
||||
@ApiModelProperty(value = "截止时间")
|
||||
private String deadline;
|
||||
|
||||
@Data
|
||||
public static class AdvertFileVO {
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@ import javax.validation.constraints.NotNull;
|
|||
public class AdvertPageVO extends BasePageVO {
|
||||
|
||||
@ApiModelProperty(value = "上线状态")
|
||||
@NotNull(message = "上线状态不能为空")
|
||||
private Integer onlineStatus;
|
||||
@ApiModelProperty(value = "推广平台ID")
|
||||
private Integer platformId;
|
||||
|
|
|
|||
|
|
@ -59,6 +59,8 @@ public class AdvertResVO {
|
|||
@ApiModelProperty(value = "折扣失效时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm")
|
||||
private Date discountEndTime;
|
||||
@ApiModelProperty(value = "截止时间")
|
||||
private String deadline;
|
||||
|
||||
@Data
|
||||
public static class AdvertFileVO {
|
||||
|
|
|
|||
|
|
@ -73,6 +73,8 @@ public class AdvertUpdateVO {
|
|||
@ApiModelProperty(value = "折扣失效时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm")
|
||||
private Date discountEndTime;
|
||||
@ApiModelProperty(value = "截止时间")
|
||||
private String deadline;
|
||||
|
||||
@Data
|
||||
public static class AdvertFileVO {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,25 @@
|
|||
package com.ruoyi.xkt.dto.advert;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* @author liujiang
|
||||
* @version v1.0
|
||||
* @date 2025/3/27 15:12
|
||||
*/
|
||||
@ApiModel("推广营销 上线/下线")
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class AdvertChangeStatusDTO {
|
||||
|
||||
@ApiModelProperty(value = "推广ID")
|
||||
private Long advertId;
|
||||
@ApiModelProperty(value = "推广状态")
|
||||
private Integer status;
|
||||
|
||||
}
|
||||
|
|
@ -60,6 +60,8 @@ public class AdvertCreateDTO {
|
|||
@ApiModelProperty(value = "折扣失效时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm")
|
||||
private Date discountEndTime;
|
||||
@ApiModelProperty(value = "截止时间")
|
||||
private String deadline;
|
||||
|
||||
@Data
|
||||
@ApiModel(value = "广告范例图")
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.ruoyi.xkt.dto.advert;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
|
@ -14,11 +15,14 @@ import java.util.Date;
|
|||
* @version v1.0
|
||||
* @date 2025/3/27 15:12
|
||||
*/
|
||||
@ApiModel("创建推广营销")
|
||||
@ApiModel("推广营销列表返回数据")
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class AdvertResDTO {
|
||||
|
||||
@ApiModelProperty(value = "推广ID")
|
||||
@JsonProperty("advertId")
|
||||
private Long id;
|
||||
@ApiModelProperty(value = "推广平台ID")
|
||||
private Integer platformId;
|
||||
@ApiModelProperty(value = "推广类型")
|
||||
|
|
@ -59,6 +63,8 @@ public class AdvertResDTO {
|
|||
@ApiModelProperty(value = "折扣失效时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm")
|
||||
private Date discountEndTime;
|
||||
@ApiModelProperty(value = "截止时间")
|
||||
private String deadline;
|
||||
|
||||
@Data
|
||||
@ApiModel(value = "广告范例图")
|
||||
|
|
|
|||
|
|
@ -61,6 +61,8 @@ public class AdvertUpdateDTO {
|
|||
@ApiModelProperty(value = "折扣失效时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm")
|
||||
private Date discountEndTime;
|
||||
@ApiModelProperty(value = "截止时间")
|
||||
private String deadline;
|
||||
|
||||
@Data
|
||||
@ApiModel(value = "广告范例图")
|
||||
|
|
|
|||
|
|
@ -15,8 +15,8 @@ import lombok.Getter;
|
|||
@AllArgsConstructor
|
||||
public enum AdOnlineStatus {
|
||||
|
||||
// 上线中
|
||||
ONLINE(1, "上线中"),
|
||||
// 已上线
|
||||
ONLINE(1, "已上线"),
|
||||
// 已下线
|
||||
OFFLINE(2, "已下线"),
|
||||
|
||||
|
|
|
|||
|
|
@ -46,12 +46,12 @@ public interface IAdvertService {
|
|||
Integer updateAdvert(AdvertUpdateDTO updateDTO);
|
||||
|
||||
/**
|
||||
* 下线推广营销
|
||||
* 上线 下线推广营销
|
||||
*
|
||||
* @param advertId 推广营销ID
|
||||
* @param changeStatusDTO 入参
|
||||
* @return Integer
|
||||
*/
|
||||
Integer offline(Long advertId);
|
||||
Integer changeAdvertStatus(AdvertChangeStatusDTO changeStatusDTO);
|
||||
|
||||
/**
|
||||
* 获取初始化平台列表
|
||||
|
|
|
|||
|
|
@ -83,4 +83,11 @@ public interface ISysProductCategoryService {
|
|||
*/
|
||||
List<ProdCateDTO> getAllSubList();
|
||||
|
||||
/**
|
||||
* 管理员获取商品分类树
|
||||
*
|
||||
* @param listDTO 查询入参
|
||||
* @return List<ProdCateListResDTO>
|
||||
*/
|
||||
List<ProdCateListResDTO> tree(ProdCateListDTO listDTO);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -115,9 +115,11 @@ public class AdvertServiceImpl implements IAdvertService {
|
|||
@Override
|
||||
@Transactional(readOnly = true)
|
||||
public Page<AdvertResDTO> page(AdvertPageDTO pageDTO) {
|
||||
LambdaQueryWrapper<Advert> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(Advert::getDelFlag, Constants.UNDELETED);
|
||||
queryWrapper.eq(Advert::getOnlineStatus, pageDTO.getOnlineStatus());
|
||||
LambdaQueryWrapper<Advert> queryWrapper = new LambdaQueryWrapper<Advert>()
|
||||
.eq(Advert::getDelFlag, Constants.UNDELETED).orderByDesc(Advert::getCreateTime);
|
||||
if (ObjectUtils.isNotEmpty(pageDTO.getOnlineStatus())) {
|
||||
queryWrapper.eq(Advert::getOnlineStatus, pageDTO.getOnlineStatus());
|
||||
}
|
||||
if (ObjectUtils.isNotEmpty(pageDTO.getPlatformId())) {
|
||||
queryWrapper.eq(Advert::getPlatformId, pageDTO.getPlatformId());
|
||||
}
|
||||
|
|
@ -126,8 +128,8 @@ public class AdvertServiceImpl implements IAdvertService {
|
|||
}
|
||||
PageHelper.startPage(pageDTO.getPageNum(), pageDTO.getPageSize());
|
||||
List<Advert> advertList = this.advertMapper.selectList(queryWrapper);
|
||||
return CollectionUtils.isEmpty(advertList) ? Page.empty(pageDTO.getPageSize(), pageDTO.getPageNum())
|
||||
: Page.convert(new PageInfo<>(advertList), BeanUtil.copyToList(advertList, AdvertResDTO.class));
|
||||
return CollectionUtils.isEmpty(advertList) ? Page.empty(pageDTO.getPageSize(), pageDTO.getPageNum())
|
||||
: Page.convert(new PageInfo<>(advertList), BeanUtil.copyToList(advertList, AdvertResDTO.class));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -145,27 +147,30 @@ public class AdvertServiceImpl implements IAdvertService {
|
|||
// TODO 判断当前是否超级管理员在操作
|
||||
this.isSuperAdmin();
|
||||
|
||||
// 将文件插入到SysFile表中
|
||||
SysFile file = BeanUtil.toBean(updateDTO.getExample(), SysFile.class);
|
||||
this.fileMapper.insert(file);
|
||||
Advert advert = Optional.ofNullable(this.advertMapper.selectOne(new LambdaQueryWrapper<Advert>()
|
||||
.eq(Advert::getId, updateDTO.getAdvertId()).eq(Advert::getDelFlag, Constants.UNDELETED)))
|
||||
.orElseThrow(() -> new ServiceException("推广营销不存在!", HttpStatus.ERROR));
|
||||
BeanUtil.copyProperties(updateDTO, advert);
|
||||
advert.setExamplePicId(file.getId());
|
||||
if (ObjectUtils.isNotEmpty(updateDTO.getExample())) {
|
||||
// 将文件插入到SysFile表中
|
||||
SysFile file = BeanUtil.toBean(updateDTO.getExample(), SysFile.class);
|
||||
this.fileMapper.insert(file);
|
||||
advert.setExamplePicId(file.getId());
|
||||
}
|
||||
return this.advertMapper.updateById(advert);
|
||||
}
|
||||
|
||||
/**
|
||||
* 下线推广营销
|
||||
*
|
||||
* @param advertId 推广营销ID
|
||||
* @param changeStatusDTO 推广营销入参
|
||||
* @return Integer
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public Integer offline(Long advertId) {
|
||||
|
||||
public Integer changeAdvertStatus(AdvertChangeStatusDTO changeStatusDTO) {
|
||||
// 判断状态是否合法
|
||||
AdOnlineStatus.of(changeStatusDTO.getStatus());
|
||||
|
||||
// TODO 判断当前是否超级管理员在操作
|
||||
// TODO 判断当前是否超级管理员在操作
|
||||
|
|
@ -173,13 +178,10 @@ public class AdvertServiceImpl implements IAdvertService {
|
|||
this.isSuperAdmin();
|
||||
|
||||
Advert advert = Optional.ofNullable(this.advertMapper.selectOne(new LambdaQueryWrapper<Advert>()
|
||||
.eq(Advert::getId, advertId).eq(Advert::getDelFlag, Constants.UNDELETED)))
|
||||
.eq(Advert::getId, changeStatusDTO.getAdvertId()).eq(Advert::getDelFlag, Constants.UNDELETED)))
|
||||
.orElseThrow(() -> new ServiceException("推广营销不存在!", HttpStatus.ERROR));
|
||||
if (Objects.equals(advert.getOnlineStatus(), AdOnlineStatus.OFFLINE.getValue())) {
|
||||
throw new ServiceException("推广营销已下线,不可再次操作!", HttpStatus.ERROR);
|
||||
}
|
||||
advert.setOnlineStatus(AdOnlineStatus.OFFLINE.getValue());
|
||||
return this.advertMapper.updateById(advert);
|
||||
advert.setOnlineStatus(changeStatusDTO.getStatus());
|
||||
return this.advertMapper.updateById(advert);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -153,6 +153,34 @@ public class SysProductCategoryServiceImpl implements ISysProductCategoryService
|
|||
return this.buildCateTree(resList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 管理员获取商品分类树
|
||||
*
|
||||
* @param listDTO 查询入参
|
||||
* @return List<ProdCateListResDTO>
|
||||
*/
|
||||
@Override
|
||||
@Transactional(readOnly = true)
|
||||
public List<ProdCateListResDTO> tree(ProdCateListDTO listDTO) {
|
||||
LambdaQueryWrapper<SysProductCategory> queryWrapper = new LambdaQueryWrapper<SysProductCategory>()
|
||||
.eq(SysProductCategory::getDelFlag, Constants.UNDELETED)
|
||||
.orderByAsc(Arrays.asList(SysProductCategory::getOrderNum, SysProductCategory::getId));
|
||||
if (StringUtils.isNotBlank(listDTO.getName())) {
|
||||
queryWrapper.like(SysProductCategory::getName, listDTO.getName());
|
||||
}
|
||||
if (StringUtils.isNotBlank(listDTO.getStatus())) {
|
||||
queryWrapper.eq(SysProductCategory::getStatus, listDTO.getStatus());
|
||||
}
|
||||
List<SysProductCategory> prodCateList = this.prodCateMapper.selectList(queryWrapper);
|
||||
if (CollectionUtils.isEmpty(prodCateList)) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
List<ProdCateListResDTO> resList = prodCateList.stream()
|
||||
.map(x -> BeanUtil.toBean(x, ProdCateListResDTO.class).setProdCateId(x.getId())).collect(Collectors.toList());
|
||||
return this.buildCateTree(resList);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取APP首页商品分类
|
||||
*
|
||||
|
|
|
|||
Loading…
Reference in New Issue