From 7e8fc56cd7171c5629a21906ec840ab2bcac4340 Mon Sep 17 00:00:00 2001 From: zhanghan11 Date: Tue, 9 Apr 2024 17:53:24 +0800 Subject: [PATCH] =?UTF-8?q?=E7=B3=BB=E7=BB=9F=E5=90=8D=E7=A7=B0=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E4=B8=BA=E5=8F=AF=E9=85=8D=E7=BD=AE=E5=90=8E=E5=8F=B0?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/common/CaptchaController.java | 13 +++- .../common/constant/CacheConstants.java | 2 +- .../framework/config/SecurityConfig.java | 2 +- .../impl/IpcAlarmRulesConfigServiceImpl.java | 6 +- .../system/service/ISysConfigService.java | 25 +++++--- .../service/impl/SysConfigServiceImpl.java | 43 ++++++++----- tzipc-ui/src/api/login.js | 62 +++++++++++-------- tzipc-ui/src/views/login.vue | 35 +++++++---- 8 files changed, 120 insertions(+), 68 deletions(-) diff --git a/tzipc-server/tzipc-admin/src/main/java/com/inspur/web/controller/common/CaptchaController.java b/tzipc-server/tzipc-admin/src/main/java/com/inspur/web/controller/common/CaptchaController.java index c98c689..23e2a20 100644 --- a/tzipc-server/tzipc-admin/src/main/java/com/inspur/web/controller/common/CaptchaController.java +++ b/tzipc-server/tzipc-admin/src/main/java/com/inspur/web/controller/common/CaptchaController.java @@ -22,7 +22,7 @@ import com.inspur.system.service.ISysConfigService; /** * 验证码操作处理 - * + * * @author inspur */ @RestController @@ -36,9 +36,18 @@ public class CaptchaController @Autowired private RedisCache redisCache; - + @Autowired private ISysConfigService configService; + + /** + * 获取系统名称 + */ + @GetMapping("/systemName") + public AjaxResult getCode() { + return AjaxResult.success(configService.selectSystemName()); + } + /** * 生成验证码 */ diff --git a/tzipc-server/tzipc-common/src/main/java/com/inspur/common/constant/CacheConstants.java b/tzipc-server/tzipc-common/src/main/java/com/inspur/common/constant/CacheConstants.java index da08ae3..0b6dcb2 100644 --- a/tzipc-server/tzipc-common/src/main/java/com/inspur/common/constant/CacheConstants.java +++ b/tzipc-server/tzipc-common/src/main/java/com/inspur/common/constant/CacheConstants.java @@ -64,7 +64,7 @@ public class CacheConstants /** * 规则配置 redis key */ - public static final String RULE_CONFIG = "rule_config_"; + public static final String RULE_CONFIG = "rule_config:"; /** * ipc缓存过期时间 diff --git a/tzipc-server/tzipc-framework/src/main/java/com/inspur/framework/config/SecurityConfig.java b/tzipc-server/tzipc-framework/src/main/java/com/inspur/framework/config/SecurityConfig.java index d13b4bb..646a557 100644 --- a/tzipc-server/tzipc-framework/src/main/java/com/inspur/framework/config/SecurityConfig.java +++ b/tzipc-server/tzipc-framework/src/main/java/com/inspur/framework/config/SecurityConfig.java @@ -109,7 +109,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter // 过滤请求 .authorizeRequests() // 对于登录login 注册register 验证码captchaImage 允许匿名访问 - .antMatchers("/login", "/register", "/captchaImage").anonymous() + .antMatchers("/login", "/register", "/captchaImage","/systemName").anonymous() // 数据接收接口,允许匿名访问 .antMatchers("/ipc/dataReceive/plcData","/ipc/dataReceive/sensorData").permitAll() // 静态资源,可匿名访问 diff --git a/tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/service/impl/IpcAlarmRulesConfigServiceImpl.java b/tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/service/impl/IpcAlarmRulesConfigServiceImpl.java index 02451fd..f0cc2a3 100644 --- a/tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/service/impl/IpcAlarmRulesConfigServiceImpl.java +++ b/tzipc-server/tzipc-system/src/main/java/com/inspur/ipc/service/impl/IpcAlarmRulesConfigServiceImpl.java @@ -106,7 +106,7 @@ public class IpcAlarmRulesConfigServiceImpl implements IIpcAlarmRulesConfigServi List list = ipcAlarmRulesConfigMapper.selectIpcAlarmRulesConfigList(new IpcAlarmRulesConfig()); for (IpcMonitorField field : partList) { List redisList = list.stream().filter(ipcAlarmRulesConfig -> ipcAlarmRulesConfig.getPartKey().equals(field.getFieldValue())).collect(Collectors.toList()); - redisCache.setCacheObject(CacheConstants.RULE_CONFIG + field.getFieldValue() + CacheConstants.REDIS_KEY_SEPARATOR, redisList,CacheConstants.IPC_EXPIRATION_TIME, TimeUnit.HOURS); + redisCache.setCacheObject(CacheConstants.RULE_CONFIG + field.getFieldValue(), redisList,CacheConstants.IPC_EXPIRATION_TIME, TimeUnit.HOURS); } } @@ -118,11 +118,11 @@ public class IpcAlarmRulesConfigServiceImpl implements IIpcAlarmRulesConfigServi */ @Override public List selectIpcAlarmRulesConfigList(String part) { - List list = redisCache.getCacheObject(CacheConstants.RULE_CONFIG + part + CacheConstants.REDIS_KEY_SEPARATOR); + List list = redisCache.getCacheObject(CacheConstants.RULE_CONFIG + part); if (list == null || list.isEmpty()) { this.updateRedisCache(); } - list = redisCache.getCacheObject(CacheConstants.RULE_CONFIG + part + CacheConstants.REDIS_KEY_SEPARATOR); + list = redisCache.getCacheObject(CacheConstants.RULE_CONFIG + part); return list; } } diff --git a/tzipc-server/tzipc-system/src/main/java/com/inspur/system/service/ISysConfigService.java b/tzipc-server/tzipc-system/src/main/java/com/inspur/system/service/ISysConfigService.java index 0a424f1..2ddafd6 100644 --- a/tzipc-server/tzipc-system/src/main/java/com/inspur/system/service/ISysConfigService.java +++ b/tzipc-server/tzipc-system/src/main/java/com/inspur/system/service/ISysConfigService.java @@ -5,14 +5,14 @@ import com.inspur.system.domain.SysConfig; /** * 参数配置 服务层 - * + * * @author inspur */ public interface ISysConfigService { /** * 查询参数配置信息 - * + * * @param configId 参数配置ID * @return 参数配置信息 */ @@ -20,7 +20,7 @@ public interface ISysConfigService /** * 根据键名查询参数配置信息 - * + * * @param configKey 参数键名 * @return 参数键值 */ @@ -28,14 +28,21 @@ public interface ISysConfigService /** * 获取验证码开关 - * + * * @return true开启,false关闭 */ public boolean selectCaptchaEnabled(); + /** + * 获取系统名称 + * + * @return + */ + public String selectSystemName(); + /** * 查询参数配置列表 - * + * * @param config 参数配置信息 * @return 参数配置集合 */ @@ -43,7 +50,7 @@ public interface ISysConfigService /** * 新增参数配置 - * + * * @param config 参数配置信息 * @return 结果 */ @@ -51,7 +58,7 @@ public interface ISysConfigService /** * 修改参数配置 - * + * * @param config 参数配置信息 * @return 结果 */ @@ -59,7 +66,7 @@ public interface ISysConfigService /** * 批量删除参数信息 - * + * * @param configIds 需要删除的参数ID */ public void deleteConfigByIds(Long[] configIds); @@ -81,7 +88,7 @@ public interface ISysConfigService /** * 校验参数键名是否唯一 - * + * * @param config 参数信息 * @return 结果 */ diff --git a/tzipc-server/tzipc-system/src/main/java/com/inspur/system/service/impl/SysConfigServiceImpl.java b/tzipc-server/tzipc-system/src/main/java/com/inspur/system/service/impl/SysConfigServiceImpl.java index 740118f..c685fba 100644 --- a/tzipc-server/tzipc-system/src/main/java/com/inspur/system/service/impl/SysConfigServiceImpl.java +++ b/tzipc-server/tzipc-system/src/main/java/com/inspur/system/service/impl/SysConfigServiceImpl.java @@ -19,7 +19,7 @@ import com.inspur.system.service.ISysConfigService; /** * 参数配置 服务层实现 - * + * * @author inspur */ @Service @@ -42,7 +42,7 @@ public class SysConfigServiceImpl implements ISysConfigService /** * 查询参数配置信息 - * + * * @param configId 参数配置ID * @return 参数配置信息 */ @@ -57,7 +57,7 @@ public class SysConfigServiceImpl implements ISysConfigService /** * 根据键名查询参数配置信息 - * + * * @param configKey 参数key * @return 参数键值 */ @@ -82,23 +82,34 @@ public class SysConfigServiceImpl implements ISysConfigService /** * 获取验证码开关 - * + * * @return true开启,false关闭 */ @Override public boolean selectCaptchaEnabled() { - String captchaEnabled = selectConfigByKey("sys.account.captchaEnabled"); - if (StringUtils.isEmpty(captchaEnabled)) - { - return true; - } - return Convert.toBool(captchaEnabled); + return false; +// String captchaEnabled = selectConfigByKey("sys.account.captchaEnabled"); +// if (StringUtils.isEmpty(captchaEnabled)) +// { +// return true; +// } +// return Convert.toBool(captchaEnabled); + } + + /** + * 获取系统名称 + * + * @return + */ + @Override + public String selectSystemName(){ + return selectConfigByKey("sys.name"); } /** * 查询参数配置列表 - * + * * @param config 参数配置信息 * @return 参数配置集合 */ @@ -110,7 +121,7 @@ public class SysConfigServiceImpl implements ISysConfigService /** * 新增参数配置 - * + * * @param config 参数配置信息 * @return 结果 */ @@ -127,7 +138,7 @@ public class SysConfigServiceImpl implements ISysConfigService /** * 修改参数配置 - * + * * @param config 参数配置信息 * @return 结果 */ @@ -144,7 +155,7 @@ public class SysConfigServiceImpl implements ISysConfigService /** * 批量删除参数信息 - * + * * @param configIds 需要删除的参数ID */ @Override @@ -197,7 +208,7 @@ public class SysConfigServiceImpl implements ISysConfigService /** * 校验参数键名是否唯一 - * + * * @param config 参数配置信息 * @return 结果 */ @@ -215,7 +226,7 @@ public class SysConfigServiceImpl implements ISysConfigService /** * 设置cache key - * + * * @param configKey 参数键 * @return 缓存键key */ diff --git a/tzipc-ui/src/api/login.js b/tzipc-ui/src/api/login.js index 649f59c..57d5526 100644 --- a/tzipc-ui/src/api/login.js +++ b/tzipc-ui/src/api/login.js @@ -1,4 +1,4 @@ -import request from '@/utils/request' +import request from "@/utils/request"; // 登录方法 export function login(username, password, code, uuid) { @@ -6,54 +6,66 @@ export function login(username, password, code, uuid) { username, password, code, - uuid - } + uuid, + }; return request({ - url: '/login', + url: "/login", headers: { - isToken: false + isToken: false, }, - method: 'post', - data: data - }) + method: "post", + data: data, + }); } // 注册方法 export function register(data) { return request({ - url: '/register', + url: "/register", headers: { - isToken: false + isToken: false, }, - method: 'post', - data: data - }) + method: "post", + data: data, + }); } // 获取用户详细信息 export function getInfo() { return request({ - url: '/getInfo', - method: 'get' - }) + url: "/getInfo", + method: "get", + }); } // 退出方法 export function logout() { return request({ - url: '/logout', - method: 'post' - }) + url: "/logout", + method: "post", + }); } // 获取验证码 export function getCodeImg() { return request({ - url: '/captchaImage', + url: "/captchaImage", headers: { - isToken: false + isToken: false, }, - method: 'get', - timeout: 20000 - }) -} \ No newline at end of file + method: "get", + timeout: 20000, + }); +} + +// 获取系统名称 +export function getSystemName() { + return request({ + url: "/systemName", + headers: { + isToken: false, + }, + method: "get", + timeout: 20000, + }); +} diff --git a/tzipc-ui/src/views/login.vue b/tzipc-ui/src/views/login.vue index 32b9122..6b1c896 100644 --- a/tzipc-ui/src/views/login.vue +++ b/tzipc-ui/src/views/login.vue @@ -1,10 +1,16 @@