master:推广营销功能进一步完善;

pull/1121/head
liujiang 2025-05-12 16:03:46 +08:00
parent 7a2c291bfb
commit fb8f3226b5
34 changed files with 885 additions and 107 deletions

View File

@ -92,5 +92,14 @@ public class AdvertController extends XktBaseController {
return R.ok(BeanUtil.copyToList(advertService.getPlatformList(), AdvertPlatformResVO.class));
}
/**
* 广
*/
@ApiOperation(value = "获取推广位示例图", httpMethod = "GET", response = R.class)
@GetMapping(value = "/demo/{advertType}")
public R<String> getDemoPic(@PathVariable Integer advertType) {
return R.ok(advertService.getDemoPic(advertType));
}
}

View File

@ -4,10 +4,12 @@ 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.advertRound.AdRoundStoreCreateVO;
import com.ruoyi.web.controller.xkt.vo.advertRound.AdRoundStoreResVO;
import com.ruoyi.web.controller.xkt.vo.advertRound.*;
import com.ruoyi.xkt.dto.advertRound.AdRoundStoreCreateDTO;
import com.ruoyi.xkt.dto.advertRound.AdvertRoundStorePageDTO;
import com.ruoyi.xkt.dto.advertRound.AdvertRoundStorePageResDTO;
import com.ruoyi.xkt.service.IAdvertRoundService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@ -15,7 +17,8 @@ import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.text.ParseException;
import javax.validation.Valid;
import java.util.List;
/**
* 广Controller
@ -41,34 +44,59 @@ public class AdvertRoundController extends XktBaseController {
return R.ok(advertRoundService.create(BeanUtil.toBean(createVO, AdRoundStoreCreateDTO.class)));
}
/**
* 广ID广广
* 广 "已订购推广位"
*/
@ApiOperation(value = "根据广告ID获取推广轮次列表并返回当前档口在这些推广轮次的数据", httpMethod = "GET", response = R.class)
@ApiOperation(value = "获取推广位数据及右侧 已订购推广位 列表", httpMethod = "GET", response = R.class)
@GetMapping(value = "/{advertId}/{storeId}/{showType}")
public R<AdRoundStoreResVO> getStoreAdInfo(@PathVariable("advertId") Long advertId, @PathVariable("storeId") Long storeId, @PathVariable("showType") Integer showType) {
return R.ok(BeanUtil.toBean(advertRoundService.getStoreAdInfo(storeId, advertId, showType), AdRoundStoreResVO.class));
}
@GetMapping("/test")
public void test() throws ParseException {
advertRoundService.saveAdvertDeadlineToRedis();
/**
* 广广
*/
@ApiOperation(value = "位置枚举类型的推广位,获取推广商品", httpMethod = "GET", response = R.class)
@GetMapping(value = "/{advertRoundId}")
public R<List<AdRoundSetProdResVO>> getSetProdInfo(@PathVariable("advertRoundId") Long advertRoundId) {
return R.ok(BeanUtil.copyToList(advertRoundService.getSetProdInfo(advertRoundId), AdRoundSetProdResVO.class));
}
/**
* 广
*/
@ApiOperation(value = "获取档口已购推广列表", httpMethod = "POST", response = R.class)
@PostMapping("/page")
public R<Page<AdvertRoundStorePageResDTO>> page(@Valid @RequestBody AdvertRoundStorePageVO pageVO) {
return R.ok(advertRoundService.page(BeanUtil.toBean(pageVO, AdvertRoundStorePageDTO.class)));
}
/**
* 广广
*/
@ApiOperation(value = "查看当前广告位推广图", httpMethod = "GET", response = R.class)
@GetMapping(value = "/pic/{storeId}/{advertRoundId}")
public R<AdRoundStoreSetResVO> getAdvertStoreSetInfo(@PathVariable("storeId") Long storeId, @PathVariable("advertRoundId") Long advertRoundId) {
return R.ok(BeanUtil.toBean(advertRoundService.getAdvertStoreSetInfo(storeId, advertRoundId), AdRoundStoreSetResVO.class));
}
// TODO 退订
// TODO 获取最受欢迎推广位8个固定不动了
// TODO 获取最受欢迎推广位8个固定不动了
/**
* 退
*/
@ApiOperation(value = "退订", httpMethod = "POST", response = R.class)
@Log(title = "退订", businessType = BusinessType.UPDATE)
@PutMapping("/unsubscribe/{storeId}/{advertRoundId}")
public R<Integer> unsubscribe(@PathVariable("storeId") Long storeId, @PathVariable("advertRoundId") Long advertRoundId) {
return R.ok(advertRoundService.unsubscribe(storeId, advertRoundId));
}
/**
* 8广
*/
@ApiOperation(value = "取最受欢迎的8个推广位", httpMethod = "GET", response = R.class)
@GetMapping(value = "/populars")
public R<List<AdRoundPopularResVO>> getMostPopulars() {
return R.ok(BeanUtil.copyToList(advertRoundService.getMostPopulars(), AdRoundPopularResVO.class));
}
}

View File

@ -1,11 +1,13 @@
package com.ruoyi.web.controller.xkt;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.IdUtil;
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.framework.oss.OSSClientWrapper;
import com.ruoyi.web.controller.xkt.vo.store.*;
import com.ruoyi.xkt.dto.store.*;
import com.ruoyi.xkt.service.IStoreService;
@ -15,6 +17,9 @@ import lombok.RequiredArgsConstructor;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
/**
* Controller
@ -113,4 +118,35 @@ public class StoreController extends XktBaseController {
}
final OSSClientWrapper ossClient;
@GetMapping("/getKey")
public R getKey() {
return R.ok(ossClient.createStsCredentials());
}
@PostMapping("/upload")
public void test(@RequestParam("file") MultipartFile file) throws Exception {
final String uuid = IdUtil.randomUUID();
ossClient.upload(uuid + ".png", file.getInputStream());
}
@GetMapping("/getUrl/{key}/{expireTime}")
public R getUrl(@PathVariable("key") String key, @PathVariable("expireTime") Long expireTime) throws Exception {
return R.ok(ossClient.generateUrl(key, expireTime));
}
@GetMapping("/download/{key}")
public void download(@PathVariable("key") String key) throws Exception {
String name = "C:\\Users\\56980\\Desktop\\test.png";
ossClient.download(key, name);
}
}

View File

@ -0,0 +1,39 @@
package com.ruoyi.web.controller.xkt.vo.advertRound;
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("最受欢迎的8个推广位")
@Data
@Accessors(chain = true)
public class AdRoundPopularResVO {
@ApiModelProperty(value = "广告ID")
private Long advertId;
@ApiModelProperty(value = "广告类型ID")
private Long typeId;
@ApiModelProperty(value = "广告类型名称")
private String typeName;
@ApiModelProperty(value = "推广展示类型")
private Integer showType;
@ApiModelProperty(value = "投放开始时间")
@JsonFormat(pattern = "MM月dd日", timezone = "GMT+8")
private Date startTime;
@ApiModelProperty(value = "投放结束时间")
@JsonFormat(pattern = "MM月dd日", timezone = "GMT+8")
private Date endTime;
@ApiModelProperty(value = "起拍价格")
private BigDecimal startPrice;
}

View File

@ -0,0 +1,23 @@
package com.ruoyi.web.controller.xkt.vo.advertRound;
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 AdRoundSetProdResVO {
@ApiModelProperty(value = "档口商品ID")
private Long storeProdId;
@ApiModelProperty(value = "商品货号")
private String prodArtNum;
}

View File

@ -45,5 +45,8 @@ public class AdRoundStoreCreateVO {
@NotBlank(message = "对象锁符号不能为空!")
@ApiModelProperty(value = "对象锁符号")
private String symbol;
@NotBlank(message = "交易密码不能为空!")
@ApiModelProperty(value = "交易密码")
private String transactionPassword;
}

View File

@ -0,0 +1,37 @@
package com.ruoyi.web.controller.xkt.vo.advertRound;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import java.util.List;
/**
* @author liujiang
* @version v1.0
* @date 2025/3/27 15:12
*/
@ApiModel("当前位置枚举类型设置的推广图")
@Data
@Accessors(chain = true)
public class AdRoundStoreSetResVO {
@ApiModelProperty(value = "推广轮次ID")
private Long advertRoundId;
@ApiModelProperty(value = "档口的推广图")
private String fileUrl;
@ApiModelProperty(value = "档口设置的商品")
private List<ARSSProdVO> prodList;
@Data
@ApiModel(value = "档口设置的商品")
@Accessors(chain = true)
public static class ARSSProdVO {
@ApiModelProperty("档口商品ID")
private Long storeProdId;
@ApiModelProperty(value = "商品货号")
private String prodArtNum;
}
}

View File

@ -0,0 +1,42 @@
package com.ruoyi.web.controller.xkt.vo.advertRound;
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;
import java.util.Date;
/**
* @author liujiang
* @version v1.0
* @date 2025/3/27 15:12
*/
@EqualsAndHashCode(callSuper = true)
@ApiModel("档口已购推广列表入参")
@Data
public class AdvertRoundStorePageVO extends BasePageVO {
@NotNull(message = "storeId不能为空")
@ApiModelProperty(value = "档口ID")
private Long storeId;
@ApiModelProperty(value = "推广类型")
private Integer typeId;
@ApiModelProperty(value = "投放状态")
private Integer launchStatus;
@ApiModelProperty(value = "竞价状态 只查看 已出价 或 竞价成功的状态")
private Integer biddingStatus;
@ApiModelProperty(value = "图片是否设置 1 未设置 2已设置")
private Integer picSetType;
@ApiModelProperty(value = "图片设计 1自主设计、2平台设计")
private Integer picDesignType;
@ApiModelProperty(value = "图片审核状态 1 待审核 2 审核通过 3 审核驳回")
private Integer picAuditStatus;
@ApiModelProperty(value = "投放开始时间")
private Date startTime;
@ApiModelProperty(value = "投放结束时间")
private Date endTime;
}

View File

@ -230,22 +230,8 @@ public class Constants
public static final String STORE_REDIS_PREFIX = "store_";
/**
* 广
* 8广
*/
/* public final static List<Integer> posEnumTypeList = new ArrayList<Integer>() {{
// 人气榜中上侧
add(AdType.PC_HOME_POP_MID_TOP.getValue());
// 人气榜中下侧
add(AdType.PC_HOME_POP_MID_BOTTOM.getValue());
// 人气榜右上侧
add(AdType.PC_HOME_POP_RIGHT_TOP.getValue());
// 人气榜右下侧
add(AdType.PC_HOME_POP_RIGHT_BOTTOM.getValue());
// 新品馆热卖榜右推广商品
add(AdType.PC_NEW_PROD_HOT_RIGHT_PRODUCT.getValue());
// PC下载页
add(AdType.PC_DOWNLOAD.getValue());
}};*/
public static final String ADVERT_POPULAR = "popular";
}

View File

@ -56,11 +56,11 @@ public enum AdType {
PC_NEW_PROD_PRODUCT_LIST(36, "新品馆商品列表", "/url"),
// PC搜索结果
PC_SEARCH_RESULT(40, "PC搜索结果", "/url"),
PC_SEARCH_RESULT(40, "电脑端搜索结果", "/url"),
// PC用户中心
PC_USER_CENTER(41, "PC用户中心", "/url"),
PC_USER_CENTER(41, "电脑端用户中心", "/url"),
// PC下载页
PC_DOWNLOAD(42, "PC下载页", "/url"),
PC_DOWNLOAD(42, "电脑端下载页", "/url"),
// APP首页顶部轮播图

View File

@ -334,7 +334,7 @@ public class XktTask {
// 当前播放轮次id
final int roundId = i + 1;
updateList.add(new AdvertRound().setAdvertId(advert.getId()).setTypeId(advert.getTypeId()).setRoundId(roundId).setLaunchStatus(launchStatus).setShowType(advert.getShowType())
.setStartTime(java.sql.Date.valueOf(now)).setEndTime(java.sql.Date.valueOf(endDate)).setPosition(position).setStartPrice(advert.getStartPrice())
.setStartTime(java.sql.Date.valueOf(now)).setEndTime(java.sql.Date.valueOf(endDate)).setPosition(position).setStartPrice(advert.getStartPrice()).setSysIntercept(0)
.setSymbol(Objects.equals(advert.getShowType(), AdShowType.POSITION_ENUM.getValue())
// 如果是位置枚举的推广位则需要精确到某一个position的推广位反之若是时间范围则直接精确到播放轮次即可
? advert.getBasicSymbol() + roundId + position : advert.getBasicSymbol() + roundId));
@ -381,7 +381,7 @@ public class XktTask {
final String position = String.valueOf((char) ('A' + j));
// 生成最新的下一轮推广位
updateList.add(new AdvertRound().setAdvertId(advert.getId()).setTypeId(advert.getTypeId()).setRoundId(maxRoundId).setShowType(advert.getShowType())
.setLaunchStatus(AdLaunchStatus.UN_LAUNCH.getValue()).setPosition(position).setStartPrice(advert.getStartPrice())
.setLaunchStatus(AdLaunchStatus.UN_LAUNCH.getValue()).setPosition(position).setStartPrice(advert.getStartPrice()).setSysIntercept(0)
// java.sql.Date 直接转化成yyyy-MM-dd格式
.setStartTime(java.sql.Date.valueOf(startDate)).setEndTime(java.sql.Date.valueOf(endDate))
.setSymbol(Objects.equals(advert.getShowType(), AdShowType.POSITION_ENUM.getValue())

View File

@ -28,9 +28,13 @@ public class AdvertRound extends XktBaseEntity {
@TableId
private Long id;
/**
* 广
* 广
*/
private Integer showType;
/**
* 广广
*/
private Integer displayType;
/**
*
*/
@ -88,13 +92,13 @@ public class AdvertRound extends XktBaseEntity {
*/
private Integer biddingTempStatus;
/**
*
* 1 2 3
*/
private Integer picAuditStatus;
/**
* 0 1
*/
private Integer picSet;
private Integer picSetType;
/**
* 广ID sysFile.id
*/
@ -108,7 +112,7 @@ public class AdvertRound extends XktBaseEntity {
*/
private Integer picDesignType;
/**
*
* 0 1
*/
private Integer sysIntercept;

View File

@ -0,0 +1,36 @@
package com.ruoyi.xkt.dto.advertRound;
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("最受欢迎的8个推广位")
@Data
@Accessors(chain = true)
public class AdRoundPopularResDTO {
@ApiModelProperty(value = "广告ID")
private Long advertId;
@ApiModelProperty(value = "广告类型ID")
private Integer typeId;
@ApiModelProperty(value = "广告类型名称")
private String typeName;
@ApiModelProperty(value = "推广展示类型")
private Integer showType;
@ApiModelProperty(value = "投放开始时间")
private Date startTime;
@ApiModelProperty(value = "投放结束时间")
private Date endTime;
@ApiModelProperty(value = "起拍价格")
private BigDecimal startPrice;
}

View File

@ -0,0 +1,23 @@
package com.ruoyi.xkt.dto.advertRound;
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 AdRoundSetPicResDTO {
@ApiModelProperty(value = "推广轮次ID")
private Long advertRoundId;
@ApiModelProperty(value = "文件路径")
private String fileUrl;
}

View File

@ -0,0 +1,23 @@
package com.ruoyi.xkt.dto.advertRound;
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 AdRoundSetProdResDTO {
@ApiModelProperty(value = "档口商品ID")
private Long storeProdId;
@ApiModelProperty(value = "商品货号")
private String prodArtNum;
}

View File

@ -37,5 +37,7 @@ public class AdRoundStoreCreateDTO {
private String prodIdStr;
@ApiModelProperty(value = "对象锁符号")
private String symbol;
@ApiModelProperty(value = "交易密码")
private String transactionPassword;
}

View File

@ -0,0 +1,37 @@
package com.ruoyi.xkt.dto.advertRound;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import java.util.List;
/**
* @author liujiang
* @version v1.0
* @date 2025/3/27 15:12
*/
@ApiModel("当前位置枚举类型设置的推广图")
@Data
@Accessors(chain = true)
public class AdRoundStoreSetResDTO {
@ApiModelProperty(value = "推广轮次ID")
private Long advertRoundId;
@ApiModelProperty(value = "档口的推广图")
private String fileUrl;
@ApiModelProperty(value = "档口设置的商品")
private List<ARSSProdDTO> prodList;
@Data
@ApiModel(value = "档口设置的商品")
@Accessors(chain = true)
public static class ARSSProdDTO {
@ApiModelProperty("档口商品ID")
private Long storeProdId;
@ApiModelProperty(value = "商品货号")
private String prodArtNum;
}
}

View File

@ -0,0 +1,40 @@
package com.ruoyi.xkt.dto.advertRound;
import com.ruoyi.xkt.dto.BasePageDTO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* @author liujiang
* @version v1.0
* @date 2025/3/27 15:12
*/
@EqualsAndHashCode(callSuper = true)
@ApiModel("档口已购推广列表入参")
@Data
public class AdvertRoundStorePageDTO extends BasePageDTO {
@ApiModelProperty(value = "档口ID")
private Long storeId;
@ApiModelProperty(value = "推广类型")
private Integer typeId;
@ApiModelProperty(value = "投放状态")
private Integer launchStatus;
@ApiModelProperty(value = "竞价状态 只查看 已出价 或 竞价成功的状态")
private Integer biddingStatus;
@ApiModelProperty(value = "图片是否设置 1 未设置 2已设置")
private Integer picSetType;
@ApiModelProperty(value = "图片设计 1自主设计、2平台设计")
private Integer picDesignType;
@ApiModelProperty(value = "图片审核状态 1 待审核 2 审核通过 3 审核驳回")
private Integer picAuditStatus;
@ApiModelProperty(value = "投放开始时间")
private Date startTime;
@ApiModelProperty(value = "投放结束时间")
private Date endTime;
}

View File

@ -0,0 +1,55 @@
package com.ruoyi.xkt.dto.advertRound;
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 AdvertRoundStorePageResDTO {
@ApiModelProperty(value = "投放平台")
private Integer platformId;
@ApiModelProperty(value = "投放平台")
private String platformName;
@ApiModelProperty(value = "投放类型")
private Integer typeId;
@ApiModelProperty(value = "投放类型")
private String typeName;
@ApiModelProperty(value = "投放位置")
private String position;
@ApiModelProperty(value = "投放开始时间")
private String startTime;
@ApiModelProperty(value = "投放结束时间")
private String endTime;
@ApiModelProperty(value = "出价")
private String payPrice;
@ApiModelProperty(value = "投放状态")
private Integer launchStatus;
@ApiModelProperty(value = "投放状态")
private String launchStatusName;
@ApiModelProperty(value = "竞价状态")
private Integer biddingStatus;
@ApiModelProperty(value = "竞价状态")
private String biddingStatusName;
@ApiModelProperty(value = "图片设计类型")
private Integer picDesignType;
@ApiModelProperty(value = "竞价状态")
private String picDesignTypeName;
@ApiModelProperty(value = "图片是否设置")
private Integer picSetType;
@ApiModelProperty(value = "图片是否设置")
private String picSetTypeName;
@ApiModelProperty(value = "图片审核状态")
private Integer picAuditStatus;
@ApiModelProperty(value = "图片审核状态")
private String picAuditStatusName;
}

View File

@ -1,5 +1,7 @@
package com.ruoyi.xkt.enums;
import com.ruoyi.common.constant.HttpStatus;
import com.ruoyi.common.exception.ServiceException;
import lombok.AllArgsConstructor;
import lombok.Getter;
@ -30,6 +32,6 @@ public enum AdBiddingStatus {
return e;
}
}
return null;
throw new ServiceException("营销推广竞价状态不存在!", HttpStatus.ERROR);
}
}

View File

@ -0,0 +1,37 @@
package com.ruoyi.xkt.enums;
import com.ruoyi.common.constant.HttpStatus;
import com.ruoyi.common.exception.ServiceException;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* 广
*
* @author liujiang
* @date 2025-04-02 23:42
*/
@Getter
@AllArgsConstructor
public enum AdPicSetType {
// 未设置
UN_SET(1, "未设置"),
// 已设置
SET(2, "已设置"),
;
private final Integer value;
private final String label;
public static AdPicSetType of(Integer value) {
for (AdPicSetType e : AdPicSetType.values()) {
if (e.getValue().equals(value)) {
return e;
}
}
throw new ServiceException("营销推广图片是否设置不存在!", HttpStatus.ERROR);
}
}

View File

@ -32,6 +32,6 @@ public enum AdShowType {
return e;
}
}
throw new ServiceException("营销推广播放轮次不存在!", HttpStatus.ERROR);
throw new ServiceException("营销推广展示类型不存在!", HttpStatus.ERROR);
}
}

View File

@ -1,5 +1,7 @@
package com.ruoyi.xkt.enums;
import com.ruoyi.common.constant.HttpStatus;
import com.ruoyi.common.exception.ServiceException;
import lombok.AllArgsConstructor;
import lombok.Getter;
@ -36,6 +38,6 @@ public enum ProdTagType {
return e;
}
}
return null;
throw new ServiceException("档口标签类型不存在!", HttpStatus.ERROR);
}
}

View File

@ -1,5 +1,7 @@
package com.ruoyi.xkt.enums;
import com.ruoyi.common.constant.HttpStatus;
import com.ruoyi.common.exception.ServiceException;
import lombok.AllArgsConstructor;
import lombok.Getter;
@ -23,7 +25,7 @@ public enum ProductSizeStatus {
return e;
}
}
return null;
throw new ServiceException("档口商品标准尺码类型不存在!", HttpStatus.ERROR);
}
}

View File

@ -1,5 +1,7 @@
package com.ruoyi.xkt.enums;
import com.ruoyi.common.constant.HttpStatus;
import com.ruoyi.common.exception.ServiceException;
import lombok.AllArgsConstructor;
import lombok.Getter;
@ -31,6 +33,6 @@ public enum RegisterStatus {
return e;
}
}
return null;
throw new ServiceException("档口注册类型不存在!", HttpStatus.ERROR);
}
}

View File

@ -1,5 +1,7 @@
package com.ruoyi.xkt.enums;
import com.ruoyi.common.constant.HttpStatus;
import com.ruoyi.common.exception.ServiceException;
import lombok.AllArgsConstructor;
import lombok.Getter;
@ -24,6 +26,6 @@ public enum SaleType {
return e;
}
}
return null;
throw new ServiceException("档口销售出库类型不存在!", HttpStatus.ERROR);
}
}

View File

@ -1,5 +1,7 @@
package com.ruoyi.xkt.enums;
import com.ruoyi.common.constant.HttpStatus;
import com.ruoyi.common.exception.ServiceException;
import lombok.AllArgsConstructor;
import lombok.Getter;
@ -26,6 +28,6 @@ public enum SoleProprietorshipType {
return e;
}
}
return null;
throw new ServiceException("档口营业执照 经营类型不存在!", HttpStatus.ERROR);
}
}

View File

@ -2,8 +2,9 @@ package com.ruoyi.xkt.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.xkt.domain.AdvertRound;
import com.ruoyi.xkt.dto.advertRound.AdvertRoundStorePageDTO;
import com.ruoyi.xkt.dto.advertRound.AdvertRoundStorePageResDTO;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
@ -13,7 +14,6 @@ import java.util.List;
* @author ruoyi
* @date 2025-03-26
*/
@Repository
public interface AdvertRoundMapper extends BaseMapper<AdvertRound> {
/**
@ -28,4 +28,26 @@ public interface AdvertRoundMapper extends BaseMapper<AdvertRound> {
boolean isStallOverBuy(@Param("advertId") Long advertId, @Param("roundId") Long roundId, @Param("storeId") Long storeId,
@Param("launchStatusList") List<Integer> launchStatusList);
/**
* 广
*
* @param pageDTO
* @return List<AdvertRoundStorePageResDTO>
*/
List<AdvertRoundStorePageResDTO> selectStoreAdvertPage(AdvertRoundStorePageDTO pageDTO);
/**
* null
* @param advertRoundId advertRoundId
*/
Integer updateAttrNull(Long advertRoundId);
/**
* 8广
*
* @return List<Long>
*/
List<Long> selectMostPopulars();
}

View File

@ -1,9 +1,10 @@
package com.ruoyi.xkt.service;
import com.ruoyi.xkt.dto.advertRound.AdRoundStoreCreateDTO;
import com.ruoyi.xkt.dto.advertRound.AdRoundStoreResDTO;
import com.ruoyi.common.core.page.Page;
import com.ruoyi.xkt.dto.advertRound.*;
import java.text.ParseException;
import java.util.List;
/**
* 广Service
@ -16,8 +17,8 @@ public interface IAdvertRoundService {
/**
* 广ID广广
*
* @param storeId ID
* @param advertId 广ID
* @param storeId ID
* @param advertId 广ID
* @param showType
* @return AdRoundPlayStoreResDTO
*/
@ -45,5 +46,52 @@ public interface IAdvertRoundService {
void test();
/**
* 11:30广 biddingTempStatusbiddingStatus
*
* @throws ParseException
*/
void updateBiddingStatus() throws ParseException;
/**
* advertRoundId
*
* @param advertRoundId advertRoundId
* @return AdRoundSetProdResDTO
*/
List<AdRoundSetProdResDTO> getSetProdInfo(Long advertRoundId);
/**
* 广
*
* @param pageDTO
* @return Page<AdvertRoundStorePageResDTO>
*/
Page<AdvertRoundStorePageResDTO> page(AdvertRoundStorePageDTO pageDTO);
/**
* 广广
*
* @param storeId ID
* @param advertRoundId 广ID
* @return AdRoundSetPicResDTO
*/
AdRoundStoreSetResDTO getAdvertStoreSetInfo(Long storeId, Long advertRoundId);
/**
* 退广
*
* @param storeId ID
* @param advertRoundId 广ID
* @return
*/
Integer unsubscribe(Long storeId, Long advertRoundId);
/**
* 8广
*
* @return List<AdRoundPopularResDTO>
*/
List<AdRoundPopularResDTO> getMostPopulars();
}

View File

@ -60,4 +60,11 @@ public interface IAdvertService {
*/
List<AdvertPlatformResDTO> getPlatformList();
/**
* 广
*
* @param advertType 广
* @return String
*/
String getDemoPic(Integer advertType);
}

View File

@ -2,24 +2,24 @@ 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.page.Page;
import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.common.enums.AdType;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.xkt.domain.AdvertRound;
import com.ruoyi.xkt.domain.AdvertRoundRecord;
import com.ruoyi.xkt.dto.advertRound.AdRoundStoreCreateDTO;
import com.ruoyi.xkt.dto.advertRound.AdRoundStoreResDTO;
import com.ruoyi.xkt.enums.AdBiddingStatus;
import com.ruoyi.xkt.enums.AdLaunchStatus;
import com.ruoyi.xkt.enums.AdRoundType;
import com.ruoyi.xkt.enums.AdShowType;
import com.ruoyi.xkt.mapper.AdvertRoundMapper;
import com.ruoyi.xkt.mapper.AdvertRoundRecordMapper;
import com.ruoyi.xkt.mapper.StoreMapper;
import com.ruoyi.xkt.domain.StoreProduct;
import com.ruoyi.xkt.domain.SysFile;
import com.ruoyi.xkt.dto.advertRound.*;
import com.ruoyi.xkt.enums.*;
import com.ruoyi.xkt.mapper.*;
import com.ruoyi.xkt.service.IAdvertRoundService;
import com.ruoyi.xkt.service.IAssetService;
import lombok.RequiredArgsConstructor;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.MapUtils;
@ -43,6 +43,8 @@ import java.util.function.BinaryOperator;
import java.util.function.Function;
import java.util.stream.Collectors;
import static com.ruoyi.common.constant.Constants.ADVERT_POPULAR;
/**
* 广Service
*
@ -57,6 +59,9 @@ public class AdvertRoundServiceImpl implements IAdvertRoundService {
final AdvertRoundRecordMapper advertRoundRecordMapper;
final RedisCache redisCache;
final StoreMapper storeMapper;
final StoreProductMapper storeProdMapper;
final SysFileMapper fileMapper;
final IAssetService assetService;
// 推广营销位锁 keysymbol + roundId 或者 symbol + roundId + position 。value都是new Object()
public static Map<String, Object> advertLockMap = new ConcurrentHashMap<>();
@ -83,7 +88,7 @@ public class AdvertRoundServiceImpl implements IAdvertRoundService {
System.err.println(advertLockMap);
}
public void test() {
public void test() {
System.err.println(advertLockMap);
}
@ -145,6 +150,30 @@ public class AdvertRoundServiceImpl implements IAdvertRoundService {
this.advertRoundMapper.updateById(updateList);
}
/**
* advertRoundId
*
* @param advertRoundId advertRoundId
* @return AdRoundSetProdResDTO
*/
@Override
@Transactional(readOnly = true)
public List<AdRoundSetProdResDTO> getSetProdInfo(Long advertRoundId) {
AdvertRound advertRound = Optional.ofNullable(this.advertRoundMapper.selectOne(new LambdaQueryWrapper<AdvertRound>()
.eq(AdvertRound::getId, advertRoundId).eq(AdvertRound::getDelFlag, Constants.UNDELETED)))
.orElseThrow(() -> new ServiceException("推广轮次不存在!"));
if (!Objects.equals(advertRound.getShowType(), AdShowType.POSITION_ENUM.getValue())) {
throw new ServiceException("当前推广位非位置枚举,不可调用该接口!", HttpStatus.ERROR);
}
if (StringUtils.isEmpty(advertRound.getProdIdStr())) {
return Collections.emptyList();
}
List<StoreProduct> storeProdList = this.storeProdMapper.selectList(new LambdaQueryWrapper<StoreProduct>()
.eq(StoreProduct::getDelFlag, Constants.UNDELETED).eq(StoreProduct::getStoreId, advertRound.getStoreId())
.in(StoreProduct::getId, Arrays.stream(advertRound.getProdIdStr().split(",")).map(Long::parseLong).collect(Collectors.toList())));
return storeProdList.stream().map(x -> new AdRoundSetProdResDTO().setStoreProdId(x.getId()).setProdArtNum(x.getProdArtNum())).collect(Collectors.toList());
}
/**
* 广ID广广
@ -156,7 +185,7 @@ public class AdvertRoundServiceImpl implements IAdvertRoundService {
*/
@Override
@Transactional(readOnly = true)
public AdRoundStoreResDTO getStoreAdInfo(final Long storeId, final Long advertId,final Integer showType) {
public AdRoundStoreResDTO getStoreAdInfo(final Long storeId, final Long advertId, final Integer showType) {
final LocalTime now = LocalTime.now();
// 当前时间 是否在 晚上22:00:01 到 晚上23:59:59之间 决定 biddingStatus 和 biddingTempStatus 用那一个字段
boolean tenClockAfter = now.isAfter(LocalTime.of(22, 0, 1)) && now.isBefore(LocalTime.of(23, 59, 59));
@ -288,18 +317,16 @@ public class AdvertRoundServiceImpl implements IAdvertRoundService {
}
/**
* 广
* 1. 广advert_idround_idpay_price[eg: A B C D E]
* 2. 广advert_idround_idpositionpay_price
* 广
* CREATE INDEX idx_advert_round_pay_pos ON advert_round (advert_id, round_id, pay_price, position)
* !
* a. b.
* 1. 广advert_idround_idpay_price[eg: A B C D E]
* 2. 广advert_idround_idpositionpay_price
* 广
* CREATE INDEX idx_advert_round_pay_pos ON advert_round (advert_id, round_id, pay_price, position)
* !
* a. b.
* <p>
* 10:0011:30广ES广
* 10:0011:30广ES广
* <p>
*
* @param createDTO
@ -344,38 +371,152 @@ public class AdvertRoundServiceImpl implements IAdvertRoundService {
if (createDTO.getPayPrice().compareTo(ObjectUtils.defaultIfNull(minPriceAdvert.getPayPrice(), BigDecimal.ZERO)) <= 0) {
throw new ServiceException("已经有档口出价更高了噢,请重新出价!", HttpStatus.ERROR);
}
// storeId不为空表明之前有其他的档口竞价
if (ObjectUtils.isNotEmpty(minPriceAdvert.getStoreId())) {
// TODO 将推广费退至原档口余额
// TODO 将推广费退至原档口余额
// 将推广费退至原档口余额
assetService.refundAdvertFee(minPriceAdvert.getStoreId(), minPriceAdvert.getPayPrice());
// 记录竞价失败的档口推广营销
this.record(minPriceAdvert);
}
// 更新出价最低的广告位
// 更新广告位数据
minPriceAdvert.setStoreId(createDTO.getStoreId()).setPayPrice(createDTO.getPayPrice())
// 展示类型非商品才赋值 setType
.setVoucherDate(java.sql.Date.valueOf(LocalDate.now()))
.setBiddingStatus(AdBiddingStatus.BIDDING.getValue())
.setBiddingTempStatus(AdBiddingStatus.BIDDING_SUCCESS.getValue())
.setPicDesignType(createDTO.getPicDesignType()).setProdIdStr(createDTO.getProdIdStr());
.setPicSetType(!Objects.equals(minPriceAdvert.getDisplayType(), AdDisplayType.PRODUCT.getValue()) ? AdPicSetType.UN_SET.getValue() : null)
.setPicDesignType(!Objects.equals(minPriceAdvert.getDisplayType(), AdDisplayType.PRODUCT.getValue()) ? createDTO.getPicDesignType() : null)
.setPicAuditStatus(!Objects.equals(minPriceAdvert.getDisplayType(), AdDisplayType.PRODUCT.getValue()) ? AdPicAuditStatus.UN_AUDIT.getValue() : null)
.setProdIdStr(createDTO.getProdIdStr());
this.advertRoundMapper.updateById(minPriceAdvert);
// TODO 新竞价成功的档口扣减余额
// TODO 新竞价成功的档口扣减余额
// 扣除推广费
assetService.payAdvertFee(createDTO.getStoreId(), createDTO.getPayPrice(), createDTO.getTransactionPassword());
}
return 1;
}
/**
* 广
*
* @param pageDTO
* @return Page<AdvertRoundStorePageResDTO>
*/
@Override
@Transactional(readOnly = true)
public Page<AdvertRoundStorePageResDTO> page(AdvertRoundStorePageDTO pageDTO) {
PageHelper.startPage(pageDTO.getPageNum(), pageDTO.getPageSize());
List<AdvertRoundStorePageResDTO> list = this.advertRoundMapper.selectStoreAdvertPage(pageDTO);
list.forEach(item -> item.setPlatformName(AdPlatformType.of(item.getPlatformId()).getLabel())
.setLaunchStatusName(AdLaunchStatus.of(item.getLaunchStatus()).getLabel())
.setPicAuditStatusName(ObjectUtils.isNotEmpty(item.getPicAuditStatus()) ? AdPicAuditStatus.of(item.getPicAuditStatus()).getLabel() : "")
.setPicDesignTypeName(ObjectUtils.isNotEmpty(item.getPicDesignType()) ? AdDesignType.of(item.getPicDesignType()).getLabel() : "")
.setPicAuditStatusName(ObjectUtils.isNotEmpty(item.getPicAuditStatus()) ? AdPicAuditStatus.of(item.getPicAuditStatus()).getLabel() : "")
.setPicSetTypeName(ObjectUtils.isNotEmpty(item.getPicSetType()) ? AdPicSetType.of(item.getPicSetType()).getLabel() : "")
.setTypeName(AdType.of(item.getTypeId()).getLabel())
.setBiddingStatusName(AdBiddingStatus.of(item.getBiddingStatus()).getLabel()));
return Page.convert(new PageInfo<>(list));
}
/**
* 广
*
* @param storeId ID
* @param advertRoundId 广ID
* @return AdRoundSetPicResDTO
*/
@Override
@Transactional(readOnly = true)
public AdRoundStoreSetResDTO getAdvertStoreSetInfo(Long storeId, Long advertRoundId) {
AdvertRound advertRound = Optional.ofNullable(this.advertRoundMapper.selectOne(new LambdaQueryWrapper<AdvertRound>()
.eq(AdvertRound::getId, advertRoundId).eq(AdvertRound::getDelFlag, Constants.UNDELETED)
.eq(AdvertRound::getStoreId, storeId)))
.orElseThrow(() -> new ServiceException("档口购买的推广位不存在!", HttpStatus.ERROR));
AdRoundStoreSetResDTO storeSet = new AdRoundStoreSetResDTO().setAdvertRoundId(advertRoundId);
// 获取档口设置的推广图
if (ObjectUtils.isNotEmpty(advertRound.getPicId())) {
SysFile file = Optional.ofNullable(this.fileMapper.selectOne(new LambdaQueryWrapper<SysFile>()
.eq(SysFile::getId, advertRound.getPicId()).eq(SysFile::getDelFlag, Constants.UNDELETED)))
.orElseThrow(() -> new ServiceException("推广图不存在", HttpStatus.ERROR));
storeSet.setFileUrl(file.getFileUrl());
}
// 获取档口设置的推广商品
if (StringUtils.isNotBlank(advertRound.getProdIdStr())) {
List<StoreProduct> storeProdList = Optional.ofNullable(this.storeProdMapper.selectList(new LambdaQueryWrapper<StoreProduct>()
.eq(StoreProduct::getStoreId, storeId).eq(StoreProduct::getDelFlag, Constants.UNDELETED)
.in(StoreProduct::getId, Arrays.stream(advertRound.getProdIdStr().split(",")).map(Long::parseLong).collect(Collectors.toList()))))
.orElseThrow(() -> new ServiceException("档口设置的推广商品不存在", HttpStatus.ERROR));
storeSet.setProdList(storeProdList.stream().map(x -> new AdRoundStoreSetResDTO.ARSSProdDTO()
.setStoreProdId(x.getId()).setProdArtNum(x.getProdArtNum())).collect(Collectors.toList()));
}
return storeSet;
}
/**
* 退广
*
* @param storeId ID
* @param advertRoundId 广ID
* @return
*/
@Override
@Transactional
public Integer unsubscribe(Long storeId, Long advertRoundId) {
AdvertRound advertRound = Optional.ofNullable(this.advertRoundMapper.selectOne(new LambdaQueryWrapper<AdvertRound>()
.eq(AdvertRound::getId, advertRoundId).eq(AdvertRound::getDelFlag, Constants.UNDELETED)
.eq(AdvertRound::getStoreId, storeId)))
.orElseThrow(() -> new ServiceException("档口购买的推广位不存在!", HttpStatus.ERROR));
// 判断当前时间距离开播是否小于72h若是则不可取消
Date threeDaysAfter = DateUtils.toDate(LocalDateTime.now().plusDays(3));
if (threeDaysAfter.after(advertRound.getStartTime())) {
throw new ServiceException("距推广开播小于72小时不可退订!");
}
// 将费用退回到档口余额中
assetService.refundAdvertFee(advertRound.getStoreId(), advertRound.getPayPrice());
// 将推广位置为空
return this.advertRoundMapper.updateAttrNull(advertRound.getId());
}
/**
* 8广
*
* @return List<AdRoundPopularResDTO>
*/
@Override
@Transactional(readOnly = true)
public List<AdRoundPopularResDTO> getMostPopulars() {
// 从redis中获取最受欢迎的8个推广位
List<AdRoundPopularResDTO> redisList = redisCache.getCacheObject(ADVERT_POPULAR);
if (CollectionUtils.isNotEmpty(redisList)) {
return redisList;
}
// 找到有人购买的最受欢迎的advertId列表
List<Long> advertIdList = this.advertRoundMapper.selectMostPopulars();
if (CollectionUtils.isEmpty(advertIdList)) {
return new ArrayList<>();
}
// 获取下一轮待投放的推广位
List<AdvertRound> advertRoundList = this.advertRoundMapper.selectList(new LambdaQueryWrapper<AdvertRound>()
.in(AdvertRound::getAdvertId, advertIdList).eq(AdvertRound::getDelFlag, Constants.UNDELETED)
.eq(AdvertRound::getLaunchStatus, AdLaunchStatus.UN_LAUNCH.getValue()));
// 找到播放轮次最近的数据
Map<Long, Optional<AdvertRound>> minRoundIdMap = advertRoundList.stream().collect(Collectors
.groupingBy(AdvertRound::getAdvertId, Collectors.minBy(Comparator.comparing(AdvertRound::getRoundId))));
// 将minRoundIdMap中的值转换为List<AdRoundPopularResDTO>
List<AdRoundPopularResDTO> list = minRoundIdMap.values().stream().map(Optional::get).map(x -> new AdRoundPopularResDTO().setAdvertId(x.getAdvertId())
.setTypeId(x.getTypeId()).setTypeName(AdType.of(x.getTypeId()).getLabel()).setShowType(x.getShowType()).setStartTime(x.getStartTime())
.setEndTime(x.getEndTime()).setStartPrice(x.getStartPrice()))
.collect(Collectors.toList());
// 存到redis中
redisCache.setCacheObject(ADVERT_POPULAR, list, 1, TimeUnit.DAYS);
return list;
}
/**
* 广
*
* @param storeId ID
* @param advertRoundList
* @param recordList
* @param recordList
* @return List<AdRoundStoreResDTO.ADRSRoundRecordDTO>
*/
private List<AdRoundStoreResDTO.ADRSRoundRecordDTO> getStoreBoughtList(Long storeId, List<AdvertRound> advertRoundList, List<AdvertRoundRecord> recordList) {
@ -403,9 +544,9 @@ public class AdvertRoundServiceImpl implements IAdvertRoundService {
/**
* redis广
* 5.1 - 5.3
* a. 4.30 4.30 22:00
* b. 5.2 5.2 22:00:00
* c. 5.3
* a. 4.30 4.30 22:00
* b. 5.2 5.2 22:00:00
* c. 5.3
*
* @throws ParseException
*/
@ -420,7 +561,7 @@ public class AdvertRoundServiceImpl implements IAdvertRoundService {
// 服务器当前时间 yyyy-MM-dd
final Date now = DateUtils.parseDate(DateUtils.getDate(), DateUtils.YYYY_MM_DD);
// 当天截止的时间 yyyy-MM-dd 22:00:00
final String filterTime = DateTimeFormatter.ofPattern(DateUtils.YYYY_MM_DD_HH_MM_SS)
final String filterTime = DateTimeFormatter.ofPattern(DateUtils.YYYY_MM_DD_HH_MM_SS)
.format(LocalDateTime.now().withHour(22).withMinute(0).withSecond(0));
advertRoundList.stream().collect(Collectors.groupingBy(AdvertRound::getAdvertId))
.forEach((advertId, roundList) -> {
@ -440,12 +581,6 @@ public class AdvertRoundServiceImpl implements IAdvertRoundService {
return;
}
}
// 作用于某一轮推广的symbol包含了播放轮次的
/*String symbol = now.before(firstRoundEndTime)
? roundList.stream().filter(x -> x.getRoundId().equals(AdRoundType.PLAY_ROUND.getValue()))
.map(AdvertRound::getSymbol).findAny().orElseThrow(() -> new ServiceException("获取推广第一轮symbol失败请联系客服!", HttpStatus.ERROR))
: roundList.stream().filter(x -> x.getRoundId().equals(AdRoundType.SECOND_ROUND.getValue()))
.map(AdvertRound::getSymbol).findAny().orElseThrow(() -> new ServiceException("获取推广第二轮symbol失败请联系客服!", HttpStatus.ERROR));*/
// 存放到redis中 有效期1天
redisCache.setCacheObject(symbol, filterTime, 1, TimeUnit.DAYS);
});
@ -454,6 +589,7 @@ public class AdvertRoundServiceImpl implements IAdvertRoundService {
/**
* 广
*
* @param symbol
* @return
*/
@ -464,6 +600,7 @@ public class AdvertRoundServiceImpl implements IAdvertRoundService {
/**
* 广
*
* @param failAdvert 广
*/
private void record(AdvertRound failAdvert) {
@ -478,6 +615,7 @@ public class AdvertRoundServiceImpl implements IAdvertRoundService {
/**
* Date
*
* @param date yyyy-MM-dd
* @return
*/
@ -489,8 +627,9 @@ public class AdvertRoundServiceImpl implements IAdvertRoundService {
/**
*
*
* @param startDate
* @param endDate
* @param endDate
* @return diffDay
*/
public static int calculateDurationDay(Date startDate, Date endDate) {
@ -501,10 +640,11 @@ public class AdvertRoundServiceImpl implements IAdvertRoundService {
/**
* 广
* @param allRoundList 广
*
* @param allRoundList 广
* @param allRecordList 广
* @param storeId ID
* @param voucherDate
* @param storeId ID
* @param voucherDate
* @param tenClockAfter 10
* @return
*/

View File

@ -1,6 +1,5 @@
package com.ruoyi.xkt.service.impl;
import java.security.SecureRandom;
import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.github.pagehelper.PageHelper;
@ -9,6 +8,7 @@ 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.enums.AdType;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.xkt.domain.Advert;
@ -17,7 +17,6 @@ import com.ruoyi.xkt.dto.advert.*;
import com.ruoyi.xkt.enums.AdOnlineStatus;
import com.ruoyi.xkt.enums.AdPlatformType;
import com.ruoyi.xkt.enums.AdTab;
import com.ruoyi.common.enums.AdType;
import com.ruoyi.xkt.mapper.AdvertMapper;
import com.ruoyi.xkt.mapper.SysFileMapper;
import com.ruoyi.xkt.service.IAdvertService;
@ -27,6 +26,7 @@ import org.apache.commons.lang3.ObjectUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.security.SecureRandom;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
@ -210,6 +210,23 @@ public class AdvertServiceImpl implements IAdvertService {
return platformList;
}
/**
* 广
*
* @param advertType 广
* @return String
*/
@Override
@Transactional(readOnly = true)
public String getDemoPic(Integer advertType) {
Advert advert = Optional.ofNullable(this.advertMapper.selectOne(new LambdaQueryWrapper<Advert>()
.eq(Advert::getTypeId, advertType).eq(Advert::getDelFlag, Constants.UNDELETED)))
.orElseThrow(() -> new ServiceException("推广类型不存在!", HttpStatus.ERROR));
SysFile file = Optional.ofNullable(this.fileMapper.selectById(advert.getExamplePicId()))
.orElseThrow(() -> new ServiceException("示例图不存在!", HttpStatus.ERROR));
return file.getFileUrl();
}
/**
*
*/

View File

@ -19,6 +19,7 @@ import com.ruoyi.xkt.enums.StoreStatus;
import com.ruoyi.xkt.mapper.DailyStoreTagMapper;
import com.ruoyi.xkt.mapper.StoreMapper;
import com.ruoyi.xkt.mapper.UserSubscriptionsMapper;
import com.ruoyi.xkt.service.IAssetService;
import com.ruoyi.xkt.service.IStoreCertificateService;
import com.ruoyi.xkt.service.IStoreService;
import lombok.RequiredArgsConstructor;
@ -50,6 +51,8 @@ public class StoreServiceImpl implements IStoreService {
final DailyStoreTagMapper storeTagMapper;
final UserSubscriptionsMapper userSubMapper;
final RedisCache redisCache;
final IAssetService assetService;
/**
*
@ -69,6 +72,8 @@ public class StoreServiceImpl implements IStoreService {
Date oneYearAfter = Date.from(LocalDate.now().plusYears(1).atStartOfDay(ZoneId.systemDefault()).toInstant());
store.setTrialEndTime(oneYearAfter);
int count = this.storeMapper.insert(store);
// 创建档口账户
assetService.createInternalAccountIfNotExists(store.getId());
// 放到redis中
redisCache.setCacheObject(Constants.STORE_REDIS_PREFIX + store.getId(), store.getId());
return count;

View File

@ -24,4 +24,71 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</foreach>
</select>
<select id="selectStoreAdvertPage" parameterType="com.ruoyi.xkt.dto.advertRound.AdvertRoundStorePageDTO" resultType="com.ruoyi.xkt.dto.advertRound.AdvertRoundStorePageResDTO">
SELECT
a.platform_id,
ar.type_id,
ar.position,
ar.start_time,
ar.end_time,
ar.pay_price,
ar.launch_status,
ar.bidding_status,
ar.pic_design_type,
ar.pic_set_type,
ar.pic_audit_status
FROM
advert_round ar
JOIN advert a ON ar.advert_id = a.id
WHERE
ar.del_flag = 0
AND ar.store_id = #{storeId}
<if test="typeId != null "> and ar.type_id = #{typeId}</if>
<if test="launchStatus != null "> and ar.launch_status = #{launchStatus}</if>
<if test="biddingStatus != null "> and ar.bidding_status = #{biddingStatus}</if>
<if test="picSetType != null "> and ar.pic_set_type = #{picSetType}</if>
<if test="picDesignType != null "> and ar.pic_design_type = #{picDesignType}</if>
<if test="picAuditStatus != null "> and ar.pic_audit_status = #{picAuditStatus}</if>
<if test="startTime != null "> and ar.start_time &gt;= #{startTime}</if>
<if test="endTime != null "> and ar.end_time &lt;= #{endTime}</if>
ORDER BY
ar.create_time DESC
</select>
<update id="updateAttrNull">
UPDATE advert_round
SET voucher_date = NULL,
store_id = NULL,
pay_price = NULL,
bidding_status = NULL,
bidding_temp_status = NULL,
pic_audit_status = NULL,
pic_set_type = NULL,
pic_id = NULL,
prod_id_str = NULL,
pic_design_type = NULL,
sys_intercept = NULL
WHERE
id = #{advertRoundId}
</update>
<select id="selectMostPopulars">
SELECT
advert_id
FROM
advert_round
WHERE
pay_price IS NOT NULL
AND store_id IS NOT NULL
AND sys_intercept = 0
GROUP BY
advert_id
ORDER BY
COUNT( advert_id ) DESC
LIMIT 8
</select>
</mapper>