Merge remote-tracking branch 'origin/main' into main

This commit is contained in:
陈绍鑫 2026-01-07 09:41:12 +08:00
commit 5f52dfee7b
1 changed files with 31 additions and 61 deletions

View File

@ -48,36 +48,38 @@ public class PaymentProcessingListPlugin extends AbstractListPlugin implements P
if ("hitback".equals(operateKey)) { if ("hitback".equals(operateKey)) {
if (selectedRows.isEmpty()) { if (selectedRows.isEmpty()) {
this.getView().showTipNotification("请选择一条数据"); this.getView().showTipNotification("请选择一条数据");
return;
} else if (selectedRows.size() > 1) { } else if (selectedRows.size() > 1) {
this.getView().showTipNotification("涉及流程中断,只能选择一条数据打回"); this.getView().showTipNotification("涉及流程中断,只能选择一条数据打回");
return;
} else { } else {
ListSelectedRow listSelectedRow = selectedRows.get(0); ListSelectedRow listSelectedRow = selectedRows.get(0);
Object primaryKeyValue = listSelectedRow.getPrimaryKeyValue(); Object primaryKeyValue = listSelectedRow.getPrimaryKeyValue();
DynamicObject dynamicObject = BusinessDataServiceHelper.loadSingle(primaryKeyValue, "cas_paybill"); DynamicObject dynamicObject = BusinessDataServiceHelper.loadSingle(primaryKeyValue, "cas_paybill");
DynamicObject loadSingle = BusinessDataServiceHelper.loadSingle(dynamicObject.getDynamicObjectType().getName(), "id,billno,name,billstatus,shkd_businessname", new QFilter("id", QCP.equals, dynamicObject.getPkValue()).toArray()); String billno = dynamicObject.getString("billno");
String billno = loadSingle.getString("billno");
logger.info("进入打回操作 → hitback\nbillno:{}", billno); logger.info("进入打回操作 → hitback\nbillno:{}", billno);
Object businessname = loadSingle.get("shkd_businessname"); Object businessname = dynamicObject.get("shkd_businessname");
String billstatus = loadSingle.getString("billstatus"); String billstatus = dynamicObject.getString("billstatus");
if (businessname != null) { if (businessname != null) {
String shkd_businessname = businessname.toString(); String shkd_businessname = businessname.toString();
if (("共享系统".equals(shkd_businessname) || "XK".equals(shkd_businessname)) && (("B".equals(billstatus) || "C".equals(billstatus)))) { if (("共享系统".equals(shkd_businessname) || "XK".equals(shkd_businessname)) && (("A".equals(billstatus) || "B".equals(billstatus) || "C".equals(billstatus)))) {
boolean outcome = whetherToInterruptTheProcess(loadSingle.getPkValue().toString());
if (outcome) {
OperationResult operation;
if ("共享系统".equals(shkd_businessname)) { if ("共享系统".equals(shkd_businessname)) {
DynamicObject[] objects = BusinessDataServiceHelper.load("cas_paybill",
"id,billno,actpayamt,entry,entry.e_expenseitem,entry.e_remark,settletype,acttradedate," +
"payeebanknum,payeetype,payeenumber,payeracctbank,payeebank,payeebankname,paymenttype," +
"org,bizdate,description,shkd_pushstatus,shkd_businessnumber,shkd_businessid,shkd_businessname," +
"billstatus,bankpaystatus", new QFilter("billno", QCP.equals, loadSingle.getString("billno")).toArray());
List<DynamicObject> dynamicObjects = new ArrayList<>(); List<DynamicObject> dynamicObjects = new ArrayList<>();
String pushResult = ApiService.paymentSlipsJson(objects[0], "BIPRE", dynamicObjects, null); String pushResult = ApiService.paymentSlipsJson(dynamicObject, "BIPRE", dynamicObjects, null);
logger.info("result信息{}", pushResult); logger.info("result信息{}", pushResult);
if (pushResult.contains("成功")) { if (pushResult.contains("成功")) {
boolean outcome = whetherToInterruptTheProcess(dynamicObject.getPkValue().toString());
if (outcome) {
if ("B".equals(billstatus) || "C".equals(billstatus)) {
dynamicObject.set("billstatus", "A");
}
SaveServiceHelper.save(dynamicObjects.toArray(new DynamicObject[0])); SaveServiceHelper.save(dynamicObjects.toArray(new DynamicObject[0]));
this.getView().showSuccessNotification("打回成功");
logger.info("单据:{}打回成功", billno);
list.refresh();
} else {
this.getView().showTipNotification("来源系统为BIP或星空且单据状态为提交或审核才允许打回");
logger.info("单据:{}打回失败失败原因来源系统为BIP或星空且单据状态为提交或审核才允许打回", billno);
}
} else { } else {
String returnResults = extractMessageFromResult(pushResult); String returnResults = extractMessageFromResult(pushResult);
if (!returnResults.isEmpty()) { if (!returnResults.isEmpty()) {
@ -85,37 +87,11 @@ public class PaymentProcessingListPlugin extends AbstractListPlugin implements P
} else { } else {
this.getView().showTipNotification("打回失败,请找业务老师处理"); this.getView().showTipNotification("打回失败,请找业务老师处理");
} }
return;
} }
} }
if ("B".equals(dynamicObject.getString("billstatus"))) {
operation = OperationServiceHelper.executeOperate("unsubmit", "cas_paybill", new DynamicObject[]{dynamicObject}, OperateOption.create());
} else if ("C".equals(dynamicObject.getString("billstatus"))) {
operation = OperationServiceHelper.executeOperate("unaudit", "cas_paybill", new DynamicObject[]{dynamicObject}, OperateOption.create());
} else {
this.getView().showTipNotification("单据不为已提交或已审核状态,无法打回");
logger.info("单据:{}打回失败,失败原因:单据不为已提交或已审核状态", billno);
return;
}
List<IOperateInfo> allErrorOrValidateInfo = operation.getAllErrorOrValidateInfo();
if (!allErrorOrValidateInfo.isEmpty()) {
this.getView().showTipNotification("打回失败,失败原因:撤销(反审核)操作失败 → " + allErrorOrValidateInfo.get(0).getMessage());
logger.info("单据:{}打回失败,失败原因:撤销(反审核)操作失败 → " + allErrorOrValidateInfo.get(0).getMessage());
return;
} else {
this.getView().showSuccessNotification("打回成功");
logger.info("单据:{}打回成功", billno);
list.refresh();
}
} else { } else {
this.getView().showTipNotification("流程中断失败,请找业务老师处理"); this.getView().showTipNotification("流程中断失败,请找业务老师处理");
} }
} else {
this.getView().showTipNotification("来源系统为BIP或星空且单据状态为提交或审核才允许打回");
logger.info("单据:{}打回失败失败原因来源系统为BIP或星空且单据状态为提交或审核才允许打回", billno);
return;
}
} else { } else {
this.getView().showTipNotification("来源系统为BIP或星空且单据状态为提交或审核才允许打回"); this.getView().showTipNotification("来源系统为BIP或星空且单据状态为提交或审核才允许打回");
logger.info("单据:{}打回失败失败原因来源系统为BIP或星空且单据状态为提交或审核才允许打回", billno); logger.info("单据:{}打回失败失败原因来源系统为BIP或星空且单据状态为提交或审核才允许打回", billno);
@ -144,26 +120,20 @@ public class PaymentProcessingListPlugin extends AbstractListPlugin implements P
try { try {
// 中断流程 // 中断流程
abandonByBusienssKey(billId); abandonByBusienssKey(billId);
// 等待一段时间再检查
Thread.sleep(1000); // 等待1秒
// 判断单据是否在流程中 // 判断单据是否在流程中
boolean inProcess = WorkflowServiceHelper.inProcess(billId); boolean inProcess = WorkflowServiceHelper.inProcess(billId);
// 如果不在流程中返回true // 如果不在流程中返回true
if (!inProcess) { if (inProcess) {
logger.info("流程中断成功单据ID: {}", billId); logger.info("流程中断成功单据ID: {}", billId);
return true; return true;
} }
// 如果仍在流程中增加重试次数 // 如果仍在流程中增加重试次数
retryCount++; retryCount++;
logger.warn("流程中断失败,第{}次重试单据ID: {}", retryCount, billId); logger.warn("流程中断失败,第{}次重试单据ID: {}", retryCount, billId);
// 如果还没达到最大重试次数等待更长时间 // 如果还没达到最大重试次数等待更长时间
if (retryCount < maxRetries) { if (retryCount < maxRetries) {
Thread.sleep(1000L * retryCount); // 逐步增加等待时间 Thread.sleep(1000L); // 逐步增加等待时间
} }
} catch (Exception e) { } catch (Exception e) {