parent
e4015f5c00
commit
45d420c4c0
|
@ -43,6 +43,26 @@ public class ApiMappingBillPlugin extends AbstractFormPlugin implements Plugin {
|
||||||
@Override
|
@Override
|
||||||
public void itemClick(ItemClickEvent evt) {
|
public void itemClick(ItemClickEvent evt) {
|
||||||
String itemKey = evt.getItemKey();
|
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);
|
DynamicObject dataEntity = this.getModel().getDataEntity(true);
|
||||||
// 获取想要推送单据编码
|
// 获取想要推送单据编码
|
||||||
String billNumber = dataEntity.getString("shkd_sourcenumber");
|
String billNumber = dataEntity.getString("shkd_sourcenumber");
|
||||||
|
@ -84,34 +104,24 @@ public class ApiMappingBillPlugin extends AbstractFormPlugin implements Plugin {
|
||||||
billObject = objects3[0];
|
billObject = objects3[0];
|
||||||
logger.info("获取银企交易明细查询推送对象 → billObject:{}", billObject);
|
logger.info("获取银企交易明细查询推送对象 → billObject:{}", billObject);
|
||||||
break;
|
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:
|
default:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取代码编辑器控件
|
// 生成JSON
|
||||||
CodeEdit codeEdit = this.getView().getControl("shkd_codeeditap");
|
|
||||||
|
|
||||||
if ("shkd_generatejson".equals(itemKey)) {
|
if ("shkd_generatejson".equals(itemKey)) {
|
||||||
String requestBody = ApiService.assembleRequestBody(billObject, dataEntity);
|
String requestBody = ApiService.assembleRequestBody(billObject, dataEntity);
|
||||||
codeEdit.setText(format(requestBody));
|
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<>();
|
List<DynamicObject> dynamicObjects = new ArrayList<>();
|
||||||
|
|
||||||
if ("shkd_testapi".equals(itemKey)) {
|
if ("shkd_testapi".equals(itemKey)) {
|
||||||
|
|
Loading…
Reference in New Issue