From c80c0184b6e560d41d5aa5691874e07b681fa18f Mon Sep 17 00:00:00 2001
From: Pu Zhibing <393733352@qq.com>
Date: 星期五, 17 一月 2025 18:41:24 +0800
Subject: [PATCH] 修改bug

---
 ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppUserController.java |  175 ++++++++++++++++++++++++++++++++++++++++++++-------------
 1 files changed, 134 insertions(+), 41 deletions(-)

diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppUserController.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppUserController.java
index fca9ac4..83f0fd9 100644
--- a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppUserController.java
+++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppUserController.java
@@ -505,7 +505,7 @@
     }
     
     @RequiresPermissions(value = {"/appUser/select", "/vipList/select"}, logical = Logical.OR)
-    @ApiOperation(value = "用户详情积分明细", tags = {"后台-用户管理-用户列表","小程序-个人中心"})
+    @ApiOperation(value = "用户详情积分明细", tags = {"后台-用户管理-用户列表"})
     @PostMapping(value = "/user/points/page")
     public R<Page<TAppUserIntegralChange>> pointsDetail(@RequestBody PointsQueryDto pointsQueryDto) {
         if (pointsQueryDto.getUserId()==null){
@@ -554,6 +554,59 @@
         return R.ok(page);
 
     }
+    
+    
+    
+    @ApiOperation(value = "用户详情积分明细", tags = {"小程序-个人中心"})
+    @PostMapping(value = "/user/points/page1")
+    public R<Page<TAppUserIntegralChange>> pointsDetail1(@RequestBody PointsQueryDto pointsQueryDto) {
+        if (pointsQueryDto.getUserId()==null){
+            pointsQueryDto.setUserId(tokenService.getLoginUserApplet().getUserId());
+        }
+        List<Integer> types = new ArrayList<>();
+        if (pointsQueryDto.getType()==null){
+            types.add(1);
+            types.add(2);
+            types.add(3);
+            types.add(4);
+            types.add(5);
+            types.add(6);
+        }else if (pointsQueryDto.getType()==1){
+            types.add(1);
+            types.add(2);
+            types.add(3);
+            types.add(4);
+            types.add(5);
+        }else if (pointsQueryDto.getType()==2){
+            types.add(6);
+        }
+        Page<TAppUserIntegralChange> page = integralChangeService.lambdaQuery()
+                .eq(TAppUserIntegralChange::getAppUserId, pointsQueryDto.getUserId())
+                .orderByDesc(TAppUserIntegralChange::getCreateTime)
+                .eq(pointsQueryDto.getChangeType() != null, TAppUserIntegralChange::getChangeType, pointsQueryDto.getChangeType())
+                .in(!types.isEmpty(), TAppUserIntegralChange::getChangeType, types).page(Page.of(pointsQueryDto.getPageCurr(), pointsQueryDto.getPageSize()));
+        
+        for (TAppUserIntegralChange record : page.getRecords()) {
+            record.setDateTime(record.getCreateTime());
+            record.setUid(record.getId().toString());
+            if (record.getChangeType()==2||record.getChangeType()==3){
+                R<TChargingOrder> tChargingOrderR = chargingOrderClient.orderDetail(Long.valueOf(record.getExtension()));
+                if (tChargingOrderR.getData()!=null) {
+                    record.setOrderNum(tChargingOrderR.getData().getCode());
+                }
+            }
+            if (record.getChangeType()==6){
+                R<TExchangeOrder> tExchangeOrderR = exchangeOrderClient.orderDetail(Long.valueOf(record.getExtension()));
+                if (tExchangeOrderR.getData()!=null){
+                    record.setOrderNum(tExchangeOrderR.getData().getCode());
+                }
+            }
+        }
+        
+        return R.ok(page);
+        
+    }
+    
 
     @ApiOperation(value = "积分详情", tags = {"小程序-个人中心"})
     @GetMapping(value = "/user/points/detail")
@@ -745,35 +798,32 @@
     public R giveVip(@RequestBody GiveVipDto  giveVipDto) {
         String[] split = giveVipDto.getUserIds().split(",");
         for (String s : split) {
-
-
-        TAppUser nowUser = appUserService.getById(s);
-
-        int plusDay = 0;
-        if (giveVipDto.getType() == 1) {
-            plusDay = 1;
-        } else if (giveVipDto.getType() == 2) {
-            plusDay = 3;
-        } else if (giveVipDto.getType() == 3) {
-            plusDay = 12;
-        }
+            TAppUser nowUser = appUserService.getById(s);
+            int plusDay = 0;
+            if (giveVipDto.getType() == 1) {
+                plusDay = 1;
+            } else if (giveVipDto.getType() == 2) {
+                plusDay = 3;
+            } else if (giveVipDto.getType() == 3) {
+                plusDay = 12;
+            }
             BigDecimal bigDecimal = new BigDecimal("0");
             TVip info = vipClient.getInfo1(giveVipDto.getVipId()).getData();
-        switch (giveVipDto.getType()){
-            case 1:
-                bigDecimal = bigDecimal.add(info.getMonthlyCard()==null?new BigDecimal(0):info.getMonthlyCard());
-                break;
-            case 2:
-                bigDecimal = bigDecimal.add(info.getSeasonCard()==null?new BigDecimal(0):info.getSeasonCard());
-                break;
-            case 3:
-                bigDecimal = bigDecimal.add(info.getAnnualCard()==null?new BigDecimal(0):info.getAnnualCard());
-                break;
-        }
+            switch (giveVipDto.getType()){
+                case 1:
+                    bigDecimal = bigDecimal.add(info.getMonthlyCard()==null?new BigDecimal(0):info.getMonthlyCard());
+                    break;
+                case 2:
+                    bigDecimal = bigDecimal.add(info.getSeasonCard()==null?new BigDecimal(0):info.getSeasonCard());
+                    break;
+                case 3:
+                    bigDecimal = bigDecimal.add(info.getAnnualCard()==null?new BigDecimal(0):info.getAnnualCard());
+                    break;
+            }
             //增加vipDetail
-        giveVipUtil.sendVip(nowUser, giveVipDto.getVipId(),plusDay,giveVipDto.getType());
-        appUserService.updateById(nowUser);
-        // 新增后台赠送记录
+            giveVipUtil.sendVip(nowUser, giveVipDto.getVipId(),plusDay,giveVipDto.getType());
+            appUserService.updateById(nowUser);
+            // 新增后台赠送记录
             TGrantVip tGrantVip = new TGrantVip();
             tGrantVip.setCode(OrderCodeUtil.getOrderCode("ZS"));
             tGrantVip.setAppUserId(nowUser.getId());
@@ -785,6 +835,51 @@
         }
         return R.ok();
     }
+    
+    
+    
+    @PostMapping(value = "/user/give/vip1")
+    public R giveVip1(@RequestBody GiveVipDto  giveVipDto) {
+        String[] split = giveVipDto.getUserIds().split(",");
+        for (String s : split) {
+            TAppUser nowUser = appUserService.getById(s);
+            int plusDay = 0;
+            if (giveVipDto.getType() == 1) {
+                plusDay = 1;
+            } else if (giveVipDto.getType() == 2) {
+                plusDay = 3;
+            } else if (giveVipDto.getType() == 3) {
+                plusDay = 12;
+            }
+            BigDecimal bigDecimal = new BigDecimal("0");
+            TVip info = vipClient.getInfo1(giveVipDto.getVipId()).getData();
+            switch (giveVipDto.getType()){
+                case 1:
+                    bigDecimal = bigDecimal.add(info.getMonthlyCard()==null?new BigDecimal(0):info.getMonthlyCard());
+                    break;
+                case 2:
+                    bigDecimal = bigDecimal.add(info.getSeasonCard()==null?new BigDecimal(0):info.getSeasonCard());
+                    break;
+                case 3:
+                    bigDecimal = bigDecimal.add(info.getAnnualCard()==null?new BigDecimal(0):info.getAnnualCard());
+                    break;
+            }
+            //增加vipDetail
+            giveVipUtil.sendVip(nowUser, giveVipDto.getVipId(),plusDay,giveVipDto.getType());
+            appUserService.updateById(nowUser);
+            // 新增后台赠送记录
+            TGrantVip tGrantVip = new TGrantVip();
+            tGrantVip.setCode(OrderCodeUtil.getOrderCode("ZS"));
+            tGrantVip.setAppUserId(nowUser.getId());
+            tGrantVip.setVipId(giveVipDto.getVipId());
+            tGrantVip.setOrderAmount(bigDecimal);
+            tGrantVip.setCreateTime(LocalDateTime.now());
+            tGrantVip.setAppUserId(nowUser.getId());
+            orderClient.managementGiveVip(tGrantVip);
+        }
+        return R.ok();
+    }
+    
 
     @ApiOperation(value = "已赠送列表", tags = {"小程序-个人中心-邀请好友"})
     @PostMapping(value = "/user/invite/page")
@@ -1067,43 +1162,41 @@
         if (count==0){
             R<TIntegralRule> set = integralRuleClient.getSet();
             TIntegralRule data = set.getData();
-            JSONObject jsonObject = JSON.parseObject(data.getAddVehiclesEarnsPoints());
-
-
-            Integer point = 0;
-            //增加车牌50分,必填
+            if(null != data){
+                JSONObject jsonObject = JSON.parseObject(data.getAddVehiclesEarnsPoints());
+                Integer point = 0;
+                //增加车牌50分,必填
                 point = point+jsonObject.getInteger("num1");
                 if (doubleVip){
                     point = point+jsonObject.getInteger("num1");
                 }
-            //增加车型分
+                //增加车型分
                 if (StringUtils.isNotEmpty(appUserCar.getVehicleModel())){
                     point = point+jsonObject.getInteger("num2");
                     if (doubleVip){
                         point = point+jsonObject.getInteger("num2");
                     }
                 }
-            //增加车辆用途分
+                //增加车辆用途分
                 if (StringUtils.isNotEmpty(appUserCar.getVehicleUse())){
                     point = point+jsonObject.getInteger("num3");
                     if (doubleVip){
                         point = point+jsonObject.getInteger("num3");
                     }
                 }
-            //增加续航分
+                //增加续航分
                 if (StringUtils.isNotEmpty(appUserCar.getEndurance())){
                     point = point+jsonObject.getInteger("num4");
                     if (doubleVip){
                         point = point+jsonObject.getInteger("num4");
                     }
                 }
-
-            //增加积分记录
-            pointDetailUtil.addDetail(byId.getPoints(),byId.getPoints()+point,5,userId,appUserCar.getLicensePlate(),"","");
-            byId.setPoints(byId.getPoints()+point);
+    
+                //增加积分记录
+                pointDetailUtil.addDetail(byId.getPoints(),byId.getPoints()+point,5,userId,appUserCar.getLicensePlate(),"","");
+                byId.setPoints(byId.getPoints()+point);
+            }
             byId.setFirstAdd(1);
-
-
         }
         CarNumDto carNumDto = CarUtil.carNum(appUserCar.getLicensePlate());
         if (carNumDto==null){

--
Gitblit v1.7.1