| | |
| | | import com.zy.common.entity.Parameter; |
| | | import com.zy.system.entity.Config; |
| | | import com.zy.system.service.ConfigService; |
| | | import com.zy.common.utils.RedisUtil; |
| | | import com.zy.core.enums.RedisKeyType; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | |
| | | |
| | | @Autowired |
| | | private ConfigService configService; |
| | | @Autowired |
| | | private RedisUtil redisUtil; |
| | | |
| | | @RequestMapping(value = "/config/refreshCache") |
| | | @ManagerAuth |
| | | public R refreshCache(){ |
| | | HashMap<String, String> systemConfigMap = new HashMap<>(); |
| | | List<Config> configList = configService.selectList(new EntityWrapper<>()); |
| | | for (Config config : configList) { |
| | | systemConfigMap.put(config.getCode(), config.getValue()); |
| | | } |
| | | redisUtil.set(RedisKeyType.SYSTEM_CONFIG_MAP.key, systemConfigMap); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/config/{id}/auth") |
| | | @ManagerAuth |
| | |
| | | return R.ok(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/config/getSelectTypes") |
| | | @ManagerAuth |
| | | public R getSelectTypes() { |
| | | EntityWrapper<Config> wrapper = new EntityWrapper<>(); |
| | | wrapper.setSqlSelect("DISTINCT select_type as selectType"); |
| | | wrapper.isNotNull("select_type"); |
| | | List<Map<String, Object>> maps = configService.selectMaps(wrapper); |
| | | List<String> types = new ArrayList<>(); |
| | | for (Map<String, Object> map : maps) { |
| | | if (map != null && map.get("selectType") != null) { |
| | | types.add(String.valueOf(map.get("selectType"))); |
| | | } |
| | | } |
| | | return R.ok(types); |
| | | } |
| | | |
| | | |
| | | private static boolean checkJson(String val){ |
| | | Object parse = null; |