From 071a98a0327d8e55f1808bf6871b7b638c193c37 Mon Sep 17 00:00:00 2001 From: zhouwentao <1577701412@qq.com> Date: Wed, 17 Apr 2024 10:04:26 +0800 Subject: [PATCH] updates --- .../mini/controller/MiniVipController.java | 45 ++++++++++--------- 1 file changed, 23 insertions(+), 22 deletions(-) diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/mini/controller/MiniVipController.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/mini/controller/MiniVipController.java index f3032be..1e7d317 100644 --- a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/mini/controller/MiniVipController.java +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/mini/controller/MiniVipController.java @@ -48,62 +48,63 @@ public class MiniVipController { private IYxVipSkuService yxVipSkuService; @Autowired private MiniUserService miniUserService; + @GetMapping(value = "/getVipInfo") @ApiOperation(value = "获取vip信息") - public Result vipInfo(){ + public Result vipInfo() { LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); - AssertUtils.notNull(loginUser,"未获取到登录信息"); + AssertUtils.notNull(loginUser, "未获取到登录信息"); VipDTO userVip = miniUserService.getUserVip(loginUser.getId()); return Result.OK(userVip); } @GetMapping(value = "/sku/all") @ApiOperation(value = "获取全部商品信息") - public Result skuAll(@RequestParam(defaultValue = "") String provider){ - if (StringUtils.isNotBlank(provider) && "toutiao".equals(provider)) { + public Result skuAll(@RequestParam(defaultValue = "") String provider) { + /*if (StringUtils.isNotBlank(provider) && "toutiao".equals(provider)) { LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); queryWrapper.eq(YxVipSku::getSkuName,"测试体验卡"); queryWrapper.orderByDesc(YxVipSku::getSkuPrice); List list = yxVipSkuService.list(queryWrapper); return Result.OK(list); - }else{ - LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); - queryWrapper.eq(YxVipSku::getSaleable, "1"); - queryWrapper.orderByDesc(YxVipSku::getSkuPrice); - queryWrapper.ne(YxVipSku::getSkuName,"测试体验卡"); - List list = yxVipSkuService.list(queryWrapper); - return Result.OK(list); - } + }else{*/ + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(YxVipSku::getSaleable, "1"); + queryWrapper.orderByDesc(YxVipSku::getSkuPrice); + queryWrapper.ne(YxVipSku::getSkuName, "测试体验卡"); + List list = yxVipSkuService.list(queryWrapper); + return Result.OK(list); +// } } @PostMapping(value = "/card/activation") @ApiOperation(value = "卡密激活") - public Result cardActivation(@RequestBody JSONObject jsonObject){ + public Result cardActivation(@RequestBody JSONObject jsonObject) { LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); SysUser user = sysUserService.getById(sysUser.getId()); - AssertUtils.notNull(user,"获取用户信息失败,请联系管理员"); + AssertUtils.notNull(user, "获取用户信息失败,请联系管理员"); String card = jsonObject.getString("card"); - AssertUtils.notNull(card,"请输入卡密"); + AssertUtils.notNull(card, "请输入卡密"); //检查card是否有效 boolean cardValid = yxVipCardService.cardIsValid(card); - AssertUtils.isTrue(cardValid,"当前卡密无效或已被使用"); + AssertUtils.isTrue(cardValid, "当前卡密无效或已被使用"); YxVipCard yxVipCard = yxVipCardService.getOne(new LambdaQueryWrapper().eq(YxVipCard::getCardNum, card)); VipDTO userVip = miniUserService.getUserVip(user.getId()); - if (userVip!=null && userVip.getVipLevel()!=0) { - AssertUtils.notTrue(yxVipSkuService.convertVipLevel(yxVipCard.getSkuCode())<=userVip.getVipLevel(),"该权益您已激活!不可重复兑换"); + if (userVip != null && userVip.getVipLevel() != 0) { + AssertUtils.notTrue(yxVipSkuService.convertVipLevel(yxVipCard.getSkuCode()) <= userVip.getVipLevel(), "该权益您已激活!不可重复兑换"); } //使用卡密 boolean exchange = yxVipCardService.exchange(card, user.getId()); - AssertUtils.isTrue(exchange,"当前卡密已被使用"); + AssertUtils.isTrue(exchange, "当前卡密已被使用"); return Result.OK("激活成功"); } @GetMapping(value = "/orderDetail") @ApiOperation(value = "获取订单详情") - public Result buy(@RequestParam(value = "orderCode")String orderCode){ - AssertUtils.notNull(orderCode,"订单编号为空!"); + public Result buy(@RequestParam(value = "orderCode") String orderCode) { + AssertUtils.notNull(orderCode, "订单编号为空!"); YxOrder yxOrder = yxOrderService.getOne(new LambdaQueryWrapper().eq(YxOrder::getOrderCode, orderCode)); - AssertUtils.notNull(yxOrder,"订单信息未找到!"); + AssertUtils.notNull(yxOrder, "订单信息未找到!"); return Result.OK(yxOrder); } }