You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
118 lines
3.8 KiB
118 lines
3.8 KiB
package com.example.demo.controller.bean;
|
|
|
|
import com.example.demo.domain.vo.bean.BeanConsumeGold;
|
|
import com.example.demo.domain.vo.coin.Page;
|
|
import com.example.demo.domain.vo.coin.Result;
|
|
import com.example.demo.service.bean.BeanConsumeService;
|
|
import lombok.RequiredArgsConstructor;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.util.ObjectUtils;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
import java.util.List;
|
|
|
|
/**
|
|
* @program: gold-java
|
|
* @ClassName BeanConsumeController
|
|
* @description:
|
|
* @author: Ethan
|
|
* @create: 2025−07-30 11:30
|
|
* @Version 1.0
|
|
**/
|
|
@RestController
|
|
@RequestMapping("/beanConsume")
|
|
@RequiredArgsConstructor
|
|
@Slf4j
|
|
@CrossOrigin
|
|
public class BeanConsumeController {
|
|
@Autowired
|
|
private BeanConsumeService beanConsumeService;
|
|
|
|
//获取消费用户分部信息
|
|
@PostMapping("/getDept")
|
|
public Result getDept(){
|
|
|
|
List<String> deptList = beanConsumeService.getDept();
|
|
return Result.success(deptList);
|
|
}
|
|
|
|
//获取直播消费用户分部信息
|
|
@PostMapping("/getLiveDept")
|
|
public Result getLiveDept(){
|
|
|
|
List<String> deptList = beanConsumeService.getLiveDept();
|
|
return Result.success(deptList);
|
|
}
|
|
|
|
//筛选查询直播消费记录
|
|
@PostMapping("/selectLiveBy")
|
|
public Result selectLiveBy(@RequestBody Page page){
|
|
try {
|
|
if (ObjectUtils.isEmpty(page.getPageNum())) {
|
|
return Result.error("页码数为空!");
|
|
}
|
|
if (ObjectUtils.isEmpty(page.getPageSize())) {
|
|
return Result.error("页大小为空!");
|
|
} else {
|
|
|
|
return Result.success(beanConsumeService.selectLiveBy(page.getPageNum(), page.getPageSize(), page.getBeanConsumeLive()));
|
|
}
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
//返回堆栈信息
|
|
return Result.error(e.toString());
|
|
}}
|
|
//筛选查询铁粉消费记录
|
|
@PostMapping("/selectFanBy")
|
|
public Result selectFanBy(@RequestBody Page page){
|
|
try {
|
|
if (ObjectUtils.isEmpty(page.getPageNum())) {
|
|
return Result.error("页码数为空!");
|
|
}
|
|
if (ObjectUtils.isEmpty(page.getPageSize())) {
|
|
return Result.error("页大小为空!");
|
|
} else {
|
|
|
|
return Result.success(beanConsumeService.selectFanBy(page.getPageNum(), page.getPageSize(), page.getBeanConsumeFan()));
|
|
}
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
return Result.error(e.toString());
|
|
}}
|
|
|
|
//筛选查询文章消费记录
|
|
@PostMapping("/selectArticleBy")
|
|
public Result selectArticleBy(@RequestBody Page page){
|
|
try {
|
|
if (ObjectUtils.isEmpty(page.getPageNum())) {
|
|
return Result.error("页码数为空!");
|
|
}
|
|
if (ObjectUtils.isEmpty(page.getPageSize())) {
|
|
return Result.error("页大小为空!");
|
|
} else {
|
|
|
|
return Result.success(beanConsumeService.selectArticleBy(page.getPageNum(), page.getPageSize(), page.getBeanConsumeArticle()));
|
|
}
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
return Result.error(e.toString());
|
|
}}
|
|
|
|
//消费合计数
|
|
@PostMapping("sumConsumeGold")
|
|
public BeanConsumeGold sumConsumeGold(@RequestBody Page page) {
|
|
|
|
return beanConsumeService.sumConsumeGold( page);
|
|
}
|
|
//查询所有直播礼物
|
|
@PostMapping("/getLiveGift")
|
|
public Result getLiveGift(){
|
|
return Result.success(beanConsumeService.getLiveGift());
|
|
}
|
|
//查询所有直播频道
|
|
@PostMapping("/getLiveChannel")
|
|
public Result getLiveChannel(){
|
|
return Result.success(beanConsumeService.getLiveChannel());
|
|
}
|
|
}
|