From 2f8e70ad2884d2b6b7443dfae0af11ae9cfc8b99 Mon Sep 17 00:00:00 2001
From: 无关风月 <443237572@qq.com>
Date: 星期五, 28 二月 2025 17:44:10 +0800
Subject: [PATCH] bug修改

---
 manage/src/main/java/com/jilongda/manage/controller/TAppUserController.java |   36 +++++++++++++++++++++++++++++++-----
 1 files changed, 31 insertions(+), 5 deletions(-)

diff --git a/manage/src/main/java/com/jilongda/manage/controller/TAppUserController.java b/manage/src/main/java/com/jilongda/manage/controller/TAppUserController.java
index 23f26e3..1222643 100644
--- a/manage/src/main/java/com/jilongda/manage/controller/TAppUserController.java
+++ b/manage/src/main/java/com/jilongda/manage/controller/TAppUserController.java
@@ -5,13 +5,17 @@
 import com.jilongda.common.basic.ApiResult;
 import com.jilongda.common.basic.PageInfo;
 import com.jilongda.manage.model.TAppUser;
+import com.jilongda.manage.model.TCouponReceive;
 import com.jilongda.manage.model.TOptometry;
 import com.jilongda.manage.model.TOrder;
+import com.jilongda.manage.query.TAppUserCouponQuery;
 import com.jilongda.manage.query.TAppUserQuery;
 import com.jilongda.manage.query.TOptometristQuery;
 import com.jilongda.manage.service.TAppUserService;
+import com.jilongda.manage.service.TCouponReceiveService;
 import com.jilongda.manage.service.TOptometryService;
 import com.jilongda.manage.service.TOrderService;
+import com.jilongda.manage.vo.TAppUserCouponVO;
 import com.jilongda.manage.vo.TAppUserVO;
 import com.jilongda.manage.vo.TOptometristVO;
 import io.swagger.annotations.Api;
@@ -32,7 +36,7 @@
  * @since 2024-12-09
  */
 @RestController
-@Api(tags = "用户管理")
+@Api(tags = "小程序用户管理")
 @RequestMapping("/t-app-user")
 public class TAppUserController {
 
@@ -42,6 +46,8 @@
     private TOrderService orderService;
     @Resource
     private TOptometryService tOptometryService;
+    @Resource
+    private TCouponReceiveService couponReceiveService;
     @ApiOperation(value = "用户列表")
     @PostMapping(value = "/pageList")
     public ApiResult<PageInfo<TAppUserVO>> pageList(@RequestBody TAppUserQuery query) {
@@ -79,11 +85,17 @@
                 .eq(TOptometry::getStatus, 3).list().size();
         tAppUserVO.setOptometryCount(size);
         // 查询最后消费时间
-        tAppUserVO.setSalesTime(orderService.lambdaQuery().eq(TOrder::getUserId, tAppUserVO.getId())
-                .orderByDesc(TOrder::getCreateTime).last("limit 1").one().getCreateTime());
+        TOrder order = orderService.lambdaQuery().eq(TOrder::getUserId, tAppUserVO.getId())
+                .orderByDesc(TOrder::getCreateTime).last("limit 1").one();
+        if (order!=null){
+            tAppUserVO.setSalesTime(order.getCreateTime());
+        }
         // 查询最后验光时间
-        tAppUserVO.setOptometryTime(tOptometryService.lambdaQuery().eq(TOptometry::getUserId, tAppUserVO.getId())
-                .eq(TOptometry::getStatus, 3).orderByDesc(TOptometry::getCreateTime).last("limit 1").one().getCreateTime());
+        TOptometry optometry = tOptometryService.lambdaQuery().eq(TOptometry::getUserId, tAppUserVO.getId())
+                .eq(TOptometry::getStatus, 3).orderByDesc(TOptometry::getCreateTime).last("limit 1").one();
+        if (optometry!=null){
+            tAppUserVO.setOptometryTime(optometry.getCreateTime());
+        }
         // 查询订单总额
         BigDecimal reduce = orderService.lambdaQuery().eq(TOrder::getUserId, byId.getId()).list().stream().map(TOrder::getPayMoney)
                 .reduce(BigDecimal.ZERO, BigDecimal::add);
@@ -91,5 +103,19 @@
 
         return ApiResult.success(tAppUserVO);
     }
+    @ApiOperation(value = "用户详情-查看优惠券")
+    @PostMapping(value = "/getCouponDetailById")
+    public ApiResult<PageInfo<TAppUserCouponVO>> getCouponDetailById(@RequestBody TAppUserCouponQuery query) {
+        PageInfo<TAppUserCouponVO> appUserVOPageInfo = couponReceiveService.pageList(query);
+        return ApiResult.success(appUserVOPageInfo);
+    }
+
+    @ApiOperation(value = "用户信息修改")
+    @PostMapping(value = "/updateUser")
+    public ApiResult<String> updateUser(@RequestBody TAppUser appUser) {
+       appUserService.updateById(appUser);
+        return ApiResult.success();
+    }
+
 }
 

--
Gitblit v1.7.1