|
@@ -19,14 +19,15 @@ package org.springblade.modules.api.controller;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
|
|
-import io.swagger.annotations.Api;
|
|
|
-import io.swagger.annotations.ApiOperation;
|
|
|
-import io.swagger.annotations.ApiParam;
|
|
|
+import io.swagger.annotations.*;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
+import org.springblade.common.constant.CacheBizConstant;
|
|
|
import org.springblade.common.constant.CommonConstant;
|
|
|
import org.springblade.core.boot.ctrl.BladeController;
|
|
|
+import org.springblade.core.cache.constant.CacheConstant;
|
|
|
import org.springblade.core.mp.support.Condition;
|
|
|
import org.springblade.core.mp.support.Query;
|
|
|
+import org.springblade.core.redis.cache.BladeRedis;
|
|
|
import org.springblade.core.tool.api.R;
|
|
|
import org.springblade.core.tool.utils.BeanUtil;
|
|
|
import org.springblade.core.tool.utils.DateUtil;
|
|
@@ -34,6 +35,10 @@ import org.springblade.core.tool.utils.StringUtil;
|
|
|
import org.springblade.modules.api.request.AddressSaveRequest;
|
|
|
import org.springblade.modules.api.request.AddressUpdateRequest;
|
|
|
import org.springblade.modules.api.request.UserFeedbacksSaveRequest;
|
|
|
+import org.springblade.modules.desk.entity.Notice;
|
|
|
+import org.springblade.modules.desk.service.INoticeService;
|
|
|
+import org.springblade.modules.desk.vo.NoticeVO;
|
|
|
+import org.springblade.modules.desk.wrapper.NoticeWrapper;
|
|
|
import org.springblade.modules.platform.entity.*;
|
|
|
import org.springblade.modules.platform.service.*;
|
|
|
import org.springblade.modules.shopping.entity.*;
|
|
@@ -44,9 +49,11 @@ import org.springblade.modules.shopping.vo.SpecItemsVO;
|
|
|
import org.springblade.modules.shopping.wrapper.GoodsAttributesWrapper;
|
|
|
import org.springblade.modules.shopping.wrapper.GoodsWrapper;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
+import springfox.documentation.annotations.ApiIgnore;
|
|
|
|
|
|
import javax.validation.Valid;
|
|
|
import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
import java.util.Objects;
|
|
|
|
|
|
/**
|
|
@@ -67,6 +74,10 @@ public class Api02Controller extends BladeController {
|
|
|
private final ISpecItemsService specItemsService;
|
|
|
private final IGoodsSpecsService goodsSpecsService;
|
|
|
private final IGoodsAttributesService goodsAttributesService;
|
|
|
+ private final IConsignConfigService consignConfigService;
|
|
|
+ private final IBrandsService brandsService;
|
|
|
+ private final INoticeService noticeService;
|
|
|
+ private final BladeRedis bladeRedis;
|
|
|
|
|
|
/**
|
|
|
* 商品分页查询
|
|
@@ -187,4 +198,51 @@ public class Api02Controller extends BladeController {
|
|
|
return R.data(GoodsAttributesWrapper.build().listVO(list));
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 抢购场次
|
|
|
+ */
|
|
|
+ @GetMapping("/consignConfig-list")
|
|
|
+ @ApiOperationSupport(order = 6)
|
|
|
+ @ApiOperation(value = "抢购场次", notes = "获取缓存数据,失效时间2分钟")
|
|
|
+ public R<List<ConsignConfig>> consignConfigList() {
|
|
|
+ List<ConsignConfig> list = bladeRedis.get(CacheBizConstant.CACHE_CONSIGN_CONFIG);
|
|
|
+ if (list == null || list.size() == 0){
|
|
|
+ list = consignConfigService.list(Wrappers.<ConsignConfig>lambdaQuery().eq(ConsignConfig::getIsEnabled, 2));
|
|
|
+ bladeRedis.setEx(CacheBizConstant.CACHE_CONSIGN_CONFIG, list, CacheBizConstant.CACHE_TIME);
|
|
|
+ }
|
|
|
+ return R.data(list);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 商品品牌
|
|
|
+ */
|
|
|
+ @GetMapping("/brands-list")
|
|
|
+ @ApiOperationSupport(order = 7)
|
|
|
+ @ApiOperation(value = "商品品牌", notes = "商品品牌")
|
|
|
+ public R<List<Brands>> brandsList() {
|
|
|
+ List<Brands> list = bladeRedis.get(CacheBizConstant.CACHE_GOODS_BRAND);
|
|
|
+ if (list == null || list.size() == 0){
|
|
|
+ list = brandsService.list(Wrappers.<Brands>lambdaQuery());
|
|
|
+ bladeRedis.setEx(CacheBizConstant.CACHE_GOODS_BRAND, list, CacheBizConstant.CACHE_TIME);
|
|
|
+ }
|
|
|
+ return R.data(list);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 通知公告
|
|
|
+ */
|
|
|
+ @GetMapping("/notice-page")
|
|
|
+ @ApiImplicitParams({
|
|
|
+ @ApiImplicitParam(name = "category", value = "公告类型", paramType = "query", dataType = "integer"),
|
|
|
+ @ApiImplicitParam(name = "title", value = "公告标题", paramType = "query", dataType = "string")
|
|
|
+ })
|
|
|
+ @ApiOperationSupport(order = 8)
|
|
|
+ @ApiOperation(value = "通知公告列表", notes = "通知公告")
|
|
|
+ public R<IPage<NoticeVO>> brandsPage(@ApiIgnore @RequestParam Map<String, Object> notice, Query query) {
|
|
|
+ NoticeWrapper.build().noticeQuery(notice);
|
|
|
+ IPage<Notice> pages = noticeService.page(Condition.getPage(query), Condition.getQueryWrapper(notice, Notice.class));
|
|
|
+ return R.data(NoticeWrapper.build().pageVO(pages));
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
}
|