diff --git a/WebContent/Tenwa/Lease/App/Interface/Ebank/LCEbankList.jsp b/WebContent/Tenwa/Lease/App/Interface/Ebank/LCEbankList.jsp
index 50e2574ef..36c9c589c 100644
--- a/WebContent/Tenwa/Lease/App/Interface/Ebank/LCEbankList.jsp
+++ b/WebContent/Tenwa/Lease/App/Interface/Ebank/LCEbankList.jsp
@@ -133,7 +133,6 @@
var sparam=JSON.stringify(importCondition).replace(/,/g,"@");//生成模板的参数据
AsDialog.PopView("/Tenwa/Core/OfficeTemplate/TemplateManager/BFTemplateTest/uploadExcel.jsp","importparam="+sparam,
{width:"320px",height:"40px",title:"上传网银Excel"},function(){reloadSelf();});
-
}
function ebankDownload(){
var sId="2017060200000001";
@@ -158,6 +157,7 @@
function newRecord(){
var sUrl = "/Tenwa/Lease/App/Interface/Ebank/LCEbankInfo.jsp";
AsControl.OpenView(sUrl,'','_self','');
+ var res=RunJavaMethodTrans("com.tenwa.lease.app.ebank.EbankUse","createEbankVoucher","");
}
function viewAndEdit(){
var sUrl = "/Tenwa/Lease/App/Interface/Ebank/LCEbankInfo.jsp";
diff --git a/WebContent/WEB-INF/etc/jbo/jbo_voucher.xml b/WebContent/WEB-INF/etc/jbo/jbo_voucher.xml
index f8368d08b..a2e829e08 100644
--- a/WebContent/WEB-INF/etc/jbo/jbo_voucher.xml
+++ b/WebContent/WEB-INF/etc/jbo/jbo_voucher.xml
@@ -182,7 +182,7 @@
-
+
@@ -192,6 +192,23 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src_core/com/tenwa/voucher/CreateVoucherProcess/CreateVoucherLoanDistributor.java b/src_core/com/tenwa/voucher/CreateVoucherProcess/CreateVoucherLoanDistributor.java
index 32eae2f89..0ecfe9ecc 100644
--- a/src_core/com/tenwa/voucher/CreateVoucherProcess/CreateVoucherLoanDistributor.java
+++ b/src_core/com/tenwa/voucher/CreateVoucherProcess/CreateVoucherLoanDistributor.java
@@ -209,7 +209,7 @@ public class CreateVoucherLoanDistributor {
}else if("PZ2018071000000007".equals(VOUCHERNO)||"PZ2018080300000072".equals(VOUCHERNO)){// 收取客户手续费
param.put("CASHFLOW", "");// 现金流项目
param.put("BUSINESSTYPE", "0604");
- }else if("PZ2018070900000002".equals(VOUCHERNO)||"PZ2018072400000060".equals(VOUCHERNO)){// 购置融资租赁资产
+ }else if("PZ2018070900000002".equals(VOUCHERNO)||"PZ2018072400000060".equals(VOUCHERNO) || "PZ2018073100000062".equals(VOUCHERNO)){// 购置融资租赁资产
if(cust_list != null) {// 集团内
param.put("CASHFLOW", "11212");// 现金流项目
}else {// 集团外
diff --git a/src_core/com/tenwa/voucher/CreateVoucherProcess/CreateVoucherMethodSettle/ContractOnhireVoucher.java b/src_core/com/tenwa/voucher/CreateVoucherProcess/CreateVoucherMethodSettle/ContractOnhireVoucher.java
index 398f391a1..49ee4aa6f 100644
--- a/src_core/com/tenwa/voucher/CreateVoucherProcess/CreateVoucherMethodSettle/ContractOnhireVoucher.java
+++ b/src_core/com/tenwa/voucher/CreateVoucherProcess/CreateVoucherMethodSettle/ContractOnhireVoucher.java
@@ -21,7 +21,7 @@ public class ContractOnhireVoucher extends BaseBussiness {
cvld.CreateVoucher(FlowUnid, "PZ2018070900000002");// 购置融资租赁资产-回
- cvld.CreateVoucher(FlowUnid, "PZ2018073100000062");// 购置融资租赁资产-回--第一车贷
+ // cvld.CreateVoucher(FlowUnid, "PZ2018073100000062");// 购置融资租赁资产-回--第一车贷
//cvld.CreateVoucher(FlowUnid, "PZ2018122000000010");// 购置融资租赁资产-回
//cvld.CreateVoucher(FlowUnid, "PZ2018072400000060");// 购置融资租赁资产-直
diff --git a/src_core/com/tenwa/voucher/serviceImp/CreateVoucherServiceImpl.java b/src_core/com/tenwa/voucher/serviceImp/CreateVoucherServiceImpl.java
index b92698324..e9fb659aa 100644
--- a/src_core/com/tenwa/voucher/serviceImp/CreateVoucherServiceImpl.java
+++ b/src_core/com/tenwa/voucher/serviceImp/CreateVoucherServiceImpl.java
@@ -401,6 +401,14 @@ public class CreateVoucherServiceImpl {
}
}
+ // 起租-第一车贷, 购置融资租赁资产带固定编码
+ if("PZ2018073100000062".equals(VOUCHERNO)) {
+ if("3".equals(SORT_NUMBER)) {
+ subData.put("CUSTID","020132");//经销商id
+ subData.put("CUSTNAME","上海锋之行汽车金融信息服务有限公司");//经销商名称
+ }
+ }
+
/*
* 提前结清带虚拟客户名称编码
*/
diff --git a/src_core/com/tenwa/voucher/serviceImp/VoucherToNCforAssistContract.java b/src_core/com/tenwa/voucher/serviceImp/VoucherToNCforAssistContract.java
index a308bbdb8..f40da6762 100644
--- a/src_core/com/tenwa/voucher/serviceImp/VoucherToNCforAssistContract.java
+++ b/src_core/com/tenwa/voucher/serviceImp/VoucherToNCforAssistContract.java
@@ -16,6 +16,8 @@ import java.util.List;
import java.util.Map;
import java.util.UUID;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.transform.OutputKeys;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
@@ -74,14 +76,14 @@ public class VoucherToNCforAssistContract implements Job{
// 生成xml头
Document document = DocumentHelper.createDocument(); // 生成每个xml的头
Element root = document.addElement("ufinterface");
- root.addAttribute("account","BQ1217");
- root.addAttribute("billtype","defdoc(自定义档案)");
+ root.addAttribute("account","bq1217");
+ root.addAttribute("billtype","defdoc");
root.addAttribute("businessunitcode","");
root.addAttribute("filename","");
root.addAttribute("groupcode","06");
root.addAttribute("isexchange","Y");
root.addAttribute("orgcode","");
- root.addAttribute("receiver","接收方业务单元编码");
+ root.addAttribute("receiver","807001002001");
root.addAttribute("replace","Y");
root.addAttribute("roottag","");
root.addAttribute("sender","001");
@@ -103,7 +105,7 @@ public class VoucherToNCforAssistContract implements Job{
Element pk_group = billhead.addElement("pk_group");// 所属集团,最大长度为20,类型为:String
pk_group.setText("06");
Element pk_org = billhead.addElement("pk_org");// 所属组织,最大长度为20,类型为:String
- pk_org.setText("安鹏租赁业务单元编码");
+ pk_org.setText("807001002001");
Element code = billhead.addElement("code");// 档案编码,最大长度为40,类型为:String
code.setText(contract_number);
Element name = billhead.addElement("name");// 档案名称,最大长度为200,类型为:String
@@ -121,14 +123,14 @@ public class VoucherToNCforAssistContract implements Job{
Sqlca.executeSQL(insertSql);
logger.info("辅助合同记录语句: " + insertSql);
}
- // String URL="//data//files//apzl_leasing//tmp//XZW//APleasing_Defdoc_"+year_month_day+".xml";
- String URL="D:\\voucherXml_NC\\APleasing_Defdoc_"+year_month_day+".xml";
+ String URL="//data//files//apzl_leasing//tmp//XZW//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());
writer.setEscapeText(false);// 字符是否转义,默认true
writer.write(document);
writer.close();
- // InterActionToNC(Sqlca,URL,type,batch,rs.size());
+ InterActionToNC(Sqlca,URL,type,batch,rs.size());
Sqlca.commit();
}
QuartzUtil.insertLog(plan_date,"com.tenwa.voucher.serviceImp.VoucherToNCforAssistContract", "success", "成功",curUserId);
@@ -155,20 +157,20 @@ public class VoucherToNCforAssistContract implements Job{
/**
* 像NC传输xml, 获取NC回执xml信息, 根据回执信息更改状态
*/
- public static void InterActionToNC(Transaction Sqlca,String inputURL,String type,String batch,int count) {
- try {
+ public static String InterActionToNC(Transaction Sqlca,String inputURL,String type,String batch,int count) throws Exception {
String updateSql = ""; // 更新sql对象
String insertSql = ""; // 新增SQL对象
String deleteSql = ""; // 删除SQL对象
String resultcode= ""; // 单条返回结果
String bdocid = ""; // xml回执id
String resultdescription=""; //错误信息
+ String returns="true";
/**
* 获取对方post连接
*/
//String url = "http://47.93.227.86:8858/service/XChangeServlet?account=q0225&groupcode=001";
- String url = "http://172.16.0.88:9990/service/XChangeServlet?account=BQ1217&groupcode=06";
+ String url = "http://172.16.0.88:9990/service/XChangeServlet?account=bq1217&groupcode=06";
URL realURL = new URL(url);
HttpURLConnection connection = (HttpURLConnection)realURL.openConnection();
connection.setDoOutput(true);
@@ -180,30 +182,39 @@ public class VoucherToNCforAssistContract implements Job{
*/
File file = new File(inputURL);
BufferedOutputStream out = new BufferedOutputStream(connection.getOutputStream());
- BufferedInputStream input = new BufferedInputStream(new FileInputStream(file));
- int length;
- byte[] buffer = new byte[1000];
- while ((length = input.read(buffer, 0, 1000)) != -1) {
- out.write(buffer, 0, length);
+ BufferedReader reader = new BufferedReader (new InputStreamReader(new FileInputStream(file),"UTF-8"));
+ String xml="";
+ String ss=null;
+ while((ss=reader.readLine()) != null) {
+ xml+=ss;
+ xml+="\r\n";
+ out.write(ss.getBytes());
}
- input.close();
+ System.out.println(xml);
+ reader.close();
out.close();
/**
* 获取NC回执信息
*/
InputStream inputStream = connection.getInputStream();
- InputStreamReader isr = new InputStreamReader(inputStream);
+ InputStreamReader isr = new InputStreamReader(inputStream,"UTF-8");
BufferedReader bufreader = new BufferedReader(isr);
String xmlString = "";
- int c;
+ String b=null;
+ while((b=bufreader.readLine()) !=null) {
+ xmlString+=b;
+ xmlString+="\r\n";
+ }
+ System.out.println(xmlString);
+ bufreader.close();
+/* int c;
while ((c = bufreader.read()) != -1) {
System.out.print((char) c);
xmlString += (char) c;
- }
- input.close();
+ }*/
+ //input.close();
System.out.println("--------------------------" + xmlString);
-
/**
* 将获取到的回执信息生成本地xml
*/
@@ -211,7 +222,7 @@ public class VoucherToNCforAssistContract implements Job{
TransformerFactory tFactory = TransformerFactory.newInstance();
Transformer transformer = tFactory.newTransformer();
DocumentSource source = new DocumentSource(resDoc);
- transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
+ transformer.setOutputProperty(OutputKeys.ENCODING, "utf-8");
//设置文档的换行与缩进
transformer.setOutputProperty(OutputKeys.INDENT, "YES");
@@ -221,13 +232,14 @@ public class VoucherToNCforAssistContract implements Job{
// File file2 = new File("D:\\VOUCHER_RECEIPT");
// if (!file2.exists()) {file2.mkdirs();}// 判断是否存在, 如果不存在就创建该文件夹
String resFile = "//data//files//apzl_leasing//tmp//WEN//APleasing_"+type+""+fmt.format(new Date())+".xml";
- // String resFile = "D:\\VOUCHER_RECEIPT\\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));
transformer.transform(source,result);
/**
* 解析xml, 根据回执信息更新状态
*/
+
SAXReader sr = new SAXReader();
Document doc = sr.read(resFile);
Element root= doc.getRootElement();
@@ -235,14 +247,30 @@ public class VoucherToNCforAssistContract implements Job{
String resSuc = root.attributeValue("successful");
//后面对回执结果做判断,然后改变导入状态就行了
if(null != resSuc){
- if(resSuc.equals("N")){
+ if("N".equals(resSuc)){
logger.info("导入失败");
// 导入失败, 将本次在明细表中存储的数据删除
deleteSql = "DELETE FROM NCXML_DETAIL_RECORDS WHERE BATCH='"+batch+"' AND XML_TYPE = '"+type+"'";
// 导入失败, 将失败数据记录入总记录表
- insertSql = "INSERT INTO NCXML_TOTAL_RECORDS(ID,BATCH,XML_TYPE,FLAG_,COUNT_,FAILED_COUNT,CREATETIME) VALUES('"+UUID.randomUUID().toString().replace("-", "")+"','"+batch+"','"+type+"','"+resSuc+"','0','"+count+"','"+formatter2.format(new Date())+"')";
+ List list = root.elements();
+ for (Element element : list) {
+ String names = element.getName();
+ String value = element.getStringValue();
+ List list2 = element.elements();
+ for (Element el : list2) {
+ String s = el.getName();
+ if("resultcode".equals(s)) {
+ resultcode = el.getStringValue();
+ }
+ if("resultdescription".equals(s)) {
+ resultdescription = el.getStringValue();
+ }
+ }
+ insertSql = "INSERT INTO NCXML_TOTAL_RECORDS(ID,BATCH,XML_TYPE,FLAG_,COUNT_,FAILED_COUNT,ERR_DESCRIBE,CREATETIME) VALUES('"+UUID.randomUUID().toString().replace("-", "")+"','"+batch+"','"+type+"','"+resSuc+"','"+count+"','"+count+"','"+resultdescription+"','"+formatter2.format(new Date())+"')";
+ }
Sqlca.executeSQL(deleteSql);
Sqlca.executeSQL(insertSql);
+ returns="false";
}else if(resSuc.equals("Y")){
logger.info("导入成功");
List list = root.elements();
@@ -250,33 +278,38 @@ public class VoucherToNCforAssistContract implements Job{
for (Element element : list) {
List list2 = element.elements();
for (Element el : list2) {
- logger.info("111111111111111111");
+ String s = el.getName();
// 获取单条回执状态
- resultcode = el.element("resultcode").getStringValue();
- if(!"1".equals(resultcode)) {
- logger.info("22222222222222");
- bdocid = el.element("bdocid").getStringValue(); // xml回执id
- resultdescription = el.element("resultdescription").getStringValue(); // 错误信息
-
- // 如果回执状态不等于1, 说明有误, 更新到记录字表并记录错误信息
- updateSql=" UPDATE NCXML_DETAIL_RECORDS SET FLAG='"+resultcode+"',ERR_DESCRIBE='"+resultdescription+"' WHERE BUILLID='"+bdocid+"' AND XML_TYPE= '"+type+"'";
- Sqlca.executeSQL(updateSql);
- logger.info("根据回执信息, 修改传输失败状态, 记录错误信息"+updateSql);
- failed_count++;
+ if("resultcode".equals(s)) {
+ resultcode = el.getStringValue();
+ }
+ // xml回执id
+ if("bdocid".equals(s)) {
+ bdocid = el.getStringValue();
+ }
+ // 错误信息
+ if("resultdescription".equals(s)) {
+ resultdescription = el.getStringValue();
}
}
+
+ if(!"1".equals(resultcode)) {
+ // 如果回执状态不等于1, 说明有误, 更新到记录字表并记录错误信息
+ updateSql=" UPDATE NCXML_DETAIL_RECORDS SET FLAG='"+resultcode+"',ERR_DESCRIBE='"+resultdescription+"' WHERE BUILLID='"+bdocid+"' AND XML_TYPE= '"+type+"'";
+ Sqlca.executeSQL(updateSql);
+ logger.info("根据回执信息, 修改传输失败状态, 记录错误信息"+updateSql);
+ failed_count++;
+ }
}
// 将本批次传输总量及 失败数量记录入记录总表
- String insertSql1="INSERT INTO NCXML_TOTAL_RECORDS(ID,BATCH,XML_TYPE,FLAG_,COUNT_,FAILED_COUNT,CREATETIME) VALUES('"+UUID.randomUUID().toString().replace("-", "")+"','"+batch+"','"+type+"','"+resSuc+"','"+count+"','"+failed_count+"','"+formatter2.format(new Date())+"')";
+ String insertSql1="INSERT INTO NCXML_TOTAL_RECORDS(ID,BATCH,XML_TYPE,FLAG_,COUNT_,FAILED_COUNT,ERR_DESCRIBE,CREATETIME) VALUES('"+UUID.randomUUID().toString().replace("-", "")+"','"+batch+"','"+type+"','"+resSuc+"','"+count+"','"+failed_count+"','"+resultdescription+"','"+formatter2.format(new Date())+"')";
Sqlca.executeSQL(insertSql1);
}else{
logger.info("出现未知错误");
}
}else{
logger.info("未找到successful属性");
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
+ }
+ return returns;
}
}
diff --git a/src_core/com/tenwa/voucher/serviceImp/VoucherToNCforCustomer.java b/src_core/com/tenwa/voucher/serviceImp/VoucherToNCforCustomer.java
index d5e92d044..7d82e28f8 100644
--- a/src_core/com/tenwa/voucher/serviceImp/VoucherToNCforCustomer.java
+++ b/src_core/com/tenwa/voucher/serviceImp/VoucherToNCforCustomer.java
@@ -78,14 +78,14 @@ public class VoucherToNCforCustomer implements Job{
// 生成xml头
Document document= DocumentHelper.createDocument();
Element root = document.addElement("ufinterface");
- root.addAttribute("account", "BQ1217");
- root.addAttribute("billtype", "customer(客户)");
+ root.addAttribute("account", "bq1217");
+ root.addAttribute("billtype", "customer");
root.addAttribute("businessunitcode", "develop");
root.addAttribute("filename", "");
root.addAttribute("groupcode", "06");
root.addAttribute("isexchange", "Y");
root.addAttribute("orgcode", "");
- root.addAttribute("receiver", "接收方业务单元编码");
+ root.addAttribute("receiver", "807001002001");
root.addAttribute("replace", "Y");
root.addAttribute("roottag", "");
root.addAttribute("sender", "kh01");
@@ -105,7 +105,7 @@ public class VoucherToNCforCustomer implements Job{
Element pk_group = billhead.addElement("pk_group"); // 所属集团,最大长度为20,类型为:String
pk_group.setText("06");
Element pk_org = billhead.addElement("pk_org"); // 所属组织,最大长度为20,类型为:String
- pk_org.setText("安鹏租赁业务单元编码");
+ pk_org.setText("807001002001");
Element code = billhead.addElement("code"); // 客户编码,最大长度为40,类型为:String
code.setText((customer_num==null)?"":customer_num);
Element name = billhead.addElement("name"); // 客户名称,最大长度为200,类型为:String
@@ -176,14 +176,14 @@ public class VoucherToNCforCustomer implements Job{
Sqlca.executeSQL(insertSql);
logger.info("客户记录语句: "+insertSql);
}
- //String URL="//data//files//apzl_leasing//tmp//XZW//APleasing_Customer_"+year_month_day+".xml";
- String URL="D:\\voucherXml_NC\\APleasing_Customer_"+year_month_day+".xml";
+ String URL="//data//files//apzl_leasing//tmp//XZW//APleasing_Customer_"+year_month_day+".xml";
+ // String URL="D:\\voucherXml_NC\\APleasing_Customer_"+year_month_day+".xml";
file=new File(URL);
writer = new XMLWriter(new FileOutputStream(file), OutputFormat.createPrettyPrint());
writer.setEscapeText(false);// 字符是否转义,默认true
writer.write(document);
writer.close();
- // InterActionToNC(Sqlca,URL,type,batch,rs.size());
+ InterActionToNC(Sqlca,URL,type,batch,rs.size());
Sqlca.commit();
QuartzUtil.insertLog(plan_date,"com.tenwa.voucher.serviceImp.VoucherToNCforCustomer", "success", "成功",curUserId);
}
@@ -210,20 +210,20 @@ public class VoucherToNCforCustomer implements Job{
/**
* 像NC传输xml, 获取NC回执xml信息, 根据回执信息更改状态
*/
- public static void InterActionToNC(Transaction Sqlca,String inputURL,String type,String batch,int count) {
- try {
+ public static String InterActionToNC(Transaction Sqlca,String inputURL,String type,String batch,int count) throws Exception {
String updateSql = ""; // 更新sql对象
String insertSql = ""; // 新增SQL对象
String deleteSql = ""; // 删除SQL对象
String resultcode= ""; // 单条返回结果
String bdocid = ""; // xml回执id
String resultdescription=""; //错误信息
+ String returns="true";
/**
* 获取对方post连接
*/
//String url = "http://47.93.227.86:8858/service/XChangeServlet?account=q0225&groupcode=001";
- String url = "http://172.16.0.88:9990/service/XChangeServlet?account=BQ1217&groupcode=06";
+ String url = "http://172.16.0.88:9990/service/XChangeServlet?account=bq1217&groupcode=06";
URL realURL = new URL(url);
HttpURLConnection connection = (HttpURLConnection)realURL.openConnection();
connection.setDoOutput(true);
@@ -235,30 +235,39 @@ public class VoucherToNCforCustomer implements Job{
*/
File file = new File(inputURL);
BufferedOutputStream out = new BufferedOutputStream(connection.getOutputStream());
- BufferedInputStream input = new BufferedInputStream(new FileInputStream(file));
- int length;
- byte[] buffer = new byte[1000];
- while ((length = input.read(buffer, 0, 1000)) != -1) {
- out.write(buffer, 0, length);
+ BufferedReader reader = new BufferedReader (new InputStreamReader(new FileInputStream(file),"UTF-8"));
+ String xml="";
+ String ss=null;
+ while((ss=reader.readLine()) != null) {
+ xml+=ss;
+ xml+="\r\n";
+ out.write(ss.getBytes());
}
- input.close();
+ System.out.println(xml);
+ reader.close();
out.close();
/**
* 获取NC回执信息
*/
InputStream inputStream = connection.getInputStream();
- InputStreamReader isr = new InputStreamReader(inputStream);
+ InputStreamReader isr = new InputStreamReader(inputStream,"UTF-8");
BufferedReader bufreader = new BufferedReader(isr);
String xmlString = "";
- int c;
+ String b=null;
+ while((b=bufreader.readLine()) !=null) {
+ xmlString+=b;
+ xmlString+="\r\n";
+ }
+ System.out.println(xmlString);
+ bufreader.close();
+/* int c;
while ((c = bufreader.read()) != -1) {
System.out.print((char) c);
xmlString += (char) c;
- }
- input.close();
+ }*/
+ //input.close();
System.out.println("--------------------------" + xmlString);
-
/**
* 将获取到的回执信息生成本地xml
*/
@@ -266,7 +275,7 @@ public class VoucherToNCforCustomer implements Job{
TransformerFactory tFactory = TransformerFactory.newInstance();
Transformer transformer = tFactory.newTransformer();
DocumentSource source = new DocumentSource(resDoc);
- transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
+ transformer.setOutputProperty(OutputKeys.ENCODING, "utf-8");
//设置文档的换行与缩进
transformer.setOutputProperty(OutputKeys.INDENT, "YES");
@@ -276,13 +285,14 @@ public class VoucherToNCforCustomer implements Job{
// File file2 = new File("D:\\VOUCHER_RECEIPT");
// if (!file2.exists()) {file2.mkdirs();}// 判断是否存在, 如果不存在就创建该文件夹
String resFile = "//data//files//apzl_leasing//tmp//WEN//APleasing_"+type+""+fmt.format(new Date())+".xml";
- // String resFile = "D:\\VOUCHER_RECEIPT\\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));
transformer.transform(source,result);
/**
* 解析xml, 根据回执信息更新状态
*/
+
SAXReader sr = new SAXReader();
Document doc = sr.read(resFile);
Element root= doc.getRootElement();
@@ -290,14 +300,30 @@ public class VoucherToNCforCustomer implements Job{
String resSuc = root.attributeValue("successful");
//后面对回执结果做判断,然后改变导入状态就行了
if(null != resSuc){
- if(resSuc.equals("N")){
+ if("N".equals(resSuc)){
logger.info("导入失败");
// 导入失败, 将本次在明细表中存储的数据删除
deleteSql = "DELETE FROM NCXML_DETAIL_RECORDS WHERE BATCH='"+batch+"' AND XML_TYPE = '"+type+"'";
// 导入失败, 将失败数据记录入总记录表
- insertSql = "INSERT INTO NCXML_TOTAL_RECORDS(ID,BATCH,XML_TYPE,FLAG_,COUNT_,FAILED_COUNT,CREATETIME) VALUES('"+UUID.randomUUID().toString().replace("-", "")+"','"+batch+"','"+type+"','"+resSuc+"','0','"+count+"','"+formatter2.format(new Date())+"')";
+ List list = root.elements();
+ for (Element element : list) {
+ String names = element.getName();
+ String value = element.getStringValue();
+ List list2 = element.elements();
+ for (Element el : list2) {
+ String s = el.getName();
+ if("resultcode".equals(s)) {
+ resultcode = el.getStringValue();
+ }
+ if("resultdescription".equals(s)) {
+ resultdescription = el.getStringValue();
+ }
+ }
+ insertSql = "INSERT INTO NCXML_TOTAL_RECORDS(ID,BATCH,XML_TYPE,FLAG_,COUNT_,FAILED_COUNT,ERR_DESCRIBE,CREATETIME) VALUES('"+UUID.randomUUID().toString().replace("-", "")+"','"+batch+"','"+type+"','"+resSuc+"','"+count+"','"+count+"','"+resultdescription+"','"+formatter2.format(new Date())+"')";
+ }
Sqlca.executeSQL(deleteSql);
Sqlca.executeSQL(insertSql);
+ returns="false";
}else if(resSuc.equals("Y")){
logger.info("导入成功");
List list = root.elements();
@@ -305,34 +331,38 @@ public class VoucherToNCforCustomer implements Job{
for (Element element : list) {
List list2 = element.elements();
for (Element el : list2) {
- logger.info("111111111111111111");
+ String s = el.getName();
// 获取单条回执状态
- resultcode = el.element("resultcode").getStringValue();
- if(!"1".equals(resultcode)) {
- logger.info("22222222222222");
- bdocid = el.element("bdocid").getStringValue(); // xml回执id
- resultdescription = el.element("resultdescription").getStringValue(); // 错误信息
-
- // 如果回执状态不等于1, 说明有误, 更新到记录字表并记录错误信息
- updateSql=" UPDATE NCXML_DETAIL_RECORDS SET FLAG='"+resultcode+"',ERR_DESCRIBE='"+resultdescription+"' WHERE BUILLID='"+bdocid+"' AND XML_TYPE= '"+type+"'";
- Sqlca.executeSQL(updateSql);
- logger.info("根据回执信息, 修改传输失败状态, 记录错误信息"+updateSql);
- failed_count++;
+ if("resultcode".equals(s)) {
+ resultcode = el.getStringValue();
+ }
+ // xml回执id
+ if("bdocid".equals(s)) {
+ bdocid = el.getStringValue();
+ }
+ // 错误信息
+ if("resultdescription".equals(s)) {
+ resultdescription = el.getStringValue();
}
}
+
+ if(!"1".equals(resultcode)) {
+ // 如果回执状态不等于1, 说明有误, 更新到记录字表并记录错误信息
+ updateSql=" UPDATE NCXML_DETAIL_RECORDS SET FLAG='"+resultcode+"',ERR_DESCRIBE='"+resultdescription+"' WHERE BUILLID='"+bdocid+"' AND XML_TYPE= '"+type+"'";
+ Sqlca.executeSQL(updateSql);
+ logger.info("根据回执信息, 修改传输失败状态, 记录错误信息"+updateSql);
+ failed_count++;
+ }
}
// 将本批次传输总量及 失败数量记录入记录总表
- String insertSql1="INSERT INTO NCXML_TOTAL_RECORDS(ID,BATCH,XML_TYPE,FLAG_,COUNT_,FAILED_COUNT,CREATETIME) VALUES('"+UUID.randomUUID().toString().replace("-", "")+"','"+batch+"','"+type+"','"+resSuc+"','"+count+"','"+failed_count+"','"+formatter2.format(new Date())+"')";
+ String insertSql1="INSERT INTO NCXML_TOTAL_RECORDS(ID,BATCH,XML_TYPE,FLAG_,COUNT_,FAILED_COUNT,ERR_DESCRIBE,CREATETIME) VALUES('"+UUID.randomUUID().toString().replace("-", "")+"','"+batch+"','"+type+"','"+resSuc+"','"+count+"','"+failed_count+"','"+resultdescription+"','"+formatter2.format(new Date())+"')";
Sqlca.executeSQL(insertSql1);
}else{
logger.info("出现未知错误");
}
}else{
logger.info("未找到successful属性");
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
+ }
+ return returns;
}
-
}
\ No newline at end of file
diff --git a/src_core/com/tenwa/voucher/serviceImp/VoucherToNCforDistributor.java b/src_core/com/tenwa/voucher/serviceImp/VoucherToNCforDistributor.java
index afe21d1fd..c430c0ed0 100644
--- a/src_core/com/tenwa/voucher/serviceImp/VoucherToNCforDistributor.java
+++ b/src_core/com/tenwa/voucher/serviceImp/VoucherToNCforDistributor.java
@@ -94,12 +94,12 @@ public class VoucherToNCforDistributor implements Job{
// 设置xml标签头
Document document = DocumentHelper.createDocument();
Element root = document.addElement("ufinterface");
- root.addAttribute("account", "BQ1217");
- root.addAttribute("billtype", "supplier(供应商)");
+ root.addAttribute("account", "bq1217");
+ root.addAttribute("billtype", "supplier");
root.addAttribute("filename", "");
root.addAttribute("groupcode", "06");
root.addAttribute("isexchange", "Y");
- root.addAttribute("receiver", "接收方业务单元编码");
+ root.addAttribute("receiver", "807001002001");
root.addAttribute("replace", "Y");
root.addAttribute("roottag", "");
root.addAttribute("sender", "gys01");
@@ -135,7 +135,7 @@ public class VoucherToNCforDistributor implements Job{
Element pk_group = billhead.addElement("pk_group"); // 所属集团,最大长度为20,类型为:String
pk_group.setText("06");
Element pk_org = billhead.addElement("pk_org"); // 所属组织,最大长度为20,类型为:String
- pk_org.setText("安鹏租赁业务单元编码");
+ pk_org.setText("807001002001");
Element code = billhead.addElement("code"); // 供应商编号,最大长度为40,类型为:String
code.setText((DISTRIBUTOR_CODING==null)?"":DISTRIBUTOR_CODING);
Element name = billhead.addElement("name"); // 供应商名称,最大长度为200,类型为:String
@@ -264,14 +264,14 @@ public class VoucherToNCforDistributor implements Job{
Sqlca.executeSQL(insertSql);
logger.info("经销商记录语句: "+ insertSql);
}
- String f="D:\\voucherXml_NC\\APleasing_Supplier_"+year_month_day+".xml";
- // String f="//data//files//apzl_leasing//tmp//XZW//APleasing_Supplier_"+year_month_day+".xml";
+ // String f="D:\\voucherXml_NC\\APleasing_Supplier_"+year_month_day+".xml";
+ String f="//data//files//apzl_leasing//tmp//XZW//APleasing_Supplier_"+year_month_day+".xml";
file=new File(f);
writer = new XMLWriter(new FileOutputStream(file), OutputFormat.createPrettyPrint());
writer.setEscapeText(false);// 字符是否转义,默认true
writer.write(document);
writer.close();
- // InterActionToNC(Sqlca,f,type,batch,rs.size());
+ InterActionToNC(Sqlca,f,type,batch,rs.size());
Sqlca.commit();
QuartzUtil.insertLog(plan_date,"com.tenwa.voucher.serviceImp.VoucherToNCforDistributor", "success", "成功",curUserId);
}
@@ -299,20 +299,20 @@ public class VoucherToNCforDistributor implements Job{
/**
* 像NC传输xml, 获取NC回执xml信息, 根据回执信息更改状态
*/
- public static void InterActionToNC(Transaction Sqlca,String inputURL,String type,String batch,int count) {
- try {
+ public static String InterActionToNC(Transaction Sqlca,String inputURL,String type,String batch,int count) throws Exception {
String updateSql = ""; // 更新sql对象
String insertSql = ""; // 新增SQL对象
String deleteSql = ""; // 删除SQL对象
String resultcode= ""; // 单条返回结果
String bdocid = ""; // xml回执id
String resultdescription=""; //错误信息
+ String returns="true";
/**
* 获取对方post连接
*/
//String url = "http://47.93.227.86:8858/service/XChangeServlet?account=q0225&groupcode=001";
- String url = "http://172.16.0.88:9990/service/XChangeServlet?account=BQ1217&groupcode=06";
+ String url = "http://172.16.0.88:9990/service/XChangeServlet?account=bq1217&groupcode=06";
URL realURL = new URL(url);
HttpURLConnection connection = (HttpURLConnection)realURL.openConnection();
connection.setDoOutput(true);
@@ -324,30 +324,39 @@ public class VoucherToNCforDistributor implements Job{
*/
File file = new File(inputURL);
BufferedOutputStream out = new BufferedOutputStream(connection.getOutputStream());
- BufferedInputStream input = new BufferedInputStream(new FileInputStream(file));
- int length;
- byte[] buffer = new byte[1000];
- while ((length = input.read(buffer, 0, 1000)) != -1) {
- out.write(buffer, 0, length);
+ BufferedReader reader = new BufferedReader (new InputStreamReader(new FileInputStream(file),"UTF-8"));
+ String xml="";
+ String ss=null;
+ while((ss=reader.readLine()) != null) {
+ xml+=ss;
+ xml+="\r\n";
+ out.write(ss.getBytes());
}
- input.close();
+ System.out.println(xml);
+ reader.close();
out.close();
/**
* 获取NC回执信息
*/
InputStream inputStream = connection.getInputStream();
- InputStreamReader isr = new InputStreamReader(inputStream);
+ InputStreamReader isr = new InputStreamReader(inputStream,"UTF-8");
BufferedReader bufreader = new BufferedReader(isr);
String xmlString = "";
- int c;
+ String b=null;
+ while((b=bufreader.readLine()) !=null) {
+ xmlString+=b;
+ xmlString+="\r\n";
+ }
+ System.out.println(xmlString);
+ bufreader.close();
+/* int c;
while ((c = bufreader.read()) != -1) {
System.out.print((char) c);
xmlString += (char) c;
- }
- input.close();
+ }*/
+ //input.close();
System.out.println("--------------------------" + xmlString);
-
/**
* 将获取到的回执信息生成本地xml
*/
@@ -355,7 +364,7 @@ public class VoucherToNCforDistributor implements Job{
TransformerFactory tFactory = TransformerFactory.newInstance();
Transformer transformer = tFactory.newTransformer();
DocumentSource source = new DocumentSource(resDoc);
- transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
+ transformer.setOutputProperty(OutputKeys.ENCODING, "utf-8");
//设置文档的换行与缩进
transformer.setOutputProperty(OutputKeys.INDENT, "YES");
@@ -365,13 +374,14 @@ public class VoucherToNCforDistributor implements Job{
// File file2 = new File("D:\\VOUCHER_RECEIPT");
// if (!file2.exists()) {file2.mkdirs();}// 判断是否存在, 如果不存在就创建该文件夹
String resFile = "//data//files//apzl_leasing//tmp//WEN//APleasing_"+type+""+fmt.format(new Date())+".xml";
- // String resFile = "D:\\VOUCHER_RECEIPT\\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));
transformer.transform(source,result);
/**
* 解析xml, 根据回执信息更新状态
*/
+
SAXReader sr = new SAXReader();
Document doc = sr.read(resFile);
Element root= doc.getRootElement();
@@ -379,14 +389,30 @@ public class VoucherToNCforDistributor implements Job{
String resSuc = root.attributeValue("successful");
//后面对回执结果做判断,然后改变导入状态就行了
if(null != resSuc){
- if(resSuc.equals("N")){
+ if("N".equals(resSuc)){
logger.info("导入失败");
// 导入失败, 将本次在明细表中存储的数据删除
deleteSql = "DELETE FROM NCXML_DETAIL_RECORDS WHERE BATCH='"+batch+"' AND XML_TYPE = '"+type+"'";
// 导入失败, 将失败数据记录入总记录表
- insertSql = "INSERT INTO NCXML_TOTAL_RECORDS(ID,BATCH,XML_TYPE,FLAG_,COUNT_,FAILED_COUNT,CREATETIME) VALUES('"+UUID.randomUUID().toString().replace("-", "")+"','"+batch+"','"+type+"','"+resSuc+"','0','"+count+"','"+formatter2.format(new Date())+"')";
+ List list = root.elements();
+ for (Element element : list) {
+ String names = element.getName();
+ String value = element.getStringValue();
+ List list2 = element.elements();
+ for (Element el : list2) {
+ String s = el.getName();
+ if("resultcode".equals(s)) {
+ resultcode = el.getStringValue();
+ }
+ if("resultdescription".equals(s)) {
+ resultdescription = el.getStringValue();
+ }
+ }
+ insertSql = "INSERT INTO NCXML_TOTAL_RECORDS(ID,BATCH,XML_TYPE,FLAG_,COUNT_,FAILED_COUNT,ERR_DESCRIBE,CREATETIME) VALUES('"+UUID.randomUUID().toString().replace("-", "")+"','"+batch+"','"+type+"','"+resSuc+"','"+count+"','"+count+"','"+resultdescription+"','"+formatter2.format(new Date())+"')";
+ }
Sqlca.executeSQL(deleteSql);
Sqlca.executeSQL(insertSql);
+ returns="false";
}else if(resSuc.equals("Y")){
logger.info("导入成功");
List list = root.elements();
@@ -394,33 +420,38 @@ public class VoucherToNCforDistributor implements Job{
for (Element element : list) {
List list2 = element.elements();
for (Element el : list2) {
- logger.info("111111111111111111");
+ String s = el.getName();
// 获取单条回执状态
- resultcode = el.element("resultcode").getStringValue();
- if(!"1".equals(resultcode)) {
- logger.info("22222222222222");
- bdocid = el.element("bdocid").getStringValue(); // xml回执id
- resultdescription = el.element("resultdescription").getStringValue(); // 错误信息
-
- // 如果回执状态不等于1, 说明有误, 更新到记录字表并记录错误信息
- updateSql=" UPDATE NCXML_DETAIL_RECORDS SET FLAG='"+resultcode+"',ERR_DESCRIBE='"+resultdescription+"' WHERE BUILLID='"+bdocid+"' AND XML_TYPE= '"+type+"'";
- Sqlca.executeSQL(updateSql);
- logger.info("根据回执信息, 修改传输失败状态, 记录错误信息"+updateSql);
- failed_count++;
+ if("resultcode".equals(s)) {
+ resultcode = el.getStringValue();
+ }
+ // xml回执id
+ if("bdocid".equals(s)) {
+ bdocid = el.getStringValue();
+ }
+ // 错误信息
+ if("resultdescription".equals(s)) {
+ resultdescription = el.getStringValue();
}
}
+
+ if(!"1".equals(resultcode)) {
+ // 如果回执状态不等于1, 说明有误, 更新到记录字表并记录错误信息
+ updateSql=" UPDATE NCXML_DETAIL_RECORDS SET FLAG='"+resultcode+"',ERR_DESCRIBE='"+resultdescription+"' WHERE BUILLID='"+bdocid+"' AND XML_TYPE= '"+type+"'";
+ Sqlca.executeSQL(updateSql);
+ logger.info("根据回执信息, 修改传输失败状态, 记录错误信息"+updateSql);
+ failed_count++;
+ }
}
// 将本批次传输总量及 失败数量记录入记录总表
- String insertSql1="INSERT INTO NCXML_TOTAL_RECORDS(ID,BATCH,XML_TYPE,FLAG_,COUNT_,FAILED_COUNT,CREATETIME) VALUES('"+UUID.randomUUID().toString().replace("-", "")+"','"+batch+"','"+type+"','"+resSuc+"','"+count+"','"+failed_count+"','"+formatter2.format(new Date())+"')";
+ String insertSql1="INSERT INTO NCXML_TOTAL_RECORDS(ID,BATCH,XML_TYPE,FLAG_,COUNT_,FAILED_COUNT,ERR_DESCRIBE,CREATETIME) VALUES('"+UUID.randomUUID().toString().replace("-", "")+"','"+batch+"','"+type+"','"+resSuc+"','"+count+"','"+failed_count+"','"+resultdescription+"','"+formatter2.format(new Date())+"')";
Sqlca.executeSQL(insertSql1);
}else{
logger.info("出现未知错误");
}
}else{
logger.info("未找到successful属性");
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
+ }
+ return returns;
}
}
diff --git a/src_core/com/tenwa/voucher/serviceImp/VoucherToNCforVoucherPZ.java b/src_core/com/tenwa/voucher/serviceImp/VoucherToNCforVoucherPZ.java
index abf163cbd..25d3036c1 100644
--- a/src_core/com/tenwa/voucher/serviceImp/VoucherToNCforVoucherPZ.java
+++ b/src_core/com/tenwa/voucher/serviceImp/VoucherToNCforVoucherPZ.java
@@ -38,31 +38,30 @@ import com.amarsoft.are.jbo.JBOTransaction;
import com.amarsoft.are.log.Log;
import com.amarsoft.awe.util.Transaction;
import com.base.util.QuartzUtil;
+import com.itextpdf.text.log.SysoCounter;
import com.tenwa.comm.util.date.DateAssistant;
import com.tenwa.comm.util.jboutil.DataOperatorUtil;
import com.tenwa.util.SerialNumberUtil;
-import jbo.com.tenwa.entity.comm.own.OWN_INFO;
import jbo.voucher.LV_STACTS_CONFIG;
public class VoucherToNCforVoucherPZ implements Job{
private static Log logger=ARE.getLog();
- // 凭证信息传输
+ // 鍑瘉淇℃伅浼犺緭
public void execute(JobExecutionContext arg0) throws JobExecutionException {
String plan_date = DateAssistant.getToday();
Object userId = arg0.getTrigger().getJobDataMap().get("CurUserId");
String curUserId = userId == null? "system" : userId.toString();
String ss = DOM4JcreateToVoucher();
if("true".equals(ss)) {
- QuartzUtil.insertLog(plan_date,"com.tenwa.voucher.serviceImp.VoucherToNCforVoucherPZ", "success", "成功",curUserId);
+ QuartzUtil.insertLog(plan_date,"com.tenwa.voucher.serviceImp.VoucherToNCforVoucherPZ", "success", "鎴愬姛",curUserId);
}else {
- QuartzUtil.insertLog(plan_date,"com.tenwa.voucher.serviceImp.VoucherToNCforVoucherPZ", "error", "失败",curUserId);
+ QuartzUtil.insertLog(plan_date,"com.tenwa.voucher.serviceImp.VoucherToNCforVoucherPZ", "error", "澶辫触",curUserId);
}
-
}
/*
- * 页面执行xml传输
+ * 椤甸潰鎵цxml浼犺緭
* */
public String sendVoucherData(JBOTransaction tx) {
String ss = DOM4JcreateToVoucher();
@@ -70,122 +69,125 @@ public class VoucherToNCforVoucherPZ implements Job{
}
/**
- * 凭证信息xml生成, 每1000条生成一个xml
+ * 鍑瘉淇℃伅xml鐢熸垚, 姣1000鏉$敓鎴愪竴涓獂ml
* @throws Exception
*/
private static String DOM4JcreateToVoucher(){
- // 本地xml存放文件夹, 没有就创建
+ // 鏈湴xml瀛樻斁鏂囦欢澶, 娌℃湁灏卞垱寤
// File file2 = new File("D:\\voucherXml_NC");
- // if (!file2.exists()) {file2.mkdirs();}// 判断是否存在, 如果不存在就创建该文件夹
- JBOTransaction tx=null;
- Transaction Sqlca = null;
- String returns="true";
+ // if (!file2.exists()) {file2.mkdirs();}// 鍒ゆ柇鏄惁瀛樺湪, 濡傛灉涓嶅瓨鍦ㄥ氨鍒涘缓璇ユ枃浠跺す
+ JBOTransaction tx=null;
+ Transaction Sqlca = null;
+ String returns="true";
+ String type="voucher"; // 璁板綍琛ㄧ被鍒
+ String batch="";
+ String deleteSql="";
try {
- // 定义全局对象
+ // 瀹氫箟鍏ㄥ眬瀵硅薄
tx= JBOFactory.createJBOTransaction();
Sqlca = Transaction.createTransaction(tx);
Map map = new HashMap();
- Document document=null; // xml文件头
- File file=null; // 生成的xml文件路径
- XMLWriter writer=null; // 输出对象
- String uuid=""; // xml主键id
- String SUBJECT_ID=null; // 获取科目id
- String OWNED_COMPANY = null; // 所属公司
- String ACC_YEAR = null; // 会计期间/年
- String ACC_MONTH = null; // 会计期间/月
- String insertSql=""; // 定义新增语句对象
- String type="voucher"; // 记录表类别
- String timeAll = ""; // 制单日期
+ Document document=null; // xml鏂囦欢澶
+ File file=null; // 鐢熸垚鐨剎ml鏂囦欢璺緞
+ XMLWriter writer=null; // 杈撳嚭瀵硅薄
+ String uuid=""; // xml涓婚敭id
+ String SUBJECT_ID=null; // 鑾峰彇绉戠洰id
+ String OWNED_COMPANY = null; // 鎵灞炲叕鍙
+ String ACC_YEAR = null; // 浼氳鏈熼棿/骞
+ String ACC_MONTH = null; // 浼氳鏈熼棿/鏈
+ String insertSql=""; // 瀹氫箟鏂板璇彞瀵硅薄
+ String timeAll = ""; // 鍒跺崟鏃ユ湡
+ String f5=""; // 鎽樿
String year_month_day = new SimpleDateFormat("yyyyMMddHHmmss").format(new Date());
String year_month_days = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
- // 查询凭证视图, 获取每条凭证
+ // 鏌ヨ鍑瘉瑙嗗浘, 鑾峰彇姣忔潯鍑瘉
String sql = "SELECT F3,F60,ID,MODULE_NAME,DEPT_NAME,F1,F15,V8_STATUS,F5,GENERATE_DATE FROM VI_VOUCHER_V8 WHERE F3 NOT IN(SELECT TABLE_NUM FROM NCXML_DETAIL_RECORDS WHERE FLAG = '1' AND XML_TYPE='"+type+"')";
- List