From 0f9d91bacff24cb14d5d86ec3de0598a13f4152c Mon Sep 17 00:00:00 2001
From: Pu Zhibing <393733352@qq.com>
Date: 星期五, 27 十二月 2024 11:50:37 +0800
Subject: [PATCH] 修改会员等级变更

---
 ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserController.java |   38 +++++++++++++++++++++++++++++++-------
 1 files changed, 31 insertions(+), 7 deletions(-)

diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserController.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserController.java
index 41cf35c..34a31bc 100644
--- a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserController.java
+++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserController.java
@@ -285,7 +285,7 @@
         }
         //当前绑定门店的店铺信息
         if (user.getShopId() != null) {
-            R<Shop> storeById = storeClient.getStoreById(user.getShopId());
+            R<Shop> storeById = shopClient.getShopById(user.getShopId());
             if (storeById.getData() != null) {
                 user.setShopName(storeById.getData().getName());
             }
@@ -389,10 +389,24 @@
      */
     @GetMapping("/getAppuserPage")
     @ApiOperation(value = "用户列表", tags = {"管理后台"})
-    public R<IPage<AppUser>> getAppuserPage(@ApiParam("页码") @RequestParam Integer pageCurr,
+    public R<IPage<AppUser>> getAppuserPage(@ApiParam("页码") @RequestParam Integer pageNum,
                                             @ApiParam("每一页数据大小") Integer pageSize,
                                             AppUser appUser) {
-        IPage<AppUser> appuserPage = appUserService.getAppuserPage(pageCurr, pageSize, appUser);
+        IPage<AppUser> appuserPage = appUserService.getAppuserPage(pageNum, pageSize, appUser);
+        for (AppUser record : appuserPage.getRecords()) {
+            if (record.getInviteUserId() != null) {
+                AppUser byId1 = appUserService.getById(record.getInviteUserId());
+                if (byId1!=null) {
+                    record.setInviteUserName(byId1.getName());
+                }
+            }
+            if (record.getShopId()!=null){
+                R<Shop> shopById = shopClient.getShopById(record.getShopId());
+                if (shopById.getData()!=null){
+                    record.setShopName(shopById.getData().getName());
+                }
+            }
+        }
         return R.ok(appuserPage);
     }
 
@@ -496,7 +510,7 @@
 
     @GetMapping("/change/shop")
     @ApiOperation(value = "用户列表-更换门店", tags = {"管理后台"})
-    public R<AppUser> shop(Long id, Long shopId) {
+    public R<AppUser> shop(Long id, Integer shopId) {
         AppUser byId = appUserService.getById(id);
         byId.setShopId(shopId);
         appUserService.updateById(byId);
@@ -540,7 +554,7 @@
         //推广人
         if (byId.getInviteUserId() != null) {
             AppUser byId1 = appUserService.getById(byId.getInviteUserId());
-            byId1.setInviteUserName(byId1.getInviteUserName());
+            byId.setInviteUserName(byId1.getInviteUserName());
         }
         //最后下单时间
         R<Order> lastOrder = remoteOrderGoodsClient.getLastOrder(id);
@@ -714,14 +728,24 @@
      * @return
      */
     @PostMapping("/upload")
-    public R<String> upload(MultipartFile file){
+    public String upload(MultipartFile file){
         String s = null;
         try {
             s = ObsUploadUtil.obsUpload(file);
         } catch (IOException e) {
             throw new RuntimeException(e);
         }
-        return R.ok(s);
+        return s;
+    }
+    
+    
+    /**
+     * 检查会员等级变更
+     * @param appUserId
+     */
+    @PostMapping("/vipUpgrade")
+    public void vipUpgrade(@RequestParam("appUserId") Long appUserId){
+        appUserService.vipUpgrade(appUserId);
     }
 }
 

--
Gitblit v1.7.1