parent
63a0a083eb
commit
bf1810ac7c
|
@ -15,6 +15,7 @@ import kd.bos.logging.LogFactory;
|
||||||
import kd.bos.orm.query.QCP;
|
import kd.bos.orm.query.QCP;
|
||||||
import kd.bos.orm.query.QFilter;
|
import kd.bos.orm.query.QFilter;
|
||||||
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||||
|
import kd.bos.servicehelper.operation.SaveServiceHelper;
|
||||||
import kd.sdk.plugin.Plugin;
|
import kd.sdk.plugin.Plugin;
|
||||||
import shkd.sys.sys.mservice.ApiService;
|
import shkd.sys.sys.mservice.ApiService;
|
||||||
|
|
||||||
|
@ -109,6 +110,18 @@ public class ApiMappingBillPlugin extends AbstractFormPlugin implements Plugin {
|
||||||
|
|
||||||
if ("shkd_testapi".equals(itemKey)) {
|
if ("shkd_testapi".equals(itemKey)) {
|
||||||
String responseBody = ApiService.paymentSlipsJson(billObject, "BIP");
|
String responseBody = ApiService.paymentSlipsJson(billObject, "BIP");
|
||||||
|
JSONObject jsonObject = JSON.parseObject(responseBody);
|
||||||
|
String code = jsonObject.getString("code");
|
||||||
|
if ("200".equals(code)) {
|
||||||
|
JSONObject data = jsonObject.getJSONObject("data");
|
||||||
|
billObject.set("shkd_businessnumber", data.getString("code"));
|
||||||
|
billObject.set("shkd_businessid", data.getString("id"));
|
||||||
|
billObject.set("shkd_businessname", "BIP");
|
||||||
|
billObject.set("shkd_pushstatus", "已推送");
|
||||||
|
SaveServiceHelper.save(new DynamicObject[]{billObject});
|
||||||
|
} else {
|
||||||
|
logger.info("推送 → 失败\n失败单据编号:{}\n推送失败接口返回数据:{}", billObject.getString("billno"), responseBody);
|
||||||
|
}
|
||||||
this.getView().showTipNotification("返回结果:" + responseBody);
|
this.getView().showTipNotification("返回结果:" + responseBody);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -51,6 +51,8 @@ public class PushTaskPlugin extends AbstractTask implements Plugin {
|
||||||
String billName = null;
|
String billName = null;
|
||||||
|
|
||||||
List<DynamicObject> dynamicObjects = new ArrayList<>();
|
List<DynamicObject> dynamicObjects = new ArrayList<>();
|
||||||
|
List<DynamicObject> objects = new ArrayList<>();
|
||||||
|
String finalBillName;
|
||||||
if (billMark != null) {
|
if (billMark != null) {
|
||||||
switch (billMark.toString()) {
|
switch (billMark.toString()) {
|
||||||
// 付款处理
|
// 付款处理
|
||||||
|
@ -58,10 +60,33 @@ public class PushTaskPlugin extends AbstractTask implements Plugin {
|
||||||
DynamicObject[] objects1 = BusinessDataServiceHelper.load("cas_paybill",
|
DynamicObject[] objects1 = BusinessDataServiceHelper.load("cas_paybill",
|
||||||
"id,billno,actpayamt,entry,entry.e_expenseitem,entry.e_remark,settletype,payeebanknum," +
|
"id,billno,actpayamt,entry,entry.e_expenseitem,entry.e_remark,settletype,payeebanknum," +
|
||||||
"payeetype,payeenumber,payeracctbank,payeebank,payeebankname,paymenttype,org,bizdate,description," +
|
"payeetype,payeenumber,payeracctbank,payeebank,payeebankname,paymenttype,org,bizdate,description," +
|
||||||
"shkd_pushstatus,shkd_businessnumber,shkd_businessid,shkd_businessname,billstatus"
|
"shkd_pushstatus,shkd_businessnumber,shkd_businessid,shkd_businessname,billstatus,bankpaystatus"
|
||||||
, new QFilter("bizdate", QCP.large_equals, date).and("shkd_pushstatus", QCP.not_equals, "已推送").toArray());
|
, new QFilter("bizdate", QCP.large_equals, date).and("shkd_pushstatus", QCP.not_equals, "已推送")
|
||||||
|
.and("billstatus", QCP.equals, "D").toArray());
|
||||||
dynamicObjects = Arrays.asList(objects1);
|
dynamicObjects = Arrays.asList(objects1);
|
||||||
billName = "付款处理";
|
billName = "付款处理";
|
||||||
|
finalBillName = billName;
|
||||||
|
dynamicObjects.forEach(dynamicObject -> {
|
||||||
|
String responseBody = ApiService.paymentSlipsJson(dynamicObject, "BIP");
|
||||||
|
logger.info("推送 → {} → 开始\n推送单据编号:{}\n接口响应数据:{}", finalBillName, dynamicObject.getString("billno"), responseBody);
|
||||||
|
if (!responseBody.contains("失败")) {
|
||||||
|
JSONObject jsonObject = JSON.parseObject(responseBody);
|
||||||
|
String code = jsonObject.getString("code");
|
||||||
|
if ("200".equals(code)) {
|
||||||
|
JSONObject data = jsonObject.getJSONObject("data");
|
||||||
|
dynamicObject.set("shkd_businessnumber", data.getString("code"));
|
||||||
|
dynamicObject.set("shkd_businessid", data.getString("id"));
|
||||||
|
dynamicObject.set("shkd_businessname", "BIP");
|
||||||
|
dynamicObject.set("shkd_pushstatus", "已推送");
|
||||||
|
objects.add(dynamicObject);
|
||||||
|
} else {
|
||||||
|
logger.info("推送 → {} → 失败\n失败单据编号:{}\n推送失败接口返回数据:{}", finalBillName, dynamicObject.getString("billno"), responseBody);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
logger.info("推送 → {} → 失败,失败单据编号:{}", finalBillName, dynamicObject.getString("billno"));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
SaveServiceHelper.save(objects.toArray(new DynamicObject[0]));
|
||||||
break;
|
break;
|
||||||
// 收款处理
|
// 收款处理
|
||||||
case "cas_recbill":
|
case "cas_recbill":
|
||||||
|
@ -83,40 +108,35 @@ public class PushTaskPlugin extends AbstractTask implements Plugin {
|
||||||
dynamicObjects = Arrays.asList(objects3);
|
dynamicObjects = Arrays.asList(objects3);
|
||||||
billName = "银行收付处理";
|
billName = "银行收付处理";
|
||||||
break;
|
break;
|
||||||
// 支付结果(付款处理支付结果定时推送)
|
// 支付失败(付款处理支付结果定时推送)
|
||||||
case "cas_paybill_result":
|
case "cas_paybill_result":
|
||||||
DynamicObject[] objects4 = BusinessDataServiceHelper.load("cas_paybill",
|
DynamicObject[] objects4 = BusinessDataServiceHelper.load("cas_paybill",
|
||||||
"id,billno,actpayamt,entry,entry.e_expenseitem,entry.e_remark,settletype,payeebanknum," +
|
"id,billno,actpayamt,entry,entry.e_expenseitem,entry.e_remark,settletype,payeebanknum," +
|
||||||
"payeetype,payeenumber,payeracctbank,payeebank,payeebankname,paymenttype,org,bizdate,description," +
|
"payeetype,payeenumber,payeracctbank,payeebank,payeebankname,paymenttype,org,bizdate,description," +
|
||||||
"shkd_pushstatus,shkd_businessnumber,shkd_businessid,shkd_businessname,billstatus"
|
"shkd_pushstatus,shkd_businessnumber,shkd_businessid,shkd_businessname,billstatus,bankpaystatus"
|
||||||
, new QFilter("bizdate", QCP.large_equals, date).and("shkd_pushstatus", QCP.not_equals, "已推送").toArray());
|
, new QFilter("bizdate", QCP.large_equals, date).and("bankpaystatus", QCP.in, new String[]{"TF", "NC", "OF"}).toArray());
|
||||||
|
dynamicObjects = Arrays.asList(objects4);
|
||||||
|
finalBillName = billName;
|
||||||
|
dynamicObjects.forEach(dynamicObject -> {
|
||||||
|
String responseBody = ApiService.paymentSlipsJson(dynamicObject, "BIPNO");
|
||||||
|
logger.info("推送 → {} → 开始\n推送单据编号:{}\n接口响应数据:{}", finalBillName, dynamicObject.getString("billno"), responseBody);
|
||||||
|
if (!responseBody.contains("失败")) {
|
||||||
|
JSONObject jsonObject = JSON.parseObject(responseBody);
|
||||||
|
String code = jsonObject.getString("code");
|
||||||
|
if ("200".equals(code)) {
|
||||||
|
dynamicObject.set("billstatus", "A");
|
||||||
|
objects.add(dynamicObject);
|
||||||
|
} else {
|
||||||
|
logger.info("推送 → {} → 失败\n失败单据编号:{}\n推送失败接口返回数据:{}", finalBillName, dynamicObject.getString("billno"), responseBody);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
logger.info("推送 → {} → 失败,失败单据编号:{}", finalBillName, dynamicObject.getString("billno"));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
SaveServiceHelper.save(objects.toArray(new DynamicObject[0]));
|
||||||
default:
|
default:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
List<DynamicObject> objects = new ArrayList<>();
|
|
||||||
String finalBillName = billName;
|
|
||||||
dynamicObjects.forEach(dynamicObject -> {
|
|
||||||
String responseBody = ApiService.paymentSlipsJson(dynamicObject, "BIP");
|
|
||||||
logger.info("推送 → {} → 开始\n推送单据编号:{}\n接口响应数据:{}", finalBillName, dynamicObject.getString("billno"), responseBody);
|
|
||||||
if (!responseBody.contains("失败")) {
|
|
||||||
JSONObject jsonObject = JSON.parseObject(responseBody);
|
|
||||||
String code = jsonObject.getString("code");
|
|
||||||
if ("200".equals(code)) {
|
|
||||||
JSONObject data = jsonObject.getJSONObject("data");
|
|
||||||
dynamicObject.set("shkd_businessnumber", data.getString("code"));
|
|
||||||
dynamicObject.set("shkd_businessid", data.getString("id"));
|
|
||||||
dynamicObject.set("shkd_businessname", "BIP");
|
|
||||||
dynamicObject.set("shkd_pushstatus", "已推送");
|
|
||||||
objects.add(dynamicObject);
|
|
||||||
} else {
|
|
||||||
logger.info("推送 → {} → 失败\n失败单据编号:{}\n推送失败接口返回数据:{}", finalBillName, dynamicObject.getString("billno"), responseBody);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
logger.info("推送 → {} → 失败,失败单据编号:{}", finalBillName, dynamicObject.getString("billno"));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
SaveServiceHelper.save(objects.toArray(new DynamicObject[0]));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue