|
@@ -240,16 +240,6 @@ public class MemberRankSettingServiceImpl extends BaseServiceImpl<Integer, Membe
|
|
|
public HttpResponseResult activeBuy(MemberPayParamDto memberPayParamDto) throws Exception {
|
|
|
SysUser sysUser = Optional.ofNullable(sysUserFeignService.queryUserInfo()).orElseThrow(()-> new BizException("请登录"));
|
|
|
Student student = studentService.getLocked(sysUser.getId());
|
|
|
- //判断用户是否已存在订单
|
|
|
- List<StudentPaymentOrder> memberIngOrders = studentPaymentOrderService.queryByCondition(GroupType.LIVE_BUY,null,student.getUserId(), DealStatusEnum.ING,OrderTypeEnum.LIVE_BUY);
|
|
|
- if (CollectionUtils.isNotEmpty(memberIngOrders)) {
|
|
|
- HttpResponseResult result = studentPaymentOrderService.checkRepeatPay(memberIngOrders.get(0), memberPayParamDto.getRepeatPay());
|
|
|
- if (result.getCode() != 200) {
|
|
|
- return result;
|
|
|
- }
|
|
|
- //还原库存
|
|
|
- liveGoodsService.addGoodsStock(memberPayParamDto.getLiveGoodsId(),memberPayParamDto.getLiveId());
|
|
|
- }
|
|
|
String activeConfig = sysConfigDao.findConfigValue("cloud_teacher_active_config");
|
|
|
List<Cloud2022ActivityDto> cloud2022ActivityDtos = JSONArray.parseArray(activeConfig, Cloud2022ActivityDto.class);
|
|
|
List<Cloud2022ActivityDto> activityDtos = cloud2022ActivityDtos.stream().
|
|
@@ -262,6 +252,16 @@ public class MemberRankSettingServiceImpl extends BaseServiceImpl<Integer, Membe
|
|
|
//判断当前商品是否可以购买(库存、上架状态、是否购买过)
|
|
|
//如果是云教练商品,那么只能购买一次、如果是免费直播课,那么每次上架只能买一次,总共只能买2次
|
|
|
if(memberPayParamDto.getLiveGoodsId() == 1){
|
|
|
+ //判断用户是否已存在订单
|
|
|
+ List<StudentPaymentOrder> memberIngOrders = studentPaymentOrderService.queryByCondition(GroupType.LIVE_BUY,null,student.getUserId(), DealStatusEnum.ING,OrderTypeEnum.LIVE_BUY);
|
|
|
+ if (CollectionUtils.isNotEmpty(memberIngOrders)) {
|
|
|
+ HttpResponseResult result = studentPaymentOrderService.checkRepeatPay(memberIngOrders.get(0), memberPayParamDto.getRepeatPay());
|
|
|
+ if (result.getCode() != 200) {
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+ //还原库存
|
|
|
+ liveGoodsService.addGoodsStock(memberPayParamDto.getLiveGoodsId(),memberPayParamDto.getLiveId());
|
|
|
+ }
|
|
|
//是否还有购买资格
|
|
|
activityId = Integer.parseInt(activityDtos.get(0).getActivityId());
|
|
|
VipGroupActivity vipGroupActivity = Optional.ofNullable(vipGroupActivityDao.get(activityId)).orElseThrow(()-> new BizException("活动不存在"));
|