diff --git a/src_core/com/tenwa/voucher/CreateVoucherProcess/InsertCustomerHistoryInfo.java b/src_core/com/tenwa/voucher/CreateVoucherProcess/InsertCustomerHistoryInfo.java index 3f112f2d2..abd388245 100644 --- a/src_core/com/tenwa/voucher/CreateVoucherProcess/InsertCustomerHistoryInfo.java +++ b/src_core/com/tenwa/voucher/CreateVoucherProcess/InsertCustomerHistoryInfo.java @@ -15,6 +15,8 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; +import static com.ctc.wstx.shaded.msv_core.datatype.xsd.WhiteSpaceProcessor.replace; + public class InsertCustomerHistoryInfo { private String flowunid; @@ -55,12 +57,15 @@ public class InsertCustomerHistoryInfo { if(customerinfo.size()>0){ for (int i = 0; i < customerinfo.size(); i++) { + + Conn con = new Conn(tx); + customerid = customerinfo.get(i).get("customerid"); certid = customerinfo.get(i).get("certid"); //获取客户为主承租人订单总数 String gm_nu = "select count(lul.id) as num from customer_person cp left join lb_union_lessee lul on lul.CUSTOMER_ID = cp.CUSTOMERID where cp.CERTID = '"+certid+"' and lul.IS_MAIN = 'Y' group by cp.CERTID"; - List> gm_number = conn.executeQuery(gm_nu); + List> gm_number = con.executeQuery(gm_nu); String gmnum = ""; if(gm_number.size()>0){ gmnum = gm_number.get(0).get("num"); @@ -69,7 +74,7 @@ public class InsertCustomerHistoryInfo { } ///获取客户为主承租融资金额和 String sum_rz = "select format(sum(nvl(CLEAN_LEASE_MONEY,0)),2) as CLEAN_LEASE_MONEY from customer_person cp left join lb_union_lessee lul on lul.CUSTOMER_ID = cp.CUSTOMERID left join lb_contract_info lci on lci.id = lul.CONTRACT_ID left join lc_calc_condition lcc on lcc.CONTRACT_ID = lul.CONTRACT_ID where cp.CERTID = '"+certid+"' and lul.IS_MAIN = 'Y' and lci.CONTRACT_STATUS >=31 and lci.CONTRACT_STATUS <> '104' group by cp.CERTID"; - List> rz = conn.executeQuery(sum_rz); + List> rz = con.executeQuery(sum_rz); String CLEAN_LEASE_MONEY = ""; if(rz.size()>0){ CLEAN_LEASE_MONEY = rz.get(0).get("clean_lease_money"); @@ -78,7 +83,7 @@ public class InsertCustomerHistoryInfo { } //获取客户为主承租已结清合同数 String jq_contract_num = "select count(lci.ID) as num from customer_person cp left join lb_union_lessee lul on lul.CUSTOMER_ID = cp.CUSTOMERID left join lb_contract_info lci on lci.id = lul.CONTRACT_ID where cp.CERTID = '"+certid+"' and lul.IS_MAIN = 'Y' and lci.CONTRACT_STATUS in ('100','105') group by cp.CERTID"; - List> jq_num = conn.executeQuery(jq_contract_num); + List> jq_num = con.executeQuery(jq_contract_num); String jq_number = ""; if(jq_num.size()>0){ jq_number = jq_num.get(0).get("num"); @@ -87,7 +92,7 @@ public class InsertCustomerHistoryInfo { } //获取客户为主承租未结清合同数 String wjq_contract_num = "select count(lci.ID) as num from customer_person cp left join lb_union_lessee lul on lul.CUSTOMER_ID = cp.CUSTOMERID left join lb_contract_info lci on lci.id = lul.CONTRACT_ID where cp.CERTID = '"+certid+"' and lul.IS_MAIN = 'Y' and lci.CONTRACT_STATUS >=31 and lci.CONTRACT_STATUS <= 100 group by cp.CERTID"; - List> wjq_num = conn.executeQuery(wjq_contract_num); + List> wjq_num = con.executeQuery(wjq_contract_num); String wjq_number = ""; if(wjq_num.size()>0){ wjq_number = wjq_num.get(0).get("num"); @@ -96,7 +101,7 @@ public class InsertCustomerHistoryInfo { } //获取客户为主承租车辆总和 String car_num = "select count(lec.ID) as num from customer_person cp left join lb_union_lessee lul on lul.CUSTOMER_ID = cp.CUSTOMERID left join lb_equipment_car lec on lec.CONTRACT_ID = lul.CONTRACT_ID where cp.CERTID = '"+certid+"' and lul.IS_MAIN = 'Y' and lec.car_attribute = 'head' group by cp.CERTID"; - List> car_number = conn.executeQuery(car_num); + List> car_number = con.executeQuery(car_num); String carnumber = ""; if(car_number.size()>0){ carnumber = car_number.get(0).get("num"); @@ -105,7 +110,7 @@ public class InsertCustomerHistoryInfo { } //获取客户为主承租结清车辆总和 String car_jq_num = "select count(lec.ID) as num from customer_person cp left join lb_union_lessee lul on lul.CUSTOMER_ID = cp.CUSTOMERID left join lb_equipment_car lec on lec.CONTRACT_ID = lul.CONTRACT_ID left join lb_contract_info lci on lci.id = lul.CONTRACT_ID where cp.CERTID = '"+certid+"' and lul.IS_MAIN = 'Y' and lci.CONTRACT_STATUS in ('100','105') and lec.car_attribute = 'head' group by cp.CERTID"; - List> car_jq_number = conn.executeQuery(car_jq_num); + List> car_jq_number = con.executeQuery(car_jq_num); String carjqnumber = ""; if(car_jq_number.size()>0){ carjqnumber = car_jq_number.get(0).get("num"); @@ -114,7 +119,7 @@ public class InsertCustomerHistoryInfo { } //获取客户为主承租未结清车辆总和 String car_wjq_num = "select count(lec.ID) as num from customer_person cp left join lb_union_lessee lul on lul.CUSTOMER_ID = cp.CUSTOMERID left join lb_equipment_car lec on lec.CONTRACT_ID = lul.CONTRACT_ID left join lb_contract_info lci on lci.id = lul.CONTRACT_ID where cp.CERTID = '"+certid+"' and lul.IS_MAIN = 'Y' and lci.CONTRACT_STATUS >='31' and lci.CONTRACT_STATUS <= '100' and lec.car_attribute = 'head' group by cp.CERTID"; - List> car_wjq_number = conn.executeQuery(car_wjq_num); + List> car_wjq_number = con.executeQuery(car_wjq_num); String carwjqnumber = ""; if(car_wjq_number.size()>0){ carwjqnumber = car_wjq_number.get(0).get("num"); @@ -122,17 +127,19 @@ public class InsertCustomerHistoryInfo { carwjqnumber = "0"; } //获取客户为主承租剩余租金,逾期租金 - String money_num = "select format(sum(nvl(corpus_over,0)),2) as corpus_over from customer_person cp left join lb_union_lessee lul on lul.CUSTOMER_ID = cp.CUSTOMERID left join vi_rent_plan vrps on lul.contract_id = vrps.contract_id where cp.CERTID = '"+certid+"' and lul.IS_MAIN = 'Y' group by cp.CERTID"; - List> money_number = conn.executeQuery(money_num); - String yqmoney_num = "select format(sum(nvl(rent_over, 0)), 2) as yqrent_over from customer_person cp left join lb_union_lessee lul on lul.CUSTOMER_ID = cp.CUSTOMERID left join vi_rent_plan vrp on lul.contract_id = vrp.contract_id where cp.CERTID = '"+certid+"' and lul.IS_MAIN = 'Y' and STR_TO_DATE(vrp.plan_date,'%Y/%m/%d') < now() group by cp.CERTID"; - List> yqmoney_number = conn.executeQuery(yqmoney_num); - String czr_rent_over = ""; - String czr_yqrent_over = ""; - if(money_number.size()>0){ - czr_rent_over = money_number.get(0).get("corpus_over"); - }else { - czr_rent_over = "0"; + //总实收 + String ssmoney_num = "select sum(nvl(lri.corpus, 0)) as corpus from customer_person cp left join lb_union_lessee lul on lul.CUSTOMER_ID = cp.CUSTOMERID left join lc_rent_income lri on lul.CONTRACT_ID = lri.CONTRACT_ID where cp.CERTID = '"+certid+"' and lul.IS_MAIN = 'Y' group by cp.CERTID"; + List> ssmoney_number = con.executeQuery(ssmoney_num); + BigDecimal ssmoney = new BigDecimal(0); + if(ssmoney_number.size()!=0){ + ssmoney = new BigDecimal(ssmoney_number.get(0).get("corpus")); } + //剩余本金 + BigDecimal czr_rent_over = new BigDecimal(CLEAN_LEASE_MONEY.replace(",","")).subtract(ssmoney); + + String yqmoney_num = "select format(sum(nvl(rent_over, 0)), 2) as yqrent_over from customer_person cp left join lb_union_lessee lul on lul.CUSTOMER_ID = cp.CUSTOMERID left join vi_rent_plan vrp on lul.contract_id = vrp.contract_id where cp.CERTID = '"+certid+"' and lul.IS_MAIN = 'Y' and STR_TO_DATE(vrp.plan_date,'%Y/%m/%d') < now() group by cp.CERTID"; + List> yqmoney_number = con.executeQuery(yqmoney_num); + String czr_yqrent_over = ""; if(yqmoney_number.size()>0){ czr_yqrent_over = yqmoney_number.get(0).get("yqrent_over"); }else { @@ -140,7 +147,7 @@ public class InsertCustomerHistoryInfo { } //获取客户为共同承租人订单总数 String gt_gm_nu = "select count(cf.id) as num from customer_family cf where cf.Partner_ = 'Y' and cf.certid = '"+certid+"' group by certid"; - List> gt_gm_number = conn.executeQuery(gt_gm_nu); + List> gt_gm_number = con.executeQuery(gt_gm_nu); String gtgmnumber = ""; if(gt_gm_number.size()>0){ gtgmnumber = gt_gm_number.get(0).get("num"); @@ -149,7 +156,7 @@ public class InsertCustomerHistoryInfo { } //获取客户为共同承租人融资额和 String gt_sum_rz = "select format(sum(nvl(CLEAN_LEASE_MONEY,0)),2) as CLEAN_LEASE_MONEY from customer_family cf left join lb_union_lessee lul on cf.PROJECT_ID = lul.PROJECT_ID left join lb_contract_info lci on lci.id = lul.CONTRACT_ID left join lc_calc_condition lcc on lcc.CONTRACT_ID = lul.CONTRACT_ID where cf.certid = '"+certid+"' and cf.Partner_ = 'Y' and lci.CONTRACT_STATUS >=31 and lci.CONTRACT_STATUS <> '104' group by cf.certid"; - List> gt_rz = conn.executeQuery(gt_sum_rz); + List> gt_rz = con.executeQuery(gt_sum_rz); String GT_CLEAN_LEASE_MONEY = ""; if(gt_rz.size()>0){ GT_CLEAN_LEASE_MONEY = gt_rz.get(0).get("clean_lease_money"); @@ -158,7 +165,7 @@ public class InsertCustomerHistoryInfo { } //获取客户为共同承租人已结清单数 String gt_jq_contract_num = "select count(lci.ID) as num from customer_family cf left join lb_union_lessee lul on lul.PROJECT_ID = cf.PROJECT_ID left join lb_contract_info lci on lci.id = lul.CONTRACT_ID where cf.certid = '"+certid+"' and cf.Partner_ = 'Y' and lci.CONTRACT_STATUS in ('100','105') group by cf.certid"; - List> gt_jq_num = conn.executeQuery(gt_jq_contract_num); + List> gt_jq_num = con.executeQuery(gt_jq_contract_num); String gt_jq_number = ""; if(gt_jq_num.size()>0){ gt_jq_number = gt_jq_num.get(0).get("num"); @@ -167,7 +174,7 @@ public class InsertCustomerHistoryInfo { } //获取客户为共同承租人未结清单数 String gt_wjq_contract_num = "select count(lci.ID) as num from customer_family cf left join lb_union_lessee lul on lul.PROJECT_ID = cf.PROJECT_ID left join lb_contract_info lci on lci.id = lul.CONTRACT_ID where cf.certid = '"+certid+"' and cf.Partner_ = 'Y' and lci.CONTRACT_STATUS >=31 and lci.CONTRACT_STATUS <= 100 group by cf.certid"; - List> gt_wjq_num = conn.executeQuery(gt_wjq_contract_num); + List> gt_wjq_num = con.executeQuery(gt_wjq_contract_num); String gt_wjq_number = ""; if(gt_wjq_num.size()>0){ gt_wjq_number = gt_wjq_num.get(0).get("num"); @@ -176,7 +183,7 @@ public class InsertCustomerHistoryInfo { } //获取客户为共同承租人车辆总和 String gt_car_num = "select count(lec.ID) as num from customer_family cf left join lb_union_lessee lul on cf.PROJECT_ID = cf.PROJECT_ID left join lb_equipment_car lec on lec.CONTRACT_ID = lul.CONTRACT_ID where cf.certid = '"+certid+"' and cf.Partner_ = 'Y' and lec.car_attribute = 'head' group by cf.certid"; - List> gt_car_number = conn.executeQuery(gt_car_num); + List> gt_car_number = con.executeQuery(gt_car_num); String gtcarnumber = ""; if(gt_car_number.size()>0){ gtcarnumber = gt_car_number.get(0).get("num"); @@ -185,7 +192,7 @@ public class InsertCustomerHistoryInfo { } //获取客户为共同承租人结清车辆总和 String gt_car_jq_num = "select count(lec.ID) as num from customer_family cf left join lb_union_lessee lul on cf.PROJECT_ID = cf.PROJECT_ID left join lb_equipment_car lec on lec.CONTRACT_ID = lul.CONTRACT_ID left join lb_contract_info lci on lci.id = lul.CONTRACT_ID where cf.certid = '"+certid+"' and cf.Partner_ = 'Y' and lci.CONTRACT_STATUS in ('100','105') and lec.car_attribute = 'head' group by cf.certid"; - List> gt_car_jq_number = conn.executeQuery(gt_car_jq_num); + List> gt_car_jq_number = con.executeQuery(gt_car_jq_num); String gtcarjqnumber = ""; if(gt_car_jq_number.size()>0){ gtcarjqnumber = gt_car_jq_number.get(0).get("num"); @@ -194,7 +201,7 @@ public class InsertCustomerHistoryInfo { } //获取客户为共同承租人未结清车辆总和 String gt_car_wjq_num = "select count(lec.ID) as num from customer_family cf left join lb_union_lessee lul on cf.PROJECT_ID = cf.PROJECT_ID left join lb_equipment_car lec on lec.CONTRACT_ID = lul.CONTRACT_ID left join lb_contract_info lci on lci.id = lul.CONTRACT_ID where cf.certid = '"+certid+"' and cf.Partner_ = 'Y' and lci.CONTRACT_STATUS >='31' and lci.CONTRACT_STATUS <= '100' and lec.car_attribute = 'head' group by cf.certid"; - List> gt_car_wjq_number = conn.executeQuery(gt_car_wjq_num); + List> gt_car_wjq_number = con.executeQuery(gt_car_wjq_num); String gtcarwjqnumber = ""; if(gt_car_wjq_number.size()>0){ gtcarwjqnumber = gt_car_wjq_number.get(0).get("num"); @@ -202,17 +209,20 @@ public class InsertCustomerHistoryInfo { gtcarwjqnumber = "0"; } //获取客户为共同承租人剩余租金,罚息 - String gt_money_num = "select format(sum(nvl(corpus_over,0)),2) as corpus_over from customer_family cf left join lb_union_lessee lul on cf.PROJECT_ID = cf.PROJECT_ID left join vi_rent_plan vrps on lul.contract_id = vrps.contract_id where cf.certid = '"+certid+"' and cf.Partner_ = 'Y' group by cf.certid"; - List> gt_money_number = conn.executeQuery(gt_money_num); - String gt_yqmoney_num = "select format(sum(nvl(rent_over, 0)), 2) as yqrent_over from customer_family cf left join lb_union_lessee lul on cf.PROJECT_ID = lul.PROJECT_ID left join vi_rent_plan vrp on lul.contract_id = vrp.contract_id where cf.certid = '"+certid+"' and cf.Partner_ = 'Y' and STR_TO_DATE(vrp.plan_date,'%Y/%m/%d') < now() group by cf.certid"; - List> gt_yqmoney_number = conn.executeQuery(gt_yqmoney_num); - String gt_rent_over = ""; - String gt_yqrent_over = ""; - if(gt_money_number.size()>0){ - gt_rent_over = gt_money_number.get(0).get("corpus_over"); - }else { - gt_rent_over = "0"; + //总实收 + String ssgt_money_num = "select sum(nvl(corpus, 0)) as corpus from customer_family cf left join lb_union_lessee lul on cf.PROJECT_ID = lul.PROJECT_ID left join lc_rent_income lri on lul.contract_id = lri.contract_id where cf.certid = '"+certid+"' and cf.Partner_ = 'Y' group by cf.certid"; + List> ssgt_money_number = con.executeQuery(ssgt_money_num); + BigDecimal ssgt_money = new BigDecimal(0); + if(ssgt_money_number.size()!=0){ + ssgt_money = new BigDecimal(ssgt_money_number.get(0).get("corpus")); } + + //总剩余本金 + BigDecimal gt_rent_over = new BigDecimal(GT_CLEAN_LEASE_MONEY.replace(",","")).subtract(ssgt_money); + + String gt_yqmoney_num = "select format(sum(nvl(rent_over, 0)), 2) as yqrent_over from customer_family cf left join lb_union_lessee lul on cf.PROJECT_ID = lul.PROJECT_ID left join vi_rent_plan vrp on lul.contract_id = vrp.contract_id where cf.certid = '"+certid+"' and cf.Partner_ = 'Y' and STR_TO_DATE(vrp.plan_date,'%Y/%m/%d') < now() group by cf.certid"; + List> gt_yqmoney_number = con.executeQuery(gt_yqmoney_num); + String gt_yqrent_over = ""; if(gt_yqmoney_number.size()>0){ gt_yqrent_over = gt_yqmoney_number.get(0).get("yqrent_over"); }else { @@ -220,7 +230,7 @@ public class InsertCustomerHistoryInfo { } //获取客户为担保人订单总数 String db_gm_nu = "select count(lgu.id) as num from lb_guarantee_unit lgu where lgu.certid = '"+certid+"' group by lgu.certid"; - List> db_gm_number = conn.executeQuery(db_gm_nu); + List> db_gm_number = con.executeQuery(db_gm_nu); String dbgmnumber = ""; if(db_gm_number.size()>0){ dbgmnumber = db_gm_number.get(0).get("num"); @@ -229,7 +239,7 @@ public class InsertCustomerHistoryInfo { } //获取客户为担保人融资额和 String db_sum_rz = "select format(sum(nvl(CLEAN_LEASE_MONEY,0)),2) as CLEAN_LEASE_MONEY from lb_guarantee_unit lgu left join lb_contract_info lci on lci.id = lgu.CONTRACT_ID left join lc_calc_condition lcc on lcc.CONTRACT_ID = lgu.CONTRACT_ID where lgu.certid = '"+certid+"' and lci.CONTRACT_STATUS >=31 and lci.CONTRACT_STATUS <> '104' group by lgu.certid"; - List> db_rz = conn.executeQuery(db_sum_rz); + List> db_rz = con.executeQuery(db_sum_rz); String DB_CLEAN_LEASE_MONEY = ""; if(db_rz.size()>0){ DB_CLEAN_LEASE_MONEY = db_rz.get(0).get("clean_lease_money"); @@ -238,7 +248,7 @@ public class InsertCustomerHistoryInfo { } //获取客户为担保人已结清单数 String db_jq_contract_num = "select count(lci.ID) as num from lb_guarantee_unit lgu left join lb_contract_info lci on lci.id = lgu.CONTRACT_ID where lgu.certid = '"+certid+"' and lci.CONTRACT_STATUS in ('100','105') group by lgu.certid"; - List> db_jq_num = conn.executeQuery(db_jq_contract_num); + List> db_jq_num = con.executeQuery(db_jq_contract_num); String db_jq_number = ""; if(db_jq_num.size()>0){ db_jq_number = db_jq_num.get(0).get("num"); @@ -247,7 +257,7 @@ public class InsertCustomerHistoryInfo { } //获取客户为担保人未结清单数 String db_wjq_contract_num = "select count(lci.ID) as num from lb_guarantee_unit lgu left join lb_contract_info lci on lci.id = lgu.CONTRACT_ID where lgu.certid = '"+certid+"' and lci.CONTRACT_STATUS >=31 and lci.CONTRACT_STATUS <= 100 group by lgu.certid"; - List> db_wjq_num = conn.executeQuery(db_wjq_contract_num); + List> db_wjq_num = con.executeQuery(db_wjq_contract_num); String db_wjq_number = ""; if(db_wjq_num.size()>0){ db_wjq_number = db_wjq_num.get(0).get("num"); @@ -256,7 +266,7 @@ public class InsertCustomerHistoryInfo { } //获取客户为担保人车辆总和 String db_car_num = "select count(lec.ID) as num from lb_guarantee_unit lgu left join lb_equipment_car lec on lec.CONTRACT_ID = lgu.CONTRACT_ID where lgu.certid = '"+certid+"' and lec.car_attribute = 'head' group by lgu.certid"; - List> db_car_number = conn.executeQuery(db_car_num); + List> db_car_number = con.executeQuery(db_car_num); String dbcarnumber = ""; if(db_car_number.size()>0){ dbcarnumber = db_car_number.get(0).get("num"); @@ -265,7 +275,7 @@ public class InsertCustomerHistoryInfo { } //获取客户为担保人结清车辆总和 String db_car_jq_num = "select count(lec.ID) as num from lb_guarantee_unit lgu left join lb_equipment_car lec on lec.CONTRACT_ID = lgu.CONTRACT_ID left join lb_contract_info lci on lci.id = lgu.CONTRACT_ID where lgu.certid = '"+certid+"' and lci.CONTRACT_STATUS in ('100','105') and lec.car_attribute = 'head' group by lgu.certid"; - List> db_car_jq_number = conn.executeQuery(db_car_jq_num); + List> db_car_jq_number = con.executeQuery(db_car_jq_num); String dbcarjqnumber = ""; if(db_car_jq_number.size()>0){ dbcarjqnumber = db_car_jq_number.get(0).get("num"); @@ -274,7 +284,7 @@ public class InsertCustomerHistoryInfo { } //获取客户为担保人结清车辆总和 String db_car_wjq_num = "select count(lec.ID) as num from lb_guarantee_unit lgu left join lb_equipment_car lec on lec.CONTRACT_ID = lgu.CONTRACT_ID left join lb_contract_info lci on lci.id = lgu.CONTRACT_ID where lgu.certid = '"+certid+"' and lci.CONTRACT_STATUS >='31' and lci.CONTRACT_STATUS <= '100' and lec.car_attribute = 'head' group by lgu.certid"; - List> db_car_wjq_number = conn.executeQuery(db_car_wjq_num); + List> db_car_wjq_number = con.executeQuery(db_car_wjq_num); String dbcarwjqnumber = ""; if(db_car_wjq_number.size()>0){ dbcarwjqnumber = db_car_wjq_number.get(0).get("num"); @@ -282,17 +292,19 @@ public class InsertCustomerHistoryInfo { dbcarwjqnumber = "0"; } //获取客户为担保人剩余租金,罚息 - String db_money_num = "select format(sum(nvl(corpus_over, 0)), 2) as corpus_over from lb_guarantee_unit lgu left join vi_rent_plan vrp on lgu.contract_id = vrp.contract_id where lgu.certid = '"+certid+"' group by lgu.certid"; - List> db_money_number = conn.executeQuery(db_money_num); - String db_yqmoney_num = "select format(sum(nvl(rent_over, 0)), 2) as yqrent_over from lb_guarantee_unit lgu left join vi_rent_plan vrp on lgu.contract_id = vrp.contract_id where lgu.certid = '"+certid+"' and STR_TO_DATE(vrp.plan_date,'%Y/%m/%d') < now() group by lgu.certid"; - List> db_yqmoney_number = conn.executeQuery(db_yqmoney_num); - String db_rent_over = ""; - String db_yqrent_over = ""; - if(db_money_number.size()>0){ - db_rent_over = db_money_number.get(0).get("corpus_over"); - }else { - db_rent_over = "0"; + //总实收 + String ssdb_money_num = "select sum(nvl(corpus, 0)) as corpus from lb_guarantee_unit lgu left join lc_rent_income lri on lgu.contract_id = lri.contract_id where lgu.certid = '"+certid+"' group by lgu.certid"; + List> ssdb_money_number = con.executeQuery(ssdb_money_num); + BigDecimal ssdb_money = new BigDecimal(0); + if(ssdb_money_number.size()!=0){ + ssdb_money = new BigDecimal(ssdb_money_number.get(0).get("corpus")); } + //总剩余本金 + BigDecimal db_rent_over = new BigDecimal(DB_CLEAN_LEASE_MONEY.replace(",","")).subtract(ssdb_money); + + String db_yqmoney_num = "select format(sum(nvl(rent_over, 0)), 2) as yqrent_over from lb_guarantee_unit lgu left join vi_rent_plan vrp on lgu.contract_id = vrp.contract_id where lgu.certid = '"+certid+"' and STR_TO_DATE(vrp.plan_date,'%Y/%m/%d') < now() group by lgu.certid"; + List> db_yqmoney_number = con.executeQuery(db_yqmoney_num); + String db_yqrent_over = ""; if(db_yqmoney_number.size()>0){ db_yqrent_over = db_yqmoney_number.get(0).get("yqrent_over"); }else { @@ -305,10 +317,10 @@ public class InsertCustomerHistoryInfo { exposureMoney = BigDecimal.valueOf(0); } //录入客户历史信息表 - String ssql = "insert into customer_history_info_temp(id,customerid,customername,certtype,certid,customertype,customer_num,flowunid,project_id,clientbuynumber,clientfinancingamount,clientclosedaccount,clientunsettled,clientvehiclepopulation,clientclosedvehicle,clientoutstandingvehicle,clientloanbalance,clientoverdueamount,jointlybuynumber,jointlyfinancingamount,jointlyclosedaccount,jointlyunsettled,jointlyveh,jointlyclosedvehicle,jointlyout,jointlyloanbalance,jointlyoverdueamount,guaranteebuynumber,guaranteefin,guaranteeclosedaccount,guaranteeunsettled,guaranteeveh,guaranteeclosedvehicle,guaranteeout,guaranteeloanbalance,guaranteeoverdueamount,exposure)"+ + String ssql = "insert into customer_history_info_temp(id,customerid,customername,certtype,certid,customertype,customer_num,flowunid,project_id,clientbuynumber,clientfinancingamount,clientclosedaccount,clientunsettled,clientvehiclepopulation,clientclosedvehicle,clientoutstandingvehicle,clientloanbalance,clientoverdueamount,jointlybuynumber,jointlyfinancingamount,jointlyclosedaccount,jointlyunsettled,jointlyveh,jointlyclosedvehicle,jointlyout,jointlyloanbalance,jointlyoverdueamount,guaranteebuynumber,guaranteefin,guaranteeclosedaccount,guaranteeunsettled,guaranteeveh,guaranteeclosedvehicle,guaranteeout,guaranteeloanbalance,guaranteeoverdueamount,exposure,inputtime)"+ "VALUES(replace(uuid(),'-',''),'"+customerinfo.get(i).get("customerid")+"','"+customerinfo.get(i).get("customername")+"','"+customerinfo.get(i).get("certtype")+"','"+customerinfo.get(i).get("certid")+"','"+customerinfo.get(i).get("customertype")+"','"+customerinfo.get(i).get("customer_num")+"','"+flowunid+"','"+customerinfo.get(i).get("project_id")+"','"+gmnum+"','"+CLEAN_LEASE_MONEY+"','"+jq_number+"','"+wjq_number+"','"+carnumber+"','"+carjqnumber+"','"+carwjqnumber+"','"+czr_rent_over+"','"+czr_yqrent_over+"',"+ "'"+gtgmnumber+"','"+GT_CLEAN_LEASE_MONEY+"','"+gt_jq_number+"','"+gt_wjq_number+"','"+gtcarnumber+"','"+gtcarjqnumber+"','"+gtcarwjqnumber+"','"+gt_rent_over+"','"+gt_yqrent_over+"',"+ - "'"+dbgmnumber+"','"+DB_CLEAN_LEASE_MONEY+"','"+db_jq_number+"','"+db_wjq_number+"','"+dbcarnumber+"','"+dbcarjqnumber+"','"+dbcarwjqnumber+"','"+db_rent_over+"','"+db_yqrent_over+"','"+exposureMoney+"')"; + "'"+dbgmnumber+"','"+DB_CLEAN_LEASE_MONEY+"','"+db_jq_number+"','"+db_wjq_number+"','"+dbcarnumber+"','"+dbcarjqnumber+"','"+dbcarwjqnumber+"','"+db_rent_over+"','"+db_yqrent_over+"','"+exposureMoney+"',replace(now(),'-','/'))"; SqlObject sqlObject = new SqlObject(ssql); sqlca.executeSQL(sqlObject);