zoujiajian пре 2 година
родитељ
комит
12fc8c103c

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

@@ -74,6 +74,9 @@ public class GroupsRelationView {
     @DbField("gr.user_id")
     private Long userId;
 
+    @DbField("gr.yhs_id")
+    private Long yhsId;
+
     @DbField("gr.start_time")
     private Date startTime;
 

+ 1 - 1
netflix-service/src/main/java/com/cyksj/service/order/UserRealOrderBenefitsService.java

@@ -32,5 +32,5 @@ public interface UserRealOrderBenefitsService {
 	/**
 	 * 实物权益可选车票
 	 */
-	List<UserAvailableGoodsTicketView> getAvailableBenefitsTickets(Long userId, Long orderId);
+	List<UserAvailableGoodsTicketView> getAvailableBenefitsTickets(Long userId, Long orderId, Long yhsId);
 }

+ 1 - 1
netflix-service/src/main/java/com/cyksj/service/order/impl/OrderDonServiceImpl.java

@@ -2219,7 +2219,7 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
 			sku = goodsDonSkuMapper.selectById(skuId);
 		}
 		if (sku == null) {
-			throw BusinessRuntimeException.getInstance("商品不存在,请刷新页面重试");
+			throw BusinessRuntimeException.getInstance("商品不存在或已下架,请刷新页面重试");
 		}
 		//调整小店的规格价格
 		if (sku.getYhShopSkuPrice() != null) {

+ 2 - 1
netflix-service/src/main/java/com/cyksj/service/order/impl/UserRealOrderBenefitsImpl.java

@@ -191,7 +191,7 @@ public class UserRealOrderBenefitsImpl implements UserRealOrderBenefitsService {
 	}
 
 	@Override
-	public List<UserAvailableGoodsTicketView> getAvailableBenefitsTickets(Long userId, Long orderId) {
+	public List<UserAvailableGoodsTicketView> getAvailableBenefitsTickets(Long userId, Long orderId,Long yhsId) {
 		List<UserAvailableGoodsTicketView> ticketViews = beanSearcher.searchAll(UserAvailableGoodsTicketView.class, MapUtils.builder()
 				.field(UserAvailableGoodsTicketView::getUserId, userId)
 				.field(UserAvailableGoodsTicketView::getDeleted, true)
@@ -200,6 +200,7 @@ public class UserRealOrderBenefitsImpl implements UserRealOrderBenefitsService {
 		ticketViews.forEach(ticket -> {
 			List<GroupsRelationView> relationViewList = beanSearcher.searchAll(GroupsRelationView.class, MapUtils.builder()
 					.field(GroupsRelationView::getUserId, userId)
+					.field(GroupsRelationView::getYhsId, yhsId)
 					.field(GroupsRelationView::getGoodsId, ticket.getGoodsId())
 					.field(GroupsRelationView::getStatus, GroupsRelation.Status.validity.name())
 					.field(GroupsRelationView::getExpiryTime).op(Operator.NotNull)

+ 4 - 2
netflix-service/src/main/java/com/cyksj/service/shop/impl/YhShopServiceImpl.java

@@ -145,8 +145,9 @@ public class YhShopServiceImpl implements YhShopFrontService {
 
 	@Override
 	public Long checkShopCustomIdAndReturnShopId(String customId) {
+		Long yhsId = 0l;
 		if (StrUtil.isEmpty(customId)) {
-			return null;
+			return yhsId;
 		}
 		YhShop yhShop = yhShopMapper.selectOne(Wrappers.lambdaQuery(YhShop.class)
 				.eq(YhShop::getCustomId, customId).last("limit 1"));
@@ -159,7 +160,8 @@ public class YhShopServiceImpl implements YhShopFrontService {
 		if (!yhShop.getStatus()) {
 			throw BusinessRuntimeException.getInstance("该店铺已关闭,请联系客服");
 		}
-		return yhShop.getId();
+		yhsId = yhShop.getId();
+		return yhsId;
 	}
 
 	@Override

+ 6 - 6
netflix-web/src/main/java/com/cyksj/web/controller/user/UserController.java

@@ -94,14 +94,13 @@ public class UserController {
      * 个人中心详情
      */
     @GetMapping("/personal")
-    public Result<UserPersonalView> getPersonalView(Long yhsId) {
+    public Result<UserPersonalView> getPersonalView(String customId) {
         long userId = StpUserUtil.getLoginIdAsLong();
         List<Long> userIds = userBindRelationService.getRelationUserIdList(userId, null);
         MapBuilder builder = MapUtils.flatBuilder(request.getParameterMap());
-        if (yhsId == null) {
-            builder.field(UserTicketView::getYhsId, 0);
-        }
+        Long yhsId = yhShopFrontService.getYhsIdByCustomId(customId);
         Number ticketNum = beanSearcher.searchCount(UserTicketView.class, builder
+                .field(UserTicketView::getYhsId, yhsId)
                 .field(UserTicketView::getUserId, userIds).op(Operator.InList)
                 .field(RenewalView::getStatus, List.of("validity", "overdue", "outside")).op(Operator.InList)
                 .build());
@@ -133,9 +132,10 @@ public class UserController {
      * 用户已有实物权益 可选车票
      */
     @GetMapping("/get/available/benefits/tickets")
-    public Result<List<UserAvailableGoodsTicketView>> getAvailableBenefitsTickets(Long orderId) {
+    public Result<List<UserAvailableGoodsTicketView>> getAvailableBenefitsTickets(Long orderId, String customId) {
         Long userId = StpUserUtil.getLoginIdAsLong();
-        List<UserAvailableGoodsTicketView> tickets = userRealOrderBenefitsService.getAvailableBenefitsTickets(userId, orderId);
+        Long yhsId = yhShopFrontService.getYhsIdByCustomId(customId);
+        List<UserAvailableGoodsTicketView> tickets = userRealOrderBenefitsService.getAvailableBenefitsTickets(userId, orderId, yhsId);
         return GatewayResponse.SUCCESS.newBuilder().toResult(tickets);
     }