贴标申请,仓储转运

This commit is contained in:
2026-09-20 15:06:17 +08:00
parent a7d458cddd
commit 02844da360
56 changed files with 2121 additions and 111 deletions
@@ -44,6 +44,15 @@ public class InternalBusinessFileController {
return ApiResponse.success(service.upload(tenantId, businessType, businessId, operatorId, file));
}
@GetMapping("/{tenantId}/{businessType}/{businessId}")
public ApiResponse<java.util.List<InternalBusinessFileService.Metadata>> list(
@RequestHeader(value = "X-Internal-Service-Token", required = false) String token,
@PathVariable long tenantId, @PathVariable @NotBlank String businessType,
@PathVariable @NotBlank String businessId) {
check(token); checkTenantId(tenantId);
return ApiResponse.success(service.list(tenantId, businessType, businessId));
}
@GetMapping("/{tenantId}/{businessType}/{businessId}/{fileId}")
public ApiResponse<InternalBusinessFileService.Metadata> metadata(
@RequestHeader(value = "X-Internal-Service-Token", required = false) String token,
@@ -10,6 +10,7 @@ import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import java.time.LocalDateTime;
import java.util.List;
@Service
public class InternalBusinessFileService {
@Resource private FileObjectMapper files;
@@ -52,6 +53,16 @@ public class InternalBusinessFileService {
return metadata(required(tenantId, businessType, businessId, fileId));
}
public List<Metadata> list(long tenantId, String businessType, String businessId) {
BusinessFileCategory category = BusinessFileCategory.require(businessType);
category.validateOwner(tenantId); category.storageBusinessId(businessId);
return files.selectList(new LambdaQueryWrapper<FileObjectEntity>()
.eq(FileObjectEntity::getTenantId, tenantId).eq(FileObjectEntity::getBusinessType, businessType)
.eq(FileObjectEntity::getBusinessId, businessId).eq(FileObjectEntity::getStatus, "ACTIVE")
.eq(FileObjectEntity::getDeleted, false).orderByAsc(FileObjectEntity::getCreatedAt, FileObjectEntity::getId))
.stream().map(InternalBusinessFileService::metadata).toList();
}
public Download download(long tenantId, String businessType, String businessId, long fileId) {
FileObjectEntity value = required(tenantId, businessType, businessId, fileId);
return new Download(value.getOriginalName(), value.getContentType(), storage.read(value.getObjectKey()));