|
|
@@ -62,12 +62,7 @@ public class GoodsDonController {
|
|
|
* 获取商品列表
|
|
|
*/
|
|
|
@GetMapping("/get")
|
|
|
- public Result<SearchResult<GoodsDon>> get(Boolean isLogin) {
|
|
|
- Long userId = null;
|
|
|
- if (isLogin != null && isLogin) {
|
|
|
- userId = StpUserUtil.getLoginIdAsLong();
|
|
|
- }
|
|
|
- final Long fUid = userId;
|
|
|
+ public Result<SearchResult<GoodsDon>> get() {
|
|
|
SearchResult<GoodsDon> search = beanSearcher.search(GoodsDon.class, MapUtils.flatBuilder(request.getParameterMap())
|
|
|
.field(GoodsDon::getStatus, true)
|
|
|
.field(GoodsDon::getDeleted, true)
|
|
|
@@ -86,13 +81,6 @@ public class GoodsDonController {
|
|
|
goods.setSoldNum(goods.getVirtualSold() + orderDonMapper.selectCount(Wrappers.lambdaQuery(OrderDon.class)
|
|
|
.eq(OrderDon::getGoodsId, goods.getId())
|
|
|
.notIn(OrderDon::getStatus, Constant.noOrderStatus)));
|
|
|
- if (fUid != null) {
|
|
|
- //设置特定价格
|
|
|
- if (!isPaySpecificGoodsIds(sku.getSpecificGoodsIds(), fUid)) {
|
|
|
- sku.setSpecificGoodsIds(null);
|
|
|
- sku.setSpecificPrice(null);
|
|
|
- }
|
|
|
- }
|
|
|
});
|
|
|
});
|
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult(search);
|
|
|
@@ -168,21 +156,17 @@ public class GoodsDonController {
|
|
|
* 官网首页 平台列表
|
|
|
*/
|
|
|
@GetMapping("/get/list")
|
|
|
- public Result<List<GoodsFrontListView>> getGoodsList(Boolean isLogin) {
|
|
|
+ public Result<List<GoodsFrontListView>> getGoodsList() {
|
|
|
List<Long> filter_goodsIds = getFilterGoodsIds();
|
|
|
String pcCacheKey = RedisService.key.YH_HOME_PAGHE_CACHE.getName() + "PC";
|
|
|
if (CollUtil.isNotEmpty(filter_goodsIds)) {
|
|
|
pcCacheKey += ":hz-ip";
|
|
|
}
|
|
|
- Long userId = null;
|
|
|
- if (isLogin != null && isLogin) {
|
|
|
- userId = StpUserUtil.getLoginIdAsLong();
|
|
|
- }
|
|
|
- final Long fUid = userId;
|
|
|
+ Long fUid = StpUserUtil.getUserIdAfterLogin();
|
|
|
Object value = redisService.get(pcCacheKey);
|
|
|
if (value != null) {
|
|
|
try {
|
|
|
- List<GoodsFrontListView> list = Jsons.parseObject(value, List.class);
|
|
|
+ List<GoodsFrontListView> list = Jsons.parseList(value, GoodsFrontListView.class);
|
|
|
if (CollUtil.isNotEmpty(list)) {
|
|
|
//设置特定价格
|
|
|
setSpecificPrice(list, fUid);
|
|
|
@@ -227,21 +211,17 @@ public class GoodsDonController {
|
|
|
* h5 银河首页平台展示
|
|
|
*/
|
|
|
@GetMapping("/get/homePage")
|
|
|
- public Result<List<GoodsFrontListView>> getGoodsHomePage(Boolean isLogin) {
|
|
|
+ public Result<List<GoodsFrontListView>> getGoodsHomePage() {
|
|
|
List<Long> filter_goodsIds = getFilterGoodsIds();
|
|
|
String h5CacheKey = RedisService.key.YH_HOME_PAGHE_CACHE.getName() + "H5";
|
|
|
if (CollUtil.isNotEmpty(filter_goodsIds)) {
|
|
|
h5CacheKey += ":hz-ip";
|
|
|
}
|
|
|
- Long userId = null;
|
|
|
- if (isLogin != null && isLogin) {
|
|
|
- userId = StpUserUtil.getLoginIdAsLong();
|
|
|
- }
|
|
|
- final Long fUid = userId;
|
|
|
+ Long fUid = StpUserUtil.getUserIdAfterLogin();
|
|
|
Object value = redisService.get(h5CacheKey);
|
|
|
if (value != null) {
|
|
|
try {
|
|
|
- List<GoodsFrontListView> list = Jsons.parseObject(value, List.class);
|
|
|
+ List<GoodsFrontListView> list = Jsons.parseList(value, GoodsFrontListView.class);
|
|
|
if (CollUtil.isNotEmpty(list)) {
|
|
|
//设置特定价格
|
|
|
setSpecificPrice(list, fUid);
|
|
|
@@ -302,12 +282,9 @@ public class GoodsDonController {
|
|
|
* 获取商品详情
|
|
|
*/
|
|
|
@GetMapping("/get/{id}")
|
|
|
- public Result<GoodsDonViews> getDetail(@PathVariable Long id, Boolean isLogin) {
|
|
|
+ public Result<GoodsDonViews> getDetail(@PathVariable Long id) {
|
|
|
Long userId = null;
|
|
|
- if (isLogin != null && isLogin) {
|
|
|
- userId = StpUserUtil.getLoginIdAsLong();
|
|
|
- }
|
|
|
- final Long fUid = userId;
|
|
|
+ Long fUid = StpUserUtil.getUserIdAfterLogin();
|
|
|
GoodsDonViews views = beanSearcher.searchFirst(GoodsDonViews.class, MapUtils.builder().field(GoodsDonViews::getId, id).build());
|
|
|
|
|
|
views.setSpecs(beanSearcher.searchFirst(GoodsDonSpecFrontView.class, MapUtils.builder().field(GoodsDonSpecFrontView::getGoodsId, views.getId()).build()));
|
|
|
@@ -338,14 +315,10 @@ public class GoodsDonController {
|
|
|
* 获取商品推荐平台
|
|
|
*/
|
|
|
@GetMapping("/get/recommend/{id}")
|
|
|
- public Result<List<GoodsFrontListView>> getRecommendGoodsByGid(@PathVariable Long id, Boolean isLogin) throws Exception {
|
|
|
+ public Result<List<GoodsFrontListView>> getRecommendGoodsByGid(@PathVariable Long id) throws Exception {
|
|
|
String key = RedisService.key.YH_HOME_PAGHE_CACHE.getName() + "recommend:" + id;
|
|
|
Object value = redisService.get(key);
|
|
|
- Long userId = null;
|
|
|
- if (isLogin != null && isLogin) {
|
|
|
- userId = StpUserUtil.getLoginIdAsLong();
|
|
|
- }
|
|
|
- final Long fUid = userId;
|
|
|
+ Long fUid = StpUserUtil.getUserIdAfterLogin();
|
|
|
if (value != null) {
|
|
|
List<GoodsFrontListView> goodsRecommendViews = Jsons.parseList(value.toString(), GoodsFrontListView.class);
|
|
|
setSpecificPrice(goodsRecommendViews, fUid);
|