增加异常订单功能

This commit is contained in:
wuweihua
2026-09-23 09:25:24 +08:00
parent 6d2e05951d
commit 574ce772b2
7 changed files with 495 additions and 3 deletions
@@ -1,5 +1,6 @@
package com.ruoyi.price.service;
import java.util.List;
import com.ruoyi.price.domain.PrcBillingTask;
import com.ruoyi.price.domain.vo.BillingTaskSubmitRequest;
@@ -12,4 +13,13 @@ public interface IPrcBillingTaskService
void processTask(Long taskId);
PrcBillingTask getById(Long taskId);
/** Admin list (failed / waiting / filter). */
List<PrcBillingTask> selectList(PrcBillingTask query);
/**
* Manual resync: reset to WAITING then process again.
* @return task after retry
*/
PrcBillingTask retryTask(Long taskId);
}
@@ -2,6 +2,7 @@ package com.ruoyi.price.service.impl;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.Map;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -255,6 +256,41 @@ public class PrcBillingTaskServiceImpl implements IPrcBillingTaskService
return billingTaskMapper.selectPrcBillingTaskById(taskId);
}
@Override
public List<PrcBillingTask> selectList(PrcBillingTask query)
{
return billingTaskMapper.selectPrcBillingTaskList(query);
}
@Override
public PrcBillingTask retryTask(Long taskId)
{
if (taskId == null)
{
throw new ServiceException("taskId required");
}
PrcBillingTask task = billingTaskMapper.selectPrcBillingTaskById(taskId);
if (task == null)
{
throw new ServiceException("billing task not found");
}
String st = task.getSuccessStatus();
if (BillTaskSuccessStatus.SUCCESS.getCode().equals(st))
{
throw new ServiceException("SUCCESS task cannot retry");
}
// Reset to WAITING so UI reflects re-queue; then sync process (admin expects immediate result).
PrcBillingTask reset = new PrcBillingTask();
reset.setTaskId(taskId);
reset.setSuccessStatus(BillTaskSuccessStatus.WAITING.getCode());
reset.setBillId(null);
reset.setErrorMessage(null);
billingTaskMapper.updateBillingResult(reset);
processTask(taskId);
return billingTaskMapper.selectPrcBillingTaskById(taskId);
}
private BillTaskType resolveAutoType(String transferNo, String trackingNo, String orderNo)
{
PrcOrderBill existed = null;