Browse Source

修复ssoutil获取不了当前request登陆用户的问题 以及公共字段注入失败 移除性能分析插件

NorthLan 7 years ago
parent
commit
b038ae89da

+ 3 - 3
zen-api/src/main/kotlin/com/gxzc/zen/umps/util/SSOUtil.kt

@@ -17,11 +17,11 @@ object SSOUtil {
     private val sysUserService: ISysUserService = SpringContextHolder.getBean(ISysUserService::class.java)
 
     fun getCurUserId(): Long? {
-        return SSOHelper.attrToken<SSOToken>(HttpUtil.getRequest())?.uid?.toLong()
+        val token = SSOHelper.attrToken<SSOToken>(HttpUtil.getRequest()) ?: SSOHelper.getToken(HttpUtil.getRequest())
+        return token?.uid?.toLong()
     }
 
     fun getCurUser(): SysUser? {
-        val curUid = getCurUserId() ?: return null
-        return sysUserService.getUserByIdCacheable(curUid)
+        return sysUserService.getUserByIdCacheable(getCurUserId() ?: return null)
     }
 }

+ 8 - 8
zen-orm/src/main/kotlin/com/gxzc/zen/orm/config/MybatisPlusConfig.kt

@@ -18,14 +18,14 @@ import org.springframework.transaction.annotation.EnableTransactionManagement
 @EnableTransactionManagement(order = 2)
 class MybatisPlusConfig {
 
-    /**
-     * 性能分析插件
-     */
-    @Bean
-    @Profile("dev") // 开发环境开启
-    fun performanceInterceptor(): PerformanceInterceptor {
-        return PerformanceInterceptor().also { it.isFormat = true }
-    }
+//    /**
+//     * 性能分析插件
+//     */
+//    @Bean
+//    @Profile("dev") // 开发环境开启
+//    fun performanceInterceptor(): PerformanceInterceptor {
+//        return PerformanceInterceptor().also { it.isFormat = true }
+//    }
 
     /**
      * 分页插件

+ 2 - 2
zen-web/src/main/kotlin/com/gxzc/zen/orm/CustomMetaObjectHandler.kt

@@ -20,7 +20,7 @@ class CustomMetaObjectHandler : MetaObjectHandler() {
     }
 
     override fun insertFill(metaObject: MetaObject?) {
-        logger.debug("公共字段自动填充: insertFill")
+        logger.debug("公共字段自动填充: insertFill ${SSOUtil.getCurUser()?.account}")
         if (getFieldValByName("createBy", metaObject) == null) {
             setFieldValByName("createBy", SSOUtil.getCurUser()?.account, metaObject)
         }
@@ -30,7 +30,7 @@ class CustomMetaObjectHandler : MetaObjectHandler() {
     }
 
     override fun updateFill(metaObject: MetaObject?) {
-        logger.debug("公共字段自动填充: updateFill")
+        logger.debug("公共字段自动填充: updateFill ${SSOUtil.getCurUser()?.account}")
         if (getFieldValByName("updateBy", metaObject) == null) {
             setFieldValByName("updateBy", SSOUtil.getCurUser()?.account, metaObject)
         }