diff --git a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/app/member/MemberController.java b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/app/member/MemberController.java index d8ba080d3..ae181e67f 100644 --- a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/app/member/MemberController.java +++ b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/app/member/MemberController.java @@ -12,11 +12,13 @@ import cn.iocoder.yudao.module.shop.service.recharge.PhoneRecordService; import cn.iocoder.yudao.module.shop.service.recharge.RechargeGearService; import cn.iocoder.yudao.module.shop.service.recharge.RechargeOrderService; import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.tags.Tag; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import java.util.List; @@ -64,6 +66,12 @@ public class MemberController { return CommonResult.success(rechargeOrderService.memberHeadInfo()); } - + @Operation(summary = "根据手机号查询档次信息") + @RequestMapping(value = "/memberByHomeGradeInfo", method = RequestMethod.GET) + @PreAuthenticated + @TenantIgnore + public CommonResult> memberByPhoneGradeInfo(@RequestParam String phone) { + return CommonResult.success(rechargeGearService.memberByPhoneGradeInfo(phone)); + } } diff --git a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/recharge/RechargeGearService.java b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/recharge/RechargeGearService.java index 507476d2e..7a05e26cf 100644 --- a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/recharge/RechargeGearService.java +++ b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/recharge/RechargeGearService.java @@ -68,4 +68,6 @@ public interface RechargeGearService { List getRechargeGearList(RechargeGearExportReqVO exportReqVO); List getGradeInfo(); + + List memberByPhoneGradeInfo(String phone); } diff --git a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/recharge/RechargeGearServiceImpl.java b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/recharge/RechargeGearServiceImpl.java index db01cb0b0..a184481e6 100644 --- a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/recharge/RechargeGearServiceImpl.java +++ b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/recharge/RechargeGearServiceImpl.java @@ -125,4 +125,27 @@ public class RechargeGearServiceImpl implements RechargeGearService { return rechargeGearRespVOS; } + @Override + public List memberByPhoneGradeInfo(String phone) { + List rechargeGearDOS = rechargeGearMapper.selectList(Wrappers.lambdaQuery() + .eq(RechargeGearDO::getDeleted, 0)); + List rechargeGearRespVOS = RechargeGearConvert.INSTANCE.convertList(rechargeGearDOS); + RechargeOrderDO orderDO = orderMapper.selectOne(Wrappers.lambdaQuery().eq(RechargeOrderDO::getUserPhone, phone) + .eq(RechargeOrderDO::getPaid,1) + .last("LIMIT 1")); + if (Objects.nonNull(orderDO)) { + List infoDOS = phoneRecordMapper.selectList(Wrappers.lambdaQuery().eq(PhoneRecordDO::getRechargeOrderId, orderDO.getId())); + Map> collect = infoDOS.stream().collect(Collectors.groupingBy(PhoneRecordDO::getRechargeGearId)); + rechargeGearRespVOS.forEach(vo -> { + List infoDOS1 = collect.get(vo.getId()); + if (!CollectionUtils.isEmpty(infoDOS1)) { + vo.setIsExist("1"); + } else { + vo.setIsExist("0"); + } + }); + } + return rechargeGearRespVOS; + } + }