查询当前经销商下逾期客户信息

This commit is contained in:
zhangjun 2020-07-07 16:27:01 +08:00
parent b4491a9769
commit f3d56ce25e

View File

@ -229,9 +229,11 @@ public class ApplyArchiveServiceImpl implements ApplyArchiveService{
fieldMap = (Map<String, Object>) testMap.get("fieldMap");
String flowunid = fieldMap.get("flowunid") == null ? "" : fieldMap.get("flowunid").toString();
String contractid = fieldMap.get("contractid") == null ? "" : fieldMap.get("contractid").toString();
String distributor = fieldMap.get("distributor_no") == null ? "" : fieldMap.get("distributor_no").toString();
String sql = "";
//sql = "select O.FULLNAME,O.mobile,O.SEX,O.WORKCORP,O.WORKADD,ca.fulladdress,O.EMERGENCY_CONTACT_PERSON from CUSTOMER_PERSON_TEMP O left join CUSTOMER_ADDRESS_TEMP ca on O.customerid=ca.customerid and O.flowunid=ca.flowunid where O.flowunid='"+flowunid+"' ";
sql = "select t.FULLNAME,t.mobile,t.SEX,t.WORKCORP,t.WORKADD,t.fulladdress,t.EMERGENCY_CONTACT_PERSON,t.plan_date,sum(t.residue_rent) as residue_rent from (select cp.FULLNAME,cp.mobile,cp.SEX,cp.WORKCORP,cp.WORKADD,ca.fulladdress,cp.EMERGENCY_CONTACT_PERSON,lrp.plan_date,ifnull(sum(lrp.rent),0) - ifnull(sum(lri.rent),0) as residue_rent from lc_rent_plan lrp left join lc_rent_income lri on lri.plan_id=lrp.id left join lb_union_lessee lul on lul.CONTRACT_ID=lrp.CONTRACT_ID left join CUSTOMER_PERSON cp on cp.customerid=lul.CUSTOMER_ID left join CUSTOMER_ADDRESS ca on ca.customerid=cp.customerid WHERE lrp.plan_date <NOW() group by lrp.id) t where t.residue_rent>=0 group by t.plan_date";
//sql = "select t.FULLNAME,t.mobile,t.SEX,t.WORKCORP,t.WORKADD,t.fulladdress,t.EMERGENCY_CONTACT_PERSON,t.plan_date,sum(t.residue_rent) as residue_rent from (select cp.FULLNAME,cp.mobile,cp.SEX,cp.WORKCORP,cp.WORKADD,ca.fulladdress,cp.EMERGENCY_CONTACT_PERSON,lrp.plan_date,ifnull(sum(lrp.rent),0) - ifnull(sum(lri.rent),0) as residue_rent from lc_rent_plan lrp left join lc_rent_income lri on lri.plan_id=lrp.id left join lb_union_lessee lul on lul.CONTRACT_ID=lrp.CONTRACT_ID left join CUSTOMER_PERSON cp on cp.customerid=lul.CUSTOMER_ID left join CUSTOMER_ADDRESS ca on ca.customerid=cp.customerid WHERE lrp.plan_date <NOW() group by lrp.id) t where t.residue_rent>=0 group by t.plan_date";
sql = "SELECT t.FULLNAME,t.mobile,t.SEX,t.WORKCORP,t.WORKADD,t.fulladdress,t.EMERGENCY_CONTACT_PERSON,t.plan_date,t.residue_rent AS residue_rent FROM (SELECT cp.FULLNAME,cp.mobile,cp.SEX,cp.WORKCORP,cp.WORKADD,ca.fulladdress,cp.EMERGENCY_CONTACT_PERSON,lrp.plan_date,IFNULL(lrp.rent, 0) - SUM(IFNULL(lri.rent, 0)) AS residue_rent FROM lc_rent_plan lrp LEFT JOIN lc_rent_income lri ON lri.plan_id = lrp.id LEFT JOIN lb_contract_info lci ON lrp.contract_id=lci.id LEFT JOIN lb_union_lessee lul ON lul.CONTRACT_ID = lrp.CONTRACT_ID LEFT JOIN CUSTOMER_PERSON cp ON cp.customerid = lul.CUSTOMER_ID LEFT JOIN CUSTOMER_ADDRESS ca ON ca.customerid = cp.customerid WHERE lrp.plan_date < NOW() AND lci.distributor_id='"+distributor+"' GROUP BY lrp.id) t WHERE t.residue_rent > 0 ";
List<Map<String, String>> dataList = DataOperatorUtil.getDataBySql(sql);
Map<String, Object> body = new HashMap<String, Object>();