Merge remote-tracking branch 'origin/release20211231' into release20211231

This commit is contained in:
zhanglei 2023-09-14 16:46:59 +08:00
commit 5a02178b25
6 changed files with 155 additions and 121 deletions

View File

@ -139,14 +139,17 @@
return false;
}
function checkNameAndCertId(){//校验姓名和证件号
function checkNameAndCertId(){//校验自然人承租人年龄
//var customerName = getItemValue(0,getRow(),"CustomerName");
var certId = getItemValue(0,getRow(),"certid");
var customerType = getItemValue(0,getRow(),"Customer_type");
//var sParams = "CustomerName="+customerName+",certId="+certId+",customerType="+customerType;
var sParams = "certId="+certId+",customerType="+customerType;
var sReturnInfo = RunJavaMethodTrans("com.tenwa.lease.flow.project.businessapply.CustomerInfoCheck","checkNameAndCertId",sParams);
return sReturnInfo;
if(customerType=="03"){
//var sParams = "CustomerName="+customerName+",certId="+certId+",customerType="+customerType;
var sParams = "certId="+certId;
var sReturnInfo = RunJavaMethodTrans("com.tenwa.lease.flow.project.businessapply.CustomerInfoCheck","checkAndCertId",sParams);
return sReturnInfo;
}
}
/*~[Describe=保存并初始化数据;InputParam=无;OutPutParam=无;]~*/
@ -265,11 +268,11 @@
/*~[Describe=确认新增申请;InputParam=无;OutPutParam=无;]~*/
function doCreation()
{
// var result = checkNameAndCertId();
// if(result=="2"){
// alert("证件号已存在!请重新输入!");
// return;
// }
var result = checkNameAndCertId();
if(result=="false"){
alert("年龄不满足!");
return;
}
if(!checkCertInfo(true)) return ;
if(!iV_all(0)) return ;
saveRecord();

View File

@ -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;
@ -64,7 +65,7 @@ public class InsertCustomerHistoryInfo {
gmnum = "0";
}
///获取客户为主承租融资金额和
String sum_rz = "select sum(nvl(CLEAN_LEASE_MONEY,0)) as CLEAN_LEASE_MONEY from lb_union_lessee lul 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 lul.customer_id = '"+customerid+"' and lul.IS_MAIN = 'Y' and lci.CONTRACT_STATUS >=31 and lci.CONTRACT_STATUS <> '104' group by lul.customer_id";
String sum_rz = "select format(sum(nvl(CLEAN_LEASE_MONEY,0)),2) as CLEAN_LEASE_MONEY from lb_union_lessee lul 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 lul.customer_id = '"+customerid+"' and lul.IS_MAIN = 'Y' and lci.CONTRACT_STATUS >=31 and lci.CONTRACT_STATUS <> '104' group by lul.customer_id";
List<Map<String, String>> rz = conn.executeQuery(sum_rz);
String CLEAN_LEASE_MONEY = "";
if(rz.size()>0){
@ -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<Map<String, String>> 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";
@ -118,7 +119,7 @@ public class InsertCustomerHistoryInfo {
carwjqnumber = "0";
}
//获取客户为主承租剩余租金,罚息
String money_num = "select sum(nvl(rent_over,0)) as rent_over,sum(nvl(penalty_over,0)) as penalty_over from lb_union_lessee lul left join vi_rent_plan_sum vrps on lul.contract_id = vrps.contract_id where lul.CUSTOMER_ID = '"+customerid+"' and lul.IS_MAIN = 'Y' group by lul.CUSTOMER_ID";
String money_num = "select format(sum(nvl(rent_over,0)),2) as rent_over,format(sum(nvl(penalty_over,0)),2) as penalty_over from lb_union_lessee lul left join vi_rent_plan_sum vrps on lul.contract_id = vrps.contract_id where lul.CUSTOMER_ID = '"+customerid+"' and lul.IS_MAIN = 'Y' group by lul.CUSTOMER_ID";
List<Map<String, String>> money_number = conn.executeQuery(money_num);
String czr_rent_over = "";
String czr_penalty_over = "";
@ -142,7 +143,7 @@ public class InsertCustomerHistoryInfo {
gtgmnumber = "0";
}
//获取客户为共同承租人融资额和
String gt_sum_rz = "select sum(nvl(CLEAN_LEASE_MONEY,0)) as CLEAN_LEASE_MONEY from lb_union_lessee lul 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 lul.customer_id = '"+customerid+"' and lul.IS_MAIN = 'N' and lci.CONTRACT_STATUS >=31 and lci.CONTRACT_STATUS <> '104' group by lul.customer_id";
String gt_sum_rz = "select format(sum(nvl(CLEAN_LEASE_MONEY,0)),2) as CLEAN_LEASE_MONEY from lb_union_lessee lul 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 lul.customer_id = '"+customerid+"' and lul.IS_MAIN = 'N' and lci.CONTRACT_STATUS >=31 and lci.CONTRACT_STATUS <> '104' group by lul.customer_id";
List<Map<String, String>> gt_rz = conn.executeQuery(gt_sum_rz);
String GT_CLEAN_LEASE_MONEY = "";
if(gt_rz.size()>0){
@ -196,7 +197,7 @@ public class InsertCustomerHistoryInfo {
gtcarwjqnumber = "0";
}
//获取客户为共同承租人剩余租金,罚息
String gt_money_num = "select sum(nvl(rent_over,0)) as rent_over,sum(nvl(penalty_over,0)) as penalty_over from lb_union_lessee lul left join vi_rent_plan_sum vrps on lul.contract_id = vrps.contract_id where lul.CUSTOMER_ID = '"+customerid+"' and lul.IS_MAIN = 'N' group by lul.CUSTOMER_ID";
String gt_money_num = "select format(sum(nvl(rent_over,0)),2) as rent_over,format(sum(nvl(penalty_over,0)),2) as penalty_over from lb_union_lessee lul left join vi_rent_plan_sum vrps on lul.contract_id = vrps.contract_id where lul.CUSTOMER_ID = '"+customerid+"' and lul.IS_MAIN = 'N' group by lul.CUSTOMER_ID";
List<Map<String, String>> gt_money_number = conn.executeQuery(gt_money_num);
String gt_rent_over = "";
String gt_penalty_over = "";
@ -220,7 +221,7 @@ public class InsertCustomerHistoryInfo {
dbgmnumber = "0";
}
//获取客户为担保人融资额和
String db_sum_rz = "select sum(nvl(CLEAN_LEASE_MONEY,0)) 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";
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<Map<String, String>> db_rz = conn.executeQuery(db_sum_rz);
String DB_CLEAN_LEASE_MONEY = "";
if(db_rz.size()>0){
@ -274,7 +275,7 @@ public class InsertCustomerHistoryInfo {
dbcarwjqnumber = "0";
}
//获取客户为担保人剩余租金,罚息
String db_money_num = "select sum(nvl(rent_over,0)) as rent_over,sum(nvl(penalty_over,0)) as penalty_over from lb_guarantee_unit lgu left join vi_rent_plan_sum vrps on lgu.contract_id = vrps.contract_id where lgu.certid = '"+certid+"' group by lgu.certid";
String db_money_num = "select format(sum(nvl(rent_over,0)),2) as rent_over,format(sum(nvl(penalty_over,0)),2) as penalty_over from lb_guarantee_unit lgu left join vi_rent_plan_sum vrps on lgu.contract_id = vrps.contract_id where lgu.certid = '"+certid+"' group by lgu.certid";
List<Map<String, String>> db_money_number = conn.executeQuery(db_money_num);
String db_rent_over = "";
String db_penalty_over = "";
@ -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<Map<String, String>> ckmoney_rz = conn.executeQuery(ck_money_rz);
List<Map<String, String>> ckmoeny_bz = conn.executeQuery(ck_moeny_bz);
List<Map<String, String>> 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<Map<String, String>> dbckmoneny_rz = conn.executeQuery(dbck_moneny_rz);
List<Map<String, String>> dbckmoeny_bz = conn.executeQuery(dbck_moeny_bz);
List<Map<String, String>> 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);

View File

@ -273,7 +273,7 @@ public class CGB0032ResBodyRecord {
bizObject.setAttributeValue(LC_EBANK.MAYOPE_MONEY, this.dealMoney);
// bizObject.setAttributeValue(LC_EBANK.FUND_MONEY, );
bizObject.setAttributeValue(LC_EBANK.INVALID, "N");
bizObject.setAttributeValue(LC_EBANK.SUMMARY, this.summary);
bizObject.setAttributeValue(LC_EBANK.SUMMARY, this.postScript);
bizObject.setAttributeValue(LC_EBANK.INPUTUSERID, userId);
bizObject.setAttributeValue(LC_EBANK.INPUTORGID, orgId);
bizObject.setAttributeValue(LC_EBANK.INPUTTIME, nowDateTime);

View File

@ -40,7 +40,7 @@ public class CGBBankService {
private static LBCgb0032LogDao lbCgb0032LogDao = LBCgb0032LogDao.getInstance();
// 默认操作人ID
private String defOperUserId = "8009U00000056";
private String defOperUserId = "8009U00000063";
// 默认操作人部门ID
private String defOperOrgId = "8009014";
@ -145,7 +145,7 @@ public class CGBBankService {
// 转换成网银流水
for (CGB0032ResBodyRecord record : records) {
BizObject lc = bizObjectManager.createQuery("ebank_sn=:ebankSn").setParameter("ebankSn", record.getSerialNo()).getSingleResult(false);
if (lc == null && record.getLoanSign().equals("+") && !(record.getOppoAccno().indexOf("9915810001415816")>=0 || record.getOppoAccno().indexOf("9912900000582902")>=0 )) {
if (lc == null && record.getLoanSign().equals("+") && !(record.getOppoAccno().indexOf("9915810001415816")>=0 || record.getOppoAccno().indexOf("9912900000582902")>=0 || record.getOppoAccno().indexOf("9912900000232905")>=0 )) {
BizObject bizObject = record.convertToEbank(bizObjectManager, defOperUserId, defOperOrgId);
bizObjectManager.saveObject(bizObject);
bizObject.setAttributeValue("EBANK_NUMBER", bizObject.getAttribute("ID"));

View File

@ -1,5 +1,6 @@
package com.tenwa.lease.flow.project.businessapply;
import com.tenwa.reckon.util.Conn;
import jbo.app.tenwa.customer.CUSTOMER_COMPANY;
import jbo.app.tenwa.customer.CUSTOMER_COMPANY_TEMP;
import jbo.app.tenwa.customer.CUSTOMER_FAMILY;
@ -17,6 +18,8 @@ import jbo.sys.CODE_LIBRARY;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.Map;
import com.amarsoft.are.jbo.BizObject;
import com.amarsoft.are.jbo.BizObjectManager;
@ -272,6 +275,33 @@ public class CustomerInfoCheck {
}
return CustomerId;
}
public String checkAndCertId(JBOTransaction tx)throws Exception{
String CustomerId="";
Transaction Sqlca=null;
Conn conn = new Conn(tx);
String typr = "";
try {
Sqlca=Transaction.createTransaction(tx);
String sql = "select \n" +
"case when 18 < t.age+0 and t.age+0 < 65 then 'true' else 'false' end as zt\n" +
"from (\n" +
"select\n" +
"\t(substring(now(),1,4)-substring('"+certId+"',7,4))-(substring('"+certId+"',11,4)-date_format(now(),'%m%d')>0) as age\n" +
"from\n" +
"\tdual\n" +
") t";
List<Map<String, String>> age = conn.executeQuery(sql);
typr = age.get(0).get("zt");
} catch (JBOException e) {
e.printStackTrace();
return "ERROR";
}
return typr;
}
//¼ì³µÉí·ÝÖ¤ºÅÊÇ·ñÖØ¸´
public String checkCertidRepeat(JBOTransaction tx) throws Exception{
BizObjectManager cptManage = JBOFactory.getBizObjectManager(CUSTOMER_PERSON_TEMP.CLASS_NAME, tx);

View File

@ -1,70 +1,124 @@
package com.tenwa.lease.flow.project.businessapply;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
import com.amarsoft.are.jbo.BizObject;
import com.amarsoft.are.jbo.BizObjectManager;
import com.amarsoft.are.jbo.JBOException;
import com.amarsoft.are.jbo.JBOFactory;
import com.amarsoft.awe.util.ASResultSet;
import com.amarsoft.awe.util.SqlObject;
import com.amarsoft.awe.util.Transaction;
import com.tenwa.comm.util.jboutil.DataOperatorUtil;
import com.tenwa.flow.baseBussion.BaseBussiness;
import com.tenwa.reckon.util.Conn;
import jbo.app.tenwa.calc.LC_CALC_CONDITION_TEMP;
import jbo.app.tenwa.customer.CUSTOMER_FAMILY_TEMP;
import jbo.app.tenwa.customer.CUSTOMER_INFO;
import jbo.app.tenwa.customer.CUSTOMER_INFO_TEMP;
import jbo.com.tenwa.lease.comm.LB_GUARANTEE_UNIT_TEMP;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
public class LBBusinessPrimary extends BaseBussiness {
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
public class LBBusinessPrimary extends BaseBussiness {
@SuppressWarnings("deprecation")
@Override
public Object run(Transaction Sqlca) throws Exception {
this.initBussinessParam(Sqlca);
String flowUnid=this.getAttribute("ObjectNo").toString();
BizObjectManager ciManage = JBOFactory.getBizObjectManager(CUSTOMER_INFO.CLASS_NAME, Sqlca);
String flowUnid = this.getAttribute("ObjectNo").toString();
String custType = this.getAttribute("CustomerType").toString();
BigDecimal exposureMoney = obtainExposureMoney(Sqlca, flowUnid);
BigDecimal compareMoney = BigDecimal.ZERO;
String routeType = this.getAttribute("routeType").toString();
if ("40".equals(routeType)) {//个人小于等于60万法人小于等于100万
compareMoney = "03".equals(custType) ? BigDecimal.valueOf(600000) : BigDecimal.valueOf(1000000);
} else if ("50".equals(routeType)) {//个人小于等于100万法人小于等于200万
compareMoney = "03".equals(custType) ? BigDecimal.valueOf(1000000) : BigDecimal.valueOf(2000000);
} else if ("60".equals(routeType)) {//个人小于等于200万法人小于等于300万
compareMoney = "03".equals(custType) ? BigDecimal.valueOf(2000000) : BigDecimal.valueOf(3000000);
} else if ("70".equals(routeType)) {//个人小于等于300万法人小于等于500万
compareMoney = "03".equals(custType) ? BigDecimal.valueOf(3000000) : BigDecimal.valueOf(5000000);
} else if ("80".equals(routeType)) {//个人大于300万法人大于500万
return "true";
}
if (exposureMoney.compareTo(compareMoney) > -1) {
return "false";
} else {
return "true";
}
}
/**
* 条件判断金额获取逻辑
* 主借人或者共借人或担保人出现在其他合同全条线业务中作为主借或者共借人或担保人重复合同取一次计算
* 全部合同的已放款的贷款余额 + 待放款的贷款金额 + 已核准未放款贷款金额 - 保证金金额 + 本单申请的贷款金额 - 保证金金额+ 当前在信审节点中[流程状态不属于0010102010008000]申请的贷款金额 - 保证金金额
*/
public static BigDecimal obtainExposureMoney(Transaction Sqlca,String flowUnid) throws Exception{
BizObjectManager citManage = JBOFactory.getBizObjectManager(CUSTOMER_INFO_TEMP.CLASS_NAME, Sqlca);
BizObjectManager cftManage = JBOFactory.getBizObjectManager(CUSTOMER_FAMILY_TEMP.CLASS_NAME, Sqlca);
BizObjectManager lgutManage = JBOFactory.getBizObjectManager(LB_GUARANTEE_UNIT_TEMP.CLASS_NAME, Sqlca);
StringBuffer sql = new StringBuffer("select sum(t.bc_money) as bcMoney from (select max(ifnull(CLEAN_LEASE_MONEY,0)) - max(ifnull(CAUTION_MONEY,0)) as bc_money from lb_project_info lpi left join lb_union_lessee lul on lul.PROJECT_ID=lpi.id left join customer_info ci on ci.customerid=lul.CUSTOMER_ID left join lb_contract_info lci on lci.PROJECT_ID=lpi.id left join lc_proj_condition lpc on lpc.PROJECT_ID=lpi.id left join CUSTOMER_FAMILY cf on cf.PROJECT_ID=lpi.id and cf.Partner_='Y' left join LB_GUARANTEE_UNIT lgu on lgu.PROJECT_ID=lpi.ID where ((lpi.PROJECT_STATUS='13' AND lci.id is null) or (lci.id is not null and (lci.CONTRACT_NO='21' or lci.CONTRACT_NO='31') )) ");
//证件号列表
ArrayList<String> certIdList = new ArrayList<>();
//承租人
BizObject cit = citManage.createQuery(" flowunid=:flowunid ").setParameter("flowunid",flowUnid ).getSingleResult(false);
String certId = cit.getAttribute("certid").getString(); // 承租人身份证号
StringBuffer certIdList = new StringBuffer(certId);
if (StringUtils.isNotBlank(cit.getAttribute("certid").getString())) certIdList.add(cit.getAttribute("certid").getString());
//配偶
BizObject cft = cftManage.createQuery(" flowunid=:flowunid ").setParameter("flowunid",flowUnid ).getSingleResult(false);
if(cft!=null && cft.getAttribute("certid").getString() !=null ) {
certIdList.append("','").append(cft.getAttribute("certid").getString());
if (cft!=null && StringUtils.isNotBlank(cft.getAttribute("certid").getString())) certIdList.add(cft.getAttribute("certid").getString());
//担保人
List<BizObject> lugList = lgutManage.createQuery(" flowunid=:flowunid ").setParameter("flowunid",flowUnid ).getResultList(false);
if (CollectionUtils.isNotEmpty(lugList)) {
lugList.forEach(item -> {
try {
if (StringUtils.isNotBlank(item.getAttribute("certid").getString())) {
certIdList.add(item.getAttribute("CERTID").getString());
}
} catch (JBOException e) {
e.printStackTrace();
}
});
}
List<BizObject> lugList = lgutManage.createQuery(" flowunid=:flowunid ").setParameter("flowunid",flowUnid ).getResultList(false);
if(lugList!=null && lugList.size()>0) {
for (BizObject lug : lugList) {
certIdList.append("','").append(lug.getAttribute("CERTID").getString());
if (certIdList.size() == 0) throw new RuntimeException("信审初审-路由判断证件信息为空!");
String certIdJoin = certIdList.stream().collect(Collectors.joining("','", "'", "'"));
//所有合同金额
StringBuilder allContractSql = new StringBuilder("select ifnull(sum(bc_money),0) as bcMoney,group_concat(proj_id separator '\\',\\'') as proj_ids from (select lpi.id as proj_id,CLEAN_LEASE_MONEY-ifnull(CAUTION_MONEY,0) as bc_money");
allContractSql.append(" from lb_project_info lpi")
.append(" left join lc_proj_condition lpc on lpc.PROJECT_ID = lpi.id")
.append(" left join lb_contract_info lci on lci.PROJECT_ID = lpi.id")
.append(" left join lb_union_lessee lul on lul.PROJECT_ID = lpi.id")
.append(" left join customer_info ci on ci.customerid = lul.CUSTOMER_ID")
.append(" left join CUSTOMER_FAMILY cf on cf.PROJECT_ID = lpi.id and cf.Partner_ = 'Y'")
.append(" left join LB_GUARANTEE_UNIT lgu on lgu.PROJECT_ID = lpi.ID")
.append(" where lpi.PROJECT_STATUS = '13'")
.append(" and (ci.certid in ("+certIdJoin+") or cf.certid in ("+certIdJoin+") or lgu.CERTID in ("+certIdJoin+"))")
.append(" group by lpi.id) t");
ASResultSet rsAll = Sqlca.getASResultSet(new SqlObject(allContractSql.toString()));
BigDecimal allContractMoney = BigDecimal.ZERO;
String projIds = null;
if (rsAll.next()) {
allContractMoney = rsAll.getBigDecimal("bcMoney");
projIds = rsAll.getString("proj_ids");
}
//项目下实收金额
BigDecimal incomeMoney = BigDecimal.ZERO;
if (StringUtils.isNotBlank(projIds)) {
String incomeMoneySql = "select ifnull(sum(corpus),0) as all_income from lc_rent_income where PROJECT_ID in ('" + projIds + "')";
ASResultSet incomeMoneyRs = Sqlca.getASResultSet(new SqlObject(incomeMoneySql));
if (incomeMoneyRs.next()) {
incomeMoney = incomeMoneyRs.getBigDecimal("all_income");
}
}
sql.append(" and ci.certid in ('").append(certIdList).append("') ");//拼接承租人
sql.append(" and cf.certid in ('").append(certIdList).append("') ");//拼接共同申请人
sql.append(" and lgu.CERTID in ('").append(certIdList).append("') ");//拼接担保人
sql.append(" group by lpi.id) t ");
BigDecimal cMoney =BigDecimal.ZERO;
List<Map<String, String>> retMoney = DataOperatorUtil.getDataBySql(sql.toString());
if(retMoney!=null && retMoney.size()>0) {
cMoney.add(new BigDecimal(retMoney.get(0).get("bcMoney")));
//流程中金额获取 信审初审节点 (包含当前流程)
String InFlowSql = "select ifnull(sum(_money),0) as inFlowMoney from ( select lcct.CLEAN_LEASE_MONEY - ifnull(lcct.CAUTION_MONEY, 0) as _money from flow_object fo join lc_calc_condition_temp lcct on fo.objectno = lcct.FLOWUNID left join customer_info_temp cit on cit.flowunid = fo.objectno left join customer_family_temp cft on cft.flowunid = fo.objectno and cft.Partner_ = 'Y' left join lb_guarantee_unit_temp lgut on lgut.FLOWUNID = fo.objectno where flowno = 'BusinessApplyFlow' and phaseno not in ('1000', '8000', '0010', '1020') and isnull(lcct.CLEAN_LEASE_MONEY) = 0"
+ " and (cit.certid in ("+certIdJoin+") or cft.certid in ("+certIdJoin+") or lgut.CERTID in ("+certIdJoin+")) group by fo.objectno) t";
ASResultSet rsIn = Sqlca.getASResultSet(new SqlObject(InFlowSql));
BigDecimal inFlowMoney = BigDecimal.valueOf(0);
if (rsIn.next()) {
inFlowMoney = rsIn.getBigDecimal("inFlowMoney");
}
String sMessage =null ;
if(1==1){//走第四个节点
sMessage="false";
}else {
sMessage="true";
}
return sMessage;
return allContractMoney.subtract(incomeMoney).add(inFlowMoney);
}
}
}