优化经销商五级分类

This commit is contained in:
tenwaPC 2019-08-14 14:07:53 +08:00
parent d7dc711adf
commit 2b5368a265

View File

@ -186,11 +186,12 @@ public class CreateFiveGradeDataAction {
double sumOverdueMoney = 0.00;
String sql = " SELECT sum(lrp."+type+" - ifnull(lri."+type+",0) - ifnull(lri."+type+"_ADJUST,0)) sumovermoney "
+ " FROM lc_rent_plan lrp "
+ " 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 (select sum("+type+") "+type+",sum("+type+"_adjust) "+type+"_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@ "
+ " group by lci.distributor_id ";
if(true==isOverdue){
sql=sql.replaceAll("@overdue@", "and lrp.PLAN_DATE<'"+StringFunction.getTodayNow().substring(0, 10)+"'");
}else{