diff --git a/WebContent/Tenwa/Core/FlowManager/FlowPage/FlowPageViewTab.jsp b/WebContent/Tenwa/Core/FlowManager/FlowPage/FlowPageViewTab.jsp index 5d307285a..72f6a47a7 100644 --- a/WebContent/Tenwa/Core/FlowManager/FlowPage/FlowPageViewTab.jsp +++ b/WebContent/Tenwa/Core/FlowManager/FlowPage/FlowPageViewTab.jsp @@ -63,6 +63,8 @@ if(ReaderId.equals("")){ if (StringUtils.isEmpty(delTabs)) { out.write(new Button("关闭流程", "关闭流程", "closePage()", "", "btn_icon_close").getHtmlText()); + }else{ + flag = true; } }else{ rightType = "ReadOnly"; diff --git a/WebContent/Tenwa/Customer/Lessee/Comm/CustomerHistory/CustomerHistoryInformation.jsp b/WebContent/Tenwa/Customer/Lessee/Comm/CustomerHistory/CustomerHistoryInformation.jsp index bdce6ea14..b4136216a 100644 --- a/WebContent/Tenwa/Customer/Lessee/Comm/CustomerHistory/CustomerHistoryInformation.jsp +++ b/WebContent/Tenwa/Customer/Lessee/Comm/CustomerHistory/CustomerHistoryInformation.jsp @@ -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"); diff --git a/WebContent/Tenwa/Customer/Lessee/Comm/CustomerHistory/CustomerHistory_Info_temp.jsp b/WebContent/Tenwa/Customer/Lessee/Comm/CustomerHistory/CustomerHistory_Info_temp.jsp index 94f9c8a48..60f6a3b69 100644 --- a/WebContent/Tenwa/Customer/Lessee/Comm/CustomerHistory/CustomerHistory_Info_temp.jsp +++ b/WebContent/Tenwa/Customer/Lessee/Comm/CustomerHistory/CustomerHistory_Info_temp.jsp @@ -27,8 +27,8 @@ String compClientID = request.getParameter("CompClientID"); - dwTemp.replaceColumn("loaned", "", CurPage.getObjectWindowOutput()); - dwTemp.replaceColumn("outstand", "", CurPage.getObjectWindowOutput()); + dwTemp.replaceColumn("loaned", "", CurPage.getObjectWindowOutput()); + dwTemp.replaceColumn("outstand", "", CurPage.getObjectWindowOutput()); String sButtons[][] = { diff --git a/WebContent/Tenwa/Customer/Lessee/Comm/CustomerHistory/LoanedInfo.jsp b/WebContent/Tenwa/Customer/Lessee/Comm/CustomerHistory/LoanedInfo.jsp index 20f239a6a..6af9d6130 100644 --- a/WebContent/Tenwa/Customer/Lessee/Comm/CustomerHistory/LoanedInfo.jsp +++ b/WebContent/Tenwa/Customer/Lessee/Comm/CustomerHistory/LoanedInfo.jsp @@ -4,13 +4,17 @@ <% String certId = CurPage.getParameter("certId"); - - ASObjectModel doTemp = new ASObjectModel("LoanedList"); - doTemp.appendJboWhere(" and O.CONTRACT_STATUS >= 31 and O.CONTRACT_STATUS <> '104' and O.CONTRACT_STATUS <> '101' "); + String flowunId = CurPage.getParameter("flowunId"); + CurPage.setAttribute("flowRowCount", "20"); + CurPage.setAttribute("pageIdentify", "loan"); + ASObjectModel doTemp = new ASObjectModel("LoanedListNew"); + doTemp.setDataQueryClass("com.amarsoft.awe.dw.ui.list.FlowMonitorListHtmlGenerator"); + doTemp.appendJboWhere(" and o.CONTRACT_STATUS in ('31','100','105')"); ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); dwTemp.Style="1";//--设置为Grid风格-- dwTemp.ReadOnly = "1";//只读模式 - dwTemp.setPageSize(10); + dwTemp.setPageSize(20); + doTemp.setVisible("PROJECT_ID,FLOWUNID,CERTID_WITH_ROLE,CONTRACT_STATUS,business_status",false); dwTemp.genHTMLObjectWindow(certId); String sButtons[][] = { @@ -31,18 +35,16 @@ } function viewHisTabLocal() { - var param = FlowFunction.loadFlowParam(); - if (typeof(param.ObjectNo) == "undefined" || param.ObjectNo.length == 0) { + var flowunid = getItemValue(0,getRow(),"FLOWUNID"); + var projectId = getItemValue(0,getRow(),"PROJECT_ID"); + if (flowunid.length == 0 && projectId.length == 0) { alert(getHtmlMessage('1'));//请选择一条信息! return; } - let sTaskNo = param["TaskNo"] - if(sTaskNo==""){ - sTaskNo = AsControl.RunJavaMethodTrans("com.amarsoft.app.flow.FlowAction","getFlowEndRelativeTaskNo", "ObjectNo="+param["sObjectNo"]+",PhaseNo="+ param["sPhaseNo"]); - if(typeof(sTaskNo)=="undefined" || sTaskNo.length==0) { - alert("流程未结束,无法查看!"); - return; - } + let sTaskNo = AsControl.RunJavaMethodTrans("com.amarsoft.app.flow.FlowAction","getFlowEndRelativeTaskNo", "ObjectNo="+flowunid+",projectId="+projectId); + if(typeof(sTaskNo)=="undefined" || sTaskNo.length==0) { + alert("流程未结束,无法查看!"); + return; } var param ="TaskNo="+sTaskNo+"&ViewID=001&RightType=ReadOnly&delTabs=扣款卡信息,客户历史信息查询"; AsControl.OpenNewWin("/Tenwa/Core/FlowManager/FlowPage/FlowPageViewTab.jsp",param) diff --git a/WebContent/Tenwa/Customer/Lessee/Comm/CustomerHistory/OutstandInfo.jsp b/WebContent/Tenwa/Customer/Lessee/Comm/CustomerHistory/OutstandInfo.jsp index 50df292a2..8cd8c4a49 100644 --- a/WebContent/Tenwa/Customer/Lessee/Comm/CustomerHistory/OutstandInfo.jsp +++ b/WebContent/Tenwa/Customer/Lessee/Comm/CustomerHistory/OutstandInfo.jsp @@ -6,18 +6,19 @@ String certId = CurPage.getParameter("certId"); String flowunId = CurPage.getParameter("flowunId"); - - ASObjectModel doTemp = new ASObjectModel("LoanedList"); - doTemp.appendJboWhere(" and (O.CONTRACT_STATUS < 31 or O.CONTRACT_STATUS = '104' or O.CONTRACT_STATUS = '101') and O.FLOWUNID <> '"+flowunId+"'"); + CurPage.setAttribute("flowRowCount", "20"); + ASObjectModel doTemp = new ASObjectModel("LoanedListNew"); + doTemp.setDataQueryClass("com.amarsoft.awe.dw.ui.list.FlowMonitorListHtmlGenerator"); + doTemp.appendJboWhere(" and o.CONTRACT_STATUS not in ('100','105','31') and (flowunid not in ('"+flowunId+"') or v.isnull(flowunid))"); ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); dwTemp.Style="1";//--设置为Grid风格-- dwTemp.ReadOnly = "1";//只读模式 - dwTemp.setPageSize(10); + dwTemp.setPageSize(20); + doTemp.setVisible("PROJECT_ID,FLOWUNID,CERTID_WITH_ROLE,CONTRACT_STATUS,COUPUS_OVER,IS_OVERDUE",false); dwTemp.genHTMLObjectWindow(certId); - String sButtons[][] = { - - }; -%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + String sButtons[][] = {}; +%> +<%@include file="/Frame/resources/include/ui/include_list.jspf"%> -<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file +<%@ include file="/Frame/resources/include/include_end.jspf"%> diff --git a/WebContent/Tenwa/Lease/Flow/Project/BusinessApplication/CustomerInfo.jsp b/WebContent/Tenwa/Lease/Flow/Project/BusinessApplication/CustomerInfo.jsp index c4352bf44..cc7b3d500 100644 --- a/WebContent/Tenwa/Lease/Flow/Project/BusinessApplication/CustomerInfo.jsp +++ b/WebContent/Tenwa/Lease/Flow/Project/BusinessApplication/CustomerInfo.jsp @@ -281,10 +281,10 @@ // $("#FULLNAME").css("color","red"); // } - if("0030"=="<%=sPhaseNo%>" ||"0040"=="<%=sPhaseNo%>"||"0050"=="<%=sPhaseNo%>"||"0060"=="<%=sPhaseNo%>"|| ("0070"=="<%=sPhaseNo%>" && "false"=="<%=IsHistory%>")){//经销商阶段看不见标红,初审、复审、信审可以标红 + if("0030"=="<%=sPhaseNo%>" ||"0040"=="<%=sPhaseNo%>"||/5/.test("<%=sPhaseNo%>")||"0060"=="<%=sPhaseNo%>"|| ("0070"=="<%=sPhaseNo%>" && "false"=="<%=IsHistory%>")){//经销商阶段看不见标红,初审、复审、信审可以标红 var certResult = checkCertIdAll(); - if(certResult=="4"){ + if(certResult=='true'){ //$("#FULLNAME").attr("style","color:red;"); $("#CERTID").css("color","red"); } @@ -989,7 +989,7 @@ function checkCertIdAll(){//校验证件号 var certId = getItemValue(0,getRow(),"CERTID"); var sParams = "certId="+certId+",flowunid="+"<%=flowunid%>"; - var sReturnInfo = RunJavaMethodTrans("com.tenwa.lease.flow.project.businessapply.CustomerInfoCheck","checkCertIdAll",sParams); + var sReturnInfo = RunJavaMethodTrans("com.tenwa.lease.flow.project.businessapply.CustomerInfoCheck","checkExistsByCertid",sParams); return sReturnInfo; } function getIdentity(){ diff --git a/WebContent/WEB-INF/etc/jbo/jbo_lease.xml b/WebContent/WEB-INF/etc/jbo/jbo_lease.xml index 237d895f3..b7751e166 100644 --- a/WebContent/WEB-INF/etc/jbo/jbo_lease.xml +++ b/WebContent/WEB-INF/etc/jbo/jbo_lease.xml @@ -5241,6 +5241,28 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/com/amarsoft/app/flow/FlowAction.java b/src/com/amarsoft/app/flow/FlowAction.java index 2e72b4fa7..9f529cca3 100644 --- a/src/com/amarsoft/app/flow/FlowAction.java +++ b/src/com/amarsoft/app/flow/FlowAction.java @@ -68,6 +68,7 @@ public class FlowAction { private String AssignmentId;// 指派人员ID private String AssignSumbitType;// 指派处理方式 private String nextNodeType; + private String projectId; //项目id private FlowService flowService; @@ -227,6 +228,14 @@ public class FlowAction { this.flowService = flowService; } + public void setProjectId(String projectId) { + this.projectId = projectId; + } + + public String getProjectId() { + return projectId; + } + //处理重复提交数据重复,只适用单体服务 private static Set taskSet = new HashSet<>(); @@ -738,16 +747,16 @@ public class FlowAction { */ public String getFlowEndRelativeTaskNo(JBOTransaction tx) throws Exception { String taskSerialNo = ""; - if (phaseNo.equals("1000") || phaseNo.equals("8000")) { - BizObject bo = JBOFactory - .getBizObjectManager("jbo.sys.FLOW_TASK", tx) - .createQuery("select RELATIVESERIALNO from O where ObjectNo =:ObjectNo and PhaseNo =:PhaseNo ") - .setParameter("ObjectNo", objectNo) - .setParameter("PhaseNo", phaseNo) - .getSingleResult(false); - if (bo != null) - taskSerialNo = bo.getAttribute("RELATIVESERIALNO").getString(); - + String sql = "select ft.RELATIVESERIALNO from flow_bussiness_object fbo join flow_task ft on fbo.flow_unid = ft.objectno where fbo.flow_name = '业务申请流程' and ft.phaseno = '1000'"; + if (StringUtils.isNotBlank(objectNo)) { + sql += " and fbo.flow_unid = '" + objectNo + "'"; + } else { + sql += " and fbo.proj_id = '" + projectId + "'"; + } + Transaction Sqlca = Transaction.createTransaction(tx); + ASResultSet asResultSet = Sqlca.getASResultSet(new SqlObject(sql)); + if (asResultSet.next()) { + taskSerialNo = asResultSet.getString("RELATIVESERIALNO"); } return taskSerialNo; } diff --git a/src_core/com/tenwa/flow/tabviewservice/FlowTaskViewTabService.java b/src_core/com/tenwa/flow/tabviewservice/FlowTaskViewTabService.java index 70fc990b9..b57e15126 100644 --- a/src_core/com/tenwa/flow/tabviewservice/FlowTaskViewTabService.java +++ b/src_core/com/tenwa/flow/tabviewservice/FlowTaskViewTabService.java @@ -1,36 +1,16 @@ package com.tenwa.flow.tabviewservice; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; - -import javax.script.Bindings; -import javax.script.Invocable; -import javax.script.ScriptEngine; -import javax.script.ScriptEngineManager; -import javax.script.ScriptException; - -import jbo.com.tenwa.entity.comm.flow.FLOW_STEP_NODE; -import jbo.com.tenwa.lease.comm.LB_PROJECT_INFO; -import jbo.sys.CODE_LIBRARY; -import jbo.sys.FLOW_TASK; -import jbo.sys.OBJECTTYPE_RELA; - import com.amarsoft.amarscript.Any; import com.amarsoft.amarscript.Expression; import com.amarsoft.app.lc.workflow.action.GetFlowAction; -import com.amarsoft.are.jbo.BizObject; -import com.amarsoft.are.jbo.BizObjectManager; -import com.amarsoft.are.jbo.BizObjectQuery; -import com.amarsoft.are.jbo.JBOFactory; -import com.amarsoft.are.jbo.JBOTransaction; +import com.amarsoft.are.jbo.*; import com.amarsoft.are.lang.StringX; import com.amarsoft.are.util.StringFunction; import com.amarsoft.awe.control.model.Page; import com.amarsoft.awe.ui.widget.Button; +import com.amarsoft.awe.util.ASResultSet; +import com.amarsoft.awe.util.SqlObject; import com.amarsoft.awe.util.Transaction; import com.amarsoft.dict.als.manage.CodeManager; import com.amarsoft.dict.als.object.Item; @@ -39,8 +19,20 @@ import com.tenwa.flow.treeview.action.BaseInitTreeView; import com.tenwa.flow.treeview.action.TreeItemData; import com.tenwa.lease.util.FlowViewUtil; import com.tenwa.officetempalte.util.FileOperatorUtil; +import jbo.com.tenwa.entity.comm.flow.FLOW_STEP_NODE; +import jbo.com.tenwa.lease.comm.LB_PROJECT_INFO; +import jbo.sys.CODE_LIBRARY; +import jbo.sys.FLOW_TASK; +import jbo.sys.OBJECTTYPE_RELA; import org.apache.commons.lang3.StringUtils; +import javax.script.*; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + public class FlowTaskViewTabService { /** * 根据按钮组及配置的按钮集合,返回按钮属性列表 @@ -326,10 +318,35 @@ public class FlowTaskViewTabService { FlowTaskViewTabService.initFlowStepNodes(tx, FlowFixedParam, baseTreeView); } - public static void deleteTreeTab(List treeItemDataList,HashMap FlowFixedParam ){ - if(StringUtils.isNotBlank(FlowFixedParam.get("delTabs"))){ + public static void deleteTreeTab(List treeItemDataList, HashMap FlowFixedParam) { + if (StringUtils.isNotBlank(FlowFixedParam.get("delTabs"))) { List delTabs = treeItemDataList.stream().filter(item -> FlowFixedParam.get("delTabs").indexOf(item.getItemName()) > -1).collect(Collectors.toList()); - treeItemDataList.removeAll(delTabs); + if (delTabs.size() > 0) treeItemDataList.removeAll(delTabs); + } + // 业务申请流程(非草稿阶段)删除无数据担保人及共申人页签 + String flowUnid = FlowFixedParam.get("FlowUnid"); + if ("BusinessApplyFlow".equals(FlowFixedParam.get("FlowNo")) && !"0010".equals(FlowFixedParam.get("PhaseNo")) && StringUtils.isNotBlank(flowUnid)) { + Transaction Sqlca = null; + try { + Sqlca = Transaction.createTransaction("als"); + ASResultSet asResultSet = Sqlca.getASResultSet(new SqlObject("select count(cft.id) as cftNum,count(lgu.id) as lguNum from lb_project_info_temp lpit left join customer_family_temp cft on lpit.flowunid = cft.flowunid and cft.Partner_ = 'Y' left join lb_guarantee_unit_temp lgu on lpit.FLOWUNID = lgu.FLOWUNID where lpit.FLOWUNID = '" + flowUnid + "'")); + asResultSet.next(); + StringBuilder sb = new StringBuilder(); + if (asResultSet.getInt("cftNum") == 0) sb.append("共同申请人"); + if (asResultSet.getInt("lguNum") == 0) sb.append(",担保人信息"); + if (sb.length() > 0) { + List delTabs = treeItemDataList.stream().filter(item -> sb.toString().indexOf(item.getItemName()) > -1).collect(Collectors.toList()); + if (delTabs.size() > 0) treeItemDataList.removeAll(delTabs); + } + Sqlca.commit(); + } catch (Exception e) { + e.printStackTrace(); + try { + Sqlca.rollback(); + } catch (JBOException e1) { + e1.printStackTrace(); + } + } } } diff --git a/src_core/com/tenwa/voucher/CreateVoucherProcess/InsertCustomerHistoryInfo.java b/src_core/com/tenwa/voucher/CreateVoucherProcess/InsertCustomerHistoryInfo.java index 3f112f2d2..99b6811f0 100644 --- a/src_core/com/tenwa/voucher/CreateVoucherProcess/InsertCustomerHistoryInfo.java +++ b/src_core/com/tenwa/voucher/CreateVoucherProcess/InsertCustomerHistoryInfo.java @@ -12,9 +12,12 @@ 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; +import static com.ctc.wstx.shaded.msv_core.datatype.xsd.WhiteSpaceProcessor.replace; + public class InsertCustomerHistoryInfo { private String flowunid; @@ -35,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> customerinfo = conn.executeQuery(sql); - String customerid = ""; String certid = ""; //避免项目的历史客户信息重复录入 @@ -55,249 +58,284 @@ public class InsertCustomerHistoryInfo { if(customerinfo.size()>0){ for (int i = 0; i < customerinfo.size(); i++) { - customerid = customerinfo.get(i).get("customerid"); + + Conn con = new Conn(tx); 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); - String gmnum = ""; - if(gm_number.size()>0){ - gmnum = gm_number.get(0).get("num"); - }else { - gmnum = "0"; - } - ///获取客户为主承租融资金额和 - 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); - String CLEAN_LEASE_MONEY = ""; - if(rz.size()>0){ - CLEAN_LEASE_MONEY = rz.get(0).get("clean_lease_money"); - }else { - CLEAN_LEASE_MONEY = "0"; - } - //获取客户为主承租已结清合同数 - 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); - String jq_number = ""; - if(jq_num.size()>0){ - jq_number = jq_num.get(0).get("num"); - }else { - jq_number = "0"; - } - //获取客户为主承租未结清合同数 - 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); - String wjq_number = ""; - if(wjq_num.size()>0){ - wjq_number = wjq_num.get(0).get("num"); - }else { - wjq_number = "0"; - } - //获取客户为主承租车辆总和 - 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); - String carnumber = ""; - if(car_number.size()>0){ - carnumber = car_number.get(0).get("num"); - }else { - carnumber = "0"; - } - //获取客户为主承租结清车辆总和 - 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); - String carjqnumber = ""; - if(car_jq_number.size()>0){ - carjqnumber = car_jq_number.get(0).get("num"); - }else { - carjqnumber = "0"; - } - //获取客户为主承租未结清车辆总和 - 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); - String carwjqnumber = ""; - if(car_wjq_number.size()>0){ - carwjqnumber = car_wjq_number.get(0).get("num"); - }else { - 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"; + //根据证件号获取合同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> 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")+"'"+","; + } } + //主承租人取值 + 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"; + 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> 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> 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> 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> 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> 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> 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> 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> 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> 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"; } - //获取客户为共同承租人订单总数 - 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); - String gtgmnumber = ""; - if(gt_gm_number.size()>0){ - gtgmnumber = gt_gm_number.get(0).get("num"); - }else { - gtgmnumber = "0"; + } - //获取客户为共同承租人融资额和 - 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); - String GT_CLEAN_LEASE_MONEY = ""; - if(gt_rz.size()>0){ - GT_CLEAN_LEASE_MONEY = gt_rz.get(0).get("clean_lease_money"); - }else { - GT_CLEAN_LEASE_MONEY = "0"; - } - //获取客户为共同承租人已结清单数 - 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); - String gt_jq_number = ""; - if(gt_jq_num.size()>0){ - gt_jq_number = gt_jq_num.get(0).get("num"); - }else { - gt_jq_number = "0"; - } - //获取客户为共同承租人未结清单数 - 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); - String gt_wjq_number = ""; - if(gt_wjq_num.size()>0){ - gt_wjq_number = gt_wjq_num.get(0).get("num"); - }else { - gt_wjq_number = "0"; - } - //获取客户为共同承租人车辆总和 - 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); - String gtcarnumber = ""; - if(gt_car_number.size()>0){ - gtcarnumber = gt_car_number.get(0).get("num"); - }else { - gtcarnumber = "0"; - } - //获取客户为共同承租人结清车辆总和 - 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); - String gtcarjqnumber = ""; - if(gt_car_jq_number.size()>0){ - gtcarjqnumber = gt_car_jq_number.get(0).get("num"); - }else { - gtcarjqnumber = "0"; - } - //获取客户为共同承租人未结清车辆总和 - 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); - String gtcarwjqnumber = ""; - if(gt_car_wjq_number.size()>0){ - gtcarwjqnumber = gt_car_wjq_number.get(0).get("num"); - }else { - 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"; + + + //获取共同承租人合同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> 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")+"'"+","; + } } + //共同承租人取值 + 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"; + 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> 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> 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> 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> 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> 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> 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> 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> 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> 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"; } - //获取客户为担保人订单总数 - 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); - String dbgmnumber = ""; - if(db_gm_number.size()>0){ - dbgmnumber = db_gm_number.get(0).get("num"); - }else { - dbgmnumber = "0"; + } - //获取客户为担保人融资额和 - 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); - String DB_CLEAN_LEASE_MONEY = ""; - if(db_rz.size()>0){ - DB_CLEAN_LEASE_MONEY = db_rz.get(0).get("clean_lease_money"); - }else { - DB_CLEAN_LEASE_MONEY = "0"; - } - //获取客户为担保人已结清单数 - 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); - String db_jq_number = ""; - if(db_jq_num.size()>0){ - db_jq_number = db_jq_num.get(0).get("num"); - }else { - db_jq_number = "0"; - } - //获取客户为担保人未结清单数 - 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); - String db_wjq_number = ""; - if(db_wjq_num.size()>0){ - db_wjq_number = db_wjq_num.get(0).get("num"); - }else { - db_wjq_number = "0"; - } - //获取客户为担保人车辆总和 - 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); - String dbcarnumber = ""; - if(db_car_number.size()>0){ - dbcarnumber = db_car_number.get(0).get("num"); - }else { - dbcarnumber = "0"; - } - //获取客户为担保人结清车辆总和 - 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); - String dbcarjqnumber = ""; - if(db_car_jq_number.size()>0){ - dbcarjqnumber = db_car_jq_number.get(0).get("num"); - }else { - dbcarjqnumber = "0"; - } - //获取客户为担保人结清车辆总和 - 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); - String dbcarwjqnumber = ""; - if(db_car_wjq_number.size()>0){ - dbcarwjqnumber = db_car_wjq_number.get(0).get("num"); - }else { - 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"; + + + //获取担保人合同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> 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")+"'"+","; + } } + //担保人取值 + 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"; + 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> 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> 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> 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> 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> 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> 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> 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> 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> 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); BigDecimal exposureMoney = LBBusinessPrimary.obtainExposureMoney(sqlca,flowunid); @@ -305,10 +343,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); @@ -329,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> customerinfo = conn.executeQuery(sql); @@ -373,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> 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> 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> 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> 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> 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> 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> 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> 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> 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> 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> 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> 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> 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> 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> 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> 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> 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> 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> 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> 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> 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> 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> 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> 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> 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> 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> 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> 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> 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> 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 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; + } + + + + } diff --git a/src_tenwa/com/tenwa/apzl/handle/ProjectHisListHandler.java b/src_tenwa/com/tenwa/apzl/handle/ProjectHisListHandler.java new file mode 100644 index 000000000..25b75d408 --- /dev/null +++ b/src_tenwa/com/tenwa/apzl/handle/ProjectHisListHandler.java @@ -0,0 +1,103 @@ +package com.tenwa.apzl.handle; + +import com.amarsoft.are.jbo.BizObject; +import com.amarsoft.are.jbo.JBOFactory; +import com.amarsoft.awe.dw.handler.impl.CommonHandler; +import com.amarsoft.awe.util.ASResultSet; +import com.amarsoft.awe.util.SqlObject; +import com.amarsoft.awe.util.Transaction; +import jbo.app.LB_EQUIPMENT_CAR; +import jbo.app.LB_EQUIPMENT_CAR_TEMP; +import org.apache.commons.lang3.StringUtils; + +import java.math.BigDecimal; +import java.util.Optional; +import java.util.stream.Stream; + +public class ProjectHisListHandler extends CommonHandler { + + + @Override + protected void initDisplayForEdit(BizObject bo) throws Exception { + String projectId = bo.getAttribute("PROJECT_ID").getString(); + String pageIdentify = this.asPage.getParameter("pageIdentify"); + //车辆总数 + int carNum = 0; + //合同状态 + String statusName = null; + // 角色名称 + String roleName = null; + if (StringUtils.isNotBlank(bo.getAttribute("CERTID_WITH_ROLE").getString())) { + String certId = this.asPage.getParameter("certId"); + Optional first = Stream.of(bo.getAttribute("CERTID_WITH_ROLE").getString().split(",")).filter(item -> item.indexOf(certId) > -1).findFirst(); + if (first.isPresent()) { + roleName = first.get().split("-")[1]; + } + } + if (StringUtils.isNotEmpty(projectId)) { + BizObject lbcSingleResult = JBOFactory.createBizObjectQuery(LB_EQUIPMENT_CAR.CLASS_NAME, + "select v.count(1) as v.carNum from O where PROJECT_ID='" + projectId + "' and car_attribute = 'head'") + .getSingleResult(false); + if (lbcSingleResult != null) carNum = lbcSingleResult.getAttribute("carNum").getInt(); + Transaction Sqlca = null; + try { + Sqlca = Transaction.createTransaction("als"); + ASResultSet asResultSet = Sqlca.getASResultSet(new SqlObject("select concat(fbo.flow_name,'中') as flow_name,flowno from flow_bussiness_object fbo left join flow_object fo on fbo.flow_unid = fo.objectno " + + "where fbo.proj_id = '" + projectId + "' and fo.phaseno not in ('1000')")); + if (asResultSet.next()) { + statusName = asResultSet.getString("flow_name"); + } else { + String contractStatus = bo.getAttribute("contract_status").getString(); + asResultSet = Sqlca.getASResultSet(new SqlObject("select STATUS_NAME from lb_contract_status where STATUS_CODE = '" + contractStatus + "'")); + if (asResultSet.next()) { + statusName = asResultSet.getString("STATUS_NAME"); + } + } + Sqlca.commit(); + } catch (Exception e) { + Sqlca.rollback(); + } + } else { + // 业务申请数据处理(流程中) + String flowUnid = bo.getAttribute("FLOWUNID").getString(); + + BizObject lbctSingleResult = JBOFactory.createBizObjectQuery(LB_EQUIPMENT_CAR_TEMP.CLASS_NAME, + "select v.count(1) as v.carNum from O where flowunid='" + flowUnid + "' and car_attribute = 'head'") + .getSingleResult(false); + if (lbctSingleResult != null) carNum = lbctSingleResult.getAttribute("carNum").getInt(); + statusName = bo.getAttribute("CONTRACT_STATUS").getString(); + } + + bo.setAttributeValue("CAR_NUM", carNum); + bo.setAttributeValue("STATUS_NAME", statusName); + bo.setAttributeValue("ROLE_NAME", roleName); + if ("loan".equals(pageIdentify)) {// 已放款列表 + // 本金余额 + Transaction Sqlca = null; + String leaseMoney = bo.getAttribute("CLEAN_LEASE_MONEY").getString(); + BigDecimal incomeMoney = BigDecimal.ZERO; + String isOverdue = "否"; + if (StringUtils.isNotBlank(projectId)) { + try { + Sqlca = Transaction.createTransaction("als"); + String querySql = "select ifnull(sum(corpus),0) as COUPUS_OVER from lc_rent_income where PROJECT_ID = '" + projectId + "'"; + ASResultSet incomeMoneyRs = Sqlca.getASResultSet(new SqlObject(querySql)); + if (incomeMoneyRs.next()) { + incomeMoney = incomeMoneyRs.getBigDecimal("COUPUS_OVER"); + } + querySql = "select count(1) as over_num from lc_rent_plan where PROJECT_ID = '" + projectId + "' and PLAN_DATE < current_date() and (isnull(COLLECT_STATUS) or COLLECT_STATUS in ('未收款','部分收款','未收款lock'))"; + ASResultSet asResultSet = Sqlca.getASResultSet(new SqlObject(querySql)); + if (asResultSet.next() && asResultSet.getInt("over_num") > 0) isOverdue = "是"; + Sqlca.commit(); + } catch (Exception e) { + Sqlca.rollback(); + } + } + //是否逾期 + bo.setAttributeValue("IS_OVERDUE", isOverdue); + //剩余本金 + bo.setAttributeValue("COUPUS_OVER", new BigDecimal(leaseMoney).subtract(incomeMoney)); + + } + } +} diff --git a/src_tenwa/com/tenwa/lease/flow/project/businessapply/CustomerInfoCheck.java b/src_tenwa/com/tenwa/lease/flow/project/businessapply/CustomerInfoCheck.java index 21337cfa0..7fe00e9b2 100644 --- a/src_tenwa/com/tenwa/lease/flow/project/businessapply/CustomerInfoCheck.java +++ b/src_tenwa/com/tenwa/lease/flow/project/businessapply/CustomerInfoCheck.java @@ -1,35 +1,20 @@ package com.tenwa.lease.flow.project.businessapply; +import com.amarsoft.are.jbo.*; +import com.amarsoft.awe.util.ASResultSet; +import com.amarsoft.awe.util.SqlObject; +import com.amarsoft.awe.util.Transaction; 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; -import jbo.app.tenwa.customer.CUSTOMER_FAMILY_TEMP; -import jbo.app.tenwa.customer.CUSTOMER_PERSON; -import jbo.app.tenwa.customer.CUSTOMER_PERSON_TEMP; -import jbo.app.tenwa.customer.DISTRIBUTOR_INFO; +import jbo.app.tenwa.customer.*; import jbo.com.tenwa.entity.comm.flow.FLOW_BUSSINESS_OBJECT; -import jbo.com.tenwa.lease.comm.LB_GUARANTEE_UNIT; import jbo.com.tenwa.lease.comm.LB_GUARANTEE_UNIT_TEMP; -import jbo.com.tenwa.lease.comm.LB_MANY_SUBJECT; import jbo.com.tenwa.lease.comm.LB_PROJECT_INFO; import jbo.com.tenwa.lease.comm.LB_PROJECT_INFO_TEMP; 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; -import com.amarsoft.are.jbo.JBOException; -import com.amarsoft.are.jbo.JBOFactory; -import com.amarsoft.are.jbo.JBOTransaction; -import com.amarsoft.awe.util.ASResultSet; -import com.amarsoft.awe.util.SqlObject; -import com.amarsoft.awe.util.Transaction; - public class CustomerInfoCheck { private String CustomerName; @@ -48,7 +33,7 @@ public class CustomerInfoCheck { private String projectNo; private String FULLNAME; private String SubjectId; - + public String getFULLNAME() { return FULLNAME; } @@ -138,7 +123,7 @@ public class CustomerInfoCheck { } return mobileResult; } - + public String checkMobileRepeat(JBOTransaction tx) throws JBOException{//校验手机号是否重复 if(customerType.equals("03")){//自然人 //BizObject mobileP=JBOFactory.createBizObjectQuery(CUSTOMER_PERSON.CLASS_NAME,"mobile=:mobile").setParameter("mobile", this.mobile).getSingleResult(false); @@ -217,12 +202,12 @@ public class CustomerInfoCheck { // return "手机号跟配偶人手机号重复!"; // } // } - } + } } } return "SUCCESS"; } - + public String checkDebitCardMobile(JBOTransaction tx) throws JBOException{//校验扣款卡手机号 if(customerType.equals("03")){//自然人校验共同人和担保人 BizObject mobilePT=JBOFactory.createBizObjectQuery(CUSTOMER_PERSON_TEMP.CLASS_NAME,"FLOWUNID=:flowunid and mobile=:mobile").setParameter("flowunid", this.flowunid).setParameter("mobile", this.mobile).getSingleResult(false); @@ -243,7 +228,7 @@ public class CustomerInfoCheck { } return mobileResult; } - + public String checkSex(JBOTransaction tx) throws Exception{ BizObjectManager cptMange = JBOFactory.getBizObjectManager(CUSTOMER_PERSON_TEMP.CLASS_NAME, tx); BizObject cpt = cptMange.createQuery("flowunid =:flowunid").setParameter("flowunid", flowunid).getSingleResult(false); @@ -257,7 +242,7 @@ public class CustomerInfoCheck { } return "error"; } - + public String checkNameAndCertId(JBOTransaction tx)throws Exception{ String CustomerId=""; Transaction Sqlca=null; @@ -323,7 +308,7 @@ public class CustomerInfoCheck { BizObject cptP = cptManage.createQuery("flowunid=:flowunid").setParameter("flowunid", flowunid).getSingleResult(false); String MARRIAGE = cptP.getAttribute("MARRIAGE").getString(); String name1 = cft.getAttribute("name").getString(); - + if("01".equals(MARRIAGE) && name1.equals(FULLNAME)){ return "success"; }else{ @@ -353,7 +338,7 @@ public class CustomerInfoCheck { } return returns; }*/ - + public String getFlowunid() { return flowunid; } @@ -432,7 +417,7 @@ public class CustomerInfoCheck { public void setId(String id) { this.id = id; } - + public String getProjectNo() { return projectNo; } @@ -457,7 +442,7 @@ public class CustomerInfoCheck { } return mas; } - + public String checkProjectNo(JBOTransaction tx) throws JBOException{//校验姓名是否存在LB_PROJECT_INFO_TEMP BizObjectManager lpitManage = JBOFactory.getBizObjectManager(LB_PROJECT_INFO_TEMP.CLASS_NAME, tx); BizObjectManager lpiManage = JBOFactory.getBizObjectManager(LB_PROJECT_INFO.CLASS_NAME, tx); @@ -473,7 +458,7 @@ public class CustomerInfoCheck { }else{ return "error"; } - + } return "success"; } @@ -506,6 +491,28 @@ public class CustomerInfoCheck { } return msg; } + + /** + * 校验当前证件号是否在本系统参与业务制作(走过业务信审就算,不包含当前单) + * @param tx + * @return + * @throws JBOException + */ + public String checkExistsByCertid(JBOTransaction tx) throws Exception { + Transaction Sqlca = Transaction.createTransaction(tx); + StringBuilder querySqlSb = new StringBuilder(); + querySqlSb.append("select sum(num) as allNum from (") + .append(" select count(1) as num from customer_info_temp ci left join flow_task ft on ci.FLOWUNID = ft.objectno and ft.phaseno = '0030' where ci.FLOWUNID <> '"+flowunid+"' and ft.flowno = 'BusinessApplyFlow' and ci.certid = '"+certId+"'") + .append(" union all") + .append(" select count(1) as num from customer_family_temp ci left join flow_task ft on ci.FLOWUNID = ft.objectno and ft.phaseno = '0030' where ci.FLOWUNID <> '"+flowunid+"' and ft.flowno = 'BusinessApplyFlow' and ci.certid = '"+certId+"'") + .append(" union all") + .append(" select count(1) as num from lb_guarantee_unit_temp ci left join flow_task ft on ci.FLOWUNID = ft.objectno and ft.phaseno = '0030' where ci.FLOWUNID <> '"+flowunid+"' and ft.flowno = 'BusinessApplyFlow' and ci.certid = '"+certId+"'") + .append(" ) t"); + ASResultSet asResultSet = Sqlca.getASResultSet(new SqlObject(querySqlSb.toString())); + if (asResultSet.next() && asResultSet.getInt("allNum") > 0) return "true"; + return "false"; + } + //如果是北汽的产品修改FLOW_BUSSINESS_OBJECT中的flow_key public String changFlowKey(JBOTransaction tx) throws Exception{ BizObjectManager fboManage = JBOFactory.getBizObjectManager(FLOW_BUSSINESS_OBJECT.CLASS_NAME, tx); diff --git a/src_tenwa/com/tenwa/lease/flow/project/businessapply/LBBusinessPrimary.java b/src_tenwa/com/tenwa/lease/flow/project/businessapply/LBBusinessPrimary.java index 6a83829c7..9cc7de255 100644 --- a/src_tenwa/com/tenwa/lease/flow/project/businessapply/LBBusinessPrimary.java +++ b/src_tenwa/com/tenwa/lease/flow/project/businessapply/LBBusinessPrimary.java @@ -111,7 +111,8 @@ public class LBBusinessPrimary extends BaseBussiness { } } //流程中金额获取(当前流程) - String InFlowSql = "select CLEAN_LEASE_MONEY-ifnull(CAUTION_MONEY,0) as inFlowMoney from lc_calc_condition_temp where FLOWUNID = '"+flowUnid+"'"; + String InFlowSql = "select CLEAN_LEASE_MONEY-ifnull(CAUTION_MONEY,0) as inFlowMoney from lc_calc_condition_temp lcct " + + " left join flow_object fo on lcct.FLOWUNID = fo.objectno where lcct.FLOWUNID = '"+flowUnid+"' and fo.phaseno not in ('1000')"; ASResultSet rsIn = Sqlca.getASResultSet(new SqlObject(InFlowSql)); BigDecimal inFlowMoney = BigDecimal.valueOf(0); if (rsIn.next()) { diff --git a/src_tenwa/com/tenwa/lease/flow/project/commcheck/ReviewExposureCheck.java b/src_tenwa/com/tenwa/lease/flow/project/commcheck/ReviewExposureCheck.java new file mode 100644 index 000000000..87cae9c42 --- /dev/null +++ b/src_tenwa/com/tenwa/lease/flow/project/commcheck/ReviewExposureCheck.java @@ -0,0 +1,40 @@ +package com.tenwa.lease.flow.project.commcheck; + +import com.amarsoft.awe.util.Transaction; +import com.tenwa.lease.flow.project.businessapply.LBBusinessPrimary; +import com.tenwa.template.check.DefaultBussinessCheck; +import org.apache.commons.lang3.StringUtils; + +import java.math.BigDecimal; + +/** + * 业务申请-复审敞口校验 + */ +public class ReviewExposureCheck extends DefaultBussinessCheck { + @Override + public Object run(Transaction Sqlca) throws Exception { + String flowunid = this.getAttribute("ObjectNo").toString(); + String phaseNo = this.getAttribute("PhaseNo").toString(); + String custType = Sqlca.getString("select cit.customertype from lb_union_lessee_temp lult join customer_info_temp cit on lult.FLOWUNID = cit.flowunid where lult.FLOWUNID = '" + flowunid + "' and lult.IS_MAIN = 'Y' "); + if (StringUtils.isEmpty(custType)) throw new RuntimeException("客户类型不存在,请联系管理员"); + BigDecimal compareMoney = BigDecimal.ZERO; + if ("0040".equals(phaseNo)) {//个人小于等于60万,法人小于等于100万 信审复审初级 + compareMoney = "03".equals(custType) ? BigDecimal.valueOf(600000) : BigDecimal.valueOf(1000000); + } else if ("0050".equals(phaseNo)) {//个人小于等于100万,法人小于等于200万 信审复审中级 + compareMoney = "03".equals(custType) ? BigDecimal.valueOf(1000000) : BigDecimal.valueOf(2000000); + } else if ("0051".equals(phaseNo)) {//个人小于等于200万,法人小于等于300万 信审复审高级 + compareMoney = "03".equals(custType) ? BigDecimal.valueOf(2000000) : BigDecimal.valueOf(3000000); + } else if ("0052".equals(phaseNo)) {//个人小于等于300万,法人小于等于500万 信审复审资深 + compareMoney = "03".equals(custType) ? BigDecimal.valueOf(3000000) : BigDecimal.valueOf(5000000); + } else if ("0053".equals(phaseNo)) {//个人大于300万,法人大于500万 信审会和贷审会 + setPass(true); + } + BigDecimal exposureMoney = LBBusinessPrimary.obtainExposureMoney(Sqlca, flowunid); + if (exposureMoney.compareTo(compareMoney) > -1) { + setPass(false); + } else { + setPass(true); + } + return null; + } +}