Browse Source

用户优惠券页面数据完善

skyline 1 năm trước cách đây
mục cha
commit
6156b129d4

+ 19 - 19
admin-web/src/views/admin/activity/userCoupon/index.vue

@@ -47,13 +47,13 @@
             @blur="loadData(true)"
             class="wd150 mr10">
         </el-input>
-        <el-input
-            v-model="state.formQuery.userName"
-            placeholder="用户名称"
-            clearable
-            @blur="loadData(true)"
-            class="wd150 mr10">
-        </el-input>
+<!--        <el-input-->
+<!--            v-model="state.formQuery.userName"-->
+<!--            placeholder="用户名称"-->
+<!--            clearable-->
+<!--            @blur="loadData(true)"-->
+<!--            class="wd150 mr10">-->
+<!--        </el-input>-->
         <el-input
             v-model="state.formQuery.mobilePhone"
             placeholder="手机号"
@@ -70,14 +70,14 @@
             class="wd150 mr10">
         </ext-d-select>
 
-        <ext-d-select
-            placeholder="用户状态"
-            v-model="state.formQuery.status"
-            type="User.status"
-            clearable
-            @blur="loadData(true)"
-            class="wd150 mr10">
-        </ext-d-select>
+<!--        <ext-d-select-->
+<!--            placeholder="用户状态"-->
+<!--            v-model="state.formQuery.status"-->
+<!--            type="User.status"-->
+<!--            clearable-->
+<!--            @blur="loadData(true)"-->
+<!--            class="wd150 mr10">-->
+<!--        </ext-d-select>-->
 
 
         <ext-d-select
@@ -135,7 +135,7 @@
               <ext-d-label type="User.status" v-model="row[field.prop]"></ext-d-label>
             </template>
             <template v-else-if="field.prop==='usageStatus'">
-              <ext-d-label type="UserCoupon.usageStatus" v-model="row[field.prop]"></ext-d-label>
+              <ext-d-label type="UserCoupon.usage" v-model="row[field.prop]"></ext-d-label>
             </template>
             <template v-else-if="field.prop==='allowStacke'">
               <ext-d-label type="Activity.allowStacke" v-model="row[field.prop]"></ext-d-label>
@@ -193,10 +193,10 @@ const state = reactive({
       },
       {label: '活动时间', prop: 'period', resizable: true, width: 350},
       {label: '优惠券名称', prop: 'couponName', align: 'center', width: 230},
-      {label: '用户名', prop: 'userName', resizable: true, width: 130},
+      {label: '用户ID', prop: 'userId', resizable: true, width: 130},
       {label: '手机号', prop: 'mobilePhone', resizable: true, width: 130},
-      {label: '有效期', prop: 'validity', resizable: true, width: 130},
-      {label: '用户状态', prop: 'status', resizable: true, width: 130},
+      {label: '有效期(天)', prop: 'validity', resizable: true, width: 130},
+      {label: '优惠券状态', prop: 'status', resizable: true, width: 130},
       {label: '使用状态', prop: 'usageStatus', resizable: true, width: 130},
       {label: '优惠允许叠加', prop: 'allowStacke', resizable: true, width: 130},
       {label: '创建时间', prop: 'createTime', resizable: true, width: 180},

+ 6 - 1
entity/src/main/java/com/kym/entity/miniapp/vo/UserCouponVo.java

@@ -25,6 +25,11 @@ public class UserCouponVo extends BaseEntity {
      */
     private Long couponId;
 
+    /**
+     * 优惠券名称
+     */
+    private String couponName;
+
     /**
      * 主活动id
      */
@@ -33,7 +38,7 @@ public class UserCouponVo extends BaseEntity {
     /**
      * 主活动名称
      */
-    private Long activityName;
+    private String activityName;
 
     /**
      * 用户id

+ 6 - 2
service/src/main/java/com/kym/service/miniapp/impl/UserCouponServiceImpl.java

@@ -25,6 +25,7 @@ import org.springframework.stereotype.Service;
 
 import java.time.LocalDateTime;
 import java.time.LocalTime;
+import java.util.stream.Collectors;
 
 /**
  * <p>
@@ -57,9 +58,11 @@ public class UserCouponServiceImpl extends MPJBaseServiceImpl<UserCouponMapper,
 
     @Override
     public PageBean<UserCouponVo> listUserCoupons(CouponQueryParam params) {
-        var userIds = userService.lambdaQuery()
+        var users = userService.lambdaQuery()
                 .like(CommUtil.isNotEmptyAndNull(params.getMobilePhone()), User::getMobilePhone, params.getMobilePhone())
-                .list().stream().map(User::getId).toList();
+                .list();
+        var userId2Mobile = users.stream().collect(Collectors.toMap(User::getId, User::getMobilePhone));
+        var userIds = users.stream().map(User::getId).toList();
 
         PageHelper.startPage(params.getPageNum(), params.getPageSize());
         var list = lambdaQuery()
@@ -76,6 +79,7 @@ public class UserCouponServiceImpl extends MPJBaseServiceImpl<UserCouponMapper,
         var voList = list.stream().map(userCoupon -> {
             var vo = new UserCouponVo();
             BeanUtils.copyProperties(userCoupon, vo);
+            vo.setMobilePhone(userId2Mobile.get(userCoupon.getUserId()));
             return vo;
         }).toList();
         var res = new PageBean<>(voList);