From ac474431e5091a06077f768b91b9f6dffa510302 Mon Sep 17 00:00:00 2001 From: nies Date: Mon, 14 Mar 2022 15:59:39 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E5=AE=8C=E5=96=84=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/base/RedisInfoController.java | 568 ++++++++++----------- .../src/main/resources/application.properties | 1 + pom.xml | 10 +- 3 files changed, 290 insertions(+), 289 deletions(-) diff --git a/modules/i3plus-core-apiservice/src/main/java/cn/estsh/i3plus/core/apiservice/controller/base/RedisInfoController.java b/modules/i3plus-core-apiservice/src/main/java/cn/estsh/i3plus/core/apiservice/controller/base/RedisInfoController.java index f996fd5..6c25916 100644 --- a/modules/i3plus-core-apiservice/src/main/java/cn/estsh/i3plus/core/apiservice/controller/base/RedisInfoController.java +++ b/modules/i3plus-core-apiservice/src/main/java/cn/estsh/i3plus/core/apiservice/controller/base/RedisInfoController.java @@ -1,284 +1,284 @@ -package cn.estsh.i3plus.core.apiservice.controller.base; - -import cn.estsh.i3plus.platform.common.util.CommonConstWords; -import cn.estsh.i3plus.platform.common.util.PlatformConstWords; -import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil; -import cn.estsh.impp.framework.boot.auth.AuthUtil; -import cn.estsh.impp.framework.boot.exception.ImppExceptionBuilder; -import cn.estsh.impp.framework.boot.util.ImppRedis; -import cn.estsh.impp.framework.boot.util.ResultBean; -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONObject; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import lombok.extern.slf4j.Slf4j; -import org.apache.logging.log4j.util.Strings; -import org.springframework.web.bind.annotation.*; - -import javax.annotation.Resource; -import java.io.UnsupportedEncodingException; -import java.net.URLDecoder; -import java.util.*; - -/** - * @Description :获取Redis信息展示,类似RDM - * @Reference : - * @Author : Castle - * @CreateDate : 2022/2/24 9:55 - * @Modify: - **/ -@Slf4j -@Api(tags = "redis信息") -@RestController -@RequestMapping(PlatformConstWords.BASE_URL + "/redis") -public class RedisInfoController { - /** - * redis db0 resource - */ - @Resource(name = CommonConstWords.IMPP_REDIS_RES) - private ImppRedis redisRes; - - /** - * redis db1 sessionDb - * - * @return - */ - @Resource(name = CommonConstWords.IMPP_REDIS_SESSION) - private ImppRedis redisSession; - - - /** - * redis db2 coreDb - */ - @Resource(name = CommonConstWords.IMPP_REDIS_CORE) - private ImppRedis redisCore; - - /** - * redis db3 redisWms - */ - @Resource(name = CommonConstWords.IMPP_REDIS_WMS) - private ImppRedis redisWms; - - /** - * redis db4 redisMes - */ - @Resource(name = CommonConstWords.IMPP_REDIS_MES) - private ImppRedis redisMes; - /** - * redis db5 redisMesPcn - */ - @Resource(name = CommonConstWords.IMPP_REDIS_MES_PCN) - private ImppRedis redisMesPcn; - - /** - * redis db6 redisMes - */ - @Resource(name = CommonConstWords.IMPP_REDIS_SWEB) - private ImppRedis redisSweb; - - /** - * redis db7 redisAndon - */ - @Resource(name = CommonConstWords.IMPP_REDIS_ANDON) - private ImppRedis redisAndon; - - /** - * redis db8 lacDb - */ - - @Resource(name = CommonConstWords.IMPP_REDIS_LAC) - private ImppRedis redisLac; - - /** - * redis db9 blockDb; - */ - - @Resource(name = CommonConstWords.IMPP_REDIS_BLOCK) - private ImppRedis redisBlock; - - /** - * redis db10 ptl - */ - - @Resource(name = CommonConstWords.IMPP_REDIS_PTL) - private ImppRedis redisPtl; - - /** - * redis db11 ptl_pcn - */ - - @Resource(name = CommonConstWords.IMPP_REDIS_PTL_PCN) - private ImppRedis redisPtlPcn; - - /** - * redis db12 mdm - */ - - @Resource(name = CommonConstWords.IMPP_REDIS_MDM) - private ImppRedis redisMdm; - /** - * redis db13 eam - */ - - @Resource(name = CommonConstWords.IMPP_REDIS_EAM) - private ImppRedis redisEam; - - /** - * redis db15 qms - */ - - @Resource(name = CommonConstWords.IMPP_REDIS_QMS) - private ImppRedis redisQms; - - - @ApiOperation(value = "获取redis的keyspace信息", notes = "获取redis的keyspace信息") - @GetMapping("/info") - public ResultBean getInfo() { - Map keys = new HashMap<>(16); - //获取所有的数据库信息 - Properties infos = redisRes.getRedisConnectionInfo("keyspace"); - //分解infos信息 - for (int i = 0; i < 16; i++) { - // info信息db0=keys=19510,expires=0,avg_ttl=0, - String key = "db" + i; - String info = infos.getProperty(key); - if (Strings.isNotBlank(info)) { - JSONObject infoJson = JSON.parseObject(("{" + info + "}").replaceAll("=", ":")); - keys.put(key, Integer.parseInt(infoJson.get("keys").toString())); - } else { - keys.put(key, 0); - } - } - return ResultBean.success("查询成功").setResultMap(keys); - } - - @ApiOperation(value = "获取指定数据库的所有keys", notes = "获取指定数据库的所有keys") - @GetMapping("/db/{id}") - public ResultBean getDbKeys(@PathVariable("id") Integer id) { - //根据id获取所有的key - ImppRedis redis = getRedis(id); - Set keySet = redis.findKeySet("*"); - return ResultBean.success("查询成功").setResultList(new ArrayList<>(keySet)); - } - - @ApiOperation(value = "根据key获取redis对应的值", notes = "根据key获取redis对应的值") - @GetMapping("/get/{id}/{key}") - public ResultBean getValue(@PathVariable("id") Integer id, @PathVariable("key") String key) { - ImppRedis redis = getRedis(id); - try { - key = URLDecoder.decode(key, "UTF-8"); - } catch (UnsupportedEncodingException e) { - throw ImppExceptionBuilder.newInstance().setErrorDetail("redisDb:{},key:{}解码失败", id, key).build(); - } - String keyType = redis.getKeyType(key).toLowerCase(); - Object result; - switch (keyType) { - case "string": - result = redis.getObject(key); - break; - case "hash": - result = redis.getHashMap(key); - break; - case "list": - result = redis.getList(key, 0, -1); - break; - case "set": - result = redis.getSet(key); - break; - case "zset": - result = null; - break; - default: - throw ImppExceptionBuilder.newInstance().setErrorDetail("无效的key类型,请检查传入的key").build(); - } - return ResultBean.success("查询成功").setResultObject(result); - } - - @ApiOperation(value = "删除对应key的值", notes = "删除对应key的值") - @DeleteMapping("/del/{id}/{key}") - public ResultBean deleteKey(@PathVariable("id") Integer id, @PathVariable("key") String key) { - ImppRedis redis = getRedis(id); - try { - key = URLDecoder.decode(key, "UTF-8"); - } catch (UnsupportedEncodingException e) { - throw ImppExceptionBuilder.newInstance().setErrorDetail("redisDb:{},key:{}解码失败", id, key).build(); - } - String keyType = redis.getKeyType(key).toLowerCase(); - switch (keyType) { - case "string": - redis.deleteKey(key); - break; - case "hash": - redis.deleteHash(key); - break; - case "list": - redis.removeList(key,0,null); - break; - default: - throw ImppExceptionBuilder.newInstance().setErrorDetail("暂不支持的key类型").build(); - } - - log.info("sysUser:{}, delete key:{}", AuthUtil.getSessionUser().getUserName(), key); - return ResultBean.success("删除成功"); - } - - /** - * 根据DB选取不同的redis链接实例 - * - * @param indexDb - * @return - */ - private ImppRedis getRedis(Integer indexDb) { - ImppRedis redis; - switch (indexDb) { - case 0: - redis = redisRes; - break; - case 1: - redis = redisSession; - break; - case 2: - redis = redisCore; - break; - case 3: - redis = redisWms; - break; - case 4: - redis = redisMes; - break; - case 5: - redis = redisMesPcn; - break; - case 6: - redis = redisSweb; - break; - case 7: - redis = redisAndon; - break; - case 8: - redis = redisLac; - break; - case 9: - redis = redisBlock; - break; - case 10: - redis = redisPtl; - break; - case 11: - redis = redisPtlPcn; - break; - case 12: - redis = redisMdm; - break; - case 13: - redis = redisEam; - break; - case 15: - redis = redisQms; - break; - default: - redis = redisRes; - } - return redis; - } -} +//package cn.estsh.i3plus.core.apiservice.controller.base; +// +//import cn.estsh.i3plus.platform.common.util.CommonConstWords; +//import cn.estsh.i3plus.platform.common.util.PlatformConstWords; +//import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil; +//import cn.estsh.impp.framework.boot.auth.AuthUtil; +//import cn.estsh.impp.framework.boot.exception.ImppExceptionBuilder; +//import cn.estsh.impp.framework.boot.util.ImppRedis; +//import cn.estsh.impp.framework.boot.util.ResultBean; +//import com.alibaba.fastjson.JSON; +//import com.alibaba.fastjson.JSONObject; +//import io.swagger.annotations.Api; +//import io.swagger.annotations.ApiOperation; +//import lombok.extern.slf4j.Slf4j; +//import org.apache.logging.log4j.util.Strings; +//import org.springframework.web.bind.annotation.*; +// +//import javax.annotation.Resource; +//import java.io.UnsupportedEncodingException; +//import java.net.URLDecoder; +//import java.util.*; +// +///** +// * @Description :获取Redis信息展示,类似RDM +// * @Reference : +// * @Author : Castle +// * @CreateDate : 2022/2/24 9:55 +// * @Modify: +// **/ +//@Slf4j +//@Api(tags = "redis信息") +//@RestController +//@RequestMapping(PlatformConstWords.BASE_URL + "/redis") +//public class RedisInfoController { +// /** +// * redis db0 resource +// */ +// @Resource(name = CommonConstWords.IMPP_REDIS_RES) +// private ImppRedis redisRes; +// +// /** +// * redis db1 sessionDb +// * +// * @return +// */ +// @Resource(name = CommonConstWords.IMPP_REDIS_SESSION) +// private ImppRedis redisSession; +// +// +// /** +// * redis db2 coreDb +// */ +// @Resource(name = CommonConstWords.IMPP_REDIS_CORE) +// private ImppRedis redisCore; +// +// /** +// * redis db3 redisWms +// */ +// @Resource(name = CommonConstWords.IMPP_REDIS_WMS) +// private ImppRedis redisWms; +// +// /** +// * redis db4 redisMes +// */ +// @Resource(name = CommonConstWords.IMPP_REDIS_MES) +// private ImppRedis redisMes; +// /** +// * redis db5 redisMesPcn +// */ +// @Resource(name = CommonConstWords.IMPP_REDIS_MES_PCN) +// private ImppRedis redisMesPcn; +// +// /** +// * redis db6 redisMes +// */ +// @Resource(name = CommonConstWords.IMPP_REDIS_SWEB) +// private ImppRedis redisSweb; +// +// /** +// * redis db7 redisAndon +// */ +// @Resource(name = CommonConstWords.IMPP_REDIS_ANDON) +// private ImppRedis redisAndon; +// +// /** +// * redis db8 lacDb +// */ +// +// @Resource(name = CommonConstWords.IMPP_REDIS_LAC) +// private ImppRedis redisLac; +// +// /** +// * redis db9 blockDb; +// */ +// +// @Resource(name = CommonConstWords.IMPP_REDIS_BLOCK) +// private ImppRedis redisBlock; +// +// /** +// * redis db10 ptl +// */ +// +// @Resource(name = CommonConstWords.IMPP_REDIS_PTL) +// private ImppRedis redisPtl; +// +// /** +// * redis db11 ptl_pcn +// */ +// +// @Resource(name = CommonConstWords.IMPP_REDIS_PTL_PCN) +// private ImppRedis redisPtlPcn; +// +// /** +// * redis db12 mdm +// */ +// +// @Resource(name = CommonConstWords.IMPP_REDIS_MDM) +// private ImppRedis redisMdm; +// /** +// * redis db13 eam +// */ +// +// @Resource(name = CommonConstWords.IMPP_REDIS_EAM) +// private ImppRedis redisEam; +// +// /** +// * redis db15 qms +// */ +// +// @Resource(name = CommonConstWords.IMPP_REDIS_QMS) +// private ImppRedis redisQms; +// +// +// @ApiOperation(value = "获取redis的keyspace信息", notes = "获取redis的keyspace信息") +// @GetMapping("/info") +// public ResultBean getInfo() { +// Map keys = new HashMap<>(16); +// //获取所有的数据库信息 +// Properties infos = redisRes.getRedisConnectionInfo("keyspace"); +// //分解infos信息 +// for (int i = 0; i < 16; i++) { +// // info信息db0=keys=19510,expires=0,avg_ttl=0, +// String key = "db" + i; +// String info = infos.getProperty(key); +// if (Strings.isNotBlank(info)) { +// JSONObject infoJson = JSON.parseObject(("{" + info + "}").replaceAll("=", ":")); +// keys.put(key, Integer.parseInt(infoJson.get("keys").toString())); +// } else { +// keys.put(key, 0); +// } +// } +// return ResultBean.success("查询成功").setResultMap(keys); +// } +// +// @ApiOperation(value = "获取指定数据库的所有keys", notes = "获取指定数据库的所有keys") +// @GetMapping("/db/{id}") +// public ResultBean getDbKeys(@PathVariable("id") Integer id) { +// //根据id获取所有的key +// ImppRedis redis = getRedis(id); +// Set keySet = redis.findKeySet("*"); +// return ResultBean.success("查询成功").setResultList(new ArrayList<>(keySet)); +// } +// +// @ApiOperation(value = "根据key获取redis对应的值", notes = "根据key获取redis对应的值") +// @GetMapping("/get/{id}/{key}") +// public ResultBean getValue(@PathVariable("id") Integer id, @PathVariable("key") String key) { +// ImppRedis redis = getRedis(id); +// try { +// key = URLDecoder.decode(key, "UTF-8"); +// } catch (UnsupportedEncodingException e) { +// throw ImppExceptionBuilder.newInstance().setErrorDetail("redisDb:{},key:{}解码失败", id, key).build(); +// } +// String keyType = redis.getKeyType(key).toLowerCase(); +// Object result; +// switch (keyType) { +// case "string": +// result = redis.getObject(key); +// break; +// case "hash": +// result = redis.getHashMap(key); +// break; +// case "list": +// result = redis.getList(key, 0, -1); +// break; +// case "set": +// result = redis.getSet(key); +// break; +// case "zset": +// result = null; +// break; +// default: +// throw ImppExceptionBuilder.newInstance().setErrorDetail("无效的key类型,请检查传入的key").build(); +// } +// return ResultBean.success("查询成功").setResultObject(result); +// } +// +// @ApiOperation(value = "删除对应key的值", notes = "删除对应key的值") +// @DeleteMapping("/del/{id}/{key}") +// public ResultBean deleteKey(@PathVariable("id") Integer id, @PathVariable("key") String key) { +// ImppRedis redis = getRedis(id); +// try { +// key = URLDecoder.decode(key, "UTF-8"); +// } catch (UnsupportedEncodingException e) { +// throw ImppExceptionBuilder.newInstance().setErrorDetail("redisDb:{},key:{}解码失败", id, key).build(); +// } +// String keyType = redis.getKeyType(key).toLowerCase(); +// switch (keyType) { +// case "string": +// redis.deleteKey(key); +// break; +// case "hash": +// redis.deleteHash(key); +// break; +// case "list": +// redis.removeList(key,0,null); +// break; +// default: +// throw ImppExceptionBuilder.newInstance().setErrorDetail("暂不支持的key类型").build(); +// } +// +// log.info("sysUser:{}, delete key:{}", AuthUtil.getSessionUser().getUserName(), key); +// return ResultBean.success("删除成功"); +// } +// +// /** +// * 根据DB选取不同的redis链接实例 +// * +// * @param indexDb +// * @return +// */ +// private ImppRedis getRedis(Integer indexDb) { +// ImppRedis redis; +// switch (indexDb) { +// case 0: +// redis = redisRes; +// break; +// case 1: +// redis = redisSession; +// break; +// case 2: +// redis = redisCore; +// break; +// case 3: +// redis = redisWms; +// break; +// case 4: +// redis = redisMes; +// break; +// case 5: +// redis = redisMesPcn; +// break; +// case 6: +// redis = redisSweb; +// break; +// case 7: +// redis = redisAndon; +// break; +// case 8: +// redis = redisLac; +// break; +// case 9: +// redis = redisBlock; +// break; +// case 10: +// redis = redisPtl; +// break; +// case 11: +// redis = redisPtlPcn; +// break; +// case 12: +// redis = redisMdm; +// break; +// case 13: +// redis = redisEam; +// break; +// case 15: +// redis = redisQms; +// break; +// default: +// redis = redisRes; +// } +// return redis; +// } +//} diff --git a/modules/i3plus-core-apiservice/src/main/resources/application.properties b/modules/i3plus-core-apiservice/src/main/resources/application.properties index ccb1d71..032a1e0 100644 --- a/modules/i3plus-core-apiservice/src/main/resources/application.properties +++ b/modules/i3plus-core-apiservice/src/main/resources/application.properties @@ -70,3 +70,4 @@ redis.resource.db=0 redis.session.db=1 #\u7CFB\u7EDF\u5168\u5C40\u7F13\u5B58\u5E93\uFF0C\u5B58\u653E\u5E73\u53F0\u6838\u5FC3\u6570\u636E\u7F13\u5B58 redis.core.db=2 +wms.redis.open=true diff --git a/pom.xml b/pom.xml index 142df5d..0ff0c1c 100644 --- a/pom.xml +++ b/pom.xml @@ -38,7 +38,7 @@ UTF-8 1.8 1.0-TEST-SNAPSHOT - 2.17.0 + 2.17.1 @@ -251,22 +251,22 @@ org.apache.shiro shiro-core - 1.4.0 + 1.8.0 org.apache.shiro shiro-web - 1.4.0 + 1.8.0 org.apache.shiro shiro-spring - 1.4.0 + 1.8.0 org.apache.shiro shiro-ehcache - 1.4.0 + 1.8.0 From 0f99680ceafba77f7b83905eaa15977b778c445a Mon Sep 17 00:00:00 2001 From: nies Date: Fri, 18 Mar 2022 10:06:14 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E5=8D=87=E7=BA=A7=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/pom.xml b/pom.xml index 0ff0c1c..3b4ef9f 100644 --- a/pom.xml +++ b/pom.xml @@ -58,6 +58,18 @@ ${project.dependency.version} + + org.springframework + spring-web + 5.0.16.RELEASE + + + + org.springframework + spring-webmvc + 5.0.16.RELEASE + + i3plus.core From d0c4586e2f8dc8f9b98106a0e3b74d906512f482 Mon Sep 17 00:00:00 2001 From: nies Date: Fri, 27 May 2022 15:07:42 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E5=8D=87=E7=BA=A7jackson=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/pom.xml b/pom.xml index 69a5208..d9653ba 100644 --- a/pom.xml +++ b/pom.xml @@ -41,6 +41,9 @@ 2.17.1 1.0.0.1 1.0.0.1 + 2.13.2.2 + 2.13.2 + 2.13.2 @@ -358,6 +361,28 @@ elasticsearch 7.5.1 + + + com.fasterxml.jackson.core + jackson-databind + ${jackson.databind.version} + compile + + + + com.fasterxml.jackson.core + jackson-annotations + ${jackson.annotation.version} + compile + + + + + com.fasterxml.jackson.core + jackson-core + ${jackson.core.version} + compile + From 877006b6834c2f8028009c41b2d5a5c107393fd7 Mon Sep 17 00:00:00 2001 From: "feng.liu" <123456> Date: Tue, 19 Jul 2022 14:43:39 +0800 Subject: [PATCH 4/4] =?UTF-8?q?shiro=E5=8D=87=E7=BA=A7=EF=BC=9A1.8.0->1.9.?= =?UTF-8?q?1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pom.xml b/pom.xml index ca3fa22..2a780f9 100644 --- a/pom.xml +++ b/pom.xml @@ -280,22 +280,22 @@ org.apache.shiro shiro-core - 1.8.0 + 1.9.1 org.apache.shiro shiro-web - 1.8.0 + 1.9.1 org.apache.shiro shiro-spring - 1.8.0 + 1.9.1 org.apache.shiro shiro-ehcache - 1.8.0 + 1.9.1