TRX před 1 rokem
rodič
revize
f10c0f5bb2

+ 30 - 0
FullCardClient/src/main/java/com/zhongshu/card/client/model/org/UserCountUpdateBaseParam.java

@@ -0,0 +1,30 @@
+package com.zhongshu.card.client.model.org;
+
+import com.zhongshu.card.client.utils.type.Sex;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import org.checkerframework.common.aliasing.qual.NonLeaked;
+
+/**
+ * @author TRX
+ * @date 2024/7/5
+ */
+@Data
+@AllArgsConstructor
+@NonLeaked
+public class UserCountUpdateBaseParam {
+    private String id;
+
+    @Schema(description = "姓名")
+    private String name;
+
+    @Schema(description = "头像")
+    private String profilePic;
+
+    @Schema(description = "性别")
+    private Sex sex;
+
+    @Schema(description = "地址")
+    private String address;
+}

+ 4 - 0
FullCardClient/src/main/java/com/zhongshu/card/client/service/org/UserAccountService.java

@@ -63,4 +63,8 @@ public interface UserAccountService {
             @Parameter(required = false) UserCountSearchParam param,
             @Parameter(hidden = true) @PageableDefault Pageable pageable
     );
+
+    ResultContent updateUserAccountInfo(UserCountUpdateBaseParam param);
+
+
 }

+ 19 - 0
FullCardServer/src/main/java/com/zhongshu/card/server/core/controller/org/UserManagerController.java

@@ -43,6 +43,7 @@ public class UserManagerController {
     @Autowired
     UserAccountService userAccountService;
 
+
     @ResourceAuth(value = "user", type = AuthType.User)
     @Operation(summary = "机构用户列表-分页查询", description = "机构用户列表-分页查询")
     @RequestMapping(value = {"pageOrgUser"}, method = {RequestMethod.POST})
@@ -80,6 +81,16 @@ public class UserManagerController {
         return userAccountService.updateOrgUserState(param);
     }
 
+    //---------------------------------所有用户 start ----------------------------
+    @ResourceAuth(value = "user", type = AuthType.User)
+    @Operation(summary = "用户列表-分页查询(所有)", description = "用户列表-分页查询")
+    @RequestMapping(value = {"pageAllUser"}, method = {RequestMethod.POST})
+    public ResultContent<Page<UserCountModel>> pageAllUser(
+            @Parameter(hidden = true) @PageableDefault(page = 0, size = 10) Pageable pageable,
+            @Parameter(required = false) UserCountSearchParam param) {
+        return userAccountService.list(param, pageable);
+    }
+
     @ResourceAuth(value = "user", type = AuthType.User)
     @Operation(summary = "重置用户密码", description = "重置用户密码(重置为默认密码)")
     @RequestMapping(value = {"resetPassWord"}, method = {RequestMethod.POST})
@@ -87,4 +98,12 @@ public class UserManagerController {
         Assert.hasText(param.getUserId(), "userId不能为空");
         return userAccountService.resetPassWord(param);
     }
+
+    @ResourceAuth(value = "user", type = AuthType.User)
+    @Operation(summary = "编辑用户信息", description = "编辑用户信息")
+    @RequestMapping(value = {"updateUserAccountInfo"}, method = {RequestMethod.POST})
+    public ResultContent updateUserAccountInfo(@RequestBody UserCountUpdateBaseParam param) {
+        return userAccountService.updateUserAccountInfo(param);
+    }
+
 }

+ 18 - 0
FullCardServer/src/main/java/com/zhongshu/card/server/core/service/org/UserAccountServiceImpl.java

@@ -583,6 +583,24 @@ public class UserAccountServiceImpl extends SuperService implements UserAccountS
         return ResultContent.buildSuccess(PageEntityUtil.toPageModel(page, this::toModel));
     }
 
+    /**
+     * 编辑用户基本信息
+     *
+     * @param param
+     * @return
+     */
+    @Override
+    public ResultContent updateUserAccountInfo(UserCountUpdateBaseParam param) {
+        UserAccount userAccount = userCountDao.findTopById(param.getId());
+        if (ObjectUtils.isEmpty(userAccount)) {
+            return ResultContent.buildFail(String.format(ResultMessage.DATA_NOT_EXIST, param.getId()));
+        }
+        BeanUtils.copyProperties(param, userAccount);
+        userAccount.setSpellCode(CommonUtil.getPinyin(userAccount.getName()));
+        userCountDao.save(userAccount);
+        return ResultContent.buildSuccess();
+    }
+
     public UserCountModel toModel(UserAccount entity) {
         UserCountModel model = null;
         if (ObjectUtils.isNotEmpty(entity)) {