1
This commit is contained in:
@@ -4,7 +4,9 @@ import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.Email;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.Pattern;
|
||||
import jakarta.validation.constraints.PositiveOrZero;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 租户生命周期数据契约集合,定义入驻、资料更新、审核请求和租户响应。
|
||||
@@ -19,7 +21,12 @@ public final class TenantDtos {
|
||||
@Schema(description = "18-character unified social credit code / 18 位统一社会信用代码", example = "91440300MA5EXAMPLE") @NotBlank @Pattern(regexp = "[0-9A-Z]{18}") String unifiedSocialCreditCode,
|
||||
@Schema(description = "Primary contact / 联系人", example = "张三") @NotBlank String contactName,
|
||||
@Schema(description = "Contact phone / 联系电话", example = "13800138000") @NotBlank String contactPhone,
|
||||
@Schema(description = "Contact email / 联系邮箱", example = "ops@example.com") @Email String contactEmail
|
||||
@Schema(description = "Contact email / 联系邮箱", example = "ops@example.com") @Email String contactEmail,
|
||||
@Size(max = 64) String servicePackage,
|
||||
@PositiveOrZero Integer creditDays,
|
||||
@Size(max = 64) String salesPerson,
|
||||
@Size(max = 255) String businessAddress,
|
||||
@Size(max = 500) String remark
|
||||
) { }
|
||||
|
||||
@Schema(name = "TenantProfileUpdateRequest", description = "Enterprise profile update / 企业资料更新")
|
||||
@@ -38,7 +45,12 @@ public final class TenantDtos {
|
||||
@NotBlank String legalName,
|
||||
@NotBlank String contactName,
|
||||
@NotBlank String contactPhone,
|
||||
@Email String contactEmail
|
||||
@Email String contactEmail,
|
||||
@Size(max = 64) String servicePackage,
|
||||
@PositiveOrZero Integer creditDays,
|
||||
@Size(max = 64) String salesPerson,
|
||||
@Size(max = 255) String businessAddress,
|
||||
@Size(max = 500) String remark
|
||||
) { }
|
||||
|
||||
@Schema(name = "TenantStatusChangeRequest", description = "Platform controlled merchant tenant status")
|
||||
@@ -55,5 +67,7 @@ public final class TenantDtos {
|
||||
@Schema(name = "TenantResponse", description = "Enterprise tenant summary / 企业租户概要")
|
||||
public record TenantResponse(Long id, String tenantCode, String tenantName, String status,
|
||||
String legalName, String unifiedSocialCreditCode, String contactName,
|
||||
String contactPhone, String contactEmail) { }
|
||||
String contactPhone, String contactEmail, String servicePackage,
|
||||
Integer creditDays, String salesPerson, String businessAddress,
|
||||
String remark, LocalDateTime createdAt) { }
|
||||
}
|
||||
|
||||
@@ -25,6 +25,11 @@ public class IamTenant extends BaseEntity {
|
||||
private String contactName;
|
||||
private String contactPhone;
|
||||
private String contactEmail;
|
||||
private String servicePackage;
|
||||
private Integer creditDays;
|
||||
private String salesPerson;
|
||||
private String businessAddress;
|
||||
private String remark;
|
||||
private LocalDateTime approvedAt;
|
||||
private Long approvedBy;
|
||||
private String rejectReason;
|
||||
|
||||
@@ -59,6 +59,11 @@ public class TenantService {
|
||||
tenant.setContactName(request.contactName());
|
||||
tenant.setContactPhone(request.contactPhone());
|
||||
tenant.setContactEmail(request.contactEmail());
|
||||
tenant.setServicePackage(request.servicePackage());
|
||||
tenant.setCreditDays(request.creditDays() == null ? 0 : request.creditDays());
|
||||
tenant.setSalesPerson(request.salesPerson());
|
||||
tenant.setBusinessAddress(request.businessAddress());
|
||||
tenant.setRemark(request.remark());
|
||||
repository.insertTenant(tenant);
|
||||
|
||||
IamTenantReview review = new IamTenantReview();
|
||||
@@ -162,6 +167,11 @@ public class TenantService {
|
||||
tenant.setContactName(request.contactName());
|
||||
tenant.setContactPhone(request.contactPhone());
|
||||
tenant.setContactEmail(request.contactEmail());
|
||||
tenant.setServicePackage(request.servicePackage());
|
||||
tenant.setCreditDays(request.creditDays() == null ? 0 : request.creditDays());
|
||||
tenant.setSalesPerson(request.salesPerson());
|
||||
tenant.setBusinessAddress(request.businessAddress());
|
||||
tenant.setRemark(request.remark());
|
||||
repository.saveTenant(tenant);
|
||||
return response(tenant);
|
||||
}
|
||||
@@ -213,7 +223,9 @@ public class TenantService {
|
||||
return new TenantResponse(
|
||||
tenant.getId(), tenant.getTenantCode(), tenant.getTenantName(), tenant.getStatus(),
|
||||
tenant.getLegalName(), tenant.getUnifiedSocialCreditCode(), tenant.getContactName(),
|
||||
tenant.getContactPhone(), tenant.getContactEmail()
|
||||
tenant.getContactPhone(), tenant.getContactEmail(), tenant.getServicePackage(),
|
||||
tenant.getCreditDays(), tenant.getSalesPerson(), tenant.getBusinessAddress(),
|
||||
tenant.getRemark(), tenant.getCreatedAt()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,6 +16,11 @@ CREATE TABLE IF NOT EXISTS iam_tenant (
|
||||
contact_name VARCHAR(64) NULL COMMENT '企业联系人',
|
||||
contact_phone VARCHAR(32) NULL COMMENT '联系电话',
|
||||
contact_email VARCHAR(128) NULL COMMENT '联系邮箱',
|
||||
service_package VARCHAR(64) NULL COMMENT '客户服务套餐',
|
||||
credit_days INT NOT NULL DEFAULT 0 COMMENT '账期天数',
|
||||
sales_person VARCHAR(64) NULL COMMENT '负责销售人员',
|
||||
business_address VARCHAR(255) NULL COMMENT '企业经营地址',
|
||||
remark VARCHAR(500) NULL COMMENT '平台客户备注',
|
||||
approved_at DATETIME(3) NULL COMMENT '审核通过时间',
|
||||
approved_by BIGINT NULL COMMENT '审核人ID',
|
||||
reject_reason VARCHAR(500) NULL COMMENT '驳回原因',
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
-- 平台客户档案原型字段补齐,可重复执行。
|
||||
USE baiyue_iam;
|
||||
|
||||
SET @add_customer_columns = IF(
|
||||
EXISTS(SELECT 1 FROM information_schema.columns
|
||||
WHERE table_schema = DATABASE() AND table_name = 'iam_tenant' AND column_name = 'service_package'),
|
||||
'SELECT 1',
|
||||
'ALTER TABLE iam_tenant ADD COLUMN service_package VARCHAR(64) NULL COMMENT ''客户服务套餐'' AFTER contact_email, ADD COLUMN credit_days INT NOT NULL DEFAULT 0 COMMENT ''账期天数'' AFTER service_package, ADD COLUMN sales_person VARCHAR(64) NULL COMMENT ''负责销售人员'' AFTER credit_days, ADD COLUMN business_address VARCHAR(255) NULL COMMENT ''企业经营地址'' AFTER sales_person, ADD COLUMN remark VARCHAR(500) NULL COMMENT ''平台客户备注'' AFTER business_address'
|
||||
);
|
||||
PREPARE add_customer_columns_stmt FROM @add_customer_columns;
|
||||
EXECUTE add_customer_columns_stmt;
|
||||
DEALLOCATE PREPARE add_customer_columns_stmt;
|
||||
Reference in New Issue
Block a user