提交内容:BIP提交接口调用

备注:BIP提交接口调用
提交人:邹江涛
This commit is contained in:
zoujiangtao 2024-12-19 19:42:38 +08:00
parent e4015f5c00
commit 45d420c4c0
1 changed files with 30 additions and 20 deletions

View File

@ -43,6 +43,26 @@ public class ApiMappingBillPlugin extends AbstractFormPlugin implements Plugin {
@Override
public void itemClick(ItemClickEvent evt) {
String itemKey = evt.getItemKey();
// 获取代码编辑器控件
CodeEdit codeEdit = this.getView().getControl("shkd_codeeditap");
// 解析JSON字符串
if ("shkd_analyzejson".equals(itemKey)) {
String text = codeEdit.getText();
Object obj = JSON.parse(text);
logger.info("解析JSON字符串 → text{}\nJSON字符串解析为JSON", text);
if (obj instanceof JSONObject) {
logger.info("解析JSON字符串 → text{}\nJSON字符串解析为JSONObject", text);
JSONObject jsonObject = JSON.parseObject(text);
parseJson(jsonObject, 1, null);
} else if (obj instanceof JSONArray) {
logger.info("解析JSON字符串 → text{}\nJSON字符串解析为JSONArray", text);
JSONArray jsonArray = JSON.parseArray(text);
parseJson(jsonArray, 1, null);
}
}
DynamicObject dataEntity = this.getModel().getDataEntity(true);
// 获取想要推送单据编码
String billNumber = dataEntity.getString("shkd_sourcenumber");
@ -84,34 +104,24 @@ public class ApiMappingBillPlugin extends AbstractFormPlugin implements Plugin {
billObject = objects3[0];
logger.info("获取银企交易明细查询推送对象 → billObject{}", billObject);
break;
// 电子回单查询
case "bei_elecreceipt":
DynamicObject[] objects4 = BusinessDataServiceHelper.load("bei_elecreceipt",
"id"
, new QFilter("billno", QCP.equals, billNumber).toArray());
billObject = objects4[0];
logger.info("获取银企交易明细查询推送对象 → billObject{}", billObject);
break;
default:
return;
}
// 获取代码编辑器控件
CodeEdit codeEdit = this.getView().getControl("shkd_codeeditap");
// 生成JSON
if ("shkd_generatejson".equals(itemKey)) {
String requestBody = ApiService.assembleRequestBody(billObject, dataEntity);
codeEdit.setText(format(requestBody));
}
logger.info("点击按钮标识:{}", itemKey);
if ("shkd_analyzejson".equals(itemKey)) {
String text = codeEdit.getText();
Object obj = JSON.parse(text);
logger.info("解析JSON字符串 → text{}\nJSON字符串解析为JSON", text);
if (obj instanceof JSONObject) {
logger.info("解析JSON字符串 → text{}\nJSON字符串解析为JSONObject", text);
JSONObject jsonObject = JSON.parseObject(text);
parseJson(jsonObject, 1, null);
} else if (obj instanceof JSONArray) {
logger.info("解析JSON字符串 → text{}\nJSON字符串解析为JSONArray", text);
JSONArray jsonArray = JSON.parseArray(text);
parseJson(jsonArray, 1, null);
}
}
List<DynamicObject> dynamicObjects = new ArrayList<>();
if ("shkd_testapi".equals(itemKey)) {