...
|
...
|
@@ -25,28 +25,29 @@ public class ConfigTypeServiceImpl implements IConfigTypeService { |
|
|
@Autowired
|
|
|
private ConfigTypeMapper configTypeMapper;
|
|
|
|
|
|
private final String NormalConfigTypeList_CACHE_KEY= "NormalConfigTypeList";
|
|
|
private final String NormalConfigTypeList_CACHE_KEY = "NormalConfigTypeList";
|
|
|
|
|
|
@PostConstruct
|
|
|
private void init() {
|
|
|
localCache.init(NormalConfigTypeList_CACHE_KEY, 5, TimeUnit.MINUTES, (String s, Object o) -> {
|
|
|
LOGGER.info("NormalConfigTypeList init s = {}, o = {}", s, o);
|
|
|
List<ConfigType> expressCompanies = configTypeMapper.selectAllNormal();
|
|
|
return expressCompanies.stream().collect(Collectors.toMap(ConfigType::getCode,ConfigType::getContent));
|
|
|
return expressCompanies.stream().collect(Collectors.toMap(ConfigType::getCode, ConfigType::getContent));
|
|
|
});
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 获取所有状态正常的配置项
|
|
|
*
|
|
|
* @return
|
|
|
*/
|
|
|
public Map<String,String> configTypeList(){
|
|
|
Map<String,String> map = (Map<String,String>) localCache.get(NormalConfigTypeList_CACHE_KEY);
|
|
|
if (map!=null&&map.size()>0) {
|
|
|
public Map<String, String> configTypeList() {
|
|
|
Map<String, String> map = (Map<String, String>) localCache.get(NormalConfigTypeList_CACHE_KEY);
|
|
|
if (map != null && map.size() > 0) {
|
|
|
return map;
|
|
|
}
|
|
|
List<ConfigType> expressCompanies = configTypeMapper.selectAllNormal();
|
|
|
return expressCompanies.stream().collect(Collectors.toMap(ConfigType::getCode,ConfigType::getContent));
|
|
|
return expressCompanies.stream().collect(Collectors.toMap(ConfigType::getCode, ConfigType::getContent));
|
|
|
}
|
|
|
|
|
|
@Override
|
...
|
...
|
@@ -57,4 +58,12 @@ public class ConfigTypeServiceImpl implements IConfigTypeService { |
|
|
.orElse(null);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public int updateContentByCode(String code, String content) {
|
|
|
ConfigType configType = new ConfigType();
|
|
|
configType.setCode(code);
|
|
|
configType.setContent(content);
|
|
|
return configTypeMapper.updateByCode(configType);
|
|
|
}
|
|
|
|
|
|
} |
...
|
...
|
|