parent
c3730790f9
commit
056c49a279
|
@ -290,7 +290,21 @@ public class ApiService {
|
|||
dynamic.set("shkd_businessname", "共享系统");
|
||||
dynamicObjects.add(dynamic);
|
||||
logger.info("银行收付处理 → BIP推送接口 → 成功\n成功单据编号:{}\n成功请求体:{}\n推送成功接口返回数据:{}", dynamic.getString("billno"), saveRequestBody, saveResponseBody);
|
||||
result = "推送 → 银行收付处理 → 成功";
|
||||
|
||||
// 电子回单关联标记
|
||||
String receiptno = dynamic.getString("receiptno");
|
||||
DynamicObject[] loaded = BusinessDataServiceHelper.load("bei_elecreceipt",
|
||||
"id,billno,shkd_pushstatus,fileserverurl,bizdate,oppbankname,description,company,oppbanknumber," +
|
||||
"detaildatetime,accountbank,amount,use,debitamount,creditamount,detailid,uploadfilename," +
|
||||
"shkd_businessnumber,shkd_businessid,shkd_businessname,receiptno"
|
||||
, new QFilter("receiptno", QCP.equals, receiptno).toArray());
|
||||
String slipsJson = paymentSlipsJson(loaded[0], "BIP", dynamicObjects, null);
|
||||
if (slipsJson.contains("成功")) {
|
||||
result = "推送 → 银行收付处理 → 成功\n推送 → 电子回单 → 成功";
|
||||
} else {
|
||||
result = "推送 → 银行收付处理 → 成功\n推送 → 电子回单 → 失败";
|
||||
}
|
||||
|
||||
} else {
|
||||
logger.info("银行收付处理 → BIP推送接口 → 失败\n失败单据编号:{}\n失败请求体:{}\n推送失败接口返回数据:{}", dynamic.getString("billno"), saveRequestBody, saveResponseBody);
|
||||
result = "推送 → 银行收付处理 → 失败";
|
||||
|
@ -328,13 +342,8 @@ public class ApiService {
|
|||
jsonObject = JSON.parseObject(saveResponseBody);
|
||||
code = jsonObject.getString("code");
|
||||
if ("200".equals(code)) {
|
||||
dynamic.set("shkd_pushstatus", "已推送");
|
||||
dynamic.set("shkd_businessname", "共享系统");
|
||||
dynamic.set("shkd_businessid", jsonObject.getJSONArray("data").get(0));
|
||||
dynamicObjects.add(dynamic);
|
||||
logger.info("电子回单查询 → BIP推送接口 → 成功\n成功单据编号:{}\n成功请求体:{}\n推送成功接口返回数据:{}",
|
||||
dynamic.getString("billno"), saveRequestBody, saveResponseBody);
|
||||
result = "推送 → 电子回单查询 → 成功";
|
||||
|
||||
DynamicObject dynamicObject = BusinessDataServiceHelper.loadSingle(dynamic.getPkValue(), dynamic.getDynamicObjectType().getName());
|
||||
IFormView viewByDynamicObj = createViewByDynamicObj(dynamicObject);
|
||||
|
@ -352,6 +361,7 @@ public class ApiService {
|
|||
String attachmentRequestBody = getAttachmentRequestBody(hashMap);
|
||||
String pushResult = pushBill(token, "https://biptestctny.invest.com.cn:8002/iuap-api-auth//yonbip/ctm/bank/tran/update", attachmentRequestBody);
|
||||
logger.info("电子回单查询 → BIP推送附件接口 → \n推送数据:{}\n请求返回结果:{}", attachmentRequestBody, pushResult);
|
||||
result = "推送 → 电子回单查询 → 成功";
|
||||
} else {
|
||||
logger.info("电子回单查询 → BIP推送接口 → 失败\n失败单据编号:{}\n失败请求体:{}\n推送失败接口返回数据:{}",
|
||||
dynamic.getString("billno"), saveRequestBody, saveResponseBody);
|
||||
|
|
|
@ -1,16 +1,53 @@
|
|||
package shkd.sys.sys.plugin.operation;
|
||||
|
||||
import kd.bos.dataentity.entity.DynamicObject;
|
||||
import kd.bos.entity.plugin.AbstractOperationServicePlugIn;
|
||||
import kd.bos.entity.plugin.args.AfterOperationArgs;
|
||||
import kd.bos.entity.plugin.args.BeforeOperationArgs;
|
||||
import kd.bos.form.plugin.AbstractFormPlugin;
|
||||
import kd.bos.logging.Log;
|
||||
import kd.bos.logging.LogFactory;
|
||||
import kd.bos.orm.query.QCP;
|
||||
import kd.bos.orm.query.QFilter;
|
||||
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||
import kd.bos.servicehelper.operation.SaveServiceHelper;
|
||||
import kd.sdk.plugin.Plugin;
|
||||
import shkd.sys.sys.mservice.ApiService;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 动态表单插件
|
||||
*/
|
||||
public class PushTransdetailOperationServicePlugin extends AbstractOperationServicePlugIn implements Plugin {
|
||||
private static final Log logger = LogFactory.getLog(PushTransdetailOperationServicePlugin.class);
|
||||
@Override
|
||||
public void afterExecuteOperationTransaction(AfterOperationArgs e) {
|
||||
super.afterExecuteOperationTransaction(e);
|
||||
public void beforeExecuteOperationTransaction(BeforeOperationArgs args) {
|
||||
super.beforeExecuteOperationTransaction(args);
|
||||
DynamicObject[] entities = args.getDataEntities();
|
||||
logger.info("操作获取单据数量:{}", entities.length);
|
||||
List<Object> pkValue = new ArrayList<>();
|
||||
Arrays.stream(entities).forEach(dynamicObject -> {
|
||||
pkValue.add(dynamicObject.getPkValue());
|
||||
});
|
||||
DynamicObject[] objects = BusinessDataServiceHelper.load("bei_transdetail_cas", "id," +
|
||||
"billno,bizdate,oppbank,oppunit,accountbank,description,company,oppbanknumber," +
|
||||
"bankdetailno,transbalance,description,debitamount,creditamount,shkd_pushstatus," +
|
||||
"shkd_businessnumber,shkd_businessid,shkd_businessname,receiptno"
|
||||
, new QFilter("id", QCP.in, pkValue)
|
||||
.and("shkd_pushstatus", QCP.not_equals, "已推送").toArray());
|
||||
if (pkValue.size() != objects.length) {
|
||||
args.setCancel(true);
|
||||
args.setCancelMessage("推送失败,存在已推送的数据");
|
||||
return;
|
||||
}
|
||||
|
||||
List<DynamicObject> dynamicObjects = new ArrayList<>();
|
||||
Arrays.stream(objects).forEach(dynamicObject -> {
|
||||
String result = ApiService.paymentSlipsJson(dynamicObject, "BIP", dynamicObjects, null);
|
||||
});
|
||||
SaveServiceHelper.save(dynamicObjects.toArray(new DynamicObject[0]));
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue