mirror of
https://gitee.com/qqtt-ah/ecom-dmb.git
synced 2026-11-24 05:09:21 +08:00
refactor: 推广记录 platform 字段改为外键关联 ec_platform 表,平台下拉动态加载
This commit is contained in:
+4
-4
@@ -37,10 +37,10 @@ public class CreatePromotionFeeDTO {
|
||||
private String feeName;
|
||||
|
||||
/**
|
||||
* 平台(淘宝、京东、拼多多等)
|
||||
* 平台ID
|
||||
*/
|
||||
@Schema(description = "平台", example = "淘宝")
|
||||
private String platform;
|
||||
@Schema(description = "平台ID", example = "1")
|
||||
private Long platformId;
|
||||
|
||||
/**
|
||||
* 推广活动名称
|
||||
@@ -97,4 +97,4 @@ public class CreatePromotionFeeDTO {
|
||||
*/
|
||||
@Schema(description = "备注", example = "双十一期间推广费用")
|
||||
private String remark;
|
||||
}
|
||||
}
|
||||
+4
-4
@@ -25,10 +25,10 @@ public class PromotionFeeFilterDTO {
|
||||
private Long feeTypeId;
|
||||
|
||||
/**
|
||||
* 平台
|
||||
* 平台ID
|
||||
*/
|
||||
@Schema(description = "平台", example = "淘宝")
|
||||
private String platform;
|
||||
@Schema(description = "平台ID", example = "1")
|
||||
private Long platformId;
|
||||
|
||||
/**
|
||||
* 推广费发生日期开始
|
||||
@@ -41,4 +41,4 @@ public class PromotionFeeFilterDTO {
|
||||
*/
|
||||
@Schema(description = "推广费发生日期结束", example = "2024-01-31")
|
||||
private LocalDate feeDateEnd;
|
||||
}
|
||||
}
|
||||
+4
-4
@@ -44,10 +44,10 @@ public class UpdatePromotionFeeDTO {
|
||||
private String feeName;
|
||||
|
||||
/**
|
||||
* 平台(淘宝、京东、拼多多等)
|
||||
* 平台ID
|
||||
*/
|
||||
@Schema(description = "平台", example = "淘宝")
|
||||
private String platform;
|
||||
@Schema(description = "平台ID", example = "1")
|
||||
private Long platformId;
|
||||
|
||||
/**
|
||||
* 推广活动名称
|
||||
@@ -104,4 +104,4 @@ public class UpdatePromotionFeeDTO {
|
||||
*/
|
||||
@Schema(description = "备注", example = "双十一期间推广费用")
|
||||
private String remark;
|
||||
}
|
||||
}
|
||||
+6
-6
@@ -40,18 +40,18 @@ public class PromotionFeePO {
|
||||
@TableField("fee_type_id")
|
||||
private Long feeTypeId;
|
||||
|
||||
/**
|
||||
* 平台ID
|
||||
*/
|
||||
@TableField("platform_id")
|
||||
private Long platformId;
|
||||
|
||||
/**
|
||||
* 推广费名称
|
||||
*/
|
||||
@TableField("fee_name")
|
||||
private String feeName;
|
||||
|
||||
/**
|
||||
* 平台(淘宝、京东、拼多多等)
|
||||
*/
|
||||
@TableField("platform")
|
||||
private String platform;
|
||||
|
||||
/**
|
||||
* 推广活动名称
|
||||
*/
|
||||
|
||||
+12
@@ -50,6 +50,18 @@ public class PromotionFeeVO {
|
||||
@Schema(description = "推广费类型名称", example = "直通车")
|
||||
private String feeTypeName;
|
||||
|
||||
/**
|
||||
* 平台ID
|
||||
*/
|
||||
@Schema(description = "平台ID", example = "1")
|
||||
private Long platformId;
|
||||
|
||||
/**
|
||||
* 平台名称
|
||||
*/
|
||||
@Schema(description = "平台名称", example = "淘宝")
|
||||
private String platformName;
|
||||
|
||||
/**
|
||||
* 推广费名称
|
||||
*/
|
||||
|
||||
+18
-14
@@ -17,8 +17,9 @@ import top.xyquan.ecomdmbbackend.modules.ecom.promotion.model.dto.UpdatePromotio
|
||||
import top.xyquan.ecomdmbbackend.modules.ecom.promotion.model.po.PromotionFeePO;
|
||||
import top.xyquan.ecomdmbbackend.modules.ecom.promotion.model.vo.PromotionFeeVO;
|
||||
import top.xyquan.ecomdmbbackend.modules.ecom.promotion.service.PromotionFeeService;
|
||||
import top.xyquan.ecomdmbbackend.modules.ecom.shop.service.ShopService;
|
||||
import top.xyquan.ecomdmbbackend.modules.ecom.promotion.service.PromotionFeeTypeService;
|
||||
import top.xyquan.ecomdmbbackend.modules.ecom.platform.service.PlatformService;
|
||||
import top.xyquan.ecomdmbbackend.modules.ecom.shop.service.ShopService;
|
||||
import top.xyquan.ecomdmbbackend.utils.CurrentUserContext;
|
||||
|
||||
import java.util.List;
|
||||
@@ -35,6 +36,7 @@ public class PromotionFeeServiceImpl implements PromotionFeeService {
|
||||
private final CurrentUserContext currentUserContext;
|
||||
private final ShopService shopService;
|
||||
private final PromotionFeeTypeService promotionFeeTypeService;
|
||||
private final PlatformService platformService;
|
||||
|
||||
/**
|
||||
* 创建推广费记录
|
||||
@@ -49,7 +51,7 @@ public class PromotionFeeServiceImpl implements PromotionFeeService {
|
||||
po.setCompanyId(currentUserContext.getCurrentCompanyId());
|
||||
po.setCreateBy(currentUserContext.getCurrentUserId());
|
||||
po.setUpdateBy(currentUserContext.getCurrentUserId());
|
||||
|
||||
|
||||
promotionFeeMapper.insert(po);
|
||||
return po.getId();
|
||||
}
|
||||
@@ -110,17 +112,13 @@ public class PromotionFeeServiceImpl implements PromotionFeeService {
|
||||
*/
|
||||
@Override
|
||||
public PageResultVO<PromotionFeeVO> getPromotionFeePage(PageQueryDTO<PromotionFeeFilterDTO> pageQueryDTO) {
|
||||
// 从token中获取公司ID
|
||||
Long companyId = currentUserContext.getCurrentCompanyId();
|
||||
|
||||
// 创建分页对象
|
||||
Page<PromotionFeePO> page = new Page<>(pageQueryDTO.getPage(), pageQueryDTO.getPageSize());
|
||||
|
||||
// 构建查询条件
|
||||
LambdaQueryWrapper<PromotionFeePO> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(PromotionFeePO::getCompanyId, companyId);
|
||||
|
||||
// 添加过滤条件
|
||||
PromotionFeeFilterDTO filter = pageQueryDTO.getFilters();
|
||||
if (filter != null) {
|
||||
if (filter.getShopId() != null) {
|
||||
@@ -129,8 +127,8 @@ public class PromotionFeeServiceImpl implements PromotionFeeService {
|
||||
if (filter.getFeeTypeId() != null) {
|
||||
wrapper.eq(PromotionFeePO::getFeeTypeId, filter.getFeeTypeId());
|
||||
}
|
||||
if (filter.getPlatform() != null && !filter.getPlatform().trim().isEmpty()) {
|
||||
wrapper.like(PromotionFeePO::getPlatform, filter.getPlatform());
|
||||
if (filter.getPlatformId() != null) {
|
||||
wrapper.eq(PromotionFeePO::getPlatformId, filter.getPlatformId());
|
||||
}
|
||||
if (filter.getFeeDateStart() != null) {
|
||||
wrapper.ge(PromotionFeePO::getFeeDate, filter.getFeeDateStart());
|
||||
@@ -140,19 +138,15 @@ public class PromotionFeeServiceImpl implements PromotionFeeService {
|
||||
}
|
||||
}
|
||||
|
||||
// 排序
|
||||
wrapper.orderByDesc(PromotionFeePO::getFeeDate)
|
||||
.orderByDesc(PromotionFeePO::getCreateTime);
|
||||
|
||||
// 执行分页查询
|
||||
IPage<PromotionFeePO> pageResult = promotionFeeMapper.selectPage(page, wrapper);
|
||||
|
||||
// 转换为VO
|
||||
List<PromotionFeeVO> voList = pageResult.getRecords().stream()
|
||||
.map(this::convertToVO)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// 构建分页结果
|
||||
return PageResultVO.create(voList, pageResult.getTotal(), pageQueryDTO.getPage(), pageQueryDTO.getPageSize());
|
||||
}
|
||||
|
||||
@@ -182,10 +176,20 @@ public class PromotionFeeServiceImpl implements PromotionFeeService {
|
||||
vo.setFeeTypeName(feeTypeVO.getTypeName());
|
||||
}
|
||||
} catch (Exception ignored) {
|
||||
// 查询失败不影响主流程
|
||||
}
|
||||
}
|
||||
|
||||
// 填充平台名称
|
||||
if (po.getPlatformId() != null) {
|
||||
try {
|
||||
var platform = platformService.getById(po.getPlatformId());
|
||||
if (platform != null) {
|
||||
vo.setPlatformName(platform.getPlatformName());
|
||||
}
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
}
|
||||
|
||||
return vo;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user