From e7fc077a4934a307fe77d148082418b77f0e31e0 Mon Sep 17 00:00:00 2001 From: mengqiang <> Date: Fri, 12 Feb 2021 17:28:25 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../resources/config/application-dev.properties | 3 ++- .../com/sso/dao/mapper/SsoLoginLogMapper.java | 15 --------------- .../model/bo/platform/SystemUpdateSecretBO.java | 7 +++++++ .../service/admin/impl/SystemServiceImpl.java | 13 +++++++++++++ .../mapper/mybatis/SsoLoginLogMapper.xml | 5 ----- .../resources/mapper/mybatis/SsoMenuMapper.xml | 1 + .../resources/mapper/mybatis/SsoUserMapper.xml | 4 ++-- .../com/sso/common/utils/ip/IpAddressUtils.java | 6 ++---- sso-auth-center-vue/README.md | 1 - sso-auth-center-vue/src/layout/index.vue | 3 +++ sso-auth-center-vue/src/main.js | 5 ++++- .../src/views/sso/platform/platformDetail.vue | 1 + .../src/views/sso/platform/platformMgmt.vue | 3 +++ .../src/views/sso/role/index.vue | 17 ++++++----------- .../src/views/sso/user/index.vue | 4 ++-- 15 files changed, 46 insertions(+), 42 deletions(-) diff --git a/sso-auth-center-service/sso-auth-center-admin/src/main/resources/config/application-dev.properties b/sso-auth-center-service/sso-auth-center-admin/src/main/resources/config/application-dev.properties index 4bacb90..b669a30 100644 --- a/sso-auth-center-service/sso-auth-center-admin/src/main/resources/config/application-dev.properties +++ b/sso-auth-center-service/sso-auth-center-admin/src/main/resources/config/application-dev.properties @@ -2,7 +2,8 @@ server.port=9901 #日志配置 logging.level.root=info -logging.level.com.sso=DEBUG +#认证中心日志配置 +logging.level.com.sso=info logging.level.org.springframework=warn #日志文件路径 log.root.path=${user.home}/logs/sso-auth-center diff --git a/sso-auth-center-service/sso-business/src/main/java/com/sso/dao/mapper/SsoLoginLogMapper.java b/sso-auth-center-service/sso-business/src/main/java/com/sso/dao/mapper/SsoLoginLogMapper.java index ff9fb01..26b6e3f 100644 --- a/sso-auth-center-service/sso-business/src/main/java/com/sso/dao/mapper/SsoLoginLogMapper.java +++ b/sso-auth-center-service/sso-business/src/main/java/com/sso/dao/mapper/SsoLoginLogMapper.java @@ -13,7 +13,6 @@ import java.util.List; * 登录日志基础mapper接口 * * @author 程序员小强 - * @date 2021-01-23 10:45:22 */ public interface SsoLoginLogMapper { @@ -22,7 +21,6 @@ public interface SsoLoginLogMapper { * * @param requestId 自增主键 * @return 登录日志实体 - * @date 20-01-19 10:45:22 */ SsoLoginLog getByRequestId(String requestId); @@ -47,7 +45,6 @@ public interface SsoLoginLogMapper { * * @param ssoLoginLog 登录日志实体 * @return 新增的行数 - * @date 2021-01-23 10:45:22 */ int insert(SsoLoginLog ssoLoginLog); @@ -56,25 +53,14 @@ public interface SsoLoginLogMapper { * * @param ssoLoginLog 登录日志实体 * @return 新增的行数 - * @date 2021-01-23 10:45:22 */ int insertSelective(SsoLoginLog ssoLoginLog); - /** - * 根据自增主键删除接口 - * - * @param id 自增主键主键 - * @return 删除的行数 - * @date 2021-01-23 10:45:22 - */ - int deleteByPrimaryKey(Long id); - /** * 根据自增主键编辑接口 * * @param ssoLoginLog 登录日志实体 * @return 编辑的行数 - * @date 2021-01-23 10:45:22 */ int updateByPrimaryKey(SsoLoginLog ssoLoginLog); @@ -83,7 +69,6 @@ public interface SsoLoginLogMapper { * * @param ssoLoginLog 登录日志实体 * @return 编辑的行数 - * @date 2021-01-23 10:45:22 */ int updateByPrimaryKeySelective(SsoLoginLog ssoLoginLog); diff --git a/sso-auth-center-service/sso-business/src/main/java/com/sso/model/bo/platform/SystemUpdateSecretBO.java b/sso-auth-center-service/sso-business/src/main/java/com/sso/model/bo/platform/SystemUpdateSecretBO.java index 04bd9d1..eaeca17 100644 --- a/sso-auth-center-service/sso-business/src/main/java/com/sso/model/bo/platform/SystemUpdateSecretBO.java +++ b/sso-auth-center-service/sso-business/src/main/java/com/sso/model/bo/platform/SystemUpdateSecretBO.java @@ -3,6 +3,7 @@ package com.sso.model.bo.platform; import com.sso.common.model.BaseOperateBO; import lombok.Data; +import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotNull; /** @@ -21,6 +22,12 @@ public class SystemUpdateSecretBO extends BaseOperateBO { @NotNull(message = "系统平台ID不为空") private Long sysId; + /** + * 系统编码 + */ + @NotBlank(message = "系统编码不为空") + private String sysCode; + /** * 签名类型 0-无;1-MD5;2-RSA; */ diff --git a/sso-auth-center-service/sso-business/src/main/java/com/sso/service/admin/impl/SystemServiceImpl.java b/sso-auth-center-service/sso-business/src/main/java/com/sso/service/admin/impl/SystemServiceImpl.java index 60a7c23..3019d05 100644 --- a/sso-auth-center-service/sso-business/src/main/java/com/sso/service/admin/impl/SystemServiceImpl.java +++ b/sso-auth-center-service/sso-business/src/main/java/com/sso/service/admin/impl/SystemServiceImpl.java @@ -25,7 +25,9 @@ import com.sso.model.vo.platform.SystemListVO; import com.sso.service.admin.SystemService; import com.sso.service.admin.login.PermissionService; import com.sso.service.base.SysConfigService; +import com.sso.service.base.SystemCacheService; import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.CollectionUtils; @@ -63,6 +65,8 @@ public class SystemServiceImpl implements SystemService { private SysConfigProperty sysConfigProperty; @Resource private SysConfigService sysConfigService; + @Resource + private SystemCacheService systemCacheService; /** * 我的平台列表 @@ -245,6 +249,10 @@ public class SystemServiceImpl implements SystemService { //修改平台 ssoSystemMapper.updateBySysId(ssoSystem); + + //移除缓存 + systemCacheService.removeSystemCache(updateBO.getSysCode()); + log.info("[ 平台修改完成 ] >> {}", updateBO.getLogValue()); } @@ -264,6 +272,8 @@ public class SystemServiceImpl implements SystemService { ssoSystem.setUpdateBy(updateBO.getOperateBy()); //修改平台 ssoSystemMapper.updateSecretBySysId(ssoSystem); + //移除缓存 + systemCacheService.removeSystemCache(updateBO.getSysCode()); log.info("[ 平台修改秘钥完成 ] >> {} ", updateBO.getLogValue()); } @@ -294,6 +304,9 @@ public class SystemServiceImpl implements SystemService { deleteSystem.setDelFlag(DelFlagEnum.DELETED.getStatus()); deleteSystem.setUpdateBy(deleteBO.getOperateBy()); ssoSystemMapper.updateBySysIdSelective(deleteSystem); + + //移除缓存 + systemCacheService.removeSystemCache(deleteSystem.getSysCode()); log.info("[ 平台删除完成 ] >> sysId:{} , operateBy:{}", deleteBO.getSysId(), deleteBO.getOperateBy()); } diff --git a/sso-auth-center-service/sso-business/src/main/resources/mapper/mybatis/SsoLoginLogMapper.xml b/sso-auth-center-service/sso-business/src/main/resources/mapper/mybatis/SsoLoginLogMapper.xml index a9a5663..20bda27 100644 --- a/sso-auth-center-service/sso-business/src/main/resources/mapper/mybatis/SsoLoginLogMapper.xml +++ b/sso-auth-center-service/sso-business/src/main/resources/mapper/mybatis/SsoLoginLogMapper.xml @@ -195,11 +195,6 @@ - - DELETE FROM sso_login_log - WHERE id = #{id,jdbcType=BIGINT} - - UPDATE sso_login_log SET diff --git a/sso-auth-center-service/sso-business/src/main/resources/mapper/mybatis/SsoMenuMapper.xml b/sso-auth-center-service/sso-business/src/main/resources/mapper/mybatis/SsoMenuMapper.xml index f330889..8fd363a 100644 --- a/sso-auth-center-service/sso-business/src/main/resources/mapper/mybatis/SsoMenuMapper.xml +++ b/sso-auth-center-service/sso-business/src/main/resources/mapper/mybatis/SsoMenuMapper.xml @@ -83,6 +83,7 @@ WHERE del_flag=0 AND sys_code = #{sysCode,jdbcType=VARCHAR} AND menu_name = #{menuName,jdbcType=VARCHAR} + LIMIT 1 @@ -174,7 +174,7 @@ AND a.status = #{status,jdbcType=INTEGER} - AND del_flag = #{delFlag,jdbcType=INTEGER} + AND a.del_flag = #{delFlag,jdbcType=INTEGER} ORDER BY a.status,a.update_time desc diff --git a/sso-auth-center-service/sso-common/src/main/java/com/sso/common/utils/ip/IpAddressUtils.java b/sso-auth-center-service/sso-common/src/main/java/com/sso/common/utils/ip/IpAddressUtils.java index 20519bf..741c899 100755 --- a/sso-auth-center-service/sso-common/src/main/java/com/sso/common/utils/ip/IpAddressUtils.java +++ b/sso-auth-center-service/sso-common/src/main/java/com/sso/common/utils/ip/IpAddressUtils.java @@ -65,15 +65,13 @@ public class IpAddressUtils { //详细地址 示例:浙江省杭州市 电信 String addr = jsonObject.getString("addr"); if (StringUtils.isNoneBlank(addr)) { - addr = addr.replaceAll(province, "") - .replaceAll(city, "").trim(); - return addr; + addr = addr.replaceAll(province, "").replaceAll(city, "").trim(); } //示例:浙江省 杭州市 电信 return String.format("%s %s %s", province, city, addr); } catch (Exception e) { - log.error("[ 根据IP-获取地理位置异常 ] >> {}", ip); + log.error("[ 根据IP-获取地理位置异常 ] >> {}", ip, e); } return UNKNOWN; } diff --git a/sso-auth-center-vue/README.md b/sso-auth-center-vue/README.md index 0169b6a..97f2411 100755 --- a/sso-auth-center-vue/README.md +++ b/sso-auth-center-vue/README.md @@ -24,5 +24,4 @@ npm run dev npm run build-test # 构建生产环境 -npm run build-prod ``` diff --git a/sso-auth-center-vue/src/layout/index.vue b/sso-auth-center-vue/src/layout/index.vue index 2dd5f67..dc9f5d9 100644 --- a/sso-auth-center-vue/src/layout/index.vue +++ b/sso-auth-center-vue/src/layout/index.vue @@ -201,6 +201,9 @@ export default { if (key === '' || key === null) { return } + if(this.$route.path === key){ + return + } //如果是外链 if (isExternal(key)) { const lastActiveIndex = sessionStorage.getItem('activeIndex') diff --git a/sso-auth-center-vue/src/main.js b/sso-auth-center-vue/src/main.js index 80ce2fb..309b378 100755 --- a/sso-auth-center-vue/src/main.js +++ b/sso-auth-center-vue/src/main.js @@ -3,12 +3,15 @@ import Vue from 'vue' import 'normalize.css/normalize.css' // A modern alternative to CSS resets import ElementUI from 'element-ui' import 'element-ui/lib/theme-chalk/index.css' +import '@/styles/index.scss' + import locale from 'element-ui/lib/locale/lang/zh-CN' // lang i18n import Pagination from '@/components/Pagination' import { handleTree, resetForm } from '@/utils/admin-util' -import '@/styles/index.scss' // global css +// global css + import App from './App' import store from './store' import router from './router' diff --git a/sso-auth-center-vue/src/views/sso/platform/platformDetail.vue b/sso-auth-center-vue/src/views/sso/platform/platformDetail.vue index 9e8456e..d4a108f 100755 --- a/sso-auth-center-vue/src/views/sso/platform/platformDetail.vue +++ b/sso-auth-center-vue/src/views/sso/platform/platformDetail.vue @@ -334,6 +334,7 @@ export default { this.reset() this.getDetail() this.updateSecretForm.sysId = this.detailData.sysId + this.updateSecretForm.sysCode = this.targetSysCode this.updateSecretForm.sysName = this.detailData.sysName this.updateSecretForm.signType = this.detailData.signType this.updateSecretForm.publicKey = this.detailData.publicKey diff --git a/sso-auth-center-vue/src/views/sso/platform/platformMgmt.vue b/sso-auth-center-vue/src/views/sso/platform/platformMgmt.vue index 83551d5..af63500 100755 --- a/sso-auth-center-vue/src/views/sso/platform/platformMgmt.vue +++ b/sso-auth-center-vue/src/views/sso/platform/platformMgmt.vue @@ -99,6 +99,9 @@ 取 消 + +

您还没有平台管理权限,联系管理员添加吧

+