Commit 1e915792 by 宋祥

1.数据集支持初始化参数

parent e3d7c1fd
package com.baosight.hggp.common; package com.baosight.hggp.common;
import com.baosight.hggp.core.enums.OrgTypeEnum;
import java.util.HashMap;
import java.util.Map;
/** /**
* @Author wwl * @Author wwl
* @Date 2024/1/9 19:35 * @Date 2024/1/9 19:35
...@@ -63,14 +68,16 @@ public enum DdynamicEnum { ...@@ -63,14 +68,16 @@ public enum DdynamicEnum {
* 编写:yk * 编写:yk
*/ */
USER_BLOCK_ID("user_block_id","loginName","userName","HGXSUser.queryComboBox"), USER_BLOCK_ID("user_block_id","loginName","userName","HGXSUser.queryComboBox"),
/** /**
* 模块:系统管理 * 模块:系统管理
* 用途:部门 * 用途:部门
* 编写:ly * 编写:ly
*/ */
DEPT_CODE_BLOCK_ID("dept_code_block_id", "orgId", "orgCname", "factoryCode", "factoryName", "companyCode", DEPT_CODE_BLOCK_ID("dept_code_block_id", "orgId", "orgCname", "factoryCode", "factoryName", "companyCode",
"companyName", "HGXSOrg.queryAll"), "companyName", "HGXSOrg.queryAll", new HashMap() {{
put("orgType", OrgTypeEnum.DEPT.getCode());
}}),
/** /**
* 模块:系统管理 * 模块:系统管理
...@@ -78,14 +85,20 @@ public enum DdynamicEnum { ...@@ -78,14 +85,20 @@ public enum DdynamicEnum {
* 编写:ly * 编写:ly
*/ */
FACTORY_CODE_BLOCK_ID("factory_code_block_id", "orgId", "orgCname", "companyCode", FACTORY_CODE_BLOCK_ID("factory_code_block_id", "orgId", "orgCname", "companyCode",
"companyName", "HGXSOrg.queryAll"), "companyName", "HGXSOrg.queryAll", new HashMap() {{
put("orgType", OrgTypeEnum.FACTORY.getCode());
}}),
/** /**
* 模块:系统管理 * 模块:系统管理
* 用途:公司查询 * 用途:公司查询
* 编写:ly * 编写:ly
*/ */
COMPANY_CODE_BLOCK_ID("company_code_block_id", "orgId", "orgCname", "HGXSOrg.queryAll"), COMPANY_CODE_BLOCK_ID("company_code_block_id", "orgId", "orgCname", "HGXSOrg.queryAll",
new HashMap() {{
put("orgType", OrgTypeEnum.COMPANY.getCode());
}}
),
/** /**
* 模块:公司名称 * 模块:公司名称
...@@ -132,6 +145,8 @@ public enum DdynamicEnum { ...@@ -132,6 +145,8 @@ public enum DdynamicEnum {
/** 数据源 */ /** 数据源 */
private final String dbSource; private final String dbSource;
private Map paramMap;
DdynamicEnum(String blockId, String value, String text, String param1, String dbSource) { DdynamicEnum(String blockId, String value, String text, String param1, String dbSource) {
this.blockId = blockId; this.blockId = blockId;
this.value = value; this.value = value;
...@@ -148,8 +163,19 @@ public enum DdynamicEnum { ...@@ -148,8 +163,19 @@ public enum DdynamicEnum {
this.param2 = param2; this.param2 = param2;
this.dbSource = dbSource; this.dbSource = dbSource;
} }
DdynamicEnum(String blockId, String value, String text, String param1, String param2, String param3, String dbSource) { DdynamicEnum(String blockId, String value, String text, String param1, String param2, String dbSource,
Map paramMap) {
this.blockId = blockId;
this.value = value;
this.text = text;
this.param1 = param1;
this.param2 = param2;
this.dbSource = dbSource;
this.paramMap = paramMap;
}
DdynamicEnum(String blockId, String value, String text, String param1, String param2, String param3, String dbSource) {
this.blockId = blockId; this.blockId = blockId;
this.value = value; this.value = value;
this.text = text; this.text = text;
...@@ -169,8 +195,21 @@ public enum DdynamicEnum { ...@@ -169,8 +195,21 @@ public enum DdynamicEnum {
this.param4 = param4; this.param4 = param4;
this.dbSource = dbSource; this.dbSource = dbSource;
} }
DdynamicEnum(String blockId, String value, String text, String param1, String param2, String param3, String param4, String param5, String dbSource) { DdynamicEnum(String blockId, String value, String text, String param1, String param2, String param3,
String param4, String dbSource, Map paramMap) {
this.blockId = blockId;
this.value = value;
this.text = text;
this.param1 = param1;
this.param2 = param2;
this.param3 = param3;
this.param4 = param4;
this.dbSource = dbSource;
this.paramMap = paramMap;
}
DdynamicEnum(String blockId, String value, String text, String param1, String param2, String param3, String param4, String param5, String dbSource) {
this.blockId = blockId; this.blockId = blockId;
this.value = value; this.value = value;
this.text = text; this.text = text;
...@@ -212,17 +251,42 @@ public enum DdynamicEnum { ...@@ -212,17 +251,42 @@ public enum DdynamicEnum {
this.param9 = param9; this.param9 = param9;
this.dbSource = dbSource; this.dbSource = dbSource;
} }
DdynamicEnum(String blockId, String value, String text, String dbSource){ DdynamicEnum(String blockId, String value, String text, String param1, String param2, String param3,
String param4, String param5, String param6, String param7, String param8, String param9,
String dbSource, Map paramMap) {
this.blockId = blockId;
this.value = value;
this.text = text;
this.param1 = param1;
this.param2 = param2;
this.param3 = param3;
this.param4 = param4;
this.param5 = param5;
this.param6 = param6;
this.param7 = param7;
this.param8 = param8;
this.param9 = param9;
this.dbSource = dbSource;
this.paramMap = paramMap;
}
DdynamicEnum(String blockId, String value, String text, String dbSource){
this.blockId = blockId; this.blockId = blockId;
this.value = value; this.value = value;
this.text = text; this.text = text;
this.dbSource = dbSource; this.dbSource = dbSource;
} }
DdynamicEnum(String blockId, String value, String text, String dbSource, Map paramMap) {
this.blockId = blockId;
public String getDbSource() { this.value = value;
this.text = text;
this.dbSource = dbSource;
this.paramMap = paramMap;
}
public String getDbSource() {
return dbSource; return dbSource;
} }
...@@ -309,4 +373,9 @@ public enum DdynamicEnum { ...@@ -309,4 +373,9 @@ public enum DdynamicEnum {
public void setParam9(String param9) { public void setParam9(String param9) {
this.param9 = param9; this.param9 = param9;
} }
public Map getParamMap() {
return paramMap;
}
} }
...@@ -30,7 +30,16 @@ import java.util.Map; ...@@ -30,7 +30,16 @@ import java.util.Map;
public class CommonMethod { public class CommonMethod {
protected static Dao dao = (Dao) PlatApplicationContext.getBean( "dao" ); protected static Dao dao = (Dao) PlatApplicationContext.getBean( "dao" );
/**
* @param inInfo 前后台交互对象
* @param tableParams 表信息
* 公用下拉方法
*/
public static void initBlock(EiInfo inInfo, List<DdynamicEnum> tableParams){
initBlock(inInfo, tableParams, null,false);
}
/** /**
* @param inInfo 前后台交互对象 * @param inInfo 前后台交互对象
* @param tableParams 表信息 * @param tableParams 表信息
...@@ -69,6 +78,11 @@ public class CommonMethod { ...@@ -69,6 +78,11 @@ public class CommonMethod {
for (DdynamicEnum tableParam : tableParams) { for (DdynamicEnum tableParam : tableParams) {
/* 编辑块名称 */ /* 编辑块名称 */
eiBlock = new EiBlock(tableParam.getBlockId()); eiBlock = new EiBlock(tableParam.getBlockId());
// 合并参数
Map paramMap = tableParam.getParamMap();
if (MapUtils.isNotEmpty(paramMap)) {
selectParams.putAll(paramMap);
}
/* 将所有查询到的结果放到暂存变量中 */ /* 将所有查询到的结果放到暂存变量中 */
results = dao.query(tableParam.getDbSource(), selectParams, EiConstant.defaultOffset, -999999); results = dao.query(tableParam.getDbSource(), selectParams, EiConstant.defaultOffset, -999999);
List<LinkedHashMap> resultRows = new ArrayList<>(); List<LinkedHashMap> resultRows = new ArrayList<>();
......
package com.baosight.xservices.xs.service; package com.baosight.xservices.xs.service;
import com.baosight.hggp.common.DdynamicEnum; import com.baosight.hggp.common.DdynamicEnum;
import com.baosight.hggp.core.enums.OrgTypeEnum;
import com.baosight.hggp.core.security.UserSessionUtils; import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.hg.pz.domain.HGPZ009; import com.baosight.hggp.hg.pz.domain.HGPZ009;
import com.baosight.hggp.hg.pz.tools.HGPZTools; import com.baosight.hggp.hg.pz.tools.HGPZTools;
...@@ -27,7 +26,6 @@ import com.baosight.xservices.xs.util.UserSession; ...@@ -27,7 +26,6 @@ import com.baosight.xservices.xs.util.UserSession;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashMap;
import java.util.Map; import java.util.Map;
/** /**
...@@ -50,15 +48,9 @@ public class ServiceXS3002 extends ServiceEPBase { ...@@ -50,15 +48,9 @@ public class ServiceXS3002 extends ServiceEPBase {
*/ */
public EiInfo initLoad(EiInfo inInfo) { public EiInfo initLoad(EiInfo inInfo) {
try { try {
Map queryMap = new HashMap(); CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.DEPT_CODE_BLOCK_ID));
queryMap.put("orgType", OrgTypeEnum.DEPT.getCode()); CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.FACTORY_CODE_BLOCK_ID));
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.DEPT_CODE_BLOCK_ID), queryMap); CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.COMPANY_CODE_BLOCK_ID));
queryMap = new HashMap();
queryMap.put("orgType", OrgTypeEnum.FACTORY.getCode());
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.FACTORY_CODE_BLOCK_ID), queryMap);
queryMap = new HashMap();
queryMap.put("orgType", OrgTypeEnum.COMPANY.getCode());
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.COMPANY_CODE_BLOCK_ID), queryMap);
} catch (PlatException e) { } catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败"); LogUtils.setDetailMsg(inInfo, e, "初始化失败");
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment