This commit is contained in:
2026-08-05 16:26:10 +08:00
parent 06f7f9d2f2
commit 5ba9716e12
155 changed files with 2883 additions and 551 deletions
@@ -83,6 +83,7 @@ public class PlatformMeasurementImageController {
private long requirePlatform(AuthenticatedUser user) {
if (user == null || !"PLATFORM".equalsIgnoreCase(user.appCode())
|| user.tenantId() == null || user.tenantId() != 0L
|| user.userId() == null || user.userId() <= 0) {
throw new BizException(ResultCode.FORBIDDEN, "需要平台端身份");
}
@@ -47,6 +47,7 @@ public class PlatformQualificationFileController {
@RequestParam(required = false) LocalDate validTo,
@RequestParam(defaultValue = "false") boolean replace) {
requirePlatform(user);
requireCustomer(tenantId);
qualificationType = QualificationTypes.requireOptional(qualificationType);
var stored = storage.store(tenantId, file);
try {
@@ -94,6 +95,7 @@ public class PlatformQualificationFileController {
@RequestParam(defaultValue = "false") boolean replaceBusinessLicense,
@RequestParam(defaultValue = "false") boolean replaceLegalPersonId) {
requirePlatform(user);
requireCustomer(tenantId);
return ApiResponse.success(packageService.upload(tenantId, businessLicense, legalPersonId,
unifiedSocialCreditCode, businessLicenseValidTo, legalPersonIdValidTo,
replaceBusinessLicense, replaceLegalPersonId, true));
@@ -105,6 +107,7 @@ public class PlatformQualificationFileController {
@AuthenticationPrincipal AuthenticatedUser user,
@PathVariable long tenantId, @PathVariable String fileName) {
requirePlatform(user);
requireCustomer(tenantId);
var resource = storage.load(tenantId, fileName);
String mediaType = fileName.endsWith(".png") ? MediaType.IMAGE_PNG_VALUE
: (fileName.endsWith(".pdf") ? MediaType.APPLICATION_PDF_VALUE : MediaType.IMAGE_JPEG_VALUE);
@@ -113,8 +116,15 @@ public class PlatformQualificationFileController {
}
private void requirePlatform(AuthenticatedUser user) {
if (user == null || !"PLATFORM".equalsIgnoreCase(user.appCode())) {
if (user == null || !"PLATFORM".equalsIgnoreCase(user.appCode())
|| user.tenantId() == null || user.tenantId() != 0L) {
throw new BizException(ResultCode.FORBIDDEN, "Platform identity is required");
}
}
private void requireCustomer(long tenantId) {
if (tenantId <= 0L) {
throw new BizException(ResultCode.BAD_REQUEST, "Customer identity must be positive");
}
}
}
@@ -187,7 +187,7 @@ public class ExportTaskService {
private void requirePlatform(AuthenticatedUser user) {
if (user == null || user.userId() == null || user.tenantId() == null
|| !"PLATFORM".equalsIgnoreCase(user.appCode())) {
|| user.tenantId() != 0L || !"PLATFORM".equalsIgnoreCase(user.appCode())) {
throw new BizException(ResultCode.FORBIDDEN, "Platform identity is required");
}
}