sap推送接口修改

This commit is contained in:
李贵强 2025-09-03 12:14:34 +08:00
parent 7c15c2ff1b
commit aa2f977bf6
4 changed files with 97 additions and 20 deletions

View File

@ -36,7 +36,7 @@ public class CimIntBillBatchFormPlugin extends AbstractFormPlugin implements Plu
if (finsubscribe != null) { if (finsubscribe != null) {
String cashManagementProducts = finsubscribe.getString("shjh_xjglcp"); String cashManagementProducts = finsubscribe.getString("shjh_xjglcp");
this.getModel().setValue("shjh_amountcontrl", cashManagementProducts, i); this.getModel().setValue("shjh_amountcontrl", cashManagementProducts, i);
if ("1".equals(cashManagementProducts)) { //if ("1".equals(cashManagementProducts)) {
// 预提日期 // 预提日期
Date preintdate = (Date) this.getModel().getValue("preintdate"); Date preintdate = (Date) this.getModel().getValue("preintdate");
if (preintdate != null) { if (preintdate != null) {
@ -136,7 +136,7 @@ public class CimIntBillBatchFormPlugin extends AbstractFormPlugin implements Plu
} }
} }
} }
} //}
} }
} }
this.getView().invokeOperation("save"); this.getView().invokeOperation("save");

View File

@ -27,6 +27,7 @@ import shjh.jhzj7.fi.fi.utils.domin.ResponseData;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date; import java.util.Date;
import java.util.Map; import java.util.Map;
@ -149,9 +150,9 @@ public class DepositpreintSapOperation extends AbstractOperationServicePlugIn im
String shjh_pzh = prinfo.getString("shjh_sappzh"); String shjh_pzh = prinfo.getString("shjh_sappzh");
//添加会计凭证编号 //添加会计凭证编号
iteminfo.put("BELNR", shjh_pzh); iteminfo.put("BELNR", shjh_pzh);
String shjh_year = prinfo.getString("shjh_sapyear"); // String shjh_year = prinfo.getString("shjh_sapyear");
//添加会计年度 // //添加会计年度
iteminfo.put("GJAHR", shjh_year); // iteminfo.put("GJAHR", shjh_year);
//添加冲销原因-04-跨期冲销默认04冲销日期必传 //添加冲销原因-04-跨期冲销默认04冲销日期必传
iteminfo.put("STGRD", "04"); iteminfo.put("STGRD", "04");
//添加用户名-操作反清账按钮的用户OA用户名 //添加用户名-操作反清账按钮的用户OA用户名
@ -163,15 +164,43 @@ public class DepositpreintSapOperation extends AbstractOperationServicePlugIn im
iteminfo.put("UNAME",oauser);//用户名 iteminfo.put("UNAME",oauser);//用户名
} }
//添加反清账日期 //添加反清账日期
long batchnoid = prinfo.getLong("batchnoid");
if (batchnoid!=0L){
Date date = this.getSourceDate(batchnoid);
if (date!=null){
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String datestr = sdf.format(new Date()); String datestr = sdf.format(date);
iteminfo.put("BUDAT", datestr); iteminfo.put("BUDAT", datestr);
SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy");
String datestr2 = sdf2.format(date);
iteminfo.put("GJAHR", datestr2);
}
}
IT_LIST.add(iteminfo); IT_LIST.add(iteminfo);
JSONObject sapReturnData = SapUtils.sapReversalAPI(IT_LIST,prinfo.getString("billno")); JSONObject sapReturnData = SapUtils.sapReversalAPI(IT_LIST,prinfo.getString("billno"));
return sapReturnData; return sapReturnData;
} }
private Date getSourceDate(long batchnoid) {
//联查蓝单
QFilter qFilter = new QFilter("batchnoid", QCP.equals, batchnoid);//批次id
qFilter.and("operatetype",QCP.equals,"preint");//操作类别
DynamicObject depositprein = BusinessDataServiceHelper.loadSingle("cim_depositpreint", qFilter.toArray());
if (depositprein!=null){
Date bizDate=depositprein.getDate("businessdate");
if (bizDate != null) {
// 使用Calendar增加一个月
Calendar calendar = Calendar.getInstance();
calendar.setTime(bizDate);
calendar.add(Calendar.MONTH, 1); // 增加一个月
return calendar.getTime();
}
}
return null; // 任意环节为空时返回null
}
private JSONObject sendBlueVoucher(DynamicObject prinfo, Map<String, String> sapMap){ private JSONObject sendBlueVoucher(DynamicObject prinfo, Map<String, String> sapMap){
//SAP定期预提收益凭证接口入参组装和调用 //SAP定期预提收益凭证接口入参组装和调用
JSONObject IS_HEADER = new JSONObject();//抬头 JSONObject IS_HEADER = new JSONObject();//抬头
@ -179,8 +208,14 @@ public class DepositpreintSapOperation extends AbstractOperationServicePlugIn im
String companyCode = prinfo.getDynamicObject("org").getString("number"); String companyCode = prinfo.getDynamicObject("org").getString("number");
IS_HEADER.put("BUKRS",companyCode);//公司代码 IS_HEADER.put("BUKRS",companyCode);//公司代码
IS_HEADER.put("BLART","SA");//凭证类型-总账类凭证 IS_HEADER.put("BLART","SA");//凭证类型-总账类凭证
IS_HEADER.put("BLDAT",sdf.format(prinfo.getDate("bizdate")));//凭证日期-业务日期
IS_HEADER.put("BUDAT",sdf.format(prinfo.getDate("bizdate")));//过账日期-业务日期 QFilter qFilter = new QFilter("sourcebill", QCP.equals, prinfo.getPkValue());
DynamicObject voucher = BusinessDataServiceHelper.loadSingle("gl_voucher", qFilter.toArray());
if (voucher != null) {
IS_HEADER.put("BLDAT",sdf.format(voucher.getDate("bizdate")));//凭证日期-业务日期
IS_HEADER.put("BUDAT",sdf.format(voucher.getDate("bookeddate")));//过账日期-业务日期
}
String isoCode = prinfo.getDynamicObject("currency").getString("number"); String isoCode = prinfo.getDynamicObject("currency").getString("number");
IS_HEADER.put("WAERS", JhzjUtils.getCurrencyCode(isoCode));//币种 IS_HEADER.put("WAERS", JhzjUtils.getCurrencyCode(isoCode));//币种
IS_HEADER.put("XBLNR",prinfo.getString("billno"));//参考凭证号-单据编号 固定长度16位 IS_HEADER.put("XBLNR",prinfo.getString("billno"));//参考凭证号-单据编号 固定长度16位

View File

@ -308,9 +308,17 @@ public class RecPushVoucherOperation extends AbstractOperationServicePlugIn impl
IS_HEADER.put("BLDAT", bizDate != null ? format.format(bizDate) : ""); IS_HEADER.put("BLDAT", bizDate != null ? format.format(bizDate) : "");
// 过账日期 // 过账日期
Date payeeDate = recBill.getDate("payeedate"); // Date payeeDate = recBill.getDate("payeedate");
// IS_HEADER.put("BUDAT", payeeDate != null ? format.format(payeeDate) : "");
QFilter voucherFilters = new QFilter("sourcebill", QCP.equals, recBill.getPkValue());
DynamicObject gl_voucher = BusinessDataServiceHelper.loadSingle("gl_voucher", voucherFilters.toArray());
if (gl_voucher != null) {
Date payeeDate = gl_voucher.getDate("bizdate");
IS_HEADER.put("BUDAT", payeeDate != null ? format.format(payeeDate) : ""); IS_HEADER.put("BUDAT", payeeDate != null ? format.format(payeeDate) : "");
}
// 币种 // 币种
DynamicObject currency = recBill.getDynamicObject("currency"); DynamicObject currency = recBill.getDynamicObject("currency");
String isoCode = currency != null ? currency.getString("number") : ""; String isoCode = currency != null ? currency.getString("number") : "";

View File

@ -26,6 +26,7 @@ import shjh.jhzj7.fi.fi.utils.domin.ResponseData;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date; import java.util.Date;
import java.util.Map; import java.util.Map;
@ -149,9 +150,9 @@ public class RevenueBillOperation extends AbstractOperationServicePlugIn impleme
String shjh_pzh = prinfo.getString("shjh_sappzh"); String shjh_pzh = prinfo.getString("shjh_sappzh");
//添加会计凭证编号 //添加会计凭证编号
iteminfo.put("BELNR", shjh_pzh); iteminfo.put("BELNR", shjh_pzh);
String shjh_year = prinfo.getString("shjh_sapyear"); // String shjh_year = prinfo.getString("shjh_sapyear");
//添加会计年度 // //添加会计年度
iteminfo.put("GJAHR", shjh_year); // iteminfo.put("GJAHR", shjh_year);
//添加冲销原因-04-跨期冲销默认04冲销日期必传 //添加冲销原因-04-跨期冲销默认04冲销日期必传
iteminfo.put("STGRD", "04"); iteminfo.put("STGRD", "04");
//添加用户名-操作反清账按钮的用户OA用户名 //添加用户名-操作反清账按钮的用户OA用户名
@ -163,9 +164,19 @@ public class RevenueBillOperation extends AbstractOperationServicePlugIn impleme
iteminfo.put("UNAME",oauser);//用户名 iteminfo.put("UNAME",oauser);//用户名
} }
//添加反清账日期 //添加反清账日期
String writeoffbillno = prinfo.getString("billno");//单据号
if (writeoffbillno!=null){
Date date = this.getSourceDate(writeoffbillno);
if (date!=null){
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String datestr = sdf.format(new Date()); String datestr = sdf.format(date);
iteminfo.put("BUDAT", datestr); iteminfo.put("BUDAT", datestr);
SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy");
String datestr2 = sdf2.format(date);
iteminfo.put("BELNR", datestr2);
}
}
IT_LIST.add(iteminfo); IT_LIST.add(iteminfo);
JSONObject sapReturnData = SapUtils.sapReversalAPI(IT_LIST,prinfo.getString("billno")); JSONObject sapReturnData = SapUtils.sapReversalAPI(IT_LIST,prinfo.getString("billno"));
@ -179,6 +190,23 @@ public class RevenueBillOperation extends AbstractOperationServicePlugIn impleme
return sapReturnData; return sapReturnData;
} }
private Date getSourceDate(String writeoffbillno) {
//联查蓝单
QFilter qFilter = new QFilter("writeoffbillno", QCP.equals, writeoffbillno);
DynamicObject intBillRevenue = BusinessDataServiceHelper.loadSingle("cim_intbill_revenue", qFilter.toArray());
if (intBillRevenue!=null){
Date bizDate=intBillRevenue.getDate("bizdate");
if (bizDate != null) {
// 使用Calendar增加一个月
Calendar calendar = Calendar.getInstance();
calendar.setTime(bizDate);
calendar.add(Calendar.MONTH, 1); // 增加一个月
return calendar.getTime();
}
}
return null; // 任意环节为空时返回null
}
private JSONObject sendBlueVoucher(DynamicObject prinfo, Map<String, String> sapMap){ private JSONObject sendBlueVoucher(DynamicObject prinfo, Map<String, String> sapMap){
//SAP预提收益凭证接口入参组装和调用 //SAP预提收益凭证接口入参组装和调用
JSONObject IS_HEADER = new JSONObject();//抬头 JSONObject IS_HEADER = new JSONObject();//抬头
@ -186,8 +214,14 @@ public class RevenueBillOperation extends AbstractOperationServicePlugIn impleme
String companyCode = prinfo.getDynamicObject("org").getString("number"); String companyCode = prinfo.getDynamicObject("org").getString("number");
IS_HEADER.put("BUKRS",companyCode);//公司代码 IS_HEADER.put("BUKRS",companyCode);//公司代码
IS_HEADER.put("BLART","SA");//凭证类型-总账类凭证 IS_HEADER.put("BLART","SA");//凭证类型-总账类凭证
IS_HEADER.put("BLDAT",sdf.format(prinfo.getDate("bizdate")));//凭证日期-业务日期
IS_HEADER.put("BUDAT",sdf.format(prinfo.getDate("bizdate")));//过账日期-业务日期 QFilter qFilter = new QFilter("sourcebill", QCP.equals, prinfo.getPkValue());
DynamicObject voucher = BusinessDataServiceHelper.loadSingle("gl_voucher", qFilter.toArray());
if (voucher != null) {
IS_HEADER.put("BLDAT",sdf.format(voucher.getDate("bizdate")));//凭证日期-业务日期
IS_HEADER.put("BUDAT",sdf.format(voucher.getDate("bookeddate")));//过账日期-业务日期
}
String isoCode = prinfo.getDynamicObject("currency").getString("number"); String isoCode = prinfo.getDynamicObject("currency").getString("number");
IS_HEADER.put("WAERS", JhzjUtils.getCurrencyCode(isoCode));//币种 IS_HEADER.put("WAERS", JhzjUtils.getCurrencyCode(isoCode));//币种
IS_HEADER.put("XBLNR",prinfo.getString("billno"));//参考凭证号-单据编号 固定长度16位 IS_HEADER.put("XBLNR",prinfo.getString("billno"));//参考凭证号-单据编号 固定长度16位