Jelajahi Sumber

fix 修改官网平台排序展示规则;多张车票返回购买时间

zoujiajian 2 tahun lalu
induk
melakukan
24a085bd45

+ 1 - 1
netflix-dao/src/main/java/com/cyksj/model/views/GoodsFrontListView.java

@@ -23,7 +23,7 @@ import java.util.List;
 @Setter
 @SearchBean(tables = "goods_don g",
 		where = "g.deleted is true and g.status is true",
-		orderBy = "g.sort_by desc, g.id")
+		orderBy = "g.sort_by asc, g.id")
 @JsonInclude(JsonInclude.Include.NON_NULL)
 public class GoodsFrontListView {
 	@DbField("g.id")

+ 3 - 0
netflix-dao/src/main/java/com/cyksj/model/views/RenewalView.java

@@ -135,6 +135,9 @@ public class RenewalView {
     @DbField("gr.yhs_id")
     private Long yhsId;
 
+    @DbIgnore
+    private Date payTime;
+
     @DbIgnore
     private GoodsDonViews goodsDonViews;
 

+ 12 - 8
netflix-service/src/main/java/com/cyksj/service/relation/impl/GroupRelationFrontServiceImpl.java

@@ -35,7 +35,7 @@ import org.springframework.transaction.annotation.Transactional;
 import javax.servlet.http.HttpServletRequest;
 import java.util.ArrayList;
 import java.util.List;
-import java.util.stream.Collectors;
+import java.util.Optional;
 
 /*
  *项目名: netflix
@@ -88,10 +88,7 @@ public class GroupRelationFrontServiceImpl implements GroupRelationFrontService
 				.build());
 		//过滤邀请制、已失效的车位
 		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) {
 				ticket.setPassword(null);
 			}
@@ -131,14 +128,21 @@ public class GroupRelationFrontServiceImpl implements GroupRelationFrontService
 				}
 				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"));
+				ticket.setPayTime(Optional.ofNullable(orderDon.getPayTime()).orElse(orderDon.getCreatedTime()));
+			}
 			List<GroupsRelationUserView> relationUserViews = groupsRelationMapper.getUserRelationUserViews(ticket.getGroupId(), ticket.getRelationId(), ticket.getUserId(), List.of(GroupsRelation.Status.validity, GroupsRelation.Status.outside));
 			ticket.setRelationViews(relationUserViews);
 			if (ticket.getExpiryTime() != null) {
 				ticket.setExpiryTimeStr(DateUtil.format(ticket.getExpiryTime(), "yyyy-MM-dd"));
 			}
-			return true;
-		}).collect(Collectors.toList());
-		return collect;
+		});
+		return list;
 	}
 
 	@Override

+ 2 - 2
netflix-web/src/main/java/com/cyksj/web/controller/goods/GoodsDonController.java

@@ -71,7 +71,7 @@ public class GoodsDonController {
         SearchResult<GoodsDon> search = beanSearcher.search(GoodsDon.class, MapUtils.flatBuilder(request.getParameterMap())
                 .field(GoodsDon::getStatus, true)
                 .field(GoodsDon::getDeleted, true)
-                .orderBy(GoodsDon::getSortBy).desc()
+                .orderBy(GoodsDon::getSortBy).asc()
                 .orderBy(GoodsDon::getId).asc()
                 .build()
         );
@@ -101,7 +101,7 @@ public class GoodsDonController {
                 .field(GoodsDonPopularizeView::getStatus, true)
                 .field(GoodsDonPopularizeView::getDeleted, true)
                 .field(GoodsDonPopularizeView::getType, 1)
-                .orderBy(GoodsDonPopularizeView::getSortBy).desc()
+                .orderBy(GoodsDonPopularizeView::getSortBy).asc()
                 .orderBy(GoodsDonPopularizeView::getId).asc()
                 .build());
         DateTime now = DateTime.now();