🐛 修复运单计划-1占位,并对账导入失败明细按原表全量列导出
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+6
-4
@@ -140,8 +140,9 @@ public class TransportReconciliationController extends BladeController {
|
||||
for (int index = 0; index < rows.size() && index < feeItems.size(); index++) rows.get(index).setFeeItems(feeItems.get(index));
|
||||
reconciliationService.importVehicles(id, rows);
|
||||
} catch (org.springblade.common.excel.ImportFailureException exception) {
|
||||
// 任一行失败即整批回滚,导出原表全部数据并标注错误(含按列标红)。
|
||||
ImportFailureExcelUtil.export(response, "运输对账导入失败明细" + DateUtil.time(), "导入失败明细", exception.getFailureList(), VehicleReconciliationExcel.class);
|
||||
// 按原表真实表头导出全量列(含动态费用),修正后可直接重新导入
|
||||
ImportFailureExcelUtil.exportOriginalWithFailures(response, "运输对账导入失败明细" + DateUtil.time(),
|
||||
"导入失败明细", file, exception.getFailureList(), VehicleReconciliationExcel.class);
|
||||
return null;
|
||||
} catch (Exception readException) {
|
||||
// 读取阶段异常兜底:单元格内容无法转换(如金额列填「一万二千元」)时,
|
||||
@@ -173,8 +174,9 @@ public class TransportReconciliationController extends BladeController {
|
||||
for (int index = 0; index < rows.size() && index < feeItems.size(); index++) rows.get(index).setFeeItems(feeItems.get(index));
|
||||
reconciliationService.importCargoes(id, rows);
|
||||
} catch (org.springblade.common.excel.ImportFailureException exception) {
|
||||
// 任一行失败即整批回滚,导出原表全部数据并标注错误(含按列标红)。
|
||||
ImportFailureExcelUtil.export(response, "运输对账导入失败明细" + DateUtil.time(), "导入失败明细", exception.getFailureList(), CargoReconciliationExcel.class);
|
||||
// 按原表真实表头导出全量列(含动态费用),修正后可直接重新导入
|
||||
ImportFailureExcelUtil.exportOriginalWithFailures(response, "运输对账导入失败明细" + DateUtil.time(),
|
||||
"导入失败明细", file, exception.getFailureList(), CargoReconciliationExcel.class);
|
||||
return null;
|
||||
} catch (Exception readException) {
|
||||
// 读取阶段异常兜底:单元格内容无法转换(如金额列填「一万二千元」)时,
|
||||
|
||||
+16
-4
@@ -406,11 +406,22 @@ public class WaybillImportBatchServiceImpl extends BaseServiceImpl<WaybillImport
|
||||
}
|
||||
batch.setProjectName(project.getProjectName());
|
||||
if (Func.isEmpty(batch.getCustomerName())) batch.setCustomerName(project.getCustomerNames());
|
||||
TransportPlan plan = Func.isEmpty(request.getPlanId()) ? null : transportPlanService.getById(request.getPlanId());
|
||||
if (plan != null) batch.setPlanName(plan.getPlanName());
|
||||
// BladeX 数字 null 序列化为 -1;未选计划时不得落库占位值
|
||||
Long planId = normalizeOptionalId(request.getPlanId());
|
||||
batch.setPlanId(planId);
|
||||
TransportPlan plan = planId == null ? null : transportPlanService.getById(planId);
|
||||
if (plan != null) {
|
||||
batch.setPlanName(plan.getPlanName());
|
||||
} else {
|
||||
batch.setPlanName(null);
|
||||
}
|
||||
return batch;
|
||||
}
|
||||
|
||||
private Long normalizeOptionalId(Long id) {
|
||||
return id == null || id <= 0L ? null : id;
|
||||
}
|
||||
|
||||
private Waybill buildWaybill(Map<String, Object> row, WaybillImportBatch batch, Long carrierContractId, boolean draft) {
|
||||
if (row == null) throw new ServiceException("运单数据不正确");
|
||||
Waybill waybill = new Waybill();
|
||||
@@ -461,8 +472,9 @@ public class WaybillImportBatchServiceImpl extends BaseServiceImpl<WaybillImport
|
||||
waybill.setCarrierId(firstCarrierId(batch.getCarrierIds()));
|
||||
waybill.setCarrierName(batch.getCarrierName());
|
||||
waybill.setCarrierContractId(carrierContractId);
|
||||
waybill.setPlanId(batch.getPlanId());
|
||||
waybill.setPlanName(batch.getPlanName());
|
||||
Long planId = normalizeOptionalId(batch.getPlanId());
|
||||
waybill.setPlanId(planId);
|
||||
waybill.setPlanName(planId == null ? null : batch.getPlanName());
|
||||
waybill.setImportBatchId(batch.getId());
|
||||
waybill.setBatchNo(batch.getBatchNo());
|
||||
waybill.setDataSource("批量导入");
|
||||
|
||||
+7
@@ -1418,6 +1418,13 @@ public class WaybillServiceImpl extends BaseServiceImpl<WaybillMapper, Waybill>
|
||||
waybill.setBusinessStatus(TransportBusinessSupport.trimToNull(waybill.getBusinessStatus()));
|
||||
waybill.setDataSource(TransportBusinessSupport.normalizeWaybillDataSource(waybill.getDataSource()));
|
||||
waybill.setPlanName(TransportBusinessSupport.trimToNull(waybill.getPlanName()));
|
||||
// BladeX 数字 null 序列化为 -1;未选计划时归一为空,避免占位值落库/回显
|
||||
if (waybill.getPlanId() != null && waybill.getPlanId() <= 0L) {
|
||||
waybill.setPlanId(null);
|
||||
}
|
||||
if (waybill.getPlanId() == null || "-1".equals(waybill.getPlanName())) {
|
||||
waybill.setPlanName(null);
|
||||
}
|
||||
waybill.setMasterNo(TransportBusinessSupport.trimToNull(waybill.getMasterNo()));
|
||||
waybill.setLoadingNo(TransportBusinessSupport.trimToNull(waybill.getLoadingNo()));
|
||||
waybill.setLoadingIdentifier(TransportBusinessSupport.trimToNull(waybill.getLoadingIdentifier()));
|
||||
|
||||
+7
@@ -72,6 +72,13 @@ public class WaybillWrapper extends BaseEntityWrapper<Waybill, WaybillVO> {
|
||||
if (isSentinelMinusOne(waybillVO.getUnitPrice())) {
|
||||
waybillVO.setUnitPrice(null);
|
||||
}
|
||||
// 计划未选时 planId 可能为库内 -1 或序列化占位,统一清空避免前端回显 -1
|
||||
if (waybillVO.getPlanId() != null && waybillVO.getPlanId() <= 0L) {
|
||||
waybillVO.setPlanId(null);
|
||||
}
|
||||
if (waybillVO.getPlanId() == null || "-1".equals(waybillVO.getPlanName())) {
|
||||
waybillVO.setPlanName(null);
|
||||
}
|
||||
return waybillVO;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user