|
|
|
@ -51,31 +51,38 @@ public class MesConfigService implements IMesConfigService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Boolean checkCfgValueIsContainItem(String organizeCode, String cfgCode, String cfgKey, String cfgType, String splitStr, String item) {
|
|
|
|
|
public List<MesConfig> getConfigList(String organizeCode, String cfgCode, String cfgKey, String cfgType) {
|
|
|
|
|
DdlPackBean packBean = DdlPackBean.getDdlPackBean(organizeCode);
|
|
|
|
|
DdlPreparedPack.getStringEqualPack(cfgCode, MesExtConstWords.CFG_CODE, packBean);
|
|
|
|
|
DdlPreparedPack.getStringEqualPack(cfgKey, MesExtConstWords.CFG_KEY, packBean);
|
|
|
|
|
DdlPreparedPack.getStringEqualPack(cfgType, MesExtConstWords.CFG_TYPE, packBean);
|
|
|
|
|
MesConfig config = configRepository.getByProperty(packBean);
|
|
|
|
|
if (null == config || StringUtils.isEmpty(config.getCfgValue())) return false;
|
|
|
|
|
List<String> cfgValueList = Arrays.asList(config.getCfgValue().split(splitStr));
|
|
|
|
|
return configRepository.findByHqlWhere(packBean);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Boolean checkCfgValueIsContainItem(String organizeCode, String cfgCode, String cfgKey, String cfgType, String splitStr, String item) {
|
|
|
|
|
String cfgValue = getAndMergeCfgValue(organizeCode, cfgCode, cfgKey, cfgType, splitStr);
|
|
|
|
|
if (StringUtils.isEmpty(cfgValue)) return false;
|
|
|
|
|
List<String> cfgValueList = Arrays.asList(cfgValue.split(splitStr));
|
|
|
|
|
return (!CollectionUtils.isEmpty(cfgValueList) && cfgValueList.contains(item)) ? true : false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private String getAndMergeCfgValue(String organizeCode, String cfgCode, String cfgKey, String cfgType, String splitStr) {
|
|
|
|
|
List<MesConfig> configList = getConfigList(organizeCode, cfgCode, cfgKey, cfgType);
|
|
|
|
|
if (CollectionUtils.isEmpty(configList)) return null;
|
|
|
|
|
return configList.stream().filter(o -> (null != o && !StringUtils.isEmpty(o.getCfgValue()))).map(MesConfig::getCfgValue).collect(Collectors.joining(splitStr));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Boolean checkShardingTablesObjectCfg(String organizeCode, String cfgKey, String item) {
|
|
|
|
|
return checkCfgValueIsContainItem(organizeCode, MesExtConstWords.MES_SHARDING_TABLES_OBJECT_CFG, cfgKey, CommonEnumUtil.SOFT_TYPE.MES.name(), MesExtConstWords.SEMICOLON, item);
|
|
|
|
|
return checkCfgValueIsContainItem(organizeCode, MesExtConstWords.MES_SHARDING_TABLES_OBJECT_CFG, cfgKey, CommonEnumUtil.SOFT_TYPE.MES.name(), MesExtConstWords.COMMA, item);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<String> findCfgValueContainItem(String organizeCode, String cfgCode, String cfgKey, String cfgType, String splitStr, List<String> itemList) {
|
|
|
|
|
DdlPackBean packBean = DdlPackBean.getDdlPackBean(organizeCode);
|
|
|
|
|
DdlPreparedPack.getStringEqualPack(cfgCode, MesExtConstWords.CFG_CODE, packBean);
|
|
|
|
|
DdlPreparedPack.getStringEqualPack(cfgKey, MesExtConstWords.CFG_KEY, packBean);
|
|
|
|
|
DdlPreparedPack.getStringEqualPack(cfgType, MesExtConstWords.CFG_TYPE, packBean);
|
|
|
|
|
MesConfig config = configRepository.getByProperty(packBean);
|
|
|
|
|
if (null == config || StringUtils.isEmpty(config.getCfgValue())) return null;
|
|
|
|
|
List<String> cfgValueList = Arrays.asList(config.getCfgValue().split(splitStr));
|
|
|
|
|
String cfgValue = getAndMergeCfgValue(organizeCode, cfgCode, cfgKey, cfgType, splitStr);
|
|
|
|
|
if (StringUtils.isEmpty(cfgValue)) return null;
|
|
|
|
|
List<String> cfgValueList = Arrays.asList(cfgValue.split(splitStr));
|
|
|
|
|
if (CollectionUtils.isEmpty(cfgValueList)) return null;
|
|
|
|
|
return itemList.stream().filter(cfgValueList::contains).collect(Collectors.toList());
|
|
|
|
|
}
|
|
|
|
@ -83,7 +90,7 @@ public class MesConfigService implements IMesConfigService {
|
|
|
|
|
@Override
|
|
|
|
|
public List<String> findShardingTablesObjectCfg(String organizeCode, String cfgKey, List<String> itemList) {
|
|
|
|
|
if(CollectionUtils.isEmpty(itemList)) return null;
|
|
|
|
|
return findCfgValueContainItem(organizeCode, MesExtConstWords.MES_SHARDING_TABLES_OBJECT_CFG, cfgKey, CommonEnumUtil.SOFT_TYPE.MES.name(), MesExtConstWords.SEMICOLON, itemList);
|
|
|
|
|
return findCfgValueContainItem(organizeCode, MesExtConstWords.MES_SHARDING_TABLES_OBJECT_CFG, cfgKey, CommonEnumUtil.SOFT_TYPE.MES.name(), MesExtConstWords.COMMA, itemList);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|