Код:
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.limit.common.bean.ContractLimitParameters;
//import ru.bitel.bgbilling.kernel.contract.limit.server.bean.LimitManager.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() );
}
}
}
ругается так
Код:
method does not override or implement a method from a supertype at /usr/local/BGBillingServer/dyn/ru/skyb/scripts/action/ActionContractLimit.java on 37:9
cannot find symbol
symbol: variable request
location: class ru.skyb.scripts.action.ActionContractLimit at /usr/local/BGBillingServer/dyn/ru/skyb/scripts/action/ActionContractLimit.java on 41:33
cannot find symbol
symbol: variable request
location: class ru.skyb.scripts.action.ActionContractLimit at /usr/local/BGBillingServer/dyn/ru/skyb/scripts/action/ActionContractLimit.java on 42:17
cannot find symbol
symbol: variable userID
location: class ru.skyb.scripts.action.ActionContractLimit at /usr/local/BGBillingServer/dyn/ru/skyb/scripts/action/ActionContractLimit.java on 88:91
cannot find symbol
symbol: variable userID
location: class ru.skyb.scripts.action.ActionContractLimit at /usr/local/BGBillingServer/dyn/ru/skyb/scripts/action/ActionContractLimit.java on 101:91
cannot find symbol
symbol: variable userID
location: class ru.skyb.scripts.action.ActionContractLimit at /usr/local/BGBillingServer/dyn/ru/skyb/scripts/action/ActionContractLimit.java on 114:91
cannot find symbol
symbol: method doAction() at /usr/local/BGBillingServer/dyn/ru/skyb/scripts/action/ActionContractLimit.java on 133:22
cannot find symbol
symbol: method setMsg(java.lang.String)
location: class ru.skyb.scripts.action.ActionContractLimit at /usr/local/BGBillingServer/dyn/ru/skyb/scripts/action/ActionContractLimit.java on 147:19
_________________
Код:
Клиент: вер. 6.2.714 / 25.05.2015 17:27:15
os: Linux; java: Java HotSpot(TM) 64-Bit Server VM, v.1.8.0_45
Сервер: вер. 6.2.881 / 22.05.2015 17:56:55
os: Linux; java: Java HotSpot(TM) 64-Bit Server VM, v.1.8.0_45
Помощь по администрированию bgbilling в jabber конференции или Группа в telegramСтиль программирования - пьяный мастерстер
Разработка мобильных приложений