⚡ 空表导入提示改为「未读取到数据行,请确认表头下方已填写内容」
原提示「导入数据不能为空」在用户上传「只有表头、未填数据行」的文件时容易误解 (文件并非空文件,只是没填内容)。全项目 27 个模块、30 处统一替换该文案。 验证:mvn install -DskipTests 通过;空表上传返回新文案; 13 个导入回归脚本 383 项断言全绿。
This commit is contained in:
+1
-1
@@ -127,7 +127,7 @@ public class AirportMasterServiceImpl extends BaseServiceImpl<AirportMasterMappe
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public List<AirportMasterExcel> importAirportMaster(List<AirportMasterExcel> data) {
|
||||
if (Func.isEmpty(data)) {
|
||||
throw new ServiceException("导入数据不能为空");
|
||||
throw new ServiceException("未读取到数据行,请确认表头下方已填写内容");
|
||||
}
|
||||
List<AirportMasterExcel> errorList = new ArrayList<>();
|
||||
List<AirportMaster> airportMasterList = new ArrayList<>();
|
||||
|
||||
+1
-1
@@ -138,7 +138,7 @@ public class CargoTypeServiceImpl extends BaseServiceImpl<CargoTypeMapper, Cargo
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public List<CargoTypeImportFailureExcel> importCargoType(List<CargoTypeExcel> data) {
|
||||
if (Func.isEmpty(data)) {
|
||||
throw new ServiceException("导入数据不能为空");
|
||||
throw new ServiceException("未读取到数据行,请确认表头下方已填写内容");
|
||||
}
|
||||
// 全量校验:任何一行失败都整批回滚,因此先收集所有错误再统一抛出。
|
||||
// 注意不能只往 errorList 里塞数据就 return——异常被吞掉后方法会正常返回,
|
||||
|
||||
+1
-1
@@ -118,7 +118,7 @@ public class CurrencyServiceImpl extends BaseServiceImpl<CurrencyMapper, Currenc
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public List<CurrencyExcel> importCurrency(List<CurrencyExcel> data) {
|
||||
if (Func.isEmpty(data)) {
|
||||
throw new ServiceException("导入数据不能为空");
|
||||
throw new ServiceException("未读取到数据行,请确认表头下方已填写内容");
|
||||
}
|
||||
// 全量校验:任何一行失败都整批回滚,因此先收集所有错误再统一抛出。
|
||||
// 注意:循环内除 save 外还有 rebuildEnabledValidity 这个派生写——
|
||||
|
||||
+1
-1
@@ -106,7 +106,7 @@ public class FeeItemServiceImpl extends BaseServiceImpl<FeeItemMapper, FeeItem>
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public List<FeeItemImportFailureExcel> importFeeItem(List<FeeItemExcel> data) {
|
||||
if (Func.isEmpty(data)) {
|
||||
throw new ServiceException("导入数据不能为空");
|
||||
throw new ServiceException("未读取到数据行,请确认表头下方已填写内容");
|
||||
}
|
||||
// 全量校验:任何一行失败都整批回滚,因此先收集所有错误再统一抛出。
|
||||
// 注意不能只往 failureList 里塞数据就 return——异常被吞掉后方法会正常返回,
|
||||
|
||||
+1
-1
@@ -140,7 +140,7 @@ public class PortTerminalServiceImpl extends BaseServiceImpl<PortTerminalMapper,
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public List<PortTerminalExcel> importPortTerminal(List<PortTerminalExcel> data) {
|
||||
if (Func.isEmpty(data)) {
|
||||
throw new ServiceException("导入数据不能为空");
|
||||
throw new ServiceException("未读取到数据行,请确认表头下方已填写内容");
|
||||
}
|
||||
// 全量校验:任何一行失败都整批回滚,因此先收集所有错误再统一抛出。
|
||||
List<PortTerminalExcel> failureList = new ArrayList<>();
|
||||
|
||||
+1
-1
@@ -129,7 +129,7 @@ public class RailwayStationServiceImpl extends BaseServiceImpl<RailwayStationMap
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public List<RailwayStationExcel> importRailwayStation(List<RailwayStationExcel> data) {
|
||||
if (Func.isEmpty(data)) {
|
||||
throw new ServiceException("导入数据不能为空");
|
||||
throw new ServiceException("未读取到数据行,请确认表头下方已填写内容");
|
||||
}
|
||||
List<RailwayStationExcel> errorList = new ArrayList<>();
|
||||
List<RailwayStation> railwayStationList = new ArrayList<>();
|
||||
|
||||
+1
-1
@@ -204,7 +204,7 @@ public class RegionServiceImpl extends ServiceImpl<RegionMapper, Region> impleme
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public List<RegionExcel> importRegion(List<RegionExcel> data, Boolean isCovered) {
|
||||
if (Func.isEmpty(data)) {
|
||||
throw new ServiceException("导入数据不能为空");
|
||||
throw new ServiceException("未读取到数据行,请确认表头下方已填写内容");
|
||||
}
|
||||
// 全量校验:任何一行失败都整批回滚,因此先收集所有错误再统一抛出。
|
||||
// 注意不能只往 errorList 里塞数据就 return——异常被吞掉后方法会正常返回,
|
||||
|
||||
+1
-1
@@ -86,7 +86,7 @@ public class AccidentRecordServiceImpl extends BaseServiceImpl<AccidentRecordMap
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public List<AccidentRecordExcel> importAccidentRecord(List<AccidentRecordExcel> data) {
|
||||
if (Func.isEmpty(data)) {
|
||||
throw new ServiceException("导入数据不能为空");
|
||||
throw new ServiceException("未读取到数据行,请确认表头下方已填写内容");
|
||||
}
|
||||
List<AccidentRecordExcel> errorList = new ArrayList<>();
|
||||
List<AccidentRecord> accidentRecordList = new ArrayList<>();
|
||||
|
||||
+1
-1
@@ -105,7 +105,7 @@ public class AnnualInspectionRecordServiceImpl extends BaseServiceImpl<AnnualIns
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public List<AnnualInspectionRecordExcel> importAnnualInspectionRecord(List<AnnualInspectionRecordExcel> data) {
|
||||
if (Func.isEmpty(data)) {
|
||||
throw new ServiceException("导入数据不能为空");
|
||||
throw new ServiceException("未读取到数据行,请确认表头下方已填写内容");
|
||||
}
|
||||
List<AnnualInspectionRecordExcel> errorList = new ArrayList<>();
|
||||
List<AnnualInspectionRecord> annualInspectionRecordList = new ArrayList<>();
|
||||
|
||||
+1
-1
@@ -142,7 +142,7 @@ public class CommonCargoServiceImpl extends BaseServiceImpl<CommonCargoMapper, C
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public List<CommonCargoImportFailureExcel> importCommonCargo(List<CommonCargoExcel> data) {
|
||||
if (Func.isEmpty(data)) {
|
||||
throw new ServiceException("导入数据不能为空");
|
||||
throw new ServiceException("未读取到数据行,请确认表头下方已填写内容");
|
||||
}
|
||||
// 全量校验:任何一行失败都整批回滚,因此先收集所有错误再统一抛出。
|
||||
// 注意:本方法虽已标注 @Transactional,但循环内把异常吞掉后正常 return,
|
||||
|
||||
+1
-1
@@ -129,7 +129,7 @@ public class CommonRouteServiceImpl extends BaseServiceImpl<CommonRouteMapper, C
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public List<CommonRouteImportExcel> importCommonRoute(List<CommonRouteImportExcel> data) {
|
||||
if (Func.isEmpty(data)) {
|
||||
throw new ServiceException("导入数据不能为空");
|
||||
throw new ServiceException("未读取到数据行,请确认表头下方已填写内容");
|
||||
}
|
||||
// 全量校验:任何一行失败都整批回滚,因此先收集所有错误再统一抛出。
|
||||
// 注意:本方法虽已标注 @Transactional,但循环内把异常吞掉后正常 return,
|
||||
|
||||
+1
-1
@@ -196,7 +196,7 @@ public class CreditScoreQuantificationServiceImpl extends BaseServiceImpl<Credit
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public List<CreditScoreQuantificationExcel> importCreditScoreQuantification(List<CreditScoreQuantificationExcel> data) {
|
||||
if (Func.isEmpty(data)) {
|
||||
throw new ServiceException("导入数据不能为空");
|
||||
throw new ServiceException("未读取到数据行,请确认表头下方已填写内容");
|
||||
}
|
||||
Map<String, List<CreditScoreQuantificationExcel>> dataMap = data.stream()
|
||||
.filter(row -> Func.isNotEmpty(trimToNull(row.getTableName())))
|
||||
|
||||
+1
-1
@@ -79,7 +79,7 @@ public class EquipmentLedgerServiceImpl extends BaseServiceImpl<EquipmentLedgerM
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public List<EquipmentLedgerExcel> importEquipmentLedger(List<EquipmentLedgerExcel> data) {
|
||||
if (Func.isEmpty(data)) {
|
||||
throw new ServiceException("导入数据不能为空");
|
||||
throw new ServiceException("未读取到数据行,请确认表头下方已填写内容");
|
||||
}
|
||||
List<EquipmentLedgerExcel> errorList = new ArrayList<>();
|
||||
List<EquipmentLedger> equipmentLedgerList = new ArrayList<>();
|
||||
|
||||
+1
-1
@@ -61,7 +61,7 @@ public class EtcRecordServiceImpl extends BaseServiceImpl<EtcRecordMapper, EtcRe
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public List<EtcRecordExcel> importEtcRecord(List<EtcRecordExcel> data) {
|
||||
if (Func.isEmpty(data)) {
|
||||
throw new ServiceException("导入数据不能为空");
|
||||
throw new ServiceException("未读取到数据行,请确认表头下方已填写内容");
|
||||
}
|
||||
List<EtcRecordExcel> errorList = new ArrayList<>();
|
||||
List<EtcRecord> etcRecordList = new ArrayList<>();
|
||||
|
||||
+1
-1
@@ -110,7 +110,7 @@ public class InsuranceRecordServiceImpl extends BaseServiceImpl<InsuranceRecordM
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public List<InsuranceRecordExcel> importInsuranceRecord(List<InsuranceRecordExcel> data) {
|
||||
if (Func.isEmpty(data)) {
|
||||
throw new ServiceException("导入数据不能为空");
|
||||
throw new ServiceException("未读取到数据行,请确认表头下方已填写内容");
|
||||
}
|
||||
List<InsuranceRecordExcel> errorList = new ArrayList<>();
|
||||
List<InsuranceRecord> insuranceRecordList = new ArrayList<>();
|
||||
|
||||
+1
-1
@@ -80,7 +80,7 @@ public class MaintenancePlanServiceImpl extends BaseServiceImpl<MaintenancePlanM
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public List<MaintenancePlanExcel> importMaintenancePlan(List<MaintenancePlanExcel> data) {
|
||||
if (Func.isEmpty(data)) {
|
||||
throw new ServiceException("导入数据不能为空");
|
||||
throw new ServiceException("未读取到数据行,请确认表头下方已填写内容");
|
||||
}
|
||||
List<MaintenancePlanExcel> errorList = new ArrayList<>();
|
||||
List<MaintenancePlan> maintenancePlanList = new ArrayList<>();
|
||||
|
||||
+1
-1
@@ -82,7 +82,7 @@ public class MaintenanceRecordServiceImpl extends BaseServiceImpl<MaintenanceRec
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public List<MaintenanceRecordExcel> importMaintenanceRecord(List<MaintenanceRecordExcel> data) {
|
||||
if (Func.isEmpty(data)) {
|
||||
throw new ServiceException("导入数据不能为空");
|
||||
throw new ServiceException("未读取到数据行,请确认表头下方已填写内容");
|
||||
}
|
||||
List<MaintenanceRecordExcel> errorList = new ArrayList<>();
|
||||
List<MaintenanceRecord> maintenanceRecordList = new ArrayList<>();
|
||||
|
||||
+1
-1
@@ -81,7 +81,7 @@ public class MileageRecordServiceImpl extends BaseServiceImpl<MileageRecordMappe
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public List<MileageRecordExcel> importMileageRecord(List<MileageRecordExcel> data) {
|
||||
if (Func.isEmpty(data)) {
|
||||
throw new ServiceException("导入数据不能为空");
|
||||
throw new ServiceException("未读取到数据行,请确认表头下方已填写内容");
|
||||
}
|
||||
List<MileageRecordExcel> errorList = new ArrayList<>();
|
||||
List<MileageRecord> mileageRecordList = new ArrayList<>();
|
||||
|
||||
+1
-1
@@ -70,7 +70,7 @@ public class OilElectricRecordServiceImpl extends BaseServiceImpl<OilElectricRec
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public List<OilElectricRecordExcel> importOilElectricRecord(List<OilElectricRecordExcel> data) {
|
||||
if (Func.isEmpty(data)) {
|
||||
throw new ServiceException("导入数据不能为空");
|
||||
throw new ServiceException("未读取到数据行,请确认表头下方已填写内容");
|
||||
}
|
||||
List<OilElectricRecordExcel> errorList = new ArrayList<>();
|
||||
List<OilElectricRecord> oilElectricRecordList = new ArrayList<>();
|
||||
|
||||
+1
-1
@@ -67,7 +67,7 @@ public class OtherExpenseRecordServiceImpl extends BaseServiceImpl<OtherExpenseR
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public List<OtherExpenseRecordExcel> importOtherExpenseRecord(List<OtherExpenseRecordExcel> data) {
|
||||
if (Func.isEmpty(data)) {
|
||||
throw new ServiceException("导入数据不能为空");
|
||||
throw new ServiceException("未读取到数据行,请确认表头下方已填写内容");
|
||||
}
|
||||
List<OtherExpenseRecordExcel> errorList = new ArrayList<>();
|
||||
List<OtherExpenseRecord> otherExpenseRecordList = new ArrayList<>();
|
||||
|
||||
+1
-1
@@ -173,7 +173,7 @@ public class ShippingTemplateServiceImpl extends BaseServiceImpl<ShippingTemplat
|
||||
@Override
|
||||
public List<ShippingTemplateGoodsExcel> importGoods(List<ShippingTemplateGoodsExcel> data) {
|
||||
if (Func.isEmpty(data)) {
|
||||
throw new ServiceException("导入数据不能为空");
|
||||
throw new ServiceException("未读取到数据行,请确认表头下方已填写内容");
|
||||
}
|
||||
List<ShippingTemplateGoodsExcel> failures = new ArrayList<>();
|
||||
for (int index = 0; index < data.size(); index++) {
|
||||
|
||||
+1
-1
@@ -82,7 +82,7 @@ public class TireReplacementRecordServiceImpl extends BaseServiceImpl<TireReplac
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public List<TireReplacementRecordExcel> importTireReplacementRecord(List<TireReplacementRecordExcel> data) {
|
||||
if (Func.isEmpty(data)) {
|
||||
throw new ServiceException("导入数据不能为空");
|
||||
throw new ServiceException("未读取到数据行,请确认表头下方已填写内容");
|
||||
}
|
||||
List<TireReplacementRecordExcel> errorList = new ArrayList<>();
|
||||
List<TireReplacementRecord> tireReplacementRecordList = new ArrayList<>();
|
||||
|
||||
+1
-1
@@ -81,7 +81,7 @@ public class TransportChangeRecordServiceImpl extends BaseServiceImpl<TransportC
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public List<TransportChangeRecordExcel> importTransportChangeRecord(List<TransportChangeRecordExcel> data) {
|
||||
if (Func.isEmpty(data)) {
|
||||
throw new ServiceException("导入数据不能为空");
|
||||
throw new ServiceException("未读取到数据行,请确认表头下方已填写内容");
|
||||
}
|
||||
List<TransportChangeRecordExcel> errorList = new ArrayList<>();
|
||||
List<TransportChangeRecord> transportChangeRecordList = new ArrayList<>();
|
||||
|
||||
+2
-2
@@ -198,7 +198,7 @@ public class TransportPlanServiceImpl extends BaseServiceImpl<TransportPlanMappe
|
||||
@Override
|
||||
public List<TransportPlanImportExcel> validateTransportPlan(List<TransportPlanImportExcel> data, Long projectId, String projectName, Long contractId, String contractName, String customerName) {
|
||||
if (Func.isEmpty(data)) {
|
||||
throw new ServiceException("导入数据不能为空");
|
||||
throw new ServiceException("未读取到数据行,请确认表头下方已填写内容");
|
||||
}
|
||||
if (Func.isEmpty(projectId)) {
|
||||
throw new ServiceException("项目不能为空");
|
||||
@@ -250,7 +250,7 @@ public class TransportPlanServiceImpl extends BaseServiceImpl<TransportPlanMappe
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public List<TransportPlanImportExcel> importTransportPlan(List<TransportPlanImportExcel> data, Long projectId, String projectName, Long contractId, String contractName, String customerName) {
|
||||
if (Func.isEmpty(data)) {
|
||||
throw new ServiceException("导入数据不能为空");
|
||||
throw new ServiceException("未读取到数据行,请确认表头下方已填写内容");
|
||||
}
|
||||
if (Func.isEmpty(projectId)) {
|
||||
throw new ServiceException("项目不能为空");
|
||||
|
||||
+3
-3
@@ -290,7 +290,7 @@ public class TransportReconciliationServiceImpl
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public List<VehicleReconciliationFailureExcel> importVehicles(Long id, List<VehicleReconciliationExcel> rows) {
|
||||
if (Func.isEmpty(rows)) throw new ServiceException("导入数据不能为空");
|
||||
if (Func.isEmpty(rows)) throw new ServiceException("未读取到数据行,请确认表头下方已填写内容");
|
||||
TransportReconciliation bill = editable(id);
|
||||
if (!VEHICLE.equals(bill.getReconciliationMode())) throw new ServiceException("当前对账模式不是整车总额对账");
|
||||
resetExternal(id);
|
||||
@@ -419,7 +419,7 @@ public class TransportReconciliationServiceImpl
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public List<CargoReconciliationFailureExcel> importCargoes(Long id, List<CargoReconciliationExcel> rows) {
|
||||
if (Func.isEmpty(rows)) throw new ServiceException("导入数据不能为空");
|
||||
if (Func.isEmpty(rows)) throw new ServiceException("未读取到数据行,请确认表头下方已填写内容");
|
||||
TransportReconciliation bill = editable(id);
|
||||
if (!CARGO.equals(bill.getReconciliationMode())) throw new ServiceException("当前对账模式不是货物明细对账");
|
||||
resetExternal(id);
|
||||
@@ -487,7 +487,7 @@ public class TransportReconciliationServiceImpl
|
||||
private List<String> validateImportCargo(CargoReconciliationExcel row) {
|
||||
List<String> validationErrors = new ArrayList<>();
|
||||
if (row == null) {
|
||||
validationErrors.add("导入数据不能为空");
|
||||
validationErrors.add("未读取到数据行,请确认表头下方已填写内容");
|
||||
return validationErrors;
|
||||
}
|
||||
org.springblade.common.excel.ImportFailureExcelUtil.addValidationError(validationErrors,
|
||||
|
||||
+1
-1
@@ -91,7 +91,7 @@ public class ViolationRecordServiceImpl extends BaseServiceImpl<ViolationRecordM
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public List<ViolationRecordImportExcel> importViolationRecord(List<ViolationRecordImportExcel> data) {
|
||||
if (Func.isEmpty(data)) {
|
||||
throw new ServiceException("导入数据不能为空");
|
||||
throw new ServiceException("未读取到数据行,请确认表头下方已填写内容");
|
||||
}
|
||||
List<ViolationRecordImportExcel> errorList = new ArrayList<>();
|
||||
List<ViolationRecord> violationRecordList = new ArrayList<>();
|
||||
|
||||
+1
-1
@@ -901,7 +901,7 @@ public class WaybillServiceImpl extends BaseServiceImpl<WaybillMapper, Waybill>
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public List<WaybillExcel> importWaybill(List<WaybillExcel> data) {
|
||||
if (Func.isEmpty(data)) {
|
||||
throw new ServiceException("导入数据不能为空");
|
||||
throw new ServiceException("未读取到数据行,请确认表头下方已填写内容");
|
||||
}
|
||||
List<WaybillExcel> errorList = new ArrayList<>();
|
||||
for (int index = 0; index < data.size(); index++) {
|
||||
|
||||
Reference in New Issue
Block a user