APP数据统计逾期金额展示倒推一年的数据的数据

This commit is contained in:
zhangjun 2020-07-30 19:33:27 +08:00
parent 10f0fa36e2
commit 3582eddcc5

View File

@ -436,8 +436,10 @@ public class ApplyArchiveServiceImpl implements ApplyArchiveService{
Map<String, Object> testMap = (Map<String, Object>) MultipartDataUtil
.readRequestParam(request, "UTF-8");
fieldMap = (Map<String, Object>) testMap.get("fieldMap");
String orgId = fieldMap.get("belongorg") == null ? "" : fieldMap.get("belongorg").toString();
String sql = "";
sql = "select t.plan_date,t.rent,t.contract_id,sum(t.residue_rent) as residue_rent from (select lrp.plan_date,lrp.rent,lrp.contract_id,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 WHERE lrp.plan_date <NOW() group by lrp.id ) t where t.residue_rent>=0 group by t.plan_date order by t.plan_date asc limit 0,30 ";
//sql = "select t.plan_date,t.rent,t.contract_id,sum(t.residue_rent) as residue_rent from (select lrp.plan_date,lrp.rent,lrp.contract_id,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 WHERE lrp.plan_date <NOW() group by lrp.id ) t where t.residue_rent>=0 group by t.plan_date order by t.plan_date asc limit 0,30 ";
sql = "SELECT LEFT(lrp.plan_date,7),SUM(IFNULL(lrp.rent,0)),SUM(IFNULL(lrp.rent,0))-SUM(IFNULL(lri.rent,0)) AS residue_rent FROM lc_rent_plan lrp LEFT JOIN (SELECT SUM(rent) rent,contract_id,plan_list FROM lc_rent_income GROUP BY contract_id,plan_list) lri ON lrp.contract_id=lri.contract_id AND lrp.plan_list=lri.plan_list LEFT JOIN lb_contract_info lci ON lci.id=lrp.contract_id WHERE lci.distributor_id=(SELECT distributor_no FROM distributor_info WHERE orgid='"+orgId+"') AND lrp.plan_date <NOW() GROUP BY LEFT(lrp.plan_date,7) ORDER BY LEFT(lrp.plan_date,7) DESC LIMIT 0,12 ";
List<Map<String, String>> dataList = DataOperatorUtil.getDataBySql(sql);
if(dataList.size()>0){
Map<String, Object> body = new HashMap<String, Object>();