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.

106 lines
3.1 KiB

2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
1 month ago
2 months ago
2 months ago
2 months ago
1 month ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
1 month ago
1 month ago
  1. package com.example.demo.controller;
  2. import com.example.demo.domain.vo.*;
  3. import com.example.demo.service.ConsumeService;
  4. import com.example.demo.service.RefundService;
  5. import lombok.RequiredArgsConstructor;
  6. import lombok.extern.slf4j.Slf4j;
  7. import org.springframework.beans.factory.annotation.Autowired;
  8. import org.springframework.util.ObjectUtils;
  9. import org.springframework.web.bind.annotation.*;
  10. import java.util.List;
  11. /**
  12. * @program: gold-java
  13. * @ClassName RefundMapper.xml
  14. * @description:
  15. * @author: Double
  16. * @create: 202506-26 11:28
  17. * @Version 1.0
  18. **/
  19. @RestController
  20. @RequestMapping("/refund")
  21. @RequiredArgsConstructor
  22. @Slf4j
  23. @CrossOrigin
  24. public class RefundController {
  25. @Autowired
  26. private RefundService refundService;
  27. //退款明细
  28. @PostMapping("/selectAll")
  29. public Result selcetAll(@RequestBody Page page) {
  30. try {
  31. if (ObjectUtils.isEmpty(page.getPageNum())) {
  32. return Result.error("页码数为空!");
  33. }
  34. if (ObjectUtils.isEmpty(page.getPageSize())) {
  35. return Result.error("页大小为空!");
  36. } else {
  37. return Result.success(refundService.selectAll(page.getPageNum(), page.getPageSize(), page.getRefundUser()));
  38. }
  39. } catch (Exception e) {
  40. return Result.error("请检查筛选数据的格式");
  41. }
  42. }
  43. //退款筛选
  44. @PostMapping("/selectBy")
  45. public Result selcetBy(@RequestBody Page page) {
  46. try {
  47. if (ObjectUtils.isEmpty(page.getPageNum())) {
  48. return Result.error("页码数为空!");
  49. }
  50. if (ObjectUtils.isEmpty(page.getPageSize())) {
  51. return Result.error("页大小为空!");
  52. } else {
  53. return Result.success(refundService.selectBy(page.getPageNum(), page.getPageSize(), page.getRefundUser()));
  54. }
  55. } catch (Exception e) {
  56. return Result.error("请检查筛选数据的格式");
  57. }
  58. }
  59. //退款金币统计
  60. @PostMapping("/statsGold")
  61. public Result statsGold(@RequestBody RefundUser refundUser) {
  62. try {
  63. Gold gold = refundService.statsGold(refundUser);
  64. return Result.success(gold);
  65. } catch (Exception e) {
  66. return Result.error("请检查数据的格式");
  67. }
  68. }
  69. //获取退款类型
  70. @PostMapping("/refundType")
  71. public Result getRefundType()
  72. {
  73. List<String> list = refundService.getRefundType();
  74. return Result.success(list);
  75. }
  76. //筛选产品
  77. @PostMapping("/selectGoods")
  78. public Result getSelectGoods(@RequestBody RefundUser refundUser)
  79. {
  80. List<RefundUser> list = refundService.selectGoods(refundUser.getJwcode());
  81. return Result.success(list);
  82. }
  83. //消耗金币增加
  84. @PostMapping("/add")
  85. public Result add(@RequestBody RefundUser refundUser) {
  86. try {
  87. return refundService.add(refundUser);
  88. } catch (Exception e) {
  89. return Result.error("请检查数据的格式");
  90. }
  91. }
  92. }