经销商五级分类优化
This commit is contained in:
parent
692bf60913
commit
5658ff2b34
@ -184,9 +184,9 @@ public class CreateFiveGradeDataAction {
|
||||
//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 "
|
||||
String sql = " SELECT sum(lrp."+type+" - ifnull(lri."+type+",0) - ifnull(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 (select sum(corpus) corpus,sum(corpus_adjust) corpus_adjust,CONTRACT_ID,PLAN_LIST from lc_rent_income group by CONTRACT_ID,PLAN_LIST ) 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@ "
|
||||
@ -212,7 +212,7 @@ public class CreateFiveGradeDataAction {
|
||||
double sumOverdueMoney = 0.00;
|
||||
String sql = " SELECT sum(lrp.CORPUS - ifnull(lri.CORPUS,0) - ifnull(lri.CORPUS_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 (select sum(corpus) corpus,sum(corpus_adjust) corpus_adjust,CONTRACT_ID,PLAN_LIST from lc_rent_income group by CONTRACT_ID,PLAN_LIST ) 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 is not null ";
|
||||
|
||||
SqlObject sqlobj = new SqlObject(sql);
|
||||
@ -225,9 +225,9 @@ public class CreateFiveGradeDataAction {
|
||||
//逾期 罚息 合计
|
||||
private double calcOverDuePenalty(String distributorNo,Transaction tx) throws Exception{
|
||||
double 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 "
|
||||
String sql = " SELECT sum(ifnull(getRentPenalty(lrp.PAYMENT_NUMBER,lrp.PLAN_LIST,date_format('"+StringFunction.getTodayNow().substring(0, 10)+"', '%Y/%m/%d')),0)-ifnull(lri.penalty,0)-ifnull(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 (select sum(penalty) penalty,sum(penalty_adjust) penalty_adjust,CONTRACT_ID,PLAN_LIST from lc_rent_income group by CONTRACT_ID,PLAN_LIST ) 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 ";
|
||||
@ -259,9 +259,9 @@ public class CreateFiveGradeDataAction {
|
||||
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 "
|
||||
+ " (SELECT sum(ifnull(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 (select sum(corpus) corpus,sum(corpus_adjust) corpus_adjust,CONTRACT_ID,PLAN_LIST from lc_rent_income group by CONTRACT_ID,PLAN_LIST ) 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 - ifnull(lri.CORPUS,0) - ifnull(lri.CORPUS_ADJUST,0))>0 "
|
||||
+ " group by lci.ID) t1 "
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user