修改人:邹江涛

修改内容:API映射公共单据
修改时间:2024/12/03
This commit is contained in:
zoujiangtao 2024-12-03 18:00:49 +08:00
parent 4eabd24c49
commit d8a12ec6a7
1 changed files with 100 additions and 7 deletions

View File

@ -54,9 +54,38 @@ public class ApiMappingBillPlugin extends AbstractFormPlugin implements Plugin {
// 获取想要推送单据类型 // 获取想要推送单据类型
String billMark = dataEntity.getDynamicObject("shkd_sourcebill").getString("number"); String billMark = dataEntity.getDynamicObject("shkd_sourcebill").getString("number");
logger.info("获取推送单据类型 → billMark{}", billMark); logger.info("获取推送单据类型 → billMark{}", billMark);
// 获取推送单据对象
DynamicObject billObject = BusinessDataServiceHelper.loadSingle(billMark, new QFilter("billno", QCP.equals, billNumber).toArray());
logger.info("获取推送对象 → billObject{}", billObject); DynamicObject billObject;
switch (billMark) {
// 付款处理
case "cas_paybill":
DynamicObject[] objects1 = BusinessDataServiceHelper.load("cas_paybill",
"id,actpayamt,entry,entry.e_expenseitem,settletype,payeebanknum,payeetype,payeenumber,payeracctbank," +
"payeebank,payeebankname,paymenttype,org,bizdate"
, new QFilter("billno", QCP.equals, billNumber).toArray());
billObject = objects1[0];
logger.info("获取付款处理推送对象 → billObject{}", billObject);
break;
// 收款处理
case "cas_recbill":
DynamicObject[] objects2 = BusinessDataServiceHelper.load("cas_recbill",
""
, new QFilter("billno", QCP.equals, billNumber).toArray());
billObject = objects2[0];
logger.info("获取收款处理推送对象 → billObject{}", billObject);
break;
// 银企交易明细查询
case "aqap_bank_acnt_detail":
DynamicObject[] objects3 = BusinessDataServiceHelper.load("aqap_bank_acnt_detail",
""
, new QFilter("billno", QCP.equals, billNumber).toArray());
billObject = objects3[0];
logger.info("获取银企交易明细查询推送对象 → billObject{}", billObject);
break;
default:
return;
}
// 生成JSON // 生成JSON
DynamicObjectCollection dynamicObjectCollection = dataEntity.getDynamicObjectCollection("entryentity"); DynamicObjectCollection dynamicObjectCollection = dataEntity.getDynamicObjectCollection("entryentity");
@ -95,7 +124,29 @@ public class ApiMappingBillPlugin extends AbstractFormPlugin implements Plugin {
if (shkd_soufield != null) { if (shkd_soufield != null) {
String[] parts = shkd_soufield.toString().split("\\."); String[] parts = shkd_soufield.toString().split("\\.");
if (parts.length == 1) { if (parts.length == 1) {
value = billObject.get(parts[0]); if ("payeetype".equals(parts[0]) || "payertype".equals(parts[0])) {
String objectType = billObject.getString(parts[0]);
switch (objectType) {
case "bos_org":
value = "4";
break;
case "bd_supplier":
value = "2";
break;
case "bd_customer":
value = "1";
break;
case "bos_user":
value = "3";
break;
case "other":
value = "4";
break;
}
} else {
value = billObject.get(parts[0]);
}
} else if (parts.length == 2) { } else if (parts.length == 2) {
if ("entry".equals(parts[0])) { if ("entry".equals(parts[0])) {
DynamicObjectCollection dynamicObjectCollection1 = billObject.getDynamicObjectCollection(parts[0]); DynamicObjectCollection dynamicObjectCollection1 = billObject.getDynamicObjectCollection(parts[0]);
@ -172,7 +223,7 @@ public class ApiMappingBillPlugin extends AbstractFormPlugin implements Plugin {
headMap.put("Content-Type", "application/json"); headMap.put("Content-Type", "application/json");
apiEntity.setHeaders(headMap); apiEntity.setHeaders(headMap);
Map<String, Object> paramsMap = new HashMap<>(); Map<String, Object> paramsMap = new HashMap<>();
Map<String, Object> resultMap = ApiService.getBIPToken(domainName); Map<String, Object> resultMap = ApiService.getBIPToken(domainName);
paramsMap.put("access_token", resultMap.get("token")); paramsMap.put("access_token", resultMap.get("token"));
apiEntity.setQueryParams(paramsMap); apiEntity.setQueryParams(paramsMap);
apiEntity.setRequestBody(codeEdit.getText()); apiEntity.setRequestBody(codeEdit.getText());
@ -203,7 +254,28 @@ public class ApiMappingBillPlugin extends AbstractFormPlugin implements Plugin {
if (shkd_soufield != null) { if (shkd_soufield != null) {
String[] parts = shkd_soufield.toString().split("\\."); String[] parts = shkd_soufield.toString().split("\\.");
if (parts.length == 1) { if (parts.length == 1) {
value = dynamic.get(parts[0]); if ("payeetype".equals(parts[0]) || "payertype".equals(parts[0])) {
String objectType = dynamic.getString(parts[0]);
switch (objectType) {
case "bos_org":
value = "4";
break;
case "bd_supplier":
value = "2";
break;
case "bd_customer":
value = "1";
break;
case "bos_user":
value = "3";
break;
case "other":
value = "4";
break;
}
} else {
value = dynamic.get(parts[0]);
}
} else if (parts.length == 2) { } else if (parts.length == 2) {
if ("entry".equals(parts[0])) { if ("entry".equals(parts[0])) {
DynamicObjectCollection dynamicObjectCollection = dynamic.getDynamicObjectCollection(parts[0]); DynamicObjectCollection dynamicObjectCollection = dynamic.getDynamicObjectCollection(parts[0]);
@ -253,7 +325,28 @@ public class ApiMappingBillPlugin extends AbstractFormPlugin implements Plugin {
if (shkd_soufield != null) { if (shkd_soufield != null) {
String[] parts = shkd_soufield.toString().split("\\."); String[] parts = shkd_soufield.toString().split("\\.");
if (parts.length == 1) { if (parts.length == 1) {
value = dynamic.get(parts[0]); if ("payeetype".equals(parts[0]) || "payertype".equals(parts[0])) {
String objectType = dynamic.getString(parts[0]);
switch (objectType) {
case "bos_org":
value = "4";
break;
case "bd_supplier":
value = "2";
break;
case "bd_customer":
value = "1";
break;
case "bos_user":
value = "3";
break;
case "other":
value = "4";
break;
}
} else {
value = dynamic.get(parts[0]);
}
} else if (parts.length == 2) { } else if (parts.length == 2) {
if ("entry".equals(parts[0])) { if ("entry".equals(parts[0])) {
DynamicObjectCollection dynamicObjectCollection = dynamic.getDynamicObjectCollection(parts[0]); DynamicObjectCollection dynamicObjectCollection = dynamic.getDynamicObjectCollection(parts[0]);