From 6f1e24a274681da3bfeb73a3e67392b027be29e8 Mon Sep 17 00:00:00 2001 From: "youHong.ai" <774495953@qq.com> Date: Tue, 6 Dec 2022 13:08:57 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9cusBaseAction=EF=BC=8C?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E4=BD=BF=E7=94=A8=E9=9D=9E=E5=85=A8=E5=B1=80?= =?UTF-8?q?requestInfo=E5=AF=B9=E8=B1=A1=E8=8E=B7=E5=8F=96=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E6=96=B9=E6=B3=95=EF=BC=8C=E9=98=B2=20=E6=AD=A2?= =?UTF-8?q?=E5=A4=9A=E7=BA=BF=E7=A8=8B=E4=B8=8B=E5=87=BA=E7=8E=B0=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/aiyh/utils/action/CusBaseAction.java | 55 +++++++++++++++++-- 1 file changed, 49 insertions(+), 6 deletions(-) diff --git a/src/main/java/aiyh/utils/action/CusBaseAction.java b/src/main/java/aiyh/utils/action/CusBaseAction.java index 4fb3b80..9b114a6 100644 --- a/src/main/java/aiyh/utils/action/CusBaseAction.java +++ b/src/main/java/aiyh/utils/action/CusBaseAction.java @@ -30,7 +30,7 @@ public abstract class CusBaseAction implements Action { /** * 全局requestInfo对象 */ - protected RequestInfo requestInfo; + protected RequestInfo globalRequestInfo; /** *

初始化流程默认的处理方法

@@ -49,7 +49,7 @@ public abstract class CusBaseAction implements Action { @Override public final String execute(RequestInfo requestInfo) { - this.requestInfo = requestInfo; + this.globalRequestInfo = requestInfo; RequestManager requestManager = requestInfo.getRequestManager(); String billTable = requestManager.getBillTableName(); String requestId = requestInfo.getRequestid(); @@ -111,8 +111,6 @@ public abstract class CusBaseAction implements Action { return true; } - ; - /** *

流程其他流转类型处理方法注册

@@ -199,9 +197,26 @@ public abstract class CusBaseAction implements Action { * * @return 流程主表数据 */ + @Deprecated protected Map getMainTableValue() { +// 获取主表数据 + Property[] propertyArr = globalRequestInfo.getMainTableInfo().getProperty(); + return getStringMap(propertyArr); + } + + /** + *

获取流程主表数据

+ * + * @return 流程主表数据 + */ + protected Map getMainTableValue(RequestInfo requestInfo) { // 获取主表数据 Property[] propertyArr = requestInfo.getMainTableInfo().getProperty(); + return getStringMap(propertyArr); + } + + @NotNull + private Map getStringMap(Property[] propertyArr) { if (null == propertyArr) { return Collections.emptyMap(); } @@ -220,8 +235,25 @@ public abstract class CusBaseAction implements Action { * * @return 以明细表需要为键,以明细表数据为值的键值对明细数据信息 */ + @Deprecated protected Map>> getDetailTableValue() { + DetailTable[] detailTableArr = globalRequestInfo.getDetailTableInfo().getDetailTable(); + return getListMap(detailTableArr); + } + + /** + *

获取所有明细数据

+ * + * @return 以明细表需要为键,以明细表数据为值的键值对明细数据信息 + */ + protected Map>> getDetailTableValue(RequestInfo requestInfo) { DetailTable[] detailTableArr = requestInfo.getDetailTableInfo().getDetailTable(); + return getListMap(detailTableArr); + } + + + @NotNull + private Map>> getListMap(DetailTable[] detailTableArr) { Map>> detailDataList = new HashMap<>((int) Math.ceil(detailTableArr.length * 1.4)); for (DetailTable detailTable : detailTableArr) { List> detailData = getDetailValue(detailTable); @@ -237,10 +269,21 @@ public abstract class CusBaseAction implements Action { * @param detailNo 明细表编号 * @return 明细数据 */ + @Deprecated protected List> getDetailTableValueByDetailNo(int detailNo) { + DetailTable detailTable = globalRequestInfo.getDetailTableInfo().getDetailTable(detailNo); + return getDetailValue(detailTable); + } + + /** + *

获取指定明细表的表数据

+ * + * @param detailNo 明细表编号 + * @return 明细数据 + */ + protected List> getDetailTableValueByDetailNo(int detailNo, RequestInfo requestInfo) { DetailTable detailTable = requestInfo.getDetailTableInfo().getDetailTable(detailNo); - List> detailData = getDetailValue(detailTable); - return detailData; + return getDetailValue(detailTable); } /**