From 21b6a017328ef80e442d443c2bfa056685c30e94 Mon Sep 17 00:00:00 2001 From: chenshaoxin <1981897232@qq.com> Date: Mon, 16 Jun 2025 17:38:29 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BA=BA=EF=BC=9A=E9=99=88?= =?UTF-8?q?=E7=BB=8D=E9=91=AB=20=E6=97=A5=E6=9C=9F=EF=BC=9A2025/6/16=2017?= =?UTF-8?q?=EF=BC=9A30=20=E5=86=85=E5=AE=B9:=E6=93=8D=E4=BD=9C=E5=86=B7?= =?UTF-8?q?=E5=8D=B4=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../operation/ElectronicPayDealOPPlugin.java | 62 +++++++++---------- .../operation/domain/TimeValidator.java | 35 ++++++----- 2 files changed, 50 insertions(+), 47 deletions(-) diff --git a/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/plugin/operation/ElectronicPayDealOPPlugin.java b/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/plugin/operation/ElectronicPayDealOPPlugin.java index 2d78595..1daaf8e 100644 --- a/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/plugin/operation/ElectronicPayDealOPPlugin.java +++ b/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/plugin/operation/ElectronicPayDealOPPlugin.java @@ -10,13 +10,11 @@ import kd.bos.entity.plugin.args.AfterOperationArgs; import kd.bos.entity.plugin.args.BeforeOperationArgs; import kd.bos.entity.plugin.args.BeginOperationTransactionArgs; import kd.bos.entity.plugin.args.ReturnOperationArgs; -import kd.bos.entity.validate.AbstractValidator; -import kd.bos.entity.validate.ValidatePriority; -import kd.bos.entity.validate.ValidateResult; -import kd.bos.entity.validate.ValidateResultCollection; +import kd.bos.entity.validate.*; import kd.bos.logging.Log; import kd.bos.logging.LogFactory; import kd.sdk.plugin.Plugin; +import shkd.sys.sys.plugin.list.ElectronicPayDealListPlugin; import shkd.sys.sys.plugin.operation.domain.TimeValidator; import java.time.Duration; @@ -33,14 +31,14 @@ public class ElectronicPayDealOPPlugin extends AbstractOperationServicePlugIn im @Override public void onPreparePropertys(PreparePropertysEventArgs e) { super.onPreparePropertys(e); - Iterator> iterator = timemap.entrySet().iterator(); - while (iterator.hasNext()) { - Map.Entry entry = iterator.next(); - Duration duration = Duration.between(entry.getValue(), LocalDateTime.now()); - if (duration.getSeconds() > 10) { - iterator.remove(); - } - } +// Iterator> iterator = timemap.entrySet().iterator(); +// while (iterator.hasNext()) { +// Map.Entry entry = iterator.next(); +// Duration duration = Duration.between(entry.getValue(), LocalDateTime.now()); +// if (duration.getSeconds() > 10) { +// iterator.remove(); +// } +// } } @Override @@ -78,25 +76,25 @@ public class ElectronicPayDealOPPlugin extends AbstractOperationServicePlugIn im @Override public void onReturnOperation(ReturnOperationArgs e) { - List overtime = new ArrayList<>();//存放因连续点击而校验失败的数据 - super.onReturnOperation(e); - ValidateResultCollection validateResult = this.operationResult.getValidateResult(); - List validateErrors = validateResult.getValidateErrors(); - for (ValidateResult validateError : validateErrors) { - List allErrorInfo = validateError.getAllErrorInfo(); - for (OperateErrorInfo operateErrorInfo : allErrorInfo) { - String message = operateErrorInfo.getMessage(); - if (message.contains("当前单据已更新操作结果,请十秒后再更新")){ - overtime.add(operateErrorInfo.getPkValue()); - } - } - } - List successPkIds = e.getOperationResult().getSuccessPkIds();//执行成功的数据 - Map billNos = ((OperationResult) e.getOperationResult()).getBillNos(); - billNos.keySet().removeAll(successPkIds); - billNos.keySet().removeAll(overtime); - for (Object key : billNos.keySet()) { - timemap.remove(key); - } +// List overtime = new ArrayList<>();//存放因连续点击而校验失败的数据 +// super.onReturnOperation(e); +// ValidateResultCollection validateResult = this.operationResult.getValidateResult(); +// List validateErrors = validateResult.getValidateErrors(); +// for (ValidateResult validateError : validateErrors) { +// List allErrorInfo = validateError.getAllErrorInfo(); +// for (OperateErrorInfo operateErrorInfo : allErrorInfo) { +// String message = operateErrorInfo.getMessage(); +// if (message.contains("当前单据已更新操作结果,请十秒后再更新")){ +// overtime.add(operateErrorInfo.getPkValue()); +// } +// } +// } +// List successPkIds = e.getOperationResult().getSuccessPkIds();//执行成功的数据 +// Map billNos = ((OperationResult) e.getOperationResult()).getBillNos();//用于存放要去除的数据 +// billNos.keySet().removeAll(successPkIds); +// billNos.keySet().removeAll(overtime); +// for (Object key : billNos.keySet()) { +// timemap.remove(key); +// } } } diff --git a/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/plugin/operation/domain/TimeValidator.java b/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/plugin/operation/domain/TimeValidator.java index 84fa633..041ee7c 100644 --- a/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/plugin/operation/domain/TimeValidator.java +++ b/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/plugin/operation/domain/TimeValidator.java @@ -20,21 +20,26 @@ public class TimeValidator extends AbstractValidator { for(ExtendedDataEntity obj :dataEntities){ DynamicObject bill = obj.getDataEntity();//获取当前单据的数据包 Long id = bill.getLong("id");//进一步获取编码字段 - Map timemap = ElectronicPayDealOPPlugin.timemap; - LocalDateTime localDateTime = timemap.get(id); - LocalDateTime currentTime = LocalDateTime.now(); - if (localDateTime!=null){ - - Duration duration = Duration.between(localDateTime, currentTime); - // 判断时间差是否超过 10 秒 - if (duration.getSeconds() <= 10) { - this.addMessage(obj,"当前单据已更新操作结果,请十秒后再更新", ErrorLevel.Error);//错误消息 - timemap.put(id,localDateTime); - }else { - timemap.put(id,currentTime); - } - }else { - timemap.put(id,currentTime); +// Map timemap = ElectronicPayDealOPPlugin.timemap; +// LocalDateTime localDateTime = timemap.get(id); +// LocalDateTime currentTime = LocalDateTime.now(); +// if (localDateTime!=null){ +// +// Duration duration = Duration.between(localDateTime, currentTime); +// // 判断时间差是否超过 10 秒 +// if (duration.getSeconds() <= 10) { +// this.addMessage(obj,"当前单据已更新操作结果,请十秒后再更新", ErrorLevel.Error);//错误消息 +// timemap.put(id,localDateTime); +// }else { +// timemap.put(id,currentTime); +// } +// }else { +// timemap.put(id,currentTime); +// } + DynamicObject dynamicObject = BusinessDataServiceHelper.loadSingle(id, obj.getDataEntity().getDataEntityType().getName()); + boolean shkd_lock = dynamicObject.getBoolean("shkd_lock"); + if (shkd_lock){ + this.addMessage(obj,"当前单据已锁定", ErrorLevel.Error);//错误消息 } }