凭证相关-NC接口优化
This commit is contained in:
parent
74554dc38d
commit
e8156f860d
@ -8,6 +8,7 @@ import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.PrintStream;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import java.text.SimpleDateFormat;
|
||||
@ -65,6 +66,9 @@ public class VoucherToNCforAssistContract implements Job{
|
||||
Transaction Sqlca = null;
|
||||
// 获取配置文件的输入流
|
||||
FileInputStream in=null;
|
||||
//用于记录异常
|
||||
File file1 = null;
|
||||
PrintStream stream = null;
|
||||
// xml类别
|
||||
String type="contract";
|
||||
// 批次号
|
||||
@ -112,7 +116,11 @@ public class VoucherToNCforAssistContract implements Job{
|
||||
String pk_group = VouchersPropertiesUtil.get("contract_pk_group");
|
||||
// 传输xml文件存放路径
|
||||
String LOCALHOST_URL = VouchersPropertiesUtil.get("LOCALHOST_URL");
|
||||
|
||||
// 错误信息存放路径
|
||||
String ERROR_URL = VouchersPropertiesUtil.get("ERROR_URL");
|
||||
// 异常记录路径
|
||||
file1=new File(ERROR_URL+"NC_ERROR-"+year_month_day+".txt");
|
||||
stream=new PrintStream(file1);
|
||||
/**
|
||||
* 定义全局变量
|
||||
*/
|
||||
@ -217,16 +225,18 @@ public class VoucherToNCforAssistContract implements Job{
|
||||
Sqlca.rollback();
|
||||
if(batch!=null || !"".equals(batch)){
|
||||
logger.debug("合同xml传输失败");
|
||||
String insertSql="INSERT INTO NCXML_TOTAL_RECORDS(ID,BATCH,XML_TYPE,FLAG_,COUNT_,FAILED_COUNT,ERR_DESCRIBE,CREATETIME) VALUES('"+UUID.randomUUID().toString().replace("-", "")+"','"+batch+"','"+type+"','N','"+count+"','"+count+"','传输失败, 请联系管理员 !','"+year_month_days+"')";
|
||||
String insertSql="INSERT INTO NCXML_TOTAL_RECORDS(ID,BATCH,XML_TYPE,FLAG_,COUNT_,FAILED_COUNT,ERR_DESCRIBE,CREATETIME) VALUES('"+UUID.randomUUID().toString().replace("-", "")+"','"+batch+"','"+type+"','N','"+count+"','"+count+"','"+e.toString()+"','"+year_month_days+"')";
|
||||
Sqlca1.executeSQL(insertSql);
|
||||
Sqlca1.commit();
|
||||
}
|
||||
} catch (Exception e2) {
|
||||
e2.printStackTrace();
|
||||
}
|
||||
|
||||
e.printStackTrace(stream);
|
||||
e.printStackTrace();
|
||||
}finally {
|
||||
stream.flush();
|
||||
stream.close();
|
||||
if(Sqlca!=null) {
|
||||
try {
|
||||
Sqlca.commit();
|
||||
@ -256,6 +266,9 @@ public class VoucherToNCforAssistContract implements Job{
|
||||
Transaction Sqlca = null;
|
||||
// 获取配置文件的输入流
|
||||
FileInputStream in=null;
|
||||
//用于记录异常
|
||||
File file1 = null;
|
||||
PrintStream stream = null;
|
||||
// xml类别
|
||||
String type="contract";
|
||||
// 记录当前批次传输总量
|
||||
@ -302,7 +315,11 @@ public class VoucherToNCforAssistContract implements Job{
|
||||
String pk_group = VouchersPropertiesUtil.get("contract_pk_group");
|
||||
// 传输xml文件存放路径
|
||||
String LOCALHOST_URL = VouchersPropertiesUtil.get("LOCALHOST_URL");
|
||||
|
||||
// 错误信息存放路径
|
||||
String ERROR_URL = VouchersPropertiesUtil.get("ERROR_URL");
|
||||
// 异常记录路径
|
||||
file1=new File(ERROR_URL+"NC_ERROR-"+year_month_day+".txt");
|
||||
stream=new PrintStream(file1);
|
||||
/**
|
||||
* 定义全局变量
|
||||
*/
|
||||
@ -408,16 +425,19 @@ public class VoucherToNCforAssistContract implements Job{
|
||||
Sqlca.rollback();
|
||||
if(batch!=null || !"".equals(batch)){
|
||||
logger.debug("合同xml传输失败");
|
||||
String insertSql="INSERT INTO NCXML_TOTAL_RECORDS(ID,BATCH,XML_TYPE,FLAG_,COUNT_,FAILED_COUNT,ERR_DESCRIBE,CREATETIME) VALUES('"+UUID.randomUUID().toString().replace("-", "")+"','"+batch+"','"+type+"','N','"+count+"','"+count+"','传输失败, 请联系管理员 !','"+year_month_days+"')";
|
||||
String insertSql="INSERT INTO NCXML_TOTAL_RECORDS(ID,BATCH,XML_TYPE,FLAG_,COUNT_,FAILED_COUNT,ERR_DESCRIBE,CREATETIME) VALUES('"+UUID.randomUUID().toString().replace("-", "")+"','"+batch+"','"+type+"','N','"+count+"','"+count+"','"+e.toString()+"','"+year_month_days+"')";
|
||||
Sqlca1.executeSQL(insertSql);
|
||||
Sqlca1.commit();
|
||||
}
|
||||
} catch (Exception e2) {
|
||||
e2.printStackTrace();
|
||||
}
|
||||
e.printStackTrace(stream);
|
||||
e.printStackTrace();
|
||||
returns="false";
|
||||
}finally {
|
||||
stream.flush();
|
||||
stream.close();
|
||||
if(Sqlca!=null) {
|
||||
try {
|
||||
Sqlca.commit();
|
||||
|
||||
@ -8,6 +8,7 @@ import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.PrintStream;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import java.text.SimpleDateFormat;
|
||||
@ -69,6 +70,9 @@ public class VoucherToNCforCustomer implements Job{
|
||||
Transaction Sqlca = null;
|
||||
// 获取配置文件的输入流
|
||||
FileInputStream in =null;
|
||||
//用于记录异常
|
||||
File file1 = null;
|
||||
PrintStream stream = null;
|
||||
// 定义xml类型对象
|
||||
String type="customer";
|
||||
// 批次号
|
||||
@ -126,6 +130,11 @@ public class VoucherToNCforCustomer implements Job{
|
||||
String pk_format = VouchersPropertiesUtil.get("customer_pk_format");
|
||||
// 传输xml文件存放路径
|
||||
String LOCALHOST_URL = VouchersPropertiesUtil.get("LOCALHOST_URL");
|
||||
// 错误信息存放路径
|
||||
String ERROR_URL = VouchersPropertiesUtil.get("ERROR_URL");
|
||||
// 异常记录路径
|
||||
file1=new File(ERROR_URL+"NC_ERROR-"+year_month_day+".txt");
|
||||
stream=new PrintStream(file1);
|
||||
|
||||
// 定义文件对象
|
||||
File file=null;
|
||||
@ -286,16 +295,18 @@ public class VoucherToNCforCustomer implements Job{
|
||||
Sqlca.rollback();
|
||||
if(batch!=null || !"".equals(batch)){
|
||||
logger.debug("客户xml传输失败");
|
||||
String insertSql="INSERT INTO NCXML_TOTAL_RECORDS(ID,BATCH,XML_TYPE,FLAG_,COUNT_,FAILED_COUNT,ERR_DESCRIBE,CREATETIME) VALUES('"+UUID.randomUUID().toString().replace("-", "")+"','"+batch+"','"+type+"','N','"+count+"','"+count+"','传输失败, 请联系管理员 !','"+year_month_days+"')";
|
||||
String insertSql="INSERT INTO NCXML_TOTAL_RECORDS(ID,BATCH,XML_TYPE,FLAG_,COUNT_,FAILED_COUNT,ERR_DESCRIBE,CREATETIME) VALUES('"+UUID.randomUUID().toString().replace("-", "")+"','"+batch+"','"+type+"','N','"+count+"','"+count+"','"+e.toString()+"','"+year_month_days+"')";
|
||||
Sqlca1.executeSQL(insertSql);
|
||||
Sqlca1.commit();
|
||||
}
|
||||
} catch (Exception e2) {
|
||||
e2.printStackTrace();
|
||||
}
|
||||
|
||||
e.printStackTrace(stream);
|
||||
e.printStackTrace();
|
||||
}finally {
|
||||
stream.flush();
|
||||
stream.close();
|
||||
if (Sqlca!=null) {
|
||||
try {
|
||||
Sqlca.commit();
|
||||
@ -325,6 +336,9 @@ public class VoucherToNCforCustomer implements Job{
|
||||
Transaction Sqlca = null;
|
||||
// 获取配置文件的输入流
|
||||
FileInputStream in =null;
|
||||
//用于记录异常
|
||||
File file1 = null;
|
||||
PrintStream stream = null;
|
||||
// 定义xml类型对象
|
||||
String type="customer";
|
||||
// 批次号
|
||||
@ -380,7 +394,11 @@ public class VoucherToNCforCustomer implements Job{
|
||||
String pk_format = VouchersPropertiesUtil.get("customer_pk_format");
|
||||
// 传输xml文件存放路径
|
||||
String LOCALHOST_URL = VouchersPropertiesUtil.get("LOCALHOST_URL");
|
||||
|
||||
// 错误信息存放路径
|
||||
String ERROR_URL = VouchersPropertiesUtil.get("ERROR_URL");
|
||||
// 异常记录路径
|
||||
file1=new File(ERROR_URL+"NC_ERROR-"+year_month_day+".txt");
|
||||
stream=new PrintStream(file1);
|
||||
// 定义文件对象
|
||||
File file=null;
|
||||
// 定义Document对象
|
||||
@ -541,17 +559,19 @@ public class VoucherToNCforCustomer implements Job{
|
||||
Sqlca.rollback();
|
||||
if(batch!=null || !"".equals(batch)){
|
||||
logger.debug("客户xml传输失败");
|
||||
String insertSql="INSERT INTO NCXML_TOTAL_RECORDS(ID,BATCH,XML_TYPE,FLAG_,COUNT_,FAILED_COUNT,ERR_DESCRIBE,CREATETIME) VALUES('"+UUID.randomUUID().toString().replace("-", "")+"','"+batch+"','"+type+"','N','"+count+"','"+count+"','传输失败, 请联系管理员 !','"+year_month_days+"')";
|
||||
String insertSql="INSERT INTO NCXML_TOTAL_RECORDS(ID,BATCH,XML_TYPE,FLAG_,COUNT_,FAILED_COUNT,ERR_DESCRIBE,CREATETIME) VALUES('"+UUID.randomUUID().toString().replace("-", "")+"','"+batch+"','"+type+"','N','"+count+"','"+count+"','"+e.toString()+"','"+year_month_days+"')";
|
||||
Sqlca1.executeSQL(insertSql);
|
||||
Sqlca1.commit();
|
||||
}
|
||||
} catch (Exception e2) {
|
||||
e2.printStackTrace();
|
||||
}
|
||||
|
||||
e.printStackTrace(stream);
|
||||
e.printStackTrace();
|
||||
returns="false";
|
||||
}finally {
|
||||
stream.flush();
|
||||
stream.close();
|
||||
if (Sqlca!=null) {
|
||||
try {
|
||||
Sqlca.commit();
|
||||
|
||||
@ -8,6 +8,7 @@ import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.PrintStream;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import java.text.SimpleDateFormat;
|
||||
@ -67,6 +68,9 @@ public class VoucherToNCforDistributor implements Job{
|
||||
Transaction Sqlca = null;
|
||||
// 获取配置文件的输入流
|
||||
FileInputStream in=null;
|
||||
//用于记录异常
|
||||
File file1 = null;
|
||||
PrintStream stream = null;
|
||||
// 批次号
|
||||
String batch = "";
|
||||
// xml类别
|
||||
@ -91,7 +95,7 @@ public class VoucherToNCforDistributor implements Job{
|
||||
// in = new FileInputStream("//data/config//vouchers.properties");
|
||||
// 通过Properties对象读取配置文件
|
||||
// properties.load(in);
|
||||
|
||||
|
||||
// 获取配置文件数据
|
||||
// 账套
|
||||
String account = VouchersPropertiesUtil.get("distributor_account");
|
||||
@ -121,7 +125,11 @@ public class VoucherToNCforDistributor implements Job{
|
||||
String pk_format = VouchersPropertiesUtil.get("distributor_pk_format");
|
||||
// 传输xml文件存放路径
|
||||
String LOCALHOST_URL = VouchersPropertiesUtil.get("LOCALHOST_URL");
|
||||
|
||||
// 错误信息存放路径
|
||||
String ERROR_URL = VouchersPropertiesUtil.get("ERROR_URL");
|
||||
// 异常记录路径
|
||||
file1=new File(ERROR_URL+"NC_ERROR-"+year_month_day+".txt");
|
||||
stream=new PrintStream(file1);
|
||||
|
||||
File file = null; // 文件对象
|
||||
XMLWriter writer = null; // 输出对象
|
||||
@ -358,15 +366,18 @@ public class VoucherToNCforDistributor implements Job{
|
||||
Sqlca.rollback();
|
||||
if(batch!=null || !"".equals(batch)){
|
||||
logger.debug("经销商xml传输失败");
|
||||
String insertSql="INSERT INTO NCXML_TOTAL_RECORDS(ID,BATCH,XML_TYPE,FLAG_,COUNT_,FAILED_COUNT,ERR_DESCRIBE,CREATETIME) VALUES('"+UUID.randomUUID().toString().replace("-", "")+"','"+batch+"','"+type+"','N','"+count+"','"+count+"','传输失败, 请联系管理员 !','"+year_month_days+"')";
|
||||
String insertSql="INSERT INTO NCXML_TOTAL_RECORDS(ID,BATCH,XML_TYPE,FLAG_,COUNT_,FAILED_COUNT,ERR_DESCRIBE,CREATETIME) VALUES('"+UUID.randomUUID().toString().replace("-", "")+"','"+batch+"','"+type+"','N','"+count+"','"+count+"','"+e.toString()+"','"+year_month_days+"')";
|
||||
Sqlca1.executeSQL(insertSql);
|
||||
Sqlca1.commit();
|
||||
}
|
||||
} catch (Exception e2) {
|
||||
e2.printStackTrace();
|
||||
}
|
||||
e.printStackTrace();
|
||||
e.printStackTrace(stream);
|
||||
e.printStackTrace();
|
||||
}finally {
|
||||
stream.flush();
|
||||
stream.close();
|
||||
if(Sqlca!=null) {
|
||||
try {
|
||||
Sqlca.commit();
|
||||
@ -403,6 +414,9 @@ public class VoucherToNCforDistributor implements Job{
|
||||
String year_month_days = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
|
||||
// 获取配置文件的输入流
|
||||
FileInputStream in=null;
|
||||
//用于记录异常
|
||||
File file1 = null;
|
||||
PrintStream stream = null;
|
||||
// 批次号
|
||||
String batch = "";
|
||||
try {
|
||||
@ -449,7 +463,11 @@ public class VoucherToNCforDistributor implements Job{
|
||||
String pk_format = VouchersPropertiesUtil.get("distributor_pk_format");
|
||||
// 传输xml文件存放路径
|
||||
String LOCALHOST_URL = VouchersPropertiesUtil.get("LOCALHOST_URL");
|
||||
|
||||
// 错误信息存放路径
|
||||
String ERROR_URL = VouchersPropertiesUtil.get("ERROR_URL");
|
||||
// 异常记录路径
|
||||
file1=new File(ERROR_URL+"NC_ERROR-"+year_month_day+".txt");
|
||||
stream=new PrintStream(file1);
|
||||
|
||||
File file = null; // 文件对象
|
||||
XMLWriter writer = null; // 输出对象
|
||||
@ -685,16 +703,19 @@ public class VoucherToNCforDistributor implements Job{
|
||||
Sqlca.rollback();
|
||||
if(batch!=null || !"".equals(batch)){
|
||||
logger.debug("经销商xml传输失败");
|
||||
String insertSql="INSERT INTO NCXML_TOTAL_RECORDS(ID,BATCH,XML_TYPE,FLAG_,COUNT_,FAILED_COUNT,ERR_DESCRIBE,CREATETIME) VALUES('"+UUID.randomUUID().toString().replace("-", "")+"','"+batch+"','"+type+"','N','"+count+"','"+count+"','传输失败, 请联系管理员 !','"+year_month_days+"')";
|
||||
String insertSql="INSERT INTO NCXML_TOTAL_RECORDS(ID,BATCH,XML_TYPE,FLAG_,COUNT_,FAILED_COUNT,ERR_DESCRIBE,CREATETIME) VALUES('"+UUID.randomUUID().toString().replace("-", "")+"','"+batch+"','"+type+"','N','"+count+"','"+count+"','"+e.toString()+"','"+year_month_days+"')";
|
||||
Sqlca1.executeSQL(insertSql);
|
||||
Sqlca1.commit();
|
||||
}
|
||||
} catch (Exception e2) {
|
||||
e2.printStackTrace();
|
||||
}
|
||||
e.printStackTrace(stream);
|
||||
e.printStackTrace();
|
||||
returns="false";
|
||||
}finally {
|
||||
stream.flush();
|
||||
stream.close();
|
||||
if(Sqlca!=null) {
|
||||
try {
|
||||
Sqlca.commit();
|
||||
|
||||
@ -3,11 +3,16 @@ package com.tenwa.voucher.serviceImp;
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.BufferedOutputStream;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.PrintStream;
|
||||
import java.io.PrintWriter;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import java.text.SimpleDateFormat;
|
||||
@ -64,11 +69,6 @@ public class VoucherToNCforVoucherPZ implements Job{
|
||||
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);
|
||||
}else {
|
||||
QuartzUtil.insertLog(plan_date,"com.tenwa.voucher.serviceImp.VoucherToNCforVoucherPZ", "error", "失败",curUserId);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -94,6 +94,9 @@ public class VoucherToNCforVoucherPZ implements Job{
|
||||
String returns="true";
|
||||
// 获取配置文件的输入流
|
||||
FileInputStream in=null;
|
||||
//用于记录异常
|
||||
File file1 = null;
|
||||
PrintStream stream = null;
|
||||
// 记录表类别
|
||||
String type="voucher";
|
||||
// 批次号
|
||||
@ -114,13 +117,6 @@ public class VoucherToNCforVoucherPZ implements Job{
|
||||
/**
|
||||
* 读取配置文件信息
|
||||
* */
|
||||
//创建Properties对象
|
||||
//Properties properties = new Properties();
|
||||
//获取配置文件输入流
|
||||
//in = new FileInputStream("/vouchers.properties");
|
||||
//in = new FileInputStream("//data/config//vouchers.properties");
|
||||
//通过Properties对象读取配置文件
|
||||
//properties.load(in);
|
||||
// 获取配置文件数据
|
||||
// 账套
|
||||
String account = VouchersPropertiesUtil.get("voucher_account");
|
||||
@ -154,9 +150,14 @@ public class VoucherToNCforVoucherPZ implements Job{
|
||||
String pk_currtype = VouchersPropertiesUtil.get("voucher_pk_currtype");
|
||||
// 传输xml文件存放路径
|
||||
String LOCALHOST_URL = VouchersPropertiesUtil.get("LOCALHOST_URL");
|
||||
// 错误信息存放路径
|
||||
String ERROR_URL = VouchersPropertiesUtil.get("ERROR_URL");
|
||||
/**
|
||||
* 定义全局变量
|
||||
*/
|
||||
// 异常记录路径
|
||||
file1=new File(ERROR_URL+"NC_ERROR-"+year_month_day+".txt");
|
||||
stream=new PrintStream(file1);
|
||||
// xml文件头
|
||||
Document document=null;
|
||||
// 生成的xml文件路径
|
||||
@ -563,17 +564,24 @@ public class VoucherToNCforVoucherPZ implements Job{
|
||||
Sqlca.rollback();
|
||||
if(batch!=null || !"".equals(batch)){
|
||||
logger.debug("凭证xml传输失败");
|
||||
String insertSql="INSERT INTO NCXML_TOTAL_RECORDS(ID,BATCH,XML_TYPE,FLAG_,COUNT_,FAILED_COUNT,ERR_DESCRIBE,CREATETIME) VALUES('"+UUID.randomUUID().toString().replace("-", "")+"','"+batch+"','"+type+"','N','"+count+"','"+count+"','传输失败, 请联系管理员 !','"+year_month_days+"')";
|
||||
String insertSql="INSERT INTO NCXML_TOTAL_RECORDS(ID,BATCH,XML_TYPE,FLAG_,COUNT_,FAILED_COUNT,ERR_DESCRIBE,CREATETIME) VALUES('"+UUID.randomUUID().toString().replace("-", "")+"','"+batch+"','"+type+"','N','"+count+"','"+count+"','"+e.toString()+"','"+year_month_days+"')";
|
||||
Sqlca1.executeSQL(insertSql);
|
||||
Sqlca1.commit();
|
||||
}
|
||||
} catch (Exception e2) {
|
||||
e2.printStackTrace();
|
||||
}
|
||||
|
||||
/*try {
|
||||
new PrintWriter(new BufferedWriter(new FileWriter("E:/log.txt",true)),true).println(e.toString());
|
||||
} catch (IOException e1) {
|
||||
e1.printStackTrace();
|
||||
}*/
|
||||
e.printStackTrace(stream);
|
||||
e.printStackTrace();
|
||||
returns="false";
|
||||
}finally {
|
||||
stream.flush();
|
||||
stream.close();
|
||||
if(Sqlca!=null) {
|
||||
try {
|
||||
Sqlca.commit();
|
||||
@ -594,7 +602,6 @@ public class VoucherToNCforVoucherPZ implements Job{
|
||||
return returns;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 像NC传输xml, 获取NC回执xml信息, 根据回执信息更改状态
|
||||
*/
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user