AccountDetailController.java 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. package com.tzld.piaoquan.api.controller;
  2. import com.tzld.piaoquan.api.job.GzhReplyVideoRefreshJob;
  3. import com.tzld.piaoquan.api.model.vo.GhDetailVo;
  4. import com.tzld.piaoquan.api.model.vo.GhTypeVo;
  5. import com.tzld.piaoquan.api.model.vo.StrategyStatusVo;
  6. import com.tzld.piaoquan.api.service.GhDetailService;
  7. import com.tzld.piaoquan.growth.common.common.base.CommonResponse;
  8. import com.tzld.piaoquan.growth.common.common.enums.GhTypeEnum;
  9. import com.tzld.piaoquan.growth.common.common.enums.StrategyStatusEnum;
  10. import com.tzld.piaoquan.growth.common.utils.page.Page;
  11. import lombok.extern.slf4j.Slf4j;
  12. import org.springframework.beans.factory.annotation.Autowired;
  13. import org.springframework.web.bind.annotation.*;
  14. import java.util.Arrays;
  15. import java.util.List;
  16. import java.util.stream.Collectors;
  17. @Slf4j
  18. @RestController
  19. @RequestMapping("/account")
  20. @CrossOrigin(origins = "*")
  21. public class AccountDetailController {
  22. @Autowired
  23. private GhDetailService ghDetailService;
  24. @Autowired
  25. private GzhReplyVideoRefreshJob gzhReplyVideoRefreshJob;
  26. @GetMapping("/getList")
  27. public CommonResponse<Page<GhDetailVo>> getAccountDetailList(@RequestParam(defaultValue = "1") Integer pageNum,
  28. @RequestParam(defaultValue = "20") Integer pageSize,
  29. @RequestParam(defaultValue = "") String accountId,
  30. @RequestParam(defaultValue = "") String accountName,
  31. @RequestParam(required = false) Long videoId) {
  32. return ghDetailService.getGhDetailList(pageNum, pageSize, accountId, accountName, videoId);
  33. }
  34. @PostMapping("/add")
  35. public CommonResponse<Void> addAccountDetail(@RequestBody GhDetailVo detailVo) {
  36. return ghDetailService.addGhDetail(detailVo);
  37. }
  38. @PostMapping("/update")
  39. public CommonResponse<Void> updateAccountDetail(@RequestBody GhDetailVo detailVo) {
  40. return ghDetailService.updateDetail(detailVo);
  41. }
  42. @PostMapping("/delete")
  43. public CommonResponse<Void> deleteAccountDetail(@RequestBody GhDetailVo detailVo) {
  44. return ghDetailService.deleteDetail(detailVo.getId());
  45. }
  46. @GetMapping("/types")
  47. public CommonResponse<List<GhTypeVo>> getAllAccountTypes() {
  48. return CommonResponse.success(Arrays.stream(GhTypeEnum.values())
  49. .map(ghTypeEnum -> new GhTypeVo(ghTypeEnum.type, ghTypeEnum.name))
  50. .collect(Collectors.toList()));
  51. }
  52. @GetMapping("/strategyStatus")
  53. public CommonResponse<List<StrategyStatusVo>> getAllStrategyStatus() {
  54. return CommonResponse.success(Arrays.stream(StrategyStatusEnum.values())
  55. .map(strategyStatusEnum -> new StrategyStatusVo(strategyStatusEnum.status, strategyStatusEnum.name))
  56. .collect(Collectors.toList()));
  57. }
  58. @GetMapping("/job/gzhReplyVideoRefreshJob")
  59. public CommonResponse<Void> gzhReplyVideoRefreshJob() {
  60. gzhReplyVideoRefreshJob.gzhReplyVideoRefreshJob(null);
  61. return CommonResponse.success();
  62. }
  63. @GetMapping("/job/syncGzhAutoreplyBehaviorUvTotalJob")
  64. public CommonResponse<Void> syncGzhAutoreplyBehaviorUvTotalJob() {
  65. gzhReplyVideoRefreshJob.syncGzhAutoreplyBehaviorUvTotalJob(null);
  66. return CommonResponse.success();
  67. }
  68. }