remove: 删除无用代码

This commit is contained in:
ah--desktop
2026-04-09 22:58:43 +08:00
parent 534d052ae6
commit 24a14cff91
2 changed files with 16 additions and 61 deletions
@@ -162,11 +162,11 @@ public class ImportTaskProcessorServiceImpl implements ImportTaskProcessorServic
}
}
private static final int ORDER_BATCH_SIZE = 200;
private static final int RELATION_BATCH_SIZE = 200;
private static final int PROGRESS_UPDATE_INTERVAL_ROWS = 50;
private static final long PROGRESS_NOTIFY_INTERVAL_MS = 2000L;
private static final int IN_QUERY_BATCH_SIZE = 500;
private static final int ORDER_BATCH_SIZE = 500; // 订单批量插入大小
private static final int RELATION_BATCH_SIZE = 500; // 商品关系批量插入大小
private static final int PROGRESS_UPDATE_INTERVAL_ROWS = 50; // 进度更新间隔行数
private static final long PROGRESS_NOTIFY_INTERVAL_MS = 2000L; // 进度通知间隔时间
private static final int IN_QUERY_BATCH_SIZE = 500; // 内查询批量大小
private static class PendingOrderInsert {
private int rowNumber;
@@ -363,9 +363,6 @@ public class ImportTaskProcessorServiceImpl implements ImportTaskProcessorServic
fileInputStream = new java.io.BufferedInputStream(new java.io.FileInputStream(tempOssFile));
}
// 获取默认订单状态ID(尝试查找"未知状态",如果不存在则使用第一个状态,如果都没有则自动创建"待处理"状态)
Long defaultStatusId = getDefaultOrderStatusId(companyId, task.getCreateBy());
long lastProgressNotifyAt = 0L;
// 尝试多种编码读取CSV文件(常见的中文编码)
@@ -1774,47 +1771,7 @@ public class ImportTaskProcessorServiceImpl implements ImportTaskProcessorServic
// 默认返回GBK(中文CSV文件最常用)
return java.nio.charset.Charset.forName("GBK");
}
/**
* 获取默认订单状态ID(尝试查找"未知状态",如果不存在则使用第一个状态)
*
* @param companyId 公司ID
* @return 默认订单状态ID
*/
private Long getDefaultOrderStatusId(Long companyId) {
return getDefaultOrderStatusId(companyId, null);
}
/**
* 获取默认订单状态ID,如果没有则自动创建
*
* @param companyId 公司ID
* @param createBy 创建人ID(可选)
* @return 默认订单状态ID
*/
private Long getDefaultOrderStatusId(Long companyId, Long createBy) {
// 首先尝试查找"未知状态"
Long statusId = findOrderStatusIdByName(companyId, "未知状态");
if (statusId != null) {
return statusId;
}
// 如果找不到"未知状态",则使用第一个状态(按排序顺序)
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper<OrderStatusPO> wrapper =
new com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper<>();
wrapper.eq(OrderStatusPO::getCompanyId, companyId)
.orderByAsc(OrderStatusPO::getSortOrder)
.orderByDesc(OrderStatusPO::getCreateTime)
.last("LIMIT 1");
OrderStatusPO firstStatus = orderStatusService.getOne(wrapper);
if (firstStatus != null) {
return firstStatus.getId();
}
// 公司没有任何订单状态,自动创建一个默认的"待处理"状态
return createOrderStatusIfNotExists(companyId, "待处理", createBy, null);
}
/**
* 根据状态名称查找订单状态ID
*
@@ -1846,18 +1803,6 @@ public class ImportTaskProcessorServiceImpl implements ImportTaskProcessorServic
return statusId;
}
/**
* 如果订单状态不存在,则自动创建(不依赖CurrentUserContext)
*
* @param companyId 公司ID
* @param statusName 状态名称
* @param createBy 创建人ID
* @return 订单状态ID
*/
private Long createOrderStatusIfNotExists(Long companyId, String statusName, Long createBy) {
return createOrderStatusIfNotExists(companyId, statusName, createBy, null);
}
private Long createOrderStatusIfNotExists(Long companyId, String statusName, Long createBy, ImportRuntimeContext context) {
if (statusName == null || statusName.trim().isEmpty()) {
throw new BusinessException("订单状态名称不能为空");
@@ -1877,7 +1822,7 @@ public class ImportTaskProcessorServiceImpl implements ImportTaskProcessorServic
orderStatus.setStatusName(trimmedStatusName);
orderStatus.setDescription("自动创建的状态");
orderStatus.setSortOrder(0);
orderStatus.setAutoStatistics(0); // 自动参与统计字段设置为否(0)
orderStatus.setAutoStatistics(1); // 自动参与统计字段设置为是(1)
orderStatus.setCreateBy(createBy);
// 保存订单状态