|
|
@@ -213,6 +213,7 @@ public class GoodsDonController {
|
|
|
* 官网首页 平台列表
|
|
|
*/
|
|
|
@GetMapping("/get/list")
|
|
|
+ @Deprecated
|
|
|
public Result<? extends Object> getGoodsList(String customId) {
|
|
|
if (StrUtil.isNotBlank(customId)) {
|
|
|
Result<List<YhShopGoodsFrontView>> shopGoods = getShopGoods(yhShopFrontService.getYhsIdByCustomId(customId));
|
|
|
@@ -247,7 +248,7 @@ public class GoodsDonController {
|
|
|
data.setNotifyMsg(getPayMsgTime(data.getId(), now, 1, null));
|
|
|
|
|
|
//设置特定价格
|
|
|
- setSpecificPrice(data, fUid);
|
|
|
+ setSpecificPrice(data, fUid, null);
|
|
|
});
|
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult(Optional.of(list));
|
|
|
}
|
|
|
@@ -291,7 +292,7 @@ public class GoodsDonController {
|
|
|
data.setNotifyMsg(getPayMsgTime(data.getId(), now, 1, null));
|
|
|
|
|
|
//设置特定价格
|
|
|
- setSpecificPrice(data, fUid);
|
|
|
+ setSpecificPrice(data, fUid, null);
|
|
|
});
|
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult(Optional.of(list));
|
|
|
}
|
|
|
@@ -413,7 +414,7 @@ public class GoodsDonController {
|
|
|
* 获取商品推荐平台
|
|
|
*/
|
|
|
@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;
|
|
|
Long yhsId = null;
|
|
|
if (StrUtil.isNotBlank(customId)) {
|
|
|
@@ -445,13 +446,29 @@ public class GoodsDonController {
|
|
|
if (goodsRecommendViews == null) {
|
|
|
goodsRecommendViews = Jsons.parseList(o.toString(), GoodsFrontListView.class);
|
|
|
}
|
|
|
- goodsRecommendViews.forEach(data -> {
|
|
|
+ Long sharedId = null;
|
|
|
+ if (StrUtil.isNotBlank(dsCode)) {
|
|
|
+ UserSharedDto userSharedDto = userService.getUserShredDtoByDsCode(dsCode);
|
|
|
+ sharedId = userSharedDto.getSharedId();
|
|
|
+ }
|
|
|
+ final Long dsUserId = sharedId;
|
|
|
+ goodsRecommendViews = goodsRecommendViews.stream().filter(data -> {
|
|
|
+ if (data.getIsOwns()) {
|
|
|
+ GoodsDonSku minPriceUserOwnsSku = goodsDonSkuMapper.checkAndReturnMinPriceUserOwnsSku(data.getId(), dsUserId);
|
|
|
+ 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)
|
|
|
.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);
|
|
|
+ return true;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult(goodsRecommendViews);
|
|
|
}
|
|
|
|
|
|
@@ -537,8 +554,14 @@ public class GoodsDonController {
|
|
|
List<HomeManagementFrontView> exList = Jsons.parseList(Jsons.toJson(map.get(HomeManagementConfig.Type.ex.name())), HomeManagementFrontView.class);
|
|
|
if (CollUtil.isNotEmpty(exList)) {
|
|
|
exList = exList.stream().filter(data -> {
|
|
|
- if (data.getIsOwns() && goodsDonSkuMapper.checkUserOwnsSku(data.getGoodsId(), dsUserId) == null) {
|
|
|
- return false;
|
|
|
+ if (data.getIsOwns()) {
|
|
|
+ GoodsDonSku minPriceUserOwnsSku = goodsDonSkuMapper.checkAndReturnMinPriceUserOwnsSku(data.getGoodsId(), dsUserId);
|
|
|
+ if (minPriceUserOwnsSku == null) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ data.setPrice(minPriceUserOwnsSku.getPrice());
|
|
|
+ data.setMonths(minPriceUserOwnsSku.getMonths());
|
|
|
+ data.setDays(minPriceUserOwnsSku.getDays());
|
|
|
}
|
|
|
return true;
|
|
|
}).collect(Collectors.toList());
|
|
|
@@ -549,8 +572,14 @@ public class GoodsDonController {
|
|
|
List<HomeManagementFrontView> vgList = Jsons.parseList(Jsons.toJson(map.get(HomeManagementConfig.Type.vg.name())), HomeManagementFrontView.class);
|
|
|
if (CollUtil.isNotEmpty(vgList)) {
|
|
|
vgList = vgList.stream().filter(data -> {
|
|
|
- if (data.getIsOwns() && goodsDonSkuMapper.checkUserOwnsSku(data.getGoodsId(), dsUserId) == null) {
|
|
|
- return false;
|
|
|
+ if (data.getIsOwns()) {
|
|
|
+ GoodsDonSku minPriceUserOwnsSku = goodsDonSkuMapper.checkAndReturnMinPriceUserOwnsSku(data.getGoodsId(), dsUserId);
|
|
|
+ if (minPriceUserOwnsSku == null) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ data.setPrice(minPriceUserOwnsSku.getPrice());
|
|
|
+ data.setMonths(minPriceUserOwnsSku.getMonths());
|
|
|
+ data.setDays(minPriceUserOwnsSku.getDays());
|
|
|
}
|
|
|
return true;
|
|
|
}).collect(Collectors.toList());
|
|
|
@@ -668,7 +697,7 @@ public class GoodsDonController {
|
|
|
/**
|
|
|
* 设置平台 特定价格
|
|
|
*/
|
|
|
- public void setSpecificPrice(GoodsFrontListView data, Long fUid) {
|
|
|
+ public void setSpecificPrice(GoodsFrontListView data, Long fUid, Long dsUserId) {
|
|
|
if (fUid != null) {
|
|
|
if (data.getIsSp()) {
|
|
|
//查找所有特定规格最小价格 满足条件
|
|
|
@@ -686,6 +715,9 @@ public class GoodsDonController {
|
|
|
redisService.setNx(specificGoodsKey, specificSkus, RedisService.key.YH_HOME_PAGHE_CACHE.getTimeout());
|
|
|
}
|
|
|
specificSkus.forEach(specificSku -> {
|
|
|
+ if (StrUtil.isNotEmpty(specificSku.getUserOwns()) && (dsUserId == null || !specificSku.getUserOwns().contains(dsUserId.toString()))) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
String specificGoodsIdsStr = specificSku.getSpecificGoodsIds();
|
|
|
if (isPaySpecificGoodsIds(specificGoodsIdsStr, fUid)) {
|
|
|
BigDecimal specificPrice = data.getSpecificPrice();
|
|
|
@@ -910,8 +942,14 @@ public class GoodsDonController {
|
|
|
}
|
|
|
final Long dsUserId = sharedId;
|
|
|
goodsFrontListViews = goodsFrontListViews.stream().filter(data -> {
|
|
|
- if (data.getIsOwns() && goodsDonSkuMapper.checkUserOwnsSku(data.getId(), dsUserId) == null) {
|
|
|
- return false;
|
|
|
+ if (data.getIsOwns()) {
|
|
|
+ GoodsDonSku minPriceUserOwnsSku = goodsDonSkuMapper.checkAndReturnMinPriceUserOwnsSku(data.getId(), dsUserId);
|
|
|
+ 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)
|
|
|
.eq(OrderDon::getGoodsId, data.getId()).notIn(OrderDon::getStatus, Constant.noOrderStatus));
|