解决异常

dev
ic_excellent 2023-08-14 15:38:58 +08:00
parent 5a8ef40e18
commit 2ff4e22bbd
8 changed files with 133 additions and 92 deletions

View File

@ -3,6 +3,7 @@ package com.api.nonstandardext.zenner.job;
import com.api.nonstandardext.zenner.model.sap.PeriodBalance; import com.api.nonstandardext.zenner.model.sap.PeriodBalance;
import com.api.nonstandardext.zenner.utils.SAPWebserviceTool; import com.api.nonstandardext.zenner.utils.SAPWebserviceTool;
import net.sf.json.JSONObject; import net.sf.json.JSONObject;
import org.apache.log4j.Logger;
import weaver.conn.RecordSet; import weaver.conn.RecordSet;
import weaver.formmode.setup.ModeRightInfo; import weaver.formmode.setup.ModeRightInfo;
import weaver.general.BaseBean; import weaver.general.BaseBean;
@ -23,8 +24,9 @@ import java.util.Calendar;
*/ */
public class SyncAccountInfoFromSapJob extends BaseCronJob { public class SyncAccountInfoFromSapJob extends BaseCronJob {
BaseBean logger = new BaseBean(); //BaseBean logger = new BaseBean();
private final Logger logger = aiyh.utils.Util.getLogger("json_util");
private final static String JobName = " SyncAccountInfoFromSapJob "; private final static String JobName = " SyncAccountInfoFromSapJob ";
/** 模块id */ /** 模块id */
@ -71,11 +73,11 @@ public class SyncAccountInfoFromSapJob extends BaseCronJob {
} }
public void execute() { public void execute() {
logger.writeLog("-----" + JobName + " Begin------"); logger.info("-----" + JobName + " Begin------");
RecordSet rs = new RecordSet(); RecordSet rs = new RecordSet();
try { try {
logger.writeLog("-----" + JobName + " getInterfaceName------" + getInterfaceName()); logger.info("-----" + JobName + " getInterfaceName------" + getInterfaceName());
// if (getInterfaceName().indexOf("syncGlaccPeriodBalancesFromSap") >= 0){ // if (getInterfaceName().indexOf("syncGlaccPeriodBalancesFromSap") >= 0){
@ -99,10 +101,10 @@ public class SyncAccountInfoFromSapJob extends BaseCronJob {
// } // }
} catch (Exception e) { } catch (Exception e) {
logger.writeLog(JobName + " 获取异常: " + e.getMessage()); logger.info(JobName + " 获取异常: " + e.getMessage());
e.printStackTrace(); e.printStackTrace();
} }
logger.writeLog("--------------------" + JobName + " End---------------------------"); logger.info("--------------------" + JobName + " End---------------------------");
} }
public void syncGlaccPeriodBalancesFromSap(String comCode, String period, String year, String glAccount, SAPWebserviceTool tool) throws Exception { public void syncGlaccPeriodBalancesFromSap(String comCode, String period, String year, String glAccount, SAPWebserviceTool tool) throws Exception {
@ -111,7 +113,7 @@ public class SyncAccountInfoFromSapJob extends BaseCronJob {
JSONObject result = tool.callInterface_011(params); JSONObject result = tool.callInterface_011(params);
logger.writeLog(JobName + " syncGlaccPeriodBalancesFromSap result : " + result); logger.info(JobName + " syncGlaccPeriodBalancesFromSap result : " + result);
JSONObject balanceResponse = result.getJSONObject("balanceResponse"); JSONObject balanceResponse = result.getJSONObject("balanceResponse");
PeriodBalance periodBalance = new PeriodBalance(); PeriodBalance periodBalance = new PeriodBalance();
@ -145,7 +147,7 @@ public class SyncAccountInfoFromSapJob extends BaseCronJob {
// keyParams.put("IvFiscYear", 2022); // keyParams.put("IvFiscYear", 2022);
// keyParams.put("IvGlAccount", 12345); // keyParams.put("IvGlAccount", 12345);
// String str = keyParams.toString(); // String str = keyParams.toString();
// logger.writeLog(JobName + " syncSapData Service Call str : " + str); // logger.info(JobName + " syncSapData Service Call str : " + str);
// Object resultObject = call.invoke(new Object[] { 6000, 8, 2022, 12345 });//调用接口 // Object resultObject = call.invoke(new Object[] { 6000, 8, 2022, 12345 });//调用接口
// result = (String) resultObject; // result = (String) resultObject;
} }

View File

@ -4,6 +4,7 @@ import com.api.nonstandardext.zenner.model.bank.DayBalance;
import com.api.nonstandardext.zenner.service.bank.Bank_b2e0005_Service; import com.api.nonstandardext.zenner.service.bank.Bank_b2e0005_Service;
import com.api.nonstandardext.zenner.utils.ZennerApiService; import com.api.nonstandardext.zenner.utils.ZennerApiService;
import com.api.nonstandardext.zenner.utils.ZennerUtil; import com.api.nonstandardext.zenner.utils.ZennerUtil;
import org.apache.log4j.Logger;
import org.dom4j.Document; import org.dom4j.Document;
import org.dom4j.DocumentHelper; import org.dom4j.DocumentHelper;
import org.dom4j.Element; import org.dom4j.Element;
@ -28,8 +29,8 @@ import java.util.*;
*/ */
public class SyncAccountStatementJob extends BaseCronJob { public class SyncAccountStatementJob extends BaseCronJob {
BaseBean logger = new BaseBean(); //BaseBean logger = new BaseBean();
private final Logger logger = aiyh.utils.Util.getLogger("json_util");
private String interfaceName; private String interfaceName;
/** 模块id */ /** 模块id */
@ -54,12 +55,12 @@ public class SyncAccountStatementJob extends BaseCronJob {
} }
public void execute() { public void execute() {
logger.writeLog("-----" + JobName + " Begin------"); logger.info("-----" + JobName + " Begin------");
RecordSet rs = new RecordSet(); RecordSet rs = new RecordSet();
ZennerApiService zennerApiService = new ZennerApiService(); ZennerApiService zennerApiService = new ZennerApiService();
try { try {
logger.writeLog("-----" + JobName + " getInterfaceName------" + getInterfaceName()); logger.info("-----" + JobName + " getInterfaceName------" + getInterfaceName());
//银行 //银行
String bankApiUrl = zennerApiService.getSystemConfigValue("BANK_API_URL"); String bankApiUrl = zennerApiService.getSystemConfigValue("BANK_API_URL");
@ -69,10 +70,10 @@ public class SyncAccountStatementJob extends BaseCronJob {
syncBank_b2e0005(bankApiUrl, Util.null2String(rs.getString("lxh")), Util.null2String(rs.getString("yxzh"))); syncBank_b2e0005(bankApiUrl, Util.null2String(rs.getString("lxh")), Util.null2String(rs.getString("yxzh")));
} }
} catch (Exception e) { } catch (Exception e) {
logger.writeLog(JobName + " 获取异常: " + e.getMessage()); logger.info(JobName + " 获取异常: " + e.getMessage());
e.printStackTrace(); e.printStackTrace();
} }
logger.writeLog("--------------------" + JobName + " End---------------------------"); logger.info("--------------------" + JobName + " End---------------------------");
} }
/** /**
@ -87,7 +88,7 @@ public class SyncAccountStatementJob extends BaseCronJob {
if (!dir.exists()) { if (!dir.exists()) {
dir.mkdirs(); dir.mkdirs();
} }
logger.writeLog(JobName + "..syncBank_b2e0005......bankApiUrl: " + bankApiUrl); logger.info(JobName + "..syncBank_b2e0005......bankApiUrl: " + bankApiUrl);
//当日账号余额 //当日账号余额
Map<String, String> xmlParams = new HashMap<>(); Map<String, String> xmlParams = new HashMap<>();
@ -101,7 +102,7 @@ public class SyncAccountStatementJob extends BaseCronJob {
xmlParams.put("ibknum", ibknum); xmlParams.put("ibknum", ibknum);
xmlParams.put("actacn", actacn); xmlParams.put("actacn", actacn);
String xmlFileUrl = dirPath + "b2e0005_" + ZennerUtil.parseToDateString(Calendar.getInstance().getTime(), ZennerUtil.formatYYYYMMDD)+ ".xml"; String xmlFileUrl = dirPath + "b2e0005_" + ZennerUtil.parseToDateString(Calendar.getInstance().getTime(), ZennerUtil.formatYYYYMMDD)+ ".xml";
logger.writeLog(JobName + ".syncBank_b2e0005.......xmlFileUrl: " + xmlFileUrl); logger.info(JobName + ".syncBank_b2e0005.......xmlFileUrl: " + xmlFileUrl);
Bank_b2e0005_Service bankB2e0005Service = new Bank_b2e0005_Service(); Bank_b2e0005_Service bankB2e0005Service = new Bank_b2e0005_Service();
bankB2e0005Service.createXml(xmlFileUrl, xmlParams); bankB2e0005Service.createXml(xmlFileUrl, xmlParams);
@ -112,18 +113,18 @@ public class SyncAccountStatementJob extends BaseCronJob {
int logPageNum = pLen / ps; int logPageNum = pLen / ps;
int i = 0; int i = 0;
if (pLen <= ps){ if (pLen <= ps){
logger.writeLog(JobName + ".syncBank_b2e0005.......voucherParams last: " + apiParams); logger.info(JobName + ".syncBank_b2e0005.......voucherParams last: " + apiParams);
} else { } else {
for (i = 0; i < logPageNum; i++){ for (i = 0; i < logPageNum; i++){
logger.writeLog(JobName + ".syncBank_b2e0005.......voucherParams " + i + " : " + apiParams.substring(i * ps, (i + 1) * 500)); logger.info(JobName + ".syncBank_b2e0005.......voucherParams " + i + " : " + apiParams.substring(i * ps, (i + 1) * 500));
} }
logger.writeLog(JobName + ".syncBank_b2e0005.......voucherParams last: " + apiParams.substring((i-1) * 500)); logger.info(JobName + ".syncBank_b2e0005.......voucherParams last: " + apiParams.substring((i-1) * 500));
} }
logger.writeLog(JobName + " bankApiUrl : " + bankApiUrl); logger.info(JobName + " bankApiUrl : " + bankApiUrl);
String result = ZennerUtil.httpPostToken(bankApiUrl, new HashMap<>(), apiParams); String result = ZennerUtil.httpPostToken(bankApiUrl, new HashMap<>(), apiParams);
logger.writeLog(JobName + " syncBank_b2e0005 result : " + result); logger.info(JobName + " syncBank_b2e0005 result : " + result);
Document doc = DocumentHelper.parseText(result); // 将xml转为dom对象 Document doc = DocumentHelper.parseText(result); // 将xml转为dom对象
Element root = doc.getRootElement(); // 获取根节点 Element root = doc.getRootElement(); // 获取根节点
@ -133,7 +134,7 @@ public class SyncAccountStatementJob extends BaseCronJob {
for (Object l2 : elements) { //遍历子元素 for (Object l2 : elements) { //遍历子元素
Element l2Element = (Element) l2; Element l2Element = (Element) l2;
logger.writeLog("l2Element name :" + l2Element.getName()); logger.info("l2Element name :" + l2Element.getName());
List<Element> elementsL3 = l2Element.elements(); List<Element> elementsL3 = l2Element.elements();
for (Object l3 : elementsL3) { //遍历子元素 for (Object l3 : elementsL3) { //遍历子元素
@ -144,7 +145,7 @@ public class SyncAccountStatementJob extends BaseCronJob {
for (Object l4 : elementsL4) { //遍历子元素 for (Object l4 : elementsL4) { //遍历子元素
Element dataElement = (Element) l4; Element dataElement = (Element) l4;
logger.writeLog("l4Element name :" + dataElement.getName()); logger.info("l4Element name :" + dataElement.getName());
if ("status".equals(dataElement.getName())){ if ("status".equals(dataElement.getName())){
List<Element> elementsL5 = dataElement.elements(); List<Element> elementsL5 = dataElement.elements();
@ -152,7 +153,7 @@ public class SyncAccountStatementJob extends BaseCronJob {
for (Object l5 : elementsL5) { //遍历子元素 for (Object l5 : elementsL5) { //遍历子元素
Element l5Element = (Element) l5; Element l5Element = (Element) l5;
if ("rspcod".equals(l5Element.getName())) { if ("rspcod".equals(l5Element.getName())) {
logger.writeLog("rspcod:" + l5Element.getStringValue()); logger.info("rspcod:" + l5Element.getStringValue());
if (l5Element.getStringValue().equals("B001")){ if (l5Element.getStringValue().equals("B001")){
statusOk = true; statusOk = true;
} else { } else {
@ -160,14 +161,14 @@ public class SyncAccountStatementJob extends BaseCronJob {
} }
} }
if ("rspmsg".equals(l5Element.getName())) { if ("rspmsg".equals(l5Element.getName())) {
logger.writeLog("rspmsg:" + l5Element.getStringValue()); logger.info("rspmsg:" + l5Element.getStringValue());
} }
} }
} }
logger.writeLog("statusOk:" + statusOk); logger.info("statusOk:" + statusOk);
if (statusOk){ if (statusOk){
logger.writeLog("dataElement.getName():" + dataElement.getName()); logger.info("dataElement.getName():" + dataElement.getName());
if ("b2e0005-rs".equals(dataElement.getName())){ if ("b2e0005-rs".equals(dataElement.getName())){
List<Element> elementsData = dataElement.elements(); List<Element> elementsData = dataElement.elements();
@ -179,19 +180,19 @@ public class SyncAccountStatementJob extends BaseCronJob {
for (Object l5 : elementsL5) { //遍历子元素 for (Object l5 : elementsL5) { //遍历子元素
Element l5Element = (Element) l5; Element l5Element = (Element) l5;
if ("ibknum".equals(l5Element.getName())) { if ("ibknum".equals(l5Element.getName())) {
logger.writeLog("ibknum:" + l5Element.getStringValue()); logger.info("ibknum:" + l5Element.getStringValue());
dayBalance.setIbknum(l5Element.getStringValue()); dayBalance.setIbknum(l5Element.getStringValue());
} }
if ("actacn".equals(l5Element.getName())) { if ("actacn".equals(l5Element.getName())) {
logger.writeLog("actacn:" + l5Element.getStringValue()); logger.info("actacn:" + l5Element.getStringValue());
dayBalance.setActacn(l5Element.getStringValue()); dayBalance.setActacn(l5Element.getStringValue());
} }
if ("curcde".equals(l5Element.getName())) { if ("curcde".equals(l5Element.getName())) {
logger.writeLog("curcde:" + l5Element.getStringValue()); logger.info("curcde:" + l5Element.getStringValue());
dayBalance.setCurcde(l5Element.getStringValue()); dayBalance.setCurcde(l5Element.getStringValue());
} }
if ("actname".equals(l5Element.getName())) { if ("actname".equals(l5Element.getName())) {
logger.writeLog("actname:" + l5Element.getStringValue()); logger.info("actname:" + l5Element.getStringValue());
dayBalance.setActname(l5Element.getStringValue()); dayBalance.setActname(l5Element.getStringValue());
} }
} }
@ -203,15 +204,15 @@ public class SyncAccountStatementJob extends BaseCronJob {
for (Object l5 : elementsL5) { //遍历子元素 for (Object l5 : elementsL5) { //遍历子元素
Element l5Element = (Element) l5; Element l5Element = (Element) l5;
if ("bokbal".equals(l5Element.getName())) { if ("bokbal".equals(l5Element.getName())) {
logger.writeLog("bokbal:" + l5Element.getStringValue()); logger.info("bokbal:" + l5Element.getStringValue());
dayBalance.setBokbal(l5Element.getStringValue()); dayBalance.setBokbal(l5Element.getStringValue());
} }
if ("avabal".equals(l5Element.getName())) { if ("avabal".equals(l5Element.getName())) {
logger.writeLog("avabal:" + l5Element.getStringValue()); logger.info("avabal:" + l5Element.getStringValue());
dayBalance.setAvabal(l5Element.getStringValue()); dayBalance.setAvabal(l5Element.getStringValue());
} }
if ("currentavabal".equals(l5Element.getName())) { if ("currentavabal".equals(l5Element.getName())) {
logger.writeLog("currentavabal:" + l5Element.getStringValue()); logger.info("currentavabal:" + l5Element.getStringValue());
if ("".equals(l5Element.getStringValue())){ if ("".equals(l5Element.getStringValue())){
dayBalance.setCurrentavabal("0"); dayBalance.setCurrentavabal("0");
} else { } else {
@ -220,7 +221,7 @@ public class SyncAccountStatementJob extends BaseCronJob {
} }
if ("stpamt".equals(l5Element.getName())) { if ("stpamt".equals(l5Element.getName())) {
logger.writeLog("stpamt:" + l5Element.getStringValue()); logger.info("stpamt:" + l5Element.getStringValue());
if ("".equals(l5Element.getStringValue())){ if ("".equals(l5Element.getStringValue())){
dayBalance.setStpamt("0"); dayBalance.setStpamt("0");
} else { } else {
@ -228,30 +229,30 @@ public class SyncAccountStatementJob extends BaseCronJob {
} }
} }
if ("ovramt".equals(l5Element.getName())) { if ("ovramt".equals(l5Element.getName())) {
logger.writeLog("ovramt:" + l5Element.getStringValue()); logger.info("ovramt:" + l5Element.getStringValue());
dayBalance.setOvramt("".equals(l5Element.getStringValue()) ? "0" : l5Element.getStringValue()); dayBalance.setOvramt("".equals(l5Element.getStringValue()) ? "0" : l5Element.getStringValue());
} }
if ("frzamt".equals(l5Element.getName())) { if ("frzamt".equals(l5Element.getName())) {
logger.writeLog("frzamt:" + l5Element.getStringValue()); logger.info("frzamt:" + l5Element.getStringValue());
dayBalance.setFrzamt("".equals(l5Element.getStringValue()) ? "0" : l5Element.getStringValue()); dayBalance.setFrzamt("".equals(l5Element.getStringValue()) ? "0" : l5Element.getStringValue());
} }
if ("effauthamt".equals(l5Element.getName())) { if ("effauthamt".equals(l5Element.getName())) {
logger.writeLog("effauthamt:" + l5Element.getStringValue()); logger.info("effauthamt:" + l5Element.getStringValue());
dayBalance.setEffauthamt("".equals(l5Element.getStringValue()) ? "0" : l5Element.getStringValue()); dayBalance.setEffauthamt("".equals(l5Element.getStringValue()) ? "0" : l5Element.getStringValue());
} }
if ("effusdoverbal".equals(l5Element.getName())) { if ("effusdoverbal".equals(l5Element.getName())) {
logger.writeLog("effusdoverbal:" + l5Element.getStringValue()); logger.info("effusdoverbal:" + l5Element.getStringValue());
dayBalance.setEffusdoverbal("".equals(l5Element.getStringValue()) ? "0" : l5Element.getStringValue()); dayBalance.setEffusdoverbal("".equals(l5Element.getStringValue()) ? "0" : l5Element.getStringValue());
} }
if ("effuseablequota".equals(l5Element.getName())) { if ("effuseablequota".equals(l5Element.getName())) {
logger.writeLog("effuseablequota:" + l5Element.getStringValue()); logger.info("effuseablequota:" + l5Element.getStringValue());
dayBalance.setEffuseablequota("".equals(l5Element.getStringValue()) ? "0" : l5Element.getStringValue()); dayBalance.setEffuseablequota("".equals(l5Element.getStringValue()) ? "0" : l5Element.getStringValue());
} }
} }
} }
if ("baldat".equals(l4Element.getName())) { if ("baldat".equals(l4Element.getName())) {
logger.writeLog("baldat:" + l4Element.getStringValue()); logger.info("baldat:" + l4Element.getStringValue());
if (!"".equals(l4Element.getStringValue())){ if (!"".equals(l4Element.getStringValue())){
Date date = ZennerUtil.parseToDate(l4Element.getStringValue(), ZennerUtil.formatYYYYMMDD_NoSplit); Date date = ZennerUtil.parseToDate(l4Element.getStringValue(), ZennerUtil.formatYYYYMMDD_NoSplit);
@ -265,6 +266,6 @@ public class SyncAccountStatementJob extends BaseCronJob {
} }
} }
dayBalance.save(dayBalance, Util.getIntValue(this.modelId), "uf_bank_day_balance"); dayBalance.save(dayBalance, Util.getIntValue(this.modelId), "uf_bank_day_balance");
logger.writeLog(JobName + " result dayBalance: " + dayBalance.toString()); logger.info(JobName + " result dayBalance: " + dayBalance.toString());
} }
} }

View File

@ -4,6 +4,7 @@ import com.api.nonstandardext.zenner.model.bank.TradeInfo;
import com.api.nonstandardext.zenner.service.bank.Bank_b2e0035_Service; import com.api.nonstandardext.zenner.service.bank.Bank_b2e0035_Service;
import com.api.nonstandardext.zenner.utils.ZennerApiService; import com.api.nonstandardext.zenner.utils.ZennerApiService;
import com.api.nonstandardext.zenner.utils.ZennerUtil; import com.api.nonstandardext.zenner.utils.ZennerUtil;
import org.apache.log4j.Logger;
import org.dom4j.Document; import org.dom4j.Document;
import org.dom4j.DocumentHelper; import org.dom4j.DocumentHelper;
import org.dom4j.Element; import org.dom4j.Element;
@ -29,21 +30,33 @@ import java.util.*;
*/ */
public class SyncAccountTradeInfoJob extends BaseCronJob { public class SyncAccountTradeInfoJob extends BaseCronJob {
BaseBean logger = new BaseBean(); //BaseBean logger = new BaseBean();
private final Logger logger = aiyh.utils.Util.getLogger("json_util");
/** 模块id */ /** 模块id */
private String modelId; private String modelId;
private String interfaceName; private String interfaceName;
private String amountTo;
/** 同步开始日期 */ /** 同步开始日期 */
private String fromDate; private String fromDate;
/** 同步结束日期 */ /** 同步结束日期 */
private String toDate; private String toDate;
private String queryType;
private final static String JobName = " SyncAccountTradeInfoJob "; private final static String JobName = " SyncAccountTradeInfoJob ";
public String getAmountTo() {
return amountTo;
}
public void setAmountTo(String amountTo) {
this.amountTo = amountTo;
}
public String getFromDate() { public String getFromDate() {
return fromDate; return fromDate;
} }
@ -52,6 +65,14 @@ public class SyncAccountTradeInfoJob extends BaseCronJob {
this.fromDate = fromDate; this.fromDate = fromDate;
} }
public String getQueryType() {
return queryType;
}
public void setQueryType(String queryType) {
this.queryType = queryType;
}
public String getToDate() { public String getToDate() {
return toDate; return toDate;
} }
@ -69,13 +90,13 @@ public class SyncAccountTradeInfoJob extends BaseCronJob {
} }
public void execute() { public void execute() {
logger.writeLog("-----" + JobName + " Begin------"); logger.info("-----" + JobName + " Begin------");
RecordSet rs = new RecordSet(); RecordSet rs = new RecordSet();
ZennerApiService zennerApiService = new ZennerApiService(); ZennerApiService zennerApiService = new ZennerApiService();
try { try {
logger.writeLog("-----" + JobName + " getInterfaceName------" + getInterfaceName()); logger.info("-----" + JobName + " getInterfaceName------" + getInterfaceName());
logger.writeLog(String.format("params --- fromDate:%s toDate:%s",fromDate,toDate)); logger.info(String.format("params --- fromDate:%s toDate:%s",fromDate,toDate));
//银行 //银行
String bankApiUrl = zennerApiService.getSystemConfigValue("BANK_API_URL"); String bankApiUrl = zennerApiService.getSystemConfigValue("BANK_API_URL");
@ -85,21 +106,21 @@ public class SyncAccountTradeInfoJob extends BaseCronJob {
while (rs.next()){ while (rs.next()){
int total = syncBank_b2e0035(bankApiUrl, Util.null2String(rs.getString("lxh")), Util.null2String(rs.getString("yxzh")), 1, pageSize); int total = syncBank_b2e0035(bankApiUrl, Util.null2String(rs.getString("lxh")), Util.null2String(rs.getString("yxzh")), 1, pageSize);
Integer totalPage = (total + pageSize - 1) / pageSize; Integer totalPage = (total + pageSize - 1) / pageSize;
logger.writeLog(JobName + " totalPage:" + totalPage); logger.info(JobName + " totalPage:" + totalPage);
for (int pageNo = 2; pageNo <= totalPage; pageNo++) { for (int pageNo = 2; pageNo <= totalPage; pageNo++) {
int startNo = (pageNo - 1) * pageSize; int startNo = (pageNo - 1) * pageSize;
int endNo = pageNo * pageSize; int endNo = pageNo * pageSize;
logger.writeLog(JobName + " startNo:" + startNo + " endNo:" + endNo); logger.info(JobName + " startNo:" + startNo + " endNo:" + endNo);
int pageTotal = syncBank_b2e0035(bankApiUrl, Util.null2String(rs.getString("lxh")), Util.null2String(rs.getString("yxzh")), startNo, pageSize); int pageTotal = syncBank_b2e0035(bankApiUrl, Util.null2String(rs.getString("lxh")), Util.null2String(rs.getString("yxzh")), startNo, pageSize);
logger.writeLog(JobName + " total:" + pageTotal); logger.info(JobName + " total:" + pageTotal);
} }
} }
} catch (Exception e) { } catch (Exception e) {
logger.writeLog(JobName + " 获取异常: " + e.getMessage()); logger.info(JobName + " 获取异常: " + e.getMessage());
e.printStackTrace(); e.printStackTrace();
} }
logger.writeLog("--------------------" + JobName + " End---------------------------"); logger.info("--------------------" + JobName + " End---------------------------");
} }
/** /**
@ -116,6 +137,8 @@ public class SyncAccountTradeInfoJob extends BaseCronJob {
dir.mkdirs(); dir.mkdirs();
} }
String tempAmountTo = "".equals(Util.null2String(this.amountTo)) ? "100000000" : Util.null2String(this.amountTo);
//当日账号余额 //当日账号余额
Map<String, String> xmlParams = new HashMap<>(); Map<String, String> xmlParams = new HashMap<>();
xmlParams.put("termid", "E192168000104"); xmlParams.put("termid", "E192168000104");
@ -124,29 +147,29 @@ public class SyncAccountTradeInfoJob extends BaseCronJob {
xmlParams.put("custid", "387679060"); xmlParams.put("custid", "387679060");
xmlParams.put("trncod", "b2e0035"); xmlParams.put("trncod", "b2e0035");
xmlParams.put("token", ""); xmlParams.put("token", "");
String tempType = "".equals(Util.null2String(this.queryType)) ? "2002" : this.queryType;
xmlParams.put("type", "2002"); xmlParams.put("type", tempType);
xmlParams.put("ibknum", ibknum); xmlParams.put("ibknum", ibknum);
xmlParams.put("actacn", actacn); xmlParams.put("actacn", actacn);
//xmlParams.put("from", "20220919"); //xmlParams.put("from", "20220919");
Calendar cal = Calendar.getInstance(); Calendar cal = Calendar.getInstance();
cal.add(Calendar.DAY_OF_MONTH, -1); cal.add(Calendar.DAY_OF_MONTH, -1);
String to = !"".equals(Util.null2String(this.fromDate)) ? this.fromDate : ZennerUtil.parseToDateString(cal.getTime(), ZennerUtil.formatYYYYMMDD_NoSplit); String to = !"".equals(Util.null2String(this.toDate)) ? this.toDate : ZennerUtil.parseToDateString(cal.getTime(), ZennerUtil.formatYYYYMMDD_NoSplit);
cal.add(Calendar.DAY_OF_MONTH,-1); cal.add(Calendar.DAY_OF_MONTH,-1);
String from = !"".equals(Util.null2String(this.toDate)) String from = !"".equals(Util.null2String(this.fromDate))
? this.toDate ? this.fromDate
: ZennerUtil.parseToDateString(cal.getTime(), ZennerUtil.formatYYYYMMDD_NoSplit); : ZennerUtil.parseToDateString(cal.getTime(), ZennerUtil.formatYYYYMMDD_NoSplit);
//String to = !"".equals(Util.null2String(this.toDate)) ? this.toDate : ZennerUtil.parseToDateString(new Date(), ZennerUtil.formatYYYYMMDD_NoSplit); //String to = !"".equals(Util.null2String(this.toDate)) ? this.toDate : ZennerUtil.parseToDateString(new Date(), ZennerUtil.formatYYYYMMDD_NoSplit);
xmlParams.put("from", from); xmlParams.put("from", from);
xmlParams.put("to", to); xmlParams.put("to", to);
xmlParams.put("amountFrom", "1"); xmlParams.put("amountFrom", "0.01");
xmlParams.put("amountTo", "100000"); xmlParams.put("amountTo", tempAmountTo);
xmlParams.put("begnum", start + ""); xmlParams.put("begnum", start + "");
xmlParams.put("recnum", end + ""); xmlParams.put("recnum", end + "");
xmlParams.put("direction", "0"); xmlParams.put("direction", "0");
String xmlFileUrl = dirPath + "b2e0035_" + ZennerUtil.parseToDateString(Calendar.getInstance().getTime(), ZennerUtil.formatYYYYMMDD)+ ".xml"; String xmlFileUrl = dirPath + "b2e0035_" + ZennerUtil.parseToDateString(Calendar.getInstance().getTime(), ZennerUtil.formatYYYYMMDD)+ ".xml";
logger.writeLog(JobName + " xmlFileUrl : " + xmlFileUrl); logger.info(JobName + " xmlFileUrl : " + xmlFileUrl);
Bank_b2e0035_Service bankB2e0035Service = new Bank_b2e0035_Service(); Bank_b2e0035_Service bankB2e0035Service = new Bank_b2e0035_Service();
bankB2e0035Service.createXml(xmlFileUrl, xmlParams); bankB2e0035Service.createXml(xmlFileUrl, xmlParams);
@ -157,19 +180,19 @@ public class SyncAccountTradeInfoJob extends BaseCronJob {
int logPageNum = pLen / ps; int logPageNum = pLen / ps;
int i = 0; int i = 0;
if (pLen <= ps){ if (pLen <= ps){
logger.writeLog(JobName + "........voucherParams last: " + apiParams); logger.info(JobName + "........voucherParams last: " + apiParams);
} else { } else {
for (i = 0; i < logPageNum; i++){ for (i = 0; i < logPageNum; i++){
logger.writeLog(JobName + "........voucherParams " + i + " : " + apiParams.substring(i * ps, (i + 1) * 500)); logger.info(JobName + "........voucherParams " + i + " : " + apiParams.substring(i * ps, (i + 1) * 500));
} }
logger.writeLog(JobName + "........voucherParams last: " + apiParams.substring((i-1) * 500)); logger.info(JobName + "........voucherParams last: " + apiParams.substring((i-1) * 500));
} }
logger.writeLog(JobName + " bankApiUrl : " + bankApiUrl); logger.info(JobName + " bankApiUrl : " + bankApiUrl);
String result = ZennerUtil.httpPostToken(bankApiUrl, new HashMap<>(), apiParams); String result = ZennerUtil.httpPostToken(bankApiUrl, new HashMap<>(), apiParams);
logger.writeLog(JobName + " syncBank_b2e0035 result : " + result); logger.info(JobName + " syncBank_b2e0035 result : " + result);
Document doc = DocumentHelper.parseText(result); // 将xml转为dom对象 Document doc = DocumentHelper.parseText(result); // 将xml转为dom对象
Element root = doc.getRootElement(); // 获取根节点 Element root = doc.getRootElement(); // 获取根节点
@ -179,7 +202,7 @@ public class SyncAccountTradeInfoJob extends BaseCronJob {
for (Object l2 : elements) { //遍历子元素 for (Object l2 : elements) { //遍历子元素
Element l2Element = (Element) l2; Element l2Element = (Element) l2;
logger.writeLog(JobName + "l2Element name :" + l2Element.getName()); logger.info(JobName + "l2Element name :" + l2Element.getName());
List<Element> elementsL3 = l2Element.elements(); List<Element> elementsL3 = l2Element.elements();
for (Object l3 : elementsL3) { //遍历子元素 for (Object l3 : elementsL3) { //遍历子元素
@ -190,7 +213,7 @@ public class SyncAccountTradeInfoJob extends BaseCronJob {
for (Object l4 : elementsL4) { //遍历子元素 for (Object l4 : elementsL4) { //遍历子元素
Element dataElement = (Element) l4; Element dataElement = (Element) l4;
logger.writeLog(JobName + "l4Element name :" + dataElement.getName()); logger.info(JobName + "l4Element name :" + dataElement.getName());
if ("status".equals(dataElement.getName())){ if ("status".equals(dataElement.getName())){
List<Element> elementsL5 = dataElement.elements(); List<Element> elementsL5 = dataElement.elements();
@ -198,7 +221,7 @@ public class SyncAccountTradeInfoJob extends BaseCronJob {
for (Object l5 : elementsL5) { //遍历子元素 for (Object l5 : elementsL5) { //遍历子元素
Element l5Element = (Element) l5; Element l5Element = (Element) l5;
if ("rspcod".equals(l5Element.getName())) { if ("rspcod".equals(l5Element.getName())) {
logger.writeLog("rspcod:" + l5Element.getStringValue()); logger.info("rspcod:" + l5Element.getStringValue());
if (l5Element.getStringValue().equals("B001") || l5Element.getStringValue().equals("B002")){ if (l5Element.getStringValue().equals("B001") || l5Element.getStringValue().equals("B002")){
statusOk = true; statusOk = true;
} else { } else {
@ -206,16 +229,16 @@ public class SyncAccountTradeInfoJob extends BaseCronJob {
} }
} }
if ("rspmsg".equals(l5Element.getName())) { if ("rspmsg".equals(l5Element.getName())) {
logger.writeLog(JobName + "rspmsg:" + l5Element.getStringValue()); logger.info(JobName + "rspmsg:" + l5Element.getStringValue());
} }
} }
} }
if ("totalnum".equals(dataElement.getName())){ if ("totalnum".equals(dataElement.getName())){
logger.writeLog("totalnum:" + dataElement.getStringValue()); logger.info("totalnum:" + dataElement.getStringValue());
} }
if ("notenum".equals(dataElement.getName())){ if ("notenum".equals(dataElement.getName())){
logger.writeLog("notenum:" + dataElement.getStringValue()); logger.info("notenum:" + dataElement.getStringValue());
String notenumStr = Util.null2String(dataElement.getStringValue()); String notenumStr = Util.null2String(dataElement.getStringValue());
if ("".equals(notenum)){ if ("".equals(notenum)){
notenumStr = "0"; notenumStr = "0";
@ -223,9 +246,9 @@ public class SyncAccountTradeInfoJob extends BaseCronJob {
notenum = Integer.parseInt(notenumStr); notenum = Integer.parseInt(notenumStr);
} }
logger.writeLog("statusOk:" + statusOk); logger.info("statusOk:" + statusOk);
if (statusOk){ if (statusOk){
logger.writeLog(JobName + "dataElement.getName():" + dataElement.getName()); logger.info(JobName + "dataElement.getName():" + dataElement.getName());
if ("b2e0035-rs".equals(dataElement.getName())){ if ("b2e0035-rs".equals(dataElement.getName())){
TradeInfo tradeInfo = new TradeInfo(); TradeInfo tradeInfo = new TradeInfo();
@ -263,23 +286,23 @@ public class SyncAccountTradeInfoJob extends BaseCronJob {
for (Object l5 : elementsL5) { //遍历子元素 for (Object l5 : elementsL5) { //遍历子元素
Element l5Element = (Element) l5; Element l5Element = (Element) l5;
if ("toibkn".equals(l5Element.getName())) { if ("toibkn".equals(l5Element.getName())) {
logger.writeLog(JobName + "toibkn:" + l5Element.getStringValue()); logger.info(JobName + "toibkn:" + l5Element.getStringValue());
tradeInfo.setToibkn(l5Element.getStringValue()); tradeInfo.setToibkn(l5Element.getStringValue());
} }
if ("actacn".equals(l5Element.getName())) { if ("actacn".equals(l5Element.getName())) {
logger.writeLog(JobName + "actacn:" + l5Element.getStringValue()); logger.info(JobName + "actacn:" + l5Element.getStringValue());
tradeInfo.setActacn_receipt(l5Element.getStringValue()); tradeInfo.setActacn_receipt(l5Element.getStringValue());
} }
if ("toname".equals(l5Element.getName())) { if ("toname".equals(l5Element.getName())) {
logger.writeLog(JobName + "toname:" + l5Element.getStringValue()); logger.info(JobName + "toname:" + l5Element.getStringValue());
tradeInfo.setToname(l5Element.getStringValue()); tradeInfo.setToname(l5Element.getStringValue());
} }
if ("tobank".equals(l5Element.getName())) { if ("tobank".equals(l5Element.getName())) {
logger.writeLog(JobName + "tobank:" + l5Element.getStringValue()); logger.info(JobName + "tobank:" + l5Element.getStringValue());
tradeInfo.setTobank(l5Element.getStringValue()); tradeInfo.setTobank(l5Element.getStringValue());
} }
if ("tobref".equals(l5Element.getName())) { if ("tobref".equals(l5Element.getName())) {
logger.writeLog(JobName + "tobref:" + l5Element.getStringValue()); logger.info(JobName + "tobref:" + l5Element.getStringValue());
tradeInfo.setTobref(l5Element.getStringValue()); tradeInfo.setTobref(l5Element.getStringValue());
} }
} }
@ -351,6 +374,14 @@ public class SyncAccountTradeInfoJob extends BaseCronJob {
tradeInfo.setInsid(l4Element.getStringValue()); tradeInfo.setInsid(l4Element.getStringValue());
} }
} }
if ("vchnum".equals(l4Element.getName())) {
if (!"".equals(l4Element.getStringValue())){
tradeInfo.setVchnum(l4Element.getStringValue());
}
}
if ("transid".equals(l4Element.getName()) && !"".equals(l4Element.getStringValue())) {
tradeInfo.setTransid(l4Element.getStringValue());
}
} }
tradeInfoList.add(tradeInfo); tradeInfoList.add(tradeInfo);
@ -360,11 +391,12 @@ public class SyncAccountTradeInfoJob extends BaseCronJob {
} }
} }
logger.writeLog(JobName + " result tradeInfoList size: " + tradeInfoList.size()); logger.info(JobName + " result tradeInfoList size: " + tradeInfoList.size());
for (TradeInfo tradeInfo : tradeInfoList){ for (TradeInfo tradeInfo : tradeInfoList){
if (!"".equals(tradeInfo.getIbknum())){ tradeInfo.save(tradeInfo, Util.getIntValue(this.modelId), "uf_bank_trade_info");
tradeInfo.save(tradeInfo, Util.getIntValue(this.modelId), "uf_bank_trade_info"); //if (!"".equals(tradeInfo.getIbknum())){
} // tradeInfo.save(tradeInfo, Util.getIntValue(this.modelId), "uf_bank_trade_info");
//}
} }
return notenum; return notenum;

View File

@ -1,5 +1,6 @@
package com.api.nonstandardext.zenner.model.bank; package com.api.nonstandardext.zenner.model.bank;
import org.apache.log4j.Logger;
import weaver.conn.RecordSet; import weaver.conn.RecordSet;
import weaver.formmode.setup.ModeRightInfo; import weaver.formmode.setup.ModeRightInfo;
import weaver.general.BaseBean; import weaver.general.BaseBean;
@ -13,6 +14,7 @@ import java.util.Date;
*/ */
public class TradeInfo extends BaseBean { public class TradeInfo extends BaseBean {
private final Logger logger = aiyh.utils.Util.getLogger("json_util");
private Integer formmodeid; private Integer formmodeid;
private String modedatacreater; private String modedatacreater;
private String modedatacreatertype; private String modedatacreatertype;
@ -130,13 +132,15 @@ public class TradeInfo extends BaseBean {
ufModel.setModedatacreatedate(currentDateTime.substring(0, 10)); ufModel.setModedatacreatedate(currentDateTime.substring(0, 10));
ufModel.setModedatacreatetime(currentDateTime.substring(11)); ufModel.setModedatacreatetime(currentDateTime.substring(11));
String existSql = "select id from " + tableName + " where ibknum='" + ufModel.getIbknum() + "' and actacn='" + ufModel.getActacn() + "' and outref='" + ufModel.getOutref() + "'"; //String existSql = "select id from " + tableName + " where ibknum='" + ufModel.getIbknum() + "' and actacn='" + ufModel.getActacn() + "' and outref='" + ufModel.getOutref() + "'";
String existSql = "select id from " + tableName + " where vchnum='" + ufModel.getVchnum() + "'";
logger.info("exist sql ==>"+existSql);
rs.execute(existSql); rs.execute(existSql);
if (rs.next()) { if (rs.next()) {
billId = rs.getInt("id"); billId = rs.getInt("id");
String msg = update(modelName, tableName, ufModel); String msg = update(modelName, tableName, ufModel);
if (!"".equals(msg)){ if (!"".equals(msg)){
this.writeLog(modelName + " 保存异常: " + msg); logger.info(modelName + " 保存异常: " + msg);
} }
return billId; return billId;
} }
@ -178,15 +182,16 @@ public class TradeInfo extends BaseBean {
return -1; return -1;
} }
RecordSet rightRs = new RecordSet(); RecordSet rightRs = new RecordSet();
writeLog(modelName + ", insertSql ->" + insertSql + ", result:" + result + ", formmodeid: " + formmodeid); logger.info(modelName + ", insertSql ->" + insertSql + ", result:" + result + ", formmodeid: " + formmodeid);
rightRs.execute("SELECT id FROM " + tableName + " where ibknum='" + ufModel.getIbknum() + "' and actacn='" + ufModel.getActacn() + "' and outref='" + ufModel.getOutref() + "'"); //rightRs.execute("SELECT id FROM " + tableName + " where ibknum='" + ufModel.getIbknum() + "' and actacn='" + ufModel.getActacn() + "' and outref='" + ufModel.getOutref() + "'");
rightRs.execute(existSql);
if (rightRs.next()) { if (rightRs.next()) {
billId = rightRs.getInt("id"); billId = rightRs.getInt("id");
this.setModeRight(1, formmodeid, billId); this.setModeRight(1, formmodeid, billId);
} }
} }
} catch (Exception e) { } catch (Exception e) {
writeLog(modelName + ", 新增报错 ->" + e.getMessage()); logger.info(modelName + ", 新增报错 ->" + e.getMessage());
e.printStackTrace(); e.printStackTrace();
return -1; return -1;
} }
@ -194,7 +199,7 @@ public class TradeInfo extends BaseBean {
} }
public String update(String modelName, String tableName, TradeInfo ufModel) throws Exception{ public String update(String modelName, String tableName, TradeInfo ufModel) throws Exception{
writeLog(modelName + ", update -> formmodeid: " + formmodeid); logger.info(modelName + ", update -> formmodeid: " + formmodeid);
RecordSet rs = new RecordSet(); RecordSet rs = new RecordSet();
String setSql = ""; String setSql = "";
boolean result = false; boolean result = false;
@ -233,15 +238,16 @@ public class TradeInfo extends BaseBean {
} }
if(!"".equals(setSql)) { if(!"".equals(setSql)) {
setSql = setSql.substring(1); setSql = setSql.substring(1);
String updateSql = "update " + tableName + " set " + setSql + " where ibknum='" + ufModel.getIbknum() + "' and actacn='" + ufModel.getActacn() + "' and outref='" + ufModel.getOutref() + "'"; //String updateSql = "update " + tableName + " set " + setSql + " where ibknum='" + ufModel.getIbknum() + "' and actacn='" + ufModel.getActacn() + "' and outref='" + ufModel.getOutref() + "'";
writeLog(modelName + ", updateSql ->" + updateSql); String updateSql = "update " + tableName + " set " + setSql + "where vchnum = '" + ufModel.getVchnum() + "'";
logger.info(modelName + ", updateSql ->" + updateSql);
result = rs.execute(updateSql); result = rs.execute(updateSql);
if (!result){ if (!result){
return "修改失败"; return "修改失败";
} }
} }
} catch (Exception e){ } catch (Exception e){
writeLog(modelName + ", 修改报错 ->" + e.getMessage()); logger.info(modelName + ", 修改报错 ->" + e.getMessage());
e.printStackTrace(); e.printStackTrace();
return e.getMessage(); return e.getMessage();
} }

View File

@ -69,7 +69,7 @@ public class SAPWebserviceTool extends BaseBean {
public String callParams_011(String comCode, String period, String year, String glAccount){ public String callParams_011(String comCode, String period, String year, String glAccount){
String params = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:urn=\"urn:sap-getLogFilePath:document:sap:soap:functions:mc-style\">\n" + String params = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:urn=\"urn:sap-com:document:sap:soap:functions:mc-style\">\n" +
" <soapenv:Header/>\n" + " <soapenv:Header/>\n" +
" <soapenv:Body>\n" + " <soapenv:Body>\n" +
" <urn:ZoaGlGetglaccperiodbalances>\n" + " <urn:ZoaGlGetglaccperiodbalances>\n" +