mirror of
				https://github.com/continew-org/continew-admin.git
				synced 2025-10-26 18:58:37 +08:00 
			
		
		
		
	chore: 忽略获取在线用户信息异常
This commit is contained in:
		| @@ -20,7 +20,6 @@ import cn.hutool.core.util.ObjectUtil; | ||||
| import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler; | ||||
| import org.apache.ibatis.reflection.MetaObject; | ||||
| import top.continew.admin.common.context.UserContextHolder; | ||||
| import top.continew.starter.core.exception.BusinessException; | ||||
| import top.continew.starter.extension.crud.model.entity.BaseDO; | ||||
|  | ||||
| import java.time.LocalDateTime; | ||||
| @@ -57,7 +56,6 @@ public class MyBatisPlusMetaObjectHandler implements MetaObjectHandler { | ||||
|      */ | ||||
|     @Override | ||||
|     public void insertFill(MetaObject metaObject) { | ||||
|         try { | ||||
|         if (null == metaObject) { | ||||
|             return; | ||||
|         } | ||||
| @@ -72,9 +70,6 @@ public class MyBatisPlusMetaObjectHandler implements MetaObjectHandler { | ||||
|             this.fillFieldValue(metaObject, CREATE_USER, createUser, false); | ||||
|             this.fillFieldValue(metaObject, CREATE_TIME, createTime, false); | ||||
|         } | ||||
|         } catch (Exception e) { | ||||
|             throw new BusinessException("插入数据时自动填充异常:" + e.getMessage()); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     /** | ||||
| @@ -84,7 +79,6 @@ public class MyBatisPlusMetaObjectHandler implements MetaObjectHandler { | ||||
|      */ | ||||
|     @Override | ||||
|     public void updateFill(MetaObject metaObject) { | ||||
|         try { | ||||
|         if (null == metaObject) { | ||||
|             return; | ||||
|         } | ||||
| @@ -99,9 +93,6 @@ public class MyBatisPlusMetaObjectHandler implements MetaObjectHandler { | ||||
|             this.fillFieldValue(metaObject, UPDATE_USER, updateUser, true); | ||||
|             this.fillFieldValue(metaObject, UPDATE_TIME, updateTime, true); | ||||
|         } | ||||
|         } catch (Exception e) { | ||||
|             throw new BusinessException("修改数据时自动填充异常:" + e.getMessage()); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|   | ||||
| @@ -23,8 +23,6 @@ import cn.hutool.extra.spring.SpringUtil; | ||||
| import top.continew.starter.core.util.ExceptionUtils; | ||||
| import top.continew.starter.extension.crud.service.CommonUserService; | ||||
|  | ||||
| import java.util.Optional; | ||||
|  | ||||
| /** | ||||
|  * 用户上下文 Holder | ||||
|  * | ||||
| @@ -142,7 +140,7 @@ public class UserContextHolder { | ||||
|      * @return 用户 ID | ||||
|      */ | ||||
|     public static Long getUserId() { | ||||
|         return Optional.ofNullable(getContext()).map(UserContext::getId).orElse(null); | ||||
|         return ExceptionUtils.exToNull(() -> getContext().getId()); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
| @@ -151,7 +149,7 @@ public class UserContextHolder { | ||||
|      * @return 用户名 | ||||
|      */ | ||||
|     public static String getUsername() { | ||||
|         return Optional.ofNullable(getContext()).map(UserContext::getUsername).orElse(null); | ||||
|         return ExceptionUtils.exToNull(() -> getContext().getUsername()); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|   | ||||
		Reference in New Issue
	
	Block a user