From 495c864d0bb01d4c3ed2c687f3e091813b03a089 Mon Sep 17 00:00:00 2001 From: zhanghan11 Date: Tue, 16 Apr 2024 08:49:33 +0800 Subject: [PATCH] =?UTF-8?q?=E8=8E=B7=E5=8F=96=E4=B8=8A=E4=BC=A0=E9=A2=91?= =?UTF-8?q?=E7=8E=87=E6=95=B0=E6=8D=AE=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../web/controller/common/CaptchaController.java | 8 ++++++++ .../inspur/framework/config/SecurityConfig.java | 2 +- .../inspur/system/service/ISysConfigService.java | 9 +++++++++ .../service/impl/SysConfigServiceImpl.java | 16 ++++++++++++++++ 4 files changed, 34 insertions(+), 1 deletion(-) 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 23e2a20..f1ba289 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 @@ -48,6 +48,14 @@ public class CaptchaController return AjaxResult.success(configService.selectSystemName()); } + /** + * 获取上传频率 + */ + @GetMapping("/sharedKeys") + public AjaxResult getSharedKeys() { + return AjaxResult.success(configService.selectSharedKeys()); + } + /** * 生成验证码 */ 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 646a557..5d8130a 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","/systemName").anonymous() + .antMatchers("/login", "/register", "/captchaImage","/systemName","/sharedKeys").anonymous() // 数据接收接口,允许匿名访问 .antMatchers("/ipc/dataReceive/plcData","/ipc/dataReceive/sensorData").permitAll() // 静态资源,可匿名访问 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 2ddafd6..7a675aa 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 @@ -1,6 +1,8 @@ package com.inspur.system.service; import java.util.List; +import java.util.Map; + import com.inspur.system.domain.SysConfig; /** @@ -40,6 +42,13 @@ public interface ISysConfigService */ public String selectSystemName(); + /** + * 获取上传频率 + * + * @return + */ + public Map selectSharedKeys(); + /** * 查询参数配置列表 * 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 c685fba..74e60e8 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 @@ -1,7 +1,9 @@ package com.inspur.system.service.impl; import java.util.Collection; +import java.util.HashMap; import java.util.List; +import java.util.Map; import javax.annotation.PostConstruct; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -107,6 +109,20 @@ public class SysConfigServiceImpl implements ISysConfigService return selectConfigByKey("sys.name"); } + /** + * 获取上传频率 + * + * @return + */ + @Override + public Map selectSharedKeys(){ + Map returnMap = new HashMap<>(); + Map map = new HashMap<>(); + map.put("time",Integer.parseInt(selectConfigByKey("shared.time"))); + returnMap.put("shared",map); + return returnMap; + } + /** * 查询参数配置列表 *