From d8150effd61b8c22eea031de7789ecd610435b3b Mon Sep 17 00:00:00 2001 From: 无关风月 <443237572@qq.com> Date: 星期三, 14 八月 2024 10:16:36 +0800 Subject: [PATCH] 小程序扫一扫选择优惠券 --- ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TVipController.java | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 55 insertions(+), 0 deletions(-) diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TVipController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TVipController.java index 0a1e9a1..69430e4 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TVipController.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TVipController.java @@ -1,10 +1,12 @@ package com.ruoyi.other.controller; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.ruoyi.common.core.domain.R; import com.ruoyi.common.core.web.domain.AjaxResult; import com.ruoyi.common.core.web.page.PageInfo; import com.ruoyi.other.api.domain.TIntegralRule; +import com.ruoyi.other.api.domain.TUserTag; import com.ruoyi.other.api.domain.TVip; import com.ruoyi.other.service.TVipService; import io.swagger.annotations.ApiImplicitParam; @@ -13,6 +15,10 @@ import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; + +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; /** * <p> @@ -50,6 +56,16 @@ public AjaxResult<TVip> getInfo(Integer id) { return AjaxResult.ok(vipService.getById(id)); } + + /** + * 远程调用 + * @param id + * @return + */ + @PostMapping("/getInfo1") + public R<TVip> getInfo1(@RequestParam("id")Integer id) { + return R.ok(vipService.getById(id)); + } @ApiOperation(value = "会员列表分页查询") @PostMapping(value = "/pageList") @ApiImplicitParams({ @@ -60,5 +76,44 @@ return AjaxResult.ok(vipService.pageList(pageCurr,pageSize)); } + //获取会员Map + @PostMapping(value = "/getVipMap") + public R<Map<Integer, String>> getVipMap(@RequestBody List<Integer> ids) { + + List<TVip> list = vipService.lambdaQuery().in(!ids.isEmpty(), TVip::getId, ids).list(); + Map<Integer, String> idNameMap = list.stream() + .collect(Collectors.toMap( + TVip::getId, + TVip::getName + )); + return R.ok(idNameMap); + } + + /** + * 获取最高抵扣、最低起步价,最高折扣的会员 + * @param type 1=最高抵扣、2=最低起步价,3=最高折扣 + * @return + */ + @PostMapping(value = "/getVipInfoByType") + public R<TVip> getVipInfoByType(@RequestParam Integer type){ + switch (type){ + case 1: + return R.ok(vipService.getOne(Wrappers.lambdaQuery(TVip.class) + .eq(TVip::getReveal,1) + .orderByDesc(TVip::getMaximumDeduction) + .last("LIMIT 1"))); + case 2: + return R.ok(vipService.getOne(Wrappers.lambdaQuery(TVip.class) + .eq(TVip::getReveal,1) + .orderByAsc(TVip::getMonthlyCard) + .last("LIMIT 1"))); + default: + return R.ok(vipService.getOne(Wrappers.lambdaQuery(TVip.class) + .eq(TVip::getReveal,1) + .orderByDesc(TVip::getMonthlyCardDiscount) + .last("LIMIT 1"))); + } + } + } -- Gitblit v1.7.1