37_GrpParaUtil
`import com.reserve.cang.core.sys.domain.DataDicDomain;
import com.reserve.cang.core.sys.service.CacheDataDicService;
import com.reserve.cang.model.sys.ParameterGroupDetail;
import com.reserve.cang.utils.SpringContext;
import org.apache.commons.beanutils.BeanUtils;
import org.apache.commons.lang3.StringUtils;
import java.util.Set;
/**
-
缓存数据字典常用类
-
@version 1.0
*/
public class GrpParaUtil {/**
- 年会人脸识别相关参数配置
**/
public static final String AM_FACE_CONFIG = "SP000167";
/**
- 摄像头类型_品牌_型号_使用方法配置
**/
public static final String DEVICE_CAMERA_CONFIG = "SP000171";
/**
- 设备拍照分割数
*/
public static final String IMG_SPLIT_NUM = "SP000179";
private static CacheDataDicService service = null;
/**
- 在缓存中根据key返回集合参数表中配置值
- @param groupCode
- @return
*/
public static Setget(String groupCode) {
if (StringUtils.isBlank(groupCode)) return null;
return getService().selectCacheDataDictInfo(groupCode).getDataDicDetails();
}
/**
- 在缓存中根据key返回集合参数表中配置值
- @param groupCode
- @return
*/
public static DataDicDomain getMain(String groupCode) {
if (StringUtils.isBlank(groupCode)) return null;
return getService().selectCacheDataDictInfo(groupCode);
}
/**
- 在缓存中根据主项编号和子项值查找name
*/
public static String getName(String groupCode, String value) {
if (StringUtils.isBlank(groupCode) || StringUtils.isBlank(value)) return "";
Set_vs = getService().selectCacheDataDictInfo(groupCode).getDataDicDetails();
ParameterGroupDetail _dest = new ParameterGroupDetail();
try {
for (ParameterGroupDetail _d : _vs) {
if (value.equalsIgnoreCase(_d.getSvalue())) {
BeanUtils.copyProperties(_dest, _d);
break;
}
}
} catch (Exception e) {
e.printStackTrace();
}
if (_dest == null)
return "";
return _dest.getSname();
}
/**
- 在缓存中根据主项编号和子项值查找说明
*/
public static String getExplainForValue(String groupCode, String value) {
if (StringUtils.isBlank(groupCode) || StringUtils.isBlank(value)) return "";
Set_vs = getService().selectCacheDataDictInfo(groupCode).getDataDicDetails();
ParameterGroupDetail _dest = new ParameterGroupDetail();
try {
for (ParameterGroupDetail _d : _vs) {
if (value.equalsIgnoreCase(_d.getSvalue())) {
BeanUtils.copyProperties(_dest, _d);
break;
}
}
} catch (Exception e) {
e.printStackTrace();
}
if (_dest == null)
return "";
return _dest.getSremark();
}
/**
- 在缓存中根据主项编号和子项名称查出详情
*/
public static ParameterGroupDetail getDetailForName(String groupCode, String name) {
if (StringUtils.isBlank(groupCode) || StringUtils.isBlank(name)) return null;
Set_vs = getService().selectCacheDataDictInfo(groupCode).getDataDicDetails();
ParameterGroupDetail _dest = new ParameterGroupDetail();
try {
for (ParameterGroupDetail _d : _vs) {
if (name.equalsIgnoreCase(_d.getSname())) {
BeanUtils.copyProperties(_dest, _d);
break;
}
}
} catch (Exception e) {
e.printStackTrace();
}
return _dest;
}
/**
- 在缓存中根据主项编号和子项值查出详情
*/
public static ParameterGroupDetail getDetailForValue(String groupCode, String value) {
if (StringUtils.isBlank(groupCode) || StringUtils.isBlank(value)) return null;
Set_vs = getService().selectCacheDataDictInfo(groupCode).getDataDicDetails();
ParameterGroupDetail _dest = new ParameterGroupDetail();
try {
for (ParameterGroupDetail _d : _vs) {
if (value.equalsIgnoreCase(_d.getSvalue())) {
BeanUtils.copyProperties(_dest, _d);
break;
}
}
} catch (Exception e) {
e.printStackTrace();
}
return _dest;
}
/**
- 在缓存中根据主项编号和子项名查找说明
*/
public static String getExplain(String groupCode, String name) {
if (StringUtils.isBlank(groupCode) || StringUtils.isBlank(name)) return "";
Set_vs = getService().selectCacheDataDictInfo(groupCode).getDataDicDetails();
ParameterGroupDetail _dest = new ParameterGroupDetail();
try {
for (ParameterGroupDetail _d : _vs) {
if (name.equalsIgnoreCase(_d.getSname())) {
BeanUtils.copyProperties(_dest, _d);
break;
}
}
} catch (Exception e) {
e.printStackTrace();
}
if (_dest == null)
return "";
return _dest.getSremark();
}
/**
- 在缓存中根据关键字和名字查找值
*/
public static String getValue(String groupCode, String name) {
if (StringUtils.isBlank(groupCode) || StringUtils.isBlank(name)) return "";
ParameterGroupDetail dtl = getService().selectCacheParamGroupDetailInfo(groupCode, name);
if (dtl == null) return "";
return dtl.getSvalue();
}
/***
- 初始化Bean
*/
private static CacheDataDicService getService() {
if (service == null) {
service = SpringContext.getBean("dataDicServiceImpl");
}
return service;
}
}
`
- 年会人脸识别相关参数配置

浙公网安备 33010602011771号