提速修改计费重
This commit is contained in:
+31
-8
@@ -1851,6 +1851,36 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
|
||||
}
|
||||
dedup.put(orderNo, row);
|
||||
}
|
||||
if (dedup.size() > CHARGE_WEIGHT_IMPORT_MAX)
|
||||
{
|
||||
throw new ServiceException("导入行数超限,最多 "
|
||||
+ CHARGE_WEIGHT_IMPORT_MAX + " 条");
|
||||
}
|
||||
|
||||
// Batch load bills with data-scope (chunked IN), avoid N+1 select + getBill
|
||||
java.util.Map<String, PrcOrderBill> billByOrderNo = new java.util.HashMap<String, PrcOrderBill>();
|
||||
List<String> allOrderNos = new ArrayList<String>(dedup.keySet());
|
||||
final int chunkSize = 500;
|
||||
for (int from = 0; from < allOrderNos.size(); from += chunkSize)
|
||||
{
|
||||
int to = Math.min(from + chunkSize, allOrderNos.size());
|
||||
List<String> chunk = new ArrayList<String>(allOrderNos.subList(from, to));
|
||||
PrcOrderBill query = new PrcOrderBill();
|
||||
query.setOrderNos(chunk);
|
||||
List<PrcOrderBill> scoped = self.selectBillList(query);
|
||||
if (scoped != null)
|
||||
{
|
||||
for (PrcOrderBill bill : scoped)
|
||||
{
|
||||
if (bill == null || StringUtils.isEmpty(bill.getOrderNo()))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
billByOrderNo.put(bill.getOrderNo().trim(), bill);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
List<ChargeWeightImportWorkItem> items = new ArrayList<ChargeWeightImportWorkItem>();
|
||||
for (java.util.Map.Entry<String, ChargeWeightImportRow> entry : dedup.entrySet())
|
||||
{
|
||||
@@ -1867,13 +1897,11 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
|
||||
{
|
||||
throw new ServiceException("客户不能为空");
|
||||
}
|
||||
PrcOrderBill bill = orderBillMapper.selectPrcOrderBillByOrderNo(orderNo);
|
||||
PrcOrderBill bill = billByOrderNo.get(orderNo);
|
||||
if (bill == null)
|
||||
{
|
||||
throw new ServiceException("订单不存在");
|
||||
}
|
||||
// data-scope in request thread
|
||||
self.getBill(bill.getBillId());
|
||||
if (!customerMatches(bill, customer))
|
||||
{
|
||||
throw new ServiceException("客户与订单不匹配");
|
||||
@@ -1903,11 +1931,6 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
|
||||
{
|
||||
throw new ServiceException("导入数据不能为空");
|
||||
}
|
||||
if (items.size() > CHARGE_WEIGHT_IMPORT_MAX)
|
||||
{
|
||||
throw new ServiceException("导入行数超限,最多 "
|
||||
+ CHARGE_WEIGHT_IMPORT_MAX + " 条");
|
||||
}
|
||||
String taskId = IdUtils.fastSimpleUUID();
|
||||
int total = items.size() + initialFail;
|
||||
chargeWeightImportAsyncRunner.put(taskId, ChargeWeightImportTask.STATUS_PENDING, 0, "queued",
|
||||
|
||||
Reference in New Issue
Block a user