zoujiajian 2 年 前
コミット
36285ca154

+ 1 - 1
netflix-service/src/main/java/com/cyksj/service/relation/GroupRelationFrontService.java

@@ -15,7 +15,7 @@ import java.util.List;
  *创建时间:2022/12/29 15:42
  */
 public interface GroupRelationFrontService {
-	List<RenewalView> getMyTicket(long userId, Boolean isLoginPopularize, Long yhsId);
+	List<RenewalView> getMyTicket(long userId, Boolean isLoginPopularize, String customId);
 
 	Boolean isJoinCorpWx(Long userId, Boolean isJoin, Boolean noCoupon);
 

+ 6 - 4
netflix-service/src/main/java/com/cyksj/service/relation/impl/GroupRelationFrontServiceImpl.java

@@ -21,6 +21,7 @@ import com.cyksj.service.chatgpt.ChatGptAuthService;
 import com.cyksj.service.mail.MailService;
 import com.cyksj.service.mange.coupon.CouponCommonService;
 import com.cyksj.service.relation.GroupRelationFrontService;
+import com.cyksj.service.shop.YhShopFrontService;
 import com.cyksj.service.user.UserBindRelationService;
 import com.ejlchina.searcher.BeanSearcher;
 import com.ejlchina.searcher.param.Operator;
@@ -64,10 +65,12 @@ public class GroupRelationFrontServiceImpl implements GroupRelationFrontService
 
 	private final OrderDonMapper orderDonMapper;
 
+	private final YhShopFrontService yhShopFrontService;
+
 	private final HttpServletRequest request;
 
 	@Override
-	public List<RenewalView> getMyTicket(long userId, Boolean isLoginPopularize, Long yhsId) {
+	public List<RenewalView> getMyTicket(long userId, Boolean isLoginPopularize, String customId) {
 		User u = userMapper.selectById(userId);
 		if (u == null) throw BusinessRuntimeException.getGatewayApiCode(GatewayApiCode.CMS_TOKEN_VALID);
 		if (u.getIsBlack()) {
@@ -75,12 +78,11 @@ public class GroupRelationFrontServiceImpl implements GroupRelationFrontService
 		}
 		List<Long> userIds = userBindRelationService.getRelationUserIdList(userId, u);
 		MapBuilder builder = MapUtils.flatBuilder(request.getParameterMap());
-		if (yhsId == null) {
-			builder.field(RenewalView::getYhsId, 0);
-		}
+		Long yhsId = yhShopFrontService.getYhsIdByCustomId(customId);
 		List<RenewalView> list = beanSearcher.searchAll(RenewalView.class, builder
 				.field(RenewalView::getUserId, 0).op(Operator.GreaterThan)
 				.field(RenewalView::getUserId, userIds).op(Operator.InList)
+				.field(RenewalView::getYhsId, yhsId)
 				.field(RenewalView::getStatus, List.of("validity", "overdue", "outside")).op(Operator.InList)
 				.orderBy(RenewalView::getExpiryTime).asc()
 				.build());

+ 2 - 0
netflix-service/src/main/java/com/cyksj/service/shop/YhShopFrontService.java

@@ -22,4 +22,6 @@ public interface YhShopFrontService {
 	Long checkShopCustomIdAndReturnShopId(String customId);
 
 	YhShopInfo getYhShopInfo(String customId);
+
+	Long getYhsIdByCustomId(String customId);
 }

+ 19 - 0
netflix-service/src/main/java/com/cyksj/service/shop/impl/YhShopServiceImpl.java

@@ -171,11 +171,30 @@ public class YhShopServiceImpl implements YhShopFrontService {
 	public YhShopInfo getYhShopInfo(String customId) {
 		YhShop yhShop = yhShopMapper.selectOne(Wrappers.lambdaQuery(YhShop.class)
 				.eq(YhShop::getCustomId, customId).last("limit 1"));
+		if (yhShop == null) {
+			return null;
+		}
 		YhShopInfo yhShopInfo = new YhShopInfo();
 		BeanUtil.copyProperties(yhShop, yhShopInfo);
 		return yhShopInfo;
 	}
 
+	@Override
+	public Long getYhsIdByCustomId(String customId) {
+		Long yhsId = 0l;
+		if (StrUtil.isEmpty(customId)) {
+			return yhsId;
+		}
+		customId = customId.trim();
+		YhShop yhShop = yhShopMapper.selectOne(Wrappers.lambdaQuery(YhShop.class)
+				.eq(YhShop::getCustomId, customId).last("limit 1"));
+		if (yhShop == null) {
+			return yhsId;
+		}
+		yhsId = yhShop.getId();
+		return yhsId;
+	}
+
 	public void checkShopInfo(String name, String customId) {
 		if (StrUtil.isEmpty(name)) {
 			throw BusinessRuntimeException.getInstance("请输入店铺名称");

+ 2 - 2
netflix-web/src/main/java/com/cyksj/web/controller/group/GroupRelationController.java

@@ -108,9 +108,9 @@ public class GroupRelationController {
     private final static Sequence SEQUENCE = new Sequence(0);
 
     @RequestMapping("/get/renewal")
-    public Result<List<RenewalView>> get(Boolean isLoginPopularize, Long yhsId) {
+    public Result<List<RenewalView>> get(Boolean isLoginPopularize, String customId) {
         long userId = StpUserUtil.getLoginIdAsLong();
-        List<RenewalView> list = groupRelationFrontService.getMyTicket(userId, isLoginPopularize, yhsId);
+        List<RenewalView> list = groupRelationFrontService.getMyTicket(userId, isLoginPopularize, customId);
         return GatewayResponse.SUCCESS.newBuilder().toResult(list);
     }
 

+ 5 - 5
netflix-web/src/main/java/com/cyksj/web/controller/payment/OrderController.java

@@ -33,6 +33,7 @@ import com.cyksj.model.views.OrderCommentView;
 import com.cyksj.service.order.OrderDonService;
 import com.cyksj.service.paypal.PayPalService;
 import com.cyksj.service.paypal.PaypalPayConfigService;
+import com.cyksj.service.shop.YhShopFrontService;
 import com.cyksj.service.stripe.StripePayConfigService;
 import com.cyksj.service.stripe.StripeService;
 import com.cyksj.service.user.UserBindRelationService;
@@ -119,7 +120,7 @@ public class OrderController {
     private StripeService stripeService;
 
     @Autowired
-    private UserBindRelationService userBindRelationService;
+    private YhShopFrontService yhShopFrontService;
 
     /**
      * 支付
@@ -343,14 +344,13 @@ public class OrderController {
      * 获取订单列表
      */
     @GetMapping("/get")
-    public Result<SearchResult<OrderDonView>> list(Long yhsId){
+    public Result<SearchResult<OrderDonView>> list(String customId){
         long userId = StpUserUtil.getLoginIdAsLong();
         MapBuilder builder = MapUtils.flatBuilder(request.getParameterMap());
-        if (yhsId == null) {
-            builder.field(OrderDonView::getYhsId, 0);
-        }
+        Long yhsId = yhShopFrontService.getYhsIdByCustomId(customId);
         List<Long> userIds = UserBindRelationService.getRelationUserIdList(userId, null);
         SearchResult<OrderDonView> search = beanSearcher.search(OrderDonView.class, builder
+                .field(OrderDonView::getYhsId, yhsId)
                 .field(OrderDonView::getUserId, userIds).op(Operator.InList)
                 .orderBy(OrderDonView::getId).desc()
                 .build());