Merge remote-tracking branch 'origin/main' into main

This commit is contained in:
fang 2024-11-13 10:55:14 +08:00
commit a1e4af12b9
1 changed files with 28 additions and 8 deletions

View File

@ -17,6 +17,7 @@ import kd.bos.orm.query.QFilter;
import kd.bos.servicehelper.BusinessDataServiceHelper; import kd.bos.servicehelper.BusinessDataServiceHelper;
import kd.bos.servicehelper.user.UserServiceHelper; import kd.bos.servicehelper.user.UserServiceHelper;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -33,7 +34,7 @@ public class PayBillApiSavePlugin implements ApiSavePlugin, ApiSerializerPlugin
@Override @Override
public List<Map<String, Object>> preHandleRequestData(List<Map<String, Object>> reqData) { public List<Map<String, Object>> preHandleRequestData(List<Map<String, Object>> reqData) {
logger.info("接口调用接口参数:{}", reqData); logger.info("接口调用接口参数:{}\n数据长度{}", reqData, reqData.size());
//付款处理 收款人ID payee 付款银行.编码 payerbank_number payeetype 收款人类型 payeenumber 收款人编码 //付款处理 收款人ID payee 付款银行.编码 payerbank_number payeetype 收款人类型 payeenumber 收款人编码
//payeracctbank_number 付款银行账号.number //payeracctbank_number 付款银行账号.number
@ -47,7 +48,7 @@ public class PayBillApiSavePlugin implements ApiSavePlugin, ApiSerializerPlugin
String objectNumber;//对象编码/付人编码 String objectNumber;//对象编码/付人编码
String fieldName1;//字段名称/付人ID String fieldName1;//字段名称/付人ID
String bankNumber;///付款银行账号.number String bankNumber = null;///付款银行账号.number
String fieldName2;//字段名称/付款银行.number String fieldName2;//字段名称/付款银行.number
for (Map<String, Object> map : reqData) { for (Map<String, Object> map : reqData) {
@ -55,18 +56,30 @@ public class PayBillApiSavePlugin implements ApiSavePlugin, ApiSerializerPlugin
Object payertype = map.get("payertype");//如果是付款人类型 则为收款处理保存接口 Object payertype = map.get("payertype");//如果是付款人类型 则为收款处理保存接口
if (payeetype != null) { if (payeetype != null) {
logger.info("进入付款处理单API"); logger.info("进入付款处理单API");
//收款人类型
objectType = payeetype.toString(); objectType = payeetype.toString();
//收款人编码
objectNumber = map.get("payeenumber").toString(); objectNumber = map.get("payeenumber").toString();
//收款人ID
fieldName1 = "payee"; fieldName1 = "payee";
bankNumber = map.get("payeracctbank_number").toString();
fieldName2 = "payerbank_number"; Object payeebankObj = map.get("payeebank");
Map<String, Object> payeebankMap = (Map<String, Object>) payeebankObj;
bankNumber = (String) payeebankMap.get("number");
fieldName2 = "payerbank";
DynamicObject dynamicObject = BusinessDataServiceHelper.loadSingle(objectType, "id", new QFilter("billno", QCP.equals, objectNumber).toArray()); DynamicObject dynamicObject = BusinessDataServiceHelper.loadSingle(objectType, "id", new QFilter("billno", QCP.equals, objectNumber).toArray());
logger.info("objectType:{},objectNumber:{}", objectType, objectNumber); logger.info("objectType:{},objectNumber:{}", objectType, objectNumber);
DynamicObject amAccountbank = BusinessDataServiceHelper.loadSingle("am_accountbank", "id,bank,bank.number", new QFilter("number", QCP.equals, bankNumber).toArray()); DynamicObject amAccountbank = BusinessDataServiceHelper.loadSingle("am_accountbank", "id,bank,bank.number", new QFilter("number", QCP.equals, bankNumber).toArray());
logger.info("amAccountbank:{}", amAccountbank); logger.info("amAccountbank:{}", amAccountbank);
map.put(fieldName1, dynamicObject.getString("id")); map.put(fieldName1, dynamicObject.getString("id"));
map.put(fieldName2, amAccountbank.getDynamicObject("bank").getString("number"));
Map<String, Object> payerbank = new HashMap<>();
payerbank.put("number", amAccountbank.getDynamicObject("bank").getString("number"));
map.put(fieldName2, payerbank);
} }
if (payertype != null) { if (payertype != null) {
@ -74,14 +87,21 @@ public class PayBillApiSavePlugin implements ApiSavePlugin, ApiSerializerPlugin
objectNumber = map.get("payernumber").toString(); objectNumber = map.get("payernumber").toString();
fieldName1 = "payer"; fieldName1 = "payer";
bankNumber = map.get("accountbank_number").toString();
fieldName2 = "payeebank_number"; Object accountbank = map.get("accountbank");
Map<String, Object> accountbankMap = (Map<String, Object>) accountbank;
bankNumber = (String) accountbankMap.get("number");
fieldName2 = "payeebank";
DynamicObject dynamicObject = BusinessDataServiceHelper.loadSingle(objectType, "id", new QFilter("billno", QCP.equals, objectNumber).toArray()); DynamicObject dynamicObject = BusinessDataServiceHelper.loadSingle(objectType, "id", new QFilter("billno", QCP.equals, objectNumber).toArray());
logger.info("objectType:{},objectNumber:{}", objectType, objectNumber); logger.info("objectType:{},objectNumber:{}", objectType, objectNumber);
DynamicObject amAccountbank = BusinessDataServiceHelper.loadSingle("am_accountbank", "id,bank,bank.number", new QFilter("number", QCP.equals, bankNumber).toArray()); DynamicObject amAccountbank = BusinessDataServiceHelper.loadSingle("am_accountbank", "id,bank,bank.number", new QFilter("number", QCP.equals, bankNumber).toArray());
logger.info("amAccountbank:{}", amAccountbank); logger.info("amAccountbank:{}", amAccountbank);
map.put(fieldName1, dynamicObject.getString("id")); map.put(fieldName1, dynamicObject.getString("id"));
map.put(fieldName2, amAccountbank.getDynamicObject("bank").getString("number"));
Map<String, Object> payeebank = new HashMap<>();
payeebank.put("number", amAccountbank.getDynamicObject("bank").getString("number"));
map.put(fieldName2, payeebank);
} }
shkd_businessid = map.get("shkd_businessid").toString(); shkd_businessid = map.get("shkd_businessid").toString();
shkd_businessnumber = map.get("shkd_businessnumber").toString(); shkd_businessnumber = map.get("shkd_businessnumber").toString();