From f91bb885d680d3f30cbf1bcffdd6819b3b10e6b1 Mon Sep 17 00:00:00 2001
From: 无关风月 <443237572@qq.com>
Date: 星期五, 01 十一月 2024 21:03:36 +0800
Subject: [PATCH] Merge branch 'master' of http://120.76.84.145:10101/gitblit/r/java/mx_charging_pile

---
 ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppUserController.java |   36 +++++++++++++++++++++++++++---------
 1 files changed, 27 insertions(+), 9 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 f06c968..3a6752e 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
@@ -5,6 +5,7 @@
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -40,6 +41,7 @@
 import com.ruoyi.order.api.model.TGrantVip;
 import com.ruoyi.other.api.domain.*;
 import com.ruoyi.other.api.domain.TCoupon;
+import com.ruoyi.other.api.domain.TVip;
 import com.ruoyi.other.api.dto.UnitListQueryDto;
 import com.ruoyi.other.api.feignClient.IntegralRuleClient;
 import com.ruoyi.other.api.feignClient.OtherClient;
@@ -585,6 +587,8 @@
         return R.ok();
 
     }
+    @Resource
+    private TAppUserVipDetailService appUserVipDetailService;
 
     @ApiOperation(value = "个人中心信息", tags = {"小程序-个人中心"})
     @GetMapping(value = "/user/info")
@@ -601,12 +605,14 @@
         if (byId.getVipEndTime()==null||byId.getVipEndTime().isBefore(LocalDateTime.now())){
             appUserInfoDto.setIsVip(0);
         }else {
+            TAppUserVipDetail one = appUserVipDetailService.getOne(new LambdaQueryWrapper<TAppUserVipDetail>()
+                    .eq(TAppUserVipDetail::getAppUserId, userId)
+                    .eq(TAppUserVipDetail::getVipId, byId.getVipId())
+                    .last(" and now() between start_time and end_time"));
+            Long count = appCouponService.lambdaQuery().eq(TAppCoupon::getDetailId, one.getId()).count();
+            appUserInfoDto.setVipCouponNum(count);
             appUserInfoDto.setIsVip(1);
             appUserInfoDto.setVipExpireTime(byId.getVipEndTime());
-
-
-
-
 
 
 
@@ -705,7 +711,7 @@
 
 
     @ApiOperation(value = "优惠卷详情(1可使用2不可用)", tags = {"小程序-个人中心"})
-    @GetMapping(value = "/user/coupon/getById")
+    @PostMapping(value = "/user/coupon/getById")
     public R<TAppCoupon> couponGetById(@RequestParam("id")Long id) {
         TAppCoupon appCoupon = appCouponService.getById(id);
         appCoupon.setUid(id.toString());
@@ -736,13 +742,13 @@
             TVip info = vipClient.getInfo1(giveVipDto.getVipId()).getData();
         switch (giveVipDto.getType()){
             case 1:
-                bigDecimal = bigDecimal.add(info.getMonthlyCard());
+                bigDecimal = bigDecimal.add(info.getMonthlyCard()==null?new BigDecimal(0):info.getMonthlyCard());
                 break;
             case 2:
-                bigDecimal = bigDecimal.add(info.getSeasonCard());
+                bigDecimal = bigDecimal.add(info.getSeasonCard()==null?new BigDecimal(0):info.getSeasonCard());
                 break;
             case 3:
-                bigDecimal = bigDecimal.add(info.getAnnualCard());
+                bigDecimal = bigDecimal.add(info.getAnnualCard()==null?new BigDecimal(0):info.getAnnualCard());
                 break;
         }
             //增加vipDetail
@@ -765,8 +771,12 @@
     @PostMapping(value = "/user/invite/page")
     public R<Page<TInviteUser>> invitePage(@RequestBody BasePage basePage) {
         Long userId = tokenService.getLoginUserApplet().getUserId();
-
         Page<TInviteUser> page = inviteUserService.lambdaQuery().eq(TInviteUser::getAppUserId, userId).isNotNull(TInviteUser::getAward).orderByDesc(TInviteUser::getCreateTime).page(Page.of(basePage.getPageCurr(), basePage.getPageSize()));
+        for (TInviteUser record : page.getRecords()) {
+            TAppUser byId = appUserService.getById(record.getBeInvitedAppUserId());
+            record.setAvatar(byId.getAvatar());
+            record.setName(byId.getName());
+        }
         return R.ok(page);
     }
 
@@ -961,6 +971,10 @@
                 .eq(TAppUserSign::getAppUserId, userId)
                 .orderByDesc(TAppUserSign::getSignDay)
                 .list();
+        for (TAppUserSign signRecord : signRecords) {
+            int i = signDayUtil.calculateContinuousSignDays1(signRecord.getAppUserId(), signRecord.getSignDay());
+            signRecord.setContinueDays(i);
+        }
         return R.ok(signRecords);
 
     }
@@ -1115,6 +1129,10 @@
     public R getModel(String id) throws Exception {
         String modelById = CarBrandUtil.getModelById(id);
         JSONObject jsonObject = JSON.parseObject(modelById);
+        Integer code = jsonObject.getInteger("code");
+        if (code==701){
+            return R.fail("当前品牌暂无分类");
+        }
         JSONArray data = jsonObject.getJSONArray("data");
         JSONArray backList = new JSONArray();
         for (Object datum : data) {

--
Gitblit v1.7.1