master:推广营销元数据功能添加;
parent
5ff2459720
commit
3b610b5ec2
|
|
@ -0,0 +1,88 @@
|
|||
package com.ruoyi.web.controller.xkt;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.XktBaseController;
|
||||
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.AdvertCreateVO;
|
||||
import com.ruoyi.web.controller.xkt.vo.advert.AdvertPageVO;
|
||||
import com.ruoyi.web.controller.xkt.vo.advert.AdvertResVO;
|
||||
import com.ruoyi.web.controller.xkt.vo.advert.AdvertUpdateVO;
|
||||
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.service.IAdvertService;
|
||||
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.*;
|
||||
|
||||
/**
|
||||
* 管理员管理推广营销Controller
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-03-26
|
||||
*/
|
||||
@Api(tags = "推广营销")
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/rest/v1/adverts")
|
||||
public class AdvertController extends XktBaseController {
|
||||
|
||||
final IAdvertService advertService;
|
||||
|
||||
/**
|
||||
* 新增推广营销。只有超级管理员有权限
|
||||
*/
|
||||
@ApiOperation(value = "新增推广营销", httpMethod = "POST", response = R.class)
|
||||
@Log(title = "新增推广营销", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public R<Integer> create(@Validated @RequestBody AdvertCreateVO createVO) {
|
||||
return R.ok(advertService.create(BeanUtil.toBean(createVO, AdvertCreateDTO.class)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取推广营销详细信息
|
||||
*/
|
||||
@ApiOperation(value = "获取推广营销详细信息", httpMethod = "GET", response = R.class)
|
||||
@GetMapping(value = "/{advertId}")
|
||||
public R<AdvertResVO> getInfo(@PathVariable("advertId") Long advertId) {
|
||||
return R.ok(BeanUtil.toBean(advertService.getInfo(advertId), AdvertResVO.class));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询推广营销列表
|
||||
*/
|
||||
@ApiOperation(value = "查询推广营销列表 ", httpMethod = "POST", response = R.class)
|
||||
@PostMapping("/page")
|
||||
public R<Page<AdvertResDTO>> page(@Validated @RequestBody AdvertPageVO pageVO) {
|
||||
return R.ok(advertService.page(BeanUtil.toBean(pageVO, AdvertPageDTO.class)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改推广营销信息
|
||||
*/
|
||||
@ApiOperation(value = "修改推广营销信息", httpMethod = "PUT", response = R.class)
|
||||
@Log(title = "修改推广营销信息", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public R<Integer> edit(@Validated @RequestBody AdvertUpdateVO updateVO) {
|
||||
return R.ok(advertService.updateAdvert(BeanUtil.toBean(updateVO, AdvertUpdateDTO.class)));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 推广营销下线
|
||||
*/
|
||||
@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));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -7,11 +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.store.*;
|
||||
import com.ruoyi.web.controller.xkt.vo.storeProd.StoreProdPageVO;
|
||||
import com.ruoyi.web.controller.xkt.vo.storeProd.StoreProdResVO;
|
||||
import com.ruoyi.xkt.dto.store.*;
|
||||
import com.ruoyi.xkt.dto.storeProduct.StoreProdPageDTO;
|
||||
import com.ruoyi.xkt.dto.storeProduct.StoreProdPageResDTO;
|
||||
import com.ruoyi.xkt.service.IStoreService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
|
@ -40,8 +36,8 @@ public class StoreController extends XktBaseController {
|
|||
@PreAuthorize("@ss.hasPermi('system:store:edit')")
|
||||
@Log(title = "新增档口", businessType = BusinessType.UPDATE)
|
||||
@PostMapping
|
||||
public R<Integer> create(@Validated @RequestBody StoreCreateDTO createDTO) {
|
||||
return R.ok(storeService.create(createDTO));
|
||||
public R<Integer> create(@Validated @RequestBody StoreCreateVO createVO) {
|
||||
return R.ok(storeService.create(BeanUtil.toBean(createVO, StoreCreateDTO.class)));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -108,6 +104,4 @@ public class StoreController extends XktBaseController {
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,82 @@
|
|||
package com.ruoyi.web.controller.xkt.vo.advert;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author liujiang
|
||||
* @version v1.0
|
||||
* @date 2025/3/27 15:12
|
||||
*/
|
||||
@ApiModel("创建推广营销")
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class AdvertCreateVO {
|
||||
|
||||
@NotNull(message = "推广平台ID不能为空!")
|
||||
@ApiModelProperty(value = "推广平台ID")
|
||||
private Integer platformId;
|
||||
@NotNull(message = "推广类型不能为空!")
|
||||
@ApiModelProperty(value = "推广类型")
|
||||
private Integer typeId;
|
||||
@NotNull(message = "推广tab不能为空!")
|
||||
@ApiModelProperty(value = "推广tab")
|
||||
private Integer tabId;
|
||||
@NotNull(message = "展示类型不能为空!")
|
||||
@ApiModelProperty(value = "展示类型 1推广图、2商品、3推广图及商品")
|
||||
private Integer displayType;
|
||||
@NotNull(message = "起拍价格不能为空!")
|
||||
@ApiModelProperty(value = "起拍价格")
|
||||
private BigDecimal startPrice;
|
||||
@NotNull(message = "播放间隔不能为空!")
|
||||
@ApiModelProperty(value = "播放间隔")
|
||||
private Integer playInterval;
|
||||
@NotNull(message = "播放轮次不能为空!")
|
||||
@ApiModelProperty(value = "播放轮次")
|
||||
private Integer playTimes;
|
||||
@NotNull(message = "播放数量不能为空!")
|
||||
@ApiModelProperty(value = "播放数量")
|
||||
private Integer playNum;
|
||||
@ApiModelProperty(value = "推广范例图片")
|
||||
private AdvertFileVO example;
|
||||
@ApiModelProperty(value = "推广图片尺寸")
|
||||
private String picPixel;
|
||||
@ApiModelProperty(value = "推广图片大小")
|
||||
private String picSize;
|
||||
@ApiModelProperty(value = "推广折扣类型(1现金、2直接打折)")
|
||||
private Integer discountType;
|
||||
@ApiModelProperty(value = "折扣数额(现金:直接输入折扣金额;直接打折:输入折后数值)")
|
||||
private BigDecimal discountAmount;
|
||||
@ApiModelProperty(value = "折扣生效时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm")
|
||||
private Date discountStartTime;
|
||||
@ApiModelProperty(value = "折扣失效时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm")
|
||||
private Date discountEndTime;
|
||||
|
||||
@Data
|
||||
@ApiModel(value = "广告范例图")
|
||||
public static class AdvertFileVO {
|
||||
@NotBlank(message = "文件名称不能为空!")
|
||||
@ApiModelProperty(value = "文件名称", required = true)
|
||||
private String fileName;
|
||||
@NotBlank(message = "文件路径不能为空!")
|
||||
@ApiModelProperty(value = "文件路径", required = true)
|
||||
private String fileUrl;
|
||||
@NotNull(message = "文件大小不能为空!")
|
||||
@ApiModelProperty(value = "文件大小", required = true)
|
||||
private BigDecimal fileSize;
|
||||
@NotNull(message = "文件类型不能为空!")
|
||||
@ApiModelProperty(value = "文件类型", required = true)
|
||||
private Integer typeId;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
package com.ruoyi.web.controller.xkt.vo.advert;
|
||||
|
||||
import com.ruoyi.web.controller.xkt.vo.BasePageVO;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* @author liujiang
|
||||
* @version v1.0
|
||||
* @date 2025/3/27 15:12
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ApiModel("推广营销分页查询入参")
|
||||
@Data
|
||||
public class AdvertPageVO extends BasePageVO {
|
||||
|
||||
@ApiModelProperty(value = "上线状态")
|
||||
@NotNull(message = "上线状态不能为空")
|
||||
private Integer onlineStatus;
|
||||
@ApiModelProperty(value = "推广平台ID")
|
||||
private Integer platformId;
|
||||
@ApiModelProperty(value = "推广类型")
|
||||
private Integer typeId;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,72 @@
|
|||
package com.ruoyi.web.controller.xkt.vo.advert;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author liujiang
|
||||
* @version v1.0
|
||||
* @date 2025/3/27 15:12
|
||||
*/
|
||||
@ApiModel("创建推广营销")
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class AdvertResVO {
|
||||
|
||||
@ApiModelProperty(value = "推广平台ID")
|
||||
private Integer platformId;
|
||||
@ApiModelProperty(value = "推广类型")
|
||||
private Integer typeId;
|
||||
@ApiModelProperty(value = "推广tab")
|
||||
private Integer tabId;
|
||||
@ApiModelProperty(value = "展示类型 1推广图、2商品、3推广图及商品")
|
||||
private Integer displayType;
|
||||
@ApiModelProperty(value = "起拍价格")
|
||||
private BigDecimal startPrice;
|
||||
@ApiModelProperty(value = "播放间隔")
|
||||
private Integer playInterval;
|
||||
@ApiModelProperty(value = "播放轮次")
|
||||
private Integer playTimes;
|
||||
@ApiModelProperty(value = "播放数量")
|
||||
private Integer playNum;
|
||||
@ApiModelProperty(value = "推广状态")
|
||||
private Integer onlineStatus;
|
||||
@ApiModelProperty(value = "推广范例图片")
|
||||
private AdvertFileVO example;
|
||||
@ApiModelProperty(value = "推广图片尺寸")
|
||||
private String picPixel;
|
||||
@ApiModelProperty(value = "推广图片大小")
|
||||
private String picSize;
|
||||
@ApiModelProperty(value = "推广折扣类型(1现金、2直接打折)")
|
||||
private Integer discountType;
|
||||
@ApiModelProperty(value = "折扣数额(现金:直接输入折扣金额;直接打折:输入折后数值)")
|
||||
private BigDecimal discountAmount;
|
||||
@ApiModelProperty(value = "折扣生效时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm")
|
||||
private Date discountStartTime;
|
||||
@ApiModelProperty(value = "折扣失效时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm")
|
||||
private Date discountEndTime;
|
||||
|
||||
@Data
|
||||
@ApiModel(value = "广告范例图")
|
||||
public static class AdvertFileVO {
|
||||
@ApiModelProperty(value = "文件名称", required = true)
|
||||
private String fileName;
|
||||
@ApiModelProperty(value = "文件路径", required = true)
|
||||
private String fileUrl;
|
||||
@ApiModelProperty(value = "文件大小", required = true)
|
||||
private BigDecimal fileSize;
|
||||
@ApiModelProperty(value = "文件类型", required = true)
|
||||
private Integer typeId;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,85 @@
|
|||
package com.ruoyi.web.controller.xkt.vo.advert;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author liujiang
|
||||
* @version v1.0
|
||||
* @date 2025/3/27 15:12
|
||||
*/
|
||||
@ApiModel("编辑推广营销")
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class AdvertUpdateVO {
|
||||
|
||||
@ApiModelProperty(value = "推广ID")
|
||||
@NotNull(message = "推广ID不能为空!")
|
||||
private Long advertId;
|
||||
@NotNull(message = "推广平台ID不能为空!")
|
||||
@ApiModelProperty(value = "推广平台ID")
|
||||
private Integer platformId;
|
||||
@NotNull(message = "推广类型不能为空!")
|
||||
@ApiModelProperty(value = "推广类型")
|
||||
private Integer typeId;
|
||||
@NotNull(message = "推广tab不能为空!")
|
||||
@ApiModelProperty(value = "推广tab")
|
||||
private Integer tabId;
|
||||
@NotNull(message = "展示类型不能为空!")
|
||||
@ApiModelProperty(value = "展示类型 1推广图、2商品、3推广图及商品")
|
||||
private Integer displayType;
|
||||
@NotNull(message = "起拍价格不能为空!")
|
||||
@ApiModelProperty(value = "起拍价格")
|
||||
private BigDecimal startPrice;
|
||||
@NotNull(message = "播放间隔不能为空!")
|
||||
@ApiModelProperty(value = "播放间隔")
|
||||
private Integer playInterval;
|
||||
@NotNull(message = "播放轮次不能为空!")
|
||||
@ApiModelProperty(value = "播放轮次")
|
||||
private Integer playTimes;
|
||||
@NotNull(message = "播放数量不能为空!")
|
||||
@ApiModelProperty(value = "播放数量")
|
||||
private Integer playNum;
|
||||
@ApiModelProperty(value = "推广范例图片")
|
||||
private AdvertFileVO example;
|
||||
@ApiModelProperty(value = "推广图片尺寸")
|
||||
private String picPixel;
|
||||
@ApiModelProperty(value = "推广图片大小")
|
||||
private String picSize;
|
||||
@ApiModelProperty(value = "推广折扣类型(1现金、2直接打折)")
|
||||
private Integer discountType;
|
||||
@ApiModelProperty(value = "折扣数额(现金:直接输入折扣金额;直接打折:输入折后数值)")
|
||||
private BigDecimal discountAmount;
|
||||
@ApiModelProperty(value = "折扣生效时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm")
|
||||
private Date discountStartTime;
|
||||
@ApiModelProperty(value = "折扣失效时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm")
|
||||
private Date discountEndTime;
|
||||
|
||||
@Data
|
||||
@ApiModel(value = "广告范例图")
|
||||
public static class AdvertFileVO {
|
||||
@NotBlank(message = "文件名称不能为空!")
|
||||
@ApiModelProperty(value = "文件名称", required = true)
|
||||
private String fileName;
|
||||
@NotBlank(message = "文件路径不能为空!")
|
||||
@ApiModelProperty(value = "文件路径", required = true)
|
||||
private String fileUrl;
|
||||
@NotNull(message = "文件大小不能为空!")
|
||||
@ApiModelProperty(value = "文件大小", required = true)
|
||||
private BigDecimal fileSize;
|
||||
@NotNull(message = "文件类型不能为空!")
|
||||
@ApiModelProperty(value = "文件类型", required = true)
|
||||
private Integer typeId;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
package com.ruoyi.web.controller.xkt.vo.store;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* @author liujiang
|
||||
* @version v1.0
|
||||
* @date 2025/3/27 15:12
|
||||
*/
|
||||
@ApiModel("创建档口")
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class StoreCreateVO {
|
||||
|
||||
@ApiModelProperty(value = "档口绑定的用户")
|
||||
private Long userId;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,93 @@
|
|||
package com.ruoyi.xkt.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.ruoyi.common.core.domain.XktBaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 广告营销 advert
|
||||
*
|
||||
* @author liujiang
|
||||
* @date 2025-05-03
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
public class Advert extends XktBaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 广告ID
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
/**
|
||||
* 推广平台 电脑端 、APP
|
||||
*/
|
||||
private Integer platformId;
|
||||
/**
|
||||
* 推广类型
|
||||
*/
|
||||
private Integer typeId;
|
||||
/**
|
||||
* 推广tab
|
||||
*/
|
||||
private Integer tabId;
|
||||
/**
|
||||
* 上线状态
|
||||
*/
|
||||
private Integer onlineStatus;
|
||||
/**
|
||||
* 展示类型 推广图、商品、推广图及商品
|
||||
*/
|
||||
private Integer displayType;
|
||||
/**
|
||||
* 起拍价格
|
||||
*/
|
||||
private BigDecimal startPrice;
|
||||
/**
|
||||
* 播放间隔(单位:天)
|
||||
*/
|
||||
private Integer playInterval;
|
||||
/**
|
||||
* 播放轮次
|
||||
*/
|
||||
private Integer playTimes;
|
||||
/**
|
||||
* 播放数量
|
||||
*/
|
||||
private Integer playNum;
|
||||
/**
|
||||
* 推广范例图片ID
|
||||
*/
|
||||
private Long examplePicId;
|
||||
/**
|
||||
* 推广图片尺寸
|
||||
*/
|
||||
private String picPixel;
|
||||
/**
|
||||
* 推广图片大小
|
||||
*/
|
||||
private String picSize;
|
||||
/**
|
||||
* 推广折扣类型(现金、直接打折)
|
||||
*/
|
||||
private Integer discountType;
|
||||
/**
|
||||
* 折扣数额(现金:直接输入折扣金额;直接打折:输入折后数值)
|
||||
*/
|
||||
private BigDecimal discountAmount;
|
||||
/**
|
||||
* 折扣生效时间 yyyy-MM-dd HH:mm:ss
|
||||
*/
|
||||
private Date discountStartTime;
|
||||
/**
|
||||
* 折扣失效时间 yyyy-MM-dd HH:mm:ss
|
||||
*/
|
||||
private Date discountEndTime;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
package com.ruoyi.xkt.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.ruoyi.common.core.domain.XktBaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 档口上传的推广营销文件对象 advert_store_file
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-03-26
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class AdvertStoreFile extends XktBaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 推广营销文件ID
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
/**
|
||||
* 档口ID
|
||||
*/
|
||||
private Long storeId;
|
||||
/**
|
||||
* 系统文件ID
|
||||
*/
|
||||
private Long fileId;
|
||||
/**
|
||||
* 和推广营销中的typeId一致
|
||||
*/
|
||||
private Integer typeId;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,74 @@
|
|||
package com.ruoyi.xkt.dto.advert;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author liujiang
|
||||
* @version v1.0
|
||||
* @date 2025/3/27 15:12
|
||||
*/
|
||||
@ApiModel("创建推广营销")
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class AdvertCreateDTO {
|
||||
|
||||
@ApiModelProperty(value = "档口绑定的用户")
|
||||
private Integer platformId;
|
||||
@ApiModelProperty(value = "推广类型")
|
||||
private Integer typeId;
|
||||
@ApiModelProperty(value = "推广tab")
|
||||
private Integer tabId;
|
||||
@ApiModelProperty(value = "展示类型 1推广图、2商品、3推广图及商品")
|
||||
private Integer displayType;
|
||||
@ApiModelProperty(value = "起拍价格")
|
||||
private BigDecimal startPrice;
|
||||
@ApiModelProperty(value = "播放间隔")
|
||||
private Integer playInterval;
|
||||
@ApiModelProperty(value = "播放轮次")
|
||||
private Integer playTimes;
|
||||
@ApiModelProperty(value = "播放数量")
|
||||
private Integer playNum;
|
||||
@ApiModelProperty(value = "推广范例图片")
|
||||
private AdvertFileDTO example;
|
||||
@ApiModelProperty(value = "推广图片尺寸")
|
||||
private String picPixel;
|
||||
@ApiModelProperty(value = "推广图片大小")
|
||||
private String picSize;
|
||||
@ApiModelProperty(value = "推广折扣类型(1现金、2直接打折)")
|
||||
private Integer discountType;
|
||||
@ApiModelProperty(value = "折扣数额(现金:直接输入折扣金额;直接打折:输入折后数值)")
|
||||
private BigDecimal discountAmount;
|
||||
@ApiModelProperty(value = "折扣生效时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm")
|
||||
private Date discountStartTime;
|
||||
@ApiModelProperty(value = "折扣失效时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm")
|
||||
private Date discountEndTime;
|
||||
|
||||
@Data
|
||||
@ApiModel(value = "广告范例图")
|
||||
public static class AdvertFileDTO {
|
||||
@NotBlank(message = "文件名称不能为空!")
|
||||
@ApiModelProperty(value = "文件名称", required = true)
|
||||
private String fileName;
|
||||
@NotBlank(message = "文件路径不能为空!")
|
||||
@ApiModelProperty(value = "文件路径", required = true)
|
||||
private String fileUrl;
|
||||
@NotNull(message = "文件大小不能为空!")
|
||||
@ApiModelProperty(value = "文件大小", required = true)
|
||||
private BigDecimal fileSize;
|
||||
@NotNull(message = "文件类型不能为空!")
|
||||
@ApiModelProperty(value = "文件类型", required = true)
|
||||
private Integer typeId;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
package com.ruoyi.xkt.dto.advert;
|
||||
|
||||
import com.ruoyi.xkt.dto.BasePageDTO;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* @author liujiang
|
||||
* @version v1.0
|
||||
* @date 2025/3/27 15:12
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ApiModel("推广营销分页查询入参")
|
||||
@Data
|
||||
public class AdvertPageDTO extends BasePageDTO {
|
||||
|
||||
@ApiModelProperty("上线状态")
|
||||
private Integer onlineStatus;
|
||||
@ApiModelProperty(value = "推广平台ID")
|
||||
private Integer platformId;
|
||||
@ApiModelProperty(value = "推广类型")
|
||||
private Integer typeId;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,70 @@
|
|||
package com.ruoyi.xkt.dto.advert;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author liujiang
|
||||
* @version v1.0
|
||||
* @date 2025/3/27 15:12
|
||||
*/
|
||||
@ApiModel("创建推广营销")
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class AdvertResDTO {
|
||||
|
||||
@ApiModelProperty(value = "推广平台ID")
|
||||
private Integer platformId;
|
||||
@ApiModelProperty(value = "推广类型")
|
||||
private Integer typeId;
|
||||
@ApiModelProperty(value = "推广tab")
|
||||
private Integer tabId;
|
||||
@ApiModelProperty(value = "展示类型 1推广图、2商品、3推广图及商品")
|
||||
private Integer displayType;
|
||||
@ApiModelProperty(value = "起拍价格")
|
||||
private BigDecimal startPrice;
|
||||
@ApiModelProperty(value = "播放间隔")
|
||||
private Integer playInterval;
|
||||
@ApiModelProperty(value = "播放轮次")
|
||||
private Integer playTimes;
|
||||
@ApiModelProperty(value = "播放数量")
|
||||
private Integer playNum;
|
||||
@ApiModelProperty(value = "推广状态")
|
||||
private Integer onlineStatus;
|
||||
@ApiModelProperty(value = "推广范例图片")
|
||||
private AdvertFileDTO example;
|
||||
@ApiModelProperty(value = "推广图片尺寸")
|
||||
private String picPixel;
|
||||
@ApiModelProperty(value = "推广图片大小")
|
||||
private String picSize;
|
||||
@ApiModelProperty(value = "推广折扣类型(1现金、2直接打折)")
|
||||
private Integer discountType;
|
||||
@ApiModelProperty(value = "折扣数额(现金:直接输入折扣金额;直接打折:输入折后数值)")
|
||||
private BigDecimal discountAmount;
|
||||
@ApiModelProperty(value = "折扣生效时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm")
|
||||
private Date discountStartTime;
|
||||
@ApiModelProperty(value = "折扣失效时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm")
|
||||
private Date discountEndTime;
|
||||
|
||||
@Data
|
||||
@ApiModel(value = "广告范例图")
|
||||
public static class AdvertFileDTO {
|
||||
@ApiModelProperty(value = "文件名称", required = true)
|
||||
private String fileName;
|
||||
@ApiModelProperty(value = "文件路径", required = true)
|
||||
private String fileUrl;
|
||||
@ApiModelProperty(value = "文件大小", required = true)
|
||||
private BigDecimal fileSize;
|
||||
@ApiModelProperty(value = "文件类型", required = true)
|
||||
private Integer typeId;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,76 @@
|
|||
package com.ruoyi.xkt.dto.advert;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author liujiang
|
||||
* @version v1.0
|
||||
* @date 2025/3/27 15:12
|
||||
*/
|
||||
@ApiModel("编辑推广营销")
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class AdvertUpdateDTO {
|
||||
|
||||
@ApiModelProperty(value = "推广ID")
|
||||
private Long advertId;
|
||||
@ApiModelProperty(value = "推广平台ID")
|
||||
private Integer platformId;
|
||||
@ApiModelProperty(value = "推广类型")
|
||||
private Integer typeId;
|
||||
@ApiModelProperty(value = "推广tab")
|
||||
private Integer tabId;
|
||||
@ApiModelProperty(value = "展示类型 1推广图、2商品、3推广图及商品")
|
||||
private Integer displayType;
|
||||
@ApiModelProperty(value = "起拍价格")
|
||||
private BigDecimal startPrice;
|
||||
@ApiModelProperty(value = "播放间隔")
|
||||
private Integer playInterval;
|
||||
@ApiModelProperty(value = "播放轮次")
|
||||
private Integer playTimes;
|
||||
@ApiModelProperty(value = "播放数量")
|
||||
private Integer playNum;
|
||||
@ApiModelProperty(value = "推广范例图片")
|
||||
private AdvertFileVO example;
|
||||
@ApiModelProperty(value = "推广图片尺寸")
|
||||
private String picPixel;
|
||||
@ApiModelProperty(value = "推广图片大小")
|
||||
private String picSize;
|
||||
@ApiModelProperty(value = "推广折扣类型(1现金、2直接打折)")
|
||||
private Integer discountType;
|
||||
@ApiModelProperty(value = "折扣数额(现金:直接输入折扣金额;直接打折:输入折后数值)")
|
||||
private BigDecimal discountAmount;
|
||||
@ApiModelProperty(value = "折扣生效时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm")
|
||||
private Date discountStartTime;
|
||||
@ApiModelProperty(value = "折扣失效时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm")
|
||||
private Date discountEndTime;
|
||||
|
||||
@Data
|
||||
@ApiModel(value = "广告范例图")
|
||||
public static class AdvertFileVO {
|
||||
@NotBlank(message = "文件名称不能为空!")
|
||||
@ApiModelProperty(value = "文件名称", required = true)
|
||||
private String fileName;
|
||||
@NotBlank(message = "文件路径不能为空!")
|
||||
@ApiModelProperty(value = "文件路径", required = true)
|
||||
private String fileUrl;
|
||||
@NotNull(message = "文件大小不能为空!")
|
||||
@ApiModelProperty(value = "文件大小", required = true)
|
||||
private BigDecimal fileSize;
|
||||
@NotNull(message = "文件类型不能为空!")
|
||||
@ApiModelProperty(value = "文件类型", required = true)
|
||||
private Integer typeId;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
package com.ruoyi.xkt.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 推广营销类型
|
||||
*
|
||||
* @author liujiang
|
||||
* @date 2025-04-02 23:42
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum AdDiscountType {
|
||||
|
||||
// 现金
|
||||
CASH(1, "现金"),
|
||||
// 折扣
|
||||
DISCOUNT(2, "折扣"),
|
||||
|
||||
;
|
||||
|
||||
private final Integer value;
|
||||
private final String label;
|
||||
|
||||
public static AdDiscountType of(Integer value) {
|
||||
for (AdDiscountType e : AdDiscountType.values()) {
|
||||
if (e.getValue().equals(value)) {
|
||||
return e;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
package com.ruoyi.xkt.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 推广营销展示类型
|
||||
*
|
||||
* @author liujiang
|
||||
* @date 2025-04-02 23:42
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum AdDisplayType {
|
||||
|
||||
// 推广图
|
||||
PICTURE(1, "推广图"),
|
||||
// 商品
|
||||
PRODUCT(2, "商品"),
|
||||
// 图和商品
|
||||
PIC_AND_PROD(3, "图和商品"),
|
||||
|
||||
|
||||
;
|
||||
|
||||
private final Integer value;
|
||||
private final String label;
|
||||
|
||||
public static AdDisplayType of(Integer value) {
|
||||
for (AdDisplayType e : AdDisplayType.values()) {
|
||||
if (e.getValue().equals(value)) {
|
||||
return e;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
package com.ruoyi.xkt.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 推广营销类型
|
||||
*
|
||||
* @author liujiang
|
||||
* @date 2025-04-02 23:42
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum AdOnlineStatus {
|
||||
|
||||
// 上线中
|
||||
ONLINE(1, "上线中"),
|
||||
// 已下线
|
||||
OFFLINE(2, "已下线"),
|
||||
|
||||
|
||||
;
|
||||
|
||||
private final Integer value;
|
||||
private final String label;
|
||||
|
||||
public static AdOnlineStatus of(Integer value) {
|
||||
for (AdOnlineStatus e : AdOnlineStatus.values()) {
|
||||
if (e.getValue().equals(value)) {
|
||||
return e;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
package com.ruoyi.xkt.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 推广营销平台类型
|
||||
* @author liujiang
|
||||
* @date 2025-04-02 23:42
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum AdPlatformType {
|
||||
|
||||
PC(1, "电脑端"),
|
||||
APP(2, "APP"),
|
||||
|
||||
;
|
||||
|
||||
private final Integer value;
|
||||
private final String label;
|
||||
|
||||
public static AdPlatformType of(Integer value) {
|
||||
for (AdPlatformType e : AdPlatformType.values()) {
|
||||
if (e.getValue().equals(value)) {
|
||||
return e;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
package com.ruoyi.xkt.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 推广营销类型
|
||||
* @author liujiang
|
||||
* @date 2025-04-02 23:42
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum AdTab {
|
||||
|
||||
// 首页
|
||||
HOME(1, "首页"),
|
||||
// 新品馆
|
||||
NEW_PROD(2, "新品馆"),
|
||||
// 以图搜款
|
||||
PIC_SEARCH(3, "以图搜款"),
|
||||
// 搜索结果
|
||||
SEARCH_RESULT(4, "搜索结果"),
|
||||
// 用户中心
|
||||
USER_CENTER(5, "用户中心"),
|
||||
// 下载页
|
||||
DOWNLOAD(6, "下载页"),
|
||||
// 分类页
|
||||
CATEGORY(7, "分类页"),
|
||||
|
||||
;
|
||||
|
||||
private final Integer value;
|
||||
private final String label;
|
||||
|
||||
public static AdTab of(Integer value) {
|
||||
for (AdTab e : AdTab.values()) {
|
||||
if (e.getValue().equals(value)) {
|
||||
return e;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,106 @@
|
|||
package com.ruoyi.xkt.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 推广营销类型
|
||||
* @author liujiang
|
||||
* @date 2025-04-02 23:42
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum AdType {
|
||||
|
||||
// 顶部横向大图
|
||||
PC_HOME_TOP_LEFT_BANNER(1, "顶部横向大图"),
|
||||
// 顶部纵向小图
|
||||
PC_HOME_TOP_RIGHT_BANNER(2, "顶部纵向小图"),
|
||||
// 人气榜左侧大图
|
||||
PC_HOME_POP_LEFT_BANNER(3, "人气榜左大图"),
|
||||
// 人气榜中上侧
|
||||
PC_HOME_POP_MID_TOP(4, "人气榜中上侧"),
|
||||
// 人气榜中下侧
|
||||
PC_HOME_POP_MID_BOTTOM(5, "人气榜中下侧"),
|
||||
// 人气榜右上侧
|
||||
PC_HOME_POP_RIGHT_TOP(6, "人气榜右上侧"),
|
||||
// 人气榜右下侧
|
||||
PC_HOME_POP_RIGHT_BOTTOM(7, "人气榜右下侧"),
|
||||
// 首页档口横幅
|
||||
PC_HOME_SINGLE_BANNER(8, "首页档口横幅"),
|
||||
// 首页商品列表
|
||||
PC_HOME_PRODUCT_LIST(9, "首页商品列表"),
|
||||
// 首页两侧固定挂耳
|
||||
PC_HOME_FIXED_EAR(10, "首页两侧固定挂耳"),
|
||||
// 首页搜索框下名称
|
||||
PC_HOME_SEARCH_DOWN_NAME(11, "首页搜索框下名称"),
|
||||
// 首页搜索框商品
|
||||
PC_HOME_SEARCH_PRODUCT(12, "首页搜索框商品"),
|
||||
// 首页搜索框档口
|
||||
PC_HOME_SEARCH_STORE(13, "首页搜索框档口"),
|
||||
// 首页以图搜款商品
|
||||
PC_HOME_PIC_SEARCH_PRODUCT(14, "首页以图搜款商品"),
|
||||
|
||||
|
||||
// 新品馆顶部横向大图
|
||||
PC_NEW_PROD_TOP_LEFT_BANNER(30, "新品馆顶部横向大图"),
|
||||
// 新品馆顶部纵向大图
|
||||
PC_NEW_PROD_TOP_RIGHT(31, "新品馆顶部纵向大图"),
|
||||
// 新品馆品牌榜
|
||||
PC_NEW_PROD_BRAND_BANNER(32, "新品馆品牌榜"),
|
||||
// 新品馆热卖榜左大图
|
||||
PC_NEW_PROD_HOT_LEFT_BANNER(33, "新品馆热卖榜左大图"),
|
||||
// 新品馆热卖榜右推广商品
|
||||
PC_NEW_PROD_HOT_RIGHT_PRODUCT(34, "新品馆热卖榜右推广商品"),
|
||||
// 新品馆横幅
|
||||
PC_NEW_PROD_SINGLE_BANNER(35, "新品馆横幅"),
|
||||
// 新品馆商品列表
|
||||
PC_NEW_PROD_PRODUCT_LIST(36, "新品馆商品列表"),
|
||||
|
||||
// PC搜索结果
|
||||
PC_SEARCH_RESULT(40, "PC搜索结果"),
|
||||
// PC用户中心
|
||||
PC_USER_CENTER(41, "PC用户中心"),
|
||||
// PC下载页
|
||||
PC_DOWNLOAD(42, "PC下载页"),
|
||||
|
||||
|
||||
// APP首页顶部轮播图
|
||||
APP_HOME_TOP_BANNER(50, "APP首页顶部轮播图"),
|
||||
// APP首页推荐商品区
|
||||
APP_HOME_RECOMMEND_PRODUCT(51, "APP首页推荐商品区"),
|
||||
// APP首页热卖推荐
|
||||
APP_HOME_HOT_RECOMMEND(52, "APP首页热卖推荐"),
|
||||
// APP首页人气榜
|
||||
APP_HOME_POP_RECOMMEND(53, "APP首页人气榜"),
|
||||
// APP首页新品榜
|
||||
APP_HOME_NEW_PROD_RECOMMEND(54, "APP首页新品榜"),
|
||||
// APP搜索结果
|
||||
APP_SEARCH_RESULT(55, "APP搜索结果"),
|
||||
|
||||
|
||||
// APP分类页轮播图
|
||||
APP_CATEGORY_TOP_BANNER(70, "APP分类页轮播图"),
|
||||
// APP个人中心猜你喜欢
|
||||
APP_USER_CENTER_GUESS_YOU_LIKE(71, "APP个人中心猜你喜欢"),
|
||||
|
||||
|
||||
// 以图搜款结果推广商品
|
||||
PIC_SEARCH_RESULT_PRODUCT(80, "以图搜款结果推广商品"),
|
||||
|
||||
|
||||
|
||||
;
|
||||
|
||||
private final Integer value;
|
||||
private final String label;
|
||||
|
||||
public static AdType of(Integer value) {
|
||||
for (AdType e : AdType.values()) {
|
||||
if (e.getValue().equals(value)) {
|
||||
return e;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
package com.ruoyi.xkt.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.ruoyi.xkt.domain.Advert;
|
||||
import com.ruoyi.xkt.dto.advert.AdvertPageDTO;
|
||||
import com.ruoyi.xkt.dto.advert.AdvertResDTO;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 推广营销Mapper接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-03-26
|
||||
*/
|
||||
@Repository
|
||||
public interface AdvertMapper extends BaseMapper<Advert> {
|
||||
|
||||
/**
|
||||
* 查询推广营销分页列表
|
||||
* @param pageDTO 查询入参
|
||||
* @return
|
||||
*/
|
||||
// List<AdvertResDTO> selectAdvertPage(AdvertPageDTO pageDTO);
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
package com.ruoyi.xkt.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.ruoyi.xkt.domain.AdvertStoreFile;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/**
|
||||
* 推广营销Mapper接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-03-26
|
||||
*/
|
||||
@Repository
|
||||
public interface AdvertStoreFileMapper extends BaseMapper<AdvertStoreFile> {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,57 @@
|
|||
package com.ruoyi.xkt.service;
|
||||
|
||||
import com.ruoyi.common.core.page.Page;
|
||||
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;
|
||||
|
||||
/**
|
||||
* 推广营销Service接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-03-26
|
||||
*/
|
||||
public interface IAdvertService {
|
||||
|
||||
/**
|
||||
* 新增推广营销
|
||||
*
|
||||
* @param createDTO
|
||||
* @return
|
||||
*/
|
||||
Integer create(AdvertCreateDTO createDTO);
|
||||
|
||||
/**
|
||||
* 获取推广营销详情
|
||||
*
|
||||
* @param advertId 推广营销ID
|
||||
* @return AdvertResDTO
|
||||
*/
|
||||
AdvertResDTO getInfo(Long advertId);
|
||||
|
||||
/**
|
||||
* 推广营销分页
|
||||
*
|
||||
* @param pageDTO 分页查询入参
|
||||
* @return Page<AdvertResDTO>
|
||||
*/
|
||||
Page<AdvertResDTO> page(AdvertPageDTO pageDTO);
|
||||
|
||||
/**
|
||||
* 更新推广营销
|
||||
*
|
||||
* @param updateDTO 更新推广营销入参
|
||||
* @return Integer
|
||||
*/
|
||||
Integer updateAdvert(AdvertUpdateDTO updateDTO);
|
||||
|
||||
/**
|
||||
* 下线推广营销
|
||||
*
|
||||
* @param advertId 推广营销ID
|
||||
* @return Integer
|
||||
*/
|
||||
Integer offline(Long advertId);
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,191 @@
|
|||
package com.ruoyi.xkt.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.ruoyi.common.constant.Constants;
|
||||
import com.ruoyi.common.constant.HttpStatus;
|
||||
import com.ruoyi.common.core.domain.model.LoginUser;
|
||||
import com.ruoyi.common.core.page.Page;
|
||||
import com.ruoyi.common.exception.ServiceException;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import com.ruoyi.xkt.domain.Advert;
|
||||
import com.ruoyi.xkt.domain.SysFile;
|
||||
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.storeCustomer.StoreCusPageResDTO;
|
||||
import com.ruoyi.xkt.enums.AdOnlineStatus;
|
||||
import com.ruoyi.xkt.mapper.AdvertMapper;
|
||||
import com.ruoyi.xkt.mapper.SysFileMapper;
|
||||
import com.ruoyi.xkt.service.IAdvertService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* 推广营销Service业务层处理
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-03-26
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class AdvertServiceImpl implements IAdvertService {
|
||||
|
||||
final AdvertMapper advertMapper;
|
||||
final SysFileMapper fileMapper;
|
||||
|
||||
/**
|
||||
* 新增推广营销
|
||||
*
|
||||
* @param createDTO 新增推广营销入参
|
||||
* @return Integer
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public Integer create(AdvertCreateDTO createDTO) {
|
||||
|
||||
// TODO 判断当前是否超级管理员在操作
|
||||
// TODO 判断当前是否超级管理员在操作
|
||||
// TODO 判断当前是否超级管理员在操作
|
||||
this.isSuperAdmin();
|
||||
|
||||
// 将文件插入到SysFile表中
|
||||
SysFile file = BeanUtil.toBean(createDTO.getExample(), SysFile.class);
|
||||
this.fileMapper.insert(file);
|
||||
Advert advert = BeanUtil.toBean(createDTO, Advert.class);
|
||||
advert.setOnlineStatus(AdOnlineStatus.ONLINE.getValue());
|
||||
advert.setExamplePicId(file.getId());
|
||||
return this.advertMapper.insert(advert);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取推广营销详情
|
||||
*
|
||||
* @param advertId 推广营销ID
|
||||
* @return AdvertResDTO
|
||||
*/
|
||||
@Override
|
||||
@Transactional(readOnly = true)
|
||||
public AdvertResDTO getInfo(Long advertId) {
|
||||
|
||||
// TODO 判断当前是否超级管理员在操作
|
||||
// TODO 判断当前是否超级管理员在操作
|
||||
// TODO 判断当前是否超级管理员在操作
|
||||
this.isSuperAdmin();
|
||||
|
||||
Advert advert = Optional.ofNullable(this.advertMapper.selectOne(new LambdaQueryWrapper<Advert>()
|
||||
.eq(Advert::getId, advertId).eq(Advert::getDelFlag, Constants.UNDELETED)))
|
||||
.orElseThrow(() -> new ServiceException("推广营销不存在!", HttpStatus.ERROR));
|
||||
AdvertResDTO resDTO = BeanUtil.toBean(advert, AdvertResDTO.class);
|
||||
// 找到范例图片
|
||||
if (ObjectUtils.isNotEmpty(advert.getExamplePicId())) {
|
||||
SysFile file = Optional.ofNullable(this.fileMapper.selectById(advert.getExamplePicId()))
|
||||
.orElseThrow(() -> new ServiceException("推广营销范例图片不存在!", HttpStatus.ERROR));
|
||||
resDTO.setExample(BeanUtil.toBean(file, AdvertResDTO.AdvertFileDTO.class).setTypeId(advert.getTypeId()));
|
||||
}
|
||||
return resDTO;
|
||||
}
|
||||
|
||||
/**
|
||||
* 推广营销分页
|
||||
*
|
||||
* @param pageDTO 分页查询入参
|
||||
* @return Page<AdvertResDTO>
|
||||
*/
|
||||
@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());
|
||||
if (ObjectUtils.isNotEmpty(pageDTO.getPlatformId())) {
|
||||
queryWrapper.eq(Advert::getPlatformId, pageDTO.getPlatformId());
|
||||
}
|
||||
if (ObjectUtils.isNotEmpty(pageDTO.getTypeId())) {
|
||||
queryWrapper.eq(Advert::getTypeId, pageDTO.getTypeId());
|
||||
}
|
||||
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));
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新推广营销
|
||||
*
|
||||
* @param updateDTO 更新推广营销入参
|
||||
* @return Integer
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public Integer updateAdvert(AdvertUpdateDTO updateDTO) {
|
||||
|
||||
// TODO 判断当前是否超级管理员在操作
|
||||
// TODO 判断当前是否超级管理员在操作
|
||||
// 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());
|
||||
return this.advertMapper.updateById(advert);
|
||||
}
|
||||
|
||||
/**
|
||||
* 下线推广营销
|
||||
*
|
||||
* @param advertId 推广营销ID
|
||||
* @return Integer
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public Integer offline(Long advertId) {
|
||||
|
||||
|
||||
// TODO 判断当前是否超级管理员在操作
|
||||
// TODO 判断当前是否超级管理员在操作
|
||||
// TODO 判断当前是否超级管理员在操作
|
||||
this.isSuperAdmin();
|
||||
|
||||
Advert advert = Optional.ofNullable(this.advertMapper.selectOne(new LambdaQueryWrapper<Advert>()
|
||||
.eq(Advert::getId, advertId).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);
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验当前是否是超级管理员操作
|
||||
*/
|
||||
private void isSuperAdmin() {
|
||||
// 获取当前登录用户
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (ObjectUtils.isEmpty(loginUser)) {
|
||||
throw new ServiceException("当前用户不存在!", HttpStatus.ERROR);
|
||||
}
|
||||
if (!SecurityUtils.isAdmin(loginUser.getUserId())) {
|
||||
throw new ServiceException("当前用户不是超级管理员,不可操作!", HttpStatus.ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
<?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="com.ruoyi.xkt.mapper.AdvertMapper">
|
||||
|
||||
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue