This commit is contained in:
@@ -10,6 +10,7 @@ import ru.soune.nocopy.entity.tarif.TariffTimeTerm;
|
||||
import ru.soune.nocopy.entity.tarif.TariffType;
|
||||
import ru.soune.nocopy.entity.user.User;
|
||||
import ru.soune.nocopy.exception.TariffNotFoundException;
|
||||
import ru.soune.nocopy.repository.TariffInfoRepository;
|
||||
import ru.soune.nocopy.repository.TariffRepository;
|
||||
|
||||
import java.util.List;
|
||||
@@ -21,6 +22,8 @@ public class TariffService {
|
||||
|
||||
private final TariffRepository tariffRepository;
|
||||
|
||||
private final TariffInfoRepository tariffInfoRepository;
|
||||
|
||||
public void addTariff(String tariffName, double price, String type, int tokens, long diskSize, long maxUsers,
|
||||
int maxFilesCount, String tariffTerm, String description) {
|
||||
Tariff tariff = new Tariff();
|
||||
@@ -46,6 +49,10 @@ public class TariffService {
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
public Boolean existTariffInfoByTariffId(Long id) {
|
||||
return tariffInfoRepository.existsByTariffId(id);
|
||||
}
|
||||
|
||||
public List<TariffDTO> getTariffByAccountTypeAndTariffTerm(User user, TariffTimeTerm tariffTerm) {
|
||||
String typeAccount = user.canManageCompanySettings() ? "b2b": "b2c";
|
||||
|
||||
@@ -120,7 +127,7 @@ public class TariffService {
|
||||
if (tariffRequest.getName() != null) {
|
||||
tariff.setName(tariffRequest.getName());
|
||||
}
|
||||
if (tariffRequest.getPrice() != null) { // null = не обновляем
|
||||
if (tariffRequest.getPrice() != null) {
|
||||
tariff.setPrice(tariffRequest.getPrice());
|
||||
}
|
||||
if (tariffRequest.getTokens() != null) {
|
||||
|
||||
Reference in New Issue
Block a user