From a7280ca6e35b6f5af67ee3fb3689b831fe1016dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=A3=E5=9C=A3=E5=8D=8E?= <752718920@qq.com> Date: Tue, 6 Jun 2023 21:34:31 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=B9=B3=E5=8F=B0=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E7=9A=84=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/PlatformConfigController.java | 30 +++++++++++++++---- .../platformConfig/PlatformConfigService.java | 23 +++++++++++++- 2 files changed, 47 insertions(+), 6 deletions(-) diff --git a/jshERP-boot/src/main/java/com/jsh/erp/controller/PlatformConfigController.java b/jshERP-boot/src/main/java/com/jsh/erp/controller/PlatformConfigController.java index f7cfe9bf..3cf7a267 100644 --- a/jshERP-boot/src/main/java/com/jsh/erp/controller/PlatformConfigController.java +++ b/jshERP-boot/src/main/java/com/jsh/erp/controller/PlatformConfigController.java @@ -44,7 +44,7 @@ public class PlatformConfigController { String res; try { String platformKey = "platform_name"; - PlatformConfig platformConfig = platformConfigService.getPlatformConfigByKey(platformKey); + PlatformConfig platformConfig = platformConfigService.getInfoByKey(platformKey); res = platformConfig.getPlatformValue(); } catch(Exception e){ e.printStackTrace(); @@ -64,7 +64,27 @@ public class PlatformConfigController { String res; try { String platformKey = "platform_url"; - PlatformConfig platformConfig = platformConfigService.getPlatformConfigByKey(platformKey); + PlatformConfig platformConfig = platformConfigService.getInfoByKey(platformKey); + res = platformConfig.getPlatformValue(); + } catch(Exception e){ + e.printStackTrace(); + res = "#"; + } + return res; + } + + /** + * 获取是否开启注册 + * @param request + * @return + */ + @GetMapping(value = "/getPlatform/registerFlag") + @ApiOperation(value = "获取是否开启注册") + public String getPlatformRegisterFlag(HttpServletRequest request)throws Exception { + String res; + try { + String platformKey = "register_flag"; + PlatformConfig platformConfig = platformConfigService.getInfoByKey(platformKey); res = platformConfig.getPlatformValue(); } catch(Exception e){ e.printStackTrace(); @@ -100,13 +120,13 @@ public class PlatformConfigController { * @param request * @return */ - @GetMapping(value = "/getPlatformConfigByKey") + @GetMapping(value = "/getInfoByKey") @ApiOperation(value = "根据platformKey查询信息") - public BaseResponseInfo getPlatformConfigByKey(@RequestParam("platformKey") String platformKey, + public BaseResponseInfo getInfoByKey(@RequestParam("platformKey") String platformKey, HttpServletRequest request)throws Exception { BaseResponseInfo res = new BaseResponseInfo(); try { - PlatformConfig platformConfig = platformConfigService.getPlatformConfigByKey(platformKey); + PlatformConfig platformConfig = platformConfigService.getInfoByKey(platformKey); res.code = 200; res.data = platformConfig; } catch(Exception e){ diff --git a/jshERP-boot/src/main/java/com/jsh/erp/service/platformConfig/PlatformConfigService.java b/jshERP-boot/src/main/java/com/jsh/erp/service/platformConfig/PlatformConfigService.java index 54b72b9e..337a9289 100644 --- a/jshERP-boot/src/main/java/com/jsh/erp/service/platformConfig/PlatformConfigService.java +++ b/jshERP-boot/src/main/java/com/jsh/erp/service/platformConfig/PlatformConfigService.java @@ -154,7 +154,7 @@ public class PlatformConfigService { return result; } - public PlatformConfig getPlatformConfigByKey(String platformKey)throws Exception { + public PlatformConfig getInfoByKey(String platformKey)throws Exception { PlatformConfig platformConfig = new PlatformConfig(); try{ if(platformKey.contains("aliOss") || platformKey.contains("weixin")) { @@ -172,4 +172,25 @@ public class PlatformConfigService { } return platformConfig; } + + /** + * 根据key查询平台信息-内部专用方法 + * @param platformKey + * @return + * @throws Exception + */ + public PlatformConfig getPlatformConfigByKey(String platformKey)throws Exception { + PlatformConfig platformConfig = new PlatformConfig(); + try{ + PlatformConfigExample example = new PlatformConfigExample(); + example.createCriteria().andPlatformKeyEqualTo(platformKey); + List list=platformConfigMapper.selectByExample(example); + if(list!=null && list.size()>0){ + platformConfig = list.get(0); + } + }catch(Exception e){ + JshException.readFail(logger, e); + } + return platformConfig; + } }