Оптимальный
This commit is contained in:
@@ -83,7 +83,8 @@ public class Main implements Runnable {
|
||||
ExcelDataRow data;
|
||||
while( !Thread.currentThread().isInterrupted() && ((data = nextData()) != null) ) {
|
||||
if (!data.tarif.equalsIgnoreCase("Акция 3 месяца") &&
|
||||
!data.tarif.equalsIgnoreCase("Группа компаний"))
|
||||
!data.tarif.equalsIgnoreCase("Группа компаний") &&
|
||||
!data.tarif.equalsIgnoreCase("Оптимальный, 4 направ."))
|
||||
continue; //FIXME
|
||||
|
||||
logger.info("Проверяю {} / {} ...", data.inn, data.kpp);
|
||||
@@ -100,7 +101,10 @@ public class Main implements Runnable {
|
||||
tarif_Akcia3Mount(astral, organization, data);
|
||||
}
|
||||
else if (data.tarif.equalsIgnoreCase("Группа компаний")) {
|
||||
tarif_GroupCompany(astral, organization, data);
|
||||
tarif_GroupCompany(organization, data);
|
||||
}
|
||||
else if (data.tarif.equalsIgnoreCase("Оптимальный, 4 направ.")) {
|
||||
tarif_Optimalniy(astral, organization, data);
|
||||
}
|
||||
|
||||
safeSleep(sleepThread);
|
||||
@@ -161,7 +165,7 @@ public class Main implements Runnable {
|
||||
}
|
||||
|
||||
// Тариф: Группа компаний
|
||||
private void tarif_GroupCompany(AstralSession astral, Organization organization, ExcelDataRow data) {
|
||||
private void tarif_GroupCompany(Organization organization, ExcelDataRow data) {
|
||||
// Step 0: Количество доступных продуктов
|
||||
if (organization.products.size() == 0) {
|
||||
logger.warn("({}/{}): Нет доступных продуктов!", organization.inn, organization.kpp);
|
||||
@@ -197,13 +201,44 @@ public class Main implements Runnable {
|
||||
}
|
||||
}
|
||||
|
||||
// Тариф: Оптимальный, 4 направ.
|
||||
private void tarif_Optimalniy(AstralSession astral, Organization organization, ExcelDataRow data) {
|
||||
// Step 0: Количество доступных продуктов
|
||||
if (organization.products.size() == 0) {
|
||||
logger.warn("({}/{}): Нет доступных продуктов!", organization.inn, organization.kpp);
|
||||
return;
|
||||
}
|
||||
|
||||
// Step I: Проверяем разницу дат.
|
||||
// Сертификат должен быть выдан в тот же день или позже, чем тариф
|
||||
Product product = organization.products.get(0);
|
||||
Tarif tarif = product.contractTariffs.get(0);
|
||||
if (product.certs.size() > 1) {
|
||||
logger.warn("({}/{}): Обнаружено более 1 сертификата!", organization.inn, organization.kpp);
|
||||
}
|
||||
Cert cert = product.certs.get(0);
|
||||
|
||||
long tarifDateLong = tarif.date_initialDate.getTime();
|
||||
long certDateLong = cert.startCertDate.getTime();
|
||||
|
||||
if (certDateLong < tarifDateLong) {
|
||||
logger.error("({}/{}): Ошибка: сертификат выдан раньше тарифа!", organization.inn, organization.kpp);
|
||||
return;
|
||||
}
|
||||
|
||||
// Step II: Проверяем кол-во Направлений
|
||||
if (!calcRecipients(product, data)) { //TODO надо проверять по категориям
|
||||
logger.warn("({}/{}): Внимание! Не соответствие количества направлений!", organization.inn, organization.kpp);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean calcRecipients(Product product, ExcelDataRow data) {
|
||||
int countFNS = 0,
|
||||
countFSS = 0,
|
||||
countRosstat = 0,
|
||||
countPFR = 0,
|
||||
countRosalco = 0,
|
||||
countRPN = 0;
|
||||
countFSS = 0,
|
||||
countRosstat = 0,
|
||||
countPFR = 0,
|
||||
countRosalco = 0,
|
||||
countRPN = 0;
|
||||
|
||||
for (Recipient recipient : product.recipients) {
|
||||
switch (recipient.protocolId) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Configuration status="WARN">
|
||||
<Configuration>
|
||||
<Appenders>
|
||||
<Console name="Console" target="SYSTEM_ERR">
|
||||
<PatternLayout pattern="%d{HH:mm:ss.SSS} [%level/%t] %msg%n"/>
|
||||
|
||||
Reference in New Issue
Block a user