|
|
@@ -9,8 +9,10 @@ import cn.hutool.core.util.StrUtil;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.cyksj.common.exception.BusinessRuntimeException;
|
|
|
+import com.cyksj.common.util.Jsons;
|
|
|
import com.cyksj.enums.GatewayApiCode;
|
|
|
import com.cyksj.mapper.GroupsRelationMapper;
|
|
|
+import com.cyksj.mapper.OrderDiscountPlusPurchaseSkuRelationMapper;
|
|
|
import com.cyksj.mapper.OrderDonMapper;
|
|
|
import com.cyksj.mapper.UserMapper;
|
|
|
import com.cyksj.model.entity.*;
|
|
|
@@ -34,6 +36,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
import java.util.ArrayList;
|
|
|
+import java.util.Date;
|
|
|
import java.util.List;
|
|
|
import java.util.Optional;
|
|
|
|
|
|
@@ -69,6 +72,8 @@ public class GroupRelationFrontServiceImpl implements GroupRelationFrontService
|
|
|
|
|
|
private final HttpServletRequest request;
|
|
|
|
|
|
+ private final OrderDiscountPlusPurchaseSkuRelationMapper orderDiscountPlusPurchaseSkuRelationMapper;
|
|
|
+
|
|
|
@Override
|
|
|
public List<RenewalView> getMyTicket(long userId, Boolean isLoginPopularize, String customId) {
|
|
|
User u = userMapper.selectById(userId);
|
|
|
@@ -134,7 +139,33 @@ public class GroupRelationFrontServiceImpl implements GroupRelationFrontService
|
|
|
.eq(OrderDon::getUserId, ticket.getUserId())
|
|
|
.orderByDesc(OrderDon::getId)
|
|
|
.last("limit 1"));
|
|
|
- ticket.setPayTime(Optional.ofNullable(orderDon.getPayTime()).orElse(orderDon.getCreatedTime()));
|
|
|
+ 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(orderDon.getPayTime()).orElse(orderDon.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));
|
|
|
ticket.setRelationViews(relationUserViews);
|