|
|
@ -10,6 +10,7 @@ import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
import java.util.HashMap; |
|
|
import java.util.HashMap; |
|
|
import java.util.List; |
|
|
import java.util.List; |
|
|
import java.util.Map; |
|
|
import java.util.Map; |
|
|
@ -99,9 +100,14 @@ public class CountingReportServiceImpl implements CountingReportService { |
|
|
detail.setCreateBy(countingReport.getCreateBy()); |
|
|
detail.setCreateBy(countingReport.getCreateBy()); |
|
|
detail.setUpdateBy(countingReport.getUpdateBy()); |
|
|
detail.setUpdateBy(countingReport.getUpdateBy()); |
|
|
} |
|
|
} |
|
|
// 批量保存明细 |
|
|
|
|
|
countingReportMapper.batchSaveDetail(detailList); |
|
|
|
|
|
logger.info("批量新增盘点单明细成功,明细数: {}", detailList.size()); |
|
|
|
|
|
|
|
|
// 分批保存明细,每批100条,避免 SQL Server 2100 参数上限(每条13个参数,100条=1300个参数) |
|
|
|
|
|
final int BATCH_SIZE = 100; |
|
|
|
|
|
int total = detailList.size(); |
|
|
|
|
|
for (int i = 0; i < total; i += BATCH_SIZE) { |
|
|
|
|
|
List<CountingReportDetail> batch = new ArrayList<>(detailList.subList(i, Math.min(i + BATCH_SIZE, total))); |
|
|
|
|
|
countingReportMapper.batchSaveDetail(batch); |
|
|
|
|
|
} |
|
|
|
|
|
logger.info("批量新增盘点单明细成功,明细数: {}", total); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
return result; |
|
|
return result; |
|
|
@ -242,6 +248,32 @@ public class CountingReportServiceImpl implements CountingReportService { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
public int queryDetailTotal(Map<String, Object> params) { |
|
|
|
|
|
logger.info("查询盘点单明细总数,参数: {}", params); |
|
|
|
|
|
try { |
|
|
|
|
|
int total = countingReportMapper.queryDetailTotal(params); |
|
|
|
|
|
logger.info("查询盘点单明细总数成功,总数: {}", total); |
|
|
|
|
|
return total; |
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
logger.error("查询盘点单明细总数失败,错误信息: {}", e.getMessage(), e); |
|
|
|
|
|
throw new RuntimeException("查询盘点单明细总数失败: " + e.getMessage(), e); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
public Map<String, Object> queryDetailStatistics(Map<String, Object> params) { |
|
|
|
|
|
logger.info("查询盘点单明细统计信息,参数: {}", params); |
|
|
|
|
|
try { |
|
|
|
|
|
Map<String, Object> statistics = countingReportMapper.queryDetailStatistics(params); |
|
|
|
|
|
logger.info("查询盘点单明细统计信息成功"); |
|
|
|
|
|
return statistics; |
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
logger.error("查询盘点单明细统计信息失败,错误信息: {}", e.getMessage(), e); |
|
|
|
|
|
throw new RuntimeException("查询盘点单明细统计信息失败: " + e.getMessage(), e); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public String generateReportId(String site, String buNo, String type) { |
|
|
public String generateReportId(String site, String buNo, String type) { |
|
|
logger.info("生成盘点任务单号,站点: {}, BU: {}, 类型: {}", site, buNo, type); |
|
|
logger.info("生成盘点任务单号,站点: {}, BU: {}, 类型: {}", site, buNo, type); |
|
|
|