秒杀活动增加活动商品数量

This commit is contained in:
lifenlong
2021-05-25 08:02:31 +08:00
parent 00a0edeade
commit e7e29da455
6 changed files with 39 additions and 19 deletions

View File

@@ -14,6 +14,7 @@ import cn.lili.modules.promotion.service.SeckillApplyService;
import cn.lili.modules.promotion.service.SeckillService;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@@ -33,8 +34,9 @@ public class SeckillManagerController {
@Autowired
private SeckillApplyService seckillApplyService;
@PostMapping
@ApiOperation(value = "添加秒杀活动")
@PostMapping
public ResultMessage<Seckill> addSeckill(SeckillVO seckillVO) {
AuthUser currentUser = UserContext.getCurrentUser();
seckillVO.setStoreId(currentUser.getId());
@@ -44,8 +46,9 @@ public class SeckillManagerController {
return ResultUtil.data(seckillVO);
}
@PutMapping
@ApiOperation(value = "修改秒杀活动")
@PutMapping
public ResultMessage<Seckill> updateSeckill(SeckillVO seckillVO) {
AuthUser currentUser = UserContext.getCurrentUser();
seckillVO.setStoreId(currentUser.getId());
@@ -54,44 +57,48 @@ public class SeckillManagerController {
return ResultUtil.data(seckillVO);
}
@GetMapping(value = "/{id}")
@ApiOperation(value = "通过id获取")
@ApiImplicitParam(name = "id", value = "秒杀活动ID", required = true, dataType = "String", paramType = "path")
@GetMapping(value = "/{id}")
public ResultMessage<Seckill> get(@PathVariable String id) {
Seckill seckill = seckillService.getById(id);
return ResultUtil.data(seckill);
}
@GetMapping
@ApiOperation(value = "分页查询秒杀活动列表")
@GetMapping
public ResultMessage<IPage<SeckillVO>> getAll(SeckillSearchParams param, PageVO pageVo) {
pageVo.setNotConvert(true);
IPage<SeckillVO> page = seckillService.getSeckillByPageFromMongo(param, pageVo);
return ResultUtil.data(page);
}
@DeleteMapping("/{id}")
@ApiOperation(value = "删除一个秒杀活动")
@ApiImplicitParam(name = "id", value = "秒杀活动ID", required = true, dataType = "String", paramType = "path")
@DeleteMapping("/{id}")
public ResultMessage<Object> deleteSeckill(@PathVariable String id) {
seckillService.deleteSeckill(id);
return ResultUtil.success();
}
@PutMapping("/close/{id}")
@ApiOperation(value = "关闭一个秒杀活动")
@ApiImplicitParam(name = "id", value = "秒杀活动ID", required = true, dataType = "String", paramType = "path")
@PutMapping("/close/{id}")
public ResultMessage<Object> closeSeckill(@PathVariable String id) {
seckillService.closeSeckill(id);
return ResultUtil.success();
}
@ApiOperation(value = "开启一个秒杀活动")
@ApiImplicitParam(name = "id", value = "秒杀活动ID", required = true, dataType = "String", paramType = "path")
@PutMapping("/open/{id}")
@ApiOperation(value = "一个秒杀活动")
public ResultMessage<Object> openSeckill(@PathVariable String id) {
seckillService.openSeckill(id);
return ResultUtil.success();
}
@GetMapping("/apply")
@ApiOperation(value = "获取秒杀活动申请列表")
@GetMapping("/apply")
public ResultMessage<IPage<SeckillApply>> getSeckillApply(SeckillSearchParams param, PageVO pageVo) {
IPage<SeckillApply> seckillApply = seckillApplyService.getSeckillApplyFromMongo(param, pageVo);
return ResultUtil.data(seckillApply);