Procházet zdrojové kódy

可用礼品卡列表

zoujiajian před 2 roky
rodič
revize
1e0b055a69

+ 3 - 2
netflix-service/src/main/java/com/cyksj/service/user/impl/UserServiceImpl.java

@@ -547,8 +547,9 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
 					throw BusinessRuntimeException.getInstance("该礼品卡对应的虚拟卡不存在,请联系客服");
 				}
 				GroupsRelation relationNoOrder = exchangeCodeService.getRelationNoOrder(sku, userId);
-				giftCardUserRecord.setRelationId(relationNoOrder.getId());
-				giftCardUserRecordMapper.updateById(giftCardUserRecord);
+				giftCardUserRecordMapper.update(null, Wrappers.lambdaUpdate(GiftCardUserRecord.class)
+						.set(GiftCardUserRecord::getRelationId, relationNoOrder.getId())
+						.eq(GiftCardUserRecord::getId, giftCardUserRecord.getId()));
 				log.info("发送至用户userId:{}礼品卡虚拟车票结束", userId);
 			}
 		}

+ 17 - 0
netflix-web/src/main/java/com/cyksj/web/controller/user/UserController.java

@@ -362,6 +362,23 @@ public class UserController {
         return GatewayResponse.SUCCESS.newBuilder().toResult(view);
     }
 
+    /**
+     * 可用现金礼品卡列表
+     */
+    @GetMapping("/get/available/giftCard")
+    public Result<List<GiftCardUserPayFrontView>> getAvailGiftCard() {
+        long userId = StpUserUtil.getLoginIdAsLong();
+        String condition = String.format("and to_user_id = %s", userId);
+        List<GiftCardUserPayFrontView> view = beanSearcher.searchAll(GiftCardUserPayFrontView.class, MapUtils.builder()
+                .put("condition", condition)
+                .put("uid", userId)
+                //现金卡
+                .field(GiftCardUserPayFrontView::getGcType, 1)
+                .orderBy(GiftCardUserRecordView::getIsUsed).asc()
+                .orderBy(GiftCardUserPayFrontView::getId).desc().build());
+        return GatewayResponse.SUCCESS.newBuilder().toResult(view);
+    }
+
     /**
      * 礼品卡分享详情
      */