| | |
| | | package com.yeshi.fanli.service.impl.config;
|
| | |
|
| | | import java.util.ArrayList;
|
| | | import java.util.Arrays;
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | |
|
| | |
| | | import com.yeshi.fanli.entity.config.AppHomeFloatImg;
|
| | | import com.yeshi.fanli.entity.system.ConfigKeyEnum;
|
| | | import com.yeshi.fanli.entity.xcx.XCXSettingConfig;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.config.ConfigService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | |
| | |
|
| | | @Resource
|
| | | private ConfigMapper configMapper;
|
| | | |
| | |
|
| | | @Cacheable(value = "config")
|
| | | public List<Config> getAllList() {
|
| | |
| | | @Transactional
|
| | | public void update(List<Config> list) {
|
| | | for (Config config : list) {
|
| | | if (config.getValue() == null) {
|
| | | config.setValue("");
|
| | | }
|
| | | config.setCreatetime(new Date().getTime() + "");
|
| | | configMapper.updateByPrimaryKeySelective(config);
|
| | | }
|
| | |
| | |
|
| | | @CacheEvict(value = "config", allEntries = true)
|
| | | public void update(Config config) {
|
| | | if (config.getValue() == null)
|
| | | config.setValue("");
|
| | | |
| | | config.setCreatetime(new Date().getTime() + "");
|
| | | configMapper.updateByPrimaryKeySelective(config);
|
| | | }
|
| | |
| | | return value;
|
| | | }
|
| | |
|
| | | |
| | | @Cacheable(value = "config", key = "'isRobotCloudOpen'+'-'+#key")
|
| | | @Override
|
| | | public boolean isRobotCloudOpen(String key) {
|
| | | String value = get(key);
|
| | | if (StringUtil.isNullOrEmpty(value))
|
| | | return false;
|
| | | if ("1".equalsIgnoreCase(value.trim())) {
|
| | | return true;
|
| | | } else {
|
| | | return false;
|
| | | }
|
| | | }
|
| | |
|
| | |
|
| | | |
| | | @Cacheable(value = "config", key = "'getTestUsers'")
|
| | | @Override
|
| | | public List<String> getTestUsers() {
|
| | | String value = get(ConfigKeyEnum.testUserArray.getKey());
|
| | | if (StringUtil.isNullOrEmpty(value))
|
| | | return null;
|
| | | try {
|
| | | return Arrays.asList(value.split(","));
|
| | | } catch (Exception e) {
|
| | | LogHelper.errorDetailInfo(e);
|
| | | }
|
| | | return null;
|
| | | }
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | @Override
|
| | | public Config getConfig(long id) {
|
| | | return configMapper.selectByPrimaryKey(id);
|
| | |
| | | config.setCreatetime(currentTime + "");
|
| | | configMapper.updateByPrimaryKeySelective(config);
|
| | | }
|
| | | |
| | | |
| | | @Override
|
| | | public Config getConfigBykeyNoCache(String key) {
|
| | | List<Config> list = configMapper.listByKey(key, null, null);
|
| | | if (list.size() == 0) {
|
| | | return null;
|
| | | }
|
| | | return list.get(0);
|
| | | }
|
| | | }
|