forum.bitel.ru
http://forum.bitel.ru/

Последнее обновление, отсутствуют классы
http://forum.bitel.ru/viewtopic.php?f=22&t=11283
Страница 1 из 1

Автор:  skyb [ 24 янв 2016, 05:49 ]
Заголовок сообщения:  Последнее обновление, отсутствуют классы

bitel.billing.server.contract.bean.LimitManager
Сервер: вер. 6.2.1001 / 19.01.2016 20:30:21
os: Linux; java: Java HotSpot(TM) Server VM, v.1.8.0_51

Вложения:
snapshot3.png
snapshot3.png [ 2.28 КБ | Просмотров: 3431 ]

Автор:  Phricker [ 24 янв 2016, 14:44 ]
Заголовок сообщения:  Re: Последнее обновление, отсутствуют классы

Код:
import ru.bitel.bgbilling.kernel.contract.limit.server.bean.LimitManager;

Я как раз на последнем обновлении начал свои скрипты к переходу на 6.2 тестировать.
И там лимит менеджер как раз вывалился
Плюс
Код:
lm.updateContractLimit

вместо String days стал требовать int days

Автор:  skyb [ 25 янв 2016, 06:48 ]
Заголовок сообщения:  Re: Последнее обновление, отсутствуют классы

класс который с лимитом в вебе

Код:
package ru.skyb.scripts.action;

import java.math.BigDecimal;
import java.sql.Connection;
import java.sql.Date;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Calendar;
import java.util.GregorianCalendar;
import java.util.HashMap;
import java.util.Map;
import bitel.billing.server.contract.bean.BalanceUtils;
import bitel.billing.server.ActionResultContentType;
import bitel.billing.server.contract.bean.Contract;
import bitel.billing.server.contract.bean.ContractManager;
//import bitel.billing.server.contract.bean.LimitManager;
//import ru.bitel.bgbilling.kernel.contract.api.common.bean.
//import bitel.billing.server.contract.bean.LimitManager.ContractLimitParameters;
import ru.bitel.bgbilling.kernel.contract.api.common.bean.ContractLimitParameters;
import ru.bitel.bgbilling.kernel.contract.limit.server.bean.LimitManager;
//import bitel.billing.server.contract.bean.LimitManager;
import ru.bitel.bgbilling.common.BGException;
import ru.bitel.bgbilling.common.BGMessageException;
import ru.bitel.bgbilling.kernel.event.events.ContractLimitUserLow;
import ru.bitel.bgbilling.kernel.event.events.LimitChangedEvent;
import ru.bitel.bgbilling.kernel.event.events.system.SystemLimitChangedEvent;
import bitel.billing.common.TimeUtils;
import ru.bitel.common.Utils;

public class ActionContractLimit
   extends bitel.billing.server.contract.action.web.ActionContractLimit
{

   private ContractLimitParameters clp = null;
   @Override
    public void doAction()
       throws SQLException, BGException
   {
      String action = request.getParameter("act");
      request.setAttribute( "contentType", ActionResultContentType.jsp );
      java.util.Date currentDate = new java.util.Date();
      //BigDecimal summ = getBigDecimalParameter( "summ", BigDecimal.ZERO );
      BigDecimal summ = new BigDecimal(1000);
      LimitManager lm = new LimitManager( con );
      ContractManager cm = new ContractManager( con );
        Contract contract = cm.getContractById( cid );
      BalanceUtils bu = new BalanceUtils (con);
      String query = " SELECT date1 FROM contract WHERE id = " + cid;
      PreparedStatement contractPs = con.prepareStatement( query );
      ResultSet contractRs = contractPs.executeQuery();

/*      else if( contract.getBalanceLimit().subtract( summ ).compareTo( clp.minLimit ) < 0 )
         {
            throw new BGMessageException( "Понижение лимита ниже " + Utils.formatBigDecimalSumm( clp.minLimit ) + " невозможно." );
         }
*/
      reloadClp( lm, contract );
      //if( clp != null && summ.compareTo( BigDecimal.ZERO ) > 0 && contract.getBalanceMode() == Contract.DEBET_BALANCE_MODE )
      if( clp != null && "Взять платеж".equals(action) && contract.getBalanceMode() == Contract.DEBET_BALANCE_MODE )
         {
         while ( contractRs.next() )
            {
               Date date = contractRs.getDate( 1 );
               
                 int mounth = TimeUtils.monthsDelta(date, currentDate);
/*
*Больше месяца - день
*Больше трех - три
*Больше пол года - пять
*/
               if (bu.getBalance(currentDate, cid).compareTo(  new BigDecimal(0) ) >= 0)
               {
                if (mounth == 0)
                  {
                   
                   System.out.println("While sql " + date + " mounth " + mounth + " currentDate " + currentDate);
                  throw new BGMessageException( "Обещанный платеж можно брать только через месяц" );
                                    
                  }
                 if (mounth >= 1 && mounth < 3)
                    {
                        lm.lowLimit( cid, summ, 1 );

                          contract = cm.getContractById( cid );
                         
                          context.publishAfterCommit( new ContractLimitUserLow( userID, cid, summ, 1 ) );
                          context.publishAfterCommit( new SystemLimitChangedEvent( cid, contract.getBalanceLimit()) );
                          context.publishAfterCommit( new LimitChangedEvent( cid, contract.getBalanceLimit()) );
                         
                          reloadClp( lm, contract );
                          System.out.println("While sql " + date + " mounth " + mounth + " currentDate " + currentDate);
                    }
                 if (mounth >= 3 && mounth < 6)
                    {
                        lm.lowLimit( cid, summ, 3 );

                          contract = cm.getContractById( cid );
                         
                          context.publishAfterCommit( new ContractLimitUserLow( userID, cid, summ, 3 ) );
                          context.publishAfterCommit( new SystemLimitChangedEvent( cid, contract.getBalanceLimit()) );
                          context.publishAfterCommit( new LimitChangedEvent( cid, contract.getBalanceLimit()) );
                         
                          reloadClp( lm, contract );
                          System.out.println("While sql " + date + " mounth " + mounth + " currentDate " + currentDate);
                    }
                 if (mounth >= 6)
                    {
                        lm.lowLimit( cid, summ, 5 );

                          contract = cm.getContractById( cid );
                         
                          context.publishAfterCommit( new ContractLimitUserLow( userID, cid, summ, 5 ) );
                          context.publishAfterCommit( new SystemLimitChangedEvent( cid, contract.getBalanceLimit()) );
                          context.publishAfterCommit( new LimitChangedEvent( cid, contract.getBalanceLimit()) );
                         
                          reloadClp( lm, contract );
                          System.out.println("While sql " + date + " mounth " + mounth + " currentDate " + currentDate);
                    }      
               }      
            else
               {
                throw new BGMessageException( "Понижение лимита при отрицательном балансе невозможно." );
               }
            }
         
         contractPs.close();
         contractRs.close();
         
         }

      super.doAction();

   }
   
   private void reloadClp( LimitManager lm, Contract contract )
           throws BGException
       {
          try
          {
             clp = null;
             clp = lm.getContractLimitParameters( setup, contract );
          }
          catch( BGMessageException e )
          {
             setMsg( e.getMessage() );
          }
       }
}

ругается тут
Код:
clp = lm.getContractLimitParameters( setup, contract );

так
Вложение:
Выделение_044.png
Выделение_044.png [ 3.99 КБ | Просмотров: 3413 ]

я как бы понимаю чего не нравиться, но чет в API как то я не нашел ответ, не туда смотрю?

Автор:  skn [ 25 янв 2016, 12:23 ]
Заголовок сообщения:  Re: Последнее обновление, отсутствуют классы

заменить
Код:
import ru.bitel.bgbilling.kernel.contract.api.common.bean.ContractLimitParameters;

на
Код:
import ru.bitel.bgbilling.kernel.contract.limit.server.bean.LimitManager.ContractLimitParameters;

Автор:  stark [ 25 янв 2016, 13:17 ]
Заголовок сообщения:  Re: Последнее обновление, отсутствуют классы

Вернем в ближайшее время как deprecated .

Автор:  skyb [ 25 янв 2016, 13:32 ]
Заголовок сообщения:  Re: Последнее обновление, отсутствуют классы

аха, поменял, взлетело, пасиба

Автор:  stark [ 25 янв 2016, 13:43 ]
Заголовок сообщения:  Re: Последнее обновление, отсутствуют классы

Обновление со старым LimitMnager-ом и сопутствующими классами выкладывается. Теперь он deprecated.

Страница 1 из 1 Часовой пояс: UTC + 5 часов [ Летнее время ]
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/