From 0209a09e63d33622fe8c0f6dafa77aff20ef4e65 Mon Sep 17 00:00:00 2001 From: tangfutang Date: Mon, 27 Jul 2020 18:14:19 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=9D=E5=AD=98=E6=89=A3=E6=AC=BE=E5=8D=A1?= =?UTF-8?q?=E9=99=84=E4=BB=B6=E5=92=8C=E5=90=88=E5=90=8C=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E6=A8=A1=E7=B3=8A=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/BusinessDataServiceImpl.java | 5 +- .../service/impl/ContractMakeServiceImpl.java | 32 +++- .../service/Impl/FlowDataServiceImpl.java | 138 +++++++++++++++++- 3 files changed, 164 insertions(+), 11 deletions(-) diff --git a/src_app_fresh/apx/com/amarsoft/als/apzl/apply/business/data/service/impl/BusinessDataServiceImpl.java b/src_app_fresh/apx/com/amarsoft/als/apzl/apply/business/data/service/impl/BusinessDataServiceImpl.java index bdb595376..649b9db1c 100644 --- a/src_app_fresh/apx/com/amarsoft/als/apzl/apply/business/data/service/impl/BusinessDataServiceImpl.java +++ b/src_app_fresh/apx/com/amarsoft/als/apzl/apply/business/data/service/impl/BusinessDataServiceImpl.java @@ -116,7 +116,7 @@ public class BusinessDataServiceImpl implements BusinessDataService { String userid = fieldMap.get("userid") == null ? "" : fieldMap.get("userid").toString(); String brandid = fieldMap.get("brandid") == null ? "" : fieldMap.get("brandid").toString(); String carseriesid = fieldMap.get("carseriesid") == null ? "" : fieldMap.get("carseriesid").toString(); - + String frame_number = fieldMap.get("frame_number") == null ? "" : fieldMap.get("frame_number").toString(); Map body = new HashMap(); ASUser asUser = new ASUser(userid); BizObjectManager lbacm = JBOFactory.getBizObjectManager(LB_BEFORE_APPLICATION_CONFIG.CLASS_NAME); @@ -201,7 +201,8 @@ public class BusinessDataServiceImpl implements BusinessDataService { lba.setAttributeValue("modelId", modelId); lba.setAttributeValue("carseries", carseries); lba.setAttributeValue("mile", mile); - lba.setAttributeValue("frame_number", age_limit); + lba.setAttributeValue("age_limit", age_limit); + lba.setAttributeValue("frame_number", frame_number); lba.setAttributeValue("price", price); lba.setAttributeValue("carattributes", carattributes); lba.setAttributeValue("liter", liter); diff --git a/src_app_fresh/apx/com/amarsoft/als/apzl/apply/contract/make/service/impl/ContractMakeServiceImpl.java b/src_app_fresh/apx/com/amarsoft/als/apzl/apply/contract/make/service/impl/ContractMakeServiceImpl.java index 8b25354f1..fa0d3ebc1 100644 --- a/src_app_fresh/apx/com/amarsoft/als/apzl/apply/contract/make/service/impl/ContractMakeServiceImpl.java +++ b/src_app_fresh/apx/com/amarsoft/als/apzl/apply/contract/make/service/impl/ContractMakeServiceImpl.java @@ -50,14 +50,20 @@ public class ContractMakeServiceImpl implements ContractMakeService{ .readRequestParam(request, "UTF-8"); fieldMap = (Map) testMap.get("fieldMap"); // 参数 String userId = fieldMap.get("userid") == null ? "" : fieldMap.get("userid").toString(); + String vagueCondition = fieldMap.get("vagueCondition") == null ? "" : fieldMap.get("vagueCondition").toString(); Map body = new HashMap(); ASUser asUser = new ASUser(userId); String orgID = asUser.getOrgID(); String sql = ""; if("8006011".equals(orgID)){ - sql = "SELECT lpi.END_DATE AS startdate,lpi.id projectid, lpi.product_id, lpi.project_no, lpi.project_name, ci.customername, getItemName ('CertType', ci.certtype) certtype, ci.certid, getUserName (lpi.project_manage) AS project_manage, getOrgLevelName (lpi.project_dept) project_dept, ci.customertype,lpi.leas_form,lpi.CAR_TYPE,lpi.IS_NETCAR,psl.operationType,psl.signType,psl.sealType,lpi.subjectid,lpi.subjectname,lpc.CLEAN_LEASE_MONEY AS clean_lease_money,lpc.INCOME_NUMBER AS income_number,lec.MODEL AS model,lprp.RENT AS rent FROM LB_PROJECT_INFO lpi LEFT JOIN LC_PROJ_CONDITION lpc ON lpi.id=lpc.project_id LEFT JOIN LB_CONTRACT_INFO lci ON lpi.id=lci.project_id LEFT JOIN LC_CONTRACT_CONDITION lcc ON lci.id=lcc.contract_id LEFT JOIN LB_UNION_LESSEE lult ON lpi.id = lult.project_id AND (lult.contract_id = '' OR lult.contract_id IS NULL) LEFT JOIN CUSTOMER_INFO ci ON lult.customer_id = ci.customerid LEFT JOIN PRD_SPECIFIC_LIBRARY psl ON psl.productid=lpi.product_id LEFT JOIN LB_EQUIPMENT_CAR lec ON lec.project_id=lpi.id LEFT JOIN LC_PROJ_RENT_PLAN lprp ON lprp.project_id=lpi.id AND lprp.plan_list='1' WHERE lult.is_main = 'y' AND lpi.project_status = '13' AND((lci.contract_status = '21' AND lpc.equip_amt>lcc.equip_amt) OR ((lult.CONTRACT_ID='' OR lult.CONTRACT_ID IS NULL)AND (SELECT COUNT(*) FROM lb_contract_info WHERE project_id=lpi.id)=0)) AND lpi.INPUTORGID='"+orgID+"' AND lpi.businesstype='1' ORDER BY lpi.END_DATE DESC"; + sql = "SELECT lpi.END_DATE AS startdate,lpi.id projectid, lpi.product_id, lpi.project_no, lpi.project_name, ci.customername, getItemName ('CertType', ci.certtype) certtype, ci.certid, getUserName (lpi.project_manage) AS project_manage, getOrgLevelName (lpi.project_dept) project_dept, ci.customertype,lpi.leas_form,lpi.CAR_TYPE,lpi.IS_NETCAR,psl.operationType,psl.signType,psl.sealType,lpi.subjectid,lpi.subjectname,lpc.CLEAN_LEASE_MONEY AS clean_lease_money,lpc.INCOME_NUMBER AS income_number,lec.MODEL AS model,lprp.RENT AS rent FROM LB_PROJECT_INFO lpi LEFT JOIN LC_PROJ_CONDITION lpc ON lpi.id=lpc.project_id LEFT JOIN LB_CONTRACT_INFO lci ON lpi.id=lci.project_id LEFT JOIN LC_CONTRACT_CONDITION lcc ON lci.id=lcc.contract_id LEFT JOIN LB_UNION_LESSEE lult ON lpi.id = lult.project_id AND (lult.contract_id = '' OR lult.contract_id IS NULL) LEFT JOIN CUSTOMER_INFO ci ON lult.customer_id = ci.customerid LEFT JOIN PRD_SPECIFIC_LIBRARY psl ON psl.productid=lpi.product_id LEFT JOIN LB_EQUIPMENT_CAR lec ON lec.project_id=lpi.id LEFT JOIN LC_PROJ_RENT_PLAN lprp ON lprp.project_id=lpi.id AND lprp.plan_list='1' WHERE lult.is_main = 'y' AND lpi.project_status = '13' AND((lci.contract_status = '21' AND lpc.equip_amt>lcc.equip_amt) OR ((lult.CONTRACT_ID='' OR lult.CONTRACT_ID IS NULL)AND (SELECT COUNT(*) FROM lb_contract_info WHERE project_id=lpi.id)=0)) AND lpi.INPUTORGID='"+orgID+"'"; }else{ - sql="SELECT lpi.END_DATE AS startdate,lpi.id projectid, lpi.product_id, lpi.project_no, lpi.project_name, ci.customername, getItemName ('CertType', ci.certtype) certtype, ci.certid, getUserName (lpi.project_manage) AS project_manage, getOrgLevelName (lpi.project_dept) project_dept, ci.customertype,lpi.leas_form,lpi.CAR_TYPE,lpi.IS_NETCAR,psl.operationType,psl.signType,psl.sealType,lpi.subjectid,lpi.subjectname,lpc.CLEAN_LEASE_MONEY AS clean_lease_money,lpc.INCOME_NUMBER AS income_number,lec.MODEL AS model,lprp.RENT AS rent FROM LB_PROJECT_INFO lpi LEFT JOIN LC_PROJ_CONDITION lpc ON lpi.id=lpc.project_id LEFT JOIN LB_CONTRACT_INFO lci ON lpi.id=lci.project_id LEFT JOIN LC_CONTRACT_CONDITION lcc ON lci.id=lcc.contract_id LEFT JOIN LB_UNION_LESSEE lult ON lpi.id = lult.project_id AND (lult.contract_id = '' OR lult.contract_id IS NULL) LEFT JOIN CUSTOMER_INFO ci ON lult.customer_id = ci.customerid LEFT JOIN PRD_SPECIFIC_LIBRARY psl ON psl.productid=lpi.product_id LEFT JOIN LB_EQUIPMENT_CAR lec ON lec.project_id=lpi.id LEFT JOIN LC_PROJ_RENT_PLAN lprp ON lprp.project_id=lpi.id AND lprp.plan_list='1' WHERE lult.is_main = 'y' AND lpi.project_status = '13' AND((lci.contract_status = '21' AND lpc.equip_amt>lcc.equip_amt) OR ((lult.CONTRACT_ID='' OR lult.CONTRACT_ID IS NULL)AND (SELECT COUNT(*) FROM lb_contract_info WHERE project_id=lpi.id)=0)) AND lpi.PROJECT_MANAGE='"+userId+"' AND lpi.businesstype='1' ORDER BY lpi.END_DATE DESC"; + sql="SELECT lpi.END_DATE AS startdate,lpi.id projectid, lpi.product_id, lpi.project_no, lpi.project_name, ci.customername, getItemName ('CertType', ci.certtype) certtype, ci.certid, getUserName (lpi.project_manage) AS project_manage, getOrgLevelName (lpi.project_dept) project_dept, ci.customertype,lpi.leas_form,lpi.CAR_TYPE,lpi.IS_NETCAR,psl.operationType,psl.signType,psl.sealType,lpi.subjectid,lpi.subjectname,lpc.CLEAN_LEASE_MONEY AS clean_lease_money,lpc.INCOME_NUMBER AS income_number,lec.MODEL AS model,lprp.RENT AS rent FROM LB_PROJECT_INFO lpi LEFT JOIN LC_PROJ_CONDITION lpc ON lpi.id=lpc.project_id LEFT JOIN LB_CONTRACT_INFO lci ON lpi.id=lci.project_id LEFT JOIN LC_CONTRACT_CONDITION lcc ON lci.id=lcc.contract_id LEFT JOIN LB_UNION_LESSEE lult ON lpi.id = lult.project_id AND (lult.contract_id = '' OR lult.contract_id IS NULL) LEFT JOIN CUSTOMER_INFO ci ON lult.customer_id = ci.customerid LEFT JOIN PRD_SPECIFIC_LIBRARY psl ON psl.productid=lpi.product_id LEFT JOIN LB_EQUIPMENT_CAR lec ON lec.project_id=lpi.id LEFT JOIN LC_PROJ_RENT_PLAN lprp ON lprp.project_id=lpi.id AND lprp.plan_list='1' WHERE lult.is_main = 'y' AND lpi.project_status = '13' AND((lci.contract_status = '21' AND lpc.equip_amt>lcc.equip_amt) OR ((lult.CONTRACT_ID='' OR lult.CONTRACT_ID IS NULL)AND (SELECT COUNT(*) FROM lb_contract_info WHERE project_id=lpi.id)=0)) AND lpi.PROJECT_MANAGE='"+userId+"'"; + } + if(vagueCondition.length() ==0 ){ + sql = sql+ " AND lpi.businesstype='1' ORDER BY lpi.END_DATE DESC "; + }else{ + sql = sql+ " and (lpi.project_no like '%"+vagueCondition+"%' or ci.customername like '%"+vagueCondition+"%') AND lpi.businesstype='1' ORDER BY lpi.END_DATE DESC "; } List> dataList = DataOperatorUtil.getDataBySql(sql); body.put("datas", dataList); @@ -400,14 +406,21 @@ public class ContractMakeServiceImpl implements ContractMakeService{ .readRequestParam(request, "UTF-8"); fieldMap = (Map) testMap.get("fieldMap"); // 参数 String userId = fieldMap.get("userid") == null ? "" : fieldMap.get("userid").toString(); + String vagueCondition = fieldMap.get("vagueCondition") == null ? "" : fieldMap.get("vagueCondition").toString(); + Map body = new HashMap(); ASUser asUser = new ASUser(userId); String orgID = asUser.getOrgID(); String sql = ""; if("8006011".equals(orgID)){ - sql = "SELECT lpi.END_DATE AS startdate,lci.id as contractid,lult.project_id as projectid,lci.product_id,lci.contract_no flowkey,lci.contract_number,lci.project_name,ci.customername,getItemName('CertType',ci.certtype) certtype,ci.certid,getUserName(lci.project_manage) AS project_manage,getOrgLevelName(lci.project_dept) project_dept,ci.customertype,lci.leas_form,lpi.CAR_TYPE,lpi.IS_NETCAR,psl.operationType,psl.sealType,psl.signType,lci.subjectid,lci.subjectname,lci.inputorgid,lpi.project_no as project_no,lpc.CLEAN_LEASE_MONEY AS clean_lease_money,lpc.INCOME_NUMBER AS income_number,lec.MODEL AS model,lprp.RENT AS rent FROM LB_CONTRACT_INFO lci LEFT JOIN LB_PROJECT_INFO lpi ON lpi.id = lci.project_id LEFT JOIN LB_UNION_LESSEE lult ON lci.id=lult.contract_id LEFT JOIN CUSTOMER_INFO ci ON lult.customer_id=ci.customerid LEFT JOIN PRD_SPECIFIC_LIBRARY psl ON psl.productid = lpi.product_id LEFT JOIN LB_EQUIPMENT_CAR lec ON lec.project_id=lpi.id LEFT JOIN LC_PROJ_RENT_PLAN lprp ON lprp.project_id=lpi.id AND lprp.plan_list='1' LEFT JOIN LC_PROJ_CONDITION lpc ON lpi.id=lpc.project_id WHERE lult.is_main='y' AND lci.businesstype='1' AND NOT EXISTS (SELECT 1 FROM LC_CALC_CONDITION_STATUS ccs WHERE ccs.contract_id=lci.id) AND contract_status='21' AND lci.inputorgid='"+orgID+"' ORDER BY lci.contract_number DESC"; + sql = "SELECT lpi.END_DATE AS startdate,lci.id as contractid,lult.project_id as projectid,lci.product_id,lci.contract_no flowkey,lci.contract_number,lci.project_name,ci.customername,getItemName('CertType',ci.certtype) certtype,ci.certid,getUserName(lci.project_manage) AS project_manage,getOrgLevelName(lci.project_dept) project_dept,ci.customertype,lci.leas_form,lpi.CAR_TYPE,lpi.IS_NETCAR,psl.operationType,psl.sealType,psl.signType,lci.subjectid,lci.subjectname,lci.inputorgid,lpi.project_no as project_no,lpc.CLEAN_LEASE_MONEY AS clean_lease_money,lpc.INCOME_NUMBER AS income_number,lec.MODEL AS model,lprp.RENT AS rent FROM LB_CONTRACT_INFO lci LEFT JOIN LB_PROJECT_INFO lpi ON lpi.id = lci.project_id LEFT JOIN LB_UNION_LESSEE lult ON lci.id=lult.contract_id LEFT JOIN CUSTOMER_INFO ci ON lult.customer_id=ci.customerid LEFT JOIN PRD_SPECIFIC_LIBRARY psl ON psl.productid = lpi.product_id LEFT JOIN LB_EQUIPMENT_CAR lec ON lec.project_id=lpi.id LEFT JOIN LC_PROJ_RENT_PLAN lprp ON lprp.project_id=lpi.id AND lprp.plan_list='1' LEFT JOIN LC_PROJ_CONDITION lpc ON lpi.id=lpc.project_id WHERE lult.is_main='y' AND lci.businesstype='1' AND NOT EXISTS (SELECT 1 FROM LC_CALC_CONDITION_STATUS ccs WHERE ccs.contract_id=lci.id) AND contract_status='21' AND lci.inputorgid='"+orgID+"' "; }else{ - sql="SELECT lpi.END_DATE AS startdate,lci.id as contractid,lult.project_id as projectid,lci.product_id,lci.contract_no flowkey,lci.contract_number,lci.project_name,ci.customername,getItemName('CertType',ci.certtype) certtype,ci.certid,getUserName(lci.project_manage) AS project_manage,getOrgLevelName(lci.project_dept) project_dept,ci.customertype,lci.leas_form,lpi.CAR_TYPE,lpi.IS_NETCAR,psl.operationType,psl.sealType,psl.signType,lci.subjectid,lci.subjectname,lci.inputuserid,lpi.project_no as project_no,lpc.CLEAN_LEASE_MONEY AS clean_lease_money,lpc.INCOME_NUMBER AS income_number,lec.MODEL AS model,lprp.RENT AS rent FROM LB_CONTRACT_INFO lci LEFT JOIN LB_PROJECT_INFO lpi ON lpi.id = lci.project_id LEFT JOIN LB_UNION_LESSEE lult ON lci.id=lult.contract_id LEFT JOIN CUSTOMER_INFO ci ON lult.customer_id=ci.customerid LEFT JOIN PRD_SPECIFIC_LIBRARY psl ON psl.productid = lpi.product_id LEFT JOIN LB_EQUIPMENT_CAR lec ON lec.project_id=lpi.id LEFT JOIN LC_PROJ_RENT_PLAN lprp ON lprp.project_id=lpi.id AND lprp.plan_list='1' LEFT JOIN LC_PROJ_CONDITION lpc ON lpi.id=lpc.project_id WHERE lult.is_main='y' AND lci.businesstype='1' AND NOT EXISTS (SELECT 1 FROM LC_CALC_CONDITION_STATUS ccs WHERE ccs.contract_id=lci.id) AND contract_status='21' AND lci.inputuserid='"+userId+"' ORDER BY lci.contract_number DESC "; + sql="SELECT lpi.END_DATE AS startdate,lci.id as contractid,lult.project_id as projectid,lci.product_id,lci.contract_no flowkey,lci.contract_number,lci.project_name,ci.customername,getItemName('CertType',ci.certtype) certtype,ci.certid,getUserName(lci.project_manage) AS project_manage,getOrgLevelName(lci.project_dept) project_dept,ci.customertype,lci.leas_form,lpi.CAR_TYPE,lpi.IS_NETCAR,psl.operationType,psl.sealType,psl.signType,lci.subjectid,lci.subjectname,lci.inputuserid,lpi.project_no as project_no,lpc.CLEAN_LEASE_MONEY AS clean_lease_money,lpc.INCOME_NUMBER AS income_number,lec.MODEL AS model,lprp.RENT AS rent FROM LB_CONTRACT_INFO lci LEFT JOIN LB_PROJECT_INFO lpi ON lpi.id = lci.project_id LEFT JOIN LB_UNION_LESSEE lult ON lci.id=lult.contract_id LEFT JOIN CUSTOMER_INFO ci ON lult.customer_id=ci.customerid LEFT JOIN PRD_SPECIFIC_LIBRARY psl ON psl.productid = lpi.product_id LEFT JOIN LB_EQUIPMENT_CAR lec ON lec.project_id=lpi.id LEFT JOIN LC_PROJ_RENT_PLAN lprp ON lprp.project_id=lpi.id AND lprp.plan_list='1' LEFT JOIN LC_PROJ_CONDITION lpc ON lpi.id=lpc.project_id WHERE lult.is_main='y' AND lci.businesstype='1' AND NOT EXISTS (SELECT 1 FROM LC_CALC_CONDITION_STATUS ccs WHERE ccs.contract_id=lci.id) AND contract_status='21' AND lci.inputuserid='"+userId+"' "; + } + if(vagueCondition.length() ==0 ){ + sql = sql+ " ORDER BY lci.contract_number DESC "; + }else{ + sql = sql+ " and (lci.contract_number like '%"+vagueCondition+"%' or lpi.project_no like '%"+vagueCondition+"%' or ci.customername like '%"+vagueCondition+"%') ORDER BY lci.contract_number DESC "; } List> dataList = DataOperatorUtil.getDataBySql(sql); body.put("datas", dataList); @@ -424,14 +437,21 @@ public class ContractMakeServiceImpl implements ContractMakeService{ .readRequestParam(request, "UTF-8"); fieldMap = (Map) testMap.get("fieldMap"); // 参数 String userId = fieldMap.get("userid") == null ? "" : fieldMap.get("userid").toString(); + String vagueCondition = fieldMap.get("vagueCondition") == null ? "" : fieldMap.get("vagueCondition").toString(); + Map body = new HashMap(); ASUser asUser = new ASUser(userId); String orgID = asUser.getOrgID(); String sql = ""; if("8006011".equals(orgID)){ - sql = "SELECT lpi.END_DATE AS startdate,lci.id as contractid,lult.project_id as projectid ,lci.product_id,lci.contract_no FlowKey,lci.contract_number,lci.project_name,ci.customername,getItemName('CertType',ci.certtype) certtype,ci.certid,getUserName(lci.project_manage) as project_manage,getOrgLevelName(lci.project_dept) project_dept,ci.customertype,lci.car_type,lci.leas_form,lpi.project_no as project_no,lpc.CLEAN_LEASE_MONEY AS clean_lease_money,lpc.INCOME_NUMBER AS income_number,lec.MODEL AS model,lprp.RENT AS rent FROM LB_CONTRACT_INFO lci LEFT JOIN lb_project_info lpi ON lpi.id=lci.project_id LEFT JOIN LB_UNION_LESSEE lult on lci.id=lult.contract_id LEFT JOIN CUSTOMER_INFO ci on lult.customer_id=ci.customerid LEFT JOIN LB_EQUIPMENT_CAR lec ON lec.project_id=lpi.id LEFT JOIN LC_PROJ_RENT_PLAN lprp ON lprp.project_id=lpi.id AND lprp.plan_list='1' LEFT JOIN LC_PROJ_CONDITION lpc ON lpi.id=lpc.project_id where lult.is_main='y' and lci.businesstype = '1' and not EXISTS (select 1 from LC_CALC_CONDITION_STATUS ccs where ccs.contract_id=lci.id) and contract_status='21' and lci.inputorgid='"+orgID+"' order by lci.contract_number desc"; + sql = "SELECT lpi.END_DATE AS startdate,lci.id as contractid,lult.project_id as projectid ,lci.product_id,lci.contract_no FlowKey,lci.contract_number,lci.project_name,ci.customername,getItemName('CertType',ci.certtype) certtype,ci.certid,getUserName(lci.project_manage) as project_manage,getOrgLevelName(lci.project_dept) project_dept,ci.customertype,lci.car_type,lci.leas_form,lpi.project_no as project_no,lpc.CLEAN_LEASE_MONEY AS clean_lease_money,lpc.INCOME_NUMBER AS income_number,lec.MODEL AS model,lprp.RENT AS rent FROM LB_CONTRACT_INFO lci LEFT JOIN lb_project_info lpi ON lpi.id=lci.project_id LEFT JOIN LB_UNION_LESSEE lult on lci.id=lult.contract_id LEFT JOIN CUSTOMER_INFO ci on lult.customer_id=ci.customerid LEFT JOIN LB_EQUIPMENT_CAR lec ON lec.project_id=lpi.id LEFT JOIN LC_PROJ_RENT_PLAN lprp ON lprp.project_id=lpi.id AND lprp.plan_list='1' LEFT JOIN LC_PROJ_CONDITION lpc ON lpi.id=lpc.project_id where lult.is_main='y' and lci.businesstype = '1' and not EXISTS (select 1 from LC_CALC_CONDITION_STATUS ccs where ccs.contract_id=lci.id) and contract_status='21' and lci.inputorgid='"+orgID+"' "; }else{ - sql="SELECT lpi.END_DATE AS startdate,lci.id as contractid,lult.project_id as projectid, lci.product_id,lci.contract_no FlowKey,lci.contract_number,lci.project_name,ci.customername,getItemName('CertType',ci.certtype) certtype,ci.certid,getUserName(lci.project_manage) AS project_manage,getOrgLevelName(lci.project_dept) project_dept,ci.customertype,lci.car_type,lci.leas_form,lpi.project_no as project_no,lpc.CLEAN_LEASE_MONEY AS clean_lease_money,lpc.INCOME_NUMBER AS income_number,lec.MODEL AS model,lprp.RENT AS rent FROM LB_CONTRACT_INFO lci LEFT JOIN lb_project_info lpi ON lpi.id=lci.project_id LEFT JOIN LB_UNION_LESSEE lult ON lci.id=lult.contract_id LEFT JOIN CUSTOMER_INFO ci ON lult.customer_id=ci.customerid LEFT JOIN LB_EQUIPMENT_CAR lec ON lec.project_id=lpi.id LEFT JOIN LC_PROJ_RENT_PLAN lprp ON lprp.project_id=lpi.id AND lprp.plan_list='1' LEFT JOIN LC_PROJ_CONDITION lpc ON lpi.id=lpc.project_id WHERE lult.is_main='y' AND lci.businesstype = '1' AND NOT EXISTS (SELECT 1 FROM LC_CALC_CONDITION_STATUS ccs WHERE ccs.contract_id=lci.id) AND contract_status='21' AND lci.PROJECT_MANAGE='"+userId+"' ORDER BY lci.contract_number DESC"; + sql="SELECT lpi.END_DATE AS startdate,lci.id as contractid,lult.project_id as projectid, lci.product_id,lci.contract_no FlowKey,lci.contract_number,lci.project_name,ci.customername,getItemName('CertType',ci.certtype) certtype,ci.certid,getUserName(lci.project_manage) AS project_manage,getOrgLevelName(lci.project_dept) project_dept,ci.customertype,lci.car_type,lci.leas_form,lpi.project_no as project_no,lpc.CLEAN_LEASE_MONEY AS clean_lease_money,lpc.INCOME_NUMBER AS income_number,lec.MODEL AS model,lprp.RENT AS rent FROM LB_CONTRACT_INFO lci LEFT JOIN lb_project_info lpi ON lpi.id=lci.project_id LEFT JOIN LB_UNION_LESSEE lult ON lci.id=lult.contract_id LEFT JOIN CUSTOMER_INFO ci ON lult.customer_id=ci.customerid LEFT JOIN LB_EQUIPMENT_CAR lec ON lec.project_id=lpi.id LEFT JOIN LC_PROJ_RENT_PLAN lprp ON lprp.project_id=lpi.id AND lprp.plan_list='1' LEFT JOIN LC_PROJ_CONDITION lpc ON lpi.id=lpc.project_id WHERE lult.is_main='y' AND lci.businesstype = '1' AND NOT EXISTS (SELECT 1 FROM LC_CALC_CONDITION_STATUS ccs WHERE ccs.contract_id=lci.id) AND contract_status='21' AND lci.PROJECT_MANAGE='"+userId+"' "; + } + if(vagueCondition.length() ==0 ){ + sql = sql+ " order by lci.contract_number desc "; + }else{ + sql = sql+ " and (lci.contract_number like '%"+vagueCondition+"%' or lpi.project_no like '%"+vagueCondition+"%' or ci.customername like '%"+vagueCondition+"%') ORDER BY lci.contract_number DESC "; } List> dataList = DataOperatorUtil.getDataBySql(sql); body.put("datas", dataList); diff --git a/src_app_fresh/apx/com/amarsoft/als/apzl/flow/data/service/Impl/FlowDataServiceImpl.java b/src_app_fresh/apx/com/amarsoft/als/apzl/flow/data/service/Impl/FlowDataServiceImpl.java index 15cc5a698..58c0c92af 100644 --- a/src_app_fresh/apx/com/amarsoft/als/apzl/flow/data/service/Impl/FlowDataServiceImpl.java +++ b/src_app_fresh/apx/com/amarsoft/als/apzl/flow/data/service/Impl/FlowDataServiceImpl.java @@ -1,10 +1,18 @@ package apx.com.amarsoft.als.apzl.flow.data.service.Impl; +import java.awt.image.BufferedImage; +import java.io.DataOutputStream; +import java.io.File; +import java.io.FileOutputStream; +import java.io.InputStream; import java.math.BigDecimal; +import java.net.URLDecoder; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.regex.Pattern; +import javax.imageio.ImageIO; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -12,6 +20,8 @@ import jbo.app.tenwa.customer.CUSTOMER_ACCOUNT; import jbo.app.tenwa.customer.CUSTOMER_ACCOUNT_HIS; import jbo.app.tenwa.customer.CUSTOMER_ACCOUNT_TEMP; import jbo.app.tenwa.customer.CUSTOMER_INFO_TEMP; +import jbo.app.tenwa.doc.LB_DOCLIBRARY; +import jbo.app.tenwa.doc.LB_DOCRELATIVE; import jbo.app.tenwa.doc.LB_DOC_CONTRACT_LIST; import jbo.com.tenwa.lease.comm.LB_EQUIPMENT_CAR_TEMP; import jbo.com.tenwa.lease.comm.LB_UNION_LESSEE; @@ -22,6 +32,8 @@ import com.amarsoft.are.jbo.BizObject; import com.amarsoft.are.jbo.BizObjectManager; import com.amarsoft.are.jbo.JBOFactory; import com.amarsoft.are.jbo.JBOTransaction; +import com.amarsoft.are.util.StringFunction; +import com.amarsoft.awe.Configure; import com.amarsoft.awe.util.Transaction; import com.amarsoft.context.ASUser; import com.amarsoft.dict.als.manage.NameManager; @@ -60,6 +72,10 @@ public class FlowDataServiceImpl implements FlowDataService{ body.put("mobile", map.get("mobile")+""); body.put("certid", map.get("certid")+""); } + //获取扣款文件id + String fileSql = "select lda.id as fileid from LB_DOCRELATIVE ldra left join LB_DOCLIBRARY ldc on ldc.RELATIVE_ID=ldra.id and ldc.DOC_NAME='还款卡(正反面)' left join LB_DOCATTRIBUTE lda on lda.library_id=ldc.id where ldra.objecttype='BusinessApplyFlow' and ldra.proj_id='"+dataList.get(0).get("project_id")+"' and lda.deleteed is null limit 0,2 "; + List> fileList = DataOperatorUtil.getDataBySql(fileSql); + body.put("attributeid", fileList); }else{ BizObject lult = this.getLult(flowunid); if(lult!=null){ @@ -87,11 +103,23 @@ public class FlowDataServiceImpl implements FlowDataService{ Map testMap = (Map) MultipartDataUtil.readRequestParam(request, "UTF-8"); BizObjectManager catManage = JBOFactory.getBizObjectManager(CUSTOMER_ACCOUNT_TEMP.CLASS_NAME,sqlca); + System.out.println("============业务申请扣款卡信息保存参数====================="); + System.out.println(testMap); + System.out.println("==================================================="); fieldMap = (Map) testMap.get("fieldMap"); // 参数 + List> fileList = (List>) testMap.get("fileList"); String flowunid = fieldMap.get("flowunid") == null ? "" : fieldMap.get("flowunid").toString(); - String userid = fieldMap.get("acc_number") == null ? "" : fieldMap.get("acc_number").toString(); + String userid = fieldMap.get("userid") == null ? "" : fieldMap.get("userid").toString(); ASUser CurUser = new ASUser(userid, sqlca); - + //保存扣款卡对应的图片信息 + if(fileList!=null&&fileList.size()>0){ + Map flowParms = ContractMakeControllerUtil.getFlowParms(flowunid); + if(flowParms == null){ + ReturnMapUtil.setReturnMap(null,RestfullConstant.baseProperty.get("fail").toString(), "没有查询到对应的流程实例!"); + return ReturnMapUtil.getReturnMap(); + } + this.savaBankCardFile(flowParms.get("ProjectId"), flowParms.get("ApplyType"), fileList, CurUser, tx); + } BizObject cat = catManage.createQuery(" flowunid =:flowunid").setParameter("flowunid", flowunid).getSingleResult(true); if( cat == null ){ cat = catManage.newObject(); @@ -165,6 +193,10 @@ public class FlowDataServiceImpl implements FlowDataService{ data.put("mobile", dataList.get(0).get("mobile")+""); data.put("certid", dataList.get(0).get("certid")+""); body.put("statusCode", "00"); + //获取扣款文件id + String fileSql = "select lda.id as fileid from LB_DOCRELATIVE ldra left join LB_DOCLIBRARY ldc on ldc.RELATIVE_ID=ldra.id and ldc.DOC_NAME='还款卡(正反面)' left join LB_DOCATTRIBUTE lda on lda.library_id=ldc.id where ldra.objecttype='BusinessApplyFlow' and ldra.proj_id='"+dataList.get(0).get("project_id")+"' and lda.deleteed is null limit 0,2 "; + List> fileList = DataOperatorUtil.getDataBySql(fileSql); + body.put("attributeid", fileList); }else{ data.put("id", ""); data.put("acc_number", ""); @@ -195,6 +227,8 @@ public class FlowDataServiceImpl implements FlowDataService{ System.out.println(testMap); System.out.println("===================="); fieldMap = (Map) testMap.get("fieldMap"); // 参数 + List> fileList = (List>) testMap.get("fileList"); + Map body = new HashMap(); String projectId = fieldMap.get("project_id") == null ? "" : fieldMap.get("project_id").toString(); String ContractId = fieldMap.get("contract_id") == null ? "" : fieldMap.get("contract_id").toString(); @@ -204,6 +238,17 @@ public class FlowDataServiceImpl implements FlowDataService{ String account = fieldMap.get("account") == null ? "" : fieldMap.get("account").toString(); String mobile = fieldMap.get("mobile") == null ? "" : fieldMap.get("mobile").toString(); String certid = fieldMap.get("certid") == null ? "" : fieldMap.get("certid").toString(); + String userid = fieldMap.get("userid") == null ? "" : fieldMap.get("userid").toString(); + ASUser CurUser = new ASUser(userid, sqlca); + if(fileList!=null&&fileList.size()>0){ + Map flowParms = ContractMakeControllerUtil.getFlowParms(FlowUnid); + if(flowParms == null){ + ReturnMapUtil.setReturnMap(null,RestfullConstant.baseProperty.get("fail").toString(), "没有查询到对应的流程实例!"); + return ReturnMapUtil.getReturnMap(); + } + this.savaBankCardFile(flowParms.get("ProjectId"), flowParms.get("ApplyType"), fileList, CurUser, tx); + } + BizObjectManager ldclManager = JBOFactory.getBizObjectManager(LB_DOC_CONTRACT_LIST.CLASS_NAME); List ldcls = ldclManager.createQuery("select * from O where file_flag='yes' and ( flow_unid=:flowunid or contract_id=:contractid ) ").setParameter("flowunid", FlowUnid).setParameter("contractid", ContractId).getResultList(false); body.put("FlowUnid", FlowUnid); @@ -248,7 +293,7 @@ public class FlowDataServiceImpl implements FlowDataService{ BizObjectManager cahManage = JBOFactory.getFactory().getManager(CUSTOMER_ACCOUNT_HIS.CLASS_NAME); BizObject cah = cahManage.createQuery(" account=:account and acc_number=:acc_number and bank_name=:bank_name and mobile=:mobile and sign_status='Y'") .setParameter("account", account).setParameter("acc_number", acc_number).setParameter("bank_name", bank_name).setParameter("mobile", mobile).getSingleResult(false); - if(cah == null ){ + if(cah != null ){ return "Y"; }else{ return "N"; @@ -336,6 +381,7 @@ public class FlowDataServiceImpl implements FlowDataService{ } body.put("flowunid", flowunid);//流程id + System.out.println("GPS返回参数"+body); ReturnMapUtil.setReturnMap(body, RestfullConstant.baseProperty.get("success").toString(), ""); return ReturnMapUtil.getReturnMap(); @@ -349,6 +395,9 @@ public class FlowDataServiceImpl implements FlowDataService{ Map testMap = (Map) MultipartDataUtil .readRequestParam(request, "UTF-8"); fieldMap = (Map) testMap.get("fieldMap"); // 参数 + System.out.println("=======GPS保存=============="); + System.out.println(fieldMap); + System.out.println("====================="); Map body = new HashMap(); String flowunid = fieldMap.get("flowunid") == null ? "" : fieldMap.get("flowunid").toString(); String userid = fieldMap.get("userid") == null ? "" : fieldMap.get("userid").toString(); @@ -625,4 +674,87 @@ public class FlowDataServiceImpl implements FlowDataService{ return ReturnMapUtil.getReturnMap(); } + + public void savaBankCardFile(String projectId,String applyFlow,List> fileList,ASUser user,JBOTransaction tx) throws Exception{ + BizObjectManager relaManage = JBOFactory.getBizObjectManager(LB_DOCRELATIVE.CLASS_NAME); + BizObject rela = null; + if("BusinessApplyApply".equals(applyFlow)||"BusinessChangeApply".equals(applyFlow)||"BusinessCancelApply".equals(applyFlow)||"BContractApproveApply".equals(applyFlow)||"BContractCancelApply".equals(applyFlow)||"BContractChangeApply".equals(applyFlow)){ + rela = relaManage.createQuery(" objecttype='BusinessApplyFlow' AND proj_id=:projectId ").setParameter("projectId", projectId).getSingleResult(false); + + }else{ + rela = relaManage.createQuery(" objecttype=:objecttype AND proj_id=:projectId ").setParameter("objecttype", applyFlow).setParameter("projectId", projectId).getSingleResult(false); + } + String relaId = ""; + if (null == rela) { + return; + } else { + relaId = rela.getAttribute("ID") == null ? "" : rela.getAttribute( + "ID").toString(); + } + + BizObjectManager libraryManage = JBOFactory.getBizObjectManager(LB_DOCLIBRARY.CLASS_NAME); + BizObject library = libraryManage.createQuery("RELATIVE_ID=:RELATIVE_ID AND DOC_NAME='还款卡(正反面)' ").setParameter("RELATIVE_ID", relaId).getSingleResult(true); + String libraryId = ""; + if (null == library) { + return ; + } else { + libraryId = library.getAttribute("ID") == null ? "" : library.getAttribute( + "ID").toString(); + } + Configure CurConfig = Configure.getInstance(); + BizObjectManager attrBm=JBOFactory.getBizObjectManager("jbo.app.tenwa.doc.LB_DOCATTRIBUTE"); + for (Map file : fileList) { + BizObject attr=attrBm.newObject(); + attr.setAttributeValue("Library_Id", libraryId); + attr.setAttributeValue("FileName", file.get("fileName")); + attr.setAttributeValue("InputUserId", user.getUserID()); + attr.setAttributeValue("InputOrgId", user.getOrgID()); + attr.setAttributeValue("InputTime",StringFunction.getTodayNow()); + attr.setAttributeValue("objectType", applyFlow); + + //得到不带路径的文件名 + String sFileName = StringFunction.getFileName(file.get("fileName").toString()); + sFileName = URLDecoder.decode(URLDecoder.decode(sFileName,"UTF-8"),"UTF-8"); + + //定义数据库操作变量 + String sFileSavePath = CurConfig.getConfigure("FileSavePath"); + + String uuid=java.util.UUID.randomUUID().toString().replaceAll("-", ""); + String sFullPath =com.tenwa.officetempalte.util.FileOperatorUtil.getuploadFileDir(sFileSavePath) +uuid+"_"+sFileName; + InputStream is = (InputStream) file.get("file"); + File f = new File(sFullPath); + DataOutputStream fileout = new DataOutputStream( + new FileOutputStream(f)); + String sFileSize = file.get("fileSize") == null ? "" : file.get("fileSize").toString(); + byte b[] = new byte[Integer.valueOf(sFileSize)]; + @SuppressWarnings("unused") + int i = is.read(b, 0, Integer.valueOf(sFileSize) - 1); + fileout.write(b, 0, b.length); // 将文件数据存盘 + fileout.close(); + + //得到带相对路径的文件名 + String sFilePath = sFullPath.replace(sFileSavePath, ""); + attr.setAttributeValue("FilePath",sFilePath); + attr.setAttributeValue("FullPath",sFullPath); + attr.setAttributeValue("Content_Type", isImage(f,file.get("fileContentType"))); + attr.setAttributeValue("FileSize", file.get("fileSize")); + tx.join(attrBm); + attrBm.saveObject(attr); + tx.commit(); + } + } + + public Object isImage(File file,Object object) throws Exception{ + String reg = "(mp4|flv|avi|rm|rmvb|wmv)"; + Pattern p = Pattern.compile(reg); + boolean boo = p.matcher(file.getName()).find(); + if(boo){ + return "video"; + } + BufferedImage bi = ImageIO.read(file); + if(bi==null){ + return object; + } + return "image/jpeg"; + } }