ScratchController.java 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. package com.punchsettle.server.service.controller;
  2. import com.punchsettle.server.common.valid.Save;
  3. import com.punchsettle.server.dto.scratch.ScratchDto;
  4. import com.punchsettle.server.dto.scratch.ScratchQuery;
  5. import com.punchsettle.server.service.manager.IScratchManager;
  6. import org.springframework.beans.factory.annotation.Autowired;
  7. import org.springframework.validation.annotation.Validated;
  8. import org.springframework.web.bind.annotation.PostMapping;
  9. import org.springframework.web.bind.annotation.RequestBody;
  10. import org.springframework.web.bind.annotation.RequestMapping;
  11. import org.springframework.web.bind.annotation.RestController;
  12. import java.util.List;
  13. /**
  14. * @author tyuio
  15. * @version 1.0.0
  16. * @description 刮刮乐 controller
  17. * @date 2024/12/13 21:57
  18. */
  19. @RestController
  20. @RequestMapping("/scratch")
  21. public class ScratchController {
  22. @Autowired
  23. private IScratchManager scratchManager;
  24. /**
  25. * 增加投入金额/中奖金额记录
  26. * @param dto
  27. */
  28. @PostMapping("/addScratchRecord")
  29. public void addScratchRecord(@RequestBody @Validated({Save.class}) ScratchDto dto) {
  30. scratchManager.addScratchRecord(dto);
  31. }
  32. /**
  33. * 撤销投入金额记录/中奖记录
  34. */
  35. @PostMapping("/revokeScratchRecord")
  36. public void revokeScratchRecord(@RequestBody @Validated({ScratchDto.Revoke.class})ScratchDto dto) {
  37. scratchManager.revokeScratchRecord(dto);
  38. }
  39. /**
  40. * 按时间范围查询刮刮乐记录
  41. */
  42. @PostMapping("/queryScratchRecord")
  43. public List<ScratchDto> queryScratchRecord(@RequestBody @Validated ScratchQuery query) {
  44. return scratchManager.queryScratchRecord(query);
  45. }
  46. }