This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
package ru.soune.nocopy.service.tariff;
|
package ru.soune.nocopy.service.tariff;
|
||||||
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.boot.context.event.ApplicationReadyEvent;
|
import org.springframework.boot.context.event.ApplicationReadyEvent;
|
||||||
import org.springframework.context.event.EventListener;
|
import org.springframework.context.event.EventListener;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@@ -18,6 +19,66 @@ import java.util.Map;
|
|||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class TariffInitializationService {
|
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;
|
private final TariffRepository tariffRepository;
|
||||||
|
|
||||||
@EventListener(ApplicationReadyEvent.class)
|
@EventListener(ApplicationReadyEvent.class)
|
||||||
@@ -49,47 +110,47 @@ public class TariffInitializationService {
|
|||||||
switch (type) {
|
switch (type) {
|
||||||
case DEMO:
|
case DEMO:
|
||||||
tariff.setName("Демо");
|
tariff.setName("Демо");
|
||||||
tariff.setPrice(TariffConstants.DEMO_PRICE);
|
tariff.setPrice(demoPrice);
|
||||||
tariff.setTokens(TariffConstants.DEMO_TOKENS);
|
tariff.setTokens(demoTokens);
|
||||||
tariff.setMaxFilesCount(10);
|
tariff.setMaxFilesCount(demoMaxFileCount);
|
||||||
tariff.setDiskSize(1024L * 1024 * 100);
|
tariff.setDiskSize(1024L * 1024 * 100);
|
||||||
tariff.setMaxUsers(1L);
|
tariff.setMaxUsers(demoUserCount);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case START:
|
case START:
|
||||||
tariff.setName("Стартовый");
|
tariff.setName("Стартовый");
|
||||||
tariff.setPrice(TariffConstants.START_PRICE);
|
tariff.setPrice(startPrice);
|
||||||
tariff.setTokens(TariffConstants.START_TOKENS);
|
tariff.setTokens(startTokens);
|
||||||
tariff.setMaxFilesCount(50);
|
tariff.setMaxFilesCount(startMaxFileCount);
|
||||||
tariff.setDiskSize(1024L * 1024 * 500);
|
tariff.setDiskSize(1024L * 1024 * 500);
|
||||||
tariff.setMaxUsers(3L);
|
tariff.setMaxUsers(startUserCount);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BASIC:
|
case BASIC:
|
||||||
tariff.setName("Базовый");
|
tariff.setName("Базовый");
|
||||||
tariff.setPrice(TariffConstants.BASIC_PRICE);
|
tariff.setPrice(basicPrice);
|
||||||
tariff.setTokens(TariffConstants.BASIC_TOKENS);
|
tariff.setTokens(basicTokens);
|
||||||
tariff.setMaxFilesCount(200);
|
tariff.setMaxFilesCount(basicMaxFileCount);
|
||||||
tariff.setDiskSize(1024L * 1024 * 1024 * 2L);
|
tariff.setDiskSize(1024L * 1024 * 1024 * 2L);
|
||||||
tariff.setMaxUsers(10L);
|
tariff.setMaxUsers(basicUserCount);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PRO:
|
case PRO:
|
||||||
tariff.setName("Профессиональный");
|
tariff.setName("Профессиональный");
|
||||||
tariff.setPrice(TariffConstants.PRO_PRICE);
|
tariff.setPrice(proPrice);
|
||||||
tariff.setTokens(TariffConstants.PRO_TOKENS);
|
tariff.setTokens(proTokens);
|
||||||
tariff.setMaxFilesCount(1000);
|
tariff.setMaxFilesCount(proMaxFileCount);
|
||||||
tariff.setDiskSize(1024L * 1024 * 1024 * 10L);
|
tariff.setDiskSize(1024L * 1024 * 1024 * 10L);
|
||||||
tariff.setMaxUsers(25L);
|
tariff.setMaxUsers(proUserCount);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ENTERPRISE:
|
case ENTERPRISE:
|
||||||
tariff.setName("Корпоративный");
|
tariff.setName("Корпоративный");
|
||||||
tariff.setPrice(TariffConstants.ENTERPRISE_PRICE);
|
tariff.setPrice(enterpricePrice);
|
||||||
tariff.setTokens(TariffConstants.ENTERPRISE_TOKENS);
|
tariff.setTokens(enterpriceTokens);
|
||||||
tariff.setMaxFilesCount(5000);
|
tariff.setMaxFilesCount(enterpriceMaxFileCount);
|
||||||
tariff.setDiskSize(1024L * 1024 * 1024 * 50L);
|
tariff.setDiskSize(1024L * 1024 * 1024 * 50L);
|
||||||
tariff.setMaxUsers(100L);
|
tariff.setMaxUsers(enterpriceUserCount);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -94,3 +94,34 @@ app:
|
|||||||
standart-subject: NO COPY - Подтверждение email адреса
|
standart-subject: NO COPY - Подтверждение email адреса
|
||||||
standart-address-from: vlad.popovtsev@gmail.com
|
standart-address-from: vlad.popovtsev@gmail.com
|
||||||
user: Пользователь
|
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
|
||||||
Reference in New Issue
Block a user