package com.tzld.piaoquan.api.controller; import com.tzld.piaoquan.api.job.GzhReplyVideoRefreshJob; import com.tzld.piaoquan.api.model.vo.GhDetailVo; import com.tzld.piaoquan.api.model.vo.GhTypeVo; import com.tzld.piaoquan.api.model.vo.StrategyStatusVo; import com.tzld.piaoquan.api.service.GhDetailService; import com.tzld.piaoquan.growth.common.common.base.CommonResponse; import com.tzld.piaoquan.growth.common.common.enums.GhTypeEnum; import com.tzld.piaoquan.growth.common.common.enums.StrategyStatusEnum; import com.tzld.piaoquan.growth.common.utils.page.Page; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import java.util.Arrays; import java.util.List; import java.util.stream.Collectors; @Slf4j @RestController @RequestMapping("/account") @CrossOrigin(origins = "*") public class AccountDetailController { @Autowired private GhDetailService ghDetailService; @Autowired private GzhReplyVideoRefreshJob gzhReplyVideoRefreshJob; @GetMapping("/getList") public CommonResponse> getAccountDetailList(@RequestParam(defaultValue = "1") Integer pageNum, @RequestParam(defaultValue = "20") Integer pageSize, @RequestParam(defaultValue = "") String accountId, @RequestParam(defaultValue = "") String accountName, @RequestParam(required = false) Long videoId) { return ghDetailService.getGhDetailList(pageNum, pageSize, accountId, accountName, videoId); } @PostMapping("/add") public CommonResponse addAccountDetail(@RequestBody GhDetailVo detailVo) { return ghDetailService.addGhDetail(detailVo); } @PostMapping("/update") public CommonResponse updateAccountDetail(@RequestBody GhDetailVo detailVo) { return ghDetailService.updateDetail(detailVo); } @PostMapping("/delete") public CommonResponse deleteAccountDetail(@RequestBody GhDetailVo detailVo) { return ghDetailService.deleteDetail(detailVo.getId()); } @GetMapping("/types") public CommonResponse> getAllAccountTypes() { return CommonResponse.success(Arrays.stream(GhTypeEnum.values()) .map(ghTypeEnum -> new GhTypeVo(ghTypeEnum.type, ghTypeEnum.name)) .collect(Collectors.toList())); } @GetMapping("/strategyStatus") public CommonResponse> getAllStrategyStatus() { return CommonResponse.success(Arrays.stream(StrategyStatusEnum.values()) .map(strategyStatusEnum -> new StrategyStatusVo(strategyStatusEnum.status, strategyStatusEnum.name)) .collect(Collectors.toList())); } @GetMapping("/job/gzhReplyVideoRefreshJob") public CommonResponse gzhReplyVideoRefreshJob() { gzhReplyVideoRefreshJob.gzhReplyVideoRefreshJob(null); return CommonResponse.success(); } @GetMapping("/job/syncGzhAutoreplyBehaviorUvTotalJob") public CommonResponse syncGzhAutoreplyBehaviorUvTotalJob() { gzhReplyVideoRefreshJob.syncGzhAutoreplyBehaviorUvTotalJob(null); return CommonResponse.success(); } }