feat: 根据手机号查询档次信息
parent
0799a89b0e
commit
2d223030d4
|
@ -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<List<RechargeGearRespVO>> memberByPhoneGradeInfo(@RequestParam String phone) {
|
||||
return CommonResult.success(rechargeGearService.memberByPhoneGradeInfo(phone));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -68,4 +68,6 @@ public interface RechargeGearService {
|
|||
List<RechargeGearDO> getRechargeGearList(RechargeGearExportReqVO exportReqVO);
|
||||
|
||||
List<RechargeGearRespVO> getGradeInfo();
|
||||
|
||||
List<RechargeGearRespVO> memberByPhoneGradeInfo(String phone);
|
||||
}
|
||||
|
|
|
@ -125,4 +125,27 @@ public class RechargeGearServiceImpl implements RechargeGearService {
|
|||
return rechargeGearRespVOS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<RechargeGearRespVO> memberByPhoneGradeInfo(String phone) {
|
||||
List<RechargeGearDO> rechargeGearDOS = rechargeGearMapper.selectList(Wrappers.<RechargeGearDO>lambdaQuery()
|
||||
.eq(RechargeGearDO::getDeleted, 0));
|
||||
List<RechargeGearRespVO> rechargeGearRespVOS = RechargeGearConvert.INSTANCE.convertList(rechargeGearDOS);
|
||||
RechargeOrderDO orderDO = orderMapper.selectOne(Wrappers.<RechargeOrderDO>lambdaQuery().eq(RechargeOrderDO::getUserPhone, phone)
|
||||
.eq(RechargeOrderDO::getPaid,1)
|
||||
.last("LIMIT 1"));
|
||||
if (Objects.nonNull(orderDO)) {
|
||||
List<PhoneRecordDO> infoDOS = phoneRecordMapper.selectList(Wrappers.<PhoneRecordDO>lambdaQuery().eq(PhoneRecordDO::getRechargeOrderId, orderDO.getId()));
|
||||
Map<Long, List<PhoneRecordDO>> collect = infoDOS.stream().collect(Collectors.groupingBy(PhoneRecordDO::getRechargeGearId));
|
||||
rechargeGearRespVOS.forEach(vo -> {
|
||||
List<PhoneRecordDO> infoDOS1 = collect.get(vo.getId());
|
||||
if (!CollectionUtils.isEmpty(infoDOS1)) {
|
||||
vo.setIsExist("1");
|
||||
} else {
|
||||
vo.setIsExist("0");
|
||||
}
|
||||
});
|
||||
}
|
||||
return rechargeGearRespVOS;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue