From 9a2f57309883b1f738dc03ec5d916004855ee0d5 Mon Sep 17 00:00:00 2001 From: xiezhiwen Date: Wed, 13 Mar 2019 15:56:22 +0800 Subject: [PATCH] =?UTF-8?q?=E5=87=AD=E8=AF=81=E7=9B=B8=E5=85=B3--=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E6=89=B9=E6=AC=A1=E5=8F=B7=E8=B7=B3=E5=8F=B7=E8=B0=83?= =?UTF-8?q?=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../VoucherToNCforAssistContract.java | 11 +++++++---- .../serviceImp/VoucherToNCforCustomer.java | 11 +++++++---- .../serviceImp/VoucherToNCforDistributor.java | 11 +++++++---- .../serviceImp/VoucherToNCforVoucherPZ.java | 17 ++++++++++------- 4 files changed, 31 insertions(+), 19 deletions(-) diff --git a/src_core/com/tenwa/voucher/serviceImp/VoucherToNCforAssistContract.java b/src_core/com/tenwa/voucher/serviceImp/VoucherToNCforAssistContract.java index 0fa41d80b..e4730131a 100644 --- a/src_core/com/tenwa/voucher/serviceImp/VoucherToNCforAssistContract.java +++ b/src_core/com/tenwa/voucher/serviceImp/VoucherToNCforAssistContract.java @@ -124,6 +124,8 @@ public class VoucherToNCforAssistContract implements Job{ String sql="SELECT id,CONTRACT_NUMBER FROM LB_CONTRACT_INFO WHERE CONTRACT_NUMBER NOT IN(SELECT TABLE_NUM FROM NCXML_DETAIL_RECORDS WHERE FLAG = '1' AND XML_TYPE='"+type+"')"; List> rs = DataOperatorUtil.getDataBySql(Sqlca,sql,null); if(rs!=null && rs.size()>0) { + // 批次号 + String batch = ""; // 生成xml头 Document document = DocumentHelper.createDocument(); // 生成每个xml的头 Element root = document.addElement("ufinterface"); @@ -138,8 +140,6 @@ public class VoucherToNCforAssistContract implements Job{ root.addAttribute("replace",replace); root.addAttribute("roottag",""); root.addAttribute("sender",sender); - // 获取批次号 - String batch = SerialNumberUtil.getVoucherPCNumber(Sqlca); // 遍历结果集 for (Map map : rs) { contract_number=(map.get("CONTRACT_NUMBER")==null)?"":map.get("CONTRACT_NUMBER"); @@ -173,6 +173,9 @@ public class VoucherToNCforAssistContract implements Job{ BizObject record=JBOFactory.createBizObjectQuery(NCXML_DETAIL_RECORDS.CLASS_NAME, "BILLID='"+uuid+"'").getSingleResult(false); // 等于null说明新数据, 新增入记录表 if(record==null || "".equals(record)) { + if("".equals(batch)) { + batch = SerialNumberUtil.getVoucherPCNumber(Sqlca); + } insertSql="INSERT INTO NCXML_DETAIL_RECORDS(BILLID,XML_TYPE,TABLE_NUM,FLAG,CREATE_TIME,BATCH) VALUES('"+uuid+"','"+type+"','"+contract_number+"','1','"+year_month_days+"','"+batch+"')"; Sqlca.executeSQL(insertSql); logger.info("辅助合同记录语句: " + insertSql); @@ -357,8 +360,8 @@ public class VoucherToNCforAssistContract implements Job{ // 判断集合为否为null, 不为空遍历集合, 获取旧数据的批次号 if(batchList != null || batchList.size()>0) { // 定义当前批次, 错误记录数 - int con=0; for (String old_batch : batchList) { + int con=0; // 查询集合, 获取旧批次的失败总数 String selectSql="SELECT BATCH,COUNT(BILLID) CON FROM ncxml_detail_records WHERE flag !=1 AND xml_type='"+type+"' AND BATCH='"+old_batch+"' GROUP BY BATCH"; List> dataList=DataOperatorUtil.getDataBySql(Sqlca, selectSql,null); @@ -408,8 +411,8 @@ public class VoucherToNCforAssistContract implements Job{ // 判断集合为否为null, 不为空遍历集合, 获取旧数据的批次号 if(batchList != null) { // 定义当前批次, 错误记录数 - int con=0; for (String old_batch : batchList) { + int con=0; // 查询集合, 获取旧批次的失败总数 String selectSql="SELECT BATCH,COUNT(BILLID) CON FROM ncxml_detail_records WHERE flag !=1 AND xml_type='"+type+"' AND BATCH='"+old_batch+"' GROUP BY BATCH;"; List> dataList=DataOperatorUtil.getDataBySql(Sqlca, selectSql,null); diff --git a/src_core/com/tenwa/voucher/serviceImp/VoucherToNCforCustomer.java b/src_core/com/tenwa/voucher/serviceImp/VoucherToNCforCustomer.java index 35a6c250c..6a7658f23 100644 --- a/src_core/com/tenwa/voucher/serviceImp/VoucherToNCforCustomer.java +++ b/src_core/com/tenwa/voucher/serviceImp/VoucherToNCforCustomer.java @@ -136,6 +136,8 @@ public class VoucherToNCforCustomer implements Job{ 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) { + // 批次号 + String batch = ""; // 记录历史批次号 List batchList= new ArrayList(); // 记录当前批次传输总量 @@ -154,8 +156,6 @@ public class VoucherToNCforCustomer implements Job{ root.addAttribute("replace", replace); root.addAttribute("roottag", ""); root.addAttribute("sender", sender); - // 生成批次号 - String batch = SerialNumberUtil.getVoucherPCNumber(Sqlca); // 遍历要传输的结果集 for(int i=0;i0) { // 定义当前批次, 错误记录数 - int con=0; for (String old_batch : batchList) { + int con=0; // 查询集合, 获取旧批次的失败总数 String selectSql="SELECT BATCH,COUNT(BILLID) CON FROM ncxml_detail_records WHERE flag !=1 AND xml_type='"+type+"' AND BATCH='"+old_batch+"' GROUP BY BATCH"; List> dataList=DataOperatorUtil.getDataBySql(Sqlca, selectSql,null); @@ -477,8 +480,8 @@ public class VoucherToNCforCustomer implements Job{ // 判断集合为否为null, 不为空遍历集合, 获取旧数据的批次号 if(batchList != null) { // 定义当前批次, 错误记录数 - int con=0; for (String old_batch : batchList) { + int con=0; // 查询集合, 获取旧批次的失败总数 String selectSql="SELECT BATCH,COUNT(BILLID) CON FROM ncxml_detail_records WHERE flag !=1 AND xml_type='"+type+"' AND BATCH='"+old_batch+"' GROUP BY BATCH;"; List> dataList=DataOperatorUtil.getDataBySql(Sqlca, selectSql,null); diff --git a/src_core/com/tenwa/voucher/serviceImp/VoucherToNCforDistributor.java b/src_core/com/tenwa/voucher/serviceImp/VoucherToNCforDistributor.java index 87da6ccde..75a3c4088 100644 --- a/src_core/com/tenwa/voucher/serviceImp/VoucherToNCforDistributor.java +++ b/src_core/com/tenwa/voucher/serviceImp/VoucherToNCforDistributor.java @@ -146,6 +146,8 @@ public class VoucherToNCforDistributor implements Job{ String sql="SELECT id,DISTRIBUTOR_NAME,DISTRIBUTOR_CODING,DISTRIBUTOR_ADDRESS,FACT_ADDR,PROVINCES,POSTCODE,REGISTERED_ADDR,BUSINESS_SCOPE,SUBSIDIARY_COMPANY,TYPE,BUSINESS_LICENSE_NO,DISTRIBUTOR_STATUS,E_MAIL,FAX_NUMBER,REGISTERED_ASSET,DISTRIBUTORER,MBAFC_EARLYDISBURSEMENT_TYPE,URL FROM DISTRIBUTOR_INFO WHERE (DISTRIBUTOR_CODING NOT IN(SELECT TABLE_NUM FROM NCXML_DETAIL_RECORDS WHERE FLAG ='1' AND XML_TYPE='"+type+"') and DISTRIBUTOR_CODING not in(SELECT cust_id FROM customer_list)) and DISTRIBUTOR_STATUS='distributor_status04' "; List> rs = DataOperatorUtil.getDataBySql(Sqlca,sql,null); if(rs !=null && rs.size()>0) { + // 批次号 + String batch = ""; // 设置xml标签头 Document document = DocumentHelper.createDocument(); Element root = document.addElement("ufinterface"); @@ -158,8 +160,6 @@ public class VoucherToNCforDistributor implements Job{ root.addAttribute("replace", replace); root.addAttribute("roottag", ""); root.addAttribute("sender",sender); - // 获取批次号 - String batch = SerialNumberUtil.getVoucherPCNumber(Sqlca); // 遍历要传输的结果集 for(int i=0; i0) { // 定义当前批次, 错误记录数 - int con=0; for (String old_batch : batchList) { + int con=0; // 查询集合, 获取旧批次的失败总数 String selectSql="SELECT BATCH,COUNT(BILLID) CON FROM ncxml_detail_records WHERE flag !=1 AND xml_type='"+type+"' AND BATCH='"+old_batch+"' GROUP BY BATCH"; List> dataList=DataOperatorUtil.getDataBySql(Sqlca, selectSql,null); @@ -553,8 +556,8 @@ public class VoucherToNCforDistributor implements Job{ // 判断集合为否为null, 不为空遍历集合, 获取旧数据的批次号 if(batchList != null) { // 定义当前批次, 错误记录数 - int con=0; for (String old_batch : batchList) { + int con=0; // 查询集合, 获取旧批次的失败总数 String selectSql="SELECT BATCH,COUNT(BILLID) CON FROM ncxml_detail_records WHERE flag !=1 AND xml_type='"+type+"' AND BATCH='"+old_batch+"' GROUP BY BATCH;"; List> dataList=DataOperatorUtil.getDataBySql(Sqlca, selectSql,null); diff --git a/src_core/com/tenwa/voucher/serviceImp/VoucherToNCforVoucherPZ.java b/src_core/com/tenwa/voucher/serviceImp/VoucherToNCforVoucherPZ.java index 9194213d0..f790d9856 100644 --- a/src_core/com/tenwa/voucher/serviceImp/VoucherToNCforVoucherPZ.java +++ b/src_core/com/tenwa/voucher/serviceImp/VoucherToNCforVoucherPZ.java @@ -152,8 +152,6 @@ public class VoucherToNCforVoucherPZ implements Job{ XMLWriter writer=null; // 记录表类别 String type="voucher"; - // 批次号 - String batch=""; // xml主键id String uuid=""; // 获取科目id @@ -184,6 +182,8 @@ public class VoucherToNCforVoucherPZ implements Job{ // 获取生成xml文件的数量, 最大循环值=c+1 int c = (int)(a / b); for (int i = 0; i <=c && a>0; i++) { + // 批次号 + String batch=""; // 记录当前批次传输总量 int count=0; // 记录历史批次号 @@ -202,7 +202,6 @@ public class VoucherToNCforVoucherPZ implements Job{ root.addAttribute("replace", replace); root.addAttribute("roottag", ""); root.addAttribute("sender", sender); - batch = SerialNumberUtil.getVoucherPCNumber(Sqlca); for (int x = i * b; x < (i + 1) * b && x < a; x++) { // 决定当前xml生成的数据量 // 获取凭证编号 String F3=list.get(x).get("f3"); @@ -215,7 +214,7 @@ public class VoucherToNCforVoucherPZ implements Job{ List> v1 = DataOperatorUtil.getDataBySql(Sqlca,sql1,map); // 获取v8表贷方数据 - String sql2 = "SELECT f5,f6,f8,f15,f51,f52,f59,f60,f65,f73,f74,f75 FROM VOUCHER_V8 WHERE F3=:F3 AND ENTRYDC='-1'"; + String sql2 = "SELECT f1,f5,f6,f8,f15,f51,f52,f59,f60,f65,f73,f74,f75 FROM VOUCHER_V8 WHERE F3=:F3 AND ENTRYDC='-1'"; List> v2 = DataOperatorUtil.getDataBySql(Sqlca,sql2,map); // 获取v8表公共信息 @@ -223,7 +222,7 @@ public class VoucherToNCforVoucherPZ implements Job{ //OWNED_COMPANY=map2.get("f49"); // 本方id ACC_YEAR = map2.get("f51"); // 会计期间/年 ACC_MONTH =map2.get("f52"); // 会计期间/月 - timeAll =map2.get("f15"); // 制单时间 + timeAll =map2.get("f1"); // 制单时间 } // 获取本方信息 @@ -500,6 +499,10 @@ public class VoucherToNCforVoucherPZ implements Job{ // 根据id查询记录表是否已经记录过, 没有记录过使用当前批次号记录, 如果已经记录了, 则不操作 BizObject record=JBOFactory.createBizObjectQuery(NCXML_DETAIL_RECORDS.CLASS_NAME, "BILLID='"+uuid+"'").getSingleResult(false); if(record==null || "".equals(record)) { + // 有新数据, 当前批次批次号为空才会生成 + if("".equals(batch)) { + batch = SerialNumberUtil.getVoucherPCNumber(Sqlca); + } // 等于null说明新数据, 新增入记录表 insertSql="INSERT INTO NCXML_DETAIL_RECORDS(BILLID,XML_TYPE,TABLE_NUM,FLAG,CREATE_TIME,BATCH) VALUES('"+uuid+"','"+type+"','"+F3+"','1','"+year_month_days+"','"+batch+"')"; Sqlca.executeSQL(insertSql); @@ -686,8 +689,8 @@ public class VoucherToNCforVoucherPZ implements Job{ // 判断集合为否为null, 不为空遍历集合, 获取旧数据的批次号 if(batchList != null || batchList.size()>0) { // 定义当前批次, 错误记录数 - int con=0; for (String old_batch : batchList) { + int con=0; // 查询集合, 获取旧批次的失败总数 String selectSql="SELECT BATCH,COUNT(BILLID) CON FROM ncxml_detail_records WHERE flag !=1 AND xml_type='"+type+"' AND BATCH='"+old_batch+"' GROUP BY BATCH"; List> dataList=DataOperatorUtil.getDataBySql(Sqlca, selectSql,null); @@ -737,8 +740,8 @@ public class VoucherToNCforVoucherPZ implements Job{ // 判断集合为否为null, 不为空遍历集合, 获取旧数据的批次号 if(batchList != null) { // 定义当前批次, 错误记录数 - int con=0; for (String old_batch : batchList) { + int con=0; // 查询集合, 获取旧批次的失败总数 String selectSql="SELECT BATCH,COUNT(BILLID) CON FROM ncxml_detail_records WHERE flag !=1 AND xml_type='"+type+"' AND BATCH='"+old_batch+"' GROUP BY BATCH;"; List> dataList=DataOperatorUtil.getDataBySql(Sqlca, selectSql,null);