fix: 修复推广费分页查询缺少店铺名称和推广费类型名称

- PromotionFeeServiceImpl.convertToVO() 增加关联查询,填充 shopName 和 feeTypeName
- 精简导入订单任务中规格编码为空时的任务消息提示
This commit is contained in:
小蟑螂
2026-04-20 12:56:25 +08:00
parent dd2dcd7d88
commit a0f487b0c7
2 changed files with 32 additions and 9 deletions
@@ -877,15 +877,10 @@ public class OrderImportProcessor {
String specCode = getValue(record, specCodeField);
if (specCode == null || specCode.trim().isEmpty()) {
if (specCodeField != null && specCodeField.getRequired() != null && specCodeField.getRequired()) {
String availableHeaders = String.join(", ", record.getParser().getHeaderMap().keySet());
String fileFieldName = specCodeField.getFileFieldName();
throw new BusinessException(String.format("规格编码不能为空。映射的表头名: '%s',可用的表头: [%s],当前行的所有值: %s",
fileFieldName, availableHeaders, record.toMap()));
} else if (specCodeField == null) {
String availableHeaders = String.join(", ", record.getParser().getHeaderMap().keySet());
throw new BusinessException(String.format("规格编码不能为空。映射中未定义该字段,可用的表头: [%s],当前行的所有值: %s",
availableHeaders, record.toMap()));
// 必填但未填,或未配置映射:任务消息仅提示简短文案
if (specCodeField == null
|| (specCodeField.getRequired() != null && specCodeField.getRequired())) {
throw new BusinessException("规格编码不能为空");
}
}
@@ -17,6 +17,8 @@ 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.utils.CurrentUserContext;
import java.util.List;
@@ -31,6 +33,8 @@ public class PromotionFeeServiceImpl implements PromotionFeeService {
private final PromotionFeeMapper promotionFeeMapper;
private final CurrentUserContext currentUserContext;
private final ShopService shopService;
private final PromotionFeeTypeService promotionFeeTypeService;
/**
* 创建推广费记录
@@ -158,6 +162,30 @@ public class PromotionFeeServiceImpl implements PromotionFeeService {
private PromotionFeeVO convertToVO(PromotionFeePO po) {
PromotionFeeVO vo = new PromotionFeeVO();
BeanUtils.copyProperties(po, vo);
// 填充店铺名称
if (po.getShopId() != null) {
try {
var shop = shopService.getById(po.getShopId());
if (shop != null) {
vo.setShopName(shop.getName());
}
} catch (Exception ignored) {
}
}
// 填充推广费类型名称
if (po.getFeeTypeId() != null) {
try {
var feeTypeVO = promotionFeeTypeService.getPromotionFeeTypeById(po.getFeeTypeId());
if (feeTypeVO != null) {
vo.setFeeTypeName(feeTypeVO.getTypeName());
}
} catch (Exception ignored) {
// 查询失败不影响主流程
}
}
return vo;
}
}