经销商五级分类
This commit is contained in:
parent
560a03a665
commit
deba3cbb5e
@ -42,6 +42,8 @@
|
||||
//dwTemp.ReadOnly = "1";//只读模式
|
||||
ASDataObject ado = dwTemp.getDataObject();
|
||||
ado.setHtmlEvent("LIMIT_APPROVAL_DATE", "onchange", "getenddate");
|
||||
ado.setHtmlEvent("CHANNELTYPE", "onchange", "changeTotalRequired");
|
||||
|
||||
ado.setHtmlEvent("LIMIT_EFFECTIVE_DATE", "onchange", "getenddate");
|
||||
//ado.setReadOnly("BUSINESS_PROPERTY,DISTRIBUTORER",true);
|
||||
dwTemp.genHTMLObjectWindow(sFlowUnid);
|
||||
@ -57,6 +59,9 @@
|
||||
sButtonPosition = "north";
|
||||
%><%@ include file="/Frame/resources/include/ui/include_info.jspf"%>
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
changeTotalRequired();
|
||||
})
|
||||
//组织机构验证码的的校验
|
||||
function Checkfield(){
|
||||
var businessLicenseNo = getItemValue(0,getRow(0),"BUSINESS_LICENSE_NO");
|
||||
@ -208,6 +213,23 @@
|
||||
setItemValue(0,getRow(),"LIMIT_APPROVAL_DATE",sReturn[1]);
|
||||
},"请选择渠道商");
|
||||
}
|
||||
//ÇëÑ¡Ôñ¾ÏúÉÌÃû³Æ
|
||||
function changeTotalRequired(){
|
||||
var channeltype = getItemValue(0,0,'channeltype');
|
||||
if("01"==channeltype){
|
||||
setItemRequired(0,'TOTAL',true);
|
||||
setItemRequired(0,'MARGIN_SCALE_SET',true);
|
||||
setItemRequired(0,'LIMIT_END_DATE',true);
|
||||
}else if("04"==channeltype){
|
||||
setItemRequired(0,'TOTAL',false);
|
||||
setItemRequired(0,'MARGIN_SCALE_SET',false);
|
||||
setItemRequired(0,'LIMIT_END_DATE',false);
|
||||
}else{
|
||||
setItemRequired(0,'TOTAL',false);
|
||||
setItemRequired(0,'MARGIN_SCALE_SET',true);
|
||||
setItemRequired(0,'LIMIT_END_DATE',true);
|
||||
}
|
||||
}
|
||||
var province="";//定义一个全局变量
|
||||
// 选择省份
|
||||
function selectProvinceCode(){
|
||||
|
||||
@ -30,6 +30,8 @@
|
||||
String DISTRIBUTOR_NO=CurPage.getParameter("DISTRIBUTOR_NO");
|
||||
ASObjectModel doTemp = new ASObjectModel(sTempletNo);
|
||||
//doTemp.setColTips("", "测试");
|
||||
doTemp.setHtmlEvent("CHANNELTYPE", "onchange", "changeTotalRequired");
|
||||
|
||||
ASObjectWindow dwTemp = new ASObjectWindow(CurPage, doTemp,request);
|
||||
dwTemp.Style = "2";//freeform
|
||||
//dwTemp.ReadOnly = "1";//只读模式
|
||||
@ -53,6 +55,9 @@
|
||||
sButtonPosition = "north";
|
||||
%><%@ include file="/Frame/resources/include/ui/include_info.jspf"%>
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
changeTotalRequired();
|
||||
})
|
||||
function save(){
|
||||
var total = getItemValue(0,0,'TOTAL');
|
||||
if(total==null||total==""){setItemValue(0, 0, "TOTAL", "0")};
|
||||
@ -166,7 +171,23 @@ function saveproj_name(){
|
||||
},"请选择地区",'');
|
||||
}
|
||||
}
|
||||
|
||||
//ÇëÑ¡Ôñ¾ÏúÉÌÃû³Æ
|
||||
function changeTotalRequired(){
|
||||
var channeltype = getItemValue(0,0,'channeltype');
|
||||
if("01"==channeltype){
|
||||
setItemRequired(0,'TOTAL',true);
|
||||
setItemRequired(0,'MARGIN_SCALE_SET',true);
|
||||
setItemRequired(0,'LIMIT_END_DATE',true);
|
||||
}else if("04"==channeltype){
|
||||
setItemRequired(0,'TOTAL',false);
|
||||
setItemRequired(0,'MARGIN_SCALE_SET',false);
|
||||
setItemRequired(0,'LIMIT_END_DATE',false);
|
||||
}else{
|
||||
setItemRequired(0,'TOTAL',false);
|
||||
setItemRequired(0,'MARGIN_SCALE_SET',true);
|
||||
setItemRequired(0,'LIMIT_END_DATE',true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
@ -313,6 +313,50 @@
|
||||
</managerProperties>
|
||||
</manager>
|
||||
</class>
|
||||
<class name="LB_FIVEGRADEDETAILED_INFO" label="" keyAttributes="ID">
|
||||
<attributes>
|
||||
<attribute name="ID" label="主键" type="STRING" length="32"/>
|
||||
<attribute name="CONTRACT_ID" label="合同ID" type="STRING" length="32"/>
|
||||
<attribute name="DISTRIBUTOR_NO" label="渠道商编号" type="STRING" length="32"/>
|
||||
<attribute name="DISTRIBUTORNAME" label="渠道商名称" type="STRING" length="100"/>
|
||||
<attribute name="DISTRIBUTORTYPE" label="渠道商类型" type="STRING" length="32"/>
|
||||
<attribute name="DISTRIBUTORQUOTA" label="渠道商额度池" type="STRING" length="32"/>
|
||||
<attribute name="DEPOSITRATIO" label="保证金比例设置" type="STRING" length="32"/>
|
||||
<attribute name="AGREEMENT" label="协议到期日" type="STRING" length="32"/>
|
||||
<attribute name="TOTAL_FINANCING_AMOUNT" label="融资金额合计" type="STRING" length="32"/>
|
||||
<attribute name="THE_REMAINING_AMOUNT" label="剩余额度" type="STRING" length="32"/>
|
||||
<attribute name="CONTRACT_NUMBER" label="合同编号" type="STRING" length="32"/>
|
||||
<attribute name="TOTAL_OVERDUE_PRINCIPAL" label="逾期本金合计" type="STRING" length="32"/>
|
||||
<attribute name="TOTAL_OVERDUE_INTEREST" label="逾期利息合计" type="STRING" length="32"/>
|
||||
<attribute name="TOTAL_PENALTY" label="罚息合计" type="STRING" length="32"/>
|
||||
<attribute name="TOTAL_OVERDUE_ALL" label="逾期金额合计" type="STRING" length="32"/>
|
||||
<attribute name="EXISTING_CUSTOMERS_NUM" label="存续客户数量" type="STRING" length="32"/>
|
||||
<attribute name="TOTAL_OUTSTANDING_PRINCIPAL" label="未还本金合计" type="STRING" length="32"/>
|
||||
<attribute name="OVERDUERATE" label="逾期率" type="STRING" length="32"/>
|
||||
<attribute name="BADNESSRATE" label="不良率" type="STRING" length="32"/>
|
||||
<attribute name="EXISTING_CUSTOMERS_NUM_NORMAL" label="存续客户数量正常" type="STRING" length="32"/>
|
||||
<attribute name="FINANCING_AMOUNT_NORMAL" label="融资金额正常" type="STRING" length="32"/>
|
||||
<attribute name="NOTBACK_PRINCIPAL_NORMAL" label="未还本金正常" type="STRING" length="32"/>
|
||||
<attribute name="EXISTING_CUSTOMERS_NUM_ATTENTION" label="存续客户数量关注" type="STRING" length="32"/>
|
||||
<attribute name="FINANCING_AMOUNT_ATTENTION" label="融资金额关注" type="STRING" length="32"/>
|
||||
<attribute name="NOTBACK_PRINCIPAL_ATTENTION" label="未还本金关注" type="STRING" length="32"/>
|
||||
<attribute name="EXISTING_CUSTOMERS_NUM_SECONDARY" label="存续客户数量次级" type="STRING" length="32"/>
|
||||
<attribute name="FINANCING_AMOUNT_SECONDARY" label="融资金额次级" type="STRING" length="32"/>
|
||||
<attribute name="NOTBACK_PRINCIPAL_SECONDARY" label="未还本金次级" type="STRING" length="32"/>
|
||||
<attribute name="EXISTING_CUSTOMERS_NUM_SUSPICIOUS" label="存续客户数量可疑" type="STRING" length="32"/>
|
||||
<attribute name="FINANCING_AMOUNT_SUSPICIOUS" label="融资金额可疑" type="STRING" length="32"/>
|
||||
<attribute name="NOTBACK_PRINCIPAL_SUSPICIOUS" label="未还本金可疑" type="STRING" length="32"/>
|
||||
<attribute name="EXISTING_CUSTOMERS_NUM_LOSS" label="存续客户数量损失" type="STRING" length="32"/>
|
||||
<attribute name="FINANCING_AMOUNT_LOSS" label="融资金额损失" type="STRING" length="32"/>
|
||||
<attribute name="NOTBACK_PRINCIPAL_LOSS" label="未还本金损失" type="STRING" length="32"/>
|
||||
</attributes>
|
||||
<manager>
|
||||
<managerProperties>
|
||||
<property name="table" value="lb_fivegradedetailed_info" />
|
||||
<property name="createKey" value="true" />
|
||||
</managerProperties>
|
||||
</manager>
|
||||
</class>
|
||||
</package>
|
||||
<package name="jbo.com.tenwa.entity.comm.officetempalte" >
|
||||
<class name="BF_PARAMCONFIG" label="参数配置" keyAttributes="ID">
|
||||
|
||||
@ -1021,6 +1021,7 @@
|
||||
<attribute name="DISTRIBUTOR_CODING" label="经销商编号" type="STRING" length="32"/>
|
||||
<attribute name="TOTAL" label="额度" type="STRING" length="32"/>
|
||||
<attribute name="SUMS" label="总额" type="STRING" length="64"/>
|
||||
<attribute name="channeltype" label="渠道商类型" type="STRING" length="32"/>
|
||||
<attribute name="import_status" label="导入状态" type="STRING" length="64"/>
|
||||
<attribute name="MARGIN_SCALE_SET" label="保证金比例设置" type="STRING" length="64"/>
|
||||
</attributes>
|
||||
@ -1316,6 +1317,7 @@
|
||||
<attribute name="PROVINCES" label="省份" type="STRING" length="32"/>
|
||||
<attribute name="DISTRIBUTOR_CODING" label="经销商编码" type="STRING" length="32"/>
|
||||
<attribute name="TOTAL" label="额度" type="STRING" length="32"/>
|
||||
<attribute name="channeltype" label="渠道商类型" type="STRING" length="32"/>
|
||||
<attribute name="SUMS" label="总额" type="STRING" length="64"/>
|
||||
<attribute name="MARGIN_SCALE_SET" label="保证金比例设置" type="STRING" length="60"/>
|
||||
</attributes>
|
||||
|
||||
@ -3,6 +3,7 @@ package com.tenwa.lease.app.quartzmession;
|
||||
import java.util.List;
|
||||
|
||||
import jbo.app.tenwa.calc.LC_CALC_CONDITION_STATUS;
|
||||
import jbo.app.tenwa.customer.DISTRIBUTOR_INFO;
|
||||
import jbo.app.tenwa.customer.LM_GRADE_CLASSIFICATION;
|
||||
import jbo.com.tenwa.lease.comm.LB_CONTRACT_INFO;
|
||||
import jbo.com.tenwa.lease.comm.LB_FIVE_GRADE;
|
||||
@ -19,9 +20,11 @@ import com.amarsoft.are.jbo.JBOException;
|
||||
import com.amarsoft.are.jbo.JBOFactory;
|
||||
import com.amarsoft.are.jbo.JBOTransaction;
|
||||
import com.amarsoft.are.util.StringFunction;
|
||||
import com.amarsoft.awe.util.Transaction;
|
||||
import com.base.util.QuartzUtil;
|
||||
import com.tenwa.comm.util.date.DateAssistant;
|
||||
import com.tenwa.flow.comm.handler.flowmanage.OverdueProjectCache;
|
||||
import com.tenwa.lease.flow.project.commbusiness.CreateFiveGradeDataAction;
|
||||
|
||||
public class AutoFiveGradeClassification implements Job {
|
||||
|
||||
@ -91,6 +94,7 @@ public class AutoFiveGradeClassification implements Job {
|
||||
JBOTransaction tx=null;
|
||||
try {
|
||||
tx= JBOFactory.createJBOTransaction();
|
||||
BizObjectManager diManager = JBOFactory.getBizObjectManager(DISTRIBUTOR_INFO.CLASS_NAME);
|
||||
BizObjectManager lccsManager = JBOFactory.getBizObjectManager(LC_CALC_CONDITION_STATUS.CLASS_NAME);
|
||||
BizObjectManager lciManager = JBOFactory.getBizObjectManager(LB_CONTRACT_INFO.CLASS_NAME);
|
||||
BizObjectManager five_gr = JBOFactory.getBizObjectManager(LB_FIVE_GRADE.CLASS_NAME);
|
||||
@ -129,6 +133,13 @@ public class AutoFiveGradeClassification implements Job {
|
||||
}
|
||||
}
|
||||
}
|
||||
Transaction txv = Transaction.createTransaction(tx);
|
||||
List<BizObject> diList = diManager.createQuery("1=1").getResultList(false);
|
||||
CreateFiveGradeDataAction cfgda = null;
|
||||
for(BizObject dibo:diList){
|
||||
cfgda=new CreateFiveGradeDataAction(dibo.getAttribute("distributor_no").getString(),txv);
|
||||
cfgda.insertFiveGradeTable(txv);
|
||||
}
|
||||
tx.commit();
|
||||
} catch (Exception e) {
|
||||
try {
|
||||
|
||||
@ -0,0 +1,309 @@
|
||||
package com.tenwa.lease.flow.project.commbusiness;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import jbo.app.tenwa.customer.DISTRIBUTOR_INFO;
|
||||
import jbo.com.tenwa.entity.comm.own.LB_FIVEGRADEDETAILED_INFO;
|
||||
|
||||
import com.amarsoft.are.jbo.BizObject;
|
||||
import com.amarsoft.are.jbo.BizObjectManager;
|
||||
import com.amarsoft.are.jbo.JBOException;
|
||||
import com.amarsoft.are.jbo.JBOFactory;
|
||||
import com.amarsoft.are.util.StringFunction;
|
||||
import com.amarsoft.awe.util.ASResultSet;
|
||||
import com.amarsoft.awe.util.SqlObject;
|
||||
import com.amarsoft.awe.util.Transaction;
|
||||
|
||||
public class CreateFiveGradeDataAction {
|
||||
String contractId;
|
||||
|
||||
String distributorNo;
|
||||
double TOTAL_OVERDUE_PRINCIPAL;
|
||||
double TOTAL_OVERDUE_INTEREST;
|
||||
double TOTAL_PENALTY;
|
||||
//所有未还本金
|
||||
double TOTAL_OUTSTANDING_PRINCIPAL;
|
||||
//逾期客户未还本金合计
|
||||
double TOTAL_OUTSTANDINGCUSTOMER_PRINCIPAL;
|
||||
//---五级分类未还本金----
|
||||
double NOTBACK_PRINCIPAL_NORMAL;
|
||||
double NOTBACK_PRINCIPAL_ATTENTION;
|
||||
double NOTBACK_PRINCIPAL_SECONDARY;
|
||||
double NOTBACK_PRINCIPAL_SUSPICIOUS;
|
||||
double NOTBACK_PRINCIPAL_LOSS;
|
||||
//---五级分类存续客户----
|
||||
String EXISTING_CUSTOMERS_NUM_NORMAL;
|
||||
String EXISTING_CUSTOMERS_NUM_ATTENTION;
|
||||
String EXISTING_CUSTOMERS_NUM_SECONDARY;
|
||||
String EXISTING_CUSTOMERS_NUM_SUSPICIOUS;
|
||||
String EXISTING_CUSTOMERS_NUM_LOSS;
|
||||
//---五级分类融资额
|
||||
String FINANCING_AMOUNT_NORMAL;
|
||||
String FINANCING_AMOUNT_ATTENTION;
|
||||
String FINANCING_AMOUNT_SECONDARY;
|
||||
String FINANCING_AMOUNT_SUSPICIOUS;
|
||||
String FINANCING_AMOUNT_LOSS;
|
||||
|
||||
public CreateFiveGradeDataAction(String distributorno,Transaction tx) throws Exception{
|
||||
try {
|
||||
distributorNo = distributorno;
|
||||
TOTAL_OVERDUE_PRINCIPAL = this.calcOverDuePrincipal(distributorNo,"CORPUS",true,null,tx);
|
||||
TOTAL_OVERDUE_INTEREST = this.calcOverDuePrincipal(distributorNo,"INTEREST",true,null,tx);
|
||||
TOTAL_PENALTY = this.calcOverDuePenalty(distributorNo,tx);
|
||||
TOTAL_OUTSTANDING_PRINCIPAL = this.calcOverDuePrincipal(distributorNo, "CORPUS", false, null, tx);
|
||||
TOTAL_OUTSTANDINGCUSTOMER_PRINCIPAL = this.calcOverDueCustomerAllCorpus(distributorNo, tx);
|
||||
|
||||
NOTBACK_PRINCIPAL_NORMAL = this.calcOverDuePrincipal(distributorNo, "CORPUS", false, "ClassifyResult01", tx);
|
||||
NOTBACK_PRINCIPAL_ATTENTION = this.calcOverDuePrincipal(distributorNo, "CORPUS", false, "ClassifyResult02", tx);
|
||||
NOTBACK_PRINCIPAL_SECONDARY = this.calcOverDuePrincipal(distributorNo, "CORPUS", false, "ClassifyResult03", tx);
|
||||
NOTBACK_PRINCIPAL_SUSPICIOUS = this.calcOverDuePrincipal(distributorNo, "CORPUS", false, "ClassifyResult04", tx);
|
||||
NOTBACK_PRINCIPAL_LOSS = this.calcOverDuePrincipal(distributorNo, "CORPUS", false, "ClassifyResult05", tx);
|
||||
|
||||
EXISTING_CUSTOMERS_NUM_NORMAL = this.getCustomerNumber(distributorNo,"ClassifyResult01","custnum",tx);
|
||||
EXISTING_CUSTOMERS_NUM_ATTENTION = this.getCustomerNumber(distributorNo,"ClassifyResult02","custnum",tx);
|
||||
EXISTING_CUSTOMERS_NUM_SECONDARY = this.getCustomerNumber(distributorNo,"ClassifyResult03","custnum",tx);
|
||||
EXISTING_CUSTOMERS_NUM_SUSPICIOUS = this.getCustomerNumber(distributorNo,"ClassifyResult04","custnum",tx);
|
||||
EXISTING_CUSTOMERS_NUM_LOSS = this.getCustomerNumber(distributorNo,"ClassifyResult05","custnum",tx);
|
||||
|
||||
FINANCING_AMOUNT_NORMAL = this.getCustomerNumber(distributorNo,"ClassifyResult01","qq",tx);
|
||||
FINANCING_AMOUNT_ATTENTION = this.getCustomerNumber(distributorNo,"ClassifyResult02","qq",tx);
|
||||
FINANCING_AMOUNT_SECONDARY = this.getCustomerNumber(distributorNo,"ClassifyResult03","qq",tx);
|
||||
FINANCING_AMOUNT_SUSPICIOUS = this.getCustomerNumber(distributorNo,"ClassifyResult04","qq",tx);
|
||||
FINANCING_AMOUNT_LOSS = this.getCustomerNumber(distributorNo,"ClassifyResult05","qq",tx);
|
||||
System.out.println("=====================================");
|
||||
System.out.println(this.toString());
|
||||
System.out.println("=====================================");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
throw new Exception("初始化对象异常");
|
||||
}
|
||||
}
|
||||
public boolean insertFiveGradeTable(Transaction tx) throws Exception{
|
||||
BizObjectManager bm;
|
||||
BizObjectManager bmDI;
|
||||
try {
|
||||
bmDI = JBOFactory.getBizObjectManager(DISTRIBUTOR_INFO.CLASS_NAME,tx);
|
||||
BizObject BoDI=bmDI.createQuery("DISTRIBUTOR_NO=:DISTRIBUTOR_NO").setParameter("DISTRIBUTOR_NO", distributorNo).getSingleResult(true);
|
||||
|
||||
bm = JBOFactory.getBizObjectManager(LB_FIVEGRADEDETAILED_INFO.CLASS_NAME,tx);
|
||||
BizObject oldBo=bm.createQuery("DISTRIBUTOR_NO=:DISTRIBUTOR_NO").setParameter("DISTRIBUTOR_NO", distributorNo).getSingleResult(true);
|
||||
if(oldBo!=null){
|
||||
oldBo.setAttributeValue(LB_FIVEGRADEDETAILED_INFO.DISTRIBUTORNAME,BoDI.getAttribute("distributor_name"));
|
||||
oldBo.setAttributeValue(LB_FIVEGRADEDETAILED_INFO.DISTRIBUTORTYPE,BoDI.getAttribute("channeltype"));
|
||||
oldBo.setAttributeValue(LB_FIVEGRADEDETAILED_INFO.DISTRIBUTORQUOTA,BoDI.getAttribute("TOTAL"));
|
||||
oldBo.setAttributeValue(LB_FIVEGRADEDETAILED_INFO.DEPOSITRATIO,BoDI.getAttribute("MARGIN_SCALE_SET"));
|
||||
oldBo.setAttributeValue(LB_FIVEGRADEDETAILED_INFO.AGREEMENT,BoDI.getAttribute("LIMIT_END_DATE"));
|
||||
oldBo.setAttributeValue(LB_FIVEGRADEDETAILED_INFO.TOTAL_FINANCING_AMOUNT,new BigDecimal(Double.parseDouble(FINANCING_AMOUNT_LOSS)+Double.parseDouble(FINANCING_AMOUNT_SUSPICIOUS)+Double.parseDouble(FINANCING_AMOUNT_SECONDARY)+Double.parseDouble(FINANCING_AMOUNT_ATTENTION)+Double.parseDouble(FINANCING_AMOUNT_NORMAL)).setScale(2, BigDecimal.ROUND_DOWN).toPlainString());
|
||||
oldBo.setAttributeValue(LB_FIVEGRADEDETAILED_INFO.THE_REMAINING_AMOUNT,new BigDecimal(Double.parseDouble(BoDI.getAttribute("TOTAL").getString())-(Double.parseDouble(FINANCING_AMOUNT_LOSS)+Double.parseDouble(FINANCING_AMOUNT_SUSPICIOUS)+Double.parseDouble(FINANCING_AMOUNT_SECONDARY)+Double.parseDouble(FINANCING_AMOUNT_ATTENTION)+Double.parseDouble(FINANCING_AMOUNT_NORMAL))).setScale(2, BigDecimal.ROUND_DOWN).toPlainString());
|
||||
|
||||
oldBo.setAttributeValue(LB_FIVEGRADEDETAILED_INFO.TOTAL_OVERDUE_PRINCIPAL,TOTAL_OVERDUE_PRINCIPAL);
|
||||
oldBo.setAttributeValue(LB_FIVEGRADEDETAILED_INFO.TOTAL_OVERDUE_INTEREST,TOTAL_OVERDUE_INTEREST);
|
||||
oldBo.setAttributeValue(LB_FIVEGRADEDETAILED_INFO.TOTAL_PENALTY, TOTAL_PENALTY);
|
||||
oldBo.setAttributeValue(LB_FIVEGRADEDETAILED_INFO.TOTAL_OVERDUE_ALL, TOTAL_OVERDUE_PRINCIPAL+TOTAL_OVERDUE_INTEREST+TOTAL_PENALTY);
|
||||
oldBo.setAttributeValue(LB_FIVEGRADEDETAILED_INFO.EXISTING_CUSTOMERS_NUM, Integer.parseInt(EXISTING_CUSTOMERS_NUM_NORMAL)+Integer.parseInt(EXISTING_CUSTOMERS_NUM_ATTENTION)+Integer.parseInt(EXISTING_CUSTOMERS_NUM_SUSPICIOUS)+Integer.parseInt(EXISTING_CUSTOMERS_NUM_LOSS)+Integer.parseInt(EXISTING_CUSTOMERS_NUM_SECONDARY));
|
||||
oldBo.setAttributeValue(LB_FIVEGRADEDETAILED_INFO.TOTAL_OUTSTANDING_PRINCIPAL, TOTAL_OUTSTANDING_PRINCIPAL+"");
|
||||
oldBo.setAttributeValue(LB_FIVEGRADEDETAILED_INFO.OVERDUERATE, (double) Math.round(TOTAL_OUTSTANDINGCUSTOMER_PRINCIPAL/TOTAL_OUTSTANDING_PRINCIPAL));
|
||||
oldBo.setAttributeValue(LB_FIVEGRADEDETAILED_INFO.BADNESSRATE, (double) Math.round(NOTBACK_PRINCIPAL_LOSS+NOTBACK_PRINCIPAL_SUSPICIOUS+NOTBACK_PRINCIPAL_SECONDARY/TOTAL_OUTSTANDING_PRINCIPAL));
|
||||
|
||||
oldBo.setAttributeValue(LB_FIVEGRADEDETAILED_INFO.EXISTING_CUSTOMERS_NUM_NORMAL, EXISTING_CUSTOMERS_NUM_NORMAL);
|
||||
oldBo.setAttributeValue(LB_FIVEGRADEDETAILED_INFO.EXISTING_CUSTOMERS_NUM_ATTENTION, EXISTING_CUSTOMERS_NUM_ATTENTION);
|
||||
oldBo.setAttributeValue(LB_FIVEGRADEDETAILED_INFO.EXISTING_CUSTOMERS_NUM_SECONDARY, EXISTING_CUSTOMERS_NUM_SECONDARY);
|
||||
oldBo.setAttributeValue(LB_FIVEGRADEDETAILED_INFO.EXISTING_CUSTOMERS_NUM_SUSPICIOUS, EXISTING_CUSTOMERS_NUM_SUSPICIOUS);
|
||||
oldBo.setAttributeValue(LB_FIVEGRADEDETAILED_INFO.EXISTING_CUSTOMERS_NUM_LOSS, EXISTING_CUSTOMERS_NUM_LOSS);
|
||||
|
||||
oldBo.setAttributeValue(LB_FIVEGRADEDETAILED_INFO.NOTBACK_PRINCIPAL_NORMAL, NOTBACK_PRINCIPAL_NORMAL+"");
|
||||
oldBo.setAttributeValue(LB_FIVEGRADEDETAILED_INFO.NOTBACK_PRINCIPAL_ATTENTION, NOTBACK_PRINCIPAL_ATTENTION);
|
||||
oldBo.setAttributeValue(LB_FIVEGRADEDETAILED_INFO.NOTBACK_PRINCIPAL_SECONDARY, NOTBACK_PRINCIPAL_SECONDARY);
|
||||
oldBo.setAttributeValue(LB_FIVEGRADEDETAILED_INFO.NOTBACK_PRINCIPAL_SUSPICIOUS, NOTBACK_PRINCIPAL_SUSPICIOUS);
|
||||
oldBo.setAttributeValue(LB_FIVEGRADEDETAILED_INFO.NOTBACK_PRINCIPAL_LOSS, NOTBACK_PRINCIPAL_LOSS);
|
||||
|
||||
oldBo.setAttributeValue(LB_FIVEGRADEDETAILED_INFO.FINANCING_AMOUNT_NORMAL, FINANCING_AMOUNT_NORMAL);
|
||||
oldBo.setAttributeValue(LB_FIVEGRADEDETAILED_INFO.FINANCING_AMOUNT_ATTENTION, FINANCING_AMOUNT_ATTENTION);
|
||||
oldBo.setAttributeValue(LB_FIVEGRADEDETAILED_INFO.FINANCING_AMOUNT_SECONDARY, FINANCING_AMOUNT_SECONDARY);
|
||||
oldBo.setAttributeValue(LB_FIVEGRADEDETAILED_INFO.FINANCING_AMOUNT_SUSPICIOUS, FINANCING_AMOUNT_SUSPICIOUS);
|
||||
oldBo.setAttributeValue(LB_FIVEGRADEDETAILED_INFO.FINANCING_AMOUNT_LOSS, FINANCING_AMOUNT_LOSS);
|
||||
bm.saveObject(oldBo);
|
||||
}else{
|
||||
BizObject newBo = bm.newObject();
|
||||
newBo.setAttributeValue(LB_FIVEGRADEDETAILED_INFO.DISTRIBUTOR_NO, distributorNo);
|
||||
newBo.setAttributeValue(LB_FIVEGRADEDETAILED_INFO.DISTRIBUTORNAME,BoDI.getAttribute("distributor_name"));
|
||||
newBo.setAttributeValue(LB_FIVEGRADEDETAILED_INFO.DISTRIBUTORTYPE,BoDI.getAttribute("channeltype"));
|
||||
newBo.setAttributeValue(LB_FIVEGRADEDETAILED_INFO.DISTRIBUTORQUOTA,BoDI.getAttribute("TOTAL"));
|
||||
newBo.setAttributeValue(LB_FIVEGRADEDETAILED_INFO.DEPOSITRATIO,BoDI.getAttribute("MARGIN_SCALE_SET"));
|
||||
newBo.setAttributeValue(LB_FIVEGRADEDETAILED_INFO.AGREEMENT,BoDI.getAttribute("LIMIT_END_DATE"));
|
||||
newBo.setAttributeValue(LB_FIVEGRADEDETAILED_INFO.TOTAL_FINANCING_AMOUNT,new BigDecimal(Double.parseDouble(FINANCING_AMOUNT_LOSS)+Double.parseDouble(FINANCING_AMOUNT_SUSPICIOUS)+Double.parseDouble(FINANCING_AMOUNT_SECONDARY)+Double.parseDouble(FINANCING_AMOUNT_ATTENTION)+Double.parseDouble(FINANCING_AMOUNT_NORMAL)).setScale(2, BigDecimal.ROUND_DOWN).toPlainString());
|
||||
newBo.setAttributeValue(LB_FIVEGRADEDETAILED_INFO.THE_REMAINING_AMOUNT,new BigDecimal(Double.parseDouble(BoDI.getAttribute("TOTAL").getString())-(Double.parseDouble(FINANCING_AMOUNT_LOSS)+Double.parseDouble(FINANCING_AMOUNT_SUSPICIOUS)+Double.parseDouble(FINANCING_AMOUNT_SECONDARY)+Double.parseDouble(FINANCING_AMOUNT_ATTENTION)+Double.parseDouble(FINANCING_AMOUNT_NORMAL))).setScale(2, BigDecimal.ROUND_DOWN).toPlainString());
|
||||
|
||||
newBo.setAttributeValue(LB_FIVEGRADEDETAILED_INFO.TOTAL_OVERDUE_PRINCIPAL,TOTAL_OVERDUE_PRINCIPAL);
|
||||
newBo.setAttributeValue(LB_FIVEGRADEDETAILED_INFO.TOTAL_OVERDUE_INTEREST,TOTAL_OVERDUE_INTEREST);
|
||||
newBo.setAttributeValue(LB_FIVEGRADEDETAILED_INFO.TOTAL_PENALTY, TOTAL_PENALTY);
|
||||
newBo.setAttributeValue(LB_FIVEGRADEDETAILED_INFO.TOTAL_OVERDUE_ALL, TOTAL_OVERDUE_PRINCIPAL+TOTAL_OVERDUE_INTEREST+TOTAL_PENALTY);
|
||||
newBo.setAttributeValue(LB_FIVEGRADEDETAILED_INFO.EXISTING_CUSTOMERS_NUM, Integer.parseInt(EXISTING_CUSTOMERS_NUM_NORMAL)+Integer.parseInt(EXISTING_CUSTOMERS_NUM_ATTENTION)+Integer.parseInt(EXISTING_CUSTOMERS_NUM_SUSPICIOUS)+Integer.parseInt(EXISTING_CUSTOMERS_NUM_LOSS)+Integer.parseInt(EXISTING_CUSTOMERS_NUM_SECONDARY));
|
||||
newBo.setAttributeValue(LB_FIVEGRADEDETAILED_INFO.TOTAL_OUTSTANDING_PRINCIPAL, TOTAL_OUTSTANDING_PRINCIPAL+"");
|
||||
newBo.setAttributeValue(LB_FIVEGRADEDETAILED_INFO.OVERDUERATE, (double) Math.round(TOTAL_OUTSTANDINGCUSTOMER_PRINCIPAL/TOTAL_OUTSTANDING_PRINCIPAL));
|
||||
newBo.setAttributeValue(LB_FIVEGRADEDETAILED_INFO.BADNESSRATE, (double) Math.round(NOTBACK_PRINCIPAL_LOSS+NOTBACK_PRINCIPAL_SUSPICIOUS+NOTBACK_PRINCIPAL_SECONDARY/TOTAL_OUTSTANDING_PRINCIPAL));
|
||||
|
||||
newBo.setAttributeValue(LB_FIVEGRADEDETAILED_INFO.EXISTING_CUSTOMERS_NUM_NORMAL, EXISTING_CUSTOMERS_NUM_NORMAL);
|
||||
newBo.setAttributeValue(LB_FIVEGRADEDETAILED_INFO.EXISTING_CUSTOMERS_NUM_ATTENTION, EXISTING_CUSTOMERS_NUM_ATTENTION);
|
||||
newBo.setAttributeValue(LB_FIVEGRADEDETAILED_INFO.EXISTING_CUSTOMERS_NUM_SECONDARY, EXISTING_CUSTOMERS_NUM_SECONDARY);
|
||||
newBo.setAttributeValue(LB_FIVEGRADEDETAILED_INFO.EXISTING_CUSTOMERS_NUM_SUSPICIOUS, EXISTING_CUSTOMERS_NUM_SUSPICIOUS);
|
||||
newBo.setAttributeValue(LB_FIVEGRADEDETAILED_INFO.EXISTING_CUSTOMERS_NUM_LOSS, EXISTING_CUSTOMERS_NUM_LOSS);
|
||||
|
||||
newBo.setAttributeValue(LB_FIVEGRADEDETAILED_INFO.NOTBACK_PRINCIPAL_NORMAL, NOTBACK_PRINCIPAL_NORMAL+"");
|
||||
newBo.setAttributeValue(LB_FIVEGRADEDETAILED_INFO.NOTBACK_PRINCIPAL_ATTENTION, NOTBACK_PRINCIPAL_ATTENTION);
|
||||
newBo.setAttributeValue(LB_FIVEGRADEDETAILED_INFO.NOTBACK_PRINCIPAL_SECONDARY, NOTBACK_PRINCIPAL_SECONDARY);
|
||||
newBo.setAttributeValue(LB_FIVEGRADEDETAILED_INFO.NOTBACK_PRINCIPAL_SUSPICIOUS, NOTBACK_PRINCIPAL_SUSPICIOUS);
|
||||
newBo.setAttributeValue(LB_FIVEGRADEDETAILED_INFO.NOTBACK_PRINCIPAL_LOSS, NOTBACK_PRINCIPAL_LOSS);
|
||||
|
||||
newBo.setAttributeValue(LB_FIVEGRADEDETAILED_INFO.FINANCING_AMOUNT_NORMAL, FINANCING_AMOUNT_NORMAL);
|
||||
newBo.setAttributeValue(LB_FIVEGRADEDETAILED_INFO.FINANCING_AMOUNT_ATTENTION, FINANCING_AMOUNT_ATTENTION);
|
||||
newBo.setAttributeValue(LB_FIVEGRADEDETAILED_INFO.FINANCING_AMOUNT_SECONDARY, FINANCING_AMOUNT_SECONDARY);
|
||||
newBo.setAttributeValue(LB_FIVEGRADEDETAILED_INFO.FINANCING_AMOUNT_SUSPICIOUS, FINANCING_AMOUNT_SUSPICIOUS);
|
||||
newBo.setAttributeValue(LB_FIVEGRADEDETAILED_INFO.FINANCING_AMOUNT_LOSS, FINANCING_AMOUNT_LOSS);
|
||||
bm.saveObject(newBo);
|
||||
}
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
tx.rollback();
|
||||
e.printStackTrace();
|
||||
throw new Exception("入表异常!");
|
||||
}
|
||||
}
|
||||
//type:CORPUS type:计算本金:CORPUS 计算利息 INTEREST
|
||||
//isOverdue : 是否逾期 ;true:为算出逾期对应的金额 false:为算出所有剩余未还的金额
|
||||
private double calcOverDuePrincipal(String distributorNo,String type,boolean isOverdue,String fivegrade,Transaction tx) throws Exception{
|
||||
double sumOverdueMoney = 0.00;
|
||||
String sql = " SELECT sum(lrp."+type+" - (nvl(lri."+type+" + lri."+type+"_ADJUST,0))) sumovermoney "
|
||||
+ " FROM lc_rent_plan lrp "
|
||||
+ " LEFT JOIN lc_rent_income lri ON lrp.PLAN_LIST = lri.PLAN_LIST and lri.CONTRACT_ID = lrp.CONTRACT_ID "
|
||||
+ " left join lb_contract_info lci on lci.ID = lrp.CONTRACT_ID "
|
||||
+ " @fivegrade@ "
|
||||
+ " where lci.distributor_id = '"+distributorNo+"' @overdue@ "
|
||||
+ " group by lci.distributor_id ";
|
||||
if(true==isOverdue){
|
||||
sql=sql.replaceAll("@overdue@", "and lrp.PLAN_DATE<'"+StringFunction.getTodayNow().substring(0, 10)+"'");
|
||||
}else{
|
||||
sql=sql.replaceAll("@overdue@", "");
|
||||
}
|
||||
if(fivegrade==null||fivegrade.length() == 0){
|
||||
sql=sql.replaceAll("@fivegrade@", "");
|
||||
}else{
|
||||
sql=sql.replaceAll("@fivegrade@", "inner join LC_CALC_CONDITION_STATUS lfg on lfg.five_grade ='"+fivegrade+"' and lfg.contract_id = lci.ID");
|
||||
}
|
||||
SqlObject sqlobj = new SqlObject(sql);
|
||||
ASResultSet rs = tx.getASResultSet(sqlobj);
|
||||
if(rs.next()){
|
||||
sumOverdueMoney = rs.getDouble("sumovermoney");
|
||||
}
|
||||
return sumOverdueMoney;
|
||||
}
|
||||
//逾期 罚息 合计
|
||||
private int calcOverDuePenalty(String distributorNo,Transaction tx) throws Exception{
|
||||
int sumOverdueMoney = 0;
|
||||
String sql = " SELECT sum(nvl(getRentPenalty(lrp.PAYMENT_NUMBER,lrp.PLAN_LIST,date_format('"+StringFunction.getTodayNow().substring(0, 10)+"', '%Y/%m/%d')),0)-nvl(lri.penalty+lri.penalty_adjust,0)) sumovermoney "
|
||||
+ " FROM lc_rent_plan lrp "
|
||||
+ " LEFT JOIN lc_rent_income lri ON lrp.PLAN_LIST = lri.PLAN_LIST and lri.CONTRACT_ID = lrp.CONTRACT_ID "
|
||||
+ " left join lb_contract_info lci on lci.ID = lrp.CONTRACT_ID "
|
||||
+ " where lci.distributor_id = '"+distributorNo+"' and lrp.PLAN_DATE<'"+StringFunction.getTodayNow().substring(0, 10)+"' "
|
||||
+ " group by lci.distributor_id ";
|
||||
SqlObject sqlobj = new SqlObject(sql);
|
||||
ASResultSet rs = tx.getASResultSet(sqlobj);
|
||||
if(rs.next()){
|
||||
sumOverdueMoney = rs.getInt("sumovermoney");
|
||||
}
|
||||
return sumOverdueMoney;
|
||||
}
|
||||
//获取存续客户数量
|
||||
private String getCustomerNumber(String distributorNo,String fivegrade,String type,Transaction tx) throws Exception{
|
||||
String customerNum = "0";
|
||||
String CleanLeaseMoney = "0";
|
||||
String sql = "select count(*) num ,SUM(lcc.CLEAN_LEASE_MONEY) CLEAN_LEASE_MONEY from lb_contract_info lci inner join LC_CALC_CONDITION_STATUS lfg on lfg.five_grade ='"+fivegrade+"' and lfg.contract_id = lci.ID left join lc_calc_condition lcc on lcc.contract_id = lci.id where lci.CONTRACT_STATUS='31' and lci.distributor_id = '"+distributorNo+"' group by lci.distributor_id";
|
||||
SqlObject sqlobj = new SqlObject(sql);
|
||||
ASResultSet rs = tx.getASResultSet(sqlobj);
|
||||
if(rs.next()){
|
||||
customerNum = rs.getString("num");
|
||||
CleanLeaseMoney = rs.getString("CLEAN_LEASE_MONEY");
|
||||
}
|
||||
if("custnum".equals(type)){
|
||||
return customerNum;
|
||||
}else{
|
||||
return CleanLeaseMoney;
|
||||
}
|
||||
}
|
||||
|
||||
private double calcOverDueCustomerAllCorpus(String distributorNo,Transaction tx) throws Exception{
|
||||
double sumsurpcorpus = 0.00;
|
||||
String sql = " select sum(lcc.CLEAN_LEASE_MONEY-t1.sumincomecorpus) sumsurpcorpus from "
|
||||
+ " (SELECT sum(nvl(lri.CORPUS+lri.CORPUS_ADJUST,0)) sumincomecorpus,lci.ID "
|
||||
+ " FROM lc_rent_plan lrp "
|
||||
+ " LEFT JOIN lc_rent_income lri ON lrp.PLAN_LIST = lri.PLAN_LIST and lri.CONTRACT_ID = lrp.CONTRACT_ID "
|
||||
+ " left join lb_contract_info lci on lci.ID = lrp.CONTRACT_ID "
|
||||
+ " where lrp.PLAN_DATE<'"+StringFunction.getTodayNow().substring(0, 10)+"' and (lrp.CORPUS - (nvl(lri.CORPUS + lri.CORPUS_ADJUST,0)))>0 "
|
||||
+ " group by lci.ID) t1 "
|
||||
+ " left join lc_calc_condition lcc on lcc.CONTRACT_ID = t1.ID "
|
||||
+ " left join lb_contract_info lciv on lciv.id = t1.ID "
|
||||
+ " where lciv.distributor_id = '"+distributorNo+"' "
|
||||
+ " group by lciv.distributor_id ";
|
||||
SqlObject sqlobj = new SqlObject(sql);
|
||||
ASResultSet rs = tx.getASResultSet(sqlobj);
|
||||
if(rs.next()){
|
||||
sumsurpcorpus = rs.getDouble("sumsurpcorpus");
|
||||
}
|
||||
return sumsurpcorpus;
|
||||
}
|
||||
|
||||
public String getContractId() {
|
||||
return contractId;
|
||||
}
|
||||
|
||||
public void setContractId(String contractId) {
|
||||
this.contractId = contractId;
|
||||
}
|
||||
public double getTOTAL_OVERDUE_PRINCIPAL() {
|
||||
return TOTAL_OVERDUE_PRINCIPAL;
|
||||
}
|
||||
public void setTOTAL_OVERDUE_PRINCIPAL(double tOTAL_OVERDUE_PRINCIPAL) {
|
||||
TOTAL_OVERDUE_PRINCIPAL = tOTAL_OVERDUE_PRINCIPAL;
|
||||
}
|
||||
public double getTOTAL_OVERDUE_INTEREST() {
|
||||
return TOTAL_OVERDUE_INTEREST;
|
||||
}
|
||||
public void setTOTAL_OVERDUE_INTEREST(double tOTAL_OVERDUE_INTEREST) {
|
||||
TOTAL_OVERDUE_INTEREST = tOTAL_OVERDUE_INTEREST;
|
||||
}
|
||||
public double getTOTAL_PENALTY() {
|
||||
return TOTAL_PENALTY;
|
||||
}
|
||||
public void setTOTAL_PENALTY(double tOTAL_PENALTY) {
|
||||
TOTAL_PENALTY = tOTAL_PENALTY;
|
||||
}
|
||||
@Override
|
||||
public String toString() {
|
||||
return "CreateFiveGradeDataAction [distributorNo=" + distributorNo
|
||||
+ ", TOTAL_OVERDUE_PRINCIPAL=" + TOTAL_OVERDUE_PRINCIPAL
|
||||
+ ", TOTAL_OVERDUE_INTEREST=" + TOTAL_OVERDUE_INTEREST
|
||||
+ ", TOTAL_PENALTY=" + TOTAL_PENALTY
|
||||
+ ", TOTAL_OUTSTANDING_PRINCIPAL=" + TOTAL_OUTSTANDING_PRINCIPAL
|
||||
+ ", TOTAL_OUTSTANDINGCUSTOMER_PRINCIPAL="
|
||||
+ TOTAL_OUTSTANDINGCUSTOMER_PRINCIPAL
|
||||
+ ", NOTBACK_PRINCIPAL_NORMAL=" + NOTBACK_PRINCIPAL_NORMAL
|
||||
+ ", NOTBACK_PRINCIPAL_ATTENTION=" + NOTBACK_PRINCIPAL_ATTENTION
|
||||
+ ", NOTBACK_PRINCIPAL_SECONDARY=" + NOTBACK_PRINCIPAL_SECONDARY
|
||||
+ ", NOTBACK_PRINCIPAL_SUSPICIOUS=" + NOTBACK_PRINCIPAL_SUSPICIOUS
|
||||
+ ", NOTBACK_PRINCIPAL_LOSS=" + NOTBACK_PRINCIPAL_LOSS
|
||||
+ ", EXISTING_CUSTOMERS_NUM_NORMAL="
|
||||
+ EXISTING_CUSTOMERS_NUM_NORMAL
|
||||
+ ", EXISTING_CUSTOMERS_NUM_ATTENTION="
|
||||
+ EXISTING_CUSTOMERS_NUM_ATTENTION
|
||||
+ ", EXISTING_CUSTOMERS_NUM_SECONDARY="
|
||||
+ EXISTING_CUSTOMERS_NUM_SECONDARY
|
||||
+ ", EXISTING_CUSTOMERS_NUM_SUSPICIOUS="
|
||||
+ EXISTING_CUSTOMERS_NUM_SUSPICIOUS
|
||||
+ ", EXISTING_CUSTOMERS_NUM_LOSS=" + EXISTING_CUSTOMERS_NUM_LOSS
|
||||
+ ", FINANCING_AMOUNT_NORMAL=" + FINANCING_AMOUNT_NORMAL
|
||||
+ ", FINANCING_AMOUNT_ATTENTION=" + FINANCING_AMOUNT_ATTENTION
|
||||
+ ", FINANCING_AMOUNT_SECONDARY=" + FINANCING_AMOUNT_SECONDARY
|
||||
+ ", FINANCING_AMOUNT_SUSPICIOUS=" + FINANCING_AMOUNT_SUSPICIOUS
|
||||
+ ", FINANCING_AMOUNT_LOSS=" + FINANCING_AMOUNT_LOSS + "]";
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user