|
@@ -13,6 +13,7 @@ import com.cyksj.common.exception.BusinessRuntimeException;
|
|
|
import com.cyksj.common.util.Jsons;
|
|
import com.cyksj.common.util.Jsons;
|
|
|
import com.cyksj.common.util.StringUtil;
|
|
import com.cyksj.common.util.StringUtil;
|
|
|
import com.cyksj.dto.Result;
|
|
import com.cyksj.dto.Result;
|
|
|
|
|
+import com.cyksj.dto.UserSharedDto;
|
|
|
import com.cyksj.enums.GatewayResponse;
|
|
import com.cyksj.enums.GatewayResponse;
|
|
|
import com.cyksj.mapper.GoodsDonSkuMapper;
|
|
import com.cyksj.mapper.GoodsDonSkuMapper;
|
|
|
import com.cyksj.mapper.OrderDonMapper;
|
|
import com.cyksj.mapper.OrderDonMapper;
|
|
@@ -25,6 +26,7 @@ import com.cyksj.redis.RedisService;
|
|
|
import com.cyksj.service.goods.GoodsDonFrontService;
|
|
import com.cyksj.service.goods.GoodsDonFrontService;
|
|
|
import com.cyksj.service.home.ClickRecordFrontService;
|
|
import com.cyksj.service.home.ClickRecordFrontService;
|
|
|
import com.cyksj.service.shop.YhShopFrontService;
|
|
import com.cyksj.service.shop.YhShopFrontService;
|
|
|
|
|
+import com.cyksj.service.user.UserService;
|
|
|
import com.cyksj.web.util.StpUserUtil;
|
|
import com.cyksj.web.util.StpUserUtil;
|
|
|
import com.ejlchina.searcher.BeanSearcher;
|
|
import com.ejlchina.searcher.BeanSearcher;
|
|
|
import com.ejlchina.searcher.SearchResult;
|
|
import com.ejlchina.searcher.SearchResult;
|
|
@@ -39,6 +41,8 @@ import javax.servlet.http.HttpServletRequest;
|
|
|
import java.math.BigDecimal;
|
|
import java.math.BigDecimal;
|
|
|
import java.util.*;
|
|
import java.util.*;
|
|
|
import java.util.concurrent.ConcurrentHashMap;
|
|
import java.util.concurrent.ConcurrentHashMap;
|
|
|
|
|
+import java.util.concurrent.atomic.AtomicBoolean;
|
|
|
|
|
+import java.util.concurrent.atomic.AtomicLong;
|
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
import java.util.stream.Stream;
|
|
import java.util.stream.Stream;
|
|
|
|
|
|
|
@@ -70,6 +74,8 @@ public class GoodsDonController {
|
|
|
|
|
|
|
|
private final YhShopFrontService yhShopFrontService;
|
|
private final YhShopFrontService yhShopFrontService;
|
|
|
|
|
|
|
|
|
|
+ private final UserService userService;
|
|
|
|
|
+
|
|
|
private final GoodsDonFrontService goodsDonFrontService;
|
|
private final GoodsDonFrontService goodsDonFrontService;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -212,6 +218,7 @@ public class GoodsDonController {
|
|
|
* 官网首页 平台列表
|
|
* 官网首页 平台列表
|
|
|
*/
|
|
*/
|
|
|
@GetMapping("/get/list")
|
|
@GetMapping("/get/list")
|
|
|
|
|
+ @Deprecated
|
|
|
public Result<? extends Object> getGoodsList(String customId) {
|
|
public Result<? extends Object> getGoodsList(String customId) {
|
|
|
if (StrUtil.isNotBlank(customId)) {
|
|
if (StrUtil.isNotBlank(customId)) {
|
|
|
Result<List<YhShopGoodsFrontView>> shopGoods = getShopGoods(yhShopFrontService.getYhsIdByCustomId(customId));
|
|
Result<List<YhShopGoodsFrontView>> shopGoods = getShopGoods(yhShopFrontService.getYhsIdByCustomId(customId));
|
|
@@ -246,7 +253,7 @@ public class GoodsDonController {
|
|
|
data.setNotifyMsg(getPayMsgTime(data.getId(), now, 1, null));
|
|
data.setNotifyMsg(getPayMsgTime(data.getId(), now, 1, null));
|
|
|
|
|
|
|
|
//设置特定价格
|
|
//设置特定价格
|
|
|
- setSpecificPrice(data, fUid);
|
|
|
|
|
|
|
+ setSpecificPrice(data, fUid, null);
|
|
|
});
|
|
});
|
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult(Optional.of(list));
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult(Optional.of(list));
|
|
|
}
|
|
}
|
|
@@ -290,7 +297,7 @@ public class GoodsDonController {
|
|
|
data.setNotifyMsg(getPayMsgTime(data.getId(), now, 1, null));
|
|
data.setNotifyMsg(getPayMsgTime(data.getId(), now, 1, null));
|
|
|
|
|
|
|
|
//设置特定价格
|
|
//设置特定价格
|
|
|
- setSpecificPrice(data, fUid);
|
|
|
|
|
|
|
+ setSpecificPrice(data, fUid, null);
|
|
|
});
|
|
});
|
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult(Optional.of(list));
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult(Optional.of(list));
|
|
|
}
|
|
}
|
|
@@ -329,16 +336,20 @@ public class GoodsDonController {
|
|
|
* 获取商品详情
|
|
* 获取商品详情
|
|
|
*/
|
|
*/
|
|
|
@GetMapping("/get/{id}")
|
|
@GetMapping("/get/{id}")
|
|
|
- public Result<? extends Object> getDetail(@PathVariable Long id, String customId) {
|
|
|
|
|
|
|
+ public Result<? extends Object> getDetail(@PathVariable Long id, String customId, String dsCode) {
|
|
|
if (StrUtil.isNotBlank(customId) && id != 15) {
|
|
if (StrUtil.isNotBlank(customId) && id != 15) {
|
|
|
Result<YhShopGoodsFrontView> yhShopGoodsDetail = getGoodsDetailByYhsId(yhShopFrontService.getYhsIdByCustomId(customId), id);
|
|
Result<YhShopGoodsFrontView> yhShopGoodsDetail = getGoodsDetailByYhsId(yhShopFrontService.getYhsIdByCustomId(customId), id);
|
|
|
return yhShopGoodsDetail;
|
|
return yhShopGoodsDetail;
|
|
|
}
|
|
}
|
|
|
String goodsDetailKey = RedisService.key.YH_HOME_PAGHE_CACHE.getEnvName() + "goods_detail:" + id;
|
|
String goodsDetailKey = RedisService.key.YH_HOME_PAGHE_CACHE.getEnvName() + "goods_detail:" + id;
|
|
|
|
|
+ List<Long> filter_goodsIds = getFilterGoodsIds();
|
|
|
|
|
+ //存在过滤平台 商品详情不返回
|
|
|
|
|
+ if (CollUtil.isNotEmpty(filter_goodsIds) && filter_goodsIds.contains(id)) {
|
|
|
|
|
+ return GatewayResponse.SUCCESS.newBuilder().toResult();
|
|
|
|
|
+ }
|
|
|
Object o = redisService.get(goodsDetailKey);
|
|
Object o = redisService.get(goodsDetailKey);
|
|
|
- GoodsFrontListView views = null;
|
|
|
|
|
if (o == null) {
|
|
if (o == null) {
|
|
|
- views = beanSearcher.searchFirst(GoodsFrontListView.class, MapUtils.builder().field(GoodsFrontListView::getId, id)
|
|
|
|
|
|
|
+ GoodsFrontListView views = beanSearcher.searchFirst(GoodsFrontListView.class, MapUtils.builder().field(GoodsFrontListView::getId, id)
|
|
|
.build());
|
|
.build());
|
|
|
|
|
|
|
|
views.setSpecs(beanSearcher.searchFirst(GoodsDonSpecFrontView.class, MapUtils.builder().field(GoodsDonSpecFrontView::getGoodsId, views.getId()).build()));
|
|
views.setSpecs(beanSearcher.searchFirst(GoodsDonSpecFrontView.class, MapUtils.builder().field(GoodsDonSpecFrontView::getGoodsId, views.getId()).build()));
|
|
@@ -352,10 +363,26 @@ public class GoodsDonController {
|
|
|
o = redisService.get(goodsDetailKey);
|
|
o = redisService.get(goodsDetailKey);
|
|
|
}
|
|
}
|
|
|
Long fUid = StpUserUtil.getUserIdAfterLogin();
|
|
Long fUid = StpUserUtil.getUserIdAfterLogin();
|
|
|
- if (views == null) {
|
|
|
|
|
- views = Jsons.parseObject(o, GoodsFrontListView.class);
|
|
|
|
|
|
|
+ GoodsFrontListView views = Jsons.parseObject(o, GoodsFrontListView.class);
|
|
|
|
|
+ AtomicLong dsUserId = new AtomicLong();
|
|
|
|
|
+ AtomicBoolean existsChannel = new AtomicBoolean(true);
|
|
|
|
|
+ if (StrUtil.isNotBlank(dsCode)) {
|
|
|
|
|
+ UserSharedDto userSharedDto = userService.getUserShredDtoByDsCode(dsCode);
|
|
|
|
|
+ dsUserId.set(userSharedDto.getSharedId());
|
|
|
}
|
|
}
|
|
|
- for (GoodsDonSkuFrontView sku : views.getSkuList()) {
|
|
|
|
|
|
|
+ views.setSkuList(views.getSkuList().stream().filter(sku -> {
|
|
|
|
|
+ if (StrUtil.isNotBlank(sku.getUserOwns())) {
|
|
|
|
|
+ if (dsUserId.get() == 0 && fUid != null && existsChannel.get()) {
|
|
|
|
|
+ Long sharedId = userService.getSharedIdByUserId(fUid);
|
|
|
|
|
+ if (sharedId == 0) {
|
|
|
|
|
+ existsChannel.set(false);
|
|
|
|
|
+ }
|
|
|
|
|
+ dsUserId.set(sharedId);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (dsUserId.get() == 0 || !sku.getUserOwns().contains(String.valueOf(dsUserId.get()))) {
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
if (sku.getIsDp()) {
|
|
if (sku.getIsDp()) {
|
|
|
sku.setDpSkuViews(beanSearcher.searchAll(GoodsDiscountPlusPurchaseRelationFrontView.class, MapUtils.builder()
|
|
sku.setDpSkuViews(beanSearcher.searchAll(GoodsDiscountPlusPurchaseRelationFrontView.class, MapUtils.builder()
|
|
|
.field(GoodsDiscountPlusPurchaseRelationFrontView::getSkuId, sku.getId())
|
|
.field(GoodsDiscountPlusPurchaseRelationFrontView::getSkuId, sku.getId())
|
|
@@ -365,27 +392,28 @@ public class GoodsDonController {
|
|
|
if (fUid == null) {
|
|
if (fUid == null) {
|
|
|
sku.setSpecificPrice(null);
|
|
sku.setSpecificPrice(null);
|
|
|
sku.setSpecificGoodsIds(null);
|
|
sku.setSpecificGoodsIds(null);
|
|
|
- continue;
|
|
|
|
|
- }
|
|
|
|
|
- //设置特定价格
|
|
|
|
|
- if (!isPaySpecificGoodsIds(sku.getSpecificGoodsIds(), fUid)) {
|
|
|
|
|
- sku.setSpecificGoodsIds(null);
|
|
|
|
|
- sku.setSpecificPrice(null);
|
|
|
|
|
- } else {
|
|
|
|
|
- BigDecimal specificPrice = views.getSpecificPrice();
|
|
|
|
|
-
|
|
|
|
|
- BigDecimal skuSpecificPrice = sku.getSpecificPrice();
|
|
|
|
|
- Long specificSkuId = sku.getId();
|
|
|
|
|
- if (specificPrice == null) {
|
|
|
|
|
- views.setSpecificPrice(skuSpecificPrice);
|
|
|
|
|
- views.setSpecificSkuId(specificSkuId);
|
|
|
|
|
- } else if (specificPrice.compareTo(skuSpecificPrice) > 0) {
|
|
|
|
|
- views.setSpecificPrice(skuSpecificPrice);
|
|
|
|
|
- views.setSpecificSkuId(specificSkuId);
|
|
|
|
|
|
|
+ }else {
|
|
|
|
|
+ //设置特定价格
|
|
|
|
|
+ if (!isPaySpecificGoodsIds(sku.getSpecificGoodsIds(), fUid)) {
|
|
|
|
|
+ sku.setSpecificGoodsIds(null);
|
|
|
|
|
+ sku.setSpecificPrice(null);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ BigDecimal specificPrice = views.getSpecificPrice();
|
|
|
|
|
+
|
|
|
|
|
+ BigDecimal skuSpecificPrice = sku.getSpecificPrice();
|
|
|
|
|
+ Long specificSkuId = sku.getId();
|
|
|
|
|
+ if (specificPrice == null) {
|
|
|
|
|
+ views.setSpecificPrice(skuSpecificPrice);
|
|
|
|
|
+ views.setSpecificSkuId(specificSkuId);
|
|
|
|
|
+ } else if (specificPrice.compareTo(skuSpecificPrice) > 0) {
|
|
|
|
|
+ views.setSpecificPrice(skuSpecificPrice);
|
|
|
|
|
+ views.setSpecificSkuId(specificSkuId);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- }
|
|
|
|
|
|
|
+ return true;
|
|
|
|
|
+ }).collect(Collectors.toList()));
|
|
|
Integer sold = orderDonMapper.selectCount(Wrappers.lambdaQuery(OrderDon.class)
|
|
Integer sold = orderDonMapper.selectCount(Wrappers.lambdaQuery(OrderDon.class)
|
|
|
.eq(OrderDon::getGoodsId, views.getId()).notIn(OrderDon::getStatus, Constant.noOrderStatus));
|
|
.eq(OrderDon::getGoodsId, views.getId()).notIn(OrderDon::getStatus, Constant.noOrderStatus));
|
|
|
views.setSold(sold + views.getSold());
|
|
views.setSold(sold + views.getSold());
|
|
@@ -403,7 +431,7 @@ public class GoodsDonController {
|
|
|
* 获取商品推荐平台
|
|
* 获取商品推荐平台
|
|
|
*/
|
|
*/
|
|
|
@GetMapping("/get/recommend/{id}")
|
|
@GetMapping("/get/recommend/{id}")
|
|
|
- public Result<List<GoodsFrontListView>> getRecommendGoodsByGid(@PathVariable Long id, String customId) throws Exception {
|
|
|
|
|
|
|
+ public Result<List<GoodsFrontListView>> getRecommendGoodsByGid(@PathVariable Long id, String customId, String dsCode) throws Exception {
|
|
|
String key = RedisService.key.YH_HOME_PAGHE_CACHE.getEnvName() + "recommend:" + id;
|
|
String key = RedisService.key.YH_HOME_PAGHE_CACHE.getEnvName() + "recommend:" + id;
|
|
|
Long yhsId = null;
|
|
Long yhsId = null;
|
|
|
if (StrUtil.isNotBlank(customId)) {
|
|
if (StrUtil.isNotBlank(customId)) {
|
|
@@ -435,13 +463,36 @@ public class GoodsDonController {
|
|
|
if (goodsRecommendViews == null) {
|
|
if (goodsRecommendViews == null) {
|
|
|
goodsRecommendViews = Jsons.parseList(o.toString(), GoodsFrontListView.class);
|
|
goodsRecommendViews = Jsons.parseList(o.toString(), GoodsFrontListView.class);
|
|
|
}
|
|
}
|
|
|
- goodsRecommendViews.forEach(data -> {
|
|
|
|
|
|
|
+ AtomicLong dsUserId = new AtomicLong();
|
|
|
|
|
+ AtomicBoolean existsChannel = new AtomicBoolean(true);
|
|
|
|
|
+ if (StrUtil.isNotBlank(dsCode)) {
|
|
|
|
|
+ UserSharedDto userSharedDto = userService.getUserShredDtoByDsCode(dsCode);
|
|
|
|
|
+ dsUserId.set(userSharedDto.getSharedId());
|
|
|
|
|
+ }
|
|
|
|
|
+ goodsRecommendViews = goodsRecommendViews.stream().filter(data -> {
|
|
|
|
|
+ if (data.getIsOwns()) {
|
|
|
|
|
+ if (dsUserId.get() == 0 && fUid != null && existsChannel.get()) {
|
|
|
|
|
+ Long sharedId = userService.getSharedIdByUserId(fUid);
|
|
|
|
|
+ if (sharedId == 0) {
|
|
|
|
|
+ existsChannel.set(false);
|
|
|
|
|
+ }
|
|
|
|
|
+ dsUserId.set(sharedId);
|
|
|
|
|
+ }
|
|
|
|
|
+ GoodsDonSku minPriceUserOwnsSku = goodsDonSkuMapper.checkAndReturnMinPriceUserOwnsSku(data.getId(), dsUserId.get());
|
|
|
|
|
+ if (minPriceUserOwnsSku == null) {
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+ data.setPrice(minPriceUserOwnsSku.getPrice());
|
|
|
|
|
+ data.setMonths(minPriceUserOwnsSku.getMonths());
|
|
|
|
|
+ data.setDays(minPriceUserOwnsSku.getDays());
|
|
|
|
|
+ }
|
|
|
Integer sold = orderDonMapper.selectCount(Wrappers.lambdaQuery(OrderDon.class)
|
|
Integer sold = orderDonMapper.selectCount(Wrappers.lambdaQuery(OrderDon.class)
|
|
|
.eq(OrderDon::getGoodsId, data.getId()).notIn(OrderDon::getStatus, Constant.noOrderStatus));
|
|
.eq(OrderDon::getGoodsId, data.getId()).notIn(OrderDon::getStatus, Constant.noOrderStatus));
|
|
|
- data.setSold(data.getSold() + sold);
|
|
|
|
|
|
|
+ data.setSold(data.getSold() + sold);
|
|
|
//设置特定价格
|
|
//设置特定价格
|
|
|
- setSpecificPrice(data, fUid);
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ setSpecificPrice(data, fUid, dsUserId.get());
|
|
|
|
|
+ return true;
|
|
|
|
|
+ }).collect(Collectors.toList());
|
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult(goodsRecommendViews);
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult(goodsRecommendViews);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -485,13 +536,17 @@ public class GoodsDonController {
|
|
|
* 获取首页配置列表
|
|
* 获取首页配置列表
|
|
|
*/
|
|
*/
|
|
|
@GetMapping("/get/homeManage")
|
|
@GetMapping("/get/homeManage")
|
|
|
- public Result<Map<String, List<HomeManagementFrontView>>> getHomeManagementFrontPage(String customId) {
|
|
|
|
|
|
|
+ public Result<Map<String, List<HomeManagementFrontView>>> getHomeManagementFrontPage(String customId, String dsCode) {
|
|
|
String key = RedisService.key.YH_HOME_PAGHE_CACHE.getEnvName() + "homeManage";
|
|
String key = RedisService.key.YH_HOME_PAGHE_CACHE.getEnvName() + "homeManage";
|
|
|
Long yhsId = null;
|
|
Long yhsId = null;
|
|
|
if (StrUtil.isNotBlank(customId)) {
|
|
if (StrUtil.isNotBlank(customId)) {
|
|
|
yhsId = yhShopFrontService.getYhsIdByCustomId(customId);
|
|
yhsId = yhShopFrontService.getYhsIdByCustomId(customId);
|
|
|
key = RedisService.key.YH_HOME_PAGHE_CACHE_SHOP.getEnvName() + yhsId + ":homeManage";
|
|
key = RedisService.key.YH_HOME_PAGHE_CACHE_SHOP.getEnvName() + yhsId + ":homeManage";
|
|
|
}
|
|
}
|
|
|
|
|
+ List<Long> filter_goodsIds = getFilterGoodsIds();
|
|
|
|
|
+ if (CollUtil.isNotEmpty(filter_goodsIds)) {
|
|
|
|
|
+ key += ":hz-ip";
|
|
|
|
|
+ }
|
|
|
Long fUid = StpUserUtil.getUserIdAfterLogin();
|
|
Long fUid = StpUserUtil.getUserIdAfterLogin();
|
|
|
Object o = redisService.get(key);
|
|
Object o = redisService.get(key);
|
|
|
if (o == null) {
|
|
if (o == null) {
|
|
@@ -507,6 +562,9 @@ public class GoodsDonController {
|
|
|
.field(HomeManagementFrontView::getType, type.name());
|
|
.field(HomeManagementFrontView::getType, type.name());
|
|
|
if (type == HomeManagementConfig.Type.ex || type == HomeManagementConfig.Type.vg) {
|
|
if (type == HomeManagementConfig.Type.ex || type == HomeManagementConfig.Type.vg) {
|
|
|
builder.put("condition", conditionSql);
|
|
builder.put("condition", conditionSql);
|
|
|
|
|
+ if (CollUtil.isNotEmpty(filter_goodsIds)) {
|
|
|
|
|
+ builder.field(HomeManagementFrontView::getGoodsId, filter_goodsIds).op(Operator.NotIn);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
List<HomeManagementFrontView> homeManagementFrontViews = beanSearcher.searchAll(HomeManagementFrontView.class, builder.build());
|
|
List<HomeManagementFrontView> homeManagementFrontViews = beanSearcher.searchAll(HomeManagementFrontView.class, builder.build());
|
|
|
map.putIfAbsent(type.name(), homeManagementFrontViews);
|
|
map.putIfAbsent(type.name(), homeManagementFrontViews);
|
|
@@ -514,21 +572,22 @@ public class GoodsDonController {
|
|
|
redisService.setNx(key, map, 50 * 60l);
|
|
redisService.setNx(key, map, 50 * 60l);
|
|
|
o = redisService.get(key);
|
|
o = redisService.get(key);
|
|
|
}
|
|
}
|
|
|
|
|
+ AtomicLong dsUserId = new AtomicLong();
|
|
|
|
|
+ AtomicBoolean existsChannel = new AtomicBoolean(true);
|
|
|
|
|
+ if (StrUtil.isNotBlank(dsCode)) {
|
|
|
|
|
+ UserSharedDto userSharedDto = userService.getUserShredDtoByDsCode(dsCode);
|
|
|
|
|
+ dsUserId.set(userSharedDto.getSharedId());
|
|
|
|
|
+ }
|
|
|
Map<String, List<HomeManagementFrontView>> map = Jsons.parseObject(o, Map.class);
|
|
Map<String, List<HomeManagementFrontView>> map = Jsons.parseObject(o, Map.class);
|
|
|
if (map.containsKey(HomeManagementConfig.Type.ex.name()) || map.containsKey(HomeManagementConfig.Type.vg.name())) {
|
|
if (map.containsKey(HomeManagementConfig.Type.ex.name()) || map.containsKey(HomeManagementConfig.Type.vg.name())) {
|
|
|
try {
|
|
try {
|
|
|
- //设置特定价格
|
|
|
|
|
|
|
+ //精彩推荐
|
|
|
List<HomeManagementFrontView> exList = Jsons.parseList(Jsons.toJson(map.get(HomeManagementConfig.Type.ex.name())), HomeManagementFrontView.class);
|
|
List<HomeManagementFrontView> exList = Jsons.parseList(Jsons.toJson(map.get(HomeManagementConfig.Type.ex.name())), HomeManagementFrontView.class);
|
|
|
- if (CollUtil.isNotEmpty(exList)) {
|
|
|
|
|
- setHomeManageSpecific(exList, fUid);
|
|
|
|
|
- map.put(HomeManagementConfig.Type.ex.name(), exList);
|
|
|
|
|
- }
|
|
|
|
|
- //设置特定价格
|
|
|
|
|
|
|
+ setHomeConfigGoods(map, HomeManagementConfig.Type.ex, exList, dsUserId, existsChannel, fUid);
|
|
|
|
|
+
|
|
|
|
|
+ //虚拟平台
|
|
|
List<HomeManagementFrontView> vgList = Jsons.parseList(Jsons.toJson(map.get(HomeManagementConfig.Type.vg.name())), HomeManagementFrontView.class);
|
|
List<HomeManagementFrontView> vgList = Jsons.parseList(Jsons.toJson(map.get(HomeManagementConfig.Type.vg.name())), HomeManagementFrontView.class);
|
|
|
- if (CollUtil.isNotEmpty(vgList)) {
|
|
|
|
|
- setHomeManageSpecific(vgList, fUid);
|
|
|
|
|
- map.put(HomeManagementConfig.Type.vg.name(), vgList);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ setHomeConfigGoods(map, HomeManagementConfig.Type.vg, vgList, dsUserId, existsChannel, fUid);
|
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -546,19 +605,19 @@ public class GoodsDonController {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public List<Long> getFilterGoodsIds() {
|
|
public List<Long> getFilterGoodsIds() {
|
|
|
- //过滤杭州Ai ChatGPT平台
|
|
|
|
|
- //获取当前ip地址
|
|
|
|
|
- SysConfig sysConfig = sysConfigMapper.selectOne(Wrappers.lambdaQuery(SysConfig.class)
|
|
|
|
|
- .eq(SysConfig::getSysKey, Constant.LOCATION_FOR_GOODS_IDS).last("limit 1"));
|
|
|
|
|
List<Long> filter_goodsIds = null;
|
|
List<Long> filter_goodsIds = null;
|
|
|
- if (sysConfig != null && StrUtil.isNotBlank(sysConfig.getSysValue())) {
|
|
|
|
|
- if (StringUtil.getRealAddressByIP(ServletUtil.getClientIP(request)).contains("杭州")) {
|
|
|
|
|
- try {
|
|
|
|
|
- filter_goodsIds = Jsons.parseList(sysConfig.getSysValue(), Long.class);
|
|
|
|
|
- } catch (Exception e) {
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ //获取当前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) {
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
return filter_goodsIds;
|
|
return filter_goodsIds;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -640,7 +699,7 @@ public class GoodsDonController {
|
|
|
/**
|
|
/**
|
|
|
* 设置平台 特定价格
|
|
* 设置平台 特定价格
|
|
|
*/
|
|
*/
|
|
|
- public void setSpecificPrice(GoodsFrontListView data, Long fUid) {
|
|
|
|
|
|
|
+ public void setSpecificPrice(GoodsFrontListView data, Long fUid, Long dsUserId) {
|
|
|
if (fUid != null) {
|
|
if (fUid != null) {
|
|
|
if (data.getIsSp()) {
|
|
if (data.getIsSp()) {
|
|
|
//查找所有特定规格最小价格 满足条件
|
|
//查找所有特定规格最小价格 满足条件
|
|
@@ -658,6 +717,9 @@ public class GoodsDonController {
|
|
|
redisService.setNx(specificGoodsKey, specificSkus, RedisService.key.YH_HOME_PAGHE_CACHE.getTimeout());
|
|
redisService.setNx(specificGoodsKey, specificSkus, RedisService.key.YH_HOME_PAGHE_CACHE.getTimeout());
|
|
|
}
|
|
}
|
|
|
specificSkus.forEach(specificSku -> {
|
|
specificSkus.forEach(specificSku -> {
|
|
|
|
|
+ if (StrUtil.isNotEmpty(specificSku.getUserOwns()) && (dsUserId == null || !specificSku.getUserOwns().contains(dsUserId.toString()))) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
String specificGoodsIdsStr = specificSku.getSpecificGoodsIds();
|
|
String specificGoodsIdsStr = specificSku.getSpecificGoodsIds();
|
|
|
if (isPaySpecificGoodsIds(specificGoodsIdsStr, fUid)) {
|
|
if (isPaySpecificGoodsIds(specificGoodsIdsStr, fUid)) {
|
|
|
BigDecimal specificPrice = data.getSpecificPrice();
|
|
BigDecimal specificPrice = data.getSpecificPrice();
|
|
@@ -689,7 +751,7 @@ public class GoodsDonController {
|
|
|
/**
|
|
/**
|
|
|
* 设置平台 特定价格
|
|
* 设置平台 特定价格
|
|
|
*/
|
|
*/
|
|
|
- public void setGcSpecificPrice(GoodsFrontListCategoryView data, Long fUid) {
|
|
|
|
|
|
|
+ public void setGcSpecificPrice(GoodsFrontListCategoryView data, Long fUid, Long dsUserId) {
|
|
|
if (fUid != null) {
|
|
if (fUid != null) {
|
|
|
if (data.getIsSp()) {
|
|
if (data.getIsSp()) {
|
|
|
//查找所有特定规格最小价格 满足条件
|
|
//查找所有特定规格最小价格 满足条件
|
|
@@ -707,6 +769,9 @@ public class GoodsDonController {
|
|
|
redisService.setNx(specificGoodsKey, specificSkus, RedisService.key.YH_HOME_PAGHE_CACHE.getTimeout());
|
|
redisService.setNx(specificGoodsKey, specificSkus, RedisService.key.YH_HOME_PAGHE_CACHE.getTimeout());
|
|
|
}
|
|
}
|
|
|
specificSkus.forEach(specificSku -> {
|
|
specificSkus.forEach(specificSku -> {
|
|
|
|
|
+ if (StrUtil.isNotEmpty(specificSku.getUserOwns()) && (dsUserId == null || !specificSku.getUserOwns().contains(dsUserId.toString()))) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
String specificGoodsIdsStr = specificSku.getSpecificGoodsIds();
|
|
String specificGoodsIdsStr = specificSku.getSpecificGoodsIds();
|
|
|
if (isPaySpecificGoodsIds(specificGoodsIdsStr, fUid)) {
|
|
if (isPaySpecificGoodsIds(specificGoodsIdsStr, fUid)) {
|
|
|
BigDecimal specificPrice = data.getSpecificPrice();
|
|
BigDecimal specificPrice = data.getSpecificPrice();
|
|
@@ -760,13 +825,16 @@ public class GoodsDonController {
|
|
|
/**
|
|
/**
|
|
|
* 设置首页配置 涉及平台特定价格
|
|
* 设置首页配置 涉及平台特定价格
|
|
|
*/
|
|
*/
|
|
|
- public void setHomeManageSpecific(List<HomeManagementFrontView> list, Long fUid) {
|
|
|
|
|
|
|
+ public void setHomeManageSpecific(List<HomeManagementFrontView> list, Long fUid, Long dsUserId) {
|
|
|
DateTime now = DateTime.now();
|
|
DateTime now = DateTime.now();
|
|
|
list.forEach(data -> {
|
|
list.forEach(data -> {
|
|
|
if (data.getIsSp() != null && data.getIsSp() && fUid != null) {
|
|
if (data.getIsSp() != null && data.getIsSp() && fUid != null) {
|
|
|
//查找所有特定规格最小价格 满足条件
|
|
//查找所有特定规格最小价格 满足条件
|
|
|
List<GoodsDonSku> specificSkus = getSpecificSku(data.getGoodsId());
|
|
List<GoodsDonSku> specificSkus = getSpecificSku(data.getGoodsId());
|
|
|
specificSkus.forEach(specificSku -> {
|
|
specificSkus.forEach(specificSku -> {
|
|
|
|
|
+ if (StrUtil.isNotEmpty(specificSku.getUserOwns()) && (dsUserId == null || !specificSku.getUserOwns().contains(dsUserId.toString()))) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
String specificGoodsIdsStr = specificSku.getSpecificGoodsIds();
|
|
String specificGoodsIdsStr = specificSku.getSpecificGoodsIds();
|
|
|
if (isPaySpecificGoodsIds(specificGoodsIdsStr, fUid)) {
|
|
if (isPaySpecificGoodsIds(specificGoodsIdsStr, fUid)) {
|
|
|
BigDecimal specificPrice = data.getSpecificPrice();
|
|
BigDecimal specificPrice = data.getSpecificPrice();
|
|
@@ -789,6 +857,33 @@ public class GoodsDonController {
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ public void setHomeConfigGoods(Map<String, List<HomeManagementFrontView>> map, HomeManagementConfig.Type type, List<HomeManagementFrontView> list, AtomicLong dsUserId, AtomicBoolean existsChannel, Long fUid) throws Exception {
|
|
|
|
|
+ //设置特定价格
|
|
|
|
|
+ if (CollUtil.isNotEmpty(list)) {
|
|
|
|
|
+ list = list.stream().filter(data -> {
|
|
|
|
|
+ if (data.getIsOwns()) {
|
|
|
|
|
+ if (dsUserId.get() == 0 && fUid != null && existsChannel.get()) {
|
|
|
|
|
+ Long sharedId = userService.getSharedIdByUserId(fUid);
|
|
|
|
|
+ if (sharedId == 0) {
|
|
|
|
|
+ existsChannel.set(false);
|
|
|
|
|
+ }
|
|
|
|
|
+ dsUserId.set(sharedId);
|
|
|
|
|
+ }
|
|
|
|
|
+ GoodsDonSku minPriceUserOwnsSku = goodsDonSkuMapper.checkAndReturnMinPriceUserOwnsSku(data.getGoodsId(), dsUserId.get());
|
|
|
|
|
+ if (minPriceUserOwnsSku == null) {
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+ data.setPrice(minPriceUserOwnsSku.getPrice());
|
|
|
|
|
+ data.setMonths(minPriceUserOwnsSku.getMonths());
|
|
|
|
|
+ data.setDays(minPriceUserOwnsSku.getDays());
|
|
|
|
|
+ }
|
|
|
|
|
+ return true;
|
|
|
|
|
+ }).collect(Collectors.toList());
|
|
|
|
|
+ setHomeManageSpecific(list, fUid, dsUserId.get());
|
|
|
|
|
+ map.put(type.name(), list);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 店铺平台列表
|
|
* 店铺平台列表
|
|
|
*/
|
|
*/
|
|
@@ -846,7 +941,7 @@ public class GoodsDonController {
|
|
|
* 根据分类获取对应平台
|
|
* 根据分类获取对应平台
|
|
|
*/
|
|
*/
|
|
|
@GetMapping("/get/categoryGoods")
|
|
@GetMapping("/get/categoryGoods")
|
|
|
- public Result<? extends Object> getGoodsByCategory(Long cgy, String customId) {
|
|
|
|
|
|
|
+ public Result<? extends Object> getGoodsByCategory(Long cgy, String customId, String dsCode) {
|
|
|
if (StrUtil.isNotBlank(customId)) {
|
|
if (StrUtil.isNotBlank(customId)) {
|
|
|
Result<List<YhShopGoodsFrontCategoryView>> shopGoods = getShopCategoryGoods(yhShopFrontService.getYhsIdByCustomId(customId), cgy);
|
|
Result<List<YhShopGoodsFrontCategoryView>> shopGoods = getShopCategoryGoods(yhShopFrontService.getYhsIdByCustomId(customId), cgy);
|
|
|
return shopGoods;
|
|
return shopGoods;
|
|
@@ -856,6 +951,10 @@ public class GoodsDonController {
|
|
|
if (cgy != null) {
|
|
if (cgy != null) {
|
|
|
categoryGoodsKey += ":" + cgy;
|
|
categoryGoodsKey += ":" + cgy;
|
|
|
}
|
|
}
|
|
|
|
|
+ List<Long> filter_goodsIds = getFilterGoodsIds();
|
|
|
|
|
+ if (CollUtil.isNotEmpty(filter_goodsIds)) {
|
|
|
|
|
+ categoryGoodsKey += ":hz-ip";
|
|
|
|
|
+ }
|
|
|
Object o = redisService.get(categoryGoodsKey);
|
|
Object o = redisService.get(categoryGoodsKey);
|
|
|
if (o == null) {
|
|
if (o == null) {
|
|
|
MapBuilder mapBuilder = MapUtils.flatBuilder(request.getParameterMap());
|
|
MapBuilder mapBuilder = MapUtils.flatBuilder(request.getParameterMap());
|
|
@@ -863,20 +962,46 @@ public class GoodsDonController {
|
|
|
String condition = String.format(" and gcr.category = %s", cgy);
|
|
String condition = String.format(" and gcr.category = %s", cgy);
|
|
|
mapBuilder.put("condition", condition);
|
|
mapBuilder.put("condition", condition);
|
|
|
}
|
|
}
|
|
|
|
|
+ if (CollUtil.isNotEmpty(filter_goodsIds)) {
|
|
|
|
|
+ mapBuilder.field(GoodsFrontListCategoryView::getId, filter_goodsIds).op(Operator.NotIn);
|
|
|
|
|
+ }
|
|
|
List<GoodsFrontListCategoryView> goodsFrontListViews = beanSearcher.searchAll(GoodsFrontListCategoryView.class, mapBuilder.build());
|
|
List<GoodsFrontListCategoryView> goodsFrontListViews = beanSearcher.searchAll(GoodsFrontListCategoryView.class, mapBuilder.build());
|
|
|
redisService.setNx(categoryGoodsKey, goodsFrontListViews, RedisService.key.YH_HOME_PAGHE_CACHE.getTimeout() + 10 * 60);
|
|
redisService.setNx(categoryGoodsKey, goodsFrontListViews, RedisService.key.YH_HOME_PAGHE_CACHE.getTimeout() + 10 * 60);
|
|
|
o = redisService.get(categoryGoodsKey);
|
|
o = redisService.get(categoryGoodsKey);
|
|
|
}
|
|
}
|
|
|
List<GoodsFrontListCategoryView> goodsFrontListViews = Jsons.parseList(o, GoodsFrontListCategoryView.class);
|
|
List<GoodsFrontListCategoryView> goodsFrontListViews = Jsons.parseList(o, GoodsFrontListCategoryView.class);
|
|
|
DateTime now = DateTime.now();
|
|
DateTime now = DateTime.now();
|
|
|
- goodsFrontListViews.forEach(data -> {
|
|
|
|
|
|
|
+ AtomicLong dsUserId = new AtomicLong();
|
|
|
|
|
+ AtomicBoolean existsChannel = new AtomicBoolean(true);
|
|
|
|
|
+ if (StrUtil.isNotBlank(dsCode)) {
|
|
|
|
|
+ UserSharedDto userSharedDto = userService.getUserShredDtoByDsCode(dsCode);
|
|
|
|
|
+ dsUserId.set(userSharedDto.getSharedId());
|
|
|
|
|
+ }
|
|
|
|
|
+ goodsFrontListViews = goodsFrontListViews.stream().filter(data -> {
|
|
|
|
|
+ if (data.getIsOwns()) {
|
|
|
|
|
+ if (dsUserId.get() == 0 && fUid != null && existsChannel.get()) {
|
|
|
|
|
+ Long sharedId = userService.getSharedIdByUserId(fUid);
|
|
|
|
|
+ if (sharedId == 0) {
|
|
|
|
|
+ existsChannel.set(false);
|
|
|
|
|
+ }
|
|
|
|
|
+ dsUserId.set(sharedId);
|
|
|
|
|
+ }
|
|
|
|
|
+ GoodsDonSku minPriceUserOwnsSku = goodsDonSkuMapper.checkAndReturnMinPriceUserOwnsSku(data.getId(), dsUserId.get());
|
|
|
|
|
+ if (minPriceUserOwnsSku == null) {
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+ data.setPrice(minPriceUserOwnsSku.getPrice());
|
|
|
|
|
+ data.setMonths(minPriceUserOwnsSku.getMonths());
|
|
|
|
|
+ data.setDays(minPriceUserOwnsSku.getDays());
|
|
|
|
|
+ }
|
|
|
Integer sold = orderDonMapper.selectCount(Wrappers.lambdaQuery(OrderDon.class)
|
|
Integer sold = orderDonMapper.selectCount(Wrappers.lambdaQuery(OrderDon.class)
|
|
|
.eq(OrderDon::getGoodsId, data.getId()).notIn(OrderDon::getStatus, Constant.noOrderStatus));
|
|
.eq(OrderDon::getGoodsId, data.getId()).notIn(OrderDon::getStatus, Constant.noOrderStatus));
|
|
|
data.setSold(sold + data.getSold());
|
|
data.setSold(sold + data.getSold());
|
|
|
data.setNotifyMsg(getPayMsgTime(data.getId(), now, 1, null));
|
|
data.setNotifyMsg(getPayMsgTime(data.getId(), now, 1, null));
|
|
|
//设置特定价格
|
|
//设置特定价格
|
|
|
- setGcSpecificPrice(data, fUid);
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ setGcSpecificPrice(data, fUid, dsUserId.get());
|
|
|
|
|
+ return true;
|
|
|
|
|
+ }).collect(Collectors.toList());
|
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult(goodsFrontListViews);
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult(goodsFrontListViews);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -910,6 +1035,21 @@ public class GoodsDonController {
|
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult(list);
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult(list);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 获取设备活动详情
|
|
|
|
|
+ */
|
|
|
|
|
+ @GetMapping("/get/equipment/activity")
|
|
|
|
|
+ public Result<EquipmentActivityReduce> getEpActivity() {
|
|
|
|
|
+ DateTime now = DateTime.now();
|
|
|
|
|
+ EquipmentActivityReduce equipmentActivityReduce = beanSearcher.searchFirst(EquipmentActivityReduce.class, MapUtils.builder()
|
|
|
|
|
+ .field(EquipmentActivityReduce::getSt, now).op(Operator.LessEqual)
|
|
|
|
|
+ .field(EquipmentActivityReduce::getEt, now).op(Operator.GreaterThan)
|
|
|
|
|
+ .field(EquipmentActivityReduce::getDeleted, 1)
|
|
|
|
|
+ .onlySelect(EquipmentActivityReduce::getF, EquipmentActivityReduce::getQ, EquipmentActivityReduce::getTq, EquipmentActivityReduce::getSt, EquipmentActivityReduce::getEt)
|
|
|
|
|
+ .build());
|
|
|
|
|
+ return GatewayResponse.SUCCESS.newBuilder().toResult(equipmentActivityReduce);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 获取pc广告配置
|
|
* 获取pc广告配置
|
|
|
*/
|
|
*/
|