凭证接口

This commit is contained in:
amarsoft 2018-08-27 15:27:45 +08:00
parent ec2d8e5381
commit 51b5334c30
2 changed files with 90 additions and 0 deletions

View File

@ -0,0 +1,6 @@
package com.tenwa.voucher.service;
public interface VoucherSysJointNCService {
public void sendVoucherData()throws Exception;
}

View File

@ -0,0 +1,84 @@
package com.tenwa.voucher.serviceImp;
import java.io.File;
import java.io.FileOutputStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.dom4j.Document;
import org.dom4j.DocumentHelper;
import org.dom4j.Element;
import org.dom4j.io.OutputFormat;
import org.dom4j.io.XMLWriter;
import com.amarsoft.are.jbo.JBOFactory;
import com.amarsoft.awe.util.Transaction;
import com.amarsoft.dict.als.cache.CacheLoaderFactory;
import com.tenwa.comm.util.jboutil.DataOperatorUtil;
import com.tenwa.voucher.service.VoucherSysJointNCService;
public class VoucherSysJointNCServiceImpl implements VoucherSysJointNCService {
@Override
public void sendVoucherData() throws Exception {
}
private static List<String> getDataList() throws Exception{
Transaction Sqlca =null;
Map<String,String> map=new HashMap<String, String>();
List<String> f3list=new ArrayList<String>();
Sqlca = Transaction.createTransaction(CacheLoaderFactory.getDataSource());
String sql="select F3 from voucher_v8 where v8_flag='1' or v8_flag='-1'";
List<Map<String,String>> dataList=DataOperatorUtil.getDataBySql(Sqlca, sql, map);
for(Map ma:dataList){
f3list.add(ma.get("F3").toString());
}
return f3list;
}
public static void DOM4Jcreate(File file)throws Exception{
Document document=DocumentHelper.createDocument();
List<String> f3list=getDataList();
//String s = String.Join(",", f3list.toArray());
Element root=document.addElement("ufinterface");
root.addAttribute("account", "develop");
root.addAttribute("billtype", "vouchergl");
root.addAttribute("businessunitcode", "develop");
root.addAttribute("filename", "");
root.addAttribute("groupcode", "");
root.addAttribute("isexchange", "");
root.addAttribute("orgcode", "");
root.addAttribute("receiver", "0001121000000000JIYO");
root.addAttribute("replace", "");
root.addAttribute("roottag", "");
root.addAttribute("sender", "001");
Element voucher=root.addElement("voucher");
Element voucherHead=voucher.addElement("voucher_head");
Element pkVoucher=voucherHead.addElement("pk_voucher");
//这个取值待定
pkVoucher.setText("10111210000000005JUK");
//
XMLWriter writer=new XMLWriter(new FileOutputStream(file),OutputFormat.createPrettyPrint());
writer.setEscapeText(false);//字符是否转义,默认true
writer.write(document);
writer.close();
}
public static void main(String[] args) {
File file=new File("C:\\Users\\amarsoft\\Desktop\\123.xml");
try {
//DOM4Jcreate(file);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}