fix: 修复定时任务获取用户信息报错的问题
This commit is contained in:
parent
71563c1e55
commit
430fbd127d
|
|
@ -20,22 +20,30 @@ public class MybatisPlusHandler implements MetaObjectHandler {
|
|||
public void insertFill(MetaObject metaObject) {
|
||||
this.strictInsertFill(metaObject, "createdBy", String.class, getUserName());
|
||||
this.strictInsertFill(metaObject, "createdTime", LocalDateTime.class, LocalDateTime.now());
|
||||
this.strictInsertFill(metaObject, "updatedBy", String.class, getUserName());
|
||||
this.strictInsertFill(metaObject, "updatedBy", String.class, getRealName());
|
||||
this.strictInsertFill(metaObject, "updatedTime", LocalDateTime.class, LocalDateTime.now());
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateFill(MetaObject metaObject) {
|
||||
this.strictInsertFill(metaObject, "updatedBy", String.class, getUserName());
|
||||
this.strictInsertFill(metaObject, "updatedBy", String.class, getRealName());
|
||||
this.strictInsertFill(metaObject, "updatedTime", LocalDateTime.class, LocalDateTime.now());
|
||||
}
|
||||
|
||||
private String getUserName() {
|
||||
private String getRealName() {
|
||||
try {
|
||||
return StrUtil.isNotBlank(SessionUtil.getRealName()) ? SessionUtil.getRealName() : SessionUtil.getUserName();
|
||||
} catch (NflgBusinessException e) {
|
||||
return "admin";
|
||||
}
|
||||
}
|
||||
|
||||
private String getUserName() {
|
||||
try {
|
||||
return SessionUtil.getUserName();
|
||||
} catch (NflgBusinessException e) {
|
||||
return "admin";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue