feat(fleet): integrate costs quotes operations and in-transit handovers

This commit is contained in:
2026-10-03 12:38:04 +08:00
parent 274ecac474
commit cb6c54ffe5
107 changed files with 7304 additions and 42 deletions
@@ -17,6 +17,7 @@ enum BusinessFileCategory {
CUSTOMS_DOCUMENT(false, FormatPolicy.STANDARD, Limits.STANDARD, BusinessIdPolicy.POSITIVE_LONG),
CUSTOMS_RECEIPT(false, FormatPolicy.STANDARD, Limits.STANDARD, BusinessIdPolicy.POSITIVE_LONG),
FINANCE_VOUCHER(false, FormatPolicy.STANDARD, Limits.STANDARD, BusinessIdPolicy.POSITIVE_LONG),
FINANCE_VEHICLE_VOUCHER(false, FormatPolicy.IMAGE, Limits.STANDARD, BusinessIdPolicy.POSITIVE_LONG),
INBOUND_HOLD_EVIDENCE(true, FormatPolicy.STANDARD, Limits.STANDARD, BusinessIdPolicy.POSITIVE_LONG),
OVERSEAS_PROCUREMENT_RECEIPT(true, FormatPolicy.STANDARD, Limits.STANDARD, BusinessIdPolicy.POSITIVE_LONG),
OVERSEAS_PROCUREMENT_VOUCHER(true, FormatPolicy.STANDARD, Limits.STANDARD, BusinessIdPolicy.POSITIVE_LONG),
@@ -61,6 +62,9 @@ enum BusinessFileCategory {
}
void validateOwner(long tenantId) {
if (this == FINANCE_VEHICLE_VOUCHER && tenantId != 0) {
throw new BizException(ResultCode.BAD_REQUEST, "公司车辆付款凭证必须归属平台");
}
if (this == FLEET_VEHICLE_RECORD_PHOTO && tenantId != 0) {
throw new BizException(ResultCode.BAD_REQUEST, "车辆运维照片必须归属平台");
}
@@ -65,7 +65,7 @@ public class BusinessFileStorage {
extension = ".xlsx";
} else {
if (formatPolicy == BusinessFileCategory.FormatPolicy.IMAGE && !java.util.Set.of("image/jpeg", "image/png").contains(type))
throw bad("运维照片仅支持JPG、PNG");
throw bad("图片附件仅支持JPG、PNG");
if (formatPolicy == BusinessFileCategory.FormatPolicy.LICENSE && !java.util.Set.of("application/pdf", "image/jpeg", "image/png").contains(type))
throw bad("驾驶证附件仅支持PDF、JPG、PNG");
extension = TYPES.get(type);
@@ -0,0 +1,10 @@
openapi: 3.0.3
info:
title: 公司车辆付款凭证归属
version: 1.0.0
description: >-
复用InternalBusinessFileController内部上传、元数据及内容接口,不增加公网路径。
businessType为FINANCE_VEHICLE_VOUCHER,tenantId必须为0,businessId为Finance公司费用内部主键。
仅非空JPG/PNG,最多10MiB,同时校验MIME及文件签名;File按平台、业务类型、费用ID及文件ID复合校验。
Finance校验list/upload/pay权限及费用归属;上传不是付款,不复用客户FINANCE_VOUCHER或车辆维修照片。
paths: {}
@@ -9,8 +9,10 @@ import static org.assertj.core.api.Assertions.*;
class VehicleCarePhotoTest {
@TempDir Path root;
@Test void recordPhotosArePlatformOwnedAndRequireRealImageBytes() throws Exception {
var category = BusinessFileCategory.require("FLEET_VEHICLE_RECORD_PHOTO");
@org.junit.jupiter.params.ParameterizedTest
@org.junit.jupiter.params.provider.ValueSource(strings = {"FLEET_VEHICLE_RECORD_PHOTO", "FINANCE_VEHICLE_VOUCHER"})
void recordPhotosAndCompanyVouchersArePlatformOwnedAndRequireRealImageBytes(String type) throws Exception {
var category = BusinessFileCategory.require(type);
category.validateOwner(0);
assertThatThrownBy(() -> category.validateOwner(7)).hasMessageContaining("平台");
assertThatThrownBy(() -> category.validateOwner(-1)).hasMessageContaining("平台");