master:竞价失败列表功能完善;

pull/1121/head
liujiang 2025-05-14 15:46:57 +08:00
parent 09e66a856a
commit 1cc6324f55
8 changed files with 268 additions and 69 deletions

View File

@ -0,0 +1,43 @@
package com.ruoyi.web.controller.xkt;
import cn.hutool.core.bean.BeanUtil;
import com.ruoyi.common.core.controller.XktBaseController;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.page.Page;
import com.ruoyi.web.controller.xkt.vo.advertRoundRecord.AdvertRoundRecordPageVO;
import com.ruoyi.xkt.dto.advertRoundRecord.AdvertRoundRecordPageDTO;
import com.ruoyi.xkt.dto.advertRoundRecord.AdvertRoundRecordPageResDTO;
import com.ruoyi.xkt.service.IAdvertRoundRecordService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* 广Controller
*
* @author ruoyi
* @date 2025-03-26
*/
@Api(tags = "推广轮次竞价失败")
@RestController
@RequiredArgsConstructor
@RequestMapping("/rest/v1/ad-round-records")
public class AdvertRoundRecordController extends XktBaseController {
final IAdvertRoundRecordService advertRoundRecordService;
/**
*
*/
@ApiOperation(value = "获取档口竞价失败列表", httpMethod = "POST", response = R.class)
@PostMapping("/page")
public R<Page<AdvertRoundRecordPageResDTO>> page(@Validated @RequestBody AdvertRoundRecordPageVO pageVO) {
return R.ok(advertRoundRecordService.page(BeanUtil.toBean(pageVO, AdvertRoundRecordPageDTO.class)));
}
}

View File

@ -0,0 +1,34 @@
package com.ruoyi.web.controller.xkt.vo.advertRoundRecord;
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 AdvertRoundRecordPageVO extends BasePageVO {
@NotNull(message = "档口ID不能为空!")
@ApiModelProperty(value = "档口ID")
private Long storeId;
@ApiModelProperty(value = "平台ID")
private Long platformId;
@ApiModelProperty(value = "推广类型")
private Integer typeId;
@ApiModelProperty(value = "投放开始时间")
private Date startTime;
@ApiModelProperty(value = "投放结束时间")
private Date endTime;
}

View File

@ -0,0 +1,32 @@
package com.ruoyi.xkt.dto.advertRoundRecord;
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 AdvertRoundRecordPageDTO extends BasePageDTO {
@ApiModelProperty(value = "档口ID")
private Long storeId;
@ApiModelProperty(value = "平台ID")
private Long platformId;
@ApiModelProperty(value = "推广类型")
private Integer typeId;
@ApiModelProperty(value = "投放开始时间")
private Date startTime;
@ApiModelProperty(value = "投放结束时间")
private Date endTime;
}

View File

@ -0,0 +1,55 @@
package com.ruoyi.xkt.dto.advertRoundRecord;
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 AdvertRoundRecordPageResDTO {
@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

@ -2,12 +2,11 @@ package com.ruoyi.xkt.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.xkt.domain.AdvertRoundRecord;
import org.apache.ibatis.annotations.Param;
import com.ruoyi.xkt.dto.advertRoundRecord.AdvertRoundRecordPageDTO;
import com.ruoyi.xkt.dto.advertRoundRecord.AdvertRoundRecordPageResDTO;
import org.springframework.stereotype.Repository;
import java.util.Date;
import java.util.List;
import java.util.Set;
/**
* 广Mapper
@ -15,32 +14,14 @@ import java.util.Set;
* @author ruoyi
* @date 2025-03-26
*/
@Repository
public interface AdvertRoundRecordMapper extends BaseMapper<AdvertRoundRecord> {
/**
* 广广
*
*
* @param advertId 广ID
* @param storeId ID
* @param voucherDate
* @param roundIdSet ID
* @param pageDTO
* @return
*/
List<AdvertRoundRecord> selectListByRoundId(@Param("advertId") Long advertId, @Param("storeId") Long storeId,
@Param("voucherDate") Date voucherDate, @Param("roundIdSet") Set<Integer> roundIdSet);
/**
* 广广
*
* @param advertId 广ID
* @param storeId ID
* @param voucherDate
* @param positionList
* @return
*/
List<AdvertRoundRecord> selectListByPosition(@Param("advertId") Long advertId, @Param("storeId") Long storeId,
@Param("voucherDate") Date voucherDate, @Param("positionList") List<String> positionList);
List<AdvertRoundRecordPageResDTO> selectRecordPage(AdvertRoundRecordPageDTO pageDTO);
}

View File

@ -0,0 +1,23 @@
package com.ruoyi.xkt.service;
import com.ruoyi.common.core.page.Page;
import com.ruoyi.xkt.dto.advertRoundRecord.AdvertRoundRecordPageDTO;
import com.ruoyi.xkt.dto.advertRoundRecord.AdvertRoundRecordPageResDTO;
/**
* 广Service
*
* @author ruoyi
* @date 2025-03-26
*/
public interface IAdvertRoundRecordService {
/**
*
*
* @param pageDTO
* @return Page<AdvertRoundRecordPageResDTO>
*/
Page<AdvertRoundRecordPageResDTO> page(AdvertRoundRecordPageDTO pageDTO);
}

View File

@ -0,0 +1,54 @@
package com.ruoyi.xkt.service.impl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.ruoyi.common.core.page.Page;
import com.ruoyi.common.enums.AdType;
import com.ruoyi.xkt.dto.advertRoundRecord.AdvertRoundRecordPageDTO;
import com.ruoyi.xkt.dto.advertRoundRecord.AdvertRoundRecordPageResDTO;
import com.ruoyi.xkt.enums.*;
import com.ruoyi.xkt.mapper.AdvertRoundRecordMapper;
import com.ruoyi.xkt.service.IAdvertRoundRecordService;
import lombok.RequiredArgsConstructor;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
/**
* 广Service
*
* @author ruoyi
* @date 2025-03-26
*/
@Service
@RequiredArgsConstructor
public class AdvertRoundRecordServiceImpl implements IAdvertRoundRecordService {
final AdvertRoundRecordMapper advertRoundRecordMapper;
/**
*
*
* @param pageDTO
* @return Page<AdvertRoundRecordPageResDTO>
*/
@Override
@Transactional(readOnly = true)
public Page<AdvertRoundRecordPageResDTO> page(AdvertRoundRecordPageDTO pageDTO) {
PageHelper.startPage(pageDTO.getPageNum(), pageDTO.getPageSize());
List<AdvertRoundRecordPageResDTO> list = this.advertRoundRecordMapper.selectRecordPage(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));
}
}

View File

@ -4,55 +4,32 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.xkt.mapper.AdvertRoundRecordMapper">
<select id="selectListByRoundId" resultType="com.ruoyi.xkt.domain.AdvertRoundRecord">
<select id="selectRecordPage" parameterType="com.ruoyi.xkt.dto.advertRoundRecord.AdvertRoundRecordPageDTO" resultType="com.ruoyi.xkt.dto.advertRoundRecord.AdvertRoundRecordPageResDTO">
SELECT
*
a.platform_id,
arr.type_id,
CONCAT('位置', arr.position) AS position,
arr.start_time,
arr.end_time,
arr.pay_price,
arr.launch_status,
arr.bidding_status,
arr.pic_design_type,
arr.pic_set_type,
arr.pic_audit_status
FROM
advert_round_record
advert_round_record arr
JOIN advert a ON arr.advert_id = a.id
WHERE
id IN (
SELECT
MAX( id )
FROM
advert_round_record
WHERE
advert_id = #{advertId}
AND store_id = #{storeId}
AND voucher_date = #{voucherDate}
AND del_flag = 0
AND round_id IN
<foreach item="roundId" collection="roundIdSet" open="(" separator="," close=")">
#{roundId}
</foreach>
GROUP BY
round_id
)
arr.del_flag = 0
AND arr.store_id = #{storeId}
<if test="platformId != null "> and a.platform_id = #{platformId}</if>
<if test="typeId != null "> and arr.type_id = #{typeId}</if>
<if test="startTime != null "> and arr.start_time &gt;= #{startTime}</if>
<if test="endTime != null "> and arr.end_time &lt;= #{endTime}</if>
ORDER BY
arr.start_time
</select>
<select id="selectListByPosition" resultType="com.ruoyi.xkt.domain.AdvertRoundRecord">
SELECT
*
FROM
advert_round_record
WHERE
id IN (
SELECT
MAX( id )
FROM
advert_round_record
WHERE
advert_id = #{advertId}
AND store_id = #{storeId}
AND voucher_date = #{voucherDate}
AND del_flag = 0
AND position IN
<foreach item="position" collection="positionList" open="(" separator="," close=")">
#{position}
</foreach>
GROUP BY
round_id
)
</select>
</mapper>