|
|
@@ -38,6 +38,7 @@ import javax.servlet.http.HttpServletRequest;
|
|
|
import java.math.BigDecimal;
|
|
|
import java.util.*;
|
|
|
import java.util.concurrent.ConcurrentHashMap;
|
|
|
+import java.util.stream.Collectors;
|
|
|
import java.util.stream.Stream;
|
|
|
|
|
|
/**
|
|
|
@@ -72,18 +73,30 @@ public class GoodsDonController {
|
|
|
* 获取平台商品分类
|
|
|
*/
|
|
|
@GetMapping("/get/category")
|
|
|
- public Result<List<GoodsDonCategoryFrontView>> getCategory() {
|
|
|
- String key = RedisService.key.YH_HOME_PAGHE_CACHE.getName() + "category";
|
|
|
- Object o = redisService.get(key);
|
|
|
- List<GoodsDonCategoryFrontView> list;
|
|
|
- if (o == null) {
|
|
|
- list = beanSearcher.searchAll(GoodsDonCategoryFrontView.class, MapUtils.flatBuilder(request.getParameterMap())
|
|
|
- .build());
|
|
|
- redisService.setNx(key, list, 30 * 60l);
|
|
|
- o = redisService.get(key);
|
|
|
- }
|
|
|
- list = Jsons.parseList(o, GoodsDonCategoryFrontView.class);
|
|
|
- return GatewayResponse.SUCCESS.newBuilder().toResult(list);
|
|
|
+ public Result<List<GoodsDonCategoryFrontView>> getCategory(String customId) {
|
|
|
+ Long yhsId = null;
|
|
|
+ if (StrUtil.isNotBlank(customId)) {
|
|
|
+ yhsId = yhShopFrontService.getYhsIdByCustomId(customId);
|
|
|
+ }
|
|
|
+ String key = RedisService.key.YH_HOME_PAGHE_CACHE.getEnvName() + "category";
|
|
|
+ Object o = redisService.get(key);
|
|
|
+ List<GoodsDonCategoryFrontView> list;
|
|
|
+ MapBuilder mapBuilder = MapUtils.flatBuilder(request.getParameterMap());
|
|
|
+ String condition = " and (select count(*) from goods_don_category_relate gcr inner join goods_don g on g.id = gcr.goods_id %s where gcr.category = gc.id) > 0";
|
|
|
+ if (yhsId != null) {
|
|
|
+ condition = String.format(condition, String.format(" inner join yh_shop_goods_sku ys on ys.goods_id = g.id and ys.status is true and ys.deleted is true and g.is_distribute is true and yhs_id = %s", yhsId));
|
|
|
+ } else {
|
|
|
+ condition = String.format(condition, StrUtil.EMPTY);
|
|
|
+ }
|
|
|
+ mapBuilder.put("condition", condition);
|
|
|
+ if (o == null) {
|
|
|
+ list = beanSearcher.searchAll(GoodsDonCategoryFrontView.class, mapBuilder
|
|
|
+ .build());
|
|
|
+ redisService.setNx(key, list, 30 * 60l);
|
|
|
+ o = redisService.get(key);
|
|
|
+ }
|
|
|
+ list = Jsons.parseList(o, GoodsDonCategoryFrontView.class);
|
|
|
+ return GatewayResponse.SUCCESS.newBuilder().toResult(list);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -194,53 +207,42 @@ public class GoodsDonController {
|
|
|
*/
|
|
|
@GetMapping("/get/list")
|
|
|
public Result<? extends Object> getGoodsList(String customId) {
|
|
|
- if (StrUtil.isNotBlank(customId)) {
|
|
|
- Result<List<YhShopGoodsFrontView>> shopGoods = getShopGoods(yhShopFrontService.getYhsIdByCustomId(customId));
|
|
|
- return shopGoods;
|
|
|
- }
|
|
|
- List<Long> filter_goodsIds = getFilterGoodsIds();
|
|
|
- String pcCacheKey = RedisService.key.YH_HOME_PAGHE_CACHE.getEnvName() + "PC";
|
|
|
- if (CollUtil.isNotEmpty(filter_goodsIds)) {
|
|
|
- pcCacheKey += ":hz-ip";
|
|
|
- }
|
|
|
- Long fUid = StpUserUtil.getUserIdAfterLogin();
|
|
|
- Object value = redisService.get(pcCacheKey);
|
|
|
- if (value != null) {
|
|
|
- try {
|
|
|
- List<GoodsFrontListView> list = Jsons.parseList(value, GoodsFrontListView.class);
|
|
|
- if (CollUtil.isNotEmpty(list)) {
|
|
|
- //设置特定价格
|
|
|
- setSpecificPrice(list, fUid);
|
|
|
- return GatewayResponse.SUCCESS.newBuilder().toResult(Optional.ofNullable(list));
|
|
|
- }
|
|
|
- } catch (Exception e) {
|
|
|
- }
|
|
|
- }
|
|
|
- MapBuilder builder = MapUtils.flatBuilder(request.getParameterMap());
|
|
|
- if (CollUtil.isNotEmpty(filter_goodsIds)) {
|
|
|
- builder.field(GoodsFrontListView::getId, filter_goodsIds).op(Operator.NotIn);
|
|
|
- }
|
|
|
- builder.field(GoodsFrontListView::getType, 1);
|
|
|
- List<GoodsFrontListView> list = beanSearcher.searchAll(GoodsFrontListView.class, builder.build());
|
|
|
- DateTime now = DateTime.now();
|
|
|
- list.forEach(data -> {
|
|
|
-// data.setSpecs(beanSearcher.searchFirst(GoodsDonSpecFrontView.class, MapUtils.builder().field(GoodsDonSpecFrontView::getGoodsId, data.getId()).build()));
|
|
|
-// data.setSkuList(beanSearcher.searchAll(GoodsDonSkuFrontView.class, MapUtils.builder().field(GoodsDonSkuFrontView::getGoodsId, data.getId()).field(GoodsDonSkuFrontView::getStatus, true).orderBy(GoodsDonSkuFrontView::getPrice).asc().build()));
|
|
|
-// data.getSkuList().forEach(sku -> {
|
|
|
-// if (sku.getIsDp()) {
|
|
|
-// List<GoodsDiscountPlusPurchaseRelationFrontView> dpSkuViews = beanSearcher.searchAll(GoodsDiscountPlusPurchaseRelationFrontView.class, MapUtils.builder().field(GoodsDiscountPlusPurchaseRelationFrontView::getSkuId, sku.getId()).build());
|
|
|
-// sku.setDpSkuViews(dpSkuViews);
|
|
|
-// }
|
|
|
-// });
|
|
|
- Integer sold = orderDonMapper.selectCount(Wrappers.lambdaQuery(OrderDon.class)
|
|
|
- .eq(OrderDon::getGoodsId, data.getId()).notIn(OrderDon::getStatus, Constant.noOrderStatus));
|
|
|
- data.setSold(sold + data.getVirtualSold());
|
|
|
- data.setNotifyMsg(getPayMsgTime(data.getId(), now, 1, null));
|
|
|
- });
|
|
|
- redisService.setNx(pcCacheKey, list, RedisService.key.YH_HOME_PAGHE_CACHE.getTimeout());
|
|
|
- //设置特定价格
|
|
|
- setSpecificPrice(list, fUid);
|
|
|
- return GatewayResponse.SUCCESS.newBuilder().toResult(Optional.of(list));
|
|
|
+ if (StrUtil.isNotBlank(customId)) {
|
|
|
+ Result<List<YhShopGoodsFrontView>> shopGoods = getShopGoods(yhShopFrontService.getYhsIdByCustomId(customId));
|
|
|
+ return shopGoods;
|
|
|
+ }
|
|
|
+ List<Long> filter_goodsIds = getFilterGoodsIds();
|
|
|
+ String pcCacheKey = RedisService.key.YH_HOME_PAGHE_CACHE.getEnvName() + "PC";
|
|
|
+ if (CollUtil.isNotEmpty(filter_goodsIds)) {
|
|
|
+ pcCacheKey += ":hz-ip";
|
|
|
+ }
|
|
|
+ Long fUid = StpUserUtil.getUserIdAfterLogin();
|
|
|
+ Object o = redisService.get(pcCacheKey);
|
|
|
+ List<GoodsFrontListView> list = null;
|
|
|
+ if (o == null) {
|
|
|
+ MapBuilder builder = MapUtils.flatBuilder(request.getParameterMap());
|
|
|
+ if (CollUtil.isNotEmpty(filter_goodsIds)) {
|
|
|
+ builder.field(GoodsFrontListView::getId, filter_goodsIds).op(Operator.NotIn);
|
|
|
+ }
|
|
|
+ builder.field(GoodsFrontListView::getType, 1);
|
|
|
+ list = beanSearcher.searchAll(GoodsFrontListView.class, builder.build());
|
|
|
+ redisService.setNx(pcCacheKey, list, RedisService.key.YH_HOME_PAGHE_CACHE.getTimeout());
|
|
|
+ o = redisService.get(pcCacheKey);
|
|
|
+ }
|
|
|
+ if (list == null) {
|
|
|
+ list = Jsons.parseList(o, GoodsFrontListView.class);
|
|
|
+ }
|
|
|
+ DateTime now = DateTime.now();
|
|
|
+ list.forEach(data -> {
|
|
|
+ Integer sold = orderDonMapper.selectCount(Wrappers.lambdaQuery(OrderDon.class)
|
|
|
+ .eq(OrderDon::getGoodsId, data.getId()).notIn(OrderDon::getStatus, Constant.noOrderStatus));
|
|
|
+ data.setSold(sold + data.getSold());
|
|
|
+ data.setNotifyMsg(getPayMsgTime(data.getId(), now, 1, null));
|
|
|
+
|
|
|
+ //设置特定价格
|
|
|
+ setSpecificPrice(data, fUid);
|
|
|
+ });
|
|
|
+ return GatewayResponse.SUCCESS.newBuilder().toResult(Optional.of(list));
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -249,44 +251,42 @@ public class GoodsDonController {
|
|
|
@GetMapping("/get/homePage")
|
|
|
@Deprecated
|
|
|
public Result<? extends Object> getGoodsHomePage(String customId) {
|
|
|
- if (StrUtil.isNotBlank(customId)) {
|
|
|
- Result<List<YhShopGoodsFrontView>> shopGoods = getShopGoods(yhShopFrontService.getYhsIdByCustomId(customId));
|
|
|
- return shopGoods;
|
|
|
- }
|
|
|
- List<Long> filter_goodsIds = getFilterGoodsIds();
|
|
|
- String h5CacheKey = RedisService.key.YH_HOME_PAGHE_CACHE.getEnvName() + "H5";
|
|
|
- if (CollUtil.isNotEmpty(filter_goodsIds)) {
|
|
|
- h5CacheKey += ":hz-ip";
|
|
|
- }
|
|
|
- Long fUid = StpUserUtil.getUserIdAfterLogin();
|
|
|
- Object value = redisService.get(h5CacheKey);
|
|
|
- if (value != null) {
|
|
|
- try {
|
|
|
- List<GoodsFrontListView> list = Jsons.parseList(value, GoodsFrontListView.class);
|
|
|
- if (CollUtil.isNotEmpty(list)) {
|
|
|
- //设置特定价格
|
|
|
- setSpecificPrice(list, fUid);
|
|
|
- return GatewayResponse.SUCCESS.newBuilder().toResult(Optional.ofNullable(list));
|
|
|
- }
|
|
|
- } catch (Exception e) {
|
|
|
- }
|
|
|
- }
|
|
|
- MapBuilder builder = MapUtils.flatBuilder(request.getParameterMap());
|
|
|
- if (CollUtil.isNotEmpty(filter_goodsIds)) {
|
|
|
- builder.field(GoodsFrontListView::getId, filter_goodsIds).op(Operator.NotIn);
|
|
|
- }
|
|
|
- List<GoodsFrontListView> dataList = beanSearcher.searchAll(GoodsFrontListView.class, builder.build());
|
|
|
- DateTime now = DateTime.now();
|
|
|
- dataList.forEach(data -> {
|
|
|
- Integer sold = orderDonMapper.selectCount(Wrappers.lambdaQuery(OrderDon.class)
|
|
|
- .eq(OrderDon::getGoodsId, data.getId()).notIn(OrderDon::getStatus, Constant.noOrderStatus));
|
|
|
- data.setSold(sold + data.getVirtualSold());
|
|
|
- data.setNotifyMsg(getPayMsgTime(data.getId(), now, 1, null));
|
|
|
- });
|
|
|
- redisService.setNx(h5CacheKey, dataList, RedisService.key.YH_HOME_PAGHE_CACHE.getTimeout());
|
|
|
- //设置特定价格
|
|
|
- setSpecificPrice(dataList, fUid);
|
|
|
- return GatewayResponse.SUCCESS.newBuilder().toResult(Optional.of(dataList));
|
|
|
+ if (StrUtil.isNotBlank(customId)) {
|
|
|
+ Result<List<YhShopGoodsFrontView>> shopGoods = getShopGoods(yhShopFrontService.getYhsIdByCustomId(customId));
|
|
|
+ return shopGoods;
|
|
|
+ }
|
|
|
+ List<Long> filter_goodsIds = getFilterGoodsIds();
|
|
|
+ String h5CacheKey = RedisService.key.YH_HOME_PAGHE_CACHE.getEnvName() + "H5";
|
|
|
+ if (CollUtil.isNotEmpty(filter_goodsIds)) {
|
|
|
+ h5CacheKey += ":hz-ip";
|
|
|
+ }
|
|
|
+ Long fUid = StpUserUtil.getUserIdAfterLogin();
|
|
|
+ Object o = redisService.get(h5CacheKey);
|
|
|
+ List<GoodsFrontListView> list = null;
|
|
|
+ if (o == null) {
|
|
|
+ MapBuilder builder = MapUtils.flatBuilder(request.getParameterMap());
|
|
|
+ if (CollUtil.isNotEmpty(filter_goodsIds)) {
|
|
|
+ builder.field(GoodsFrontListView::getId, filter_goodsIds).op(Operator.NotIn);
|
|
|
+ }
|
|
|
+ list = beanSearcher.searchAll(GoodsFrontListView.class, builder.build());
|
|
|
+ redisService.setNx(h5CacheKey, list, RedisService.key.YH_HOME_PAGHE_CACHE.getTimeout());
|
|
|
+ o = redisService.get(h5CacheKey);
|
|
|
+ }
|
|
|
+ if (list == null) {
|
|
|
+ list = Jsons.parseList(o, GoodsFrontListView.class);
|
|
|
+ }
|
|
|
+
|
|
|
+ DateTime now = DateTime.now();
|
|
|
+ list.forEach(data -> {
|
|
|
+ Integer sold = orderDonMapper.selectCount(Wrappers.lambdaQuery(OrderDon.class)
|
|
|
+ .eq(OrderDon::getGoodsId, data.getId()).notIn(OrderDon::getStatus, Constant.noOrderStatus));
|
|
|
+ data.setSold(sold + data.getSold());
|
|
|
+ data.setNotifyMsg(getPayMsgTime(data.getId(), now, 1, null));
|
|
|
+
|
|
|
+ //设置特定价格
|
|
|
+ setSpecificPrice(data, fUid);
|
|
|
+ });
|
|
|
+ return GatewayResponse.SUCCESS.newBuilder().toResult(Optional.of(list));
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -319,100 +319,124 @@ public class GoodsDonController {
|
|
|
}
|
|
|
|
|
|
|
|
|
- /**
|
|
|
- * 获取商品详情
|
|
|
- */
|
|
|
- @GetMapping("/get/{id}")
|
|
|
- public Result<? extends Object> getDetail(@PathVariable Long id, String customId) {
|
|
|
- if (StrUtil.isNotBlank(customId) && id != 15) {
|
|
|
- Result<YhShopGoodsFrontView> yhShopGoodsDetail = getGoodsDetailByYhsId(yhShopFrontService.getYhsIdByCustomId(customId), id);
|
|
|
- return yhShopGoodsDetail;
|
|
|
- }
|
|
|
- Long fUid = StpUserUtil.getUserIdAfterLogin();
|
|
|
- GoodsDonViews views = beanSearcher.searchFirst(GoodsDonViews.class, MapUtils.builder().field(GoodsDonViews::getId, id).build());
|
|
|
+ /**
|
|
|
+ * 获取商品详情
|
|
|
+ */
|
|
|
+ @GetMapping("/get/{id}")
|
|
|
+ public Result<? extends Object> getDetail(@PathVariable Long id, String customId) {
|
|
|
+ if (StrUtil.isNotBlank(customId) && id != 15) {
|
|
|
+ Result<YhShopGoodsFrontView> yhShopGoodsDetail = getGoodsDetailByYhsId(yhShopFrontService.getYhsIdByCustomId(customId), id);
|
|
|
+ return yhShopGoodsDetail;
|
|
|
+ }
|
|
|
+ String goodsDetailKey = RedisService.key.YH_HOME_PAGHE_CACHE.getEnvName() + "goods_detail:" + id;
|
|
|
+ Object o = redisService.get(goodsDetailKey);
|
|
|
+ GoodsFrontListView views = null;
|
|
|
+ if (o == null) {
|
|
|
+ views = beanSearcher.searchFirst(GoodsFrontListView.class, MapUtils.builder().field(GoodsFrontListView::getId, id)
|
|
|
+ .build());
|
|
|
|
|
|
- views.setSpecs(beanSearcher.searchFirst(GoodsDonSpecFrontView.class, MapUtils.builder().field(GoodsDonSpecFrontView::getGoodsId, views.getId()).build()));
|
|
|
- MapBuilder builder = MapUtils.builder().field(GoodsDonSku::getGoodsId, views.getId()).field(GoodsDonSku::getStatus, true);
|
|
|
+ views.setSpecs(beanSearcher.searchFirst(GoodsDonSpecFrontView.class, MapUtils.builder().field(GoodsDonSpecFrontView::getGoodsId, views.getId()).build()));
|
|
|
+ MapBuilder builder = MapUtils.builder().field(GoodsDonSku::getGoodsId, views.getId()).field(GoodsDonSku::getStatus, true);
|
|
|
|
|
|
- if (views.getType() == 1) {
|
|
|
- builder.orderBy(GoodsDonSku::getOrderBy).asc();
|
|
|
- }
|
|
|
- views.setSkuList(beanSearcher.searchAll(GoodsDonSkuFrontView.class, builder.build()));
|
|
|
- views.getSkuList().forEach(sku -> {
|
|
|
- if (sku.getIsDp()) {
|
|
|
- sku.setDpSkuViews(beanSearcher.searchAll(GoodsDiscountPlusPurchaseRelationFrontView.class, MapUtils.builder()
|
|
|
- .field(GoodsDiscountPlusPurchaseRelationFrontView::getSkuId, sku.getId())
|
|
|
- .build()));
|
|
|
- }
|
|
|
- if (views.getIsSp()) {
|
|
|
- if (fUid == null) {
|
|
|
- sku.setSpecificPrice(null);
|
|
|
- sku.setSpecificGoodsIds(null);
|
|
|
- return;
|
|
|
- }
|
|
|
- //设置特定价格
|
|
|
- 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);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
- //评论
|
|
|
+ if (views.getType() == 1) {
|
|
|
+ builder.orderBy(GoodsDonSku::getOrderBy).asc();
|
|
|
+ }
|
|
|
+ views.setSkuList(beanSearcher.searchAll(GoodsDonSkuFrontView.class, builder.build()));
|
|
|
+ redisService.setNx(goodsDetailKey, views, RedisService.key.YH_HOME_PAGHE_CACHE.getTimeout() + 60 * RandomUtil.randomInt(10));
|
|
|
+ o = redisService.get(goodsDetailKey);
|
|
|
+ }
|
|
|
+ Long fUid = StpUserUtil.getUserIdAfterLogin();
|
|
|
+ if (views == null) {
|
|
|
+ views = Jsons.parseObject(o, GoodsFrontListView.class);
|
|
|
+ }
|
|
|
+ for (GoodsDonSkuFrontView sku : views.getSkuList()) {
|
|
|
+ if (sku.getIsDp()) {
|
|
|
+ sku.setDpSkuViews(beanSearcher.searchAll(GoodsDiscountPlusPurchaseRelationFrontView.class, MapUtils.builder()
|
|
|
+ .field(GoodsDiscountPlusPurchaseRelationFrontView::getSkuId, sku.getId())
|
|
|
+ .build()));
|
|
|
+ }
|
|
|
+ if (views.getIsSp()) {
|
|
|
+ if (fUid == null) {
|
|
|
+ sku.setSpecificPrice(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);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ Integer sold = orderDonMapper.selectCount(Wrappers.lambdaQuery(OrderDon.class)
|
|
|
+ .eq(OrderDon::getGoodsId, views.getId()).notIn(OrderDon::getStatus, Constant.noOrderStatus));
|
|
|
+ views.setSold(sold + views.getSold());
|
|
|
+ //评论
|
|
|
// OrderCommentFrontView comments = beanSearcher.searchFirst(OrderCommentFrontView.class, MapUtils.builder()
|
|
|
// .field(OrderCommentFrontView::getGoodsId, views.getId())
|
|
|
// .orderBy(OrderCommentFrontView::getCommentTime).desc()
|
|
|
// .orderBy(OrderCommentFrontView::getId).desc()
|
|
|
// .build());
|
|
|
// views.setComments(comments);
|
|
|
- return GatewayResponse.SUCCESS.newBuilder().toResult(views);
|
|
|
- }
|
|
|
+ return GatewayResponse.SUCCESS.newBuilder().toResult(views);
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
* 获取商品推荐平台
|
|
|
*/
|
|
|
@GetMapping("/get/recommend/{id}")
|
|
|
- public Result<List<GoodsFrontListView>> getRecommendGoodsByGid(@PathVariable Long id) throws Exception {
|
|
|
- String key = RedisService.key.YH_HOME_PAGHE_CACHE.getEnvName() + "recommend:" + id;
|
|
|
- Object value = redisService.get(key);
|
|
|
- Long fUid = StpUserUtil.getUserIdAfterLogin();
|
|
|
- if (value != null) {
|
|
|
- List<GoodsFrontListView> goodsRecommendViews = Jsons.parseList(value.toString(), GoodsFrontListView.class);
|
|
|
- setSpecificPrice(goodsRecommendViews, fUid);
|
|
|
- return GatewayResponse.SUCCESS.newBuilder().toResult(goodsRecommendViews);
|
|
|
- }
|
|
|
- if (value == null) {
|
|
|
- GoodsDon goodsDon = beanSearcher.searchFirst(GoodsDon.class, MapUtils.builder()
|
|
|
- .field(GoodsDon::getId, id)
|
|
|
- .field(GoodsDon::getStatus, true)
|
|
|
- .field(GoodsDon::getDeleted, true)
|
|
|
- .build());
|
|
|
- if (goodsDon != null && StrUtil.isNotEmpty(goodsDon.getRecommendGoods())) {
|
|
|
- List<Long> recommend_gidList = Jsons.parseList(goodsDon.getRecommendGoods(), Long.class);
|
|
|
- List<GoodsFrontListView> goodsRecommendViews = beanSearcher.searchAll(GoodsFrontListView.class, MapUtils.builder().field(GoodsRecommendViews::getGoodsId, recommend_gidList).op(Operator.InList).build());
|
|
|
- goodsRecommendViews.forEach(data -> {
|
|
|
- Integer sold = registerOrderDonMapper.selectCount(Wrappers.lambdaQuery(RegisterOrderDon.class)
|
|
|
- .eq(RegisterOrderDon::getGoodsId, data.getId()).notIn(RegisterOrderDon::getStatus, Constant.noOrderStatus));
|
|
|
- data.setSold(sold + data.getVirtualSold());
|
|
|
- });
|
|
|
- redisService.setNx(key, Jsons.toJson(goodsRecommendViews), 60 * 15l);
|
|
|
- //设置特定价格
|
|
|
- setSpecificPrice(goodsRecommendViews, fUid);
|
|
|
- return GatewayResponse.SUCCESS.newBuilder().toResult(goodsRecommendViews);
|
|
|
- }
|
|
|
- }
|
|
|
- return GatewayResponse.SUCCESS.newBuilder().toResult();
|
|
|
+ public Result<List<GoodsFrontListView>> getRecommendGoodsByGid(@PathVariable Long id, String customId) throws Exception {
|
|
|
+ String key = RedisService.key.YH_HOME_PAGHE_CACHE.getEnvName() + "recommend:" + id;
|
|
|
+ Long yhsId = null;
|
|
|
+ if (StrUtil.isNotBlank(customId)) {
|
|
|
+ yhsId = yhShopFrontService.getYhsIdByCustomId(customId);
|
|
|
+ key = RedisService.key.YH_HOME_PAGHE_CACHE_SHOP.getEnvName() + yhsId + ":recommend:" + id;
|
|
|
+ }
|
|
|
+ Object o = redisService.get(key);
|
|
|
+ Long fUid = StpUserUtil.getUserIdAfterLogin();
|
|
|
+ List<GoodsFrontListView> goodsRecommendViews = null;
|
|
|
+ if (o == null) {
|
|
|
+ GoodsDon goodsDon = beanSearcher.searchFirst(GoodsDon.class, MapUtils.builder()
|
|
|
+ .field(GoodsDon::getId, id).field(GoodsDon::getStatus, true)
|
|
|
+ .field(GoodsDon::getDeleted, true)
|
|
|
+ .build());
|
|
|
+ if (goodsDon != null && StrUtil.isNotEmpty(goodsDon.getRecommendGoods())) {
|
|
|
+ List<Long> recommend_gidList = Jsons.parseList(goodsDon.getRecommendGoods(), Long.class);
|
|
|
+ MapBuilder mapBuilder = MapUtils.builder();
|
|
|
+ if (yhsId != null) {
|
|
|
+ mapBuilder.put("condition", String.format(" and g.id in (select distinct goods_id from yh_shop_goods_sku where yhs_id = %s and status is true and deleted is true) and g.is_distribute is true", yhsId));
|
|
|
+ }
|
|
|
+ mapBuilder.field(GoodsFrontListView::getId, recommend_gidList).op(Operator.InList);
|
|
|
+ goodsRecommendViews = beanSearcher.searchAll(GoodsFrontListView.class, mapBuilder.build());
|
|
|
+ redisService.setNx(key, Jsons.toJson(goodsRecommendViews), 60 * 15l);
|
|
|
+ o = redisService.get(key);
|
|
|
+ } else {
|
|
|
+ return GatewayResponse.SUCCESS.newBuilder().toResult();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (goodsRecommendViews == null) {
|
|
|
+ goodsRecommendViews = Jsons.parseList(o.toString(), GoodsFrontListView.class);
|
|
|
+ }
|
|
|
+ goodsRecommendViews.forEach(data -> {
|
|
|
+ Integer sold = orderDonMapper.selectCount(Wrappers.lambdaQuery(OrderDon.class)
|
|
|
+ .eq(OrderDon::getGoodsId, data.getId()).notIn(OrderDon::getStatus, Constant.noOrderStatus));
|
|
|
+ data.setSold(data.getSold() + sold);
|
|
|
+ //设置特定价格
|
|
|
+ setSpecificPrice(data, fUid);
|
|
|
+ });
|
|
|
+ return GatewayResponse.SUCCESS.newBuilder().toResult(goodsRecommendViews);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -455,30 +479,30 @@ public class GoodsDonController {
|
|
|
* 获取首页配置列表
|
|
|
*/
|
|
|
@GetMapping("/get/homeManage")
|
|
|
- public Result<Map<String, List<HomeManagementFrontView>>> getHomeManagementFrontPage() {
|
|
|
- String key = RedisService.key.YH_HOME_PAGHE_CACHE.getName() + "homeManage";
|
|
|
+ public Result<Map<String, List<HomeManagementFrontView>>> getHomeManagementFrontPage(String customId) {
|
|
|
+ String key = RedisService.key.YH_HOME_PAGHE_CACHE.getEnvName() + "homeManage";
|
|
|
+ Long yhsId = null;
|
|
|
+ if (StrUtil.isNotBlank(customId)) {
|
|
|
+ yhsId = yhShopFrontService.getYhsIdByCustomId(customId);
|
|
|
+ key = RedisService.key.YH_HOME_PAGHE_CACHE_SHOP.getEnvName() + yhsId + ":homeManage";
|
|
|
+ }
|
|
|
Long fUid = StpUserUtil.getUserIdAfterLogin();
|
|
|
Object o = redisService.get(key);
|
|
|
if (o == null) {
|
|
|
String condition = "g.deleted is true and g.status is true";
|
|
|
+ if (yhsId != null) {
|
|
|
+ condition += String.format(" and g.id in (select distinct goods_id from yh_shop_goods_sku where yhs_id = %s and status is true and deleted is true) and g.is_distribute is true", yhsId);
|
|
|
+ }
|
|
|
Map<String, List<HomeManagementFrontView>> map = new ConcurrentHashMap<>();
|
|
|
+ final String conditionSql = condition;
|
|
|
Stream.of(HomeManagementConfig.Type.values())
|
|
|
.forEach(type -> {
|
|
|
MapBuilder builder = MapUtils.builder()
|
|
|
- .field(HomeManagementConfig::getType, type.name());
|
|
|
+ .field(HomeManagementFrontView::getType, type.name());
|
|
|
if (type == HomeManagementConfig.Type.ex || type == HomeManagementConfig.Type.vg) {
|
|
|
- builder.put("condition", condition);
|
|
|
+ builder.put("condition", conditionSql);
|
|
|
}
|
|
|
List<HomeManagementFrontView> homeManagementFrontViews = beanSearcher.searchAll(HomeManagementFrontView.class, builder.build());
|
|
|
- if (type == HomeManagementConfig.Type.ex || type == HomeManagementConfig.Type.vg) {
|
|
|
- DateTime now = DateTime.now();
|
|
|
- homeManagementFrontViews.forEach(data -> {
|
|
|
- Integer sold = orderDonMapper.selectCount(Wrappers.lambdaQuery(OrderDon.class)
|
|
|
- .eq(OrderDon::getGoodsId, data.getGoodsId()).notIn(OrderDon::getStatus, Constant.noOrderStatus));
|
|
|
- data.setSold(sold + data.getVirtualSold());
|
|
|
- data.setNotifyMsg(getPayMsgTime(data.getGoodsId(), now, 1));
|
|
|
- });
|
|
|
- }
|
|
|
map.putIfAbsent(type.name(), homeManagementFrontViews);
|
|
|
});
|
|
|
redisService.setNx(key, map, 50 * 60l);
|
|
|
@@ -610,81 +634,104 @@ public class GoodsDonController {
|
|
|
/**
|
|
|
* 设置平台 特定价格
|
|
|
*/
|
|
|
- public void setSpecificPrice(List<GoodsFrontListView> list, Long fUid) {
|
|
|
- if (fUid != null) {
|
|
|
- list.forEach(data -> {
|
|
|
- if (data.getIsSp()) {
|
|
|
- //查找所有特定规格最小价格 满足条件
|
|
|
- String specificGoodsKey = RedisService.key.YH_HOME_PAGHE_CACHE.getEnvName() + "specific:" + data.getId();
|
|
|
- Object speciObj = redisService.get(specificGoodsKey);
|
|
|
- List<GoodsDonSku> specificSkus = null;
|
|
|
- if (speciObj != null) {
|
|
|
- specificSkus = Jsons.parseList(speciObj, GoodsDonSku.class);
|
|
|
- } else {
|
|
|
- specificSkus = goodsDonSkuMapper.selectList(
|
|
|
- Wrappers.lambdaQuery(GoodsDonSku.class)
|
|
|
- .eq(GoodsDonSku::getGoodsId, data.getId())
|
|
|
- .eq(GoodsDonSku::getStatus, true)
|
|
|
- .gt(GoodsDonSku::getSpecificPrice, 0));
|
|
|
- redisService.setNx(specificGoodsKey, specificSkus, RedisService.key.YH_HOME_PAGHE_CACHE.getTimeout());
|
|
|
- }
|
|
|
- specificSkus.forEach(specificSku -> {
|
|
|
- String specificGoodsIdsStr = specificSku.getSpecificGoodsIds();
|
|
|
- if (isPaySpecificGoodsIds(specificGoodsIdsStr, fUid)) {
|
|
|
- BigDecimal specificPrice = data.getSpecificPrice();
|
|
|
- BigDecimal skuSpecificPrice = specificSku.getSpecificPrice();
|
|
|
- Long specificSkuId = specificSku.getId();
|
|
|
- if (specificPrice == null) {
|
|
|
- data.setSpecificPrice(skuSpecificPrice);
|
|
|
- data.setSpecificSkuId(specificSkuId);
|
|
|
- } else if (specificPrice.compareTo(skuSpecificPrice) > 0) {
|
|
|
- data.setSpecificPrice(skuSpecificPrice);
|
|
|
- data.setSpecificSkuId(specificSkuId);
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
- List<GoodsDonSkuFrontView> skuList = data.getSkuList();
|
|
|
- if (CollUtil.isNotEmpty(skuList)) {
|
|
|
- skuList.forEach(sku->{
|
|
|
- //设置特定价格
|
|
|
- if (!isPaySpecificGoodsIds(sku.getSpecificGoodsIds(), fUid)) {
|
|
|
- sku.setSpecificGoodsIds(null);
|
|
|
- sku.setSpecificPrice(null);
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
+ public void setSpecificPrice(GoodsFrontListView data, Long fUid) {
|
|
|
+ if (fUid != null) {
|
|
|
+ if (data.getIsSp()) {
|
|
|
+ //查找所有特定规格最小价格 满足条件
|
|
|
+ String specificGoodsKey = RedisService.key.YH_HOME_PAGHE_CACHE.getEnvName() + "specific:" + data.getId();
|
|
|
+ Object speciObj = redisService.get(specificGoodsKey);
|
|
|
+ List<GoodsDonSku> specificSkus = null;
|
|
|
+ if (speciObj != null) {
|
|
|
+ specificSkus = Jsons.parseList(speciObj, GoodsDonSku.class);
|
|
|
+ } else {
|
|
|
+ specificSkus = goodsDonSkuMapper.selectList(
|
|
|
+ Wrappers.lambdaQuery(GoodsDonSku.class)
|
|
|
+ .eq(GoodsDonSku::getGoodsId, data.getId())
|
|
|
+ .eq(GoodsDonSku::getStatus, true)
|
|
|
+ .gt(GoodsDonSku::getSpecificPrice, 0));
|
|
|
+ redisService.setNx(specificGoodsKey, specificSkus, RedisService.key.YH_HOME_PAGHE_CACHE.getTimeout());
|
|
|
+ }
|
|
|
+ specificSkus.forEach(specificSku -> {
|
|
|
+ String specificGoodsIdsStr = specificSku.getSpecificGoodsIds();
|
|
|
+ if (isPaySpecificGoodsIds(specificGoodsIdsStr, fUid)) {
|
|
|
+ BigDecimal specificPrice = data.getSpecificPrice();
|
|
|
+ BigDecimal skuSpecificPrice = specificSku.getSpecificPrice();
|
|
|
+ Long specificSkuId = specificSku.getId();
|
|
|
+ if (specificPrice == null) {
|
|
|
+ data.setSpecificPrice(skuSpecificPrice);
|
|
|
+ data.setSpecificSkuId(specificSkuId);
|
|
|
+ } else if (specificPrice.compareTo(skuSpecificPrice) > 0) {
|
|
|
+ data.setSpecificPrice(skuSpecificPrice);
|
|
|
+ data.setSpecificSkuId(specificSkuId);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ List<GoodsDonSkuFrontView> skuList = data.getSkuList();
|
|
|
+ if (CollUtil.isNotEmpty(skuList)) {
|
|
|
+ skuList.forEach(sku -> {
|
|
|
+ //设置特定价格
|
|
|
+ if (!isPaySpecificGoodsIds(sku.getSpecificGoodsIds(), fUid)) {
|
|
|
+ sku.setSpecificGoodsIds(null);
|
|
|
+ sku.setSpecificPrice(null);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 获取特定规格
|
|
|
+ */
|
|
|
+ public List<GoodsDonSku> getSpecificSku(Long goodsId) {
|
|
|
+ //查找所有特定规格最小价格 满足条件
|
|
|
+ String specificGoodsKey = RedisService.key.YH_HOME_PAGHE_CACHE.getEnvName() + "specific:" + goodsId;
|
|
|
+ Object speciObj = redisService.get(specificGoodsKey);
|
|
|
+ List<GoodsDonSku> specificSkus = null;
|
|
|
+ if (speciObj != null) {
|
|
|
+ specificSkus = Jsons.parseList(speciObj, GoodsDonSku.class);
|
|
|
+ } else {
|
|
|
+ specificSkus = goodsDonSkuMapper.selectList(
|
|
|
+ Wrappers.lambdaQuery(GoodsDonSku.class)
|
|
|
+ .eq(GoodsDonSku::getGoodsId, goodsId)
|
|
|
+ .eq(GoodsDonSku::getStatus, true)
|
|
|
+ .gt(GoodsDonSku::getSpecificPrice, 0));
|
|
|
+ redisService.setNx(specificGoodsKey, specificSkus, RedisService.key.YH_HOME_PAGHE_CACHE.getTimeout());
|
|
|
+ }
|
|
|
+ specificSkus = Optional.ofNullable(specificSkus).orElse(new ArrayList<>());
|
|
|
+ return specificSkus;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 设置首页配置 涉及平台特定价格
|
|
|
*/
|
|
|
public void setHomeManageSpecific(List<HomeManagementFrontView> list, Long fUid) {
|
|
|
- if (fUid != null && CollUtil.isNotEmpty(list)) {
|
|
|
- list.forEach(data -> {
|
|
|
- if (data.getIsSp() != null && data.getIsSp()) {
|
|
|
- //查找所有特定规格最小价格 满足条件
|
|
|
- List<GoodsDonSku> specificSkus = getSpecificSku(data.getGoodsId());
|
|
|
- specificSkus.forEach(specificSku -> {
|
|
|
- String specificGoodsIdsStr = specificSku.getSpecificGoodsIds();
|
|
|
- if (isPaySpecificGoodsIds(specificGoodsIdsStr, fUid)) {
|
|
|
- BigDecimal specificPrice = data.getSpecificPrice();
|
|
|
- BigDecimal skuSpecificPrice = specificSku.getSpecificPrice();
|
|
|
- Long specificSkuId = specificSku.getId();
|
|
|
- if (specificPrice == null) {
|
|
|
- data.setSpecificPrice(skuSpecificPrice);
|
|
|
- data.setSpecificSkuId(specificSkuId);
|
|
|
- } else if (specificPrice.compareTo(skuSpecificPrice) > 0) {
|
|
|
- data.setSpecificPrice(skuSpecificPrice);
|
|
|
- data.setSpecificSkuId(specificSkuId);
|
|
|
- }
|
|
|
+ DateTime now = DateTime.now();
|
|
|
+ list.forEach(data -> {
|
|
|
+ if (data.getIsSp() != null && data.getIsSp() && fUid != null) {
|
|
|
+ //查找所有特定规格最小价格 满足条件
|
|
|
+ List<GoodsDonSku> specificSkus = getSpecificSku(data.getGoodsId());
|
|
|
+ specificSkus.forEach(specificSku -> {
|
|
|
+ String specificGoodsIdsStr = specificSku.getSpecificGoodsIds();
|
|
|
+ if (isPaySpecificGoodsIds(specificGoodsIdsStr, fUid)) {
|
|
|
+ BigDecimal specificPrice = data.getSpecificPrice();
|
|
|
+ BigDecimal skuSpecificPrice = specificSku.getSpecificPrice();
|
|
|
+ Long specificSkuId = specificSku.getId();
|
|
|
+ if (specificPrice == null) {
|
|
|
+ data.setSpecificPrice(skuSpecificPrice);
|
|
|
+ data.setSpecificSkuId(specificSkuId);
|
|
|
+ } else if (specificPrice.compareTo(skuSpecificPrice) > 0) {
|
|
|
+ data.setSpecificPrice(skuSpecificPrice);
|
|
|
+ data.setSpecificSkuId(specificSkuId);
|
|
|
}
|
|
|
- });
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ Integer sold = orderDonMapper.selectCount(Wrappers.lambdaQuery(OrderDon.class)
|
|
|
+ .eq(OrderDon::getGoodsId, data.getGoodsId()).notIn(OrderDon::getStatus, Constant.noOrderStatus));
|
|
|
+ data.setSold(sold + data.getSold());
|
|
|
+ data.setNotifyMsg(getPayMsgTime(data.getGoodsId(), now, 1, null));
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -692,7 +739,7 @@ public class GoodsDonController {
|
|
|
*/
|
|
|
@GetMapping("/get/shop/goods/{yhsId}")
|
|
|
public Result<List<YhShopGoodsFrontView>> getShopGoods(@PathVariable Long yhsId) {
|
|
|
- String yhShopCacheKey = RedisService.key.YH_HOME_PAGHE_CACHE.getName() + "yhShop:" + yhsId;
|
|
|
+ String yhShopCacheKey = RedisService.key.YH_HOME_PAGHE_CACHE_SHOP.getEnvName() + yhsId;
|
|
|
Object value = redisService.get(yhShopCacheKey);
|
|
|
List<YhShopGoodsFrontView> list = null;
|
|
|
if (value != null) {
|
|
|
@@ -710,9 +757,8 @@ public class GoodsDonController {
|
|
|
DateTime now = DateTime.now();
|
|
|
list.forEach(data->{
|
|
|
Integer sold = orderDonMapper.selectCount(Wrappers.lambdaQuery(OrderDon.class)
|
|
|
- .eq(OrderDon::getYhsId, yhsId)
|
|
|
.eq(OrderDon::getGoodsId, data.getId()).notIn(OrderDon::getStatus, Constant.noOrderStatus));
|
|
|
- data.setSold(sold + data.getVs());
|
|
|
+ data.setSold(sold + data.getSold());
|
|
|
data.setNotifyMsg(getPayMsgTime(data.getId(), now, 1, yhsId));
|
|
|
});
|
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult(list);
|
|
|
@@ -740,4 +786,68 @@ public class GoodsDonController {
|
|
|
goodsDetailView.setComments(comments);
|
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult(goodsDetailView);
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 根据分类获取对应平台
|
|
|
+ */
|
|
|
+ @GetMapping("/get/categoryGoods")
|
|
|
+ public Result<? extends Object> getGoodsByCategory(Long cgy, String customId) {
|
|
|
+ if (StrUtil.isNotBlank(customId)) {
|
|
|
+ Result<List<YhShopGoodsFrontView>> shopGoods = getShopCategoryGoods(yhShopFrontService.getYhsIdByCustomId(customId), cgy);
|
|
|
+ return shopGoods;
|
|
|
+ }
|
|
|
+ String categoryGoodsKey = RedisService.key.YH_HOME_PAGHE_CACHE.getEnvName() + "category:goods";
|
|
|
+ if (cgy != null) {
|
|
|
+ categoryGoodsKey += ":" + cgy;
|
|
|
+ }
|
|
|
+ Object o = redisService.get(categoryGoodsKey);
|
|
|
+ if (o == null) {
|
|
|
+ MapBuilder mapBuilder = MapUtils.flatBuilder(request.getParameterMap());
|
|
|
+ if (cgy != null) {
|
|
|
+ String condition = String.format(" and id in (select goods_id from goods_don_category_relate where category = %s)", cgy);
|
|
|
+ mapBuilder.put("condition", condition);
|
|
|
+ }
|
|
|
+ List<GoodsFrontListView> goodsFrontListViews = beanSearcher.searchAll(GoodsFrontListView.class, mapBuilder.build());
|
|
|
+ redisService.setNx(categoryGoodsKey, goodsFrontListViews, RedisService.key.YH_HOME_PAGHE_CACHE.getTimeout() + 10 * 60);
|
|
|
+ o = redisService.get(categoryGoodsKey);
|
|
|
+ }
|
|
|
+ List<GoodsFrontListView> goodsFrontListViews = Jsons.parseList(o, GoodsFrontListView.class);
|
|
|
+ DateTime now = DateTime.now();
|
|
|
+ goodsFrontListViews.forEach(data -> {
|
|
|
+ Integer sold = orderDonMapper.selectCount(Wrappers.lambdaQuery(OrderDon.class)
|
|
|
+ .eq(OrderDon::getGoodsId, data.getId()).notIn(OrderDon::getStatus, Constant.noOrderStatus));
|
|
|
+ data.setSold(sold + data.getSold());
|
|
|
+ data.setNotifyMsg(getPayMsgTime(data.getId(), now, 1, null));
|
|
|
+ });
|
|
|
+ return GatewayResponse.SUCCESS.newBuilder().toResult(goodsFrontListViews);
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/get/shop/categoryGoods/{yhsId}")
|
|
|
+ public Result<List<YhShopGoodsFrontView>> getShopCategoryGoods(@PathVariable Long yhsId, Long category) {
|
|
|
+ String categoryGoodsKey = RedisService.key.YH_HOME_PAGHE_CACHE_SHOP.getEnvName() + yhsId + ":category";
|
|
|
+ if (category != null) {
|
|
|
+ categoryGoodsKey += ":" + category;
|
|
|
+ }
|
|
|
+ Object value = redisService.get(categoryGoodsKey);
|
|
|
+ if (value == null) {
|
|
|
+ MapBuilder builder = MapUtils.flatBuilder(request.getParameterMap());
|
|
|
+ String condition = String.format("and yhs_id = %s", yhsId);
|
|
|
+ if (category != null) {
|
|
|
+ condition += String.format(" and ys.goods_id in (select goods_id from goods_don_category_relate where category = %s)", category);
|
|
|
+ }
|
|
|
+ builder.put("condition", condition);
|
|
|
+ List<YhShopGoodsFrontView> list = beanSearcher.searchAll(YhShopGoodsFrontView.class, builder.build());
|
|
|
+ redisService.setNx(categoryGoodsKey, list, RedisService.key.YH_HOME_PAGHE_CACHE.getTimeout() + 5 * 60);
|
|
|
+ value = redisService.get(categoryGoodsKey);
|
|
|
+ }
|
|
|
+ List<YhShopGoodsFrontView> list = Jsons.parseList(value, YhShopGoodsFrontView.class);
|
|
|
+ DateTime now = DateTime.now();
|
|
|
+ list.forEach(data -> {
|
|
|
+ Integer sold = orderDonMapper.selectCount(Wrappers.lambdaQuery(OrderDon.class)
|
|
|
+ .eq(OrderDon::getGoodsId, data.getId()).notIn(OrderDon::getStatus, Constant.noOrderStatus));
|
|
|
+ data.setSold(sold + data.getSold());
|
|
|
+ data.setNotifyMsg(getPayMsgTime(data.getId(), now, 1, yhsId));
|
|
|
+ });
|
|
|
+ return GatewayResponse.SUCCESS.newBuilder().toResult(list);
|
|
|
+ }
|
|
|
}
|