|
|
@@ -15,10 +15,7 @@ import com.cyksj.common.util.StringUtil;
|
|
|
import com.cyksj.dto.Result;
|
|
|
import com.cyksj.dto.UserSharedDto;
|
|
|
import com.cyksj.enums.GatewayResponse;
|
|
|
-import com.cyksj.mapper.GiftCardGoodsSkuMapper;
|
|
|
-import com.cyksj.mapper.GoodsDonSkuMapper;
|
|
|
-import com.cyksj.mapper.OrderDonMapper;
|
|
|
-import com.cyksj.mapper.RegisterOrderDonMapper;
|
|
|
+import com.cyksj.mapper.*;
|
|
|
import com.cyksj.mapper.manage.coupon.CouponUserMapper;
|
|
|
import com.cyksj.mapper.shop.YhShopGoodsSkuMapper;
|
|
|
import com.cyksj.mapper.sys.SysConfigMapper;
|
|
|
@@ -617,20 +614,19 @@ public class GoodsDonController {
|
|
|
yhsId = yhShopFrontService.getYhsIdByCustomId(customId);
|
|
|
key = RedisService.key.YH_HOME_PAGHE_CACHE_SHOP.getName() + yhsId + ":homeManage";
|
|
|
}
|
|
|
-// List<Long> filter_goodsIds = getFilterGoodsIds();
|
|
|
- List<Long> filter_goodsIds = null;
|
|
|
+ Long fUid = StpUserUtil.getUserIdAfterLogin();
|
|
|
+ Boolean isFilterGoodsIds = isFilterGoodsIds(fUid);
|
|
|
AtomicBoolean isRemoveRg = new AtomicBoolean(false);
|
|
|
-// if (isHzIp()) {
|
|
|
-// key += ":hz-ip";
|
|
|
+ if (isFilterGoodsIds) {
|
|
|
+ key += ":filter-ip";
|
|
|
// isRemoveRg.set(true);
|
|
|
-// }
|
|
|
+ }
|
|
|
String lang = request.getHeader("lang");
|
|
|
AtomicBoolean language = new AtomicBoolean(false);
|
|
|
if (lang != null && !StrUtil.equals(UserPageLanguage.Language.zh_CN.name(), lang)) {
|
|
|
key += ":" + lang;
|
|
|
language.set(true);
|
|
|
}
|
|
|
- Long fUid = StpUserUtil.getUserIdAfterLogin();
|
|
|
Object o = redisService.get(key);
|
|
|
if (o == null) {
|
|
|
try {
|
|
|
@@ -649,8 +645,8 @@ public class GoodsDonController {
|
|
|
.field(HomeManagementFrontView::getType, type.name());
|
|
|
if (type == HomeManagementConfig.Type.ex || type == HomeManagementConfig.Type.vg) {
|
|
|
builder.put("condition", conditionSql);
|
|
|
- if (CollUtil.isNotEmpty(filter_goodsIds)) {
|
|
|
- builder.field(HomeManagementFrontView::getGoodsId, filter_goodsIds).op(Operator.NotIn);
|
|
|
+ if (isFilterGoodsIds) {
|
|
|
+ builder.field(HomeManagementFrontView::getIsFilter, Boolean.FALSE);
|
|
|
}
|
|
|
}
|
|
|
List<HomeManagementFrontView> homeManagementFrontViews = beanSearcher.searchAll(HomeManagementFrontView.class, builder.build());
|
|
|
@@ -700,21 +696,34 @@ public class GoodsDonController {
|
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult();
|
|
|
}
|
|
|
|
|
|
- public List<Long> getFilterGoodsIds() {
|
|
|
+ public Boolean isFilterGoodsIds(Long userIdAfLogin) {
|
|
|
List<Long> filter_goodsIds = null;
|
|
|
+ if (userIdAfLogin == null) {
|
|
|
+ //未登录 直接过滤
|
|
|
+ return true;
|
|
|
+ }
|
|
|
//获取当前ip地址
|
|
|
- if (StringUtil.getRealAddressByIP(ServletUtil.getClientIP(request)).contains("杭州")) {
|
|
|
- //过滤杭州Ai ChatGPT平台
|
|
|
- SysConfig sysConfig = sysConfigMapper.selectOne(Wrappers.lambdaQuery(SysConfig.class)
|
|
|
- .eq(SysConfig::getSysKey, Constant.LOCATION_FOR_GOODS_IDS).last("limit 1"));
|
|
|
- if (sysConfig != null && StrUtil.isNotBlank(sysConfig.getSysValue())) {
|
|
|
- try {
|
|
|
- filter_goodsIds = Jsons.parseList(sysConfig.getSysValue(), Long.class);
|
|
|
- } catch (Exception e) {
|
|
|
+ String newestIpAddress = StringUtil.getNewestIpAddress(ServletUtil.getClientIP(request));
|
|
|
+ if (newestIpAddress.contains("杭州") || newestIpAddress.contains("北京")) {
|
|
|
+// //过滤杭州Ai ChatGPT平台
|
|
|
+// SysConfig sysConfig = sysConfigMapper.selectOne(Wrappers.lambdaQuery(SysConfig.class)
|
|
|
+// .eq(SysConfig::getSysKey, Constant.LOCATION_FOR_GOODS_IDS).last("limit 1"));
|
|
|
+// if (sysConfig != null && StrUtil.isNotBlank(sysConfig.getSysValue())) {
|
|
|
+// try {
|
|
|
+// filter_goodsIds = Jsons.parseList(sysConfig.getSysValue(), Long.class);
|
|
|
+// } catch (Exception e) {
|
|
|
+// }
|
|
|
+// }
|
|
|
+ if (userIdAfLogin != null) {
|
|
|
+ //是否购买过AI产品
|
|
|
+ Integer count = orderDonMapper.hasPaymentAiGoods(userIdAfLogin);
|
|
|
+ if (count == 0) {
|
|
|
+ //未购买 直接过滤
|
|
|
+ return true;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- return filter_goodsIds;
|
|
|
+ return false;
|
|
|
}
|
|
|
|
|
|
public Boolean isHzIp() {
|
|
|
@@ -1083,10 +1092,9 @@ public class GoodsDonController {
|
|
|
if (cgy != null) {
|
|
|
categoryGoodsKey += ":" + cgy;
|
|
|
}
|
|
|
- //List<Long> filter_goodsIds = getFilterGoodsIds();
|
|
|
- List<Long> filter_goodsIds = null;
|
|
|
- if (CollUtil.isNotEmpty(filter_goodsIds)) {
|
|
|
- categoryGoodsKey += ":hz-ip";
|
|
|
+ Boolean isFilterGoodsIds = isFilterGoodsIds(fUid);
|
|
|
+ if (isFilterGoodsIds) {
|
|
|
+ categoryGoodsKey += ":filter-ip";
|
|
|
}
|
|
|
String lang = request.getHeader("lang");
|
|
|
AtomicBoolean language = new AtomicBoolean(false);
|
|
|
@@ -1102,8 +1110,9 @@ public class GoodsDonController {
|
|
|
String condition = String.format(" and gcr.category = %s", cgy);
|
|
|
mapBuilder.put("condition", condition);
|
|
|
}
|
|
|
- if (CollUtil.isNotEmpty(filter_goodsIds)) {
|
|
|
- mapBuilder.field(GoodsFrontListCategoryView::getId, filter_goodsIds).op(Operator.NotIn);
|
|
|
+ if (isFilterGoodsIds) {
|
|
|
+ //特殊ip需要过滤的商品
|
|
|
+ mapBuilder.field(GoodsFrontListCategoryView::getIsFilter, Boolean.FALSE);
|
|
|
}
|
|
|
List<GoodsFrontListCategoryView> goodsFrontListViews = beanSearcher.searchAll(GoodsFrontListCategoryView.class, mapBuilder.build());
|
|
|
List<Long> gptBuyGids = getGptMirrorGiveawayBuyGids();
|