Przeglądaj źródła

中台bug修复

wuchen 2 miesięcy temu
rodzic
commit
9e7fdd3d23

+ 16 - 17
alien-store/src/main/java/shop/alien/store/controller/StoreUserController.java

@@ -217,7 +217,7 @@ public class StoreUserController {
     }
 
     /**
-     * web端查询用户列表(支持主账号和子账号查询)
+     * web端查询用户列表(支持主账号和子账号查询) 分页查询重构
      */
     @ApiOperation("web端查询用户列表(支持主账号和子账号查询)")
     @ApiOperationSupport(order = 7)
@@ -281,27 +281,21 @@ public class StoreUserController {
         return R.success("初始化成功");
     }
 
-    /**
-     * web端删除商家端用户
-     */
-    @ApiOperation("web端删除商家端用户")
-    @ApiOperationSupport(order = 7)
-    @DeleteMapping("/deleteStoreUser")
-    public R<StoreUserVo> deleteStoreUser(@RequestParam(value = "id") String id) {
-        log.info("StoreUserController.deleteStoreUser?id={}", id);
-        return storeUserService.deleteStoreUser(id);
-    }
 
     /**
-     * web端切换商家端用户
+     * web端切换商家端用户状态(主账号有子账号时禁止禁用;子账号无限制;返回更新后状态供前端及时展示)
      */
-    @ApiOperation("web端切换商家端用户")
+    @ApiOperation("web端切换商家端用户状态(主账号有子账号时禁止禁用;返回更新后状态供前端及时展示)")
     @ApiOperationSupport(order = 7)
     @PutMapping("/switchingStates")
     public R<StoreUserVo> switchingStates(@RequestBody StoreUser storeUser) {
         log.info("StoreUserController.switchingStates?storeUser={}", storeUser);
-        storeUserService.switchingStates(storeUser);
-        return R.success("切换成功");
+        try {
+            return storeUserService.switchingStates(storeUser);
+        } catch (Exception e) {
+            log.warn("StoreUserController.switchingStates 校验或切换失败: {}", e.getMessage());
+            return R.fail(e.getMessage());
+        }
     }
 
     @ApiOperation(value = "web端导出商家端账号相关信息")
@@ -426,8 +420,13 @@ public class StoreUserController {
     @PostMapping("/deleteStoreAccountInfo")
     public R<StoreUserVo> deleteStoreAccountInfo(@RequestBody StoreUserVo storeUserVo) {
         log.info("StoreUserController.deleteStoreAccountInfo?storeUserVo={}", storeUserVo);
-        storeUserService.deleteStoreAccountInfo(storeUserVo);
-        return R.success("删除成功");
+        try {
+            storeUserService.deleteStoreAccountInfo(storeUserVo);
+            return R.success("删除成功");
+        } catch (Exception e) {
+            log.warn("StoreUserController.deleteStoreAccountInfo 校验或删除失败: {}", e.getMessage());
+            return R.fail(e.getMessage());
+        }
     }
 
     /**

+ 3 - 10
alien-store/src/main/java/shop/alien/store/service/StoreUserService.java

@@ -118,18 +118,11 @@ public interface StoreUserService extends IService<StoreUser> {
     void resetStoreUserPassword(StoreUser storeUser);
 
     /**
-     * web端编辑用户列表
+     * web端切换商家端用户状态(主账号底下有子账号时禁止禁用;子账号无限制)
      *
-     * @return boolean
-     */
-    R<StoreUserVo> deleteStoreUser(String id);
-
-    /**
-     * web端切换商家端用户状态
-     *
-     * @return boolean
+     * @return   更新后的用户信息(含最新 status),供前端及时展示
      */
-    void switchingStates(StoreUser storeUser);
+    R<StoreUserVo> switchingStates(StoreUser storeUserParam);
 
 
     /**