TRX 1 an în urmă
părinte
comite
f823aa1afe

+ 16 - 0
FullCardServer/src/main/java/com/zhongshu/card/server/core/service/base/SuperService.java

@@ -133,6 +133,22 @@ public abstract class SuperService {
         }
     }
 
+    public void initEntityNoOid(SuperMain entity) {
+        if (entity != null) {
+            UserAccount account = getCurrentUserAccount();
+            if (account != null) {
+                if (StringUtils.isEmpty(entity.getCreateUserId())) {
+                    entity.setCreateUserId(account.getUserId());
+                    entity.setCreateUserName(account.getName());
+                    entity.setCreatePhone(account.getPhone());
+                }
+                entity.setUpdateUserId(account.getUserId());
+                entity.setUpdateUserName(account.getName());
+                entity.setUpdatePhone(account.getPhone());
+            }
+        }
+    }
+
     /**
      * 填充当前用户和oid信息 (oid为空会抛出异常)
      *

+ 5 - 1
FullCardServer/src/main/java/com/zhongshu/card/server/core/service/org/RoleServiceImpl.java

@@ -124,6 +124,8 @@ public class RoleServiceImpl extends SuperService {
             role.setRoleId(roleId);
             role.setCreateUserId(getCurrentUserId());
             role.setIsAdmin(Boolean.FALSE);
+            // 初始信息
+            initEntityNoOid(role);
             roleDao.save(role);
         } else {
             // 编辑
@@ -153,7 +155,9 @@ public class RoleServiceImpl extends SuperService {
                 }
             }
             // 编辑本地角色
-            BeanUtils.copyProperties(param, role);
+            BeanUtils.copyProperties(param, role, "roleType");
+            initUpdateEntity(role);
+
             roleDao.save(role);
         }
         return ResultContent.buildSuccess();