✨ 单号筛选改为多行输入并限制1000个

This commit is contained in:
caojia
2026-10-23 10:06:59 +08:00
parent 4ec28de073
commit fc94a15f76
4 changed files with 145 additions and 44 deletions
@@ -34,6 +34,7 @@ import com.bms.system.service.IBmsProductCodeMappingService;
public class OrderBillProductCheckService
{
private static final int ORDER_DRILL_LIMIT = 500;
private static final int MAX_ORDER_IDENTIFIERS = 1000;
@Autowired
private ITmsPriceQuoteService tmsPriceQuoteService;
@@ -225,6 +226,7 @@ public class OrderBillProductCheckService
throw new ServiceException("please select customer");
}
query.setCustomerCodes(codes);
query.setOrderIdentifiers(normalizeOrderIdentifiers(query.getOrderIdentifiers()));
Map<String, Object> params = query.getParams();
String begin = params == null ? null : strObj(params.get("beginBizDate"));
String end = params == null ? null : strObj(params.get("endBizDate"));
@@ -251,6 +253,34 @@ public class OrderBillProductCheckService
return new ArrayList<String>(set);
}
private static List<String> normalizeOrderIdentifiers(List<String> identifiers)
{
LinkedHashSet<String> unique = new LinkedHashSet<String>();
if (identifiers != null)
{
for (String identifier : identifiers)
{
if (StringUtils.isEmpty(identifier))
{
continue;
}
for (String token : identifier.split("[,,;;\\s]+"))
{
String value = token.trim();
if (StringUtils.isNotEmpty(value))
{
unique.add(value);
}
}
}
}
if (unique.size() > MAX_ORDER_IDENTIFIERS)
{
throw new ServiceException("单号去重后最多输入 " + MAX_ORDER_IDENTIFIERS + " 个");
}
return new ArrayList<String>(unique);
}
private static Date resolveAsOf(PrcOrderBill query)
{
Map<String, Object> params = query.getParams();
@@ -106,6 +106,7 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
private static final String DICT_FEE_TYPE = "bms_fee_type";
private static final String FEE_TYPE_REFUND = "REFUND";
private static final int MAX_ORDER_IDENTIFIERS = 1000;
@Autowired
@Lazy
@@ -343,6 +344,7 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
query.setProductCodes(normalizeCodeList(query.getProductCodes()));
query.setTrackingNos(normalizeCodeList(query.getTrackingNos()));
query.setTransferNos(normalizeCodeList(query.getTransferNos()));
query.setOrderIdentifiers(normalizeOrderIdentifiers(query.getOrderIdentifiers()));
return orderBillMapper.selectPrcOrderBillList(query);
}
@@ -401,6 +403,17 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
return cleaned.isEmpty() ? null : cleaned;
}
/** 单号筛选按去重后的订单号/运单号/转单号数量限制,避免过大的 IN 参数。 */
private List<String> normalizeOrderIdentifiers(List<String> identifiers)
{
List<String> cleaned = normalizeCodeList(identifiers);
if (cleaned != null && cleaned.size() > MAX_ORDER_IDENTIFIERS)
{
throw new ServiceException("单号去重后最多输入 " + MAX_ORDER_IDENTIFIERS + " 个");
}
return cleaned;
}
@Override
public TmsPriceQuoteResult getBill(String billId)
{
@@ -979,7 +992,7 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
List<String> orderNos = normalizeCodeList(request.getOrderNos());
List<String> trackingNos = normalizeCodeList(request.getTrackingNos());
List<String> transferNos = normalizeCodeList(request.getTransferNos());
List<String> orderIdentifiers = normalizeCodeList(request.getOrderIdentifiers());
List<String> orderIdentifiers = normalizeOrderIdentifiers(request.getOrderIdentifiers());
List<String> customerCodes = normalizeCodeList(request.getCustomerCodes());
List<String> productCodes = normalizeCodeList(request.getProductCodes());
String creditArrearsStatus = StringUtils.isEmpty(request.getCreditArrearsStatus()) ? null
@@ -1030,7 +1043,7 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
query.setProductCodes(normalizeCodeList(query.getProductCodes()));
query.setTrackingNos(normalizeCodeList(query.getTrackingNos()));
query.setTransferNos(normalizeCodeList(query.getTransferNos()));
query.setOrderIdentifiers(normalizeCodeList(query.getOrderIdentifiers()));
query.setOrderIdentifiers(normalizeOrderIdentifiers(query.getOrderIdentifiers()));
query.setBillIds(normalizeCodeList(query.getBillIds()));
}
@@ -1149,7 +1162,7 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
List<String> orderNos = normalizeCodeList(orderNosRaw);
List<String> trackingNos = normalizeCodeList(trackingNosRaw);
List<String> transferNos = normalizeCodeList(transferNosRaw);
List<String> orderIdentifiers = normalizeCodeList(orderIdentifiersRaw);
List<String> orderIdentifiers = normalizeOrderIdentifiers(orderIdentifiersRaw);
List<String> customerCodes = normalizeCodeList(customerCodesRaw);
List<String> productCodes = normalizeCodeList(productCodesRaw);
String creditArrearsStatus = StringUtils.isEmpty(creditArrearsStatusRaw) ? null
@@ -2577,7 +2590,7 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
boolean hasFilter = (orderNos != null && !orderNos.isEmpty())
|| (trackingNos != null && !trackingNos.isEmpty())
|| (transferNos != null && !transferNos.isEmpty())
|| (request.getOrderIdentifiers() != null && !normalizeCodeList(request.getOrderIdentifiers()).isEmpty())
|| (request.getOrderIdentifiers() != null && !normalizeOrderIdentifiers(request.getOrderIdentifiers()).isEmpty())
|| (customerCodes != null && !customerCodes.isEmpty())
|| (productCodes != null && !productCodes.isEmpty())
|| StringUtils.isNotEmpty(creditArrearsStatus)
@@ -2591,7 +2604,7 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
query.setOrderNos(orderNos);
query.setTrackingNos(trackingNos);
query.setTransferNos(transferNos);
query.setOrderIdentifiers(normalizeCodeList(request.getOrderIdentifiers()));
query.setOrderIdentifiers(normalizeOrderIdentifiers(request.getOrderIdentifiers()));
query.setCustomerCodes(customerCodes);
query.setProductCodes(productCodes);
query.setCreditArrearsStatus(creditArrearsStatus);