From 1d5f9bf0edc3d15498d80809d9ff34feb6e4fcef Mon Sep 17 00:00:00 2001 From: zhangjun Date: Fri, 10 Jul 2020 19:48:19 +0800 Subject: [PATCH] =?UTF-8?q?app=E9=80=BE=E6=9C=9F=E5=AE=A2=E6=88=B7or?= =?UTF-8?q?=E9=80=BE=E6=9C=9F=E5=90=88=E5=90=8C=E6=9F=A5=E8=AF=A2sql?= =?UTF-8?q?=E4=BC=98=E5=8C=96=EF=BC=8C=E9=80=BB=E8=BE=91=E6=94=B9=E5=8F=98?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../center/service/impl/ApplyArchiveServiceImpl.java | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src_app_fresh/apx/com/amarsoft/als/user/change/center/service/impl/ApplyArchiveServiceImpl.java b/src_app_fresh/apx/com/amarsoft/als/user/change/center/service/impl/ApplyArchiveServiceImpl.java index 8db0b3a25..69efd6d4d 100644 --- a/src_app_fresh/apx/com/amarsoft/als/user/change/center/service/impl/ApplyArchiveServiceImpl.java +++ b/src_app_fresh/apx/com/amarsoft/als/user/change/center/service/impl/ApplyArchiveServiceImpl.java @@ -227,13 +227,11 @@ public class ApplyArchiveServiceImpl implements ApplyArchiveService{ Map testMap = (Map) MultipartDataUtil .readRequestParam(request, "UTF-8"); fieldMap = (Map) 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 userId = fieldMap.get("belongorg") == null ? "" : fieldMap.get("belongorg").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 lul.customer_name,cp.mobile,cp.SEX,cp.WORKCORP,cp.WORKADD,ca.fulladdress,cp.EMERGENCY_CONTACT_PERSON,lrp.contract_id,cp.customerid AS customer_id FROM lc_overdue_rent_plan lrp LEFT JOIN lb_contract_info lci ON lci.id=lrp.contract_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 lrp.plan_status='خ´½لاه' AND lci.distributor_id=(SELECT distributor_no FROM distributor_info WHERE orgid='"+userId+"') GROUP BY lrp.contract_id "; //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 =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 "; + //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> dataList = DataOperatorUtil.getDataBySql(sql); Map body = new HashMap(); @@ -250,7 +248,8 @@ public class ApplyArchiveServiceImpl implements ApplyArchiveService{ fieldMap = (Map) testMap.get("fieldMap"); String customerid = fieldMap.get("customer_id") == null ? "" : fieldMap.get("customer_id").toString(); String sql = ""; - sql = "select lrp.contract_id,lci.contract_number,lul.customer_name as lessee_name,lec.frame_number,lec.model,ifnull(sum(lrp.rent),0) - ifnull(sum(lri.rent),0) as residue_rent,lrp.rent,lcc.defaultdueday,lcc.lease_term,lrp.plan_list,lrp.penalty from lb_contract_info lci left join lc_calc_condition lcc on lcc.contract_id = lci.id left join lb_union_lessee lul on lcc.contract_id = lul.contract_id and lul.is_main = 'y' left join lb_equipment_car lec on lec.contract_id = lcc.contract_id left join lc_rent_plan lrp on lrp.contract_id=lci.id left join lc_rent_income lri on lri.plan_id=lrp.id where lul.customer_id='"+customerid+"' group by lrp.contract_id "; + //sql = "select lrp.contract_id,lci.contract_number,lul.customer_name as lessee_name,lec.frame_number,lec.model,ifnull(sum(lrp.rent),0) - ifnull(sum(lri.rent),0) as residue_rent,lrp.rent,lcc.defaultdueday,lcc.lease_term,lrp.plan_list,lrp.penalty from lb_contract_info lci left join lc_calc_condition lcc on lcc.contract_id = lci.id left join lb_union_lessee lul on lcc.contract_id = lul.contract_id and lul.is_main = 'y' left join lb_equipment_car lec on lec.contract_id = lcc.contract_id left join lc_rent_plan lrp on lrp.contract_id=lci.id left join lc_rent_income lri on lri.plan_id=lrp.id where lul.customer_id='"+customerid+"' group by lrp.contract_id "; + sql = "SELECT lrp.contract_id,lrp.contract_plan_number AS contract_number,lul.customer_name AS lessee_name,lec.frame_number,lec.model,lrp.overinterest AS residue_rent,lrp.rent,SUBSTRING(lrp.plan_date,-2) AS defaultdueday,lcc.lease_term,COUNT(*) AS plan_list,SUM(lrp.penalty) AS penalty FROM lc_overdue_rent_plan lrp LEFT JOIN lb_union_lessee lul ON lul.contract_id=lrp.contract_id AND lul.is_main = 'y' LEFT JOIN lb_equipment_car lec ON lec.contract_id = lrp.contract_id LEFT JOIN lc_calc_condition lcc ON lcc.contract_id = lrp.contract_id WHERE plan_status='خ´½لاه' AND lul.customer_id='"+customerid+"' GROUP BY lrp.contract_id "; List> dataList = DataOperatorUtil.getDataBySql(sql); Map body = new HashMap();