diff --git a/WebContent/AppConfig/OrgUserManage/UserList.jsp b/WebContent/AppConfig/OrgUserManage/UserList.jsp index ffc9d4363..20c921c14 100644 --- a/WebContent/AppConfig/OrgUserManage/UserList.jsp +++ b/WebContent/AppConfig/OrgUserManage/UserList.jsp @@ -57,7 +57,6 @@ //alert(getHtmlMessage('1'));//请选择一条信息! return; } - debugger; var afsState = sReturn.split("@"); afsState = afsState[0]; if(typeof(curStatus)=="undefined" ||curStatus.length==0){ diff --git a/WebContent/WEB-INF/lib/bcprov-ext-jdk15-146.jar b/WebContent/WEB-INF/lib/bcprov-ext-jdk15-146.jar deleted file mode 100644 index 2d98d33c9..000000000 Binary files a/WebContent/WEB-INF/lib/bcprov-ext-jdk15-146.jar and /dev/null differ diff --git a/WebContent/WEB-INF/web.xml b/WebContent/WEB-INF/web.xml index 59ee95941..8d0f3b5e1 100644 --- a/WebContent/WEB-INF/web.xml +++ b/WebContent/WEB-INF/web.xml @@ -132,10 +132,6 @@ AfsResultServlet com.ample.esb.controller.AfsResultServlet - - DataSource - als - ScoreResultServlet diff --git a/src/com/ample/esb/bean/amp/AmpRequest.java b/src/com/ample/esb/bean/amp/AmpRequest.java index bea51a44b..588bcf7da 100644 --- a/src/com/ample/esb/bean/amp/AmpRequest.java +++ b/src/com/ample/esb/bean/amp/AmpRequest.java @@ -11,6 +11,9 @@ public class AmpRequest { @XStreamOmitField private String operatorId; + @XStreamOmitField + private String flowUnid; + public String getOperatorId() { return operatorId; } @@ -19,6 +22,14 @@ public class AmpRequest { this.operatorId = operatorId; } + public String getFlowUnid() { + return flowUnid; + } + + public void setFlowUnid(String flowUnid) { + this.flowUnid = flowUnid; + } + public String getApplication() { return application; } diff --git a/src/com/ample/esb/common/EsbCommon.java b/src/com/ample/esb/common/EsbCommon.java index c81acae64..1947592aa 100644 --- a/src/com/ample/esb/common/EsbCommon.java +++ b/src/com/ample/esb/common/EsbCommon.java @@ -14,7 +14,6 @@ import com.ample.esb.util.DateUtils; import com.ample.esb.util.GlobalSeqNo; import com.ample.esb.util.XstreamUtil; import com.ample.sms.FileUtil; -import com.thoughtworks.xstream.XStream; import org.apache.http.HttpResponse; import org.apache.http.HttpStatus; import org.apache.http.client.config.RequestConfig; @@ -36,8 +35,7 @@ public class EsbCommon implements EsbServise { transaction.setMessageBody(messgeBody()); return transaction; } - public MessageEsbHead getCommonEsbHead() { - MessageEsbHead esbHead = new MessageEsbHead(); + public MessageEsbHead getCommonEsbHead(MessageEsbHead esbHead) { esbHead.setSourceSystemId("APF"); esbHead.setOriginalSystemId("APF"); esbHead.setSourceMachineDate(DateUtils.dateNow()); @@ -51,8 +49,7 @@ public class EsbCommon implements EsbServise { esbHead.setEsbExpandContent(""); return esbHead; } - public MessageAppHead getCommonAppHead(){ - MessageAppHead appHead = new MessageAppHead(); + public MessageAppHead getCommonAppHead(MessageAppHead appHead){ appHead.setBranchCode("20"); appHead.setSourceTranDate(DateUtils.dateNow()); appHead.setSourceTranTime(DateUtils.TimeNowAccurate()); @@ -70,18 +67,17 @@ public class EsbCommon implements EsbServise { appHead.setAppExpandContent(""); return appHead; } - public MessageBody getCommonBody(){ - MessageBody msgBody = new MessageBody(); + public MessageBody getCommonBody(MessageBody msgBody){ return msgBody; } public MessageEsbHead esbHead(){ - return this.getCommonEsbHead(); + return this.getCommonEsbHead(new MessageEsbHead()); } public MessageAppHead appHead(){ - return this.getCommonAppHead(); + return this.getCommonAppHead(new MessageAppHead()); } public MessageBody messgeBody(){ - return this.getCommonBody(); + return this.getCommonBody(new MessageBody()); } public String httpSend(String url , String xmlValue){ @@ -110,29 +106,6 @@ public class EsbCommon implements EsbServise { return result; } - public String xmlConvert(Transaction tran) { - XStream xs = XstreamUtil.initXStream(true); - xs.autodetectAnnotations(true); - xs.aliasSystemAttribute(null,"class"); - String xml = xs.toXML(tran); - //XStream的老毛病,转译会将_转成__,所以在这里转回来 - xml = xml.replace("__","_"); - xml = "\n" + xml; - return xml; - } - - public Transaction objectConvert(String xml) { - if(xml.startsWith("")+2); - } - XStream xs = new XStream(); - xs.ignoreUnknownElements(); - xs.autodetectAnnotations(true); - xs.alias("TRANSACTION",Transaction.class); - Transaction response = (Transaction)xs.fromXML(xml); - return response; - } - /** * 国三摘要 * @param srcData diff --git a/src/com/ample/esb/controller/AfsResultServlet.java b/src/com/ample/esb/controller/AfsResultServlet.java index bbf3bb64e..a5c38ec78 100644 --- a/src/com/ample/esb/controller/AfsResultServlet.java +++ b/src/com/ample/esb/controller/AfsResultServlet.java @@ -24,8 +24,8 @@ import java.io.PrintWriter; public class AfsResultServlet extends HttpServlet { private static final long serialVersionUID = 1L; public void doPost(HttpServletRequest request, HttpServletResponse response) { - System.out.println("反欺诈人工判定结果请求回调开始!"); - response.setContentType("application/x-www-form-urlencoded;charset:utf-8"); + System.out.println("============反欺诈人工判定结果请求回调开始!============"); + response.setContentType("application/xml;charset:utf-8"); response.setHeader("Cache-Control", "no-store"); response.setHeader("Pragma", "no-cache"); response.setDateHeader("Expires", 0L); @@ -48,7 +48,7 @@ public class AfsResultServlet extends HttpServlet { out.print(updateResult(resultXml)); out.close(); - + System.out.println("============反欺诈人工判定结果请求回调结束!============"); } public String updateResult(String requestXml){ @@ -59,18 +59,8 @@ public class AfsResultServlet extends HttpServlet { FileUtil.writeFile(logPath + projectNo +"_"+ globalSeqNo +"_request.txt", requestXml); String fraudAlert = tran.getMessageBody().getAfsResultRequest().getFraudAlert(); String actionTaken = tran.getMessageBody().getAfsResultRequest().getActionTaken(); - BizObjectManager bom = null; - BizObject boRsr = null; - try { - bom = JBOFactory.getBizObjectManager(RC_SCORE_RESULT.CLASS_NAME); - boRsr = bom.createQuery("project_no=:projectNo").setParameter("projectNo",projectNo).getSingleResult(true); - boRsr.setAttributeValue("fraud_alert_code",fraudAlert); - boRsr.setAttributeValue("fraud_taken_code",actionTaken); - boRsr.setAttributeValue("updatetime", DateUtils.dateTimeNowCore()); - bom.saveObject(boRsr); - } catch (JBOException e) { - e.printStackTrace(); - } + + String RetCommStatus = "S"; Response rs = new Response(); rs.setResult("Successful"); MessageBody mb = new MessageBody(); @@ -81,17 +71,35 @@ public class AfsResultServlet extends HttpServlet { esbHead.setTargetMachineTime(DateUtils.TimeNowAccurate()); esbHead.setTargetReciveDate(DateUtils.dateNow()); esbHead.setTargetReciveTime(DateUtils.TimeNowAccurate()); - esbHead.setRetCommStatus("S"); - esbHead.setRetCode("000000"); - esbHead.setRetMsg("成功"); esbHead.setRetSystemId("APF"); + esbHead.setRetCode("000000"); + esbHead.setRetMsg("成功"); + + BizObjectManager bom = null; + BizObject boRsr = null; + try { + bom = JBOFactory.getBizObjectManager(RC_SCORE_RESULT.CLASS_NAME); + boRsr = bom.createQuery("project_no=:projectNo").setParameter("projectNo",projectNo).getSingleResult(true); + boRsr.setAttributeValue("fraud_alert_code",fraudAlert); + boRsr.setAttributeValue("fraud_taken_code",actionTaken); + boRsr.setAttributeValue("update_time", DateUtils.dateTimeNowCore()); + bom.saveObject(boRsr); + } catch (JBOException e) { + e.printStackTrace(); + tran.setMessageBody(null); + RetCommStatus = "F"; + esbHead.setRetCode("99999"); + esbHead.setRetMsg("失败:"+e.getErrorMessage()); + } + + esbHead.setRetCommStatus(RetCommStatus); MessageAppHead appHead = tran.getMessageAppHead(); appHead.setTargetTranDate(DateUtils.dateNow()); appHead.setTargetTranTime(DateUtils.TimeNowAccurate()); String responseXml = XstreamUtil.xmlConvert(tran); - FileUtil.writeFile(logPath + projectNo +"_"+ globalSeqNo +"_response.txt", responseXml); + FileUtil.writeFile(logPath + projectNo +"_"+ globalSeqNo + RetCommStatus +"_response.txt", responseXml); return responseXml; diff --git a/src/com/ample/esb/controller/AmpController.java b/src/com/ample/esb/controller/AmpController.java index feaa57179..29e57caf2 100644 --- a/src/com/ample/esb/controller/AmpController.java +++ b/src/com/ample/esb/controller/AmpController.java @@ -1,44 +1,26 @@ package com.ample.esb.controller; -import com.amarsoft.app.util.ProductParamUtil; -import com.amarsoft.are.jbo.*; -import com.ample.esb.bean.amp.*; +import com.amarsoft.are.jbo.JBOTransaction; import com.ample.esb.bean.esb.Transaction; -import com.ample.esb.common.ParamDataUtils; -import com.ample.esb.service.EsbServise; +import com.ample.esb.service.AmpService; import com.ample.esb.service.impl.AmpServiceImpl; -import com.ample.esb.util.DateUtils; -import com.ample.esb.util.XstreamUtil; -import jbo.app.tenwa.calc.*; -import jbo.app.tenwa.customer.*; -import jbo.com.tenwa.lease.comm.*; -import jbo.oti.RC_ADDRESS_INFO; -import jbo.prd.PRD_SPECIFIC_LIBRARY; -import jbo.sys.FLOW_TASK; -import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Set; +import java.util.HashMap; +import java.util.Map; public class AmpController { private String operatorId; private String flowUnid; public String ampDo(JBOTransaction tx) throws Exception { - EsbServise es = new AmpServiceImpl(getRequestBody()); - Transaction tran = es.transactionDo(); + Map map = new HashMap(); + map.put("flowUnid",flowUnid); + map.put("operatorId",operatorId); + AmpService as = new AmpServiceImpl(map); + Transaction tran = as.transactionDo(); String result = resultAnalysis(tran); return result; } - public AmpRequest getRequestBody() throws Exception { - String requestInfo = XstreamUtil.xmlConvertNotTitle(getApplicationTitle()); - requestInfo = "" + requestInfo + "]]>"; - AmpRequest AmpRequest = new AmpRequest(); - AmpRequest.setOperatorId(operatorId); - AmpRequest.setApplication(requestInfo); - return AmpRequest; - } + public String resultAnalysis(Transaction tran){ String response = ""; String retCode = tran.getMessageEsbHead().getRetCode(); @@ -67,1012 +49,6 @@ public class AmpController { this.flowUnid = flowUnid; } - public ApplicationTitle getApplicationTitle() throws Exception { - this.init(); - ApplicationTitle app = new ApplicationTitle(); - Applicant2 app2 = new Applicant2(); - app2.setDealerInfo(getDealerInfo()); - app2.setLoanInfo(getLoanInfo()); - app2.setVehicleInfo(getVehicleInfo()); - app2.setCustomerInfo(getCustomerInfo()); - app2.setCoborrowers(getCoborrowers()); - app2.setGuarantorInfo(getGuarantorInfo()); - app2.setContInfo(getContInfo()); - app2.setApplicationInfo(getApplicationInfo()); - app2.setPreviouslyVehicle(getPreviouslyVehicle()); - app.setApplicant2(app2); - return app; - } - //公共参数 - //订单临时表 - private BizObject boLpit; - //个人临时表 - private BizObject boCpt; - //测算临时表 - private BizObject boLcct; - //订单临时表集合 - private List boLects; - private List boLguts; - - private BizObjectManager bomLpi; - - private BizObject boCft; - //经销商正式表 - private BizObject boDi; - /** - * 往bean里面填值 - * @throws JBOException - */ - public void init() throws JBOException { - boLpit = JBOFactory.createBizObjectQuery(LB_PROJECT_INFO_TEMP.CLASS_NAME,"FLOWUNID=:FLOWUNID").setParameter("FLOWUNID",flowUnid).getSingleResult(false); - /*if(boLpit==null||boLpit.getAttribute("ID")==null||"".equals(boLpit.getAttribute("ID").toString())){ - return; - }*/ - boCpt = JBOFactory.createBizObjectQuery(CUSTOMER_PERSON_TEMP.CLASS_NAME,"FLOWUNID=:flowunid").setParameter("flowunid",flowUnid).getSingleResult(false); - - boLects = JBOFactory.createBizObjectQuery(LB_EQUIPMENT_CAR_TEMP.CLASS_NAME,"FLOWUNID=:FLOWUNID").setParameter("FLOWUNID",flowUnid).getResultList(false); - - boLcct = JBOFactory.createBizObjectQuery(LC_CALC_CONDITION_TEMP.CLASS_NAME,"FLOWUNID=:flowunid").setParameter("flowunid",flowUnid).getSingleResult(false); - - bomLpi = JBOFactory.getBizObjectManager(LB_PROJECT_INFO.CLASS_NAME); - - String distributorNo = boLpit.getAttribute("distributor_id").toString(); - boDi = JBOFactory.createBizObjectQuery(DISTRIBUTOR_INFO.CLASS_NAME,"DISTRIBUTOR_NO=:distributorNo").setParameter("distributorNo",distributorNo).getSingleResult(false); - boCft = JBOFactory.createBizObjectQuery(CUSTOMER_FAMILY_TEMP.CLASS_NAME,"FLOWUNID=:flowunid and Partner_='Y'").setParameter("flowunid",flowUnid).getSingleResult(false); - boLguts = JBOFactory.createBizObjectQuery(LB_GUARANTEE_UNIT_TEMP.CLASS_NAME,"FLOWUNID=:flowunid ").setParameter("flowunid",flowUnid).getResultList(false); - - } - public DealerInfo getDealerInfo() throws JBOException { - if(boDi==null||boDi.getAttribute("ID")==null||"".equals(boDi.getAttribute("ID").toString())){ - return null; - } - String distributorNo = boLpit.getAttribute("distributor_id").toString(); - DealerInfo di = new DealerInfo(); - //经销商名称 - di.setDealerName(boDi.getAttribute("DISTRIBUTOR_NAME").toString()); - //经销商编号 - di.setDealerId(distributorNo); - di.setDealerMode(""); - String addressCode = boDi.getAttribute("DISTRIBUTOR_ADDRESS").getString(); - String dealerProvince = ParamDataUtils.queryMapBcProvinceCode("AreaCode",addressCode); - String dealerCity = ParamDataUtils.queryMapBcCityCode("AreaCode",addressCode); - di.setDealerProvince_gb(dealerProvince); - di.setDealerCity_gb(dealerCity); - di.setDealerDistrict_gb(""); - di.setDealerStreet_gb(""); - di.setSubDealerName(""); - di.setDealerGuaranteeRatio(""); - di.setDealerFiledVisitFlag(""); - di.setSubDealerAppFlag(""); - di.setDealerArea(""); - di.setSubDealerCode(""); - di.setDealerTotalUsedAmount(""); - di.setDealerAvailableAmount(""); - - - int monthApproveCount = bomLpi.createQuery("select 1 from o left join jbo.com.tenwa.lease.comm.LB_EQUIPMENT_CAR lec on lec.project_id=o.id where o.distributor_id=:distributor_id and o.project_status='13' and left(o.INPUTTIME,7)=:curMonth").setParameter("distributor_id",distributorNo).setParameter("curMonth",DateUtils.monthNowCore()).getTotalCount(); - int monthFailCount = bomLpi.createQuery("select 1 from o left join jbo.com.tenwa.lease.comm.LB_EQUIPMENT_CAR lec on lec.project_id=o.id where o.distributor_id=:distributor_id and o.PROJECT_STATUS<>'13' and left(o.INPUTTIME,7)=:curMonth").setParameter("distributor_id",distributorNo).setParameter("curMonth",DateUtils.monthNowCore()).getTotalCount(); - di.setApprovalCountThisMonth(monthApproveCount); - di.setRefuseCountThisMonth(monthFailCount); - BizObjectManager bomLfi = JBOFactory.getBizObjectManager(LC_FUND_INCOME.CLASS_NAME); - int monthLoanCount = bomLfi.createQuery("select 1 from o left join jbo.com.tenwa.lease.comm.LB_EQUIPMENT_CAR lec on lec.project_id=o.project_id left join jbo.com.tenwa.lease.comm.LB_PROJECT_INFO lpi on lpi.id=o.project_id where o.pay_type = 'pay_type_out' and o.PAY_STATUS='have_paid' and o.FEE_TYPE='feetype10' and o.SETTLE_METHOD='settlemethod6' and left(o.fact_date,7)=:curMonth and lpi.distributor_id=:distributor_id").setParameter("distributor_id",distributorNo).setParameter("curMonth",DateUtils.monthNowCore()).getTotalCount(); - di.setLoanCountThisMonth(monthLoanCount); - int yearApproveCount = bomLpi.createQuery("select 1 from o left join jbo.com.tenwa.lease.comm.LB_EQUIPMENT_CAR lec on lec.project_id=o.id where o.distributor_id=:distributor_id and o.project_status='13' and left(o.INPUTTIME,4)=:curYear").setParameter("distributor_id",distributorNo).setParameter("curYear",DateUtils.yearNow()).getTotalCount(); - int yearFailCount = bomLpi.createQuery("select 1 from o left join jbo.com.tenwa.lease.comm.LB_EQUIPMENT_CAR lec on lec.project_id=o.id where o.distributor_id=:distributor_id and o.PROJECT_STATUS<>'13' and left(o.INPUTTIME,4)=:curYear").setParameter("distributor_id",distributorNo).setParameter("curYear",DateUtils.yearNow()).getTotalCount(); - int yearLoanCount = bomLfi.createQuery("select FACT_MONEY from o left join jbo.com.tenwa.lease.comm.LB_EQUIPMENT_CAR lec on lec.project_id=o.project_id left join jbo.com.tenwa.lease.comm.LB_PROJECT_INFO lpi on lpi.id=o.project_id where o.pay_type = 'pay_type_out' and o.PAY_STATUS='have_paid' and o.FEE_TYPE='feetype10' and o.SETTLE_METHOD='settlemethod6' and left(o.fact_date,4)=:curYear and lpi.distributor_id=:distributor_id").setParameter("distributor_id",distributorNo).setParameter("curYear",DateUtils.yearNow()).getTotalCount(); - di.setApprovalCountThisYear(yearApproveCount); - di.setRefuseCountThisYear(yearFailCount); - di.setLoanCountThisYear(yearLoanCount); - - return di; - } - public LoanInfo getLoanInfo() throws Exception { - - LoanInfo li = new LoanInfo(); - li.setProductId(boLpit.getAttribute("PRODUCT_ID").toString()); - li.setProductName(boLpit.getAttribute("PRODUCT_NAME").toString()); - String settleMethod = boLcct.getAttribute("SETTLE_METHOD").toString(); - li.setProductType(ParamDataUtils.queryBcEnumType("SETTLE_METHOD",settleMethod)); - li.setSubsityTypeCode(""); - //年利率(产品利率) - String productRate = ProductParamUtil.getProductParameterValue(boLpit.getAttribute("PRODUCT_ID").toString(),"PRD0350","product_rate","ProductRate"); - BigDecimal interestRate = new BigDecimal(productRate).divide(new BigDecimal("100"),4,BigDecimal.ROUND_HALF_UP); - li.setInterestRate(interestRate.toString()); - //首付比例(综合) - double firstRatio = boLcct.getAttribute("ALL_FIRST_PAYMENT_RATIO").getDouble()/100; - li.setDownPaymentPercentage(new BigDecimal(firstRatio).setScale(4,BigDecimal.ROUND_HALF_UP).toString()); - //总首付金额 - li.setDownPaymentTotalAmount(boLcct.getAttribute("ALL_FIRST_PAYMENT").toString()); - li.setFinanceAmountUnit(""); - li.setFinanceAmountTotal(""); - //期数 - li.setTerms(boLcct.getAttribute("INCOME_NUMBER").toString()); - List boLrps = JBOFactory.createBizObjectQuery(LC_RENT_PLAN_TEMP.CLASS_NAME,"select o.interest,o.rent from o where o.FLOWUNID=:flowunid").setParameter("flowunid",flowUnid).getResultList(false); - BigDecimal interestTotal = new BigDecimal("0"); - double firstRent = 0; - for(int i=0;i 0) { - IsSubsity="1"; - } - } - //厂家承担利息总额,即厂家贴息金额 - li.setMakerInterestTotal(makerInterestTotal); - li.setMakerInterestTotalDeposit(""); - li.setIsSubsity(IsSubsity); - li.setContractPriceTotal(boLcct.getAttribute("EQUIP_AMT").toString()); - li.setMonthInterestRate(interestRate.divide(new BigDecimal("12"),4,BigDecimal.ROUND_HALF_UP).toString()); - li.setPayType("银行卡直扣"); - li.setPayRemark(""); - li.setIsLinked(ParamDataUtils.queryBcEnumType("TrueFalse",boLpit.getAttribute("IS_NETCAR").toString())); - li.setLinkedCompany(boLpit.getAttribute("AFFILIATEDNAME").toString()); - li.setLinkedCompanyType(boLpit.getAttribute("LEGALPERSONID").toString()); - li.setReserveString1("0"); - li.setReserveString2(""); - li.setReserveString3(""); - li.setReserveString4(""); - li.setReserveString5(""); - //车辆贷款用途 乘用车或商用。 0:商用车。目前取的TCF商用车,TCC乘用车 - String carType = boLpit.getAttribute("car_type").toString(); - li.setAssetPurpose("乘用车".equals(carType)?"TCC":"TCF"); - li.setBalloonPercentage(""); - li.setBalloonAmount(""); - String financedAmtPct = new BigDecimal(boLcct.getAttribute("CLEAN_LEASE_MONEY").toString()).divide(new BigDecimal(boLcct.getAttribute("TOTAL_ALL").toString()),4,BigDecimal.ROUND_HALF_UP).toString(); - li.setFinancedAmtPct(financedAmtPct); - li.setRentalCalculationMtd(""); - //客户承担利率 - String yearRate = boLcct.getAttribute("YEAR_RATE").toString(); - li.setBaseCustomerRate(yearRate); - //贴息利率 - li.setSubsidyRte(interestRate.subtract(new BigDecimal(yearRate)).toString()); - li.setCalcSubsidyRte(""); - li.setCalcSubsidyAmt(""); - //实际利率,刘英明:产品利率 - li.setActualRte(interestRate.toString()); - li.setPaymentScheme(ParamDataUtils.queryBcEnumType("income_number_year",boLcct.getAttribute("INCOME_NUMBER_YEAR").toString())); - li.setDealerSubsidyPct("0"); - li.setManufacturerSubsidyPct("0"); - li.setCalcDealerSubsidyAmt(interestRate.subtract(new BigDecimal(yearRate)).doubleValue()); - li.setCalcManufacturerSubsidyAmt(makerInterestTotal); - li.setCarCount(boLects.size()); - //todo 敞口条数和金额 - li.setExposuresNumber(exposures()); - li.setExposureAmount(exposuresAmount()); - li.setCarRealDownPaymentRatio(boLcct.getAttribute("FIRST_PAYMENT_RATIO").toString()); - li.setCarRealDownPaymentAmt(boLcct.getAttribute("FIRST_PAYMENT").toString()); - li.setFinancingRatio(1.0-boLcct.getAttribute("FIRST_PAYMENT_RATIO").getDouble()); - return li; - } - - public VehicleInfo getVehicleInfo() throws JBOException { - VehicleInfo vi = new VehicleInfo(); - List SingleVehicleTypes = new ArrayList<>(); - for(BizObject bo : boLects){ - SingleVehicleType svt = new SingleVehicleType(); - //品牌制造商 - svt.setMaker(ParamDataUtils.queryBcEnumType("MANUFACTURER_NAME",bo.getAttribute("MANUFACTURER_NAME").toString())); - svt.setBrand(bo.getAttribute("BRAND").toString()); - svt.setSeries(bo.getAttribute("car_series").toString()); - //车型 - svt.setModel(bo.getAttribute("MODEL").toString()); - //车辆台数 - svt.setQuantity("1"); - //车辆交易价格 - svt.setPriceUnit(bo.getAttribute("EQUIP_PRICE").toString()); - svt.setPriceTotal(""); - svt.setGps(""); - svt.setChassisVehicleModel(""); - svt.setSubsityVehicleModel(""); - //车辆类型:新车;二手车 - svt.setVehicleType(ParamDataUtils.queryBcEnumType("CarType",boLpit.getAttribute("CAR_TYPE").toString())); - svt.setOtherFee(""); - svt.setProducer(""); - //新车指导价 - svt.setNewPrice(bo.getAttribute("NOW_TOTAL").toString()); - svt.setVinNumber(""); - svt.setEngineNumber(""); - //车辆用途 - svt.setPurpose(""); - svt.setComments(""); - svt.setTransmission(""); - svt.setIsAffiliated(""); - svt.setAffiliatedCompName(""); - svt.setAffiliatedCompCrdcode(""); - svt.setRoadOperationLicenseCode(boLpit.getAttribute("TRANSPORTCERTID").toString()); - svt.setCarType(ParamDataUtils.queryBcEnumType("CarType",boLpit.getAttribute("CAR_TYPE").toString())); - svt.setBuyUseType(bo.getAttribute("cartype").toString()); - svt.setPurchaseTax(boLcct.getAttribute("PURCHASE_TAX").toString()); - svt.setCarPrice(bo.getAttribute("EQUIP_PRICE").toString()); - svt.setCarRealPrice(bo.getAttribute("EQUIP_PRICE").toString()); - SingleVehicleTypes.add(svt); - - } - vi.setSingleVehicleTypes(SingleVehicleTypes); - return vi; - } - public CustomerInfo getCustomerInfo() throws JBOException { - CustomerInfo ci = null; - BizObject boCit = JBOFactory.createBizObjectQuery(CUSTOMER_INFO_TEMP.CLASS_NAME,"FLOWUNID=:flowunid").setParameter("flowunid",flowUnid).getSingleResult(false); - String customerType = boCit.getAttribute("customertype").toString(); - if("01".equals(customerType)){ - ci = getCustomerInfoOfCompany(); - } - if("03".equals(customerType)){ - ci = getCustomerInfoOfPerson(); - } - return ci; - } - public CustomerInfo getCustomerInfoOfCompany() throws JBOException { - CustomerInfo ci = new CustomerInfo(); - BizObject boCct = JBOFactory.createBizObjectQuery(CUSTOMER_COMPANY_TEMP.CLASS_NAME,"FLOWUNID=:flowunid").setParameter("flowunid",flowUnid).getSingleResult(false); - String chName = boCct.getAttribute("company_name").toString(); - String idCardNum = boCct.getAttribute("certid").toString(); - String idTypeCode = boCct.getAttribute("CERTTYPE").toString(); - String annualIncome = boCct.getAttribute("business_income").toString(); - String phoneHome = boCct.getAttribute("tel").toString(); - String phoneOffice = boCct.getAttribute("company_tel").toString(); - String businessTypeCode = boCct.getAttribute("unit_properties").toString(); - - ci.setChName(chName); - ci.setIdCardNum(idCardNum); - ci.setIdTypeCode(ParamDataUtils.queryBcEnumType("CertType",idTypeCode)); - ci.setAnnualIncome(annualIncome); - ci.setPhoneHome(phoneHome); - ci.setPhoneOffice(phoneOffice); - ci.setBusinessNatureCde(ParamDataUtils.queryBcEnumType("Unit_nature",businessTypeCode)); - ci.setCustTypeId("2"); - ci.setCheckedType("2"); - return ci; - } - public CustomerInfo getCustomerInfoOfPerson() throws JBOException { - CustomerInfo ci = new CustomerInfo(); - BizObject boCat = JBOFactory.createBizObjectQuery(CUSTOMER_ACCOUNT_TEMP.CLASS_NAME,"FLOWUNID=:flowunid").setParameter("flowunid",flowUnid).getSingleResult(false); - - String idTypeCode = ParamDataUtils.queryBcEnumType("CertType",boCpt.getAttribute("CERTTYPE").toString()); - String chName = boCpt.getAttribute("FULLNAME").toString(); - String idCardNum = boCpt.getAttribute("CERTID").toString(); - String genderCode = ParamDataUtils.queryBcEnumType("sex",boCpt.getAttribute("SEX").toString()); - String maritalStatusCode = ParamDataUtils.queryBcEnumType("marry",boCpt.getAttribute("MARRIAGE").toString()); - String residentialStatusCode = ParamDataUtils.queryBcEnumType("Property_type",boCpt.getAttribute("Property_type").toString()); - String MonthlyIncome = boCpt.getAttribute("FAMILYMONTHINCOME").toString(); - String phoneCellPhone01 = boCpt.getAttribute("mobile").toString(); - String empemployerName = boCpt.getAttribute("WORKCORP").toString(); - String businessTypeCode = boCpt.getAttribute("Unit_nature").toString(); - String phoneHome = boCpt.getAttribute("telephone").toString(); - String phoneOffice = boCpt.getAttribute("WORKTEL").toString(); - String loanCardNumber = boCat.getAttribute("acc_number").toString(); - String openBankMobileNo = boCat.getAttribute("MOBILE").toString(); - String expense = boCpt.getAttribute("monthly_expenses").toString(); - String birthday = boCpt.getAttribute("birthday").toString().replace("/","-"); - String idBirthday = idCardNum.substring(6,14); - String nowDay = DateUtils.dateNow(); - int ageInYear = DateUtils.yearDiffByDate(idBirthday,nowDay); - int ageInMonth = DateUtils.monthDiffByDate(idBirthday,nowDay); - String workAddressId = boCpt.getAttribute("work_address_id").getString(); - - BizObject boRai = this.getAddressById(workAddressId); - String workProvinceCode = boRai.getAttribute("province_code").toString(); - String workCityCode = boRai.getAttribute("city_code").toString(); - String workDistrictCode = boRai.getAttribute("district_code").toString(); - String workAddressDetail = boRai.getAttribute("address_detail").toString(); - String occupationCode = ParamDataUtils.queryBcEnumType("career",boCpt.getAttribute("HEADSHIP").toString()); - String empBusinessTypeCode = ParamDataUtils.queryBcEnumType("workUnitIndustry",boCpt.getAttribute("UNITKIND").toString()); - String empPositionCode = ParamDataUtils.queryBcEnumType("duties",boCpt.getAttribute("OCCUPATION").toString()); - String highestEducation = ParamDataUtils.queryBcEnumType("Education",boCpt.getAttribute("EDUEXPERIENCE").toString()); - String CardTermBeginDate = boCpt.getAttribute("start_idexpiry").toString().replace("/","-"); - String CardTermEndDate = boCpt.getAttribute("idexpiry").toString().replace("/","-"); - - String nationId = ParamDataUtils.queryBcEnumType("nation",boCpt.getAttribute("NATIONALITY").toString()); - - ci.setChName(chName); - //证件类型 - ci.setIdTypeCode(idTypeCode); - //证件号 - ci.setIdCardNum(idCardNum); - //年龄 - ci.setAgeInYear(ageInYear); - //性别 - ci.setGenderCode(genderCode); - //婚姻状况 - ci.setMaritalStatusCode(maritalStatusCode); - //学历 - ci.setEducationCode(highestEducation); - //居住状况(安鹏房产类型) - ci.setResidentialStatusCode(residentialStatusCode); - //月收入 - ci.setMonthlyIncome(MonthlyIncome); - //年收入 - ci.setAnnualIncome(""); - ci.setMonthlyDTI(""); - ci.setNoOfDependents(""); - //工作单位名称 - ci.setEmpemployerName(empemployerName); - //单位所属行业 - ci.setEmpBusinessTypeCode(empBusinessTypeCode); - //职业 - ci.setEmpOccupationCode(occupationCode); - //职务 - ci.setEmpPositionCode(empPositionCode); - ci.setEmpProfessionalRank(""); - ci.setWorkSince(""); - ci.setEmpTimeOfEmployee(""); - ci.setPhoneCellphone01(phoneCellPhone01); - ci.setPhoneCellphone02(""); - ci.setPhoneHome(phoneHome); - ci.setPhoneOffice(phoneOffice); - ci.setBankStatementStatusCode(""); - ci.setLocalResidentFlag(""); - ci.setLocalApplicantFlag(""); - ci.setVipCust(""); - //重复申请客户(0:否1:是) - ci.setRepeatedApplicantFlag(repeatedApplicantFlag(idCardNum)); - ci.setHukouType(""); - //最高学历 - ci.setHighestEducation(highestEducation); - ci.setHighestDegree(""); - ci.setOfficePostCode(""); - ci.setCurrentOfficeEntryDate(""); - ci.setPhsNumber(""); - ci.setEmail(""); - ci.setHasDrivingLicence(""); - ci.setAllowDrivingType(""); - //人员类别(1.个人、2.法人) - ci.setCheckedType("1"); - //贷款卡号(银行卡号) - ci.setLoanCardNumber(loanCardNumber); - ci.setLoanCardPassword(""); - ci.setArchiveUrl(""); - ci.setAgeInMonth(ageInMonth); - ci.setChildrenFlag(""); - ci.setBlacklistInd(""); - ci.setThaiTitleCde(""); - //月支出 - ci.setExpense(expense); - //生日 - ci.setBrithday(birthday); - ci.setLicenseExpireDate(""); - ci.setCountryCode(""); - ci.setAreaCode(""); - ci.setExtentionNbr(""); - ci.setPhoneTypeCde(""); - ci.setDesignationCde(""); - ci.setCityCde(""); - ci.setStateCde(""); - //省市区 - ci.setProvinceGB(workProvinceCode); - ci.setCityGB(workCityCode); - ci.setDistrictGB(workDistrictCode); - ci.setStreetGB(""); - //企业性质 - ci.setBusinessNatureCde(ParamDataUtils.queryBcEnumType("Unit_nature",businessTypeCode)); - ci.setPostCode(""); - //工作地址 - ci.setEmployAddress(workAddressDetail); - //职业 - ci.setOccupationCode(occupationCode); - //企业类型 - ci.setBusinessTypeCde(empBusinessTypeCode); - //表示工作年限的长度(从事运输行业年限) - ci.setTimeInYear2(""); - ci.setRankCde(""); - //职业 - ci.setOccupationCde(occupationCode); - //单位所属行业 - ci.setIndustryTypeCde(empBusinessTypeCode); - ci.setAddr(getAddr()); - ci.setExposure(getExposure(idTypeCode)); - //客户类型 - ci.setCustTypeId("1"); - ci.setIdCardTermBeginDate(CardTermBeginDate); - ci.setIdCardTermEndDate(CardTermEndDate); - ci.setOpenBankMobileNo(openBankMobileNo); - ci.setNationId(nationId); - return ci; - } - public Coborrowers getCoborrowers() throws JBOException { - Coborrowers cos = new Coborrowers(); - if(boCft==null){ - return cos; - } - List coborrowerList = new ArrayList<>(); - coborrowerList.add(getCoborrower()); - cos.setCoborrower(coborrowerList); - return cos; - } - public Coborrower getCoborrower() throws JBOException { - Coborrower co = new Coborrower(); - String idTypeCode = ParamDataUtils.queryBcEnumType("CertType",boCft.getAttribute("CERTTYPE").toString()); - String chName = boCft.getAttribute("name").toString(); - String idCardNum = boCft.getAttribute("CERTID").toString(); - String genderCode = ParamDataUtils.queryBcEnumType("sex",boCft.getAttribute("SEX").toString()); - String maritalStatusCode = ParamDataUtils.queryBcEnumType("marry",boCft.getAttribute("marry_type").toString()); - String residentialStatusCode = ParamDataUtils.queryBcEnumType("Property_type",boCft.getAttribute("residential_status").toString()); - String MonthlyIncome = boCft.getAttribute("smincome").toString(); - String phoneCellPhone01 = boCft.getAttribute("tel").toString(); - String empemployerName = boCft.getAttribute("suname").toString(); - String businessTypeCode = boCft.getAttribute("enterprise_nature").toString(); - String phoneHome = boCft.getAttribute("tel").toString(); - String phoneOffice = boCft.getAttribute("suphone").toString(); - String expense = boCft.getAttribute("monthly_expenses").toString(); - String birthday = boCft.getAttribute("birthday").toString().replace("/","-"); - String idBirthday = idCardNum.substring(6,14); - String nowDay = DateUtils.dateNow(); - int ageInYear = DateUtils.yearDiffByDate(idBirthday,nowDay); - int ageInMonth = DateUtils.monthDiffByDate(idBirthday,nowDay); - String workAddressId = boCft.getAttribute("work_address_id").getString(); - - BizObject boRai = getAddressById(workAddressId); - String workProvinceCode = boRai.getAttribute("province_code").toString(); - String workCityCode = boRai.getAttribute("city_code").toString(); - String workDistrictCode = boRai.getAttribute("district_code").toString(); - String workAddressDetail = boRai.getAttribute("address_detail").toString(); - String occupationCode = ParamDataUtils.queryBcEnumType("career",boCft.getAttribute("career_type").toString()); - String empBusinessTypeCode = ParamDataUtils.queryBcEnumType("workUnitIndustry",boCft.getAttribute("industry_type").toString()); - String empPositionCode = ParamDataUtils.queryBcEnumType("duties",boCft.getAttribute("sposition").toString()); - String highestEducation = ParamDataUtils.queryBcEnumType("Education",boCft.getAttribute("education_level").toString()); - String CardTermBeginDate = boCft.getAttribute("start_idexpiry").toString().replace("/","-"); - String CardTermEndDate = boCft.getAttribute("idexpiry").toString().replace("/","-"); - String nationId = ParamDataUtils.queryBcEnumType("nation",boCft.getAttribute("nation").toString()); - String censusRegAddrId = boCft.getAttribute("id_address_id").toString(); - BizObject boCens = this.getAddressById(censusRegAddrId); - String censusRegAddr = boCens.getAttribute("full_address").toString(); - String relationshipCode = ParamDataUtils.queryBcEnumType("personContact",boCft.getAttribute("ASSURE_RELATION").toString()); - - co.setChName(chName); - //证件类型 - co.setIdTypeCode(idTypeCode); - //证件号 - co.setIdCardNum(idCardNum); - //年龄 - co.setAgeInYear(ageInYear); - //性别 - co.setGenderCode(genderCode); - //婚姻状况 - co.setMaritalStatusCode(maritalStatusCode); - //学历 - co.setEducationCode(highestEducation); - //居住状况(安鹏房产类型) - co.setResidentialStatusCode(residentialStatusCode); - //月收入 - co.setMonthlyIncome(MonthlyIncome); - //年收入 - co.setAnnualIncome(""); - co.setMonthlyDTI(""); - co.setNoOfDependents(""); - //工作单位名称 - co.setEmpemployerName(empemployerName); - //单位所属行业 - co.setEmpBusinessTypeCode(empBusinessTypeCode); - //职业 - co.setEmpOccupationCode(occupationCode); - //职务 - co.setEmpPositionCode(empPositionCode); - co.setEmpProfessionalRank(""); - co.setWorkSince(""); - co.setEmpTimeOfEmployee(""); - co.setPhoneCellphone01(phoneCellPhone01); - co.setPhoneCellphone02(""); - co.setPhoneHome(phoneHome); - co.setPhoneOffice(phoneOffice); - co.setBankStatementStatusCode(""); - co.setLocalResidentFlag(""); - co.setLocalApplicantFlag(""); - co.setVipCust(""); - //重复申请客户(0:否1:是) - co.setRepeatedApplicantFlag(repeatedApplicantFlag(idCardNum)); - co.setHukouType(""); - //最高学历 - co.setHighestEducation(highestEducation); - co.setHighestDegree(""); - co.setOfficePostCode(""); - co.setCurrentOfficeEntryDate(""); - co.setPhsNumber(""); - co.setEmail(""); - co.setHasDrivingLicence(""); - co.setAllowDrivingType(""); - //人员类别(1.个人、2.法人) - co.setCheckedType("1"); - co.setLoanCardPassword(""); - co.setArchiveUrl(""); - co.setAgeInMonth(ageInMonth); - co.setChildrenFlag(""); - co.setBlacklistInd(""); - co.setThaiTitleCde(""); - //月支出 - co.setExpense(expense); - //生日 - co.setBrithday(birthday); - co.setLicenseExpireDate(""); - co.setCountryCode(""); - co.setAreaCode(""); - co.setExtentionNbr(""); - co.setPhoneTypeCde(""); - co.setDesignationCde(""); - co.setCityCde(""); - co.setStateCde(""); - //省市区 - co.setProvinceGB(workProvinceCode); - co.setCityGB(workCityCode); - co.setDistrictGB(workDistrictCode); - co.setStreetGB(""); - //企业性质 - co.setBusinessNatureCde(ParamDataUtils.queryBcEnumType("Unit_nature",businessTypeCode)); - co.setPostCode(""); - //工作地址 - co.setEmployAddress(workAddressDetail); - //职业 - co.setOccupationCode(occupationCode); - //企业类型 - co.setBusinessTypeCde(empBusinessTypeCode); - //表示工作年限的长度(从事运输行业年限) - co.setTimeInYear2(""); - co.setRankCde(""); - //职业 - co.setOccupationCde(occupationCode); - //单位所属行业 - co.setIndustryTypeCde(empBusinessTypeCode); - co.setAddr(getAddr()); - co.setExposure(getExposure(idTypeCode)); - //客户类型(目前系统共借人只有一个,且为自然人,默认填入1) - co.setCustTypeId("1"); - co.setIdCardTermBeginDate(CardTermBeginDate); - co.setIdCardTermEndDate(CardTermEndDate); - //民族 - co.setNationId(nationId); - //户籍地址 - co.setCensusRegAddr(censusRegAddr); - //单位电话 - co.setTelWorkNo(phoneOffice); - //与主借人关系 - co.setRelationshipCode(relationshipCode); - //共借人编号(目前系统只有一个共借人,默认填1) - co.setBorrowerId("1"); - return co; - } - public GuarantorInfo getGuarantorInfo() throws JBOException { - GuarantorInfo gi = new GuarantorInfo(); - List gis = new ArrayList<>(); - for(BizObject boLgu : boLguts){ - Guar gr = getGuar(boLgu); - if(gr==null){ - continue; - } - gis.add(gr); - } - return gi; - } - public Guar getGuar(BizObject boLgu) throws JBOException { - String certType = boLgu.getAttribute("CERTTYPE").toString(); - Guar gr = null; - if(certType.startsWith("Ind")){ - gr = getGuarOfPerson(boLgu); - } - if(certType.startsWith("Ent")){ - gr = getGuarOfCompany(boLgu); - } - return gr; - } - public Guar getGuarOfCompany(BizObject boLgu) throws JBOException { - Guar gr = new Guar(); - String chName = boLgu.getAttribute("FULLNAME").toString(); - String idCardNum = boLgu.getAttribute("CERTID").toString(); - String idTypeCode = boLgu.getAttribute("CERTTYPE").toString(); - String relationshipCode = ParamDataUtils.queryBcEnumType("personContact",boLgu.getAttribute("ASSURE_RELATION").toString()); - - gr.setChName(chName); - gr.setIdCardNum(idCardNum); - gr.setIdTypeCode(ParamDataUtils.queryBcEnumType("CertType",idTypeCode)); - gr.setRelationshipCode(relationshipCode); - gr.setCustTypeId("2"); - gr.setCheckedType("2"); - return gr; - } - public Guar getGuarOfPerson(BizObject boLgu) throws JBOException { - Guar gr = new Guar(); - String idTypeCode = ParamDataUtils.queryBcEnumType("CertType",boLgu.getAttribute("CERTTYPE").toString()); - String chName = boLgu.getAttribute("FULLNAME").toString(); - String idCardNum = boLgu.getAttribute("CERTID").toString(); - String genderCode = ParamDataUtils.queryBcEnumType("sex",boLgu.getAttribute("SEX").toString()); - String maritalStatusCode = ParamDataUtils.queryBcEnumType("marry",boLgu.getAttribute("Marital_status").toString()); - String residentialStatusCode = ParamDataUtils.queryBcEnumType("Property_type",boLgu.getAttribute("residential_status").toString()); - String MonthlyIncome = boLgu.getAttribute("smincome").toString(); - String phoneCellPhone01 = boLgu.getAttribute("MOBILE").toString(); - String empemployerName = boLgu.getAttribute("WORKCORP").toString(); - String businessTypeCode = boLgu.getAttribute("enterprise_nature").toString(); - String phoneHome = boLgu.getAttribute("MOBILE").toString(); - String phoneOffice = boLgu.getAttribute("WORKTEL").toString(); - String expense = boLgu.getAttribute("monthly_expenses").toString(); - String birthday = boLgu.getAttribute("birthday").toString().replace("/","-"); - String idBirthday = idCardNum.substring(6,14); - String nowDay = DateUtils.dateNow(); - int ageInYear = DateUtils.yearDiffByDate(idBirthday,nowDay); - int ageInMonth = DateUtils.monthDiffByDate(idBirthday,nowDay); - String workAddressId = boLgu.getAttribute("work_address_id").getString(); - - BizObject boRai = getAddressById(workAddressId); - String workProvinceCode = boRai.getAttribute("province_code").toString(); - String workCityCode = boRai.getAttribute("city_code").toString(); - String workDistrictCode = boRai.getAttribute("district_code").toString(); - String workAddressDetail = boRai.getAttribute("address_detail").toString(); - String occupationCode = ParamDataUtils.queryBcEnumType("career",boLgu.getAttribute("career_type").toString()); - String empBusinessTypeCode = ParamDataUtils.queryBcEnumType("workUnitIndustry",boLgu.getAttribute("industry_type").toString()); - String empPositionCode = ParamDataUtils.queryBcEnumType("duties",boLgu.getAttribute("TITLE").toString()); - String highestEducation = ParamDataUtils.queryBcEnumType("Education",boLgu.getAttribute("education_level").toString()); - String CardTermBeginDate = boLgu.getAttribute("start_idexpiry").toString().replace("/","-"); - String CardTermEndDate = boLgu.getAttribute("idexpiry").toString().replace("/","-"); - String nationId = ParamDataUtils.queryBcEnumType("nation",boLgu.getAttribute("nation").toString()); - String censusRegAddrId = boLgu.getAttribute("id_address_id").toString(); - BizObject boCens = this.getAddressById(censusRegAddrId); - String censusRegAddr = boCens.getAttribute("full_address").toString(); - String relationshipCode = ParamDataUtils.queryBcEnumType("personContact",boLgu.getAttribute("ASSURE_RELATION").toString()); - - gr.setChName(chName); - //证件类型 - gr.setIdTypeCode(idTypeCode); - //证件号 - gr.setIdCardNum(idCardNum); - //年龄 - gr.setAgeInYear(ageInYear); - //性别 - gr.setGenderCode(genderCode); - //婚姻状况 - gr.setMaritalStatusCode(maritalStatusCode); - //学历 - gr.setEducationCode(highestEducation); - //居住状况(安鹏房产类型) - gr.setResidentialStatusCode(residentialStatusCode); - //月收入 - gr.setMonthlyIncome(MonthlyIncome); - //年收入 - gr.setAnnualIncome(""); - gr.setMonthlyDTI(""); - gr.setNoOfDependents(""); - //工作单位名称 - gr.setEmpemployerName(empemployerName); - //单位所属行业 - gr.setEmpBusinessTypeCode(empBusinessTypeCode); - //职业 - gr.setEmpOccupationCode(occupationCode); - //职务 - gr.setEmpPositionCode(empPositionCode); - gr.setEmpProfessionalRank(""); - gr.setWorkSince(""); - gr.setEmpTimeOfEmployee(""); - gr.setPhoneCellphone01(phoneCellPhone01); - gr.setPhoneCellphone02(""); - gr.setPhoneHome(phoneHome); - gr.setPhoneOffice(phoneOffice); - gr.setBankStatementStatusCode(""); - gr.setLocalResidentFlag(""); - gr.setLocalApplicantFlag(""); - gr.setVipCust(""); - //重复申请客户(0:否1:是) - gr.setRepeatedApplicantFlag(repeatedApplicantFlag(idCardNum)); - gr.setHukouType(""); - //最高学历 - gr.setHighestEducation(highestEducation); - gr.setHighestDegree(""); - gr.setOfficePostCode(""); - gr.setCurrentOfficeEntryDate(""); - gr.setPhsNumber(""); - gr.setEmail(""); - gr.setHasDrivingLicence(""); - gr.setAllowDrivingType(""); - //人员类别(1.个人、2.法人) - gr.setCheckedType("1"); - gr.setLoanCardPassword(""); - gr.setArchiveUrl(""); - gr.setAgeInMonth(ageInMonth); - gr.setChildrenFlag(""); - gr.setBlacklistInd(""); - gr.setThaiTitleCde(""); - //月支出 - gr.setExpense(expense); - //生日 - gr.setBrithday(birthday); - gr.setLicenseExpireDate(""); - gr.setCountryCode(""); - gr.setAreaCode(""); - gr.setExtentionNbr(""); - gr.setPhoneTypeCde(""); - gr.setDesignationCde(""); - gr.setCityCde(""); - gr.setStateCde(""); - //省市区 - gr.setProvinceGB(workProvinceCode); - gr.setCityGB(workCityCode); - gr.setDistrictGB(workDistrictCode); - gr.setStreetGB(""); - //企业性质 - gr.setBusinessNatureCde(ParamDataUtils.queryBcEnumType("Unit_nature",businessTypeCode)); - gr.setPostCode(""); - //工作地址 - gr.setEmployAddress(workAddressDetail); - //职业 - gr.setOccupationCode(occupationCode); - //企业类型 - gr.setBusinessTypeCde(empBusinessTypeCode); - //表示工作年限的长度(从事运输行业年限) - gr.setTimeInYear2(""); - gr.setRankCde(""); - //职业 - gr.setOccupationCde(occupationCode); - //单位所属行业 - gr.setIndustryTypeCde(empBusinessTypeCode); - gr.setAddr(getAddr()); - gr.setExposure(getExposure(idTypeCode)); - gr.setCustTypeId("1"); - gr.setIdCardTermBeginDate(CardTermBeginDate); - gr.setIdCardTermEndDate(CardTermEndDate); - //民族 - gr.setNationId(nationId); - //户籍地址 - gr.setCensusRegAddr(censusRegAddr); - //与主借人关系 - gr.setRelationshipCode(relationshipCode); - - return gr; - } - public ContInfo getContInfo() throws JBOException { - ContInfo ci = new ContInfo(); - List contrs = new ArrayList<>(); - - Contr contr = new Contr(); - contr.setContNum("1"); - contr.setChName(boCpt.getAttribute("EMERGENCY_CONTACT_PERSON").toString()); - contr.setRelationshipCode(boCpt.getAttribute("EMPLOYRECORD").toString()); - contr.setCellPhone(boCpt.getAttribute("EMERGENCY_CONTACT_TEL").toString()); - - Contr contr2 = new Contr(); - contr2.setContNum("2"); - contr2.setChName(boCpt.getAttribute("INTRO").toString()); - contr2.setRelationshipCode(boCpt.getAttribute("EDUDEGREE").toString()); - contr2.setCellPhone(boCpt.getAttribute("REMARK").toString()); - - contrs.add(contr); - contrs.add(contr2); - ci.setContrs(contrs); - return ci; - } - - public int repeatedApplicantFlag(String certId) throws JBOException { - int repeatedApplicantFlag = 0; - //int boCountLgu = JBOFactory.createBizObjectQuery(LB_GUARANTEE_UNIT.CLASS_NAME,"CERTID=:certId").setParameter("certId",certId).getTotalCount(); - //int boCountCf = JBOFactory.createBizObjectQuery(CUSTOMER_FAMILY.CLASS_NAME,"CERTID=:certId and status='valid' and Partner_='Y' ").setParameter("certId",certId).getTotalCount(); - int boCountCi = JBOFactory.createBizObjectQuery(CUSTOMER_INFO.CLASS_NAME,"CERTID=:certId ").setParameter("certId",certId).getTotalCount(); - if(boCountCi>0){ - repeatedApplicantFlag = 1; - } - return repeatedApplicantFlag; - } - - public Addr getAddr() throws JBOException { - BizObject boCat = JBOFactory.createBizObjectQuery(CUSTOMER_ADDRESS_TEMP.CLASS_NAME,"FLOWUNID=:flowunid and customerid=:customerId").setParameter("flowunid",flowUnid).setParameter("customerId",boCpt.getAttribute("customerid").toString()).getSingleResult(false); - String liveAddressId = boCat.getAttribute("province").getString(); - String provinceCode = ParamDataUtils.queryMapBcProvinceCode("AreaCode",liveAddressId); - String cityCode = ParamDataUtils.queryMapBcCityCode("AreaCode",liveAddressId); - String districtCode = ParamDataUtils.queryMapBcCountyCode("AreaCode",liveAddressId); - String fullAddress = boCat.getAttribute("dressdetail").getString(); - String residentialStatusCode = ParamDataUtils.queryBcEnumType("Property_type",boCpt.getAttribute("Property_type").toString()); - Addr addr = new Addr(); - addr.setProvince(""); - addr.setCity(""); - addr.setDistrict(""); - addr.setProvinceGB(provinceCode); - addr.setCityGB(cityCode); - addr.setDistrictGB(districtCode); - addr.setStreetGB(""); - addr.setAddress(fullAddress); - addr.setPostCode(""); - addr.setAddrType(""); - addr.setAddrNum(""); - addr.setPropertyTypeCde(residentialStatusCode); - addr.setHukouAddress(""); - - return addr; - } - public Exposure getExposure(String certId) throws JBOException { - //必须用身份证号,不能用customerid,因为存在一个身份证号,多个customerid的情况 - List boCis = JBOFactory.createBizObjectQuery(CUSTOMER_INFO.CLASS_NAME,"CERTID=:certId").setParameter("certId",certId).getResultList(false); - BigDecimal corpusRemain = new BigDecimal("0"); - BigDecimal yetLoan = new BigDecimal("0"); - int carCountRemain = 0; - int carCountYetLoan = 0; - for(BizObject boCi : boCis){ - String customerId = boCi.getAttribute("CUSTOMERID").toString(); - //一个customerId存在多个合同 - List boLuls = JBOFactory.createBizObjectQuery(LB_UNION_LESSEE.CLASS_NAME,"CUSTOMER_ID=:CUSTOMER_ID and is_main='Y'").setParameter("CUSTOMER_ID",customerId).getResultList(false); - for(BizObject boLul : boLuls){ - String contractId = boLul.getAttribute("contract_id").toString(); - BizObject boLci = JBOFactory.createBizObjectQuery(LB_CONTRACT_INFO.CLASS_NAME,"ID=:ID").setParameter("ID",contractId).getSingleResult(false); - String contractStatus = boLci.getAttribute("CONTRACT_STATUS").toString(); - if("31".equals(contractStatus)){ - BizObject boCat = JBOFactory.createBizObjectQuery(LC_CALC_CONDITION.CLASS_NAME,"CONTRACT_ID=:CONTRACT_ID").setParameter("CONTRACT_ID",contractId).getSingleResult(false); - String financeAmount = boCat.getAttribute("CLEAN_LEASE_MONEY").toString(); - BizObject boLri = JBOFactory.createBizObjectQuery(LC_RENT_INCOME.CLASS_NAME,"select ifnull(sum(corpus),0) as v.corpusTotal from o where CONTRACT_ID=:CONTRACT_ID and ROLL_BACK='0' ").setParameter("CONTRACT_ID",contractId).getSingleResult(false); - String corpusTotal = boLri.getAttribute("corpusTotal").toString(); - corpusRemain = corpusRemain.add(new BigDecimal(financeAmount).subtract(new BigDecimal(corpusTotal))); - carCountRemain = JBOFactory.createBizObjectQuery(LB_EQUIPMENT_CAR.CLASS_NAME,"CONTRACT_ID=:CONTRACT_ID").setParameter("CONTRACT_ID",contractId).getTotalCount(); - - } - if("21".equals(contractStatus)){ - BizObject boLfi = JBOFactory.createBizObjectQuery(LC_FUND_INCOME.CLASS_NAME,"CONTRACT_ID=:CONTRACT_ID and pay_type='pay_type_out' and fee_type='feetype10' and SETTLE_METHOD='settlemethod6' and roll_back='0' and PAY_STATUS<>'have_paid' ").setParameter("CONTRACT_ID",contractId).getSingleResult(false); - String factMoney = boLfi.getAttribute("fact_money").toString(); - yetLoan = yetLoan.add(new BigDecimal(factMoney)); - carCountYetLoan = JBOFactory.createBizObjectQuery(LB_EQUIPMENT_CAR.CLASS_NAME,"CONTRACT_ID=:CONTRACT_ID").setParameter("CONTRACT_ID",contractId).getTotalCount(); - } - } - } - Exposure ep = new Exposure(); - ep.setOutstanding(corpusRemain.toString()); - ep.setApprovalAmt(yetLoan.toString()); - ep.setOsNum(carCountRemain); - ep.setApprovalNum(carCountYetLoan); - return ep; - } - - public ApplicationInfo getApplicationInfo() throws Exception { - ApplicationInfo app = new ApplicationInfo(); - String number = boLpit.getAttribute("PROJECT_NO").toString(); - BizObject boft = JBOFactory.createBizObjectQuery(FLOW_TASK.CLASS_NAME,"select min(begintime) as v.minTime,max(begintime) as v.maxTime from o where flowno='BusinessApplyFlow' and phasetype='1020' and objectno=:flowunid").setParameter("flowunid",flowUnid).getSingleResult(false); - String minTime = boft.getAttribute("minTime").toString().replace("/","-").replace(" ","T"); - String maxTime = boft.getAttribute("maxTime").toString().replace("/","-").replace(" ","T"); - String faName = boLpit.getAttribute("inputName").toString(); - String faCellphone = boLpit.getAttribute("inputTel").toString(); - String carType = boLpit.getAttribute("car_type").toString(); - app.setNumber(number); - app.setApplicationType("APF"); - app.setOriginalSystemId("APF"); - app.setTranNo(DateUtils.dateTimeNowAccurate()); - app.setFirstProposalDate(minTime); - app.setLastProposalDate(maxTime); - app.setFaName(faName); - app.setFaid(""); - app.setFaCellphone(faCellphone); - app.setFvName(""); - app.setFvCellphone(""); - app.setFvDateoffv(""); - app.setFieldVisitFlag(""); - app.setBusinessStep(""); - app.setGroupCustomerUpId(""); - app.setGroupCustomerSpecialLimit(""); - //区分贷款车辆类型(CV、PV) - app.setLoanvehicleType("乘用车".equals(carType)?"PV":"CV"); - app.setQueryReason(""); - app.setCreditQueryType(""); - app.setCreditQueryInterface(""); - BizObject boPsl = JBOFactory.createBizObjectQuery(PRD_SPECIFIC_LIBRARY.CLASS_NAME,"PRODUCTID=:PRODUCTID").setParameter("PRODUCTID",boLpit.getAttribute("PRODUCT_ID").toString()).getSingleResult(false); - String lendingType = boPsl.getAttribute("LENDING_TYPE").toString(); - app.setIsVehicleGuaranty("AFTER".equals(lendingType)||"FIRST".equals(lendingType)?"1":"0"); - app.setCvHeadVehicleCount(""); - app.setSosRandomNumber(""); - //申请日期 - app.setApplicationDate(boLpit.getAttribute("project_date").toString().replace("/","-").replace(" ","T")); - //经销商提交申请或重新提交申请时间。 - app.setApplicationSubmitDate(maxTime); - //申请类型 客户类型 1个人 2法人 - BizObject boCit = JBOFactory.createBizObjectQuery(CUSTOMER_INFO_TEMP.CLASS_NAME,"FLOWUNID=:flowunid").setParameter("flowunid",flowUnid).getSingleResult(false); - String customerType = "1"; - if("01".equals(boCit.getAttribute("customertype").toString())){ - customerType="2"; - } - app.setCustomerType(customerType); - //经销商担保模式 - app.setStatusCode(ParamDataUtils.queryBcEnumType("dischanneltype",boDi.getAttribute("channeltype").toString())); - - return app; - } - - public PreviouslyVehicle getPreviouslyVehicle() throws JBOException { - PreviouslyVehicle pv = new PreviouslyVehicle(); - pv.setWorkingTime(ParamDataUtils.queryBcEnumType("employmentTime",boCpt.getAttribute("pre_operate_years").toString())); - pv.setPreviouslyVehicleType(ParamDataUtils.queryBcEnumType("operatePreVehicleType",boCpt.getAttribute("pre_operate_car_type").toString())); - pv.setPreviouslyVehicleLicense(boCpt.getAttribute("pre_operate_car_no").toString()); - return pv; - } - - public BizObject getAddressById(String addressId) throws JBOException { - BizObjectManager rcAddressInfo = JBOFactory.getBizObjectManager(RC_ADDRESS_INFO.CLASS_NAME); - BizObject boRai = rcAddressInfo.createQuery("address_id=:id").setParameter("id", addressId).getSingleResult(false); - return boRai; - } - - public int exposures() throws JBOException { - Set projectSet = new HashSet<>(); - BizObject boCit = JBOFactory.createBizObjectQuery(CUSTOMER_INFO_TEMP.CLASS_NAME,"FLOWUNID=:flowunid").setParameter("flowunid",flowUnid).getSingleResult(false); - String applyCertId = boCpt.getAttribute("CERTID").toString(); - projectSet.addAll(getExposuresNumberByCertID(applyCertId)); - if(boCft!=null){ - String coBorroeerId = boCft.getAttribute("CERTID").toString(); - projectSet.addAll(getExposuresNumberByCertID(coBorroeerId)); - } - if(boLguts.size()>0){ - for(BizObject boLgu : boLguts){ - String lguCertId = boLgu.getAttribute("CERTID").toString(); - projectSet.addAll(getExposuresNumberByCertID(lguCertId)); - } - } - return projectSet.size(); - } - public String exposuresAmount() throws JBOException { - Set projectSet = new HashSet<>(); - BigDecimal amount = new BigDecimal("0.00"); - BizObject boCit = JBOFactory.createBizObjectQuery(CUSTOMER_INFO_TEMP.CLASS_NAME,"FLOWUNID=:flowunid").setParameter("flowunid",flowUnid).getSingleResult(false); - String applyCertId = boCpt.getAttribute("CERTID").toString(); - projectSet.addAll(getExposuresNumberByCertID(applyCertId)); - if(boCft!=null){ - String coBorroeerId = boCft.getAttribute("CERTID").toString(); - projectSet.addAll(getExposuresNumberByCertID(coBorroeerId)); - } - if(boLguts.size()>0){ - for(BizObject boLgu : boLguts){ - String lguCertId = boLgu.getAttribute("CERTID").toString(); - projectSet.addAll(getExposuresNumberByCertID(lguCertId)); - } - } - for(String projectId : projectSet){ - BizObject boLpc = JBOFactory.createBizObjectQuery(LC_PROJ_CONDITION.CLASS_NAME,"PROJECT_ID=:PROJECT_ID").setParameter("PROJECT_ID",projectId).getSingleResult(false); - String cleanLeaseMoney = boLpc.getAttribute("CLEAN_LEASE_MONEY").toString(); - String cautionMoney =boLpc.getAttribute("CAUTION_MONEY").toString(); - BizObject boLri = JBOFactory.createBizObjectQuery(LC_RENT_INCOME.CLASS_NAME,"select ifnull(sum(rent),0) as v.rentIncome from O where ROLL_BACK=0 and PROJECT_ID=:PROJECT_ID").setParameter("PROJECT_ID",projectId).getSingleResult(false); - String rentIncome = boLri.getAttribute("rentIncome").toString(); - amount = new BigDecimal(cleanLeaseMoney).subtract(new BigDecimal(cautionMoney)).subtract(new BigDecimal(rentIncome)).add(amount); - } - - return amount.toString(); - } - public Set getExposuresNumberByCertID(String certId) throws JBOException { - /* - 具体敞口逻辑为:主借人或者共借人或担保人出现在其他合同(全条线业务)中作为主借或者共借人或担保人(重复合同取一次计算) - =全部合同的(已放款的贷款余额 + 待放款的贷款金额 + 已核准未放款贷款金额 - 保证金金额) + 本单申请的(贷款金额 - 保证金金额) - +当前在信审节点中申请的(贷款金额 - 保证金金额) - 法人客户,需考虑法人客户的自然人主体:法定代表人、实际控制人及股东关联的订单敞口。 - */ - //一个身份证可能存在多个customerid - List boCis = JBOFactory.createBizObjectQuery(CUSTOMER_INFO.CLASS_NAME,"select CUSTOMERID from O where CERTID=:certId").setParameter("certId",certId).getResultList(false); - Set projectSet = new HashSet<>(); - for(BizObject boCi : boCis){ - String customerId = boCi.getAttribute("CUSTOMERID").toString(); - //一个customerId存在多个合同 - List boLuls = JBOFactory.createBizObjectQuery(LB_UNION_LESSEE.CLASS_NAME,"select project_id from O where CUSTOMER_ID=:CUSTOMER_ID and is_main='Y'").setParameter("CUSTOMER_ID",customerId).getResultList(false); - for(BizObject boLul : boLuls){ - String projectId = boLul.getAttribute("project_id").toString(); - projectSet.add(projectId); - } - } - List boCfs = JBOFactory.createBizObjectQuery(CUSTOMER_FAMILY.CLASS_NAME,"select PROJECT_ID from O where CERTID=:certId and status='valid' and Partner_='Y'").setParameter("certId",certId).getResultList(false); - for(BizObject boCf : boCfs){ - String projectId = boCf.getAttribute("PROJECT_ID").toString(); - projectSet.add(projectId); - } - List boLgus = JBOFactory.createBizObjectQuery(LB_GUARANTEE_UNIT.CLASS_NAME,"select PROJECT_ID from O where CERTID=:certId ").setParameter("certId",certId).getResultList(false); - for(BizObject boLgu : boLgus){ - String projectId = boLgu.getAttribute("PROJECT_ID").toString(); - projectSet.add(projectId); - } - return projectSet; - } } diff --git a/src/com/ample/esb/service/AmpService.java b/src/com/ample/esb/service/AmpService.java new file mode 100644 index 000000000..8b845f67c --- /dev/null +++ b/src/com/ample/esb/service/AmpService.java @@ -0,0 +1,8 @@ +package com.ample.esb.service; + +import com.ample.esb.bean.amp.ApplicationTitle; + +public interface AmpService extends EsbServise{ + ApplicationTitle getApplicationTitle() throws Exception; + +} diff --git a/src/com/ample/esb/service/impl/AccountSyncServiceImpl.java b/src/com/ample/esb/service/impl/AccountSyncServiceImpl.java index ccbc55032..1dadd7938 100644 --- a/src/com/ample/esb/service/impl/AccountSyncServiceImpl.java +++ b/src/com/ample/esb/service/impl/AccountSyncServiceImpl.java @@ -15,7 +15,8 @@ public class AccountSyncServiceImpl extends EsbCommon { } @Override public MessageEsbHead esbHead() { - MessageEsbHead head = super.getCommonEsbHead(); + MessageEsbHead head = new MessageEsbHead(); + head = super.getCommonEsbHead(head); head.setTargetSystemId("AFS"); head.setServiceId("SCN0003"); head.setServiceVersion("1.0.0"); @@ -30,14 +31,16 @@ public class AccountSyncServiceImpl extends EsbCommon { @Override public MessageAppHead appHead() { - MessageAppHead head = super.getCommonAppHead(); + MessageAppHead head = new MessageAppHead(); + head = super.getCommonAppHead(head); head.setOperatorId(accountSyncRequest.getOperatorId()); return head; } @Override public MessageBody messgeBody() { - MessageBody body = super.getCommonBody(); + MessageBody body = new MessageBody(); + body = super.getCommonBody(body); body.setRequest(accountSyncRequest); return body; } diff --git a/src/com/ample/esb/service/impl/AmpServiceImpl.java b/src/com/ample/esb/service/impl/AmpServiceImpl.java index 7056f36e6..63a6c8f9a 100644 --- a/src/com/ample/esb/service/impl/AmpServiceImpl.java +++ b/src/com/ample/esb/service/impl/AmpServiceImpl.java @@ -1,23 +1,40 @@ package com.ample.esb.service.impl; -import com.ample.esb.bean.amp.AmpRequest; +import com.amarsoft.app.util.ProductParamUtil; +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.ample.esb.bean.amp.*; import com.ample.esb.bean.esb.MessageAppHead; import com.ample.esb.bean.esb.MessageBody; import com.ample.esb.bean.esb.MessageEsbHead; import com.ample.esb.common.EsbCommon; +import com.ample.esb.common.ParamDataUtils; +import com.ample.esb.service.AmpService; +import com.ample.esb.util.DateUtils; +import com.ample.esb.util.XstreamUtil; +import jbo.app.tenwa.calc.*; +import jbo.app.tenwa.customer.*; +import jbo.com.tenwa.lease.comm.*; +import jbo.oti.RC_ADDRESS_INFO; +import jbo.prd.PRD_SPECIFIC_LIBRARY; +import jbo.sys.FLOW_TASK; -public class AmpServiceImpl extends EsbCommon { +import java.math.BigDecimal; +import java.util.*; - private AmpRequest ampRequest; - - public AmpServiceImpl(AmpRequest ampRequest) { - setAmpRequest(ampRequest); +public class AmpServiceImpl extends EsbCommon implements AmpService { + private String flowUnid; + private String operatorId; + public AmpServiceImpl(Map map){ + setFlowUnid(map.get("flowUnid")); + setOperatorId(map.get("operatorId")); } @Override public MessageEsbHead esbHead() { - - MessageEsbHead head = super.getCommonEsbHead(); - + MessageEsbHead head = new MessageEsbHead(); + head = super.getCommonEsbHead(head); head.setTargetSystemId("AMP"); head.setServiceId("SCN0003"); head.setServiceVersion("1.0.0"); @@ -27,31 +44,1057 @@ public class AmpServiceImpl extends EsbCommon { head.setCommType("10"); head.setChannelId("09"); head.setFileFlag("0"); - return head; } @Override public MessageAppHead appHead() { - MessageAppHead head = super.getCommonAppHead(); - head.setOperatorId(ampRequest.getOperatorId()); + MessageAppHead head = new MessageAppHead(); + head = super.getCommonAppHead(head); + head.setOperatorId(operatorId); return head; } @Override public MessageBody messgeBody() { - MessageBody body = super.getCommonBody(); - body.setAmpRequest(ampRequest); + MessageBody body = new MessageBody(); + body = super.getCommonBody(body); + body.setAmpRequest(getRequestBody()); return body; } - - public AmpRequest getAmpRequest() { + public AmpRequest getRequestBody() { + String requestInfo = XstreamUtil.xmlConvertNotTitle(getApplicationTitle()); + requestInfo = "" + requestInfo + "]]>"; + AmpRequest ampRequest = new AmpRequest(); + ampRequest.setApplication(requestInfo); return ampRequest; } + @Override + public ApplicationTitle getApplicationTitle() { + ApplicationTitle app = new ApplicationTitle(); + try{ + this.init(); + Applicant2 app2 = new Applicant2(); + app2.setDealerInfo(getDealerInfo()); + app2.setLoanInfo(getLoanInfo()); + app2.setVehicleInfo(getVehicleInfo()); + app2.setCustomerInfo(getCustomerInfo()); + app2.setCoborrowers(getCoborrowers()); + app2.setGuarantorInfo(getGuarantorInfo()); + app2.setContInfo(getContInfo()); + app2.setApplicationInfo(getApplicationInfo()); + app2.setPreviouslyVehicle(getPreviouslyVehicle()); + app.setApplicant2(app2); + }catch (Exception e){ + e.printStackTrace(); + } + return app; + } + //公共参数 + //订单临时表 + private BizObject boLpit; + //个人临时表 + private BizObject boCpt; + //测算临时表 + private BizObject boLcct; + //订单临时表集合 + private List boLects; - public void setAmpRequest(AmpRequest ampRequest) { - this.ampRequest = ampRequest; + private List boLguts; + + private BizObjectManager bomLpi; + + private BizObject boCft; + //经销商正式表 + private BizObject boDi; + /** + * 往bean里面填值 + * @throws JBOException + */ + public void init() throws JBOException { + boLpit = JBOFactory.createBizObjectQuery(LB_PROJECT_INFO_TEMP.CLASS_NAME,"FLOWUNID=:FLOWUNID").setParameter("FLOWUNID",flowUnid).getSingleResult(false); + /*if(boLpit==null||boLpit.getAttribute("ID")==null||"".equals(boLpit.getAttribute("ID").toString())){ + return; + }*/ + boCpt = JBOFactory.createBizObjectQuery(CUSTOMER_PERSON_TEMP.CLASS_NAME,"FLOWUNID=:flowunid").setParameter("flowunid",flowUnid).getSingleResult(false); + + boLects = JBOFactory.createBizObjectQuery(LB_EQUIPMENT_CAR_TEMP.CLASS_NAME,"FLOWUNID=:FLOWUNID").setParameter("FLOWUNID",flowUnid).getResultList(false); + + boLcct = JBOFactory.createBizObjectQuery(LC_CALC_CONDITION_TEMP.CLASS_NAME,"FLOWUNID=:flowunid").setParameter("flowunid",flowUnid).getSingleResult(false); + + bomLpi = JBOFactory.getBizObjectManager(LB_PROJECT_INFO.CLASS_NAME); + + String distributorNo = boLpit.getAttribute("distributor_id").toString(); + boDi = JBOFactory.createBizObjectQuery(DISTRIBUTOR_INFO.CLASS_NAME,"DISTRIBUTOR_NO=:distributorNo").setParameter("distributorNo",distributorNo).getSingleResult(false); + boCft = JBOFactory.createBizObjectQuery(CUSTOMER_FAMILY_TEMP.CLASS_NAME,"FLOWUNID=:flowunid and Partner_='Y'").setParameter("flowunid",flowUnid).getSingleResult(false); + boLguts = JBOFactory.createBizObjectQuery(LB_GUARANTEE_UNIT_TEMP.CLASS_NAME,"FLOWUNID=:flowunid ").setParameter("flowunid",flowUnid).getResultList(false); + + } + public DealerInfo getDealerInfo() throws JBOException { + if(boDi==null||boDi.getAttribute("ID")==null||"".equals(boDi.getAttribute("ID").toString())){ + return null; + } + String distributorNo = boLpit.getAttribute("distributor_id").toString(); + DealerInfo di = new DealerInfo(); + //经销商名称 + di.setDealerName(boDi.getAttribute("DISTRIBUTOR_NAME").toString()); + //经销商编号 + di.setDealerId(distributorNo); + di.setDealerMode(""); + String addressCode = boDi.getAttribute("DISTRIBUTOR_ADDRESS").getString(); + String dealerProvince = ParamDataUtils.queryMapBcProvinceCode("AreaCode",addressCode); + String dealerCity = ParamDataUtils.queryMapBcCityCode("AreaCode",addressCode); + di.setDealerProvince_gb(dealerProvince); + di.setDealerCity_gb(dealerCity); + di.setDealerDistrict_gb(""); + di.setDealerStreet_gb(""); + di.setSubDealerName(""); + di.setDealerGuaranteeRatio(""); + di.setDealerFiledVisitFlag(""); + di.setSubDealerAppFlag(""); + di.setDealerArea(""); + di.setSubDealerCode(""); + di.setDealerTotalUsedAmount(""); + di.setDealerAvailableAmount(""); + + + int monthApproveCount = bomLpi.createQuery("select 1 from o left join jbo.com.tenwa.lease.comm.LB_EQUIPMENT_CAR lec on lec.project_id=o.id where o.distributor_id=:distributor_id and o.project_status='13' and left(o.INPUTTIME,7)=:curMonth").setParameter("distributor_id",distributorNo).setParameter("curMonth", DateUtils.monthNowCore()).getTotalCount(); + int monthFailCount = bomLpi.createQuery("select 1 from o left join jbo.com.tenwa.lease.comm.LB_EQUIPMENT_CAR lec on lec.project_id=o.id where o.distributor_id=:distributor_id and o.PROJECT_STATUS<>'13' and left(o.INPUTTIME,7)=:curMonth").setParameter("distributor_id",distributorNo).setParameter("curMonth",DateUtils.monthNowCore()).getTotalCount(); + di.setApprovalCountThisMonth(monthApproveCount); + di.setRefuseCountThisMonth(monthFailCount); + BizObjectManager bomLfi = JBOFactory.getBizObjectManager(LC_FUND_INCOME.CLASS_NAME); + int monthLoanCount = bomLfi.createQuery("select 1 from o left join jbo.com.tenwa.lease.comm.LB_EQUIPMENT_CAR lec on lec.project_id=o.project_id left join jbo.com.tenwa.lease.comm.LB_PROJECT_INFO lpi on lpi.id=o.project_id where o.pay_type = 'pay_type_out' and o.PAY_STATUS='have_paid' and o.FEE_TYPE='feetype10' and o.SETTLE_METHOD='settlemethod6' and left(o.fact_date,7)=:curMonth and lpi.distributor_id=:distributor_id").setParameter("distributor_id",distributorNo).setParameter("curMonth",DateUtils.monthNowCore()).getTotalCount(); + di.setLoanCountThisMonth(monthLoanCount); + int yearApproveCount = bomLpi.createQuery("select 1 from o left join jbo.com.tenwa.lease.comm.LB_EQUIPMENT_CAR lec on lec.project_id=o.id where o.distributor_id=:distributor_id and o.project_status='13' and left(o.INPUTTIME,4)=:curYear").setParameter("distributor_id",distributorNo).setParameter("curYear",DateUtils.yearNow()).getTotalCount(); + int yearFailCount = bomLpi.createQuery("select 1 from o left join jbo.com.tenwa.lease.comm.LB_EQUIPMENT_CAR lec on lec.project_id=o.id where o.distributor_id=:distributor_id and o.PROJECT_STATUS<>'13' and left(o.INPUTTIME,4)=:curYear").setParameter("distributor_id",distributorNo).setParameter("curYear",DateUtils.yearNow()).getTotalCount(); + int yearLoanCount = bomLfi.createQuery("select FACT_MONEY from o left join jbo.com.tenwa.lease.comm.LB_EQUIPMENT_CAR lec on lec.project_id=o.project_id left join jbo.com.tenwa.lease.comm.LB_PROJECT_INFO lpi on lpi.id=o.project_id where o.pay_type = 'pay_type_out' and o.PAY_STATUS='have_paid' and o.FEE_TYPE='feetype10' and o.SETTLE_METHOD='settlemethod6' and left(o.fact_date,4)=:curYear and lpi.distributor_id=:distributor_id").setParameter("distributor_id",distributorNo).setParameter("curYear",DateUtils.yearNow()).getTotalCount(); + di.setApprovalCountThisYear(yearApproveCount); + di.setRefuseCountThisYear(yearFailCount); + di.setLoanCountThisYear(yearLoanCount); + + return di; + } + public LoanInfo getLoanInfo() throws Exception { + + LoanInfo li = new LoanInfo(); + li.setProductId(boLpit.getAttribute("PRODUCT_ID").toString()); + li.setProductName(boLpit.getAttribute("PRODUCT_NAME").toString()); + String settleMethod = boLcct.getAttribute("SETTLE_METHOD").toString(); + li.setProductType(ParamDataUtils.queryBcEnumType("SETTLE_METHOD",settleMethod)); + li.setSubsityTypeCode(""); + //年利率(产品利率) + String productRate = ProductParamUtil.getProductParameterValue(boLpit.getAttribute("PRODUCT_ID").toString(),"PRD0350","product_rate","ProductRate"); + BigDecimal interestRate = new BigDecimal(productRate).divide(new BigDecimal("100"),4,BigDecimal.ROUND_HALF_UP); + li.setInterestRate(interestRate.toString()); + //首付比例(综合) + double firstRatio = boLcct.getAttribute("ALL_FIRST_PAYMENT_RATIO").getDouble()/100; + li.setDownPaymentPercentage(new BigDecimal(firstRatio).setScale(4,BigDecimal.ROUND_HALF_UP).toString()); + //总首付金额 + li.setDownPaymentTotalAmount(boLcct.getAttribute("ALL_FIRST_PAYMENT").toString()); + li.setFinanceAmountUnit(""); + li.setFinanceAmountTotal(""); + //期数 + li.setTerms(boLcct.getAttribute("INCOME_NUMBER").toString()); + List boLrps = JBOFactory.createBizObjectQuery(LC_RENT_PLAN_TEMP.CLASS_NAME,"select o.interest,o.rent from o where o.FLOWUNID=:flowunid").setParameter("flowunid",flowUnid).getResultList(false); + BigDecimal interestTotal = new BigDecimal("0"); + double firstRent = 0; + for(int i=0;i 0) { + IsSubsity="1"; + } + } + //厂家承担利息总额,即厂家贴息金额 + li.setMakerInterestTotal(makerInterestTotal); + li.setMakerInterestTotalDeposit(""); + li.setIsSubsity(IsSubsity); + li.setContractPriceTotal(boLcct.getAttribute("EQUIP_AMT").toString()); + li.setMonthInterestRate(interestRate.divide(new BigDecimal("12"),4,BigDecimal.ROUND_HALF_UP).toString()); + li.setPayType("银行卡直扣"); + li.setPayRemark(""); + li.setIsLinked(ParamDataUtils.queryBcEnumType("TrueFalse",boLpit.getAttribute("IS_NETCAR").toString())); + li.setLinkedCompany(boLpit.getAttribute("AFFILIATEDNAME").toString()); + li.setLinkedCompanyType(boLpit.getAttribute("LEGALPERSONID").toString()); + li.setReserveString1("0"); + li.setReserveString2(""); + li.setReserveString3(""); + li.setReserveString4(""); + li.setReserveString5(""); + //车辆贷款用途 乘用车或商用。 0:商用车。目前取的TCF商用车,TCC乘用车 + String carType = boLpit.getAttribute("car_type").toString(); + li.setAssetPurpose("乘用车".equals(carType)?"TCC":"TCF"); + li.setBalloonPercentage(""); + li.setBalloonAmount(""); + String financedAmtPct = new BigDecimal(boLcct.getAttribute("CLEAN_LEASE_MONEY").toString()).divide(new BigDecimal(boLcct.getAttribute("TOTAL_ALL").toString()),4,BigDecimal.ROUND_HALF_UP).toString(); + li.setFinancedAmtPct(financedAmtPct); + li.setRentalCalculationMtd(""); + //客户承担利率 + String yearRate = boLcct.getAttribute("YEAR_RATE").toString(); + li.setBaseCustomerRate(yearRate); + //贴息利率 + li.setSubsidyRte(interestRate.subtract(new BigDecimal(yearRate)).toString()); + li.setCalcSubsidyRte(""); + li.setCalcSubsidyAmt(""); + //实际利率,刘英明:产品利率 + li.setActualRte(interestRate.toString()); + li.setPaymentScheme(ParamDataUtils.queryBcEnumType("income_number_year",boLcct.getAttribute("INCOME_NUMBER_YEAR").toString())); + li.setDealerSubsidyPct("0"); + li.setManufacturerSubsidyPct("0"); + li.setCalcDealerSubsidyAmt(interestRate.subtract(new BigDecimal(yearRate)).doubleValue()); + li.setCalcManufacturerSubsidyAmt(makerInterestTotal); + li.setCarCount(boLects.size()); + li.setExposuresNumber(exposures()); + li.setExposureAmount(exposuresAmount()); + li.setCarRealDownPaymentRatio(boLcct.getAttribute("FIRST_PAYMENT_RATIO").toString()); + li.setCarRealDownPaymentAmt(boLcct.getAttribute("FIRST_PAYMENT").toString()); + li.setFinancingRatio(1.0-boLcct.getAttribute("FIRST_PAYMENT_RATIO").getDouble()); + return li; } + public VehicleInfo getVehicleInfo() throws JBOException { + VehicleInfo vi = new VehicleInfo(); + List SingleVehicleTypes = new ArrayList<>(); + for(BizObject bo : boLects){ + SingleVehicleType svt = new SingleVehicleType(); + //品牌制造商 + svt.setMaker(ParamDataUtils.queryBcEnumType("MANUFACTURER_NAME",bo.getAttribute("MANUFACTURER_NAME").toString())); + svt.setBrand(bo.getAttribute("BRAND").toString()); + svt.setSeries(bo.getAttribute("car_series").toString()); + //车型 + svt.setModel(bo.getAttribute("MODEL").toString()); + //车辆台数 + svt.setQuantity("1"); + //车辆交易价格 + svt.setPriceUnit(bo.getAttribute("EQUIP_PRICE").toString()); + svt.setPriceTotal(""); + svt.setGps(""); + svt.setChassisVehicleModel(""); + svt.setSubsityVehicleModel(""); + //车辆类型:新车;二手车 + svt.setVehicleType(ParamDataUtils.queryBcEnumType("CarType",boLpit.getAttribute("CAR_TYPE").toString())); + svt.setOtherFee(""); + svt.setProducer(""); + //新车指导价 + svt.setNewPrice(bo.getAttribute("NOW_TOTAL").toString()); + svt.setVinNumber(""); + svt.setEngineNumber(""); + //车辆用途 + svt.setPurpose(""); + svt.setComments(""); + svt.setTransmission(""); + svt.setIsAffiliated(""); + svt.setAffiliatedCompName(""); + svt.setAffiliatedCompCrdcode(""); + svt.setRoadOperationLicenseCode(boLpit.getAttribute("TRANSPORTCERTID").toString()); + svt.setCarType(ParamDataUtils.queryBcEnumType("CarType",boLpit.getAttribute("CAR_TYPE").toString())); + svt.setBuyUseType(bo.getAttribute("cartype").toString()); + svt.setPurchaseTax(boLcct.getAttribute("PURCHASE_TAX").toString()); + svt.setCarPrice(bo.getAttribute("EQUIP_PRICE").toString()); + svt.setCarRealPrice(bo.getAttribute("EQUIP_PRICE").toString()); + SingleVehicleTypes.add(svt); + + } + vi.setSingleVehicleTypes(SingleVehicleTypes); + return vi; + } + public CustomerInfo getCustomerInfo() throws JBOException { + CustomerInfo ci = null; + BizObject boCit = JBOFactory.createBizObjectQuery(CUSTOMER_INFO_TEMP.CLASS_NAME,"FLOWUNID=:flowunid").setParameter("flowunid",flowUnid).getSingleResult(false); + String customerType = boCit.getAttribute("customertype").toString(); + if("01".equals(customerType)){ + ci = getCustomerInfoOfCompany(); + } + if("03".equals(customerType)){ + ci = getCustomerInfoOfPerson(); + } + return ci; + } + public CustomerInfo getCustomerInfoOfCompany() throws JBOException { + CustomerInfo ci = new CustomerInfo(); + BizObject boCct = JBOFactory.createBizObjectQuery(CUSTOMER_COMPANY_TEMP.CLASS_NAME,"FLOWUNID=:flowunid").setParameter("flowunid",flowUnid).getSingleResult(false); + String chName = boCct.getAttribute("company_name").toString(); + String idCardNum = boCct.getAttribute("certid").toString(); + String idTypeCode = boCct.getAttribute("CERTTYPE").toString(); + String annualIncome = boCct.getAttribute("business_income").toString(); + String phoneHome = boCct.getAttribute("tel").toString(); + String phoneOffice = boCct.getAttribute("company_tel").toString(); + String businessTypeCode = boCct.getAttribute("unit_properties").toString(); + + ci.setChName(chName); + ci.setIdCardNum(idCardNum); + ci.setIdTypeCode(ParamDataUtils.queryBcEnumType("CertType",idTypeCode)); + ci.setAnnualIncome(annualIncome); + ci.setPhoneHome(phoneHome); + ci.setPhoneOffice(phoneOffice); + ci.setBusinessNatureCde(ParamDataUtils.queryBcEnumType("Unit_nature",businessTypeCode)); + ci.setCustTypeId("2"); + ci.setCheckedType("2"); + return ci; + } + public CustomerInfo getCustomerInfoOfPerson() throws JBOException { + CustomerInfo ci = new CustomerInfo(); + BizObject boCat = JBOFactory.createBizObjectQuery(CUSTOMER_ACCOUNT_TEMP.CLASS_NAME,"FLOWUNID=:flowunid").setParameter("flowunid",flowUnid).getSingleResult(false); + + String idTypeCode = ParamDataUtils.queryBcEnumType("CertType",boCpt.getAttribute("CERTTYPE").toString()); + String chName = boCpt.getAttribute("FULLNAME").toString(); + String idCardNum = boCpt.getAttribute("CERTID").toString(); + String genderCode = ParamDataUtils.queryBcEnumType("sex",boCpt.getAttribute("SEX").toString()); + String maritalStatusCode = ParamDataUtils.queryBcEnumType("marry",boCpt.getAttribute("MARRIAGE").toString()); + String residentialStatusCode = ParamDataUtils.queryBcEnumType("Property_type",boCpt.getAttribute("Property_type").toString()); + String MonthlyIncome = boCpt.getAttribute("FAMILYMONTHINCOME").toString(); + String phoneCellPhone01 = boCpt.getAttribute("mobile").toString(); + String empemployerName = boCpt.getAttribute("WORKCORP").toString(); + String businessTypeCode = boCpt.getAttribute("Unit_nature").toString(); + String phoneHome = boCpt.getAttribute("telephone").toString(); + String phoneOffice = boCpt.getAttribute("WORKTEL").toString(); + String loanCardNumber = boCat.getAttribute("acc_number").toString(); + String openBankMobileNo = boCat.getAttribute("MOBILE").toString(); + String expense = boCpt.getAttribute("monthly_expenses").toString(); + String birthday = boCpt.getAttribute("birthday").toString().replace("/","-"); + String idBirthday = idCardNum.substring(6,14); + String nowDay = DateUtils.dateNow(); + int ageInYear = DateUtils.yearDiffByDate(idBirthday,nowDay); + int ageInMonth = DateUtils.monthDiffByDate(idBirthday,nowDay); + String workAddressId = boCpt.getAttribute("work_address_id").getString(); + + BizObject boRai = this.getAddressById(workAddressId); + String workProvinceCode = boRai.getAttribute("province_code").toString(); + String workCityCode = boRai.getAttribute("city_code").toString(); + String workDistrictCode = boRai.getAttribute("district_code").toString(); + String workAddressDetail = boRai.getAttribute("address_detail").toString(); + String occupationCode = ParamDataUtils.queryBcEnumType("career",boCpt.getAttribute("HEADSHIP").toString()); + String empBusinessTypeCode = ParamDataUtils.queryBcEnumType("workUnitIndustry",boCpt.getAttribute("UNITKIND").toString()); + String empPositionCode = ParamDataUtils.queryBcEnumType("duties",boCpt.getAttribute("OCCUPATION").toString()); + String highestEducation = ParamDataUtils.queryBcEnumType("Education",boCpt.getAttribute("EDUEXPERIENCE").toString()); + String CardTermBeginDate = boCpt.getAttribute("start_idexpiry").toString().replace("/","-"); + String CardTermEndDate = boCpt.getAttribute("idexpiry").toString().replace("/","-"); + + String nationId = ParamDataUtils.queryBcEnumType("nation",boCpt.getAttribute("NATIONALITY").toString()); + + ci.setChName(chName); + //证件类型 + ci.setIdTypeCode(idTypeCode); + //证件号 + ci.setIdCardNum(idCardNum); + //年龄 + ci.setAgeInYear(ageInYear); + //性别 + ci.setGenderCode(genderCode); + //婚姻状况 + ci.setMaritalStatusCode(maritalStatusCode); + //学历 + ci.setEducationCode(highestEducation); + //居住状况(安鹏房产类型) + ci.setResidentialStatusCode(residentialStatusCode); + //月收入 + ci.setMonthlyIncome(MonthlyIncome); + //年收入 + ci.setAnnualIncome(""); + ci.setMonthlyDTI(""); + ci.setNoOfDependents(""); + //工作单位名称 + ci.setEmpemployerName(empemployerName); + //单位所属行业 + ci.setEmpBusinessTypeCode(empBusinessTypeCode); + //职业 + ci.setEmpOccupationCode(occupationCode); + //职务 + ci.setEmpPositionCode(empPositionCode); + ci.setEmpProfessionalRank(""); + ci.setWorkSince(""); + ci.setEmpTimeOfEmployee(""); + ci.setPhoneCellphone01(phoneCellPhone01); + ci.setPhoneCellphone02(""); + ci.setPhoneHome(phoneHome); + ci.setPhoneOffice(phoneOffice); + ci.setBankStatementStatusCode(""); + ci.setLocalResidentFlag(""); + ci.setLocalApplicantFlag(""); + ci.setVipCust(""); + //重复申请客户(0:否1:是) + ci.setRepeatedApplicantFlag(repeatedApplicantFlag(idCardNum)); + ci.setHukouType(""); + //最高学历 + ci.setHighestEducation(highestEducation); + ci.setHighestDegree(""); + ci.setOfficePostCode(""); + ci.setCurrentOfficeEntryDate(""); + ci.setPhsNumber(""); + ci.setEmail(""); + ci.setHasDrivingLicence(""); + ci.setAllowDrivingType(""); + //人员类别(1.个人、2.法人) + ci.setCheckedType("1"); + //贷款卡号(银行卡号) + ci.setLoanCardNumber(loanCardNumber); + ci.setLoanCardPassword(""); + ci.setArchiveUrl(""); + ci.setAgeInMonth(ageInMonth); + ci.setChildrenFlag(""); + ci.setBlacklistInd(""); + ci.setThaiTitleCde(""); + //月支出 + ci.setExpense(expense); + //生日 + ci.setBrithday(birthday); + ci.setLicenseExpireDate(""); + ci.setCountryCode(""); + ci.setAreaCode(""); + ci.setExtentionNbr(""); + ci.setPhoneTypeCde(""); + ci.setDesignationCde(""); + ci.setCityCde(""); + ci.setStateCde(""); + //省市区 + ci.setProvinceGB(workProvinceCode); + ci.setCityGB(workCityCode); + ci.setDistrictGB(workDistrictCode); + ci.setStreetGB(""); + //企业性质 + ci.setBusinessNatureCde(ParamDataUtils.queryBcEnumType("Unit_nature",businessTypeCode)); + ci.setPostCode(""); + //工作地址 + ci.setEmployAddress(workAddressDetail); + //职业 + ci.setOccupationCode(occupationCode); + //企业类型 + ci.setBusinessTypeCde(empBusinessTypeCode); + //表示工作年限的长度(从事运输行业年限) + ci.setTimeInYear2(""); + ci.setRankCde(""); + //职业 + ci.setOccupationCde(occupationCode); + //单位所属行业 + ci.setIndustryTypeCde(empBusinessTypeCode); + ci.setAddr(getAddr()); + ci.setExposure(getExposure(idTypeCode)); + //客户类型 + ci.setCustTypeId("1"); + ci.setIdCardTermBeginDate(CardTermBeginDate); + ci.setIdCardTermEndDate(CardTermEndDate); + ci.setOpenBankMobileNo(openBankMobileNo); + ci.setNationId(nationId); + return ci; + } + public Coborrowers getCoborrowers() throws JBOException { + Coborrowers cos = new Coborrowers(); + if(boCft==null){ + return cos; + } + List coborrowerList = new ArrayList<>(); + coborrowerList.add(getCoborrower()); + cos.setCoborrower(coborrowerList); + return cos; + } + public Coborrower getCoborrower() throws JBOException { + Coborrower co = new Coborrower(); + String idTypeCode = ParamDataUtils.queryBcEnumType("CertType",boCft.getAttribute("CERTTYPE").toString()); + String chName = boCft.getAttribute("name").toString(); + String idCardNum = boCft.getAttribute("CERTID").toString(); + String genderCode = ParamDataUtils.queryBcEnumType("sex",boCft.getAttribute("SEX").toString()); + String maritalStatusCode = ParamDataUtils.queryBcEnumType("marry",boCft.getAttribute("marry_type").toString()); + String residentialStatusCode = ParamDataUtils.queryBcEnumType("Property_type",boCft.getAttribute("residential_status").toString()); + String MonthlyIncome = boCft.getAttribute("smincome").toString(); + String phoneCellPhone01 = boCft.getAttribute("tel").toString(); + String empemployerName = boCft.getAttribute("suname").toString(); + String businessTypeCode = boCft.getAttribute("enterprise_nature").toString(); + String phoneHome = boCft.getAttribute("tel").toString(); + String phoneOffice = boCft.getAttribute("suphone").toString(); + String expense = boCft.getAttribute("monthly_expenses").toString(); + String birthday = boCft.getAttribute("birthday").toString().replace("/","-"); + String idBirthday = idCardNum.substring(6,14); + String nowDay = DateUtils.dateNow(); + int ageInYear = DateUtils.yearDiffByDate(idBirthday,nowDay); + int ageInMonth = DateUtils.monthDiffByDate(idBirthday,nowDay); + String workAddressId = boCft.getAttribute("work_address_id").getString(); + + BizObject boRai = getAddressById(workAddressId); + String workProvinceCode = boRai.getAttribute("province_code").toString(); + String workCityCode = boRai.getAttribute("city_code").toString(); + String workDistrictCode = boRai.getAttribute("district_code").toString(); + String workAddressDetail = boRai.getAttribute("address_detail").toString(); + String occupationCode = ParamDataUtils.queryBcEnumType("career",boCft.getAttribute("career_type").toString()); + String empBusinessTypeCode = ParamDataUtils.queryBcEnumType("workUnitIndustry",boCft.getAttribute("industry_type").toString()); + String empPositionCode = ParamDataUtils.queryBcEnumType("duties",boCft.getAttribute("sposition").toString()); + String highestEducation = ParamDataUtils.queryBcEnumType("Education",boCft.getAttribute("education_level").toString()); + String CardTermBeginDate = boCft.getAttribute("start_idexpiry").toString().replace("/","-"); + String CardTermEndDate = boCft.getAttribute("idexpiry").toString().replace("/","-"); + String nationId = ParamDataUtils.queryBcEnumType("nation",boCft.getAttribute("nation").toString()); + String censusRegAddrId = boCft.getAttribute("id_address_id").toString(); + BizObject boCens = this.getAddressById(censusRegAddrId); + String censusRegAddr = boCens.getAttribute("full_address").toString(); + String relationshipCode = ParamDataUtils.queryBcEnumType("personContact",boCft.getAttribute("ASSURE_RELATION").toString()); + + co.setChName(chName); + //证件类型 + co.setIdTypeCode(idTypeCode); + //证件号 + co.setIdCardNum(idCardNum); + //年龄 + co.setAgeInYear(ageInYear); + //性别 + co.setGenderCode(genderCode); + //婚姻状况 + co.setMaritalStatusCode(maritalStatusCode); + //学历 + co.setEducationCode(highestEducation); + //居住状况(安鹏房产类型) + co.setResidentialStatusCode(residentialStatusCode); + //月收入 + co.setMonthlyIncome(MonthlyIncome); + //年收入 + co.setAnnualIncome(""); + co.setMonthlyDTI(""); + co.setNoOfDependents(""); + //工作单位名称 + co.setEmpemployerName(empemployerName); + //单位所属行业 + co.setEmpBusinessTypeCode(empBusinessTypeCode); + //职业 + co.setEmpOccupationCode(occupationCode); + //职务 + co.setEmpPositionCode(empPositionCode); + co.setEmpProfessionalRank(""); + co.setWorkSince(""); + co.setEmpTimeOfEmployee(""); + co.setPhoneCellphone01(phoneCellPhone01); + co.setPhoneCellphone02(""); + co.setPhoneHome(phoneHome); + co.setPhoneOffice(phoneOffice); + co.setBankStatementStatusCode(""); + co.setLocalResidentFlag(""); + co.setLocalApplicantFlag(""); + co.setVipCust(""); + //重复申请客户(0:否1:是) + co.setRepeatedApplicantFlag(repeatedApplicantFlag(idCardNum)); + co.setHukouType(""); + //最高学历 + co.setHighestEducation(highestEducation); + co.setHighestDegree(""); + co.setOfficePostCode(""); + co.setCurrentOfficeEntryDate(""); + co.setPhsNumber(""); + co.setEmail(""); + co.setHasDrivingLicence(""); + co.setAllowDrivingType(""); + //人员类别(1.个人、2.法人) + co.setCheckedType("1"); + co.setLoanCardPassword(""); + co.setArchiveUrl(""); + co.setAgeInMonth(ageInMonth); + co.setChildrenFlag(""); + co.setBlacklistInd(""); + co.setThaiTitleCde(""); + //月支出 + co.setExpense(expense); + //生日 + co.setBrithday(birthday); + co.setLicenseExpireDate(""); + co.setCountryCode(""); + co.setAreaCode(""); + co.setExtentionNbr(""); + co.setPhoneTypeCde(""); + co.setDesignationCde(""); + co.setCityCde(""); + co.setStateCde(""); + //省市区 + co.setProvinceGB(workProvinceCode); + co.setCityGB(workCityCode); + co.setDistrictGB(workDistrictCode); + co.setStreetGB(""); + //企业性质 + co.setBusinessNatureCde(ParamDataUtils.queryBcEnumType("Unit_nature",businessTypeCode)); + co.setPostCode(""); + //工作地址 + co.setEmployAddress(workAddressDetail); + //职业 + co.setOccupationCode(occupationCode); + //企业类型 + co.setBusinessTypeCde(empBusinessTypeCode); + //表示工作年限的长度(从事运输行业年限) + co.setTimeInYear2(""); + co.setRankCde(""); + //职业 + co.setOccupationCde(occupationCode); + //单位所属行业 + co.setIndustryTypeCde(empBusinessTypeCode); + co.setAddr(getAddr()); + co.setExposure(getExposure(idTypeCode)); + //客户类型(目前系统共借人只有一个,且为自然人,默认填入1) + co.setCustTypeId("1"); + co.setIdCardTermBeginDate(CardTermBeginDate); + co.setIdCardTermEndDate(CardTermEndDate); + //民族 + co.setNationId(nationId); + //户籍地址 + co.setCensusRegAddr(censusRegAddr); + //单位电话 + co.setTelWorkNo(phoneOffice); + //与主借人关系 + co.setRelationshipCode(relationshipCode); + //共借人编号(目前系统只有一个共借人,默认填1) + co.setBorrowerId("1"); + return co; + } + public GuarantorInfo getGuarantorInfo() throws JBOException { + GuarantorInfo gi = new GuarantorInfo(); + List gis = new ArrayList<>(); + for(BizObject boLgu : boLguts){ + Guar gr = getGuar(boLgu); + if(gr==null){ + continue; + } + gis.add(gr); + } + return gi; + } + public Guar getGuar(BizObject boLgu) throws JBOException { + String certType = boLgu.getAttribute("CERTTYPE").toString(); + Guar gr = null; + if(certType.startsWith("Ind")){ + gr = getGuarOfPerson(boLgu); + } + if(certType.startsWith("Ent")){ + gr = getGuarOfCompany(boLgu); + } + return gr; + } + public Guar getGuarOfCompany(BizObject boLgu) throws JBOException { + Guar gr = new Guar(); + String chName = boLgu.getAttribute("FULLNAME").toString(); + String idCardNum = boLgu.getAttribute("CERTID").toString(); + String idTypeCode = boLgu.getAttribute("CERTTYPE").toString(); + String relationshipCode = ParamDataUtils.queryBcEnumType("personContact",boLgu.getAttribute("ASSURE_RELATION").toString()); + + gr.setChName(chName); + gr.setIdCardNum(idCardNum); + gr.setIdTypeCode(ParamDataUtils.queryBcEnumType("CertType",idTypeCode)); + gr.setRelationshipCode(relationshipCode); + gr.setCustTypeId("2"); + gr.setCheckedType("2"); + return gr; + } + public Guar getGuarOfPerson(BizObject boLgu) throws JBOException { + Guar gr = new Guar(); + String idTypeCode = ParamDataUtils.queryBcEnumType("CertType",boLgu.getAttribute("CERTTYPE").toString()); + String chName = boLgu.getAttribute("FULLNAME").toString(); + String idCardNum = boLgu.getAttribute("CERTID").toString(); + String genderCode = ParamDataUtils.queryBcEnumType("sex",boLgu.getAttribute("SEX").toString()); + String maritalStatusCode = ParamDataUtils.queryBcEnumType("marry",boLgu.getAttribute("Marital_status").toString()); + String residentialStatusCode = ParamDataUtils.queryBcEnumType("Property_type",boLgu.getAttribute("residential_status").toString()); + String MonthlyIncome = boLgu.getAttribute("smincome").toString(); + String phoneCellPhone01 = boLgu.getAttribute("MOBILE").toString(); + String empemployerName = boLgu.getAttribute("WORKCORP").toString(); + String businessTypeCode = boLgu.getAttribute("enterprise_nature").toString(); + String phoneHome = boLgu.getAttribute("MOBILE").toString(); + String phoneOffice = boLgu.getAttribute("WORKTEL").toString(); + String expense = boLgu.getAttribute("monthly_expenses").toString(); + String birthday = boLgu.getAttribute("birthday").toString().replace("/","-"); + String idBirthday = idCardNum.substring(6,14); + String nowDay = DateUtils.dateNow(); + int ageInYear = DateUtils.yearDiffByDate(idBirthday,nowDay); + int ageInMonth = DateUtils.monthDiffByDate(idBirthday,nowDay); + String workAddressId = boLgu.getAttribute("work_address_id").getString(); + + BizObject boRai = getAddressById(workAddressId); + String workProvinceCode = boRai.getAttribute("province_code").toString(); + String workCityCode = boRai.getAttribute("city_code").toString(); + String workDistrictCode = boRai.getAttribute("district_code").toString(); + String workAddressDetail = boRai.getAttribute("address_detail").toString(); + String occupationCode = ParamDataUtils.queryBcEnumType("career",boLgu.getAttribute("career_type").toString()); + String empBusinessTypeCode = ParamDataUtils.queryBcEnumType("workUnitIndustry",boLgu.getAttribute("industry_type").toString()); + String empPositionCode = ParamDataUtils.queryBcEnumType("duties",boLgu.getAttribute("TITLE").toString()); + String highestEducation = ParamDataUtils.queryBcEnumType("Education",boLgu.getAttribute("education_level").toString()); + String CardTermBeginDate = boLgu.getAttribute("start_idexpiry").toString().replace("/","-"); + String CardTermEndDate = boLgu.getAttribute("idexpiry").toString().replace("/","-"); + String nationId = ParamDataUtils.queryBcEnumType("nation",boLgu.getAttribute("nation").toString()); + String censusRegAddrId = boLgu.getAttribute("id_address_id").toString(); + BizObject boCens = this.getAddressById(censusRegAddrId); + String censusRegAddr = boCens.getAttribute("full_address").toString(); + String relationshipCode = ParamDataUtils.queryBcEnumType("personContact",boLgu.getAttribute("ASSURE_RELATION").toString()); + + gr.setChName(chName); + //证件类型 + gr.setIdTypeCode(idTypeCode); + //证件号 + gr.setIdCardNum(idCardNum); + //年龄 + gr.setAgeInYear(ageInYear); + //性别 + gr.setGenderCode(genderCode); + //婚姻状况 + gr.setMaritalStatusCode(maritalStatusCode); + //学历 + gr.setEducationCode(highestEducation); + //居住状况(安鹏房产类型) + gr.setResidentialStatusCode(residentialStatusCode); + //月收入 + gr.setMonthlyIncome(MonthlyIncome); + //年收入 + gr.setAnnualIncome(""); + gr.setMonthlyDTI(""); + gr.setNoOfDependents(""); + //工作单位名称 + gr.setEmpemployerName(empemployerName); + //单位所属行业 + gr.setEmpBusinessTypeCode(empBusinessTypeCode); + //职业 + gr.setEmpOccupationCode(occupationCode); + //职务 + gr.setEmpPositionCode(empPositionCode); + gr.setEmpProfessionalRank(""); + gr.setWorkSince(""); + gr.setEmpTimeOfEmployee(""); + gr.setPhoneCellphone01(phoneCellPhone01); + gr.setPhoneCellphone02(""); + gr.setPhoneHome(phoneHome); + gr.setPhoneOffice(phoneOffice); + gr.setBankStatementStatusCode(""); + gr.setLocalResidentFlag(""); + gr.setLocalApplicantFlag(""); + gr.setVipCust(""); + //重复申请客户(0:否1:是) + gr.setRepeatedApplicantFlag(repeatedApplicantFlag(idCardNum)); + gr.setHukouType(""); + //最高学历 + gr.setHighestEducation(highestEducation); + gr.setHighestDegree(""); + gr.setOfficePostCode(""); + gr.setCurrentOfficeEntryDate(""); + gr.setPhsNumber(""); + gr.setEmail(""); + gr.setHasDrivingLicence(""); + gr.setAllowDrivingType(""); + //人员类别(1.个人、2.法人) + gr.setCheckedType("1"); + gr.setLoanCardPassword(""); + gr.setArchiveUrl(""); + gr.setAgeInMonth(ageInMonth); + gr.setChildrenFlag(""); + gr.setBlacklistInd(""); + gr.setThaiTitleCde(""); + //月支出 + gr.setExpense(expense); + //生日 + gr.setBrithday(birthday); + gr.setLicenseExpireDate(""); + gr.setCountryCode(""); + gr.setAreaCode(""); + gr.setExtentionNbr(""); + gr.setPhoneTypeCde(""); + gr.setDesignationCde(""); + gr.setCityCde(""); + gr.setStateCde(""); + //省市区 + gr.setProvinceGB(workProvinceCode); + gr.setCityGB(workCityCode); + gr.setDistrictGB(workDistrictCode); + gr.setStreetGB(""); + //企业性质 + gr.setBusinessNatureCde(ParamDataUtils.queryBcEnumType("Unit_nature",businessTypeCode)); + gr.setPostCode(""); + //工作地址 + gr.setEmployAddress(workAddressDetail); + //职业 + gr.setOccupationCode(occupationCode); + //企业类型 + gr.setBusinessTypeCde(empBusinessTypeCode); + //表示工作年限的长度(从事运输行业年限) + gr.setTimeInYear2(""); + gr.setRankCde(""); + //职业 + gr.setOccupationCde(occupationCode); + //单位所属行业 + gr.setIndustryTypeCde(empBusinessTypeCode); + gr.setAddr(getAddr()); + gr.setExposure(getExposure(idTypeCode)); + gr.setCustTypeId("1"); + gr.setIdCardTermBeginDate(CardTermBeginDate); + gr.setIdCardTermEndDate(CardTermEndDate); + //民族 + gr.setNationId(nationId); + //户籍地址 + gr.setCensusRegAddr(censusRegAddr); + //与主借人关系 + gr.setRelationshipCode(relationshipCode); + + return gr; + } + public ContInfo getContInfo() throws JBOException { + ContInfo ci = new ContInfo(); + List contrs = new ArrayList<>(); + + Contr contr = new Contr(); + contr.setContNum("1"); + contr.setChName(boCpt.getAttribute("EMERGENCY_CONTACT_PERSON").toString()); + contr.setRelationshipCode(boCpt.getAttribute("EMPLOYRECORD").toString()); + contr.setCellPhone(boCpt.getAttribute("EMERGENCY_CONTACT_TEL").toString()); + + Contr contr2 = new Contr(); + contr2.setContNum("2"); + contr2.setChName(boCpt.getAttribute("INTRO").toString()); + contr2.setRelationshipCode(boCpt.getAttribute("EDUDEGREE").toString()); + contr2.setCellPhone(boCpt.getAttribute("REMARK").toString()); + + contrs.add(contr); + contrs.add(contr2); + ci.setContrs(contrs); + return ci; + } + + public int repeatedApplicantFlag(String certId) throws JBOException { + int repeatedApplicantFlag = 0; + //int boCountLgu = JBOFactory.createBizObjectQuery(LB_GUARANTEE_UNIT.CLASS_NAME,"CERTID=:certId").setParameter("certId",certId).getTotalCount(); + //int boCountCf = JBOFactory.createBizObjectQuery(CUSTOMER_FAMILY.CLASS_NAME,"CERTID=:certId and status='valid' and Partner_='Y' ").setParameter("certId",certId).getTotalCount(); + int boCountCi = JBOFactory.createBizObjectQuery(CUSTOMER_INFO.CLASS_NAME,"CERTID=:certId ").setParameter("certId",certId).getTotalCount(); + if(boCountCi>0){ + repeatedApplicantFlag = 1; + } + return repeatedApplicantFlag; + } + + public Addr getAddr() throws JBOException { + BizObject boCat = JBOFactory.createBizObjectQuery(CUSTOMER_ADDRESS_TEMP.CLASS_NAME,"FLOWUNID=:flowunid and customerid=:customerId").setParameter("flowunid",flowUnid).setParameter("customerId",boCpt.getAttribute("customerid").toString()).getSingleResult(false); + String liveAddressId = boCat.getAttribute("province").getString(); + String provinceCode = ParamDataUtils.queryMapBcProvinceCode("AreaCode",liveAddressId); + String cityCode = ParamDataUtils.queryMapBcCityCode("AreaCode",liveAddressId); + String districtCode = ParamDataUtils.queryMapBcCountyCode("AreaCode",liveAddressId); + String fullAddress = boCat.getAttribute("dressdetail").getString(); + String residentialStatusCode = ParamDataUtils.queryBcEnumType("Property_type",boCpt.getAttribute("Property_type").toString()); + Addr addr = new Addr(); + addr.setProvince(""); + addr.setCity(""); + addr.setDistrict(""); + addr.setProvinceGB(provinceCode); + addr.setCityGB(cityCode); + addr.setDistrictGB(districtCode); + addr.setStreetGB(""); + addr.setAddress(fullAddress); + addr.setPostCode(""); + addr.setAddrType(""); + addr.setAddrNum(""); + addr.setPropertyTypeCde(residentialStatusCode); + addr.setHukouAddress(""); + + return addr; + } + public Exposure getExposure(String certId) throws JBOException { + //必须用身份证号,不能用customerid,因为存在一个身份证号,多个customerid的情况 + List boCis = JBOFactory.createBizObjectQuery(CUSTOMER_INFO.CLASS_NAME,"CERTID=:certId").setParameter("certId",certId).getResultList(false); + BigDecimal corpusRemain = new BigDecimal("0"); + BigDecimal yetLoan = new BigDecimal("0"); + int carCountRemain = 0; + int carCountYetLoan = 0; + for(BizObject boCi : boCis){ + String customerId = boCi.getAttribute("CUSTOMERID").toString(); + //一个customerId存在多个合同 + List boLuls = JBOFactory.createBizObjectQuery(LB_UNION_LESSEE.CLASS_NAME,"CUSTOMER_ID=:CUSTOMER_ID and is_main='Y'").setParameter("CUSTOMER_ID",customerId).getResultList(false); + for(BizObject boLul : boLuls){ + String contractId = boLul.getAttribute("contract_id").toString(); + BizObject boLci = JBOFactory.createBizObjectQuery(LB_CONTRACT_INFO.CLASS_NAME,"ID=:ID").setParameter("ID",contractId).getSingleResult(false); + String contractStatus = boLci.getAttribute("CONTRACT_STATUS").toString(); + if("31".equals(contractStatus)){ + BizObject boCat = JBOFactory.createBizObjectQuery(LC_CALC_CONDITION.CLASS_NAME,"CONTRACT_ID=:CONTRACT_ID").setParameter("CONTRACT_ID",contractId).getSingleResult(false); + String financeAmount = boCat.getAttribute("CLEAN_LEASE_MONEY").toString(); + BizObject boLri = JBOFactory.createBizObjectQuery(LC_RENT_INCOME.CLASS_NAME,"select ifnull(sum(corpus),0) as v.corpusTotal from o where CONTRACT_ID=:CONTRACT_ID and ROLL_BACK='0' ").setParameter("CONTRACT_ID",contractId).getSingleResult(false); + String corpusTotal = boLri.getAttribute("corpusTotal").toString(); + corpusRemain = corpusRemain.add(new BigDecimal(financeAmount).subtract(new BigDecimal(corpusTotal))); + carCountRemain = JBOFactory.createBizObjectQuery(LB_EQUIPMENT_CAR.CLASS_NAME,"CONTRACT_ID=:CONTRACT_ID").setParameter("CONTRACT_ID",contractId).getTotalCount(); + + } + if("21".equals(contractStatus)){ + BizObject boLfi = JBOFactory.createBizObjectQuery(LC_FUND_INCOME.CLASS_NAME,"CONTRACT_ID=:CONTRACT_ID and pay_type='pay_type_out' and fee_type='feetype10' and SETTLE_METHOD='settlemethod6' and roll_back='0' and PAY_STATUS<>'have_paid' ").setParameter("CONTRACT_ID",contractId).getSingleResult(false); + String factMoney = boLfi.getAttribute("fact_money").toString(); + yetLoan = yetLoan.add(new BigDecimal(factMoney)); + carCountYetLoan = JBOFactory.createBizObjectQuery(LB_EQUIPMENT_CAR.CLASS_NAME,"CONTRACT_ID=:CONTRACT_ID").setParameter("CONTRACT_ID",contractId).getTotalCount(); + } + } + } + Exposure ep = new Exposure(); + ep.setOutstanding(corpusRemain.toString()); + ep.setApprovalAmt(yetLoan.toString()); + ep.setOsNum(carCountRemain); + ep.setApprovalNum(carCountYetLoan); + return ep; + } + + public ApplicationInfo getApplicationInfo() throws Exception { + ApplicationInfo app = new ApplicationInfo(); + String number = boLpit.getAttribute("PROJECT_NO").toString(); + BizObject boft = JBOFactory.createBizObjectQuery(FLOW_TASK.CLASS_NAME,"select min(begintime) as v.minTime,max(begintime) as v.maxTime from o where flowno='BusinessApplyFlow' and phasetype='1020' and objectno=:flowunid").setParameter("flowunid",flowUnid).getSingleResult(false); + String minTime = boft.getAttribute("minTime").toString().replace("/","-").replace(" ","T"); + String maxTime = boft.getAttribute("maxTime").toString().replace("/","-").replace(" ","T"); + String faName = boLpit.getAttribute("inputName").toString(); + String faCellphone = boLpit.getAttribute("inputTel").toString(); + String carType = boLpit.getAttribute("car_type").toString(); + app.setNumber(number); + app.setApplicationType("APF"); + app.setOriginalSystemId("APF"); + app.setTranNo(DateUtils.dateTimeNowAccurate()); + app.setFirstProposalDate(minTime); + app.setLastProposalDate(maxTime); + app.setFaName(faName); + app.setFaid(""); + app.setFaCellphone(faCellphone); + app.setFvName(""); + app.setFvCellphone(""); + app.setFvDateoffv(""); + app.setFieldVisitFlag(""); + app.setBusinessStep(""); + app.setGroupCustomerUpId(""); + app.setGroupCustomerSpecialLimit(""); + //区分贷款车辆类型(CV、PV) + app.setLoanvehicleType("乘用车".equals(carType)?"PV":"CV"); + app.setQueryReason(""); + app.setCreditQueryType(""); + app.setCreditQueryInterface(""); + BizObject boPsl = JBOFactory.createBizObjectQuery(PRD_SPECIFIC_LIBRARY.CLASS_NAME,"PRODUCTID=:PRODUCTID").setParameter("PRODUCTID",boLpit.getAttribute("PRODUCT_ID").toString()).getSingleResult(false); + String lendingType = boPsl.getAttribute("LENDING_TYPE").toString(); + app.setIsVehicleGuaranty("AFTER".equals(lendingType)||"FIRST".equals(lendingType)?"1":"0"); + app.setCvHeadVehicleCount(""); + app.setSosRandomNumber(""); + //申请日期 + app.setApplicationDate(boLpit.getAttribute("project_date").toString().replace("/","-").replace(" ","T")); + //经销商提交申请或重新提交申请时间。 + app.setApplicationSubmitDate(maxTime); + //申请类型 客户类型 1个人 2法人 + BizObject boCit = JBOFactory.createBizObjectQuery(CUSTOMER_INFO_TEMP.CLASS_NAME,"FLOWUNID=:flowunid").setParameter("flowunid",flowUnid).getSingleResult(false); + String customerType = "1"; + if("01".equals(boCit.getAttribute("customertype").toString())){ + customerType="2"; + } + app.setCustomerType(customerType); + //经销商担保模式 + app.setStatusCode(ParamDataUtils.queryBcEnumType("dischanneltype",boDi.getAttribute("channeltype").toString())); + + return app; + } + + public PreviouslyVehicle getPreviouslyVehicle() throws JBOException { + PreviouslyVehicle pv = new PreviouslyVehicle(); + pv.setWorkingTime(ParamDataUtils.queryBcEnumType("employmentTime",boCpt.getAttribute("pre_operate_years").toString())); + pv.setPreviouslyVehicleType(ParamDataUtils.queryBcEnumType("operatePreVehicleType",boCpt.getAttribute("pre_operate_car_type").toString())); + pv.setPreviouslyVehicleLicense(boCpt.getAttribute("pre_operate_car_no").toString()); + return pv; + } + + public BizObject getAddressById(String addressId) throws JBOException { + BizObjectManager rcAddressInfo = JBOFactory.getBizObjectManager(RC_ADDRESS_INFO.CLASS_NAME); + BizObject boRai = rcAddressInfo.createQuery("address_id=:id").setParameter("id", addressId).getSingleResult(false); + return boRai; + } + + public int exposures() throws JBOException { + Set projectSet = new HashSet<>(); + BizObject boCit = JBOFactory.createBizObjectQuery(CUSTOMER_INFO_TEMP.CLASS_NAME,"FLOWUNID=:flowunid").setParameter("flowunid",flowUnid).getSingleResult(false); + String applyCertId = boCpt.getAttribute("CERTID").toString(); + projectSet.addAll(getExposuresNumberByCertID(applyCertId)); + if(boCft!=null){ + String coBorroeerId = boCft.getAttribute("CERTID").toString(); + projectSet.addAll(getExposuresNumberByCertID(coBorroeerId)); + } + if(boLguts.size()>0){ + for(BizObject boLgu : boLguts){ + String lguCertId = boLgu.getAttribute("CERTID").toString(); + projectSet.addAll(getExposuresNumberByCertID(lguCertId)); + } + } + return projectSet.size(); + } + public String exposuresAmount() throws JBOException { + Set projectSet = new HashSet<>(); + BigDecimal amount = new BigDecimal("0.00"); + BizObject boCit = JBOFactory.createBizObjectQuery(CUSTOMER_INFO_TEMP.CLASS_NAME,"FLOWUNID=:flowunid").setParameter("flowunid",flowUnid).getSingleResult(false); + String applyCertId = boCpt.getAttribute("CERTID").toString(); + projectSet.addAll(getExposuresNumberByCertID(applyCertId)); + if(boCft!=null){ + String coBorroeerId = boCft.getAttribute("CERTID").toString(); + projectSet.addAll(getExposuresNumberByCertID(coBorroeerId)); + } + if(boLguts.size()>0){ + for(BizObject boLgu : boLguts){ + String lguCertId = boLgu.getAttribute("CERTID").toString(); + projectSet.addAll(getExposuresNumberByCertID(lguCertId)); + } + } + for(String projectId : projectSet){ + BizObject boLpc = JBOFactory.createBizObjectQuery(LC_PROJ_CONDITION.CLASS_NAME,"PROJECT_ID=:PROJECT_ID").setParameter("PROJECT_ID",projectId).getSingleResult(false); + String cleanLeaseMoney = boLpc.getAttribute("CLEAN_LEASE_MONEY").toString(); + String cautionMoney =boLpc.getAttribute("CAUTION_MONEY").toString(); + BizObject boLri = JBOFactory.createBizObjectQuery(LC_RENT_INCOME.CLASS_NAME,"select ifnull(sum(rent),0) as v.rentIncome from O where ROLL_BACK=0 and PROJECT_ID=:PROJECT_ID").setParameter("PROJECT_ID",projectId).getSingleResult(false); + String rentIncome = boLri.getAttribute("rentIncome").toString(); + amount = new BigDecimal(cleanLeaseMoney).subtract(new BigDecimal(cautionMoney)).subtract(new BigDecimal(rentIncome)).add(amount); + } + + return amount.toString(); + } + public Set getExposuresNumberByCertID(String certId) throws JBOException { + /* + 具体敞口逻辑为:主借人或者共借人或担保人出现在其他合同(全条线业务)中作为主借或者共借人或担保人(重复合同取一次计算) + =全部合同的(已放款的贷款余额 + 待放款的贷款金额 + 已核准未放款贷款金额 - 保证金金额) + 本单申请的(贷款金额 - 保证金金额) + +当前在信审节点中申请的(贷款金额 - 保证金金额) + 法人客户,需考虑法人客户的自然人主体:法定代表人、实际控制人及股东关联的订单敞口。 + */ + //一个身份证可能存在多个customerid + List boCis = JBOFactory.createBizObjectQuery(CUSTOMER_INFO.CLASS_NAME,"select CUSTOMERID from O where CERTID=:certId").setParameter("certId",certId).getResultList(false); + Set projectSet = new HashSet<>(); + for(BizObject boCi : boCis){ + String customerId = boCi.getAttribute("CUSTOMERID").toString(); + //一个customerId存在多个合同 + List boLuls = JBOFactory.createBizObjectQuery(LB_UNION_LESSEE.CLASS_NAME,"select project_id from O where CUSTOMER_ID=:CUSTOMER_ID and is_main='Y'").setParameter("CUSTOMER_ID",customerId).getResultList(false); + for(BizObject boLul : boLuls){ + String projectId = boLul.getAttribute("project_id").toString(); + projectSet.add(projectId); + } + } + List boCfs = JBOFactory.createBizObjectQuery(CUSTOMER_FAMILY.CLASS_NAME,"select PROJECT_ID from O where CERTID=:certId and status='valid' and Partner_='Y'").setParameter("certId",certId).getResultList(false); + for(BizObject boCf : boCfs){ + String projectId = boCf.getAttribute("PROJECT_ID").toString(); + projectSet.add(projectId); + } + List boLgus = JBOFactory.createBizObjectQuery(LB_GUARANTEE_UNIT.CLASS_NAME,"select PROJECT_ID from O where CERTID=:certId ").setParameter("certId",certId).getResultList(false); + for(BizObject boLgu : boLgus){ + String projectId = boLgu.getAttribute("PROJECT_ID").toString(); + projectSet.add(projectId); + } + return projectSet; + } + + public String getFlowUnid() { + return flowUnid; + } + + public void setFlowUnid(String flowUnid) { + this.flowUnid = flowUnid; + } + + public String getOperatorId() { + return operatorId; + } + + public void setOperatorId(String operatorId) { + this.operatorId = operatorId; + } }