收款处理自动推送费控定时任务
This commit is contained in:
parent
ab05e6bae9
commit
323ca77b3f
|
|
@ -35,6 +35,11 @@ public class FeeControlApiPlugin extends AbstractFormPlugin implements Plugin {
|
||||||
private static final String ENTRY_KEY = "shjh_entryentity";
|
private static final String ENTRY_KEY = "shjh_entryentity";
|
||||||
private static final String PAYMENT_API = "paymentApi";
|
private static final String PAYMENT_API = "paymentApi";
|
||||||
private static final String LOAN_API = "loanApi";
|
private static final String LOAN_API = "loanApi";
|
||||||
|
private static final String INTERFACE_ID1 ="FMGetJahYFKList";//识别被调接口并进行路由-预付款退回
|
||||||
|
|
||||||
|
private static final String INTERFACE_ID2 ="FMGetJahJKYList";//识别被调接口并进行路由-员工借款
|
||||||
|
|
||||||
|
private static final String RECEIVER_ID ="FeiKong";//定义的发送者
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 按钮监听
|
* 按钮监听
|
||||||
|
|
@ -156,8 +161,7 @@ public class FeeControlApiPlugin extends AbstractFormPlugin implements Plugin {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
String supplierCode = supplier.getString("number");
|
String supplierCode = supplier.getString("number");
|
||||||
String interfaceID="FMGetJahYFKList";
|
HashMap<String, String> head = ApiUtils.buildHead(INTERFACE_ID1,RECEIVER_ID);
|
||||||
HashMap<String, String> head = ApiUtils.buildHead(interfaceID);
|
|
||||||
HashMap<String, Object> body = ApiUtils.buildBody(companyCode, this.getUserCode(), startDate, endDate);
|
HashMap<String, Object> body = ApiUtils.buildBody(companyCode, this.getUserCode(), startDate, endDate);
|
||||||
HashMap<String, Object> data = (HashMap<String, Object>) body.get("data");
|
HashMap<String, Object> data = (HashMap<String, Object>) body.get("data");
|
||||||
|
|
||||||
|
|
@ -247,8 +251,7 @@ public class FeeControlApiPlugin extends AbstractFormPlugin implements Plugin {
|
||||||
*/
|
*/
|
||||||
private void handleLoanApi(String companyCode, Date startDate, Date endDate, String billNumber) {
|
private void handleLoanApi(String companyCode, Date startDate, Date endDate, String billNumber) {
|
||||||
try {
|
try {
|
||||||
String interfaceID="FMGetJahJKYList";
|
HashMap<String, String> head = ApiUtils.buildHead(INTERFACE_ID2,RECEIVER_ID);
|
||||||
HashMap<String, String> head = ApiUtils.buildHead(interfaceID);
|
|
||||||
HashMap<String, Object> body = ApiUtils.buildBody(companyCode, this.getUserCode(), startDate, endDate);
|
HashMap<String, Object> body = ApiUtils.buildBody(companyCode, this.getUserCode(), startDate, endDate);
|
||||||
//String response = ApiUtils.sendPost(head, body, "https://hipint-stg.jahwa.com.cn:6443/gateway/HIP_ReceiveFromFM/1.0/fm/send");
|
//String response = ApiUtils.sendPost(head, body, "https://hipint-stg.jahwa.com.cn:6443/gateway/HIP_ReceiveFromFM/1.0/fm/send");
|
||||||
String response="{\n" +
|
String response="{\n" +
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,158 @@
|
||||||
|
package shjh.jhzj7.fi.fi.plugin.form;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONArray;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import kd.bos.dataentity.entity.DynamicObject;
|
||||||
|
import kd.bos.entity.EntityMetadataCache;
|
||||||
|
import kd.bos.entity.datamodel.ListSelectedRowCollection;
|
||||||
|
import kd.bos.form.control.events.ItemClickEvent;
|
||||||
|
import kd.bos.list.BillList;
|
||||||
|
import kd.bos.list.plugin.AbstractListPlugin;
|
||||||
|
import kd.bos.logging.Log;
|
||||||
|
import kd.bos.logging.LogFactory;
|
||||||
|
import kd.bos.orm.query.QCP;
|
||||||
|
import kd.bos.orm.query.QFilter;
|
||||||
|
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||||
|
import kd.bos.servicehelper.botp.BFTrackerServiceHelper;
|
||||||
|
import kd.sdk.plugin.Plugin;
|
||||||
|
import shjh.jhzj7.fi.fi.utils.SapUtils;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 标准单据列表插件
|
||||||
|
* 【收款业务变更】扩展校验方法
|
||||||
|
*
|
||||||
|
* @author LiGuiQiang
|
||||||
|
*/
|
||||||
|
public class RecBillChangeListExtendPlugin extends AbstractListPlugin implements Plugin {
|
||||||
|
|
||||||
|
private final static Log logger = LogFactory.getLog(RecBillChangeListExtendPlugin.class);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void itemClick(ItemClickEvent evt) {
|
||||||
|
String key = evt.getItemKey();
|
||||||
|
if (!"tblrecchg".equalsIgnoreCase(key)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
BillList list = (BillList) this.getView().getControl("billlistap");
|
||||||
|
ListSelectedRowCollection selectedRows = list.getSelectedRows();
|
||||||
|
if (selectedRows == null || selectedRows.isEmpty()) {
|
||||||
|
this.getView().showTipNotification("请选择需要操作的收款单!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
DynamicObject recBill = BusinessDataServiceHelper.loadSingle(
|
||||||
|
selectedRows.get(0).getPrimaryKeyValue(),
|
||||||
|
EntityMetadataCache.getDataEntityType("cas_recbill")
|
||||||
|
);
|
||||||
|
|
||||||
|
String billStatus = recBill.getString("billstatus");
|
||||||
|
String sourceBillType = recBill.getString("sourcebilltype");
|
||||||
|
String voucherNum = recBill.getString("shjh_vouchernum");
|
||||||
|
String typeNumber = recBill.getString("receivingtype.number");
|
||||||
|
String qzState = recBill.getString("shjh_qzzt");
|
||||||
|
BigDecimal actrecamt = recBill.getBigDecimal("actrecamt");
|
||||||
|
|
||||||
|
// 校验:状态为“已收款” 且 来源为“收款入账中心/认领通知单”
|
||||||
|
boolean isStatusC = "C".equals(billStatus);
|
||||||
|
boolean isValidSource = "cas_claimcenterbill".equals(sourceBillType) || "bei_intelrec".equals(sourceBillType);
|
||||||
|
if (!(isStatusC && isValidSource)) {
|
||||||
|
this.getView().showTipNotification("所选单据不满足变更条件,只有单据状态=“已收款”且源单类型=“收款入账中心/认领通知单”的收款单才允许变更。");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 校验:SAP凭证号不能为空
|
||||||
|
if (voucherNum == null || voucherNum.trim().isEmpty()) {
|
||||||
|
this.getView().showTipNotification("所选单据不满足变更条件,SAP凭证号≠空。");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 校验:收款类型必须为指定类型
|
||||||
|
if (!Arrays.asList("103", "109", "100").contains(typeNumber)) {
|
||||||
|
this.getView().showTipNotification("所选单据不满足变更条件,只有收款类型=“预付款退回/员工还款/销售回款”的收款单才允许变更。");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 校验清账状态
|
||||||
|
boolean isAutoCleared = "A".equals(qzState) || "D".equals(qzState);
|
||||||
|
boolean isToBeCleared = "B".equals(qzState);
|
||||||
|
boolean isClearBillCancelled = false;
|
||||||
|
|
||||||
|
if (isToBeCleared) {
|
||||||
|
Map<String, HashSet<Long>> recBillMap = BFTrackerServiceHelper.findSourceBills("cas_recbill", new Long[]{(Long) recBill.getPkValue()});
|
||||||
|
if (recBillMap.containsKey("shjh_clear_account")) {
|
||||||
|
Set<Long> billIds = recBillMap.get("shjh_clear_account");
|
||||||
|
for (Long billId : billIds) {
|
||||||
|
DynamicObject clearBill = BusinessDataServiceHelper.loadSingle(billId, "shjh_clear_account");
|
||||||
|
if (clearBill != null && "D".equals(clearBill.getString("billstatus"))) {
|
||||||
|
isClearBillCancelled = true;
|
||||||
|
break; // 只要存在一个作废的清账单即可
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.getView().showTipNotification("所选单据不满足变更条件,下游未关联清账单。");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(isAutoCleared || (isToBeCleared && isClearBillCancelled))) {
|
||||||
|
this.getView().showTipNotification("所选单据不满足变更条件,只有清账状态为“无需金蝶清账/反清账”,或清账状态为“待清账”且清账单已作废的收款单才允许变更。");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 校验收款金额 > 0
|
||||||
|
if (actrecamt == null || actrecamt.compareTo(BigDecimal.ZERO) <= 0) {
|
||||||
|
this.getView().showTipNotification("所选单据不满足变更条件,只有收款金额>0的收款单才允许变更。");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// SAP清账状态校验
|
||||||
|
boolean cleared = false;
|
||||||
|
String billNumber = recBill.getString("billno");
|
||||||
|
String companyCode = recBill.getString("org.number");
|
||||||
|
String sapFiscalYear = recBill.getString("shjh_sapfiscalyear");
|
||||||
|
String sapLineNumber = recBill.getString("shjh_sapline");
|
||||||
|
|
||||||
|
String response = SapUtils.querySapClearAccountsState(billNumber, companyCode, voucherNum, sapFiscalYear, sapLineNumber);
|
||||||
|
if (response != null) {
|
||||||
|
try {
|
||||||
|
JSONObject json = JSONObject.parseObject(response);
|
||||||
|
JSONObject data = json.getJSONObject("data");
|
||||||
|
JSONArray itItems = data.getJSONArray("IT_ITEMS");
|
||||||
|
if (itItems != null && !itItems.isEmpty()) {
|
||||||
|
JSONObject resultItem = itItems.getJSONObject(0);
|
||||||
|
cleared = "y".equalsIgnoreCase(resultItem.getString("ZCLEARED"));
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error("SAP返回清账状态解析异常:" + e.getMessage(), e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cleared) {
|
||||||
|
this.getView().showTipNotification("所选单据不满足变更条件,该单据在SAP已清账。");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 校验是否有付款申请锁定
|
||||||
|
QFilter[] filters = new QFilter[]{
|
||||||
|
new QFilter("org.number", QCP.equals, companyCode),
|
||||||
|
new QFilter("shjh_vouchernum", QCP.equals, voucherNum),
|
||||||
|
new QFilter("shjh_sapfiscalyear", QCP.equals, sapFiscalYear),
|
||||||
|
new QFilter("shjh_sapline", QCP.equals, sapLineNumber)
|
||||||
|
};
|
||||||
|
DynamicObject payApply = BusinessDataServiceHelper.loadSingle("ap_payapply", filters);
|
||||||
|
if (payApply != null) {
|
||||||
|
this.getView().showTipNotification("所选单据不满足变更条件,存在SAP关联付款申请:" + payApply.getString("billno") + ",不允许变更。");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 到这里表示全部校验通过,可以继续执行变更逻辑
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -35,6 +35,9 @@ public class LoanPushSapOperation extends AbstractOperationServicePlugIn impleme
|
||||||
|
|
||||||
private final static Log logger = LogFactory.getLog(LoanPushSapOperation.class);
|
private final static Log logger = LogFactory.getLog(LoanPushSapOperation.class);
|
||||||
|
|
||||||
|
private static final String INTERFACE_ID ="GeneraRepayBill";//识别被调接口并进行路由-员工借款
|
||||||
|
|
||||||
|
private static final String RECEIVER_ID ="FeiKong";//定义的发送者
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 操作标识
|
* 操作标识
|
||||||
|
|
@ -83,14 +86,14 @@ public class LoanPushSapOperation extends AbstractOperationServicePlugIn impleme
|
||||||
if (null != recBill) {
|
if (null != recBill) {
|
||||||
//单号
|
//单号
|
||||||
String billNumber = recBill.getString("billno");
|
String billNumber = recBill.getString("billno");
|
||||||
String interfaceId = "GeneraRepayBill";
|
|
||||||
HashMap<String, String> responseHead = ApiUtils.buildHead(interfaceId);
|
HashMap<String, String> responseHead = ApiUtils.buildHead(INTERFACE_ID,RECEIVER_ID);
|
||||||
HashMap<String, Object> responseBody = this.assembleRequest(interfaceId,billNumber, recBill,message);
|
HashMap<String, Object> responseBody = this.assembleRequest(INTERFACE_ID,billNumber, recBill,message);
|
||||||
//try {
|
//try {
|
||||||
// String response = ApiUtils.sendPost(responseHead, responseBody, "https://hipint-stg.jahwa.com.cn:6443/gateway/HIP_ReceiveFromFM/1.0/fm/send");
|
// String response = ApiUtils.sendPost(responseHead, responseBody, "https://hipint-stg.jahwa.com.cn:6443/gateway/HIP_ReceiveFromFM/1.0/fm/send");
|
||||||
String response="{ \"rootContextID\": \"8as6dfasd6f98as7d6f9a98sd76f\", \"code\": \"0\", \"msg\": \"成功\", \"data\": { \"ID\": \"ab7a4722-656e-4fdf-bcea-3d40d175fa78\", \"BillConfigID\": 2524, \"RequestCode\": \"JKY2025030400002\" } }";
|
String response="{ \"rootContextID\": \"8as6dfasd6f98as7d6f9a98sd76f\", \"code\": \"0\", \"msg\": \"成功\", \"data\": { \"ID\": \"ab7a4722-656e-4fdf-bcea-3d40d175fa78\", \"BillConfigID\": 2524, \"RequestCode\": \"JKY2025030400002\" } }";
|
||||||
if (!response.isEmpty()) {
|
if (!response.isEmpty()) {
|
||||||
this.parseResponse(recBill,response, billNumber, responseBody, interfaceId, message);
|
this.parseResponse(recBill,response, billNumber, responseBody, INTERFACE_ID, message);
|
||||||
}
|
}
|
||||||
//} catch (IOException ex) {
|
//} catch (IOException ex) {
|
||||||
// message.append("收款处理【").append(billNumber).append("】:").append(ex.getMessage()).append("\n");
|
// message.append("收款处理【").append(billNumber).append("】:").append(ex.getMessage()).append("\n");
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,9 @@ public class PaymentPushSapOperation extends AbstractOperationServicePlugIn impl
|
||||||
|
|
||||||
private final static Log logger = LogFactory.getLog(PaymentPushSapOperation.class);
|
private final static Log logger = LogFactory.getLog(PaymentPushSapOperation.class);
|
||||||
|
|
||||||
|
private static final String INTERFACE_ID ="GeneraGTH";//识别被调接口并进行路由-员工借款
|
||||||
|
|
||||||
|
private static final String RECEIVER_ID ="FeiKong";//定义的发送者
|
||||||
/**
|
/**
|
||||||
* 操作标识
|
* 操作标识
|
||||||
*/
|
*/
|
||||||
|
|
@ -83,13 +85,13 @@ public class PaymentPushSapOperation extends AbstractOperationServicePlugIn impl
|
||||||
if (null != recBill) {
|
if (null != recBill) {
|
||||||
//单号
|
//单号
|
||||||
String billNumber = recBill.getString("billno");
|
String billNumber = recBill.getString("billno");
|
||||||
String interfaceId = "GeneraGTH";
|
|
||||||
HashMap<String, String> responseHead = ApiUtils.buildHead(interfaceId);
|
HashMap<String, String> responseHead = ApiUtils.buildHead(INTERFACE_ID,RECEIVER_ID);
|
||||||
HashMap<String, Object> responseBody = this.assembleRequest(interfaceId,billNumber, recBill,message);
|
HashMap<String, Object> responseBody = this.assembleRequest(INTERFACE_ID,billNumber, recBill,message);
|
||||||
try {
|
try {
|
||||||
String response = ApiUtils.sendPost(responseHead, responseBody, "https://hipint-stg.jahwa.com.cn:6443/gateway/HIP_ReceiveFromFM/1.0/fm/send");
|
String response = ApiUtils.sendPost(responseHead, responseBody, "https://hipint-stg.jahwa.com.cn:6443/gateway/HIP_ReceiveFromFM/1.0/fm/send");
|
||||||
if (!response.isEmpty()) {
|
if (!response.isEmpty()) {
|
||||||
this.parseResponse(recBill,response, billNumber, responseBody, interfaceId, message);
|
this.parseResponse(recBill,response, billNumber, responseBody, INTERFACE_ID, message);
|
||||||
}
|
}
|
||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
message.append("收款处理【").append(billNumber).append("】:").append(ex.getMessage()).append("\n");
|
message.append("收款处理【").append(billNumber).append("】:").append(ex.getMessage()).append("\n");
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,9 @@ public class RebReversalFiOperation extends AbstractOperationServicePlugIn imple
|
||||||
|
|
||||||
private final static Log logger = LogFactory.getLog(RebReversalFiOperation.class);
|
private final static Log logger = LogFactory.getLog(RebReversalFiOperation.class);
|
||||||
|
|
||||||
|
private static final String INTERFACE_ID ="BillInvalid";//识别被调接口并进行路由-员工借款
|
||||||
|
|
||||||
|
private static final String RECEIVER_ID ="FeiKong";//定义的发送者
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 操作标识
|
* 操作标识
|
||||||
|
|
@ -132,14 +135,14 @@ public class RebReversalFiOperation extends AbstractOperationServicePlugIn imple
|
||||||
if (null != recBill) {
|
if (null != recBill) {
|
||||||
//单号
|
//单号
|
||||||
String billNumber = recBill.getString("billno");
|
String billNumber = recBill.getString("billno");
|
||||||
String interfaceId = "BillInvalid";
|
|
||||||
HashMap<String, String> responseHead = ApiUtils.buildHead(interfaceId);
|
HashMap<String, String> responseHead = ApiUtils.buildHead(INTERFACE_ID,RECEIVER_ID);
|
||||||
HashMap<String, Object> responseBody = this.assembleRequest(interfaceId,billNumber, recBill,message);
|
HashMap<String, Object> responseBody = this.assembleRequest(INTERFACE_ID,billNumber, recBill,message);
|
||||||
//try {
|
//try {
|
||||||
// String response = ApiUtils.sendPost(responseHead, responseBody, "https://hipint-stg.jahwa.com.cn:6443/gateway/HIP_ReceiveFromFM/1.0/fm/send");
|
// String response = ApiUtils.sendPost(responseHead, responseBody, "https://hipint-stg.jahwa.com.cn:6443/gateway/HIP_ReceiveFromFM/1.0/fm/send");
|
||||||
String response="{ \"rootContextID\": \"8as6dfasd6f98as7d6f9a98sd76f\", \"code\": \"0\", \"msg\": \"红冲作废单据处理成功\", \"data\": null }";
|
String response="{ \"rootContextID\": \"8as6dfasd6f98as7d6f9a98sd76f\", \"code\": \"0\", \"msg\": \"红冲作废单据处理成功\", \"data\": null }";
|
||||||
if (!response.isEmpty()) {
|
if (!response.isEmpty()) {
|
||||||
this.parseResponse(response, billNumber, responseBody, interfaceId, message);
|
ApiUtils.parseResponse(response, billNumber, responseBody, INTERFACE_ID, message);
|
||||||
}
|
}
|
||||||
//} catch (IOException ex) {
|
//} catch (IOException ex) {
|
||||||
// message.append("收款处理【").append(billNumber).append("】:").append(ex.getMessage()).append("\n");
|
// message.append("收款处理【").append(billNumber).append("】:").append(ex.getMessage()).append("\n");
|
||||||
|
|
@ -200,7 +203,7 @@ public class RebReversalFiOperation extends AbstractOperationServicePlugIn imple
|
||||||
* @param body 请求体
|
* @param body 请求体
|
||||||
* @param apiName 接口名
|
* @param apiName 接口名
|
||||||
*/
|
*/
|
||||||
private void parseResponse(String response, String billNumber, HashMap<String, Object> body, String apiName, StringBuilder message) {
|
public void parseResponse(String response, String billNumber, HashMap<String, Object> body, String apiName, StringBuilder message) {
|
||||||
JSONObject result = JSONObject.parseObject(response);
|
JSONObject result = JSONObject.parseObject(response);
|
||||||
if (null != result) {
|
if (null != result) {
|
||||||
String formattedBody = JSON.toJSONString(body);
|
String formattedBody = JSON.toJSONString(body);
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
package shjh.jhzj7.fi.fi.utils;
|
package shjh.jhzj7.fi.fi.utils;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import kd.bos.logging.Log;
|
import kd.bos.logging.Log;
|
||||||
import kd.bos.logging.LogFactory;
|
import kd.bos.logging.LogFactory;
|
||||||
import org.apache.http.HttpResponse;
|
import org.apache.http.HttpResponse;
|
||||||
|
|
@ -23,12 +24,12 @@ public class ApiUtils {
|
||||||
|
|
||||||
static Log log = LogFactory.getLog(ApiUtils.class);
|
static Log log = LogFactory.getLog(ApiUtils.class);
|
||||||
|
|
||||||
public static HashMap<String,String> buildHead(String interfaceId){
|
public static HashMap<String,String> buildHead(String interfaceId,String receiverId){
|
||||||
HashMap<String,String> header = new HashMap<>(5);
|
HashMap<String,String> header = new HashMap<>(5);
|
||||||
header.put("Content-Type","application/json;charset=UTF-8");
|
header.put("Content-Type","application/json;charset=UTF-8");
|
||||||
header.put("x-Gateway-APIKey","207b5296-9866-4b4b-8146-1fea58b3c8c9");
|
header.put("x-Gateway-APIKey","207b5296-9866-4b4b-8146-1fea58b3c8c9");
|
||||||
header.put("interfaceID",interfaceId);
|
header.put("interfaceID",interfaceId);
|
||||||
header.put("receiverID","FeiKong");
|
header.put("receiverID",receiverId);
|
||||||
return header;
|
return header;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -88,5 +89,43 @@ public class ApiUtils {
|
||||||
return responseData;
|
return responseData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 响应解析
|
||||||
|
* 日志记录
|
||||||
|
* @param response 响应参数
|
||||||
|
* @param billNumber 本单单号
|
||||||
|
* @param body 请求体
|
||||||
|
* @param apiName 接口名
|
||||||
|
*/
|
||||||
|
public static boolean parseResponse(String response, String billNumber, HashMap<String, Object> body, String apiName, StringBuilder message) {
|
||||||
|
JSONObject result = JSONObject.parseObject(response);
|
||||||
|
boolean isSuccess =false;
|
||||||
|
if (null != result) {
|
||||||
|
String formattedBody = JSON.toJSONString(body);
|
||||||
|
String code = result.getString("code");
|
||||||
|
switch (code) {
|
||||||
|
case "0":
|
||||||
|
isSuccess=true;
|
||||||
|
EsbUtils.saveLog("收款处理"+billNumber, apiName, formattedBody, response, true, "ESBReversalApi", "推送成功");
|
||||||
|
break;
|
||||||
|
case "1":
|
||||||
|
EsbUtils.saveLog("收款处理"+billNumber, apiName, formattedBody, response, false, "ESBReversalApi", "服务异常");
|
||||||
|
message.append("收款处理【").append(billNumber).append("】:").append("服务异常").append("\n");
|
||||||
|
break;
|
||||||
|
case "2":
|
||||||
|
EsbUtils.saveLog("收款处理"+billNumber, apiName, formattedBody, response, false, "ESBReversalApi", "三方服务异常");
|
||||||
|
message.append("收款处理【").append(billNumber).append("】:").append("三方服务异常").append("\n");
|
||||||
|
break;
|
||||||
|
case "3":
|
||||||
|
EsbUtils.saveLog("收款处理"+billNumber, apiName, formattedBody, response, false, "ESBReversalApi", "业务异常");
|
||||||
|
message.append("收款处理【").append(billNumber).append("】:").append("业务异常").append("\n");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
EsbUtils.saveLog("收款处理"+billNumber, apiName, formattedBody, response, false, "ESBReversalApi", "未知异常");
|
||||||
|
message.append("收款处理【").append(billNumber).append("】:").append("未知异常").append("\n");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return isSuccess;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -13,8 +13,10 @@ import org.apache.http.entity.StringEntity;
|
||||||
import org.apache.http.impl.client.HttpClients;
|
import org.apache.http.impl.client.HttpClients;
|
||||||
import org.apache.http.util.EntityUtils;
|
import org.apache.http.util.EntityUtils;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
|
import java.util.*;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
@ -48,16 +50,25 @@ public class SapUtils {
|
||||||
public static final String sapArUrl = "https://hipint-stg.jahwa.com.cn:6443/gateway/HIP_ReceiveFromFM/1.0/fm/send";//测试环境(SAP应收凭证清单)
|
public static final String sapArUrl = "https://hipint-stg.jahwa.com.cn:6443/gateway/HIP_ReceiveFromFM/1.0/fm/send";//测试环境(SAP应收凭证清单)
|
||||||
// public static final String sapArUrl = "https://hipint.jahwa.com.cn:6443/gateway/HIP_ReceiveFromFM/1.0/fm/send";//正式环境
|
// public static final String sapArUrl = "https://hipint.jahwa.com.cn:6443/gateway/HIP_ReceiveFromFM/1.0/fm/send";//正式环境
|
||||||
|
|
||||||
|
private static final String API_METHOD4 = "SAP收款凭证清账状态查询接口";
|
||||||
|
private static final String INTERFACE_ID4 = "ReceiptVoucherClearingStatusCheck";
|
||||||
|
/**
|
||||||
|
* 测试地址
|
||||||
|
*/
|
||||||
|
public static final String QUERY_STATE_URL = "https://hipint-stg.jahwa.com.cn:6443/gateway/HIP_ReceiveFromFM/1.0/fm/send";
|
||||||
|
// public static final String withholdingUrl = "https://hipint.jahwa.com.cn:6443/gateway//HIP_ReceiveFromFM/1.0/fm/send";
|
||||||
|
public static final String RECEIVER_ID4 = "SAP";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SAP应付凭证锁定解锁状态回写
|
* SAP应付凭证锁定解锁状态回写
|
||||||
*/
|
*/
|
||||||
public static JSONObject unlocked_status(JSONArray IT_INPUT,String billno){
|
public static JSONObject unlocked_status(JSONArray IT_INPUT, String billno) {
|
||||||
|
|
||||||
Map<String, Object> thirdPartyMap = new HashMap<>();
|
Map<String, Object> thirdPartyMap = new HashMap<>();
|
||||||
thirdPartyMap.put("interfaceID",interfaceID1);
|
thirdPartyMap.put("interfaceID", interfaceID1);
|
||||||
thirdPartyMap.put("receiverID",receiverID1);
|
thirdPartyMap.put("receiverID", receiverID1);
|
||||||
thirdPartyMap.put("URL",unlockedUrl);
|
thirdPartyMap.put("URL", unlockedUrl);
|
||||||
thirdPartyMap.put("billno",billno);
|
thirdPartyMap.put("billno", billno);
|
||||||
// 组装请求体
|
// 组装请求体
|
||||||
JSONObject pendingsBody = unlockedBody(IT_INPUT);
|
JSONObject pendingsBody = unlockedBody(IT_INPUT);
|
||||||
// 发送请求并处理响应
|
// 发送请求并处理响应
|
||||||
|
|
@ -66,6 +77,7 @@ public class SapUtils {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SAP应付凭证锁定解锁状态回写组装请求体:
|
* SAP应付凭证锁定解锁状态回写组装请求体:
|
||||||
|
*
|
||||||
* @return 请求体的 JSON 对象
|
* @return 请求体的 JSON 对象
|
||||||
*/
|
*/
|
||||||
private static JSONObject unlockedBody(JSONArray IT_INPUT) {
|
private static JSONObject unlockedBody(JSONArray IT_INPUT) {
|
||||||
|
|
@ -77,11 +89,11 @@ public class SapUtils {
|
||||||
String dates = date.format(formatter);
|
String dates = date.format(formatter);
|
||||||
//组装请求体
|
//组装请求体
|
||||||
JSONObject pendingsBody = new JSONObject();
|
JSONObject pendingsBody = new JSONObject();
|
||||||
pendingsBody.put("rootContextID",""+System.currentTimeMillis());//唯一事务ID,采用UUID或其他强唯一性ID,会校验不存在,是否在上游储存
|
pendingsBody.put("rootContextID", "" + System.currentTimeMillis());//唯一事务ID,采用UUID或其他强唯一性ID,会校验不存在,是否在上游储存
|
||||||
pendingsBody.put("requestTime", dates);//请求时间,格式为yyyy-MM-dd HH:mm:ss.SSS
|
pendingsBody.put("requestTime", dates);//请求时间,格式为yyyy-MM-dd HH:mm:ss.SSS
|
||||||
|
|
||||||
JSONObject data = new JSONObject();
|
JSONObject data = new JSONObject();
|
||||||
data.put("IT_LIST",IT_INPUT);
|
data.put("IT_LIST", IT_INPUT);
|
||||||
pendingsBody.put("data", data);
|
pendingsBody.put("data", data);
|
||||||
return pendingsBody;
|
return pendingsBody;
|
||||||
}
|
}
|
||||||
|
|
@ -130,12 +142,12 @@ public class SapUtils {
|
||||||
/**
|
/**
|
||||||
* SAP应付凭证清单接口
|
* SAP应付凭证清单接口
|
||||||
*/
|
*/
|
||||||
public static JSONObject vouchers_payable(JSONArray IT_LIST,String billno){
|
public static JSONObject vouchers_payable(JSONArray IT_LIST, String billno) {
|
||||||
Map<String, Object> thirdPartyMap = new HashMap<>();
|
Map<String, Object> thirdPartyMap = new HashMap<>();
|
||||||
thirdPartyMap.put("interfaceID",interfaceID2);
|
thirdPartyMap.put("interfaceID", interfaceID2);
|
||||||
thirdPartyMap.put("receiverID",receiverID1);
|
thirdPartyMap.put("receiverID", receiverID1);
|
||||||
thirdPartyMap.put("URL",vouchersUrl);
|
thirdPartyMap.put("URL", vouchersUrl);
|
||||||
thirdPartyMap.put("billno",billno);
|
thirdPartyMap.put("billno", billno);
|
||||||
// 组装请求体
|
// 组装请求体
|
||||||
JSONObject payableBody = payableBody(IT_LIST);
|
JSONObject payableBody = payableBody(IT_LIST);
|
||||||
// 发送请求并处理响应
|
// 发送请求并处理响应
|
||||||
|
|
@ -144,6 +156,7 @@ public class SapUtils {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SAP应付凭证清单接口组装请求体:
|
* SAP应付凭证清单接口组装请求体:
|
||||||
|
*
|
||||||
* @return 请求体的 JSON 对象
|
* @return 请求体的 JSON 对象
|
||||||
*/
|
*/
|
||||||
private static JSONObject payableBody(JSONArray IT_LIST) {
|
private static JSONObject payableBody(JSONArray IT_LIST) {
|
||||||
|
|
@ -155,11 +168,11 @@ public class SapUtils {
|
||||||
String dates = date.format(formatter);
|
String dates = date.format(formatter);
|
||||||
//组装请求体
|
//组装请求体
|
||||||
JSONObject pendingsBody = new JSONObject();
|
JSONObject pendingsBody = new JSONObject();
|
||||||
pendingsBody.put("rootContextID",""+System.currentTimeMillis());//唯一事务ID,采用UUID或其他强唯一性ID
|
pendingsBody.put("rootContextID", "" + System.currentTimeMillis());//唯一事务ID,采用UUID或其他强唯一性ID
|
||||||
pendingsBody.put("requestTime",dates);//请求时间,格式为yyyy-MM-dd HH:mm:ss.SSS
|
pendingsBody.put("requestTime", dates);//请求时间,格式为yyyy-MM-dd HH:mm:ss.SSS
|
||||||
|
|
||||||
JSONObject data = new JSONObject();
|
JSONObject data = new JSONObject();
|
||||||
data.put("IT_INPUT",IT_LIST);
|
data.put("IT_INPUT", IT_LIST);
|
||||||
pendingsBody.put("data", data);
|
pendingsBody.put("data", data);
|
||||||
return pendingsBody;
|
return pendingsBody;
|
||||||
}
|
}
|
||||||
|
|
@ -167,12 +180,12 @@ public class SapUtils {
|
||||||
/**
|
/**
|
||||||
* 生成代扣款记账单接口
|
* 生成代扣款记账单接口
|
||||||
*/
|
*/
|
||||||
public static JSONObject withholding_billing(JSONObject data,String billno){
|
public static JSONObject withholding_billing(JSONObject data, String billno) {
|
||||||
Map<String, Object> thirdPartyMap = new HashMap<>();
|
Map<String, Object> thirdPartyMap = new HashMap<>();
|
||||||
thirdPartyMap.put("interfaceID",interfaceID3);
|
thirdPartyMap.put("interfaceID", interfaceID3);
|
||||||
thirdPartyMap.put("receiverID",receiverID2);
|
thirdPartyMap.put("receiverID", receiverID2);
|
||||||
thirdPartyMap.put("URL",withholdingUrl);
|
thirdPartyMap.put("URL", withholdingUrl);
|
||||||
thirdPartyMap.put("billno",billno);
|
thirdPartyMap.put("billno", billno);
|
||||||
|
|
||||||
// 获取当前日期和时间
|
// 获取当前日期和时间
|
||||||
LocalDateTime date = LocalDateTime.now();
|
LocalDateTime date = LocalDateTime.now();
|
||||||
|
|
@ -180,7 +193,7 @@ public class SapUtils {
|
||||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSS");
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSS");
|
||||||
// 格式化当前日期和时间
|
// 格式化当前日期和时间
|
||||||
String dates = date.format(formatter);
|
String dates = date.format(formatter);
|
||||||
thirdPartyMap.put("createdatetime",dates);
|
thirdPartyMap.put("createdatetime", dates);
|
||||||
// 组装请求体
|
// 组装请求体
|
||||||
JSONObject withholdingBody = withholdingBody(data);
|
JSONObject withholdingBody = withholdingBody(data);
|
||||||
// 发送请求并处理响应
|
// 发送请求并处理响应
|
||||||
|
|
@ -189,6 +202,7 @@ public class SapUtils {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 生成代扣款记账单接口组装请求体:
|
* 生成代扣款记账单接口组装请求体:
|
||||||
|
*
|
||||||
* @return 请求体的 JSON 对象
|
* @return 请求体的 JSON 对象
|
||||||
*/
|
*/
|
||||||
private static JSONObject withholdingBody(JSONObject data) {
|
private static JSONObject withholdingBody(JSONObject data) {
|
||||||
|
|
@ -200,7 +214,7 @@ public class SapUtils {
|
||||||
String dates = date.format(formatter);
|
String dates = date.format(formatter);
|
||||||
//组装请求体
|
//组装请求体
|
||||||
JSONObject pendingsBody = new JSONObject();
|
JSONObject pendingsBody = new JSONObject();
|
||||||
pendingsBody.put("rootContextID",""+System.currentTimeMillis());//todo:唯一事务ID,采用UUID或其他强唯一性ID
|
pendingsBody.put("rootContextID", "" + System.currentTimeMillis());//todo:唯一事务ID,采用UUID或其他强唯一性ID
|
||||||
pendingsBody.put("requestTime", dates);//请求时间,格式为yyyy-MM-dd HH:mm:ss.SSS
|
pendingsBody.put("requestTime", dates);//请求时间,格式为yyyy-MM-dd HH:mm:ss.SSS
|
||||||
pendingsBody.put("data", data);
|
pendingsBody.put("data", data);
|
||||||
return pendingsBody;
|
return pendingsBody;
|
||||||
|
|
@ -209,11 +223,11 @@ public class SapUtils {
|
||||||
/**
|
/**
|
||||||
* 发送请求并处理响应
|
* 发送请求并处理响应
|
||||||
*
|
*
|
||||||
* @param pendingsBody 请求体
|
* @param pendingsBody 请求体
|
||||||
* @param thirdPartyMap 第三方数据映射
|
* @param thirdPartyMap 第三方数据映射
|
||||||
* @param apiName 接口名称
|
* @param apiName 接口名称
|
||||||
*/
|
*/
|
||||||
private static JSONObject processRequest(JSONObject pendingsBody, Map<String, Object> thirdPartyMap, String apiName){
|
private static JSONObject processRequest(JSONObject pendingsBody, Map<String, Object> thirdPartyMap, String apiName) {
|
||||||
|
|
||||||
// 配置超时时间
|
// 配置超时时间
|
||||||
RequestConfig requestConfig = RequestConfig.custom()
|
RequestConfig requestConfig = RequestConfig.custom()
|
||||||
|
|
@ -251,31 +265,32 @@ public class SapUtils {
|
||||||
if (responseEntity != null) {
|
if (responseEntity != null) {
|
||||||
String responseString = EntityUtils.toString(responseEntity, "UTF-8");
|
String responseString = EntityUtils.toString(responseEntity, "UTF-8");
|
||||||
jsonObject = JSONObject.parseObject(responseString);
|
jsonObject = JSONObject.parseObject(responseString);
|
||||||
String code = (String)jsonObject.get("code");
|
String code = (String) jsonObject.get("code");
|
||||||
if (!"0".equals(code)) {
|
if (!"0".equals(code)) {
|
||||||
logger.info(apiName +"失败!");
|
logger.info(apiName + "失败!");
|
||||||
saveLog( (thirdPartyMap.get("billno").toString()), pendingsBody, jsonObject, false,apiName);
|
saveLog((thirdPartyMap.get("billno").toString()), pendingsBody, jsonObject, false, apiName);
|
||||||
return jsonObject;
|
return jsonObject;
|
||||||
}
|
}
|
||||||
handleResponse(jsonObject, pendingsBody, thirdPartyMap,apiName);
|
handleResponse(jsonObject, pendingsBody, thirdPartyMap, apiName);
|
||||||
return com.alibaba.fastjson.JSONObject.parseObject(responseString);
|
return com.alibaba.fastjson.JSONObject.parseObject(responseString);
|
||||||
}else {
|
} else {
|
||||||
logger.info(apiName +"失败!");
|
logger.info(apiName + "失败!");
|
||||||
saveLog( (thirdPartyMap.get("billno").toString()), pendingsBody, null, false,apiName);
|
saveLog((thirdPartyMap.get("billno").toString()), pendingsBody, null, false, apiName);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
handleException(e, pendingsBody, thirdPartyMap, jsonObject,apiName);
|
handleException(e, pendingsBody, thirdPartyMap, jsonObject, apiName);
|
||||||
}
|
}
|
||||||
return jsonObject;
|
return jsonObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 解析响应 JSON 字符串
|
* 解析响应 JSON 字符串
|
||||||
|
*
|
||||||
* @param response 响应的 JSON 字符串
|
* @param response 响应的 JSON 字符串
|
||||||
* @param apiName 接口名称
|
* @param apiName 接口名称
|
||||||
* @return 解析后的 JSON 对象
|
* @return 解析后的 JSON 对象
|
||||||
*/
|
*/
|
||||||
private static JSONObject parseResponse(String response,String apiName) {
|
private static JSONObject parseResponse(String response, String apiName) {
|
||||||
try {
|
try {
|
||||||
return JSONObject.parseObject(response);
|
return JSONObject.parseObject(response);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
@ -286,40 +301,42 @@ public class SapUtils {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 处理响应结果
|
* 处理响应结果
|
||||||
* @param jsonObject 响应的 JSON 对象
|
*
|
||||||
* @param pendingsBody 请求体
|
* @param jsonObject 响应的 JSON 对象
|
||||||
* @param thirdPartyMap 第三方数据映射
|
* @param pendingsBody 请求体
|
||||||
* @param apiName 接口名称
|
* @param thirdPartyMap 第三方数据映射
|
||||||
|
* @param apiName 接口名称
|
||||||
*/
|
*/
|
||||||
private static void handleResponse(JSONObject jsonObject, JSONObject pendingsBody, Map<String, Object> thirdPartyMap,String apiName) {
|
private static void handleResponse(JSONObject jsonObject, JSONObject pendingsBody, Map<String, Object> thirdPartyMap, String apiName) {
|
||||||
String operResult = jsonObject.getString("code");
|
String operResult = jsonObject.getString("code");
|
||||||
JSONObject jsonobject = jsonObject.getJSONObject("data");
|
JSONObject jsonobject = jsonObject.getJSONObject("data");
|
||||||
if (jsonobject == null && !"0".equals(operResult)) {
|
if (jsonobject == null && !"0".equals(operResult)) {
|
||||||
logger.info(apiName + "失败!");
|
logger.info(apiName + "失败!");
|
||||||
saveLog((thirdPartyMap.get("billno").toString()), pendingsBody, jsonObject, false,apiName);
|
saveLog((thirdPartyMap.get("billno").toString()), pendingsBody, jsonObject, false, apiName);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
String logMessage = Objects.equals(operResult, "0") ? apiName +"成功!" : apiName +"失败!";
|
String logMessage = Objects.equals(operResult, "0") ? apiName + "成功!" : apiName + "失败!";
|
||||||
|
|
||||||
// 记录日志
|
// 记录日志
|
||||||
logger.info(logMessage);
|
logger.info(logMessage);
|
||||||
saveLog((thirdPartyMap.get("billno").toString()), pendingsBody, jsonObject, true,apiName);
|
saveLog((thirdPartyMap.get("billno").toString()), pendingsBody, jsonObject, true, apiName);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 处理异常情况
|
* 处理异常情况
|
||||||
* @param e 捕获的异常
|
*
|
||||||
* @param pendingsBody 请求体
|
* @param e 捕获的异常
|
||||||
* @param thirdPartyMap 第三方数据映射
|
* @param pendingsBody 请求体
|
||||||
* @param jsonObject 响应的 JSON 对象
|
* @param thirdPartyMap 第三方数据映射
|
||||||
* @param apiName 接口名称
|
* @param jsonObject 响应的 JSON 对象
|
||||||
|
* @param apiName 接口名称
|
||||||
*/
|
*/
|
||||||
private static void handleException(Exception e, JSONObject pendingsBody, Map<String, Object> thirdPartyMap, JSONObject jsonObject,String apiName) {
|
private static void handleException(Exception e, JSONObject pendingsBody, Map<String, Object> thirdPartyMap, JSONObject jsonObject, String apiName) {
|
||||||
// 记录异常信息
|
// 记录异常信息
|
||||||
String errorMessage = String.format(apiName +"状态回写接口异常:%s", e.getMessage());
|
String errorMessage = String.format(apiName + "状态回写接口异常:%s", e.getMessage());
|
||||||
logger.error(errorMessage);
|
logger.error(errorMessage);
|
||||||
saveLog(thirdPartyMap.get("billno").toString(), pendingsBody, jsonObject, false,apiName);
|
saveLog(thirdPartyMap.get("billno").toString(), pendingsBody, jsonObject, false, apiName);
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -332,8 +349,50 @@ public class SapUtils {
|
||||||
* @param isSuccess 是否成功
|
* @param isSuccess 是否成功
|
||||||
* @param apiName 接口名称
|
* @param apiName 接口名称
|
||||||
*/
|
*/
|
||||||
private static void saveLog(String billNo, JSONObject pendingsBody, JSONObject jsonObject, boolean isSuccess,String apiName) {
|
private static void saveLog(String billNo, JSONObject pendingsBody, JSONObject jsonObject, boolean isSuccess, String apiName) {
|
||||||
JhzjUtils.saveLog(billNo, apiName, pendingsBody.toJSONString(),
|
JhzjUtils.saveLog(billNo, apiName, pendingsBody.toJSONString(),
|
||||||
jsonObject != null ? jsonObject.toJSONString() : "{}", isSuccess, "API");
|
jsonObject != null ? jsonObject.toJSONString() : "{}", isSuccess, "API");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 调用SAP收款凭证清账状态查询接口
|
||||||
|
*
|
||||||
|
* @param billNumber 单据编号
|
||||||
|
* @param companyCode 公司编码
|
||||||
|
* @param sapVoucherNumber SAP凭证号
|
||||||
|
* @param sapFiscalYear 会计年度
|
||||||
|
* @param sapLineNumber 会计凭证中的行项目数
|
||||||
|
* @return 响应参数
|
||||||
|
*/
|
||||||
|
public static String querySapClearAccountsState(String billNumber, String companyCode, String sapVoucherNumber, String sapFiscalYear, String sapLineNumber) {
|
||||||
|
try {
|
||||||
|
StringBuilder message = new StringBuilder();
|
||||||
|
HashMap<String, String> head = ApiUtils.buildHead(INTERFACE_ID4, RECEIVER_ID4);
|
||||||
|
// 构建请求体
|
||||||
|
HashMap<String, Object> body = new HashMap<>();
|
||||||
|
Map<String, Object> item = new HashMap<>();
|
||||||
|
item.put("BUKRS", companyCode); // 公司编码
|
||||||
|
item.put("BELNR", sapVoucherNumber); // SAP凭证号
|
||||||
|
item.put("GJAHR", sapFiscalYear); // 会计年度
|
||||||
|
item.put("BUZEI", sapLineNumber); // 行项目号
|
||||||
|
|
||||||
|
List<Map<String, Object>> items = new ArrayList<>();
|
||||||
|
items.add(item);
|
||||||
|
|
||||||
|
Map<String, Object> data = new HashMap<>();
|
||||||
|
data.put("IT_ITEMS", items);
|
||||||
|
|
||||||
|
body.put("data", data);
|
||||||
|
String response = ApiUtils.sendPost(head, body, QUERY_STATE_URL);
|
||||||
|
if (null != response) {
|
||||||
|
boolean isSuccess = ApiUtils.parseResponse(response, billNumber, body, API_METHOD4, message);
|
||||||
|
if (isSuccess) {
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
logger.error(e.getMessage());
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue