進行參數傳值及本類屬性值調用ide
public class TBalancesUtil { private double before_amount; private double fen_qi_amountAll; private double fen_qi_amount; private TBalances tBalances; private TBalances tBalancesNew; private TGrocery tGrocery; private String period_name; private int period_fen_qi_shu; public TBalancesUtil() { } private static class Inner { private static TBalancesUtil getInstance(TBalances tBalances, TBalances tBalancesNew, TGrocery tGrocery, String period_name, int period_fen_qi_shu) { return new TBalancesUtil(tBalances, tBalancesNew, tGrocery, period_name, period_fen_qi_shu); } } public static TBalancesUtil getSingle(TBalances tBalances, TBalances tBalancesNew, TGrocery tGrocery, String period_name, int period_fen_qi_shu) { return Inner.getInstance(tBalances, tBalancesNew, tGrocery, period_name, period_fen_qi_shu); } public TBalancesUtil(TBalances tBalances, TBalances tBalancesNew, TGrocery tGrocery, String period_name, int period_fen_qi_shu) { this.tBalances = tBalances; this.tBalancesNew = tBalancesNew; this.tGrocery = tGrocery; this.period_name = period_name; this.period_fen_qi_shu = period_fen_qi_shu; this.before_amount = MathUtil.multiply(MathUtil.multiply(tBalances.getServicemoney(), tGrocery.getFixed_rate(), tGrocery.getKeep_decimal()), tGrocery.getBefore_amount_rate(), tGrocery.getKeep_decimal()); this.fen_qi_amountAll = MathUtil.multiply(MathUtil.multiply(tBalances.getServicemoney(), tGrocery.getFixed_rate(), tGrocery.getKeep_decimal()), tGrocery.getFen_qi_amount_rate(), tGrocery.getKeep_decimal()); this.fen_qi_amount = MathUtil.divide(MathUtil.multiply(MathUtil.multiply(tBalances.getServicemoney(), tGrocery.getFixed_rate(), tGrocery.getKeep_decimal()), tGrocery.getFen_qi_amount_rate(), tGrocery.getKeep_decimal()), tBalances.getFen_qi_shu(), tGrocery.getKeep_decimal()); } public TBalances firstMouth() { tBalancesNew.setId(tBalances.getId()); tBalancesNew.setContnum(tBalances.getContnum()); tBalancesNew.setAccount_time(tBalances.getAccount_time()); tBalancesNew.setFen_qi_shu(tBalances.getFen_qi_shu()); tBalancesNew.setServicemoney(tBalances.getServicemoney()); tBalancesNew.setBefore_amount(before_amount); tBalancesNew.setDone_fen_qi_amount(fen_qi_amount); tBalancesNew.setRemained_fen_qi_shu(tBalances.getFen_qi_shu() - 1); tBalancesNew.setRemained_fen_qi_amount(fen_qi_amountAll - fen_qi_amount); tBalancesNew.setCreate_date(tBalances.getCreate_date()); tBalancesNew.setPeriod_name(period_name); tBalancesNew.setFen_qi_amount(fen_qi_amount); tBalancesNew.setPeriod_fen_qi_amount(fen_qi_amount); tBalancesNew.setPeriod_fen_qi_shu(1); tBalancesNew.setContract_status(1); return tBalancesNew; } public TBalances lastMouth() { tBalancesNew.setId(tBalances.getId()); tBalancesNew.setContnum(tBalances.getContnum()); tBalancesNew.setAccount_time(tBalances.getAccount_time()); tBalancesNew.setFen_qi_shu(tBalances.getFen_qi_shu()); tBalancesNew.setServicemoney(tBalances.getServicemoney()); tBalancesNew.setDone_fen_qi_amount(fen_qi_amountAll); tBalancesNew.setCreate_date(tBalances.getCreate_date()); tBalancesNew.setBefore_amount(0.00); tBalancesNew.setRemained_fen_qi_shu(period_fen_qi_shu); tBalancesNew.setRemained_fen_qi_amount(0.00); tBalancesNew.setFen_qi_amount(MathUtil.subtract(fen_qi_amountAll, MathUtil.multiply(fen_qi_amount, (period_fen_qi_shu - 1), 2), 2)); tBalancesNew.setContract_status(2); tBalancesNew.setPeriod_name(period_name); tBalancesNew.setPeriod_fen_qi_amount(MathUtil.subtract(fen_qi_amountAll, MathUtil.multiply(fen_qi_amount, (period_fen_qi_shu - 1), 2), 2)); tBalancesNew.setPeriod_fen_qi_shu(period_fen_qi_shu); return tBalancesNew; } public TBalances middleMouth() { tBalancesNew.setId(tBalances.getId()); tBalancesNew.setContnum(tBalances.getContnum()); tBalancesNew.setAccount_time(tBalances.getAccount_time()); tBalancesNew.setFen_qi_shu(tBalances.getFen_qi_shu()); tBalancesNew.setServicemoney(tBalances.getServicemoney()); tBalancesNew.setPeriod_fen_qi_shu(period_fen_qi_shu); tBalancesNew.setContnum(tBalances.getContnum()); tBalancesNew.setAccount_time(tBalances.getAccount_time()); tBalancesNew.setFen_qi_shu(tBalances.getFen_qi_shu()); tBalancesNew.setDone_fen_qi_amount(MathUtil.multiply(period_fen_qi_shu, fen_qi_amount, 2)); tBalancesNew.setServicemoney(tBalances.getServicemoney()); tBalancesNew.setCreate_date(tBalances.getCreate_date()); tBalancesNew.setBefore_amount(0.00); tBalancesNew.setRemained_fen_qi_shu(period_fen_qi_shu); tBalancesNew.setRemained_fen_qi_amount(MathUtil.subtract(fen_qi_amountAll, MathUtil.multiply(period_fen_qi_shu, fen_qi_amount, 2), 2)); tBalancesNew.setFen_qi_amount(fen_qi_amount); tBalancesNew.setContract_status(tBalances.getContract_status()); tBalancesNew.setPeriod_name(period_name); tBalancesNew.setPeriod_fen_qi_amount(fen_qi_amount); return tBalancesNew; }}