凭证信息, 接口变更

This commit is contained in:
xiezhiwen 2019-03-05 10:55:42 +08:00
parent 0e020574b0
commit 5356799dad
11 changed files with 178 additions and 124 deletions

View File

@ -3009,6 +3009,9 @@
<attributes>
<attribute name="cust_id" label="客商编码" type="STRING" length="32"/>
<attribute name="cust_name" label="客商名称" type="STRING" length="120"/>
<attribute name="CUST_NO" label="纳税人识别号" type="STRING" length="120"/>
<attribute name="CUST_TYPE" label="分类" type="STRING" length="120"/>
<attribute name="CUST_STATUS" label="启用状态" type="STRING" length="120"/>
<attribute name="inputuserid" label="登记人" type="STRING" length="32"/>
<attribute name="inputorgid" label="登记机构" type="STRING" length="32"/>
<attribute name="inputtime" label="登记时间" type="STRING" length="32"/>

View File

@ -160,8 +160,10 @@
<attribute name="CUST_TYPE" label="分类" type="STRING" length="32"/>
<attribute name="OLD_CUST_ID" label="原客商编码" type="STRING" length="32"/>
<attribute name="OLD_CUST_NAME" label="原客商名称" type="STRING" length="100"/>
<attribute name="OLD_CUST_STATUS" label="原启用状态" type="STRING" length="32"/>
<attribute name="NEW_CUST_ID" label="用友传入客商编码" type="STRING" length="32"/>
<attribute name="NEW_CUST_NAME" label="用友传入客商名称" type="STRING" length="100"/>
<attribute name="NEW_CUST_STATUS" label="用友传入启用状态" type="STRING" length="100"/>
<attribute name="RECORD_DATE" label="记录日期" type="DATE" length="19"/>
<attribute name="inputuserid" label="登记人" type="STRING" length="32"/>
<attribute name="inputorgid" label="登记机构" type="STRING" length="32"/>

View File

@ -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

View File

@ -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<String,String> map=new HashMap<String, String>();
@ -105,7 +105,7 @@ public class CreateVoucherLoanDistributor {
CreateVoucherServiceImpl vs=new CreateVoucherServiceImpl();
String VOUCHER_TYPE="1";// 凭证分类 金蝶
String userid ="admin";
for (int i=0;i<dataList.size();i++){
// 第一车贷
if("PZ2018073100000062".equals(VOUCHERNO)) {

View File

@ -12,33 +12,34 @@ public class ContractOnhireVoucher extends BaseBussiness {
public Object run(Transaction Sqlca) throws Exception {
this.initBussinessParam(Sqlca);
String FlowUnid=this.getAttribute("FlowUnid").toString();
String userid = this.getAttribute("CurUserID").toString();
CreateVoucherLoanDistributor cvld=new CreateVoucherLoanDistributor();
cvld.CreateVoucher(FlowUnid, "PZ2018073100000061");// 确认GPS收入 --回租
cvld.CreateVoucher(FlowUnid, "PZ2018073100000061",userid);// 确认GPS收入 --回租
//cvld.CreateVoucher(FlowUnid, "PZ2018080300000068",Sqlca);// 确认GPS收入 --直租
cvld.CreateVoucher(FlowUnid, "PZ2018070900000003");// 收取首付款-回租
cvld.CreateVoucher(FlowUnid, "PZ2018070900000003",userid);// 收取首付款-回租
//cvld.CreateVoucher(FlowUnid, "PZ2018080200000065",Sqlca);// 收取首付款-直租
cvld.CreateVoucher(FlowUnid, "PZ2018070900000002");// 购置融资租赁资产-
cvld.CreateVoucher(FlowUnid, "PZ2018070900000002",userid);// 购置融资租赁资产-
cvld.CreateVoucher(FlowUnid, "PZ2018073100000062");// 购置融资租赁资产---第一车贷
cvld.CreateVoucher(FlowUnid, "PZ2018073100000062",userid);// 购置融资租赁资产---第一车贷
//cvld.CreateVoucher(FlowUnid, "PZ2018122000000010");// 购置融资租赁资产-
//cvld.CreateVoucher(FlowUnid, "PZ2018072400000060");// 购置融资租赁资产-
cvld.CreateVoucher(FlowUnid, "PZ2018071000000005");// 合同起租一次性确认收入-回租
cvld.CreateVoucher(FlowUnid, "PZ2018071000000005",userid);// 合同起租一次性确认收入-回租
//cvld.CreateVoucher(FlowUnid, "PZ2018080300000069");// 合同起租一次性确认收入-直租
cvld.CreateVoucher(FlowUnid, "PZ2018071000000006");// 合同起租按月分摊收入--回租
cvld.CreateVoucher(FlowUnid, "PZ2018071000000006",userid);// 合同起租按月分摊收入--回租
//cvld.CreateVoucher(FlowUnid, "PZ2018080300000071");// 合同起租按月分摊收入--直租
cvld.CreateVoucher(FlowUnid, "PZ2018071000000004");// 收取客户保证金--回租
cvld.CreateVoucher(FlowUnid, "PZ2018071000000004",userid);// 收取客户保证金--回租
//cvld.CreateVoucher(FlowUnid, "PZ2018080300000070");// 收取客户保证金--直租
cvld.CreateVoucher(FlowUnid, "PZ2018071000000007");// 收取客户手续费一次性确认收入--回租
cvld.CreateVoucher(FlowUnid, "PZ2018071000000007",userid);// 收取客户手续费一次性确认收入--回租
//cvld.CreateVoucher(FlowUnid, "PZ2018080300000072");// 收取客户手续费一次性确认收入--直租
cvld.CreateVoucher(FlowUnid, "PZ2018071000000009");// 收取客户手续费按月分摊收入--回租
cvld.CreateVoucher(FlowUnid, "PZ2018071000000009",userid);// 收取客户手续费按月分摊收入--回租
//cvld.CreateVoucher(FlowUnid, "PZ2018080300000073");// 收取客户手续费按月分摊收入--直租
//String a = ProductParamUtil.getProductParameterValue(dataList.get(i).get("PRODUCT_ID"), "PRD0315", "DISCOUNT", "isBalance");

View File

@ -2,5 +2,5 @@ package com.tenwa.voucher.service;
public interface CustomerService {
public String Customer_syn(String CUST_ID,String CUST_NAME,String CUST_NO,String GRADE);
public String Customer_syn(String CUST_ID,String CUST_NAME,String CUST_PK,String CUST_STATUS,String InitiateMode);
}

View File

@ -17,7 +17,7 @@ import com.tenwa.voucher.service.CustomerService;
public class CustomerServiceImpl implements CustomerService{
@SuppressWarnings("deprecation")
public String Customer_syn(String CUST_ID,String CUST_NAME, String CUST_PK,String CUST_STATUS){
public String Customer_syn(String CUST_ID,String CUST_NAME, String CUST_PK,String CUST_STATUS,String InitiateMode){
// 获取当前系统时间
String startime = StringFunction.getTodayNow();
// 反馈结果
@ -26,11 +26,12 @@ public class CustomerServiceImpl implements CustomerService{
String sql1="";
String insertSql1="";
String insertSql2="";
// 获取事物
JBOTransaction tx = null;
Transaction Sqlca =null;
try {
tx =JBOFactory.createJBOTransaction();
// Sqlca = Transaction.createTransaction(CacheLoaderFactory.getDataSource());
Sqlca = Transaction.createTransaction(tx);
// 判断参数是否为空, 为空则反馈错误信息
@ -41,34 +42,47 @@ public class CustomerServiceImpl implements CustomerService{
}else if(CUST_PK==null || CUST_PK=="" || CUST_PK.length()<=0){
return "传输失败:唯一标识不能为空 !";
}else if(CUST_STATUS==null || CUST_STATUS=="" || CUST_STATUS.length()<=0){
return "传输失败:标识不能为空 !";
return "传输失败:唯一标识不能为空 !";
}else if(InitiateMode==null || InitiateMode=="" || InitiateMode.length()<=0){
return "传输失败:启用状态不能为空 !";
}else if(!"U".equals(CUST_STATUS) && !"I".equals(CUST_STATUS)){
return "传输失败:传输标识有误 !";
}
// 执行sql, 用于获取数据及判断新增 or 修改操作
sql1="SELECT cust_id,cust_name FROM CUSTOMER_LIST WHERE CUST_NO=:CUST_PK";
// 执行SQL, 根据唯一标识查询, 判断新增或修改
Map<String, String> 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<Map<String, String>> 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);
}
}

View File

@ -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");

View File

@ -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<Map<String, String>> 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<rs.size();i++) {
customer_num=rs.get(i).get("customer_num"); // 获取客户编号
customername=rs.get(i).get("customername"); // 获取客户名称
certid=rs.get(i).get("certid"); // 身份证号
Element bill = root.addElement("bill");
//uuid=UUID.randomUUID().toString().replace("-", "");
@ -170,7 +174,7 @@ public class VoucherToNCforCustomer implements Job{
Element code = billhead.addElement("code"); // 客户编码,最大长度为40,类型为:String
code.setText((customer_num==null)?"":customer_num);
Element name = billhead.addElement("name"); // 客户名称,最大长度为200,类型为:String
name.setText((customername==null)?"":customername);
name.setText((customername==null)?"":customername+"-"+certid);
Element shortname = billhead.addElement("shortname"); // 客户简称,最大长度为200,类型为:String
shortname.setText((customername==null)?"":customername);
Element mnecode = billhead.addElement("mnecode"); // 助记码,最大长度为50,类型为:String
@ -251,7 +255,7 @@ public class VoucherToNCforCustomer implements Job{
}
}
}
String URL="//data//files//apzl_leasing//tmp//XZW//APleasing_Customer_"+year_month_day+".xml";
String URL=LOCALHOST_URL+"//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());
@ -292,11 +296,16 @@ public class VoucherToNCforCustomer 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);
@ -336,7 +345,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");
@ -345,7 +354,8 @@ public class VoucherToNCforCustomer 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";
System.out.println(resFile);
//String resFile = "D:\\VOUCHER_RECEIPT\\APleasing_"+type+""+fmt.format(new Date())+".xml";
StreamResult result = new StreamResult(new File(resFile));
// 将回执信息转化为xml
@ -355,8 +365,7 @@ public class VoucherToNCforCustomer implements Job{
* 解析xml, 根据回执信息更新状态
*/
SAXReader sr = new SAXReader();
System.out.println(resFile);
Document doc = sr.read(resFile);
Document doc = sr.read(new File(resFile));
Element root= doc.getRootElement();
// 根据successful判断是否有失败的, 有则为N, 全部成功为Y
String resSuc = root.attributeValue("successful");

View File

@ -44,6 +44,7 @@ import com.amarsoft.dict.als.manage.NameManager;
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;
@ -71,40 +72,42 @@ public class VoucherToNCforDistributor 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("distributor_account");
String account = VouchersPropertiesUtil.get("distributor_account");
// 单据类型
String billtype = properties.getProperty("distributor_billtype");
String billtype = VouchersPropertiesUtil.get("distributor_billtype");
// 集团编码
String groupcode = properties.getProperty("distributor_groupcode");
String groupcode = VouchersPropertiesUtil.get("distributor_groupcode");
// 系统参数
String isexchange = properties.getProperty("distributor_isexchange");
String isexchange = VouchersPropertiesUtil.get("distributor_isexchange");
// 接收方
String receiver = properties.getProperty("distributor_receiver");
String receiver = VouchersPropertiesUtil.get("distributor_receiver");
// 外系统编码
String sender = properties.getProperty("distributor_sender");
String sender = VouchersPropertiesUtil.get("distributor_sender");
// 系统参数
String replace = properties.getProperty("distributor_replace");
String replace = VouchersPropertiesUtil.get("distributor_replace");
// 所属组织
String pk_org = properties.getProperty("distributor_pk_org");
String pk_org = VouchersPropertiesUtil.get("distributor_pk_org");
// 所属集团
String pk_group = properties.getProperty("distributor_pk_group");
String pk_group = VouchersPropertiesUtil.get("distributor_pk_group");
// 供应商基本分类
String pk_supplierclass = properties.getProperty("distributor_pk_supplierclass");
String pk_supplierclass = VouchersPropertiesUtil.get("distributor_pk_supplierclass");
// 国家地区
String pk_country = properties.getProperty("distributor_pk_country");
String pk_country = VouchersPropertiesUtil.get("distributor_pk_country");
// 时区
String pk_timezone = properties.getProperty("distributor_pk_timezone");
String pk_timezone = VouchersPropertiesUtil.get("distributor_pk_timezone");
// 账数据格式
String pk_format = properties.getProperty("distributor_pk_format");
String pk_format = VouchersPropertiesUtil.get("distributor_pk_format");
// 传输xml文件存放路径
String LOCALHOST_URL = VouchersPropertiesUtil.get("LOCALHOST_URL");
File file = null; // 文件对象
@ -329,7 +332,7 @@ public class VoucherToNCforDistributor implements Job{
}
}
//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=LOCALHOST_URL+"//APleasing_Supplier_"+year_month_day+".xml";
file=new File(f);
writer = new XMLWriter(new FileOutputStream(file), OutputFormat.createPrettyPrint());
writer.setEscapeText(false);// 字符是否转义,默认true
@ -370,11 +373,16 @@ public class VoucherToNCforDistributor 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);
@ -423,7 +431,7 @@ public class VoucherToNCforDistributor 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
@ -433,7 +441,7 @@ public class VoucherToNCforDistributor 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");

View File

@ -43,6 +43,7 @@ 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.httpclient.resources.VouchersPropertiesUtil;
import com.tenwa.util.SerialNumberUtil;
import jbo.com.tenwa.entity.comm.own.OWN_ACCOUNT;
@ -100,45 +101,46 @@ public class VoucherToNCforVoucherPZ implements Job{
/**
* 读取配置文件信息
* */
// 创建Properties对象
Properties properties = new Properties();
// 获取配置文件输入流
//创建Properties对象
//Properties properties = new Properties();
//获取配置文件输入流
//in = new FileInputStream("/vouchers.properties");
in = new FileInputStream("//data/config//vouchers.properties");
// 通过Properties对象读取配置文件
properties.load(in);
//in = new FileInputStream("//data/config//vouchers.properties");
//通过Properties对象读取配置文件
//properties.load(in);
// 获取配置文件数据
// 账套
String account = properties.getProperty("voucher_account");
String account = VouchersPropertiesUtil.get("voucher_account");
// 单据类型
String billtype = properties.getProperty("voucher_billtype");
String billtype = VouchersPropertiesUtil.get("voucher_billtype");
// 集团编码
String groupcode = properties.getProperty("voucher_groupcode");
String groupcode = VouchersPropertiesUtil.get("voucher_groupcode");
// 系统参数
String isexchange = properties.getProperty("voucher_isexchange");
String isexchange = VouchersPropertiesUtil.get("voucher_isexchange");
// 接收方
String receiver = properties.getProperty("voucher_receiver");
String receiver = VouchersPropertiesUtil.get("voucher_receiver");
// 外系统编码
String sender = properties.getProperty("voucher_sender");
String sender = VouchersPropertiesUtil.get("voucher_sender");
// 系统参数
String replace = properties.getProperty("voucher_replace");
String replace = VouchersPropertiesUtil.get("voucher_replace");
// 凭证类别
String pk_vouchertype = properties.getProperty("voucher_pk_vouchertype");
String pk_vouchertype = VouchersPropertiesUtil.get("voucher_pk_vouchertype");
// 来源系统
String pk_system = properties.getProperty("voucher_pk_system");
String pk_system = VouchersPropertiesUtil.get("voucher_pk_system");
// 凭证类型值
String voucherkind = properties.getProperty("voucher_voucherkind");
String voucherkind = VouchersPropertiesUtil.get("voucher_voucherkind");
// 核算账簿
String pk_accountingbook = properties.getProperty("voucher_pk_accountingbook");
String pk_accountingbook = VouchersPropertiesUtil.get("voucher_pk_accountingbook");
// 制单人
String pk_prepared = properties.getProperty("voucher_pk_prepared");
String pk_prepared = VouchersPropertiesUtil.get("voucher_pk_prepared");
// 所属组织
String pk_org = properties.getProperty("voucher_pk_org");
String pk_org = VouchersPropertiesUtil.get("voucher_pk_org");
// 所属集团
String pk_group = properties.getProperty("voucher_pk_group");
String pk_group = VouchersPropertiesUtil.get("voucher_pk_group");
// 币种
String pk_currtype = properties.getProperty("voucher_pk_currtype");
System.out.println(111);
String pk_currtype = VouchersPropertiesUtil.get("voucher_pk_currtype");
// 传输xml文件存放路径
String LOCALHOST_URL = VouchersPropertiesUtil.get("LOCALHOST_URL");
/**
* 定义全局变量
*/
@ -203,8 +205,8 @@ public class VoucherToNCforVoucherPZ implements Job{
batch = SerialNumberUtil.getVoucherPCNumber(Sqlca);
for (int x = i * b; x < (i + 1) * b && x < a; x++) { // 决定当前xml生成的数据量
// 获取凭证编号
String F3=list.get(x).get("F3");
String F60=list.get(x).get("F60");
String F3=list.get(x).get("f3");
String F60=list.get(x).get("f60");
map.clear();
map.put("F3",F3);
@ -505,9 +507,10 @@ public class VoucherToNCforVoucherPZ implements Job{
}
}
}
String URL="//data//files//apzl_leasing//tmp//XZW//APleasing_VOUCHER_"+year_month_day+".xml";
String URL=LOCALHOST_URL+"//APleasing_VOUCHER_"+year_month_day+".xml";
//String URL="D:\\voucherXml_NC\\APleasing_VOUCHER_"+year_month_day+".xml";
file=new File(URL);
System.out.println("存放传输文件路径: "+file);
writer = new XMLWriter(new FileOutputStream(file), OutputFormat.createPrettyPrint());
writer.setEscapeText(false);// 字符是否转义,默认true
writer.write(document);
@ -546,16 +549,21 @@ public class VoucherToNCforVoucherPZ 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);
connection.setRequestProperty("Content-type", "text/xml");
connection.setRequestMethod("POST");
/**
* 读取本方生成的xml, 传输到NC
*/
@ -599,7 +607,7 @@ public class VoucherToNCforVoucherPZ 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
@ -609,7 +617,7 @@ public class VoucherToNCforVoucherPZ 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");