瀏覽代碼

fix 多账号购买AI车票情况

zoujiajian 6 月之前
父節點
當前提交
b2932f2c8b

+ 1 - 1
netflix-dao/src/main/java/com/cyksj/mapper/OrderDonMapper.java

@@ -99,7 +99,7 @@ public interface OrderDonMapper extends BaseMapper<OrderDon> {
 
 	List<DistributeOrderStatisticsDataView> getDistributeOrderView(@Param("goodsId") Long goodsId, @Param("skuIds") List<Long> skuIds, @Param("start") String start, @Param("end") String end, @Param("isGeneral") Boolean isGeneral, @Param("chain") Integer chain);
 
-	Integer hasPaymentAiGoods(Long userId);
+	Integer hasPaymentAiGoods(@Param("userIds") List<Long> userIds);
 
 	List<Long> selectTransportOids(@Param("phone") String phone, @Param("receiver") String receiver);
 

+ 5 - 1
netflix-dao/src/main/resources/mapper/OrderDonMapper.xml

@@ -602,7 +602,11 @@
     </select>
 
     <select id="hasPaymentAiGoods" resultType="java.lang.Integer">
-        select count(1) from order_don where user_id = #{userId} and status not in ('close','noPayment')
+        select count(1) from order_don where user_id in
+        <foreach collection="userIds" item="item" open="(" separator="," close=")">
+            #{item}
+        </foreach>
+        and status not in ('close','noPayment')
         and goods_id in (select distinct goods_id from goods_don_category_relate where category = 1)
     </select>
 

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

@@ -847,7 +847,8 @@ public class GoodsDonController {
 			}
 			if (userIdAfLogin != null) {
 				//是否购买过AI产品
-				Integer count = orderDonMapper.hasPaymentAiGoods(userIdAfLogin);
+				List<Long> userIdList = userBindRelationService.getRelationUserIdList(userIdAfLogin, null);
+				Integer count = orderDonMapper.hasPaymentAiGoods(userIdList);
 				if (count == 0) {
 					//未购买 直接过滤
 					return true;

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

@@ -1059,7 +1059,8 @@ public class OrderController {
     @GetMapping("/get/payAiOrders/condition")
     public Result<Boolean> getPayAiOrdersConditions() {
         long userId = StpUserUtil.getLoginIdAsLong();
-        Integer selectCount = orderDonMapper.hasPaymentAiGoods(userId);
+        List<Long> userIdList = userBindRelationService.getRelationUserIdList(userId, null);
+        Integer selectCount = orderDonMapper.hasPaymentAiGoods(userIdList);
         return GatewayResponse.SUCCESS.newBuilder().toResult(selectCount > 0);
     }
 }