fix(sip): 优化导入数据校验

- 在导入数据时,过滤掉产品编码为空的项,避免因空值导致的错误
- 修改错误提示信息,使其更加准确地反映问题所在
master
chenhao 2025-04-11 18:43:15 +08:00
parent a248f12399
commit 54c0b79ac2
1 changed files with 3 additions and 2 deletions

View File

@ -3,6 +3,7 @@ package com.ruoyi.sip.service.impl;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.function.Function;
import java.util.stream.Collectors;
@ -108,9 +109,9 @@ public class DeliveryListServiceImpl implements IDeliveryListService {
@Override
public AjaxResult importData(List<DeliveryList> deliveryList, Long deliveryId) {
List<String> productCodeList = deliveryList.stream().map(DeliveryList::getProductCode).collect(Collectors.toList());
List<String> productCodeList = deliveryList.stream().map(DeliveryList::getProductCode).filter(Objects::nonNull).collect(Collectors.toList());
if (productCodeList.isEmpty()) {
return AjaxResult.error("产品编码为空");
return AjaxResult.error("文件为空或产品编码为空");
}
List<OrderList> orderLists = infoMapper.listOrderListByDeliveryId(deliveryId);
if (orderLists.isEmpty()) {