推送凭证(付款)__核算维度可配置优化_工具类

--s
This commit is contained in:
weiyunlong 2025-06-26 17:26:40 +08:00
parent 4718f5f05e
commit 67e5129e58
2 changed files with 21 additions and 7 deletions

View File

@ -30,6 +30,7 @@ import java.util.*;
import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Collectors;
import static shjh.jhzj7.fi.fi.utils.SapUtils.getAsstacttypeMap;
import static shjh.jhzj7.fi.fi.utils.SapUtils.sap_accounVoucher;
/**
@ -94,13 +95,7 @@ public class PaybillPushSapOperation extends AbstractOperationServicePlugIn impl
//抬头
JSONObject isHeader = getIS_HEADER(bill);
//组装核算维度map
Map<String, String> sapMap = new HashMap<>();
QFilter filter1 = new QFilter("enable", QCP.equals, "1");
QFilter filter2 = new QFilter("shjh_sap", QCP.not_equals, "");
DynamicObject[] bdAsstacttypes = BusinessDataServiceHelper.load("bd_asstacttype", "id,shjh_sap,enable,flexfield", new QFilter[]{filter1, filter2});
for (DynamicObject bdAsstacttype : bdAsstacttypes) {
sapMap.put(bdAsstacttype.getString("flexfield"), bdAsstacttype.getString("shjh_sap"));
}
Map<String, String> sapMap = getAsstacttypeMap();
// 时间问题代码未优化提取公共方法
// 前提:若无凭证,校验
// :

View File

@ -2,8 +2,12 @@ package shjh.jhzj7.fi.fi.utils;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import kd.bos.dataentity.entity.DynamicObject;
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 org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
@ -666,4 +670,19 @@ public class SapUtils {
}
return null;
}
/**
* 获取核算维度map(SAP)
*/
public static Map<String,String> getAsstacttypeMap(){
//组装核算维度map
Map<String, String> sapMap = new HashMap<>();
QFilter filter1 = new QFilter("enable", QCP.equals, "1");
QFilter filter2 = new QFilter("shjh_sap", QCP.not_equals, "");
DynamicObject[] bdAsstacttypes = BusinessDataServiceHelper.load("bd_asstacttype", "id,shjh_sap,enable,flexfield", new QFilter[]{filter1, filter2});
for (DynamicObject bdAsstacttype : bdAsstacttypes) {
sapMap.put(bdAsstacttype.getString("flexfield"), bdAsstacttype.getString("shjh_sap"));
}
return sapMap;
}
}