diff --git a/src_core/com/tenwa/voucher/CreateVoucherProcess/InsertCustomerHistoryInfo.java b/src_core/com/tenwa/voucher/CreateVoucherProcess/InsertCustomerHistoryInfo.java index 31a282fd9..8813ab10d 100644 --- a/src_core/com/tenwa/voucher/CreateVoucherProcess/InsertCustomerHistoryInfo.java +++ b/src_core/com/tenwa/voucher/CreateVoucherProcess/InsertCustomerHistoryInfo.java @@ -6,6 +6,7 @@ import com.amarsoft.awe.util.SqlObject; import com.amarsoft.awe.util.Transaction; import com.amarsoft.context.ASUser; import com.tenwa.comm.util.date.DateAssistant; +import com.tenwa.lease.flow.project.businessapply.LBBusinessPrimary; import com.tenwa.reckon.util.Conn; import java.math.BigDecimal; @@ -76,7 +77,7 @@ public class InsertCustomerHistoryInfo { String jq_contract_num = "select count(lci.ID) as num from lb_union_lessee lul left join lb_contract_info lci on lci.id = lul.CONTRACT_ID where lul.customer_id = '"+customerid+"' and lul.IS_MAIN = 'Y' and lci.CONTRACT_STATUS in ('100','105') group by lul.customer_id"; List> jq_num = conn.executeQuery(jq_contract_num); String jq_number = ""; - if(rz.size()>0){ + if(jq_num.size()>0){ jq_number = jq_num.get(0).get("num"); }else { jq_number = "0"; @@ -289,67 +290,13 @@ public class InsertCustomerHistoryInfo { db_penalty_over = "0"; } //客户敞口计算 - String ck_money_rz = "select sum(nvl(PLAN_MONEY,0)) as money from lb_union_lessee lul left join lc_fund_plan lfp on lul.CONTRACT_ID = lfp.CONTRACT_ID and lfp.FEE_TYPE = 'feetype10' where lul.CUSTOMER_ID = '"+customerid+"' group by lul.CUSTOMER_ID"; - String ck_moeny_bz = "select sum(nvl(PLAN_MONEY,0)) as money from lb_union_lessee lul left join lc_fund_plan lfp on lul.CONTRACT_ID = lfp.CONTRACT_ID and lfp.FEE_TYPE = 'feetype2' where lul.CUSTOMER_ID = '"+customerid+"' group by lul.CUSTOMER_ID"; - String ck_money_bc = "select nvl(CLEAN_LEASE_MONEY,0) - nvl(CAUTION_MONEY,0) as bc_money from lc_calc_condition_temp lcct where FLOWUNID = '"+flowunid+"'"; - //担保人敞口计算 - String dbck_moneny_rz = "select sum(nvl(PLAN_MONEY,0)) as money from LB_GUARANTEE_UNIT lgu left join lc_fund_income lfi on lgu.CONTRACT_ID lgu.CONTRACT_ID and lfi.FEE_TYPE = 'feetype10' where lgu.CERTID = '"+certid+"'"; - String dbck_moeny_bz = "select sum(nvl(PLAN_MONEY,0)) as money from LB_GUARANTEE_UNIT lgu left join lc_fund_income lfi on lgu.CONTRACT_ID lgu.CONTRACT_ID and lfi.FEE_TYPE = 'feetype2' where lgu.CERTID = '"+certid+"'"; - String dbck_money_bq = "select nvl(CLEAN_LEASE_MONEY,0) - nvl(CAUTION_MONEY,0) as bc_money from lb_guarantee_unit_temp lgut left join lc_calc_condition_temp lcct on lgut.FLOWUNID = lcct.FLOWUNID where lgut.FLOWUNID = '"+flowunid+"'"; - - List> ckmoney_rz = conn.executeQuery(ck_money_rz); - List> ckmoeny_bz = conn.executeQuery(ck_moeny_bz); - List> ckmoney_bc = conn.executeQuery(ck_money_bc); - String ckmoney_rzy = ""; - String ckmoeny_bzy = ""; - String ckmoney_bcy = ""; - if(ckmoney_rz.size()>0){ - ckmoney_rzy = ckmoney_rz.get(0).get("money"); - }else { - ckmoney_rzy = "0"; - } - if(ckmoeny_bz.size()>0){ - ckmoeny_bzy = ckmoeny_bz.get(0).get("money"); - }else { - ckmoeny_bzy = "0"; - } - if(ckmoney_bc.size()>0){ - ckmoney_bcy = ckmoney_bc.get(0).get("bc_money"); - }else { - ckmoney_bcy = "0"; - } - - List> dbckmoneny_rz = conn.executeQuery(dbck_moneny_rz); - List> dbckmoeny_bz = conn.executeQuery(dbck_moeny_bz); - List> dbckmoney_bq = conn.executeQuery(dbck_money_bq); - - String dbckmoneny_rzy = ""; - String dbckmoeny_bzy = ""; - String dbckmoney_bqy = ""; - if(dbckmoneny_rz.size()>0){ - dbckmoneny_rzy = dbckmoneny_rz.get(0).get("money"); - }else { - dbckmoneny_rzy = "0"; - } - if(dbckmoeny_bz.size()>0){ - dbckmoeny_bzy = dbckmoeny_bz.get(0).get("money"); - }else { - dbckmoeny_bzy = "0"; - } - if(dbckmoney_bq.size()>0){ - dbckmoney_bqy = dbckmoney_bq.get(0).get("bc_money"); - }else { - dbckmoney_bqy = "0"; - } - - BigDecimal money = new BigDecimal(ckmoney_rzy).subtract(new BigDecimal(ckmoeny_bzy)).add(new BigDecimal(ckmoney_bcy)).add(new BigDecimal(dbckmoneny_rzy)).subtract(new BigDecimal(dbckmoeny_bzy)).add(new BigDecimal(dbckmoney_bqy)); - - //录入客户历史信息表 Transaction sqlca = Transaction.createTransaction(tx); + BigDecimal exposureMoney = LBBusinessPrimary.obtainExposureMoney(sqlca,flowunid); + //录入客户历史信息表 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)"+ "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_penalty_over+"',"+ "'"+gtgmnumber+"','"+GT_CLEAN_LEASE_MONEY+"','"+gt_jq_number+"','"+gt_wjq_number+"','"+gtcarnumber+"','"+gtcarjqnumber+"','"+gtcarwjqnumber+"','"+gt_rent_over+"','"+gt_penalty_over+"',"+ - "'"+dbgmnumber+"','"+DB_CLEAN_LEASE_MONEY+"','"+db_jq_number+"','"+db_wjq_number+"','"+dbcarnumber+"','"+dbcarjqnumber+"','"+dbcarwjqnumber+"','"+db_rent_over+"','"+db_penalty_over+"','"+money+"')"; + "'"+dbgmnumber+"','"+DB_CLEAN_LEASE_MONEY+"','"+db_jq_number+"','"+db_wjq_number+"','"+dbcarnumber+"','"+dbcarjqnumber+"','"+dbcarwjqnumber+"','"+db_rent_over+"','"+db_penalty_over+"','"+exposureMoney+"')"; SqlObject sqlObject = new SqlObject(ssql); sqlca.executeSQL(sqlObject);