add 参数表

This commit is contained in:
刘鹏 2024-08-12 20:12:56 +08:00
parent d2e407cca3
commit cf75f0bd76
11 changed files with 573 additions and 169 deletions

View File

@ -7,6 +7,8 @@
*/
package shkd.fi.fi.common;
import java.util.Map;
/**
* fi云fi应用-通用常量类<br>
* 代码中不能存在硬编码敏感信息如账号密码http外链ftp外链邮箱等<br>
@ -19,10 +21,26 @@ public class AppflgConstant {
public static final String KEY_APP_NAME = "fi-fi";
public static final String APIGW_COSCOSHIPPING_COM_TOKEN = "apigw.coscoshipping.com.token";
public static final String YUNSHUI_TOKEN_URL = "tokenUrl";
public static final String YUNSHUI_XFZACCOUNTPWS = "xfzAccountPWS";
public static final String YUNSHUI_SYSTEMNAME = "systemName";
public static final String YUNSHUI_OCR_INVOICESCANNER_URL = "OCR_INVOICESCANNER_URL";
public static final String YUNSHUI_COMPLIANCECOLLECTZY_URL = "COMPLIANCECOLLECTZY_URL";
public static final String SAP_USER_PASS = "sap_user_pass";
public static final String SAP_USER_PASS(Map<String,String> map){
return map.get(SAP_USER_PASS);
}
public static final String SAP_SYN_VOUCHER_URL = "sap_syn_voucher_url";
public static final String SAP_SYN_VOUCHER_URL(Map<String,String> map){
return map.get(SAP_SYN_VOUCHER_URL);
}
public static final String SAP_SYN_VOUCHER_URL_NNAME = "SAP凭证同步接口";
public static final String SAP_CX_VOUCHER_URL = "sap_cx_voucher_url";
public static final String SAP_CX_VOUCHER_URL(Map<String,String> map){
return map.get(SAP_CX_VOUCHER_URL);
}
public static final String SAP_CX_VOUCHER_URL_NAME = "SAP凭证冲销接口";
@ -32,22 +50,37 @@ public class AppflgConstant {
* 电子凭证库client_id
*/
public static final String DZPZK_CLIENT_ID = "dzpzk_client_id";
public static final String DZPZK_CLIENT_ID (Map<String,String> map){
return map.get(DZPZK_CLIENT_ID);
}
/**
* 电子凭证库client_secret
*/
public static final String DZPZK_CLIENT_SECRET = "dzpzk_client_secret";
public static final String DZPZK_CLIENT_SECRET(Map<String,String> map){
return map.get(DZPZK_CLIENT_SECRET);
}
/**
* 电子凭证库username
*/
public static final String DZPZK_USERNAME = "dzpzk_username";
public static final String DZPZK_USERNAME(Map<String,String> map){
return map.get(DZPZK_USERNAME);
}
/**
* 电子凭证库password
*/
public static final String DZPZK_PASSWORD = "dzpzk_password";
public static final String DZPZK_PASSWORD(Map<String,String> map){
return map.get(DZPZK_PASSWORD);
}
/**
* 电子凭证库获取token接口地址
*/
public static final String DZPZK_TOKE_URL = "dzpzk_toke_url";
public static final String DZPZK_TOKE_URL(Map<String,String> map){
return map.get(DZPZK_TOKE_URL);
}
public static final String DZPZK_TOKE_URL_NAME = "电子凭证库获取token接口";
@ -55,27 +88,42 @@ public class AppflgConstant {
* 电子凭证库附件归档接口URL
*/
public static final String DZPZK_GUIDANG_URL = "dzpzk_guidang_url";
public static final String DZPZK_GUIDANG_URL(Map<String,String> map){
return map.get(DZPZK_GUIDANG_URL);
}
public static final String DZPZK_GUIDANG_URL_NAME = "电子凭证库附件归档接口";
/**
* 电子凭证库附件归档接口结果查询URL
*/
public static final String DZPZK_GUIDANG_RES_URL = "dzpzk_guidang_res_url";
public static final String DZPZK_GUIDANG_RES_URL(Map<String,String> map){
return map.get(DZPZK_GUIDANG_RES_URL);
}
public static final String DZPZK_GUIDANG_RES_URL_NAME = "电子凭证库附件归档结果查询接口";
/**
* 电子凭证库业务数据同步接口URL
*/
public static final String SHKD_DZPZK_BIZ_URL = "shkd_dzpzk_biz_url";
public static final String SHKD_DZPZK_BIZ_URL(Map<String,String> map){
return map.get(SHKD_DZPZK_BIZ_URL);
}
public static final String SHKD_DZPZK_BIZ_URL_NAME = "电子凭证库业务数据接口";
/**
* 电子凭证库业务数据同步接口结果查询URL
*/
public static final String SHKD_DZPZK_BIZ_RES_URL = "shkd_dzpzk_biz_res_url";
public static final String SHKD_DZPZK_BIZ_RES_URL(Map<String,String> map){
return map.get(SHKD_DZPZK_BIZ_RES_URL);
}
public static final String SHKD_DZPZK_BIZ_RES_URL_NAME = "电子凭证库业务数据结果查询接口";
/***
* OA发票池接口URL
*/
public static final String OA_INV_URL = "oa_inv_url";
public static final String OA_INV_URL(Map<String,String> map){
return map.get(OA_INV_URL);
}
public static final String OA_INV_URL_NAME = "OA发票池接口";
@ -84,15 +132,19 @@ public class AppflgConstant {
* 系统编码
*/
public static final String SYS_NUMBER = "JDN";
public static final String SYS_NUMBER(Map<String,String> map){
return map.get(SYS_NUMBER);
}
/**
* 获取电子凭证库tokenURL
* @return
*/
public static String getDzpzkTokenURL(){
return System.getProperty(AppflgConstant.DZPZK_TOKE_URL)+"&client_id="+System.getProperty(AppflgConstant.DZPZK_CLIENT_ID)+"&client_secret="+
System.getProperty(AppflgConstant.DZPZK_CLIENT_SECRET)+"&username="+System.getProperty(AppflgConstant.DZPZK_USERNAME)+"&password="+
System.getProperty(AppflgConstant.DZPZK_PASSWORD);
public static String getDzpzkTokenURL(Map<String,String> map){
return map.get(AppflgConstant.DZPZK_TOKE_URL)+"&client_id="+map.get(AppflgConstant.DZPZK_CLIENT_ID)+"&client_secret="+
map.get(AppflgConstant.DZPZK_CLIENT_SECRET)+"&username="+map.get(AppflgConstant.DZPZK_USERNAME)+"&password="+
map.get(AppflgConstant.DZPZK_PASSWORD);
}
}

View File

@ -0,0 +1,216 @@
/**
* Copyright 2024 bejson.com
*/
package shkd.fi.fi.common.dzpzk.bizdataquery.res;
import java.util.Date;
import java.util.List;
/**
* Auto-generated: 2024-08-12 17:27:10
*
* @author bejson.com (i@bejson.com)
* @website http://www.bejson.com/java2pojo/
*/
public class Attr {
private String entryAccountFlag;
private String transferFlag;
private String usedPeriod;
private String value2;
private String usedConfirmation;
private String transferAmount;
private String assetsDepreciationMethod;
private String bankElectronicReceipt;
private String mappingStatus;
private String incomeTaxYearFrom;
private String paidFlag;
private String invoiceNumber;
private String invoiceType;
private String usedFlag;
private String incomeTaxYearTo;
private String companyCode;
private String contractNumber;
private String securityFlag;
private String purchaserTaxNumber;
private List<JournalHeads> journalHeads;
private String purchaserName;
private String sysDocNumber;
private String expensePeriodFrom;
private String incomeTaxDeduct;
private String expensePeriodTo;
public void setEntryAccountFlag(String entryAccountFlag) {
this.entryAccountFlag = entryAccountFlag;
}
public String getEntryAccountFlag() {
return entryAccountFlag;
}
public void setTransferFlag(String transferFlag) {
this.transferFlag = transferFlag;
}
public String getTransferFlag() {
return transferFlag;
}
public void setUsedPeriod(String usedPeriod) {
this.usedPeriod = usedPeriod;
}
public String getUsedPeriod() {
return usedPeriod;
}
public void setValue2(String value2) {
this.value2 = value2;
}
public String getValue2() {
return value2;
}
public void setUsedConfirmation(String usedConfirmation) {
this.usedConfirmation = usedConfirmation;
}
public String getUsedConfirmation() {
return usedConfirmation;
}
public void setTransferAmount(String transferAmount) {
this.transferAmount = transferAmount;
}
public String getTransferAmount() {
return transferAmount;
}
public void setAssetsDepreciationMethod(String assetsDepreciationMethod) {
this.assetsDepreciationMethod = assetsDepreciationMethod;
}
public String getAssetsDepreciationMethod() {
return assetsDepreciationMethod;
}
public void setBankElectronicReceipt(String bankElectronicReceipt) {
this.bankElectronicReceipt = bankElectronicReceipt;
}
public String getBankElectronicReceipt() {
return bankElectronicReceipt;
}
public void setMappingStatus(String mappingStatus) {
this.mappingStatus = mappingStatus;
}
public String getMappingStatus() {
return mappingStatus;
}
public void setIncomeTaxYearFrom(String incomeTaxYearFrom) {
this.incomeTaxYearFrom = incomeTaxYearFrom;
}
public String getIncomeTaxYearFrom() {
return incomeTaxYearFrom;
}
public void setPaidFlag(String paidFlag) {
this.paidFlag = paidFlag;
}
public String getPaidFlag() {
return paidFlag;
}
public void setInvoiceNumber(String invoiceNumber) {
this.invoiceNumber = invoiceNumber;
}
public String getInvoiceNumber() {
return invoiceNumber;
}
public void setInvoiceType(String invoiceType) {
this.invoiceType = invoiceType;
}
public String getInvoiceType() {
return invoiceType;
}
public void setUsedFlag(String usedFlag) {
this.usedFlag = usedFlag;
}
public String getUsedFlag() {
return usedFlag;
}
public void setIncomeTaxYearTo(String incomeTaxYearTo) {
this.incomeTaxYearTo = incomeTaxYearTo;
}
public String getIncomeTaxYearTo() {
return incomeTaxYearTo;
}
public void setCompanyCode(String companyCode) {
this.companyCode = companyCode;
}
public String getCompanyCode() {
return companyCode;
}
public void setContractNumber(String contractNumber) {
this.contractNumber = contractNumber;
}
public String getContractNumber() {
return contractNumber;
}
public void setSecurityFlag(String securityFlag) {
this.securityFlag = securityFlag;
}
public String getSecurityFlag() {
return securityFlag;
}
public void setPurchaserTaxNumber(String purchaserTaxNumber) {
this.purchaserTaxNumber = purchaserTaxNumber;
}
public String getPurchaserTaxNumber() {
return purchaserTaxNumber;
}
public void setJournalHeads(List<JournalHeads> journalHeads) {
this.journalHeads = journalHeads;
}
public List<JournalHeads> getJournalHeads() {
return journalHeads;
}
public void setPurchaserName(String purchaserName) {
this.purchaserName = purchaserName;
}
public String getPurchaserName() {
return purchaserName;
}
public void setSysDocNumber(String sysDocNumber) {
this.sysDocNumber = sysDocNumber;
}
public String getSysDocNumber() {
return sysDocNumber;
}
public void setExpensePeriodFrom(String expensePeriodFrom) {
this.expensePeriodFrom = expensePeriodFrom;
}
public String getExpensePeriodFrom() {
return expensePeriodFrom;
}
public void setIncomeTaxDeduct(String incomeTaxDeduct) {
this.incomeTaxDeduct = incomeTaxDeduct;
}
public String getIncomeTaxDeduct() {
return incomeTaxDeduct;
}
public void setExpensePeriodTo(String expensePeriodTo) {
this.expensePeriodTo = expensePeriodTo;
}
public String getExpensePeriodTo() {
return expensePeriodTo;
}
}

View File

@ -0,0 +1,54 @@
/**
* Copyright 2024 bejson.com
*/
package shkd.fi.fi.common.dzpzk.bizdataquery.res;
/**
* Auto-generated: 2024-08-12 17:27:10
*
* @author bejson.com (i@bejson.com)
* @website http://www.bejson.com/java2pojo/
*/
public class BizdataQueryResBean {
private String processingResult;
private int retryCount;
private String evcTypeCode;
private String errorMessage;
private Attr attr;
public void setProcessingResult(String processingResult) {
this.processingResult = processingResult;
}
public String getProcessingResult() {
return processingResult;
}
public void setRetryCount(int retryCount) {
this.retryCount = retryCount;
}
public int getRetryCount() {
return retryCount;
}
public void setEvcTypeCode(String evcTypeCode) {
this.evcTypeCode = evcTypeCode;
}
public String getEvcTypeCode() {
return evcTypeCode;
}
public void setErrorMessage(String errorMessage) {
this.errorMessage = errorMessage;
}
public String getErrorMessage() {
return errorMessage;
}
public void setAttr(Attr attr) {
this.attr = attr;
}
public Attr getAttr() {
return attr;
}
}

View File

@ -0,0 +1,63 @@
/**
* Copyright 2024 bejson.com
*/
package shkd.fi.fi.common.dzpzk.bizdataquery.res;
import java.util.Date;
/**
* Auto-generated: 2024-08-12 17:27:10
*
* @author bejson.com (i@bejson.com)
* @website http://www.bejson.com/java2pojo/
*/
public class JournalHeads {
private String accountDate;
private String journalSummary;
private String accountYear;
private String journalNumber;
private String accountPeriod;
private String accEntityCode;
public void setAccountDate(String accountDate) {
this.accountDate = accountDate;
}
public String getAccountDate() {
return accountDate;
}
public void setJournalSummary(String journalSummary) {
this.journalSummary = journalSummary;
}
public String getJournalSummary() {
return journalSummary;
}
public void setAccountYear(String accountYear) {
this.accountYear = accountYear;
}
public String getAccountYear() {
return accountYear;
}
public void setJournalNumber(String journalNumber) {
this.journalNumber = journalNumber;
}
public String getJournalNumber() {
return journalNumber;
}
public void setAccountPeriod(String accountPeriod) {
this.accountPeriod = accountPeriod;
}
public String getAccountPeriod() {
return accountPeriod;
}
public void setAccEntityCode(String accEntityCode) {
this.accEntityCode = accEntityCode;
}
public String getAccEntityCode() {
return accEntityCode;
}
}

View File

@ -17,9 +17,9 @@ public class Attr {
private String companyName;
private String accountYear;
private String sellerName;
private Date accountPeriod;
private String accountPeriod;
private String buyerName;
private Date invoiceDate;
private String invoiceDate;
private String buyerTin;
private String invoiceCode;
private String invoiceNumber;
@ -66,10 +66,10 @@ public class Attr {
return sellerName;
}
public void setAccountPeriod(Date accountPeriod) {
public void setAccountPeriod(String accountPeriod) {
this.accountPeriod = accountPeriod;
}
public Date getAccountPeriod() {
public String getAccountPeriod() {
return accountPeriod;
}
@ -80,10 +80,10 @@ public class Attr {
return buyerName;
}
public void setInvoiceDate(Date invoiceDate) {
public void setInvoiceDate(String invoiceDate) {
this.invoiceDate = invoiceDate;
}
public Date getInvoiceDate() {
public String getInvoiceDate() {
return invoiceDate;
}

View File

@ -69,7 +69,6 @@ public class ApFinapbillFormPlugin extends AbstractBillPlugIn {
super.closedCallBack(closedCallBackEvent);
}
@Override
public void beforeDeleteRow(BeforeDeleteRowEventArgs e) {
super.beforeDeleteRow(e);
EntryProp entryProp = e.getEntryProp();

View File

@ -38,6 +38,7 @@ import shkd.fi.fi.common.orc.ErrorResponse;
import shkd.fi.fi.common.orc.OCRRetureData;
import shkd.fi.fi.common.orc.Response;
import shkd.fi.fi.util.LogBillUtils;
import shkd.fi.fi.util.ParamsUtils;
import java.io.*;
import java.math.BigDecimal;
@ -107,14 +108,15 @@ public class UploadAttachmentsFormPlugin extends AbstractFormPlugin {
option.setVariableValue(OperateOptionConst.ISHASRIGHT, "true");
option.setVariableValue(OperateOptionConst.IGNOREWARN, "true");
Map<String, String> paramsMap = ParamsUtils.getParamsMap();
//通过接口调用获取token "https://apigw.coscoshipping.com/token";
String tokenUrl = System.getProperty("tokenUrl");
String tokenUrl = paramsMap.get(AppflgConstant.YUNSHUI_TOKEN_URL);
//消费者账户密码 "8kHGk2X2z9UqHzqcNI0XuUbPIlEa:vDusBSMDPM_ohW6lZlANGB9hlQoa"
String xfzAccountPWS = System.getProperty("xfzAccountPWS");
String xfzAccountPWS = paramsMap.get(AppflgConstant.YUNSHUI_XFZACCOUNTPWS);
//加密消费者账户密码
byte[] xfzEncode = Base64.getEncoder().encode(xfzAccountPWS.getBytes());
String xfzEncodeStr = new String(xfzEncode);
String token;
String token="";
try {
//1.缓存有token 则取缓存里的token
@ -186,14 +188,14 @@ public class UploadAttachmentsFormPlugin extends AbstractFormPlugin {
ocrScannerBody.put("serialNo", billno + System.currentTimeMillis());
ocrScannerBody.put("taxNo", uniformsocialcreditcode);
ocrScannerBody.put("operatorAccount", "");
ocrScannerBody.put("systemName", System.getProperty("systemName"));//SH-INVSYS
ocrScannerBody.put("systemName", paramsMap.get(AppflgConstant.YUNSHUI_SYSTEMNAME));//SH-INVSYS
ocrScannerBody.put("serviceMode", "0");
ocrScannerBody.put("serviceMold", "1");
ocrScannerBody.put("base64Str", attachmentUrlEncodeStr);
try {
//1.4.调用OCR接口
String ocr_invoicescanner_url = System.getProperty("OCR_INVOICESCANNER_URL");
String ocr_invoicescanner_url = paramsMap.get(AppflgConstant.YUNSHUI_OCR_INVOICESCANNER_URL);
String postjson = HttpClientUtils.postjson(ocr_invoicescanner_url, ocrScannerHeader, ocrScannerBody.toJSONString());
LogBillUtils.SaveLogBill(ocr_invoicescanner_url, postjson, "OCR识别接口", ocrScannerBody.toString());
if (StringUtils.isEmpty(postjson)) {
@ -248,11 +250,11 @@ public class UploadAttachmentsFormPlugin extends AbstractFormPlugin {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
String format = simpleDateFormat.format(invoiceDate);
compliancecollectBody.put("BillingDate", format);//invoiceDate
compliancecollectBody.put("SystemName", System.getProperty("systemName"));
compliancecollectBody.put("SystemName", paramsMap.get(AppflgConstant.YUNSHUI_SYSTEMNAME));
compliancecollectBody.put("OperatorAccount", "CBS");
compliancecollectBody.put("OperatorName", "1");
//2.3.调用发票合规查验接口
String compliancecollectzy_url = System.getProperty("COMPLIANCECOLLECTZY_URL");
String compliancecollectzy_url = paramsMap.get(AppflgConstant.YUNSHUI_COMPLIANCECOLLECTZY_URL);
String compliancecollectPostjson = HttpClientUtils.postjson(compliancecollectzy_url, compliancecollectHeader, compliancecollectBody.toJSONString());
LogBillUtils.SaveLogBill(compliancecollectzy_url, compliancecollectPostjson, "发票合规查验接口", compliancecollectBody.toString());
//

View File

@ -15,10 +15,7 @@ import shkd.fi.fi.common.AppflgConstant;
import shkd.fi.fi.sap.result.docuentif.Item;
import shkd.fi.fi.sap.result.docuentif.MTDocumentIFRet;
import shkd.fi.fi.sap.result.docuentif.cxdocuentif.MT_CXDOCUMENT_IF_RET;
import shkd.fi.fi.util.DateUtils;
import shkd.fi.fi.util.HttpUtils;
import shkd.fi.fi.util.LogBillUtils;
import shkd.fi.fi.util.XmlUtils;
import shkd.fi.fi.util.*;
import javax.xml.bind.JAXBException;
import java.util.*;
@ -83,12 +80,14 @@ public class CxSapOPPlugin extends AbstractOperationServicePlugIn {
return;
}
Map<String, String> paramsMap = ParamsUtils.getParamsMap();
//校验通过进行冲销
//2.组装转换参数
String spa_user_pass = System.getProperty(AppflgConstant.SAP_USER_PASS);
String spa_user_pass = AppflgConstant.SAP_USER_PASS(paramsMap);
byte[] token = Base64.getEncoder().encode(spa_user_pass.getBytes());
String tokenStr = new String(token);
String sap_cx_voucher_url = System.getProperty(AppflgConstant.SAP_CX_VOUCHER_URL);
String sap_cx_voucher_url = AppflgConstant.SAP_CX_VOUCHER_URL(paramsMap);
String crdate = DateUtils.formatDate(new Date(),DateUtils.COMPACT_TIME);
Random random = new Random();
@ -99,8 +98,7 @@ public class CxSapOPPlugin extends AbstractOperationServicePlugIn {
DynamicObject org = gl_voucher.getDynamicObject("org");
String shkd_sap_number = org.getString("shkd_sap_number");
DynamicObject creator = gl_voucher.getDynamicObject("creator");
String packgId = System.getProperty(AppflgConstant.SYS_NUMBER)+time_random;
// String packgid = System.getProperty(AppflgConstant.SYS_NUMBER) + date.getTime();
String packgId = AppflgConstant.SYS_NUMBER(paramsMap)+time_random;
String billno = gl_voucher.getString("billno");
String shkd_belnr = gl_voucher.getString("shkd_belnr");
Date bookeddate = gl_voucher.getDate("bookeddate");

View File

@ -25,6 +25,7 @@ import shkd.fi.fi.common.AppflgConstant;
import shkd.fi.fi.common.dzpzk.bizdata.req.DzpzBizDataBean;
import shkd.fi.fi.common.dzpzk.bizdata.req.Evouchers;
import shkd.fi.fi.common.dzpzk.bizdata.req.JournalHeads;
import shkd.fi.fi.common.dzpzk.bizdataquery.res.BizdataQueryResBean;
import shkd.fi.fi.common.dzpzk.guidang.req.*;
import shkd.fi.fi.common.dzpzk.guidang.res.GuidangResponseBean;
import shkd.fi.fi.common.dzpzk.guidangquery.req.GuidangQueryReqBean;
@ -34,6 +35,7 @@ import shkd.fi.fi.sap.result.docuentif.Item;
import shkd.fi.fi.util.DateUtils;
import shkd.fi.fi.util.FileUtils;
import shkd.fi.fi.util.LogBillUtils;
import shkd.fi.fi.util.ParamsUtils;
import java.io.*;
import java.util.*;
@ -69,6 +71,7 @@ public class DzpzkOPPlugin extends AbstractOperationServicePlugIn {
synBizData(e);
break;
case "shkd_dzpzk_biz_res":
queryBizDataResult(e);
break;
default:
break;
@ -200,6 +203,7 @@ public class DzpzkOPPlugin extends AbstractOperationServicePlugIn {
return;
}
Integer integer = 0;
Map<String, String> paramsMap = ParamsUtils.getParamsMap();
//2.组装转换参数
String requstTime = DateUtils.formatDate(new Date(), DateUtils.PATTERN_CLASSICAL);
String requstNo = DateUtils.formatDate(new Date(), DateUtils.COMPACT_TIME);
@ -251,6 +255,7 @@ public class DzpzkOPPlugin extends AbstractOperationServicePlugIn {
body.setElements(elementsList);
guidangVo.setBody(body);
//同步
//1.缓存有token 则取缓存里的token
String token ="";
if (cache.contains(AppflgConstant.DZPZK_TOKEN)) {
@ -263,7 +268,7 @@ public class DzpzkOPPlugin extends AbstractOperationServicePlugIn {
try {
Map<String, String> hd = new HashMap<>();
Map<String, Object> bd = new HashMap<>();
String dzpzkTokenURL = AppflgConstant.getDzpzkTokenURL();
String dzpzkTokenURL = AppflgConstant.getDzpzkTokenURL(paramsMap);
String getTokenResult = HttpClientUtils.post(dzpzkTokenURL, hd,bd);
LogBillUtils.SaveLogBill(dzpzkTokenURL, getTokenResult, AppflgConstant.DZPZK_TOKE_URL_NAME, "");
if (StringUtils.isEmpty(getTokenResult)) {
@ -283,7 +288,7 @@ public class DzpzkOPPlugin extends AbstractOperationServicePlugIn {
}
try {
String guidangUrl = System.getProperty(AppflgConstant.DZPZK_GUIDANG_URL);
String guidangUrl = AppflgConstant.DZPZK_GUIDANG_URL(paramsMap);
Map<String, String> header = new HashMap<String, String>();
header.put("Authorization","Bearer "+token);
String jsonBody = JSONObject.toJSONString(guidangVo);
@ -452,14 +457,14 @@ public class DzpzkOPPlugin extends AbstractOperationServicePlugIn {
this.operationResult.setMessage("数据校验不通过:"+errStr.toString());
break;
}
if(!"0".equals(voucher.getString("shkd_dzpzkstatus"))){
errStr.append("凭证号:").append(voucherNo).append("不满足查询条件,原因:");
errStr.append(" 凭证归档状态不是 附件已归档待处理").append("\r");
this.operationResult.setShowMessage(true);
this.operationResult.setSuccess(false);
this.operationResult.setMessage("数据校验不通过:"+errStr.toString());
break;
}
// if(!"0".equals(voucher.getString("shkd_dzpzkstatus"))){
// errStr.append("凭证号:").append(voucherNo).append("不满足查询条件,原因:");
// errStr.append(" 电子凭证库同步状态不是 附件已归档待处理").append("\r");
// this.operationResult.setShowMessage(true);
// this.operationResult.setSuccess(false);
// this.operationResult.setMessage("数据校验不通过:"+errStr.toString());
// break;
// }
if(StringUtils.isEmpty(voucher.getString("shkd_gd_reqno"))){
errStr.append("凭证号:").append(voucherNo).append("不满足查询条件,原因:");
errStr.append(" 附件归档请求编号为空").append("\r");
@ -477,25 +482,13 @@ public class DzpzkOPPlugin extends AbstractOperationServicePlugIn {
this.operationResult.setMessage("数据校验不通过:"+errStr.toString());
return;
}
//2.组装转换参数
for (DynamicObject voucher : voucherColl) {
DynamicObject org = voucher.getDynamicObject("org");
String shkd_gd_reqno = voucher.getString("shkd_gd_reqno");
//同步
//1.缓存有token 则取缓存里的token
//1.缓存有token 则取缓存里的token
Map<String, String> paramsMap = ParamsUtils.getParamsMap();
String token ="";
if (cache.contains(AppflgConstant.DZPZK_TOKEN)) {
token = cache.get(AppflgConstant.DZPZK_TOKEN);
} else {
//2.缓存无token,通过接口调用获取token
//1.1.请求头
//1.3.通过接口调用获取token
try {
Map<String, String> hd = new HashMap<>();
Map<String, Object> bd = new HashMap<>();
String dzpzkTokenURL = AppflgConstant.getDzpzkTokenURL();
String dzpzkTokenURL = AppflgConstant.getDzpzkTokenURL(paramsMap);
String getTokenResult = HttpClientUtils.post(dzpzkTokenURL, hd,bd);
LogBillUtils.SaveLogBill(dzpzkTokenURL, getTokenResult, AppflgConstant.DZPZK_TOKE_URL_NAME, "");
if (StringUtils.isEmpty(getTokenResult)) {
@ -512,10 +505,15 @@ public class DzpzkOPPlugin extends AbstractOperationServicePlugIn {
} catch (IOException ex) {
throw new RuntimeException(ex);
}
}
//2.组装转换参数
for (DynamicObject voucher : voucherColl) {
DynamicObject org = voucher.getDynamicObject("org");
String shkd_gd_reqno = voucher.getString("shkd_gd_reqno");
//同步
try {
String guidangUrl = System.getProperty(AppflgConstant.DZPZK_GUIDANG_RES_URL);
String guidangUrl = AppflgConstant.DZPZK_GUIDANG_RES_URL(paramsMap);
Map<String, String> header = new HashMap<String, String>();
header.put("Authorization","Bearer "+token);
GuidangQueryReqBean guidangQueryReqBean = new GuidangQueryReqBean();
@ -538,18 +536,29 @@ public class DzpzkOPPlugin extends AbstractOperationServicePlugIn {
String postjson = HttpClientUtils.postjson(guidangUrl, header, jsonBody);
LogBillUtils.SaveLogBill(guidangUrl, postjson, AppflgConstant.DZPZK_GUIDANG_RES_URL_NAME, jsonBody);
GuidangQueryResBean guidangResponseBean = JSONObject.parseObject(postjson, GuidangQueryResBean.class);
if(null!=guidangResponseBean){
if("1".equals(guidangResponseBean.getProcessingResult())){
this.operationResult.setShowMessage(true);
this.operationResult.setSuccess(true);
this.operationResult.setMessage("同步成功");
voucher.set("shkd_dzpzkstatus","1");
this.operationResult.setMessage("同步成功,成功生成了归档元素");
voucher.set("shkd_dzpzkstatus","1");//附件归档成功
SaveServiceHelper.save(new DynamicObject[]{voucher});
}else if("0".equals(guidangResponseBean.getProcessingResult())) {
this.operationResult.setShowMessage(true);
this.operationResult.setSuccess(true);
this.operationResult.setMessage("电子凭证库系统附件归档结果暂未处理,请稍等查询");
} else if ("-1".equals(guidangResponseBean.getProcessingResult())) {
this.operationResult.setShowMessage(true);
this.operationResult.setSuccess(false);
this.operationResult.setMessage("电子凭证库系统附件归档结果未生成:"+guidangResponseBean.getErrorMessage());
voucher.set("shkd_dzpzkstatus","2");//附件归档失败
SaveServiceHelper.save(new DynamicObject[]{voucher});
}
}else {
this.operationResult.setShowMessage(true);
this.operationResult.setSuccess(false);
this.operationResult.setMessage("同步失败");
voucher.set("shkd_dzpzkstatus","2");
SaveServiceHelper.save(new DynamicObject[]{voucher});
this.operationResult.setMessage("电子凭证库系统附件归档结果查询结果为空,请联系管理员");
}
} catch (IOException ex) {
throw new RuntimeException(ex);
@ -612,7 +621,7 @@ public class DzpzkOPPlugin extends AbstractOperationServicePlugIn {
this.operationResult.setMessage("数据校验不通过:"+errStr.toString());
return;
}
Integer integer = 0;
Map<String, String> paramsMap = ParamsUtils.getParamsMap();
//2.组装转换参数
String requstTime = DateUtils.formatDate(new Date(), DateUtils.PATTERN_CLASSICAL);
String requstNo = DateUtils.formatDate(new Date(), DateUtils.COMPACT_TIME);
@ -670,7 +679,7 @@ public class DzpzkOPPlugin extends AbstractOperationServicePlugIn {
try {
Map<String, String> hd = new HashMap<>();
Map<String, Object> bd = new HashMap<>();
String dzpzkTokenURL = AppflgConstant.getDzpzkTokenURL();
String dzpzkTokenURL = AppflgConstant.getDzpzkTokenURL(paramsMap);
String getTokenResult = HttpClientUtils.post(dzpzkTokenURL, hd,bd);
LogBillUtils.SaveLogBill(dzpzkTokenURL, getTokenResult, AppflgConstant.DZPZK_TOKE_URL_NAME, "");
if (StringUtils.isEmpty(getTokenResult)) {
@ -690,27 +699,33 @@ public class DzpzkOPPlugin extends AbstractOperationServicePlugIn {
}
try {
String url = System.getProperty(AppflgConstant.SHKD_DZPZK_BIZ_URL);
String url = AppflgConstant.SHKD_DZPZK_BIZ_URL(paramsMap);
Map<String, String> header = new HashMap<String, String>();
header.put("Authorization","Bearer "+token);
String jsonBody = JSONObject.toJSONString(bizDataBean);
String postjson = HttpClientUtils.postjson(url, header, jsonBody);
LogBillUtils.SaveLogBill(url, postjson, AppflgConstant.DZPZK_GUIDANG_URL_NAME, jsonBody);
GuidangResponseBean guidangResponseBean = JSONObject.parseObject(postjson, GuidangResponseBean.class);
if("success".equals(guidangResponseBean.getCode())){
this.operationResult.setShowMessage(true);
this.operationResult.setSuccess(true);
this.operationResult.setMessage("同步成功");
voucher.set("shkd_gd_reqno",requstNo);
voucher.set("shkd_dzpzkstatus","0");
SaveServiceHelper.save(new DynamicObject[]{voucher});
}else {
if(null==guidangResponseBean){
this.operationResult.setShowMessage(true);
this.operationResult.setSuccess(false);
this.operationResult.setMessage("同步失败");
voucher.set("shkd_gd_reqno",requstNo);
voucher.set("shkd_dzpzkstatus","2");
this.operationResult.setMessage("电子凭证库系统凭证归档失败,接口返回结果为空");
}else {
if ("success".equals(guidangResponseBean.getCode())) {
this.operationResult.setShowMessage(true);
this.operationResult.setSuccess(true);
this.operationResult.setMessage("同步成功,电子凭证库系统凭证已归档待处理");
voucher.set("shkd_pz_reqno", requstNo);
voucher.set("shkd_dzpzkstatus", "3");//凭证已归档待处理
SaveServiceHelper.save(new DynamicObject[]{voucher});
} else {
this.operationResult.setShowMessage(true);
this.operationResult.setSuccess(false);
this.operationResult.setMessage("电子凭证库系统凭证归档失败:" + guidangResponseBean.getMessage());
voucher.set("shkd_pz_reqno", requstNo);
voucher.set("shkd_dzpzkstatus", "5");
SaveServiceHelper.save(new DynamicObject[]{voucher});
}
}
} catch (IOException ex) {
throw new RuntimeException(ex);
@ -735,7 +750,7 @@ public class DzpzkOPPlugin extends AbstractOperationServicePlugIn {
this.operationResult.setMessage("数据校验不通过:"+errStr.toString());
break;
}
if(!"0".equals(voucher.getString("shkd_dzpzkstatus"))){
if(!"3".equals(voucher.getString("shkd_dzpzkstatus"))){
errStr.append("凭证号:").append(voucherNo).append("不满足查询条件,原因:");
errStr.append(" 凭证归档状态不是 附件已归档待处理").append("\r");
this.operationResult.setShowMessage(true);
@ -743,9 +758,9 @@ public class DzpzkOPPlugin extends AbstractOperationServicePlugIn {
this.operationResult.setMessage("数据校验不通过:"+errStr.toString());
break;
}
if(StringUtils.isEmpty(voucher.getString("shkd_gd_reqno"))){
if(StringUtils.isEmpty(voucher.getString("shkd_pz_reqno"))){
errStr.append("凭证号:").append(voucherNo).append("不满足查询条件,原因:");
errStr.append(" 附件归档请求编号为空").append("\r");
errStr.append(" 凭证归档请求编号为空").append("\r");
this.operationResult.setShowMessage(true);
this.operationResult.setSuccess(false);
this.operationResult.setMessage("数据校验不通过:"+errStr.toString());
@ -761,10 +776,7 @@ public class DzpzkOPPlugin extends AbstractOperationServicePlugIn {
return;
}
//2.组装转换参数
for (DynamicObject voucher : voucherColl) {
DynamicObject org = voucher.getDynamicObject("org");
String shkd_gd_reqno = voucher.getString("shkd_gd_reqno");
//同步
Map<String, String> paramsMap = ParamsUtils.getParamsMap();
//1.缓存有token 则取缓存里的token
//1.缓存有token 则取缓存里的token
String token ="";
@ -778,7 +790,7 @@ public class DzpzkOPPlugin extends AbstractOperationServicePlugIn {
try {
Map<String, String> hd = new HashMap<>();
Map<String, Object> bd = new HashMap<>();
String dzpzkTokenURL = AppflgConstant.getDzpzkTokenURL();
String dzpzkTokenURL = AppflgConstant.getDzpzkTokenURL(paramsMap);
String getTokenResult = HttpClientUtils.post(dzpzkTokenURL, hd,bd);
LogBillUtils.SaveLogBill(dzpzkTokenURL, getTokenResult, AppflgConstant.DZPZK_TOKE_URL_NAME, "");
if (StringUtils.isEmpty(getTokenResult)) {
@ -797,8 +809,12 @@ public class DzpzkOPPlugin extends AbstractOperationServicePlugIn {
}
}
for (DynamicObject voucher : voucherColl) {
DynamicObject org = voucher.getDynamicObject("org");
String shkd_gd_reqno = voucher.getString("shkd_gd_reqno");
//同步
try {
String url = System.getProperty(AppflgConstant.SHKD_DZPZK_BIZ_RES_URL);
String url = AppflgConstant.SHKD_DZPZK_BIZ_RES_URL(paramsMap);
Map<String, String> header = new HashMap<String, String>();
header.put("Authorization","Bearer "+token);
GuidangQueryReqBean guidangQueryReqBean = new GuidangQueryReqBean();
@ -820,19 +836,25 @@ public class DzpzkOPPlugin extends AbstractOperationServicePlugIn {
String jsonBody = JSONObject.toJSONString(guidangQueryReqBean);
String postjson = HttpClientUtils.postjson(url, header, jsonBody);
LogBillUtils.SaveLogBill(url, postjson, AppflgConstant.SHKD_DZPZK_BIZ_RES_URL_NAME, jsonBody);
GuidangQueryResBean guidangResponseBean = JSONObject.parseObject(postjson, GuidangQueryResBean.class);
if("1".equals(guidangResponseBean.getProcessingResult())){
this.operationResult.setShowMessage(true);
this.operationResult.setSuccess(true);
this.operationResult.setMessage("同步成功");
voucher.set("shkd_dzpzkstatus","1");
SaveServiceHelper.save(new DynamicObject[]{voucher});
}else {
BizdataQueryResBean bizdataQueryResBean = JSONObject.parseObject(postjson, BizdataQueryResBean.class);
if(null==bizdataQueryResBean){
this.operationResult.setShowMessage(true);
this.operationResult.setSuccess(false);
this.operationResult.setMessage("同步失败");
voucher.set("shkd_dzpzkstatus","2");
this.operationResult.setMessage("同步失败,电子凭证库系统凭证业务数据归档接口返回结果为空");
}else {
if ("S".equals(bizdataQueryResBean.getProcessingResult())) {
this.operationResult.setShowMessage(true);
this.operationResult.setSuccess(true);
this.operationResult.setMessage("凭证归档同步成功");
voucher.set("shkd_dzpzkstatus", "4");
SaveServiceHelper.save(new DynamicObject[]{voucher});
} else {
this.operationResult.setShowMessage(true);
this.operationResult.setSuccess(false);
this.operationResult.setMessage("凭证归档同步失败:"+bizdataQueryResBean.getErrorMessage());
voucher.set("shkd_dzpzkstatus", "5");
SaveServiceHelper.save(new DynamicObject[]{voucher});
}
}
} catch (IOException ex) {
throw new RuntimeException(ex);
@ -841,32 +863,6 @@ public class DzpzkOPPlugin extends AbstractOperationServicePlugIn {
}
}
public static void updateVoucher (DynamicObject voucher,Item item) {
String zstatus = item.getZstatus();
String packgid = item.getPackgid();
String docid = item.getDocid();
String promsg = item.getPromsg();
String bukrs = item.getBukrs();
String gjahr = item.getGjahr();
String monat = item.getMonat();
String belnr = item.getBelnr();
String wbdate = item.getWbdate();
voucher.set("shkd_zstatus","S".equals(zstatus)?"1":"0");
voucher.set("shkd_packgid",packgid);
voucher.set("shkd_docid",docid);
voucher.set("shkd_promsg",promsg);
voucher.set("shkd_bukrs",bukrs);
voucher.set("shkd_gjahr",gjahr);
voucher.set("shkd_monat",monat);
voucher.set("shkd_belnr",belnr);
voucher.set("shkd_wbdate",wbdate);
SaveServiceHelper.save(new DynamicObject[]{voucher});
}
public static void updateVoucher (DynamicObject voucher,String resultStr) {
voucher.set("shkd_gd_reqno","0");
voucher.set("shkd_dzpzkstatus",resultStr);
SaveServiceHelper.save(new DynamicObject[]{voucher});
}
/**
* 单据下插

View File

@ -23,6 +23,7 @@ import shkd.fi.fi.sap.result.docuentif.Item;
import shkd.fi.fi.sap.result.docuentif.MTDocumentIFRet;
import shkd.fi.fi.util.HttpUtils;
import shkd.fi.fi.util.LogBillUtils;
import shkd.fi.fi.util.ParamsUtils;
import shkd.fi.fi.util.XmlUtils;
import javax.xml.bind.JAXBException;
@ -225,6 +226,7 @@ public class SynchronizaSapOPPlugin extends AbstractOperationServicePlugIn {
}
Integer integer = 0;
//2.组装转换参数
Map<String, String> paramsMap = ParamsUtils.getParamsMap();
for (DynamicObject dataEntity : voucherColl) {
//结构ZFIS_YS_HEAD 库存-财务系统PI接口表头结构 (1-6)
@ -253,7 +255,7 @@ public class SynchronizaSapOPPlugin extends AbstractOperationServicePlugIn {
DynamicObjectCollection entries = gl_voucher.getDynamicObjectCollection("entries");
integer += entries.size();
//5.数据包唯一标识号(PACKGID)--格式JDN+时间戳
String packgid = System.getProperty(AppflgConstant.SYS_NUMBER) + date.getTime();
String packgid = AppflgConstant.SYS_NUMBER(paramsMap) + date.getTime();
//6.数据状态T测试运行P正式运行(ZFLAG)--固定传T
String zflag = "P";
header.setBUKRS(shkd_sap_number);
@ -435,10 +437,10 @@ public class SynchronizaSapOPPlugin extends AbstractOperationServicePlugIn {
try {
DT_DOCUMENT_IF_SRC dt_document_if_src = setData(header, items);
String xml = XmlUtils.getXml(dt_document_if_src).replaceAll("DT_DOCUMENT_IF_SRC", "urn:MT_DOCUMENT_IF_SRC");
String spa_user_pass = System.getProperty(AppflgConstant.SAP_USER_PASS);
String spa_user_pass = AppflgConstant.SAP_USER_PASS(paramsMap);
byte[] token = Base64.getEncoder().encode(spa_user_pass.getBytes());
String tokenStr = new String(token);
String sap_syn_voucher_url = System.getProperty(AppflgConstant.SAP_SYN_VOUCHER_URL);
String sap_syn_voucher_url = AppflgConstant.SAP_SYN_VOUCHER_URL(paramsMap);
String responseStr="";
Map<String,Object> result = HttpUtils.sendPostToSAP(sap_syn_voucher_url,tokenStr, xml);
@ -490,7 +492,6 @@ public class SynchronizaSapOPPlugin extends AbstractOperationServicePlugIn {
}
System.out.println(integer);
}
public static void updateVoucher (DynamicObject voucher,Item item) {

View File

@ -0,0 +1,23 @@
package shkd.fi.fi.util;
import kd.bos.dataentity.entity.DynamicObject;
import kd.bos.orm.query.QCP;
import kd.bos.orm.query.QFilter;
import kd.bos.servicehelper.BusinessDataServiceHelper;
import java.util.HashMap;
import java.util.Map;
public class ParamsUtils {
public static Map<String,String> getParamsMap(){
Map<String,String> map = new HashMap<String,String>();
QFilter filter = new QFilter("id", QCP.not_equals,0);
DynamicObject[] coll = BusinessDataServiceHelper.load("shkd_params", "number,shkd_val", new QFilter[]{filter});
for (int i = 0; i < coll.length; i++) {
DynamicObject dynamicObject = coll[i];
map.put(dynamicObject.getString("number"),dynamicObject.getString("shkd_val"));
}
return map;
}
}