收款推送sap优化

This commit is contained in:
yuxueliang0813 2025-04-27 18:15:57 +08:00
parent 574336b0f8
commit 56988ec26c
5 changed files with 36 additions and 15 deletions

View File

@ -393,7 +393,6 @@ public class FeeControlApiPlugin extends AbstractFormPlugin implements Plugin {
/** /**
* 获取当前操作用户工号 * 获取当前操作用户工号
*
* @return * @return
*/ */
public String getUserCode() { public String getUserCode() {
@ -430,12 +429,12 @@ public class FeeControlApiPlugin extends AbstractFormPlugin implements Plugin {
private HashMap<String,Object> getData(String companyCode, Date startDate, Date endDate){ private HashMap<String,Object> getData(String companyCode, Date startDate, Date endDate){
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
HashMap<String,Object> data = new HashMap<>(10); HashMap<String,Object> data = new HashMap<>(10);
data.put("UserCode","GH017994"); // data.put("UserCode","GH017994");//测试用默认余老师账号
//data.put("UserCode",this.getUserCode()); data.put("UserCode",this.getUserCode());
data.put("QueryBeginDate",sdf.format(startDate)); data.put("QueryBeginDate",sdf.format(startDate));
data.put("QueryEndDate",sdf.format(endDate)); data.put("QueryEndDate",sdf.format(endDate));
data.put("page","1"); data.put("page","1");
data.put("rows","10"); data.put("rows","5000");
data.put("CompanyCode",companyCode); data.put("CompanyCode",companyCode);
return data; return data;

View File

@ -441,7 +441,6 @@ public class ClearAccountBillOperation extends AbstractOperationServicePlugIn im
}else{ }else{
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String datestr = sdf.format(new Date()); String datestr = sdf.format(new Date());
// addFilterCondition(IT_LIST, "BUDAT", datestr, datestr);
iteminfo.put("BUDAT", datestr); iteminfo.put("BUDAT", datestr);
} }
IT_LIST.add(iteminfo); IT_LIST.add(iteminfo);
@ -543,15 +542,15 @@ public class ClearAccountBillOperation extends AbstractOperationServicePlugIn im
String isoCode = prinfo.getDynamicObject("shjh_currency").getString("number"); String isoCode = prinfo.getDynamicObject("shjh_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位
// IS_HEADER.put("BKTXT",customerinfo.getString("name"));//凭证抬头文本 习惯传 供应商||客户名称 IS_HEADER.put("BKTXT",customerinfo.getString("name"));//凭证抬头文本 习惯传 供应商||客户名称
IS_HEADER.put("BKTXT","上海禾诗家化妆品有限公司");// -- 仅测试 // IS_HEADER.put("BKTXT","上海禾诗家化妆品有限公司");// -- 仅测试
//添加用户名过滤条件-操作审核按钮的用户OA用户名 //添加用户名过滤条件-操作审核按钮的用户OA用户名
DynamicObject userinfo = BusinessDataServiceHelper.loadSingleFromCache(RequestContext.get().getCurrUserId(), userName); DynamicObject userinfo = BusinessDataServiceHelper.loadSingleFromCache(RequestContext.get().getCurrUserId(), userName);
String oauser = userinfo.getString("shjh_oauser"); String oauser = userinfo.getString("shjh_oauser");
IS_HEADER.put("USNAM",oauser);//用户名 IS_HEADER.put("USNAM",oauser);//用户名
//----------------处理详细入参清账不需要items参数---------------------- //----------------处理详细入参清账不需要items参数----------------------
String customerCode = customerinfo.getString("number"); String customerCode = customerinfo.getString("number");
customerCode = "1005004";//上海禾诗家化妆品有限公司 -- 仅测试 // customerCode = "1005004";//上海禾诗家化妆品有限公司 -- 仅测试
//----------------处理清账数据入参---------------------- //----------------处理清账数据入参----------------------
DynamicObjectCollection docolls = prinfo.getDynamicObjectCollection("shjh_details"); DynamicObjectCollection docolls = prinfo.getDynamicObjectCollection("shjh_details");
DynamicObject entryinfo; DynamicObject entryinfo;

View File

@ -79,13 +79,14 @@ public class PayBillSubmitOperation extends AbstractOperationServicePlugIn imple
BigDecimal applyAmountBigDecimal = new BigDecimal(applyamount); BigDecimal applyAmountBigDecimal = new BigDecimal(applyamount);
int comparisonResult = applyAmountBigDecimal.compareTo(actpayamt); int comparisonResult = applyAmountBigDecimal.compareTo(actpayamt);
if (comparisonResult != 0) { if (comparisonResult != 0) {
this.addErrorMessage(entity,"费控校验未通过不能提交:付款金额不一致"); this.addErrorMessage(entity,"费控校验未通过不能提交:付款金额不一致 费控:"+applyamount+" 金蝶:"+actpayamt);
return; return;
} }
String assacct = tempData.getString("assacct");//费控-收款银行账号_payeebanknum String assacct = tempData.getString("assacct");//费控-收款银行账号_payeebanknum
String payeebanknum = bill.getString("payeebanknum");//金蝶-收款银行账号 String payeebanknum = bill.getString("payeebanknum");//金蝶-收款银行账号
if (!assacct.equals(payeebanknum)) { if (!assacct.equals(payeebanknum)) {
this.addErrorMessage(entity,"费控校验未通过不能提交:收款账号不一致"); this.addErrorMessage(entity,"费控校验未通过不能提交:收款账号不一致 费控:"+assacct+" 金蝶:"+payeebanknum);
return; return;
} }
// String bebank = tempData.getString("bebank");//收款银行名称-费控是银行简称先不校验 // String bebank = tempData.getString("bebank");//收款银行名称-费控是银行简称先不校验
@ -96,9 +97,8 @@ public class PayBillSubmitOperation extends AbstractOperationServicePlugIn imple
// } // }
String bebankNum = tempData.getString("bebankNum");//费控-收款银行联行号_recbanknumber String bebankNum = tempData.getString("bebankNum");//费控-收款银行联行号_recbanknumber
String recbanknumber = bill.getString("payeebank.number");//金蝶-收款银行联行号 String recbanknumber = bill.getString("payeebank.number");//金蝶-收款银行联行号
if (!bebankNum.equals(recbanknumber)) { if (!bebankNum.equals(recbanknumber)) {
this.addErrorMessage(entity,"费控校验未通过不能提交:收款银行联行号不一致"); this.addErrorMessage(entity,"费控校验未通过不能提交:收款银行联行号不一致 费控:"+bebankNum+" 金蝶:"+recbanknumber);
return; return;
} }
} }

View File

@ -186,6 +186,12 @@ public class RecPushVoucherOperation extends AbstractOperationServicePlugIn impl
operateErrorInfo.setPkValue(dataEntity.getPkValue()); operateErrorInfo.setPkValue(dataEntity.getPkValue());
this.operationResult.addErrorInfo(operateErrorInfo); this.operationResult.addErrorInfo(operateErrorInfo);
} }
}else{
OperateErrorInfo operateErrorInfo = new OperateErrorInfo();
operateErrorInfo.setMessage("SAP返回值为空");
operateErrorInfo.setErrorLevel(ErrorLevel.Error.name());
operateErrorInfo.setPkValue(dataEntity.getPkValue());
this.operationResult.addErrorInfo(operateErrorInfo);
} }
} }
} }

View File

@ -1,5 +1,7 @@
package shjh.jhzj7.fi.fi.plugin.operate; package shjh.jhzj7.fi.fi.plugin.operate;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import kd.bos.context.RequestContext; import kd.bos.context.RequestContext;
import kd.bos.dataentity.entity.DynamicObject; import kd.bos.dataentity.entity.DynamicObject;
import kd.bos.dataentity.utils.StringUtils; import kd.bos.dataentity.utils.StringUtils;
@ -119,10 +121,25 @@ public class RecRedPushOperation extends AbstractOperationServicePlugIn implemen
if (!EsbUtils.isEmpty(response)) { if (!EsbUtils.isEmpty(response)) {
boolean success = ApiUtils.parseResponse(response, billNumber, responseBody, INTERFACE_ID, message); boolean success = ApiUtils.parseResponse(response, billNumber, responseBody, INTERFACE_ID, message);
if (success){ if (success){
//TODO sap红冲凭证成功反写sap凭证号和推送标记 //sap红冲凭证成功反写sap凭证号和推送标记
recBill.set("shjh_ispushsap",true); JSONObject sapReturnData = JSONObject.parseObject(response);
SaveServiceHelper.update(recBill); JSONObject data = sapReturnData.getJSONObject("data");
JSONArray rows = data.getJSONArray("IT_ITEM");
JSONObject resultData = rows.getJSONObject(0);
String key = resultData.getString("OBJ_KEY");
if(EsbUtils.isEmpty(key)){
message.append("收款处理【").append(billNumber).append("】:").append("SAP返回的OBJ_KEY为空").append("\n");
}else{
//sap凭证号
recBill.set("shjh_vouchernum",key.length() >= 10 ? key.substring(0, 10) : key);
//sap会计年度
recBill.set("shjh_sapfiscalyear",key.length() >= 4 ? key.substring(key.length() - 4) : key);
recBill.set("shjh_ispushsap",true);//sap已推送标记
SaveServiceHelper.update(recBill);
}
} }
}else{
message.append("收款处理【").append(billNumber).append("】:").append("SAP返回值为空").append("\n");
} }
} 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");