修改cusBaseAction,新增使用非全局requestInfo对象获取数据方法,防 止多线程下出现问题

dev
youHong.ai 2022-12-06 13:08:57 +08:00
parent d5b0805ea5
commit 6f1e24a274
1 changed files with 49 additions and 6 deletions

View File

@ -30,7 +30,7 @@ public abstract class CusBaseAction implements Action {
/**
* requestInfo
*/
protected RequestInfo requestInfo;
protected RequestInfo globalRequestInfo;
/**
* <h2></h2>
@ -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;
}
;
/**
* <h2></h2>
@ -199,9 +197,26 @@ public abstract class CusBaseAction implements Action {
*
* @return
*/
@Deprecated
protected Map<String, String> getMainTableValue() {
// 获取主表数据
Property[] propertyArr = globalRequestInfo.getMainTableInfo().getProperty();
return getStringMap(propertyArr);
}
/**
* <h2></h2>
*
* @return
*/
protected Map<String, String> getMainTableValue(RequestInfo requestInfo) {
// 获取主表数据
Property[] propertyArr = requestInfo.getMainTableInfo().getProperty();
return getStringMap(propertyArr);
}
@NotNull
private Map<String, String> getStringMap(Property[] propertyArr) {
if (null == propertyArr) {
return Collections.emptyMap();
}
@ -220,8 +235,25 @@ public abstract class CusBaseAction implements Action {
*
* @return
*/
@Deprecated
protected Map<String, List<Map<String, String>>> getDetailTableValue() {
DetailTable[] detailTableArr = globalRequestInfo.getDetailTableInfo().getDetailTable();
return getListMap(detailTableArr);
}
/**
* <h2></h2>
*
* @return
*/
protected Map<String, List<Map<String, String>>> getDetailTableValue(RequestInfo requestInfo) {
DetailTable[] detailTableArr = requestInfo.getDetailTableInfo().getDetailTable();
return getListMap(detailTableArr);
}
@NotNull
private Map<String, List<Map<String, String>>> getListMap(DetailTable[] detailTableArr) {
Map<String, List<Map<String, String>>> detailDataList = new HashMap<>((int) Math.ceil(detailTableArr.length * 1.4));
for (DetailTable detailTable : detailTableArr) {
List<Map<String, String>> detailData = getDetailValue(detailTable);
@ -237,10 +269,21 @@ public abstract class CusBaseAction implements Action {
* @param detailNo
* @return
*/
@Deprecated
protected List<Map<String, String>> getDetailTableValueByDetailNo(int detailNo) {
DetailTable detailTable = globalRequestInfo.getDetailTableInfo().getDetailTable(detailNo);
return getDetailValue(detailTable);
}
/**
* <h2></h2>
*
* @param detailNo
* @return
*/
protected List<Map<String, String>> getDetailTableValueByDetailNo(int detailNo, RequestInfo requestInfo) {
DetailTable detailTable = requestInfo.getDetailTableInfo().getDetailTable(detailNo);
List<Map<String, String>> detailData = getDetailValue(detailTable);
return detailData;
return getDetailValue(detailTable);
}
/**