This commit is contained in:
2026-08-26 23:17:56 +08:00
parent 792a988c11
commit b750f6ecf0
50 changed files with 227 additions and 94 deletions
@@ -74,6 +74,9 @@ public class DriverExcel implements Serializable {
@ExcelProperty("住址")
private String address;
@ExcelProperty("驾驶车辆")
private String drivingVehicle;
@ExcelProperty("岗位 *")
private String posts;
@@ -37,7 +37,7 @@ public class OilElectricRecordExcel implements Serializable {
@ExcelIgnore
private Long id;
@ExcelIgnore
@ExcelProperty("卡号")
private String cardNo;
@ExcelProperty("*交易时间")
@@ -20,6 +20,7 @@
<result column="education" property="education"/>
<result column="address_region" property="addressRegion"/>
<result column="address" property="address"/>
<result column="driving_vehicle" property="drivingVehicle"/>
<result column="posts" property="posts"/>
<result column="id_card_front" property="idCardFront"/>
<result column="id_card_back" property="idCardBack"/>
@@ -64,6 +65,7 @@
education,
address_region,
address,
driving_vehicle,
posts,
id_card_front,
id_card_back,
@@ -51,7 +51,7 @@
contact,
address,
factory_time,
CASE WHEN mileage &lt; 0 THEN 0 ELSE mileage END AS mileage,
CASE WHEN mileage = -1 THEN NULL WHEN mileage &lt; 0 THEN 0 ELSE mileage END AS mileage,
mileage_unit,
attachments,
remark
@@ -97,7 +97,7 @@ public class AccidentRecordServiceImpl extends BaseServiceImpl<AccidentRecordMap
prepare(accidentRecord);
List<String> validationErrors = validateImportAccidentRecord(accidentRecord);
if (Func.isNotEmpty(validationErrors)) {
excel.setErrorMessage(org.springblade.common.excel.ImportFailureExcelUtil.formatErrorMessage(index + 2, validationErrors));
excel.setErrorMessage(org.springblade.common.excel.ImportFailureExcelUtil.formatErrorMessage(validationErrors));
errorList.add(excel);
continue;
}
@@ -105,7 +105,7 @@ public class AccidentRecordServiceImpl extends BaseServiceImpl<AccidentRecordMap
accidentRecordList.add(accidentRecord);
} catch (Exception exception) {
String message = exception instanceof ServiceException ? exception.getMessage() : "导入失败";
excel.setErrorMessage(org.springblade.common.excel.ImportFailureExcelUtil.formatErrorMessage(index + 2, List.of(message)));
excel.setErrorMessage(org.springblade.common.excel.ImportFailureExcelUtil.formatErrorMessage(List.of(message)));
errorList.add(excel);
}
}
@@ -96,7 +96,7 @@ public class AnnualInspectionRecordServiceImpl extends BaseServiceImpl<AnnualIns
prepare(annualInspectionRecord);
List<String> validationErrors = validateImportAnnualInspectionRecord(annualInspectionRecord);
if (Func.isNotEmpty(validationErrors)) {
excel.setErrorMessage(org.springblade.common.excel.ImportFailureExcelUtil.formatErrorMessage(index + 2, validationErrors));
excel.setErrorMessage(org.springblade.common.excel.ImportFailureExcelUtil.formatErrorMessage(validationErrors));
errorList.add(excel);
continue;
}
@@ -104,7 +104,7 @@ public class AnnualInspectionRecordServiceImpl extends BaseServiceImpl<AnnualIns
annualInspectionRecordList.add(annualInspectionRecord);
} catch (Exception exception) {
String message = exception instanceof ServiceException ? exception.getMessage() : "导入失败";
excel.setErrorMessage(org.springblade.common.excel.ImportFailureExcelUtil.formatErrorMessage(index + 2, List.of(message)));
excel.setErrorMessage(org.springblade.common.excel.ImportFailureExcelUtil.formatErrorMessage(List.of(message)));
errorList.add(excel);
}
}
@@ -455,10 +455,10 @@ public class ContractManageServiceImpl extends BaseServiceImpl<ContractManageMap
}
private void normalizeOptionalIntegerFields(ContractManage contractManage) {
if (contractManage.getCopyCount() != null && contractManage.getCopyCount() < 0) {
if (contractManage.getCopyCount() != null && contractManage.getCopyCount() <= 0) {
contractManage.setCopyCount(null);
}
if (contractManage.getPaymentDays() != null && contractManage.getPaymentDays() < 0) {
if (contractManage.getPaymentDays() != null && contractManage.getPaymentDays() <= 0) {
contractManage.setPaymentDays(null);
}
}
@@ -55,6 +55,7 @@ public class DriverServiceImpl extends BaseServiceImpl<DriverMapper, Driver> imp
private static final int NAME_MAX_LENGTH = 10;
private static final int ID_CARD_MAX_LENGTH = 18;
private static final int MOBILE_MAX_LENGTH = 20;
private static final int VEHICLE_NO_MAX_LENGTH = 30;
private static final int SHORT_TEXT_MAX_LENGTH = 50;
private static final int ADDRESS_MAX_LENGTH = 200;
private static final int REMARK_MAX_LENGTH = 200;
@@ -132,6 +133,8 @@ public class DriverServiceImpl extends BaseServiceImpl<DriverMapper, Driver> imp
driver.setEducation(trimToNull(driver.getEducation()));
driver.setAddressRegion(trimToNull(driver.getAddressRegion()));
driver.setAddress(trimToNull(driver.getAddress()));
String drivingVehicle = trimToNull(driver.getDrivingVehicle());
driver.setDrivingVehicle(drivingVehicle == null ? null : drivingVehicle.toUpperCase());
driver.setPosts(trimToNull(driver.getPosts()));
driver.setDrivingType(trimToEmpty(driver.getDrivingType()).toUpperCase());
driver.setDrivingLicenseNo(trimToNull(driver.getDrivingLicenseNo()));
@@ -224,6 +227,7 @@ public class DriverServiceImpl extends BaseServiceImpl<DriverMapper, Driver> imp
validateLength(driver.getIdCardNo(), ID_CARD_MAX_LENGTH, "身份证号不能超过18字");
validateLength(driver.getMobile(), MOBILE_MAX_LENGTH, "手机号不能超过20字");
validateLength(driver.getEmergencyContactMobile(), MOBILE_MAX_LENGTH, "紧急联系人手机号不能超过20字");
validateLength(driver.getDrivingVehicle(), VEHICLE_NO_MAX_LENGTH, "驾驶车辆不能超过30字");
validateLength(driver.getDrivingLicenseNo(), SHORT_TEXT_MAX_LENGTH, "驾驶证档案编号不能超过50字");
validateLength(driver.getQualificationNo(), SHORT_TEXT_MAX_LENGTH, "资格证号不能超过50字");
validateLength(driver.getOrganizationName(), SHORT_TEXT_MAX_LENGTH, "所属组织不能超过50字");
@@ -84,7 +84,7 @@ public class EquipmentLedgerServiceImpl extends BaseServiceImpl<EquipmentLedgerM
org.springblade.common.excel.ImportFailureExcelUtil.addValidationError(validationErrors,
!importEquipmentCodes.add(equipmentLedger.getEquipmentCode()), "设备编号在本次导入中重复");
if (Func.isNotEmpty(validationErrors)) {
excel.setErrorMessage(org.springblade.common.excel.ImportFailureExcelUtil.formatErrorMessage(index + 2, validationErrors));
excel.setErrorMessage(org.springblade.common.excel.ImportFailureExcelUtil.formatErrorMessage(validationErrors));
errorList.add(excel);
continue;
}
@@ -92,7 +92,7 @@ public class EquipmentLedgerServiceImpl extends BaseServiceImpl<EquipmentLedgerM
equipmentLedgerList.add(equipmentLedger);
} catch (Exception exception) {
String message = exception instanceof ServiceException ? exception.getMessage() : "导入失败";
excel.setErrorMessage(org.springblade.common.excel.ImportFailureExcelUtil.formatErrorMessage(index + 2, List.of(message)));
excel.setErrorMessage(org.springblade.common.excel.ImportFailureExcelUtil.formatErrorMessage(List.of(message)));
errorList.add(excel);
}
}
@@ -73,14 +73,14 @@ public class EtcRecordServiceImpl extends BaseServiceImpl<EtcRecordMapper, EtcRe
prepare(etcRecord);
List<String> validationErrors = validateImportEtcRecord(etcRecord);
if (Func.isNotEmpty(validationErrors)) {
excel.setErrorMessage(org.springblade.common.excel.ImportFailureExcelUtil.formatErrorMessage(index + 2, validationErrors));
excel.setErrorMessage(org.springblade.common.excel.ImportFailureExcelUtil.formatErrorMessage(validationErrors));
errorList.add(excel);
continue;
}
etcRecordList.add(etcRecord);
} catch (Exception exception) {
String message = exception instanceof ServiceException ? exception.getMessage() : "导入失败";
excel.setErrorMessage(org.springblade.common.excel.ImportFailureExcelUtil.formatErrorMessage(index + 2, List.of(message)));
excel.setErrorMessage(org.springblade.common.excel.ImportFailureExcelUtil.formatErrorMessage(List.of(message)));
errorList.add(excel);
}
}
@@ -125,7 +125,7 @@ public class InsuranceRecordServiceImpl extends BaseServiceImpl<InsuranceRecordM
org.springblade.common.excel.ImportFailureExcelUtil.addValidationError(validationErrors, !importPolicyKeys.add(policyKey), "同一车船类型和保险类型下保单号在本次导入中重复");
}
if (Func.isNotEmpty(validationErrors)) {
excel.setErrorMessage(org.springblade.common.excel.ImportFailureExcelUtil.formatErrorMessage(index + 2, validationErrors));
excel.setErrorMessage(org.springblade.common.excel.ImportFailureExcelUtil.formatErrorMessage(validationErrors));
errorList.add(excel);
continue;
}
@@ -133,7 +133,7 @@ public class InsuranceRecordServiceImpl extends BaseServiceImpl<InsuranceRecordM
insuranceRecordList.add(insuranceRecord);
} catch (Exception exception) {
String message = exception instanceof ServiceException ? exception.getMessage() : "导入失败";
excel.setErrorMessage(org.springblade.common.excel.ImportFailureExcelUtil.formatErrorMessage(index + 2, List.of(message)));
excel.setErrorMessage(org.springblade.common.excel.ImportFailureExcelUtil.formatErrorMessage(List.of(message)));
errorList.add(excel);
}
}
@@ -90,14 +90,14 @@ public class MaintenancePlanServiceImpl extends BaseServiceImpl<MaintenancePlanM
prepare(maintenancePlan);
List<String> validationErrors = validateImportMaintenancePlan(maintenancePlan);
if (Func.isNotEmpty(validationErrors)) {
excel.setErrorMessage(org.springblade.common.excel.ImportFailureExcelUtil.formatErrorMessage(index + 2, validationErrors));
excel.setErrorMessage(org.springblade.common.excel.ImportFailureExcelUtil.formatErrorMessage(validationErrors));
errorList.add(excel);
continue;
}
maintenancePlanList.add(maintenancePlan);
} catch (Exception exception) {
String message = exception instanceof ServiceException ? exception.getMessage() : "导入失败";
excel.setErrorMessage(org.springblade.common.excel.ImportFailureExcelUtil.formatErrorMessage(index + 2, List.of(message)));
excel.setErrorMessage(org.springblade.common.excel.ImportFailureExcelUtil.formatErrorMessage(List.of(message)));
errorList.add(excel);
}
}
@@ -61,6 +61,7 @@ public class MaintenanceRecordServiceImpl extends BaseServiceImpl<MaintenanceRec
private static final int REPLACED_PART_MAX_LENGTH = 200;
private static final int ADDRESS_MAX_LENGTH = 100;
private static final int REMARK_MAX_LENGTH = 500;
private static final BigDecimal EMPTY_MILEAGE_SENTINEL = BigDecimal.valueOf(-1);
@Override
public IPage<MaintenanceRecordVO> selectMaintenanceRecordPage(IPage<MaintenanceRecordVO> page, MaintenanceRecordVO maintenanceRecord) {
@@ -94,14 +95,14 @@ public class MaintenanceRecordServiceImpl extends BaseServiceImpl<MaintenanceRec
prepare(maintenanceRecord);
List<String> validationErrors = validateImportMaintenanceRecord(maintenanceRecord);
if (Func.isNotEmpty(validationErrors)) {
excel.setErrorMessage(org.springblade.common.excel.ImportFailureExcelUtil.formatErrorMessage(index + 2, validationErrors));
excel.setErrorMessage(org.springblade.common.excel.ImportFailureExcelUtil.formatErrorMessage(validationErrors));
errorList.add(excel);
continue;
}
maintenanceRecordList.add(maintenanceRecord);
} catch (Exception exception) {
String message = exception instanceof ServiceException ? exception.getMessage() : "导入失败";
excel.setErrorMessage(org.springblade.common.excel.ImportFailureExcelUtil.formatErrorMessage(index + 2, List.of(message)));
excel.setErrorMessage(org.springblade.common.excel.ImportFailureExcelUtil.formatErrorMessage(List.of(message)));
errorList.add(excel);
}
}
@@ -141,7 +142,7 @@ public class MaintenanceRecordServiceImpl extends BaseServiceImpl<MaintenanceRec
return list(queryWrapper).stream().map(maintenanceRecord -> {
MaintenanceRecordExportExcel excel = Objects.requireNonNull(BeanUtil.copyProperties(maintenanceRecord, MaintenanceRecordExportExcel.class));
excel.setCost(scaleAmount(maintenanceRecord.getCost()));
excel.setMileage(scaleAmount(nonNegative(maintenanceRecord.getMileage())));
excel.setMileage(scaleAmount(nonNegative(normalizeMileage(maintenanceRecord.getMileage()))));
excel.setUpdateUserName(UserCache.getUserRealName(maintenanceRecord.getUpdateUser()));
if (Func.isEmpty(excel.getMileageUnit())) {
excel.setMileageUnit(defaultMileageUnit(maintenanceRecord.getVehicleType()));
@@ -159,6 +160,7 @@ public class MaintenanceRecordServiceImpl extends BaseServiceImpl<MaintenanceRec
maintenanceRecord.setCompany(trimToNull(maintenanceRecord.getCompany()));
maintenanceRecord.setContact(trimToNull(maintenanceRecord.getContact()));
maintenanceRecord.setAddress(trimToNull(maintenanceRecord.getAddress()));
maintenanceRecord.setMileage(normalizeMileage(maintenanceRecord.getMileage()));
maintenanceRecord.setRemark(trimToNull(maintenanceRecord.getRemark()));
if (Func.isEmpty(maintenanceRecord.getMileageUnit())) {
maintenanceRecord.setMileageUnit(defaultMileageUnit(maintenanceRecord.getVehicleType()));
@@ -213,6 +215,10 @@ public class MaintenanceRecordServiceImpl extends BaseServiceImpl<MaintenanceRec
return BigDecimal.ZERO;
}
private BigDecimal normalizeMileage(BigDecimal mileage) {
return Func.isNotEmpty(mileage) && mileage.compareTo(EMPTY_MILEAGE_SENTINEL) == 0 ? null : mileage;
}
private BigDecimal scaleAmount(BigDecimal value) {
return Func.isEmpty(value) ? null : value.setScale(2, RoundingMode.HALF_UP);
}
@@ -92,7 +92,7 @@ public class MileageRecordServiceImpl extends BaseServiceImpl<MileageRecordMappe
prepare(mileageRecord);
List<String> validationErrors = validateImportMileageRecord(mileageRecord);
if (Func.isNotEmpty(validationErrors)) {
excel.setErrorMessage(org.springblade.common.excel.ImportFailureExcelUtil.formatErrorMessage(index + 2, validationErrors));
excel.setErrorMessage(org.springblade.common.excel.ImportFailureExcelUtil.formatErrorMessage(validationErrors));
errorList.add(excel);
continue;
}
@@ -100,7 +100,7 @@ public class MileageRecordServiceImpl extends BaseServiceImpl<MileageRecordMappe
mileageRecordList.add(mileageRecord);
} catch (Exception exception) {
String message = exception instanceof ServiceException ? exception.getMessage() : "导入失败";
excel.setErrorMessage(org.springblade.common.excel.ImportFailureExcelUtil.formatErrorMessage(index + 2, List.of(message)));
excel.setErrorMessage(org.springblade.common.excel.ImportFailureExcelUtil.formatErrorMessage(List.of(message)));
errorList.add(excel);
}
}
@@ -78,18 +78,18 @@ public class OilElectricRecordServiceImpl extends BaseServiceImpl<OilElectricRec
OilElectricRecordExcel excel = data.get(index);
try {
OilElectricRecord oilElectricRecord = Objects.requireNonNull(BeanUtil.copyProperties(excel, OilElectricRecord.class));
oilElectricRecord.setDataSource(defaultDataSource(oilElectricRecord.getDataSource()));
oilElectricRecord.setDataSource("批量导入");
prepare(oilElectricRecord);
List<String> validationErrors = validateImportOilElectricRecord(oilElectricRecord);
if (Func.isNotEmpty(validationErrors)) {
excel.setErrorMessage(org.springblade.common.excel.ImportFailureExcelUtil.formatErrorMessage(index + 2, validationErrors));
excel.setErrorMessage(org.springblade.common.excel.ImportFailureExcelUtil.formatErrorMessage(validationErrors));
errorList.add(excel);
continue;
}
oilElectricRecordList.add(oilElectricRecord);
} catch (Exception exception) {
String message = exception instanceof ServiceException ? exception.getMessage() : "导入失败";
excel.setErrorMessage(org.springblade.common.excel.ImportFailureExcelUtil.formatErrorMessage(index + 2, List.of(message)));
excel.setErrorMessage(org.springblade.common.excel.ImportFailureExcelUtil.formatErrorMessage(List.of(message)));
errorList.add(excel);
}
}
@@ -76,14 +76,14 @@ public class OtherExpenseRecordServiceImpl extends BaseServiceImpl<OtherExpenseR
prepare(otherExpenseRecord);
List<String> validationErrors = validateImportOtherExpenseRecord(otherExpenseRecord);
if (Func.isNotEmpty(validationErrors)) {
excel.setErrorMessage(org.springblade.common.excel.ImportFailureExcelUtil.formatErrorMessage(index + 2, validationErrors));
excel.setErrorMessage(org.springblade.common.excel.ImportFailureExcelUtil.formatErrorMessage(validationErrors));
errorList.add(excel);
continue;
}
otherExpenseRecordList.add(otherExpenseRecord);
} catch (Exception exception) {
String message = exception instanceof ServiceException ? exception.getMessage() : "导入失败";
excel.setErrorMessage(org.springblade.common.excel.ImportFailureExcelUtil.formatErrorMessage(index + 2, List.of(message)));
excel.setErrorMessage(org.springblade.common.excel.ImportFailureExcelUtil.formatErrorMessage(List.of(message)));
errorList.add(excel);
}
}
@@ -84,7 +84,7 @@ public class ProjectApplyServiceImpl extends BaseServiceImpl<ProjectApplyMapper,
@Override
public ProjectApplyVO detail(Long id) {
ProjectApplyVO projectApplyVO = ProjectApplyWrapper.build().entityVO(loadExists(id));
normalizeOptionalAmounts(projectApplyVO);
normalizeOptionalFields(projectApplyVO);
fillReadonly(projectApplyVO);
return projectApplyVO;
}
@@ -345,7 +345,7 @@ public class ProjectApplyServiceImpl extends BaseServiceImpl<ProjectApplyMapper,
projectApply.setTransportRoute(TransportBusinessSupport.trimToNull(projectApply.getTransportRoute()));
projectApply.setTransportType(TransportBusinessSupport.trimToNull(projectApply.getTransportType()));
projectApply.setBusinessType(TransportBusinessSupport.trimToNull(projectApply.getBusinessType()));
normalizeOptionalAmounts(projectApply);
normalizeOptionalFields(projectApply);
projectApply.setSettlementMode(TransportBusinessSupport.trimToNull(projectApply.getSettlementMode()));
projectApply.setHandlerUserName(TransportBusinessSupport.trimToNull(projectApply.getHandlerUserName()));
projectApply.setPrincipalUserName(TransportBusinessSupport.trimToNull(projectApply.getPrincipalUserName()));
@@ -354,7 +354,7 @@ public class ProjectApplyServiceImpl extends BaseServiceImpl<ProjectApplyMapper,
projectApply.setSituationRemark(TransportBusinessSupport.trimToNull(projectApply.getSituationRemark()));
}
private void normalizeOptionalAmounts(ProjectApply projectApply) {
private void normalizeOptionalFields(ProjectApply projectApply) {
if (projectApply.getProjectScale() != null && projectApply.getProjectScale().signum() < 0) {
projectApply.setProjectScale(null);
}
@@ -364,6 +364,15 @@ public class ProjectApplyServiceImpl extends BaseServiceImpl<ProjectApplyMapper,
if (projectApply.getFundDemand() != null && projectApply.getFundDemand().signum() < 0) {
projectApply.setFundDemand(null);
}
if (projectApply.getReceivableDays() != null && projectApply.getReceivableDays() < 0) {
projectApply.setReceivableDays(null);
}
if (projectApply.getPaymentDays() != null && projectApply.getPaymentDays() < 0) {
projectApply.setPaymentDays(null);
}
if (projectApply.getCargoQuantity() != null && "-1".equals(projectApply.getCargoQuantity().trim())) {
projectApply.setCargoQuantity(null);
}
}
private void copyChangeFields(ProjectApply target, ProjectApply source) {
@@ -473,7 +482,7 @@ public class ProjectApplyServiceImpl extends BaseServiceImpl<ProjectApplyMapper,
private void validateDays(Integer value, String label) {
if (value == null) {
throw new ServiceException(label + "不能为空");
return;
}
if (value < 0 || value > 999) {
throw new ServiceException(label + "范围为0到999天");
@@ -92,14 +92,14 @@ public class TireReplacementRecordServiceImpl extends BaseServiceImpl<TireReplac
prepare(tireReplacementRecord);
List<String> validationErrors = validateImportTireReplacementRecord(tireReplacementRecord);
if (Func.isNotEmpty(validationErrors)) {
excel.setErrorMessage(org.springblade.common.excel.ImportFailureExcelUtil.formatErrorMessage(index + 2, validationErrors));
excel.setErrorMessage(org.springblade.common.excel.ImportFailureExcelUtil.formatErrorMessage(validationErrors));
errorList.add(excel);
continue;
}
tireReplacementRecordList.add(tireReplacementRecord);
} catch (Exception exception) {
String message = exception instanceof ServiceException ? exception.getMessage() : "导入失败";
excel.setErrorMessage(org.springblade.common.excel.ImportFailureExcelUtil.formatErrorMessage(index + 2, List.of(message)));
excel.setErrorMessage(org.springblade.common.excel.ImportFailureExcelUtil.formatErrorMessage(List.of(message)));
errorList.add(excel);
}
}
@@ -92,14 +92,14 @@ public class TransportChangeRecordServiceImpl extends BaseServiceImpl<TransportC
prepare(transportChangeRecord);
List<String> validationErrors = validateImportTransportChangeRecord(transportChangeRecord);
if (Func.isNotEmpty(validationErrors)) {
excel.setErrorMessage(org.springblade.common.excel.ImportFailureExcelUtil.formatErrorMessage(index + 2, validationErrors));
excel.setErrorMessage(org.springblade.common.excel.ImportFailureExcelUtil.formatErrorMessage(validationErrors));
errorList.add(excel);
continue;
}
transportChangeRecordList.add(transportChangeRecord);
} catch (Exception exception) {
String message = exception instanceof ServiceException ? exception.getMessage() : "导入失败";
excel.setErrorMessage(org.springblade.common.excel.ImportFailureExcelUtil.formatErrorMessage(index + 2, List.of(message)));
excel.setErrorMessage(org.springblade.common.excel.ImportFailureExcelUtil.formatErrorMessage(List.of(message)));
errorList.add(excel);
}
}
@@ -63,7 +63,7 @@ public class ViolationRecordServiceImpl extends BaseServiceImpl<ViolationRecordM
private static final int PENALTY_UNIT_MAX_LENGTH = 50;
private static final int DESCRIPTION_MAX_LENGTH = 500;
private static final int RESULT_MAX_LENGTH = 500;
private static final int ATTACHMENTS_MAX_LENGTH = 1000;
private static final int ATTACHMENTS_MAX_LENGTH = 16000;
private static final int MAX_DEDUCT_POINTS = 15;
private static final String PROCESSED = "已处理";
private static final String UNPROCESSED = "未处理";
@@ -104,7 +104,7 @@ public class ViolationRecordServiceImpl extends BaseServiceImpl<ViolationRecordM
prepare(violationRecord);
List<String> validationErrors = validateImportViolationRecord(violationRecord);
if (Func.isNotEmpty(validationErrors)) {
excel.setErrorMessage(org.springblade.common.excel.ImportFailureExcelUtil.formatErrorMessage(index + 2, validationErrors));
excel.setErrorMessage(org.springblade.common.excel.ImportFailureExcelUtil.formatErrorMessage(validationErrors));
errorList.add(excel);
continue;
}
@@ -112,7 +112,7 @@ public class ViolationRecordServiceImpl extends BaseServiceImpl<ViolationRecordM
violationRecordList.add(violationRecord);
} catch (Exception exception) {
String message = exception instanceof ServiceException ? exception.getMessage() : "导入失败";
excel.setErrorMessage(org.springblade.common.excel.ImportFailureExcelUtil.formatErrorMessage(index + 2, List.of(message)));
excel.setErrorMessage(org.springblade.common.excel.ImportFailureExcelUtil.formatErrorMessage(List.of(message)));
errorList.add(excel);
}
}
@@ -152,7 +152,7 @@ public class ViolationRecordServiceImpl extends BaseServiceImpl<ViolationRecordM
org.springblade.common.excel.ImportFailureExcelUtil.addLengthValidationError(validationErrors, violationRecord.getPenaltyUnit(), PENALTY_UNIT_MAX_LENGTH, "被罚单位不能超过50字");
org.springblade.common.excel.ImportFailureExcelUtil.addLengthValidationError(validationErrors, violationRecord.getProcessDescription(), DESCRIPTION_MAX_LENGTH, "过程描述不能超过500字");
org.springblade.common.excel.ImportFailureExcelUtil.addLengthValidationError(validationErrors, violationRecord.getProcessResult(), RESULT_MAX_LENGTH, "处理结果不能超过500字");
org.springblade.common.excel.ImportFailureExcelUtil.addLengthValidationError(validationErrors, violationRecord.getAttachments(), ATTACHMENTS_MAX_LENGTH, "附件不能超过1000字");
org.springblade.common.excel.ImportFailureExcelUtil.addLengthValidationError(validationErrors, violationRecord.getAttachments(), ATTACHMENTS_MAX_LENGTH, "附件数据不能超过16000字");
return validationErrors;
}
@@ -240,7 +240,7 @@ public class ViolationRecordServiceImpl extends BaseServiceImpl<ViolationRecordM
validateLength(violationRecord.getPenaltyUnit(), PENALTY_UNIT_MAX_LENGTH, "被罚单位不能超过50字");
validateLength(violationRecord.getProcessDescription(), DESCRIPTION_MAX_LENGTH, "过程描述不能超过500字");
validateLength(violationRecord.getProcessResult(), RESULT_MAX_LENGTH, "处理结果不能超过500字");
validateLength(violationRecord.getAttachments(), ATTACHMENTS_MAX_LENGTH, "附件不能超过1000字");
validateLength(violationRecord.getAttachments(), ATTACHMENTS_MAX_LENGTH, "附件数据不能超过16000字");
}
private void validateVehicleTypeImmutable(ViolationRecord violationRecord) {
@@ -31,6 +31,7 @@ import org.springblade.system.cache.UserCache;
import org.springblade.transport.pojo.entity.MaintenanceRecord;
import org.springblade.transport.pojo.vo.MaintenanceRecordVO;
import java.math.BigDecimal;
import java.util.Objects;
/**
@@ -47,6 +48,9 @@ public class MaintenanceRecordWrapper extends BaseEntityWrapper<MaintenanceRecor
@Override
public MaintenanceRecordVO entityVO(MaintenanceRecord maintenanceRecord) {
MaintenanceRecordVO maintenanceRecordVO = Objects.requireNonNull(BeanUtil.copyProperties(maintenanceRecord, MaintenanceRecordVO.class));
if (maintenanceRecordVO.getMileage() != null && maintenanceRecordVO.getMileage().compareTo(BigDecimal.valueOf(-1)) == 0) {
maintenanceRecordVO.setMileage(null);
}
maintenanceRecordVO.setUpdateUserName(UserCache.getUserRealName(maintenanceRecord.getUpdateUser()));
return maintenanceRecordVO;
}