diff --git a/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/mservice/ApiService.java b/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/mservice/ApiService.java index db5e4b3..2a3f561 100644 --- a/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/mservice/ApiService.java +++ b/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/mservice/ApiService.java @@ -248,6 +248,8 @@ public class ApiService { dynamic.set("shkd_pushstatus", "结算失败"); } else if ("TS".equals(objects[0].getString("bankpaystatus"))) { dynamic.set("shkd_pushstatus", "已结算"); + } else { + dynamic.set("shkd_pushstatus", "结算失败"); } dynamicObjects.add(dynamic); diff --git a/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/plugin/operation/HitBackOperationServicePlugin.java b/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/plugin/operation/HitBackOperationServicePlugin.java new file mode 100644 index 0000000..d587754 --- /dev/null +++ b/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/plugin/operation/HitBackOperationServicePlugin.java @@ -0,0 +1,45 @@ +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.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 shkd.sys.sys.plugin.form.ApiMappingBillPlugin; + +import java.util.ArrayList; +import java.util.List; + +/** + * 单据操作插件 + */ +public class HitBackOperationServicePlugin extends AbstractOperationServicePlugIn implements Plugin { + private static final Log logger = LogFactory.getLog(ApiMappingBillPlugin.class); + @Override + public void afterExecuteOperationTransaction(AfterOperationArgs args) { + super.afterExecuteOperationTransaction(args); + List dynamicObjectList = new ArrayList<>(); + DynamicObject[] entities = args.getDataEntities(); + for (DynamicObject dynamicObject : entities) { + BusinessDataServiceHelper.load(dynamicObject.getDataEntityType().getName(), "id,billno,actpayamt,entry,entry.e_expenseitem,entry.e_remark,settletype,payeebanknum," + + "payeetype,payeenumber,payeracctbank,payeebank,payeebankname,paymenttype,org,bizdate,description," + + "shkd_pushstatus,shkd_businessnumber,shkd_businessid,shkd_businessname,billstatus,bankpaystatus" + , new QFilter("id", QCP.equals, dynamicObject.getPkValue()) + .and("billstatus", QCP.equals, "C")//已审核 + .and("shkd_pushstatus", QCP.equals, "未结算").toArray()); + try { + ApiService.paymentSlipsJson(dynamicObject, "BIPNO", dynamicObjectList); + SaveServiceHelper.save(dynamicObjectList.toArray(new DynamicObject[0])); + logger.info("执行打回操作成功,单据编号:{}", dynamicObject.getString("billno")); + } catch (Exception e) { + logger.info("执行打回操作失败,错误信息 → \n{}", e); + } + } + } +} \ No newline at end of file diff --git a/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/plugin/task/PushTaskPlugin.java b/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/plugin/task/PushTaskPlugin.java index 0514793..920fb82 100644 --- a/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/plugin/task/PushTaskPlugin.java +++ b/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/plugin/task/PushTaskPlugin.java @@ -100,7 +100,7 @@ public class PushTaskPlugin extends AbstractTask implements Plugin { "id,billno,actpayamt,entry,entry.e_expenseitem,entry.e_remark,settletype,payeebanknum," + "payeetype,payeenumber,payeracctbank,payeebank,payeebankname,paymenttype,org,bizdate,description," + "shkd_pushstatus,shkd_businessnumber,shkd_businessid,shkd_businessname,billstatus,bankpaystatus" - , new QFilter("bankpaystatus", QCP.equals, "TS") + , new QFilter("bankpaystatus", QCP.equals, "TS")//付款成功 .and("shkd_pushstatus", QCP.equals, "结算失败").toArray()); dynamicObjects = Arrays.asList(objects4); dynamicObjects.addAll(Arrays.asList(objects5));