package com.ruoyi.promotion.controller.forepart;
|
|
|
import com.ruoyi.common.core.domain.R;
|
import com.ruoyi.common.core.utils.page.PageDTO;
|
import com.ruoyi.common.core.web.page.BasePage;
|
import com.ruoyi.promotion.controller.forepart.dto.ForepartPromotionWishDTO;
|
import com.ruoyi.promotion.controller.forepart.vo.ForepartPopupVO;
|
import com.ruoyi.promotion.controller.forepart.vo.ForepartPromotionWishBulletVO;
|
import com.ruoyi.promotion.controller.forepart.vo.ForepartPromotionWishVO;
|
import com.ruoyi.promotion.service.IPromotionWishService;
|
import io.swagger.annotations.Api;
|
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiParam;
|
import java.util.List;
|
import javax.validation.Valid;
|
import javax.validation.constraints.NotNull;
|
import lombok.RequiredArgsConstructor;
|
import org.springframework.validation.annotation.Validated;
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.PathVariable;
|
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RestController;
|
|
/**
|
* <p>
|
* 心愿求购 前端控制器
|
* </p>
|
*
|
* @author mitao
|
* @since 2024-10-29
|
*/
|
@Validated
|
@RestController
|
@RequiredArgsConstructor
|
@RequestMapping("/forepart/promotion-wish")
|
@Api(value = "用户端-心愿求购相关接口", tags = "【09.25】用户端-心愿求购相关接口")
|
public class ForepartPromotionWishController {
|
|
private final IPromotionWishService promotionWishService;
|
|
/**
|
* 个人中心-获取推荐商品可购买数
|
* @return
|
*/
|
@GetMapping("/getRecommendNum")
|
@ApiOperation(value = "个人中心-获取推荐商品可购买数")
|
public R<Integer> getRecommendNum() {
|
return R.ok(promotionWishService.getRecommendNum());
|
}
|
|
/**
|
* 获取首页弹幕数据
|
* @return
|
*/
|
@GetMapping("/bulletList")
|
@ApiOperation(value = "获取首页弹幕数据", notes = "达成心愿数为数组长度")
|
public R<List<ForepartPromotionWishBulletVO>> getBulletList() {
|
return R.ok(promotionWishService.getBulletList());
|
}
|
|
/**
|
* 求购历史-达成心愿数
|
* @return
|
*/
|
@GetMapping("/getCompletedWishCount")
|
@ApiOperation(value = "求购历史-达成心愿数")
|
public R<Long> getCompletedWishCount() {
|
return R.ok(promotionWishService.getCompletedWishCount());
|
}
|
|
/**
|
* 获取弹窗信息
|
* @return
|
*/
|
@GetMapping("/popup")
|
@ApiOperation(value = "获取弹窗信息", notes = "获取弹窗信息")
|
public R<ForepartPopupVO> getPopup() {
|
return R.ok(promotionWishService.getPopup());
|
}
|
|
/**
|
* 求购历史
|
* @param page
|
* @return
|
*/
|
@PostMapping("/wishHistory")
|
@ApiOperation(value = "求购历史")
|
public R<PageDTO<ForepartPromotionWishVO>> getWishHistory(@Valid @RequestBody BasePage page) {
|
return R.ok(promotionWishService.getWishHistory(page));
|
}
|
|
/**
|
* 发布求购
|
* @param dto
|
* @return
|
*/
|
@PostMapping("/publish")
|
@ApiOperation(value = "发布求购")
|
public R<Long> publish(@Valid @RequestBody ForepartPromotionWishDTO dto) {
|
return R.ok(promotionWishService.publish(dto));
|
}
|
|
/**
|
* 心愿求购详情
|
* @param id
|
* @return
|
*/
|
@GetMapping("/detail/{id}")
|
@ApiOperation(value = "心愿求购详情")
|
public R<ForepartPromotionWishVO> getDetails(
|
@ApiParam(name = "id", value = "心愿求购id", required = true) @NotNull(message = "心愿求购id不能为空") @PathVariable("id") Long id) {
|
return R.ok(promotionWishService.getPromotionWishDetails(id));
|
}
|
|
/**
|
* 撤回求购
|
* @param id
|
* @return
|
*/
|
@DeleteMapping("/{id}")
|
@ApiOperation(value = "撤回心愿求购")
|
public R<?> delete(
|
@ApiParam(name = "id", value = "心愿求购id", required = true) @NotNull(message = "心愿求购id不能为空") @PathVariable("id") Long id) {
|
promotionWishService.deleteById(id);
|
return R.ok();
|
}
|
}
|