修改计费重

This commit is contained in:
wuweihua
2026-10-13 17:12:32 +08:00
parent 5c48717da2
commit d6a6ec4d53
17 changed files with 294 additions and 14 deletions
@@ -160,6 +160,15 @@ public class TabOrderSyncAsyncRunner
/** Sync selected rows with a short-lived worker pool (for HTTP syncSelected). */
public Map<String, Object> syncRowsParallel(List<TabOrderMonitorVo> rows)
{
return syncRowsParallel(rows, null);
}
/**
* Sync or refund selected rows.
* @param billType optional PENDING/REBILL/REFUND; null = auto PENDING/REBILL
*/
public Map<String, Object> syncRowsParallel(List<TabOrderMonitorVo> rows, String billType)
{
Map<String, Object> data = new HashMap<String, Object>();
List<Map<String, Object>> details = new ArrayList<Map<String, Object>>();
@@ -170,6 +179,7 @@ public class TabOrderSyncAsyncRunner
data.put("details", details);
return data;
}
final String fixedBillType = StringUtils.isEmpty(billType) ? null : billType.trim();
int threads = Math.min(clampThreads(billingProperties == null ? null : billingProperties.getOrderSourceSyncThreads()),
Math.max(1, rows.size()));
ExecutorService pool = newWorkerPool(threads, "order-source-sel");
@@ -187,9 +197,10 @@ public class TabOrderSyncAsyncRunner
item.put("transferOrderId", one == null ? null : one.getTransferOrderId());
try
{
PrcBillingTask task = billingTaskService.submitAndProcess(toSubmit(one));
PrcBillingTask task = billingTaskService.submitAndProcess(toSubmit(one, fixedBillType));
item.put("successStatus", task == null ? null : task.getSuccessStatus());
item.put("errorMessage", task == null ? null : task.getErrorMessage());
item.put("billType", task == null ? fixedBillType : task.getBillType());
if (task != null && BillTaskSuccessStatus.SUCCESS.getCode().equals(task.getSuccessStatus()))
{
ok.incrementAndGet();
@@ -204,6 +215,7 @@ public class TabOrderSyncAsyncRunner
fail.incrementAndGet();
item.put("successStatus", "ERROR");
item.put("errorMessage", e.getMessage());
item.put("billType", fixedBillType);
}
return item;
});
@@ -357,6 +369,11 @@ public class TabOrderSyncAsyncRunner
}
public static BillingTaskSubmitRequest toSubmit(TabOrderMonitorVo row)
{
return toSubmit(row, null);
}
public static BillingTaskSubmitRequest toSubmit(TabOrderMonitorVo row, String billType)
{
if (row == null)
{
@@ -368,6 +385,10 @@ public class TabOrderSyncAsyncRunner
req.setOrderNo(row.getOrderId());
req.setCustomerCode(row.getCustomerCode());
req.setBillTime(row.getPickupDate());
if (StringUtils.isNotEmpty(billType))
{
req.setBillType(billType.trim());
}
return req;
}
}