|
@@ -9,8 +9,10 @@ import cn.hutool.core.util.StrUtil;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.cyksj.common.exception.BusinessRuntimeException;
|
|
import com.cyksj.common.exception.BusinessRuntimeException;
|
|
|
|
|
+import com.cyksj.common.util.Jsons;
|
|
|
import com.cyksj.enums.GatewayApiCode;
|
|
import com.cyksj.enums.GatewayApiCode;
|
|
|
import com.cyksj.mapper.GroupsRelationMapper;
|
|
import com.cyksj.mapper.GroupsRelationMapper;
|
|
|
|
|
+import com.cyksj.mapper.OrderDiscountPlusPurchaseSkuRelationMapper;
|
|
|
import com.cyksj.mapper.OrderDonMapper;
|
|
import com.cyksj.mapper.OrderDonMapper;
|
|
|
import com.cyksj.mapper.UserMapper;
|
|
import com.cyksj.mapper.UserMapper;
|
|
|
import com.cyksj.model.entity.*;
|
|
import com.cyksj.model.entity.*;
|
|
@@ -34,8 +36,9 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
|
|
|
+import java.util.Date;
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
-import java.util.stream.Collectors;
|
|
|
|
|
|
|
+import java.util.Optional;
|
|
|
|
|
|
|
|
/*
|
|
/*
|
|
|
*项目名: netflix
|
|
*项目名: netflix
|
|
@@ -69,6 +72,8 @@ public class GroupRelationFrontServiceImpl implements GroupRelationFrontService
|
|
|
|
|
|
|
|
private final HttpServletRequest request;
|
|
private final HttpServletRequest request;
|
|
|
|
|
|
|
|
|
|
+ private final OrderDiscountPlusPurchaseSkuRelationMapper orderDiscountPlusPurchaseSkuRelationMapper;
|
|
|
|
|
+
|
|
|
@Override
|
|
@Override
|
|
|
public List<RenewalView> getMyTicket(long userId, Boolean isLoginPopularize, String customId) {
|
|
public List<RenewalView> getMyTicket(long userId, Boolean isLoginPopularize, String customId) {
|
|
|
User u = userMapper.selectById(userId);
|
|
User u = userMapper.selectById(userId);
|
|
@@ -88,10 +93,7 @@ public class GroupRelationFrontServiceImpl implements GroupRelationFrontService
|
|
|
.build());
|
|
.build());
|
|
|
//过滤邀请制、已失效的车位
|
|
//过滤邀请制、已失效的车位
|
|
|
DateTime now = DateTime.now();
|
|
DateTime now = DateTime.now();
|
|
|
- List<RenewalView> collect = list.stream().filter(ticket -> {
|
|
|
|
|
- if (ticket.getExpiryTime() != null && ticket.getExpiryTime().before(now)) {
|
|
|
|
|
- return false;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ list.stream().forEach(ticket -> {
|
|
|
if (ticket.getGoodsId() == 18 && ticket.getSkuNum() > 1) {
|
|
if (ticket.getGoodsId() == 18 && ticket.getSkuNum() > 1) {
|
|
|
ticket.setPassword(null);
|
|
ticket.setPassword(null);
|
|
|
}
|
|
}
|
|
@@ -131,14 +133,47 @@ public class GroupRelationFrontServiceImpl implements GroupRelationFrontService
|
|
|
}
|
|
}
|
|
|
ticket.setRemainDays(remainDays);
|
|
ticket.setRemainDays(remainDays);
|
|
|
}
|
|
}
|
|
|
|
|
+ if (list.size() > 1 && ticket.getGoodsId() != 18) {
|
|
|
|
|
+ OrderDon orderDon = orderDonMapper.selectOne(Wrappers.lambdaQuery(OrderDon.class)
|
|
|
|
|
+ .eq(OrderDon::getRelationId, ticket.getRelationId())
|
|
|
|
|
+ .eq(OrderDon::getUserId, ticket.getUserId())
|
|
|
|
|
+ .orderByDesc(OrderDon::getId)
|
|
|
|
|
+ .last("limit 1"));
|
|
|
|
|
+ Date payTime = null;
|
|
|
|
|
+ if (orderDon != null) {
|
|
|
|
|
+ payTime = Optional.ofNullable(orderDon.getPayTime()).orElse(orderDon.getCreatedTime());
|
|
|
|
|
+ }
|
|
|
|
|
+ //加购订单
|
|
|
|
|
+ if (orderDon == null) {
|
|
|
|
|
+ List<OrderDiscountPlusPurchaseSkuRelation> plusPurchaseSkuRelations = orderDiscountPlusPurchaseSkuRelationMapper.selectPlusRelationByIdAndUserId(ticket.getRelationId(), ticket.getUserId());
|
|
|
|
|
+ for (OrderDiscountPlusPurchaseSkuRelation data : plusPurchaseSkuRelations) {
|
|
|
|
|
+ String relationIds = data.getRelationIds();
|
|
|
|
|
+ if (StrUtil.isEmpty(relationIds)) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ try {
|
|
|
|
|
+ List<Long> relationList = Jsons.parseList(relationIds, Long.class);
|
|
|
|
|
+ if (relationList.contains(ticket.getRelationId())) {
|
|
|
|
|
+ OrderDon plusOrder = orderDonMapper.selectById(data.getOrderId());
|
|
|
|
|
+ if (plusOrder != null) {
|
|
|
|
|
+ payTime = Optional.ofNullable(plusOrder.getPayTime()).orElse(plusOrder.getCreatedTime());
|
|
|
|
|
+ }
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ ticket.setPayTime(payTime);
|
|
|
|
|
+ }
|
|
|
List<GroupsRelationUserView> relationUserViews = groupsRelationMapper.getUserRelationUserViews(ticket.getGroupId(), ticket.getRelationId(), ticket.getUserId(), List.of(GroupsRelation.Status.validity, GroupsRelation.Status.outside));
|
|
List<GroupsRelationUserView> relationUserViews = groupsRelationMapper.getUserRelationUserViews(ticket.getGroupId(), ticket.getRelationId(), ticket.getUserId(), List.of(GroupsRelation.Status.validity, GroupsRelation.Status.outside));
|
|
|
ticket.setRelationViews(relationUserViews);
|
|
ticket.setRelationViews(relationUserViews);
|
|
|
if (ticket.getExpiryTime() != null) {
|
|
if (ticket.getExpiryTime() != null) {
|
|
|
ticket.setExpiryTimeStr(DateUtil.format(ticket.getExpiryTime(), "yyyy-MM-dd"));
|
|
ticket.setExpiryTimeStr(DateUtil.format(ticket.getExpiryTime(), "yyyy-MM-dd"));
|
|
|
}
|
|
}
|
|
|
- return true;
|
|
|
|
|
- }).collect(Collectors.toList());
|
|
|
|
|
- return collect;
|
|
|
|
|
|
|
+ });
|
|
|
|
|
+ return list;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|