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.
|
|
package com.example.demo.controller.bean;
import com.example.demo.domain.vo.bean.BeanOnlineRechargeInfo; import com.example.demo.domain.vo.bean.BeanRecharge; import com.example.demo.domain.vo.bean.BeanSystemRechargeInfo; import com.example.demo.domain.vo.bean.GoldBean; import com.example.demo.domain.vo.coin.Page; import com.example.demo.domain.vo.coin.Result; import com.example.demo.service.bean.BeanRechargeService; 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 BeanRechrageController * @description: * @author: Double * @create: 2025−07-29 16:46 * @Version 1.0 **/
@RestController @RequestMapping("/beanRecharge") @RequiredArgsConstructor @Slf4j @CrossOrigin public class BeanRechargeController {
@Autowired private BeanRechargeService beanRechargeService;
//添加金豆
@PostMapping("/add") public Result add(@RequestBody BeanRecharge recharge) { try { return beanRechargeService.add(recharge); } catch (Exception e) { return Result.error("添加失败"); } }
//系统充值
@PostMapping("/selectBySystem") public Result selectBySystem(@RequestBody Page page) { try { if (ObjectUtils.isEmpty(page.getPageNum())) { return Result.error("页码数为空!"); } if (ObjectUtils.isEmpty(page.getPageSize())) { return Result.error("页大小为空!"); } else { return Result.success(beanRechargeService.selectBySystem(page.getPageNum(), page.getPageSize(), page.getBeanSystemRechargeInfo())); } } catch (Exception e) { e.printStackTrace(); return Result.error("请检查筛选数据的格式"); }
}
//系统金豆统计
@PostMapping("/statsSystemBean") public Result statsSystemBean(@RequestBody BeanSystemRechargeInfo beanSystemRechargeInfo) { try { GoldBean goldBean = beanRechargeService.statsSystemBean(beanSystemRechargeInfo); return Result.success(goldBean); } catch (Exception e) { return Result.error("请检查数据的格式"); } } //获取系统充值地区
@PostMapping("/systemMarket") public Result systemMarket() { List<String> list = beanRechargeService.systemMarket(); return Result.success(list); }
//线上充值
@PostMapping("/selectByOnline") public Result selectByOnline(@RequestBody Page page) { try { if (ObjectUtils.isEmpty(page.getPageNum())) { return Result.error("页码数为空!"); } if (ObjectUtils.isEmpty(page.getPageSize())) { return Result.error("页大小为空!"); } else { return Result.success(beanRechargeService.selectByOnline(page.getPageNum(), page.getPageSize(), page.getBeanOnlineRechargeInfo())); } } catch (Exception e) { e.printStackTrace(); return Result.error("请检查筛选数据的格式"); }
}
//线上金豆统计
@PostMapping("/statsOnlineBean") public Result statsOnlineBean(@RequestBody BeanOnlineRechargeInfo beanOnlineRechargeInfo) { try { GoldBean goldBean = beanRechargeService.statsOnlineBean(beanOnlineRechargeInfo); return Result.success(goldBean); } catch (Exception e) { return Result.error("请检查数据的格式"); } }
//获取线上充值地区
@PostMapping("/onlineMarket") public Result onlineMarket() { List<String> list = beanRechargeService.onlineMarket(); return Result.success(list); } }
|