fix(authorization): 省区域和市区域授权即激活,无需初始考核
修改 createProvinceCompany 和 createCityCompany 方法: - 授权后立即激活权益 (benefitActive: true) - 从第1个月开始考核 (currentMonthIndex: 1) - 省区域月度目标:150, 300, 600, 1200, 2400, 4800, 9600, 19200, 11750 - 市区域月度目标:30, 60, 120, 240, 480, 960, 1920, 3840, 2350 - 保留 skipAssessment 参数兼容性 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
76108328c3
commit
834a1fc0b0
|
|
@ -371,14 +371,14 @@ export class AuthorizationRole extends AggregateRoot {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 工厂方法 - 创建正式省公司
|
// 工厂方法 - 创建正式省公司
|
||||||
|
// 授权即激活,开始按月考核(150, 300, 600, 1200, 2400, 4800, 9600, 19200, 11750)
|
||||||
static createProvinceCompany(params: {
|
static createProvinceCompany(params: {
|
||||||
userId: UserId
|
userId: UserId
|
||||||
provinceCode: string
|
provinceCode: string
|
||||||
provinceName: string
|
provinceName: string
|
||||||
adminId: AdminUserId
|
adminId: AdminUserId
|
||||||
skipAssessment?: boolean
|
skipAssessment?: boolean // 保留兼容,但不再影响激活状态
|
||||||
}): AuthorizationRole {
|
}): AuthorizationRole {
|
||||||
const skipAssessment = params.skipAssessment ?? false
|
|
||||||
const now = new Date()
|
const now = new Date()
|
||||||
const auth = new AuthorizationRole({
|
const auth = new AuthorizationRole({
|
||||||
authorizationId: AuthorizationId.generate(),
|
authorizationId: AuthorizationId.generate(),
|
||||||
|
|
@ -396,14 +396,14 @@ export class AuthorizationRole extends AggregateRoot {
|
||||||
assessmentConfig: AssessmentConfig.forProvince(),
|
assessmentConfig: AssessmentConfig.forProvince(),
|
||||||
requireLocalPercentage: 0,
|
requireLocalPercentage: 0,
|
||||||
exemptFromPercentageCheck: true,
|
exemptFromPercentageCheck: true,
|
||||||
benefitActive: skipAssessment,
|
benefitActive: true, // 授权即激活
|
||||||
benefitActivatedAt: skipAssessment ? now : null,
|
benefitActivatedAt: now,
|
||||||
benefitDeactivatedAt: null,
|
benefitDeactivatedAt: null,
|
||||||
benefitValidUntil: skipAssessment ? AuthorizationRole.calculateBenefitValidUntil(now) : null,
|
benefitValidUntil: AuthorizationRole.calculateBenefitValidUntil(now),
|
||||||
lastAssessmentMonth: skipAssessment ? AuthorizationRole.getCurrentMonthString(now) : null,
|
lastAssessmentMonth: AuthorizationRole.getCurrentMonthString(now),
|
||||||
monthlyTreesAdded: 0,
|
monthlyTreesAdded: 0,
|
||||||
lastMonthTreesAdded: 0,
|
lastMonthTreesAdded: 0,
|
||||||
currentMonthIndex: skipAssessment ? 1 : 0,
|
currentMonthIndex: 1, // 从第1个月开始考核
|
||||||
createdAt: now,
|
createdAt: now,
|
||||||
updatedAt: now,
|
updatedAt: now,
|
||||||
})
|
})
|
||||||
|
|
@ -469,14 +469,14 @@ export class AuthorizationRole extends AggregateRoot {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 工厂方法 - 创建正式市公司
|
// 工厂方法 - 创建正式市公司
|
||||||
|
// 授权即激活,开始按月考核(30, 60, 120, 240, 480, 960, 1920, 3840, 2350)
|
||||||
static createCityCompany(params: {
|
static createCityCompany(params: {
|
||||||
userId: UserId
|
userId: UserId
|
||||||
cityCode: string
|
cityCode: string
|
||||||
cityName: string
|
cityName: string
|
||||||
adminId: AdminUserId
|
adminId: AdminUserId
|
||||||
skipAssessment?: boolean
|
skipAssessment?: boolean // 保留兼容,但不再影响激活状态
|
||||||
}): AuthorizationRole {
|
}): AuthorizationRole {
|
||||||
const skipAssessment = params.skipAssessment ?? false
|
|
||||||
const now = new Date()
|
const now = new Date()
|
||||||
const auth = new AuthorizationRole({
|
const auth = new AuthorizationRole({
|
||||||
authorizationId: AuthorizationId.generate(),
|
authorizationId: AuthorizationId.generate(),
|
||||||
|
|
@ -494,14 +494,14 @@ export class AuthorizationRole extends AggregateRoot {
|
||||||
assessmentConfig: AssessmentConfig.forCity(),
|
assessmentConfig: AssessmentConfig.forCity(),
|
||||||
requireLocalPercentage: 0,
|
requireLocalPercentage: 0,
|
||||||
exemptFromPercentageCheck: true,
|
exemptFromPercentageCheck: true,
|
||||||
benefitActive: skipAssessment,
|
benefitActive: true, // 授权即激活
|
||||||
benefitActivatedAt: skipAssessment ? now : null,
|
benefitActivatedAt: now,
|
||||||
benefitDeactivatedAt: null,
|
benefitDeactivatedAt: null,
|
||||||
benefitValidUntil: skipAssessment ? AuthorizationRole.calculateBenefitValidUntil(now) : null,
|
benefitValidUntil: AuthorizationRole.calculateBenefitValidUntil(now),
|
||||||
lastAssessmentMonth: skipAssessment ? AuthorizationRole.getCurrentMonthString(now) : null,
|
lastAssessmentMonth: AuthorizationRole.getCurrentMonthString(now),
|
||||||
monthlyTreesAdded: 0,
|
monthlyTreesAdded: 0,
|
||||||
lastMonthTreesAdded: 0,
|
lastMonthTreesAdded: 0,
|
||||||
currentMonthIndex: skipAssessment ? 1 : 0,
|
currentMonthIndex: 1, // 从第1个月开始考核
|
||||||
createdAt: now,
|
createdAt: now,
|
||||||
updatedAt: now,
|
updatedAt: now,
|
||||||
})
|
})
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue