dev add apllication tariff fields
Test Workflow / test (push) Successful in 3s

This commit is contained in:
vladp
2026-02-02 12:19:34 +07:00
parent 7dd057603d
commit 4395654b0d
2 changed files with 113 additions and 21 deletions
@@ -1,6 +1,7 @@
package ru.soune.nocopy.service.tariff;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.event.ApplicationReadyEvent;
import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Service;
@@ -18,6 +19,66 @@ import java.util.Map;
@RequiredArgsConstructor
public class TariffInitializationService {
@Value("${tarif.demo-price}")
private long demoPrice;
@Value("${tarif.demo-tokens}")
private int demoTokens;
@Value("${tarif.demo-user-count}")
private long demoUserCount;
@Value("${tarif.demo-max-files-count}")
private int demoMaxFileCount;
@Value("${tarif.start-price}")
private long startPrice;
@Value("${tarif.start-tokens}")
private int startTokens;
@Value("${tarif.start-max-files-count}")
private int startMaxFileCount;
@Value("${tarif.start-user-count}")
private long startUserCount;
@Value("${tarif.basic-price}")
private long basicPrice;
@Value("${tarif.basic-tokens}")
private int basicTokens;
@Value("${tarif.basic-max-files-count}")
private int basicMaxFileCount;
@Value("${tarif.basic-user-count}")
private long basicUserCount;
@Value("${tarif.pro-price}")
private long proPrice;
@Value("${tarif.pro-tokens}")
private int proTokens;
@Value("${tarif.pro-max-files-count}")
private int proMaxFileCount;
@Value("${tarif.pro-user-count}")
private long proUserCount;
@Value("${tarif.enterprice-price}")
private long enterpricePrice;
@Value("${tarif.enterprice-tokens}")
private int enterpriceTokens;
@Value("${tarif.enterprice-max-files-count}")
private int enterpriceMaxFileCount;
@Value("${tarif.enterprice-user-count}")
private long enterpriceUserCount;
private final TariffRepository tariffRepository;
@EventListener(ApplicationReadyEvent.class)
@@ -49,47 +110,47 @@ public class TariffInitializationService {
switch (type) {
case DEMO:
tariff.setName("Демо");
tariff.setPrice(TariffConstants.DEMO_PRICE);
tariff.setTokens(TariffConstants.DEMO_TOKENS);
tariff.setMaxFilesCount(10);
tariff.setPrice(demoPrice);
tariff.setTokens(demoTokens);
tariff.setMaxFilesCount(demoMaxFileCount);
tariff.setDiskSize(1024L * 1024 * 100);
tariff.setMaxUsers(1L);
tariff.setMaxUsers(demoUserCount);
break;
case START:
tariff.setName("Стартовый");
tariff.setPrice(TariffConstants.START_PRICE);
tariff.setTokens(TariffConstants.START_TOKENS);
tariff.setMaxFilesCount(50);
tariff.setPrice(startPrice);
tariff.setTokens(startTokens);
tariff.setMaxFilesCount(startMaxFileCount);
tariff.setDiskSize(1024L * 1024 * 500);
tariff.setMaxUsers(3L);
tariff.setMaxUsers(startUserCount);
break;
case BASIC:
tariff.setName("Базовый");
tariff.setPrice(TariffConstants.BASIC_PRICE);
tariff.setTokens(TariffConstants.BASIC_TOKENS);
tariff.setMaxFilesCount(200);
tariff.setPrice(basicPrice);
tariff.setTokens(basicTokens);
tariff.setMaxFilesCount(basicMaxFileCount);
tariff.setDiskSize(1024L * 1024 * 1024 * 2L);
tariff.setMaxUsers(10L);
tariff.setMaxUsers(basicUserCount);
break;
case PRO:
tariff.setName("Профессиональный");
tariff.setPrice(TariffConstants.PRO_PRICE);
tariff.setTokens(TariffConstants.PRO_TOKENS);
tariff.setMaxFilesCount(1000);
tariff.setPrice(proPrice);
tariff.setTokens(proTokens);
tariff.setMaxFilesCount(proMaxFileCount);
tariff.setDiskSize(1024L * 1024 * 1024 * 10L);
tariff.setMaxUsers(25L);
tariff.setMaxUsers(proUserCount);
break;
case ENTERPRISE:
tariff.setName("Корпоративный");
tariff.setPrice(TariffConstants.ENTERPRISE_PRICE);
tariff.setTokens(TariffConstants.ENTERPRISE_TOKENS);
tariff.setMaxFilesCount(5000);
tariff.setPrice(enterpricePrice);
tariff.setTokens(enterpriceTokens);
tariff.setMaxFilesCount(enterpriceMaxFileCount);
tariff.setDiskSize(1024L * 1024 * 1024 * 50L);
tariff.setMaxUsers(100L);
tariff.setMaxUsers(enterpriceUserCount);
break;
}
+31
View File
@@ -94,3 +94,34 @@ app:
standart-subject: NO COPY - Подтверждение email адреса
standart-address-from: vlad.popovtsev@gmail.com
user: Пользователь
tarif:
demo-price: 0
demo-tokens: 10
demo-max-files-count: 10
demo-disk-size: 100
demo-user-count: 1
start-tokens: 20
start-price: 100
start-max-files-count: 20
start-disk-size: 200
start-user-count: 10
basic-tokens: 30
basic-price: 200
basic-max-files-count: 30
basic-disk-size: 300
basic-user-count: 30
pro-tokens: 40
pro-price: 300
pro-max-files-count: 40
pro-disk-size: 400
pro-user-count: 50
enterprice-tokens: 50
enterprice-price: 400
enterprice-max-files-count: 50
enterprice-disk-size: 500
enterprice-user-count: 80