提交 ca2ef813 编写于 作者: zhouweidong's avatar zhouweidong

补充用户默认值

上级 4c7553c4
......@@ -224,16 +224,16 @@ public class DEFieldDefaultValueAspect
switch(preFieldType) {
case CREATEMAN:
et.set(fieldname, curUser.getUserid());
et.set(fieldname, getUserId(curUser, et));
break;
case CREATEMANNAME:
et.set(fieldname, curUser.getPersonname());
et.set(fieldname, getUserName(curUser, et));
break;
case UPDATEMAN:
et.set(fieldname, curUser.getUserid());
et.set(fieldname, getUserId(curUser, et));
break;
case UPDATEMANNAME:
et.set(fieldname, curUser.getPersonname());
et.set(fieldname, getUserName(curUser, et));
break;
case CREATEDATE:
et.set(fieldname, new Timestamp(new Date().getTime()));
......@@ -271,4 +271,34 @@ public class DEFieldDefaultValueAspect
}
}
/**
* 获取当前登录用户标识
*
* @param curUser
* @param et
* @return
*/
private String getUserId(AuthenticationUser curUser, EntityBase et) {
String userId = StringUtils.isEmpty(curUser.getUserid()) ? DataObject.getStringValue(et.get(TAG_PERSONID), null) : curUser.getUserid();
if (StringUtils.isEmpty(userId)) {
userId = "ibzadmin";
}
return userId;
}
/**
* 获取当前登录用户名称
*
* @param curUser
* @param et
* @return
*/
private String getUserName(AuthenticationUser curUser, EntityBase et) {
String userName = StringUtils.isEmpty(curUser.getPersonname()) ? DataObject.getStringValue(et.get(TAG_PERSONNAME), null) : curUser.getPersonname();
if (StringUtils.isEmpty(userName)) {
userName = "系统管理员";
}
return userName;
}
}
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册