From 5356799dad6c38db329c99e083b68918784f3c3e Mon Sep 17 00:00:00 2001 From: xiezhiwen Date: Tue, 5 Mar 2019 10:55:42 +0800 Subject: [PATCH] =?UTF-8?q?=E5=87=AD=E8=AF=81=E4=BF=A1=E6=81=AF,=20?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E5=8F=98=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- WebContent/WEB-INF/etc/jbo/jbo_customer.xml | 3 + WebContent/WEB-INF/etc/jbo/jbo_voucher.xml | 2 + config/vouchers.properties | 8 +-- .../CreateVoucherLoanDistributor.java | 4 +- .../ContractOnhireVoucher.java | 21 +++--- .../voucher/service/CustomerService.java | 2 +- .../serviceImp/CustomerServiceImpl.java | 38 +++++++---- .../VoucherToNCforAssistContract.java | 43 +++++++----- .../serviceImp/VoucherToNCforCustomer.java | 65 +++++++++++-------- .../serviceImp/VoucherToNCforDistributor.java | 52 ++++++++------- .../serviceImp/VoucherToNCforVoucherPZ.java | 64 ++++++++++-------- 11 files changed, 178 insertions(+), 124 deletions(-) diff --git a/WebContent/WEB-INF/etc/jbo/jbo_customer.xml b/WebContent/WEB-INF/etc/jbo/jbo_customer.xml index d70c5880c..680f54e4e 100644 --- a/WebContent/WEB-INF/etc/jbo/jbo_customer.xml +++ b/WebContent/WEB-INF/etc/jbo/jbo_customer.xml @@ -3009,6 +3009,9 @@ + + + diff --git a/WebContent/WEB-INF/etc/jbo/jbo_voucher.xml b/WebContent/WEB-INF/etc/jbo/jbo_voucher.xml index c17108e87..f30156cdb 100644 --- a/WebContent/WEB-INF/etc/jbo/jbo_voucher.xml +++ b/WebContent/WEB-INF/etc/jbo/jbo_voucher.xml @@ -160,8 +160,10 @@ + + diff --git a/config/vouchers.properties b/config/vouchers.properties index 96b4b8735..b2d764497 100644 --- a/config/vouchers.properties +++ b/config/vouchers.properties @@ -114,15 +114,15 @@ contract_pk_org=06 -#用友连接配置-示例:http://172.16.0.88:9990/service/XChangeServlet?account=BQ1217&groupcode=06 +#用友连接配置-示例:http://172.16.0.88:9990/service/XChangeServlet?account=8&groupcode=06 #IP地址及端口 NC_URL=http://172.16.0.88:9990 -account=BQ1217 +account=8 groupcode=06 #传输xml文件存放路径 -LOCALHOST_URL=//data//files//apzl_leasing//tmp//XZW// +LOCALHOST_URL=//data//files//apzl_leasing//tmp//XZW #回执信息存放路径 -RECEIVE_URL=//data//files//apzl_leasing//tmp//WEN// +RECEIVE_URL=//data//files//apzl_leasing//tmp//WEN diff --git a/src_core/com/tenwa/voucher/CreateVoucherProcess/CreateVoucherLoanDistributor.java b/src_core/com/tenwa/voucher/CreateVoucherProcess/CreateVoucherLoanDistributor.java index d31f2bbc4..0f53bae01 100644 --- a/src_core/com/tenwa/voucher/CreateVoucherProcess/CreateVoucherLoanDistributor.java +++ b/src_core/com/tenwa/voucher/CreateVoucherProcess/CreateVoucherLoanDistributor.java @@ -15,7 +15,7 @@ import com.tenwa.comm.util.jboutil.DataOperatorUtil; import com.tenwa.voucher.serviceImp.CreateVoucherServiceImpl; public class CreateVoucherLoanDistributor { - public String CreateVoucher(String FlowUnid,String VOUCHERNO) throws Exception { + public String CreateVoucher(String FlowUnid,String VOUCHERNO,String userid) throws Exception { Transaction Sqlca =null; Map map=new HashMap(); @@ -105,7 +105,7 @@ public class CreateVoucherLoanDistributor { CreateVoucherServiceImpl vs=new CreateVoucherServiceImpl(); String VOUCHER_TYPE="1";// ƾ֤ - String userid ="admin"; + for (int i=0;i map = new HashMap<>(); map.put("CUST_PK", CUST_PK); - + sql1="SELECT cust_id,cust_name,CUST_STATUS FROM CUSTOMER_LIST WHERE CUST_NO=:CUST_PK"; List> list = DataOperatorUtil.getDataBySql(Sqlca, sql1, map); - // ״̬ΪдI, Ҳѯlistûв鵽, һϢ + // ûв鵽, Ϊ, ʶI, ˵ʶ if(list.size()==0 && !"I".equals(CUST_STATUS)) { return "ʶ,ӦΪ,֤ !"; + // 鵽, ˵Ӧñ, ʶU, ˵ʶ }else if(list.size() >0 && !"U".equals(CUST_STATUS)) { return "ʶ,ӦΪ,֤ !"; + // 鲻, ҴʶΪI, }else if("I".equals(CUST_STATUS) && list.size()==0) { - insertSql1="INSERT INTO CUSTOMER_LIST(cust_id,cust_name,cust_no,cust_type,inputuserid,inputorgid,inputtime,updateuserid,updateorgid,updatetime) VALUES('"+CUST_ID+"','"+CUST_NAME+"','"+CUST_PK+"',NULL,'administrator','8009001','"+startime+"','administrator','8009001','"+startime+"')"; + insertSql1="INSERT INTO CUSTOMER_LIST(cust_id,cust_name,cust_no,cust_type,cust_status,inputuserid,inputorgid,inputtime,updateuserid,updateorgid,updatetime) VALUES('"+CUST_ID+"','"+CUST_NAME+"','"+CUST_PK+"',NULL,'"+InitiateMode+"','administrator','8009001','"+startime+"','administrator','8009001','"+startime+"')"; Sqlca.executeSQL(insertSql1); - // ״̬ΪдU, Ҳѯ, һҪݵ¼ + // , ʶҲΪU, پжϸʲô }else if("U".equals(CUST_STATUS) && list.size() >0) { + // ԭͻ String OLD_CUST_ID = list.get(0).get("cust_id"); + // ԭͻ String OLD_CUST_NAME = list.get(0).get("cust_name"); - if((OLD_CUST_ID==CUST_ID || OLD_CUST_ID.equals(CUST_ID)) && (OLD_CUST_NAME==CUST_NAME || OLD_CUST_NAME.equals(CUST_NAME))) { - return "ԭͬ, !"; + // ԭͻ״̬ + String OLD_INITIATE_MODE = list.get(0).get("CUST_STATUS"); + // ͻ, , ״̬ͬ, Ҫ + if((OLD_CUST_ID==CUST_ID || OLD_CUST_ID.equals(CUST_ID)) && (OLD_CUST_NAME==CUST_NAME || OLD_CUST_NAME.equals(CUST_NAME)) && (OLD_INITIATE_MODE==InitiateMode || OLD_INITIATE_MODE.equals(InitiateMode))) { + return "δ, ֤ !"; + // ͻͬ, ״̬ͬ, ״̬ + }else if((OLD_CUST_ID==CUST_ID || OLD_CUST_ID.equals(CUST_ID)) && (OLD_CUST_NAME==CUST_NAME || OLD_CUST_NAME.equals(CUST_NAME)) && (OLD_INITIATE_MODE!=InitiateMode || !OLD_INITIATE_MODE.equals(InitiateMode))){ + String upd="UPDATE CUSTOMER_LIST SET CUST_STATUS='"+InitiateMode+"' WHERE CUST_NO='"+CUST_PK+"'"; + Sqlca.executeSQL(upd); + // ʣµҪ, ¼, ͻȷϺֶ }else { - insertSql2="INSERT INTO customer_log(ID,CUST_NO,CUST_TYPE,OLD_CUST_ID,OLD_CUST_NAME,NEW_CUST_ID,NEW_CUST_NAME,RECORD_DATE) VALUES(REPLACE(UUID(), '-', ''),'"+CUST_PK+"',NULL,'"+OLD_CUST_ID+"','"+OLD_CUST_NAME+"','"+CUST_ID+"','"+CUST_NAME+"','"+startime+"')"; + insertSql2="INSERT INTO customer_log(ID,CUST_NO,CUST_TYPE,OLD_CUST_ID,OLD_CUST_NAME,OLD_CUST_STATUS,NEW_CUST_ID,NEW_CUST_NAME,NEW_CUST_STATUS,RECORD_DATE) VALUES(REPLACE(UUID(), '-', ''),'"+CUST_PK+"',NULL,'"+OLD_CUST_ID+"','"+OLD_CUST_NAME+"','"+OLD_INITIATE_MODE+"','"+CUST_ID+"','"+CUST_NAME+"','"+InitiateMode+"','"+startime+"')"; Sqlca.executeSQL(insertSql2); } } diff --git a/src_core/com/tenwa/voucher/serviceImp/VoucherToNCforAssistContract.java b/src_core/com/tenwa/voucher/serviceImp/VoucherToNCforAssistContract.java index debd5121a..f41b05d79 100644 --- a/src_core/com/tenwa/voucher/serviceImp/VoucherToNCforAssistContract.java +++ b/src_core/com/tenwa/voucher/serviceImp/VoucherToNCforAssistContract.java @@ -41,6 +41,7 @@ import com.amarsoft.awe.util.Transaction; import com.base.util.QuartzUtil; import com.tenwa.comm.util.date.DateAssistant; import com.tenwa.comm.util.jboutil.DataOperatorUtil; +import com.tenwa.httpclient.resources.VouchersPropertiesUtil; import com.tenwa.util.SerialNumberUtil; import jbo.voucher.NCXML_DETAIL_RECORDS; @@ -66,32 +67,35 @@ public class VoucherToNCforAssistContract implements Job{ * ȡļϢ * */ // Properties - Properties properties = new Properties(); + // Properties properties = new Properties(); // ȡļ - //in = new FileInputStream("/vouchers.properties"); - in = new FileInputStream("//data/config//vouchers.properties"); + // in = new FileInputStream("/vouchers.properties"); + // in = new FileInputStream("//data/config//vouchers.properties"); // ͨPropertiesȡļ - properties.load(in); + // properties.load(in); // ȡļ // - String account = properties.getProperty("contract_account"); + String account = VouchersPropertiesUtil.get("contract_account"); // - String billtype = properties.getProperty("contract_billtype"); + String billtype = VouchersPropertiesUtil.get("contract_billtype"); // ű - String groupcode = properties.getProperty("contract_groupcode"); + String groupcode = VouchersPropertiesUtil.get("contract_groupcode"); // ϵͳ - String isexchange = properties.getProperty("contract_isexchange"); + String isexchange = VouchersPropertiesUtil.get("contract_isexchange"); // շ - String receiver = properties.getProperty("contract_receiver"); + String receiver = VouchersPropertiesUtil.get("contract_receiver"); // ϵͳ - String sender = properties.getProperty("contract_sender"); + String sender = VouchersPropertiesUtil.get("contract_sender"); // ϵͳ - String replace = properties.getProperty("contract_replace"); + String replace = VouchersPropertiesUtil.get("contract_replace"); // ֯ - String pk_org = properties.getProperty("contract_pk_org"); + String pk_org = VouchersPropertiesUtil.get("contract_pk_org"); // - String pk_group = properties.getProperty("contract_pk_group"); + String pk_group = VouchersPropertiesUtil.get("contract_pk_group"); + // xmlļ· + String LOCALHOST_URL = VouchersPropertiesUtil.get("LOCALHOST_URL"); + /** * ȫֱ */ @@ -183,7 +187,7 @@ public class VoucherToNCforAssistContract implements Job{ } } } - String URL="//data//files//apzl_leasing//tmp//XZW//APleasing_Defdoc_"+year_month_day+".xml"; + String URL=LOCALHOST_URL+"//APleasing_Defdoc_"+year_month_day+".xml"; // String URL="D:\\voucherXml_NC\\APleasing_Defdoc_"+year_month_day+".xml"; file=new File(URL); writer = new XMLWriter(new FileOutputStream(file), OutputFormat.createPrettyPrint()); @@ -224,11 +228,16 @@ public class VoucherToNCforAssistContract implements Job{ String resultcode= ""; // ؽ String bdocid = ""; // xmlִid String resultdescription=""; //Ϣ + String NC_URL = VouchersPropertiesUtil.get("NC_URL");// ipַ˿ں + String account = VouchersPropertiesUtil.get("account"); + String groupcode = VouchersPropertiesUtil.get("groupcode"); + String RECEIVE_URL = VouchersPropertiesUtil.get("RECEIVE_URL"); //ִϢ· + /** * ȡԷpost */ //String url = "http://172.16.0.88:9990/service/XChangeServlet?account=8&groupcode=06"; - String url = "http://172.16.0.88:9990/service/XChangeServlet?account=BQ1217&groupcode=06"; + String url = NC_URL+"/service/XChangeServlet?account="+account+"&groupcode="+groupcode; URL realURL = new URL(url); HttpURLConnection connection = (HttpURLConnection)realURL.openConnection(); connection.setDoOutput(true); @@ -277,7 +286,7 @@ public class VoucherToNCforAssistContract implements Job{ // ݼ¼ SimpleDateFormat formatter2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); // ִϢ· - String resFile = "//data//files//apzl_leasing//tmp//WEN//APleasing_"+type+""+fmt.format(new Date())+".xml"; + String resFile = RECEIVE_URL+"//APleasing_"+type+""+fmt.format(new Date())+".xml"; //String resFile = "D:\\VOUCHER_RECEIPT\\APleasing_"+type+""+fmt.format(new Date())+".xml"; StreamResult result = new StreamResult(new File(resFile)); // ִϢתΪxml @@ -287,7 +296,7 @@ public class VoucherToNCforAssistContract implements Job{ * xml, ݻִϢ״̬ */ SAXReader sr = new SAXReader(); - Document doc = sr.read(resFile); + Document doc = sr.read(new File(resFile)); Element root= doc.getRootElement(); // successfulжǷʧܵ, ΪN, ȫɹΪY String resSuc = root.attributeValue("successful"); diff --git a/src_core/com/tenwa/voucher/serviceImp/VoucherToNCforCustomer.java b/src_core/com/tenwa/voucher/serviceImp/VoucherToNCforCustomer.java index 7ef462357..11a81dc0d 100644 --- a/src_core/com/tenwa/voucher/serviceImp/VoucherToNCforCustomer.java +++ b/src_core/com/tenwa/voucher/serviceImp/VoucherToNCforCustomer.java @@ -17,12 +17,10 @@ import java.util.List; import java.util.Map; import java.util.Properties; import java.util.UUID; - import javax.xml.transform.OutputKeys; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerFactory; import javax.xml.transform.stream.StreamResult; - import org.dom4j.Document; import org.dom4j.DocumentHelper; import org.dom4j.Element; @@ -43,8 +41,8 @@ import com.amarsoft.awe.util.Transaction; import com.base.util.QuartzUtil; import com.tenwa.comm.util.date.DateAssistant; import com.tenwa.comm.util.jboutil.DataOperatorUtil; +import com.tenwa.httpclient.resources.VouchersPropertiesUtil; import com.tenwa.util.SerialNumberUtil; - import jbo.voucher.NCXML_DETAIL_RECORDS; public class VoucherToNCforCustomer implements Job{ @@ -73,40 +71,43 @@ public class VoucherToNCforCustomer implements Job{ * ȡļϢ */ // Properties - Properties properties = new Properties(); + // Properties properties = new Properties(); // ȡļ - //in = new FileInputStream("/vouchers.properties"); - in = new FileInputStream("//data/config//vouchers.properties"); + // in = new FileInputStream("/vouchers.properties"); + // in = new FileInputStream("//data/config//vouchers.properties"); // ͨPropertiesȡļ - properties.load(in); + // properties.load(in); + // ȡļ // - String account = properties.getProperty("customer_account"); + String account = VouchersPropertiesUtil.get("customer_account"); // - String billtype = properties.getProperty("customer_billtype"); + String billtype = VouchersPropertiesUtil.get("customer_billtype"); // ű - String groupcode = properties.getProperty("customer_groupcode"); + String groupcode = VouchersPropertiesUtil.get("customer_groupcode"); // ϵͳ - String isexchange = properties.getProperty("customer_isexchange"); + String isexchange = VouchersPropertiesUtil.get("customer_isexchange"); // շ - String receiver = properties.getProperty("customer_receiver"); + String receiver = VouchersPropertiesUtil.get("customer_receiver"); // ϵͳ - String sender = properties.getProperty("customer_sender"); + String sender = VouchersPropertiesUtil.get("customer_sender"); // ϵͳ - String replace = properties.getProperty("customer_replace"); + String replace = VouchersPropertiesUtil.get("customer_replace"); // ֯ - String pk_org = properties.getProperty("customer_pk_org"); + String pk_org = VouchersPropertiesUtil.get("customer_pk_org"); // - String pk_group = properties.getProperty("customer_pk_group"); + String pk_group = VouchersPropertiesUtil.get("customer_pk_group"); // ͻ - String pk_custclass = properties.getProperty("customer_pk_custclass"); + String pk_custclass = VouchersPropertiesUtil.get("customer_pk_custclass"); // ҵ - String pk_country = properties.getProperty("customer_pk_country"); + String pk_country = VouchersPropertiesUtil.get("customer_pk_country"); // ʱ - String pk_timezone = properties.getProperty("customer_pk_timezone"); + String pk_timezone = VouchersPropertiesUtil.get("customer_pk_timezone"); // ݸʽ - String pk_format = properties.getProperty("customer_pk_format"); + String pk_format = VouchersPropertiesUtil.get("customer_pk_format"); + // xmlļ· + String LOCALHOST_URL = VouchersPropertiesUtil.get("LOCALHOST_URL"); // ļ File file=null; @@ -122,6 +123,8 @@ public class VoucherToNCforCustomer implements Job{ String uuid=""; // ͻŶ String customer_num=""; + // ֤ + String certid=""; // ͻƶ String customername=""; // ļ· @@ -130,7 +133,7 @@ public class VoucherToNCforCustomer implements Job{ String year_month_days = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()); // ѯΪ֮ǰʧܵ - String sql="SELECT max(cif.customerid) id,cif.customer_num,MAX(cif.customername)customername,MAX(cif.customertype)customertype,MAX(cif.customerid) customerid FROM CUSTOMER_INFO cif LEFT JOIN lb_union_lessee lul ON lul.customer_id=cif.customerid LEFT JOIN lb_contract_info lci ON lci.id=lul.contract_id WHERE lci.contract_status >='31' AND cif.customer_num NOT IN (SELECT TABLE_NUM FROM NCXML_DETAIL_RECORDS WHERE FLAG = '1' AND XML_TYPE = '"+type+"') GROUP BY CIF.CUSTOMER_NUM "; + String sql="SELECT max(cif.customerid) id,cif.customer_num,MAX(cif.customername)customername,MAX(cif.customertype)customertype,MAX(cif.customerid) customerid,MAX(cif.certid) as certid FROM CUSTOMER_INFO cif LEFT JOIN lb_union_lessee lul ON lul.customer_id=cif.customerid LEFT JOIN lb_contract_info lci ON lci.id=lul.contract_id WHERE lci.contract_status >='31' AND cif.customer_num NOT IN (SELECT TABLE_NUM FROM NCXML_DETAIL_RECORDS WHERE FLAG = '1' AND XML_TYPE = '"+type+"') GROUP BY CIF.CUSTOMER_NUM "; List> rs = DataOperatorUtil.getDataBySql(Sqlca,sql,null); if(rs != null && rs.size()>0) { // ¼ʷκ @@ -157,6 +160,7 @@ public class VoucherToNCforCustomer implements Job{ for(int i=0;i