历史客户信息查询主承租人取值修改

This commit is contained in:
zzk 2023-09-21 18:38:11 +08:00
parent 04e7e91ef8
commit a9fbb90137
2 changed files with 350 additions and 8 deletions

View File

@ -9,7 +9,7 @@
String RightType=CurPage.getParameter("RightType");
String productId=CurPage.getParameter("ProductId");
String projectId=CurPage.getParameter("ProjectId");
String khcertid = Sqlca.getString("select ci.certid from lb_union_lessee_temp lul left join customer_info ci on ci.customerid = lul.CUSTOMER_ID where lul.IS_MAIN = 'Y' and lul.flowunid='"+flowunid+"'");
String khcertid = Sqlca.getString("select cpt.certid from lb_union_lessee_temp lul left join customer_person_temp cpt on cpt.FLOWUNID = lul.FLOWUNID where lul.IS_MAIN = 'Y' and lul.flowunid='"+flowunid+"'");
String gtcertid = Sqlca.getString("select cf.certid from customer_family_temp cf where cf.Partner_ = 'Y' and cf.flowunid='"+flowunid+"'");
String dbcertid = Sqlca.getString("select CERTID from lb_guarantee_unit_temp where flowunid='"+flowunid+"' order by CERTID asc limit 1");
String dbcertid2 = Sqlca.getString("select CERTID from lb_guarantee_unit_temp where flowunid='"+flowunid+"' order by CERTID desc limit 1");

View File

@ -12,6 +12,7 @@ import com.tenwa.reckon.util.Conn;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -37,13 +38,13 @@ public class InsertCustomerHistoryInfo {
Conn conn = new Conn(tx);
String flowunid = this.flowunid;
//获取客户基本信息
String sql = "select ci.customerid,ci.customername,ci.certtype,ci.certid,'主承租人' as customertype,ci.customer_num,lul.FLOWUNID,lul.project_id from customer_info ci left join lb_union_lessee_temp lul on lul.customer_id = ci.customerid where lul.IS_MAIN = 'Y' and lul.FLOWUNID = '" + flowunid + "' \n" +
String sql = "select cpt.customerid,cpt.FULLNAME as customername,cpt.certtype,cpt.certid,'主承租人' as customertype,'' as customer_num,lul.FLOWUNID,lul.project_id from customer_person_temp cpt left join lb_union_lessee_temp lul on cpt.FLOWUNID = lul.FLOWUNID where lul.IS_MAIN = 'Y' and lul.FLOWUNID = '"+flowunid+"' \n" +
"union \n" +
"select lgu.ASSUROR as customerid,lgu.FULLNAME as customername,lgu.CERTTYPE,lgu.certid,'担保人' as customertype,'' as customer_num,lgu.FLOWUNID,lgu.project_id from lb_guarantee_unit_temp lgu where lgu.FLOWUNID = '" + flowunid + "'\n" +
"select lgu.ASSUROR as customerid,lgu.FULLNAME as customername,lgu.CERTTYPE,lgu.certid,'担保人' as customertype,'' as customer_num,lgu.FLOWUNID,lgu.project_id from lb_guarantee_unit_temp lgu where lgu.FLOWUNID = '"+flowunid+"'\n" +
"union \n" +
"select '' as customerid,cf.name as customername,cf.CERTTYPE,cf.certid,'共同承租人' as customertype,'' as customer_num,cf.FLOWUNID,cf.PROJECT_ID from customer_family_temp cf where cf.FLOWUNID = '" + flowunid + "'\n";
"select '' as customerid,cf.name as customername,cf.CERTTYPE,cf.certid,'共同承租人' as customertype,'' as customer_num,cf.FLOWUNID,cf.PROJECT_ID from customer_family_temp cf where cf.FLOWUNID = '"+flowunid+"'";
List<Map<String, String>> customerinfo = conn.executeQuery(sql);
String customerid = "";
String certid = "";
//避免项目的历史客户信息重复录入
@ -366,11 +367,12 @@ public class InsertCustomerHistoryInfo {
Conn conn = new Conn(tx);
String flowunid = this.flowunid;
//获取客户基本信息
String sql = "select ci.customerid,ci.customername,ci.certtype,ci.certid,'主承租人' as customertype,ci.customer_num,lul.FLOWUNID,lul.project_id from customer_info ci left join lb_union_lessee_temp lul on lul.customer_id = ci.customerid where lul.IS_MAIN = 'Y' and lul.FLOWUNID = '" + flowunid + "' \n" +
String sql = "select cpt.customerid,cpt.FULLNAME as customername,cpt.certtype,cpt.certid,'主承租人' as customertype,'' as customer_num,lul.FLOWUNID,lul.project_id from customer_person_temp cpt left join lb_union_lessee_temp lul on cpt.FLOWUNID = lul.FLOWUNID where lul.IS_MAIN = 'Y' and lul.FLOWUNID = '"+flowunid+"' \n" +
"union \n" +
"select lgu.ASSUROR as customerid,lgu.FULLNAME as customername,lgu.CERTTYPE,lgu.certid,'担保人' as customertype,'' as customer_num,lgu.FLOWUNID,lgu.project_id from lb_guarantee_unit_temp lgu where lgu.FLOWUNID = '" + flowunid + "'\n" +
"select lgu.ASSUROR as customerid,lgu.FULLNAME as customername,lgu.CERTTYPE,lgu.certid,'担保人' as customertype,'' as customer_num,lgu.FLOWUNID,lgu.project_id from lb_guarantee_unit_temp lgu where lgu.FLOWUNID = '"+flowunid+"'\n" +
"union \n" +
"select '' as customerid,cf.name as customername,cf.CERTTYPE,cf.certid,'共同承租人' as customertype,'' as customer_num,cf.FLOWUNID,cf.PROJECT_ID from customer_family_temp cf where cf.FLOWUNID = '" + flowunid + "'\n";
"select '' as customerid,cf.name as customername,cf.CERTTYPE,cf.certid,'共同承租人' as customertype,'' as customer_num,cf.FLOWUNID,cf.PROJECT_ID from customer_family_temp cf where cf.FLOWUNID = '"+flowunid+"'";
List<Map<String, String>> customerinfo = conn.executeQuery(sql);
@ -410,4 +412,344 @@ public class InsertCustomerHistoryInfo {
}
public static Map CustomerHistoryInfo(String flowunid,String certid) throws Exception {
//承租人参数
String gmnum = "0";
String CLEAN_LEASE_MONEY = "0";
String jq_number = "0";
String wjq_number = "0";
String carnumber = "0";
String carjqnumber = "0";
String carwjqnumber = "0";
BigDecimal czr_rent_over = new BigDecimal(0);
String czr_yqrent_over = "0";
//共同申请人参数
String gtgmnumber = "0";
String GT_CLEAN_LEASE_MONEY = "0";
String gt_jq_number = "0";
String gt_wjq_number = "0";
String gtcarnumber = "0";
String gtcarjqnumber = "0";
String gtcarwjqnumber = "0";
BigDecimal gt_rent_over = new BigDecimal(0);
String gt_yqrent_over = "0";
//担保人参数
String dbgmnumber = "0";
String DB_CLEAN_LEASE_MONEY = "0";
String db_jq_number = "0";
String db_wjq_number = "0";
String dbcarnumber = "0";
String dbcarjqnumber = "0";
String dbcarwjqnumber = "0";
BigDecimal db_rent_over = new BigDecimal(0);
String db_yqrent_over = "0";
//敞口
BigDecimal exposureMoney = new BigDecimal(0);
try {
JBOTransaction tx = JBOFactory.createJBOTransaction();
Conn con = new Conn(tx);
//根据证件号获取合同ID
//获取主承租人合同ID
String czrprojid = "select lul.CONTRACT_ID from customer_person cp left join lb_union_lessee lul on cp.CUSTOMERID = lul.CUSTOMER_ID left join lb_contract_info lci on lul.CONTRACT_ID = lci.ID where cp.CERTID = '" + certid + "' and lul.CONTRACT_ID <> '' and lul.IS_MAIN = 'Y' and lci.CONTRACT_STATUS <> '101' and lci.CONTRACT_STATUS <> '104'";
List<Map<String, String>> czrproj_id = con.executeQuery(czrprojid);
String czr_proj_id = "";
for (int j = 0; j < czrproj_id.size(); j++) {
if (czrproj_id.size() == j + 1) {
czr_proj_id = czr_proj_id + "'" + czrproj_id.get(j).get("contract_id") + "'";
} else {
czr_proj_id = czr_proj_id + "'" + czrproj_id.get(j).get("contract_id") + "'" + ",";
}
}
//主承租人取值
if (!"".equals(czr_proj_id)) {
//获取客户为主承租人订单总数
String gm_nu = "select count(lci.id) as num from lb_contract_info lci where lci.id in (" + czr_proj_id + ") and lci.CONTRACT_STATUS <> '104' and lci.CONTRACT_STATUS <> '101'";
List<Map<String, String>> gm_number = con.executeQuery(gm_nu);
if (gm_number.size() > 0) {
gmnum = gm_number.get(0).get("num");
}
///获取客户为主承租融资金额和
String sum_rz = "select format(sum(nvl(CLEAN_LEASE_MONEY,0)),2) as CLEAN_LEASE_MONEY from lb_contract_info lci left join lc_calc_condition lcc on lcc.CONTRACT_ID = lci.ID where lci.CONTRACT_STATUS >=31 and lci.CONTRACT_STATUS <> '104' and lci.CONTRACT_STATUS <> '101' and lci.ID in (" + czr_proj_id + ")";
List<Map<String, String>> rz = con.executeQuery(sum_rz);
if (rz.size() > 0) {
CLEAN_LEASE_MONEY = rz.get(0).get("clean_lease_money");
}
//获取客户为主承租已结清合同数
String jq_contract_num = "select count(lci.ID) as num from lb_contract_info lci where lci.ID in (" + czr_proj_id + ") and lci.CONTRACT_STATUS in ('100','105')";
List<Map<String, String>> jq_num = con.executeQuery(jq_contract_num);
if (jq_num.size() > 0) {
jq_number = jq_num.get(0).get("num");
}
//获取客户为主承租未结清合同数
String wjq_contract_num = "select count(lci.ID) as num from lb_contract_info lci where lci.ID in (" + czr_proj_id + ") and lci.CONTRACT_STATUS >=31 and lci.CONTRACT_STATUS < 100";
List<Map<String, String>> wjq_num = con.executeQuery(wjq_contract_num);
if (wjq_num.size() > 0) {
wjq_number = wjq_num.get(0).get("num");
}
//获取客户为主承租车辆总和
String car_num = "select count(lec.ID) as num from lb_contract_info lci left join lb_equipment_car lec on lec.CONTRACT_ID = lci.id where lci.id in (" + czr_proj_id + ") and lec.car_attribute = 'head'";
List<Map<String, String>> car_number = con.executeQuery(car_num);
if (car_number.size() > 0) {
carnumber = car_number.get(0).get("num");
}
//获取客户为主承租结清车辆总和
String car_jq_num = "select count(lec.ID) as num from lb_contract_info lci left join lb_equipment_car lec on lec.CONTRACT_ID = lci.ID where lci.CONTRACT_STATUS in ('100','105') and lec.car_attribute = 'head' and lci.ID in (" + czr_proj_id + ")";
List<Map<String, String>> car_jq_number = con.executeQuery(car_jq_num);
if (car_jq_number.size() > 0) {
carjqnumber = car_jq_number.get(0).get("num");
}
//获取客户为主承租未结清车辆总和
String car_wjq_num = "select count(lec.ID) as num from lb_contract_info lci left join lb_equipment_car lec on lec.CONTRACT_ID = lci.ID where lci.CONTRACT_STATUS >=31 and lci.CONTRACT_STATUS < 100 and lec.car_attribute = 'head' and lci.ID in (" + czr_proj_id + ")";
List<Map<String, String>> car_wjq_number = con.executeQuery(car_wjq_num);
if (car_wjq_number.size() > 0) {
carwjqnumber = car_wjq_number.get(0).get("num");
}
//获取客户为主承租剩余租金,逾期租金
//总实收
String ssmoney_num = "select replace(format(sum(nvl(lri.corpus,0)),2),',','') as corpus from lc_rent_income lri where lri.CONTRACT_ID in (" + czr_proj_id + ")";
List<Map<String, String>> ssmoney_number = con.executeQuery(ssmoney_num);
BigDecimal ssmoney = new BigDecimal(0);
if (ssmoney_number.get(0).get("corpus") != null || !"".equals(ssmoney_number.get(0).get("corpus"))) {
ssmoney = new BigDecimal(ssmoney_number.get(0).get("corpus"));
}
//剩余本金
czr_rent_over = new BigDecimal(CLEAN_LEASE_MONEY.replace(",", "")).subtract(ssmoney);
String yqmoney_num = "select format(sum(lrp.rent-nvl(t.RENT,0)),2) as yqrent_over from \n" +
"lc_rent_plan lrp\n" +
"left join (select CONTRACT_ID,lri.PLAN_LIST,sum(RENT) as RENT from lc_rent_income lri where lri.CONTRACT_ID in (" + czr_proj_id + ") group by lri.CONTRACT_ID,lri.PLAN_LIST) t \n" +
" on t.CONTRACT_ID = lrp.CONTRACT_ID and t.PLAN_LIST = lrp.PLAN_LIST \n" +
"where STR_TO_DATE(lrp.plan_date,'%Y/%m/%d') < now()\n" +
"\tand lrp.contract_id in (" + czr_proj_id + ")";
List<Map<String, String>> yqmoney_number = con.executeQuery(yqmoney_num);
if (yqmoney_number.size() > 0) {
czr_yqrent_over = yqmoney_number.get(0).get("yqrent_over");
} else {
czr_yqrent_over = "0";
}
}
//获取共同承租人合同ID
String gtprojid = "select lci.ID from customer_family cf left join lb_contract_info lci on cf.PROJECT_ID = lci.PROJECT_ID where cf.certid = '" + certid + "' and cf.Partner_ = 'Y' and lci.CONTRACT_STATUS <> '101' and lci.CONTRACT_STATUS <> '104'";
List<Map<String, String>> gtproj_id = con.executeQuery(gtprojid);
String gt_proj_id = "";
for (int j = 0; j < gtproj_id.size(); j++) {
if (gtproj_id.size() == j + 1) {
gt_proj_id = gt_proj_id + "'" + gtproj_id.get(j).get("id") + "'";
} else {
gt_proj_id = gt_proj_id + "'" + gtproj_id.get(j).get("id") + "'" + ",";
}
}
//共同承租人取值
if (!"".equals(gt_proj_id)) {
//获取客户为共同承租人订单总数
String gt_gm_nu = "select count(lci.ID) as num from lb_contract_info lci where lci.ID in (" + gt_proj_id + ") and lci.CONTRACT_STATUS <> '104' and lci.CONTRACT_STATUS <> '101'";
List<Map<String, String>> gt_gm_number = con.executeQuery(gt_gm_nu);
if (gt_gm_number.size() > 0) {
gtgmnumber = gt_gm_number.get(0).get("num");
}
//获取客户为共同承租人融资额和
String gt_sum_rz = "select format(sum(nvl(CLEAN_LEASE_MONEY,0)),2) as CLEAN_LEASE_MONEY from lb_contract_info lci left join lc_calc_condition lcc on lcc.CONTRACT_ID = lci.ID where lci.CONTRACT_STATUS >=31 and lci.CONTRACT_STATUS <> '104' and lci.CONTRACT_STATUS <> '101' and lci.ID in (" + gt_proj_id + ")";
List<Map<String, String>> gt_rz = con.executeQuery(gt_sum_rz);
if (gt_rz.size() > 0) {
GT_CLEAN_LEASE_MONEY = gt_rz.get(0).get("clean_lease_money");
}
//获取客户为共同承租人已结清单数
String gt_jq_contract_num = "select count(lci.ID) as num from lb_contract_info lci where lci.ID in (" + gt_proj_id + ") and lci.CONTRACT_STATUS in ('100','105')";
List<Map<String, String>> gt_jq_num = con.executeQuery(gt_jq_contract_num);
if (gt_jq_num.size() > 0) {
gt_jq_number = gt_jq_num.get(0).get("num");
}
//获取客户为共同承租人未结清单数
String gt_wjq_contract_num = "select count(lci.ID) as num from lb_contract_info lci where lci.ID in (" + gt_proj_id + ") and lci.CONTRACT_STATUS >=31 and lci.CONTRACT_STATUS < 100";
List<Map<String, String>> gt_wjq_num = con.executeQuery(gt_wjq_contract_num);
if (gt_wjq_num.size() > 0) {
gt_wjq_number = gt_wjq_num.get(0).get("num");
}
//获取客户为共同承租人车辆总和
String gt_car_num = "select count(lec.ID) as num from lb_contract_info lci left join lb_equipment_car lec on lec.CONTRACT_ID = lci.ID where lci.CONTRACT_STATUS in ('100','105') and lec.car_attribute = 'head' and lci.ID in (" + gt_proj_id + ")";
List<Map<String, String>> gt_car_number = con.executeQuery(gt_car_num);
if (gt_car_number.size() > 0) {
gtcarnumber = gt_car_number.get(0).get("num");
}
//获取客户为共同承租人结清车辆总和
String gt_car_jq_num = "select count(lci.ID) as num from lb_contract_info lci where lci.ID in (" + gt_proj_id + ") and lci.CONTRACT_STATUS in ('100','105')";
List<Map<String, String>> gt_car_jq_number = con.executeQuery(gt_car_jq_num);
if (gt_car_jq_number.size() > 0) {
gtcarjqnumber = gt_car_jq_number.get(0).get("num");
}
//获取客户为共同承租人未结清车辆总和
String gt_car_wjq_num = "select count(lec.ID) as num from lb_contract_info lci left join lb_equipment_car lec on lec.CONTRACT_ID = lci.ID where lci.CONTRACT_STATUS >=31 and lci.CONTRACT_STATUS < 100 and lec.car_attribute = 'head' and lci.ID in (" + gt_proj_id + ")";
List<Map<String, String>> gt_car_wjq_number = con.executeQuery(gt_car_wjq_num);
if (gt_car_wjq_number.size() > 0) {
gtcarwjqnumber = gt_car_wjq_number.get(0).get("num");
}
//获取客户为共同承租人剩余租金,罚息
//总实收
String ssgt_money_num = "select replace(format(sum(nvl(lri.corpus,0)),2),',','') as corpus from lc_rent_income lri where lri.CONTRACT_ID in (" + gt_proj_id + ")";
List<Map<String, String>> ssgt_money_number = con.executeQuery(ssgt_money_num);
BigDecimal ssgt_money = new BigDecimal(0);
if (ssgt_money_number.get(0).get("corpus") != null || !"".equals(ssgt_money_number.get(0).get("corpus"))) {
ssgt_money = new BigDecimal(ssgt_money_number.get(0).get("corpus"));
}
//总剩余本金
gt_rent_over = new BigDecimal(GT_CLEAN_LEASE_MONEY.replace(",", "")).subtract(ssgt_money);
String gt_yqmoney_num = "select format(sum(lrp.rent-nvl(t.RENT,0)),2) as yqrent_over from \n" +
"lc_rent_plan lrp\n" +
"left join (select CONTRACT_ID,lri.PLAN_LIST,sum(RENT) as RENT from lc_rent_income lri where lri.CONTRACT_ID in (" + gt_proj_id + ") group by lri.CONTRACT_ID,lri.PLAN_LIST) t \n" +
" on t.CONTRACT_ID = lrp.CONTRACT_ID and t.PLAN_LIST = lrp.PLAN_LIST \n" +
"where STR_TO_DATE(lrp.plan_date,'%Y/%m/%d') < now()\n" +
"\tand lrp.contract_id in (" + gt_proj_id + ")";
List<Map<String, String>> gt_yqmoney_number = con.executeQuery(gt_yqmoney_num);
if (gt_yqmoney_number.size() > 0) {
gt_yqrent_over = gt_yqmoney_number.get(0).get("yqrent_over");
} else {
gt_yqrent_over = "0";
}
}
//获取担保人合同ID
String dbprojid = "select lci.id 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 <> '101' and lci.CONTRACT_STATUS <> '104'";
List<Map<String, String>> dbproj_id = con.executeQuery(dbprojid);
String db_proj_id = "";
for (int j = 0; j < dbproj_id.size(); j++) {
if (dbproj_id.size() == j + 1) {
db_proj_id = db_proj_id + "'" + dbproj_id.get(j).get("id") + "'";
} else {
db_proj_id = db_proj_id + "'" + dbproj_id.get(j).get("id") + "'" + ",";
}
}
//担保人取值
if (!"".equals(db_proj_id)) {
//获取客户为担保人订单总数
String db_gm_nu = "select count(lci.ID) as num from lb_contract_info lci where lci.ID in (" + db_proj_id + ")";
List<Map<String, String>> db_gm_number = con.executeQuery(db_gm_nu);
if (db_gm_number.size() > 0) {
dbgmnumber = db_gm_number.get(0).get("num");
}
//获取客户为担保人融资额和
String db_sum_rz = "select format(sum(nvl(CLEAN_LEASE_MONEY,0)),2) as CLEAN_LEASE_MONEY from lb_contract_info lci left join lc_calc_condition lcc on lcc.CONTRACT_ID = lci.ID where lci.CONTRACT_STATUS >=31 and lci.CONTRACT_STATUS <> '104' and lci.CONTRACT_STATUS <> '101' and lci.ID in (" + db_proj_id + ")";
List<Map<String, String>> db_rz = con.executeQuery(db_sum_rz);
if (db_rz.size() > 0) {
DB_CLEAN_LEASE_MONEY = db_rz.get(0).get("clean_lease_money");
}
//获取客户为担保人已结清单数
String db_jq_contract_num = "select count(lci.ID) as num from lb_contract_info lci where lci.ID in (" + db_proj_id + ") and lci.CONTRACT_STATUS in ('100','105')";
List<Map<String, String>> db_jq_num = con.executeQuery(db_jq_contract_num);
if (db_jq_num.size() > 0) {
db_jq_number = db_jq_num.get(0).get("num");
}
//获取客户为担保人未结清单数
String db_wjq_contract_num = "select count(lci.ID) as num from lb_contract_info lci where lci.ID in (" + db_proj_id + ") and lci.CONTRACT_STATUS >=31 and lci.CONTRACT_STATUS < 100";
List<Map<String, String>> db_wjq_num = con.executeQuery(db_wjq_contract_num);
if (db_wjq_num.size() > 0) {
db_wjq_number = db_wjq_num.get(0).get("num");
}
//获取客户为担保人车辆总和
String db_car_num = "select count(lec.ID) as num from lb_contract_info lci left join lb_equipment_car lec on lec.CONTRACT_ID = lci.ID where lci.CONTRACT_STATUS in ('100','105') and lec.car_attribute = 'head' and lci.ID in (" + db_proj_id + ")";
List<Map<String, String>> db_car_number = con.executeQuery(db_car_num);
if (db_car_number.size() > 0) {
dbcarnumber = db_car_number.get(0).get("num");
}
//获取客户为担保人结清车辆总和
String db_car_jq_num = "select count(lci.ID) as num from lb_contract_info lci where lci.ID in (" + db_proj_id + ") and lci.CONTRACT_STATUS in ('100','105')";
List<Map<String, String>> db_car_jq_number = con.executeQuery(db_car_jq_num);
if (db_car_jq_number.size() > 0) {
dbcarjqnumber = db_car_jq_number.get(0).get("num");
}
//获取客户为担保人未结清车辆总和
String db_car_wjq_num = "select count(lec.ID) as num from lb_contract_info lci left join lb_equipment_car lec on lec.CONTRACT_ID = lci.ID where lci.CONTRACT_STATUS >=31 and lci.CONTRACT_STATUS < 100 and lec.car_attribute = 'head' and lci.ID in (" + db_proj_id + ")";
List<Map<String, String>> db_car_wjq_number = con.executeQuery(db_car_wjq_num);
if (db_car_wjq_number.size() > 0) {
dbcarwjqnumber = db_car_wjq_number.get(0).get("num");
}
//获取客户为担保人剩余租金,罚息
//总实收
String ssdb_money_num = "select replace(format(sum(nvl(lri.corpus,0)),2),',','') as corpus from lc_rent_income lri where lri.CONTRACT_ID in (" + db_proj_id + ")";
List<Map<String, String>> ssdb_money_number = con.executeQuery(ssdb_money_num);
BigDecimal ssdb_money = new BigDecimal(0);
if (ssdb_money_number.get(0).get("corpus") != null || !"".equals(ssdb_money_number.get(0).get("corpus"))) {
ssdb_money = new BigDecimal(ssdb_money_number.get(0).get("corpus"));
}
//总剩余本金
db_rent_over = new BigDecimal(DB_CLEAN_LEASE_MONEY.replace(",", "")).subtract(ssdb_money);
String db_yqmoney_num = "select format(sum(lrp.rent-nvl(t.RENT,0)),2) as yqrent_over from \n" +
"lc_rent_plan lrp\n" +
"left join (select CONTRACT_ID,lri.PLAN_LIST,sum(RENT) as RENT from lc_rent_income lri where lri.CONTRACT_ID in (" + db_proj_id + ") group by lri.CONTRACT_ID,lri.PLAN_LIST) t \n" +
" on t.CONTRACT_ID = lrp.CONTRACT_ID and t.PLAN_LIST = lrp.PLAN_LIST \n" +
"where STR_TO_DATE(lrp.plan_date,'%Y/%m/%d') < now()\n" +
"\tand lrp.contract_id in (" + db_proj_id + ")";
List<Map<String, String>> db_yqmoney_number = con.executeQuery(db_yqmoney_num);
if (db_yqmoney_number.size() > 0) {
db_yqrent_over = db_yqmoney_number.get(0).get("yqrent_over");
} else {
db_yqrent_over = "0";
}
}
//客户敞口计算
Transaction sqlca = Transaction.createTransaction(tx);
exposureMoney = LBBusinessPrimary.obtainExposureMoney(sqlca, flowunid);
if (exposureMoney == null || "".equals(exposureMoney)) {
exposureMoney = BigDecimal.valueOf(0);
}
} catch (Exception e) {
e.printStackTrace();
}
Map<String, String> map = new HashMap<>();
map.put("clientbuynumber", gmnum);
map.put("clientfinancingamount", CLEAN_LEASE_MONEY);
map.put("clientclosedaccount", jq_number);
map.put("clientunsettled", wjq_number);
map.put("clientvehiclepopulation", carnumber);
map.put("clientclosedvehicle", carjqnumber);
map.put("clientoutstandingvehicle", carwjqnumber);
map.put("clientloanbalance", czr_rent_over.toString());
map.put("clientoverdueamount", czr_yqrent_over);
map.put("jointlybuynumber", gtgmnumber);
map.put("jointlyfinancingamount", GT_CLEAN_LEASE_MONEY);
map.put("jointlyclosedaccount", gt_jq_number);
map.put("jointlyunsettled", gt_wjq_number);
map.put("jointlyveh", gtcarnumber);
map.put("jointlyclosedvehicle", gtcarjqnumber);
map.put("jointlyout", gtcarwjqnumber);
map.put("jointlyloanbalance", gt_rent_over.toString());
map.put("jointlyoverdueamount", gt_yqrent_over);
map.put("guaranteebuynumber", dbgmnumber);
map.put("guaranteefin", DB_CLEAN_LEASE_MONEY);
map.put("guaranteeclosedaccount", db_jq_number);
map.put("guaranteeunsettled", db_wjq_number);
map.put("guaranteeveh", dbcarnumber);
map.put("guaranteeclosedvehicle", dbcarjqnumber);
map.put("guaranteeout", dbcarwjqnumber);
map.put("guaranteeloanbalance", db_rent_over.toString());
map.put("guaranteeoverdueamount", db_yqrent_over);
map.put("exposure", exposureMoney.toString());
return map;
}
}